Archive for June, 2010
Gotchas with Rooting a MyTouch Slide
Jun 29th
I got a hold of an extra MyTouch slide for testing and wanted to root it in order to put some a different ROM on there (namely Cyanogen). The MyTouch slide root instructions are fairly well documented and have worked for a lot of people. Unfortunately they did not work for me and I got stuck where 90% of most people get stuck, in the “loop”. I was stuck in this mode for a week and nearly called it quits until I found this Gem last night. I could not get the loop to recognize my device as “offline”. Well, it would, but only for a split second.
I then found out why:
The instructions don’t point this out, and maybe this case is only due to my device but here goes:
- With the USB unplugged from the Phone and computer, Boot into HBOOT (with the phone off, press Power + the Down Volume). Then wait a second for the boot loader to try to find some images and then once its done navigate down to “recovery” (DO NOT GO INTO RECOVERY YET), so at this point “recovery” is just highlighted. Plug the USB into the phone, the other end of the USB should NOT be plugged into anything. So now you should have a phone with a USB cord connected/dangling not connected to the computer. Read this through, then do it: Now you will need to start the loop. Then as soon as you can, plug the USB into the computer. As soon (I mean lightning quick here people) as you feel the USB pop into place ENTER RECOVERY MODE (hit the power button). This has to be done before your phone recognizes that its plugged into the USB. As soon as the phone recognizes its in USB mode it will change from HBOOT to HBOOT with USB (or something like that, you’ll see it at the top of the screen in blue when in HBOOT). Notice: the switch from HBOOT to HBOOT WITH USB is almost instantaneous. Its about 1/2 of 1 second, its that quick. So AS SOON AS YOU feel the USB click (gotta be super fast people), enter recovery mode.
- I had to use the stock SD card that came with the phone, not a new/replacement one. Previously I had a 4 gig card in there from an old phone which was actually bought at Micro Center (had photos/files/etc on it). I read somewhere that you needed to use a stock SD card (I guess the types are different). Long story short: The new card I had in the phone did not allow it to show up as “offline”. I used the stock SD card and magically the phone started showing up in the loop immediately.
That pretty much did it for me. I was able to root the phone, install other roms and then I went full circle and brought it back to factory settings with this ClockworkMod nandroid backup.
So key points: Be fast with plugging in the USB and entering recovery mode. Use the stock SD card not some junk you bought from Micro Center (like me).
Android App – Eventdroid Released
Jun 28th
Last week I released Eventdroid, the first Android based Eventbrite Bar code Scanner / Event Check-in App. With this app you can check in attendees to your Eventbrite app with your Android phone using a bar code scanner – or if you prefer to do it manually, you can check them in one by one through the manual check in process.
You can check out Eventdroid by either installing it (scan the barcode below) or you can get more details on the official Eventdroid website.
Scan the barcode to download Eventdroid
Pruning Elmah Files with Powershell
Jun 22nd
We use (and love) Elmah. Due to many reasons we decided to opt for the XML file logging to AppData. This works great and is super simple to set up. The only issue is that on our test and production servers we were filling up the AppData directory and after awhile Elmah.axd would take minutes to load.
I wrote a Powershell script that we could put on a timer (Windows Schedule Task) that would delete all but the last 100 error logs. This is a pretty brute force script, but simple. Unfortunately due to some internal regulations we were not able to use the script so I’m sharing it here.
How to Use
Download the source below and save it as “prune.ps1″. Run it like this:
#> .\prune.ps1 -prunedirectory “c:\path\to\elmahlogs\”
The script will keep the 100 most recent. Do you want more kept around? No problem, just change the “$numberOfFilesToKeep” variable.
Enjoy -
param
(
[string] $prunedirectory = $(throw "Parameter - 'prunedirectory' is required.")
)
$numberOfFilesToKeep = 100
$files = get-childitem $prunedirectory*.xml | sort-object -property CreationTime -descending
for($i = $numberOfFilesToKeep; $i -lt $files.count; $i++) { rm -force $files[$i].fullname }
Android: Db4o StackOverflowError
Jun 21st
I
‘m using db4o for a persistence store in an Android app since db4o allows FREE usage in Android apps I decide it would be a good fit. Until I ran into the an error I could not get around for a couple of weeks.
Over the last couple of weeks I’ve been dealing with an error from hell, the StackOverflowError. I reworked the object model, I cut down the calls, trimmed up all the fat in the Android app I could find and I couldn’t find what was causing the db40 classes to throw a StackOverflow error.
The error that I’d get back would look like this:
06-12 18:31:06.630: DEBUG/dalvikvm(17018): newInstance failed: no ()
06-12 18:31:06.640: INFO/dalvikvm(17018): Stack overflow, expanding (0x41869200 to 0x41869000)
06-12 18:31:06.640: INFO/dalvikvm(17018): Shrank stack (to 0x41869200, curFrame is 0x41869698)
06-12 18:31:06.640: DEBUG/AndroidRuntime(17018): Shutting down VM
06-12 18:31:06.640: WARN/dalvikvm(17018): threadid=3: thread exiting with uncaught exception (group=0x4001b180)
06-12 18:31:06.690: DEBUG/dalvikvm(17018): GC freed 5995 objects / 562312 bytes in 36ms
06-12 18:31:06.800: DEBUG/dalvikvm(17018): GC freed 3836 objects / 436456 bytes in 79ms
06-12 18:31:06.840: DEBUG/dalvikvm(17018): GC freed 687 objects / 167288 bytes in 33ms
06-12 18:31:06.860: ERROR/AndroidRuntime(17018): Uncaught handler: thread main exiting due to uncaught exception
06-12 18:31:07.020: DEBUG/Gmail(140): MailEngine.sendOrSaveMessage messageId=1338387167469109248 refMessageId=0, conversationId=1338387167469109248
06-12 18:31:07.030: WARN/ActivityManager(76): Activity pause timeout for HistoryRecord{449684b8 com.google.android.gm/.ComposeActivity}
06-12 18:31:07.090: DEBUG/dalvikvm(17018): GC freed 3055 objects / 566504 bytes in 215ms
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): java.lang.StackOverflowError
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.foundation.CircularLongBuffer4.remove(CircularLongBuffer4.java:73)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.caching.LRU2QLongCache.produce(LRU2QLongCache.java:40)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.caching.LRU2QLongCache.produce(LRU2QLongCache.java:14)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.io.CachingBin.getPage(CachingBin.java:153)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.io.CachingBin.readInternal(CachingBin.java:65)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.io.CachingBin.read(CachingBin.java:57)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.io.BinDecorator.read(BinDecorator.java:40)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.io.BlockAwareBin.blockRead(BlockAwareBin.java:90)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.IoAdaptedObjectContainer.readBytes(IoAdaptedObjectContainer.java:210)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.IoAdaptedObjectContainer.readBytes(IoAdaptedObjectContainer.java:201)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.LocalTransaction.readPointer(LocalTransaction.java:387)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.LocalTransaction.getCurrentSlotOfID(LocalTransaction.java:355)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.LocalObjectContainer.readReaderOrWriterByID(LocalObjectContainer.java:437)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.LocalObjectContainer.readReaderByID(LocalObjectContainer.java:415)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.LocalObjectContainer.readReaderByID(LocalObjectContainer.java:419)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.marshall.UnmarshallingContext.readBuffer(UnmarshallingContext.java:127)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.marshall.UnmarshallingContext.read(UnmarshallingContext.java:40)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.ObjectReference.read(ObjectReference.java:304)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.ObjectReference.read(ObjectReference.java:290)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.ObjectContainerBase.getHardObjectReferenceById(ObjectContainerBase.java:956)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.marshall.AbstractReadContext.classMetadataForObjectId(AbstractReadContext.java:85)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.marshall.AbstractReadContext.readObject(AbstractReadContext.java:57)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.marshall.AbstractReadContext.readAtCurrentSeekPosition(AbstractReadContext.java:46)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.OpenTypeHandler.read(OpenTypeHandler.java:172)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.Handlers4.readValueType(Handlers4.java:313)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.marshall.AbstractReadContext.readAtCurrentSeekPosition(AbstractReadContext.java:48)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.marshall.AbstractReadContext$1.run(AbstractReadContext.java:38)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.marshall.SlotFormat.doWithSlotIndirection(SlotFormat.java:64)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.marshall.AbstractReadContext.readObject(AbstractReadContext.java:36)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.handlers.array.ArrayHandler.readInto(ArrayHandler.java:381)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.handlers.array.ArrayHandler.readElements(ArrayHandler.java:363)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.handlers.array.ArrayHandler.read(ArrayHandler.java:355)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.Handlers4.readValueType(Handlers4.java:313)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.marshall.AbstractReadContext.readAtCurrentSeekPosition(AbstractReadContext.java:48)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.OpenTypeHandler.read(OpenTypeHandler.java:172)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.Handlers4.readValueType(Handlers4.java:313)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.marshall.AbstractReadContext.readAtCurrentSeekPosition(AbstractReadContext.java:48)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.marshall.AbstractReadContext$1.run(AbstractReadContext.java:38)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.marshall.SlotFormat.doWithSlotIndirection(SlotFormat.java:64)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.marshall.AbstractReadContext.readObject(AbstractReadContext.java:36)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.marshall.AbstractReadContext.read(AbstractReadContext.java:28)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.FieldMetadata.read(FieldMetadata.java:811)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.FieldMetadata.activate(FieldMetadata.java:646)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.handlers.StandardReferenceTypeHandler$2.processAspect(StandardReferenceTypeHandler.java:93)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.metadata.MarshallingInfoTraverseAspectCommand.processAspect(MarshallingInfoTraverseAspectCommand.java:52)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.metadata.StandardAspectTraversalStrategy.traverseAllAspects(StandardAspectTraversalStrategy.java:24)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.ClassMetadata.traverseAllAspects(ClassMetadata.java:2086)
06-12 18:31:07.100: ERROR/AndroidRuntime(17018): at com.db4o.internal.handlers.StandardReferenceTypeHandler.traverseAllAspects(St
After posting on the forums I was given some advice from Fabio (who looks to be an employee),. He advised to try the TransparentActivation mechanism. I implemented it on my 6 classes and in the configuration of db4o as shown in an example in the previous link.
Magically, the error went away. So, if you get this error, implement the Activatable interface (or IActivatable in .NET).
NOTE: This could be vastly useful when Windows Phone 7 is released if you’re using it for .NET.
Db4o’s Java Doc/Documentation/Help in Eclipse
Jun 12th
This may be easy to remember for others (and I’m sure I’ll remember it eventually) but here is…
When I mouse over a call, I want the java-doc to be presented so that I can see what the api options/docs are. Just referencing the jar is not enough. Here’s what you have to do after you’ve added Db4o to your build path:
- Expand “Referenced Libraries”branchof your project in Package Explorer.
- Select db4o-* library, right-click and open “Properties”
- Select Javadoc Location in the list and browse to \doc\api folder in your db4o installation (or wherever you downloaded/extracted the db4o stuff) I place mine into c:\sdk\db4o\
Now you’ll get nice java docs in eclipse like this:



