Anonymous asked: I believe I figured out a fix for the R.java in Eclipse for development on PPC macs.
If you have a fix, I’d gladly republish the answer and credit you.
If you have a fix, I’d gladly republish the answer and credit you.
I have not seen a fix to the emulator issue, I’ve been loading the apk to the device manually after build.
Let’s assume you’re here because your development PC or Intel Mac is down right now, either due to hardware failure, maintenance, or some other catastrophic sort of event.
You decide: “Hey, I’ve got a PPC Mac, I could do Android dev on it instead.” But, then you remember that Apple and basically everyone else has now left PPC computers to wither and die, and generally get outdated. Google included.
You will most likely will be told to go compile packages from source using ever increasingly cryptic and long commands on the terminal. Assuming the source is available, you’ve got about a 50% chance that it will actually compile and a 10% chance that it will actually work if it does compile. If it doesn’t compile, you’ll find yourself fiddling with pieces of code in the source package to try to get it to compile, which has about a 2% chance of working if you know what you’re doing, almost no chance if you don’t. And all the while, getting more and more frustrated.
Right. Let’s skip that bit.
Firstly, you’ll want Eclipse. Luckily, the Eclipse team hasn’t forgotten OS X PPC. They’ve got a Carbon package right on the downloads page. Here it is: Eclipse Indigo Carbon Mirrors
Select a mirror below and allow the file to download.
Second, you want the Android SDK. Unfortunately, they only have Windows, Linux, and Mac OS X (Intel) listed. This is a lie (sort of.) Download the Mac OS X (Intel) SDK Package.
Move the zips from your download folder to where you want (that you have write access to).
Extract the zips. I just double clicked them with Stuff-It.
Go into the Android folder. Double click the tools folder. Goto the lib folder. Rename the folder X86 to ppc. Go back one folder and double click the script that’s called android. Android SDK and ADV Manager will pop up after a terminal box.
In the Android SDK and ADV Manager, click Settings. Click the Force https checkbox. A dialog will pop up saying it’s Fetching. This box may end with an error about adv. Click close on it if it doesn’t close itself.
Click available packages and select the packages from the SDK you wish to install. I just installed the entire android repository and the google, inc. third party addons.
When you’re finished selecting packages, click the install button to the lower right. This may take awhile depending on how many boxes you checked and this box may too end with an error about adv. If it does, just click close.
Once finished, close the Android SDK adn ADV Manager. Then open your eclipse folder. Double click the eclipse executable and it will start right up. There is now some configuration needed before we can continue.
First we need to download the android developer tools for eclipse. On the Finder Bar, click Help -> Install New Software. In the box that says Work With, paste this URL.
https://dl-ssl.google.com/android/eclipse/
And click Add. Type Android as the name and click OK. The pane below will refresh and have a group of packages called developer tools. Check the developer tools box and click Next. When it is finished, press the finish button. Eclipse will ask to restart. Allow it to do so.
Next time eclipse opens, on the Finder Bar, press Eclipse -> Preferences, or simply (⌘+,)
Click the Android option. In the SDK Location box, it is blank, so click the browse button to the right of it and navigate to the android sdk directory (just the base directory, no further).
Click OK then hit the Apply button. The list of available SDK versions will be populated. Select your target version, then hit apply again and hit OK.
Under the file menu, select New -> Other. Expand the Android tree and select Android project. Put in the name, select your target android version, and put in a package name, then hit finish.
In your code files, delete all references to R.java. Unfortunately R.java isn’t generated for some reason I haven’t discovered yet. So you’ll have to either manually build your activity instead of using layout files or manually inflate your layout files.
When you want to build your project, press play. But the emulator won’t run. You’ll have to put the jar on the device manually and monitor events and exceptions on the device manually as well.
Looking for a workaround on these issues.

All I have to say to begin with is ARGGGGGGGG!!!!!
The above picture shows my disappointment with the cabalized SDL installation process with Haskell on Windows.
As an installation with cabal is usually a dream, let’s get to how I’ve gotten this far.
I’m making a game with Haskell. I was originally going to use C# and the XNA framework, but due to portability reasons and how friggin’ cool Haskell is, I decided to use it instead. I began by writing some useful things I’ll use ingame. This afternoon I decided I’d had enough of the inner functions written that I should go ahead and mock up a UI to test many of them. The options for Haskell graphics library are OpenGL and HSDL. So, I looked into OpenGL first, but had subsequently decided it wasn’t right for this project. Cue SDL. Simple for my simple graphics. I decided to go with SDL, so I fired up my terminal in Linux and used “cabal install sdl”.
Like it should, it installed just fine. After running a few test programs, I confirmed my choice to myself and rebooted into Windows to install it there. Windows, after all, was where I had my current code stored. When I got to Windows, I opened a command prompt and typed “cabal install sdl”, the installation errored out, claiming I hadn’t had SDL installed on my system.
I went to libsdl and downloaded SDL, then stuck it in C:. cabal and still the same thing. So I checked online. It didn’t seem like I was having an isolated issue, but, there weren’t that many answers floating around.
First, I checked a site that recommened I copy the contents of include into MinGW’s include. No dice here. Then I checked a site that told me to download the package from hackage and modify the cabal build file and make sure that my SDL folder was on path. Did that. Failed. This time it told me that I must be on a MinGW or MSYS command prompt, so I switched to MinGW. Still failed. Then I checked a file called WIN32 inside the haskell SDL distribution. Which were almost identical to Win32, with only slight differences. This failed too, but it told me that SDL.h was not on path.
What I’ve found is that most SDL installation tutorials for Haskell are slightly outdated and the only sure fire method is as follows.

