mlogo
archives
  • Insomnia is way under-rated these days. #

Powered by Twitter Tools.

Tuesday 4/29 around 11 pm   No Comments »
  • Richard Nixon was, in all likelihood, never a pastor. #
  • Seriously, Microsoft Office 2008’s spell checker still does not recognize the word "Podcast" or even "Blog" by default? #
  • @wilharris Last.fm does, I believe. #

Powered by Twitter Tools.

Monday 4/28 around 11 pm   No Comments »

If you have ever developed in PHP, you have likely utilized the amazing strtotime function. It lets you throw any string at the function, and it returns an integer UNIX Epoch timestamp. It’s incredibly flexible. All of the following will return a valid UNIX timestamp:

  • strtotime("Nov 2, 1984");
  • strtotime("Nov 2, 1984 5:34AM");
  • strtotime("Nov 2, 1984 15:34");
  • strtotime("Last Tuesday");
  • strtotime("Tomorrow");

Now that I’m doing some work in Cocoa, I really miss this capability. Thankfully, as every copy of OS X (at least since 10.4) has shipped with /usr/bin/php installed by default, we can call it from Cocoa! Here is some code that will return an NSDate from a string, via PHP’s strtotime();


-(NSDate *) stringToTimeViaPHP:(NSString *)aString
{
    NSTask *task;
    task = [[NSTask alloc] init];
    [task setLaunchPath: @"/usr/bin/php"];

    NSString *strToTimeArgs = [NSString stringWithFormat:@"print strtotime('%@');",aString];

    NSArray *arguments;
    arguments = [NSArray arrayWithObjects: @"-r",strToTimeArgs, nil];

    [task setArguments: arguments];

    NSPipe *pipe;
    pipe = [NSPipe pipe];
    [task setStandardOutput: pipe];

    NSFileHandle *file;
    file = [pipe fileHandleForReading];

    //NSLog(@"Launching %@ ",[task arguments]);
    [task launch];

    NSData *data;
    data = [file readDataToEndOfFile];

    NSString *string;
    string = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];

    int dateInterval = [string intValue];

    theDateTaken = [NSDate dateWithTimeIntervalSince1970:dateInterval];
    //NSLog(@"The date stands as %@",theDateTaken);

    return theDate;
}

I’ve only tested this on Leopard (Mac OS X 10.5.2), but it should work on Tiger as well. I am releasing this code under the MIT License. Let me know in the comments if you find it useful in your app.

Monday 4/28 around 5 pm   No Comments »
  • Seriously, is Comcast Baltimore ridiculously slow for anyone else this morning? #

Powered by Twitter Tools.

Saturday 4/26 around 11 pm   No Comments »
  • Jobs are such strange things… You actually have to do them! When some people don’t, Michael gets angry… #
  • Move the mouse… Now, click it! Click it you fool! #

Powered by Twitter Tools.

Friday 4/25 around 11 pm   No Comments »
  • Katie passed her orals!!! #

Powered by Twitter Tools.

Wednesday 4/23 around 11 pm   No Comments »

It turns out you can play with the URL in the new CNN Shirts site. This would be a perfect CNN Headline.

Via Ryan Block.

Monday 4/21 around 12 pm   1 Comment »
  • How many people can say they’re stuck in Papal traffic? #
  • Does anyone find it odd that Costco sells funeral supplies (coffins) in bulk? http://tinyurl.com/2lybzd #
  • Damned spammers. #

Powered by Twitter Tools.

Wednesday 4/16 around 11 pm   No Comments »
  • Fenyang, Shanxi, China’s coordinates are 37.264722, 111.777500, if you’re ever looking for it on a Google Map. http://tinyurl.com/3p9a5c #
  • @hotdogsladies , let’s just call it Merlin’s Law. #

Powered by Twitter Tools.

Tuesday 4/15 around 11 pm   No Comments »

Cream cheese filling

In a mixing bowl put:


  • 8 ounces cream cheese softened to room temp

  • 1/3 cup white granulated sugar

  • 1 egg at room temperature


Mix on medium until smooth.

Cake Ingredients

  • 1½ cups all purpose, unbleached flour
  • 5 tablespoons cocoa (not dutch-processed)
  • 1 teaspoon baking soda
  • ¼ teaspoon salt
  • 1 cup dark brown sugar
  • 1 cup water
  • 1/3 cup canola or other flavorless oil
  • 1 tablespoon apple vinegar
  • 1 teaspoon vanilla

Instructions
Butter a 12 cup muffin tin. Preheat oven to 350°F.
Sift flour, cocoa, salt, and baking soda into a bowl. Mix water, oil, sugar, vinegar, and vanilla together. Combine the two and stir just until combined. Divide evenly among the 12 cups in the muffin tin. Add about 1 tablespoon of filling per cup…just plop it on top.
Bake for 15 to 20 minutes or until the cake portion springs back when touched and the cream cheese has turned a light gold around the edges.
Remove from oven, allow to cool 5 to 10 minutes and then carefully remove the cakes from the tin. Eat warm or cool totally.

Tuesday 4/15 around 6 am   No Comments »