Process #creditcard payments via an #iPhone or #iPad app, via #Stripe / @cardio

Process credit card payments via an iPhone or iPad app, via Stripe using this app

https://itunes.apple.com/us/app/credit-card-payment/id1245576958?mt=8

Once you open the app, you are prompted to create a new Stripe Account, or connect to an existing account. Once done, you simply enter the amount, currency and the customer’s credit card details, to get paid into your Stripe account. Once in your stripe account, they will make bank transfers out to your bank account.

The app was developed in Cordova / Ionic – and the feature for scanning the credit cards is using the CardIO plugin. The back-end is in ASP.NET over HTTPS, and there is no database connected to it, so no data is stored about the transactions on our servers (Although stripe has this info)

Categories: Uncategorized

Using the @OpenSubtitles API in C#

Open Subtitles is a great online resource for finding subtitles for movies online, and you can also interact with it programmatically using their XML-RPC API – but it’s quite complex, so it’s best to start with a pre-built library.

I went for this library on SourceForge – https://sourceforge.net/projects/opensubdotnet/

it had a demo console app that works out of the box, but you should register your own user agent with OpenSubtitles, so they know who you are.

I needed a two step process for my app – which you can download on iTunes here:

https://itunes.apple.com/gb/app/open-subtitles/id522825951?mt=8

The first was to make a search for movies by name; which you can do using the opensubdotnet library below;

 

 

OSDotNetSession session = OSDotNetSession.LogIn(“”, “”, “en”, “**YOUR USER AGENT HERE**”);

List<SearchSubtitleResult> List = session.SearchByQuery(Request.QueryString[“film”]);

 

Then, once you get that list of films, with language variations, you can ask the user to select one, you can get the download link at this stage, however, if you need to do any server processing of the subtitles, then you can’t just download this and unzip it, since OpenSubtitles will block your server for not being a human (a captcha)

But, I get the IMDB ID and Subtitle File at this stage, and pass it through to the next step

OSDotNetSession session = OSDotNetSession.LogIn(“”, “”, “en”, “**YOUR USER AGENT HERE**”);
List<SearchSubtitleResult> List = session.SearchByImdbId(strImdb);
SearchSubtitleResult selected = List.First(f => f.IDSubtitleFile == strSubtitleID);
MemoryStream mem = session.DownloadSubtitle(selected);
string strLang = selected.ISO639.ToLower();
Encoding enc = Encoding.GetEncoding(“iso-8859-1″);
if (strLang==”he”) enc = Encoding.GetEncoding(“iso-8859-8″);
if (strLang==”el”) enc = Encoding.GetEncoding(“iso-8859-7″);
if (strLang==”ar”) enc = Encoding.GetEncoding(“iso-8859-6”);
StreamReader sr = new StreamReader(mem,enc);
string strText = sr.ReadToEnd();

 

Note that you need to be careful with text encodings here. The text is not necessarily going to be in the latin (i.e. english) alphabet. So I have made exceptions here for Hebrew (he), Greek (el) and Arabic (ar). This should be extended for Chinese, Korean, Japanese, Russian, Thai, Hindu, Georgian etc., but if anyone wants to complete that list, please comment below.

 

 

 

Categories: Uncategorized

#OCR #API webservice designed for C# / .NET

ocr

Converting images to text has long been quite a difficult task for computers to perform, since it requires a type of fuzzy-logic, where things are not exact or precise.

We’ve developed a OCR web service, where you can submit a image either as a base-64 encoded string, or as a URL to an image that is hosted somewhere online.  – by default, it is set to recognise one line of text (not a page), but you can change that via the extraArguments, psm settings.

Check out the new API at http://ocr.apixml.net

And for those who don’t want to read, here’s how to make a GET request to the API:

GET /ocr.asmx/ProcessUrl?url=string&extraArguments=string HTTP/1.1
Host: ocr.apixml.net

 

Categories: Uncategorized

Developer Test devices for sale #Ebay #Testing

Categories: Uncategorized

Convert a number to a custom base in C# #Maths

b10

We naturally count in base 10 (decimal), and if you do some programming, then you’ll be familiar with base 2 (binary), and base 16 (hex).

So, what about if you wanted to make your own custom base, like base 36 or base 25?, here’s some code to covert a custom base (base36) to decimal and back again

private static int ConvertToBaseAlpha(string alpha)
{
string strBase = “ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890”;
int intValue = 0;
int intPower = 1;
foreach(char c in Enumerable.Reverse(alpha.ToCharArray()))
{
var intPosValue = strBase.IndexOf(c);
intValue += intPosValue * intPower;
intPower *= strBase.Length;
}
return intValue;
}

private static string ConvertFromBaseAlpha(double alpha)
{
string strBase = “ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890”;
string strValue = “”;
int intPower = strBase.Length;
while((int)alpha!=0)
{
var intMod = (int)(alpha % intPower);
alpha /= intPower;
strValue = strBase.Substring(intMod, 1) + strValue;
}
return strValue;
}

Categories: Uncategorized

#Fax Off! app for #iOS using @ionic @cordova @filestack @twilio

Categories: Uncategorized

Send #Faxes via #API using C# @Twilio

fax-machine-component1

Faxes are still an old technology, and to be honest, I fail to understand how some companies still require them for certain authenticated (signed) documents. There are numerous services online that provide paid-for faxes, like sendfaxes.co.uk 

However, I saw that Twilio offers a FAX API, so if you wanted to add the functionality to your C# application, then here’s some sample code;

const string username = “xxxxx”;
const string password = “zzzzzz”;

var strUrl = “https://fax.twilio.com/v1/Faxes&#8221;;
strUrl = string.Format(strUrl, username);
var wc = new WebClient();
wc.Headers[“Content-Type”] = “application/x-www-form-urlencoded”;
var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(username + “:” + password));
wc.Headers[HttpRequestHeader.Authorization] = string.Format(
“Basic {0}”, credentials);

var strResponse = wc.UploadString(strUrl, “To=%2B” + strToNumber +
“&From=%2B” + strFromNumber +
“&MediaUrl=” + strFax);

I tested this against FaxBurner, in order to get a temporary FAX number, and after about 2 minutes the fax arrived.

The Fax I sent was this: http://www.xmlpdf.com/manualfiles/hello-world.pdf – and it arrived in a similar format, but with the grey turned into a pattern of dots, since Faxes are monochrome. (as below)

b4

It is worth noting that during the 2 minutes when the FAX was being sent, it was possible to poll on Twilio for a status update, by calling the url with authentication, and with the SID returned in the JSON – https://fax.twilio.com/v1/Faxes\/{sid}

The status property of the JSON moved from “queued” to “sending” then finally “delivered” – i.e.

{
“media_sid”: “ME88a43ed8bdf1ddc9dbce3914ceeee7f3”,
“status”: “delivered”,
“direction”: “outbound”,
“from”: “+16193332636”,
“date_updated”: “2017-05-25T11:09:29Z”,
“price”: “-0.035”,
“account_sid”: “AC84d144631d43d12966be8c03e2c6a640”,
“to”: “+18668158879”,
“date_created”: “2017-05-25T11:04:20Z”,
“url”: “https:\/\/fax.twilio.com\/v1\/Faxes\/FXa6503014cfdc71509b9bf9f02cc7976a”,
“sid”: “FXa6503014cfdc71509b9bf9f02cc7976a”,
“duration”: 286,
“num_pages”: 1,
“quality”: “fine”,
“price_unit”: “USD”,
“api_version”: “v1”,
“media_url”: “https:\/\/media.twiliocdn.com\/fax\/AC84d144631d43d12966be8c03e2c6a640\/e5225a49644c2edd383baa803b4db3a2061c7301cdea8b2b600568b5adfa16b326c345334b0b0a8100a5fc608fa58ab330b365830df5308a84a2ec78bc924137?x-amz-security-token=FQoDYXdzEOr%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDHhP4wXa%2F%2BYky2StOCK3A2efy0tyDbg1GlWUU58EVMiK8arQIwL8MuNF0RkNNjeQ7OhI5rEJ8Jt3Gm59qYbBTpS7Ay9RmVNkePDTc19I96r16IZQzBR3G1zlZ4rhZE%2BORofirA3qv2lopLvokhyHj8UNtXMZ73pvWaJ32fcXmvbpkbgc50O8Mjuah84D5pc2w1nI0WlhCQB5btB9bvL5gbavI2ZbHKodUpgA%2FrQilGtEn7fXeO4S4J07Vp5o4LRSzFH7K3HWfgRdZxo3GYxKZqm6WCiR8qk2JQubBNbqJByY4Wb6R4a39OykpkZHPcr6gllDFqrF0fV%2B4%2FyWeukGfvEaEN332LZGJ%2BZj6hLyAWrG5vNtDZNvDr%2BoSwssnXhiu7wQn7syqs6WVCxy5KnmRi6c3PNvsAgAL6RkI%2F2alN7hxexVMxN%2BhnDmuT6c2Wb%2FtEFXJwIxOd1vMWgVIVDX%2FORrxyugIpcyNyDLghRm8cMtCKeED12TpGIdpbHQLPZTBpObPyRluJ4ZYOQkcGfRoFrJxdBPayRawTlLOBaKfY23yMzwWkH9cQKHlvXTGDy6MBrjb3wEVwHu5C4B1WndHIpSfKXPaAMotL%2BayQU%3D&AWSAccessKeyId=ASIAJH4JX2XKGVNEIEFA&Expires=1495717784&Signature=erQay6zd%2BzjBjYGxtf5BoHIiJMo%3D”,
“links”: {
“media”: “https:\/\/fax.twilio.com\/v1\/Faxes\/FXa6503014cfdc71509b9bf9f02cc7976a\/Media”
}
}

 

 

