Keilly: 2007

Friday, November 30, 2007

TrackIt v1.1


Now with Leopard compatibility!

A simple widget that allows you to keep track of whatever number you like: daily, weekly, or whenever...

- Slimmers track your weight
- Dieters track your calorie intake
- Runners track your miles
- Golfers track your score
- Sportsmen track your averages

How to use:
- Enter your number for today and an 'x' will appar on the graph.
- Come back tomorrow (or whenever) and enter the number for tomorrow.
- A graph automatically plots, showing you how the number changes over time.

- Use the left/right buttons to zoom out up to a year.

Track multiple numbers by opening multiple widgets - To do this, open Dashboard, click on the (+) symbol in the bottom left, locate the TrackIt widget from the available list, click the widget and new one will appear.

Version 1.1 - Leopard Compatibility (but probably Tiger incompatibility!)
Version 1.02 fixes a bug when restarting at the end of a month.

10.5 Leopard Users download from here (v1.1)
10.4 Tiger users download from here (v1.02)

IMPORTANT UPGRADE INFORMATION...
If you are upgrading from an earlier version and wish to keep your data you must do the following steps:
- Open the Terminal application from Application/Utilities
- Type: cp .TrackIt/* Desktop
- Your data files will be copied to the Desktop. Open in TextEdit by double clicking.
- In the new version of the widget, press the i to flip it
- Hit the 'Edit Data' button and TextEdit will open an empty data file.
- Copy and Paste the data from the old file to the new file
- Save

Mac OS X 10.5 Leopard is required. If you're using Safari, click the download link. When the widget download is complete, Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it. If you're using a browser other than Safari, click the download link. When the widget download is complete, unarchive it and place it in /Library/Widgets/ in your home folder. Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it.

Thursday, November 22, 2007

ListenAgain 3.2


Another minor upgrade to BBC ListenAgain.

What's new:

- Accessibility (thanks to James Jolley's invaluable advice and testing)
- Volume control
- Hotkeys (left/right = skip, up/down = volume, space = play/pause, s=stop, p=station popup)

This has been developed and tested on Mac 10.5

VoiceOver users: when selecting stations use VoiceOver keys with the arrows to select the station from the menu.

Requires RealPlayer 10.1 Update, RealPlayer 11 doesn't play when Dashboard is hidden. Use RealPlayer 10.1

Download

Troubleshooting:
Try and play directly from the BBC website. If it works there then it will almost certainly work in Dashboard. If not the problem has historically been issues with RealPlayer - try uninstalling and reinstalling RealPlayer using the version from the BBC website. Reboot after the reinstall to restart Dashboard.

Let me know any other problems.

Mac OS X 10.4 Tiger is required. If you're using Safari, click the download link. When the widget download is complete, Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it. If you're using a browser other than Safari, click the download link. When the widget download is complete, unarchive it and place it in /Library/Widgets/ in your home folder. Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it.

Saturday, November 10, 2007

Leopard Compatibility


I've just upgraded to Leopard. Here's how my widgets fare:

ZX Spectrum - 100% OK
BBC ListenAgain - 100% OK

SOWPODS Word Checker - Updated to version 1.2 now 100% OK
Word Finder - Updated to version 1.1 now 100% OK

TrackIt - Updated to version 1.1. now OK.

Hopefully I'll have updates soon. It'll be nice to use the full release of Dashcode for the first time.

Friday, October 12, 2007

Listen Again v3.1



What's new:

- It works again!

- Can play any day of multi-day programmes.

Download

Troubleshooting: If you cannot play radio streams, and also cannot play streams directly from the BBC web site in Safari then RealPlayer is probbaly not installed or configured properly.

Let me know any other problems.

Mac OS X 10.4 Tiger is required. If you're using Safari, click the download link. When the widget download is complete, Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it. If you're using a browser other than Safari, click the download link. When the widget download is complete, unarchive it and place it in /Library/Widgets/ in your home folder. Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it.

Thursday, September 27, 2007

Clear a BufferedImage in Java

Lots of cool Animations require a transparent background and, of course, speed.

In Java creating a new BufferedImage for each frame of an animation is slow, but reusing images with transparency from frame to frame is tricky as BufferedImage doesn't have an obvious way to set all of it's pixels to completely transparent.

Unlike other colors we can't just paint a transparent color over the image because, well, it's transparent and won't affect the pixels already in the image.

I had a poke around and found this from IBM DeveloperWorks.

g2D.setComposite(
AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
Rectangle2D.Double rect =
new Rectangle2D.Double(0,0,width,height);
g2D.fill(rect);

It would be a lot more useful if clearing to any color was part of the Image API, but until then this is good to know.

Sunday, August 19, 2007

Simple Border Resize

Here's a simple way to resize a top or bottom border of the widget, a slight modification will do the sides too. It's nice because it will also handle a border that has a nice gradient fill, and/or rounded corners.

The idea is to have two corner images and a third center image that stretches to horizontally fill whatever gap is between them. AFAIK: this bit requires JavaScript.

- Use your image editor or Dashcode to create the base border (images here shown x3)...


- Open the image in an image editor, such as Gimp.

- Use the crop tool to create three new images, the left corner, the right corder, and a one pixel wide strip from the center. For the corners also include five to ten extra pixels from the width. This is to prevent a rendering artifact when resizing (more on this later)




- So copy the three images into the widget Images folder, add them to the html, and edit their css placement values (or use the inspector in Dashcode). Here's my css as an example:

#bottomleftimage {
position: absolute;
bottom: 12px;
left: 12px;
}

#bottomimage {
position: absolute;
bottom: 12px;
left: 22px;
width: 283px; // default width, this will change on resize
}

#bottomrightimage {
position: absolute;
bottom: 12px;
left: auto;
right: 12px;
}

- Running the widget now: the border should look good on default size. On resizing it will move the right corner correctly but the center of the border won't stretch. To do the stretch: Just after the window.resize call....
...
window.resizeTo(x,y);
document.getElementById("bottomimage").style.width =
(x-42) + "px";
...
The '42' is found by subtracting the total width of the widget minus the width of your border center by default. Try and make the center image overlap by five or so pixels into the corner images, this will stop any gaps appearing during resizing.

- Now when you resize the widget the border will resize nicely too.

Monday, August 6, 2007

Resizing Text Dynamically

In the latest version of the ListenAgain widget the text shrinks and descriptions disappear when the widget is resized to a small size. I think this is quite a nice effect and especially useful in Dashboard where space is very limited.

The trick is to use JavaScript to manipulate the CSS style when the widget resizes.
The hardest thing I found was to find the correct style sheet object. The following bit of code should do the hard work and return the CSS object with the matching name.

function getStyleClass(className)
{
for(var s=0; s < document.styleSheets.length; s++)
{
var ret = getStyleClassFromRules(className,
document.styleSheets[s].cssRules);
if (ret != null)
return ret;
}
return null;
}

function getStyleClassFromRules(className, cssRules)
{
for(var r=0; r<cssRules.length; r++)
{
if (cssRules[r].selectorText != null)
{
if (cssRules[r].selectorText == className)
return cssRules[r];
}
else if (cssRules[r].styleSheet)
{
var ret = getStyleClassFromRules(className,
cssRules[r].styleSheet.cssRules);
if (ret != null)
return ret;
}
}
return null;
}
So now in your resize method, grab the CSS Object for the object to shrink and tweak it's style: e.g. To find the style for ".articlebody" and change it's look...

var descStyle = getStyleClass(".articlebody");
if (descStyle != null)
{
if (y < 280)
descStyle.style.display = "none"; // hide
else
descStyle.style.display = "block"; // show

if (x < 245)
descStyle.style.fontSize = "11px"; // small
else if (x < 280)
descStyle.style.fontSize = "12px"; // larger
else
descStyle.style.fontSize = "13px"; // largest
}

Of course there are loads more style options to change, and from here lots of cool effects are possible. For example, add a simple timer and slowly change an objects opacity to make it fade in or out; or grow and shrink an image as the mouse moves over it.

Saturday, August 4, 2007

Listen Again v3.0




Here's a new version of the Listen Again widget.

Changes:
- Better resizing. The previous versions were always a bit large, so you can now shrink down to much smaller sizes and the text will adjust size automatically. Also once the widget is shrunk past a certain size the programme descriptions are automatically hidden.

- Added a 'now playing' icon.

- Added a time code for playing programmes.

- Removed rear side of the widget as there were only two options on there: Show Descriptions, and Volume. The volume control seemed virtually useless considering there are easy machine volume controls on Macs.

- Fixed a bug with the scroll pane during resize.

Enjoy!

Download

Mac OS X 10.4 Tiger is required. If you're using Safari, click the download link. When the widget download is complete, Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it. If you're using a browser other than Safari, click the download link. When the widget download is complete, unarchive it and place it in /Library/Widgets/ in your home folder. Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it.

Troubleshooting: If you cannot play radio streams, and also cannot play streams directly from the BBC web site in Safari then RealPlayer is probbaly not installed or configured properly.

Tuesday, July 31, 2007

TrackIt v1.02



Tiger Only! Leopard compatibility coming soon.

A widget that allows you to keep track of whatever number you like: daily, weekly, or whenever...

- Slimmers track your weight
- Dieters track your calorie intake
- Runners track your miles
- Golfers track your score
- Sportsmen track your averages

A simple way to track any number you like. One day, one week one month at a time.

Just open dashboard and enter your number for today and an 'x' will apprea on the graph. Then come back tomorrow and enter the number for tomorrow. A graph automatically shows you how it's doing over time. View by week or zoom out up to a year.

Track multiple numbers by opening multiple widgets - To do this, open Dashboard, click on the (+) symbol in the bottom left, locate the TrackIt widget from the available list, click the widget and one will appear per click.

Version 1.02 fixes a bug when restarting at the end of a month.

Download from here

IMPORTANT UPGRADE INFORMATION...
If you are upgrading from an earlier version and wish to keep your data you must do the following steps:
- Before upgrading, open each track it widget to preserve, flip it over and press the edit data button.
- TextEdit will open with the data. Save it to a safe place and keep it open.
- Upgrade the widget, flip the newly created empty widget over and press Edit Data again.
- TextEdit will open with a basic data file. Copy everything from the old TextEdit to the new one and hit save.
- Bringing up Dashboard will show you the new widget with your data in it (Colour wasn't preserved, sorry!)

If you upgraded without performing steps all is not lost. Mail me and I'll tell you how to get your data back.

Mac OS X 10.4 Tiger is required. If you're using Safari, click the download link. When the widget download is complete, Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it. If you're using a browser other than Safari, click the download link. When the widget download is complete, unarchive it and place it in /Library/Widgets/ in your home folder. Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it.

Monday, July 16, 2007

Dashcode Beta Expired


Looks like Apple made good on their original expiry date for Dashcode Beta. Starting yesterday Dashcode will simply display a dialog saying the beta has expired. Annoyingly, this date was originally set to be after the release of Leopard allowing developers to upgrade the OS and keep working and supporting their widgets. Apple slipped the release of Leopard, but didn't similarly move the Dashcode expiry date.

Choices now are:
- Upgrade to Apple Select (for $500) and install a pre-release (flaky) version of Leopard.
- Wait patiently till October.
- TextEdit + Safari + Webkit debugger + a big headache.
- Set the date back on your machine while starting Dashcode Beta - this, amazingly, works. You'll have to have downloaded the beta already as it's no longer available on Apple Developer Center.

Sunday, July 15, 2007

Create other word lists for the Word Finder widget

These are instructions on how to use other languages or dictionaries with my Word Finder widget.

Requirements: Your word list in a file, one word per line, saved to the desktop.

Part A - Format your list...

- Download this file to the Desktop.
- Open Applications/Terminal
- 'cd Desktop'
- 'perl convert.pl yourWordListName'

You should see the wheels turning and 14 word lists will be produced, one for each word length.

Part B - Replace my word lists with yours...

- Download my widget to the Desktop
- Right click and select 'Show package contents'
- Open the 'Bingo' folder to see my lists.
- Drag those to the Trash and drag in yours from the Desktop
- Double click on the widget file and it should load into Dashboard ready to go with your word list.

(Your widget now lives in 'Your Home/Application Support/Widgets')

If you make a Widget with other useful lists or languages then mail me and I'll host it here.

Create other word lists for the Word Finder widget

These are instructions on how to use other languages or dictionaries with my Word Finder widget.

Requirements: Your word list in a file, one word per line, saved to the desktop.

Part A - Format your list...
- Download this file to the Desktop.
- Open Applications/Terminal
- 'cd Desktop'
- 'perl convert.pl yourWordListName'

You should see the wheels turning and 14 word lists will be produced, one for each word length.

Part B - Replace my word lists with yours...
- Download my widget to the Desktop
- Right click and select 'Show package contents'
- Open the 'Bingo' folder to see my lists.
- Drag those to the Trash and drag in yours from the Desktop
- Double click on the widget file and it should load into Dashboard ready to go with your word list.

(Your widget now lives in 'Your Home/Application Support/Widgets')

If you have a Widget with other lists then let me know and I can host it here.

Let me know if there are any problems.

Word Finder v1.1


As a complement to the word checker widget, here's v1.0 of a Scrabble word finder - although it works as a general purpose anagram finder too.

Simply enter between 2 and 15 letters hit return and the widget will show you all the possible words.

Enter a '?' to represent a blank, up to two can be used

Dictionary: The widget uses the latest international english Scrabble word list (SOWPODS). Look here for other dictionaries/languages.

Enter '??' in the widget to see all two letter words.

Download here
OS X 10.5 Compatible (10.4 version here)

This site and widget is in no way affiliated to the official Scrabble game which is the trademark of Hasbro in the US and Canada, and J.W.Spear & Sons elsewhere.

Mac OS X 10.4 Tiger is required. If you're using Safari, click the download link. When the widget download is complete, Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it. If you're using a browser other than Safari, click the download link. When the widget download is complete, unarchive it and place it in /Library/Widgets/ in your home folder. Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it.

Sunday, July 1, 2007

TrackIt Widget v1.0


A new widget that allows you to keep track of whatever number you like: daily, weekly, or whenever...

- Slimmers track your weight
- Dieters track your calorie intake
- Runners track your miles
- Golfers track your score
- Sportsmen track your averages

A simple way to track any number you like. One day, one week one month at a time.

Just open dashboard and enter your number for today and an 'x' will apprea on the graph. Then come back tomorrow and enter the number for tomorrow. A graph automatically shows you how it's doing over time. View by week or zoom out up to a year.

Track multiple numbers by opening multiple widgets - To do this, open Dashboard, click on the (+) symbol in the bottom left, locate the TrackIt widget from the available list, click the widget and one will appear per click.

Download from here

If you like the widget please contribute to the support and development of new versions by buying me a coffee: Press the button on the back of the widget.

Mac OS X 10.4 Tiger is required. If you're using Safari, click the download link. When the widget download is complete, Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it. If you're using a browser other than Safari, click the download link. When the widget download is complete, unarchive it and place it in /Library/Widgets/ in your home folder. Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it.

Thursday, June 28, 2007

Speed up file writing

Simple writing to a file can be achieved by the following:

widget.system("/bin/echo name=" + value + " >> "
+ dataFileName, null);

New lines aren't allowed with this version of the echo command, so only one line can be written at a time. The problem is that system calls aren't very fast: who knows why, perhaps a new shell is created internally each call? Anyway, writing a file of more than a couple of lines is noticeably slow to the user. So we need a way to do this with less system calls.

'printf' does the job perfectly as it allows multiple line writing. Build up the string to write, separating lines with the '\n' character. Then write the whole file in one call....

var dataString = "";
for(i=0; i {
dataString += data[i].name + "=" + data[i].value + "\n";
}
if (dataString.length > 0)
widget.system("/usr/bin/printf '" + dataString +
"' > " + dataFileName, null);

So... much... faster...

Tuesday, June 12, 2007

Safari 3 Public Beta vs Dashcode Public Beta

I just installed the Safari 3 Public Beta, it's very nice but without AdBlock and to a lesser extent Greasemonkey it's never going to replace Firefox. Anyway, after firing up Dashcode Public Beta I noticed that there are rendering problems. Just creating a simple widget and resizing the front design is suddenly very problematic. I suppose Safari 3 has an updated version of Webkit that Dashcode Beta isn't ready for.

Uninstalling Safari 3 fixes things with Dashcode. A bit of a pity as Safari 3 was noticeably quicker that Safari 2 and much much faster than Firefox.

Incidentally, maybe a bonus reason for the release of Safari on Windows is to increase the number of plugins available. Plugins are certainly a big differentiator between Firefox and the other browsers, and while Safari is marginalized only on OSX it won't get the volume of [quality] plugins developed by 'the community' that Firefox does.

ZX Spectrum Widget in WWDC Keynote

While being embarrassed for a room full of grown men enthusiastically cheering and whooping at the announcement of a new 'Finder', I spotted that Steve Jobs was sharing the WWDC 2007 stage with a huge OSX feature that he somehow neglected to mention: My ZX Spectrum widget.
It's on around minute 45, blink very slowly and you'll miss it.

Saturday, June 2, 2007

Use the command line (to read/write files and other fun stuff)

Using the command line from a widget adds the ability to make widgets much more powerful than standard web pages. It's really easy to do by using the widget.system call.

e.g., to run a script (drag the script to your widget 'Files' section):
  widget.system("./myscript.sh", null);
Simple write to file 'data.txt'"
  widget.system("/bin/echo Some data >> data.txt", null);
widget.system("/bin/echo More data >> data.txt", null);
Simple file read from 'data.txt':
  var data =
widget.system("/bin/cat data.txt ", null).outputString;
Run a java application:
  widget.system("/usr/bin/java ", null)
Note the use of the path to the executable in the system call. Looks like the widget doesn't have a good path variable set up in it's shell. Not sure why, but it's easy enough to find an executable location by typing 'which java' in Terminal.

Make sure that the widget has the attribute 'Allow Command Line Access' turned on or instead you'll get a non obvious exception when executing the system call.

Monday, May 28, 2007

Aqua Button Image Templates


Warning, drawing images takes ages!
Bizarrely writing the code for widgets always seems to be the quickest bit, drawing graphics and wrestling with Dashcode sucks up most of the time.

To help with drawing I followed an online guide to creating Aqua buttons and created long and round versions.
Here are the saved template files for Gimp to save all the bother. It's easy to change size, colour and put an icon inside.

(The icons are deliberately rotated above for maximum shock value when viewing the page, hold your laptop sideways for a more realistic view of what to expect)

Round Template
Long Horizontal Template

Sunday, May 27, 2007

Listen Again v2.0


I've just uploaded a new version of the ListenAgain widget. This version adds the much needed, and much requested, ability to skip forward and back through playing programmes. Rather than fast forward the skip jumps ahead in convenient increments.

Funnily enough the thing that took the longest time was drawing the new image for the control buttons.

Requires RealPlayer

Mac OS X 10.4 Tiger is required. If you're using Safari, click the download link. When the widget download is complete, Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it. If you're using a browser other than Safari, click the download link. When the widget download is complete, unarchive it and place it in /Library/Widgets/ in your home folder. Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it.

Troubleshooting: If you cannot play radio streams, and also cannot play streams directly from the BBC web site in Safari then RealPlayer is probbaly not installed or configured properly.

Friday, May 25, 2007

Resizable Background

The better widgets resize. The apple guidelines here do a nice job of describing how to add the resize corner and code, but to get it to look nice at any size is tricky.

By default Dashcode will create a widget with a nice background image that can have rounded corners, gradient fills, and glass effects. This image does not dynamically resize.

One super simple way to get these effects plus enable resizing is to replace the background image with a canvas, and render draw the background on the fly. It's pretty simple. This code will render a black rounded rectangle at any size...


var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');

context.clearRect(0, 0, canvas.width, canvas.height);

var x = 0;
var y = 0;
var x1 = window.innerWidth - 20;
var y1 = window.innerHeight - 28;
var round = 10; // The roundness of the corners

context.lineJoin = "round";
context.fillStyle = '#000000'; // background color

context.arc(x1-round,y+round, round, -Math.PI/2,
0, 0);
context.arc(x1-round,y1-round, round, 0,
Math.PI/2, 0);
context.arc(x+round,y1-round, round, Math.PI/2,
Math.PI, 0);
context.arc(x+round,y+round, round, Math.PI,
3*Math.PI/2, 0);

context.fill();
The steps to add this to a widget are

- Replace the background image with a canvas
- Size the canvas component to it's largest possible size
- Call size and the rendering code when the widget is shown.

Sizing is canvas is the tricky thing. Dashboard initializes the canvas drawing area to a fixed size when the component is first created - so sizing the canvas later does not increase the available area for drawing - leading to possible clipping. The workaround is to initially size the canvas as large as your widgets maximum size, and to add some code to resize the canvas down to the desired size after creation - but just before the widget is shown (i.e. call it in function show()).

The canvas is quite powerful at drawing, and nice effects can be quickly achieved with its API. This image of an unreleased widget is all drawn on canvases, with some text and and buttons added..


Take a look at the code of the ZX Spectrum widget for a working example of a widget with a resizable canvas

Tuesday, May 22, 2007

Full Screen Widgets

It is possible to have widgets that can enter a full screen mode. This would be useful for my ZX Spectrum widget where the user might want to quickly step back in time and pretend for a while that their $1000 Macbook is a humble 48K ZX Spectrum.

The only catch is that your useful widget code must be written in Java.

Java has the immensely useful Java full screen mode. The catch here is that an applet by default doesn't have enough permissions to use it. We can work around this by running as a application and starting Java from the command line rather than embedded in a web page. For full screen mode the rendering must be done to the contents of a Frame or Window.
So if you'd like to work in two modes: one as the contents of a small widget area in Dashboard and also as optionally full screen: write your code so it can be started as an applet and as an application.

Invoking full screen is easy ('this' is a JFrame containing our UI):

GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
setUndecorated(true);
gs[0].setFullScreenWindow(this);
setVisible(true);

We also want to exit full screen when the user hits 'Escape', I added this to the JFrame:

protected void processKeyEvent(KeyEvent e){
if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
{
System.exit(0);
}
}

To run this from a Dashboard widget, use the widget.system command to run the application. Ensure that 'allow command line access' and 'allow java execution' is turned on in the widget preferences.

widget.system("/usr/bin/java -jar
FullScreenTest.jar fullscreentest.Main", null);

Boom! and that's it.

I've bundled this up into a test widget to demo the experience:

Widget: Full Screen Test
Java source: fullscreentest.Main

Monday, May 21, 2007

Spectrum Version 3

I've completed work on a new version of my ZX Spectrum Widget:


Relive the glory days of the 80’s guiding Miner Willy through the ‘Solar Power Generator’, defeating Doomdark near the ‘Mountains of the Moon’, or just programming your next BASIC masterpiece.

Important upgrade instructions:
The widget update will copy over the game file directory, so if you’ve added new games to an earlier version: Save the game files, then upgrade, then copy the games back.

Download v3

Older Versions are here

New in version 3.0
- Custom resizing - drag the widget to your preferred size, up to 1000x800 (larger sizes require faster machines)
- Basic (10 PRINT "Neil Rules! "; 20 GOTO 10)

New in version 2.2
- Sizing bug fix
- New games

New in version 2.1
- Compact size when not in use

New in version 2.0
- Sound
- .TAP file support
- Faster and smaller emulator
- Kempston joystick support (use arrows and ctrl)

Pull those bedroom curtains even tighter together and ignore your mother calling you for dinner.

Mac OS X 10.4 Tiger is required. If you're using Safari, click the download link. When the widget download is complete, Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it. If you're using a browser other than Safari, click the download link. When the widget download is complete, unarchive it and place it in /Library/Widgets/ in your home folder. Show Dashboard, click the Plus sign to display the Widget Bar and click the widget's icon in the Widget Bar to open it.

Legal
The widget comes with a few legally provided games (see below).
You can add more games by flipping over the widget, pressing ‘Open Game Snapshot Folder’ and adding your own games to that folder.

Only add files that you are legally allowed to - e.g. In some countries these can be games you have purchased. Copyright laws vary from country to county, so check them if you are unsure.
Don't pirate games!

I believe the owners of the supplied games allow their games to be freely distributed (according to the web-site World of Spectrum). If you are the copyright owner of one of these games and you would like it removed from the widget distribution contact me and I will be happy to remove it.

The widget is based on the Qaop Java emulator - which has it’s own page here

Troubleshooting:
Requires Java v5.0. If you are seeing a red 'X' in the corner, then Java isn't set up correctly. This is most probably fixed by:
- Open Finder
- Navigate to Applications->Utilities->Java->J2SE 5.0
- Open Java Preferences
- Ensure version is set to J2SE 5.0

Monday, May 7, 2007

Widget Resize Bug

Looks like there's a bug in Dashboard where if you resize a widget vertically only the widget gets clipped rather than resized. This is really annoying because once the resize corner itself is clipped out it's no longer possible to get it back and the widget is left permanently in the clipped state. Removing and re-adding is the user's only option.



Here's a hack to the resize code that prevents this. Add something similar around the window.resizeTo(x,y) statement in Apple's standard code to do resizing. The code contains some size limiting code too as this also interacts

function sizeWidget(x,y)
{
if (x == window.innerWidth && y == window.innerHeight)
return;

// size limiting code
if (x<=200)
x = 200;
if (x>=440)
x = 440;
if (y<=130)
y = 130;
if (y>=340)
y = 340;

// prevent vertical resize bug
if (y>130 && y<340 && y != window.innerHeight &&
x == window.innerWidth)
window.resizeTo(x+1,y);

// finally the original resize
window.resizeTo(x,y);
}


All that's happening is that if our condition is met (height changed, width unchanged) then the widget is resized horizontally by one pixel, before being immediately resized to the desired size.

It's not perfect - a slight wobble is barely noticeable on my machine when resizing vertically, but it's nicer than the widget being chopped.

Tuesday, April 24, 2007

Scrabble Dictionary Widget



Travel Scrabble is a great game when on holiday, but carrying the dictionary is a pain. So I cooked up a scrabble dictionary widget while on a cross country flight (you do take your laptop on holiday right?)

It's the simplest thing ever, just type in the word and press enter and you'll see a red or green indicator.

It uses the freely available word lists for SOWPODS or TWL. SOWPODS is the valid British English and American English word lists combined; TWL is the North American word list for 2006; you can choose on the widget back which, or both, to use.

Depending on where you live Scrabble is the trademark of Hasbro or Mattel. Using the Scrabble name for anything is a legal minefield. So I decided to call the widget the incredibly dull "SOWPODS/TWL Word Checker"

Download Word Checker Widget
OS X 10.5 Compatible (10.4 tested version here)

Thanks to Andy Isaacson for tweaking the text clearing behaviour.