Coding Blues

April 27, 2007

I have been doing designer(software design) work for the last few weeks and one of my job is to make those SQL queries. One of the things that I wanted to revise was the stored procedure to update the main table. The data will come from the temporary table. If the data is not present in the main table, insert it. Otherwise, make an update. It was implemented using cursors(yuck!). So I created the SQL queries which looked like:

update main set …..

from temp

where temp.pk = main.pk;

 

insert into main(…)

select  …

from temp left join main on main.pk=temp.pk

where main.pk is null

 

 When I showed it to the developer he said that update-from will not work in Oracle. WTF!?! MS SQL Server has it. PostgreSQL has it. I don’t know why Oracle can’t have this powerful SQL extension. One of the few things that I like with MS SQL’s T-SQL is that its easy to use. Even MS SQL Server 7 has a join keyword which makes your SQL easier to read. In Oracle at that time you need to use the + operator. I was thinking that since Oracle is the bigger company they should have a better SQL language.

I did revise the earlier query but its a bit uglier.

——————————————————————-

One error that I keep on seeing is the improper use of random number generators. If for example you have ten choices and you need to randomly choose between them you get a number from the random number generator then from that number determine your choice. You should have something like the code below:

int num = random.nextInt(10); //gives a number from 0 to 9

if(num == 0) {

//do something

}  else if(num == 1) {

//do something

} ….

 But no. What I usually found in other people’s code was:

if(random.nextInt(10) == 0) {

//do something

} else if(random.nextInt(10) == 1) {

 //do something

}

——————————————————————-

One of the WTF questions that I heard a long time ago: “What is the basis of your randomization?”

Stargazer Feisty Upgrade

April 22, 2007

The upgrade was not flawless. X did not work immediately. I need to manually update the ATI fglrx drivers(my Edgy notes came in handy). There was also no sound. After browsing in the forums I found some workaround(replaced some files).

I have not played around with it yet so I don’t know how much of an improvement Feisty is over Edgy.

The Star Wars Hand of Thrawn duology by Timothy Zahn. I found both of them at Kinokuniya and I immediately purchased them. Most of the time I only see one of the series so I am a bit hesitant to buy since I might not be able to complete them. Timothy Zahn is probably the best StarWars expanded universe writer.

Included in the pic is my Kinokuniya privelege card. It gives me 10% discount for on all books for 21 SGD annual membership fee.

handofthrawn.jpg

I have been wanting to get a pair of speakers since Stargazer’s doesn’t sound good and I could not turn the volume that high without much distortion. I initially wanted to have a 2.0 setup(no wiring mess) but the good ones are a bit pricey. Its 160 SGD for the Creative T20 and 195 SGD for the Klipsch(4.5k lang sa Pinas). I decided to purchase a 2.1 setup since it is much cheaper(60-80 SGD range). I initially wanted the Logitech X-230 but the salesman recommended the Altec Lansing VS2321. What made me buy, even though I have not read the reviews yet, is the silver color(all others are black). It looks good beside my laptop. The only problem is the satellite speakers topple easily and worse of all picks up interference(from the wifi) when not properly positioned.

stargazerwithvoiturelumiere.jpg

Going to Funan is not complete without visiting the computer book store. I was surprised when I found UML Distilled being sold for 21 SGD only. I immediately bought it.

uml-distilled.jpg

April 17, 2007

I recently changed role. From a programmer, I became a designer. I suspect that its because of my English skills(among my colleagues only the more senior ones have good English) and not really my knowledge on the project and the framework we are using. With only five months into the project and no training whatsoever on the framework we are using, I doubt if I qualify to be a designer. I think they just needed someone to write the design specification They even assigned me to a different module of the project. Its was my first time to see those APIs and tools. Its not the skills that I don’t have but the knowledge on the API and on the problem domain. I am driving blindly at this point.

My first assignment was to revise a design specification. All is going well until the development stage. The developer did not obey the specification. He has some good reasons. I did made some mistakes like not checking if the static method is public and not reading the code thoroughly. But the others are really show-stoppers. They did not tell me that I can not use the old scripts because it is already not supported. They did never told me that the class that is supplying the connection to the database is also not supported. Its a freaking utility class that I assumed that I should not even care about its implementation. The developer who I was working with knows more about the what we are doing(warts and all). Compounding the problem is the fact that all of the knowledgeable developers are in a different location. The new programmers(we are only two here) are isolated. Knowledge flow is a bit limited.

Enough ranting for now. A lot of fire fighting is needed tomorrow.

April 13, 2007

Sumabog daw ang real-time enlistment ng UP. Punta na lang kayo sa blog ni Rom. Basahin nyo ito at ito.

