Archive

Author Archive

Skype Attach protocol 8

This is an update to my previous post about getting Skype to attach from the C# API, the problem is, that you should attach asynchronously, and handle the attachement event

((_ISkypeEvents_Event)skype).

AttachmentStatus += OurAttachmentStatus;
skype.Attach(8, false);
Where OutAttachementStatus can be as follows:
void OurAttachmentStatus(

TAttachmentStatus status)
{
Attached = false;

try
{
Debug.WriteLine(DateTime.Now.ToLocalTime() + ” Attachment Status: ” + skype.Convert.AttachmentStatusToText(status));
}
catch (Exception ex)
{
Debug.WriteLine(DateTime.Now.ToLocalTime() + ” Error: ” + ex.Message + ” Unable to write Skype attach status change”);
}

if (status == TAttachmentStatus.apiAttachAvailable)
{
try
{
skype.Attach(8, true);
}
catch (Exception ex)
{
Debug.WriteLine(DateTime.Now.ToLocalTime() + ” Error: ” + ex.Message + ” Unable to send Skype API Attach Request Message”);
}
}
else
if (status == TAttachmentStatus.apiAttachSuccess)
{
Attached = true;
WasAttached = true;
}
}

On first attach, it asks for permission from the locally running Skype Client, if granted, then it’s not asked for again,
and the attachment works alot faster.
You can then do cool stuff, like search for users:
foreach (User user in skype.SearchForUsers(“bob”))
I’ve found that “user” has the following ‘interesting’ properties:
Handle – banzigof
FullName – fiach
Country – France
City – strasbourg
CountryCode – fr
I’ve put together a skype contact browser, running off a MySQL database
The list is semi-random, so it’ll always show cities with over 500 users, but can randomly push smaller cities into the list.

select city,count(*) as count from skypeUsers group by city order by count(*) + rand()*500 desc
limit 50

Categories: Uncategorized

Getting started with Skype for C#

I’m trying to connect to Skype from c#, but not very sucessfully. Hopefully I’ll crack this in the future …

Using the code snippet:

Skype skype = new Skype();
if (!skype.Client.IsRunning)
{
// start minimized with no splash screen
skype.Client.Start(true, true);
}

// wait for the client to be connected and ready
skype.Attach(8, true); // Not 6?

But then skype gives the error:

Another Application (blah.exe) is attempting to access Skype but we are unable to respond.Please try again later.

Although SEHE, the testing app for the API does work, with the messages:

