Codeigniter is not dead! And yes, Laravel is sexy!

Everywhere, everyone is saying CodeIgniter is dead! CodeIgniter is not dead so shut up!

That’s being said. Lately I have been exploring a lot of new things, new for me. I learnt composer. I have ported a library as a composer package which I use in my company. Learnt nodejs. And started exploring ExpressJS.

Then I bumped into Laravel. The sweet little thing that is gaining a lot of traction these days. and which is giving a lot of heat to CodeIgniter is dead argument. Well I beg to differ. CodeIgniter is not dead.

First of all let me tell you from my experience. CodeIgniter is a boon for those developers who want to dive into MVC and PHP Frameworks. CodeIgniter is dead simple to use. Install it and start using it right away. Laravel fans will argue that same goes for Laravel. But you see, for using Laravel properly, you need to know how to use Composer and some other little things.

The beauty of CodeIgniter lies in it’s simplicity. You don’t need to define routes for starters. unzip the code, create a new Controller and there you go.

No doubt Laravel is awesome. I liked Laravel too. I am going to ditch CodeIgniter pretty soon. but not because it is dead. But because, Laravel is built on top of good programming patterns and concepts. Dependency Injection is exactly how you should write your code. Every Class should only know what is happening inside it. Nothing more. You should be able to change dependencies on the fly. Move to other Database with one line change.

But still, there are a lot of apps I have built that are built using CI. And there are a lot of websites that are built on CI out there. There are millions of websites out where built on top of CI. So it’s not going anywhere. CodeIgniter will stay for a little longer.

Yes, CodeIgniter is not dead. But at the same time, Laravel is pretty sexy too!

I am a composer

Just a couple of minutes back, hours to be precise, I wrote my first Composer package.

For those, who don’t know what Composer is, It’s a dependency manager for PHP. Some like to call it a package manager. Thats wrong! It’s a dependency manager.

From past few months, I have been craving for new knowledge. So I started digging up Internet like I used to do earlier. I bumped into Laravel, newest thing happening in PHP world. I tend to stay away from new frameworks, libraries as much as I can. Why? because till the time they are mature enough I cant use them in my code – I write code for enterprises, so can’t fuck up there. I cant afford to.

But Laravel actually reminded me of important, useful actually,  it is to write good, clean and efficient code. Let me stop here. Ill save it for next post.

Anyways, One thing I quickly learnt that Laravel uses Composer heavily. Thanks to the docs, I installed Composer and was up and running in few minutes. You can do it in seconds it you have good Internet connection.

The geek inside me quickly woke up. Forget Laravel, what the heck is Composer and how to use it? – all I could hear inside my brain.

So I Googled. And found this and this tutorial. Oh, and THIS – main resource. I must say, Composer is going to save a lot of hassle if everyone starts using it. I mean, look around you. Everywhere you will find poorly written code. Because of a lot of reasons. One of which is there is no standard in PHP. PHP is a loosely typed language.

Anyways, What I ended up with is this: hello-composer. It’s on Composer’s repository too if you are feeling courteous.

After this, I quickly started working on a real composer package. First thing that popped into my mind was Facbeook SDK. I have been using it for all sorts of applications in my Company. I am working on it. Let’s see where it goes!

Oh yes, I am not sorry if you find this post all over the place. I am half asleep and it’s 3:30 in the morning. Damn, I should sleep.

Y U NO ADD MY ICONS, PhoneGap!

So, I have started playing with PhoneGap at last. I find it a little funny though, how we developers/programmers can trick no-tech guys. I mean its just a web browser which is launched in full screen mode.

Anyways, PhoneGap is bloody easy to work on. If you are a good web developer, you can create and release an app in under two mins, Literally!

I have been monitoring PhoneGap since it’s inception. But stayed away because it was in beta. With version 3.0.0 they have labeled it stable. I beg to differ. It’s nowhere close to stable. Maybe that was too harsh. Actually, Its not that stable is the correct way of putting it. There are bugs:

First, I installed it on my MAC. Created an app. Changed config.xml to pick up icons that I created. I compiled it and installed it on my device and BAM! My icons were nowhere. PhoneGap didn’t pick up my icons. Instead, it installed default icons. Natural Instinct? I searched! And after a lot of searching I saw I wasn’t the only one facing this issue. As a good programmer, I wanted to log it as an issue, but someone else already did. So, it’s ok!

Second, I installed PhoneGap on my Ubuntu Machine. Created a new project. opened up the www folder and all I could see was index.html and a config.xml file. The file structure and files that PhoneGap builds is completely different on different OS. I didn’t try it on my windows machine though.

So far it’s the experience is okish. I can create apps, beautiful apps. All hail to HTML5 and CSS3. But it would be great if PhoneGap could keep the file structure similar on different OS. Otherwise, whats the point of being a cross-platform development framework.

I hope they fix these soon!

How Social is this URL?

At the place where I work, we do a lot of research about a brand before pitching an idea to them.

One of the key metrics that we present to our clients is the social reach of their products, websites etc. It’s a simple metric that tell you a lot about the health of a brand.

But lately, I noticed that whenever a person in our office had to get these numbers, he/she had to ask someone from tech team to get it for him/her. This is a time consuming process, plus it wastes a lot of time of my tech resources. Solution? Spend 1 hour to build a simple tool and save numerous hours that are wasted on digging up these numbers.

So I built this tool: Shared Count. Its a very simple tool that asks you for a URL and returns various social counts for it. Sure tools like these exists. Why I created this? Because, other tools don’t have a good UI. Mine has. At least it’s better in my view. Plus, I will have control over it. I can modify the code at will. Include/exclude features or supported websites.

I have released its code as open source. You can check it at Github. Fork it, Modify it.

Travel and Travel often!

Yesterday, I received an invitation from Medium. I was wondering whether I will post again or not. And here I am!

What inspired me today, besides Medium’s excellent editor, a video. A video which mad me happy and sad at the same time. Check it here. A colleague sent it to me. The timing was bang on. I was thinking about my cancelled plan. The last trip I wanted to go for. My yearly ritual to Himalayas. Didn’t happen this year.

Somehow this video shook me from the inside. It made me realise that working your ass off will only get you money ( yes some happiness too, but temporary happiness ). Day by day, I am becoming mundane.

Maybe its a hint, maybe its not. What I do know is, I will travel more often from now on. Even if its a weekend getaway, I am going to pick up my bike and head in a direction.

Google Plus Project Invites

I’ll keep this post short and straight!

If you are one of those who are still not allowed to use Google+ Project, then you can use following method to get/send an invite:

If  ‘A‘ is a guy already using Google+ and ‘B‘ who wants to use Google+, then:

  1. Ask A to add B as a Gtalk contact.
  2. Ask A to create a new circle and add B as a contact in that circle.
  3. Then, A should update a status message in his stream marked to the newly created circle with B as a contact in it (as you do on Facebook using lock icon for lists).
  4. After the message has been posted, the B will receive an email which acts as an invitation email.
  5. That’s it! Enjoy!

This method worked for me. Let me know if it works for you as well or not.

Google+ Screens

Lately, Google released Google+ Project. Sadly, I wasn’t allowed to access Google+ Why? Cause, I am banned from Google Labs.. Reason? My account is marked malicious!

Today, @karansinghmagic sent me an invite :) and I got in! At first glance it felt much better than Facebook, at least visually!

Now for all who want a sneek peak of what Google+ Project looks like, I present following screens. So Enjoy!

Validating URLs

How many times have you struggled with URL validations? I have struggled a lot. Damn, those stupid regex(s). Well regex as a tech is not stupid, it’s awesome. but when u have a 10,000 regex expressions to choose from? and on the top of that every regex gives different result.

When I faced this challenge, I tested more than 80+ regex expressions, obviously not in a day :P. Then had to settle with a regex which had a least probability of producing -ve results.

Obviously as a programmer, I wanted better alternative. And I stumbled upon PHP filters. Well, it can be used for other things than validation as well such as sanitization, etc.

Why I would like to use filter_var instead of my or anybody else’s regex. Simply because, regex used in filter_Var are well tested and produce far less -ves. Moreover, being a native function, it produces results faster.

As far as my Codeigniter Application is concerned, I have extended the Validation library:

And I am all set *grins*.

Second view towards life!

Why do people tour? Especially on motorcycles?

So it’s time for my next road trip. Yay! It’s been several months since my last trip. Gosh! That was one hell of a trip. Thrilled? Hell yeah! This is much better than the weed I smoked this Friday. The only thing that is irritating me right now is the flu. I hope it gets cured before Thursday.

Coming back to the question. If you ask me, I have no f’ing clue! Though I heard it somewhere that people take up motorcycling because they lost their War of Love. Some say, cause they want to see the world. Seriously? People have their own perception about the things, I won’t be judgmental.

I do it cause, When I am on my bike, I am me. I like the smell of raw nature, that aroma which fills your lungs when you pass through a valley. Those endless roads and that sense of uncertainty.

Plus, It’s the freedom you have, you feel. No worries about work, about people. You don’t have to please anyone. You don’t have to fake your smile. You don’t have to hide!

Imagine yourself standing at the edge of a cliff 10,000 feet above sea level. You can scream your heart out and no one will question you :)

and, for those who couldn’t make out anything from above written text. Well, who cares!

Mating Processingjs and JQuery

In my latest weekend project, I wanted to integrate jquery with processingjs. The way processingjs is developed, it’s requires a little trick to fire up processingjs at will. Though after much struggling I came up with following.


$(document).ready(function() {

dom_el = $("#canvas").get(0);

code = ''; /* fetch source string using ajax or hard code it */

stage.set_stage(function() {
stage_instance = new Processing(dom_el, code);
});
}

Code is pretty much self explanatory. The real essence is the Processing() constructor. It takes two arguments viz: Canvas DOM element and the source code string.

You can always fetch source code from a file using $.ajax(). I am using $.get();