For Geniuses

Free Online Television and Movies

May 23rd, 2009

The Media Mac is still going strong and so is the move towards online entertainment. I’ve rounded up a list of sites serving up free television and film.

video.aol.com
Provides content from network and cable television channels.

Babelgum.com
Babelgum has less mainstream content.

CBS.com
Has television shows and a handful of movies from CBS.

Crackle.com
Owned by Sony and includes content from Sony’s TV and Film library.

Fancast.com
Fancast was created by Comcast and includes TV and movies from network and cable television channels.

Fox.com
Has tv shows from Fox’s current line up.

Hulu.com
Hulu is a joint venture between NBC Universal, News Corporation and The Walt Disney Company launched in March of 2008. In addition to providing streaming video they also provide CDN and syndication services to Fancast and several other video sites.

Joost.com
Joost features content from Viacom, MTV, BET, Paramount and several other content creators. In addition to television and movies Joost also has music videos.

LinkTV.org
Link TV provides international television programming.

tv.msn.com
Has major network and cable content.

NBC.com
Serves up shows from the NBC network.

SnagFilms.com
SnagFilms provides documentaries.

thirteen.org
Run by PBS and includes content produced by PBS.

Tv.com
TV.com has network tv shows including several classics.

TVGuide.com
TV Guide has video from network and cable tv networks.

tv.yahoo.com
Yahoo has television from network and cable television channels

Youtube.com
YouTube has begun offering television shows and movies in addition to it’s user generated content.

TV - http://www.youtube.com/shows
Film - http://www.youtube.com/movies

Veoh.com
Veoh provides content from major television and movie studios and other online content providers.

Joomla 1.5.x - Unique Page Styles

November 19th, 2008

In the past couple months I’ve worked on several Joomla 1.5.x sites. I’m starting to develop a bag of tricks. This trick will allow you to assign a unique css class or id for each page. I’ve used this technique to assign different header graphics to individual pages. I’m far from calling myself a “Joomla Guy,” so any input or tweaks would be greatly appreciated.

My approach is to parse the http variables with PHP and create a unique identifier. I created a function called getclass and put it at the top of my template’s index.php file. There is probably a better place to put helper functions, but I don’t know where that is yet. The function looks like this:


function getclass() {
$id = split (':', $_GET['id']);

$class = “”;

if (isset($_GET['option'])) {
$class = $class . $_GET['option'];
}

if (isset($_GET['view'])) {
$class = $class . “_” . $_GET['view'];
}

if ($id[0] > 0) {
$class = $class . “_” . $id[0];
}

return $class;
}

Now to use the class I’m adding it to the body element like so:


<body class="<?= getclass(); ?>" >

You can use firebug to inspect the body element and get a page’s class. To use it in your style sheet you can do something like this:


/* Default header */
#header {
height: 100px;
width: 900px;
background-image: url(../images/default.jpg);
}

body.com_content_category_6 #header {
background-image: url(../images/header1.jpg);
}

body.com_contact_contact_1 #header {
background-image: url(../images/headers/header2.jpg);
}

body.com_content_section_1 #header {
background-image: url(../images/headers/header3.jpg);
}

This method has it’s limits and I’m not 100% happy with it. For instance it would be cool to be able to pull a page’s section or category id so you could do per section or category specific header. The problem is that these variables don’t get passed through the URL as variables. I saw some examples where people were writing custom SQL queries to do this, but I haven’t had a project to warrant putting that much time into it. Also it seems to me that there has to be some sort of API call, like $thisPage->getCategoryid().

iPhone 2.1 Hacking - Getting Around

October 4th, 2008

Now that we have a way into the iPhone it is time to start exploring. If you have ever used Linux, OS X or UNIX the iPhone will have a very familiar layout as it is based on BSD UNIX just like the desktop version of OS X.

The Basic Layout

To navigate the file system and manipulate files there are several useful commands and short cuts. I strongly recommend logging into your iPhone with MobileTerminal or over SSH and following along. When you first log in your current working directory will be your home directory, most likely /var/mobile or /private/var/root depending on what user you logged in as. You can check your working directory with the pwd (present working directory) command.

To see the contents of a directory you use the ls command, which stands for list. Without arguments ls will list most of the contents of the current working directory. What ls doesn’t show you are hidden files. In UNIX any file starting with a . is a hidden file. Hidden files are usually configuration or system files that users don’t normally need to access. I like to be able to see these files so I usually use ls -a. Here is the contents of my home directory.

  • ./ - . is the alias for the current directory. “ls -a .” would show us the same last as “ls -a”
  • ../ - .. is the alias for the parent directory
  • .bash_history - is used by BASH to store every command you type at the command prompt. It is updated when you log out of bash
  • .forward - used to forward system mail to /dev/null
  • .ssh/ - used by ssh to store your known_hosts file
  • Applications/ - where your AppStore applications are stored
  • Library/ - preferences and user data are stored here, e.g., voice mail is stored in ~/Library/Voicemail as .amr files
  • Media/ - where iTunes media files are stored

The top level of the UNIX file structure is /, which is known as the root directory. You can make the root directory your working directory by using the cd to change directories.

The contents of my root directory are:

  • /.Trashes - where trashed files are stored
  • /.fseventsd - file system event logs
  • /Applications - link to /var/stash/Applications/ where system applications such as MobileSafari and Cydia/Installer applications are stored.
  • /Developer - empty on my system, on OS X this is where XCode would be installed.
  • /Library - system level application data and preferences are stored here
  • /System - the lowest level system files are stored here, on OS X this folder is stored in the boot sector
  • /User - a link to ~
  • /bin - is where executable files are kept
  • /boot - empty on my system
  • /cores - empty on my system
  • /dev - in UNIX everything is a file, the files in /dev are interfaces to kernel device drivers, e.g., /dev/disk0 is your iPhone’s hard drive, /dev/disk0s1 represents the root partition and /dev/disk0s2 is the partition mounted at /private/var
  • /etc - link to /private/etc, where configuration files are kept.
  • /lib - where programming libraries are stored
  • /mnt - where devices can be mounted
  • /private - where /etc /var really live on iphone.
  • /sbin - where system and administrative commands are kept
  • /tmp - temporary system scratch files
  • /usr - where applications are stored
  • /var - link to /private/var, where logs and other system files go

Commands

Here are some other basic commands you should familiarize yourself with. All UNIX systems should have a command called man. Man brings up the manual page for any given command. To find out how to use cat you could type “man cat”. Right now iPhone doesn’t support the man command but you can use it in terminal on your desktop. The commands and their options are nearly identical for all UNIX systems.

  • cat - used to concatenate and display file contents.
  • cd - changes the working directory
  • cp - copies files
  • ls - lists files
  • mkdir - makes directories
  • more - page output
  • mv - moves files
  • pwd - outputs working directory
  • rm - removes files and directories
  • rmdir - removes empty directories
  • touch - changes file access and modification times

Shortcuts

  • . - current director
  • .. - parent directory
  • ~ - home directory of user that is currently logged in.
  • ~otheruser - home directory of another user where otheruser is replaced with a real user’s name

JavaScript For Testing Layouts

September 30th, 2008

Here is a little script I wrote for testing layouts. It injects random lorem ipsum texts, lists and headings into a documents content area. To start using it include the script at the bottom of your HTML page and give your content container an the id stretchme. An absolutely positioned div with links to inject different kinds of content will appear in the top left corner of your page.

I use this a lot for design heavy HTML email templates that are going to be populated by clients or other developers to make sure the layout can accommodate different content lengths. Check out the demo.


/*global document */

var stretch = {
blocks: 1,

text: [
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec et massa sed purus suscipit volutpat. Vivamus a lectus vitae mi adipiscing accumsan. Nam auctor dolor. Morbi semper arcu commodo dolor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed pede magna, feugiat id, sagittis quis, congue et, nibh. Fusce ac quam pharetra ante condimentum hendrerit. Donec sollicitudin iaculis ante. Cras accumsan ipsum quis nisi. Sed ornare risus a orci.",

"Quisque pellentesque quam luctus justo. Mauris at purus eu mauris aliquam luctus. Morbi fermentum, lacus at iaculis consequat, erat magna malesuada quam, eget pharetra velit lacus quis arcu. Quisque quis est eu risus congue condimentum. Fusce fermentum semper massa. Donec blandit. Quisque condimentum. Phasellus orci justo, ornare nec, pretium sit amet, convallis sed, quam. Integer ornare ullamcorper tellus. Suspendisse ante mauris, mattis vel, ultricies semper, sagittis nec, felis. Phasellus pellentesque, nisl sed lobortis semper, velit lorem sollicitudin dui, in imperdiet justo nunc sit amet enim. Vivamus nec sem ut diam pulvinar pellentesque. Duis malesuada sapien ut libero. Sed sit amet lorem vitae purus iaculis vestibulum. Fusce interdum leo eu ipsum. Vivamus varius sollicitudin nisl. Nullam a tortor. Suspendisse risus pede, lobortis id, adipiscing ut, lacinia id, turpis. Sed iaculis hendrerit urna. Donec in massa.",

"Nam mattis, nulla in volutpat semper, quam orci convallis tellus, in interdum ipsum eros eu enim. Vestibulum velit erat, ultrices vel, dapibus sed, tempor sit amet, ligula. Fusce nec mauris. Aenean blandit purus at velit. Maecenas ac tellus. Cras vulputate purus ac augue placerat accumsan. Praesent porttitor, lorem at viverra volutpat, mi nisl suscipit nibh, nec venenatis mauris velit ut mi. Nunc odio libero, scelerisque eu, ultrices eget, rhoncus et, elit. Aenean erat tortor, interdum eu, fermentum ut, pharetra sit amet, neque. Fusce sagittis enim sed tellus. Aliquam dolor. Nullam accumsan. Ut lectus libero, pharetra nec, mattis quis, eleifend vehicula, nunc. Praesent velit nisl, pharetra ut, iaculis non, aliquet eget, enim. Fusce et nisl. Ut viverra sollicitudin urna. Nullam eros lacus, pharetra et, varius ut, vehicula id, nulla. Donec sit amet tellus. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.",

"Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed non leo aliquet felis eleifend porttitor. Proin ut metus non mi feugiat pretium. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer malesuada mauris. Sed in lorem. Fusce non turpis. Ut tincidunt. Curabitur sit amet erat id risus ornare faucibus. Fusce consectetuer hendrerit eros. Vestibulum convallis libero ac turpis. Aliquam rhoncus pretium purus. Pellentesque molestie augue a lacus. Nam auctor libero eu eros. Suspendisse potenti. Duis ut tellus vehicula mauris blandit placerat. Nam rhoncus, dui in dictum molestie, urna dolor consequat ipsum, at semper lacus ligula tincidunt lacus. In orci lectus, ultrices in, tristique quis, adipiscing at, urna.",

"Morbi sapien sapien, vulputate eu, malesuada posuere, euismod ac, lorem. Aenean varius, risus ac fringilla commodo, felis mauris imperdiet est, ac auctor est leo in lacus. Proin viverra, quam ut vehicula viverra, diam elit viverra mauris, eu dignissim neque ipsum eleifend est. Duis non nisl sit amet mauris adipiscing placerat. Aenean tellus magna, rutrum a, pretium a, imperdiet a, purus. In ipsum. Aenean nisi diam, ultrices tempor, molestie ut, suscipit at, dolor. Ut metus eros, suscipit vel, pellentesque nec, imperdiet sit amet, sapien. Praesent porttitor aliquet erat. Nam venenatis nunc a orci. Morbi vel lectus et nibh pretium luctus. Etiam ultrices mollis urna. Praesent quis mi id lectus mattis aliquam.",

"Duis quis augue ac lectus dictum faucibus. Aliquam lacinia aliquet nunc. In hac habitasse platea dictumst. Phasellus vel ante a lorem dignissim posuere. Morbi mollis nunc auctor augue. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam erat volutpat. Cras quam augue, dictum vitae, scelerisque eget, hendrerit in, quam. Sed faucibus nunc in sapien. Ut ipsum ante, lacinia a, vestibulum ut, dignissim a, tortor. Ut in magna. Proin ante. Nulla facilisi. Nulla volutpat porta odio. Donec mollis porttitor nisi. Nam imperdiet luctus magna. Praesent est leo, fermentum dapibus, ullamcorper ut, volutpat at, risus. Integer porttitor euismod turpis. Nam sit amet magna eget tellus rutrum condimentum. Suspendisse tristique auctor leo.",

"Sed sed lectus ac risus vehicula ullamcorper. Suspendisse potenti. Donec adipiscing iaculis turpis. Curabitur dictum auctor elit. Maecenas in nisl at mi sagittis dignissim. Duis et odio. Morbi ornare dolor a quam. Mauris in justo. Vivamus a augue. Ut hendrerit urna quis urna. Duis eros augue, tempus non, consequat eu, ullamcorper quis, purus. Aliquam erat volutpat. Sed ultrices vulputate diam.",

"Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nunc semper, turpis ac tristique commodo, nibh velit ullamcorper sem, at lacinia mi odio vitae orci. Nam posuere. Vivamus arcu quam, viverra quis, tempus ac, vestibulum quis, mauris. Suspendisse ullamcorper convallis justo. Nullam cursus, lectus in fringilla laoreet, pede nulla gravida lorem, id mollis leo tellus quis tellus. Phasellus pulvinar, dui vitae volutpat ultricies, felis justo pellentesque augue, vitae pretium lorem turpis vitae sapien. Morbi vel pede. Integer non leo. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Phasellus sapien libero, ornare ac, venenatis sit amet, commodo in, nunc. Curabitur pretium diam quis nisl. Pellentesque vehicula augue et arcu. Proin est eros, euismod vel, mattis quis, condimentum in, tellus. Nulla a felis sit amet ipsum malesuada vehicula. Vestibulum sit amet massa in magna facilisis gravida. Quisque vel nisi malesuada dolor facilisis bibendum. Ut lobortis porta lorem. Sed ultrices mattis neque.",

"Mauris vehicula libero non diam. Proin quis eros et purus consequat commodo. Vivamus a sapien. Phasellus sagittis metus vel purus. Nunc congue sem in pede. Suspendisse potenti. Maecenas aliquet, erat et vulputate adipiscing, metus leo luctus risus, ut feugiat dui mi nec magna. Nunc tristique eros non leo. Duis nibh. Curabitur nibh orci, imperdiet nec, aliquam quis, interdum quis, est. Aliquam lorem ligula, vestibulum a, lobortis ac, accumsan at, lectus. Fusce sed lorem in turpis scelerisque dapibus. Nullam dictum est posuere arcu vestibulum egestas.",

"Maecenas ut lacus. Donec ultricies odio at dolor. Donec neque. Donec vel magna. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam sodales metus non purus. Nulla egestas aliquet pede. Ut massa elit, lacinia vel, luctus eget, blandit in, tortor. Etiam varius. Fusce lacinia tristique nunc. Nullam eget turpis vel urna adipiscing egestas. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Pellentesque ligula nulla, placerat sed, porttitor sollicitudin, vulputate sit amet, tortor. Nullam sodales interdum augue. Nam lacinia augue nec quam."
],

unorderedlist: [

"<ul><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Nulla tincidunt auctor massa.</li><li>Nunc egestas rhoncus pede.</li><li>Nam varius pellentesque ligula.</li><li>Praesent sit amet nisl sed arcu convallis consectetuer.</li><li>Maecenas lobortis gravida odio.</li><li>Morbi auctor vehicula nisl.</li></ul>",

"<ul><li>Nam consequat justo sed elit.</li><li>Sed ultrices porta pede.</li><li>Etiam congue sagittis libero.</li><li>Nam vel nisl sit amet lorem varius ultrices.</li><li>Donec adipiscing tincidunt odio.</li></ul>",

"<ul><li>Sed ornare tempor nisi.</li><li>Proin porttitor justo ut elit.</li><li>Praesent auctor risus condimentum nisl.</li><li>Vestibulum rhoncus diam a arcu.</li><li>Quisque semper laoreet nibh.</li><li>Phasellus at magna at nunc interdum euismod.</li><li>Vivamus elementum sapien vel felis.</li><li>Vivamus sodales enim ac nulla.</li></ul>",

"<ul><li>Duis scelerisque vehicula mi.</li><li>Cras cursus dui eu justo.</li><li>Curabitur sed elit a velit commodo blandit.</li><li>Morbi varius elit id neque.</li><li>Sed ut velit adipiscing augue rutrum pulvinar.</li><li>Maecenas blandit egestas nulla.</li><li>Aenean sit amet lacus vel risus rhoncus scelerisque.</li></ul>",

"<ul><li>In ut purus quis leo mattis vestibulum.</li><li>Cras a lorem a risus euismod eleifend.</li><li>Aenean aliquet leo sed ipsum.</li><li>Fusce posuere porttitor leo.</li><li>Integer ornare tellus eu erat.</li><li>Cras elementum risus scelerisque velit.</li></ul>",

"<ul><li>Duis adipiscing mauris a justo.</li><li>In lacinia sodales orci.</li><li>Nullam molestie lectus id nisi.</li><li>Morbi vulputate turpis at risus adipiscing mattis.</li><li>Duis posuere eros vitae nunc.</li><li>Nullam at lorem ut purus tincidunt viverra.</li><li>Morbi vestibulum tellus ut dolor.</li></ul>",

"<ul><li>Aliquam gravida sollicitudin ligula.</li><li>Curabitur elementum ornare turpis.</li><li>Donec a dolor nec mauris ornare tempor.</li><li>Curabitur auctor est eget dolor.</li><li>Nulla convallis lacus nec augue.</li><li>Aliquam ultrices ligula id ligula.</li></ul>",

"<ul><li>Vivamus feugiat dui sed tellus.</li><li>Donec nec lacus non sapien ullamcorper faucibus.</li><li>Nunc laoreet lacinia purus.</li></ul>",

"<ul><li>Sed eget lorem nec risus accumsan sagittis.</li><li>Duis viverra venenatis quam.</li><li>Duis ultricies pretium elit.</li><li>Nulla volutpat volutpat elit.</li></ul>",

"<ul><li>Morbi ultricies bibendum libero.</li><li>Etiam eget sapien eget ipsum lobortis consequat.</li><li>Ut a sem vel erat varius adipiscing.</li><li>Vivamus vulputate urna eget massa.</li><li>Pellentesque ut dolor sed est porta porttitor.</li><li>Donec bibendum scelerisque arcu.</li><li>Proin sit amet lectus id quam gravida pretium.</li></ul>"

],

orderedlist: [

"<ol><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Nulla tincidunt auctor massa.</li><li>Nunc egestas rhoncus pede.</li><li>Nam varius pellentesque ligula.</li><li>Praesent sit amet nisl sed arcu convallis consectetuer.</li><li>Maecenas lobortis gravida odio.</li><li>Morbi auctor vehicula nisl.</li></ol>",

"<ol><li>Nam consequat justo sed elit.</li><li>Sed ultrices porta pede.</li><li>Etiam congue sagittis libero.</li><li>Nam vel nisl sit amet lorem varius ultrices.</li><li>Donec adipiscing tincidunt odio.</li></ol>",

"<ol><li>Sed ornare tempor nisi.</li><li>Proin porttitor justo ut elit.</li><li>Praesent auctor risus condimentum nisl.</li><li>Vestibulum rhoncus diam a arcu.</li><li>Quisque semper laoreet nibh.</li><li>Phasellus at magna at nunc interdum euismod.</li><li>Vivamus elementum sapien vel felis.</li><li>Vivamus sodales enim ac nulla.</li></ol>",

"<ol><li>Duis scelerisque vehicula mi.</li><li>Cras cursus dui eu justo.</li><li>Curabitur sed elit a velit commodo blandit.</li><li>Morbi varius elit id neque.</li><li>Sed ut velit adipiscing augue rutrum pulvinar.</li><li>Maecenas blandit egestas nulla.</li><li>Aenean sit amet lacus vel risus rhoncus scelerisque.</li></ol>",

"<ol><li>In ut purus quis leo mattis vestibulum.</li><li>Cras a lorem a risus euismod eleifend.</li><li>Aenean aliquet leo sed ipsum.</li><li>Fusce posuere porttitor leo.</li><li>Integer ornare tellus eu erat.</li><li>Cras elementum risus scelerisque velit.</li></ol>",

"<ol><li>Duis adipiscing mauris a justo.</li><li>In lacinia sodales orci.</li><li>Nullam molestie lectus id nisi.</li><li>Morbi vulputate turpis at risus adipiscing mattis.</li><li>Duis posuere eros vitae nunc.</li><li>Nullam at lorem ut purus tincidunt viverra.</li><li>Morbi vestibulum tellus ut dolor.</li></ol>",

"<ol><li>Aliquam gravida sollicitudin ligula.</li><li>Curabitur elementum ornare turpis.</li><li>Donec a dolor nec mauris ornare tempor.</li><li>Curabitur auctor est eget dolor.</li><li>Nulla convallis lacus nec augue.</li><li>Aliquam ultrices ligula id ligula.</li></ol>",

"<ol><li>Vivamus feugiat dui sed tellus.</li><li>Donec nec lacus non sapien ullamcorper faucibus.</li><li>Nunc laoreet lacinia purus.</li></ol>",

"<ol><li>Sed eget lorem nec risus accumsan sagittis.</li><li>Duis viverra venenatis quam.</li><li>Duis ultricies pretium elit.</li><li>Nulla volutpat volutpat elit.</li></ol>",

"<ol><li>Morbi ultricies bibendum libero.</li><li>Etiam eget sapien eget ipsum lobortis consequat.</li><li>Ut a sem vel erat varius adipiscing.</li><li>Vivamus vulputate urna eget massa.</li><li>Pellentesque ut dolor sed est porta porttitor.</li><li>Donec bibendum scelerisque arcu.</li><li>Proin sit amet lectus id quam gravida pretium.</li></ol>"

],

head: [
"Lorem ipsum dolor",

"Quisque pellentesque",

"Nam mattis",

"Cum sociis natoque",

"Morbi sapien sapien",

"Duis quis",

"Sed sed lectus ac risus vehicula ullamcorper",

"Class aptent taciti sociosqu",

"Mauris vehicula libero non diam",

"Maecenas ut lacus"
],

init: function () {

document.getElementsByTagName("head")[0].innerHTML = document.getElementsByTagName("head")[0].innerHTML +
"<style type='text/css'>" +
"#stretchy { position: fixed; background-color: white; border: 1px solid black; left: 0px; top: 0px; color: black; z-index: 2; padding: 4px; }" +
"#stretchy a { color: black; text-decoration: none; }" +
"#stretchy a:hover {text-decoration: underline;}" +
"</style>";

document.body.innerHTML = document.body.innerHTML + "<div id="stretchy"><a href='#' onclick='return stretch.getHeading();'>Heading</a> | <a href='#' onclick='return stretch.getText();'>Paragraph</a> | <a href='#' onclick='return stretch.getOrderedList();'>Ordered List</a> | <a href='#' onclick='return stretch.getUnorderedList();'>Unordered List</a> | <a href='#' onclick='return stretch.clear();'>Clear</a></div>";
},

clear: function () {
document.getElementById("stretchme").innerHTML = "";
},

randomContent: function (contentArray) {

var i = Math.floor(Math.random() * contentArray.length);

return contentArray[i];
},

getHeading: function () {

document.getElementById("stretchme").innerHTML = document.getElementById("stretchme").innerHTML + "<h" + stretch.blocks + ">" + this.randomContent(stretch.head) + "</h" + stretch.blocks + ">";

stretch.blocks = stretch.blocks + 1;

if (stretch.blocks > 6) {
stretch.blocks = 1;
}

return false;
},

getText: function () {

document.getElementById("stretchme").innerHTML = document.getElementById("stretchme").innerHTML + "<p>" + this.randomContent(stretch.text) + "</p>";

return false;
},

getUnorderedList: function () {
document.getElementById("stretchme").innerHTML = document.getElementById("stretchme").innerHTML + this.randomContent(stretch.unorderedlist);

return false;
},

getOrderedList: function () {
document.getElementById("stretchme").innerHTML = document.getElementById("stretchme").innerHTML + this.randomContent(stretch.orderedlist);

return false;
}

};

stretch.init();

Finally Some Cartoons

September 25th, 2008

I’ve been really disappointed by the lack of cartoons on the online video sites I’ve seen so far.  Earlier in the week I was delighted to find Kewl Cartoons, an offering from DIC Entertainment.  My personal favorite is Inspector Gadget.  Kewl Cartoons’ player doesn’t have a full screen mode which really sucks, it has a mode that makes the player a little bigger.  This mode fit pretty good in my low-def tv screen and video card running at 800×600.  All of you closeted “Hey Vern, It’s Ernest!” fans now have a place to hang your head in shame.

cbs.com - More Bad TV

September 24th, 2008

I’ve been watching some shows on CBS’s video site. Their selection is a limited however they do have some odd balls such as the hilarious Beauty and the Beast tv series.

iPhone 2.1 Hacking - Getting Started

September 21st, 2008

The iPhone 2.1 hacking series is going to focus on cracking open the iPhone and using it to learn programming, UNIX and networking.  To write this article I’m using a first generation iPhone with a fresh install of the 2.1 firmware and a MacBook Pro.

Jailbreaking 2.1

I’m assuming you already have an iPhone with the 2.1 firmware installed.  If you haven’t upgraded to 2.1 you can do so by following these instructions on Apple’s website. 

Now that we are all up to date with 2.1 we need to jailbreak our iPhones.  I used the iPhone Dev Team’s PwnageTool for 2.1 Firmware.  After you start PwnageTool you are presented with a couple of options Simple mode, Export mode and the type of device you have.

I can’t ever resist Expert mode.  The next screen will search your system for firmware bundles and give you a list to choose from. 

The next pane gives you a list of areas that you can customize. Select General Settings and click next.

Under General Settings I unchecked Active the phone and Enable baseband update.  These settings are for unlocking the phone to use non AT&T sim cards.  I like to bump up the root partition to 2GB to give some breathing room for the OS.

The next screen is Bootneuter settings.  Bootneuter is also for non AT&T sim cards.  I unchecked the Neuter bootloader box on this screen.

The next screen allows you to install Cydia apps.  I decided to install MobileTerminal, Bourne-Again SHell, Cydia Installer and OpenSSH.  We will install more applications with Cydia later.

The next page is Custom packages settings.  I choose to install Cydia and Installer.app.

The next screen is where you can set a custom logo.  I’ve never been able to get this to work without changing the default logos in the PwnageTool.app package itself.

The next screen takes you back to the main menu.  At this point you should be ready to select  build then click on the next button.

The next step asks where you want to save your custom firmware, I saved mine to the desktop.  After that PwnageTool starts creating a custom IPSW file.  At some point it will ask you for your system password.

After the IPSW (iPhone/iPod Firmware Update File) file has been created you will be asked if your phone has been Pwned before.  I said no because I have fresh 2.1 firmware.

Next you will need to enter DFU (Device Firmware Update) mode.  Follow the instructions on screen.  The first time it took me a couple of tries.

Now you should be able to restore your phone with the hacked IPSW.  To use a custom IPSW in iTunes option-click the Restore button in itunes.  It should open a dialog to let you chose your hacked IPSW file.  After a few minutes iTunes will show a prompt stating that the iPhone has been restored to factory settings and is restarting.  After the restart iTunes will direct you to a “Set Up Your iPhone” page.  Here you will choose “Setup as a new iPhone”.  The first sync will bring back all of your settings and AppStore apps.

Installing UNIX, Developer and Networking Tools

At this point you should have a fully functional jailbroken iPhone.  The first order of business is to check out Cydia and install some additional goodies.  When you start Cydia for the first time it gives you three different modes.  Choose the “developer” mode.  This will give you unfiltered access to all of Cydia’s packages.  There are usually some updates to run, you can go to the Changes tab to upgrade any out of date applications.

Next lets install some applications from Cydia.  Before you get started go to the Settings application, under General turn off auto-lock.  If your phone locks during a software install the install may be terminated prematurely. Here is the list of apps I like to install  to UNIX up and get some development tools.  Some of these seem to come installed by default.

Administration

  • adv-cmds
  • Darwin Tools
  • lsof
  • shell-cmds
  • Sudo
  • system-cmds
  • top

Archiving

Data Storage

Development

Networking

Packaging

Security

System

  • ARM Floating Point
  • Base Structure
  • gettext

Terminal Support

  • MobileTerminal

Text Editors

Utilities

Securing Your iPhone

Despite all of Apple’s efforts to secure the iPhone there are some horrifying insecurities.  They are breezed over by the idea that no one should be getting into the guts of the iPhone or logging into it’s UNIX system.  The biggie that we need to take care of right away is changing the passwords for the root and mobile users.  Every iPhone has the same passwords for these two users, alpine.  Now that we’ve installed the networking services OpenSSH and vsftpd we’ve given people a way into our systems, via FTP or SSH a malicious hacker could login and steal or delete your data if they knew your password.  Now they do, alpine.

On iPhone and all other UNIX systems you can change your password with the passwd command.  Go to MobileTerminal, you will automatically be logged in as the mobile user.  At the prompt type passwd and hit return.

You will have to type the old password, alpine, and your new password twice.

Now we need to change the root user’s password.  To change the password for the root user type su and hit enter.  You will need to login again using alpine.  Now you can repeat the same steps as before using the passwd command.  This time you don’t have to type the old password, just the new password.

Type exit to log out of the root account.

Controlling Services

Now that we’ve installed ssh and ftp and secured our accounts we can go one step further by enabling these services only when we want to use them.  To turn our services on and off we’re going to use the launchctl command.   To start vsftpd  on iPhone use the following command:

launchctl load /System/Library/LaunchDaemons/com.bigboss.vsftpd.Startup.plist 

To stop vsftpd on iPhone use the following command:

launchctl unload /System/Library/LaunchDaemons/com.bigboss.vsftpd.Startup.plist 

To start sshd  on iPhone use the following command:

launchctl load /Library/LaunchDaemons/com.openssh.sshd.plist

To stop sshd  on iPhone use the following command:

launchctl unload /Library/LaunchDaemons/com.openssh.sshd.plist

This is a lot to type in MobileTerminal using the little iPhone keyboard.  If sshd is running you can use ssh to to login from Terminal.  Connect to a wireless network on your iPhone and check your ip address.

After you get your ip open terminal and type the following command:

ssh root@192.168.0.4

You will be prompted about the authenticity of the host, say yes.  The RSA key fingerprint gets saved in ~/.ssh/known_hosts and you will be prompted every time your iPhone gets a new ip address.

You are now logged into your iPhone and can run shell commands remotely.  You can start or stop vsftpd or stop sshd from the command line remotely.  Take note that when you disable sshd remotely your login isn’t terminated.  After you exit your session you will not be able to log back in unless you enable sshd from MobileTerminal.

SideReel - More Online TV

July 24th, 2008

SideReel is an interesting online TV site, rather than being created by big content and hosting video like hulu.com and fancast.com, SideReel acts more as a wiki linking to episodes you can watch online. SideReel’s site proclaims that it was created to overcome the short comings of standard internet video searches and have a conduit to all of the scattered video providers on the net. The site is user maintained and includes links to video put out by big content and what looks like pirated content.

SideReel does make it easy to browse a wide variety of shows, I was very pleased by their selection of cartoons. The user experience leaves a little to be desired. I found their use of ajax interface elements confusing and tasteless. Many of the video players on linked sites were of poor quality, on one site none of the buttons worked. Also several of the videos had been removed.

All in all I applaud SideReel’s efforts. With some interface work and automated link verification tools they will have a grade A site.

Avoid Page Rank Dilution With .htaccess

July 19th, 2008

If your website is accessible with and without the www subdomain Google will see your site as two different sites. When your home page, http://mydomain.com/ and http://www.mydomain.com/, get indexed as two separate pages their page rank gets diluted because their content is duplicated.

For usability reasons you sill want people to be able to type in and use both domains. To get around this on Apache servers you can create a .htaccess file that redirects all traffic going to mydomain.com to www.mydomain.com. This script rewrites the domain and preserves the rest of the URL and should nearly transparent to the user. It uses a permanent 301 redirect which Google will recognize and reindex any links as www.mydomain.com.

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^mydomain.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301]

Nintendo Entertainment System ROMs for iPhone

June 30th, 2008

I’ve setup an Installer.app repository that downloads NES ROMs from popular ROM sites. The ROMs are installed in /var/mobile/Media/ROMs/NES , the iPhone NES emulator will be able to find the ROMs and they will show up in the list of games. Read the rest of this entry »