Tech Tips

HTC Magic – android phone in India total let down

UPDATE 18th Aug 2009:

Finally fastboot problem of perfected SPL is taken care of. We were able to flash new ROM on our android. Google Maps, Android Market, Gmail, Quickoffice, youtube etc are available.

We also tested our application Aw’ Shugs, need some tweaking.

Following links were extremely useful.
http://forum.xda-developers.com/showthread.php?t=548218
http://forum.xda-developers.com/showthread.php?p=4335330#post4335330
How to create GoldCard

All credit goes to xda-developers guys.
————————————————————————————
We bought HTC Magic India’s first and only android phone hoping to test our applications but it has been a total let down. Complete waste of money.
- Cannot root it. SAPPHIRE PVT 32A SHIP S-ON H, HBOOT-1.33.0010 (SAPP10000) CPLD-12 which cannot be rooted.
- There is no android market
- There are no applications by default for eg google maps.

All you get is an expensive touch phone with normal features and no useful app.

We called at least 30 dealers before purchasing and none of us any idea what is android market and whether handsets will have it or not. Only response was buy it to find it. I contacted HTC support asking them how to install google maps, they gave me long instructions on how to use android market to install google maps :) Anyway, it took 3-4 emails and then they realized this handset does not have android market with no immediate plans to release it.

If you are planning to buy HTC magic (India) for development, don’t.

Images after upgrade:

Phone after the upgrade | newdevice2.png


Tools for iPhone UI (user interface) design, mockups, wireframes or just a sketch

iphone-mockup.pngWe tried several tools and methods for user interface designing of iPhone applications. We now use a combination of these tools and our choice depends on what best suits the product as well as the customer. The key point is communicating the design clearly to both the customer and developers.

Before going into details, let me just list the iPhone design and mockup (wireframe) tools/methods in no particular order:

  1. Use Interface Builder (Mac only)
  2. Use Balsamiq mockup tool (Mac, windows, linux) – http://www.balsamiq.com (http://www.balsamiq.com/blog/2009/03/01/iphone-controls-new-icons-and-much-more/)
  3. Use Omnigraffle (Mac only) and import an iPhone stencil – (http://www.omnigroup.com/applications/omnigraffle/download/ and http://www.graffletopia.com/search/iphone)
  4. Use paper and a stencil- http://www.designcommission.com/shop/iphone-stencil-kit/
  5. Use a pre-printed sketch paper – http://labs.boulevart.be/index.php/2008/06/05/sketch-paper-for-the-mobile-designer/
  6. Use photoshop and the iPhone PSD – http://www.teehanlax.com/blog/?p=1628
  7. Use Adobe Fireworks – http://blogs.adobe.com/fireworks/2008/08/iphone_gui_as_adobe_fireworks.html and http://www.building43.com/videos/2009/06/23/mockup-iphone-app-adobe-fireworks/
  8. Although not there yet, you can try http://iphonemockup.lkmc.ch/
  9. Use the stencil kit from Yahoo! which is available in a variety of formats – http://developer.yahoo.com/ypatterns/wireframes/
  10. Use the sketchbook available at http://www.mobilesketchbook.com/

Some bonus stuff

Lazy as I am, I decided to write details about each iPhone UI design tool later, so till then please use the list above and explore them.

If I missed your favorite tool, please let me know in comments and I will gladly add it here.


Android tip #1 ContentProvider , Accessing local file system from WebView / showing image in webview using content://

ok, this was a tough one.
First be informed that this is something Google (Android people) are trying to prevent i.e. letting browser (WebView) have access to the local file system. In earlier releases of SDK you could access local files using ‘file://’ but it is stopped now. Then there was an option where you can provide a WebViewClient and implement shouldOverrideUrlLoading to make it work. This was also removed.
The way to make it work now is by implementing your own ContentProvider, there is lot of discussion and documentation on implementing ContentProvider but all that is completely redundant (not needed). The solution is very simple, create your own ContentProvider and only override

public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException

Rest of the code in ContentProvder is not needed for this problem.

Step 1:
Declare your Content Provider in AndroidManifest.xml

<provider android:name="MyDataContentProvider"  android:authorities="com.techjini" />

Step 2:
Create your ContentProvider and implement openFile
All you have to do is get real path from uri, open it and return the descriptor

URI uri = URI.create("file:///data/data/com.techjini/files/myImage.jpeg");
File file = new File(uri);
ParcelFileDescriptor parcel = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
return parcel;

Step 3:
(You need this step only if file is not already present on the device/sdcard)
Save your content to the file. Following is an example to store a Bitmap

FileOutputStream fos = openFileOutput("myImage.jpeg", Activity.MODE_WORLD_WRITEABLE);
imageView.getBitmap().compress(Bitmap.CompressFormat.JPEG, 100, fos);

fos.flush();
fos.close();

You can find out where your image is stored using

System.out.println(getFilesDir().getAbsolutePath());

Step 4:
Access the file in WebView

myWebView.loadUrl("content://com.techjini/myImage.jpeg");
//com.techjini is what you mentioned in 'android:authorities' in your AndroidManifest.xml

Looks simple :)


