Archive

Archive for October, 2016

#bin number lookup in c#

credit-card-perspective

The first six digits of a credit card (BIN) indicate the issuing bank and country. You can use
this to assist in fraud detection, or determine what country a customer is from – although
people do sometimes carry foreign cards.

Here is an example from NeutrinoAPI that allows you look up a card BIN number in c# – you’ll need your own username and key

[HttpGet]
public ActionResult CheckBinNumber(string binNumber)
{
var strUrl = “https://neutrinoapi.com/bin-lookup?”;
strUrl += “bin-number={0}”;
strUrl += “&customer-ip=8.8.8.8”; // Google’s IP address.
strUrl += “&user-id={{your username}}”;
strUrl += “&api-key={{your key}}”;
strUrl = string.Format(strUrl, binNumber);
var wc = new WebClient();
var strRaw = wc.DownloadString(strUrl);
return Content(strRaw, “application/json”);
}

…. and you get the following json

{
“country”:“IRELAND”,
“country-code”:“IE”,
“card-brand”:“MASTERCARD”,
“ip-city”:“Mountain View”,
“ip-blocklists”:[
“dshield”
],
“ip-country”:“United States”,
“issuer”:“BANK OF IRELAND”,
“issuer-website”:http://www.bankofireland.com/contact-us/”,
“ip-region”:“California”,
“valid”:true,
“card-type”:“CREDIT”,
“ip-blocklisted”:true,
“card-category”:“”,
“issuer-phone”:“1890 365 100 OR 353 1 404 4001”,
“ip-matches-bin”:false,
“ip-country-code”:“US”
}

Categories: Uncategorized

Embed a #Skype-like chat in your webpage @tokbox

opentok

I had a quick look on the internet to see if it was easy to embed Skype / Facetime / or Google talk in a website, and although it seems possible to embed Skype – MDLive did it, but only in partnership with Microsoft, so I don’t think it’s open to all. Facetime seems completely closed.

  However, I did come across another company that does it; try page out;
