UPDATE: Desktop SMS
February 2, 2010 by Conor · Leave a Comment
Here is an updated version of my Desktop SMS program.
New features:
- Fixed general usability issues i.e. message and recipient clears after message sent.
- Added option to run in stealth mode. Program hides in system tray when sending message. Great for the office!
- Non outlook users can choose to use the internal contacts system to store contacts. This probably needs more work.
Download: here
Send webtexts from desktop with MS Outlook support.
January 17, 2010 by Conor · 3 Comments
Here’s a simple little app that uses the sending scripts from www.cabbagetexter.com to send text messages via your networks webtext service. The best part is that it integrates with MS Outlook contacts which works pretty well for me becuase I have Outlook synced with my phone (HTC Hero).
At the moment the program just pulls the contacts full name and the number in “Mobile Phone” field of the contact entry. Entries that don’t have a mobile number or do not begin with 085,086,087 or the international equivalent will not be displayed. I have yet to test this service for international mobile numbers. If they are compatible I will add these to the filter also. Let me know!!
There is support for Meteor, O2 and Vodafone at the moment but I will add support for “3 Mobile” soon.
Security Disclaimer:
This program works by sending a http request in the following format:
http://sms.conorhackett.com/free/[network].send.php?&u=[your_number]&p=[your_password]&s=m&d=[recipient_number]m=[your_message]
At the moment your webtext username and password are sent in plain text and can be easily sniffed. Also, if you set the program to remember your username and password then they will be stored in plaintext on your computer (hidden to most users but there all the same).
I am working on securing both of the above but for now they are wide open so if you are unhappy with this you may not want to use this program or only use it on a secure trusted network/computer.
–
Download here.
If you like/dislike anything about this program then please comment this article or send me an e-mail to : support )AT( sms.conorhackett.com
Update: You must have MS Outlook installed on your computer to use the contacts features.. If you haven’t got Outlook installed then you will get a strage looking error.
Happy New Year!
January 5, 2010 by Conor · Leave a Comment
Happy New Year everybody!
This is my first post of 2010 and from my new android powered HTC Hero using wp2go!
Store code snippets with Code Warehouse
December 15, 2009 by Conor · Leave a Comment
Have you ever found yourself browsing the net and finding some code that you know is useful and you’d like to store it for future use? You then proceed to save it in a text file and save it in a random location. Not only will you forget about it but even if you remembered it you probably wouldn’t be able to find it!!
Thats where Code Warehouse comes in. It is a handy little utiliy that lets you create your own categories for storing code snippets for reference later on. For each code entry you can specify the language to enable syntax highlighting, item type (function, class, interface etc.) plus the usuals like name, description etc. You are also able to save notes about each entry and and upload files associated with the entry. This would be handy if you needed DLL files or other to support the code you are writing.
Code Warehouse really is a once stop shop for code management and gone are the days when I had to flick through various old projects to double check how something was done. It has support for lots of languages and I am a particular fan of the database support (MySQL, SQL Server, Access + more) which means I could develop a web interface to make my code available to me on the go or provide access to other users.
My setup is as follows: Main categories by programming language then sub categories in each for various areas e.g. Text, File IO, web, security etc..
Link: here
Check your Eircom stats for your desktop
November 22, 2009 by Conor · Leave a Comment
A while back I showed you how to automatically login to the Eircom stats page.
That was handy, right? But now you can check your stats right from your desktop with a simple little program I put together over the weekend. All you need to do is provide your phone number and account number (you only need to enter these once) to get your downloads, uploads, allowance and remaining downloads for the month.
I plan to turn this program into a universal program with support for all ISPs that support checking your stats online. I am nearing completion of support fo BT broadband as I type so leave a comment if your interested and i’ll speed up development..
Download link: here
TweetPhoto API tutorial in VB.NET
November 11, 2009 by Conor · 5 Comments
I’ve already told you that I am currently working on a Twitter client with two other guys as part of a college project. Along with URL shortening, Tweeting photos seems to be a fairly common feature in other clients so it’s also something we must fully support in our client, JACTweet!!
I will be using the tweetPhoto service to tweet photos. API documentation starts here but keep in mind that you must apply for an API key before you start. Application is currently by e-mail (not automated) so you should apply for a key straight away before you even start reading the documentation.
I would also suggest using some kind of HTTP debugger when familiarizing yourself with web service interfaces. I am currently using Fiddler and can only say good things about it. It lets you see the raw data that is being sent accross the interent and more importantly what the web server on the other side sees.
I’ll start off by stepping you through what needs to be done:
- Creat a new instance HTTPWebRequest
- Set method (POST) and add headers – Except for content length, which is unknown at this point
- Read image file into a byte array (Note: TweetPhoto 5MB limit)
- Set content-length header to the length of above byte array
- Stream file (byte array) to tweetPhoto
- Get response from tweetPhoto
First we create a new instance of HTTPWebRequest with the tweetPhoto API upload URL. Adding method and known headers also.
Dim request = HttpWebRequest.Create("http://tweetphotoapi.com/api/tpapi.svc/upload2")
request.Method = "POST"
request.ContentType = "application/x-www-form-urlencoded"
request.Headers.Add("TPAPIKEY: api_key_here")
request.Headers.Add("TPAPI: username,password")
request.Headers.Add("TPMIMETYPE: image/png")
request.Headers.Add("TPPOST:True")
request.Headers.Add("TPMSG: message here")
request.Headers.Add("TPTAGS: comma,seperated,tags,here")
Next we will read the image file into a byte array and set the content-length header.
Dim content() = File.ReadAllBytes("path_to_image_file_here")
request.ContentLength = content.Length
Now we will stream the actual image file to tweetPhoto in the form of bytes. If you are thinking in terms of the HTTP transmission then this is the body and everything else beforehand has just been headers telling the web servers what to expect in the body.
Using str As System.IO.Stream = request.GetRequestStream()
str.Write(content, 0, content.Length)
End Using
If you’ve gotten this far then the above code is working perfectly without any exceptions. We conclude with the response from the server. This comes in the form of XML but for now we’ll just save it as a string.
Dim response = request.GetResponse() Dim responseOutput as String Dim reader As StreamReader reader = New StreamReader(response.GetResponseStream()) responseOutput = reader.ReadToEnd()
For clarity here is all the above code in just one block.
'Imports System.IO -> Required
'Imports System.Net -> Required
Dim request = WebRequest.Create("http://tweetphotoapi.com/api/tpapi.svc/upload2")
request.Method = "POST"
request.ContentType = "application/x-www-form-urlencoded"
request.Headers.Add("TPAPIKEY: your_api_key_here")
request.Headers.Add("TPAPI: password,username")
request.Headers.Add("TPMIMETYPE: image/png")
request.Headers.Add("TPPOST:True")
request.Headers.Add("TPMSG: message here.")
request.Headers.Add("TPTAGS: comma,seperated,tags,here")
Dim content() = File.ReadAllBytes("path_to_image_here")
request.ContentLength = content.Length
Using str As System.IO.Stream = request.GetRequestStream()
str.Write(content, 0, content.Length)
End Using
Dim response = request.GetResponse
Dim responseOutput As String
Dim reader As StreamReader
reader = New StreamReader(response.GetResponseStream())
responseOutput = reader.ReadToEnd()
MessageBox.Show(responseOutput)
I have also made up a quick demo that uploads a photo along with tags and a message to a users account. You can get the source here. The source is in Visual Studio 2008 Pro format.
Have fun!
Oh, and if somebody actually reads this and finds it useful then please post a comment to let me know what you think. It would be amazing to see people actually reading this blog.:-)
Shorten URLs in Visual Basic using Bit.ly API
November 3, 2009 by Conor · Leave a Comment
I’m currently working on a Twitter client for college that will provide a function to shorten URLs using the Bit.ly API.
It’s actually really simple and easy to use and while my sample interface is written in VB you can use the API with any language. To use the API all you need do is construct a URL like so:
http://api.bit.ly/shorten?version=2.0.1&longUrl=http://www.conorhackett.com&login=[USERNAME]&apiKey=[API_KEY]
You will need to register with Bit.ly to get API key and a username before you can try this. Also, the url you want to shorten must begin with “http://” or else you will get an error. The above URL (with my API key included) will return the following response:
{ “errorCode”: 0, “errorMessage”: “”, “results”: { “http://www.conorhackett.com”: { “hash”: “nzIzC”, “shortKeywordUrl”: “”, “shortUrl”: “http://bit.ly/9SWQS”, “userHash”: “9SWQS” } }, “statusCode”: “OK” }
From this you can extract the shortened URL along with the status of the response among other but they are the only two pieces of information that I used.
Below you’ll find my solution written in VB. The handling of the status messages isn’t the greatest but it works fine. I should really be using regular expressions to validate user input and extract information from the response. It’s late and my regex skills are still a little shaky so i’ll leave that until another day.
' NOTE: you must use -> Imports System.Net
Public Function getShort(ByVal url As String) As String
' New instance of WebClient
Dim client As WebClient = New WebClient()
' if URL doesn't start with http:// then append it to the start
If url.StartsWith("http://") = False Then
url = "http://" + url
End If
' Setup command url to be sent to Bit.ly API
Dim commandUrl As String = "http://api.bit.ly/shorten?version=2.0.1&longUrl=" + url + "&login=[USERNAME]&apiKey=[API_KEY]"
' Get raw result string
Dim result As String = client.DownloadString(commandUrl)
' Determine status of repsonse
' This needs to be improves but works ok for now.
If result.IndexOf("""statusCode"": ""OK""") > 0 Then
' Get position of the beginning of short URL.
Dim indexOf As Integer = result.IndexOf("http://bit.ly/")
result = result.Substring(indexOf, 19)
End If
If result.IndexOf("""statusCode"": ""ERROR""") > 0 Then
' Throw an exception if response is ERROR.
Throw New System.Exception("ERROR")
End If
Return result
End Function
Update: This tutorial focuses on getting a JSON formatted response from Bit.ly. This can be changed to XML by adding &format=xml at the end of the request URL. I will post a guide on working with XML in the near future.
Disable floppy drive in Windows..
November 2, 2009 by Conor · Leave a Comment
If you no longer have a floppy drive in your computer then you will probably have no need for the A drive in “My Computer”. It really is quite easy to disable it..
Right-Click “My Computer” -> Select properties (Shortcut: WIN + Pause/Break) -> Hardware -> Device Manager -> Floppy Disk Controllers -> Right-Click and disable “Standard Floppy Disk Controller” -> “Yes” to warning.
That’s it! No more annoying floppy drive!
Regular expressions in C#
October 20, 2009 by Conor · Leave a Comment
Before I started my Web Crawler project I used always wonder how you’d go about pulling data from raw html. After reading up on the inner workings of a web crawler it became clear that I should be using Regular Expressions and quit fooling around with String functions such as indexOf and subString.
So basically, a regular expression is an ‘expression’ that is used to find patterns in text that are of interest to the user. I’m not going to go into specifics here as I am still learning the basics and don’t want to misinform anybody. If you’re interested you should visit the links below or if you’re already familiar with them and would like to see how to use them in C# read on.Here is a link to the MSDN documentation on the RegularExpression class.
The example below is a simplified version of the example on the MSDN site. It finds anchor tags in html and print the matches to the screen.
using System.Text.RegularExpressions;
String html = "<a href=\"http://www.conorhackett.com\">Conor Hackett</a>";
Regex expression = new Regex("<a\\s*[^<]+\\s*</a>");
// Run expression on html and store all matches in matches.
// MatchCollection stores all found matches in a collection of objects of type Match.
MatchCollection matches = expression.Matches(html);
// Print out all the found matches.
foreach (Match match in matches)
{
Console.WriteLine(match.Value + "\n");
}
The above snippet should output
<a href="http://www.conorhackett.com">
Links:
http://www.ultrapico.com/Expresso.htm
http://www.codeproject.com/KB/dotnet/regextutorial.aspx
http://regexlib.com/

