Category — Web Dev

Quick MovieWidget Update

For anyone that cares, I updated MovieWidget to support the latest Amazon searching features.

Not a big deal, but hey, that’s what I did last weekend.

Also, I’m in the process of adding MovieWidget to the Wordpress Plugin database for easy automatic update capabilities.  Then I’ll also be able to tell if anyone actually uses this thing!  :)

November 24, 2008   No Comments


Having PHP Problems With JSON and file_get_contents()?

Chances are your webhost doesn’t allow this type of access for security reasons.

If you are even remotely handy with PHP, there is a very simple fix:  Using CURL.

First, open the PHP file that is giving you the problem (make a backup of the original, just in case!).

Second, add this function to the file (make sure you do it outside of any other function definitions, and preferebly before you use it in the rest of the file…):


// function to replace file_get_contents()
function new_get_file_contents($url) {
$ch = curl_init();
$timeout = 10; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_ e x e c($ch); // take out the spaces of curl statement!!
curl_close($ch);
return $file_contents;

}

Then, search through your file for “file_get_contents” and then replace those words with “new_get_file_contents”. In a nutshell, you are replacing the original function that doesn’t work on your webhost (file_get_contents() ) with one that WILL work on your host (new_get_file_contents() ).

I usually leave a commented out copy the original line in the source, so that I can easily go back to the original if necessary.

So, for example:


$myVar = file_get_contents($url);

becomes:


// $myVar = file_get_contents($url);
$myVar = new_file_get_contents($url);

Pretty easy! I’m not sure that this will work in all situations, but I have yet to find a place where it doesn’t work. I was easily able to replace file_get_contents() with CURL in about 5 minutes in altPWA, an excellent Wordpress Plugin for adding Picasa photos and albums to your blog.

Nice and easy!

Technorati Tags , , , , ,

November 22, 2008   No Comments


More Picasa Wordpress Goodness

A while ago, I wrote an article on how to put a Picasa slideshow into Wordpress.  It helped some folks, so I’ll post more information here.

First of all, I should mention that while the original method still works, as of WP 2.6.2, the “normal” method of embedding Picasa slide shows into a web page seems to work just fine.  This involves getting the embed URL directly from Picasa and adding to the post.  A word to the wise though - you have to add the embed code in HTML mode in the editor.  If you do it in Visual mode, it doesn’t seem to work too well.  Oh well, its a small price to pay, and much easier than my original posted method.

For example if you copy this code from Picasa:

< embed type="application/x-shockwave-flash"
src="http://picasaweb.google.com/s/c/bin/slideshow.swf"
width="288" height="192" flashvars="host=picasaweb.google.com
&RGB=0x000000&feed=http%3A%2F%2F
picasaweb.google.com%2Fdata%2Ffeed%2Fapi
%2Fuser%2Fmilowerx%2Falbumid
%2F5053811777489218721%3Fkind%3Dphoto
%26alt%3Drss" pluginspage="http://www.macromedia.com
/go/getflashplayer">< / embed >

it becomes:

when it is in your post.  Nice!

Alternative Methods for a simple Slideshow

I’ve written a plugin to help folks with this task. Welcome Postcasa, a simple Wordpress plugin to add the slideshow directly from the album RSS feed. Its easy to use and works regardless of if you are in visual or HTML mode.

Other Fancy Picasa Plugins

That said, there are many Wordpress plugins that have been created that work well in their own right.  Most of them put album thumbnails directly into the post (instead of having one picture location that cycles through all the pictures).

Some of my favorite are:

  • kPicasa Gallery - this great plugin is extremely simple to use and has a lot of configuration options.  The one downside to the plugin is (supposedly) that the gallery must be by itself on a page (i.e. it can’t be inline, meaning resident on a page with other information).  A second downside is that the plugin only supports one Picasa username for the entire blog.  You ARE able to specify which albums go on a page, etc. but they must all be from the same Picasa login.   Darn…
  • KB Easy Picasa Web - this plugin is exactly as described.  Its easy.  All you have to do is put the hyperlink to an album in a post, and this plugin replaces the link with the album contents.  Very nice for certain situations.  The only problem is that it puts EVERYTHING in that one post, doesn’t paginate at all, and you can’t set the number of columns to use.  There are some formatting options, but they are fairly limited.  This is nice for someone who doesn’t need a lot of sophistication, and simply wants to “get to it” without having to add any shortcode to posts, etc.
  • GoldenGate - this plugin doesn’t allow you to add an entire album at a time, but it DOES do something that is very unique.  It adds all of your Picasa photos to the MediaLibrary portion of the Wordpress post editor in real time using Google APIs.  This is great for allowing you to store your photos on Picasa, but use them in posts in Wordpress.  Very slick.
  • Shashin - this is one of the members of the Picasa plugin Royal Family.  Its a great plugin and has a bit different behavior than many of the other plugins listed here.  It displays albums as well as the photos themselves as most do, but it also allows you zoom in on any picture using Highslide, which is free for non-commercial use.  The neat thing is that this zoom is in context of the page, not in a page covering popup viewer.
  • altPWA - One of my favorites, this plugin allows using albums from multiple users and also has a bunch of settings to allow you to make the galleries look the way you want them to.  There is one challenge though - it uses the PHP function file_get_contents(), which isn’t allowed by many web hosts.  Since it is made available under GPL, I’ve modified the code to use CURL instead, which is allowed by most hosts.  I’ve sent mail to the original author offering the changed code to him so that his great plugin will be accessible to more people.  Its a very nice piece of work!  A few feature requests: 1) allow a page that displays a number of album roots (i.e. NOT the actual photos, but the actual listing of available albums) to also allow a column display rather than just one after the other and 2) add more CSS around the photo thumbnails so that they can be more easily stylized.  Minor, minor stuff, but desirable in my opinion nonetheless.

As you can see, if you are a Picasa / Google Fanboy like my brother, there are lots of options for integrating your favorite image manager with Wordpress.  Life is good again.

Technorati Tags , ,

November 22, 2008   6 Comments


Hug A Developer

SNIFF.  If only this were a joke…

Technorati Tags , ,

September 12, 2008   No Comments


Google Chrome

I won’t take a bunch of time telling you what Google Chrome is about.  Rather, I’ll give you a quick bullet list of neat features and let you go out on your own and get the details.

  • Its fast.  VERY fast.
  • It has crash control - one tab won’t crash the whole thing.
  • Tabs can be ripped off to their own window or merged back into the bar.
  • Incognito mode - a “no record” type of web browsing, which is great for accessing sensitive or confidential information on shared resources (think web banking at work, web mail at a conference, accessing your company’s CRM system at one of those public PC’s at an airport, etc.)
  • Application shortcuts to make web apps feel more like desktop apps
  • A minimal interface so that the content is the focus, not the browser
  • and more.

Its still a beta version and has a few issues - for instance, while writing this post, the entire browser crashed, not just one tab.  So much for crash control! To be fair, it wasn’t my web app that crashed. It was the browser itself - so, crash control on tabs wasn’t supposed to solve that kind of thing.  Again, its a beta.  As such, it is very promising.

My overall feeling about it - WOW, is that fast.  Every page seems to load 20-50% faster anecdotally than anything in FF or IE, and the minimal interface is really nice (a bit similar to full screen tabbed browsing, but that’s OK).

I have a few concerns too:

  • How long will they actually continue developing it?
  • Spell checking doesn’t seem to be integrated yet - I LOVE integrated spell check in FF
  • There is no plug-in mechanism yet (AFAIK…)
  • Will this derail Google’s long time support of FF?  They did just renew their commitment to it, but is another browser really necessary?  I love FF and wish they would have simply worked with that initiative to improve FF to be everything that they wanted to achieve with Chrome.
  • Google has its own agenda (ad revenue), and sometimes things seem out of touch with that goal.  With FF as a non-affiliated browser, why the need for Chrome?  They give some answers, but none that ring true enough to warrant a separate branch from FF, in my opinion.  It makes me wonder what evil plans they have lurking in the wings.  To be certain, Google has long been the Jedi to Microsoft’s Sith, but (in my best Yoda voice) - “The Chosen One, Google may be. Still, too clouded its future is.”  Google has been trying to become a viable and complete computing platform, hoping to drive Microsoft out of its stranglehold on PC computing.  But, once it is successful, what evil things will it start to commit? Some would say the evil has already started…  To borrow a line from The Dark Knight - will they be the hero long enough to see themselves become the villain?

Only time will tell.

But, if they clean up a few of the gaps that currently exist as compared to FireFox, Chrome may actually be an extremely viable third option.  After all, its from Google.  They usually don’t make things that suck.

Technorati Tags , ,

September 2, 2008   No Comments


Fun Ajax Loaders

Ajax is all the rage for web development these days.  For some reason, it seems that an obligatory part of using Ajax is sporting a snappy little spinning dohickey that lets people know when stuff is happening.

Ajaxload is a neat little service where you can easily make your own animated Ajax load graphic with custom color designs.  Its free and quite easy to use.

My geekness approves.

Here’s an example:

Ajax Loader

Technorati Tags , ,

August 26, 2008   No Comments


IE HTML Element SPY

If you develop web pages, and are at all concerned about consistency between FireFox and IE, you must read this post!

I have used the Web Developer plugin for FireFox for quite some time.  It is a lifesaver when you are developing web pages, as you can easily see all of the styles and markup that is being applied to a specific area of your page.  The problem is that it only works in FireFox, leaving IE out in the cold.  Since IE is the real pain in the rear when it comes to Web Dev, the lack of a similar tool has been a major PITA.

Well, a two hour witch hunt for an IE only CSS bug lead me to scour the net for something to make the pain go away!  The fix?

IE HTML Element Spy, an IE7 Add-On.  I LOVE THIS TOOL!!!

It works a little differently than Web Developer, but it really gets the job done.  I litterally spent the last 2 hours trying to debug a DIV that wouldn’t line up with the top of a page.  It was completely impossible to find out why - the thing worked fine in FireFox, but not IE.  Installing IE HTML Element Spy lead me right to the problem - a burried IE only CSS rule that put a 30px padding at the top of the sidebar.

Voila!  Problem solved.

So, 2 hours and not a single clue using my own powers of debugging versus 2 minutes and a fix with IE HTML Element Spy.  Which would you prefer?!  Yeah, me too!

Download that puppy now!

Frackin’ IE.

Technorati Tags , ,

August 23, 2008   3 Comments