Introducing YippieMove '09. Easy email transfers. Now open for all destinations.
Jan
11.
Comments Off
Comments
Category: Uncategorized

Today I tried to start iReport for the first time on the Mac. There was a shell script distributed with the program, so I gave it a shot in the Terminal. Unfortunately I got an exception immediately.

Stryker:iReport-2.0.3 2 siker$ chmod a+x iReport.sh
Stryker:iReport-2.0.3 2 siker$ ./iReport.sh
Exception in thread "main" java.lang.NoClassDefFoundError: 2

I fooled around with the script for a while. Seeing that it was trying to generate its class path using creative uses of dirname on the first script argument, I figured that maybe it’d help to run the program with the full path specified like so:

Stryker:iReport-2.0.3 2 siker$ "`pwd`/iReport.sh"

That didn’t do it though. After looking at the script some more I realized they were pretty lax with quoting. That was it. Moving the software to a location without spaces in the path solved the problem and made iReport start up just fine.

Stryker:iReport-2.0.3 2 siker$ cd ..
Stryker:Downloads siker$ mv iReport-2.0.3 2 ~/iReport
Stryker:Downloads siker$ cd ~/iReport/
Stryker:iReport siker$ ./iReport.sh

Hope that helps someone running into the same problem. I would post a bug report but I saw someone was two steps ahead already and had created a clickable Mac application and submitted a build file. That’s clearly the preferable solution.

Author: Tags: , ,
Introducing YippieMove '09. Easy email transfers. Now open for all destinations.
Dec
19.
Comments Off
Comments
Category: Uncategorized

Tom over at the eclipse-dev blog posted this useful snippet for putting native looking checkboxes in SWT JFace TableViewer tables. Unfortunately the checkboxes ended up with a gray background in OS X, as seen in the picture below.

Gray Checkbox Background
An unsightly gray checkbox background.

I came up with this hack to hack the hack to work.

private Image makeShot(Control control, boolean type)
{
	// Hopefully no platform uses exactly this color
	// because we'll make it transparent in the image.
	Color greenScreen = new Color(control.getDisplay(), 
		222, 223, 224);

	Shell shell = new Shell(control.getShell(), 
		SWT.NO_TRIM);

	// otherwise we have a default gray color
	shell.setBackground(greenScreen);

	Button button = new Button(shell, SWT.CHECK);
	button.setBackground(greenScreen);
	button.setSelection(type);

	// otherwise an image is located in a corner
	button.setLocation(1, 1);
	Point bsize = button.computeSize(SWT.DEFAULT, 
		SWT.DEFAULT);

	// otherwise an image is stretched by width
	bsize.x = Math.max(bsize.x - 1, bsize.y - 1);
	bsize.y = Math.max(bsize.x - 1, bsize.y - 1);
	button.setSize(bsize);
	shell.setSize(bsize);

	shell.open();
	GC gc = new GC(shell);
	Image image = new Image(control.getDisplay(), 
		bsize.x, bsize.y);
	gc.copyArea(image, 0, 0);
	gc.dispose();
	shell.close();

	ImageData imageData = image.getImageData();
	imageData.transparentPixel = imageData
		.palette.getPixel(greenScreen.getRGB());

	return new Image(control.getDisplay(), imageData);
}

The result now looks like the picture below.

Normal Checkbox
It’s not pixel perfect but closer.

It’s based on Florian Potschka’s version of makeShot as found in the comments to the original post. Replacing your makeShot method with the one above makes the background of the checkbox transparent. It’s not perfect: we use a random near white background color as our ‘green screen’ color in order to get the right antialias color in the edges. But this will also make any pixels with exactly this color inside of the widget shine through. Hopefully there won’t be many. Given enough time somebody will add checkbox support to arbitrary table cells in SWT and this hack will be made obsolete.

Here’s the complete snippet (untested):

package de.fhmracing.glasseye.canexplorer.gui.transmit;

import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

public abstract class EmulatedNativeCheckBoxLabelProvider extends
    ColumnLabelProvider {
  private static final String CHECKED_KEY = "CHECKED";
  private static final String UNCHECK_KEY = "UNCHECKED";

  public EmulatedNativeCheckBoxLabelProvider(ColumnViewer viewer) {
    if (JFaceResources.getImageRegistry().getDescriptor(CHECKED_KEY) == null) {
      JFaceResources.getImageRegistry().put(UNCHECK_KEY,
          makeShot(viewer.getControl(), false));
      JFaceResources.getImageRegistry().put(CHECKED_KEY,
          makeShot(viewer.getControl(), true));
    }
  }

  private Image makeShot(Control control, boolean type)
  {
    // Hopefully no platform uses exactly this color because we'll make
    // it transparent in the image.
    Color greenScreen = new Color(control.getDisplay(), 222, 223, 224);

    Shell shell = new Shell(control.getShell(), SWT.NO_TRIM);

    // otherwise we have a default gray color
    shell.setBackground(greenScreen);

    Button button = new Button(shell, SWT.CHECK);
    button.setBackground(greenScreen);
    button.setSelection(type);

    // otherwise an image is located in a corner
    button.setLocation(1, 1);
    Point bsize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT);

    // otherwise an image is stretched by width
    bsize.x = Math.max(bsize.x - 1, bsize.y - 1);
    bsize.y = Math.max(bsize.x - 1, bsize.y - 1);
    button.setSize(bsize);
    shell.setSize(bsize);

    shell.open();
    GC gc = new GC(shell);
    Image image = new Image(control.getDisplay(), bsize.x, bsize.y);
    gc.copyArea(image, 0, 0);
    gc.dispose();
    shell.close();

    ImageData imageData = image.getImageData();
    imageData.transparentPixel = imageData.palette.getPixel(greenScreen
        .getRGB());

    return new Image(control.getDisplay(), imageData);
  }

  public Image getImage(Object element) {
    if (isChecked(element)) {
      return JFaceResources.getImageRegistry().get(CHECKED_KEY);
    } else {
      return JFaceResources.getImageRegistry().get(UNCHECK_KEY);
    }
  }

  protected abstract boolean isChecked(Object element);
}

Hope it’ll help somebody.

Author: Tags: , , ,
Introducing YippieMove '09. Easy email transfers. Now open for all destinations.
Oct
31.

Just in case anyone runs into trouble with this, I just want to describe the steps for installing the symfony framework on an OS X 10.5 (Leopard) machine.

The good news is that Leopard comes with PHP 5 built in. The bad news is that PEAR is not included, which is needed to install symfony in the most convenient way.

My first attempt to remedy the situation was to run the darwin ports package manager to install pear:

# port install pear-base

Unfortunately there were two problems. First of all, the version of pear that comes with darwin ports does not use the OS X version of PHP by default, but rather looks for the PHP darwin port. This was easily remedied by adding export PHP_PEAR_PHP_BIN=`which php` to /etc/profile but unfortunately that’s not enough. The second problem is that a few files seems to be missing in the darwin port of PEAR and you’ll get the following error when you try to install symfony:


PEAR_Downloader::require_once(Structures/Graph.php): failed to open stream: No such file or directory in Downloader.php on line 1230

Indeed, even running pear install Structures_Graph results in this error message.

The Solution

This blog suggested go-pear.php as an alternative way to install PEAR on the Mac and it does work. So with no further ado, this is how to install symfony on Leopard:

sudo su -
curl http://pear.php.net/go-pear > go-pear.php
php -q go-pear.php

pear channel-discover pear.symfony-project.com
pear install symfony/symfony

Good luck with your Leopard powered symfony hacking.

Author: Tags: , ,
Introducing YippieMove '09. Easy email transfers. Now open for all destinations.

If you’ve been reading our blog before, you’ve probably already figured out one thing: we love Open Source and Apple products. Because of this, all our desktop machines run either Linux or Mac OS. Although our mixture of platforms might not be representative for all organizations, this article is still likely to apply to all start-ups and companies that are trying to create a company-wide policy for document-formats.

In our organization today we have three different office suites:

While all of these office suites have their pros and cons, they work just fine until the moment you try to move between suites. In the past in most organization it was often the case that everyone was forced to use Microsoft Office because some manager was bribed by Microsoft upper management said so. However, this is no longer a reasonable approach when we have a more diversified desktop environment than ever before. Today it’s no longer rare that we have Macs and PCs running both Windows, OS X and Linux in the same network. Because of this, forcing all users to use Microsoft Office is no longer reasonable.