(https://) is required.
The instructions are as follows;
  1. When prompted, grant access to your camera and microphone.
  2. The video from your webcam should appear in the browser.
  3. Mute your speaker.
  4. Copy the URI in the browser to your Clipboard.
  5. Open a new tab.
  6. Paste the URI into the new tab. Now you should have two videos.
    Tip: If you have a public address, share the path with a friend for a real video chat!
 
It’s from a company called Tokbox, and their base fee is $50 a month. 
The code is below, since you can easily see it from a view-source, so the passwords aren’t secure;
<!DOCTYPE HTML>
<html>
<body>
https://static.opentok.com/v2/js/opentok.js

var apiKey = ‘45708032’;
var sessionId = ‘1_MX40NTcwODAzMn5-MTQ3NzM4MDMxNTE4MH5HUE1rUzlOVlFxb0VDU0FscWRFbXFNdkd-fg’;
var token = ‘T1==cGFydG5lcl9pZD00NTcwODAzMiZzaWc9NWNlMDdkNWExM2Y2MTEzYjFkM2VlZmVjNzg4Zjg0ZTI5ZjY4NTJjZDpzZXNzaW9uX2lkPTFfTVg0ME5UY3dPREF6TW41LU1UUTNOek00TURNeE5URTRNSDVIVUUxclV6bE9WbEZ4YjBWRFUwRnNjV1JGYlhGTmRrZC1mZyZjcmVhdGVfdGltZT0xNDc3MzgwMzQyJm5vbmNlPTAuNjc1MjYyNzQ4NDk2NjA3JnJvbGU9cHVibGlzaGVyJmV4cGlyZV90aW1lPTE0Nzk5NzU5NDQ=’;
var session = OT.initSession(apiKey, sessionId)
.on(‘streamCreated’, function(event) {
session.subscribe(event.stream);
})
.connect(token, function(error) {
var publisher = OT.initPublisher();
session.publish(publisher);
});

</body>
</html>

Categories: Uncategorized

#Microsoft’s #Symbian phones sold to #FIH

ovi-nokia-logo_1

On Wednesday, May 18, Microsoft announced an agreement to sell the company’s entry-level feature phone to FIH Mobile Ltd., (FIH) a subsidiary of Hon Hai/Foxconn Technology Group, and HMD Global, Oy (HMD). As part of the sale, FIH Mobile Ltd., and HMD Global Oy will take over all of the manufacturing, sales, and marketing functions related to Microsoft’s feature phone business.  As a result, your sales and marketing relationship with respect to Nokia feature phones will transfer from Microsoft to the Buyer’s legal entity.   The transaction is expected to close by the end of calendar year 2016, subject to regulatory approvals and other closing conditions.

Categories: Uncategorized

Send a #Postcard via c# using @StannpApp

app-postcard-reverse-holder

This code will request that a message is printed onto a postcard and posted to an address of your choice, for about 40p (ish) – pretty cool.

You’ll need your own API key, and you should test it with your own address first.

var strPostData = “test=false”;
strPostData += “&size=A6”;
strPostData += “&front=https%3A%2F%2Fwww.stannp.com%2Fassets%2Fsamples%2Fa6-postcard-front.jpg”;
strPostData += “&message=hello+there!”;
strPostData += “&signature=https://www.stannp.com/assets/samples/signature-example.jpg”;
strPostData += “&recipient[title]=Mr”;
strPostData += “&recipient[firstname]=You”;
strPostData += “&recipient[lastname]=You”;
strPostData += “&recipient[address1]=Your Address”;
strPostData += “&recipient[address2]=London”;
strPostData += “&recipient[town]=London”;
strPostData += “&recipient[postcode]=Your Postcode”;
strPostData += “&recipient[country]=GB”;
WebClient wc = new WebClient();
var strUrl = “https://dash.stannp.com/api/v1/postcards/create&#8221;;
string credentials = Convert.ToBase64String( Encoding.ASCII.GetBytes(“{{YOUR API KEY HERE}}:”));
wc.Headers[HttpRequestHeader.Authorization] = string.Format(
“Basic {0}”, credentials);
try
{
wc.Headers[HttpRequestHeader.ContentType] = “application/x-www-form-urlencoded”;
var strResponse = wc.UploadString(strUrl , “POST”, strPostData);
}
catch (WebException exception)
{
string responseText;

var responseStream = exception.Response?.GetResponseStream();

if (responseStream != null)
{
using (var reader = new StreamReader(responseStream))
{
responseText = reader.ReadToEnd();
}
}
}

Categories: Uncategorized

#госномер #API – Russian car number plate lookup #ГИБДД #России

Russland, Moskau, Basiliuskathedrale

Our new website госномер.com ; pronounced “Gos Nomer” offers an API to Russian developers wishing to provide an automated way of looking up details of vehicles from their number plate.

Car registration plates in Russia use the /CheckRussia endpoint and return the following information:

  • Make & Model
  • Partial VIN number
  • Age
  • ГИБДД status (Russian police “Gibdd”)
  • Representative image

 

Sample Json:

{
“Description”:“SSANG YONG DJ KYRON”,
“CarMake”:{
“CurrentTextValue”:“SSANG YONG DJ KYRON”
},
“MakeDescription”:{
“CurrentTextValue”:“SSANG YONG DJ KYRON”
},
“VechileIdentificationNumber”:“XU3S*********1174”,
“RegistrationYear”:“2007”,
“gibddWanted”:false,
“gibddRestricted”:false,
“Image”:http://www.regcheck.org.uk/image.aspx/@U1NBTkcgWU9ORyBESiBLWVJPTg==&#8221;
}
Categories: Uncategorized

Create a Lead in Base using C# @getbase

base-crm

Base is a CRM system that offers an API to allow you to automatically track your customers / or leads. Here’s a quick code example of how to call the Base API in c#, I’ve removed the username / password values.

var lead = new BaseCRM.Lead
{
data = new Data
{
first_name = “Joe”,
last_name = “bloggs”,
email = “joe.bloggs@gmail.com”,
website = “www.webtropy.com”,
address = new Address { },
custom_fields = new CustomFields { },
tags = new List<string>()
}
};
var strJson = JavascriptSerialize(lead);

WebClient wc = new WebClient();
try
{
var strSearch = “https://api.getbase.com/v2/leads&#8221;;
wc.Headers[HttpRequestHeader.Accept] = “application/json”;
wc.Headers[HttpRequestHeader.ContentType] = “application/json”;
wc.Headers[HttpRequestHeader.UserAgent] = “Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36”;
wc.Headers.Add(“Authorization”, “Bearer {{YOUR API KEY}}”);
var strSearchResponse = wc.UploadString(strSearch,strJson);
}
catch (WebException exception)
{
string responseText;

var responseStream = exception.Response.GetResponseStream();

if (responseStream != null)
{
using (var reader = new StreamReader(responseStream))
{
responseText = reader.ReadToEnd();
}
}
}

The code above creates a new “Lead” in the Base CRM system, it requires a few helper methods as follows;

public static T JavascriptDeserialize<T>(string json)
{
var jsSerializer = new JavaScriptSerializer { MaxJsonLength = Int32.MaxValue };
return jsSerializer.Deserialize<T>(json);
}

public static string JavascriptSerialize<T>(T obj)
{
var jsSerializer = new JavaScriptSerializer { MaxJsonLength = Int32.MaxValue };
return jsSerializer.Serialize(obj);
}

and the object model;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Yelper.BaseCRM
{
public class Address
{
public string line1 { get; set; }
public string city { get; set; }
public string postal_code { get; set; }
public string state { get; set; }
public string country { get; set; }
}

public class CustomFields
{
public string known_via { get; set; }
}

public class Data
{
public string first_name { get; set; }
public string last_name { get; set; }
public string organization_name { get; set; }
public int source_id { get; set; }
public string title { get; set; }
public string description { get; set; }
public string industry { get; set; }
public string website { get; set; }
public string email { get; set; }
public string phone { get; set; }
public string mobile { get; set; }
public string fax { get; set; }
public string twitter { get; set; }
public string facebook { get; set; }
public string linkedin { get; set; }
public string skype { get; set; }
public Address address { get; set; }
public List<string> tags { get; set; }
public CustomFields custom_fields { get; set; }
}

public class Lead
{
public Data data { get; set; }
}
}

Categories: Uncategorized