Category Archives: Programming

Google Notebook for Firefox 3.6

Officially, Google dropped support for the Notebook extension with version 3.0 of Firefox, but you were able to get it working in Firefox 3.5 with this hack.

However, I’ve been using the Firefox 3.6 Beta for a while now, and the performance is degraded.  The extension seems to still allow you to bookmark a page without going to http://notebook.google.com, but the popup doesn’t register any mouseclicks.

I’m currently in the process of creating a Firefox dev environment, just to keep this extension working — that’s one way to cut my teeth on Firefox extension development, I guess. :P

Fun with Cookie Expiration

So, I had a bit of code that would delete a cookie if the date that I set it (“sessionTimeBegan”, which I stored in a variable) turned out to be on the previous day as when I was checking it:


if (MDM.VARS.MAIN.sessionTimeBegan.clearTime(true) <
(new Date()).clearTime())
{
// delete cookie
}

Then I remembered that you can just set cookies to expire on a certain time and date and that this is utterly stupid.

Don’t do this.

That being said, I did learn about ExtJS’s “clearTime()” and “clone()” functions for Date objects, and they’re really neat.

Finally got a Windows share to share

For years, our main gaming computer (which we call the “Titan”) would just not share with any other computers.

It couldn’t host multiplayer games.

It couldn’t share a printer.

It wouldn’t share files.

You couldn’t access multimedia of any sort over it.

I had absolutely no idea what the problem was — it was a very old Windows XP installation, probably four years or more, and had gone through Windows XP SP1, SP2, and SP3, so there’s no telling.

It might’ve been some service I turned off years ago, or (more than likely) an old remnant  of Norton Antivirus (a horrible, horrible program) that refused to let go.

I noticed that my much newer gaming PC would work just fine, and that it was running the exact same services that the Titan was running, so I was stumped.  You couldn’t even ping the Titan if you wanted to.

So, on a whim, I search for “cannot ping Windows XP computer” on Google, and found this:

Try this to reset TCP/IP in XP:

Click Start -> Run -> CMD

At the prompt type:

NETSH INT IP RESET C:IPRESET.TXT

via Help! Unable to ping machine on the network – Windows NT / 2000 / XP / 2003.

And it worked.  I don’t know what it did, but it worked.  I think it reset completely the way that TCP/IP worked on Windows, because when the Titan restarted, my IP settings were completely reset, but I could ping it. And it shared files.  And it could host games (I think).

Either way, I’m happy!

Various Browser Benchmarks

I’ve been installing/reinstalling/testing a lot of browsers recently, so I thought I’d provide a little bit of data back to the programming community.

I tested on two different computers — my venerable Dell laptop and my largely MSI-powered gaming PC.

Some thoughts:

  • The newest Opera 10 build on Linux does not like the SunSpider benchmark.  Understandably, it’s a benchmark put together by the WebKit browser team, but still — it performed about as bad as I’d suppose Internet Explorer would (were it to run on Linux).  I ran it twice just to make sure, and it was about 10k milliseconds each time.
  • Chromium, whether it’s on Windows XP, or the pre-alpha build I’m using on Linux, is pretty damn fast.  Like scary fast.  Though, like I said, it is their own benchmark.
  • Seamonkey on Linux is consistently faster than Firefox 3.1b3 on Linux.  I have no idea why, since they’re supposed to be powered by the exact same engine.
  • It’s amazing how much faster an older computer (Like my Dell laptop) can feel when you use a browser that’s optimized to render JavaScript faster.  It seriously feels like an entirely different computer.
  • I tried running this test in Internet Explorer 6.0 via Wine, on Ubuntu.  I figured it’s not exactly emulation (since Wine Is Not an Emulator and all), but it kept freezing on one of the “base64” tests, and I got tired of waiting on it and killed the process.  Imagine that.

And now, the benchmark numbers, utilizing the SunSpider JavaScript benchmark (smaller numbers are better, all numbers in thousandths of a second):

Computer #1

Hardware:  Dell Laptop, Pentium 4-M 2.6 GHz, 1.5GB DDR Ram

Software:  Ubuntu 8.04 (x86)

  • 10572.4ms:  Opera 10 Alpha, Build 4214
  • 8435.8ms:  Flock 2.0.3
  • 8171.8ms:  Firefox 3.0.8
  • 5243.6ms:  Firefox 3.1 Beta 3 (Shiretoko)
  • 4701.4ms:  Seamonkey 2.0 Alpha 3
  • 1506.4ms:  Chromium Dev Build

Computer #2

Hardware:  MSI Mainboard, Athlon X2 2.5GHz (Brisbane), 2GB DDR2 RAM

Software:  Windows XP SP3 (x86)

  • 6930.8ms:  Internet Explorer 8
  • 2097.8ms:  Firefox 3.1 Beta 3
  • 952.4ms:  SRWare Iron 2.0 (Chromium)

Mozilla’s Ubiquity

I know I said it before about JSON and regretted it (though it was the beginning of a beautiful friendship).

However, I just don’t seem to get Mozilla’s Ubiquity project, and I’ve even watched their whole video, and have seen and read stuff about Ubiquity for almost a year now.

I mean — is including a link in an email really that cumbersome and terrible? : Is having to use an extension to process things with tinyurl.com so horrible you want to be able to do it through text commands?

But, like I said, I’ve said this kinda stuff before — knowing me, I’ll be designing with Ubiquity in a couple of months! :P

An Abundance of GIMP Synergy

Installing GIMP 2.6 on Ubuntu 8.04

wilberWell, I got tired of being stuck with the version 2.4 of the GIMP (GNU Image Manipulation Program) that ships with Ubuntu 8.04.  It’s old, it uses the old window system that I can’t stand anymore, and version 2.6 (the current version) fixes tons of more issues that it has.

However, you can’t just go to your package manager and add it — Ubuntu locks program versions when it ships (for example, the latest version of GIMP available to Ubuntu 8.04 users is 2.4).  This is done for compatibility reasons — if version 2.4 of the GIMP works fine when Ubuntu 8.04 ships, then they lock those versions together. That way, it’s always guaranteed to work, no matter when Ubuntu is installed in the future.

However, there’re sites likes GetDeb.net which lets developers upload installer files of popular programs for Ubuntu, so that users of older versions of Ubuntu can install new programs.

So, I went to the GetDeb page for GIMP 2.6 and downloaded all the files you need to install GIMP 2.6 on Ubuntu 8.04:

Usually, in 99% of situations, you just download these files and install them, even on Ubuntu. However, on Ubuntu 8.04 with GIMP 2.6, there’s a bit of a problem — you have to force these files to install.

Now, you can do fancy command-line kung-fu if you want to, but you shouldn’t have to on Ubuntu, so I’ve included a file here for you:

Just save that file, put it along with the 5 files you downloaded from GetDeb.net into their own folder, and then run that file. (Make it executable in its properties, and then double-click on it).

And that’s it!

(I got the inspiration for that install file from this blog post here!)

The Synergy of Mac, Linux, and Windowslogo

I’ve always heard about the program called Synergy, but I’ve never used it, and that’s a damn shame.

Have a lot of computers side by side that you manage all at once? Tired of going from one keyboard and mouse, to another, even though the computers you’re working with are side by side?

Then download Synergy, configure it, and run it on all of your computers (Mac, Linux, and Windows).

And that’s it. Honestly. It’ll take you about 20 minutes and you’ll spend the next few hours wondering how you ever lived without it.

It treats all of your computers like one giant desktop — just move your mouse “off” of the side of your monitor towards your other computer, and your mouse will instantly reappear on that computer’s monitor. If you need to type something, you type it with the first computer’s monitor. Seriously.

Ah, a caveat — on Mac and Linux, the setup isn’t as streamlined and easy as it is on Linux, so there’s a program called QuickSynergy that can do it for you. If you’re using Ubuntu, it’s already in the repositories — just go to your “Add/Remove Applications” menu item, and install QuickSynergy from there.

New Blog Code Displaying via SyntaxHighter

See it below? Isn’t it just the neatest?

I had been displaying my code blocks on here with a bit of custom CSS that I had made, but I had always seen these really neat formatters for code displaying on blogs (with the syntax highlighting and the line numbers and all that). So, after reading someone’s blog one day and seeing one of these displayed yet again, I finally decided to get my own.

Thankfully, the blog in question was using a syntax highlighter that had a handy “About” link on each one (nothing wrong with an author taking credit), and I decided to adopt the very nice SyntaxHighlighter JavaScript package from http://alexgorbatchev.com/.

Alex even offers support for Blogger.com blogs (he even offers rudimentary hosting for this!). About the only thing you need to do is set the “Blogger.com” flag manually, as you’ll see below. Just include these files on your own web page and then start using “pre” tags to surround your code blocks (which you can take directly from your code editors — tabbing and spacing is preserved!).


<link href='http://alexgorbatchev.com/pub/sh/2.0.296/styles/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev.com/pub/sh/2.0.296/styles/shThemeMidnight.css' rel='stylesheet' type='text/css'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.296/scripts/shCore.js' type='text/javascript'/></script>
<script src='http://alexgorbatchev.com/pub/sh/2.0.296/scripts/shBrushJScript.js' type='text/javascript'/></script>
<script src='http://alexgorbatchev.com/pub/sh/2.0.296/scripts/shBrushXml.js' type='text/javascript'/></script>
<script src='http://alexgorbatchev.com/pub/sh/2.0.296/scripts/shBrushCss.js' type='text/javascript'/></script>
<script type='text/javascript'>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.all();
</script>

Conky, Dell i8k Modules, and My First Ubuntu Bash Script

Conky Screenshot

Well, I started playing around with Conky yesterday — if you haven’t heard of it before, just know that it’s a neat little Linux program that runs in your background and uses very little resources that displays a very neat desktop overlay.  (Like in the picture in the Lifehacker article.)

Now, some of the stock Conky scripts were more than adequate, but I had always wanted my laptop’s CPU temperature to be displayed as well, so I had to figure out a way to do that.

Now, if you’re somewhat familiar with tinkering in Linux, you’ve probably heard of the wonderful “lm_sensors” package — it’s a neat package for Linux that helps display lots of information about motherboard temps and whatnot.  Unfortunately, due to most laptops “prorietary-ness,” lm_sensors does very little for you if you’re trying to get it to work on a laptop.

Now, I had heard of the “i8kutils” package for Linux — this was a package designed for Dell laptops in particular, to display and control fan and temperature information.

So, with that, I was off to work!

(Note — these instructions are mostly for Ubuntu/Debian installations, because that’s what I use.)

First, install the package “i8kutils” using your Linux computer’s package manager (Synaptic, if you’re using Ubuntu).

Second, add the module “i8k” to your “/etc/modules” file.  (This will start the process at boottime.)  Restart your laptop.

Third, you’ll have to create some Conky script files.  I assume you’ve already had a bit of experience at least installing Conky and starting it up.  If not, play around with the instructions in that Lifehacker article and come back here afterwards.

Now, I noticed that one of my conky script files was a file called “hddmonit.sh” which contained the text:

#!/bin/bash
echo “$(nc localhost 7634 | cut -d’|’ -f4)”

Now, using a little bit of deduction, I figured that this file used a command called “nc localhost 7634” to display a little bit of information, and then used pipe commands (the little “|” symbol) to further splice the info, extracting just the temperature of my laptop’s hard drive.

So, while “nc localhost 7634” outputted this:

|/dev/sda|ST980815A|43|C|

Using the command “(nc localhost 7634 | cut -d’|’ -f4” would output just “43”, which was the temperature of my hard drive.

(The “cut” command splices out specific text from a string it’s given, in this case the fourth (-f4) chunk of text seperated by a “|” chracter.)

Now, I learned that the “i8k” module, once loaded, could be accessed with the file at  “/proc/i8k”, which just contains a string like:

1.0 A32 7GGGGGG 53 -22 1 -22 90300 -1 2

From this you can see various Dell-specific information, the important part being “53”, which was my current processor temp.  (The items in the string are separated by spaces.)

So, I quickly made myself a new script file called “i8ktemps.sh” copying the contents of “hddmonit.sh” and changing them to:

#!/bin/bash
echo “$(head /proc/i8k | cut -d’ ‘ -f4)”

This file, when executed, will just output the fourth “chunk” in the file “/proc/i8k”, which as you remember is my current processor temp.

Now, I needed to edit my Conky configuration file, which is located in your home folder and is called “.conkyrc”.

Then I simply located the line:

${font weather:size=28}x ${font}HDD ${execi 1 ~/scripts/hddmonit.sh}C

Which displayed my hard drive temperature, and changed it to:

${font weather:size=28}x ${font}CPU ${execi 1 ~/scripts/i8ktemps.sh}C HDD ${execi 1 ~/scripts/hddmonit.sh}C

Which, when Conky was restarted, would display my hard drive temperature and my current processor temperature.

See?  It’s not that hard to program this stuff!  I did this all, both programming in the Linux “Bash” shell and coding in Conky’s personal configuration code, without any experience in either.  I just looked at what was there, and changed it.

Relevant Links:

http://www.arachnoid.com/linux/shell_programming.html

http://ubuntuforums.org/showthread.php?t=411800

http://www.linuxcommand.org/wss0010.php

Google Earth 5.0 Installation Problems

Nabble – ubuntu-users – Google Earth 5.0 Installation Problems.

Wondering why your brand new installation of Google Earth 5.0 isn’t working in Ubuntu?  Is it crashing after it gets done with the splash screen, or generally just not starting up?

An odd problem, but one with an easy fix — just go to the folder where you installed Google Earth (the program files, not the shortcut), and delete or move the file called “libcrypto.so.0.9.8”.

And that’s it — wierd, but it works.