Archive for the ‘Macintosh’ Category

Running Oracle - The Solution

Wednesday, May 10th, 2006

This follows on from my previous posting. Searching for an Oracle

This is kind of old news now, because it’s been in use since SQLEditor 1.2 was released. However I though I would explain how I solved the problem that I was having with installing Oracle.

The problem was that I didn’t have a linux machine with enough memory and at the time, qemu wasn’t really fast enough to run Oracle in a virtual machine.

The first strategy I used was to upgrade the memory in my linux box (Cetaganda) to 512 MB. This solved the memory problem and meant that the testing could continue.

Then Parallels Workstation was released, which was able to run Oracle XE in a virtual machine fast enough for regular use. It also uses a different IP address than the host machine, which is useful in itself for testing.

Parallels is definitely the answer to this problem, I don’t need to switch on another machine, there is no additional noise and the performance is excellent for my purposes. I’m even considering adding the loading of the VM to the unit test setup so it will load automatically before the test cycle starts.

I’ve also got MySQL and Postgres running inside virtual machines.

Change console keyboard layout in debian

Tuesday, May 2nd, 2006

I’ve been using Parallels Workstation virtualization a lot recently for testing databases and it works amazingly well.

However I did come across a weird problem. I’d installed Debian linux and the console keyboard layout wasn’t correct for my Apple USB keyboard.
The solution was to use this command

dpkg-reconfigure console-data

Which walked me through selecting the right keyboard layout.

[link]

[Edited to correct a typo]

Finding and fixing StackOverFlowError in java

Thursday, March 16th, 2006

I was having a problem with some java one day, I’d made a change to some code and I kept getting a StackOverflowError. Unfortunately the stack trace didn’t help and some time inspecting the code didn’t offer any quick solutions. So I turned obviously to Google. The answer was simple, although it took some work to find it.

If you get a StackOverflowError in java it can sometimes be difficult to identify where the problem is occurring. This is because in some versions of the JVM the relevant stack trace isn’t automatically provided. This is the case in 1.4.2 when using the JIT compiler. (which I was)

One work around that worked for me was to add the -Xint option to the java call. This forces the JVM to use interpret the code rather than attempt to compile it. The interpreter will provide a stack trace and the problem can be easily found and fixed.

The bug report that gave the answer is at Sun:
Bug Report.

Searching for an Oracle

Wednesday, February 22nd, 2006

Recently I’ve been trying to set up a box to run Oracle again. There are enough SQLEditor users that Oracle support is important.

Fortunately Oracle have several downloads that can be used, there is a developer license for 10g and various chargeable options. However the option that is most interesting is Oracle Express. This is a cut down version of Oracle that has some limitations in maximum performance, but otherwise works the same as the regular version. For my purposes it’s perfect, since I’m not actually doing any data processing at all, maximum performance is irrelevant.

So the next step was to download and install a copy.

First I had to select windows or linux. Obviously a difficult choice, so I avoided it and downloaded both just in case.

Next I looked around for a suitable machine to run this database on. Oracle 10g does run on macs, but no word of Intel mac support, so my Imac is out (directly at least).

My next thought was a virtual machine on my Intel Imac ‘aslund’. Qemu runs windows really quite well and it runs linux perfectly well too. Unfortunately despite several hours playing around with settings I couldn’t get anything that would run fast enough and I couldn’t seem to get Oracle to run properly at all. I suspect that either I didn’t get one of the settings right, or there is some other problem somewhere.

Next I thought about ‘cetaganda’, which is my windows box. This meets the minimum requirements of 256MB ram, and has both windows and linux. No worries there.

Unfortunately it was debian linux and this requires Red Hat Enterprise Linux. After some thought I realized that Centos is a clone of Red Hat and so should work just as well. Which is probably would, if only my machine had enough memory. Unfortunately this machine was built to a (small) budget and has integrated graphics. The integrated graphics use memory from the main system for graphics, which reduces it from a nominal 256MB to only about 218 MB. 218MB isn’t enough for Oracle apparently and it complained.

Next step, the windows download (lucky I got them both before).

Windows XP sees the installer, unfortunately the same problem: not enough memory. (Although oddly the release notes mention this being a problem that has been fixed).

Next I may consider my iBook ‘Komarr’, however that will be annoying, because when I tried it before, it was slow.

The best plan may be to add more memory to cetaganda and run it that way.

Crash with WSMethodInvocationInvoke and malformed XML

Tuesday, December 27th, 2005

I’ve been doing some stuff recently with XMLRPC for both SQLEditor and an unannounced new product.

One of the key parts of XMLRPC in cocoa is the Apple web services Core. It provides almost everything you need to use web services.

However I did discover one oddity that led to some puzzelment

As part of my development I’d written a test server in php which operates a few simple functions that the client can try. This means that I can simulate various commands and cause intentional failures to see what happens. I also have a php client to check the server independently.

I had been making alterations to check a particular function in the client worked correctly. It was a new function that provided an array of values that could be placed into a menu on the client. The idea seemed sounds, the design had been worked out and new functionality had been added to both client and server. The server seemed to work fine with its test client and I was ready to try my main client application.

Unfortunately it either crashed or generated an exception on every call to WSMethodInvocationInvoke. Initally I assumed that it was a bug with my client application, perhaps I’d passed in the wrong arguments or made a mistake in setting up the context for the call.

However after some testing of various possibilities I discovered what seems to be the actual cause.

One of the included php files contained an extra new line character at the top before the doctype.

Removing this extra new line solved the problem
(presumably because it was now valid XML).

Moral of this story:

XMLRPC implementations and XML parsers are not always very forgiving of whitespace at the top.

Interestingly, the xml parser in camino doesn’t like xml files with extra lines at the top either.

I’m still looking to see if there is some setting that can be changed to make the parser more forgiving, or to pre-process the xml first.

(I’ll be reporting this issue as soon as I can produce a suitable test case)

PHP, trim and the non breaking space

Wednesday, August 3rd, 2005

An odd thing occurred today, I was trying to do trim($string) on a string in php, but I kept getting strings back that appeared to have a space at the beginning, the exact thing that trim is supposed to remove. I carefully checked and the space was definitely found when I copied the result out to TextWrangler. Finally I tried substr($string,1) and then I got the answer, the new string started nbsp; the string I was trimming had  , a non-breaking space at the beginning, which trim doesn’t remove. A quick switch to str_replace and now my string doesn’t have a space at the beginning. :-)

plutil

Friday, June 24th, 2005

STANDARDS
The plutil command obeys no one’s rules but its own.

from the plutil man page

SQLEditor built for Mac On Intel

Tuesday, June 7th, 2005

SQLEditor has now been built for Mac OS X/Intel as well as Mac OS X/ppc. I was able to download the Xcode 2.1 release last night and worked on the port this morning. SQLEditor at the moment still has bits of Java as well as Objective C so I wasn’t entirely confident of success, but I converted the build target to the xcode native type and moved the java code into a separate target. Then I ran the build process and after a bit of fiddling I was able to produce what appears to be a working fat binary:

file SQLEditor
SQLEditor: Mach-O fat file with 2 architectures
SQLEditor (for architecture ppc): Mach-O executable ppc
SQLEditor (for architecture i386): Mach-O executable i386

The new version of the application seems to run as well as the old on PPC, although it is currently set up to use the 10.4 sdk as opposed to the 10.2.8 sdk of release SQLEditor versions. (Although SQLEditor is not officially supported on less than 10.3)

If I had a Mac On Intel machine to test it on I would be very curious to find out what happens. :-)

But as far as I can see, and with the assumption that the ported version will not have unexpected bugs, the process is simple.

But will that assumption will hold? I have absolutely no idea.

Mac OS X Intel

Monday, June 6th, 2005

It has been officially announced that the Mac platform will be moving to Intel processors.

I’m still thinking about what this means for MalcolmHardie Software and SQLEditor and I have been reading about the transition to find out more.

Some useful points culled from publicly available documention:

  • Mac OS X on Intel doesn’t use Open Firmware (at least not currently). Does this mean that it uses a conventional BIOS or something entirely different?
  • Rosetta (the translation environment) does not run Applications built for Mac OS 8 or 9. Does this mean that the Classic environment will run them, or are these applications dead?
  • Rosetta doesn’t handle code written specifically for AltiVec
  • Rosetta must run the whole application, you apparently can’t mix some bits of native code and other bits of emulated code, even with plugins. (I suspect inter-application communication might work here though)

Apples & Intel?

Monday, June 6th, 2005

Maybe it’s going to be hardware based dynamic recompilation?

Or some kind of microcode based emulator?

Modern microprocessors are usually doing conversion of the assembly anyway, so why not from one instruction set to another.

I guess we’ll all know in a few hours …

Key labels or no key labels?

Friday, May 27th, 2005

I’ve been slightly concerned recently that the key labels are rubbing off the keyboard of my iBook.

But then I found this. A keyboard with no key labeling at all. 104 entirely black keys, no labels.

Interestingly it promises to offer faster speeds for the experienced typist and has differently weighted keys for different finger strengths. It sounds really interesting, especially as it promises compatibility with Linux and Mac OS X. (USB presumably)

MPW mac error messages

Monday, May 23rd, 2005

Some old error messages from MPW (which was kind of like XCode for Mac before Mac OS X in one sense).

“String literal too long (I let you have 512 characters, that’s 3 more than ANSI said I should)”

“…And the lord said, `lo, there shall only be case or default labels inside a switch statement’”

“a typedef name was a complete surprise to me at this point in your program”

[From Buggin' My Life Away]

Garbage Collection in Cocoa

Tuesday, May 10th, 2005

One of the interesting things that seems to be happening with Cocoa is the addition of garbage collection. A finalize method has appeared in the documentation for NSObject. There is a curious warning attached to it stating that it isn’t available in 10.4 or earlier releases. This suggests that it may be available in 10.5 or possibly even in notional 10.4.x releases.

It may make Cocoa programming easier for people moving from Java. Although I do hope that Java support for cocoa apps continues (not least because SQLEditor needs it for JDBC interfacing)

iBook restore DVD

Friday, February 4th, 2005

I was recently trying to install a particular package from the basic Mac OS X installation (Address Book.app) which for some reason had been deleted. Probably in a desperate attempt to free up some disk space.

It took me some searching before I realized that the packages are located in /System/Installation/ on the iBook’s restore dvd.

It isn’t the most obvious location by any means.

iMac Mini Disassembly probably ok?

Wednesday, January 19th, 2005

Daring Fireball has a comment from someone who saw a Mac Mini being disassembled and it sounds ok.

A standard issue putty knife and some assistance from a jack knife were all that was needed to crack the case.

Pocket PC and Mac OS X

Monday, November 22nd, 2004

In a break from SQLEditor and other similar things I’ve been trying to connect my pocket pc to my macintosh.
After some experimentation I have sucessfully installed synce using instructions .
I have also got the pocket pc to connect to the internet from the cradle using a slightly modified ppp script (use proxyarp) and have Avantgo synchronisation from the desktop using agsync.

I also have a new tool that handles detection of connections and disconnections on the device which I hope to make available shortly.

Unfortunately there are still some bugs, but excellent progress is being made.

I’ve also made some progress on mounting the device on the desktop using a modified webdav server. I can get read support, but I’m still working on write support.

More on this later…

DocBook and Apple Help

Monday, November 15th, 2004

One of the key tools I’ve been using recently is Docbook. Docbook is an xml-schema which can be used to write documentation for things. This can then be converted via the wonders of XSL, XML and XML-FO processors into PDF, HTML or several other formats. I’ve written all of the documentation for SQLEditor using docbook and it is really handy. Slightly verbose, but really handy.

Unfortunately at the moment there doesn’t seem to be an Apple Help stylesheet for docbook. Since one of my targets is Apple Help this is slightly unfortunate, but I suppose in time either I can write one or someone else will. In the meantime, I’m using the microsoft help stylesheet and altering the results a bit to work with Apple Help.

Docbook is definitely a handy tool for documentation though. I wish I had discovered it earlier.

SQLEditor released!

Monday, November 15th, 2004

After a rather over-extended development cycle SQLEditor version 1.0 has now been released. Which is a great relief to me. I’ve been working on it for so long now that I can’t quite remember not working on it, which is weird. Admittedly that’s only really about 12 months, but still, it’s a significant portion of my life. It’s also the first major product I’ve released.

In a moment of commercialism I would encourage you to buy a copy because it makes a wonderful christmas gift, or at least it might if the recipient really loved databases or if it was some other kind of program altogether. As it is, it probably wouldn’t make much of a Christmas gift. Socks or bottles of wine would be a better choice for almost anyone.

Releasing SQLEditor isn’t the end of the situation though. Version 1.1 is already being planned and I’ve various other projects that I’m working on as well, but SQLEditor is first and will always be the first piece of software that I released for sale.

Releasing software is complicated. In addition to the actual program, there is the distribution package, online help, the website, notifications to trackers like MacUpdate and Versiontracker, plus checking the online store is working correctly. Bad news with this release for anyone hoping for the pre-release discount. With the release of version 1.0 the offer expired.

People keep talking about MacPAD but nothing seems to be happening at the moment, only MacShareware.net seems to be supporting it (which is logical, since the two are quite closely tied together). I’ve got a MacPAD file up now, but nothing much else. I haven’t integrated it with the release managment stuff I’ve written (a motley collection of php and make files with a bit of XML for good measure).

If there was any market in it there is an interesting opportunity for a release management system (written perhaps in java?) that could generate everything automatically. Perhaps if I get really bored at some point I might do that.

The next step is to write a press release and send it out today. Joy :-(

So, in conclusion, if you haven’t already tried SQLEditor, then version 1.0 will improve your life so much that you won’t know how you got by without it. Or at least might save some time when designing SQL databases.

Writing Documentation

Thursday, November 11th, 2004

I’m currently in the middle of writing user documentation of SQLEditor. I finally settled on docbook as the format of choice since it seems the most compatible with other things.
I’m using this tutorial to build the stuff although saxon has now made it into darwinports which is nice.
http://www.boksa.de/tutorials/docbook_macosx.mpp

Mac OS X keyboard layouts

Monday, November 1st, 2004

I was reading macsurfer today and I came across an interesting article by a Canadian called Joe Clark who wanted to remove the US flag from the input mode menu item. This got me thinking, could I write something that would alter the default US keyboard layout to have a user specified flag. Could I write a keyboard layout with a Scottish flag for that matter.

It turns out that I didn’t need to.

There is already a Keyboard layout generator for mac osx. All you need to do is to enter a name for your new layout (”Scottish”) and then choose xml format. (You may also want to set the autodefine option to “define them all”) Then hit the download button. Finally save the resulting file as name.keylayout. (”Scottish.keylayout”).

If you want an icon to go with it you also need to create name.icns (”Scottish.icns”) using IconComposer or something similar.

Then drop the files into /Library/Keyboard Layouts/

Now logout and log back in again and the new keyboard layout should be available in the international pane for you to select. (hopefully)

But that isn’t the end of it. There’s more! The system is actually much cleverer than it seemed. You can set particular keys to generate combinations of characters. So if you want to do really odd things like have the number keys spell out the numbers as words that seems to be possible. (1 becomes ‘one’ for instance). Or maybe you dislike commas intensely, you would be able to redefine the keyboard layout to give space whenever you hit comma. It is also open to practical jokes of all kinds.

Tip: Check /Library/Keyboard Layouts/ if you’re getting odd effects when typing, someone may already have altered the layout.