alamin ahmed: a typical geek 2.0

ideas.experiments.thoughts.life

home blog about me
twitter: aahmed753

Archive


Topics:

iPhone made Objective-C popular

posted on: July 25, 2008 at 06:35 am

Objective-C? most developer didn't even know that such programming language existed, which is the primary programming language used for Mac OS X programming. Other programmers looked at it, then then turned away from it's bizarre use of square brackets. Objective-C never really got much attention from developers, that is until now.

iPhone SDK has been long anticipated by developers. Now that it's in the wild, only way to actually use it, is through Objective-C. Considering impact of iPhone platform and it's market, many amateur and big guns are driving into iPhone developers program. Screwing head with Objective-C, which probably will erase your memory with Java, C++ or any other programming language you used to code.

Tagged: iphone   objective-c   iPhone SDK   Parma Link | Comment(s)

iPhone is acting like Windows ME

posted on: July 24, 2008 at 10:40 am

Not allowing third-party software on iPhone was one of the biggest drawback and strength at the same time. Apple insisted that allowing door to thrid-party would instabilize the iPhone experience. Apple could've sworn that people be happy and satisfied with just the Phone, Internet Communicator and iPod. Who knew people would want to use iPhone as a tip calculator.

After using Mac for last two years, I almost forgot the that a computer can decide for itself to shutdown/restart/freeze when ever it wants. I forgot how often I used kicked my desktop tower, broke dozens of keyboards just out of frustrations. Well, it's all coming back to me now.

iPhone restarted on me more then 30 times since the upgrade of iPhone 2.0 and installing third-party software on it. Say hello to iPhone ME.

It seems to me that most of the problem is due to lack of memory management by these new amateur developers. Most of these new developers coming from programming languages that used to handle memory management (garbage collection) automatically. Even some one who developed for desktop Mac application, didn't need to care about memory leaking. And let me say from a developer point of view, memory management manually is not picnic.

Nevertheless, third-party software is a great thing that happened in iPhone version 2.0. Now I finally get to pay the waitress exactly 15% and take a break from iPhone while it restarts.

Tagged: iphone   iphone 2.0   Apple   Parma Link | Comment(s)

maximize iPhone's battery life.

posted on: July 24, 2008 at 01:30 am

10 hot and useful tips to maximize iPhone's battery life.

Apple Inc. claims that iPhone has 8 hours talk time, 250 hours of standby, 6 hours of Internet, 7 hours of video playback and 24 hours of audio playback!! These are very impressive numbers, except that claims has lots of strings attached which no one actually reads it.

Although, you may not get even close to these numbers, but I will attempt to provide all tweaks and settings to get as close as possible.  I have collected most of these tips from Apple's fine prints and some from support page of an iPod. Don't worry, I am not going to ask you to turn of Wi-Fi or other features that would simply cripple your iPhone.

  1. Brightness setting:  this alone can do the trick of getting most out your iPhone's (or any device for that matter) battery life.  Even though iPhone has bright and gorgeous screen, you may want to turn it down to get that screen playable little longer!
    How-to: "Settings" -> "Brightness" -> slide it to about one seventh
  2. Auto brightness: iPhone has built-in sensor that checks the lighting condition where ever you are and adjust the brightness accordingly.  This is sweet feature, but the sensor eats up battery life.
    How-to: "Settings" -> "Brightness" -> turn the "Auto-Brightness" switch "OFF"
  3. Auto-Lock: turn that display off as frequently as possible.  Make sure it is set to 1 Minute
    How-to: "Settings" -> "General" -> "Auto-Lock" -> "1 Minute"
  4. Auto detect Wi-Fi: iPhone has feature to
    How-to: "Settings" -> "Wi-Fi" -> "Ask to Join Networks" -> turn "OFF"
  5. Email Check frequency: this may not be suitable for lots of business or frequent email users, but it does save battery life.  You can set iPhone to check email every 15, 30, 60 minutes or do manual check.  Of course, ideal setting for saving battery would be "Manual", but you can also set to "Every hour"
    How-to: "Settings" -> "Mail" -> "Auto-Check" -> select "Manual" or "Every hour"
  6. Turn of some sounds: iPhone makes noise for about everything you do on it.  You can turn off some of these sound effects such as keyboard click noise and Lock Sound noise.  These two are really unnecessary for the most part.
    How-to: "Settings" -> "Sounds" -> "Lock Sounds" turn "OFF" and "Keyboard Clicks" turn OFF
  7. Turn of that Equalizer: yes, according to Apple, turning of Equalizer will save little battery time!
    How-to: "Settings" -> "iPod" -> "EQ" -> "Off"
  8. Turn of Sound Check: iPhone provides Sound Check feature to adjust music volume to keep consistent range for all songs.  Most of the time it does not work (at least for my songs).  So you can turn it off to save some juice.
    How-to: "Settings" -> "iPod -> "Sound Check" turn "OFF"
  9. Audio encoding: compress size of your music file for better cache purpose and encode using MP3 or AAC encoding. AIFF and some other formats are not good and eats up CPU cycles
  10. Room Temperature: Keep iPhone in room temperature and do not charge your iPhone while it is in carrying case or cover.  This keeps battery in ideal temperature even when charging.
