Archive

Archive for October, 2017

Set up #Sage on a remote #server

sage

If you have multiple users on Sage, who are not on the same network – i.e. perhaps working from home. Then you will want to move the sage data to a remote server, so that all users can access the same sage data.

  1. Rent a WINDOWS server. a VPS should do, OVH do one for £9/month
  2. Set up an VPN to the windows server. Not so easy, glossing over this point
  3. Close Sage, and copy the Company.000 folder to the server, and share it with a network share
  4. Ensure you can see this folder from Windows explorer with \\[Server]\[Share]\Company.000
  5. Now, install the Sage Data Services software on the server. You can download this as part of the trial software from Sage, or just here 
  6. Find the COMPANY file on your local machine, and open it in notepad, and change the C:\programdata\…\Company.000 file to \\[Server]\[Share]\Company.000
  7. Re-open Sage

 

Categories: Uncategorized

Accepting a once off #creditcard #payment in #Stripe

This slideshow requires JavaScript.

So, if you use Stripe on your website, but you get the odd request from a customer that’s not a standard option of your website. How do you accept a once-off custom payment via stripe, we have an app for that, which you can download here; https://creditcard.apixml.net/

But, if you’d like to use your browser rather than an app, you can do that too. Go to https://creditcard.apixml.net/

  • Click on “Accept a payment online”
  • Click on “Sign on” on the stripe window
  • Enter your stripe username and password.
  • Press “Sign into your account”
  • The window will close, and return to the previous page, with a popup open
  • Enter the amount, currency, and card details into the box provided
  • Then press “Pay now”
  • You should then see an alert saying the payment has succeeded after a few seconds
  • The money is now in your stripe account.
Categories: Uncategorized

Verify an #Irish #Taxi number plate via an #API

taxi

If you wanted to create an app that allows commuters in Ireland feel safe getting into a Taxi, you can use this API to check if the taxi is legitimately registered. (And it’s free)

Here’s the API endpoint;

http://ie.carregistrationapi.com/api/bespokeapi.asmx?op=CheckIrishTaxi

And here is a sample response from 05MH6068

<LicenceNumber>T30041</LicenceNumber>
<Expiry>09/02/2018</Expiry>
<LicenceHolder>PATRICK GERAGHTY</LicenceHolder>
</IrishTaxi>

This may be built into the main API available here; http://ie.carregistrationapi.com

Categories: Uncategorized

Verify a #Taxi is registered with #TFL via an #API

taxi-b1-exam

You can now verify if a car is registered for private hire via it’s number plate in London via TFL, and here’s a handy API for it here;

https://www.regcheck.org.uk/api/bespokeapi.asmx?op=CheckLondonTaxi

You can use LM58FXO as an example, returning;

FORD
Galaxy
360345
11/12/2017

This is an experimental service, in consideration for RegCheck.org.uk , or as a tool for http://listoftaxis.info/

Categories: Uncategorized

Check for #recalled vehicles via #VIN #NHTSA

nhtsa-brand

NHTSA, the “National Highway Traffic Safety Administration”, which allows users the option to search for vehicle recalls by manufacturers, where a serious safety flaw is discovered.

You can query this API for free via this URL;

http://www.vehicleregistrationapi.com/api/bespokeapi.asmx/CheckRecalledVIN?vin=JTHCE96S170011951

Where JTHCE96S170011951 is a VIN number for a vehicle that is subject to recall.

This is an experimental data source, but could be used in conjunction with data from  http://www.vehicleregistrationapi.com/  to determine recalls based on a car registration number.

The format of the data returned is as follows;

{
“status”: true,
“number_of_recalls”: 5,
“make”: “LEXUS”,
“vin”: “JTHCE96S170011951”,
“refresh_date”: “Oct 11,2017”,
“year”: “2007”,
“recalls”: [
{
“mfr_recall_number”: “ELF”,
“mfr_recall_status”: 11,
“mfr_notes”: “”,
“safety_risk_description”: “In the presence of an ignition source, this could increase the risk of a vehicle fire.”,
“recall_description”: “In the subject vehicles, the sealing property of the gasket seated in between the pressure sensor and the fuel delivery pipe could become degraded. During vehicle operation, fuel could leak past the gasket.”,
“remedy_description”: “Any authorized Lexus dealership will repair the fuel pressure sensor sealing surface and replace the gasket at No Charge to you.”,
“refresh_date”: “Oct 11,2017”,
“nhtsa_recall_number”: “14V647”,
“recall_date”: “Oct 15,2014”
},
{
“mfr_recall_number”: “DLG”,
“mfr_recall_status”: 11,
“mfr_notes”: “”,
“safety_risk_description”: “The loose bolts could cause the vvt gear housing and sprocket to separate and result in the engine stopping while the vehicle is being driven, increasing the risk of a crash.”,
“recall_description”: “Toyota is recalling certain model year 2007-2011 lexus gs350 vehicles manufactured june 19, 2006, through july 12, 2011; and model year 2006-2011 lexus is350 vehicles manufactured may 27, 2005, through july 13, 2011; and model year 2010-2011 lexus is350c vehicles manufactured november 25, 2009, through july 19, 2011. These vehicles, equipped with the 2gr-fse engine, use bolts to secure the housing and sprocket of the variable-valve timing (vvt) system gear assembly. These bolts could become loose due to abnormal impacts generated within the gear assembly immediately after a cold start-up.”,
“remedy_description”: “Toyota will notify owners, and lexus dealers will replace the vvt unit free of charge. Owners may contact Toyota at 1-800-331-4331.”,
“refresh_date”: “Oct 11,2017”,
“nhtsa_recall_number”: “13V395”,
“recall_date”: “Sep 04,2013”
},
{
“mfr_recall_number”: “BLA”,
“mfr_recall_status”: 11,
“mfr_notes”: “”,
“safety_risk_description”: “Fuel leakage, in the presence of an ignition source, could result in a fire.”,
“recall_description”: “Toyota is recalling certain model year 2006-2009 Lexus IS and model year 2006-2007 Lexus GS vehicles. Due to insufficient tightening of the fuel pressure sensor connected to an engine fuel delivery pipe with nickel phosphorus plating, there is a possibility that, over time, the pressure sensor could loosen. If loosening occurs, fuel could leak past a gasket used in the connection between the sensor and the pipe and through the threaded portion of the sensor.”,
“remedy_description”: “Dealers will inspect for fuel leakage from the threaded portion of the fuel pressure sensor and if a fuel leak is not confirmed, dealers will further tighten the fuel pressure sensor with the proper torque. If a fuel leak is confirmed, the gasket between the sensor and the fuel deliver pipe will be replaced with a new one, and the sensor will be tightened with the proper torque. This service will be performed free of charge. The safety recall began on march 7, 2011. Owners may contact Toyota at 1-800-331-4331.”,
“refresh_date”: “Oct 11,2017”,
“nhtsa_recall_number”: “11V029”,
“recall_date”: “Jan 26,2011”
},
{
“mfr_recall_number”: “ALE”,
“mfr_recall_status”: 11,
“mfr_notes”: “”,
“safety_risk_description”: “The engine could fail and stop suddenly while the vehicle is in motion, increasing the risk of a crash.”,
“recall_description”: “Lexus is recalling certain Model Year 2006 through 2008 Lexus passenger cars manufactured from August 26, 2005 through August 4, 2008. Micro-foreign objects in the material of the valve spring may degrade the strength of the valve spring, possibly causing the spring to break.”,
“remedy_description”: “Lexus will notify owners and dealers will repair the vehicles free of charge. The safety recall began on September 2, 2010. Owners may contact Lexus at 1-800-255-3987.”,
“refresh_date”: “Oct 11,2017”,
“nhtsa_recall_number”: “10V309”,
“recall_date”: “Jul 06,2010”
},
{
“mfr_recall_number”: “9LA”,
“mfr_recall_status”: 11,
“mfr_notes”: “”,
“safety_risk_description”: “Over time, the corrosion may create a pinhole resulting in fuel leakage. Fuel leakage, in the presence of an ignition source, could result in a fire.”,
“recall_description”: “Toyota is recalling 214,570 Model Year 2006-2008 Lexus IS, Model Year 2006-2007 GS and Model Year 2007-2008 lS passenger vehicles equipped with aluminum fuel delivery pipes (fuel rails). Ethanol fuels with a low moisture content will corrode the internal surface of the fuel rails. As this condition progresses, the engine malfunction indicator light may illuminate.”,
“remedy_description”: “Dealers will inspect and replace the fuel delivery pipes free of charge. Owners may contact Toyota\/Lexus at 1-800-255-3987.”,
“refresh_date”: “Oct 11,2017”,
“nhtsa_recall_number”: “09V020”,
“recall_date”: “Jan 16,2009”
}
],
“manufacturer_id”: 164,
“recalls_available”: true,
“model”: “GS350”
}

Categories: Uncategorized

Handling #IAP #Subscription #Cancellations

Screen-Shot-2015-05-23-at-12.45.42-PMIAP Subscriptions are great, they allow you take recurring payments from your customers, so that you can make an on-going income from a customer that continues to use your service.

However, accepting a subscription, it’s also important to know when the subscription is cancelled, so that you can stop providing your service to the customer.

First thing is to define a callback with the “Subscription Status Url”, which you can find under your app in iTunes Connect, under App Information > General Information.

This URL will be sent some JSON data using HTTP POST, and the format of the requests are as follows;

First, the Intial buy, as follows;

{
“latest_receipt”: “….”,
“latest_receipt_info”: {
“original_purchase_date_pst”: “2017-10-14 18:51:38 America\/Los_Angeles”,
“quantity”: “1”,
“unique_vendor_identifier”: “025C068A-ABA3-4967-BC20-82C397CA6E1A”,
“original_purchase_date_ms”: “1508032298000”,
“expires_date_formatted”: “2017-11-15 02:51:34 Etc\/GMT”,
“purchase_date_ms”: “1508032294000”,
“expires_date_formatted_pst”: “2017-11-14 18:51:34 America\/Los_Angeles”,
“is_trial_period”: “false”,
“item_id”: “1215609502”,
“unique_identifier”: “aae666d4899834762d29b57272c10400256ba0dc”,
“original_transaction_id”: “240000386052948”,
“expires_date”: “1510714294000”,
“app_item_id”: “1214710746”,
“transaction_id”: “240000386052948”,
“bvrs”: “1.3.3”,
“web_order_line_item_id”: “240000089571027”,
“version_external_identifier”: “822490968”,
“bid”: “ie.infiniteloop.cloudansweringmachine”,
“product_id”: “CloudAnsweringMachineSubscription”,
“purchase_date”: “2017-10-15 01:51:34 Etc\/GMT”,
“purchase_date_pst”: “2017-10-14 18:51:34 America\/Los_Angeles”,
“original_purchase_date”: “2017-10-15 01:51:38 Etc\/GMT”
},
“environment”: “PROD”,
“auto_renew_status”: “true”,
“password”: “f1d192a81bc746da837639012d3917b3”,
“auto_renew_product_id”: “CloudAnsweringMachineSubscription”,
“notification_type”: “INITIAL_BUY”
}

Then if the customer cancels the subscription, then the request would be as follows;

{
“environment”: “PROD”,
“auto_renew_status”: “false”,
“web_order_line_item_id”: “240000089571027”,
“latest_expired_receipt_info”: {
“original_purchase_date_pst”: “2017-10-14 18:51:38 America\/Los_Angeles”,
“cancellation_date_ms”: “1508089204000”,
“quantity”: “1”,
“cancellation_reason”: “0”,
“unique_vendor_identifier”: “025C068A-ABA3-4967-BC20-82C397CA6E1A”,
“original_purchase_date_ms”: “1508032298000”,
“expires_date_formatted”: “2017-11-15 02:51:34 Etc\/GMT”,
“purchase_date_ms”: “1508032294000”,
“expires_date_formatted_pst”: “2017-11-14 18:51:34 America\/Los_Angeles”,
“is_trial_period”: “false”,
“item_id”: “1215609502”,
“unique_identifier”: “aae666d4899834762d29b57272c10400256ba0dc”,
“original_transaction_id”: “240000386052948”,
“expires_date”: “1510714294000”,
“app_item_id”: “1214710746”,
“transaction_id”: “240000386052948”,
“bvrs”: “1.3.3”,
“web_order_line_item_id”: “240000089571027”,
“version_external_identifier”: “822490968”,
“bid”: “ie.infiniteloop.cloudansweringmachine”,
“cancellation_date”: “2017-10-15 17:40:04 Etc\/GMT”,
“product_id”: “CloudAnsweringMachineSubscription”,
“purchase_date”: “2017-10-15 01:51:34 Etc\/GMT”,
“cancellation_date_pst”: “2017-10-15 10:40:04 America\/Los_Angeles”,
“purchase_date_pst”: “2017-10-14 18:51:34 America\/Los_Angeles”,
“original_purchase_date”: “2017-10-15 01:51:38 Etc\/GMT”
},
“cancellation_date_ms”: “1508089204000”,
“latest_expired_receipt”: “………………….”,
“cancellation_date”: “2017-10-15 17:40:04 Etc\/GMT”,
“password”: “f1d192a81bc746da837639012d3917b3”,
“cancellation_date_pst”: “2017-10-15 10:40:04 America\/Los_Angeles”,
“auto_renew_product_id”: “CloudAnsweringMachineSubscription”,
“notification_type”: “CANCEL”
}

This example is taken from the app, CloudAnsweringMachine.com

Categories: Uncategorized

Enabling #CORS on #ASMX .NET #Webservices

240_F_130789368_w0TYy56XPpuDn0pfgXvgG3ZmfWUZenCQ

If you would like your clients / users interface with your ASMX .NET webservice directly from Javascript, then you should enable CORS, to allow them do so without using server-side code.

To do so, you add a Global.asax file and add the code;

protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext.Current.Response.AddHeader(“Access-Control-Allow-Origin”, “*”);
if (HttpContext.Current.Request.HttpMethod == “OPTIONS”)
{
HttpContext.Current.Response.AddHeader(“Access-Control-Allow-Methods”, “GET, POST”);
HttpContext.Current.Response.AddHeader(“Access-Control-Allow-Headers”, “Content-Type, Accept”);
HttpContext.Current.Response.AddHeader(“Access-Control-Max-Age”, “1728000”);
HttpContext.Current.Response.End();
}
}

Then, it’s possible for your clients to use Javascript code (with JQuery) such as the following to interface directly with your webservice:
(This code example is for AvatarAPI.com )

$(init);
function init()
{
AvatarAPI(“your.email@gmail.com”,function(profile){
if (profile.Valid == “false”)
{
profile.Image = “https://t4.ftcdn.net/jpg/01/30/78/93/240_F_130789368_w0TYy56XPpuDn0pfgXvgG3ZmfWUZenCQ.jpg&#8221;;
profile.Name = “Anonymous”
}
$(“#profile”).attr(“src”,profile.Image);
$(“#name”).text(profile.Name);
});
}

function AvatarAPI(email,callback)
{
var username = ‘xxxxxx’;
var password = ‘xxxxxxx’;
var strUrl = “https://www.avatarapi.com/avatar.asmx/GetProfile?&#8221;;
strUrl += “email=” + email;
strUrl += “&username=” + username;
strUrl += “&password=” + password;
$.get(strUrl,function(data){
var xml = $(data);
var profile = {
Name : xml.find(“profile”).find(“Name”).text(),
Image : xml.find(“profile”).find(“Image”).text(),
Valid : xml.find(“profile”).find(“Valid”).text(),
IsDefault : xml.find(“profile”).find(“IsDefault”).text()
};
callback(profile);
});
}

Categories: Uncategorized

Understanding F5 “bobcmn” Javascript detection

F5-Networks-Logo

If you’ve seen a response like this from a website;

(function(){
var securemsg;
var dosl7_common;

window[“bobcmn”] = “1111101010101020000000220000000520000000021f86dd03200000096300000000300000000300000006/TSPD/300000008TSPD_101300000005https200000000200000000”;

window.aht=!!window.aht;try{(function(){try{var __,i_,j_=1,o_=1,z_=1,s_=1,S_=1,Ji=1,li=1;for(var oi=0;oi_j;if(l)return OI(!1);l=Ij&&ij+lj<_;l=OI(l);ij=_;Ij||(Ij=!0,Jj(function(){Ij=!1},1));return l}oj();var zj=[17795081,27611931586,1558153217];
function Zj(_){_="string"===typeof _?_:_.toString(36);var l=window[_];if(!l.toString)return;var O=""+l;window[_]=function(_,O){Ij=!1;return l(_,O)};window[_].toString=function(){return O}}for(var sj=0;sj<zj.length;++sj)Zj(zj[sj]);OI(!1!==window.aht);
(function Sj(){if(!oj())return;var l=!1;function O(l){for(var z=0;l–;)z+=Z(document.documentElement,null);return z}function Z(l,z){var O="vi";z=z||new s;return O_(l,function(l){l.setAttribute("data-"+O,z.Zz());return Z(l,z)},null)}function s(){this.jo=1;this.io=0;this.Sj=this.jo;this.c=null;this.Zz=function(){this.c=this.io+this.Sj;if(!isFinite(this.c))return this.reset(),this.Zz();this.io=this.Sj;this.Sj=this.c;this.c=null;return this.Sj};this.reset=function(){this.jo++;this.io=0;this.Sj=this.jo}}
var S=!1;function z(l,z){if(!oj())return;var O=document.createElement(l);z=z||document.body;z.appendChild(O);O&&O.style&&(O.style.display="none");oj()}function J_(z,O){if(!oj())return;O=O||z;var Z="|";function s(l){l=l.split(Z);var z=[];for(var O=0;O<l.length;++O){var S="",I_=l[O].split(",");for(var J_=0;J__}
function J(_){var l=arguments.length,O=[];for(var Z=1;Z>b>>0};

})();

/TSPD/088481ad69ab2000b270b96268cc0e553e2472504e457123c9fbd2b9bab56ec1bcd49acbc8338cd8?type=7
Please enable JavaScript to view the page content.

Then you’ve been blocked by F5 Network’s Javascript detection, and unless your next requests have the correct Cookies, then you’ll be dumped back to this page. The cookies are IP and time specific.

Now, you can try and pick through the javascript, (please leave a comment, if you find anything), or you can use PhantomJS to execute the front page, and return the cookies, with a script such as;

var page = require(‘webpage’).create();
page.open(‘https://www.somewebsite.com&#8217;, function(status) {
setInterval(function(){
if (phantom.cookies.length > 0)
{
var strCookie = “”;
for(var i in phantom.cookies)
{
var cookie = phantom.cookies[i];
strCookie += cookie.name + “=” + cookie.value + “;”;
}
console.log(strCookie);
phantom.exit();
}
},1000);
});

This script will write our the required cookies, which must then be sent along with any subsequent requests. Note that the cookies are limited by time and IP, so you need to make the subsequent request from the same IP address as PhantomJS.

Categories: Uncategorized

#Nuget #Package for #WordPress.com #API

6I3oEOP4

If you want to automate processes based on the WordPress API – especially in situations where you want to do so without user interaction (i.e. server side / unattended / without oAuth), and you know C# / .NET, then this nuget package is for you.

First, you install the package via Nuget package manager;

Install-Package WordPressAPI 

Then, in order to authenticate yourself against WordPress,  You will need a wordpress username, password, and blog ID.  Get your Blog ID by going to https://developer.wordpress.com/docs/api/console/ then Login and search /me/sites or /sites/hello.wordpress.com

And here is a simple code example

var strAccessToken = WordPressComAPI.Wordpress.Login(new WordPressComAPI.Wordpress.Credentials
{
	Username = xxxxxx,
	Password = xxxxxx,
	blogId = xxxxx
});
var strSite = https://public-api.wordpress.com/rest/v1.1/sites/blog.dotnetframework.org;
var jSite = WordPressComAPI.Wordpress.Get(strSite,strAccessToken);
Categories: Uncategorized

Making a #HTTP request via #TCP/IP in C#

1001004002254105

Sometimes using WebClient or HttpClient hides important information on how you connect to a remote server. Recently I was getting a protocol violation error, when making a web request to a server. OK, so the remote server was misbehaving and sending me back corrupted HTTP headers, but I still wanted to see the response, but WebClient / HTTPRestponse was not showing me anything, just throwing an exception.

So, I resorted to TCPClient – Once again, I have to stress, this should be a last resort, you should never need to make HTTP requests using raw TCP/IP, anyway.

So, what I was trying to do, is get my remote IP address while going through a proxy, which should be the IP address of the proxy, as long as it is working correctly, and here’s the code;

private static void tcpconnect()
{
var tcp=new TcpClient(“**proxy IP***”,*** Proxy port ***);
var stream = tcp.GetStream();
var send = Encoding.ASCII.GetBytes(“GET http://www.icanhazip.com HTTP/1.0\r\n\r\n”);
stream.Write(send,0,send.Length);
var sr = new StreamReader(stream);
var str = sr.ReadToEnd();
Console.WriteLine(str);
tcp.Close();
stream.Close();
}

The Http 1.0 requires the server to close the TCP connection after the response is sent. HTTP 1.1 would keep the TCP connection open, so the ReadToEnd would hang. You could send Connection:close and use HTTP 1.1 if you wanted, or use a more intelligent stream reader.

If you’d like to know more about this subject, You can do worse than check out my book which is available here:  Buy at Amazon US or Buy at Amazon UK

 

Categories: Uncategorized