Friday, March 30, 2012

More Eclipse Update Frustrations

I use Eclipse all the time for coding, but every time I want to add a new add-on to it, it turns into a nightmare making me want to strangle whoever came up with the Eclipse update system.  Todays living hell is all about trying to add MAT (Memory Analysis Tool), just so I can read a "hprof" file.


Okay, where to start?  It was easy enough to find the MAT homepage (http://www.eclipse.org/mat/).  How do I actually get it?  There's a link called "Download the latest version as RCP application" (whatever RCP means), but I know I want to add it using the Eclipse Update Manager.  There is a "Getting Started" link, so I'll try that.

This is looking good.  There is a link called "Read the Eclipse Memory Analyzer Tutorial to see how to start the program. "

We must be there soon.  The tutorial says "Install Eclipse MAT via the Eclipse Update manager . Select "General Purpose Tools " and install "Memory Analyser (Incubation)" and "Memory Analyser (Charts)"."


Okay.  I assume by Eclipse Update Manager they mean the Install New Software option.


That asks me for a site to update from.  Erm, any clues Mr. Tutorial?  No?  Gee, thanks.

Okay, lets go back to the downloads page.  It's better than nothing.


Watch out!  It has an update site!  Okay, let's go back into Eclipse and put that in.

Hmm, it lets me put in the text, but OK is greyed out.  It seems that this is a "Duplicate Location", even though it's not in the dropdown list of locations.  Great.  Another dead end.

What next?  After fumbling about for half an hour I try the Eclipse Marketplace (which takes about 2 minutes for the window to appear as it insists on loading data from the internet every time).  I'll just do a search for MAT.


It's here!  This must be the solution then.  Okay, what do I click on?  The only links are "Share" and "Learn more", neither of which sound like "End all this messing about and just get it now", so I guess I'll try "Learn More".


This link just takes me to the website of MAT on the marketplace.  The only link I can see on the page that might be of use is the one that gives the update site.  What?  I thought this was the update site!  And the link to the Home Page returns a 404.


Fucking Hell this is ridiculous.  It seems that the Marketplace only has v1.0 of MAT, which has been replaced with a seemingly non-existent v1.1.  Maybe.  I don't know and am rapidly losing interest in this piece-of-shit life-wasting process (Apologies for the swearing but I've lost count how many days of my life I've wasted trying to find my way through the maze of Eclipse updates only to give up).



UPDATE

I finally got MAT by discovering a "Available Software Sites Preferences", adding MAT and then doing the update (this sentence makes it sound far easier than it was).  With MAT installed, I opened the HPROF file:


[Sound of programmer stabbing himself]


Friday, March 23, 2012

Java URL class is Buggered to Buggery

Take this bit of code:

URL url = new URL("http://www.somesite.com/forums/test.php");

What should "url.getFile()" return?  I would have guessed the string "test.php".  But it returns "/forums/test.php", which seems to be including the path as far as I can see.

The javadoc actually says "Gets the file name of this URL", but then goes on to contradict itself in the very next sentence with "The returned file portion will be the same as getPath().".  Is it me or Oracle[/Sun] that needs to go back to programming school and learn about the difference between a path and a filename?  Or maybe there is a subtle but massive difference between a "file name" and a "filename".

Also, AFAICT there's no way to get the (what I would call) filename, i.e. "test.php" in the example above.

Thursday, March 15, 2012

XML is a Step Backwards

XML has its place, like when transferring data between disparate systems.  But I can't help wondering if using it for things like the Android Manifest is a step backwards.  Why not use a programming language?  With XML, you lose a lot of the useful features of a programming language, like code-completion and interaction with the main code.

Taking the Android Manifest as an example, I have to refer to a list of the specific permissions that I require, since without code-completion it won't tell me the possible options.  These also have to be spelled exactly right.  Also, I'd like to change the icon based on some flags in the code.  Can I do this?  No, the XML is static.  Great!

Friday, March 09, 2012

New Android App: Speech Browser

I can now unveil my latest app: Speech Browser!  It's a voice-controlled web browser with all the usual functions that a web browser has, such as going to a website, doing a search, going forwards/back through history, following links, searching for text etc..  

However, being voice-controlled, there are a lot of extra functions: repeating a page, going forward/back through the page, controlling the speed of the voice.  There are also 3 voices available: British, American and Canadian (although being British myself I can't tell the difference between the last two :) ).

It should hopefully be quite useful for blind Android users (and if any find it useful or otherwise I'd be please to know), but I also wrote it for people to be able to listen to a website like Wikipedia without having to stare at a screen.