Archive

Archive for January, 2017

Emergency #Website recovery service – WebserverDown.com

Has your website been hacked?, has your server crashed?, lost your backups?

This service allows you recover your website instantly from a cached copy held at the Internet Archive. This allows you get an old version of your website back online while you fix the problem with your server.

Just the thing to have close at hand during a server emergency WebserverDown.com

HOW DOES THIS WORK?

 The Internet archive contains 279 Billion webpages, if one of them is your website, then it can be recovered.
  • After verifying that your website can be recovered we download the last working copy of your website from the Internet Archive
  • By changing the DNS settings on your domain to point to our server, rather than your broken server, then we serve a working copy of your website instead.
  • Once your server is back on-line, you change your DNS settings back, and you are back to normal

DNS Configuration

In order to direct traffic to the recovered website, then you will need to edit the DNS configuration of your domain to set your “www” CNAME record to point at host.webserverdown.com, This is typically done at the website where you bought your domain name, most common registrars are covered here.

 

Advertisement
Categories: Uncategorized

Reverse #VAT lookup app

screen696x696


 

Apple has just approved version 1.4 of our VAT App, which is available here;

https://itunes.apple.com/gb/app/vat/id524680827?mt=8&at=1000l9tW

It not only allows you to verify a VAT number, but also search for one based on the name of company, and/or a partial address. Thanks to http://www.vatapi.co.uk/  – an API we’ve created that lets you search automatically for company VAT numbers in most European countries.

Hope you like the app!

 

 

Categories: Uncategorized

Refused to load gap://ready #Phonegap #Cordova #CSP

screen-shot-2017-01-29-at-13-55-12
[Error] Refused to load gap://ready because it appears in neither the child-src directive nor the default-src directive of the Content Security Policy.

I noticed in an app I just updated, that the phonegap plugins were not working, (i.e. InAppBrowser), but deviceReady was getting called, so it it was ‘sort of’ working.

When I attached the remote debugger to the app from Safari I saw the error above in the console window being fired  over and over again.

The fix was to relax the CSP in the index.html, by adding

<meta http-equiv=”Content-Security-Policy” content=”default-src ‘self’ gap://ready file://* *; style-src ‘self’ ‘unsafe-inline’; script-src ‘self’ ‘unsafe-inline’ ‘unsafe-eval'”>

You have to make sure you only have one CSP meta tag, as it will only use the first one.

 

Categories: Uncategorized

Custom #HttpModule to respond to every #HTTP request.

356030_0209_4

Let’s say you wanted to create a HTTP endpoint that could respond with data that is completely generated from a c# class, and independent of the structure of the Url – for example, if you wanted to create a REST based HTTP API, that could accept a very flexible Url structure.

For example, perhaps a API that allowed it’s users to specify clauses in the URL, like yourapi.com/filter/a=5 or something like that.

Anyway, you create a class that implements IHTTPHandler as follows;