Hope these tricks help you get more life out of your iPhone's battery.  Just as an additional note, Apple has also announced iPhone's battery replacement program for $79.99 + shipping.  read it here: http://www.apple.com/support/iphone/service/battery/

Tagged: iphone   tips   Parma Link | Comment(s)

10 must-know guidelines for iphone web app developers

posted on: August 31, 2007 at 12:00 am


I visited iPhone Tech Talks on 30th of August.  Initially I wasn't thrilled about it and didn't have much expectation .  However, I found the show to be very informative and fun.  I got to seat and chat with many developers who are actively working on lots of cool iPhone apps and services.

In the beginning of the show, they mentioned that we are in bidirectional NDA (Non Disclosure Agreement) contract.  I do not see any secretive information from Apple or iPhone's prospective, but Some developers had some interesting ideas which I'm not going to disclose.

There were bast information given in 5 hours lecture - from Developer's scenario to optimizing for iPhone and how iPhone's safari renders web pages. I tried to gather most of the valuable information and organized in category of guidelines.  Hope these helps!!

  1. Separation of contents:   
    1. Put all JavaScript on .js file and all styles on separate .css file.  
    2. Obvious explanation is for better coding and readability, but main advantage is that - this design practice improves loading speed on iPhone, specially on edge network.  This is because safari caches all css and js files when they are separate.
  2. Use Standards:  
    1. iPhone supports following standards: HTML 4.01, XHTML 1.0, DOM, CSS 2.1, some CS3, Javascript Ecmascript 3.  
    2. Does not support WML.  
    3. My tip, which they didn't mention but I think is good practice, is to use XHTML 1.0 Strict rules instead of HTML 4.01 and XHTML 1.0 Transitional.  This ensure most compatibility and speed of browser for rendering.
  3. Know the limitations:
    1. Resource limitations:
      1. 10MB for each text based files (each html, js, css).  This is huge, so I don't actually consider as limitation.
      2. 8MB for images such as tiff, gif, png
      3. 32MB for jpeg images.
      4. 2MB of animated gif. If the animated gif is larger, iPhone will simply show the first frame and won't animate.
      5. if a page is greater then 10MB, it may load, but would cut resources from any other open window, if available.
    2. Javascript limitations:
      1. as I mentioned 10MB file size.
      2. only 5 second of execute.  This is to ensure a script does not make the iPhone non responsive.  
        1. If the execute time is greater, it will through Exception.
        2. So put it on try catch block.
      3. Know that script maybe paused.  So when window is inactive your script is paused.  So javascript timer will not show accurate time when user leaves the safari or goes to different window.
    3. Plug-in limitations:
      1. No Java
      2. No Flash
      3. no SVG
    4. File System
      1. NO File System
      2. Upload button will be disabled and grayed out.
  4. Know what is supported: 
    1. Most of javascript functions, events are supported:
      1. window.open, target="_new", alert(), confirm(), prompt()
        1. even though alert, confirm and prompt are a bad way to send or receive information from users in real desktop browser, iPhone it's totally different case.  In fact it is encouraged.  The script window looks good and sexy.  Feels like real app window.
      2. Events:
        1. tap triggers onclick, onmousedown, onmouseup and onmousemove
        2. two finger triggers mousewheel
        3. all other events such as blur, focus, load, unload, reset, submit, change, abort are supported
        4. please note that you can not call blur or focus events using javascript.  But events will be fired when these events happens.
    2. Supported Files within web browser:
      1. Excel. Nicely converts to html and put separate sheets as tabs.
      2. Word.
      3. PDF. Does not support password protected files.
      4. Quicktime audio and video:
        1. H.264 base 2, 640x480 at 30fps
          1. Does NOT support B frames
        1. AAC-LC upto 48kHz
        2. mov, mp4, m4v, 3gp
        3. mpeg-4 part 2
      5. Canvas for animation and data driven content
        1. Canvas is now Standard
        2. Used to create all Mac OS Widget
        3. now supported by Opera, Firefox
        4. iPhone uses complete implementation
        5. iPhone's stock uses Canvas to animate and show data
    3. Built-in Fonts
      1. Ariel, Courier, Georgia, Trebuchet, Zapfino,Helvetica, Times, Verdana
  5. Scaling/Zooming and META tag:
    1. iPhone will scale a web page to 980x1091 first, then scale back to 320x480.  They use this technique for all web sites.
    2. iPhone looks for following meta tags for overriding default scaling:
        1. this will not scale at all and just render the page to 320 width
        1. initial-scale = 1 means 100%, 2 means 200% and so on.
      1. other values for contents
        1. user-scalable=yes/no
          1. if set to no, user can't pinch or zoom
        2. minimum-scale or maximum-scale
    3. Control zooming on every element of the HTML page
      1. use -webkit-text-size-adjust property to control zooming by double tapping to all html elements including div, table, body.
        1. -webki-text-size-adjust has following values:
          1. none: disable zooming
          2. auto: let Safari handle it
          3. %: set to a percentage
  6. Integrate with iPhone's app
    1. integrate with Google Map Application
      1. simply like using anchor with show me pizza!
      2. q parameter is for terms
    2. integrate with Phone App
      1. call us
    3. integrate with Mail App
      1. email me
  7. Understand iPhone's User Agent
    1. iPhone User Agents has following terms
      1. iPhone;U;CPU like Mac OS X;en 
      2. AppleWebKit/420 - gives WebKit version
      3. Version/3.0 -  3 for Safari 3 family
      4. Mobile/xxxx - iPhone Safari build number
      5. Safari
  8. Understand iPhone Safari's preference:
    1. This is important because developer needs to know that users can disable and enable some features from the iPhone's Setting.
      1. javascript can be turned off (on by default)
      2. pop-up block can be turned off
      3. cookies policy can be changed just like desktop Safari
  9. MISC. Tips:
    1. create rounded rectangle:
      1. user -webkit-border-radius css property to create nice rounded rectangle.
    2. create button or header
      1. user -webkit-border-image to create nice headers and buttons
    3. user javascript frameworks
      1. iUi (praised by the staffs)
      2. YUI (Yahoo library)
      3. dojo
      4. prototype
      5. JQuery
    4. use CS3 media query to detect iPhone when including css files
      1. iPhone returns "screen" and width value
    5. turn on server-side compression
      1. this alone can save up-to 50% of download time.
  10. DEBUGGING
    1. Turn on developer's menu for safari,learn how.
    2. Download nightly build Webkit which includes excellent and extended "Inspect Element" tool.  http://webkit.org/
    3. User Drosera (comes with nightly build webkit for only for Mac)  for debugging Javascript.
Tagged: web design   iphone   Parma Link | Comment(s)

copyright© 2008 alaminahmed.com || powered by me!