Skip to content

Review of “Building iPhone Apps with HTML, CSS, and JavaScript”

13-Feb-10

This is a great overview of how to style your web site for the iPhone. It provides a basic introduction to HTML and CSS and covers some of the iPhone webkit specific CSS classes and meta tags. There is a brief introduction to the jQuery Touch JavaScript framework. The book also covers using the PhoneGap framework for writing native iPhone applications using HTML, CSS, and JavaScript.

Some of the highlights of this book include a helpful Pro/Con list at the beginning to help you decide if learning Objective-C and using CocoaTouch to write an iPhone app is what you want to do. It would have been nice to also cover, or mention, the Appcellerator mobile framework to build native iPhone applications. There are two great chapters that cover using client side storage in your applications and also techniques for making sure your applications work when the phone is offline.

If you are somewhat familiar with HTML, JavaScript, and CSS and want to write a web based iPhone application I would highly recommend this book.

Share and Enjoy:
  • del.icio.us
  • DotNetKicks
  • DZone
  • Reddit
  • Digg
  • StumbleUpon
  • LinkedIn
  • Facebook
  • FriendFeed
  • HackerNews
  • Netvibes
  • Posterous
  • Tumblr
  • Twitter

Goals for 2010

07-Jan-10

So I’ve been mulling around what I want to do, at least in terms of my development skills and community type stuff, in 2010 (The year we make contact). I figure if I blog them up here, I can refer back to them and check on my progress at the end of the year.

  1. Help out with the MVC Turbine docs
  2. Finish my Ringbinder project and release it
  3. Write a simple little app for use at home in either Clojure or Smalltalk
  4. Continue to learn Python
  5. Write a small app that runs on the Google App Engine
  6. Write a blog post, either here or on my work blog, at least once a week
  7. Redesign this blog
  8. Work on and launch the coderdads.info site I’ve had in mind for a while

I’m sure I’ll come up with more as the year progresses and I, hopefully, finish up these tasks.

Share and Enjoy:
  • del.icio.us
  • DotNetKicks
  • DZone
  • Reddit
  • Digg
  • StumbleUpon
  • LinkedIn
  • Facebook
  • FriendFeed
  • HackerNews
  • Netvibes
  • Posterous
  • Tumblr
  • Twitter

Benchmarking a simple DOM based cloning template

10-Dec-09

Sara Chipps recently posted a simple DOM based clone template method she uses in one of her apps. "Easy HTML Templating with JQuery"

My template looks like this:

CODE:
  1. <script id="ItemTemplate" type="text/html"
  2.         <li class="item" value="|rowNumber|">
  3.               <input type=”text” id=”input|rowNumber|” />
  4.         </li>
  5.     </script>


Now within my code I need to put a place holder where I want my HTML to go. I have my unordered list called url_list.

CODE:
  1. <ul id="url_list"></ul>

Now, you see that most of my items look like this “|rowNumber|” I have a variable in my code called nextUniqueItemID (I believe in extremely descriptive variable names). Here is my “addItem” function.

JAVASCRIPT:
  1. function addItem() {
  2.         var list = $('#url_list'),
  3.                       items = list.find('li');
  4.         list.append($('#ItemTemplate’)
  5.                                     .html().replace(/\|rowNumber\|/gi, nextUniqueItemID++))
  6.     }

The use of global variables aside (cough,cough),I looked at it and, having used something like this myself, thought that it would work find for data sets containing a very small number of items. The problem is these kinds of clone based templates are VERY slow compared to the templating engines that are available for various JavaScript libraries.

I happened to read a post by Brian Landau called "Benchmarking Javascript Templating Libraries" this morning and wondered just HOW MUCH slower is the naive template method than a good template library?

I grabbed the benchmarking code and modified it to run the new clone based template method.

JAVASCRIPT:
  1. var nextUniqueItemID = 0;
  2.     function addItem() {
  3.         var list = $('#url_list'),
  4.         items = list.find('li');
  5.         list.append($('#ItemTemplate').html().replace(/\|rowNumber\|/gi, nextUniqueItemID++));
  6.     };
  7.    
  8.     $(document).ready(function(){
  9.         var output = $('#output');
  10.         $.benchmarks = {};
  11.    
  12.       $.benchmarks.test_simple = function(){
  13.         addItem();
  14.       };
  15.      
  16.       $.benchmarks.loop_test = function(){
  17.         for (var i=0; i <5; i++){
  18.           addItem();
  19.         }
  20.       };
  21.  
  22.       // use these lines to run the benchmark tests in your browsers JS console
  23.       // $.benchmark(1000, '#simple_test', $.benchmarks.test_simple);
  24.       // $.benchmark(1000, '#loop_test', $.benchmarks.loop_test);
  25.     });

Since the template Sara provided contains an input tag you get a different benchmark if you run the simple_test and the loop_test separately after refreshing your browser. You can run the tests for yourself here, the loop test *may* cause your browser to give you a "script is running slow" message, hit continue as the loop will eventually end. You may also get different numbers if you run the tests in IE, Chrome, and Safari.

results: using FF 3.5.5
Simple Test: 1.71s
Loop test: 31.534s

When you consider that the slowest loop test using a template library was just around 4.5s, you get a better idea of just how slow this method is when you have an input in your template.

So that's fine, but it's known that dynamically adding text inputs is slow in just about every browser and the original tests don't use inputs at all, just divs. So let's modify the template and see what the results are.

CODE:
  1. <script id="ItemTemplate" type="text/html">
  2. <div class="test"><h2>This is a test of |name|</h2><p>The homepage is <a href="|url|">|url|</a>.</p><p>The sources is: |source|</p></div>
  3. </script>

I modified the addItem function to account for the new data. n.b. The data I'm using is static, if you wanted to use a data source you would just modify this method to take in your data parameters.

JAVASCRIPT:
  1. function addItem() {
  2.         var list = $('#url_list'),
  3.         items = list.find('li');
  4.         list.append($('#ItemTemplate').html()
  5.             .replace(/\|name\|/gi, "Clone template method")
  6.             .replace(/\|source\|/gi, "http://girldeveloper.com/waxing-dev/easy-html-templating-with-jquery/")
  7.             .replace(/\|url\|/gi, "http://girldeveloper.com/waxing-dev/easy-html-templating-with-jquery/"));
  8.     };

results using FF 3.5.5 - refresh between each test
simple test: 1.285s
loop test: 3.771

results using ff 3.5.5 with no refresh between tests
simple test: 1.434
loop test: 4.227

So that's looking a little bit better. Not too much slower than the template libraries.

So what do the template libraries give you? Well the replace method works find provides your data is escaped properly. But say instead of a url in the "source" replacement, you use a file path like "file:\\foodrive\source.txt". Well it still gets replaced, but the text looks like this "file:\foodrivesource.txt". So in addition to the replacement, you have to make sure your data is properly escaped. A lot of template libraries will do this for you. Also notice that the addItem method has to do a DOM lookup on every iteration of the loop to get the template. If you have a large DOM, this could impact the performance.

Share and Enjoy:
  • del.icio.us
  • DotNetKicks
  • DZone
  • Reddit
  • Digg
  • StumbleUpon
  • LinkedIn
  • Facebook
  • FriendFeed
  • HackerNews
  • Netvibes
  • Posterous
  • Tumblr
  • Twitter

Can a language be abused?

02-Dec-09

K. Scott Allen has a great post showing an "abuse" of the lambda syntax in C#.

But I'm wondering, can any use of programming language really be called abuse? The language designers and creators put the ability to create the hack described above into the language. If they didn't want you to do things like that, why put the ability in there at all? Using undocumented calls within the language to do strange things is one thing, but simply using calls within the language itself?

What are some of the best "abuses" you've seen of a language?

Share and Enjoy:
  • del.icio.us
  • DotNetKicks
  • DZone
  • Reddit
  • Digg
  • StumbleUpon
  • LinkedIn
  • Facebook
  • FriendFeed
  • HackerNews
  • Netvibes
  • Posterous
  • Tumblr
  • Twitter

Announcing Planet ASP.NET MVC

02-Dec-09

I’ve created a “Planet” type site that aggregates posts from different sources about the ASP.NET MVC Framework. Feel free to suggest new feeds you’d like to see on here. Content owners, I’ve made every effort to ensure proper attribution (e.g. the link here and the link in the feed point to the source of the post, author names are retained). However if you want your content removed from this feed, feel free to contact me with no hard feelings.

Mainly, it's for my personal benefit. I wanted to have a single source for my ASP.NET MVC news but Google searches pulled in a bunch of "why MVC isn't for me" type of posts, which I don't really care about. Those people are just wrong. ;)

You can find it here. It may eventually get it's own domain and a nifty theme.

Planet ASP.NET MVC

Share and Enjoy:
  • del.icio.us
  • DotNetKicks
  • DZone
  • Reddit
  • Digg
  • StumbleUpon
  • LinkedIn
  • Facebook
  • FriendFeed
  • HackerNews
  • Netvibes
  • Posterous
  • Tumblr
  • Twitter

Why should I care about Big-IP 10.1?

23-Nov-09

 

Big-IP 10.1 has been released announced. It includes a lot of new features and enhancements to some existing features.

You can read some of the press releases on our main news page:

F5 Delivers Advanced Web Security Solutions to Help Customers Efficiently Address Threats to Web Applications and Enhance Business Performance

F5's BIG-IP Solution Enables Service Providers to Transparently Scale and Grow Mobile Services

F5 Enhances IP Geolocation Capability through Partnership with Quova

F5 Solutions Optimize Microsoft Windows 7 and Windows Server 2008 R2 Deployments

 

Enhanced support for Windows 7 and Windows Server 2008 R2.

Direct Access and BranchCache

Microsoft DirectAccess lets Windows 7 clients create a secure connection directly to the network over IPsec rather than having to create a separate VPN connection. That means that you can still access your files securely while you are enjoying coffee and a scone at Starbuck Joe wrote a great article addressing how Big-IP 10.1 helps enable DirectAccess using Windows 7 clients with Windows Server 2008 R2 servers in your enterprise. BranchCache is a new feature in Windows 7 and Windows Server 2008 R2 that will cache content from remote servers on local servers. You can access the file once it is cached as if you were working in the remote office, using less WAN bandwidth and wasting less of your time. BranchCache can work in one of two modes: Hosted cache mode and Distributed Cache mode. In hosted mode, a Windows Server 2008 R2 server will host the cached content. In Distributed mode the clients will host the cached content. Big-IP v10.1 will route the file requests to the correct server or client.

 

Security

DNSSEC

Lori wrote a great post about what DNSSEC is and how it works, “It’s DNSSEC Not DNSSUX”, and Jason posted an article explaining how to configure the new DNS features using both the GUI and TMSH. Configuring GTM Version 10.1's DNS Security Extensions

Advanced bot and scanner protection

Big-IP 10.1 includes support for detecting web site scraping and allows you to set thresholds for locking out IP addresses.

Enhanced reporting

ASM’s new Attack Expert System helps make sense of the attacks you see logged against your network. Each attack has a list of possible attack types and the types are explained. The reporting GUI has been reworked. You can either view a chart or drill down into the attacks with a few clicks. Ten-Point-One also includes a PCI compliance report.

 

Look for some more information about some of these features in the coming months.

 

(edited for clarity SCK)

Get Adobe Flash playerPlugin by wpburn.com wordpress themes