20/01/2011 10:17:14:  Our Code – SEHE 1.0.31.12 Copyright By Don Kennedy aka TheUberOverLord@gmail.com – Tested with Skype4COM Lib version 1.0.31.0 Skype Windows client 3.8.0.188 Standard Version  3.8.32.188 – Business Version – 4.0.0.169 Beta Version
20/01/2011 10:17:14:  Our Code – TheUberOverLord_Initialize: Main Logic
20/01/2011 10:17:14:  Our Code – FirstTime: True
20/01/2011 10:17:14:  Our Code – AutoScrollOn_CheckedChanged: True
20/01/2011 10:17:14:  Our Code – UseAutoDebug_CheckedChanged: True
20/01/2011 10:17:14:  Our Code – NonWaitedAttachRequests_CheckedChanged: True
20/01/2011 10:17:14:  Our Code – SkypeStop_CheckedChanged: True
20/01/2011 10:17:14:  Our Code – UserLogoff_CheckedChanged: True
20/01/2011 10:17:14:  Our Code – StartNoSplash_CheckedChanged: True
20/01/2011 10:17:14:  Our Code – StartSkype_CheckedChanged: True
20/01/2011 10:17:33:  Our Code – Skype Attachment Request Non-Waited Sent
20/01/2011 10:17:33: Attachment Status – Converted Status: Pending Authorization – TAttachmentStatus: apiAttachPendingAuthorization
20/01/2011 10:17:34:  Our Code *** Check The Skype Window to Allow this Program ***  – Check New Events at the top right of the Skype Window  – Then click on the link under plugin authorization
20/01/2011 10:18:39: Attachment Status – Converted Status: API Available – TAttachmentStatus: apiAttachAvailable
20/01/2011 10:18:39:  Our Code – Non-Waited Attachment Sent
20/01/2011 10:18:40: Attachment Status – Converted Status: Pending Authorization – TAttachmentStatus: apiAttachPendingAuthorization
20/01/2011 10:18:40:  Our Code *** Check The Skype Window to Allow this Program ***  – Check New Events at the top right of the Skype Window  – Then click on the link under plugin authorization
20/01/2011 10:19:15: Connection Status – Converted TConnectionStatus Status: Connecting – TConnectionStatus: conConnecting
20/01/2011 10:19:15: User Status – TUserStatus Converted Status: Offline – TUserStatus: cusOffline
20/01/2011 10:19:16: Attachment Status – Converted Status: Success – TAttachmentStatus: apiAttachSuccess
20/01/2011 10:19:16:  Our Initialization Logic – Begin
20/01/2011 10:19:16:   Skype Ver: 4.2.0.187 – Skype4COM Ver: 1.0.31.0 – Protocol: 8 – Timeout: 30000
20/01/2011 10:19:16:   User: fiach.reid – SkypeOut: False – SkypeIn: False – Voicemail: False
20/01/2011 10:19:16:   PSTN Balance Currency: FREECALL – PSTN Balance: 100
20/01/2011 10:19:16:   Calls Go To Voicemail: FALSE – Calls Go To Call Forwarding: FALSE – Call Forward Rules:  – SMS Validated Numbers:
20/01/2011 10:19:16:   Language: en – Predictive Dialer Country: us – IP Country:  us
20/01/2011 10:19:16:   Audio In: Microphone (Realtek High Definition Audio) – Audio Out: Speakers (Realtek High Definition Audio)
20/01/2011 10:19:16:   Video In: Chicony USB 2.0 Camera
20/01/2011 10:19:16:   Auto Away: True – PC Speaker: False – Ringer:  – Users waiting for authorization: 0
20/01/2011 10:19:16:   AEC: True – AGC: True – Voicemails: 0  – Mute: False
20/01/2011 10:19:16:  Our Initialization Logic – End

