My desk, post 4am programming orgy

image

’nuff said… ;]

DVD burner complexities

So I took apart my DVD burner today – no worries, it was already broken… ;]

I have to say, I was simply astounded at the complexity of the mechanism. I mean, sure, I knew that it was complex, but the intricacies of the mechanism floored me. I had no idea that such am everyday item possessed such engineering beauty!

First of all came the tray mechanism with all of its plastic-geared beauty… Well, maybe that bit wasn’t so beautiful after all… ;] However the worm gear drive and stepper motor was pretty cool.

The direct drive CD spinning motor was pretty cool, too – at least I think it is when you think about how fast it had to spin that little plastic platter.

The real marvel of the thing comes in the read-write head, however. That is a precision-cast little bit of aluminium (to keep it light) that is machined to some apparently pretty tight tolerances to keep the optical path accurate. This is wrapped in a miniature 3D circuit board whose equal I have yet to see elsewhere, including laptop designs. These were little bits of board connect with filigree ribbon (I hesitate to call them “cables”) that wrapped around all sides of the aluminium substructure.

Not stopping there, we have a wonderfully complex optical path that includes the laser diode, a detector and the lens that is suspended on the teeniest imaginable copper springs which also service as current-carrying conduits that energize the circuit boards on either side of the lens. These  circuits create electric loops which then help to drive it up and down inside the strong magnetic field generated by the two tiny rare-earth magnets on either side.

All in all a complete engineering marvel that I picked up for a measly $40.

I think I’m beginning to understand why these things cost over $1,000 at inception… ;]

Yeah, the C64 is coming back! ;]

This is kinda cool. It’s a new C64 (this time a 64-bit full Wintel computer) in the same form factor as the old C64. Not sure how practical it’ll be, especially with the keyboard being kind of thick, but it makes me go all nostalgic inside.

Whoa!

Wow – this is like cool beyond words! I kinda want a copy of Mathematica 7 now… ;] (click the image to read the blog post explaining the neat image processing capabilities of Mathematica 7).

OK, yeah, I’m a huge nerd – what’s your point? ;]

CakePHP and XDebug

CakePHP LogoSo this is not going to come as much of a shock to people experienced with CakePHP, but I’m just learning now and liking what I’m seeing. CakePHP 1.3 has a really nice set of conventions to work against and provides a seemingly pretty good scaffold for most typical webapps, so I’m thinking I’ll be making some more progress with that. Questions I still need to resolve include:

  1. Does it support jQuery easily enough (CakePHP uses Prototype/Scriptaculous as its default framework, but has provisions for using others)
  2. Is the Ajax-y goodness baked in enough?
  3. Will it really be flexible enough to accomodate my needs?

AS part of this I also ended up installing Xdebug, since that’s the default debugger for CakePHP. I must admit, the things I really like about it so far are:

  1. Ease of install (instructions here got me up and running and a couple of tweaks to my Eclipse PDT setup (which supports Xdebug out of the box – nice!) found here and here got me the rest of the way). The tailored install instructions that analyze your php.ini, provide the correct download and customized install instructions is the coolest thing for a newb like me to get up and running quickly! ;]
  2. Code coverage analyzer! I’m not sure if Zend Debug is able to do the same thing, but that’s way cool!

All in all, looks like I’ve found me a framework I can be happy with – finally! ;]

PHP ZendDebugger and WAMP

So I wanted to write about my woes with PHP ZendDebugger and the latest WAMP install. Bottom line: I can’t get it to work with PHP 5.3 yet. I believe this is an incompatibility in the debugger DLLs that I have been able to find for 5.3 – looks like the linkers used are incompatible with what WAMP is using.

So, here are my findings (in no particular order):

  • PHP 5.3 requires zend_extension whereas 5.2 and prior require zend_extension_ts, so since 5.3 doesn’t work for me yet, I used zend_extension_ts
  • You do not need a separate extension configured for ZendDebugger.dll, contrary to what some posts have you believe…
  • I was able to use the PHP 5.2.11 from the WAMP distribution (click the “Get more…” menu item in WAMP’s task icon and download and install PHP 5.2.11)
  • WAMP’s php.ini seems to be copied to the Apache/bin directory – haven’t figured out why that is yet… So, make sure you’re editing the correct one!
  • I was able to get it to work with these lines added to the end of my php.ini file:
    1
    2
    3
    4
    
    [ZendDebug]
    zend_extension_ts=C:\wamp\bin\php\php5.2.11\ext\ZendDebugger-5.2.15RC1-cygwin_nt-i386\5_2_x_comp\ZendDebugger.dll
    zend_debugger.allow_hosts=127.0.0.1,192.2.3.44
    zend_debugger.expose_remotely=always

    Note the addition of the second host IP there – that’s the actual IP address I was using (well, not really, but you get the point… ;] ) – without that the Eclipse plugin wouldn’t work

  • The ZendDebugger-5.2.15-cygwin_nt-i386.zip using the 5_2_x_comp ZendDebugger.dll (not the 5_2_x_nts_comp!) from here worked for me – YMMV.
  • Otherwise I followed the instructions here

