Friday, November 30, 2012

Fixing a Problem

Problems. They're everywhere, especially in my country. They range from simple annoyances to huge socio-economic issues that will take a large amount of effort, money and divine intervention to cure.

As humongous or diminutive as problems might be I believe that the solutions to them come about by chipping away at the issue in a very incremental manner. It just takes time and a fair amount of consistency, but eventually the problem will dissolve.

But what about this case - what do you do in a case where the solution to the problem is so simple, yet the people for whom you are solving the problem are too paranoid and distrusting for them to even dip their toe in the solution unless they see someone else drinking the proverbial Kool-Aid first? What do you do then? What becomes of the problem? Can it still be classified as a problem since nobody seems to want it solved or everybody balks at the presented solution?

There is a culture in my country that says no solution (or product in a general sense of the word) is any good unless millions have been spent in creating it is presented with lavish press conferences and promotional campaigns. I honestly find this highly annoying and it shows where we are as a people in terms of our mental development.

I'm daring to change that culture and see if I can bring my country even one step closer to the 21st century. That's why I'm challenging myself to fix a problem that plagues everyone in my country, and i'm going to fix it with a budget of $20USD and I want to see how my countrymen react to it. It's going to be practical, free and simple to use. Let's see how it goes.






Thursday, August 23, 2012

jQuery QR Code Generator

So I came across a QR Code (2D Barcode) generator tonight that is written in pure JavaScript, relies on jQuery and makes 0 calls to any external API.

It's called jQuery QR Code and it's written by Jerome Etienne. Take a look at his GitHub project and tell me  what you think. This will definitely come in handy on my current project!

Saturday, March 03, 2012

Fixing Ubuntu Issues: No Wireless on Reboot

Continuing on with my series on solving problems I've encountered while using Ubuntu 11.10, I've found yet another solution to a problem that I heard a lot of people talking about. It's also a hot topic on the Ubuntu forums. I',m speaking, of course, about Ubuntu and wireless internet access.

In recent times it has not been uncommon for Ubuntu to not be able to connect to my wireless network on boot up, so I did some digging and found out that the problem was that the Automatic DHCP IPv4 settings were to blame. My solution: use manual IPv4 configuration. Here's how.

My internet set up is as follows :- My modem is connected to my wireless router which propagates the signal that my PC's USB wireless adapter receives. There's plenty of networking going on there, (something I am not the best at) but I do know that finding out the IP addresses of my various pieces of network hardware will be the key.

So on my Windows machine i ran ipconfig and found out those addresses:

192.168.1.1 - My modem's address
192.168.2.1 - My wireless router's address (Default gateway)
192.168.2.5 - Address of PC
255.255.255.0 - Subnet mask

I took those settings over to Ubuntu, opened the network manager by clicking the Wireless icon in the top task bar, selecting Edit connections... > Wireless > FBI_VAN_467 (My SSID) > Edit... > IPv4 Settings and entering the information as follows:


I chose a random non-conflicting IP address for my Ubuntu PC's address, used my wireless router's IP address for my default gateway and set my DNS server address to my modem's address.

After that it worked like a charm. I hope this helps!


Thursday, March 01, 2012

New Search Engine - DuckDuckGo

