Donnerstag, 17. Oktober 2013

Pielmeier => Peröbner

Pielmeier becomes Peröbner... and there goes my blog :)

Follow me on my new ma300k tumblr blog. Cu there!

Sonntag, 8. Juli 2012

Installing Apps2SD for HTC Desire

Introduction

The HTC Desire mobile phone is one of the best android phones on the market. Unfortunately it lacks internal memory. That’s why installing apps from Google play can be a pain. If you use big or many apps there’s just not enough internal memory for them all. Some apps support moving them to the SD card.... but many don’t. Especially the big ones like Google Maps, Facebook and Google Chrome for Android. End of the story... no!

If your Desire is rooted there are tools to move even apps like Google Maps, Facebook and Chrome to the SD card. One of these tools is Apps2SD. And here’s my journey which shows how to set up Apps2SD on an HTC Desire.

Preconditions: Sandvold ICS for Desire

Before you can install Apps2SD make sure you have installed ICS for HTC Desire. I’ve walked through this howto using v0.15.0.1. I also expect you have installed the Revolutionary Boot Loader.

Also make sure you’ve backed up all your data. This includes the following:

  • Your whole SD card’s content... we’re going to format it later.
  • All your apps on the phone, app settings, device settings, etc... we’re going to reset all these later too. I recommend you to sync all your settings, contacts into the Google cloud.

Now say “If something goes wrong it’s my own fault because I didn’t backup all my data” (This also applies for incorrect descriptions in this guide).

Format the SD card

Normally there’s only one VFAT partition on your SD card. In order to swap apps from the phone’s internal memory to the SD card you need an ext partition on the SD card.

Revolutionary can format the SD card accordingly for you. To do so boot your phone into recovery mode and choose ‘advanced’ -> ‘Partition SD Card’. This will create two partitions on your SD card. One ext partition for the apps + other stuff and one VFAT partition for your photos, music, etc. You have to decide about the size of the two partitions!

My setup was the following. I’ve got a 4GB SD card. I’m using 2GB for ext and 2GB for VFAT. Some people recommend not using more than 2GB for the ext partition. I had no problems using 2GB.

‘Partition SD Card’ will also ask you about the size of your swap partition. 0M is enough.

Finally reboot your phone.

Get Apps2SD onto SD card

Now you have to download Apps2SD and put it onto the SD card. In my case the most recent Apps2SD version was 2.7.5.3 Beta 04 but it didn’t work for me. Using v2.7.5.3 Beta 04 made my device freeze on boot which is not cool. So I’ve used v2.7.5.2-1. Now download dtapps2sd-2.7.5.2-1-signed.zip and copy it onto the SD card’s VFAT partition. You can do this by connecting your Desire as a mass storage device to your PC.

Set Up Apps2SD

First you have to boot into recovery again. Now choose ‘install zip from sdcard’ -> ‘choose zip from sdcard’ -> ‘dtapps2sd-2.7.5.2-1-signed.zip’ and install Apps2SD. Reboot your phone again.

When back in android launch the ‘Terminal Emulator’ app. We need to set up Apps2SD. Type the following into the shell:

$ su
$ a2sd reinstall

This will move your installed and all future apps onto the ext partition on the SD card. Apps2SD will reboot after it’s done.

We should also move the dalvik-cache onto the SD card. Otherwise there will be space for a few new apps but not many. To move the dalvic-cache onto the SD card launch the ‘Terminal Emulator’ app again and type the following:

$ su
$ a2sd cachesd

This time a2sd will not reboot... now you might think: I’m done. Unfortunately not... maybe you have noticed that your hardware ‘home button’ is no longer working... more on this in the next chapter.

Resetting to factory defaults

The broken ‘home button’ can be fixed with a little factory reset. You can reset your device below ‘Settings’ -> ‘Backup & reset’ -> ‘Factory data reset’.

Your Done

Have some cake!

Sonntag, 15. April 2012

setVisible for jQuery

I really wonder why jQuery has no setVisible(...) function?!? Here's mine:

(function($){
  $.fn.setVisible = function(visible){
    if(visible === true){
      this.show();
    }
    else{
      this.hide();
    }
  };
}(jQuery));

Sonntag, 2. Oktober 2011

CSS3 LED icons

Here they are... pure CSS3 LED icons:

You may have to upgrade your browser if the LEDs aren't very shiny. In the meanwhile you can check out the source:

.led {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 6px;
}