20/01/2011 10:17:14:  Our Code – SaveText_CheckedChanged: True
20/01/2011 10:17:14:  Our Code – UseCommandId_CheckedChanged: True – Command Id Reset To: 10000
20/01/2011 10:19:15: Command – Command Id: 1 – Command: PROTOCOL 9 – Expected: PROTOCOL  – Blocking: True – Timeout: 30000
20/01/2011 10:19:15: Reply – Command Id: 0 – Reply: CONNSTATUS CONNECTING – Expected:  – Blocking: False – Timeout: 30000
20/01/2011 10:19:15: Reply – Command Id: 0 – Reply: CURRENTUSERHANDLE fiach.reid – Expected:  – Blocking: False – Timeout: 30000
20/01/2011 10:19:15: Reply – Command Id: 0 – Reply: USERSTATUS OFFLINE – Expected:  – Blocking: False – Timeout: 30000
20/01/2011 10:19:15: Reply – Command Id: 1 – Command: PROTOCOL 9 – Reply: PROTOCOL 8 – Expected: PROTOCOL  – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 2 – Command: GET SKYPEVERSION – Expected: SKYPEVERSION – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 2 – Command: GET SKYPEVERSION – Reply: SKYPEVERSION 4.2.0.187 – Expected: SKYPEVERSION – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 3 – Command: #3 GET PRIVILEGE SKYPEOUT – Expected: #3 PRIVILEGE SKYPEOUT – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 3 – Command: #3 GET PRIVILEGE SKYPEOUT – Reply: #3 PRIVILEGE SKYPEOUT FALSE – Expected: #3 PRIVILEGE SKYPEOUT – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 4 – Command: #4 GET PRIVILEGE SKYPEIN – Expected: #4 PRIVILEGE SKYPEIN – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 4 – Command: #4 GET PRIVILEGE SKYPEIN – Reply: #4 PRIVILEGE SKYPEIN FALSE – Expected: #4 PRIVILEGE SKYPEIN – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 5 – Command: #5 GET PRIVILEGE VOICEMAIL – Expected: #5 PRIVILEGE VOICEMAIL – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 5 – Command: #5 GET PRIVILEGE VOICEMAIL – Reply: #5 PRIVILEGE VOICEMAIL FALSE – Expected: #5 PRIVILEGE VOICEMAIL – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 6 – Command: #6 GET PROFILE PSTN_BALANCE_CURRENCY – Expected: #6 PROFILE PSTN_BALANCE_CURRENCY – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 6 – Command: #6 GET PROFILE PSTN_BALANCE_CURRENCY – Reply: #6 PROFILE PSTN_BALANCE_CURRENCY FREECALL – Expected: #6 PROFILE PSTN_BALANCE_CURRENCY – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 7 – Command: #7 GET PROFILE PSTN_BALANCE – Expected: #7 PROFILE PSTN_BALANCE – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 7 – Command: #7 GET PROFILE PSTN_BALANCE – Reply: #7 PROFILE PSTN_BALANCE 100 – Expected: #7 PROFILE PSTN_BALANCE – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 8 – Command: #8 GET PROFILE CALL_SEND_TO_VM – Expected: #8 PROFILE CALL_SEND_TO_VM – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 8 – Command: #8 GET PROFILE CALL_SEND_TO_VM – Reply: #8 PROFILE CALL_SEND_TO_VM FALSE – Expected: #8 PROFILE CALL_SEND_TO_VM – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 9 – Command: #9 GET PROFILE CALL_APPLY_CF – Expected: #9 PROFILE CALL_APPLY_CF – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 9 – Command: #9 GET PROFILE CALL_APPLY_CF – Reply: #9 PROFILE CALL_APPLY_CF FALSE – Expected: #9 PROFILE CALL_APPLY_CF – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 10 – Command: #10 GET PROFILE CALL_FORWARD_RULES – Expected: #10 PROFILE CALL_FORWARD_RULES – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 10 – Command: #10 GET PROFILE CALL_FORWARD_RULES – Reply: #10 PROFILE CALL_FORWARD_RULES  – Expected: #10 PROFILE CALL_FORWARD_RULES – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 11 – Command: #11 GET PROFILE SMS_VALIDATED_NUMBERS – Expected: #11 PROFILE SMS_VALIDATED_NUMBERS – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 11 – Command: #11 GET PROFILE SMS_VALIDATED_NUMBERS – Reply: #11 PROFILE SMS_VALIDATED_NUMBERS  – Expected: #11 PROFILE SMS_VALIDATED_NUMBERS – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 12 – Command: #12 GET UI_LANGUAGE – Expected: #12 UI_LANGUAGE – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 12 – Command: #12 GET UI_LANGUAGE – Reply: #12 UI_LANGUAGE en – Expected: #12 UI_LANGUAGE – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 13 – Command: #13 GET PREDICTIVE_DIALER_COUNTRY – Expected: #13 PREDICTIVE_DIALER_COUNTRY – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 13 – Command: #13 GET PREDICTIVE_DIALER_COUNTRY – Reply: #13 PREDICTIVE_DIALER_COUNTRY us – Expected: #13 PREDICTIVE_DIALER_COUNTRY – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 14 – Command: #14 GET PROFILE IPCOUNTRY – Expected: #14 PROFILE IPCOUNTRY – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 14 – Command: #14 GET PROFILE IPCOUNTRY – Reply: #14 PROFILE IPCOUNTRY us – Expected: #14 PROFILE IPCOUNTRY – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 15 – Command: #15 GET AUDIO_IN – Expected: #15 AUDIO_IN – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 15 – Command: #15 GET AUDIO_IN – Reply: #15 AUDIO_IN Microphone (Realtek High Definition Audio) – Expected: #15 AUDIO_IN – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 16 – Command: #16 GET AUDIO_OUT – Expected: #16 AUDIO_OUT – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 16 – Command: #16 GET AUDIO_OUT – Reply: #16 AUDIO_OUT Speakers (Realtek High Definition Audio) – Expected: #16 AUDIO_OUT – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 17 – Command: #17 GET VIDEO_IN – Expected: #17 VIDEO_IN – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 17 – Command: #17 GET VIDEO_IN – Reply: #17 VIDEO_IN Chicony USB 2.0 Camera – Expected: #17 VIDEO_IN – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 18 – Command: #18 GET AUTOAWAY – Expected: #18 AUTOAWAY – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 18 – Command: #18 GET AUTOAWAY – Reply: #18 AUTOAWAY ON – Expected: #18 AUTOAWAY – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 19 – Command: #19 GET PCSPEAKER – Expected: #19 PCSPEAKER – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 19 – Command: #19 GET PCSPEAKER – Reply: #19 PCSPEAKER OFF – Expected: #19 PCSPEAKER – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 20 – Command: #20 GET RINGER – Expected: #20 RINGER – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 20 – Command: #20 GET RINGER – Reply: #20 RINGER  – Expected: #20 RINGER – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 21 – Command: #21 SEARCH USERSWAITINGMYAUTHORIZATION – Expected: #21 USERS  – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 21 – Command: #21 SEARCH USERSWAITINGMYAUTHORIZATION – Reply: #21 USERS  – Expected: #21 USERS  – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 22 – Command: #22 GET AEC – Expected: #22 AEC – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 22 – Command: #22 GET AEC – Reply: #22 AEC ON – Expected: #22 AEC – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 23 – Command: #23 GET AGC – Expected: #23 AGC – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 23 – Command: #23 GET AGC – Reply: #23 AGC ON – Expected: #23 AGC – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 24 – Command: #24 SEARCH VOICEMAILS – Expected: #24 VOICEMAILS  – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 24 – Command: #24 SEARCH VOICEMAILS – Reply: #24 VOICEMAILS  – Expected: #24 VOICEMAILS  – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Command – Command Id: 25 – Command: #25 GET MUTE – Expected: #25 MUTE – Blocking: True – Timeout: 30000
20/01/2011 10:19:16: Reply – Command Id: 25 – Command: #25 GET MUTE – Reply: #25 MUTE OFF – Expected: #25 MUTE – Blocking: True – Timeout: 30000

 

