I’ve just updated the website’s looks! 😀 I’m trying to update this site and the new header and background is the first step in that direction. I also wrote the first version of a dedicated page for my real time ray tracer project “Rateracer”, see the link at the header, and improved the sidebar.
I’m hoping this site will slowly become up to date in the following weeks as I make up for lost time. xD
Here’s to hoping someone finds this when searching the web!
I’m having problems when posting my own mouse left and middle clicks using CGEventPost under Mac OS X Lion. My left click events don’t properly switch between windows and my middle click events don’t properly open new tabs.
I’ve posted a more detailed question over at Stack Overflow but have yet to receive any answers. 😦
I got my new ocarina today! Around 9 the postman rang the door and I flew out of the bed and signed for the little package. 😀 The ocarina is quite small and fits in the palm of my hand. It came in small paper box decorated with the Focalink graphics. In the box the ocarina was inside a protective glove and there were also a paper with fingering charts.
I haven’t blogged in a loong time. But no matter, I guess no one reads this anyway. xD
Anyway, I ordered a new ocarina last Sunday. It’s the Focalink AC-A in matte black. It was sent from Taiwan on the 9th but the tracking system is refusing to tell me anything more than that thus far. 😦 I’m going crazy, I want my oc! 😛
Update: It just reached Sweden! xD I might get it tomorrow! 😀 😀
So I recently got some weird errors when doing HTTP requests in my Android game Hamster Climb. I was trying to get the input stream from a HttpURLConnection but kept getting a FileNotFoundException even though the URL worked perfectly in my desktop browser. Here’s an example, without error catching stuff, of how the code could look like:
String user = getUser();
String url = "http://somesite.com/page?user=" + user;
URL u = new URL(url);
HttpURLConnection c = (HttpURLConnection) u.openConnection();
InputStream is = c.getInputStream();
The problem was that at the last line the call to getInputStream generated a FileNotFoundException. I printed the URL that was used and tried it in the browser. Worked prefectly.
I managed to solve it though. The problem was that even though creating a URL object with the built URL string works, the URL might be broken. For example, if user is “Some guy” the url will contain a space which is not valid. Browsers solve this by automatically replacing the space with %20 which is what my browser did.
To solve this in code you use the URLEncoder class’ static method encode. This method takes a string and encodes it to a string that is ok to put in a URL. So replacing
Both here on this blog and over at the Hamster Climb site I’ve updated the information and screenshots of the game. The info now matches the currently released version and the new screenshots show more screens of the game. 🙂