Thursday, April 23, 2015

Redcarpet

Redcarpet is a Ruby library for rendering markup language.   When updating a CodePath Wiki guide entry, which hosts these documents outside of GitHub, I noticed that the list items not to be including the image tags that I used in a separate line:

1. Inside the Google Play Store for your project, navigate to `Settings` -> `API Access`:

    <img src="http://imgur.com/0n7ihzM.png"/>

I would see:

<ol>
<li>Inside the Google Play Store for your project, navigate to...
</ol>

<p><img src='http://imgur.com/0n7ihzM.png'/&amp></p&amp>


But if I added 4 spaces to the image tag, the problem went away:

1. Inside the Google Play Store for your project, navigate to `Settings` -> `API Access`:

        <img src="http://imgur.com/0n7ihzM.png"/>
 
Turns out that a change was made in Redcarpet v3.1.0 that changes the parsing behavior so that at least 4 spaces are needed for the line to be considered part of the list item.  It also is very likely that GitHub must be using an older version of this library, since this problem doesn't appear on native GitHub Wiki pages.   If GitHub should ever decide to upgrade to this new library, they're likely to cause their Wiki collection to experience similar problems!

https://github.com/vmg/redcarpet/commit/b7d5e017385a8ae35a594ff9535d31bd081ce973

Monday, March 30, 2015

Brain surgery on a Nexus 5

A few days ago, my Nexus 5's display started turning colors.  A few minutes later, it stopped showing.

Rather than buying a new phone, I decided to see if it could be repaired with some surgery.  I bought a $70 replacement frame and digitizer and $5 in tools.  The video walkthrough seemed pretty straightforward right?



Little did I realize that I would have to move everything from the old unit to the new frame, including the two power buttons, the battery (the video warns about puncturing and inhaling the toxic chemicals), the front and back camera, antenna board, and the main CPU.   Not to mention the microphone pieces (watch very carefully the video about the additional part you must bring over too!)

You don't really need a dryer gun since the adhesive is pretty easy to remove.  The tricky part is getting the shell of the phone off -- they are connected with small snap-ins that can break if you're not careful. Once I managed to get a few of these snap-ins loose, I could use a flathead screwdriver to remove the rest around the edge.  The video also shows what you need to do if you don't have a replacement digitizer like the part that I ordered -- I skipped over that step.

3 hours later, after making sure every single part was moved over (again, check the microphone and the part that sits below it!) it's working great. At first I thought I had failed because only the screen turned on. The battery had apparently drained so upon plugging in, I was able to see the Android Lollipop screen.  My only major issue is that I may have damaged on of the two antenna ports on the board, but the phone operates fine with just a single one plugged into it.  I plan to solder the other cable onto the socket just in case.

Nonetheless, I hope I just saved myself $400 on a new Nexus phone!


Wednesday, February 11, 2015

Want to verify your W2 submission form?

A few weeks ago, I got a letter from the SSA notifying me that my electronic employer W2 submission was wrong. I knew it was related to the electronic file format generated by Wave, but wasn't sure what was happening. After waiting 2 weeks for a response from their support team, I decided to write a small script to figure out what was happening...

https://gist.github.com/rogerhu/bef3c9cba4005f346002

It confirmed to me that their generation was off by a factor of 10.  It was fixed later by the company without notifying customers about the issue.

Also, it turns out that the SSA provides a Java applet called AccuWage that allows third-party companies to verify that their file format generation is correct...

Saturday, February 7, 2015

How to get IntelliJ to recompile Android resource files

If you want to use IntelliJ to build your Android projects, make sure that the SDK versions in your Project SDK matches that in your Preferences->Module SDK. Otherwise, you may find that you have to click Rebuild Project each time you make changes to the XML version!