Archive for May, 2009

Google Docs as a Free and Easy CMS

Monday, May 18th, 2009

CMS

A CMS is a content management system. Basically, it holds all the revisions, deals with collaborators, and puts stuff into templates so it’s nice on the eye. Good CMS’s will allow you to edit WYSIWYG too. It is, however, a pain for me to go to the work of setting up Joomla, Pligg, or WordPress for something quick and simple. And I hate to pay for software. What do you do when nothing fits just right? Invent your own system.

Google Documents

When you think of the things a CMS can do, Google Docs immediately comes to mind. Revisions, collaboration, WYSIWYG editing, and even basic publishing. The “publishing” feature only give a black and white page with not much wiggle room to turn it into a real site, although. Then I had my idea. What if PHP was to grab the published document’s URL and extricate the content, and then echo it back as if the content was hard-coded in? Some thinking, a soda, and ten lines of PHP, it was done. The script retrieves the page and discards anything before the content and everything after it. This however, removes some of the styles Google Docs puts in. If you edit the raw html of the document as Google kindly allows, you can add tags that you can refer to in your own linked stylesheet. The Google Doc must be published to work.The script is as follows, and if free to use with the comments in place:

< ?php
$docID = "dfgpnkdc_37fn6v5tfh";
//published google docID (part of publish url)
$temp = file_get_contents("http://docs.google.com/View?docID=" . $docID);
//get the page contents of the "preview" url for the doc
$temp2 = explode('<div id="doc-contents">', $temp);
//separate into the upper non-text half and lower half
$temp3 = $temp2[1];
//discard upper half
$temp4 = explode(’<br clear=”all”/>’, $temp3);
//separate into all-text and non-text, again  

//don't remove this line:
echo "<!-- Google Docs CMS PHP script copyright 2009 theajblog.com, begin script generated text -->";

echo iconv ( "utf-8" , "ISO-8859-1//TRANSLIT" , $temp4[0] );
/* echo text converted utf-8 to iso-8859-1 - important. Apostrophes turn into A’s with tildes because of a character mismatch otherwise. Also, without //TRANSLIT, certain characters like a special closing quote will cause it to cut off the document there. */
?>

iPod Touch Jailbreak + YouTube Fix

Thursday, May 7th, 2009

I’m Back - Sort Of…

I’ve been very busy with other preoccupying tasks in my life. This post is only to help you with any iTouch YouTube issues and to help you not waste hours into early dawn searching through 3-year old dead links from dying forums. I am not technically “back.” Oh, and keep in mind I’m tired because it’s kinda late (in my time zone, not the blog’s) and my writing won’t be top notch. Finally, check out winintosh.com, a friend’s website who I helped get up and running and am basically a co-founder. More on that later?

Jailbreak

You’ve heard of it and maybe wanted to do it. For those that don’t know, it will also break YouTube with the error that it can’t connect. I searched the Internet and did some other things in an effort to fix it, which I describe below:

Attempt 1

I ssh’d into the Touch and overwrote some files with some functioning iPhone firmware. Oops! Plugged into iTunes, refuses to sync (and thinks it is now a bricked iPhone). Restored the overwritten files and on to next attempt.

Attempt 2

I ssh’d into the Touch and renamed Lockdown to Lockdownblah. Then I mozied around and tried YouTube, which didn’t work. Restarted and tried final attempt.

Attempt 3

I had installed OpenSSH and Terminal a while ago on my iPod. Open Terminal, ssh root@127.0.0.1, give it root and default password alpine and I’m in. Next,

cd Library
mv Lockdown Lockdown.old
exit

But here comes the important part. I held the power button in and slid the bar to shut down. I turned it back on, and it came into Recovery Mode which iTunes refused to dock with because it required a lock code. I can’t unlock it until I connect it to iTunes which I can’t do until I unlock it…Right… So, what’s there left to do? Fix it. SSH from my computer into the Touch (PuTTY, same settings as before) and issue these commands:

cd Library
mv Lockdown Lockdownold2
mv Lockdownold Lockdown
exit

I truly don’t know why after getting rid of Lockdown and then putting it back (the old one) it suddenly worked. Anyways, feel free to try this AFTER BACKING UP! Lol, don’t make the mistake of screwing it up out of warranty and having no backup.