Fork me on GitHub

Updates from August, 2008 Toggle Comment Threads | Keyboard Shortcuts

  • britg 11:08 pm on August 26, 2008 Permalink | Log in to leave a Comment
    Tags: , aptana cloud,   

    Why Aptana is Quickly Becoming the Killer Stack 

    Anyone who knows me knows that I am a huge fan of Aptana.  (The recent acquisition of the pyDev plugin and its eventual incorporation into the IDE only solidifies that position.)  Their suite of services are quickly turning into the killer app stack for a large majority of web developers including myself and if you’re a developer who hasn’t given Aptana a try, I highly recommend you do – it’s free.

    Yes, everything they’re doing has been done before.  And yes bigger and badder players have offerings in the IDE, cloud hosting, and developer community sectors, but it’s all about consolidation baby, and Aptana wins hands down in that arena.

    The IDE Is Key

    The foundation of any good development stack is not the test or deployment servers.  It’s not the language,  documentation, or even the community.  It’s the IDE, damnit.  Because, really – what connects all the other layers?  It should be the IDE, and that’s exactly what the Aptana IDE does.

    The Aptana devs have done an excellent job in providing much more than just a text editor with syntax highlighting.  With the soon to be released Aptana IDE 1.2, you get project management, remote asset management with FTP, SVN and their new aptanacloud interface, database management, code tutorials and assistance for popular libraries and frameworks.

    No, Aptana will probably never be as good a PHP editor as Zend Studio.  And it’ll probably never be a replacement for Cyberduck or Filezilla for file management, or Amazon’s web services for cloud computing.  And you’ll probably still try to ping the jQuery docs only to realize they are still slow as hell (good alternative here, btw).  But, in the Get Stuff Done web development world, having a working solution for all these built in to your IDE is invaluable.

    The Future is in The Cloud

    As a relatively new entrant into the web technology world, I would venture to say that the biggest and most exciting development during my short tenure is Cloud Computing.  But, I’ve said it before, and I’ll say it again – managing Amazon Web Services and EC2 instances is hard work.  Google App Engine fixes the hard work problem, but you’re forced into Google’s narrow framework and constraints.

    Aptana’s new Cloud service is right smack-dab in the middle.  You’re given a sliding scale of server size, a couple of customization options, and bam! you’ve got a web server.  There’s no 50 step, command line based, get-one-step-wrong-and-you’re-hosed process to build and deploy a machine instance.  But, you also don’t have the fine-grained control of exactly what software your server runs.

    That’s an easy trade-off for the web application developer, because execution on the core functionality of your app is what matters.  No one really cares how you’ve squeezed every last ounce of optimization into your server cluster (though there’s nothing wrong with that pursuit).

    Oh, by the way, did I mention that Aptana Cloud is integrated with the Aptana IDE on every level – database management, source control, resource management, deployment, etc. etc?  Yeah, it is and it kicks ass.  Go sign up for the early access program and see for yourself.

    Javascript is the New Cranberry

    You know how you can walk down the juice aisle at your local grocery store and see 50 different juices and cranberry just seems to be involved with every damn one of them?  That’s javascript in the web world.  More often than not, JSON is the platform of choice for APIs and web services.  AJAX pervades just about every Web 2.0 application.  Hell, it’s even made it into our databases with CouchDB.

    Hey, there’s nothing wrong with that – Jeff Attwood may hate working with javascript – but I kinda sorta almost maybe like it!  Especially when working with frameworks like jQuery, javascript can be a fun experience when it adds interactivity and wow-factor to your web application.

    Enter Aptana’s end-to-end Javascript solution – Jaxer.  Damn, they thought of everything!  If web developers are spending so much time in their code interfacing with javascript APIs and writing Javascript UI interactivity, why not put javascript on the server side and use it as your middleware?  I like it.

    Hell, I can see in the near future a scenario where Javascript is the only scripting language in an entire application.  Front end javascript, with Jaxer on the server, and CouchDB as the data-store.

    Oh, and did I mention that Jaxer is integrated into the Aptana IDE with a debug console, profiler, etc? Ok, you get the point.

    So Why Did I Write This?

    Sounds like I’m a pretty hardcore Aptana fanboy, doesn’t it?  Well I can assure you the Aptana team hasn’t paid me should be paying me to say all this, damnit.  Oh well, I’ll throw in a diss just for good measure.  For some ungodly reason, the Aptana IDE only just recently added a word wrap feature.  Yes, you read that right – word wrap.  Word.  Wrap.

    Ok, they maybe might have had some sort of plausible excuse, but damn – Word. Wrap.  That’s sort of like a television not having volume control, or a keyboard without the tilde – you don’t miss it until you don’t have it.

     
    • Aptana Management 9:19 pm on August 26, 2008 Permalink

      Good Article. Please tell me where I can send the check.

    • britg 9:24 pm on August 26, 2008 Permalink

      haha, thanks “Aptana Management”

    • philip 9:53 pm on August 26, 2008 Permalink

      I like the Javascript stack of Jaxer but I want to see more of how I can integrate that with my existing large server side libraries in PHP and Java.

    • britg 5:23 am on August 27, 2008 Permalink

      Yeah, I agree – that's the biggest hurdle that Jaxer has in front of it.
      How does it fit in with all the legacy code that most people have.

      It really does take a brave soul to base an entire application on such a new
      technology.

    • Brad B. 9:06 am on August 27, 2008 Permalink

      Not one mention of Eclipse?

    • britg 9:12 am on August 27, 2008 Permalink

      The fact that they built it ontop of eclipse is great, especially with the
      plugin architecture. I thought about putting in something about that, but
      decided to lean more towards the more innovative aspects of the IDE – like
      cloud integration, jaxer server, etc.

    • Ian Selby 11:21 am on August 27, 2008 Permalink

      RE: the jaxer integration with php, etc.

      Jaxer is actually set up as a filter (in apache at least), not an interpreter like PHP, so it plays very nice with these languages. In my first week at Aptana I tested this myself and was quite happy with the results… if you want to see a very simple example, check out http://jxrgallery.aptanacloud.com. The file uploading and display is done via jaxer, but the image thumbnail / reflection processing is done via php scripts. Simple, but it works!

    • britg 11:31 am on August 27, 2008 Permalink

      Nice demo! I'm not familiar enough with apache innards to understand the
      filter vs. interpreter concept, that is interesting that the two can work
      together. I remember reading this in the jaxer discussions, but it didn't
      really sink in that a developer wouldn't use jaxer as the sole middleware in
      their app. Very cool

    • Anthony Damasco 2:44 pm on August 27, 2008 Permalink

      What about Eclipse?

    • Andrija 5:47 am on October 8, 2008 Permalink

      “the Aptana IDE only just recently added a word wrap feature”.

      I just downloaded the latest version, still RC, but there is no word wrap. Do you know how to turn on word wrap function in Aptana?

    • britg 5:55 am on October 8, 2008 Permalink

      Check out the response to the word wrap issue report here:
      http://support.aptana.com/asap/browse/STU-534?f…

      He explains how to turn on wordwrap.

    • Andrija 9:42 am on October 8, 2008 Permalink

      Thank you very much!
      It works in Aptana Studio, build: 1.2.0.017963, and I'm not using the pro version.
      Best Regards
      Andrija

    • Carl 9:46 pm on October 13, 2008 Permalink

      Do you know anyone using the product on Linux? The support seems to be really lacking.

    • gochi 2:16 am on January 17, 2009 Permalink

      Good article and good writing skill thanks for sharing this.

    • Budget Tracking Software 12:36 am on March 2, 2009 Permalink

      I've been trying to find out more about this – thanks for a great post!

    • Budget Tracking Software 10:50 pm on March 2, 2009 Permalink

      I'll have to give this a try – thanks for the demo!

    • goji juice 6:00 pm on May 26, 2009 Permalink

      Aptana Studio is an open source integrated development environment (IDE) for building Ajax web applications. It includes support for JavaScript, HTML, DOM, and CSS with code-completion, outlining, JavaScript debugging, error and warning notification and integrated documentation.

    • of mesothelioma 11:46 am on August 2, 2010 Permalink

      Thanks for writing this article – I've as of yet heard very little about Windows Mobile 6, so it was nice to read about it.

  • britg 1:44 pm on August 26, 2008 Permalink | Log in to leave a Comment
    Tags: ,   

    GeoCouch in CakePHP 

    I released a small php script for easily handling geodata in couchdb via php a while ago, check it out here.  I also put together a short tutorial on how to integrate this script in your CakePHP application.  The article is available here on the CakePHP Bakery.

     
  • britg 7:50 am on August 25, 2008 Permalink | Log in to leave a Comment
    Tags: ,   

    Integrating CakePHP with bbPress – Part 2 

    This is the second of a 3 part tutorial on how to integrate bbPress with CakePHP 1.2.x. When complete, these 3 tutorials will accomplish:

    1. Integrating bbPress in a sub-folder (not a subdomain) of your cake install (part 1 here)
    2. Integrating user registration – when a user registers through your cake application they are automatically registered in bbPress.
    3. Integrating the login – when a user is logged in via the cake application they are automatically logged in in bbPress.

    Part 2 – Integrating User Registration

    This part is a little more tricky, but not unmanageable.   The challenge here is that your Cake application probably uses the Auth component, or a custom user setup.  So you probably have a prebuilt users table and chances are it does not conform to what bbPress is looking for in it’s users table.  Also, the encryption scheme between the two is probably different.

    With that in mind, I’ve made the following design decisions

    1. My Cake users schema will remain intact AND the bbPress users schema will remain intact.
    2. Users must register through my Cake application only
    3. CakePHP is using the built-in Auth component.
    4. When a user registers through my Cake application – I run the necessary logic from the Cake User model to update the bbPress users table.
    5. The bbPress tables are in the same database as my CakePHP tables
    6. I change the encryption scheme of bbPress to conform to my Cake app.

    Step 1: changing the bbPress password encryption.

    If you’ve followed Part 1 of this tutorial, you’ve successfully installed and ran bbPress in a subfolder of your cakephp install.  Navigate to that subfolder, then open following file: bb-includes/backpress/code.wp-pass.php

    Notice two functions, hash_password(...) and check_password(...).  We will overwrite these two functions to match the hashing that takes place in our CakePHP install.  If, as I denoted above, you are using the built-in CakePHP Auth component, this is very simple – just comment out the existing functions and replace them with the following:

    	function hash_password($string) {
    		$string = 'YOUR CONFIGURE::SALT VALUE'.$string;
    		return sha1($string);
    	}
    
    	function check_password($password, $hash, $user_id = '') {
    		$string = 'YOUR CONFIGURE::SALT VALUE'.$password;
    		if(sha1($string) != $hash) {
    			return false;
    		} else {
    			return true;
    		}
    	}

    Replace the YOUR CONFIGURE::SALT VALUE with the appropriate value from your CakePHP application. This can be found in app/config/core.php.

    With these two functions in place, your bbPress user system should be hashing and checking the passwords the same way.

    Step 2: Saving a bbPress user from the CakePHP install.

    Fortunately, CakePHP provides an easy hook into the ORM saving process with the afterSave() model callback.

    To get your User model to save a new bbPress user when a new Cake user is created, add the following functions to your User model script:

    	function afterSave($created)
    	{
    		if($created)
    		{
    			$sql = "INSERT INTO `bb_users`
    			(`user_login`, `user_pass`, `user_nicename`,
    			`user_email`, `user_url`, `user_registered`,
    			`user_status`, `display_name`)
    			VALUES(
    			'".$this->data['User']['username']."',
    			'".$this->data['User']['password']."',
    			'".$this->data['User']['username']."',
    			'".$this->data['User']['email']."',
    			'',
    			NOW(),
    			0, '".$user['User']['username']."')";
    			$this->query($sql);
    		}
    	}

    Notice that we are just creating an SQL statement with all the necessary fields required to successfully insert the user into the bbPress system, and then executing that SQL. Also, if you are using the default functionality of the Auth component, $this->data['User']['password']; should automatically be hashed with the same scheme as Step 1.

    Step 3 – Preventing registration from bbPress

    This is the easy part. Simply add the following line to the top of your register.php script in you bbPress install and replace the path with the correct path to your cake registration page.

    die(header('Location: /path/to/your/cake/registration/page'));

    So, that’s it! Now, when you register a user through your Cake application, they should also appear in the bbPress users table, and you should be able to successfully log into both with the exact same credentials.

    But, the plot thickens – we don’t want our users to have to log in to both the cake app and bbpress. We want them to be logged into both automatigically. Stay tuned for part 3 of this tutorial and I’ll attempt to tackle this very conundrum.

     
    • pengekcs 9:53 am on August 31, 2008 Permalink

      Nice explanation. Simple and easy to follow.

    • pengekcs 9:53 am on August 31, 2008 Permalink

      Nice explanation. Simple and easy to follow.

    • britg 11:20 am on August 31, 2008 Permalink

      Thanks!

    • britg 11:20 am on August 31, 2008 Permalink

      Thanks!

    • Ruben 9:57 am on September 14, 2008 Permalink

      Brillian! cant wait for part 3

    • Ruben 9:57 am on September 14, 2008 Permalink

      Brillian! cant wait for part 3

    • britg 10:46 am on September 14, 2008 Permalink

      No problem! glad to help. Been slammed with other stuff and haven't been able to work on this project, but I'll definitely get around to writing part 3.

    • britg 10:46 am on September 14, 2008 Permalink

      No problem! glad to help. Been slammed with other stuff and haven't been able to work on this project, but I'll definitely get around to writing part 3.

    • Harry 1:32 am on October 24, 2008 Permalink

      Hi. I just came across your article while looking for a forum to use with my cakephp app. I'm so glad you wrote something like this up, it has saved me hours of digging through code. Will you still be witting part 3?

      Anyways, thanks again!

    • Harry 1:32 am on October 24, 2008 Permalink

      Hi. I just came across your article while looking for a forum to use with my cakephp app. I'm so glad you wrote something like this up, it has saved me hours of digging through code. Will you still be witting part 3?

      Anyways, thanks again!

    • britg 6:10 am on October 24, 2008 Permalink

      Thanks, yes I really intend to write part 3 – but unfortunately the project
      I was doing this for has been put on hold for the moment!

    • britg 6:10 am on October 24, 2008 Permalink

      Thanks, yes I really intend to write part 3 – but unfortunately the project
      I was doing this for has been put on hold for the moment!

    • Rob 1:04 pm on March 10, 2009 Permalink

      Thank you, this is a great turoial and this is just what I was looking for!! Looking forward to part 3 if I dont figure it out first!! ;) Cheers

    • Rob 8:04 pm on March 10, 2009 Permalink

      Thank you, this is a great turoial and this is just what I was looking for!! Looking forward to part 3 if I dont figure it out first!! ;) Cheers

    • James 7:01 am on April 28, 2009 Permalink

      Is there any part 3 coming anytime soon?

    • Jeff 8:40 am on August 18, 2009 Permalink

      I'm sure you're sick of hearing it, but please write part 3 soon! Or just a code example! ;)

  • britg 5:13 pm on August 23, 2008 Permalink | Log in to leave a Comment
    Tags: , ,   

    Integrating CakePHP with bbPress – Part 1 

    I’ve been working on StatForge.com for the past few days and one of the community features I want to integrate is a forum.  Rather than go for something bloated like phpbb or vanilla, I decided to go with bbPress from the makers of WordPress.

    This is the first of a 3 part tutorial on how to integrate bbPress with CakePHP 1.2.x.  When complete, these 3 tutorials will accomplish:

    1. Integrating bbPress in a sub-folder (not a subdomain) of your cake install
    2. Integrating user registration – when a user registers through your cake application they are automatically registered in bbPress. (UPDATE: part 2 here)
    3. Integrating the login – when a user is logged in via the cake application they are automatically logged in in bbPress.

    Part 1 – Integrating bbPress in a sub-folder (not a subdomain)

    It may be personal preference, but I’m not a big fan of subdomaining parts of an application.  There are definitely legitamite technical reasons to do so, but when I can get away with it, I try to use subfolders, i.e. http://statforge.com and http://statforge.com/forum/.

    There’s a small hurdle here since CakePHP wants to ReWrite all your paths (if you’ve installed it in your domain root), but it’s easy to overcome.  Find the .htaccess file in the root of your cake install.  It should look like this:

       RewriteEngine on
       RewriteRule    ^$ app/webroot/    [L]
       RewriteRule    (.*) app/webroot/$1 [L]

    This is rewriting all of your requests to the webroot folder. Assuming you want to install bbPress into a subfolder called forum (i.e. http://statforge.com/forum/) the change this .htaccess file to the following:

       RewriteEngine on
    
       RewriteCond %{REQUEST_URI} ^/forum/(.*)$
       RewriteRule ^.*$ - [L]
    
       RewriteRule    ^$ app/webroot/    [L]
       RewriteRule    (.*) app/webroot/$1 [L]

    This simply reads – if the Request starts with /forum/ pass it through normally. If not, let Cake handle it. The only limitation here is that you cannot have a controller named ‘forum’ in your cake application.

    That’s it – you should be able to drop a fresh bbPress install into the /forum subfolder and access it normally without Cake interfering.

    I’ve already integrated the user registration between my CakePHP install and my bbPress install, but I’ve gotta run for the time being. Hopefully tomorrow I’ll throw up part 2 – it’s a bit more complicated. (UPDATE: part 2 here)

     
    • Luke 5:19 am on January 8, 2009 Permalink

      have any luck with the logging in to BBPress at the same time with a single log in?

    • britg 8:18 am on January 8, 2009 Permalink

      No, unfortunately I haven't taken the time to finish this out or the project
      that this was for! I really hope to revisit soon.

    • Luke 7:08 am on January 9, 2009 Permalink

      oh, what a pity :(

      I have seen some posts on a forum of people trying to do the same thing. I don't think it can be too difficult – A matter of an afterFind callback in Cake I suppose once th e User is found?

      not sure about the BB Press end as I have not used it yet, although it looks promising compared to other forum choices. Any thoughts?

      Luke

    • britg 2:19 pm on January 9, 2009 Permalink

      Well, my first approach when I get time to revisit would be to use the same
      cookie mechanism i'm already using in my cake app – namely the cookie
      handler. I usually dont rely just on Sessions for my user login, but set a
      cookie also.

      I would extend the Cookie handler built into cake to tap into the same
      libraries that BBPress is using (either by duplication or inclusion), and
      when I set my cake cookie I also set a BBPress cookie, and a session
      variable if BBPress requires one.

      Hope that helps – and yes, I apologize that I have not finished part 3 – it
      kills me as well!

    • Luke 3:08 pm on January 9, 2009 Permalink

      oh, what a pity :(

      I have seen some posts on a forum of people trying to do the same thing. I don't think it can be too difficult – A matter of an afterFind callback in Cake I suppose once th e User is found?

      not sure about the BB Press end as I have not used it yet, although it looks promising compared to other forum choices. Any thoughts?

      Luke

  • britg 9:44 am on August 23, 2008 Permalink | Log in to leave a Comment
    Tags: ,   

    Fixing the Keyboard Issue on the Current Version of PhoneGap 

    PhoneGap currently has an issue with the keyboard not appearing whenever a form input is selected on a web site.  The key here is that the keyboard IS actually showing up, but it is being drawn behind the UIWebView used to render the webpage.

    Here’s the solution I came up with.  I don’t understand enough about the rendering heirarchy to explain the why, but here’s the how:

    In the GlassAppDelegate.m source file you should see a block of code that looks like the following:

     // Set up the image picker controller and add it to the view
    	imagePickerController = [[UIImagePickerController alloc] init];
    
    	// Im not sure why the next line was giving me a warning... any ideas?
    	// when this is commented out, the cancel button no longer works.
    	imagePickerController.delegate = self;
    	imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    	[window addSubview:imagePickerController.view];

    Simply move this block of code BELOW the following line. This renders the imagePicker object after the web view.

    webView.delegate = self;

    Problem – the imagePicker is obscuring the web view! Simply add the statment imagePickerController.view.hidden = YES; to the above block of code so that the entire block looks like:

     // Set up the image picker controller and add it to the view
    	imagePickerController = [[UIImagePickerController alloc] init];
    
    	// Im not sure why the next line was giving me a warning... any ideas?
    	// when this is commented out, the cancel button no longer works.
    	imagePickerController.delegate = self;
    	imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
            imagePickerController.view.hidden = YES;
    	[window addSubview:imagePickerController.view];

    As it sounds like, we are just hiding the imagePickerController’s view – we don’t need it when the application starts anyways. But, we do need it when we access the images API through javascript, so find the block:

    else if([(NSString *)[parts objectAtIndex:1] isEqualToString:@"getphoto"]){
    				NSLog(@"Photo request!");
    				NSLog([parts objectAtIndex:2]);
    
    				webView.hidden = YES;
            [window bringSubviewToFront:imagePickerController.view];
    				NSLog(@"photo dialog open now!");
    }

    and add the line imagePickerController.view.hidden = NO; above webView.hidden = YES; so that the entire block looks like:

    else if([(NSString *)[parts objectAtIndex:1] isEqualToString:@"getphoto"]){
    				NSLog(@"Photo request!");
    				NSLog([parts objectAtIndex:2]);
            imagePickerController.view.hidden = NO;
    				webView.hidden = YES;
            [window bringSubviewToFront:imagePickerController.view];
    				NSLog(@"photo dialog open now!");
    }

    Voila! Compile and run the app and the keyboard should now appear when a form input is pressed on your iphone.

     
    • Zach Allia 3:00 pm on August 25, 2008 Permalink

      do you have all your changes posted anywhere?

    • britg 3:37 pm on August 25, 2008 Permalink

      No, sorry I made a bunch of other custom changes for my specific application
      so I didn't put them on github or anywhere else. Would you like the this
      GlassAppDelegate.m? I can't promise I didn't do something else in the code
      for my app though

    • zachallia 8:19 pm on August 26, 2008 Permalink

      no worries, i have a bunch of custom changes too… but was hoping to see some of this get centralized.

    • britg 5:30 am on August 27, 2008 Permalink

      yeah, i hear ya – need to get git up and running so I can commit to my fork on github

    • sintaxi 11:01 am on August 27, 2008 Permalink

      This is a fantastic problem to run into. I started a discussion on the google group to discuss contributing. We need your feedback. I am prepared to offer support to anyone who needs help with git and plan to document the step by step procedure on how people can submit a pull request. Great work guys!

      http://groups.google.com/group/phonegap/browse_…

    • britg 11:05 am on August 27, 2008 Permalink

      Sweet, that's the kind of kick in the pants I need to start contributing – i'll hop into that google group discussion

    • britg 12:30 pm on August 27, 2008 Permalink

      yeah, i hear ya – need to get git up and running so I can commit to my fork on github

    • sintaxi 6:01 pm on August 27, 2008 Permalink

      This is a fantastic problem to run into. I started a discussion on the google group to discuss contributing. We need your feedback. I am prepared to offer support to anyone who needs help with git and plan to document the step by step procedure on how people can submit a pull request. Great work guys!

      http://groups.google.com/group/phonegap/browse_…

    • britg 6:05 pm on August 27, 2008 Permalink

      Sweet, that's the kind of kick in the pants I need to start contributing – i'll hop into that google group discussion

  • britg 10:57 am on August 22, 2008 Permalink | Log in to leave a Comment
    Tags: ,   

    Extending PhoneGap to Return the iPhone’s Unique Identifier 

    Yesterday I wrote about the nascent project, PhoneGap, that acts as a Cocoa Touch-native wrapper to your web-based application.  I’ve been playing with it non-stop since I stumbled accross it and it works like a charm!

    When phonegap initializes, it loads a few parameters from the client iPhone into your javascript environment.  By default these include the phone model, version, and gap version.  For my specific application, I wanted to load the iPhone’s unique identifier.

    To add this uniqueIdentifier parameter is simple – looking in the phonegap sources, Find the GlassAppDelegate.m script in the Classes folder. Using Xcode’s method-finder bar, navigate to the (void)webViewDidStartLoad:(UIWebView *) method and replace it with the following:

    - (void)webViewDidStartLoad:(UIWebView *)webViewLocal {
    	NSLog(@"Page loaded");
    	NSString *jsCallBack = nil;
    	jsCallBack = [[NSString alloc] initWithFormat:@"\
    				  __gap = true; \
    				  __gap_version='0.1'; \
    				  __gap_device_model='%s'; \
    				  __gap_device_version='%s'; \
    				  __gap_device_uniqueid='%s';",
    				  [[[UIDevice currentDevice] model] UTF8String],
    				  [[[UIDevice currentDevice] systemVersion] UTF8String],
    				  [[[UIDevice currentDevice] uniqueIdentifier] UTF8String]
    				  ];
    	//NSLog(jsCallBack);
    	[webViewLocal stringByEvaluatingJavaScriptFromString:jsCallBack];
    	[jsCallBack release];
    
    }

    I’m simply access the uniqueIdentifier property of Cocoa’s UIDevice class.

    To be able to access this paramter in your javascript, jump into the gap.js that you should be loading in your iphone web app, find the Device.init function, and replace with:

        init: function(model, version) {
            try {
                Device.available = __gap;
                Device.model = __gap_device_model;
                Device.version = __gap_device_version;
                Device.gapVersion = __gap_version;
    			Device.uniqueIdentifier = __gap_device_uniqueid;
            } catch(e) {
                alert("GAP is not supported!")
            }
        },

    Voila! You can now access the client iphone’s unique identifier via Device.uniqueIdentifier in your javascript.

    Next up – figuring out how to access the keyboard through the UIWebView :X

     
    • Zach Allia 12:06 pm on August 22, 2008 Permalink

      awesome… and thanks for figuring out the keyboard issue!

    • britg 12:09 pm on August 22, 2008 Permalink

      hey no problem!

    • Lieven Gekiere 11:30 am on August 23, 2008 Permalink

      I get an “undefined” after adding all this to my project … any idea's ?

    • britg 11:36 am on August 23, 2008 Permalink

      Hmm, when and where are you getting undefined? i.e. what's the context? Are you doing something like alert(Device.uniqueIdentifier) ?

      If you can pastie your javascript code, maybe I can weed out the issue.

    • Lieven Gekiere 2:34 am on August 24, 2008 Permalink

      Here's the JS part

      *************
      var Device = {

      available: false,
      model: “”,
      version: “”,
      isIPhone: null,
      isIPod: null,

      init: function(model, version) {
      try {
      Device.available = __gap;
      Device.model = __gap_device_model;
      Device.version = __gap_device_version;
      Device.gapVersion = __gap_version;
      Device.uniqueIdentifier = __gap_device_uniqueid;
      } catch(e) {
      alert(“GAP is not supported!”)
      }
      },

      *************

      and in my page i have :

      *************
      window.onload = function()
      {
      Device.init();
      $('infomodel').innerHTML = Device.model;
      $('infoversion').innerHTML = Device.version;
      $('infouniqueid').innerHTML = Device.uniqueIdentifier;

      Device.Location.callback = updateLocationCallback;
      Device.Image.callback = 'image.lasso?data=';
      }
      ….

      *************

    • britg 10:56 am on August 24, 2008 Permalink

      Hmm, that all looks solid. Here's a silly question – you've compiled and re-run the phonegap app in xcode, correct? also, are you using your physical iphone or the simulator?

    • Lieven Gekiere 3:28 am on August 27, 2008 Permalink

      Could this be linked to the fact i'm using a 1st generation iPhone ? Is that not supported on them ?

    • Lieven Gekiere 3:28 am on August 27, 2008 Permalink

      Could this be linked to the fact i'm using a 1st generation iPhone ? Is that not supported on them ?

    • britg 5:21 am on August 27, 2008 Permalink

      From everything I've read I assumed that the ID is available to all iphones
      and ipod touches. I can't find a case in my limited searching where the
      first gen iphones done return a unique Identifier, but I don't have one
      myself.

    • britg 5:21 am on August 27, 2008 Permalink

      From everything I've read I assumed that the ID is available to all iphones
      and ipod touches. I can't find a case in my limited searching where the
      first gen iphones done return a unique Identifier, but I don't have one
      myself.

    • Lieven Gekiere 8:40 am on August 30, 2008 Permalink

      I tried implementing this again in the latest build … but with no success. All other GAP functions do not react anymore …

      Maybe you need to explain this to Sintaxi, so he can build it in in the next master.

      L.

    • Lieven Gekiere 8:40 am on August 30, 2008 Permalink

      I tried implementing this again in the latest build … but with no success. All other GAP functions do not react anymore …

      Maybe you need to explain this to Sintaxi, so he can build it in in the next master.

      L.

    • britg 9:25 am on August 30, 2008 Permalink

      Yes, I will definitely suggest adding this in to the trunk – not sure what
      problems you're running into as I didn't see those. If you can pastebin
      your code somewhere I will try to find some time to look at it in the next
      couple days.

    • britg 9:25 am on August 30, 2008 Permalink

      Yes, I will definitely suggest adding this in to the trunk – not sure what
      problems you're running into as I didn't see those. If you can pastebin
      your code somewhere I will try to find some time to look at it in the next
      couple days.

    • Sahil Desai 12:30 am on September 1, 2008 Permalink

      any luck with getting access to the keyboard through uiwebview? I've been racking my brain trying to find a way. the only thing I could think of was to (for my specific example), create a stringByEvaluatingJavaScriptFromString message, where the javascript looks for a specific “id” on the page and then calls .focus() on it… I was hoping it would work, but no dice. it seems although it gains focus, that isn't enough to tell the iphone to pull up the keyboard :S

    • Sahil Desai 12:30 am on September 1, 2008 Permalink

      any luck with getting access to the keyboard through uiwebview? I've been racking my brain trying to find a way. the only thing I could think of was to (for my specific example), create a stringByEvaluatingJavaScriptFromString message, where the javascript looks for a specific “id” on the page and then calls .focus() on it… I was hoping it would work, but no dice. it seems although it gains focus, that isn't enough to tell the iphone to pull up the keyboard :S

    • britg 5:09 am on September 1, 2008 Permalink

      Hey Sahil – yes actually I did get the problem fixed. You can find my
      solution here:
      http://britg.com/2008/08/23/fixing-the-keyboard…

      Hope that helps!

    • britg 5:09 am on September 1, 2008 Permalink

      Hey Sahil – yes actually I did get the problem fixed. You can find my
      solution here:
      http://britg.com/2008/08/23/fixing-the-keyboard…

      Hope that helps!

    • Sahil Desai 7:30 am on September 1, 2008 Permalink

      any luck with getting access to the keyboard through uiwebview? I've been racking my brain trying to find a way. the only thing I could think of was to (for my specific example), create a stringByEvaluatingJavaScriptFromString message, where the javascript looks for a specific “id” on the page and then calls .focus() on it… I was hoping it would work, but no dice. it seems although it gains focus, that isn't enough to tell the iphone to pull up the keyboard :S

    • britg 12:09 pm on September 1, 2008 Permalink

      Hey Sahil – yes actually I did get the problem fixed. You can find my
      solution here:
      http://britg.com/2008/08/23/fixing-the-keyboard…

      Hope that helps!

  • britg 11:59 am on August 21, 2008 Permalink | Log in to leave a Comment
    Tags:   

    PhoneGap – Native iPhone Apps Running your HTML, CSS, JavaScript Code 

    Stumbled across phonegap – a project that allows you to publish a native iPhone app that simply acts as a pass-through to your web application of choice.  The best part is, you can tap into some of the core frameworks of the iphone SDK via javascript, i.e. you can tap into the Core Location framework, Acceleration, etc, etc! Hats off to the developers of this project. It’ll make my life a whole lot easier.

    Step 1: Develop a website on the stack of your choice. Better yet, use the iUI library to develop a website that looks and feels like a native iphone app.

    Step 2: Download phonegap from github and open the project in Xcode.  Simply edit the file called url.txt in the Resources folder to point to the URL of your iphone app. Compile and run and you should see your website appear.

    Step 3: To access the SDK libs, simply use their function calls:

         getLocation();
    
         // automatically calls this callback
         gotLocation(lat,lon) {
              // do awesome stuff with google maps, etc, etc.
         }

    Check out more information on their google group.

     
    • Code Generator 2:39 am on August 28, 2008 Permalink

      hey Guru
      if you have successfully deployed your web application on gap can you please help me by giving following answers:

      1-Did you run it after after following any jail breaking procedure…?
      if so then did you follow the procedure defined here http://www.onlamp.com/lpt/a/7281 or something else?
      2- if there is no way to run gap application without taking standard membership from iPhone dev center, then <key>CFBundleSignature</key>
      is the place where should i place something received after standard membership? if not then whats the purpose of this key in info.plist file?
      3- should we replace the values in string ${EXECUTABLE_NAME} and ${PRODUCT_NAME}?
      <key>CFBundleExecutable</key>
      <string>${EXECUTABLE_NAME}</string>
      <key>CFBundleName</key>
      <string>${PRODUCT_NAME}</string>
      or will these be replaced at runtime? if not then what are the appropriate values should we replace?
      4-3- According to iPhone Environment all applications should be copied in iPhone Applications directory with the .app extension
      SpringBoard automatically recognizes the application on its restart.
      i downloaded the code and it comes with sintaxi-gap-2e59c387b42cb3878596479870679191be6a14e4 name.
      Can i rename it or is there any constraint i can't change the name or should only add the .app extension like sintaxi-gap-2e59c387b42cb3878596479870679191be6a14e4.app?

      thanks in advance for you help
      cheers

    • Code Generator 2:39 am on August 28, 2008 Permalink

      hey Guru
      if you have successfully deployed your web application on gap can you please help me by giving following answers:

      1-Did you run it after after following any jail breaking procedure…?
      if so then did you follow the procedure defined here http://www.onlamp.com/lpt/a/7281 or something else?
      2- if there is no way to run gap application without taking standard membership from iPhone dev center, then <key>CFBundleSignature</key>
      is the place where should i place something received after standard membership? if not then whats the purpose of this key in info.plist file?
      3- should we replace the values in string ${EXECUTABLE_NAME} and ${PRODUCT_NAME}?
      <key>CFBundleExecutable</key>
      <string>${EXECUTABLE_NAME}</string>
      <key>CFBundleName</key>
      <string>${PRODUCT_NAME}</string>
      or will these be replaced at runtime? if not then what are the appropriate values should we replace?
      4-3- According to iPhone Environment all applications should be copied in iPhone Applications directory with the .app extension
      SpringBoard automatically recognizes the application on its restart.
      i downloaded the code and it comes with sintaxi-gap-2e59c387b42cb3878596479870679191be6a14e4 name.
      Can i rename it or is there any constraint i can't change the name or should only add the .app extension like sintaxi-gap-2e59c387b42cb3878596479870679191be6a14e4.app?

      thanks in advance for you help
      cheers

    • britg 4:18 am on August 28, 2008 Permalink

      Unfortunately I am still waiting on approval to the dev program so I
      cannot help there. And no I did not do any jailbreaking on this
      iPhone. Try asking dirk on the phonegap google group – he is very
      near to publishing the first phonegap app!

    • britg 4:18 am on August 28, 2008 Permalink

      Unfortunately I am still waiting on approval to the dev program so I
      cannot help there. And no I did not do any jailbreaking on this
      iPhone. Try asking dirk on the phonegap google group – he is very
      near to publishing the first phonegap app!

    • Code Generator 9:39 am on August 28, 2008 Permalink

      hey Guru
      if you have successfully deployed your web application on gap can you please help me by giving following answers:

      1-Did you run it after after following any jail breaking procedure…?
      if so then did you follow the procedure defined here http://www.onlamp.com/lpt/a/7281 or something else?
      2- if there is no way to run gap application without taking standard membership from iPhone dev center, then <key>CFBundleSignature</key>
      is the place where should i place something received after standard membership? if not then whats the purpose of this key in info.plist file?
      3- should we replace the values in string ${EXECUTABLE_NAME} and ${PRODUCT_NAME}?
      <key>CFBundleExecutable</key>
      <string>${EXECUTABLE_NAME}</string>
      <key>CFBundleName</key>
      <string>${PRODUCT_NAME}</string>
      or will these be replaced at runtime? if not then what are the appropriate values should we replace?
      4-3- According to iPhone Environment all applications should be copied in iPhone Applications directory with the .app extension
      SpringBoard automatically recognizes the application on its restart.
      i downloaded the code and it comes with sintaxi-gap-2e59c387b42cb3878596479870679191be6a14e4 name.
      Can i rename it or is there any constraint i can't change the name or should only add the .app extension like sintaxi-gap-2e59c387b42cb3878596479870679191be6a14e4.app?

      thanks in advance for you help
      cheers

    • britg 11:18 am on August 28, 2008 Permalink

      Unfortunately I am still waiting on approval to the dev program so I
      cannot help there. And no I did not do any jailbreaking on this
      iPhone. Try asking dirk on the phonegap google group – he is very
      near to publishing the first phonegap app!

    • weeds season 6 4:41 am on June 30, 2010 Permalink

      This looks interesting (: I haven't heard of phonegap before.. I'll look more into it!

    • R01010010 1:08 pm on March 29, 2011 Permalink

      Hey, nice entry, i would love to know if you really need xcode to work with PhoneWap. I wanna know if i can get the uid of the iphone from a webpage using phonegap, what do you think?

    • Orlando web site design 5:00 pm on April 28, 2011 Permalink

      I have never heard of phonegap before but this looks like a nice tool.

    • Orlando web site design 5:00 pm on April 28, 2011 Permalink

      I have never heard of phonegap before but this looks like a nice tool.

    • website coder 4:53 am on May 11, 2011 Permalink

      Those scripts through we can get many easy steps from this.. Really very interesting post.. Thanks for this..

    • web development bangalore 6:28 am on July 12, 2011 Permalink

      Its a very interesting post.I got a lot of information for this.Thanks for sharing.

    • Web design London 11:04 am on November 5, 2011 Permalink

      This looks interesting.But we are looking more from u.So keep on sharing..

    • شقق للبيع في الاردن 9:15 pm on January 27, 2012 Permalink

      Nice entry, i would love to know if you really need xcode to work with PhoneWap.

  • britg 2:27 pm on August 19, 2008 Permalink | Log in to leave a Comment  

    Interviewed in the MIT Technology Review 

    Figaro Interactive was recently Interviewed by the MIT Technology Review for our Google App Engine site, Brave New Fiction.   It’s a nice article on App Engine and what it means for web development in the coming times.

    Web App Writers: Rejoice, Beware

    Software developer Brit Gardner, cofounder of Dallas-based Figaro Interactive, tested App Engine’s capabilities by beginning work on a demo application soon after the service came out. Though he didn’t know Python, the programming language App Engine requires, he says he was able to build his application in the space of a few days. Gardner says that he sees App Engine as significantly different from Amazon Web Services, in that it’s a framework for application development, rather than merely a place to rent processing and storage ­capacity. He says that his site isn’t close to hitting Google’s page-view and storage limits, and he doubts that many other sites will be, either, since there are a lot of sites out there and only so many users.

     
  • britg 9:40 am on August 18, 2008 Permalink | Log in to leave a Comment
    Tags: finances, review   

    A Review of Mint.com 3 Months In 

    Let me preface by saying that most of my friends and family think I’m crazy.  Partly because I spend almost every waking moment with my fingers on, or in close proximity to, the home-row keys; partly because I quit a nice job about a year ago to start a web technology company (did I mention my degree is in Mechanical Engineering?); and partly because I sign up for and use all these new-fangled, never-heard-of, web-based services that sometimes I even have a hard time explaining what they are or why they are useful.

    With that frame of reference, it’s easy to understand why some of my friends think I’m crazy for using Mint.com.  It’s a web-based personal finance company that leverages a slurry of leading edge web technologies to deliver a rich and more convenient money management experience.

    To take advantage of this convenience, you must trust Mint.com enough to give them your account information for every financial service you want them to track.  And, if you want the complete, unfiltered experience, this means you give them the lock and key to your entire financial kingdom.

    Scary, huh?  Well, a lot of my friends and family think so.  But, that’s why there’s people like me – risking life and limb to try out these new services, getting our hands dirty, getting stung so you don’t have to, jumping through… well, you get the point.

    A lot of these services I use I don’t speak very highly of to people that ask me about them, or worse I don’t care enough to talk about them at all.  After a few months of using Mint.com, I felt compelled enough about the service to say: use it.

    If you’re worried about reputability, here’s a couple of items that might or might not help:

    1. They won the TechCrunch 50 last year.
    2. Some schmucks thought enough of them to give them $17 mil in financing.
    3. They have a partnership with the Motley Fool.
    4. They can connect to a bajillion banks – you don’t get that kind of access for long if you’re shady or insecure.

    If you can get past the giving-out-your-information part, here’s why the service is great:

    1. All your finances in one place.  This is huge for me.  I don’t want to spend 30 minutes logging into different online bank accounts, opening different tabs, remembering passwords, doing math to calculate net worth.  Your Mint.com account has all this information behind one account log-in and it’s presented clearly and succinctly, which brings me to…
    2. 99.9% of online bank user interfaces suck. Either because they muck up the interface trying to hawk you their fee-based services, or they just don’t understand usability, most online bank interfaces suck.  They are slow, repetitious, and useful information is usually deeply nested in the slowness and repetitiousness!  Mint’s UI takes advantage of a lot of newer web technologies.  AJAX for live updates to the account, healthy use of javascript for sortable tables and tabbed panels, Flex/Flash for interactive graphing, etc.
    3. The better interface translates to a better understanding of your situation. In my opinion, this makes a big difference in your financial responsibility.  A lot of people I know don’t know what their complete financial situation just because they are too lazy to put all the pieces together!  I know I’ve started checking and understanding my finances more often just because it’s so damn easy.  Previously, I would log into my different accounts and update this amazingly crafted spreadsheet that would crunch numbers and spit out graphs.  It worked great except for the whole me-having-to-update-it part.  I did it maybe once a week?  When it’s all done for you like on Mint you just plain use it more – it’s that simple.
    4. They can connect to so many damn banks.  And it’s all done behind the scenes.  A couple of other services I used relied on these browser plugins that were clunky, recorded your actions, and didn’t work half the time.  I don’t know enough about Mint to understand how they are tapping into all these banks – do they have deals cut with some of them?  Do they have pre-recorded scripts for all these banks?  I don’t know and honestly I don’t care that much – it just works.
    5. Not just banks, investments and loans too.  I’ve set up my IRA and Car loans on Mint as well.  Great way to track something daily that I usually only tracked once a month if I was lucky.  It’s also great to have these long-term finances available because they go into calculting your net worth.  Do most people really know their net worth, not just what’s in their checking account?  I submit that most people don’t but they probably should.
    6. Categorizing transactions is a breeze.  This also goes a long way towards increasing a person’s financial responsibility.  If you can put your transactions into accurate buckets, it’s dead simple to identify where you’re spending too much or where you can trim the fat.  Now, actually taking action is the hard part.

    There are some things that can be improved:

    1. When you log into your account, Mint begins the fetching of data.  While much more streamlined than other services, it’s still a pain to sit there and wait while a rotating ‘wait please’ graphic  bores into your soul, scraping an almost unnoticable chunk of your sanity from your psyche every second.  Or is that just me?  Most people I know check their finances at the same times every day.  If there were a way to tell Mint to fetch the data at a given time during the day so it’s immediately available, that would be great.  If this already exists, it needs to be more prominent!
    2. One of the primary graphs on the account page is your ‘budget’ bar graph.  Mint presents a bar for each of about 5 or 6 categories of transactions for the current month.  These represent what percentage of your budget for those categories you’ve spent so far this month.  There’s also a ‘total budget’ bar at the bottom that’s just the sum of all the categories. This is a nice feature and somewhat useful, but some of the categories don’t fit into this model very well and throw off the usefulness of the total.  For instance, most of my Utilities come all at once – at the end of the month.  So, until the last day of the month my ‘total budget’ is in the green – I’m doing great!  Then, when the utilities hit, my total expenses jump up sometimes well over the budget for that month.  This negates some of the usefulness of the chart as a steady gauge of expenses.  I don’t know the solution to this problem.
    3. Also, Mint.com makes money by giving you ‘Ways to Save’.  These are simply offers from financial institutions that pay Mint to present these to you.  I have no problem with this business model, and more power to it.  But, they definitely need to work on the content of the ‘Ways to Save’.  Most of these extend reality by saying that because I’ll get double the rewards points for every milk purchase if I switch to X service that I’ll save Y amount of dollars.  Oh, and by the way the new interest rate on X service is a lot more than your current one, but we’ll just forget to use that in our calculation.  Come on.  Give me something real to work with.  This may improve over time as more financial institutions start presenting real offers.

    Bottom line though, if you’re looking to give yourself a kick in the ass in the financial responsibilty department, definitely check out Mint.com.  It’s a well thought out, well implemented, and well polished service.

     
    • Gish 8:32 am on August 18, 2008 Permalink

      Hit the nail on the head – You got me into mint.com a week or so after you jumped on board and it's really helped focus my spending (or now lack thereof…). I talked my girlfriend into it too and now it looks like she'll be paying for our next vacation…

      I think mint definitely falls on the reward side of the risk/reward equation.

    • Aaron 12:42 pm on August 18, 2008 Permalink

      Thanks for the kind words.

      Aaron Forth
      VP Product, Mint.com

    • britg 12:48 pm on August 18, 2008 Permalink

      No problem! Thanks for implementing a great service.

    • George 10:14 am on December 23, 2008 Permalink

      Brit:

      Thanks for blogging about this. I found your post helpful when I needed to learn more about Mint.com .

      Since I blog about identity theft and corporate responsibility, I looked more closely at Mint.com and its data security issues in a recent blog post:

      http://ivebeenmugged.typepad.com/my_weblog/2008…

      You and your readers may find this helpful.

      George
      Editor
      http://ivebeenmugged.typepad.com

    • George 6:14 pm on December 23, 2008 Permalink

      Brit:

      Thanks for blogging about this. I found your post helpful when I needed to learn more about Mint.com .

      Since I blog about identity theft and corporate responsibility, I looked more closely at Mint.com and its data security issues in a recent blog post:

      http://ivebeenmugged.typepad.com/my_weblog/2008…

      You and your readers may find this helpful.

      George
      Editor
      http://ivebeenmugged.typepad.com

    • baby jogger double stroller 1:45 am on November 1, 2009 Permalink

      You did the right thing. For those who thought otherwise were wrong. You are very successful in your chosen field and this is the best proof. Keep it up and I'm sure your family will support you all the way.

    • Double Jogging Stroller 4:33 am on March 1, 2011 Permalink

      I'll post the same information to my blog, thanks for ideas and great article.

    • Marlon Ryan Salas Macapilit 9:26 am on April 24, 2012 Permalink

      The even better fact is that despite the ability to carry a lot of weight, the double strollers can still be easily folded and transported.

  • britg 3:36 pm on August 17, 2008 Permalink | Log in to leave a Comment
    Tags: braid, soundtrack   

    Braid Sountrack 

    Found this via joystiq, via mudron’s comic.  I love the music in Braid, and it has the rare quality of being nice to listen to outside of the game context, unlike other game soundtracks I really love.

    Braid Soundtrack on iTunes

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel