Tuesday, April 24, 2012

Designing UI elements with Android fragment and Android SDK Manager issues I ran into

Designing UI elements with Android fragment and Android SDK Manager issues I ran into Implementing your Android UI with fragment not only makes your application components more modular, this is an optimal design for multiple platform if you plan to target your application to be available in all Android platforms such as tablets, Google TV, and mobile. Android introduced fragment in API 3.0 but you don't necessary want to make your min API level to 11+ because then the devices with lower API won't be able to download your application in Google play store.

As seen from graph above, it seems very wise to design min API as low as Android 2.2 to grab the most of the market share. It turns out you can still use Android fragment feature from 3.0 API without increasing the min API level in your application by utilizing Android compatibility package. This requires you to download the support package using Android SDK manager. I also found out there's a sample project comes from your android-sdk\samples\android-xx\APIDemos but when I tried to import the project into the workspace, it gave me the following error:
You do not have the latest version of the SDK Tools installed: Please update.
So it looks like I need SDK Tools and compatibility package - no problem. I decided to simply download latest API levels/support/compatibility packages because who knows if I have to end up debugging particular version of the android. You will get a pop up from motodev and htcdev asking for developer credentials but no worries they are legit - you can create an account for free on their website. After creating developer account, I tried it again - While attempting doing so, I ran into more errors in Android SDK manager. Depending on what you have currently installed in the system, you will get an error:
File not found: ...\android-sdk\temp\google_apis-15_r02.zip (Access is denied)

[2012-04-24 00:01:20 - SDK Manager] Skipping 'Android SDK Tools, revision 19'; it depends on 'Android SDK Platform-tools, revision 11' which was not installed.
Error after error!! One thing to note about access is denied error is that it's not a precise error message. In my case, I simply didn't have anything in that folder. I then thought I might have been to ambitious to install everything at once. Therefore, I just decided to install Android SDK Platform-tools, revision 11 then but SDK manager is still not happy.
Failed to rename directory C:\android-sdk\tools to C:\android-sdk\temp...
The error might tell you to turn off anti-virus because you expose yourself to security risks, make sure you don't have command prompts or folders opened associated with android-sdk. I have no idea why Android SDK tools is not fully backward compatible but I figured out a workaround here eventually. To summarize the trick, I had to do the following:
INSTRUCTIONS:

1. make a copy of the tools directory and call this new directory tools2.

2. DO NOT USE 'SDK Setup.exe'.

3. Instead open up a cmd.exe window as administrator and run the following from this new tools2 directory (obviously the full path on your local machine will be different):

android-sdk-dir> tools2\android.bat update sdk

Basically, as noted before in this thread, 'SDK Setup.exe' invokes tools\android.bat, which makes it impossible for it to rename the tools directory thereafter. It's a bit goofy and should never have passed QA validation..
After you execute the command above, you will be prompted with Android SDK manager and you will be able to install anything you wish for in Android SDK manager. Sudos kudos!


Monday, September 12, 2011

Eclipse in Windows: Cannot run program (CreateProcess error=87), The parameter is incorrect

You will see this when you exceed the character limits on Windows machine in your Java classpath. The character limit for the Windows is the following:

- Windows XP: 8189 characters
- Windows 7: around 33k characters

You will have to somewhat shorten the classpath. There are potential work arounds to this problem.

1) Use the network drive to shorten the classpath

You can use the network drive to shorten the classpath. Instead of having C:\Program Files\Apache\Maven 3.0\....\\xxx.jar, you can shorten the entire path to (i.g. M:\xxx.jar). Make sure to update your Maven's settings.xml and configure your m2clipse settings accordingly.


2) Use -Djava.ext.dirs JVM parameter and exclude Maven dependencies from your run configuration

It's possible that you might still run into exceeding the class path issue even after setting up the network drive. If this is the case, follow the below steps to resolve the issue.

You can use maven's dependency plugin to export all the transitive dependency jars into the specific location. Look Maven dependency plugin. Configure the Maven dependency plug-in on your pom then execute "mvn dependency:copy-dependencies" to export the jars into the folder (i.e. libs).

Once you have exported all the jars, navigate your Eclipse's runtime configurations. Go to Arguents -> VM arguments and add the -Djava.ext.dirs=libs (if your jar folder is libs). Note that this VM argument is separated by ; so you can enter multiple folders.

Tuesday, May 31, 2011

Eclipse is running in a JRE, but a JDK is required



When installing m2eclipse plugin, you might get an error like this in a eclipse console

"Eclipse is running in a JRE, but a JDK is required"

Problem can be solved simply by editing eclipse.ini file from your eclipse installation directory.

The key is that the -vm entry must come before the -vmargs entry. Also, make sure to have a line break between

-vm

and the path.

So in the eclipse.ini file:

THIS WILL NOT WORK:
-vm C:\java\jdk\bin\javaw.exe

BUT THIS WILL:
-vm
C:\java\jdk\bin\javaw.exe

Thursday, July 29, 2010

Google Web Toolkit (GWT) CRUD - SmartGWT





I found this extensive GWT widget developed and licensed under GNU. From the all the GWT frameworks I have seen, this is the best one so far. It has over 260 showcase features and it is open source!. One of the biggest strength of this framework is the support for data integration/binding. GWT is an amazing tool. However, it doesn't have much of built-in framework for form validation/binding. Writing the code for data binding/validation in GWT can consume a lot of time. SmartGWT has amazing API functions to deal these obstacles with just a couple lines of code!

Look at the show case below:
http://www.smartclient.com/smartgwt/showcase/#add_grid_form_category

Pay close attention to Grid-Form-Binding. Writing GWT CRUD screen with SmartGWT sounds like a piece of cake!

For more information:
- Google code: http://code.google.com/p/smartgwt/
- Showcase: http://www.smartclient.com/smartgwt/showcase/


Wednesday, April 7, 2010

Spring MVC Attachment Upload/Download Handler





I implemented an attachment upload/download handler using Spring MVC. Uploading was just a piece of cake because all I had to was wiring the multipart resolver into the configuration and have a bean injected to it. Spring documentation was all I needed.

However, downloading was more tricky. I have to get response's output stream, set mime type and write the byte arrays to it. I found out this great mime type list for 2007 office. Even after I set the mime types for the response, .docx was saying that the file was corrupt. Once I click "Yes" on the recovery, it comes back fine but I am not sure why it is getting corrupted as all the other attachments come back just perfect. If anyone has any insights on this issue, please let me know.

Office 2007 Mime Types
.docm, application/vnd.ms-word.document.macroEnabled.12
.docx, application/vnd.openxmlformats-officedocument.wordprocessingml.document
.dotm, application/vnd.ms-word.template.macroEnabled.12
.dotx, application/vnd.openxmlformats-officedocument.wordprocessingml.template
.potm, application/vnd.ms-powerpoint.template.macroEnabled.12
.potx, application/vnd.openxmlformats-officedocument.presentationml.template
.ppam, application/vnd.ms-powerpoint.addin.macroEnabled.12
.ppsm, application/vnd.ms-powerpoint.slideshow.macroEnabled.12
.ppsx, application/vnd.openxmlformats-officedocument.presentationml.slideshow
.pptm, application/vnd.ms-powerpoint.presentation.macroEnabled.12
.pptx, application/vnd.openxmlformats-officedocument.presentationml.presentation
.xlam, application/vnd.ms-excel.addin.macroEnabled.12
.xlsb, application/vnd.ms-excel.sheet.binary.macroEnabled.12
.xlsm, application/vnd.ms-excel.sheet.macroEnabled.12
.xlsx, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xltm, application/vnd.ms-excel.template.macroEnabled.12
.xltx, application/vnd.openxmlformats-officedocument.spreadsheetml.template


Wednesday, January 27, 2010

DisplayTag feature to expose row numbers

I was working on Spring MVC and DisplayTag to structure the table. I had a list of objects and needed to refer the index of an item because I had to use <spring:bind>

I discovered a cool DisplayTag feature that exposes the row number of an item. Here is an example:

<display:table name="ticketList" id="ticket"> 
<display:column title="Row Number">
${ticket_rowNum}
</display:column>
</display:table>



You are basically appending "_rowNum" to the variable to get the row number.

Monday, March 30, 2009

Life Goes On: LuxuryMagic #14 - Sun Certified Java Programmer 6.0!




I dedicated a past few weeks to study for the exam. I finally received the certification today! Next is Sun Certified Web Component Developer (SCWCD). In the meantime, I submitted my resumes after receiving the certification. I don't know my decision of pursing this certification rather than finding job earlier would turn out. Hopefully, I get to hear some good news but the current economy is fairly tough especially for junior level developer like me.

Wednesday, December 17, 2008

Life Goes On: LuxuryMagic #13 - Business Card



This business card is designed by my roommate who owns design company called Broad Sighted. I initially provided him ideas for designing LuxuryMaster.net because I wasn't very proficient on CSS during that time. I received basic lesson from him so I am a bit better now but he is really good.

He provided me excellent quality of work designing 5 different front end main pages with various color schemas depicting various mood with amazing amount of details in all places.

I will now be independently working on back-end infrastructure and I am currently planning on the whole infrastructure although I have my idea fairly solid. I remember spending a whole semester designing the architecture in school when I was working on my senior project.

Although the group of 4 spent whole semester of designing basic architecture, we ran into various issues when writing codes for the actual product. I was the team leader of the group and it was very stressful to change the implementation all the time. I learned my lesson from that and I don't plan on quick rushing on this project =)

Anyways, due to his successful performance on my LuxuryMaster.net's front end UI work, I asked him to design the business card and look how it came! I can't upload the actual version of the card because it contains personal information but if you look at it carefully, you will be able to see transparent color scheme applied in different vertical layers and it is simply amazing!

If any of you are interested getting web hosting and design services for your business, I suggest you to contact him. You may visit his website Broad Sighted for more details.



Friday, December 12, 2008

Life Goes On: LuxuryMagic #12 - It's my turn to protect








I have decided to stop playing online poker for a while as I have found more joyful and meaningful things to do in my life. I haven't decided how I will spend the money I get from the withdrawal but I am sure I will figure something out =)

I purchased a book called "Real Estate Millionaire: Secret Strategies To Lifetime Wealth Today" by Dean Graziosi. I haven't had a chance to read much about the book it seemed interesting because it seems like anyone can possibly work on trading real estate properties because you don't have to have credit, or investment, or anything.

I also plan to work on my LuxuryMaster.net in the meantime and stay tuned for the updates on the site!

Thursday, December 4, 2008