tl;dnrUse Jackson, not Gson. Use this article as a reference for basic features.Part 5 of this short series of articles ended with section 5.17 of the Gson user guide, "Streaming". (Sections 6 and 7 will not be reviewed.) This sixth part includes a summary of the key differences between Gson and Jackson noted so far, along with a table of contents listing for easy navigation to the various sections of this review. | Link To This Articlehttp://goo.gl/0oR3t |
2011-07-11
Gson v Jackson - Part 6
2011-07-10
Gson v Jackson - Part 5
tl;dnrUse Jackson, not Gson. Use this article as a reference for basic features.Part 4 of this short series of articles ended with section 5.14.3 of the Gson user guide, "User Defined Exclusion Strategies". This fifth part continues with section 5.15 on "JSON Field Naming Support", and ends with section 5.17 on "Streaming", which is the end of the Gson user guide. Part 6 will include a summary of the key differences between Gson and Jackson noted so far, along with a table of contents listing for easy navigation to the various sections of this review. | Link To This Articlehttp://goo.gl/fWihj |
2011-07-03
Gson v Jackson - Part 4
tl;dnrUse Jackson, not Gson. Use this article as a reference for basic features.Part 3 of this short series of articles ended with section 5.10.1 of the Gson user guide, "InstanceCreator for a Parameterized Type". This fourth part continues with section 5.11 on "Compact Vs. Pretty Printing for JSON Output Format", and ends with section 5.14.3 on "User Defined Exclusion Strategies". Part 5 will continue with section 5.15 on "JSON Field Naming Support". | Link To This Articlehttp://goo.gl/RpFIE |
2011-07-02
Gson v Jackson - Part 3
tl;dnrUse Jackson, not Gson. Use this article as a reference for basic features.Part 2 of this short series of articles ended with section 5.7 of the Gson user guide, titled "Serializing and Deserializing Collection with Objects of Arbitrary Types". This third part continues with section 5.8 on "Built-in Serializers and Deserializers", and ends with section 5.10.1 on "InstanceCreator for a Parameterized Type". Part 4 will continue with section 5.11 on "Compact Vs. Pretty Printing for JSON Output Format". | Link To This Articlehttp://goo.gl/HsIea |
2011-06-27
Gson v Jackson - Part 2
tl;dnrUse Jackson, not Gson. Use this article as a reference for basic features.Part 1 of this short series of articles ended with section 5.3 of the Gson user guide, titled "Nested Classes (including Inner Classes)". This second part continues with section 5.4 on "Array Examples", and ends with section 5.7 on "Serializing and Deserializing Collection with Objects of Arbitrary Types". Part 3 will continue with section 5.8 on "Built-in Serializers and Deserializers". | Link To This Articlehttp://goo.gl/qkceb |
2011-06-25
Gson v Jackson - Part 1
tl;dnrUse Jackson, not Gson. Use this article as a reference for basic features.What is this post?Is this yet another JSON-to/from-Java API comparison? Yes, it is. It's the most comprehensive comparison of using Gson versus Jackson for common JSON-to/from-Java tasks known. The sections below walk through each section of the Gson user guide, demonstrating similar implementations with Jackson. API features beyond what is described in the Gson user guide are then reviewed. | Link To This Articlehttp://goo.gl/YuYhx |
2011-05-25
Deserialize JSON with Jackson into Polymorphic Types - A Complete Example
Jackson API Versions NoteThe following code examples were written using Jackson 1.7.x or 1.8.x. They probably work as-is with Jackson 1.9.x, but Jackson 2.0 introduced API changes significant enough that this code does not compile with it. On initial review, it appears that package names changed, and at least one method signature changed or was moved or was renamed or no longer exists. In the near future, I may post updated code examples that use Jackson 2.x.tl;dnrSkip to the fourth, fifth, and sixth examples.Why This Post ExistsWhile recently answering a question on StackOverflow.com about deserialization of JSON into polymorhpic types in Java, I couldn't find a simple and complete example using Jackson. At the time of this writing, the official documentation on the subject describes aspects of how to do this, but it doesn't have a full example. Searching other resources also didn't turn up any complete examples. | Link To This Articlehttp://goo.gl/nVKBZ |
Following are deserialization examples with Jackson that build up to a complete example of populating a polymorphic data structure in Java. The first three examples do not involve Polymorphism. Polymorphism is introduced in the fourth example.
Labels:
jackson,
java,
json,
polymorphism
2011-05-20
Fixing GeekYouUp's Battery Widget
tl;dnrGeekYouUp's Battery Widget for Android can be altered to reduce App Widget display update occurrences by as much as 40-65% (depending on device power use rate), without altering application functionality or otherwise hindering its ability to display the current battery charge level. Battery Widget's constantly running service, necessary for real-time monitoring of battery charge level changes, appears to use negligible resources and does not noticeably prematurely drain battery power. | Link To This Articlehttp://goo.gl/mscyj |
Following are links to the code of the fixed version of Battery Widget, logs of the svn differences showing what was changed from the original code, and a fully-built Android APK, ready to be installed on any Android device. This APK was built with a different package name, a different application name, and a different digital signature than the Battery Widget application by GeekYouUp. It can be installed in parallel with the original -- it does not replace the original Battery Widget application during installation.
- batterywidget-svn-trunk-2011.05.17-FIXED-src.zip
- batterywidget-svn-trunk-2011.05.17-DIFFS.zip
- batterywidget-svn-trunk-2011.05.17-FIXED.apk
For Those With Interest In The Details...
Labels:
Android,
App Widget,
Battery Widget,
GeekYouUp
2011-04-26
A Simple, Complete App Widget - Part 1
Note: This blog post is incomplete, and I discontinued posting part 2, as the Widget API and abilities were changing significantly with new releases of Android, at the time of writing. I left this post online, as it has many views, and some useful content. While information on developing App Widgets for the Android home screen is plentiful, much of what's available - including the contents of many books on Android software development - is incomplete, often broken, and leads to improperly functioning App Widgets. One all too common outcome is App Widgets that unnecessarily run users' batteries down. Another frequent fail includes funky App Widget behavior if more than one instance exists on a user's home screen. This post is intended to provide a complete blueprint for folks to follow, to develop their own App Widgets that display dynamic content while consuming minimal device resources, provide standard user input controls, and otherwise work correctly as expected. | Link To This Articlehttp://goo.gl/RN1ga |
2011-04-10
Android Widget Design Guidelines - Widget Sizes
While the Android Widget Design Guidelines do clearly list the bounding box dimensions for widgets, they don't list recommended dimensions for the outer frame or the inner edge box. The following apparent recommendations were extracted from the standard widget frames Photo$hop files they provided for download.
Unfortunately, these dimensions don't all nest with even spacings. For example, the portrait-mode inner edge box has a width of 207, which leaves 33 pixels of padding to split between the left and right sides, but 33 is an odd number, and we cannot split a pixel in half, so one is left to decide what to do with an extra pixel. My solution is to simply shrink the inner edge box width to 206 pixels.
Portrait Mode | |||
---|---|---|---|
4 x 1 | 3 x 3 | 2 x 2 | |
Bounding Box: | 320 x 100 | 240 x 300 | 160 x 200 |
Outer Frame with Shadow: | 304 x 75 | 224 x 272 | 144 x 189 |
Inner Edge Box: | 287 x 58 | 207 x 256 | 129 x 174 |
Landscape Mode | |||
---|---|---|---|
4 x 1 | 3 x 3 | 2 x 2 | |
Bounding Box: | 424 x 74 | 318 x 222 | 212 x 148 |
Outer Frame with Shadow: | 412 x 63 | 305 x 200 | 199 x 136 |
Inner Edge Box: | 395 x 46 | 288 x 182 | 184 x 121 |
Unfortunately, these dimensions don't all nest with even spacings. For example, the portrait-mode inner edge box has a width of 207, which leaves 33 pixels of padding to split between the left and right sides, but 33 is an odd number, and we cannot split a pixel in half, so one is left to decide what to do with an extra pixel. My solution is to simply shrink the inner edge box width to 206 pixels.
Of course, different screens will actually use different numbers of pixels both horizontally and vertically (depending on actual screen sizes and pixel densities). For this reason, and to have smaller graphics file sizes, as the guidelines suggest, use 9-patch graphics, but note that scaled graphics might be fuzzy in appearance, and it may be necessary to create LDPI, MDPI and HDPI versions of widget graphics. For Paint.NET, I made simple templates for the six standard widget sizes. Download and enjoy. (I'm using the term "template" loosely. These templates simply have three layers each with outlined boxes matching the dimensions described above.) | Link To This Articlehttp://goo.gl/C13Nx |
2011-03-24
Corrections for Android Tutorial "Hello, Views > Spinner"
The Android Developer's guide (available at http://developer.android.com/guide/index.html) is an excellent resource for folks looking to develop Android applications. Of course, as is much technical documentation, it's infected with code bugs and errors. In particular, this post lists errors in the "Hello, Views > Spinner" tutorial, available at http://developer.android.com/resources/tutorials/views/hello-spinner.html, and includes step-by-step corrections for these problems. This information was communicated to the Android development team in Android Issue 12817. | Link To This Articlehttp://goo.gl/P408h |
2011-03-22
Android Protector OWNED Easy as 1, 2, 3!
Not content with the original password protection of Android 2.2 on my T-Mobile G2, I went searching through the Android Market for other solutions. Amongst the adware and other junkware I stumbled across Android Protector v3.3.1 by Alexander Kosenkov, which looked promising. So, I decided to give it a try, installed it, and set about seeing if it did what it claimed to do, and whether it was easy to defeat. | Link To This Articlehttp://goo.gl/u0NZK |
The basis of the revolutionary and disruptive approach I took to break Protector stems from playing a lot of video games growing up. If there's one thing I learned during all those precious hours of youth spent in front of the TV with a game controller in hand, it was to TRY AGAIN. When Mario died because I didn't jump far enough, I just tried again. When Mike Tyson KO'd me before I got him, I just tried again. When those re-attempts failed, I just tried again.
Applying this life lesson to TRY AGAIN to attempting to defeat Android Protector proved useful. I was able to bypass Android Protector's security measures less than three minutes after installing and using it for the first time.
The steps to do so are simple:
- After installing and configuring Protector, restart the Android phone so the application is enabled, then search for the application in the Android Market, and select it in the search results listing. At this point, Protector covers the screen with a security code input box, otherwise preventing access to the Android Market screen beneath it. Just use the back arrow to return to the home screen.
- Launch the Android Market application, again. The Market app should try to immediately return you to viewing the Protector application listing, but of course, Protector should again cover the screen with the security code input box. After it does, just press the back arrow to return to the home screen.
- Launch the Android Market application, again. Amazingly, the Market app displays the Protector application listing and Protector does not cover the screen with the security code input box. Press the link to Uninstall Protector. Protector is thus defeated without ever needing to input the security code.
A short video of these steps in action is available on YouTube.
What have you OWNED today?
HOWTO: Install T-Mobile G2 USB Driver
While Googling for G2 USB driver does currently lead to some pages that list working instructions for installing the driver on M$ Windows machines to connect to a T-Mobile G2 Android phone through USB with adb, many of the search results were not useful, and this post is small contribution to help direct folks to a solution. (Plus, who knows what will happen to the info pages at tmobile.com, with AT&T acquiring T-Mobile.) | Link To This Articlehttp://goo.gl/leNAj |
After installing the Android SDK, and selecting to install the latest Google USB Driver package with the SDK and AVD Manager, edit the android_winusb.inf file, located in the directory where the Google USB drivers installed (which currently is android-sdk/extras/google/usb_driver), and paste in the following three lines, at the end of the sections labeled "[Google.NTx86]" and "[Google.NTamd64]".
;T-Mobile G2
%SingleAdbInterface% = USB_Install, USB\VID_0BB4&PID_0C91
%CompositeAdbInterface% = USB_Install, USB\VID_0BB4&PID_0C91&MI_01
Then, connect the G2 to the computer with a USB cable, ensure the phone is in debug mode, and follow the remaining instructions at http://developer.android.com/sdk/win-usb.htmlNote that it's sometimes necessary to repeat this process after downloading and updating the Google USB Driver package, as the updates can clear out the previous custom configuration changes.
2011-03-12
HOWTO: Clone VirtualBox VM (from existing Hard Disk) and Change the UUID
Currently, Google searching for information on how to clone VirtualBox Virtual Machines or how to move a VirtualBox VM (to a new host directory, host disk, or host machine) leads to a lot of folks stuck with cloning failures, apparent dead ends, outdated information, and VirtualBox features that don't seem to work correctly. While poking around enough leads to working solutions, this blog post is a small contribution to help direct folks towards success. | Link To This Articlehttp://goo.gl/BOiD6 |
Note: These steps work for me running VirtualBox 4.0.4 r70112 (and with the latest 4.0.6 r71416), on Windows 7 Home Premium x64 SR1. I am new to using VirtualBox and my experience level is yet introductory. Also, the information provided here is listed elsewhere on the internet, and is probably somewhere in the VirtualBox documentation.
Without further ado, to copy a flat (i.e., without snapshots) virtual machine, with the VM not running (i.e., stopped), follow these three steps:
- First, create a copy of the VDI file, using Windows Explorer or a simple copy command:
copy abc.vdi def.vdi
- Then, change the UUID of the new VDI file with the command
VBoxManage.exe internalcommands sethduuid def.vdi
- And finally, from within the VirtualBox Manager, create a new Virtual Machine, selecting to use the new VDI as an existing Hard Disk.
To simply move the location of an existing VDI file on the host, or to copy or move the VDI file to another host, it does work to delete the VM within the VirtualBox Manager, without actually deleting the VDI file on the host file system (obviously, deleting the VM on the current host is not necessary if moving to a new host), move the VDI file to the new location, and then create a new VM, selecting to use the moved VDI file as an existing Hard Disk.
Alternatively, to move the VDI file on the host without deleting the existing VM, close the VirtualBox Manager and shut down all VM instances. (Shutting down the VMs not associated to the move might not be necessary.) Then, edit *all* of the file paths in the .vbox file associated with the VM to be moved. By default, the .vbox file is in a subdirectory in the host user's home directory (e.g., C:\Users\User1). The .vbox file name should match the name of the VDI file, and be in a subdirectory with a name that also matches the name of the VDI file. The .vbox file is a simple text XML file, easily edited in Windows Notepad. Finally, start the VirtualBox Manager, select the newly moved VM, which should still be listed on the left side, where all of the VMs are listed, and start it.
Note that changing the UUID of the VDI file is not necessary, when simply moving it.
Labels:
clone,
HOWTO,
UUID,
VirtualBox,
VM
2011-02-22
FAIL: New Computer First Use: Stack Overflow
I needed a built computer quickly, so I bought a HP, because it was priced well at a local (national chain) store. And this is what I got when using it for the first time.
I then uninstalled most of the pre-installed apps (including zinio, adobe air, adobe flash, bing bar, blio, hp mediasmart music, hp mediasmart dvd, dvd menu pack for hp mediasmart video, hp mediasmart photo, mp mediasmart smartmenu, hp mediasmart video, hp mediasmart/touchsmart netflix, hp moviestore, hp support assistant, kobo, movie theme pack for hp mediasmart video, norton internet security, norton online backup, pdf complete special edition, pressreader, roxionow player, picturemover, photonow, power2go, powerdirector, hp setup manager, hp games, labelprint, cyberlink dvd suite deluxe, microsoft office 2010, Microsoft SQL Server 2005 Compact Edition [ENU], PlayReady (MS DRM), and Windows Live Essentials), applied security patches, installed apps that I like, and I'm a happy HP user, so far. | Link To This Articlehttp://goo.gl/OrSQP |
Subscribe to:
Posts (Atom)