Language wars are the new IDE wars
(I feel really sorry for Managers, every programmer has his/her favorite programming language and is trying to sneak it into the system. And you know what, it is already in your code base, sorry but that’s the truth and whatever side you take, you will end up loosing. )
I think people used to have IDE wars cause they only had one primary language to work with, but now with the explosion of languages and almost all of them having some port that runs on the JVM everyone is either trying to sneak it in or advertise the virtues of using it. And that ultimately results in a passionate email war.
And of course if you have, somehow magically gotten past that there is always the discussion on the best IDE for that language, hehehe let the wars continue.
Integrating Facebook Connect into your Web App
Lately I have been spending time researching on how to integrate with facebook connect. There is a ton of documentation on the facebook wiki page, but as with any wiki you need to know what you are looking for. I am going to document here what I found.
For the really impatient (like me) check out this video.
- To begin with go to this Wiki page on facebook to get familiar with facebook connect and reasons for using it.
- Install the facebook developer app into your facebook page (makes it easy to keep track of your api keys and your webpages ).
- Next on the facebook developer app register your domain and it will generate the api key and secret (don’t worry about saving it you can always look it up from the developer app).
- Once you have done that you will need to download and place this file xd_receiver.htm into your applications root folder. (For step by step instructions to do this go here.)
- Include this tag in every page that you plan to use facebook connect on.
< script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US" type="text/javascript" >< / script > - And also include this snippet to initiate the connection.
< script type="text/javascript" > FB.init("a8072b7845a8815f63966e90abe4a1e0", "/xd_receiver.htm"); < / script >Should be in the body not head - Place the login button
fb:login-button length='long' onlogin="successful_login();" - You need to create the function successful_login, that will do something when facebook authenticates the user. I just went and pulled the user’s picture and show it. The code for that is here
$("#login").html("< fb:profile-pic uid='loggedinuser' facebook-logo='true' > < /fb:profile-pic >. Welcome, < fb:name uid='loggedinuser' useyou='false' >< / fb:name >.");
And that’s about it, if you want you can check out my example at devender.net
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.
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,
Pragmatic Thinking & Learning
- 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.
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;
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.
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.
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>
I want to work on Ruby
Man this is so sad, I want to be working on ruby and rails but my present job is all about Java
this is a very sad situation.
Now I can only work on it nights and weekends (and at work only when no one is looking).