Friday, January 31, 2025

Check kernel structs layout

 sudo pahole -C task_struct /sys/kernel/btf/vmlinux

Saturday, December 12, 2015

MacVim with MacPorts and Xcode 7.2 failure

If the install of MacVim with MacPorts fails with error, that says something like this in the log:

"Could not find service "com.apple.CoreSimulator.CoreSimulatorService" in domain ......"

The solution would be change permissions on the: /Applications/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc

with:
sudo chmod g-w com.apple.CoreSimulator.CoreSimulatorService.xpc

Enjoy!

Wednesday, May 27, 2015

JDK 7 on Mac OS X

It's been some time since I touched Java on Mac OS X, was mostly busy with native (C/C++) cross-platform development recently.
Here is just another note for myself before I forget.

After you install Java 7 on Mac OS X and you try to run java (or javac) it will still pick up the java 1.6 from /System/Library/Java/JavaVirtualMachines/1.6.0.jdk.

In order to fix this go to 
/System/Library/Frameworks/JavaVM.framework/Versions
and remove the CurrentJDK symlink.

Then create the new one to point to the JDK 1.7, in my case with the command:
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/ CurrentJDK

Now check the version: 
$ java -version
java version "1.7.0_79"
.............

Enjoy!


Wednesday, May 20, 2015

tcpdumping


Just a bookmark for myself, when wireshark is not avail.
This collects the full payload, only from the host  x.x.x.x and https port
and writes into the out.pcap file:

tcpdump -s 0 -w out.pcap -A host x.x.x.x and tcp port https

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 ;)