WoWHorn version 1.0 is written with PR3 of Titanium.
As with any new technology this experience was a little bumpy.
This post will discuss some of those bumps, both those that involve Titanium and those that do not.
For those needing more information on either of these technologies, visit:
WoWHorn’s Home Page
Titanium’s Home Page
Read on….
WoWArmory and FireFox:
The first thing that caught me was getting the XML for WoW’s achievements.
Not only are there ten different sheets to grab for the achievements, not all browsers just grab the xml.
By specifying the information to feed the site about the ‘agent’ that is contacting it, you can get the proper results.
In this case, if you tell WoWArmory that you’re using Firefox, you can get the xml sheets out of it.
This technique works both in Javascript and in Ruby (as well as other langages).
Thanks to Quick Armory (among other places) I was able to find this out.
We use this agent: ‘User-agent’: ‘Mozilla/5.0 (en-US; rv:1.8.1.3; IJustWantXML) Gecko/20070309 Firefox/2.0.0.3′.
Titanium and Ruby:
Titanium allows for the usage of Ruby together with your normal web development tools of HTML/CSS/JavaScript.
Unfortunately there are issues using classes in this environment for PR3. The Ruby code has a habit of losing access to the JavaScript’s window and thus losing communication with the rest of the program. This issue is being worked on and will hopefully be smoothed out soon.
The work around? Don’t use classes.
Ruby functions are directly callable in the Javascript of the page if they aren’t inside of a class.
Even though the Ruby here isn’t that heavy, the functions call each other and were meant to be in a class. So it felt a little strange to have these ‘free floating’ functions.
Titanium and Ruby: The Major Error:
The strangest problem I’ve had with Titanium and Ruby is a new one. The Titanium development team is now aware of it and diligently looking into a fix for it.
This issue is that systems that do not have a local copy of Ruby installed on them crash when calling the ruby code of WoWHorn, specifically the XML gathering script. It is quite strange and, of course, not as intended as Titanium has its own Ruby build with it.
So the current work around for this is to install a local copy of Ruby.
Ruby & XML (x10):
An issue I’ve found with gathering all these XML files is that it takes some time.
As I was running late on this initial release, I didn’t push to fix it when the rest of the application did not run at all.
Thanks to being able to use Ruby with Titanium, I will be able to separate these calls into threads to speed it up.
SQLite:
Titanium uses Webkit so has access to SQLite.
Though I didn’t have too many problems feeding data into SQLite, I did keep getting errors with database locks.
So a note for anyone using SQLite, it likes to lock but really only uses explicit locks on writes.
If you’re encountering a lot of lock errors, check any kind of loops you may have. When I moved from a single file to all ten files, I forgot where my openDB function was and I was trying to reopen the database for every page. SQLite did not like that.
Javascript:
Thanks to some heavier needs for Javascript and some instruction/help from Keeto from Keetology, I have found that JavaScript isn’t just that nifty little language that helped with some effects back in the 90′s.
The object code for javascript is nice and I like the way it works. It is still a bit confusing to me, though.
I had a lot of problems with errors caused by variable scope, variable naming, syntax, and general typos.
This wouldn’t normally be an issue except for, due to calls to the Titanium framework, I couldn’t use the tools I am used to for finding these errors (names the FireFox error console).
I was finally pointed to the console section of the web inspector to help find these. Webkit’s web inspector is not a tool I’m used to so it will take some time for it to feel smooth to me.
Paths:
Knowing your current wording directory isn’t quite as simple as it used to be when using Titanium.
For instance, when you’re testing an application out via Package and Launch, your current working directory is the Titanium Developer directory, sometimes.
This is easily fixed, however, by using the path ‘app://’ to refer to your application’s Resources directory.
If the language you’re using can’t find it, like Ruby won’t, you can use the Titanium modules to help locate it with: Titanium.App.appURLToPath(‘app://’).
Finally:
Though it had its bumps, designing with Titanium has been pretty fun.
Of course I could have approached the program with only one language, such as JavaScript only, but Titanium lets me use what I want so it is my decision to decide what I want to use or what is best for the situation.
I expect Titanium to become even more friendly to other languages as well as smoother to find usage information about than it is now in PR3.
Awesome!!