First out: Microsoft’s .doc/.xls/.ppt

We’ve concluded that requiring all users to use the same software is unreasonable, but we still need to decide on one document-format that all users can both read and write. The first document format that comes to mind is the .doc-format for documents, and the .xls-format for spreadsheets. Let’s analyze this option a bit.

License: Microsoft’s own proprietary format.

Application .doc .xls .ppt
Open Office Yes (but layout problems) Yes Yes (but layout problems)
Apple iWork Yes (but layout problems) Yes (but uses a different structure natively) Yes (but layout problems)
Microsoft Office Yes (native) Yes (native) Yes (native)

Verdict: Ok, so all of the above editors support Microsoft’s proprietary file-formats. However, the drawback is that it is a proprietary format, which means that both iWork’s and Open Office’s implementation of these formats are most likely reverse-engineered. The real implication of this reverse-engineering is that the support is not really perfect. As you might have experienced, when using Open Office or Pages to export to .doc files, oftentimes the layout of the document is ruined. Since they layout tends to be quite important in business-documents, I would consider this a major drawback.

Next: Open Office’s .odt/.ods/.odp (Open Document Format)

You’ve probably already figured out that this would be our favorite, but let’s try to be unbiased. Similarly to the .doc/.xls/.ppt-combo, we’ll start out with a table of the support in the relevant applications.

Licensing: Creative Commons.

Application .odt .ods .odp
Open Office Yes (native) Yes (native) Yes (Native)
Apple iWork No No No
Microsoft Office Yes, with plug-in Yes, with plug-in Yes, with plug-in

Verdict: Unfortunately it seems like the Open Document Format won’t work. Here the biggest problem is iWork. It is really a shame that Apple chose to not include support for this format. However, there might be an answer for why this is. According to Apple’s list of features in Leopard, we can see that there’s support for Open Document Format in TextEdit. Without having any evidence at all for this claim, we would guess that Apple intentionally chose to not include the support for Open Document Format in iWork simply because they would add support for the format on OS-level in Leopard.

The decision

As you can see in the charts above, none of the two alternatives is perfect. What holds the .doc/.xls/.ppt-combo back is its proprietary nature. Because of this, all the other applications fail to read and write these files good enough for a corporate environment. What holds the Open Document Format back is the lack of implementation in iWork. Moreover, it might also be cumbersome to have to use a plug-in to read and write Open Document Files in Microsoft Office, even that that’s still better than no support at all.

The bottom line is that at this point, the only possible approach is to use the .doc/.xls/.ppt-combo. Although we don’t like it, we’re out of luck with Open Document Format due to the lack of support in iWork. However, because of the uncertainty of the support of Open Document Format in Leopard, we will actually wait and see until it’s launched to take a formal policy decision on our Document-format.

Author: Tags: ,
Introducing YippieMove '09. Easy email transfers. Now open for all destinations.

Over the last few days, iPhone unlocking has seen a couple of sharp turns. First iPhoneSimFree promised to deliver a commercial solution to unlock your iPhone. Then they hesitated and decided to become a wholesale only company, further delaying their release. Ultimately, they missed the train and the hacking community stepped in (Free iPhone unlock supposedly pending (Updated x2)), and released a free hack: iUnlock by the iPhone Dev Team (no association with Apple).

The box for a 4GB iPhone.Since vendor lock-in is never a good thing for the customer, the release of this software is great news. And as fans of the free market may be aware, cell phone unlocking is legal. But does it work? Playing With Wire decided to find out. We picked up a 4GB Apple iPhone, headed out on the internet and soon found a great unlocking tutorial at modmyiPhone. The guide is Mac specific, but we also stumbled across unlock.no which appears to offer a guide for Windows users – we didn’t try it though.

The Unlock Process

The process is a little bit lengthy but everything is done using simple graphical tools. For starters, you need to make sure your iPhone is entirely up to date. iTunes does this for you after you trigger the ‘recovery mode’ of your iPhone, by pressing Sleep and Home for 25 seconds.

iPhone in recovery mode.
The iPhone in recovery mode.

Once you’re in recovery mode you can just connect the iPhone to your computer and iTunes will offer you the option of restoring the phone. Prepare yourself for the first of a couple of lengthy downloads – for us iTunes downloaded 96 MB of software updates (we used iTunes 7.4.0 and iPhone Firmware 1.0.2 for this article). When it’s all done, iTunes will tell you so and you can close down the application.

