Around the Web: The Art of Hyperlinking

Tech, rants No Comments »

I try to stay away from just posting someone else’s work, but Coding Horror has a good article on the art of hyperlinking we could all benefit from. I posted it because it’s a good reminder to keep links simple and intuitive, and because I really really really (really) hate SnapShots-styled links like this:

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Get the Thumbnail from a YouTube Video

Tech, rants No Comments »

I’ve spent the better part of the frustrating day trying to figure out the new YouTube APIs in relation to PHP. I have a project where I need to retrieve thumbnails from various YouTube videos, and I’ve been making it too hard (I’ve tried integrating the Zend Framework with PHP, Javascript, SimplePie RSS–which is a good tool, it turns out, and all sorts of DOM-reading PHP plugins).

It turns out, the easiest way to retrieve the standard thumbnail for a YouTube video is:

http://img.youtube.com/vi/VIDEO_ID/2.jpg

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Connect to your iPhone with Coda

Tech No Comments »

Coda is a lot of great things, including a nice SSH FTP tool. If you’ve got Coda, you know about it’s cool site selection interface. Why not add an icon for your iPhone? If you’ve got SSH installed on your iPhone, you can easily connect with Coda and copy files to / from your phone. I’ve used it to install NES Roms, ringtones, and graphics. The setup below is pretty generic, and my local directory is a “phonedmg” folder created under my user account, per some of the original iPhone hacking tutorials. You’ll need to know your exact IP address and root password but if you’ve gotten as far as installing SSH you probably know how to do that. Leave a comment if you need help:

Here’s an icon I used for the Sites page in Coda…

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Bypass iPhone Activation (Current AT&T Customers)

Tech No Comments »

This won’t apply to everyone, so I’ll begin by saying there are a lot of guides out there to help you “jailbreak” your iPhone to get it to do all sorts of cool things. If you need your iPhone to work on a network other than AT&T, this post probably isn’t for you.

I had a phone on a corporate account with AT&T, and found out that the iPhone wouldn’t transfer to the account–I would have to buy new service. No thanks. This modification is fairly harmless, there are no hardware mods necessary, and if it messes up you can probably do a software restore through iTunes and be just fine. Follow the steps in this tutorial (there are 18 in all) and you’re likely to be on your way (PS you’ll need an Intel Mac for this to work).

http://www.hacktheiphone.com/iphone_using_cingular_for_intel_mac_easy.html

Those instructions start on step 11… but there is a link to steps 1-10, which are essentially steps to download the software you’ll need (it’s all free).

That should be it. Hopefully you have an iPhone using your old AT&T/Cingular SIM. If not, read on…

I didn’t initially have success with the hack, but got it figured out. They’re actually very clear instructions, but as with any technology there are variables to everyones’ situations. Here are some things that got me through:
1. It’s ok if you have the latest version of iPhone’s software (1.0.2 at the time of this post). I didn’t think it was and spent hours trying to install 1.0.1 but I found out it works fine with 1.0.2.

2. Take the iPhone SIM out and replace it with the SIM from your old phone. There is a 16-digit ICCID number on you SIM you’ll need. Write it down before you put it into the iPhone. I went through all the steps and missed that one at first–bad move. I had to start all over.

3. If everything works good until step 17, and you get a “bus error” you may have to restore the iPod and start over from the beginning. “Bus error” usually indicates it had trouble copying a file, so use iActivator (I used version 1.1.4) to put the PEM file to your iPhone. That seemed to get around the bus error. Then hit the button that let’s you activate your phone–and your iPhone should give you that *ding* and an activation message you’ve been patiently waiting for.

4. Don’t forget to copy the Services.plist file on step 18. A lot of people forget this step because they’re so excited to see the “iPhone Activated” message and iTunes thinks your iPod only has a few hundred MBs of freespace left.