After reading this very interesting and informative article (http://dontbubble.us/) and hearing mentions of it in the tech-o-sphere, I was intrigued to look into this DuckDuckGo search engine to see what it was about.

Now, anybody who knows me knows that I'm a G-Man (Google Man) through and through, but honestly i've not been to happy about their recent skirmishes with the law when it comes to people's privacy and the extent to which they will go to get your personal information so that they can target ads to better suit you.

Truthfully I was never a fan of the idea that I was being herded and processed by a big company that was going to use my personal information, my likes, dislikes, hobbies - my personality - to make money, but I had to tolerate it because it was the companies behind some of the best internet services that I use were doing this.

Now there's a new duck in the search engine pond and this one is more morally secure and less thirsty for money and is doing... just fine! I'm talking of course, about DuckDuckGo.

Granted i've only been using it for a grand total of 6 hours, I was very impressed with the speed, the relevance of the search and the cleanliness of the design... I'm just not too fond of the name. It doesn't quite adhere to the web 2.0 naming convention of 2 syllables, real/unreal word but I guess it sort of works for them. DuckDuckGo doesn't really roll off the tongue like Google or Yahoo or Bing but the name contributes to the overall playful charm of the site and to be honest, I would be reluctant to use another Web 2.0 named search engine like Searchly or Fynd or something like that.

A Sample Search

I did a Google search for  Railscasts and compared the results to those I found on DuckDuckGo. I preferred Duck's search results. They pointed to some more relevant resources.

Google Search Results

Results from the Duck
I personally prefer Duck's results. As you can see I snatched up the Railscasts them for Vim :) What do you think?

Friday, February 24, 2012

Validating Virtual Attributes in Rails 3.1

When validating virtual attributes in Rails it's important to remember that they are just that - virtual attributes. I spent almost an hour last night trying to figure out why my validations were throwing an error when I called Object.valid? My class was structured similar to the following (forgive me, I am a Rails n00b):
Class User

attr_accessor :password

validates :password,
:presence => true,
:on => create

validates :password,
:length => { :minimum => 6 :maximum => 8 },
:if => :password?
.
.
.
end
When calling valid? on the User object I got a method undefined error for password?. I could't quite figure it out and I was wondering what I was doing wrong until eventually I tried appending the following to the bottom of the class definition:
.
.
.
def password?
 self.password.present?
end
.
.
.
An seemingly simple and obvious solution, I know, but this took me about an hour to figure out after Stack Overflow failed me for the first time.

I hope this helps save someone else the frustration I endured.

Thursday, February 23, 2012

Fixing Ubuntu Issues: Ugly Font Rendering in NetBeans

Recently i've had the displeasure of working in NetBeans on Ubuntu. The IDE is great but the font rendering is terrible. Here's my solution to this problem.

The first step is to uninstall Open JDK (if it is installed) and install Sun's JRE. Do that by selecting the following packages in the synaptic package manager:

  • sun-java6-bin
  • sun-java6-jdk
  • sun-java6-jre

Mark all installed instances of Open JDk for uninstallation if you have to, then click Apply.

Confirm your Java version by going to the console and entering

java -version
You should see
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)
Now that that's done, install Microsoft's Core Fonts. Do this by going to the Ubuntu Software Center and searching for 
ttf-mscorefonts
Install them, then open NetBeans, go to Tools > Options > Fonts and Colours and choose the Courier New font. I set mine to size 18 bold. Here is my result:


Before


After

Wednesday, February 22, 2012

Fixing Ubuntu Issues: Restart Wireless Without Reboot

Sometimes after resuming from sleep, you would find that your wireless connection no longer works. Up until now, my only solution to this was to reboot. I've found an alternative solution from user mariosx on http://ubuntuforums.org/archive/index.php/t-913407.html that involves simply restarting the wireless interface. To do so, enter the following in a terminal window


sudo ifconfig eth1 down
sudo ifconfig eth1 up

Where eth1 = your network interface. Could be wlan0 or something like that. I have not yet tried this out, but it's one of the more sane solutions i've come accross for this problem during my searches.

Fixing Ubuntu Issues: Flickering Pointer

Upon instlaling Ubuntu 11.10 some of may notice that the cursor constantly flickers and sometimes disappears randomly. To solve this do the following:

Note: xorg.conf is depreciated in Ubuntu 11+

Type the following in a new console window:

cd /usr/share/X11/xorg.conf.d

sudo touch 10-monitor.conf

sudo gedit 10-monitor.conf

Paste the following into the file, changing variables where indicated by the comments

Section "Monitor"
    Identifier    "Monitor0"
EndSection

Section "Device"
    Identifier    "Device0"
    Driver        "nvidia" #Choose the driver used for this monitor
EndSection

Section "Screen"
    Identifier    "Screen0"  #Collapse Monitor and Device section to Screen section
    Device        "Device0"
    Monitor       "Monitor0"
    DefaultDepth  24 #Choose the depth (16||24)
    SubSection "Display"
        Depth     24
        Modes     "1680x1050" #Choose the resolution
    EndSubSection
EndSection

Save the file.

Press CTRL + ALT + FI to enter terminal mode and type the following:

sudo stop lightdm

sudo start lightdm

Log in and notice that the cursor does not flicker any more. You may have to unplug your mouse and plug in back in to get the cursor to work. If you do not get back to the graphical mode after starting the display manager, press CTRL + ALT + F7

Reference: http://ubuntuforums.org/showthread.php?t=1730188

Friday, July 29, 2011

Venturing Into Vim

So I heard that there's this new code editor out, and it's been out for about three decades now... so I guess when I say new I mean new to me.

As an aspiring Ruby on Rails developer, I looked around to see what was the best code editor I can/should use for handling the development of a RoR web application. The vote went almost unanimously to Vim - a minimalist as (according to its veterans) extremely powerful code editor.

So this week I took a journey into Vim land to see what all the buzz was about and boy was it a rough one. Vim is not Notepad++, Komodo Edit or any other code editor that you've used before, and that's a key concept to remember when learning to use Vim, because operating as you did in your previous editors will send you into a mad swirling fit of rage and confusion.

Vim is it's own beast. The fact that you have to press a key before entering text and press another key when you've finished entering text should tell you a lot.

After a week of use, though, I must say that I chose wisely in the investment of my time and I would like to encourage my fellow coders to do the same. Get in the know with this great (yet sometimes frustrating) piece of software; it's powerful, simple and fast.

There isn't an opinion of Vim that wasn't stated by Jeffrey Way over at his blog, so I'll leave it up to you do some further reading.


Happy Vimming!

Monday, March 14, 2011

Regular Expressions

I'm sure most of you from the programming world are familiar with regular expressions. For most of you that are from the programming world and aren't familiar with them - you should be ashamed of yourselves. I'm only this haughty because I only figured out how to use regular expressions LAST NIGHT. Can you believe that? In the middle of a large project where the deadline looms among the next sunrise and validation on a HUGE form is key, I learned to master the use of ye ole RegEx... But not without a large amount of help, though. I really have to give credit to the guys over at GSkinner.com for their RegExr tool. With this tool, I was able to turn my email address validation code from this :
function echeck(str) {

  var at="@"
  var dot="."
  var lat=str.indexOf(at)
  var lstr=str.length
  var ldot=str.indexOf(dot)
  if (str.indexOf(at)==-1){
     alert("Invalid E-mail ID")
     return false
  }

  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
     alert("Invalid E-mail ID")
     return false
  }

  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
      alert("Invalid E-mail ID")
      return false
  }

   if (str.indexOf(at,(lat+1))!=-1){
      alert("Invalid E-mail ID")
      return false
   }

   if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
      alert("Invalid E-mail ID")
      return false
   }

   if (str.indexOf(dot,(lat+2))==-1){
      alert("Invalid E-mail ID")
      return false
   }
  
   if (str.indexOf(" ")!=-1){
      alert("Invalid E-mail ID")
      return false
   }

    return true     
 }

function ValidateForm(){
 var emailID=document.frmSample.txtEmail
 
 if ((emailID.value==null)||(emailID.value=="")){
  alert("Please Enter your Email ID")
  emailID.focus()
  return false
 }
 if (echeck(emailID.value)==false){
  emailID.value=""
  emailID.focus()
  return false
 }
 return true
 }
 
 
To this :
function validateEmail(str) {
  var RE_EMAIL = /^[a-z]+[\w-_]+@[a-z]+\.[^@]*\w\w$/
  if(RE_EMAIL.test(str)) {
    return true;
  }
  else {
    return false;
  }
}
If you are like me and you never understood regular expressions, I would advise you give them a try. If you're a web developer, one of these days you are going to have to develop a form component that needs validation. Learning regular expressions is a definite time saver and I would suggest you invest the necessary time into learning them.

Saturday, February 26, 2011

Friday, February 25, 2011

Clients from Hell

Me: “Ok, we’ve pushed the site live.”

Client: “Why isn’t the site #1 on Google yet?”

Me: “We just pushed it live five minutes ago.”

Client: “Optimize the fireball.”

Me: “I’m sorry? Do you mean the firewall?”

Client: “I need more hits NOW, so I need you to optimize the fireball. I know what I’m talking about!”

Me: “We’ll get right on it.”

This is what makes my job so damn difficult. These types of clients.

Taken from: Clients from Hell

Tuesday, February 22, 2011

Productive Unproductivity