.led.yellow {
    background-color: #ffff00;
    background-image: radial-gradient(50% -5%, circle closest-side, #ffffee, #ffff00 110%);
    background-image: -webkit-radial-gradient(50% -5%, circle, #ffffee, #ffff00 110%);
    background-image: -moz-radial-gradient(50% -5%, circle, #ffffee, #ffff00 110%);
    box-shadow: 0px 0px 3px #ffff00;
}

.led.green {
    background-color: #00ff00;
    background-image: radial-gradient(50% -5%, circle closest-side, #eeffee, #00ff00 110%);
    background-image: -webkit-radial-gradient(50% -5%, circle, #eeffee, #00ff00 110%);
    background-image: -moz-radial-gradient(50% -5%, circle, #eeffee, #00ff00 110%);
    box-shadow: 0px 0px 3px #00ff00;
}

.led.red {
    background-color: #ff0000;
    background-image: radial-gradient(50% -5%, circle closest-side, #ffeeee, #ff0000 110%);
    background-image: -webkit-radial-gradient(50% -5%, circle, #ffeeee, #ff0000 110%);
    background-image: -moz-radial-gradient(50% -5%, circle, #ffeeee, #ff0000 110%);
    box-shadow: 0px 0px 3px #ff0000;
}

Mittwoch, 20. April 2011

Deobfuscating java projects

Lately I've been digging into minecraft. Normally digging into minecraft means something like this:

I was rather digging into something like this:

/*    */ import java.io.DataInputStream;
/*    */ import java.io.DataOutputStream;
/*    */ 
/*    */ public class a extends gc
/*    */ {
/*    */   public int a;
/*    */   public int b;
/*    */   public int c;
/*    */ 
/*    */   public void a(DataInputStream paramDataInputStream)
/*    */   {
/* 21 */     this.a = paramDataInputStream.readInt();
/* 22 */     this.b = paramDataInputStream.readInt();
/* 23 */     this.c = paramDataInputStream.readByte();
/*    */   }
/*    */ 
/*    */   public void a(DataOutputStream paramDataOutputStream) {
/* 27 */     paramDataOutputStream.writeInt(this.a);
/* 28 */     paramDataOutputStream.writeInt(this.b);
/* 29 */     paramDataOutputStream.writeByte(this.c);
/*    */   }

Obfuscated java code :-(

What is obfuscated code?

By obfuscating your java classes you want to prevent others from taking your source, modify it and release it again under another brand. There are tools which automatically obfuscate your code. These tools normally do the following things:

  • Put all artifacts (classes, interfaces, ...) into the default package
  • Rename all artifacts and members to something generic like 'a'

These changes make it very hard for humans to understand the meaning of some code. But there are a few things that can't be changed that easily during obfuscation:

  • Access modifiers
  • Types
  • Signatures in general
  • Import statements

What has all this to do with minecraft?

mojang is obfuscating it's minecraft releases so nobody can steal their code. Unfortunately this makes it very hard for developers to extend minecraft due to the lack of APIs within minecraft. So the community helped itself and created bukkit. bukkit is an API for minecraft. bukkit is so important just because of the minecraft obfuscation. With every minecraft release (major or minor) the signatures of all classes change. bukkit is the abstraction layer for the obfuscation changes.

But this means a lot of work for the bukkit developers [1]. They need to revert the minecraft obfuscation for every minecraft release manually.

The plan

Now there is a chance to make undoing the obfuscation more easily. But it will only work when the following conditions are met:

  • You got the deobfuscated source of a former version
  • The software is implemented iterative. So only relative small amounts of the code change during two versions.

With these assumptions you can statistically try to match artifacts from the old source with artifacts from the new obfuscated source. You just need to compare the things that don't change during obfuscation. Theres a big chance that the two artifacts with the most equality are actually the same artifact. This allows you to transfer the artifact's name and package from the old source into the new source.

The project

I like the idea of automatically deobfuscate java code. So I've hacked something and released it on github. java-deobscurify tries to find matching artifacts in the clear text and obfuscated source. java-deobscurify is still a work in progress. Let's say pre alpha... but I hope it will produce reasonable output in the near future.

References

  1. When will Bukkit be updated for Minecraft 1.5?

Mittwoch, 30. März 2011

Another minecraft rendering

Another minecraft povray rendering got finished. For more details see my former blog post Rendering minecraft worlds with povray:

Montag, 21. März 2011

Rendering minecraft worlds with povray

Lately I've been playing with the minecraft savegames. There's not much documentation about the savegame format [1] [2]. But I've managed to export some blocks and render them with povray. Here are the results:

References

  1. RegionFileCache.java
  2. RegionFile.java