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.