December 30, 2008

Debugging Tightly Coupled Code(Rant)

Filed under: Uncategorized — Tags: , — yasi8h @ 6:26 pm

I love OO for a reason. i don’t go around saying that i love OO so that everybody think i know a thing or two about software architecture. but because it have dividends. when you have a good design in your software, things become easy. some planning and some structure can make a lot of things very easy. if you follow OO principals you will have better and simple code. its very simple! you don’t follow OO principals, or any other principal(that have some acceptance, or that you knows to work well) you will end up with UGLY CODE! it might be easy to write ugly code. it might feel very ‘efficient’, ‘high performence’, ‘robust’ code at first. but in the end you will not have much performance gains(well may be about 0.001%, because you decided not to use setters and getters, to save method calls!!!). it will only make thing look bad an ugly. and that’s not all. i can assure you that your code will end up so complicated and full with ‘booby trap type bugs’ waiting to surface and explode.

believe me i know that gut feeling you get when you are writing ugly, unstructured code. πŸ™‚ when you are writing stuff your mind will be ‘hot enough’ to handle all the complications that arise. so you will be able to wire up things, and put a few FLAGS! here are there and get things working smoothly. and you might feel smart too! but think for a minute. you are not supposed to write code to show how deep the ‘stack of your brain’s cache’ is. it will be hard to understand in the future for your self. and what about others who look in to it? do you really think they want to read complicated code? it is not good to write complicated code. source code is supposed to be human friendly. you don’t need to become a machine. we have more than enough machine’s! think in a higher level people! we have enough processors/RAM and shit! brains are more precious than that stuff!

wow you want to write micro code? no i am not talking about short and straight forward code. i am talking about micro code! why would to want to write something in one line if it takes 2 minutes for someone to understand it, while the same thing could be written in 2 lines, making it easy for people to read. i mean sure it will be the same for the machine(in a given context). i think you should write code that is readable. making it too short while compromising human readability is bad.

every tiny nano/1000000000 second that you TRY to save for your compiler will cost the programmers 5 mins. think about it. is it worth it?

so now all of you(who are stupid and jobless to read this! :D) know that this is a rant. now why i am ranting like this? well today i had to do some debugging in a project whose code was ‘tightly coupled’. yeah like really tight!!! the bug was in the UI layer, but i had to go thought the custom controller code(UI), UI code that uses the controllers, business logic… to understand how the “UI” works! the business class that was related to this incident had a property setter that was there just to support a certain feature in UI :O i am so shocked! this is so tightly coupled. but what can i do. i got to debug it anyways πŸ™‚

huh… if you have to debug tightly coupled code my advice to you is… first of all claim down. and tell your self that sometimes you got to do things that you don’t like. and start debugging.


December 23, 2008

Favorite Firefox Addons of a Geek

Filed under: Uncategorized — Tags: — yasi8h @ 6:57 pm

I’ve seen some best addons for firefox lists here and there in the web. and i thought i should roll out my own. cause… mmmm… oh well… these addons are too good to be missed! and btw i am using all these under ubuntu firefox 3.0.5 but i am sure that most of these will work on windows/OSX as well.

Ad Block Plus

Preview Image of Adblock Plus

the ever famous ad blocker. this saves me a lot of bandwidth. and at the same time this keeps web pages simple. when there are ‘no’ flashy ads, you can put your concentration on the real content that matters. however, do not block all the ads in all the sites. i mean the site owners should earn some profit too… i would leave google text ads from been blocked because for me they are ok. they don’t ‘disturb’ me. and they are informative.


Preview Image of NoScript

If you want to stay a step ahead when it comes to browser security, you need this. i have been using this addon for a while now. and by experience i can tell you that this gets updated really fast. and when configured correctly this will provide you solid protection without sacrificing the usability of the browser. when some new exploit comes out or when it appears in the wild, noscript will be the first to address it. i have seen noscript adding features to block some vulnerabilities in the browser even before mozilla devs rolls out a patch. so frankly if you are serious about security this is a must have.


Preview Image of Sxipper

it remembers all my passwords, usernames + how to fill in forms for me. i can maintain one or more profiles from which i can choose, when i am filling a form for a new account(signing up for some service online). people can ‘train’ it on filling forms in different web sites around the net. and then they can share it with other users. so most of the sites that i visit work correctly with sxipper(ie: sometimes when you have capitcha checks in a login page you just want sxipper to fill in the username and password, not auto submit the form)


Preview Image of DownThemAll!

built inside firefox, multi-threaded(ie download the same file divided in to several parts concurrently thus increasing the download speed) whats more can you ask for? πŸ™‚


web developers LOVE this one! this is basically a real time ‘IDE'(its not a IDE really :)) for client side web development. you can try out so many things, debug stuff… try new things while instantly see the effects(ex: change the set of styles assosicated with some div elements and see the effects instantly!) with this addon. this is a MUST HAVE, if you do any serious web developing.


the web is yours! πŸ™‚ you don’t need to wait till ‘they’ fix their ugly layout or till they decide to show up that piece of vital information just next to your profile image. you can write some scripts and get it done. this one addon makes the web a whole lot better than it is. sites like are filled with useful, creative scripts that makes your life easier.


Preview Image of iMacros for Firefox

you have bash in *nix when you need some ‘glue’ to script repetitive actions. inside firefox you can use iMacros to script actions. its pretty easy to use and it can be really useful in some situations.


how many links have you come across which are not really(none click-able URLs that appear as plain text) ‘links’? this addon will convert them in to links. it can be really useful at times. specially if you come across a lot of plain text URLs. this addon will save a lot of ‘copy, paste, click go’ actions, that you would have to do manually, otherwise.

Read it Later

Preview Image of Read It Later

sometimes you comes across nice stuff while browsing online. but you might not have enough time to read it all at that time. for ex: while you are at work you come across this cool article that you really want read but you don’t have enough time to do so, while you are still at work. you’d want to go home and read it, right?. Read it later can help you do exactly that. it can keep track of list of things, and sync them across multiple PCs.


firefox have minimum built in ftp capabilities. this addon add almost all the features that you would expect from a full featured stand alone ftp client. you can basically have a ftp client running in one of your browser tabs. now how cool is that? πŸ™‚

btw: ftp is a inherently INSECURE protocol. so use it at your own risk πŸ™‚

so those are addons that are of most importance to me. if you haven’t tried the above, why not give it a try and see, you never know what you have been missing πŸ˜‰ if you don’t want any of the installed addons you can simply uninstall them, cleanly after all they are jut addons.

December 16, 2008

“This Game Beats em All” – My Very Own GTA IV/Liberty Cirty Stories Review!

Filed under: Uncategorized — Tags: , — yasi8h @ 5:03 pm

niko bellic

GTA has been a great game for me from the times when i played San Andreas. i was new to GTA then, unlike some of my friends who have been playing the game from some time. back then when San Andreas was the newest GTA title, i was addicted to it to say the least. i think its one of those games that i have played the most. and spend a lot of time on. i really did enjoy it. and now after some years here we are with a new edition of GTA, Liberty City. when GTA IV Liberty City Stories first got released for the consoles, i was kinda excited cause after all there is a new version of one my favorites game, out. although i don’t own any consoles. i just hoped that they would release it for the PC after sometime. and they promised to do so. after some delay Rockstar has finally delivered GTA IV.

“Insane Requirements ,Bad Graphics, Bugs, Lazy PC Port” – Well it was ok for me at least

well i my self didn’t experience that many problems with the game. and the graphics were ok for me. i am playing it with the highest settings possible(by setting them in the commandline.txt file… google gta iv commandline.txt if you want more info on this). and it works pretty neat on my box. i get 30+ frame rates and it looks alright to my eyes. it playable and i didn’t feel like it affected my gameplay. so i am happy as far as the graphics are concerned. but hey this does not mean that i didn’t have ANY bugs/problems… i had some instances where there were some textures that didn’t get rendered correctly. this one time all most all of the things around me turned black! and the only thing that i could identify was niko. but it happened only once so no big deal. there were other times where some shadows and some textures got rendered in a bit of a ‘buggy’ way. sometimes i could see through things that i shouldn’t be able to see through(ex:- shadows!). sometimes some textures got rendered with gaps in them(like if its rendering a piece of paper, i could see dots in that were transparent..).

btw i played the game on a PC, whos config is as follows…