MySql tip #2 Taking backup ensuring multi byte characters does not become garbage

If you have multi byte data in your tables its important to take backup in utf8 which can be done using the command below:

mysqldump -u root --default-character-set=utf8 DB_NAME | gzip > DB_NAME-`date +%Y%m%d%H%M`.sql.gz

The date parameter simply appends date/time to the backup.

In order to restore the backup taken above use following command

gunzip < FILE_NAME.sql.gz | mysql --default-character-set=utf8 -u root DB_NAME

This will ensure that db is back up without affecting multi byte data.


JBoss tip #5 Keeping the project in exploded .war file in some other location other than deploy folder

This is how you can increase your productivity while developing an app on Jboss, no need to package and deploy again and again, reduced development and testing time.

Open %JBOS_HOME%\server\default\conf\jboss-service.xml and add the new location

    <attribute name="URLs">
        deploy/, E:/ file:/var/opt/apps/
     </attribute>
1 Comment more...

JBoss tip #4 Increasing the jta time out from default 5 mins to more

Open %JBOSS-HOME%\server\default\conf\jboss-service.xml


name="jboss:service=TransactionManager">
3600
${jboss.server.data.dir}/tx-object-store

[/sourcecode language='css']

3600
[/sourcecode language='css'] by default it would be 300, here we changed it to 3600 which is 1 hr.


MySQL tip #1 How to find size of a mysql database

In order to find size of your mysql databases you can run following sql querry:

SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB"
FROM information_schema.TABLES GROUP BY table_schema ;

Divide it by further 1024 to get it in GB.

For more information read about INFORMATION_SCHEMA

1 Comment more...

JBoss tip #3 Accessing the application out side the local machine

Open %JBOSS_HOME%\server\default\deploy\jboss-web.deployer\server.xml and change the address to “0.0.0.0″

     <Connector port="8081" address="0.0.0.0" maxThreads="250" maxHttpHeaderSize="8192"
        emptySessionPath="true" protocol="HTTP/1.1"
        enableLookups="false" redirectPort="8443" acceptCount="100"
        connectionTimeout="20000" disableUploadTimeout="true" />

Jboss tip #2 Changing the default port number 8080 to some other port

Open %JBOSS_HOME%\server\default\deploy\jboss-web.deployer\server.xml and change the port as per your requirement.

<Connector port="8081" address="0.0.0.0" maxThreads="250" maxHttpHeaderSize="8192"
        emptySessionPath="true" protocol="HTTP/1.1"
        enableLookups="false" redirectPort="8443" acceptCount="100"
        connectionTimeout="20000" disableUploadTimeout="true" />

Jboss tip #1 Connection Pooling And DataSource creation

Which ever data source you create (for instance lets say for oracle data source or mysql data source ) file name should end with “name-ds.xml” and the content should be

<?xml version="1.0" encoding="UTF-8"?>

   <datasources>
         <local-tx-datasource>
           <jndi-name>tjOracleDS</jndi-name>
            <use-java-context>false</use-java-context>
                   <connection-url>jdbc:oracle:thin:@localhost:1521:tjdb</connection-url>
                   <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
                     <user-name>staging</user-name>
                   <password>staging</password>
                    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
                        <min-pool-size>5</min-pool-size>
                   <max-pool-size>30</max-pool-size>
                   <blocking-timeout-millis>5000</blocking-timeout-millis>

                 <metadata>
                    <type-mapping>Oracle9i</type-mapping>
                 </metadata>
         </local-tx-datasource>

       </datasources>
<use-java-context>false</use-java-context>   

This help us to remove java:comp from jndi look up for data source


© Copyright 2009 TechJini Solutions Private Limited. All Rights Reserved
iDream theme by Templates Next | Powered by WordPress