Allow me to announce my latest Android game: Android Football!
I've always wanted to create a football game, and with touchscreen controls it gets round the problem that old-style football games have in deciding which football player is under control.
But before kick off, the first thing to do is choose your teams formation. One aspect I'm quite please with is the AI of the players. They always seem to be in the right place at the right time.
Once the game has kicked off, you control the players by dragging a line from the player to where you want them to go.
The players will automatically kick the ball when they hit it. The direction is determined by the angle the touch the ball at, in the same way as a game of air-hockey (though this game is thankfully not quite as frenetic!).
The free version only has friendly games, but gives you all the features of the actual match so you decide if you like the game. In the full version you can also play in a league, and choose the number of other teams. If it proves a success, I'll be adding a Knockout Tournament option to.
The trials and tribulations of an amateur game programmer. Please tell him where he is going wrong.
Friday, May 24, 2013
Thursday, May 09, 2013
I've had a great idea!
I know, I'll add the Google+ API to my game Stellar Forces! That way, new players will be able to sign up quickly and easily!
[3 hours later, after jumping through lots of Google-shaped hoops...]
What a waste of time. I think I'll keep it the way it was.
[3 hours later, after jumping through lots of Google-shaped hoops...]
What a waste of time. I think I'll keep it the way it was.
Friday, April 26, 2013
When is Normal not Normal?
Say you've got a vector that you want to normalize:-
Vector v = new Vector([a number], [another number]);
v.normalize();
What would you expect to happen if both your numbers (maybe the movement vector of your space invader) were 0?
I would hope it would return a vector of (0, 0), so that when you added this vector to your sprite's co-ords, it didn't move. Which, with a vector of 0, 0, would be correct.
Unfortunately, in Android Java (and maybe normal Java as well), it returns (NaN, NaN), which is no use to anyone. I'd prefer an error at least (failfast?) so that I knew something unexpected was happening. With NaN, all your sums suddenly go awry, and until you know the above piece of information, you'll spend ages trying to work out just how your vector is turning into garbage and why your sprite has decided to move to infinity on both axis.
Vector v = new Vector([a number], [another number]);
v.normalize();
What would you expect to happen if both your numbers (maybe the movement vector of your space invader) were 0?
I would hope it would return a vector of (0, 0), so that when you added this vector to your sprite's co-ords, it didn't move. Which, with a vector of 0, 0, would be correct.
Unfortunately, in Android Java (and maybe normal Java as well), it returns (NaN, NaN), which is no use to anyone. I'd prefer an error at least (failfast?) so that I knew something unexpected was happening. With NaN, all your sums suddenly go awry, and until you know the above piece of information, you'll spend ages trying to work out just how your vector is turning into garbage and why your sprite has decided to move to infinity on both axis.
Wednesday, March 06, 2013
Was making money harder then or now? [Android]
I'm at that common stage of Android development where I'm wondering what my next project should be. I'm tempted to do something in 3D, but it always turns into a maths nightmare. Note to self: Don't do it!
I've recently finished my last app, a platformer called "Ninja!". It's pretty good, and I might use the engine for something a little more complex - I'm thinking a Bladerunner-y / Judge Dredd. However, I am put off by the sheer number of other platform games available on Android (not that the platform genre is any more saturated than any other genre on Android). Who would even notice my game? I guess that's why marketing is so important on Android now, probably more so than the programming.
But then I look back to the golden age of gaming (in Thatcher's Britain anyway): the mid-80's, when it was predominatly the Spectrum that everyone played on (and maybe the C64 if desperate). How do conditions now compare to then? There may be thousands of platform games available for Android, but there are also millions of users playing them. What was it like in the 80's? According to Wikipedia, 5 million Spectrums were sold and 24,000 programs were released. According to some random website I found after Googling, there are 295 million Android phones and 460,000 Android apps. Despite the fact that these numbers are untrustworthy and vague, lets work out the average:-
Spectrum:-
5,000,000 devices and 24,000 programs = 208 customers per program.
Android
295,000,000 devices and 460,000 apps = 641 customers per app.
So it seems that despite the competition, we've got it over 3 times better than they did in the 80's. Still, it doesn't seem like it. Maybe I should stop programming and do marketing for the time being.
I've recently finished my last app, a platformer called "Ninja!". It's pretty good, and I might use the engine for something a little more complex - I'm thinking a Bladerunner-y / Judge Dredd. However, I am put off by the sheer number of other platform games available on Android (not that the platform genre is any more saturated than any other genre on Android). Who would even notice my game? I guess that's why marketing is so important on Android now, probably more so than the programming.
But then I look back to the golden age of gaming (in Thatcher's Britain anyway): the mid-80's, when it was predominatly the Spectrum that everyone played on (and maybe the C64 if desperate). How do conditions now compare to then? There may be thousands of platform games available for Android, but there are also millions of users playing them. What was it like in the 80's? According to Wikipedia, 5 million Spectrums were sold and 24,000 programs were released. According to some random website I found after Googling, there are 295 million Android phones and 460,000 Android apps. Despite the fact that these numbers are untrustworthy and vague, lets work out the average:-
Spectrum:-
5,000,000 devices and 24,000 programs = 208 customers per program.
Android
295,000,000 devices and 460,000 apps = 641 customers per app.
So it seems that despite the competition, we've got it over 3 times better than they did in the 80's. Still, it doesn't seem like it. Maybe I should stop programming and do marketing for the time being.
Monday, February 11, 2013
New Android Game: Ninja!
It's a platformer. Avoid the enemy ninjas (or throw shurikens at them) and negotiate the fiendish levels.
One of the great things about creating a "platformer engine" is that once it's created, it's simply a case of having fun designing levels. Going through historically classic platformers and implementing your own version of their ideas, and being able to play it straight away, makes all the hard work worthwhile.
I've also written the code for moving platforms, but I'm still trying to work out how to include them in the map data; the map data only handles a block type in each "cell", whereas moving platforms require data on the direction to move in, and the distance. More on that in a future post.
Anyway, find Ninja! here!
Tuesday, February 05, 2013
Eclipse Hangs or Freezes on Startup
Try this:-
- cd .metadata/.plugins
- mv org.eclipse.core.resources org.eclipse.core.resources.bak
- Start eclipse. (It should show an error message or an empty workspace because no project is found.)
- Close all open editors tabs.
- Exit eclipse.
rm -rf org.eclipse.core.resources(Delete the newly created directory.)mv org.eclipse.core.resources.bak/ org.eclipse.core.resources(Restore the original directory.)- Start eclipse and start working
Monday, November 12, 2012
Installing Java for Applets
I've blogged before about the fact that Sun (and now Oracle) like to make it as difficult as possible to get Java working, especially for applets. You can spend hours trawling the new for soutions, but often they don't work due to differing versions of your OS, of Java and your browser.
However, for future reference I've found this page which seems to wort and is incredibly simple:-
However, for future reference I've found this page which seems to wort and is incredibly simple:-
http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
Wednesday, November 07, 2012
Julian Gollop Announces New Chaos
If you're a fan of Chaos then you probably already know this, but Julian Gollop, famed developer of strategy games, has announced he's working on a new version of Chaos.
Chaos is indeed a brilliant game; that's just one reason why I copied it so faithfully for my own Sorcerers for Android. I hope Julian won't mind if I treat this as a bit of competition between us as to who can create the best game. I'm bound to lose, but it's the kind of impetus I need to keep working on a game. And there can be no losers!
Chaos is indeed a brilliant game; that's just one reason why I copied it so faithfully for my own Sorcerers for Android. I hope Julian won't mind if I treat this as a bit of competition between us as to who can create the best game. I'm bound to lose, but it's the kind of impetus I need to keep working on a game. And there can be no losers!
Friday, November 02, 2012
Speed Warning
Here's a new app which will hopefully save me money from those annoying speed cameras.
Without wanting to get too political on this blog, what really gets me about being caught for speeding is that it's too easy to creep over the speed limit. Staying on the right side of the law shouldn't be a test of skill, and the more time you spend looking at your speed dial, the less time you spend looking out the window to check you're not going to crash, which can't be right.
Anyhoo, either way, my new Speed Warning app for Android should help and save people from the usual speeding fines. It sits on your dashboard and will show you your current speed, in either Miles per Hour or Kilometres per Hour, depending on what your country uses.
The main feature however, is to give you a visual and audible warning should your speed creep over the limit you have set, which can be easily adjusted with the '+' or "-" icons. So now you can keep your eyes on the road at all times without worrying if you're breaking the law.
Without wanting to get too political on this blog, what really gets me about being caught for speeding is that it's too easy to creep over the speed limit. Staying on the right side of the law shouldn't be a test of skill, and the more time you spend looking at your speed dial, the less time you spend looking out the window to check you're not going to crash, which can't be right.
Anyhoo, either way, my new Speed Warning app for Android should help and save people from the usual speeding fines. It sits on your dashboard and will show you your current speed, in either Miles per Hour or Kilometres per Hour, depending on what your country uses.
The main feature however, is to give you a visual and audible warning should your speed creep over the limit you have set, which can be easily adjusted with the '+' or "-" icons. So now you can keep your eyes on the road at all times without worrying if you're breaking the law.
Wednesday, October 24, 2012
Podcast Manager

I listen to a lot of podcasts. They make driving much more fun; now, when I hit a traffic jam, I think "Great, I can listen to more comedy before I get to work!". (This probably sounds sarcastic, but it's true).
I was yet to find a decent podcast manager on Android, so I decide to create one. All the other ones seemed too complicated; all I wanted was one that would let me easily find the podcasts on my phone and play them, but have lots of convenience features like let me return to the same point in a previously played podcast as it was when I last stopped playing it.
With this in mind, let me present Podcast Manager, and android Podcast player with all these features and more:-
* Scans your SD Card for all mp3s.
* Voice search
* Reads and displays the details of your podcasts (artist, album, etc...)
* Remembers previously played podcasts and the last position, so you can pick up exactly where you left off.
* Delete listened-to podcasts.
* Easily browse your phone's memory for podcasts.
* Easy to use interface for skipping through podcasts.
If you have to get it, let me know what you think and I'm always open to feature suggestions. But at the moment it does everything I want from a Podcast player.
Tuesday, October 23, 2012
Minecraft + 3D Printer?
You read it here first - I predict that in the future you will be able to connect Minecraft to a 3D printer and print out a model of the worlds that have been created. And I predict the first person to do this will get very rich. And there will be a shortage of 3D paper since everyone insists on printing out the Mines of Moria.
(I also predict that someone will tell me this has already happened).
(I also predict that someone will tell me this has already happened).
Friday, July 27, 2012
New App: Sorcerers
Like every other human being on the planet, I am a big fan of most Julian Gollop games, and the pinnacle of these are obviously Laser Squad and Chaos. I've "tributed" Laser Squad with Stellar Forces, and now it's time for some Chaos.
My new app is called Sorcerers. Like Chaos, it's a multi-player game where each player takes control of a wizard. Each wizard has some spells which they must use to destroy the other wizard, and the winner is the last wizard left standing. The spells range from fantasy creatures like a Wraith or Golden Dragon, to Magic Fire and of course Turmoil and the dreaded Gooey Blob.
There are a few changes to the original: there are more variety of spells, and turmoil doesn't crash the game. It's currently 2-player, but will be increased soon to up to 4 player.
My new app is called Sorcerers. Like Chaos, it's a multi-player game where each player takes control of a wizard. Each wizard has some spells which they must use to destroy the other wizard, and the winner is the last wizard left standing. The spells range from fantasy creatures like a Wraith or Golden Dragon, to Magic Fire and of course Turmoil and the dreaded Gooey Blob.
There are a few changes to the original: there are more variety of spells, and turmoil doesn't crash the game. It's currently 2-player, but will be increased soon to up to 4 player.
Thursday, July 26, 2012
Jellybean Graphics Bug - Help!
There's a really annoying bug in Jellybean, and I can't work out how to get round it, so I'm posting it here in case someone else has come across it and knows a solution:-
I've got two .png images in my app, both identical except for the name and I've changed one of them to be "bluer" (using Gimp). However, Jellybean refused to draw the bluer one. (I'm having trouble with other random images as well). There are no errors, and it loads the file okay, but nothing appears. I've tried swapping their names. They're both only 57x57 pixels, so it's not a memory issue.
Someone else has posted the same problem on Stack Overflow, but as of now there are no replies.
It's driving me mad! How can something broken like this end up being released onto millions of mobile phones?
UPDATE: I've found a workaround! Copying my images into /drawable-nodpi, seems to have solved it.
I've got two .png images in my app, both identical except for the name and I've changed one of them to be "bluer" (using Gimp). However, Jellybean refused to draw the bluer one. (I'm having trouble with other random images as well). There are no errors, and it loads the file okay, but nothing appears. I've tried swapping their names. They're both only 57x57 pixels, so it's not a memory issue.
Someone else has posted the same problem on Stack Overflow, but as of now there are no replies.
It's driving me mad! How can something broken like this end up being released onto millions of mobile phones?
UPDATE: I've found a workaround! Copying my images into /drawable-nodpi, seems to have solved it.
Wednesday, July 25, 2012
Free Service?
One thing that is starting to annoy me is the number of services that start out free, but then as soon as they become popular they introduce paid-for features while slowly reducing the free features until they are virtually useless.
The stock response to this is "well, it's free, what do you expect?". However, this oversimplifies the issue and ignores all the other aspects of the problem. Most important of these is that I've recommended these services to others, thus giving the free service its userbase. My comments on these services are still on the internet, but I wouldn't recommend them now. I've also spent my own time incorporating their service into my apps and my time isn't free. Their services are now so entwined in my apps that it's going to take me lots more time to remove them and find alternatives.
I've got no problem with these services charging for extra features, but reducing the features that were there originally is almost tantamount to blackmail.
The stock response to this is "well, it's free, what do you expect?". However, this oversimplifies the issue and ignores all the other aspects of the problem. Most important of these is that I've recommended these services to others, thus giving the free service its userbase. My comments on these services are still on the internet, but I wouldn't recommend them now. I've also spent my own time incorporating their service into my apps and my time isn't free. Their services are now so entwined in my apps that it's going to take me lots more time to remove them and find alternatives.
I've got no problem with these services charging for extra features, but reducing the features that were there originally is almost tantamount to blackmail.
Friday, June 01, 2012
Your First Java Library Function
The first thing to do when you start creating your own library of Java functions is to write a wrapper for Integer.ParseInt() (and any of the other similar built-in functions).
Integer.ParseInt is, maybe deliberately, the most pedantic piece of code ever written. Pass it a string like "2" and it works fine. Pass it a string like " 2" and it goes "waoh! A space? What the f*ck is that?? Error! Crash the system, we're going down!!". Is it too much to ask to be able to handle a space?
In fact, almost any non-numeric character (the main exception being a "minus") in the string will cause it to throw a wobbly. Even a decimal point: "2.0" is beyond its capabilities.
My suggestion is as follows, although it's not the hardest piece of code to write:-
}
return Integer.parseInt(s.trim());
} catch (java.lang.NumberFormatException ex) {
return 0;
}
}
Integer.ParseInt is, maybe deliberately, the most pedantic piece of code ever written. Pass it a string like "2" and it works fine. Pass it a string like " 2" and it goes "waoh! A space? What the f*ck is that?? Error! Crash the system, we're going down!!". Is it too much to ask to be able to handle a space?
In fact, almost any non-numeric character (the main exception being a "minus") in the string will cause it to throw a wobbly. Even a decimal point: "2.0" is beyond its capabilities.
My suggestion is as follows, although it's not the hardest piece of code to write:-
public static int ParseInt(String s) {
try {
if (s == null) {
s = "0";
} else if (s.length() == 0) {
s = "0";try {
if (s == null) {
s = "0";
} else if (s.length() == 0) {
}
return Integer.parseInt(s.trim());
} catch (java.lang.NumberFormatException ex) {
return 0;
}
}
Monday, May 28, 2012
MySQL Replication Challenges
If you've got a server running MySQL that's creaking under the weight of database reads, the obvious solution is to set up replication. MySQL replication seems to work fine, but one thing I didn't appreciate at first is the changes that probably need to be made to your code (and not just changing which server it reads data from).
I imagine that most web pages, if they're anything like mine (oh dear) implicitly rely on the database being updated immediately. My web pages usually have a similar structure:-
1: Read any get/post values and update the database
2: Display the new updated data as part of the web page
This seems fine, and it is if your database is updated immediately (since stage 2 is reading the data that has just been changed by stage 1). If you're using replication, then you'll be updating the master database in stage 1, but then reading the data from a slave for stage 2. However, if the slave hasn't updated itself from the master by the time stage 2 is running (and we're probably only talking millionths of a second) then stage 2 will display old data, and your users will cock their head to side wondering what's going on and why the system has ignored their commands.
Another similar problem I experienced is with an automatic routine that transfered data from one table to another. For various good reasons, this routine would read the first 100 records (from the slave, obv), append them to another table, and then delete the originals (on the master). And this worked fine until there was a small glitch in the communication between the master and slave. Glitches in communication aren't normally a problem since you can specify how long the master retains logs for, so you can turn a slave off for a few days, turn it on, and it will (eventually) update itself.
However, due to the glitch, the slave wasn't updating itself. It read the first 100 records from one table (on the slave), wrote them to another table (on the master), and then deleted the records from the original table (on the master). Since it was reading the records from the (non-updating) slave, the next 100 records it read were the same 100 records as last time, because they were still there.
Being an automatic routine that runs overnight, this process was duplicating identical records at a hysterical rate, eventually eating up all the disk space and so the whole system went down within just a few minutes. Oh dear.
So, in summary, replication technically works very well, but you can't just plug it in and turn it on and expect all your problems to be solved. You probably need to think carefully about when to read from the slave or master, and what will happen if the slave is too far behind the master.
I imagine that most web pages, if they're anything like mine (oh dear) implicitly rely on the database being updated immediately. My web pages usually have a similar structure:-
1: Read any get/post values and update the database
2: Display the new updated data as part of the web page
This seems fine, and it is if your database is updated immediately (since stage 2 is reading the data that has just been changed by stage 1). If you're using replication, then you'll be updating the master database in stage 1, but then reading the data from a slave for stage 2. However, if the slave hasn't updated itself from the master by the time stage 2 is running (and we're probably only talking millionths of a second) then stage 2 will display old data, and your users will cock their head to side wondering what's going on and why the system has ignored their commands.
Another similar problem I experienced is with an automatic routine that transfered data from one table to another. For various good reasons, this routine would read the first 100 records (from the slave, obv), append them to another table, and then delete the originals (on the master). And this worked fine until there was a small glitch in the communication between the master and slave. Glitches in communication aren't normally a problem since you can specify how long the master retains logs for, so you can turn a slave off for a few days, turn it on, and it will (eventually) update itself.
However, due to the glitch, the slave wasn't updating itself. It read the first 100 records from one table (on the slave), wrote them to another table (on the master), and then deleted the records from the original table (on the master). Since it was reading the records from the (non-updating) slave, the next 100 records it read were the same 100 records as last time, because they were still there.
Being an automatic routine that runs overnight, this process was duplicating identical records at a hysterical rate, eventually eating up all the disk space and so the whole system went down within just a few minutes. Oh dear.
So, in summary, replication technically works very well, but you can't just plug it in and turn it on and expect all your problems to be solved. You probably need to think carefully about when to read from the slave or master, and what will happen if the slave is too far behind the master.
Thursday, May 17, 2012
Recording Videos of my Android Apps
If there's one thing I've learnt (or learned - which is it?) over the last month, it's that people like to be able to see what an Android app looks like before they hand over any hard cash. I recently created a video of a few of my apps: Chromakey Photo Edit, Worldcrafter and Stellar Forces. And blow me down with a feather if sales and/or downloads didn't increase!
So how did I create the videos? I do have access to two phones, both of which are capable of recording videos, so the obvious answer was to use one phone to record another. However, keeping both phones steady while recording and playing was harder than I thought; the phone that is recording doesn't need to be held by a person, but it does need to be positioned between the player ("hello") and the phone I'm playing on. Asking a fellow human to hold the recording-phone tends to feel a bit ridiculous as they have to reach around you and keep the phone super-steady, which isn't that easy.
The solution hit me like a birthday present when, for my birthday, I got a present that turned out to be a phone holder for my car. Perfect! Its suction cup held it securely to a table while I played the games around it. The only challenge now is to make a vaguely entertaining video that's short but also shows off the best features of the games. And also where my thumb isn't always in the way.
Here's the Worldcrafter one:-
Since the game involves tilting the phone, that provided an extra challenge for keeping the phone in-view.
So how did I create the videos? I do have access to two phones, both of which are capable of recording videos, so the obvious answer was to use one phone to record another. However, keeping both phones steady while recording and playing was harder than I thought; the phone that is recording doesn't need to be held by a person, but it does need to be positioned between the player ("hello") and the phone I'm playing on. Asking a fellow human to hold the recording-phone tends to feel a bit ridiculous as they have to reach around you and keep the phone super-steady, which isn't that easy.
The solution hit me like a birthday present when, for my birthday, I got a present that turned out to be a phone holder for my car. Perfect! Its suction cup held it securely to a table while I played the games around it. The only challenge now is to make a vaguely entertaining video that's short but also shows off the best features of the games. And also where my thumb isn't always in the way.
Here's the Worldcrafter one:-
Since the game involves tilting the phone, that provided an extra challenge for keeping the phone in-view.
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]
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.
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!
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!
Subscribe to:
Comments (Atom)

















