December 2009 - Posts

In my previous company our Systems Analyst always gave emphasis on User Interface and always reminded us that it's not a trivial thing. I thought that it was a mature way of thinking to develop all the functionalities first. Yeah, if you're just a coder then that might be a more important thing. But being a software engineer, designing user interfaces is a required skills or else, who would want to use your application? This is why I've spend time re-learning CSS, Javascript and JQuery. JQuery with some of its components already skinned really adds to the ease of development of user interfaces (plus some sleake design).

I have to thank many of my friends online who helped me develop my web design skills. Just a few months ago I could hardly match colors (still working on it) but with some patience and hardwork it seems to be a rewarding task. I tried to research online for some guidelines and this article seems fine.

Posted by lamia | with no comments

Christmas is the Spirit of Giving and not Receiving. By posting a wish list online, I hope you're not getting the wrong idea that I only want to receive. These things, of course are my heart's desire to help me "create" and have something to share (like knowledge). I hope I could give you a moment of fun while browsing through this list.


Flex 3 With Java -


One of the frustrations I get here in Manila is that we are so dated on technology books. I can order online but would cost me too much on shipping. Now, I've done some basic Flex tutorials here in the past using PHP but I'm really hoping to use Flex with Java since that's the language I'm most comfortable with.


Dell Mini



This is a Dell Mini 12 in the picutre. I dunno what' the latest one is, it's not very important. I've done a little research and Dell still seems to promote their Mini 10. I think I've grown a loyalty to Dell since I bought my Inspiron 1525 a few months ago and I use Dell Latitude E6400 at work. Why do I still want a Dell Mini you say? I bought my Dell with development in mind and I truly loved its 15.4 inch screen, I thought it would already be portable enough to work on any place in our house. It proved a little difficult still. It's difficult when I have to sit beside my child and wife on bed before sleep because my child, though small covers a huge portion of the bed. I love to do my stuff with the two of them near me and I just hate to disturb their sleep each time I try to move even a little.


LG Chocolate Full Touch Screen -


Whenever I read books I find it hard to store my notes on my current mobile phone. I have very limited space and it's very hard to organize. I don't know if such feature is supported by this phone but that's one of the things I'm looking for in touch mobile phones. I'm really looking forward to entering the touch screen craze next year.


Windows 7 Ultimate



I really want to replace Windows Vista that is currently installed on my laptop. One of the candidates is Windows 7 because I've heard of its stability and I've actually experienced it myself.  I want to get the most out of my machine and Vista just ain't doing the job. Some of my old programs also don't work in Vista. :(


Playstation 3



During development of my game (a personal project, 2D Scrolling Manic Shooter), I found out that the most effective way to keep yourself motivated is to actually play some games and get ideas from those games. How can you develop games if you do not play games yourself? I have to admit I've been a little left behind with video games since Playstation 2. A few months ago, I had a PSP but then I had to sell it when I spilled some cooking oil in it. :(


Thanks for hearing me out! Merry Christmas and Happ New Year!

Posted by lamia | 1 comment(s)
Filed under:

SQL has always been my weakest point as a developer. So in times like this, I usually resort to application-level solutions. This is the magic of doing pet-projects, you get to work on your weak points.

PROBLEM: The COUNT(*) function was return 1 on zero-row entries... Or was it really zero?

I was trying to do a simple COUNT on two LEFT joined tables...



Now, if I had the following data

item_id | item_name

1       | Shampoo
2       | Soap
3       | Baby Powder

and have two of these items listed on the item_entries_tbl

item_entry_id | item_id

1             | 1
2             | 1
3             | 1
4             | 2
5             | 2

If I do the query:

SELECT A.item_id, COUNT(*) AS in_stock FROM items_tbl A LEFT JOIN item_entries_tbl B

Would give me...

item_id | in_stock
1       | 3
2       | 2
3       | 1

Wait... There's something wrong here... I didn't have an entry for item_id 3 and yet it counted "1" in_stock. I guess the reason is that COUNT, counts for the number of rows.
When I left joined with items_tbl, it actually created a virtual row (as I like to call it) that has item_id = 3 in it. So how did I discount it?

I put in a counter-check item_id. I modified the query as follows...

SELECT A.item_id, B.item_id AS counter_check_item_id, COUNT(*) AS in_stock FROM items_tbl A LEFT JOIN item_entries_tbl B

It now gives me the result:

item_id | counter_check_item_id | in_stock
1       | 1                     | 3
2       | 2                     | 2
3       | NULL                  | 1

At the application level, I just have to check if  counter_check_item_id is NULL, the  value 1 in in_stock would only be bogus and counter_check_item_id would verify if that row really exists.

In java:

//rs = java.sql.ResultSet

if ( rs.getString("counter_check_item_id") == null ){
    itemEntries.setInStock( rs.getInt(in_stock) );

Have a better solution? Post a comment! For those who does not. Hope that helps.

Posted by lamia | 2 comment(s)
Filed under: