Storing Web Apps locally with Data URLs
Posted by JP on Jul 14, 2008
Some people think that you need net access to run web-based applications on your iPhone. Not so. By using a data: URL, entire page content is encoded all in the URL. If save a bookmark for this URL, you can access this a JavaScript-based app even offline.
For example… paste this in to your browser.
data:text/html;charset=utf-8;base64,PGh0bWw+CjxoZWFkPgo8bWV0YSBuYW1lPSJ2aWV3cG9ydCIgY29udGVudD0id2lkdGggPSAyNDAiIC8+Cjx0aXRsZT5UaXAgQ2FsY3VsYXRvcjwvdGl0bGU+Cgo8c2NyaXB0PgoKZnVuY3Rpb24gdGlwKGFtb3VudCkgewogICAgcmV0dXJuIHRpcDsKfQoKdmFyIG91dHB1dCA9IG51bGw7CnZhciBwZXJjZW50ID0gMTguNSAvIDEwMDsKdmFyIHJ0aXBfZmFjdG9yID0gMC4yNTsKdmFyIHJ0b3RhbF9mYWN0b3IgPSAxLjAwOwoKZnVuY3Rpb24gd3JpdGVPdXQobGluZSkgewogICBpZiAob3V0cHV0KSB7CiAgICAgIG91dHB1dC5hcHBlbmRDaGlsZChkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJiciIpKTsKICAgfSBlbHNlIHsKICAgICAgb3V0cHV0ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoIm91dHB1dEFyZWEiKTsKICAgfQogICBvdXRwdXQuYXBwZW5kQ2hpbGQoZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUobGluZSkpOwp9CgpmdW5jdGlvbiB1cGRhdGUoKQp7CiAgICB2YXIgYW1vdW50ID0gTnVtYmVyKGV2YWwoaW5Gb3JtLm51bS52YWx1ZSkpOwogICAgaWYgKGFtb3VudCA9PSBOYU4pIHsKICAgICAgICB3cml0ZU91dCgnSHVoPycpOwogICAgfQogICAgdmFyIHRpcCAgPSBhbW91bnQgKiBwZXJjZW50OwogICAgdmFyIHJ0aXAgPSBNYXRoLnJvdW5kKHRpcCAvIHJ0aXBfZmFjdG9yKSAqIHJ0aXBfZmFjdG9yOwogICAgd3JpdGVPdXQoJyQnICsgYW1vdW50LnRvRml4ZWQoMikgKyAnICsgJCcgKyBydGlwLnRvRml4ZWQoMikgKyAnID0gJCcgKyAoYW1vdW50K3J0aXApLnRvRml4ZWQoMikpOwogICAgdmFyIHJ0b3RhbCA9IE1hdGgucm91bmQoKGFtb3VudCArIHRpcCkgLyBydG90YWxfZmFjdG9yICsgMC4yNSkgKiBydG90YWxfZmFjdG9yOwogICAgd3JpdGVPdXQoJyQnICsgYW1vdW50LnRvRml4ZWQoMikgKyAnICsgJCcgKyAocnRvdGFsLWFtb3VudCkudG9GaXhlZCgyKSArICcgPSAkJyArIHJ0b3RhbC50b0ZpeGVkKDIpKTsKICAgIAp9CgpmdW5jdGlvbiB6YXAoZmllbGQpIHsKICAgIGlmICghIGZpZWxkLnphcHBlZCApIHsKICAgICAgICBmaWVsZC56YXBwZWQgPSB0cnVlOwogICAgICAgIGZpZWxkLnZhbHVlICA9ICIiOwogICAgfQp9Cgo8L3NjcmlwdD4KCjwvaGVhZD4KPGJvZHk+Cgo8aDE+VGlwIENhbGN1bGF0b3I8L2gxPgoKPHA+CkVudGVyIGFmdGVyLXRheCB0b3RhbDoKPC9wPgo8Zm9ybSBuYW1lPSJpbkZvcm0iIG9uU3VibWl0PSJ1cGRhdGUoKTsgcmV0dXJuIGZhbHNlOyI+CjxpbnB1dCB0eXBlPSJ0ZXh0IiBuYW1lPSJudW0iIG9uRm9jdXM9InphcCh0aGlzKSIgdmFsdWU9IjI0LjM3IiAvPgo8aW5wdXQgbmFtZT0ic3VibWl0IiB0eXBlPSJidXR0b24iIG9uQ2xpY2s9InVwZGF0ZSgpOyIgdmFsdWU9IlRpcCIgLz4KPC9mb3JtPgoKPHAgaWQ9Im91dHB1dEFyZWEiPgo8L3A+Cgo8L2JvZHk+CjwvaHRtbD4=
Freak’n cool eh…
Want to make your own? Then try this one.
Still not had enough? Read more about it here…
Fixing the ‘Home’ & ‘End’ keys on a MAC
Posted by JP on Jun 23, 2008
The default behavior of OS X’s home and end keys drives me crazy. In every other operating system that I’ve used (Windows,Linux, etc.), these keys move your cursor to the beginning (home) or end (end) of your current line. For a coder this is like torture. Thank god you can change it. Read the rest of this entry »
How to list all installed Perl modules
Posted by JP on May 19, 2008
I recently found it necessary to list all installed Perl modules on one of my linux servers. I wouldn’t have thought that it would be as big a deal as it turned out to be. After two hours or so of testing 20 or so methods google found for me… I settled on the following 2.
From the command line:
perl -MFile::Find=find -MFile::Spec::Functions -Tlwe \
'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC'
From a web page (CGI or Modperl/Mason):
Essential Sed one liners
Posted by JP on Apr 3, 2008
sed (Stream EDitor) refers to a Unix utility for parsing text files and the programming language it uses to apply textual transformations to a sequential stream of data. It reads input files line by line, applying the operation which has been specified via the command line (or a sed script), and then outputs the line. Getting started with sed can be a real pain if you are unfamiliar with perl for regular expressions. Here are a several sed ‘one liners’ that I use all the time for test file manipulation. More can be found here.
Read the rest of this entry »
Mac OSX Keyboard Shortcuts
Posted by JP on Feb 12, 2008
As a Mac user of less than a year I can sympathize with how painful a switch can be. Many of the keyboard shortcuts I lived by under the tyrannical reign of my PC are none existent under Mac OS. But there is hope. With the help of this list of 240 Mac OSX keyboard shortcuts and 7 months of practice, I can once again say… my Keyboard KungFu is strong.
Installing RT on Rhel51
Posted by JP on Feb 11, 2008
As of Fedora 6 rt-3.6.3 has been available as an RPM. The Fedora RPM has since been rebuilt for Rhel5 using the rt-3.6.6 source code. This document serves as a guide to the basic install and setup of a new (virgin) instance of RT.
Convert Apple DMG images to ISO
Posted by JP on Nov 20, 2007
I found this out a while ago when looking for info on reading .DMG files on Windows or Linux boxes. Long story short, its a very painful process and not worth the time. Then I found this tip. It creates ISO images from DMG images, so they can be burned elsewhere. To convert the file to an ISO image, type the following command at your terminal window:
hdiutil convert /path/to/filename.dmg -format UDTO -o /path/to/savefile.iso
Read the rest of this entry »
Use Time Machine over network drive
Posted by JP on Nov 19, 2007
Open a terminal and run:
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
Then you can use a Samba or AppleShare (even Netatalk) server share as a time machine backup location. This works perfectly, as Time Machine creates a disk image with an HFS+ filesystem on which to perform backups, and mounts that.
25 Words that hurt your resume
Posted by JP on Apr 23, 2006
As if resume writing isn’t hard enough. If your as humble as I am, you have a hard time self promoting. This article gives you a few tips on making your resume cleaner, shorter, more functional, and will hopefully get you that next job.
25 words that hurt your resume
Custom Linux Images
Posted by JP on Apr 23, 2006
This site is most useful to experienced Linux System Administrators who need to standardize their system install routines. It enables you to build custom install images for various flavors of Linux. A custom install image is one where most or all of the questions that a normal install asks have been pre-answered. You can also optionally preselect what software will be installed automatically before the system’s first boot into service. It’s based on The HP Linux Common Operating Environment (LinuxCOE), a global IT engineering program which facilitates provisioning and lifecycle support of Linux systems.