Archive for August, 2006

Indexing Really Helps

Thursday, August 31st, 2006

Today I needed to modify a relatively simple, single table selection query in my web app to include left join with another table. One table holds info about submitted reports, while the other has the results of an evaluation form for a given report. The whole application started as just a very basic online evaluation form. Then I got a request for some sort of online submission mechanism. Initially they just wanted an upload page, but I built in a tracking system to go along with it. They liked it so much that they now decided to join the two.

I needed to show which reports were evaluated and which were not. The way my tables are structured, this is essentially a basic left join. Each table has almost a thousand rows in it, so I was expecting a major slowdown. No matter what you do, that Cartesian product necessary to do a join just kills performance-wise. I ran a test query to see exactly how painful is this going to be:

SELECT report.id, report.name, eval.id, eval.reportid
FROM report LEFT JOIN eval
ON report.id=eval.reportid

The result: 802 rows in set (13.44 sec). Painful! 13 seconds is unacceptable. People whine that the application is slow as it is.

Luckily though, I could fix this! Indexing is your friend!

ALTER TABLE eval ADD INDEX(reportid);

I re-ran the same exact query, only to see: 802 rows in set (0.02 sec).

Wohoo! This is a world of difference! Looking at this improvement, I’m planning to carefully examine all the big queries and put indexes on pivotal columns to optimize the db processing time. If I can shave off few seconds here and there, the overall user experience may improve.

Unfortunately the speed bump that most of my users experience is not the query time, but the crappy IE rendering engine. It just can’t handle rendering a large HTML table (20 columns by 50-100+ rows) without temporarily locking up the UI. Firefox users don’t even notice this issue because gecko renders the page incrementally.

Any good ideas how to optimize displaying large HTML tables in IE? I was thinking about just using span elements (or some sort of XML makup) and css to space out text on the page. It could potentially render a little bit faster than a table. Worse comes to worse, I’ll just start generating tab delimited output surrounded by <pre> tags.

I’m currently working on a feature that will dump a report into an Excel file so that they can play around with the numbers. This could be another potential solution.

Does Sen. Stevens have an OFF button?

Wednesday, August 30th, 2006
Ted The Tubes Stevens

I think Senator Ted “The Tubes” Stevens is on a quest to become the most hated and ridiculed person on the internets. Apparently he is the guy who put the super-doubleplus-secret hold on the bill that would open up federal spending records to the public.

Stevens is a a liability - a corrupt politician from a backwater state who will push a horribly unpopular, damaging net neutrality bill, and secretly derail useful legislation without any regard for the public interest or even his own reputation. Will anyone vote for “the tubes” guy in the next election? Who the hell knows - he is from Alaska. Apparently the tubes over there freeze over in the winter so they don’t get much internet connectivity anyways. P

The point is - he is on his way out, he already clowned himself, was ridiculed on national TV, and became an internet legend. He has nothing to loose at this point, but he still holds the office, and has political power. If you want to push some unpopular agenda, or stage some career damaging political stunt (like doubleplus secret holds) he is your guy!

This is why we need to watch his hands really closely now and see who is pulling his strings. He will be the for all kinds of crazy shit now, but I bet you that someone else is benefiting from all of his shenanigans.

Update Thu, August 31 2006, 09:22 PM

Zefrank devotes the whole episode of The Show to this issue. Strangely, he makes no tubes jokes.

Alex Cherry - Deviant Monkeys

Tuesday, August 29th, 2006

Check out this sick deviant art gallery. I really like this guys style. I would describe it as hauntingly awesome, but then again I’m no art critic. All I know is that this is going to be my new desktop wallpaper:

Monkeys

click for full size

I said it before, and I’ll say it again: Monkeyz Frinken Rule! mrgreen

Here is Alex Cherry’s official website. Go check it out.

WTF is Alien vs. Alien?

Tuesday, August 29th, 2006

Can someone tell me what is Alien vs. Alien aka Final Destination aka The Final Frontier? All I know is that it is a science fiction movie and Gigi Edgley is in it. Other than that, there is just no information about it available. It is listed on her IMDB resume but IMDB proper does not list it under any of the names.

I know that working titles are usually shitty, but DUDE! How about not naming your movie after a very established franchise? First you run against AVP, then you steal the name of a shitty thriller that spawned multiple sequels, and your third choice is a Star Trek title? What in the god’s green fuck were they smoking?

Judging from the creativity in the title choices, this picture sounds like a low budget exercise in regurgitation of alien-themed scifi cliches. I will still want to watch it though just to see Gigi doing her thing. mrgreen

Gigi looks cute in Last Train to Freo:

Gigi on Last Train to FreoGigi on Last Train to FreoGigi on Last Train to Freo
click to embigen

The trailer, is surprisingly light on Gigi content - especially considering that there are only like 5 actors in this movie total. I can tell you right now that it will never fly here in US. It is one of those “5 people on a train talking” movies which would put even the most open minded, cultured American audiences to sleep in 3 minutes flat (yes we suffer from cultural ADD). At least that’s the impression I got from the clip.

DFS and Concurrency

Tuesday, August 29th, 2006

The fucking DFS is going to be the end of me. It’s great, and awesome but only when you make sure that everyone is connected to the single server. Otherwise you get sharing violations and all hell breaks loose. For example, consider this scenario:

  • Person A opens a spreadsheet X on the network share S and DFS opens a connection to the file on Server 1.
  • Person B opens X on S, and this time DFS tries to do load balancing, and B ends up on Server 2.
  • Both A and B modify the spreadsheet and then save it. No one gets sharing violation errors? What happened?

