Ramin Hossaini

If this, then that (ifttt)

Jan
01

Ifttt is a really handy tool for creating simple triggers that set off actions or tasks. It works off of what ifttt calls “channels” (a particular date & time, Foursquare, Facebook, Flickr, and Evernote are a few examples)

You might find that the “if this, then that” is a bit too simple for certain things you would like to do – I would have loved to see a little more complexity involved. For example, “if this and this, then that”.

Here are a couple of examples:

Ifttt is in beta at the moment, and it’s free to sign up – but I don’t suspect it will stay that way for very long.

Anyways, you might as well try it yourself and start making your own recipes: ifttt

Extracting attachments from .EML files

Mar
15

Note: If you’re only interested in the download, scroll down to the bottom of the post.

An inconsiderate friend sent me a couple of .eml files with attachments that I had to look through. I downloaded the files and found that I had no associated application to open them. So instead of finding an application to open them, I thought I’d take a closer look at the files:

The top portion had a whole bunch of stuff I had no interest in whatsoever:

After all the HTML, I found the code for the attachment:

So I figured I just had to decode the Base64-encoded data and save it as the filename (in this case, a PDF)

The most logical thing at this point was to write my own application to do it. Just made a simple C# form with a textbox for the Base64-encoded data, a textbox for the filename to write to and a Decode button to get things going:

The Decode function is pretty simple:

1
2
3
4
5
public byte[] decode(string data)
{
    byte[] output = Convert.FromBase64String( data );
    return output;
}

So feed the function the Base64 part and it spits out the good stuff that you just write to a file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
FileStream fs = new FileStream(txtFilename.Text, FileMode.Create, FileAccess.Write);
BinaryWriter writer = new BinaryWriter(fs);
try
{
    for (int i = 0; i < decodedData.Length; i++)
    {
        writer.Write(decodedData[i]);
    }
}
finally
{
    writer.Close();
    fs.Close();
}

You can also just download the latest version of the app here: Base64 Decoder

The open file function is a bit experimental and does some .EML file clean-up.

It requires the .NET framework and no, it doesn’t come supported, and I can’t promise that I’ll continue working on it.

An introduction to Yahoo! Pipes

Jan
01

Yahoo! isn’t exactly one of my favourite companies out there, and it isn’t hard to figure out why when you see how they’ve acquired and maintained technologies like Delicious and Flickr.

That being said, I have to say I’m a big fan of Yahoo! Pipes, and I haven’t been able to find an alternative that’s as good.

The name is derived from the Unix pipe where simple commands can be combined together to create output that meets your needs.

Example

So here’s a very simple example: let’s say you have a specific RSS feed (in this example, the Guardian football RSS feed) you like – but you’re only interested in very specific news (in this example, we only want content relating to Liverpool FC).

Go to Yahoo! Pipes and create a new pipe. Then add the RSS feed as input:

Click on the input-box and you should be able to see a preview of what the input is like:

Under the ‘Operators’ menu on the left, drag a ‘filter’ module into your pipe, add some rules and then connect the boxes together:

Click on the ‘pipe output’ box to see a preview of the new output:

Once you’ve saved your pipe, click on ‘Run pipe’ and get the output’s RSS feed address:

I’m curious to see how others use Yahoo! Pipes – leave a comment if you think of something.

Menu-separators in Mac OS X (annoyances)

Nov
29

I recently had the pleasure of purchasing a Macbook Pro. Firstly, let’s get something out of the way: I do think it’s a dazzlingly beautiful OS, but here’s something I find pretty annoying:

Menu separators

The screenshot below shows an example of a menu with separators in 3 different Operating Systems: Windows 7, Ubuntu 10.04, and Mac OS X 10.6.5

Sometimes it just so happens that I’m clicking around so quickly that I accidentally click on the separator. On Windows and Ubuntu this is fine – it ignores it and keeps the menu open. In Mac OS X, the menu disappears (as if you’ve clicked on something that’s supposed to be clickable)

Anybody else find this annoying?

Updated: Flickr comment generator

Sep
03

I had a shocking revelation today: people are actually using my Flickr-comment-generator. Even cooler: I realised people were using the Greasemonkey script I had created to go along with it. Shame on all of you!

After Flickr redesigned their photo-pages, the script stopped working though, and people had to actually think of comments to write (terrible!). I finally took the time out today to update the script and now everybody can have generic-goodness available to them.

Also, if you would like to contribute to this terrible project by submitting generic comments of your own, feel free to send me an email here