PlayStation 3 Web Browser Development Tips

It’s fairly common knowledge that the PlayStation 3′s web browser sucks. It does the job and can play YouTube, iPlayer and browse tons of sites. But the underlying engine is just awful for developers who want to use their existing code to make a PS3-compatible website.

The PlayStation 3 browser is pretty much undocumented online, so it’s almost impossible to find any tips. For example, do you know how to enable the JavaScript debugger? To which most people respond, “It has a debugger?!?!?!?!”

Here are some tips to ease your pains: Read more »

Uncategorized

Remote Uploading to Coppermine Gallery 1.5x with PHP

Through some reverse engineering of the Coppermine flash uploader, I built my own remote uploader for Coppermine that allows users to upload images from a different part of my website. I use bridging to authenticate my WordPress users with my Coppermine installation, so this is particularly useful for areas of my website where users want to add images without having to navigate to the gallery and then back to the page they were last on to add an image.

Essentially, the flash uploader sends a POST request to the upload.php file in your main gallery installation folder.

It sends the following variables:

  • user (base 64 of serialised user_id and password_hash)
  • album (album id)
  • process (1)
  • Filename (filename of uploaded image)
  • [standard multi-part image data]
In response, it sends a single line of plaintext like follows:

success0|albums/userpics/10002/thumb_IMAG0061.jpg

To generate the user variable, you need to make a php array with a user_id and pass_hash variable inside from your authenticated user.

Then serialise the object and run it through base64_encode.
For example, with my WordPress bridged copy of Coppermine, I get the user variable using:


global $current_user;
get_currentuserinfo();
$coppermine_user_var = base64_encode(serialize(array(“user_id” => $current_user->ID, “pass_hash” => $current_user->user_pass)));

Best solution to implementing this is to look at the setup_swf_upload.js file inside of the Coppermine js folder.

Uncategorized

Easy Integration of Google +1 into a WordPress Blog

Google Like +1 put their embedding code live today, allowing developers and script kiddies alike to add it into their very own websites and spread some of the Google +1 love.

To add it to your own website, add the following lines to your themes functions.php file:

wp_register_script('googleplus1', "http://apis.google.com/js/plusone.js");
wp_enqueue_script('googleplus1');

Then add the following to your single.php file to add it to the bottom of your articles. Make sure you put it somewhere sensible. You could even float it in a div if you fancy having it somewhere in particular.

<g:plusone></g:plusone>

See http://www.google.com/webmasters/+1/button/ for more details about how to customise the button.

Easy peasy! I’m sure ‘share bar’ plugins will be adding it to their list of sharing providers soon, so if you aren’t using a custom theme, best to wait for your plugin coders to update or drop them a line suggesting they implement +1.

Uncategorized

Using BlackMagic Intensity Pro with VLC

VLC doesn’t play it as easily as you would hope. It has to do with the frame rate setting, that has to be 59.940001 for some bizarre reason.

However, after setting that you will eventually get it working but with an input delay. This is because VLC caches video in memory briefly before displaying it. You can pull this right down though, however the sound messes up the lower you set the cache. I recommend a setting of 50ms, you barely notice at all while using whatever device you have hooked into your capture card.

I’ve included a playlist file for VLC that will automatically play the video stream (assuming it’s 720p and you’ve set your BlackMagic settings correctly – if BlackMagic Media Express works you’re set).

Play PS3 in VLC

Uncategorized

Password Hashing – How to make it not suck. A basic guide.

When you register for websites or online services, you have to set a password to enable yourself to login again in the future. Your username and password needs to be stored in a database so that when you ask to login, the server can verify your details are correct and allow you access.

Let’s look at the basic way of doing this (btw, the WRONG way) and then work our way up to how most websites (should) be storing your password.

(comic from XKCD.com) Read more »

Uncategorized

Using RDS (AWS MySQL) on an Elastic Beanstalk Java Tomcat server (with EC2 security permissions)

Initial-ism filled title. Nice.

I’ve been playing with Amazon Web Service’s Elastic Beanstalk service to host a web app I’ve been working on in Java. Everything worked fine until I integrated my MySQL library and was unable to connect to the database with an error message like so:

“The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.”

So, I hunted down the solution. But, I’m going to go over how you set up a connection to a MySQL database too (if you know your code and library is set up right, skip the first bit). Read more »

Uncategorized

CentOS How To: Running Apache and Lighttpd on port 80. At the same time. On the same server.

Introduction to the problem

Step back, going to be performing some web server magic before you. Port 80 is the default port for all websites, it’s what all websites use if you don’t define the port number. I found it particularly useful to use Apache and Lighttpd at the same time for my server optimisation. I originally had Lighttpd running on port 81, but loads of foolish web admins decide to block loads of port numbers making a large amount of my important visitors unable to access static content on my site (CSS and JS dead. Not pretty.)

If you know much about how servers work, you’ll know you can’t usually have two programs running on the same port number. Otherwise, how will both programs know what information is for them? Read more »

Uncategorized

WordPress How To: Default images to link to the file

My own website seems to handle this just fine, maybe it’s because I actually explore the options inside WordPress and it defaults to what I like.

However, when running a website for a large group of other people to mess around with, all their images link to an attachment page rather than the image itself (which causes havoc for shadowbox plugins etc.)

So, you can force the default link to be the file (or the attachment page… or even blank if you would like).

Goto the “secret WordPress options page” at http://www.example.com/wp-admin/options.php (obviously, replace example.com with your domain)

Find the option “image_default_link_type” and change as required:

  • leave it blank – no URL at all
  • file – Default to File URL eg. /wp-content/image.png
  • post – Default to Attachment Page URL eg. /?attachment=111

 

Uncategorized

WordPress How To: Disable the Admin Bar in WordPress 3.1

This may be helpful to those WordPress developers who want to keep their site as it was without the new admin bar arriving with WordPress 3.1 soon.

Simply use this code in your there’s function.php file or add it to a new file in the plugins folder and activate.
add_filter( 'show_admin_bar', '__return_false' );remove_action( 'personal_options', '_admin_bar_preferences' );

Uncategorized

PHP scanning for free Twitter usernames with auto-Tweet on success

I’ve had a pretty rubbish twitter name for a long time: cubehouseathome

It’s too long, stupid and annoying (much like how I get distracted and put small side-stories in brackets in blog posts).

So, I set up a small PHP script to scan for a selection of names I preferred. It is designed to run every few minutes and instantly DM me on Twitter with the good news (which coupled with using the latest live version of TweetDeck, meant if I was at my computer, was guaranteed to get the name).

Here is the code I used for checking if a name was free (how you then alert yourself is up to you). Read more »

Uncategorized