Categories: Uncategorized

Nand.bin BootMii Wii Backup

Categories: Uncategorized

BINARY_CHECKSUM vs HASHBYTES in SQL

If you need to create a short checksum or hash code in SQL, you can use CHECKSUM, BINARY_CHECKSUM or HASHBYTES.

HASHBYTES is the best for ensuring lower collisions, whereas BINARY_CHECKSUM is worst. But for performance, here is a comparison on a 1 million row table.

 

declare @timeStart as datetime
set @timeStart = getdate()
select MAX(hashbytes(‘MD5’,x)) from y
select datediff(ms,@timestart,getdate())

checksum = 370,363,370,410,356 = 373 ms
binary_checksum = 403,356,360,390,356 = 373 ms
MD5 = 2083, 1976, 1743 , 1746 , 1753 = 1860 ms

Therefore, Binary_Checksum is 5 times faster than MD5 HASHBYTES, and the same speed as checksum.

So, my advice,

Iif you need speed over accuracy – use CHECKSUM, not BINARY_CHECKSUM.

If you need accuracy over speed  – use HASHBYTES.

 

Categories: Uncategorized

CouchDB: Extending SharpCouch with group, skip and limit

The major benifit of CouchDb, over relational databases, is that it forces you to use Map/Reduce, which  offers “out-of-the-box”, an easy path to scalability, in terms of raw data storage, performance and redundancy.

