Rich Cross-Platform Desktop Applications Using Open-Source Titanium
Enough theory—it's time to get our gloves out and start working with Titanium. First, download the latest version of Titanium from titaniumapp.com/download, and execute the package:
$ chmod +x Titanium-PR3-SDK.bin $ ./Titanium-PR3-SDK.bin
You'll be greeted by a window containing the License Agreement; click I Accept to continue. Wait for the installer to finish, and the next thing that pops up on your screen is the second tool that you'll use the most while developing applications for Titanium (aside from your favorite text editor): the Titanium Developer.
Titanium Developer is the main tool you need for developing Titanium applications. It features several tabs for different purposes, ranging from packaging your app, managing projects and discovering cool stuff from other developers (Figure 1).
The first tab is Projects, which helps you manage your Titanium projects. Here you can create new projects, run them for testing and package them for distribution (Figure 2).
The Sandbox is a very useful tool for testing code without having to create a new project. To see it in action, try typing the following snippet of code into the text area on the Sandbox tab, then press Launch (Figure 3):
<div id="output"> </div>
<script>
document.getElementById('output').innerHTML
= "Hello World from Titanium";
</script>
Congratulations! You just launched your first Titanium application via the Sandbox. Titanium Developer takes the snippet of code and launches a Titanium app using that code. On the side of the text area for the snippets, there are buttons for popular JavaScript frameworks. You can click one of those to add them to your sandbox application for testing instead of having to include them yourself.
The next tab, Apps, is a tool for discovering other awesome Titanium applications. Titanium enables you to distribute your applications easily via a distribution and packaging cloud. Every app that's packaged as public will be featured in the Apps tab, making it easier for you to share and distribute applications to your users (Figure 4).
Up to this point, Titanium Developer probably seems like any other development tool. You use it to create new projects, test them and package them for distribution—normal development stuff. But it goes beyond that. Titanium Developer isn't merely a development tool, it's a social development tool. Social development harnesses the power of social media for engaging, learning and collaborating with a global community of developers. That's why Titanium Developer contains two other tabs: Community and Feeds.
The Community tab contains a full IRC client that connects to the official Titanium IRC Channel, enabling you to talk to other developers, get help with tricky code or even share tips and tricks. The Feeds tab features live Web feeds from Twitter and FriendFeed regarding Titanium, so you'll be up to date about everything that's going on with the platform. The same tool that you use to create, package and deploy projects is also a tool that connects you to the worldwide community of developers working with the same platform as you (Figure 5).
And, the best thing about Titanium Developer? It's actually built using Titanium.
It's easy to create new projects using Titanium Developer. The Projects tab takes you step by step into creating a new project. The first step asks you which JavaScript libraries you'd like to add to your project. You can add libraries by clicking on their logos, and you also can opt out by not clicking any. For this example, try adding MooTools.
Next, you need to input information about your project. Type anything you want for the Project Name, Project Description, Publisher Name and Publisher URL fields. For the Project Location, click on the small folder icon on the side of the text field, and select the directory on your system where the project will be placed. Finally, you need an icon for the project, so click on the small folder icon on the side of the field for Application Image, and browse for an image file. Click Create Project.
The Project tab now displays your project on the list and some project information on a window on the right. This window has three tabs: the first one displays your project's information, the second one displays links to your application packages, and the third one displays distribution and download statistics for your application (Figure 6).
Select the project in the list, and click on the small box icon. This brings you to the Packager where you can run, package or install your application. Click on the Package and Launch button to launch your newly created project.
You now have your first project, but it doesn't really do much at this point. So, open your file manager and navigate to the directory you selected for the Project Location when you created your project.
Inside your project directory, you'll see several files and directories (Figure 7):
dist: the directory where Titanium Developer stores your packaged app so you can launch it for testing.
manifest: a file used by Titanium to determine settings for packaging your apps, like your app's information as well as settings and versions of the modules you're using on your application.
tiapp.xml: the descriptor file for the application. This is used by Titanium to determine settings before running your application, such as settings for the initial window, version information and copyright information.
Resources directory: where all your application files are stored—your HTML pages, stylesheets and scripts all should be kept here.
Titanium is very lenient when it comes to the structure of the Resources directory. You can create subdirectories to structure your project in any way you want, depending on your style.
Now, open the index.html file inside the Resources directory with your favorite editor. It should look like this:
<html>
<head>
<style>body{background-color:#292929;color:white}</style>
<script type="text/javascript" src="mootools-1.2.1.js"></script>
</head>
<body>
Welcome to Titanium
</body>
</html>
As you can see, it's just a simple HTML page, and Titanium Developer already included a link to the MooTools script (which also is included inside the Resources directory). Now, edit the file so it looks like Listing 1.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.
Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.
Sponsored by ActiveState
| Containers—Not Virtual Machines—Are the Future Cloud | Jun 17, 2013 |
| Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer | Jun 12, 2013 |
| Weechat, Irssi's Little Brother | Jun 11, 2013 |
| One Tail Just Isn't Enough | Jun 07, 2013 |
| Introduction to MapReduce with Hadoop on Linux | Jun 05, 2013 |
| Android's Limits | Jun 04, 2013 |
- Containers—Not Virtual Machines—Are the Future Cloud
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Linux Systems Administrator
- Introduction to MapReduce with Hadoop on Linux
- Senior Perl Developer
- Weechat, Irssi's Little Brother
- Technical Support Rep
- UX Designer
- One Tail Just Isn't Enough
- Android's Limits
- Free is costly
29 min 22 sec ago - Bought photoshop CS5 for developing a website :(
45 min 42 sec ago - Reply to comment | Linux Journal
1 hour 33 min ago - Reply to comment | Linux Journal
1 hour 34 min ago - Replica Watches
3 hours 59 min ago - Reply to comment | Linux Journal
8 hours 9 min ago - on the path to understanding
8 hours 13 min ago - As a fisher,we know that a
1 day 3 hours ago - All I Say Is Worth Share!
1 day 4 hours ago - GeekSays
1 day 4 hours ago
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?











Comments
Titanium: good idea, bad implementation
...except, the product is unreliable as stink (I am using 0.82). I am surprised you were able to get your example code running. Every corner I discover new show-stopper bugs that shouldn't even be in a beta product. On top of that, because you rely on their "cloud", you are at the mercy of their server code too - which is crazy unreliable. I would say 90% of the time I am not even able to get an installer built! And, once the installer is made, often it is corrupt - or doesn't install properly. Just go try to install some of the "example" apps on appcelerator's site - I only tried 3, but 2 wouldn't install properly. Geesh!
The idea is terrific: native apps with a UI in an embedded webkit. But the implementation is weird and unreliable. And, the whole so-called "cloud" bit to their development story is ridiculous. Let's hope 1.0 is dramatically better quality.