5. Final caveat: The iPhone won’t work on EDGE networks Update: It does work on the EDGE network, and surprisingly faster than I anticipated (works great on WiFi too), YouTube content won’t play (update: works now, see script at www.hacktheiphone.com), and I’m having trouble with email Update: I can get POP email fine, I’m having trouble setting up my Gmail account. SMS and everything else seem to be working just fine. This setup is just a crutch for me until Apple / AT&T decide to take care of their corporate customers. I can’t believe that wouldn’t be a priority, but they’ll get to it eventually. I’d rather have a slightly crippled iPhone than my ancient 2006-era RAZR anyway, so I’m fine for now…

Update (9/14/07): New hacks for the iPhone appear daily. Now that a software unlock is stable and freely downloadable (search for iUnlock), the steps to activate your phone are going to be a lot more simple. I think it’ll be possible to get visual voicemail working, too, we’ll just have to wait for them to do it.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Parallels vs. VMWare Fusion

Tech No Comments »

The short: Fusion delivers, Parallels chugs.

The long:

In a perfect world, websites and technologies would work the same on every platform. This world is far from perfect, as are the standards by which we interact with technology. As a developer, you need to be able to test your products on various systems–and that’s where a nice Intel Mac comes in quite handy.

Most of us don’t have access to a Mac, a PC, and a Unix box–it’s usually one of the three. Enter virtualization software, which allows you to run multiple operating systems on one machine. Two of the better software packages for this are Parallels Desktop and a new release of VMWare’s Fusion. I’ve been using Parallels for a while now, and while it does what I need (I test my pages on IE 6 & IE 7), it’s a huge memory hog and doesn’t really accommodate my multi-tasking disease. (I typically keep 6-10 programs open at once.) With Parallels it’s a risky venture running it along side much of anything. Even with 2GB of RAM my iMac gets sluggish–and even after I close Parallels it doesn’t fully recover until I reboot.

I’ve recently installed Fusion, and so far it blows away Parallels. I’m able to run everything I need along side it, and it’s “Unity” feature lets me run a Windows program right along side my Mac program as if it were literally running from OS 10. Here’s a screenshot of iTunes for Mac (left) running along iTunes for Windows (right). Click for the full image:

iTunes Mac vs iTunes Windows (via Fusion)

Parallels has a feature called “Coherence” that does the same thing–but it’s never been as smooth or seamless for me as Fusion. I took it another step further and downloaded one of the many available pre-built systems you can install from VMWare’s Appliance page. Just for fun I downloaded a LAMP-ready Ubuntu install and had Ubuntu running alongside Windows XP and Mac OS X. Here are three versions of the same website being run on three different OS’s (left to right: Ubuntu, OS X, and Windows XP) from one machine (click for larger):

The bottom line: With Fusion’s ease-of-use, relatively low memory overhead, and ability to quickly install pre-built operating systems, you’ve got no more excuses not to be developing on a Mac. Period. Pony up the extra money and dine on steak instead of that McDonald’s burger you’ve been languishing in for too long now.
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Facebook Code Leak

General, Tech No Comments »

On the 10th or 11th of August, a portion of Facebook’s PHP code was accidentally leaked. Facebook made an comment on a blog reporting the story that pointed to a problem with mod_php displaying their index page as plain-text.

“Some of Facebook’s source code was exposed to a small number of users due to a bug on a single server that was misconfigured and then fixed immediately. It was not a security breach and did not compromise user data in any way. The reprinting of this code violates several laws and we ask that people not distribute it further.�

As a developer, I have two equal but opposite thoughts. 1. I would hate for my code to leak and give away any hints as to the security or well-being of my sites. But, 2., since I develop alone, it’s always great for me to see how other developers go about writing code and developing their sites.

I have seen the code, and there’s nothing earth-shattering in there that should give the guys at Facebook much to worry about. They may have to change some directory structures, but the code uses so many includes and external functions that it’ll be very difficult for anyone to do anything too nefarious with it. Since I wouldn’t want people passing my code around, I’m not linking directly to it here. You can find it pretty easily without my help anyway.

Nik Cubrilovic has some good methods on trying to fix these kind of leaks, and I’ll be implementing them ASAP on my servers.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Symbolic Links for Development and Production Servers

Tech No Comments »

I use a config file for most of my PHP projects–and it’s filled with variable declarations and constants I need throughout the site. I have to reference the config file in almost every one of my files for my site, and it might look something like

include_once('Library/WebServer/Documents/Gorilla/includes/config.inc');

The problem is, if I’m developing on one machine and uploading to another, the chances are the path will be different, like

/var/www/gorilla/includes/config.inc

So, instead of doing a global file/replace on every one of my files, or writing some weird “decider script” that used a $_SERVER variable to point to the right config file, I’m using the unix command “ln.” It’ll work for the Mac and other Linux flavors, and it’s saved me a ton of headaches.

ln -s /Library/WebServer/Documents/Gorilla /var/www/gorilla

The ln is “make links,” and the “-s” creates a symbolic link that allows you to reference the first link through the second. Make sure you have at least the base directory already (in this case “var”.) Now when you upload to your production server you won’t have to change hard-coded links to match your system. Just reference the production link, like

include_once('/var/www/gorilla/includes/config.inc')

and your development server uses the symbolic link to access your development file at /Library/WebServer/Documents/Gorilla/includes/config.inc.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Lightbox Bug Tracking with Wufoo

Tech No Comments »

First, a plug for Wufoo–it’s an excellent web-app from the guys at Particletree, and it enables just about everyone to make really slick forms. Now, on to the good stuff: I’m always looking for an unobtrusive bug tracker for my development projects, and by combining a custom-form from Wufoo and lightbox techniques, I’ve got pretty useful one.

* To get started, head to Wufoo and sign up for one of their accounts.

* Build a form using their very easy-to-use interface, they even have an example bug-tracking form. You can specify how you want the form handled after the user submits it, mine is setup to email me.

* Wufoo has now created your form, and given you several options for integrating it into your own website. You’ll want the option that says “Full Page Form Code.� Take their code snippet (which is a copy of the Wufoo code used to create your form) and paste it into a new, blank HTML file. I’ve called this file “load_wufoo.html.� Whatever you call it, remember it, you’ll need to reference it in the next step.

* Now you want to create another file which will incorporate a few includes (our lightbox files and the ubiquitous prototype.js) and call our bug-tracking form (load_wufoo.html) into a lightbox (don’t worry, you can download these a bit later in the post.) I’m using code based off of Noah Winecoff’s work with lightbox and iframes. You might want to edit the lightbox.css and lightbox-iframe.js files and adjust your iframe size to match the length and width of your form you built with Wufoo.

That’s it, you’re ready. You can get fancy with the way you let your users call the bug-tracker, but mine is pretty simple, and you can try it here:

* Download prototype.js
* Download lightbox.css
* Download lightbox-frame.js
* Download bug_track.html (this is the file that will display your link for users to click)
* The only other file you’ll need is the load_wufoo.html you create at Wufoo.

* You can download my complete source here. Be sure to change the line in load_wufoo.html that sets the source of the iframe (src=”http://username.wufoo.com/forms/form-name/” mce_src=”http://username.wufoo.com/forms/form-name/” ). Remember, you’ll get this code from the Code Manager section of Wufoo under the “Full Page Form Codeâ€? link.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Working With the Double Post

Tech No Comments »

Lately, while developing sites, I’ve started to deal with a lot of form submissions, and I’m finding that it takes extra steps to prevent people from accidentally submitting a form twice. Double-posting (hitting the Submit button more than once, or refreshing a page where data has been processed) can lead to all sorts of bad problems. Imagine if PayPal had no mechanism in place to prevent a double post. When you win an auction and pay John Q. $500 for the latest smartphone, you don’t want to be able to refresh the page or hit submit again and pay him an additional $500 bucks. Most of the time, your browsers will give you a warning, much like:

I find those alerts more annoying and confusing than helpful, so I’d like to get rid of them completely. I’ve got a couple of HTML/PHP examples that demonstrate a typical form submission and a modified one that doesn’t show any POSTDATA messages.

You’ll probably want to use some more programming to further prevent double-posts, and I’ve developed a PHP class that may be useful to you. Check out the Post Block class and example here.

Apply BOTH techniques for a post-blocking double-whammy…

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in