Translate the News

After reading the “Substitutions” xkcd comic, I knew that I had to create a bookmarklet. In addition to the substitutions that were suggested, I added the following:

  • Domestic → “in the ‘hood”
  • iPad → Game Boy
  • Android → Mr. Roboto
  • President → Chief Big-Wig
  • Majority Leader → High Inquisitor
  • Minority Leader → First Loser
  • Democrats → Communists
  • Democrat / Democratic → Commie
  • Republican → Fascist
  • legislation → magic

To create the bookmarklet, just create a normal bookmark. Then, edit the bookmark, copying the following code into the “Location” or “URL” field. To use it, go to any news site, click the bookmark and enjoy the ridiculousness.

javascript:(function(){function t(n){if(!n){n=document.body}var r=n.childNodes;for(var i=0;i<r.length;i++){if(r[i].nodeType==Node.TEXT_NODE){for(var s=0;s<e.length;s++){var o=e[s][0];var u=e[s][1];r[i].textContent=r[i].textContent.replace(o,u)}}else{t(r[i])}}}var e=[[/\bwitnesses\b/gim,"these dudes I know"],[/\ballegedly\b/gim,"kinda probably"],[/\bnew study\b/gim,"Tumblr post"],[/\brebuild\b/gim,"avenge"],[/\bspace\b/gim,"spaaaaaaaaace"],[/\bdomestic\b/gim,'"in the \'hood"'],[/\bgoogle glass\b/gim,"Virtual Boy"],[/\bipad\b/gim,"Game Boy"],[/\bandroid\b/gim,"Mr. Roboto"],[/\bsmartphone\b/gim,"Pokedex"],[/\belectric\b/gim,"atomic"],[/\bcar\b/gim,"cat"],[/\belection\b/gim,"eating contest"],[/\bpresident\b/gim,"Chief Big-Wig"],[/\bsenator\b/gim,"Elf-lord"],[/\bcongressional leaders\b/gim,"River Spirits"],[/\brepresentative\b/gim,"River Spirit"],[/\bmajority leader\b/gim,"High Inquisitor"],[/\bminority leader\b/gim,"First Loser"],[/\bhomeland security\b/gim,"Homestar Runner"],[/\bdemocrats\b/gim,"Communists"],[/\bdemocrat(ic)?\b/gim,"Commie"],[/\brepublicans\b/gim,"Fascists"],[/\brepublican\b/gim,"Fascist"],[/\blegislation\b/gim,"magic"],[/\bcould not be reached for comment\b/gim,"is guilty and everyone knows it"]];t()})()

Personally, I thought this article was pretty funny to read with my news “translator.”

Be sure to share any additional substitutions that you’ve found funny, or any articles that are awesomely different with the translator.

Here’s the more readable version of the code:

    function() {
        var substitutions = [
            [/\bwitnesses\b/gim, "these dudes I know"],
            [/\ballegedly\b/gim, "kinda probably"],
            [/\bnew study\b/gim, "Tumblr post"],
            [/\brebuild\b/gim, "avenge"],
            [/\bspace\b/gim, "spaaaaaaaaace"],
            [/\bdomestic\b/gim, "\"in the \'hood\""],
            // Tech
            [/\bgoogle glass\b/gim, "Virtual Boy"],
            [/\bipad\b/gim, "Game Boy"],
            [/\bandroid\b/gim, "Mr. Roboto"],
            [/\bsmartphone\b/gim, "Pokedex"],
            [/\belectric\b/gim, "atomic"],
            [/\bcar\b/gim, "cat"],
            // Government
            [/\belection\b/gim, "eating contest"],
            [/\bpresident\b/gim, "Chief Big-Wig"],
            [/\bsenator\b/gim, "Elf-lord"],
            [/\bcongressional leaders\b/gim, "River Spirits"],
            [/\brepresentative\b/gim, "River Spirit"],
            [/\bmajority leader\b/gim, "High Inquisitor"],
            [/\bminority leader\b/gim, "First Loser"],
            [/\bhomeland security\b/gim, "Homestar Runner"],
            [/\bdemocrats\b/gim, "Communists"],
            [/\bdemocrat(ic)?\b/gim, "Commie"],
            [/\brepublicans\b/gim, "Fascists"],
            [/\brepublican\b/gim, "Fascist"],
            [/\blegislation\b/gim, "magic"],
            [/\bcould not be reached for comment\b/gim, "is guilty and everyone knows it"]
        function wordSubOn(element) {    
            if (!element) {
                element = document.body;    
            var nodes = element.childNodes;
            for (var n=0; n<nodes.length; n++) {
                if (nodes[n].nodeType == Node.TEXT_NODE) {
                    for (var i = 0; i < substitutions.length; i++) {
                        var regex = substitutions[i][0];
                        var newText = substitutions[i][1];
                        nodes[n].textContent = nodes[n].textContent
                            .replace(regex, newText);
                } else {

Type of JSTL varStatus Attribute

Recently, I did a Google search to find the type of the JSTL <c:forEach> tag’s varStatus attribute. Since it took a little extra digging, I figured I would simplify the process by posting it here:

The varStatus attribute is of type javax.servlet.jsp.jstl.core.LoopTagStatus
(Javadoc here).

PowerMock: Several matching constructors

I recently had an issue in my tests where I started getting this error:
Several matching constructors found, please specify the argument parameter types so that PowerMock can determine which method you're referring to.

I’ve seen that error many times. Usually, it means that you weren’t specific enough with your mocking call for PowerMock to definitively tell which constructor you’re calling. This is usually fixed by adding parameters or parameter types until there can only be one possible constructor that matches. In this particular case I had the following code:

public class HelperObj {
  public HelperObj(String name) { /*...*/ }

  public HelperObj(String name, int moreInfo) { /*...*/ }

public class TestClass {
  public void testStuff() {
    expectNew(HelperObj.class, anyObject(String.class)).andReturn(mockObj);

This error came up after I did some refactoring so that HelperObj was no longer a singleton. I was pretty baffled as to why PowerMock would have problems determining which constructor was being used; it seemed pretty obvious. I tried all of the variants of expectNew, but each failed. It wasn’t until a lot of searching that I found this bit of code:

public class TestClass {
  public void setUp() {
    suppress(constructor(HelperObj.class, String.class));

This apparently interfered with the expectNew call. After removing the excess suppress call, my tests ran fine.

DRM and Infinite Economics

I’ve always been fascinated by the discussion of digital copyright law and DRM. I’ve recently just found Techdirt, which has loads of well-written articles about DRM, piracy and new-age business models for an increasingly digital world. I’m sure they have other articles, but I guess I just gravitate towards those. Specifically, I enjoyed
this post, which had a pretty amazing explanation of the economics of creating more value, rather than thinking that value is a limited resource that needs to be maximized:

Economic growth occurs whenever people take resources and rearrange them in ways that are more valuable. A useful metaphor for production in an economy comes from the kitchen. To create valuable final products, we mix inexpensive ingredients together according to a recipe. The cooking one can do is limited by the supply of ingredients, and most cooking in the economy produces undesirable side effects. If economic growth could be achieved only by doing more and more of the same kind of cooking, we would eventually run out of raw materials and suffer from unacceptable levels of pollution and nuisance. Human history teaches us, however, that economic growth springs from better recipes, not just from more cooking. New recipes generally produce fewer unpleasant side effects and generate more economic value per unit of raw material.

Every generation has perceived the limits to growth that finite resources and undesirable side effects would pose if no new recipes or ideas were discovered. And every generation has underestimated the potential for finding new recipes and ideas. We consistently fail to grasp how many ideas remain to be discovered. The difficulty is the same one we have with compounding. Possibilities do not add up. They multiply.

Pretty cool stuff. We’ve always known that success comes from innovation, but this seems to say that innovators have the ability to create new things because they are able to imagine an entirely new system that is better than current systems. There are plenty of people that are willing to do things that are different, yet stay inside the understood realm of possibility. True innovators will come up with ideas whose existence proves that the current system is too narrow.

I recently found an example of this in the space travel realm. Conventional physics says that objects cannot travel faster than light. However, physicists are theorizing that by warping space (specifically, compressing the space in front of your vehicle), your vessel can travel at faster-than-light speeds. In your frame of reference, you are only traveling at sub-light speed, but the space that you are traveling through is “shrunk” while you travel, and then expands back into its original shape, with your vessel suddenly a few light years away. These physicists are assuming that the current set of understood conventions are not the full set; they innovate by imagining a larger set of rules to play by, and are thus able to achieve things that were assumed impossible before.

Warp theory
Some experiments with the theory
A good explanation of the theoretical technology

Remove Uno From AT&T Fusion (Huawei U8652)

If there is anything that I despise in my beloved virtual world, it is bloatware. I bought a Huawei U8652 (AKA AT&T Fusion) and had a bit of a hard time removing the asinine Uno app, so I decided to post instructions here:

  1. Root your phone. I kept seeing posts that told people to use ‘unlockroot v2.3’, but I thought unlockroot was a piece of garbage. Instead, I followed these instructions.
  2. Install the Android Terminal Emulator
  3. In the Terminal Emulator, type the following commands:

    mount -o remount,rw -t yaffs2 /dev/block/mtdblock8 /cust
    cd /cust/att/us/app
    chmod 777 *
  4. If you want to delete all of the bloatware apps that AT&T loaded on you, type this command:

    rm *

    If you want to delete one specific app (like Uno), type this command:

    rm uno_att.apk

    You can replace ‘uno_att.apk’ with any of the app file names that you desire

And you’re clean!


I initially thought that rooting my phone would allow me to remove these ridiculous apps, but the problem is a little deeper than that. These apps are located in a section of the internal memory that is mounted as a read-only section. If you look at the contents of /proc/mounts, you can see this entry:
/dev/block/mtdblock8 /cust yaffs2 ro,relatime 0 0
In order for a superuser to delete these apps, we have to remount that block with read/write privileges.

Metametawriting Rant

I hate writing about literature. It’s incomplete. It’s like trying to shove an entire ocean of ideas into a sock of an essay. You can’t cram enough ideas into it. Some ideas leak out, partially absorbed (but only partially). It’s a chore with no reward. The cool part is the plethora of ideas, not the regurgitation of them. If I could actually use writing to distill my ideas and present them in a clear, concise way—a way that others would be able to fully experience them—I would be able to take my treasure trove of ideas and create something that is more valuable. But, as it stands, I’m no artisan. I sweat and toil to melt down my gold only to end up with a “finished product” that looks as inspirational as a snowman.