Quad Core 2.4
Vista 64
2 SATA II drives configured with RAID 0
UsingΒ Xtreme-G FW 180.84 modded nividia drivers

“I Love the Story Man”

this been GTA, it had a great story line. i really enjoy the story in any game. its really important(for me at least). GTA IV has a good story. i am sure they could have made a movie out of it as well. seriously it would be grate if they do it right!. the main character in this version is Niko. he is from eastern europe, fresh off the boat. i don’t who creates all these story lines but whoever he is, he is doing a great job. i have played three versions of GTA. Vice City, San Andreas and now Liberty City. all of the had a good story line specially the last two titles. in SA the story was about some guy from the ‘ghetto’, coming out from the prison and stuff.. and here in Liberty City, its about a (illegal)immigrant.

When i am playing the game in the story line mode. i always try to listen to the stuff the characters say. the story keep me glued to all the dialogs. for me its like watching a movie. its even more exciting because you actually get to play though it. cool… and in IV you have this nice option, so when you are playing the single player missions you can sometimes in some missions make decisions! and they affect the story line. wow i should say that this is extremely cool. i am a fan of this lovely game.

“The Streets are Breathing, they are Alive”

Now most of us will finish the single player missions pretty soon. but we sure want to keep playing the game. fear not i think you can keep playing this for a long long time. the moment you start off with the game you can see that the liberty city is actually a live city. there are so many things happening around you and so many people are there. they are talking and they are simply alive. the city have a lot of activities happening in it. and i think this is just grate. if you have read any of the reviews of the game online you are sure to hear about this. and i experienced it my self. i feel that Rockstar have done a grate job making the city look alive. it breathtaking.

“Lets Play Some Pool”

There are lots of other things than shooting people and steeling cars in GTA. you can play all sorts of small games like pool, darts, bowling(well there is a bug in this, i hope they will patch it soon)… etc these are games that you can play and enjoy. yes they are nothing big as the GTA it self but still they are pretty interesting stuff.i like the pool game my self.

apart from these games there are some more features that i like a lot. one of them been cabs. you can actually hire cabs and use them to travel to destinations with in the city in a very short time frame. this will cost you some money, but i think this is a grate feature. i mean i am totally addicted to using cabs to travel inside the city, whenever i can. its fast its cheap.

“Take Cover!”

unlike in the previous version liberty city stories have a covering system that comes in to play in fire fights. in my opinion this makes things a bit more realistic. which is good. i love this feature as well. some reviewers say that in xbox this feature makes things a bit too easy for the players. but i don’t think its the same with the PC. you have to time your shots correctly and find good cover..etc so it doesn’t make it easy. but i feel that the cover system makes fire fights in GTA a lot more realistic(i am not saying this is how it happens in the real world. to be frank i don’t know much about real world firefights!, other than the ones they show on movies :))

“Windows Live, WTF is that! get it off my system!”

installing this stuff is mandatory??? come’on i can’t believe this. this is like forcing us to install some ad-ware! πŸ™‚ well this is not ad-ware but i think that users should have a choice between using windows live and using something else(or may be, not using any thing like that at all!). this is still my machine and i should be able to get the game working with out installing all this bundled software. i am sure the Rockstar people must have thought about this. i mean it must have been some kind of a deal between them and the Windows Live people. so far i am ok with Live games… i mean its not a major headache or anything like that. it does not interfere with the game play that much. i think GTA is using it for managing user profiles(that means the Live guys must have some APIs… web services too, may be.. the developer in me wants to play with these stuff :P)

Live would have been ok after all. but then there is this Rockstar Social Club app. i really don’t like that one. first of all when i just want to play the game i don’t want to go through it. i play it in the offline mode with no accounts and all that. so i have click about 5 or 6 buttons to skip logging in, say no to the message boxes… etc. and i have to do it every time i want to play the game. this is a pain in the neck. i am aware that this app can add some features and values to the game play… but all i am saying is that the user should have the ability to skip it if he needs to. i feel this is too much things to go through. when you are just playing a game. and the Social Club app keep running even when i am not playing the game. what is this thing? i don’t need another process hanging in there with no purpose. so i have to kill it my self. and i have to do it each time i finish playing the game. that sucks.

“All in all…”

