Ideas by Khang: A new type of web browser for the iPhone

I always have tons of ideas that would come and go, but recently, I have been doing a lot of iPhone stuff and so naturally ideas that popped up in my head are mostly iPhone related. The mobile safari is one of the best mobile browser I've used and without doubt the iPhone has one of the best mobile web browsing experience. Recently, I started seeing an increasing number of sites that support iPhone's safari browser native resolution, 420x320 or vice versa. However comparing to the vast majority of sites out on the internet, it's probably a really low percentage of sites that does support iPhone's format. My guess is around 1 - 3 percent of websites has built-in support for being friendly on the iPhone.

  Photo hosted by Simplebucket.com

What's my idea?

An iPhone application that reformats CSS/HTML on the fly so it shows well on the iPhone screen resolution of 420x320 or 320x420. I've seen iPhone applications that uses the UIWebView API to implement a full screen browser with a bunch of features that were not available on Safari. In addition to just reformating CSS/HTML, it also recognizes domain names and so clicking on such urls would fire up any preferred native apps, for example TweetDeck if it was a twitter.com hyperlink or the Facebook app for Facebook.com. Opening 3rd party applications is possible if applications register custom URL scheme for their application and publish their schemes. That's just another example that you can provide a more utilitarian browser that not only renders content better but has these nice built-in feature integrations.

So how to make money?

There's actually a few way to monetize this. The first is obvious,

  1. Sell this in the appstore for a price. "Wow, that's insane!", you might think. No, it's not. I'm sure you can price this at $2.99 and get a good amount of downloads.
  2. Offer a free version but it displays in-app ads. Monetize the cheap bastards!
  3. This might not be possible, I haven't thought it through yet but  since you are reformatting HTML/CSS, how about inserting your own ads into the web page and removing the site's ad.

Love this , hate this ?

With everything, there's love and hate, so if you think this is brilliant, I would love to talk to you more personally. Hate this? Tell me why, I love to hear and see this from every angle.

 

 

Loading mentions Retweet
Filed under  //  hacking   idea   iphone  
Comment (1)
Posted 14 days ago

Robot App: Our IPhone Game Development story

It's been a really crazy 4 weeks of coding and hacking Robot App (we've got a name for it but we're just holding it back till the app is accepted by Apple). Robot App is our first and a robot fighting arcade style IPhone game. You basically start off as a tincap robot, whatever that means I just coined that up, and beat the hell out of other robots in an arcade style setting. So think Street Fighters but with retro style robots. Derek is the mastermind behind all the artwork, graphics and the main concept of Robot App. He is one talented illustrator.

I got to know Derek through ProgrammerMeetDesigner.com through a posting that he wrote looking for a programmer to collaborate on IPhone apps. I left a comment on his post and the rest is all history. We started brainstorming and by early April, we settled on the concept of Robot App.

Along the way, we stumbled into many potholes such as things like blurry pngs that appear fine on our Macs but came up blurry on the iPhone (both simulator and hardware). That set us back a couple of days trying to figure out what's wrong. Then we stumbled on AdHoc distribution like many developers did.

I took extra time to read up on all the documents for Adhoc distribution just to make sure that I do not get into an endless loop like many other developers were experiencing with trying to send out test builds using AdHoc Distribution. That didn't help. We still ended up burning a few days trying to get the adhoc builds "work" on Derek's phone. The build was installed on his IPhone but it just crashes on start. We went through iterations of debugging and transferring of debug logs.

Thu Apr 30 00:58:43 unknown com.apple.launchd[1] <Error>: posix_spawnp("/var/mobile/Applications/A30C2E38-7AEC-4F7B-A4BD-D911E6009EDD/robot.app/robot", ...): Permission denied
Thu Apr 30 00:58:43 unknown kernel[0] <Debug>: launchd[61] syscall_builtin_profile: /private/var/mobile/Applications/A30C2E38-7AEC-4F7B-A4BD-D911E6009EDD.sb (seatbelt)
Thu Apr 30 00:58:43 unknown kernel[0] <Debug>: launchd[61] Builtin profile: container (seatbelt)
Thu Apr 30 00:58:43 unknown SpringBoard[22] <Warning>: Unable to obtain task name port for net.leftrightstudios.robot. Either it failed to exec or it terminated immediately: (os/kern) failure


Our IPhone AdHoc Distribution
He was able to install the app, it's just when starting the app, it terminates and goes back to Springboard. In the end, we figured out that his phone had some funky configuration and installed the application with some weird permission settings. We tried many different ideas, like resetting the phone, restoring to a clean state and restoring in iTunes. All those did not work. It was only till Derek suggested booting over to windows and tried using iTunes in Windows did an AdHoc install and miraculously that works. We're still not really sure why iTunes in Windows had installed the app properly.

There's so many things that we've learned throughout these couple of months and I would end to share more in the upcoming days. But I'll end this post with some project stats and will definitely post more on our adventure on developing our first IPhone game.

Robot App Project Stats