As a programmer, you learn to set deadlines for yourself - progress checkpoints along a timeline of activities that will eventually result in the completion of the application you've been assigned to create. As a programmer who went to one of the top computer science schools in the country and is now the only person in the history of that school to finish their software engineering degree in a year, you set deadlines that are to the average person highly unrealistic, but to you are a shoulder badge of confidence in your triple-A, hot shot programming skillz.

Unfortunately this confidence is the source of your frustrations as you will find that the deadline for that multi-faceted, highly featured business web application is closing in and you realize that you've spent an entire day trying to find out why the jQuery.post() function isn't receiving JSON information from your PHP script on the login page.

With just a few days left to finish this app, and a myriad of other documents, reports and meetings to tackle, this is going to be one interesting week.

Monday, February 21, 2011

Left FB For Good

I left FB for good the other day. Starting to feel those old withdrawal symptoms as of late, Facebook's team did a great job planting that seed of backtracking possibility in my sub conscience when they mentioned that "All your stuff will be there when you sign in again using your email address and password..." - talk about confidence.

The internet is really a lonely place when you're doing everything your friends aren't. In this case, i'm glad to be alone though - FB was a giant waste of time and a huge distraction from more important things.

Oh well, on to the next thing I suppose.

Tuesday, October 27, 2009

Lovely Titan Robot on Gitex Exhibition 2009 - Dubai

As a (soon to be certified) Computer/Software Engineer, it really would amaze me if I even glimpsed the components and programming that went into creating this machine.

As a primitive citizen, seeing a walking singing robot of this size is just plain scary!

Thursday, October 01, 2009

Spiderman, ALHC Showcase 2007

Who thought that the spider man theme song had so many woprds? Oh, and the dancing is pretty cool too :)

Tuesday, September 15, 2009

No School Today

Well this is a pickle! I’ve reached a point of stay-at-home-iness where I feel saturated by boredom. The fancible colours that once graced my daily routine of pacification actions have all faded to a ghastly and dowdy grey.

A mix-up of some academic records has left me without a torture pit (school) to call my own for the next few days.
What’s worse is the fact that ALL of my friends have found something to do in the mean time. The ones who weren’t victims of the mix-up have all gone back to school, or are setting foot on the bottom rung of ye old career ladder. The others who have stayed back to do over a subject or two to raise that pesky GPA are enjoying the sweet life, walking on that wonderful duplicitous edge of “I’m in school but not really”.

And that’s just my school mates; I have other friends whom I witness cresting the sweet, sandy dunes of campus life. There are the ones at UWI aka the fun-central of all Trinidadian academia and the intellectual mating ground for all post-pubescent young sluggers of all shapes and sizes. Yes I would love to go there, yes the thought of every fine, sexy kaiyo from here to Caracas all in one area is a formidable one, yes I know that guys who go there get luckier than a dollar bill at a strip club and yes, I know my girlfriend goes there (I try not to think about it, especially after previous point) stop! … I really forgot where I was going with this paragraph…


Look the point is, is that it’s usually an old friend of mine sweating his brains out through the ear at some academic institute who would ask me what I’m doing with my life these days. What am I to tell him, that I’m in academic purgatory? Or that old chestnut, “Residing in a temporary state of limbo”? I mean come on! It is in these times that I stand and babble for words because I feel like I’m wading in the shame surf because I chose to vacation on Incompetent Island. I want to be sweating my brains out through the ear; it’s how I feel most comfortable. WHERE IS MY PORTION OF SCHOLASTIC TORTURE???!!

The point is I’m bored as hell, and right now I feel like life is passing me by like a black cab in London. Sadly, I can do naught but wait, wait for my little “sichiation” to be resolved and for the schooling system to open its mouth up wide and swallow me with a gulped chaser of immense workload and unreasonable deadlines.


Hey coming to think of it, this is kind of like Burn Notice except that Michael Westen was accused of selling secrets to Bosnian intelligence agencies, and I’m being accused of… well, nothing; one of my grades was just misplaced. Oh, oh, I got a better one – Michael is trying to get back into the Central Intelligence agency and I’m trying to get back into… UTT… ok this is nothing like Burn Notice at all. Dammit!!



Tuesday, July 14, 2009

He's Not So Tough

Ok i'm kidding, if were this tough I wouldn't have gotten beaten up yesterday :'(