Sep. 15, 2009

Read more tag on blogger / blogspot

Update: this … blog has abandoned blogger – and blogger has updated their wysiwyg editor to process a ‘more tag’ splitter. However, this is still a lesson in using Dojo / javascript to make something happen.

Confession: I’m lazy. In my defense, that’s probably what makes me an alright programmer. For the life of me I couldn’t figure out how to insert a wordpress style ‘more tag’ into blogger (or blogspot specifically) so I invented my own solution- it relies on javascript and uses the dojo toolkit. Here are three steps to make it work:

(more…)

3 comments \ Leave a comment
Sep. 01, 2009

moar

MoarOften times when programs are written, they are done so in extreme hurry and usually disregard things like … security, or reality. They lack blinking lights, instructions or labels. At times, they make no sense at all. I assure you that when I wrote this routine I wasn’t trying to save disk space by being brief.

(And yeah, statements such as “some files found” and “moar moar moar moar” aren’t very informative when you’re doing batch processing and geocoding.)

No comments \ Leave a comment
Aug. 06, 2009

Converting state plane coordinates to Lat / Lon

(A blatant repost from an internal page that will never see the light of day…)

In a recent project, I had to convert coordinates from a state plane coordinate system to latitude and longitude. The coordinate system in question was created many decades ago (1927 in one case) and is now an obsolete, yet still active, part of cartography. The coordinates look like this:

458000 (Northing),
933000 (Easting)

(more…)

2 comments \ Leave a comment
Jul. 09, 2009

Hardhat programmers

Saw this ad today and it made me laugh. They portrayed a “software professional” as a mustached man wearing a hardhat.

After the laughter died down, I realized – hmm, that’s actually exactly how it should be. My union health and safety representative is checking the equipment inventory right now.

1 comment \ Leave a comment
Jun. 10, 2009

echo “meow! “

While going through some code, I found this snippet:

$numeric_cat = array();
if( !empty($cats) ) {
  foreach( $cats as $cat ) {
    $numeric_cat[] = get_category_by_slug($cat)->term_id;
    # echo "meow! ";
  }
}

Did I seriously put a commented “meow” in this code? Yes I did. For the curious cats out there, $cats are categories, and $numeric_cat means numeric category.

No comments \ Leave a comment
May. 12, 2009

Server optimization

Back in November of last year, an enthusiastic sports fan started an “Official 10,000 Post Thread to Support the Ravens” on our talkboard. Shortly thereafter, other fans pitched in and did show their support. By the Ravens-Titans game, the said thread exceed 10,000 posts and kept growing.

By around 9 PM that evening, the server cratered and had to be resuscitated. It took approximately ten hours to breathe life into it, as its databases refused to repair.

(Note to geeks: check the size of your /tmp partition and make sure it’s 3 x the size of your MySQL database, k thx.)

Anyhow, to prevent the issue from happening again, I set out to optimize the machine (lesson learned: every byte counts). End result was a much smaller memory footprint for an individual rendering.

The 3-D graph on the right shows ~8 MB usage without optimization, and down to 1.5 – 1 MB afterward. Opcode caching FTW!

No comments \ Leave a comment
Posts on this blog solely represent my personal opinions and technical experience.

© 2009-2013 Edin (Dino) Beslagic