I think this is a fantastic game. i am pretty sure that this is going to win a lot of awards and stuff like that. if you like playing computer games, i think you should definitely give this a try. you might need to get a good rig to run this game with high settings. but don’t let that stop you from playing this grate game. ha… i am looking forward to spending some looooong hours of game play. GTA all the way!


December 7, 2008

Netbeans, NX server/client and Ubuntu

Filed under: Uncategorized — Tags: , , — yasi8h @ 5:13 pm

when i am using Netbeans to code i usually run it in my desktop because it is a bit resource hoggy(well i am saying this while jugging it by my standard’s. i only have 512 in my lap). i do this using NX. i have a NX server running in my desktop while my client has NX client. both machines are running Ubuntu(what else ;)). desktop is running 8.04 and the lap is running 8.10. so what am i writing all these in my blog? well i came across some problems while using the above setup. so i thought of noting them here.

Keyboard gone nuts: pressing the Arrow(↑) on the client(while logged in to the host via NX) brings up “Take Screenshot”

this is apparently a common issue. you would find plenty of materials on this if you google about it. for me the fix was setting the Keyboard model to Evdev Managed Keyboard in the Desktop(Host). you can go there through Preferences -> Keyboard preferences…

Screen fails to update/refresh it self as needed while on Netbeans, making it confusing to read the source code

this issue was a show stopper for me. i needed to code and with this i cannot. basically the issue is like this. when you are in netbeans writing some code, if you try to scroll an already opened text file, down and up again. the text get scrambled. basically some lines of code gets duplicated. for this to happen you should scroll the document down and then scroll it up again. this is only a display issue. so if you some how managed to refresh that ‘area of the screen’ you can see the code as it is.

after trying different options in the NX client. it seems that disabling the shared memory option in NX client’s display options do the trick. at least it works for me(in the login dialog click configure -> display setting tab -> display options -> disable shared memory).

i love netbeans. its pretty neat stuff. and NX is much better than VNC and stuff. so right now i can code using netbeans which is running in my desktop with a lot of resources, through my lap, which is in a very ‘physicaly’ reachable and comfortable place for me. in case if you are wondering why i can’t just use the desktop it self. well i can. but its not very comfortable due to bad furniture…. it hurts my hands. so that’s the reason i am using my lap.

How to switch from the full screen mode in NX client

simply take your mouse to the top right corner of your screen and click(the pixel in the top most right corner). cool ha? i found it through… google of course! πŸ™‚

alright now i’m goning to sleep…


December 4, 2008 Membership Password Hashing Algorithm

Filed under: Uncategorized — Tags: , , — yasi8h @ 1:47 am

Recently i had the chance to work with membership( after deciding on adding the database schema required by to our application database it self. there were some questions left on how to use the data in these ( services)tables(the data related to user logins were in aspnet_Membership table) with some other non server side application who use the same database. specifically i needed to find out how password hashing algorithm works. so when another application wants to use the that user login data for something, it knows how to generate the correct hash and do the authentication for the users.

It was apparent that it was using a “hash + (random?)salt per user” to store the passwords(well after all this is configurable. in my case it was configured to use ‘hash’ method to store the passwords for the users).Β  after much googling i found out that there are some options that we can give on what hashing algorithm to use via <machineKey> element in the config file. this article noted that by default used SHA1. but still i didn’t know how it exactly generated the hash(ie: is it password + salt or is it salt + password…etc). so i used Reflector to find out. the interesting code is in System.Web.Security.MembershipProvider.EncodePassword.

so with that code(- some unneeded logic) you can successfully generate the same password hash that asp would.

internal string EncodePassword(string pass,Β  string salt)
   byte[] bytes = Encoding.Unicode.GetBytes(pass);
   byte[] src = Convert.FromBase64String(salt);
   byte[] dst = new byte[src.Length + bytes.Length];
   byte[] inArray = null;
   Buffer.BlockCopy(src, 0, dst, 0, src.Length);
   Buffer.BlockCopy(bytes, 0, dst, src.Length, bytes.Length);

   HashAlgorithm algorithm = HashAlgorithm.Create("SHA1");
   inArray = algorithm.ComputeHash(dst);

   return Convert.ToBase64String(inArray);

hope this helps someone/myself(in the future)


Blog at