Categories: Uncategorized

#REST based #API open for feedback

Beta REST API reference

Overview

The REST Beta API is a JSON based API that accepts basic HTTP authentication for user identification.  This API is still in BETA, and is therefore open for discussion and feedback from our users, but also may be changed without warning. If you would like to use this API in production, please let us know.

The format of the REST URL is as follows:

https://www.regcheck.org.uk/api/json.aspx/{Method}/{Parameter1}/{Parameter2}

Where {Method} is one of the following options;

CarSpecifications
Get static data based on a make, model and year of a car

Check
Get details for a vehicle in the UK

CheckAustralia
Get details for a vehicle in Australia

CheckBelgium
Get details for a vehicle in Belgium

CheckCroatia
Get details for a vehicle in Croatia

CheckCzechRepublic
Get details for a vehicle in the Czech Republic

CheckDenmark
Get details for a vehicle in Denmark

CheckEstonia
Get details for a vehicle in Estonia

CheckFinland
Get details for a vehicle in Finland

CheckFrance
Get details for a vehicle in France

CheckHungary
Get details for a vehicle in Hungary

CheckIndia
Get details for a vehicle in India

CheckIreland
Get details for a vehicle in Ireland

CheckItaly
Get details for a vehicle in Italy

CheckMotorBikeUK
Get details for a motorbike in the UK

CheckNetherlands
Get details for a vehicle in the Netherlands

CheckNewZealand
Get details for a vehicle in New Zealand

CheckNorway
Get details for a vehicle in Norway

CheckPakistan
Get details for a vehicle in Pakistan

CheckPortugal
Get details for a vehicle in Portugal

CheckRussia
Get details for a vehicle in Russia

CheckSlovakia
Get details for a vehicle in Slovakia

CheckSouthAfrica
Get details for a vehicle in South Africa

CheckSpain
Get details for a vehicle in Spain

CheckSriLanka
Get details for a vehicle in Sri Lanka

CheckSweden
Get details for a vehicle in Sweden

CheckUAE
Get details for a vehicle in United Arab Emirates

CheckUSA
Get details for a vehicle in the USA

UKMOT
Get MOT (Vehicle test) data for a car in England, Scotland or Wales

VinCheck
Get details for a vehicle based on its VIN number

WheelSize
Get Wheel size data based on a make, model and year of a car

So a sample request for a search on plate YYO7XHH in the UK would be:

https://www.regcheck.org.uk/api/json.aspx/Check/YYO7XHH

Which would return the following JSON

