This blog - now archived - is read-only.
New blog: Mohammad Emran Hasan.

Category Archives: General

Setting up central Mercurial server in Ubuntu

Mercurial

It’s been a while since we’ve been thinking about moving to Mercurial from Subversion at our company. We were convinced about the benefits of DVCS and chose Mercurial over Git. However, due to pressure at work and some procrastination, the move was delayed a couple times. Finally, today we had the move and the team is already up to speed with it.

Although it’s quite simple to install it in a central server, the different articles on the web had me confused with too many options or with a different distro than Ubuntu. So, here is a dead simple list of things to do for installing Mercurial centrally for your dev team.

Continue reading

2011

First, a very happy new year to everybody!!! The last year has showed me the ups and downs of life and I believe 2011 will be a great year. Some of my wishes in 2011 would be:

  • Re-shaping my company to become a major OSS based company in Bangladesh
  • Doing something meaningful for my country
  • Learning Ruby and related frameworks (Rails, Cucumber, etc)
  • Spending more time my family
  • Having more fun with my friends
  • Living a healthy life

Using Twitter for sending server downtime alert

Today I’ve written this simple PHP script to alert me through Twitter whenever our company’s local server is down. The script is called by a cron every 5 mins in my central hosting. Without much babble, here goes the code (if you’re interested to know why I needed this, that’s at the bottom of the post):

<?php

// Specify the target URL in your server
$targetUrl  = 'http://YOUR_SERVER_URL';

// Specify what the response is from the server
$targetText = 'Hello from Daredevil';

// We will be using cURL for fetching the content
$ch = curl_init();

// Set the params
curl_setopt($ch, CURLOPT_URL, $targetUrl);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// Get the response
$response = curl_exec($ch);
curl_close($ch);

// Are things in right place ?
if ($response == $targetText) {
    die('Site is up and running!');
}

// Nope, so here are the sender's twitter info
$username = 'SENDER_TWITTER_USERNAME';
$password = 'SENDER_TWITTER_PASSWORD';

// Receiver's twitter username
$receiver = 'RECEIVER_TWITTER_USERNAME';

// Alert message to send
$message = 'Daredevil is not responding, please fix ASAP!';

// The Twitter API address (new direct message)
$url = 'http://twitter.com/direct_messages/new.json';

// We will be using cURL for this
$ch = curl_init();

// Set the params
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$receiver&amp;text=$message");
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");

// Send the request
$response = curl_exec($ch);
curl_close($ch);

// Success or failure
if (!empty($response)) {
    echo 'Recipient has been notified.';
} else {
    echo 'No response from twitter.';
}

Why I needed this?

Recently we have setup a server at our office for committing work to a local SVN repository and have the QA test our work whenever they are ready. We also have a staging server where we do SVN update from this repo. Now, for the last few days, I’ve found the local server to be off due to a few reasons – but every time I realized this at night when I am back home and can’t do anything to turn it on. So I thought about this Twitter alert which is sent to my cell phone immediately when the server goes offline.

Btw, if Twitter doesn’t send SMS to your country, don’t worry. Check out the excellent service at Twe2 that I’ve been using for a couple days.

Cheers!

A Workshop on “Freelancing IT Jobs – How to Make Yourself Ready”

Today I facilitated this workshop on Freelancing, organized by BDjobs.com. The primary focus of the workshop was to introduce the concept of freelancing to the attendee’s as well as to provide them with a general hands-on path on how to start freelancing. The total workshop covered a variety of sections starting from freelancing overview, freelance site reviews, tips on building a professional profile, the bidding process, tips on successful bidding, client management techniques, payment pitfalls, payment methods, etc.

You can download the presentation file here in two formats: PDF and Powerpoint.

The full workshop description is provided below. If you’re interested in attending the next workshop on April, get in touch with BDjobs.com.

Continue reading

Seven Things

Well, this seven unknown things internet meme has been circulating in the web for a while and I am joining after seeing this in a few blogs I follow. However, haven’t seen this in my blogger network from Bangladesh so hope it will make a few laughs.

So here goes seven random (weird) things about me:

1. The veins in my left eyes are dried up, so I practically use my right eye for everything…pirate king!

2. The real break in my programming life came when I went to a programming contest with a team and was declined to participate. We had our rights and they later let us in, but gave us a almost broken PC. We cracked three out of 5 problems straight in DOS edit as the compiler would hardly run :)

3. I do not watch TV programs for the last 5 years. DVDs and downloaded movies/TV series are the only source of entertainment. My most fav TV series is The X Files.

4. When I was a kid, I was damn fond of toys. I had a whole collection of figures from HE-MAN, J.I.JOE, Thundercats, Transformers, and a few others.

5. I was present only in 48% classes in my second year in college, whereas the rule of thumb was a minimum of 85%. After the test exams, I was given a punishment of attending to library from 8am to 5pm for 26 days where the only thing allowed is study (textbook only). No friends, no gossip, no newspaper.

However, I convinced my father that this punishment was imposed to me as one teacher did not like my attitude in his class; i made my father to the principal with an application where its mentioned that I cannot attend this due to medical condition. Principal had to agree and I only had to do it for 2hrs for the sake of records ;)

6. The first program I wrote for money was a file copying & renaming program in VB6 for $20. It would transfer some old mail server (don’t rem the name) files from an old server to a new one and would rename their extension to match Microsoft Exchange. Exchange was smart enough to read & convert automatically, so it looked as if the program did the conversion. Heh heh.

The fun part is, later another company was somehow convinced that it’s a huge work and went into a partnership with me where I received a down payment of $1500 and a 30% profit sharing with the same application plus a few UI improvement. Not bad ;)

7. I never studied Computer Science nor did any programming classes. I have been in business studies concentration since school and did my bachelors in Business Administration (BBA). Currently I’m pursuing my masters in Business Administration (MBA) as well.

Here are the seven people I’m tagging:

1. Hasin Hayder
2. Anis Uddin Ahmad
3. NHM Tanveer Hossain Khan
4. Omi Azad
5. Trivuz
6. M.M.H Masud
7. Suhreed Sarkar

And here goes the rules:

- Link your original tagger(s), and list these rules on your blog.
- Share seven facts about yourself in the post – some random, some weird.
- Tag seven people at the end of your post by leaving their names and the links to their blogs.
- Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.

Enjoy!

Code Updates (HTTP class, Extended CodeIgniter Model, Cross-domain AJAX transport)

Greetings to all the readers of my blog.

Many of you have been writing to me in the last couple days when I took the site down. The main objective was to add the new theme and push a few code updates of the existing libraries. I really appreciate your concern and would like to reassure you that the site is up and will be up as usual :) Now, besides the slightly customized theme from Elegant Themes, I have put a few code updates. They are detailed below:

Extended Model for CodeIgniter

The original version of the Extended Model for CodeIgniter has been serving many people well. Although most users loved the nifty functions of the Model, many (including me) didn’t like the hacking of CI core to get this functionality. With the release of CodeIgniter 1.7, we can avoid that as we can now overload the Model class of CI like the other libraries. Follow this instruction:

1. Download the updated version from here
2. Put it in your application/libraries folder
3. In your model files, use it this way: class Product extends MY_Model
4. Everything else is same just like the original one

HTTP Class

There is not much update in this class except for a few bug fixes (thanks to you guys). Also, I have included a license file in the package as many of you have asked. It’s released under the MIT license. The original post is here for reference.

Download the update from here and the API reference is here.

Cross-domain AJAX calls using PHP

A minor bug fix in the code. Thanks to a few of you who pointed them out. Original post is here. Download the update from here.

I have accelerated plans for the blog in 2009 so stay tuned for some worthy posts in this month. And do write to me if you feel you have any questions/ideas/suggestions.

Cheers!

Nokia N81 8GB

Today I bought a Nokia N81 8GB smartphone from my friend Nesar. This is an upgrade from my previous Nokia 6300, which I’ve been using for 1.5 year (thats the longest time I’ve used one model). The Nseries of Nokia has been attracting a lot of people lately, with their great music and photo capture features. One of my colleagues, Anis, also bought N73 just two months back.

Nokia N81 8GB
Nokia N81 8GB

Now, good points first. The N81boosts an extremely loud set of sterio speakers – combined with its Music Express, it delivers the highest quality of music I’ve ever purchased. Combined with the built-in FM radion, the dedicated music keys, and a multimedia menu – this is a music powerhouse, thanks to the all new Symbian 9.3 OS.

The Symbian OS is superb with all the applications and now has some stunning gameplay capabilities. The phone also has all kind of connectivity point you might need – GPRS, EDGE, Wifi, Bluetooth, WLAN, 3G. And don’t forget the built-in 8GB memory.

The only downside of this phone is the camera. It’s a 2 megapixel camera – which I don’t have any clue how got into a Nseries phone. If there is not enough light, the pictures are somewhat blurry. It has flash and a number of picture modes, so its a decent one – but nowhere in comparison with other Nseries 3.2mp and 5mp cameras.

All in all, here are the facts:

  • 2.4” QVGA main color display (320 x 240 pixels), up to 16.7 million colors
  • S60 3rd Edition Feature Pack 1 based on Symbian OS v9.2
  • Dedicated media keys for quick and easy access to music and video
  • WLAN IEEE802.11 b/g with UPnP (Universal Plug and Play) support
  • Bluetooth Specification 2.0 (profiles supported: DUN, OPP, FTP, HFP, GOEP, GAP, SPP, HSP, BIP, A2DP)
  • Micro USB 2.0 Full Speed (mass storage class)
  • Nokia AV Connector 3.5mm
  • Up to 2 megapixel (1600×1200 pixels) camera, MPEG-4 VGA video capture of up to 15fps
  • Zoom: digital up to 20x
  • Front camera (CIF)
  • Video call and video sharing support (WCDMA network services)
  • Integrated flash (modes: on, off, automatic, redeye reduction)
  • Rotating gallery with Navi wheel support
  • Nokia Nseries digital music player supports MP3 (VBR), AAC, eAAC+, AAC+, WMA/M4A, WAV
  • OMA DRM 1.x, 2.0, Windows Media DRM (OTI/OTA with Nokia Music Store*)
  • Synchronize music with Windows Media Player 11
  • Media keys (play/pause, stop, forward, rewind)
  • Stereo FM radio (87.5-108MHz /76-90MHz)

Let’s see how long it can serve my ever-growing thirst of technology :)

Increase productivity with Todoist

If you’re like me, you’d want to keep your ever busy life a bit organized. Being a techie, you’d first find a tool that will facilitate you in doing so. Most of us are fan of a number of such tools: RememberTheMilk, BackPack, Ta-Da List, 30boxes, Microsoft OneNote, Stickies etc. I’ve also tried all of them and a few others, stuck with them for a few days, but later lost the interest. This happened until one of colleagues, Anis, suggested me to have a look on Todoist.

At first sight, I thought it as “okay…another web 2.0 brainchild”. It seemed too simple to handle my complicated needs and I did not have high ambition with it. But as days passed, I was discovering new new features of it and gradually it became a part of my life. I’m a big fan of Getting Things Done (GTD) approach and Todoist became my dropbox for all the tasks in my mind.

If you ask me what’s so special about Todoist, I’d mention the following few features:

Simplicity

Todoist is damn simple and hosts one of the most powerful yet sleek web 2.0 interface on the web. It allows you to have an unlimited nested category/project list and under each of them, unlimited nested task list. This is something that most other tools miss. For me, it’s a super MUST feature.

Continue reading

Beware of the so called “Senior PHP Developers”

With the rise of PHP developer as career, many are trying to get their share in the pie. Lately I’ve met a number of developers who have worked for more than one/two years in developing PHP applications in various companies and they consider themselves as “senior” developers. They try to emphasize that they’ve done enough raw programming and they are now in a position where they’ll only design architecture of applications.

When you interview them and ask about complex topics, they’ll reply: “Oh my last company didn’t allow me work with that, but I’ll be able to grab that in a day“. You trust them and think that if they get the chance, they’ll sure be able to excel. After all, they’ve got that Company X’s experience and Guru Y’s reference.
Continue reading