Wednesday, April 09, 2014

When char bites ...

Got bitten by the char arithmetics in C today, while porting some native code to Android NDK.
Good reminder that the chars are not defined as signed or unsigned in the C standard and treated as unsigned by the ARM compiler for example.
To fix this problem it's better to use either something like int8_t from stdint.h or the compiler flag:
 -funsigned-char

Good luck!

Wednesday, November 13, 2013

Running Technique Videos

Just stumbled upon the series of videos yesterday.
I could not find the part one,  but the rest is quite interesting. 
I never had the a proper coaching for running and it looks like there are lots of things that I can improve.

Running Technique Video - Part 2

Running Technique Video - Part 3

Running Technique Video - Part 4

Running Technique Video - Part 5

Enjoy!

Monday, September 30, 2013

Switching between Xcodes

Just wanted to "bookmark" the command that I had to go back to a couple of times in order to switch between instances of Xcode:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

Sunday, September 08, 2013

Connecting Ubuntu to AirPort Time Capsule

Here is what worked for me:
sudo mount -t cifs -o user=root,password=[your password],rw,hard,nosetuids,noperm,sec=ntlm //192.168.x.x/Data ~/capsule

Make sure you put the correct password and the time capsule ip address in there.


Wednesday, February 06, 2013

Seems like there is a bug in ADT 20.0.1

I had to compile one of the old Android projects today, from the times when I still was using SVN (please never use it, Git is your friend), and was getting some weird crashes in the Android Tools.
The only solution at the moment is to upgrade to ADT 20.1 rc:
http://tools.android.com/preview-channel

Enjoy!

Tuesday, December 18, 2012

Android building unsigned APK

Just a small Android development tip:

The Android export wizard that comes with Eclipse allows you to build the "release" APK of your application but expects you to have the signing keys at the time of the build, otherwise it doesn't allow to proceed. Sometimes you just need to send the unsigned APK to your client and allow them to sign it later.

The easiest way to accomplish that at the moment is to do the build with Ant (build.xml).
In order to generate the build.xml file you can run the following command in your application directory:
android update project --path .

This will create the build.xml file for you project. Then run:
ant release

and this will create the -release-unsigned.apk in your bin directory.
Sometimes (most of the time) the android tool doesn't pick the right name for the project and you might   end up with something like MainActivity-release-unsigned.apk, in that case just edit the project name property in the build.xml.

Note that if your app depends on the other library projects, then these also need to have the build.xml generated for them.

Wednesday, December 12, 2012

A couple of links on Android UI development

A friend of mine posted a couple of links related to Android UI development. Just leaving it here:
http://www.androidviews.net/
http://androidkickstartr.com/

Monday, December 10, 2012

Gitk on Mac OS X tip

Just a quick tip, if you are annoyed with
"CFURLCopyResourcePropertyForKey failed because it was passed this URL which has no scheme:" error messages in the terminal while running gitk.
Just add an alias into your .bash_profile:
alias gitk='gitk 2>/dev/null'


Monday, December 03, 2012

Code by Brian

My friend Brian started his own Android blog:

Code by Brian

Lots of useful stuff there and there is more to come.

Enjoy!

Sunday, December 02, 2012

Great article on Android UI performance by Romain

Stumbled upon this great article on Android UI performance problems detection tools, tips&tricks by Romain Guy on Google+:

http://www.curious-creature.org/docs/android-performance-case-study-1.html

Enjoy!

Monday, October 22, 2012

Android: pulling APK from non-rooted device and exploring the source code

Here is a simple way to pull the installed app APK from non-rooted device.
Well this technique worked on my Samsung Tab 10.1 tablet and didn't work on my Nexus Galaxy phone.

The main problem here is that with non-rooted device one can not browse the file system, to figure out which packages are installed, and their file names.

Here are the steps how to do this with SDK adb tool.
1. Pull down the packages.xml file to get the files that describes the packages that are installed on the device:
adb pull /data/system/packages.xml

2. Find the package tag that you are interested in. It should have a property codePath="/data/app/[name].apk"

Pull the apk file with:
adb pull /data/app/[name].apk

Now you are free to "reverse engineer" and explore the package with for example Android apktool for example.

Here is how get the decompiled java source code from the apk file.

1. Extract classes.dex:
jar xvf [name].apk classes.dex

2. With the help of dex2jar tool (http://code.google.com/p/dex2jar/), convert dex to jar:
d2j-dex2jar.sh classes.dex

3. Now you can explore the source code in the classes-dex2jar.jar with any java decompiler like for example JD-GUI (http://java.decompiler.free.fr/).

Enjoy!

Friday, October 19, 2012

Mandiant on Android

I went to MIRcon 2012 conference this week and one of speakers was a guy from our company who does some R&D for Android at our New York office.
I found his blog very interesting and just wanted to share here:
http://thecobraden.blogspot.com/

Enjoy! :)

Friday, September 21, 2012

The Easter Egg in Android tools

Try:

aapt dump badger [you app name].apk

and have a nice badger :)

Thursday, September 20, 2012

npm xmas

I haven't looked at npm code before, and today I did.
So if you run: npm xmas
you will be in for a surprise ;)

Thursday, September 06, 2012

A feature of Android "Jelly Bean": android:isolatedProcess

Just stumbled upon one interesting feature of the Jelly Bean.
The service tag got a new attribute android:isolatedProcess. 

"If set to true, this service will run under a special process that is isolated from the rest of the system and has no permissions of its own."

The application of this feature is quite limited, but interesting from a security perspective.

Basically, if you need to run some script (javascript, lua, etc) that you received from untrusted source or maybe some third-party library that might have some security issues, it allows you to isolate that part of you application in it's own "sandbox" process that doesn't inherit all the permissions of you primary application.

Friday, June 08, 2012

JSLint Vim plugin

I got involved in helping with the web project recently with lots of javascript (client and server-side frameworks etc) pretty much everywhere.
Yeah it's kind of amazing what javascript has become, amazing and a bit terrifying, cause the things can get real messy real fast without proper coding discipline on the team.

Anyways, I started to use jslint a lot in order to keep things cleaner and neater.
Here is an extremely useful Vim plugin that I use a lot recently:
https://github.com/hallettj/jslint.vim 
The inline highlighting with quickfix window support are awesome features and you can use ~/.jslintrc file to define your globals "directives" for jslint to avoid polluting the source code with it.

Enjoy!

Thursday, May 10, 2012

Mac OS X tar util adds files with "._"


So, if you got surprised after uncomressing the tar.gz file that was created on Mac OS X and finding a bunch of extra files starting with "._" for every file and directory, here is a solution for you.
To avoid these extra files to be added into tar.gz on Mac OS X, define the environment variable:
export COPYFILE_DISABLE=true

Wednesday, May 09, 2012

Android NDK8 now with MIPS arch support

With the support for MIPS architecture in the latest release of NDK8, the life of NDK developers became a bit more difficult again. We have 4 architectures to cross-compile a bunch of native libraries for: armebi, armebi-v7a, x86 and mips. I guess, this is just one more push to move towards Java code for better portability and smaller .APKs, etc.

By the way the issue with libc on x86 builds that I was posting about since NDK6 still exists.
One the native libraries that I use fails to build with the following errors:
undefined reference to `siglongjmp'
undefined reference to `sigsetjmp'
See here: http://aleksmaus.blogspot.com/2011/11/more-fun-with-android-ndk7.html

The x86 build fails with both Mac OS X and Linux NDK8.

If anybody on Android NDK team reads this, please, please, please fix it.

Monday, May 07, 2012

Mac OSX file handles limits

 I stumbled on this issue many times trying to run the services that open too many handles on Mac OS X (Lion). Even when you see the ulimit tool returning "unlimited" value, it's not actually unlimited.

Here are the couple of commands that I have to run to actually increase the number of allowed opened handles:
$ sudo launchctl limit maxfiles 500000 500000 
$ ulimit -n 500000