However, 10 CouchDB instances may be quicker than 10 SQL server boxes, but certainly, one instance is terribly slow on ~100K records at ~1 GB in size (total). In fact, it’s unusably slow 😦

Here’s an example I put live (http://couchdb.webtropy.com/), which returns 100 records at random from Delicious data – which is stored on a couchdb at couchone.com. However, the query was too slow to run a Group-by clause, nor could it even do a select, on so many records.

I modified SharpCouch to allow for limiting, grouping and skip functionality, as follows:

/// <summary>
/// Execute a temporary view and return the results.
/// </summary>
/// <param name=”server”>The server URL</param>
/// <param name=”db”>The database name</param>
/// <param name=”map”>The javascript map function</param>
/// <param name=”reduce”>The javascript reduce function or
/// null if not required</param>
/// <param name=”startkey”>The startkey or null not to use</param>
/// <param name=”endkey”>The endkey or null not to use</param>
/// <returns>The result (JSON format)</returns>
public string ExecTempView(string server,string db,string map,string reduce,string startkey,string endkey, bool Group, int Limit,int Skip)
{
// Generate the JSON view definition from the supplied
// map and optional reduce functions…
string viewdef=”{ \”map\”:\””+map+”\””;
if(reduce!=null)
viewdef+=”,\”reduce\”:\””+reduce+”\””;
viewdef+=”}”;

string url=server+”/”+db+”/_temp_view”;
if(startkey!=null)
{
url+=”?startkey=”+HttpUtility.UrlEncode(startkey);
}
if(endkey!=null)
{
if(startkey==null) url+=”?”; else url+=”&”;
url+=”endkey=”+HttpUtility.UrlEncode(endkey);
}
if (Group)
{
url += “?group=true”;
}
if (Limit > 0)
{
if (Group) url += “&”; else url += “?”;
url += “limit=” + Limit;
}
if (Skip > 0)
{
if (Group || Limit>0) url += “&”; else url += “?”;
url += “skip=” + Skip;
}

return DoRequest(url,”POST”,viewdef,”application/json”);
}

That at least gave me basic functionality.

I was hoping to do a group by author as follows:

function(doc) { emit(doc.author,1); }

function(keys, values, rereduce) {
return sum(values);
}

but that was too slow, and so too was a filter:

function(doc) {
if (doc.author == \”morgand\”)
emit(doc,1);
}

Overall, I was initially excited by it, and I was glad I could extend SharpCouch, but overall disapointed that it’s speed was awful.

 

 

Categories: Uncategorized

Google Security hole: Determine people’s names from their Gmail Account

Posing to this url:

https://docs.google.com/e/commonshare

app    2
authuser    0
clientUser    10495966446245
confirmed    false
foreignService    kix
hl    en
itemIds    1kKdL8JV8jJP5sDBprLzAgxDGvDTTA_s8KY
notificationInfo    {“messageType”:”invite”,”recipient”:”someemail@gmail.com“,”optionValues”:{“ccMe”:false,”pasteInEmail”:false}}
requestType    invite
role    30
sendEmail    true
shareProtocolVersion    2
shareService    kix
subapp    10
token    US5VKC0BAAA.J0BSgZ7BpREraHwLcA

&&&START&&&{“status”:0,”modelChanges”:[{“aclEntries”:[{“scope”:{“name”:”Their name appears here“,”id”:”114892889789266972″,”scopeType”:”user”,”me”:false,”email”:”somemail@gmail.com“},”role”:30}],”id”:”1kKdL8JV8jJP5Tr3prLzAgxDGvDTTA_s8KY”,”visibilitySetting”:{“role”:0,”summary”:”Private to me + 3 more”,”visibilityState”:”private”,”restrictedToDomain”:true,”visibilityEntries”:[{“role”:0,”summary”:”Private”,”visibilityState”:”private”,”restrictedToDomain”:true,”details”:”Only people explicitly granted permission can access. Sign-in required.”}]}}]}

Interesting? 🙂

 

Categories: Uncategorized

Moving from MsSQL to MySQL

I’ve decided to start moving some data from my MsSQL database to a MySQL one. Why?, because I’d like my MsSQL database to be used for my main websites, and the MySQL one used for less important ones. Those where the data is bulky but the performance isn’t so important. – Since my MySQL db is nowhere near my webserver.

Anyway, I was surprised how easy it was to migrate,

This is the code I use for MsSQL:

public DataSet ExecuteDataSet(string sql)
{
DataSet ds = new DataSet();
try
{

OleDbConnection DSN = new OleDbConnection(connectionString);
DSN.Open();
OleDbCommand Database = new OleDbCommand(sql,DSN);
OleDbDataAdapter Adapter = new OleDbDataAdapter(Database);
Adapter.Fill(ds,”sql”);
DSN.Close();
}
catch(Exception ex)
{
logError(ex,sql);
}
return ds;
}

Just replace OleDb with MySql and you get

public DataSet ExecuteMySqlDataSet(string sql)
{
DataSet ds = new DataSet();
try
{

MySqlConnection DSN = new MySqlConnection(MySqlConnectionString);
DSN.Open();
MySqlCommand Database = new MySqlCommand(sql, DSN);
MySqlDataAdapter Adapter = new MySqlDataAdapter(Database);
Adapter.Fill(ds, “sql”);
DSN.Close();
}
catch (Exception ex)
{
logError(ex, sql);
}
return ds;
}

And then include using MySql.Data.MySqlClient;

A few tweaks to the SQL, so instead of select top 10 * … it’s select * … limit 10, instead of order by newid() it’s order by rand(), and the table names are case sensitive.

I hit some wierd bug where it didn’t recognise column names with umlauts, but I just worked around that instead of fixing it. – Anyway, here’s the end-result: http://www.listofbanks.info/GermanBanks.aspx

Categories: Uncategorized

How to make a Geo-Aware website?

I’ve made a page that locates your closest bank branch using a Geo-aware webpage see

http://www.listofbanks.info/FindBank.aspx

Once you share your location with the page, using the prompt provided, it makes an AJAX call with your longitude and latitude to another page which returns the top 10 banks in our database ordered by distance. The system will only work in europe, so americans may see their nearest bank in spain!.

The JavaScript I used was as follows:

if (geo_position_js.init()) {
geo_position_js.getCurrentPosition(success_callback, error_callback, { enableHighAccuracy: true });
}
else {
window.document.getElementById(“response”).innerHTML = “Failed.”;
}

function success_callback(p) {
var oXHR = new XMLHttpRequest();
var strUrl = “FindBankAjax.aspx?”;
strUrl += “Latitude=” + p.coords.latitude.toFixed(2);
strUrl += “&Longitude=” + p.coords.longitude.toFixed(2);
oXHR.open(“get”, strUrl, false);
oXHR.send(null);
window.document.getElementById(“response”).innerHTML = oXHR.responseText;
}

function error_callback(p) {
window.document.getElementById(“Failed due to ” + p.code)

}

 

 

Categories: Uncategorized

Free MySQL database

Here’s a free MySQL database that anyone can use:

 

Database: wikienc1_free

Username: wikienc1_free

Password: 00036IT

Host: 184.154.116.162

FAQ:

1. Is this really free?

Yup. But I’d appreciate a backlink from your website!

2. Is it private?

Nope.

3. Won’t someone just delete my data

They could, but please don’t delete other people’s data.

4. Can’t you set up an account just for me?

Pay me and I will 🙂

5. Will you help install WordPress / Joomla / whatever ?

Nope.

6. Will the username or password change.

They could, bookmark this page, it will always be updated with the latest password

 

Categories: Uncategorized

Code syntax highlighter for C#

Categories: Uncategorized