Erik Zaadi

The tales of a coding manager addicted to dad jokes

Recent Posts

Node.js - Much more than a webserver

I’ve started to play around with Node.js lately, and it’s amazing.

Without to much effort, I hacked up a script that parses my .less files to css and minifies them, furthermore, the script minifies my javascripts with uglify-js.

The node js automagically runs when I save a .less/.js file, and notifies me via growl notifications if it’s succesful or not..

The ease of setting this up, and the fact that it works flawless both on the Mac and Ubuntu blowed me away.

Install script to run asp.net mvc 3 with Razor on nginx at a OpenSuse server

Well, the title kind of says it all ;)

For the git lovers out there clone https://github.com/erikzaadi/MonoRazorScripts.git, or simply download the zip from https://github.com/erikzaadi/MonoRazorScripts/zipball/master and unzip it.

Then run :

sudo sh ./install.sh

And voila, a couple of minutes later, you should be able to access your server via http to get some GUID-alicios Razor driven content!

To deploy your application:

  1. Delete the directory "/srv/www/monodocs/default"
  2. Copy your application to "/srv/www/monodocs/" and rename your folder name to “default”
  3. Copy the file “Default.aspx” into the new “default” folder
  4. Copy the dll files in the folder "/srv/www/monodocs/libs" into the bin folder of your application
  5. If you have the file “Microsoft.Web.Infrastructure.dll” in your bin folder, delete it

The source is at : https://github.com/erikzaadi/MonoRazorScripts

You know you are a geek when you have a site for your wedding, and even more when there are easter eggs at the site as well.

Whoa that was a long title.

I’ve been rather busy lately with preparations for our wedding, you know, find a location, get a suit, build a website for the wedding, lose the beer belly and such.

Oh yea, you caught me, I couldn’t resist it.

I actually did a full scale cross media campaign for the wedding, with the initial excuse that it would save me and my bride to be some time and effort with counting and verifying the RSVPs of our invitees.

Google Url Shortener Api for .net

I read a short and concise post by David Walsh, demonstrating a simple php class for using the new Google Url shortener Api.

I played around with the code a bit in C#, and voila! A .net version (with some additions).

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
var googleShorter = new GoogleUrlApi("PUT_YOUR_LONG_KEY_HERE");  
  
var urlToPlayWith = "http://www.google.com";  
  
var shortUrl = googleShorter.Shorten(urlToPlayWith);  
  
var longUrl = googleShorter.Expand(shortUrl);  
  
var longUrlDetails = googleShorter.ExpandFull(shortUrl);  
  
var analytics = googleShorter.GetAnalytics(shortUrl);  

Besides just creating short urls and expanding them, you can also get Analytics information about the shortened urls.

Customer Satisfaction

Yesterday I delivered a small site to a customer.

The site was not to fancy, simple and strait forward in a “get the job done” kind of way.

When I showed it to the customer he literally lit up, and was really enthusiastic about the quality of the site.

It was a pleasant surprise, as I didn’t really have such high thoughts of the design of the site that I did.

Readability VS Uber Cool One Liners VS Performance

Given that you need to do a MD5 hash in C#, which approach would you take?

A not so readable but cool one liner:

Or

A more readable and performance wise approach?

[Update:] Alex proposed the following, verbose, but as an extension:

1
2
3
4
5
6
7
8
public static string CalculateMd5Hash(this String input)
{
    return System.Security.Cryptography.MD5
        .Create()
        .ComputeHash(System.Text.Encoding.Unicode.GetBytes(input))
        .Aggregate(new StringBuilder(), (a, b) => a.Append(b.ToString("X2")), a => a)
        .ToString();
}

What do you think?

Dynamic Pitfalls

I’m working on an asp.net mvc 3 powered site (for my wedding actually!), where I decided to try out some new technologies I’ve been wanting to play with for a while.

The first technology is the combination of EF 4.0 (AKA Entity Framework), and the new SQL Server Compact 4.0, which is working nice so far, and hopefully I’ll elaborate more in the matter in a future post.

The most important thing I wanted to test though was asp.net mvc 3 (RC), running on .NET 4, especially the usages of the dynamic keyword.

Let’s open source time

Lately I haven’t been able to find myself as much time to work on open source as I used to in the past.

It annoys the hell out of me, but sometimes work + private life = less time to to hack and contribute..

One does have to make a living of course, but I’d love to be able to do is to contribute back to open source from within a working environment that truly appreciates open source.

Startup Weekend, Android, Vim, Razor and a bit of Chirpy

Whoa, it’s been a while since I’ve written.

A lot of stuff has been going on lately, so this post will be a quick summary..

  1. Startup Weekend - Tel Aviv The second startup weekend in Israel took place in the Peres Peace House, in Yaffo, where Palestinian and Israeli joined forces for a lovely three day hack fest (http://tel-aviv.startupweekend.org/)

    I joined a brilliant idea called MovieOke (Karaoke with movies), and really enjoyed working on the project during the startup weekend..

Java Java for a .Niet dev

I’ve been hacking on a small Android application lately, which exposed me to Java.

I’ve never really written an entire application in Java before, and the experience is rather interesting.

I mainly write in C# for server side code, and although I like to learn other languages, C# still remains my favorite language.

Java for me was very similar to C# (and ActionScript too, being yet another ECMA’ish language), and writing it was not as annoying as writing c++.