{
 “ABICode”: “39049602”,
 “Description”: “2007 Peugeot 307 X-line, 1360CC Petrol, 5DR, Manual”,
 “RegistrationYear”: “2007”,
 “CarMake”: {
   “CurrentTextValue”: “Peugeot”
 },
 “CarModel”: {
   “CurrentTextValue”: “307”
 },
 “EngineSize”: {
   “CurrentTextValue”: “1360CC”
 },
 “FuelType”: {
   “CurrentTextValue”: “Petrol”
 },
 “MakeDescription”: “Peugeot”,
 “ModelDescription”: “307”,
 “Immobiliser”: {
   “CurrentTextValue”: “”
 },
 “NumberOfSeats”: {
   “CurrentTextValue”: 5
 },
 “IndicativeValue”: {
   “CurrentTextValue”: “”
 },
 “DriverSide”: {
   “CurrentTextValue”: “RHD”
 },
 “Transmission”: {
   “CurrentTextValue”: “Manual”
 },
 “NumberOfDoors”: {
   “CurrentTextValue”: “5”
 },
 “ImageUrl”: “http:\/\/www.regcheck.org.uk\/image.aspx\/@UGV1Z2VvdCAzMDc=”,
 “VehicleInsuranceGroup”: “04”
}

 

Exceptions:

Certain REST API calls require more than one parameter, and these are as follows;

CarSpecifications

This is called in the format Make / Model / Year, for example;

https://www.regcheck.org.uk/api/json.aspx/CarSpecifications/Honda/Civic/2014

CheckAustralia

This is called in the format Registration Number / State, for example:

https://www.regcheck.org.uk/api/json.aspx/CheckAustralia/CEC36T/NSW

CheckUSA

This is called in the format Registration Number / State, for example:

https://www.regcheck.org.uk/api/json.aspx/CheckUSA/jxv7422/pa

CheckPakistan

This is called in the format Registration Number / State / District, for example:

https://www.regcheck.org.uk/api/json.aspx/CheckPakistan/STR%206006/PB/Pathankot

UKMOT

This is called in the format Registration Number / Make, for example:

https://www.regcheck.org.uk/api/json.aspx/UKMOT/DE02VOV/PEUGEOT

VinCheck

This is called with a VIN number instead of a registration number. for example;

https://www.regcheck.org.uk/api/json.aspx/VinCheck/5XYZT3LB9FG259411

WheelSize

This is called in the format Make / Model / Year, for example;

https://www.regcheck.org.uk/api/json.aspx/WheelSize/Ford/Focus/2014

 

Categories: Uncategorized

Enter card details using camera @cardio #cordova #phonegap

cardio

Entering a 16 digit number into an app is error prone, and can frustrate a user right at the point of purchase. There is a really cool Cordova / Phonegap plugin that allows you scan a credit card using the camera, so you can input it into the page, without the user having to type.

Although the plugin is developed by paypal, you can use it with other PSPs, like stripe, – and since the processing is done on-device, there is no transmission of sensitive data.

You add the plugin to your project using:

cordova plugin add https://github.com/card-io/card.io-Cordova-Plugin

Then you call it in Javascript with code such as;

CardIO.scan({
“requireExpiry”: true,
“requireCVV”: true,
“requirePostalCode”: false,
“restrictPostalCodeToNumericOnly”: true
},
function(response){

$scope.form.CardNumber = parseInt(response[“cardNumber”]);
var dtExpiry = new Date(response[“expiryYear”], response[“expiryMonth”], 1);
$scope.form.CardExpiry = dtExpiry;
$scope.form.CardCvv = parseInt(response[“cvv”]);
$scope.$apply();
},
function(){
sweetAlert(“Oops…”, “Your card scan has failed”, “error”);
}
);

Categories: Uncategorized

Adding a #URL to #Google just got easier #SEO

addurl

Step 1 of any SEO exercise is to add the URL to google; now you just can just search in the address bar, add URL to Google, and just add it below, without leaving the Google search.

Sure, Google will find your new website in a few days as long as you are doing “some” sort of off-page SEO activity; but this is the fast-track.

If you are planning to target Chinese users you’ll need to submit to Baidu also; and a couple of other minor search engines in China – for this I’d recommend using a service on fiverr to do this, since it is difficult to follow the procedure without knowing chinese.

Similarly, if you want to target the Russian market you will need to submit to Yandex. This has an english version, and you can get by without knowing any russian.

Just for context, I was relaunching two indian sites; http://india.appaio.com and http://india.listofcardealers.info

Categories: Uncategorized