SL8R.co.uk - Code Zone

Code, Code and Code

SL8R.co.uk - Code Zone header image 4

Entries from May 2008

CMS: Content Management System

March 31st, 2008 · No Comments

I recently talked about my Wordpress 2.5 RC1 - First Impressions and plan to upgrade this site very soon to Wordpress 2.5 so watch this space! Wordpress has some great plug-ins all of which (all the ones I have seen!) use PHP - so if you are interested in PHP development techniques then it is [...]

[Read more →]

Tags: Comment

J2ME: Get System Details

March 28th, 2008 · No Comments

I have been trying to find a way of obtaining the phone details using J2ME and I think this will do it:
System.getProperty(”microedition.platform”);
For Nokia Devices, the format is generally: “Nokia XXXX/x.yz”,
The original source for this tip is: http://www.forum.nokia.com/document/Forum_Nokia_Technical_Library/contents/FNTL/system_property_microedition.platform_values_for_S60_devices.htm
For Sony Ericsson the information is likely to be in the form: SonyEricssonK700i/R2L001
in an emulator the firmware version string [...]

[Read more →]

Tags: Code

PHP: Get PHP Information

March 27th, 2008 · No Comments

To get useful information relating to PHP - for example which version and libaries are installed you can use:

addthis_url = ‘http%3A%2F%2Fwww.sl8r.co.uk%2F2008%2F03%2F27%2Fphp-get-php-information%2F’;
addthis_title = ‘PHP%3A+Get+PHP+Information’;
addthis_pub = ”;

[Read more →]

Tags: Code

PHP: Web Service Feed Information

March 27th, 2008 · 1 Comment

Using a web service feed under REST is useful to obtain information that would otherwise be tricky to get.
For example, to get information out of Technorati (rankings etc) you could use:
$request = ‘http://api.technorati.com/bloginfo?key=[key]&url=’ . urlencode(’www.jasonslater.co.uk’) . ”;
$response = file_get_contents($request);
(remember to replace the url with your own and put your API key in the section [...]

[Read more →]

Tags: Code

J2ME: Launch a midlet from another midlet

March 25th, 2008 · 2 Comments

As part of the project Bluetooth Push Apps I need to be able to launch one midlet from another midlet. The idea here being that a midlet will be preloaded on a mobile phone and a smaller midlet pushed to it with the content. The pushed midlet upon running will call the handler to process [...]

[Read more →]

Tags: Analysis

J2ME: Image Types

March 25th, 2008 · 1 Comment

Page 9 of the “Mobile Information Device Profile, v.2.0″ document tells us that a MIDP 2.0 implementation “MUST support PNG image transparency” - anything else is optional.
Some observations from: http://developers.sun.com/mobility/midp/questions/imagetype/

 PNG was supported on the test platforms
No other format was supported
Resource names are case-sensitive
File sizes for different formats can vary from 9.1 KB (GIF) to 69.5 [...]

[Read more →]

Tags: Analysis

Java (Midlet): Obtain Content Types

March 25th, 2008 · No Comments

//import libraries
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.media.*;
//define class
public class myContentTypes extends MIDlet implements CommandListener
{
private Form myForm; // form to present info
public void startApp()
{
if (myForm == null)
{
// setup the form
myForm = new Form(”Obtain Content Types”);
Command exitCommand = new Command(”Exit”, Command.EXIT, 0);
myForm.addCommand(exitCommand);
myForm.setCommandListener(this);
// get the content types
String[] contentTypes = Manager.getSupportedContentTypes(null);
for (int i = 0; i < contentTypes.length; i++)
{
String[] protocols = [...]

[Read more →]

Tags: Code

Code Comments

March 18th, 2008 · No Comments

A recent topic of discussion has been comments in development code.
See the article at:
Software Code Commenting

addthis_url = ‘http%3A%2F%2Fwww.sl8r.co.uk%2F2008%2F03%2F18%2Fcode-comments%2F’;
addthis_title = ‘Code+Comments’;
addthis_pub = ”;

[Read more →]

Tags: Code

Java: Common mistakes for new programmers #1

March 17th, 2008 · No Comments

New Java programmers often make similar mistakes when they start out coding - I did it myself when I started out and I have seen many others do the same. One of the most common mistakes is to use a different name (or even a different case) for the Java Class itself and the filename. [...]

[Read more →]

Tags: Tip

ASP: Dynamic Style Sheets

March 14th, 2008 · No Comments

Many sites use static CSS (Cascading Style Sheets) but 4 Guys from Rolla have an interesting outline of how to dynamically create a CSS style sheet that could allow a user to change things like theme colours and fonts dynamically. This could be stored in a back-end database for persistence.
The idea behind this is to [...]

[Read more →]

Tags: Code