So now we had an updated but not yet activated iPhone. The Mac application “iNdependence” makes activation a breeze, but this is where the second lengthy download comes into the picture as you have to download the firmware a second time. We did run into a minor snag: when we followed the instructions on the page we couldn’t get the activation to work on our first attempt. Disconnecting the phone, restarting iNdependence and then reconnecting the phone took care of it though – iNdependence unlocked the phone without complaint. Voila, now we had an iPhone that was basically like Apple’s latest iPod, the iTouch: it could play music and video, but it couldn’t make phone calls.

iNdependence activating an iPhone.This is where the Unlock application comes into play. To actually get it onto the phone, you need SSH installed though. Just like the guide says, the AppTapp application allows you to install third party software on your iPhone. We ran into trouble here though: when we ran AppTapp we got an indefinite progress bar. We waited a good 15 minutes for the application to finish, but it never did. What’s worse, our iPhone locked up in ‘recovery mode’ and could no longer be started. We realized that we had left iNdependence running from the previous step, and perhaps this application conflicted with the AppTapp installer. Regardless of the reason, the iPhone was dead at this point.

AppTapp making no progress.
AppTapp never got any further than this for us.

We restarted the iPhone and connected it to iTunes to restore it to factory settings. We were horrified as iTunes crashed very early on in the process. We mentally readied ourselves for creating our own Will It Blend episode, thinking the phone was a goner. Luckily after a full reboot of both the computer and the phone, the software reset went through.

We were back to square one, and had to go ahead and again activate the phone with iNdependence and then go for a second attempt at installing AppTapp. To be on the safe side, we downloaded the most recent version of AppTapp from its homepage. We made sure iNdependence was turned off.

This time we got an error message instead – something about a boot strapping process failing and a reference to the console. So we pulled up Console.app (/Applications/Utilites/Console) and took a look. To our surprise, the iPhone installer software was still working despite the error message.

AppTapp is reporting stuff in the Console.
Look! Something is still installing.

A couple of minutes later the phone restarted and all was well. The Installer icon appeared on the iPhone desktop and we could install the required software as described in the guide.

Installer.app on the iPhone.
Some of the applications the AppTapp Installer can install.

An activated iPhone with it’s SIM card removed.In the final part of the guide, the actual Unlock software is installed using SFTP. The guide recommends transferring the application bundle using Cyberduck, but we figured any SFTP client would do it. We had Panic’s Transmit installed, which worked just fine. After copying the files as instructed, and restarting the phone one more time, we finally had the Unlock icon on the iPhone desktop. It was time to install our T-Mobile SIM card and hope for the best.

25 minutes later we were making T-Mobile phone calls.

Notes and Observations

During the above process SSH was installed on the iPhone. This allows anyone who knows the default root password to log into your iPhone and do anything they want, as long as the phone is on a wireless network. We strongly recommend that you change your password as soon as possible using the ‘passwd’ from an SSH session.

With the same IP as before, SSH in using Terminal and run ‘passwd’ to change the root password.
Using SSH to change the default password (dottie).

So far, our iPhone has worked very well with T-Mobile. Initially there was an artifact ‘missed call’ icon hanging around over the Phone icon – a red circle in the upper right corner of the phone. Obviously, visual voice mail isn’t enabled as that’s an Apple and AT&T special feature, but the voice mail indicator works. When you press the icon, the phone calls your voice mail like a regular cell phone would.

Verdict

The Unlock application works just as advertised. Including the time it took us to take photographs and the time we spent resolving our few problems, the whole unlocking process took no longer than 2 hours. At no point was a non graphical tool needed, which surely will come as a relief to some users.

Unfortunately, the process is not entirely simple even with the graphical tools, since there are several opportunities to brick the phone or otherwise get tripped up. Still, if you feel confident with your technical abilities, and you don’t feel confident in AT&T’s cell phone abilities, this is the tool you’ve been waiting for. The iPhone is free.

Author: Tags: , ,

© 2006-2009 WireLoad, LLC.
Logo photo by William Picard. Theme based on BlueMod © 2005 - 2009 FrederikM.de, based on blueblog_DE by Oliver Wunder.
Sitemap