General

TextMate Love

I love TextMate, working in it feels no natural. Although I have been an avid VI user, more and more nowadays I keep opening up TM. And it would be so nice if TM were available on Ubuntu.

And yeah trying to make gedit act like textmate sucks donkey b****

UPDATE: Ok so I tried netbeans and also ruby mine and I still think TextMate is the best.

General

Upgrading To Snow Leopard, What a pain!!

Man what a pain, the actual upgrade was very smooth but then my mac ports broke followed by sqlite, mercurial ……

  • First thing you will run into is MacPorts are broken. To fix it is download it again and reinstall (apparently each version of MacPorts is very specific to the OS) and after you do that, un-install  and res-install all your ports, this will get apps that will work with Snow Leopard (the 64 bit version). Here’s what I do not understand when Ubuntu can maintain apt-get why can’t Apple maintain mac ports and make it easy for developers ?
  • Anyway moving on, if you had Mercurial installed from MacPorts, you can forget about it (Since mercurial is dependent on python26 which is at present broken with MacPorts. Workaround is, just download the mac version of mercurial for mercurial’s website and install.
  • Reinstall sqlite3.
  • If you had installed Ruby and Gems manually  then you will have to re-do it again here are the links to do that reinstall ruby, reinstall gems this will setup the 64 bit version of ruby.

Great, now back to some productive work @#$@!$%@

Keywords uninitialized constant SQLite3::Driver::Native::Driver::API,  python26,

General

Pragmatic Thinking & Learning

Tell me something
  • Have you ever felt that you have reached a plateau in your career ?
  • Read the pragmatic programmer and couldn’t get enough of it ? or wanted a follow up to it ?
  • Felt stuck ? Reached a stalemate ?
  • Had great many plans but never really completed them ?
  • Knew there is something better but did not know how to reach it ?
  • Wanted to get better, just did not know how to ?

Well I can with 100 % confidence tell you the answer to all these questions and more is reading the book ‘Pragmatic Thinking & Learning : Refactor your Wetware‘ -by Andy Hunt .

In this book Andy shows us

  • Why the brain works as it does?
  • How to move beyond beginner level performance to expertise ?
  • What are our cognitive biases or bugs in our brain and how to overcome them?
  • How to learn deliberately ? (learning that sticks).
  • How to harvest your ideas and insight ?
  • How to stay sharp and why is it important ?
  • and so much more.

As I was reading the book I could already see changes in me and my performance (not that kind). I can honestly tell you this book has helped me.

General

Some helpful Sqls for Oracle

1. For finding out the current running sql for a particular user

SELECT a.sql_text
 FROM v$session s,
 v$sqlarea a
 WHERE s.user    = 'USER'
AND s.status        ='ACTIVE'
AND s.sql_hash_value=a.hash_value
AND s.sql_address   =a.address;

2. To find locked objects in Oracle

3. To see all the seesion for a user

   select * from v$session s where s.username = 'PROQ';

4. To see locked objects and the session

select     oracle_username || ' (' || s.osuser || ')' username
   ,  s.sid || ',' || s.serial# sess_id
   ,  owner || '.' || object_name object
   ,  object_type
   ,  decode( l.block
      ,       0, 'Not Blocking'
      ,       1, 'Blocking'
      ,       2, 'Global') status
   ,  decode(v.locked_mode
     ,       0, 'None'
     ,       1, 'Null'
     ,       2, 'Row-S (SS)'
     ,       3, 'Row-X (SX)'
     ,       4, 'Share'
     ,       5, 'S/Row-X (SSX)'
     ,       6, 'Exclusive', TO_CHAR(lmode)) mode_held
  from       v$locked_object v
  ,  dba_objects d
  ,  v$lock l
  ,  v$session s
  where      v.object_id = d.object_id
  and        v.object_id = l.id1
  and        v.session_id = s.sid
  order by oracle_username
  ,  session_id

And then kill the session with this

alter system kill session '94,2168';

5. Tables by user

select owner,count(*) from all_all_tables group by owner; 
General

Should a correct solution be elegant too?

Many times when engineers propose a design/solution we are told ‘Well lets just get over the hump for now and refactor it later”  or ‘oh, that’s an elegant solution but lets just get it done for now’ and the worst of all you are just ignored. (Makes you think if you are speaking in a different language)

This almost always pains me, I just cannot understand how can a solution be correct and not be elegant to me a complete design is something that is correct, elegant, maintainable and easy to extend. Something that will stand the test of time. Something that can be reused.

I learnt the hard way every thing that you ever write and put into the system, someday you will have to enhance it, so would it not be better for you if you do it right the fist time around ?

I guess it is the engineer in me, I get bored if there is no puzzle to solve.

General

Why no rigior ?

Recently I had to fix a problem with a job hanging, so I pulled out my trusty YouKit profiler, profiled the app and was quickly able to detect the problem.

Basically it was an old fashioned connection leak due to a mix of bad coding, no ‘max wait time’ set on get connection and to make the problem worse it is multi-threaded.

At first look, all the threads were in a blocked state, so I reduced the number of threads to one (oh thank goodness for Executors), and soon the problem became pretty evident. Oh there were other problems too like creating infinite number of threads, when we have very finite number of resources, parent thread dying without waiting for child threads to complete……

Why do programmers think making a piece of code multi threaded is so easy ? Especially when you are dealing with legacy code (and I mean code written over the past 10 years by various people), trust me all it is going to do, is zoom into existing issues in the code.

I think the first step in increasing the performance of any app, would be just profile it! Find out where it spends 80% of the time and try to tune it that.

And that’s where my issue of rigor arises, I rarely see anyone wanting to profile an application before tuning it, solution to every problem seems to be to go GungHo with threading.

This attitude is also evident in another very popular notion of “throwing pancakes on the wall” to see what sticks.

Ok when did engineering disappear from IT ? seriously did I miss that memo ? most of us have some sort of bachelors degree, if not a masters so why are we behaving like code monkeys ? What happened to measurement ? reading ?

What happened to critical thinking ? I read an article ‘Are we losing our ability to think critically?’ from the ACM (yes you should read that magazine or pick Dr.Dobbs or some professional computing journal if you are serious about your craft.) And I have to say the answer to that question is YES.

But can you blame em? nowadays all developers are crammed into one giant room where you cant even hear your own thoughts. It is no wonder developers are the biggest promotors of headphones.

General

Doing evil things, overriding jar location in Maven

Every once in a while you are stuck in a situation where you just cannot add a jar into the repository but you still want to use maven, there is a work around. In the old maven 1.x you had to do this using the project properties now it is even easier just add a dependency  like below and add the jar to the ${basedir}/lib folder. The system tag was created for a totally different purpose, but here we are using it for our overriding jar locations.

<dependency>
 <groupId>pircbot</groupId>
 <artifactId>pircbot</artifactId>
 <version>1.0</version>
 <scope>system</scope>
 <systemPath>${basedir}/lib/pircbot-1.0.jar</systemPath>
 </dependency>
General

OMG I am an Introvert !!

Oh My God, after 32 years I have finally realized that I am an Introvert !!

I read this recent post “Caring for Your Introvert” (only cause it appeared on Hacker News) and found so many things familiar, which lead me to question, am I an introvert ?

So as anyone would do I went to Google (the source of all answers) and found many articles and one of them was “Being an Introvert”  and this self assessment, I got 23 out of 30  so atleast I am not a total Introvert.

I invite everyone to take the above assessment, and figure out what orientation you are.