Project Folder created: April 9th 2009
Lines of code: 5032 lines
Number of files: 30
Application size (compressed): 6.3MB
Revision control for our project resources: dropbox (http://www.getdropbox.com)

Loading mentions Retweet
Filed under  //  hacking   iphone   iphone sdk   leftrightstudio   robot app  
Comments (3)
Posted 6 months ago

Having fun with NSTimer?

NSTimer is the new thing that I'm trying to conquer

Below is the standard timer kill code. I've even thrown in a nice #define for it....

Code:
if (pressTimer != nil) {
[pressTimer invalidate];
pressTimer = nil;

}

#define KILL_TIMER(q) if (q) {[q invalidate]; q=nil;}

If your timer is set to only fire once (repeats:NO) then you must make sure to include pressTimer = nil; in your timer function to flag that the timer is gone.

If you want a setup where a timer fires 5 times then invalidates, you use repeats:YES when creating your timer, then use the userInfo data to keep count, then call invalidate in the timer function when the count in your userInfo object reaches 5.

Yes, in this case userInfo must be an NSObject subclass! So you need to create a really simple class to hold your data. Something like this:

Code:
// TimerCounter - a simple class to assist countdown timers
@interface TimerCounter : NSObject {

int countdown;
}
@property (nonatomic, assign) int countdown;
+ (TimerCounter*)timerCounterWithCount:(int)count;
- (id)initWithCount:(int)count;
- (BOOL)decrementAndTest;
@end

Loading mentions Retweet
Filed under  //  hacking   iphone   iphone sdk   leftrightstudio  
Comments (0)
Posted 6 months ago

My Hacking essentials = Planters cashew nuts + Pepsi Max

Sent from my iPhone

Loading mentions Retweet
Filed under  //  games   hacking   iphone   leftrightstudio   robot app  
Comment (1)
Posted 7 months ago

robots are fighting on our iphones

Robot app from LeftRightStudios

Loading mentions Retweet
Filed under  //  games   hacking   iphone   leftrightstudio   robot app  
Comments (0)
Posted 7 months ago

Using Rails Metal to decouple upload from your Rails app

Ruby on Rails is my current favorite web development framework. Back in 2007, I started dabbling with merb a little bit but never really needed to use a micro-framework for any of my projects.

With the release of Rails 2.3, there are many good stuff that makes Rails more awesome but what caught my attention most was Rails Metal.

What is Rails Metal?
First, you need to understand the lifecycle of a Rails request/response and once you have a good idea of that, here's a little curve ball - Rack. With 2.3, Rack was incorporated into Rails, making it very easy to hook up any piece of Rack middleware in front of a Rails request. There are many Rack middleware that are really cool but I will not go into details here. If anyone is interested, drop me a comment and I might consider cooking up a separate post for that.
 
So Rails Metal is a thin wrapper around the generic Rack Middleware that was build into Rails to provide an process endpoint that is decoupled from the Rails Application Stack. What does this mean? If you have a service that you are expecting to handle hundreds of reqs/sec, this is where Rails Metal comes in. For example, a poller service or even a service that has access to the same session as Rails. Rails has even included a generator for Metal that produces a stub to get you going.

script/generate metal
Usage: script/generate metal MetalName [options]
Rails Info:
-v, --version Show the Rails version number and quit.
-h, --help Show this help message and quit.

General Options:
-p, --pretend Run but do not make any changes.
-f, --force Overwrite files that already exist.
-s, --skip Skip files that already exist.
-q, --quiet Suppress normal output.
-t, --backtrace Debugging: show backtrace on errors.
-c, --svn Modify files with subversion. (Note: svn must be in path)
-g, --git Modify files with git. (Note: git must be in path)

Description:
Cast some metal!

Examples:
`./script/generate metal poller`
This will create:
Metal: app/metal/poller.rb

>>> poller.rb
# Allow the metal piece to run in isolation
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)

class Poller
def self.call(env)
if env["PATH_INFO"] =~ /^\/poller/
[200, {"Content-Type" => "text/html"}, ["Hello, World!"]]
else
[404, {"Content-Type" => "text/html"}, ["Not Found"]]
end
end
end

With that in place, all you have to do is fire up your server, script/server and point your browser to http://localhost:3000/poller and viola, you got Rails Metal.

So what can I use this Rails Metal thing for?
By now, I'm hoping you are thinking "Wow! This is cool." But what else can I do with Rails Metal other than saying Hello to the world? Well first of, if you have a couple of actions that you need to optimize, rather than breaking those out into a separate app using a micro-framework, you can put them on Metal. There are many real world examples that I can use here but I will choose an upload service as an exampler since it's near and dear to my heart.

There are many ways of decoupling the upload process from hitting your Rails stack. Most infamously, you can go the micro-framework route or if you are using Nginx, there is a way that you can use the Nginx upload progress module to handle and report the upload progress to the client.

Using the example from new bamboo, instead of having a separate merb app to handle the upload, you can handle the upload using Rails Metal. If you remember, Rails Metal also has access to sessions and requests, and you can do that using

request = Rack::Request.new(env)
params = request.params
session = env['rack.session']

So here's my new shiny uploader derived from the new bamboo example code:

class Uploader
def self.call(env)
if env["PATH_INFO"] =~ /^\/upload/
request = Rack::Request.new(env)
if request.post?
file_params = request.params['file']
FileUtils.mv file_params[:tempfile].path, RAILS_ROOT+"/public/files/#{file_params[:filename]}"
return [200,{"Content-Type" => "text/html"},["Upload success"]]
end
end
[404, {"Content-Type" => "text/html"}, ["Not Found"]]
end
end

Update with new zip Download the code used in this post here: metalapp.zip

Loading mentions Retweet
Filed under  //  hacking   metal   rails  
Comments (5)
Posted 7 months ago