Gusto ko sanang kumustahin ang mga kaibigan ko sa OUR pero baka busy pa sila. Saka na lang ako kukuha ng mga inside story.

—————————————————-

Bumili ako ng dalawang Star Wars na pocketbook(Specter of the Past at Visions of the Future) na sinulat ni Timothy Zahn. Basta dumaan ako ng Kinokuniya siguradong may mabibili akong libro. Lalo na ngayon at may 10% discount.

—————————————————-

Wala lang akong magawa nitong nakaraang mga araw kaya sinubukan kong gumawa ng mga haiku.

After ironing
Midnight beckons me to sleep
But a book awaits

Gustuhin ko man
Mag-twitter sa’king opis
Pero naka-block

Friday the thirteenth
Tired souls on a happy street
And a bank not found

Ghastly morning news
Melancholy everywhere
And the prince chuckled

Dodo

April 5, 2007

 Natawa talaga ako ng nakita ko  ito sa grocery kanina.

i love my dodo

 Yung shiok(nakasulat sa ilalim ng dodo) ibig sabihin daw eh delicious. Brand ng karne yung Dodo. Parang Monterey.

Eto pa isang dodo. Medyo pa-extinct na daw sila. Pero nagulat talaga ako nung nakakita ako ng traysikel sa Singapore.

traysikel

Quo Vadis

April 4, 2007

Kakapasok ko pa lang sa kwarto ko pagkatapos kong maghapunan ng biglang may tumawag. Tiga-opisina. Dapat daw kumpletuhin ko yung time sheet kasi deadline daw. Teka lang. Naisip ko. Tapos na ako nung Biyernes pa. Sabi nang kausap ko wala daw ako entry nung April 1 at ako na lang ang natitirang hindi nagpasok ng oras ko. Err.. Linggo yun diba?

Mukhang seryoso sila dahil ilang beses akong tinawagan at pati amo ko tumawag din. Sinubukan kong mag-login sa laptop ng kasambahay ko pero hindi rin umumbra. Hindi na gumagana yung password ko. Hindi ko alam kung bakit. Gumamit na lang sila ng supervisor password. Ang tanong ng amo ko: Bakit mo nakalimutan? Hindi ko lang masabi na: Anong klaseng sistema ba yan na para sa buwan ng Marso kailangan akong magpasok para sa unang araw ng Abril na tumapat pa sa Linggo?

————————————————————–

Hindi lang dun nagtatapos ang kamalasan ko. Pero ito kasalanan ko na. Hindi ako nag-submit ng timesheet(na naglalaman ng breakdown ng trinabaho ko para sa isang linggo) sa loob ng dalawang buwan. Putsa. Nag-email yung team lead namin nung lunes na kumpletuhin na daw namin ng Byernes.

Kung sakaling makita nyo ako sa Pinas. Alam nyo na ang nangyari. Natanggal ako sa trabaho dahil sa kulang kulang na timesheet.

————————————————————–

Hindi lang dyan nagtatapos ang kamalasan ko. Medyo naghihigpit na ngayon sa opisina. Bawal na ang hindi approved software(libre man o hindi). Nakatanggap ako ng email kaninang umaga. Ayon daw sa kanilang scanning may Winamp daw ako. May unlicensed sofware daw ako. Teka, libre ang Winamp diba?

Dahil minana ko lang yung desktop hinanap ko sa Program Files folder. Wala. Tiningnan ko sa Add/Remove programs. Wala din. Sinagot ko sa email na wala akong Winamp. Ang sagot sa akin mag-log daw ako ng tiket para tanggalin ng desktop support(kasi wala kaming admin rights). Sumunod na lang ako. Sasagutin ko sana ng: Paano tatanggalin ang isang bagay na wala naman? Pero wag na lang. Baka humaba pa ang istorya.

————————————————————–

Anong natutunan ko sa mga pangyayaring ito? Hirap talaga ako sa “corporate environment”.

Dreaming in Code

April 2, 2007

Software Engineering is something of an oxymoron. It’s very difficult to have real engineering before you have physics, and there isn’t anything even close to a physics for software.

-L. Peter Deutsch

I just finished reading Dreaming in Code and I highly recommend it. The book tries to answer the question: Why is software hard? The author followed the Chandler project in his attempt to answer the question. And I guess he succeeded in answering that question. Do not expect a solution though.

The author did not only chronicled the Chandler project but also gave some software engineering history, a little bit of what Python is and some other Computer Science concepts. A lot of software engineering literature(and people) is also quoted which I think is one of the best thing about this book. It gives you an arsenal of quotes(like the one above) when you have arguments with your pointy haired boss(PHB) or those big-M Methodology zealots.