using System;
using System.Web;
public class CacheModule : IHttpModule
{
public void Init(HttpApplication application)
{
application.BeginRequest += application_BeginRequest;
}
static void application_BeginRequest(object sender, EventArgs e)
{
var application = (HttpApplication)sender;
var context = application.Context;
context.Response.Write(“<b>Cache Module</b> – Requested url:” + context.Request.Url);
HttpContext.Current.Response.Flush(); // Sends all currently buffered output to the client.
HttpContext.Current.Response.SuppressContent = true; // Gets or sets a value indicating whether to send HTTP content to the client.
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
public void Dispose() { }
}

Then you need to define this in the web.config;

<?xml version=”1.0″?>
<configuration>
<system.web>
<compilation debug=”true” targetFramework=”4.5″ />
<httpRuntime targetFramework=”4.5″ requestPathInvalidCharacters=”&lt;,&gt;,*,%,&amp;,:,\,?”/>
</system.web>
<system.webServer>
<modules>
<add name=”CacheModule” type=”CacheModule“/>
</modules>
</system.webServer>
</configuration>

Categories: Uncategorized

Framework CoreMedia not found error WatchOS / Cordova

screen-shot-2017-01-28-at-1-25-13-am

If you add a WatchOS project to a Cordova app, it may run, but when you compile it, it gives a Linker error saying that FrameWork CoreMedia is not found.
Here is a step-by-step instruction how to fix it:
 • In Bitcoin project -> Build Settings: Other Linker Flags, there are some flags like “-weak_framework AVFoundation“, “-weak_framework CoreMedia“, etc. Those settings will be inherited by all 3 targets: Bitcoin, Bitcoin Watch and Bitcoin Watch Extension.
Bitcoin target will need them, but Bitcoin Watch and Bitcoin Watch Extension is for watchOS, so it doesn’t have AVFoundation, CoreMedia… You must remove all flags, except -ObjC for those 2 targets. Just go to Build Settings -> Other Linker Flags of each target and delete unwanted flags (see attached image).
• All targets must have the same Version and Build number. And Build number should be integer like 1, 2, 3… instead of `1.1.1`. So I changed all targets version to 1.1.1 and build number to 1.
I also got this error below

screen-shot-2017-01-28-at-10-30-26

You have to make sure that all your icons for the WatchOS app (you drag the images into the Assets.XCassets file in XCode) match the required dimensions and are named WIDTHxHRIGHT@SCALEx.png. Make sure the images have no alpha channel, so export to web on Photoshop, and select No transparency, 8 bit PNG.

 

Categories: Uncategorized

Modify #IIS bindings from c#

iis

If you wanted to determine what host name an IIS website responded to dynamically, then you can use Microsoft.Web.Administration to do this. You need to run your application pool under localSystem privileges, so it’s perhaps not advisable to do on a public-facing website.  You can find the DLL at Windows\system32\inetsrv

This little POC page, lists all sites on my local dev IIS, and then adds a new random binding to a site named “localhost90”

using (ServerManager serverManager = new ServerManager())
{
foreach (var site in serverManager.Sites)
{
Response.Write(site.Name);

// add a random binding
if (site.Name == “localhost90”)
{
Random rnd = new Random();
int intRandomPort = rnd.Next(100, 1000);
Binding binding = site.Bindings.CreateElement(“binding”);
binding[“protocol”] = “http”;
binding[“bindingInformation”] = “:” + intRandomPort + “:”;
site.Bindings.Add(binding);
serverManager.CommitChanges();
}

Response.Write(“<br>”);
Response.Write(“<ul>”);
foreach (var binding in site.Bindings)
{
Response.Write(“<li>” + binding.EndPoint + “</li>”);
}
Response.Write(“</ul>”);

}
}

Categories: Uncategorized

Get a #Temporary #Email #Address, administered via an #API

tea

Categories: Uncategorized

Accept Bitcoin payments in your #App or #Website using BitcoinToBankAccount.com #API

BITCOIN TO BANK ACCOUNT API

An API to automate Bitcoin to BACS / SWIFT transfers.

 

INTRODUCTION

BitcoinToBankAccount.com offers a service where a payment made in bitcoin can be paid back out via BACS / SWIFT (Electronic bank transfer) for a low fixed fee, and within 24 hours. It uses Stripe as a payment processor.

This API allows your website or software accept bitcoin payments, by allowing the customer make a payment to a specified Bitcoin Wallet. Then once the payment has been verified, make the bank transfer back to your account, and then provide the service to the customer.

Since payments are asynchronous, you need to  poll on the wallet, to wait for the transaction to appear from the consumer. We recommend polling every 1 second for a maximum of 10 minutes.  

GETTING STARTED

The API endpoint is located at the following URL:

https://www.bitcointobankaccount.com/api/api.asmx

Ensure to use the “https” version of the API, since this ensures a level of security in the data being sent.

The steps involved are:

  • Call MakeTransfer with the amount of Bitcoin being paid, you will receive a Wallet and SessionID in return. You should ask the consumer to make a payment to the Bitcoin Wallet.

  • Call PollOnTransfer every second for up to 10 minutes, passing the SessionID returned from MakeTransfer, until a status of true is returned

  • Finally call MakeBankTransfer passing your Account number, Sort code, IBAN, and SWIFT/BIC code, and the SessionID as before. This will return true if the data is valid, the bank transfer will appear within 24 hours.

C# Example

  1. Create a new console application in Visual Studio

  2. Make a service reference to https://www.bitcointobankaccount.com/api/api.asmx call the reference “Bitcoin”

  3. Add the following code
using System;

using ConsoleApplication1.Bitcoin;
namespace ConsoleApplication1

{

   class Program

   {

       static void Main(string[] args)

       {

           var client = new apiSoapClient(“apiSoap”);

           var tx = client.MakeTransfer(0.1);

           Console.WriteLine(“Waiting for Bitcoin payment to wallet: ” + tx.Wallet);

           var isReady = false;

           for (var i = 0; i<600; i ++)

           {

               isReady = client.PollOnTransfer(tx.Session);

               if (isReady) break;

               System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1));

           }

           if (!isReady)

           {

               Console.WriteLine(“Bitcoin Payment not received”);

               return;

           }

           Console.WriteLine(“Bitcoin Payment received and verified”);

           var isOK = client.MakeBankTransfer(“82982675”, “904974”, “IE4482982675904974”, “BOFII2D”, tx.Session);

           if (isOK)

           {

               Console.WriteLine(“Bank Transfer Made”);

           }

           else

           {

               Console.WriteLine(“Bank transfer failed, please check account details”);

           }

       }

   }

}

Fees

There is a fixed fee per transaction, which is deducted before the bank transfer is made, the currency is deduced from the destination bank account.

Currency

Fee

USD 0.6
ISK 70
HKD 5
TWD 19
CHF 0.60
EUR 0.55
DKK 4
CLP 8
CAD 0.80
CNY 4
 THB 21
AUD 0.80
SGD 0.80
KRW 726
JPY 70
PLN 2
GBP 0.50
SEK 5
NZD 0.80
BRL 2
RUB 36

Categories: Uncategorized

Transfer #Bitcoin to #Bank Account using #stripe

screen-shot-2017-01-20-at-21-54-55

Almost there … https://www.bitcointobankaccount.com/ – It’s a new site that uses stripe to transfer between a bitcoin wallet and a real-life bank account.

For once I’m not sharing the code … since I think this could be big 🙂

Categories: Uncategorized

Post a #YouTube video to #Facebook via C#

yt

This post demonstrates how to post Video content to a Facebook page automatically, for example on https://www.facebook.com/Petrucci-Sheet-Music-1109694145794629/ – Here I am assuming you have a Faceook page set up, you know it’s Page Id, and you have a long-lived access token, and an API Key for Google, with the YouTube API enabled.

Install the Youtube Nuget package using

Install-Package Google.Apis.YouTube.v3

Then add this code to get videos;

private static SearchListResponse GetVideos(string searchTerm)
{
var youtubeService = new YouTubeService(new BaseClientService.Initializer()
{
ApiKey = “{{API key}}”,
ApplicationName = “Test Application”
});

var searchListRequest = youtubeService.Search.List(“snippet”);
searchListRequest.Q = searchTerm;
searchListRequest.MaxResults = 50;
searchListRequest.Type = “video”;

// Call the search.list method to retrieve results matching the specified query term.
var searchListResponse = searchListRequest.Execute();
return searchListResponse;
}

Then this code to post to facebook

static async Task PostToFacebookAsync(string searchTerm, string accessToken, string pageId, string suffix)
{
// Use HttpClient
using (var client = new HttpClient())
{
// Set variable values for post to facebook
string uri = string.Format(“https://graph.facebook.com/{0}/feed?”, pageId);

var results = GetVideos(searchTerm);
var rand = new Random();
var result = results.Items[rand.Next(results.Items.Count)];

var strName = HttpUtility.UrlEncode(result.Snippet.Title + ” ” + result.Snippet.Description + suffix);
var strLink = HttpUtility.UrlEncode(“http://youtu.be/&#8221; + result.Id.VideoId);
// Formulate querystring for graph post
StringContent queryString = new StringContent(“access_token=” + accessToken + “&message=” + strName + “&link=” + strLink);

// Post to facebook /{page-id}/feed edge
HttpResponseMessage response = await client.PostAsync(new Uri(uri), queryString);
if (response.IsSuccessStatusCode)
{
// Get the URI of the created resource.
string postId = await response.Content.ReadAsStringAsync();
Console.WriteLine(“Post Successfully: Your Post ID is: {0}”, postId);

}
else
{
string postId = await response.Content.ReadAsStringAsync();
Console.WriteLine(“Something Going Wrong”);

}
}
}

and you call it like so;

PostToFacebookAsync(strSearchTerm, strAccessToken, strPageId, strSuffix).Wait();

Categories: Uncategorized
%d bloggers like this: