Sunday, December 05, 2010

Baps Delay

I was hitting a wall of bugs with my original version of the Baps app due to having to break requests in Bluetooth messages so I decided to re-write using streams (which is how data travels over regular network connections), which seemed like a really good idea but thanks to this 512 byte Nokia limitation/bug in JavaME it's going to take a bit longer to work around.

Monday, November 29, 2010

Bluetooth Access Point Service (Baps) Progress

Following on from this post I'm now adding new longer status updates as new posts.

The design of Baps has meant that the current implementation is mostly transparent and does not know about any of the underlying data being sent, contrasted with Hiisi which re-interpreted each http request. The benefit to my approach this is that there is less likely to be an error on my part in resending any type of data onwards, however the difficulty lies in that I still need to establish the destination addresses, ports and length from the data, but I don't have easy access to this information (technically I'm using raw sockets to send bytes rather than a http connection and APIs which could do this for me). This approach has led to delays such as working out content length resulting in "chunked" data and HTTP 1.0 data not being sent correctly (thankfully HTTP 1.0 is not too common and both have an easyish fix but I digress).

I've already started thinking about bluetooth drop out protection but this will be quite difficult to get right (the whole system needs to freeze immediately until the connection is re-established meaning existing requests and results are queued) or else the browser will not receive the results. For this reason it unlikely to be perfect or even in the first release.

Friday, November 12, 2010

Nokia 5230 and Internet over Bluetooth Software - "Baps"

Work has stopped until I have some significantly free time. HTTP errors and traffic timeouts are causing the main problems and will require a lot more than a few hours of an evening which my other projects take, especially to make it easy for Joe User to install and configure. This is the next project on my todo list but I have a lot of other pressing things I need to deal with over the next 6-8 months. Sorry.
Success! The proxy on both sides is very fast and very minimal. I'm now fixing transfer length issues (HTTP 1.0 support), need to add disconnection protection as well as a decent configuration UI, installer and do some code cleaning and QA. Multiple app connections are possible but data is sent via a single synchronous link to the Baps server (on Windows), i.e. both sides process multiple requests at the same time but data is ordered again for sending between the phone and PC.
End to end transmission is almost complete, I'm having some minor trouble with the data passed back to the phone (and displayed by the proxy on the phone during testing) actually being passed back to the calling app and numerous requests at once going out of sync but this is something I know how to fix :)
I can now send a single preformatted HTTP request from the phone to the PC and receive a response on the phone (admittedly the reponse is usually a HTTP 301 or 400 error probably caused by incorrect request packet formatting). This is taking longer than I anticipated especially as I have a busy weekend coming up and it is still very much proof of concept (no gui or configuration yet). I'm re-estimating *at least* another 2 weekends.

So I've purchased a Nokia 5230 which is a fine touch screen phone and has a built in GPS. The only problem is that it has no WIFI so all net access is charged at premium 3G rates even when I'm at home and have broadband.

I'm now working on a proxy along the lines of the Hiisi Suite and MiniBTProxy called "Baps" (Bluetooth Access Point Service) that will allow an Internet connection over Bluetooth for Nokia mobile phones using Microsoft Windows XP/Vista/7 with a broadband connection.

I've already implemented a simple proxy on Windows and will shortly be adding Bluetooth functionality to it courtesy of the Marge Bluetooth API.

The goals of this mini project are to:
  • Make it easy to install (installer and guide).
  • Proxy only HTTP (no secure HTTPS connections).
  • Support multiple connections (allowing many mobile apps to run at once - a problem for the existing Bluetooth proxies).
  • Provide seamless as possible connection restoring functionality in the event of Bluetooth dropout.

Optional long run goals are:
  • Improve mobile device compatibility.
  • Add Linux server support.
  • Improve performance.

As usual source code will also be made available on release sometime before or around the 21st of November.

Sunday, October 10, 2010

Not dead (at least not yet).

The blog has been a bit stagnant in recent weeks (I've added a new Mozilla Firefox Persona however!) simply because I've not had the time to do much programming or reviewing. Yeah I know the secret to a successful blog is to update update update but sometimes we all need a holiday.

So what's the plan? Well my work for the Christmas run is still to complete Vampire Castle (it's a cursed project that is draining my life blood).

More usefully I've received some new suggestions for Aerofoil to disable services on the fly (such as the Windows indexing service) so I'm also debating an update to Aerofoil.

I consider emulator writing to be the holy grail of becoming a great programmer so I've been paying a little attention to Imran Nazar's blog on how to write a Gameboy emulator in Javascript. In the long run this could mean I write emulators on many platforms, but I'm not getting ahead of myself yet, especially as I'm still waiting on Imran to document the remaining parts (such as sound) before I really dig in.

Tuesday, September 14, 2010

Opt out of PayPal Adchoice (UK - untested worldwide)

PalPal's new Novermber 1st policy updates includes marketing policy changes that are very difficult to opt out of.

The full back plot is below but in summary to opt out of Paypal marketing you need to visit the link below and use your Ebay account. Note this probably only works if you are in the UK and I've found no way of doing it with my Paypal account - please comment below if you do. For why it needs an Ebay account read the next section below (I'm assuming you're impatient like me and just want to opt out without faffing).

Back Plot:
Paypal's new policy (6 Marketing, Effective Date: Nov 01, 2010) states that to opt out of marketing:
simply indicate your preference by logging into your account and going to the Profile subtab under the My Account tab and adjusting your preferences under Account Information, or by following the directions provided with the communication or advertisement.
If you go to this section on your account you have a number of check boxes such as "Partner/ Third Party Promotions" but don't be misled - there are NONE FOR MARKETING. If you click the link under "Marketing Preferences" instead you'll be taken to an information page and the last expandable section contains instructions to opt out by clicking an about or adchoice links above adverts themselves!
One problem... as far as I can tell Paypal do not have adverts of this nature... Ebay DO! If you're lucky(?) enough to have an Ebay account go to their home page without the Adblock plugin enabled on your web browser and click through from the tiny Adchoice link above any advert. Once you have done this you need to choose the option that is NOT "for this browser" (i.e. the quick, don't want to read, opt out option), instead you will need to log in using your Ebay credentials(!) to opt out of their marketing!!!! Feel free to follow the instructions above but for your convenience/speed I linked the (UK only?) "Adchoice" page directly above.

I can only assume that because Ebay ties your Ebay account with the Paypal account this option affects both accounts (Paypal+Ebay) marketing preferences. If this is not that case or you find out how to do Paypal's drop me a comment.

Saturday, July 31, 2010

Vampire Castle Preview Minor Update

I've been working this weekend on Vampire Castle so I've updated the preview version available to download.

- Money now needed before play starts (press R button to add cash).
- Money is deducted.
- Fruit machines can now be completely wiped from memory to load another (but still only one machine available) - I love my fruit machine model component propagation :).
- A couple of wild pointers fixed.
- Bonus 4 stopper partially implemented (only climbs the trail).
- Copyrights updated.

Download (ROM image, needs Nintendo DS emulator or DS homebrew card and preferably rumble pack):
The Fruit Machine - Vampire Castle Preview NDS

Saturday, July 10, 2010

Three and ZTE F102 Saga: We ... haven’t altered any functionality for Skype

UPDATE: I wrote this application as a workaround. Three it seems are changing Skype on other phones on the Three network.

This is part 3, part 2 and part 1

Edited to remove account specific info.
I followed their instructions and it downloaded the "minimise background" version and lo and behold it still doesn't work. I'll now going to follow their official complaints procedure and if that doesn't rectify it take this one to small claims for the cost of two phones.

Hi Benjamin

I’m sorry to hear you’re having problems while using Skype on your phone.

I understand your concerns about this matter because after updating the Skype application, the minimize option doesn’t work. I note that the application shuts when you minimize it. We as a network provider haven’t removed or altered any functionality for Skype. However this change may be a part of the Skype update.

To resolve this, please redownload the Skype application by using these steps:

• on your phone, go to Planet 3
• select Services
• select Social Networks
• select Social Networking Apps
• choose Select Skype and click on the download link.

Once this is done the Skype application from the Planet 3 will replace the existing Skype application on your phone. This should resolve the problem related to minimizing of the application.

If not, then please call us and we can book the phone for a software reflash to remove any settings related issue.

I’m sure this information has helped. If you still have any problem, just call us and we’ll take care of the rest. You can tell us what you thought about how we handled this by doing a quick survey – call us on 02030 941503. We’d love to hear from you, and we’ll use your feedback to help improve the way we do things.

If you have any more questions, please call on either 333 (free) from any 3 mobile phone or 0843 373 3333 (national rate) from any other phone and we’ll be happy to help.

Kind regards

Seher Ahmed
3 Customer Services

Saturday, July 03, 2010

FreeKicker 1.0 Released

FreeKicker is a tiny free open source Java ME application to start Skype V4 from another phone.

You may need this application if you have friends who want to call you on your Java ME mobile (with Skype 4 installed) and it is currently not running, perhaps due to bugs or issues. Your friends just need to start FreeKicker and enter your phone number to "kick"* it. This will cause Skype on your phone to start, and if you have auto-login enabled in Skype, will connect you to the Skype network so they can call you.

* "Kick" simply refers to the act of sending Skype a text message to wake it up, as such the sender may incur a regular text message charge (unless they have free texts). See the included readme files for a more detailed explanation of how this app works.



This application works on most Java enabled mobile phones but can only start the Java (not Brew) version of Skype 4, typically that installed recently in a forced upgrade on the ZTE F102 on the Three mobile network.

Download FreeKicker 1.0 for JavaMe/J2ME phones.
Download GPL 2 JavaME source code for FreeKicker 1.0

Tuesday, June 29, 2010

Update on Skype on F102 3 phone exiting when minimised

In a break from the norm I'm posting my 3 correspondence on my blog to garner some attention, maybe you'll have some fun reading it but the real grit on what I've uncovered can also be found here on the Skype forum.

My email is probably overkill and hyperbole but I was quite incensed by finding the forced upgrade deliberately prevents incoming calls when Skype is in the background and when Three's customer service told me I needed a better phone to run Skype properly. So incensed in fact I wrote a program to workaround it. In any case if it goes further I'll be claiming for 2x£30 (two phones) in the small claims court, it all depends on Three's (possible lack of) response.

Dear Sir/Madam,

Re. Notification of potential legal action.

About a week ago I sent a support email requesting that 3 restore my original Skype functionality to my F102 mobile phone as since the update I cannot receive any incoming SKYPE calls as the Skype application exits when it goes into the background ("minimised").
I received a call from one of your customer service representatives telling me because my phone "was not multitasking" I needed to upgrade it to run Skype in the background (despite my pointing out it was working fine in prior to the Skype update). I have uncovered EVIDENCE to suggest 3 HAVE DELIBERATELY pushed out this change in the Skype application reducing its functionality and this is NOT TO DO WITH THE PHONE NOT "MULTITASKING" - THE SKYPE UPDATE LINK CLEARLY STATES IT WILL EXIT IN THE BACKGROUND:

I request that you restore the previous version of Skype application on my phone within 10 days or will consider legal recourse and potential group action to rectify this situation as clearly 3 are at fault and have been attempting to make me purchase a new phone to solve the problem 3/Skype have caused.

Please email or post your response to me as I require your responses in writing. Telephone calls from 3 will be unanswered.

Yours regrettably,

Benjamin Brown

Saturday, June 26, 2010

Skype on 3 telecom not receiving calls

This is Part 1 (my first email), Part 2 of this is here

I'm putting this out there to see how many other people are having a problem with the recent Skype update disconnecting when idle or not minimising meaning you can no longer receive incoming Skype calls. I sent this to support, lets see what I get back:

Dear Sir/Madam,

Since recently updating Skype on my ZTE F102 the application no longer remains connected in the background after I minimise it. The application also disconnects from Skype when it is idle. This now means I will no longer receive incoming *Skype* calls during this time. I notice your Support on the subject (under "Skype calls and chats") has Skype questions for "Making a call", "Sending a Skype Chat" and "Receiving a Skype Chat", but NONE for receiving Skype calls.

I politely request that you restore the original functionality of the Skype application for which I purchased my phone, by either a providing a new version or enabling me to revert Skype to an older revision.

Yours faithfully,

Benjamin Brown

Tuesday, June 08, 2010

Surfing the web Sinclair ZX Spectrum style

Recently I've integrated a Java proxy server and Image to ZX Spec to allow you to surf the web seeing every image as would be displayed on a ZX Spectrum.

Of course the youtube video being low resolution doesn't really help, but look at about 2 minutes in to see the difference when I disable the proxy.
I'll be releasing the proxy patches and a modified version of Image to ZX Spec that will allow you to do this with your own browser in a few days (fun for parties maybe?!!). If I get time I'll also add conversion of the font so the text on the pages even looks like that on a Spectrum.

If you came here looking for a real way of getting your old Spectrum on the net you should have a look at Spectranet.

Sunday, June 06, 2010

Chinavasion's Gold Bar 16GB USB Review

The honeymoon period:
Shortly after receiving my 16GB Chinavasion Gold Bar USB Stick the other week I went about immediately using and testing it and found it wasn't very reliable. Since Chinavasion refused to publish my review I'll provide the fully damning one here. Incidentally as of the time of writing, 6/6/10, and after my quick search of reviews Chinavasion don't appear to have many (any?) 2 star or less product reviews (I only saw 2x 3 star reviews, the majority are 5 star, with a few 4 stars).

The casing:

The casing, weight and feel is as good as it looks on Chinavasion, however the stick I received has a tiny chip on the top right corner (not very noticeable) and one of the reverse side screws was not gold coloured but regular grey and looked very out of place (the type and size was correct). I have been tempted to rip out another USB stick memory and use it inside this because of the next problem...

The electronics:
The memory stick appears to be a genuine 16GB, that's the good part. The bad part is that it appears to be Grade B lower quality RAM which has data failures. Initially my investigation required verifying the make of the controller chip to ensure it was the correct memory size, somewhat suspiciously the controller and RAM chips inside the USB stick seem to have extremely faded manufacturer and type details printed on them. This made it impossible to determine what the specific makes were.

The fix:
Starting up fake USB stick software and testing took me a better part of a day as there are literally a hundred different "Alcor" Chinese language low level format and controller modifying applications I eventually found one that was able to recognise the stick. The memory is marked as Generic and the type is an AU6981 (or 6986), although this information can be falsified. Initial analysis with an old version of ChipGenius and its old database initially identified it incorrectly as the 98xx series, through trial and error using a newer version and other programs eventually got the right result.
The version of AlcorMP tool you need if you have one of these USB sticks is available in a zip called (or AlcorMP_AU698X_091111.rar).

Running this tool with some modified settings* and checking the "Status" determined on one run I had 3 bad blocks (with default settings), another run told me 4099 bad blocks and corrected the available size down to 12.1GB. Actual hit and miss testing via USB disk partitioning on Linux had already determined I only had 12GB of reliable memory on the stick as anything above would become corrupted on retrieval (it appeared to write but would consistently fail to read or files vanish and a corrupted filesystem warning show if I used the full 16GB capacity).

The result:

So why didn't I send this back? Well because shipping it back to China after I had just waited 3 weeks to get it (cheap postage) meant another round trip of about 6 weeks and there was no guarantee that the replacement would not be even more defective. The relatively cheap cost of £23, or half a night out, was another factor in that it just wasn't worth the hassle. Basically I used the Alcor tool to mark the USB key's bad blocks and to only use the reliable 12.1GB and this seems to have worked.

* Follow this translated guide. Under the Flash Type tab use the following LLF Check: Natural Check, Scan Level: Full Scan4, Scan Mode: Low Level, RW Cycle Time 33ms (as far as I can tell the memory is rated at 25ms however the stick is faulty so better to be safe than sorry - my write speed is still a slow 3.3MB/s).

Wednesday, May 26, 2010

New Software Thoughts

I don't have much free time to spend on programming but when I do it's usually fixing or improving existing software. I'm at a point now where I can see the end of my current list of projects (Vampire Castle DS still to go) and have been thinking about some other new cool software to write.

Here's a few ideas:

Javais (Windows/Linux):
A virtual butler with a British accent. Ever wanted your own butler to notify you, tell you the time, start programs, do web searches or generally be a dumbed down Tony Stark Jarvis prototype? Voice recognition is obviously going to be a key factor.

Local on the 8s (Nintendo DS):
A Nintendo DS weather program that simulates the Weather Channel with some truly unique features that cannot be found in similar DS software (I'm keeping quiet about features in this one).

Squashie (Windows/Linux):
A drag and drop media converter to convert your flacs/oggs etc suitable for your media player and pull in meta data (such as photos, videos, text) from the web during conversion, which will be copied to your player. Originally I intended this to convert my oggs to low (128kbps) bitrate mp3s so I could fit them on a low memory player, but obviously this program can be so much more.

Monday, May 24, 2010

Aerofoil 1.5.1 Released (64 and 32 bit builds available)

The award winning Aerofoil has now been updated to 1.5.1!

Aerofoil extends Vista and Windows 7 notebook battery life by:
  • Allowing you to manually disable Aero Glass.
  • Optionally managing Aero Glass user interface.
  • Optionally managing sound muting.
  • Optionally managing your chosen power plans.
  • Optionally managing Windows Sidebar.
  • Optionally showing a quick hibernate button.
  • Changing icon colour to show whether on battery or AC.

Benefits over earlier versions and similar software:
  • Much more efficient - Aerofoil is 100% unmanaged C++ (no .Net Framework!).
  • Available in both 64 bit (x64) and regular 32 bit (x86) builds.
  • Much smaller memory use (about 25%-30% of the size of similar software).
  • Unlike other apps, Aerofoil doesn't poll battery level continuously allowing the CPU save power by being idle more often.
  • No configuration file - everything is customised with the installer.
  • Open source and free - no expiry date, adware, spyware or malware, download and compile it for yourself if you prefer*!

What reviewers of Aerofoil have had to say:

"Aerofoil Extends Your Battery Life Approximately 25%", "you really should download"
( Disclaimer: Aerofoil's author's (my) personal best has been (only) 10-15%, or ~10 minutes, on a 2 hour battery 17 inch HP notebook (DV9233EU) with power saver mode using the lowest screen brightness.

"Why couldn't Microsoft just make power switching part of the "Designed for Windows 8" spec or buy Aerofoil?"
(Woody Leonhard, Infoworld)

"This is definitely a worth-while little app for road warriors"
(Metro Area Personal Computer Club, Iowa, USA)

"great for gaming and notebook applications alike"
(Official Windows Magazine - 47th of top 100, 37th of top 40 Hot Apps / TechRadar)

"Aerofoil, though, is far, far smaller and more efficient"
(Dave Johnson, Bnet)

The great advantage of AeroFoil is little resource consumption..... works perfectly with Windows 7"
(Kavya, Techno360)

"a must for every Vista laptop user."
(Wim Van Acoleyen, ZDNet)

"Great utility for gamers and laptop users."
(The Glitch)

"simple yet amazingly effective software that the corporate bigwigs couldn't figure out"
(Umar, Techtites)

Changes in 1.5.1:
  • Available as a 64 bit (x64) executable.
  • Source code updated for the wxWidgets 2.9.0 framework.
  • Project updated for Visual Studio 2010.
  • Multibyte strings have been removed in favour of Unicode.
  • UPX compression has been removed due to lack of a 64 bit Windows packer (memory usage remains the same).

Downloads (please read the important note below too):

Download from Softpedia (external site) (note Softpedia don't host the source code).
Download Aerofoil 1.5.1 (64 bit) Installer
Download Aerofoil 1.5.1 (32 bit) Installer

Download Aerofoil 1.5.1 (64 bit) Source Code (C++)*
Download Aerofoil 1.5.1 (32 bit) Source Code (C++)*

IMPORTANT: If you receive an error message regarding the msvcp100.dll being missing you may also need a Windows update - the Microsoft Visual C++ 2010 Redistributable. You can get this from Microsoft - links below - please choose the correct version:

Redistributable for 64 bit (x64)
Redistributable for 32 bit (x86)

* The source code has dependencies on the wxWidgets framework (2.9.0) and the project is for Visual Studio 2010. For 64 bit compilation wxWidgets will also need building with the WIN64 flag (instead of WIN32) and the project build platform targets set to x64. Additionally an environment variable $(WindowsSdkDirx64) needs to point to the relevant Windows 7.1 SDK.

Friday, May 14, 2010

Aerofoil update and 64 bit

I've recently updated Aerofoil to use a newer version of the GUI toolkit, WxWidgets 2.90, and got it building in Visual C++ 2010 Express Edition which has led me to idea of doing a native 64 bit build. Technically this will be no more efficient than the existing 32 bit but purists out there (myself included) would like to see a 64 bit build. Unfortunately as I'm no longer using VS 2008 Express I'm waiting on an integrated 64 bit compiler due in June and Microsoft say...

From the Windows SDK blog
I want to use Visual C++ 2010 Express. Should I install the Windows SDK v7.1?

If you install Visual C++ 2010 Express.... the Windows SDK v7.1 includes more tools than are delivered with Visual C++2010. If you want to install .... 64-bit native compilers/CRT, you may wish to download and install WinSDK v7.1....
This SDK will be released soon after the RTM version of Visual Studio 2010 is released

I haven't decided whether to add any new features.

Sunday, April 11, 2010

Mozilla Personas Updated

Just a quick note to say I've added three new Lanzarote personas.

You can get them all here

Thursday, April 08, 2010

Image to ZX Spec 1.2.1 Released

Update: Version 1.3.0(_01) has been released
Version 1.2.1(_02) of this application has now been released and is freely available.

award image

Image to ZX Spec 1.2.1 is a multi core capable image and video converter that can produce vintage computer art images (jpeg/png) of any size and can even convert work to a real ZX Spectrum (or an emulator) as a slideshow or video. This is useful to create retro music videos, posters, mock screenshots etc etc - you do not even need a Spectrum to use this program!

Just to show you how easy it is here's one I made earlier in 15 mins:

Key features include being able to:

- Apply a "Spectrumized" effect to any size JPEG, PNG or GIF image.
- Convert AVI or MOV files to ZX Spectrum video with optional video loader.
- Convert any JPEG, PNG or GIF image, convert to a ZX Spectrum slideshow (.tap file), or to ZX Spectrum SCREEN images (.scr file).
- Choose from numerous processing options as to how the images will be converted, including customising how colour "attribute" clash is handled.
- Convert an entire directory of images in one go.
- Change all processing options on-the-fly.
- Java based - works on Microsoft Windows, Ubuntu, etc or try it online! (Requires Java 6 to be installed)

Third party artwork:
zxthetics (Hi-Fi Lo-Fi / Digital Impressionism / Faux-Bit)
Prosthetic Knowledge/More zxthetics works
8 Bit Tron


Java 6 or better
Online version: >256MB memory free (image size limited).
Standalone version: >512MB memory free (larger image sizes permitted).


Try Image to Zx Spec 1.2.1_02 online.
Image to ZX Spec 1.2.1_02 Standalone (just unzip and double click jar file to start).
Image to ZX Spec 1.2.1_02 Source code and Javadoc (note GPL 2.0 licenced).
Tutorial and demo videos

Monday, March 22, 2010

Pay As You Go PAYG Price Changes on : What is it with greedy telecoms companies?!

I've decided to stay on three for the time being, however to subsidise their answerphone charges I and my finacĂ©e have now had to pay, I've switched my netbook to use an O2 SIM instead. Cost to me, nothing (I still pay O2 but have a larger download limit), cost to, £5-£10 a month.

Original post follows:
Basically I'm on Flat 12 tariff on the three network and a few minutes ago I texted new terms and conditions changes taking place from April 2nd.

Frankly I'm pissed off - here's the changes in summary (excluding international and special number price hikes):
  • Now charging 15p/min for voice mail/spam/skype spam that goes to your answer phone (this was free).
  • Trying to cut down their facebook bandwidth by offering facebook without pictures - text only - who does that really benefit three?
  • Free twitter - whoopie do. I don't twitter, but I bet three'll pull in some nice cross subsidy deal for this.
  • Telling me my calls to other mobile networks have gone up to 25p/min (I'm on flat 12, that's 12p for those idiots at three that can't count - I haven't changed my contract!)
  • Making out the existing unchanged free internet allowance and free texts are some great offers to make up for this price hike!!!
  • Tell me they are still better than their competitors (obviously running full damage control here - they know this'll be unpopular and cause people to leave). Orange used to say the same thing.
  • Hides the terms and conditions off their main website but sends you a link by phone to abbreviated stuff just meant to annoy.

Oh yes I can still get free Skype calls, but with all the recent outages, disconnects and failed logins I can't exactly rely on it - or is that the point?!

If this all goes through three can look forward to losing a large number of customers if they've got the nouse not to get fleeced by Three Telecom.

Sunday, March 21, 2010

How to Set or Increase the -Xmx Heap Memory of An Executable Java Jar

So a lot of people say that setting the -Xmx heap memory of an executable Java jar cannot be done, that it must be done on the command line or via batch script negating the double click functionality of a jar or Java Webstart.

Actually it can be achieved quite easily with a mostly cross platform compatible work around/solution (although this fix won't help you if you have a custom Java security policy - 99% of people don't ;))

The benefit of the solution below is that it doesn't rely on hard coded paths which will break cross platform compatibility:
  1. Create a small separate runner class with (another) main method in the jar. Set the main-class attribute of the jar to use this class.
  2. The new main method should check your conditions (e.g. you have enough memory).
  3. The new main method should start a new Java process without a hardcoded path for cross platform compatibility if the conditions are not met.
  4. Specify your parameters on the command line for that process (e.g -Xmx)
  5. Do NOT have the new main method use the "-jar" parameter as this does not work on all platforms due to path to jar issues (in fact it only seems to work on Windows).
Basically derive some code from the following example (taken from Image to ZX Spec 1.2). Note this fix uses a non standard option for MAXIMUM HEAP.

Note I am relaxing my usual GPL 2 licence for this Java class, if you derive from it consider it to be BSD licenced. I also ask you put a link or note in your software to my website in your licence/list of licences. The website you should use for reference is

Taken from Image to ZX Spec 1.2.1, where the class "" is the real main class to start the application.

/* Image to ZX Spec
* Copyright (C) 2010 Silent Software (Benjamin Brown)
* All rights reserved.
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of Silent Software, Silent Development, Benjamin
* Brown nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.


* Solution/workaround to allow executable jars
* to change their memory settings as Java cannot
* have its command line properties defined in a
* Jar file. Why Sun never implemented anything like
* this is beyond me.
public class ImageToZxSpecRunner {

    * Bare minimum heap memory for starting app and allowing
    * for reasonable sized images (note deliberate 1 MB
    * smaller than 512 due to rounding/non accurate free
    * heap calculation). The solution allows JVMs with
    * enough heap already to just start without spawning
    * a new process.
    private final static int MIN_HEAP = 511;

    public static void main(String[] args) throws Exception {

    // Do we have enough memory already (some VMs and later Java 6
    // revisions have bigger default heaps based on total machine memory)?
    float heapSizeMegs = (Runtime.getRuntime().maxMemory()/1024)/1024;

    // Yes so start
    if (heapSizeMegs > MIN_HEAP) {

    // No so set a large heap. Tut - I did use -server mode here originally
    // which does something similar for heap (i.e. can choose a machine specific
    // maximum) but this has some problems with Java 6 R19 for some reason
    // on my single core machine but worked on Java 6 R13 :( so for now I'll
    // use a naughty non standard -XX:+AggressiveHeap option.
    // instead (or whatever memory you need) as another constant and use this
    // in place of "-XX:AggressiveHeap" below. E.g.
    // "private final static int RECOMMENDED_HEAP = 1024;"
    // and
    // ProcessBuilder("java","-Xmx"+RECOMMENDED_HEAP+"m"...
    } else {
      String pathToJar = ImageToZxSpecRunner.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();
      ProcessBuilder pb = new ProcessBuilder("java","-XX:+AggressiveHeap", "-classpath", pathToJar, "");

If you find this useful (or it's saved your bacon at work!) or want to post a more generic/improved version drop me a comment (and please remember to add the licence as described above or your code will break ;) )!

Friday, March 12, 2010

Image to ZX Spec 1.1 Released

Image to ZX Spec 1.1 is now freely available.
UPDATE: Get the latest 1.3.1 build

You can use Image to ZX Spec 1.1 online here (requires Java 6) or choose to download it.
Image to ZX Spec allows you to:

- Create retro art work, any size image can be "Spectrumized" (.png, .gif .jpg file) using
and one of 15(!) dithering modes (shading for the non techies).
- Convert JPEGS or GIFs to a ZX Spectrum slideshow (tap file).
- Convert JPEGS or GIFs to a ZX Spectrum SCREEN image (.scr file).
- Convert an entire directory of images, with previews.
- Choose from numerous processing options as to how the images will be converted.
- Change all processing options on-the-fly.

New for Version 1.1
- Added new Atrribute Favoritism feature to choose the colour set to use (greatly improves default image quality).
- Added Dither Preview feature which displays previews with different dithering algorithms (and takes advantage of multi core processors).
- Updated BASIC slideshow program with new warning to stop tape.
- Minor bug fixes to do with image conversion colour choice.
- Memory usage increased for larger image conversion (512MB min).
- Improved UI layout for Linux based systems (tested on Ubuntu)
- Main frame has splash picture, About box displays system info.

Java 6 or better
Online version: >256MB memory free (image size limited).
Standalone version: >512MB memory free (larger image sizes permitted).

Try Image to ZX Spec Online
Image to ZX Spec 1.1 Standalone
Image to ZX Spec 1.1 Source Code

Many thanks to Viperfang Networks for the hosting.

Tuesday, March 09, 2010

Image to ZX Spec 1.1 Progress

Just a quick update regarding Image to ZX Spec - multi core support has been added, dither preview is now included and Spectrum attribute favouritism option has been added greatly improving the image quality. Have a look at the preview image (click for full size image) - bear in mind these display like this on a real ZX Spectrum!

Thursday, February 04, 2010

Mozilla Firefox Personas

So Christmas comes along and throws a spanner in the works of my Vampire Castle development plans. Well now February is around I've started ramping up development again and creating something new - Mozilla Firefox Personas. Vampire Castle is still my next project to complete but when I feel like chilling out I'll be adding some more personas to my official collection. Help yourself - you'll need at least Firefox 3.6 to use them.