Hope that helps some of you!

Big Bang Theory

So I wanted to look up a Big Bang Theory episode yesterday and I noticed that Google found quite a number of pages referencing it. As a result, I got curious how many results each of the episodes would return. A few lines of Perl code later, here is the result.

Big Bang Theory Popularity chart

It lists the number of results returned for each episode as a measure of relative popularity. Interesting… By the way, I had to cut out the pilot episode because it turns out that the NSTA pilot’s certification requires you to know about the Big Bang Theory… Huh, who knew!? ;]

Here is the Perl code for the previous Big Bang Theory chart. In case you’re interested… ;]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/perl
use strict;
use warnings;
use LWP;
use Data::Dumper;
use File::Find;
use GD::Graph::bars;
use GD::Graph::colour qw(:colours :lists :files :convert);
use List::Util qw /max/;
 
my $googurl = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=";
my %results = ();
my @csv;
 
find(\&BangFile, "c:\\downloads\\The Big Bang Theory");
 
my @values;
my @keys = sort(keys(%results));
my $key;
foreach $key (sort(keys(%results))) {
  push(@values, $results{$key});
}
my $maxYVal = (max @values) + 100;
print $maxYVal;
 
my $graph = GD::Graph::bars->new(400,500);
$graph->set( 
    x_label           => 'Episode',
    y_label           => 'Popularity',
    title             => 'Popularity of Big Bang Theory Episodes',
    y_max_value       => $maxYVal,
    transparent       => 0,
    bgclr             => qw(white),
    fgclr             => qw(black),
    textclr           => qw(black),
    x_labels_vertical => 1
) or die $graph->error;
my @data = (
  [@keys],
  [@values]
);
my $gd = $graph->plot(\@data) or die $graph->error;
open(IMG, '>BigBangTheoryPopularityChart.png') or die $!;
binmode IMG;
print IMG $gd->png;
close IMG;
open CSV, ">BigBangTheoryGraphData.csv";
foreach (@csv) {
  print CSV join(",", @$_), "\n";
}
 
sub BangFile() {
  if (-f $_ && !($_ =~ /pilot/i)) { 
    my @searchterms = split(/\./, $_);
    pop(@searchterms);  # remove the .avi from the filename
    my $episode = $searchterms[4];
    splice(@searchterms, 4, 1);
    my $searchterm = join(" +", @searchterms);
    $results{$episode} = &dosearch($searchterm) + 0;
    push(@csv, [$_, $episode, $results{$episode}]);
  }
}
 
sub dosearch {
  my ($term) = @_;
  my $agent = LWP::UserAgent->new();
  $agent->timeout(1800);
  my $search = "${googurl}$term";
  print "$search\n";
  my $response = $agent->get($search);
  die "Cant't get $googurl -- ", $response->status_line
    unless $response->is_success;
  my $resp = $response->content;
  if ($resp =~ /"estimatedResultCount":"(\d+)"/) {
    return $1;
  }
}

Coolest new Firefox extension?

Just tried out Ubiquity – somehwat of a crossover between Greasemonkey and Quicksilver with roll-your-own mashups underneath it all… ;] Great of you want to use your keyboard more for Firefox. Possibilities are staggering!

Firefox Download day a drag so far… (part deux)

So it’s almost at the end of download day, and I have to retract what I was saying yesterday.  I guess Internet impatience got the best of me… ;] So of course, the good folks at Mozilla had the smarts to make sure they’d be ready for the storm of requests and it looks like their infrastructure only got weak knees for a little while at the start.  Recovered nicely thereafter and at about 1:35pm EDT time FF3 showed up. I proceeded to happily download to my various machines and think this is much less of a drag now… ;]

spreadfirefox.com shows 7,389,769 downloads at the time of this writing, so I’d call that pretty successful – at least pending the next world record attempt. Since this is a new record, we’ve got no other benchmarks to compare it against, but I’d call that some pretty significant interest that will be hard to replicate!

Firefox Download day a drag so far…

So, here we are, 20 minutes after the start of FF download day and already http://www.spreadfirefox.com/ is down. mozilla.org is up, but the download link for FF 3 RC3 is unreachable, never mind the fact that the final FF3 isn’t visible anywhere yet. Hrmph.

Update (1:30pm EDT): Alright, so the RC3 is downloadable again, but FF3 Final still nowhere in sight.