Monday, February 23, 2009

Showing current branch for GIT in bash profile

Add into ~/.bashrc

PS1='\[\033[01;32m\]\h\[\033[01;34m\] \w\[\033[31m\]$(__git_ps1 "(%s)") \[\033[01;34m\]$\[\033[00m\] '

Thanks to http://www.shaldybin.com/2008/11/small-surprise-from-git-16.html

Saturday, February 7, 2009

Select Isn't broken

I have just read the following in The Pragmatic Programmer:

Even if the problem does lie with a third party, you'll still have to eliminate your code before submitting your bug report.

And I recalled that several weeks ago I was in a similar situation. My server script executed 2 times after submitting form. I tested all the code, and didn't understand, almost went crazy, asked colleague for help, we couldn't find the reason for such behavior. Direct call of action was fine. I began to think that the problem was in Codeigniter code and I was about to send them a bug report. However, after testing the code in another browser was successful, I began to suspect HTML of the site that came from client. What was found? 

<a href="url"><button></button></a>

generates 2 requests in Firefox. So we omited link and changed to type submit and everything was fine.
Ok, what's the lesson? Always be suspicious. But it is like 99% the problem is in your code, not in OS, external library or framework.