On my deleted posts, I had reference to an adventure in game programming. This post was enthusiastic and full of both optimism for the project and pessimism in knowing that I would be abandoning it before I actually got any work done on it.
Yearly I enter a contest called DreamBuildPlay. DreamBuildPlay is a video game programming contest sponsored by Microsoft. It tests the core of the indie developer community and giving away prizes in the process. It is speculated that this is all a ruse and that the real purposes behind DreamBuildPlay are secret talent scouting and acquisitions. In any case, I have failed to enter the competition with even a demo every year since 2007.
That said, I’m starting a new XNA project not intended for DreamBuildPlay. It is also not going to be available for public use. It’s not even going to be a game. Instead, I’m writing an animation program. Mostly, this is so I can make cartoons. Why I don’t draw cartoons by hand or otherwise digitally is another issue that I won’t cover here, except this statement: I’m terrible at drawing.
The first thing I found when I started this project is that I needed some sort of user interface in the XNA windows. There is an interface on a particular game client that I like. Valve’s Steam platform has a very nice overlay user interface. So I wanted to create something similar. The first things that I needed to do was define a way to make it easy to make overlays. So I created an Overlay class. These overlays needed to house controls, so I needed to define what a control was. Thus, the Control class was created. Then I wanted to make a “Handlebar” for an overlay window to create a Form class. But then I got to thinking, the Handlebar for the Overlay needed to house controls too. So I would need a generic Container class to inherit from. So I stepped back and rethought my design.
What really surprised me is that my class design down to the Form level is almost identical to Microsoft’s own Form inheritance.
What I figured was:
A Control defines some basic elements. Location, Width, Height, Foreground, and Background color, etc. It should also have a rectangle definition so we can see if it intersects anything. Naturally, if the Location or Width or Height should change, it should change the rectangle. A control should define such events as OnClick.
A ControlContainer should be a Control too, so it inherits all of Control’s properties. But, it should also house a List of controls (List
Since a HandleBar should house controls ( hide button, save button, etc), it should be a ControlContainer. But a HandleBar should also be able to house a single string of text, for the title text. It also should force it’s Controls to be draw horizontally.
So far, this is about all I have, but as soon as I can get all this user interface design done, it should be a breeze to do the actual animation work (not).

I’ve been on and off learning Haskell for a week now. Even though I hadn’t gone through a single tutorial, I estimated that it was time to try my skill at writing something trivial. In my lua experiences, I had found a lot of difficult things to do within the realm of binary operations, so I wrote a couple functions to do with binary conversion to and from different bases.
Here are the fruits of the adventure so far.
b2b64 fx fy b =
head [ fy x | x <- [
("000000","A"), ("000001","B"), ("000010","C"), ("000011","D"), ("000100","E"), ("000101","F"), ("000110","G"), ("000111","H"),
("001000","I"), ("001001","J"), ("001010","K"), ("001011","L"), ("001100","M"), ("001101","N"), ("001110","O"), ("001111","P"),
("010000","Q"), ("010001","R"), ("010010","S"), ("010011","T"), ("010100","U"), ("010101","V"), ("010110","W"), ("010111","X"),
("011000","Y"), ("011001","Z"), ("011010","a"), ("011011","b"), ("011100","c"), ("011101","d"), ("011110","e"), ("011111","f"),
("100000","g"), ("100001","h"), ("100010","i"), ("100011","j"), ("100100","k"), ("100101","l"), ("100110","m"), ("100111","n"),
("101000","o"), ("101001","p"), ("101010","q"), ("101011","r"), ("101100","s"), ("101101","t"), ("101110","u"), ("101111","v"),
("110000","w"), ("110001","x"), ("110010","y"), ("110011","z"), ("110100","0"), ("110101","1"), ("110110","2"), ("110111","3"),
("111000","4"), ("111001","5"), ("111010","6"), ("111011","7"), ("111100","8"), ("111101","9"), ("111110","+"), ("111111","/")],
fx x == b ]
b2h fx fy b =
head [ fy x | x <- [
("0000","0"), ("0001","1"), ("0010","2"), ("0011","3"), ("0100","4"), ("0101","5"), ("0110","6"), ("0111","7"),
("1000","8"), ("1001","9"), ("1010","a"), ("1011","b"), ("1100","c"), ("1101","d"), ("1110","e"), ("1111","f")],
fx x == b ]
convert ff fx fy fl b =
if b == "" then
""
else
ff fx fy (take fl b) ++ convert ff fx fy fl (drop fl b)
binary2Base64 b = convert b2b64 fst snd 6 b
base642Binary b = convert b2b64 snd fst 1 b
binary2Hex b = convert b2h fst snd 4 b
hex2Binary h = convert b2h snd fst 1 h
Yep, binary conversion to base64 or hex and back again. Pretty neat stuff!

For those of you who have yet to experience or even know about Lua, it is a general purpose scripting language. It has a rich feature set, but cuts many of the normal fatty helper functions out, keeping it a nice size for embedding purposes. If you would like all the bells and whistles of a typical language, there are luarocks available for installation that expand the functionality. One such example is the bitlib module. It’s sort of like a magnificently small CPAN.
Lua doesn’t support object oriented programming in a traditional sense, though most things you can do in OOP are available in Lua in some form or another. It’s similar to Javascript in that it supports prototyping, but it’s also like Python, in that it uses tables (see Lists in Python) to do many tasks.
I went turned to the Internet recently to search for a good pure Lua binary and hex library with hmac-sha1 support. The restrictions I was under were such that I could not use luarocks modules. This is because it’s a custom implementation of Lua embedded in a game engine (Garrys Mod’s Lua on the Source engine).
I came across a couple of libraries online. The first was Jeffrey Friedl’s sha1.lua. He’s starts off by saying “Lua is a pathetic, horrid, turd of a language”, citing that he associates with it only because of writing Adobe Lightroom plugins.
I will begin to say, I have no experience writing Adobe Lightroom plugins. I, in fact, don’t even own any creative suite programs, however, I do wholly disagree with his views on Lua. There is also a fair bit of hard coding in his library. Not that there wasn’t in the initial versions of my library. I’m thinking the reason for this was optimization in speed through the use of predefined lookup constants. The hmacsha1 implementation worked perfectly fine. In any case, his library was deemed by me to be unfit for my use, due to his statements of retaining full copyright inside the code files, and not issuing it with an open source license, which meant he could revoke license to use the routines at any time(not that it’s any secret how sha1 or hmac work). It should be noted that his personal log doesn’t fully match his sentiments or harshness about Lua. He states: “I felt quite the achievement once I got it working”, but quickly shifts back into a negative attitude saying “… then realized that I also need to code up my own HMAC-SHA1 secure signature routine”, then back to the positive with “It’s less involved than the original SHA-1 stuff, but again, filled with bytewise xors. Fun stuff, in a very old-school way.”
The second library I found was not complete to my liking and the license still lacked, so I created my own. This went through about 20 revisions. I got sha1 to work and hmac too, though failed to implement md5, sha256, sha512, and XXTEA. I thought this was due to my default zero padding and my lack of automatic truncation to a specific length that was holding the library back. So I’ve rewritten it, a third time. (One of the early revs on the svn was a complete rewrite removing much of the hard coding). However, for now my SHA1 is broken again on the branch off and I don’t have all the nice functions and hacked operators I used to. The point is if you really need something, there is nothing stopping you from writing it. You may just find yourself having some fun along the way.
I recommend that if you’ve been itching to try Lua, find a reason. Try my library if you like. rev17 has working SHA1, HMAC, all the binary functions you could want, including operator hacks for many of the multiple argument ones. Use the test file to see it work. It should be noted, however, that md5 or sha256 aren’t working yet, so you should not rely on them. (nor should you rely on MD5 in the first place, but that’s another topic all together.)
The newer, much cooler FakeBitOps library will come out as soon as I can get it working with SHA1. It includes much more asserting, much more type checking, many more defaults, a large scale condensing of many functions (BinAnd, BinOr, BinXor, HexAnd, HexOr, HexXor are now all one function for example). Improved hex support (now supporting pure number operations, as well as string derived hexstrings. Implicit conversions between binary and hex are available in binary or hex specific functions.
FakeBitOps: (my library) http://code.google.com/p/adorablebin/
Thanks for reading.
I came back to Tumblr. Before my Tumblr account was based around my ning network brand. But since Ning didn’t do free anymore, I deleted it. Since Tumblr brought a whole new official android app to the market, I decided to rejoin and reopen a blog, since I believe Tumblr to be the richest set of blogs I’ve seen on the Internets.
This blog will mainly focus on programming, but may deviate into hardware or philosophical issues around software every once and awhile.
Happy reading. I’ll be posting some Lua stuff about my binary module soon.