Yacine's

JMVC + JQM improved dispatch

In my previous example, I used an eval to load a page controller from the jQuery.fn  name space. Here is a much better version of that code which has the added benefit of allowing access to the instance of my controller:

1
2
3
4
5
6
7
8
If ( typeof MyApp.Pages[pageName] === 'function') {
    // don't really need the element passed here per this example's controller, will check if needed.
    pageInstance  = new MyApp.Pages[pageName]($('body'));
    pageInstance.view.done( function ( htmlOutput ) {
        $('body').append(htmlOutput);
        $('#' + pageName).page();
        $.mobile.changePage( $('#' + pageName) );
    }

On the controller side, the init method becomes much simpler than I had originally written:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
 * @class MyApp.Pages.Frontpage
 */
$.Controller('MyApp.Pages.Frontpage',
    /** @Static */
    {
        defaults : {
            itemsPerPage : 20,
            currentPage : 1
        },
        pluginName: 'frontpage'
    },
    /** @Prototype */
    {
        /**
         * Downloads and renders a full page of blog posts
         */
        init : function() {
            this.view = $.View("my_app/pages/views/frontpage.ejs", {
                items: MyApp.Models.BlogPost.findAll({
                    start : (this.options.currentPage-1)
                            * this.options.itemsPerPage,
                    count : this.options.itemsPerPage
                })
            });
        }
    }
); // End of controller

Read the full article »

Share

PhoneGap + JavascriptMVC production build

Once you build your app and produce production.js and production.css (hopefully through an ant script like mine), you may notice that your app does not run once deployed with PhoneGap. This is because it seems the recommended way of bootstrapping your app in JMVC uses the script’s URI to specify the app name: “../steal/steal.production.js?myappname” which PhoneGap does not appear to support.

The simple workaround is to resort to this notation instead:

1
2
3
4
<script src="../steal/steal.production.js"></script>
<script>
    steal('myappname/production.js').then('myappname/myappname.js');
</script>

Read the full article »

Share

Javascript MVC + PhoneGap + jQm Build with Ant

In an effort to streamline the build of mobile applications, I made an ant build file to automate some of the tasks you would normally have to do to package your JMVC webapp and deploy it into an android project.

Here is the interesting parts of my build.xml file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
    <target name="build" description="Builds the app for production"  depends="">
        <exec executable="./js" dir="${src}/.." vmlauncher="no">
           <arg line="${src}/scripts/build.js"></arg>
        </exec>
        <copy todir="${build}/steal">
            <fileset dir="${src}/../steal"></fileset>
        </copy>
        <copy todir="${build}/${appName}/images">
            <fileset dir="${src}/images"></fileset>
        </copy>
        <copy file="${src}/${appName}.html" tofile="${build}/${appName}/index.html"></copy>
        <replace file="${build}/${appName}/index.html" token="steal/steal.js" value="steal/steal.production.js"></replace>
        <move file="${src}/production.css" tofile="${build}/${appName}/production.css"></move>
        <move file="${src}/production.js" tofile="${build}/${appName}/production.js"></move>
    </target>

Read the full article »

Share

PhoneGap + JavascriptMVC + jQuery Mobile

I started a new mobile app project and decided to go with HTML5 wrapped with PhoneGap. The reasons are many and this post isn’t about why, but how.

Before you start, here are the libraries/frameworks I am using:
jQuery Mobile – a “Touch-Optimized Web Framework for Smartphones & Tablets”
Javascript MVC – a Javascript MVC Framework (and more)
PhoneGap – “HTML5 app platform”/embedded cross platform browser

Read the full article »

Share

Macbook battery woes

My Macbook’s battery is finally dead, which means the book shuts down immediately if I unplug it from power. I accidentally pulled on the power cable yesterday, and as a result my usually rock solid Leopard OS started showing me instability of applications, and eventually the dreaded screen of death.

Luckily, I have time machine running and backing up everything. I rebooted on the OSX install disk, ran a repair disk through the Disk Utility, then restored a couple of the Application Support folders under my user folder that I found to have been corrupted (mostly stuff I had running at the time of the crash: Firefox, Mail, VLC, iTunes, etc.)

Read the full article »

Share

Why The FCC Wants To Smash Open The iPhone

Apparently, the FCC is asking Apple, AT&T and Google some questions as part of an investigation into the recent rejection by Apple of the Google Voice app. The FCC wants to know if AT&T had a hand in that rejection, and why Apple rejected it. See the full story at the Washington Post below:

Why The FCC Wants To Smash Open The iPhone.

Share

Google Voice app GV Mobile ported to jailbroken iPhones, web app version in the works

The google voice app was rejected by Apple’s app store. It quickly went underground as a result driving more people like me to jailbreak their iPhones. <rant> I don’t understand this childish paranoia on the part of Apple and AT&T. I am pretty much disillusioned with the whole Appstore approval process. The Skype app for example was castrated to work only on Wifi. After I gave so much of my hard earned money to ATT and Apple, I need them both to take a humility pill and stop playing these games with app developers. </rant>

Google Voice app GV Mobile ported to jailbroken iPhones, web app version in the works.

Share

Is Digg down?

I can’t seem to get anything out of digg.com for almost 10 minutes. Life goes on and all, but I am wondering if its just me or if other people out there are having the same problem?

Share

Thruthful feature list

Found this on NewEgg: “LCD Features: Glare”. Wow, I’ve always wanted that feature!!!

NewEgg MSI X320

Share

iPhone SDK 2.2.1 is out

I just got an email about the iPhone SDK 2.2.1. From what is says, it is : ” required for development with devices updated to iPhone OS 2.2.1″. That is weird, what in the new update (which just came out recently) required a new SDK update?

I am downloading it now, I am curious!

Share

Cheap IT to start a business (Part 2)

Friends ask me all the time: how much would it cost to start a business from an IT perspective, as in get a website, get email, phone numbers, an ERP system, a CRM system, some basic automation, etc. This makes non-techies very nervous when just starting out on the cheap. Word on the street is that these things cost millions. Interestingly enough, most people don’t know that they can do most of that expensive stuff for next to nothing, and a little elbow grease.

This article is not meant as an in depth how-to but more as an example of what you can get done with a little knowledge when just starting out.

Click here if you’ve missed Part 1 of this article

Read the full article »

Share

Cheap IT to start a business (Part 1)

Friends ask me all the time: how much would it cost to start a business from an IT perspective, as in get a website, get email, phone numbers, an ERP system, a CRM system, some basic automation, etc. This makes non-techies very nervous when just starting out on the cheap. Word on the street is that these things cost millions. Interestingly enough, most people don’t know that they can do most of that expensive stuff for next to nothing, and a little elbow grease.

This article is not meant as an in depth how-to but more as an example of what you can get done with a little knowledge when just starting out.

Read the full article »

Share

Blog Blogging

I found a plugin for WordPress that allows me to auto-blog stories of interest from other sites with a single click. While I provide ample reference and links to the original sites, I am wondering if any of you (all 3 of you who visit my site ;-)  have any thoughts about this.

Legally, I am in full compliance with the terms of use of the different sites, and happy to provide them with additional oh so precious Google Page Rank.  This also helps my site by providing me with free content on topics I like from sites I like. Is this a win-win situation or what?

Share

Burney Falls Video

This is another video I took of Burney Falls. Taken with my Panasonic Lumix DMC-LX2 at 1280×720, 15fps.

Get the Flash Player to see this content.

Share

Santa Cruz Natural Bridges

Nice day by the tide pools in Santa Cruz’s natural bridges beach. Took this with my Panasonic Lumix DMC-LX2 at 1280×720 (original looks better, flash encoding still looks ok though)

Get the Flash Player to see this content.

Share