Blog

Invoking the Firebug debugger from a script

June 9th, 2009

If you’re tired of digging through the Firebug scripts tab to find and insert breakpoints, I was told today about a little-known trick in Firebug that allows you to add breakpoints directly in the source JS file itself.

By issuing the ‘debugger’ statement anywhere in your code, Firebug will halt execution of the script at that location, popping up it’s debugger and highlighting the line where it was used. Example:

    <body>
        Debugging:
            <script type="text/javascript">
            for (var i=0; i<100; i++) {
                if (i === 50) {
                    debugger;
                }
                document.write(i+"<br>");
            }
            </script>
        Page end!
    </body>

Unfortunately, this feature seems to be specific to Firebug only, although the Chrome Javascript Debugger (CTRL + SHIFT + L) allows you to use the “break” command with an optional conditional. There does not seem to be any similar functionality in IE8, Opera, and Safari, although I would be glad to hear if it did.

QUAKE LIVE Twitter IRC Bot

March 13th, 2009

On #quakelive on QuakeNet, there is a bot named QLTwitter that spits out text everytime the QUAKE LIVE Twitter account is updated. I’ve gotten a few requests for the code, so figure I’d publicly release it.

It has a couple of dependencies, all of which are available in Debian packages. Specifically, it requires POE, its IRC client module, and JSON modules. It is basic, but it works, and can easily be changed to broadcast tweets from any other account.

use warnings;
use strict;

use POE;
use POE::Component::IRC;
use JSON;
use LWP::Simple;
use Time::HiRes qw(time);

my ($irc) = POE::Component::IRC->spawn();
my $currStatus = '';
my $updateDelay = 120;
sub CHANNEL { "#quakelive" }

POE::Session->create(
    inline_states => {
       _start     => \&bot_start,
       irc_001    => \&on_connect,
       tick       => \&checkTweet
    },
);

sub bot_start {
    $irc->call(register => "all");
    $irc->call(connect =>
          { Nick => 'QLTwitter',
            Username => 'QLTwitter',
            Ircname  => 'QLTwitterBot by sponge',
            Server   => 'us.quakenet.org',
            Port     => '6667',
          }
    );
}

sub on_connect {
	$irc->call(privmsg => 'Q@CServe.quakenet.org', 'AUTH sponge ------');
	$irc->call(join => CHANNEL);
	$irc->call(privmsg => CHANNEL, 'QLTwitterBot is LARGE and IN CHARGE!');
	$_[KERNEL]->delay( tick => $updateDelay);
	checkTweet();
}

sub checkTweet {
	eval {
		my $json = get 'http://twitter.com/statuses/user_timeline/quakelive.json';
		my @statuses = from_json($json);
		my $curr = $statuses[0][0]->{'text'};
		if ($currStatus ne $curr) {
			$irc->call(privmsg => CHANNEL, "New QUAKE LIVE Twitter update: $curr");
			$currStatus = $curr;
		}
	};
	eval { $_[KERNEL]->delay( tick => $updateDelay); }
}

$poe_kernel->run();
exit 0;

New Server

March 9th, 2009

If you are reading this (which is kind of silly since if you’re not reading this you’ll have no idea this is there) then you’re reading d8d on the new server! Have been spending a couple of hours tonight getting all my stuff off our old server which is very likely ready to die any moment now. Anyway, hopefully all goes well, and time permitting, there’s been a few things I’ve been meaning to blog about.

New design online!

January 29th, 2009

Finished up the couple of remaining bits, and my new design is now officially up! The blog at the moment is still unskinned, but I’ll probably be fixing that in the near future. The new site should hopefully be compatible, or at least working, in most major browsers, so any feedback on broken things would be greatly appreciated.

New Design

January 18th, 2009

Things have been pretty quiet recently, so I’ve been slowly redesigning this site. Although I’m still a fan of my current design, I figure it’s about time to change again. For anyone interested, here’s a screenshot of what the new site looks like. No clue when the new design will be up, but hopefully it won’t be as long as it took to finish my current one!

Twitter

January 3rd, 2009

Twitter is one of those things that a lot of people just don’t get. I didn’t either, but still signed up anyway. I’ve found already that I already use it more often than this bigger blog, mainly because the smaller message size forces you to write quick updates. It’s convenient like text messages, another technology that I didn’t get until I started using it. Essentially, it’s free text messaging with the added feature of broadcasting to a group of people.

There are quite a few clients available, too. On my Windows Mobile phone I’ve been using the standard m.twitter.com, which works more than well enough. On my desktop, I generally use Twittget, which works as a Vista sidebar gadget. Very convenient (the sidebar idea in general is) and it doesn’t create more tray icons. It notifies me of new messages in the gadget itself, and with a bird tweet sound.

If any of my 3 readers whom I aleady haven’t told about it wish to add me, check out my profile at Twitter. I’ll be looking into how I can integrate it with the front page somehow in the near future.

iPhone Web Applications

December 10th, 2008

RIT offer a class “Web Application Development for iPhone” and looking to fill my schedule, I’ve been taking it this quarter. Despite my skepticism at the hardware and Apple’s treatment of the platform in general, there is a lot of cool stuff there.

First, arguably the biggest feature, is Dashcode. Although it suffers from poor support and being Mac OS X only (attempts to run it in a virtual machine thus far have failed) the idea and execution is great. It is essentially a visual application builder, not unlike the old FrontPage, and the form builders in Visual Studio, etc. It does a reasonably well job of hiding the web part in web design, coming with pre-built components that match the iPhone look. Output will obviously only work on the iPhone/iPod Touch; not even Safari can run output.

Being able to target only one browser allows you to use much of the cutting edge features. CSS3, HTML5, and the more advanced JS features are all available, along with GPU-accelerated transitions. It is very much a look into the future of what all browsers will eventually support, except with a viable platform available today for immediate development.

Although the mobile web has a lot of hype and buzzwords associated with it, there is some substance to be found. It is pretty exciting to see what the next-generation of browsers will bring as a new standard. With technologies like Adobe Alchemy bringing C++ to Flash, there are certainly exciting times ahead for web applications.

Wheel of Friends

September 9th, 2008

This is something I produced last year, as a part of the Open Publishing Lab so unfortunately the source isn’t available as of yet, but it’s still worth nothing.

The below is a visualization of the results of a social networking game we ran at a festival last May. Hit the link for all the details, but the gist of the game is people trade barcode stickers with people who share at least one interest out of a pool of 8 or so. Those people who connect are scanned in via a normal scanner, an application rips the barcodes and stuffs them into a database. Once those links in the database are made, it’s a bit hard to visualize it all. This is where my part came in: visualising all the people via a wheel.

The wheel was created in PHP, using a little trig, and a lot of tweaking. The output can accomdate a virtually unlimited amount of people and links. Plus, it’s pretty to look at. The wheel has gotten a lot of mileage (no pun intended) on a lot of the promotional material for the OPL.

Asus EEE PC 901

August 7th, 2008

I had originally started this blog trying to avoid the senseless posts about your personal life that very few people care about, and yet here I am, blogging about my recent purchases. Nevertheless, I recently bought an EEE PC, one of the originators of the UMPC/netbook market to replace my Gateway laptop, which despite being relatively new, has not held up well at all. After finding out how much it would cost to repair it, I figure I’d just bite the bullet and go for the EEE.

So far, after a rough start on the software side of things, I’m pretty happy with the device. It is quite speedy; time from boot to usable is very fast, and once you’re able to get GNOME running on it (which in true Linux fashion, requires editing text files) it becomes a lot more handy than the built-in “simple” interface. The built-in software is pretty extensive, including teaching applications, and closed-source apps like Skype instead of Ekiga, with out of the box working video conferencing. From a quick test, the audio quality is quite high, and the webcam is decent for being a tiny 1.3 megapixel affair.

My only major issue is with the touchpad: there is a quite noticeable delay on movement, and getting it to register at all requires you to use your whole finger, rather than the tip. Apparently this is easily fixable on Windows, but I’m unable to find an equivalent fix for the built-in Xandros system.

Otherwise, the screen is an 8.9 inch LCD running at 1024×600. Although I haven’t done the calculations, it looks like a higher DPI than your average screen. The keyboard is tiny, and definitely takes adjusting to; I type with 3 or 4 fingers per hand but have managed to become pretty fast typing this way (in fact this post has been written on the EEE).

In the 901 series, they’ve elected to change the casing, from a nice matte plastic that’s easy to handle and carry, to a generic glossy surface that everyone seems to be doing these days. it attracts fingerprints, and personally, I think is rather ugly looking. Seems like such a pointless change, and it’s too bad they had to change it right before the model I purchased.

Overall, anyone else considering the EEE or other similar devices would do a great service to themselves by checking one out in stores before. In the case of the EEE specificially, unless you’re planning to use it as is, be prepared to spend a lot of time tweaking. Even installing XP requires some post-install tweaking in order to reduce wear and tear on the drive. I don’t expect to get much use out of this for the remainder of the summer, but carrying this around once I’m back to college in the fall should be quite nice.

Site Updates

July 30th, 2008

After a couple of years of letting my resume fall into disarray, I’ve finally updated it with all the projects I’ve been apart of these past couple of years. I’m getting ready to hopefully graduate college this year, so if anyone actually reading this has any connections that may be looking, please do let me know!