JQuery bookmarklet (show)  

This is a great idea that I'm surprised no one has thought of before. If you want to play with JQuery on a non-jquery page you can use this great bookmarklet to add JQuery to any page.

Leave A Reply

Remove all JS click events (show)  

I manage some old legacy XHTML code that has onclick="foo()" elements in the XHTML. There is also some JQuery that adds click() events. I wanted to completely clean up all click events from a given element. I made a simple JQuery function to remove the onclick HTML events, and JQuery click events.

function super_clean(jselector) {                                                                                               
   return $(jselector).removeAttr('onclick').unbind('click');                                                                   
}
Leave A Reply

Great JQuery overview (show)  

John Resig gives a great JQuery overview. The slideshow is all HTML and includes live JQuery examples to play with. Well worth the read if you use JQuery at all.

Leave A Reply

Tracking for my new CPU (show)  

This is a tracking entry to note the day I got my AMD Athlon II X3.

Leave A Reply

Easily rip the audio from any video file (show)  

You can use ffmpeg to rip the audio from any video file.

ffmpeg -i input.avi /tmp/output.wav
Leave A Reply

Netflix on the PS3 (show)  

I got my Netflix disc for the PS3 and decided to test it. The first thing I noticed when opening it is a big label on the envelope that says "do not return this disc". After I inserted the disc in your PS3 I couldn't find the icon to launch Netflix. It does not auto start, and it's not under the games section where PS3 games are when you insert the disc. Instead the Netflix icon is, logically, in the video section. After you launch Netflix it gives you a URL to visit on your PC. After you visit the URL it pairs up your PS3 with your Netflix account via a 6 digit code. From here you're able to watch anything in your queue that's streamable.

I'm left wondering why Netflix requires the disc to be in the system to stream content. It does not install the application to your system. Installing to your system would make more sense, as then I wouldn't have to insert the disc every time I wanted to stream content. The PS3 has a HD for this sort of thing, I'm not sure why Netflix doesn't use it. Perhaps it will be integrated with the system in a future software release?

Leave A Reply

Woot KDE 4.4 (show)  

KDE 4.4 just hit the Fedora yum repos. I'm upgrading as we speak!

Leave A Reply

Readability Firefox Extension (show)  

Readability is a Firefox extension to strip the extraneous cruft out of webpages and present you just the content you read. When you read an article on a major news site you can end up viewing a huge header, ads down the sides, links to send/blog/print, etc. Readability strips out the content and presents it to you in an easy to read fashion. Incredible.

Thanks to dria.org for pointing it out.

Leave A Reply

New bed (show)  

For the purposes of tracking the warranty on my new sleep number bed, it arrived today.

Leave A Reply

IE and its broken substr() (show)  

substr() is a very simple function for working with strings. It's been around forever, and is well documented. I recently had need to find the last character of a string in javascript. Everything was working fine in Firefox and Chrome, but IE was breaking.

'abcdef'.substr(-1,1)

That is, start at 1 character from the end (-1) and return 1 character. In all other browsers this returns 'f' but in IE it returns 'a'.

Leave A Reply

Ruminating on the new iPad (show)  

  • Isn't this just a big expensive iPod touch now?
    • It's more than just an iPod touch that won't fit in your pocket...it's also an underpowered netbook with no keyboard. It's the worst of both worlds!
      • It actually has a robust power source; it is powered almost entirely by the user's sense of self-importance.

Slashdot.org comments

Leave A Reply

Microsoft has two malware tools (show)  

Malicious Software Removal Tool scans your system on demand for malware, and Microsoft Security Essentials is a real time anti-virus tool. Both are tools are free.

Leave A Reply

GMail and IMAP (show)  

I use Thunderbird as an IMAP client on my GMail account. There are a couple of idiosyncrasies that require some settings changes. Google has a detailed page about setting up various IMAP Clients to work properly with GMail.

Leave A Reply

Caching results in a PHP function (show)  

If you have a function that will get called lots of times, and you'd like to cache the results so as not to incur a performance penalty for hitting the disk/DB again use static variables.

function get_user($id) {
  // Sanitize the input
  $id = intval($id);

  // Declaring as static prevents the variable from dying when the function exits
  static $cache;

  // If the data is already in the cache just return that
  if ($cache[$id]) { return $cache[$id]; }

  // Get the data from the DB/Disk/Slow Source
  $rs = mysql_query("SELECT * FROM UserTable WHERE ID = $id");
  $ret = mysql_fetch_assoc($rs);

  // Store the results in the cache so it will be there next time
  $cache[$id] = $ret;

  return $ret;
}

This will store the results in cache (memory), speeding up subsequent requests. This cache will last until your script ends. To store across multiple script executions you'll want to look at something like memcache.

Leave A Reply - 1 Reply

pgrep where have you been all my life? (show)  

Ever need to find the PID of a specific process, or if a process is running? Pgrep to the rescue!

pgrep pigdin

This allows you to do cool things like:

#!/usr/bin/perl

if (`pgrep speedcrunch`) {
    print "is running\n";
} else {
    print "It's not running\n";
    # do some other stuff
}
Leave A Reply