The key to this mystery is the core mechanic of DFS which is replication. DFS does not care about concurrent writes. It simply makes sure that the file with the most recent timestamp is copied over to the other server immediately. So, in a conflict situation, whoever saves last wins.

What is the solution here? Make sure that everyone is using S on Server 1, and that there is no load balancing. This is the only way to avoid concurrency issues.

That said, I spent the whole morning digging through the DFS ConflictAndDeleted folder, and the staging area files looking for a spreadsheet that did not save last night. I could not find it, so I called in reinforcements to help me figure out the ins and outs of the DFS setup. In the end we had two people looking for this file for several hours, trying to figure out why and how did we get this conflict.

We finally found it… Guess what? It turns out that the user simply saved it under a different name, and then forgot. We spent hours blaming poor DFS when obviously PEBKAC. Aaaagh!

Windows Administration Commands

Monday, August 28th, 2006

Here are some of the more obscure, and yet extremely useful windows commands every administrator should know about. This is by no means an exhaustive list. These are simply windows utilities that I would feel naked without. Most of these are not present in XP home so I tend to carry them on a thumb drive or a CD when I plan to troubleshoot some windows installation.

Yes, the beautiful thing about these files is the fact that you can copy them from a XP pro box to an XP home box and they will still work. After all this is the same OS, only one is crippled more than the other.

I will go in alphabetical order:

cacls - my favorite windows command line tool ever. It allows you to set and fine tune access permissions on files. For example, this is the only way you can assign selective read/write permissions on per-user basis on XP home.

driverquery - displays a list of drivers installed on your system. Very informative, especially with the /v option. (not in XP Home)

getmac - gives you the mac address. Yes, you can always use ipconfig /all but why should you? (not in XP Home)

openfiles - lists all the files that are currently open on this system. It also allows you to terminate connections to files. Imagine this scenario - some jackass opens a very important file on a network share, and then leaves for lunch. He locks down his machine, closes his office and takes the only key. Meanwhile 3 other people need write access to that file, and they are getting pissed off. Openfiles to the rescue. (not in XP Home)

reg - command line utility to add and delete registry keys. This is an awesome tool for scripting. It allows you to query, add, delete, unload, import and export registry keys. It sure beats regedit if you know what you want to do and you want to do it quickly.

sfc - scans and replaces damaged protected windows files. This is essentially your first line of defense. After you remove malicious shit from the system, it is always a good idea to run sfc to make sure the core system files are intact.

systeminfo - provides exhaustive system information. I love this little tool because it produces a truckload of information that is not readily available anywhere else. It will tell you your CPU speed, original windows installation date, current uptime, all the hot-fixes and windows updates installed, as well as vendor specific information that you may find useful. (not in XP Home)

tasklist - equivalent of usinx ps command. It lists all the running processes on this machine. Much more convenient than the task manager if you ask me.

taskkill - a complement of tasklist with a very self explanatory name. You can use it to kill running processes from the command line.

No More Grants for Evolutionary Bio. Students

Sunday, August 27th, 2006

If you want to study evolution, you can no longer do that on a federal education grant for low-income college students. If this is a mistake then it is very damn convenient, considering how our president is a strong supporter of teaching creationism in schools. It’s not like these things change all that much from one year to another. I find it hard to believe that any major could simply accidentally disappear from the list without any justification.

I would really want to know who is responsible for this - who ordered it, who approve it, and who executed it. It’s a damn shame that one person’s religious bias may have may have messed up another person’s chances of getting a college grant.

Remember kids, creationism is paganism.

I can’t brain today…

Saturday, August 26th, 2006

I just want to kill and explode shit today, but I either finished, or got violently sick of all the games in my house that would allow me to do that…

I can't Brain Today
author unknown - please claim it

I need recommendations for good games. Must be entertaining, and if possible have decent storyline. Oh, and fuck the RTS. Recommendations go!

Nikto

Saturday, August 26th, 2006

Nikto is an awesome perl script which will test your web server for vulnerabilities. For example, it will tell you if you have any gaping holes in your configuration that would allow attackers to run known exploits. It will also show you interesting things that could potentially be used as attack points. Once you run it on your server, you get a nice readable list of warnings and red flags.

Next step of course is to sit your ass down, log into the server and figure out what triggered nikto, and how (if possible) to disable it. The less results you get from a scan, the better off you are, because the bad guys will essentially use the same exact tool to compose their hit list.

Passing Nikto scans of course does not make you safe. But it may make you safeer by exposing big security holes you might have missed.

I would say that it should be the second tool in your security testing toolbox next to the good old nmap.

Big deal over Pluto

Friday, August 25th, 2006
Pluto

Dear Internets,

Pluto is not a planet anymore. Get over it.

We have 8 planets now, and it doesn’t really change anything. All we need to do is to put a footnote in the new books and encyclopedias stating that Pluto is technically a dwarf planet as of August 2006. That’s it. All of the people getting upset by this are just silly.

Here is why we needed this change: every time someone discovers a new cool looking object in the Kuipers Belt some jackass immediately claims it should be classified as a planet because it is bigger/almost as big as Pluto. Media picks it up and for a month or two we are treated to stories about the “10th planet” or whatnot. Scientists try to clarify this, other people try to dispute them and the public gets confused. All because no one can provide a clear cut definition of the word planet that would include Pluto but not other Kuiper’s Belt objects.

Now we have a good definition, and Pluto does not make the cut, so fuck it. If that upsets your fragile romanticized conception of what the solar system should be, then tough shit.

Thank you for your time.


Bad Behavior has blocked access attempts in the last 7 days.