Posts

The Hard Thing About Hard Things

I was a bit disappointed with this book. It is often cited as a must-read for Product Managers- maybe since folks equate PM's with CEO's. However, it did not seem as useful for a product manager as it would for a CEO or an executive. That being said, the author did talk about some very practical problems and got into the details of different solutions to them. Most business books would gloss over the details and not over any actionable advice, but that is where this book differs. Here are some of my key takeaways: No BS: More often than not we hear executives painting a rosy picture of the business, even though the reality might be different. However, most employees know the truth and will appreciate being told the reality. Competition: If your product is getting killed by the competition, there are multiple options you have. You can look at pivoting and targeting a different market segment, make strategic partnerships, partake in some M&A, etc. Another option i...

So you want an EMM Strategy?

Given the prevalence of mobile devices in the workplace, a lot of enterprises have embraced an EMM strategy. But if you are looking to get your feet wet in this domain you might get confused with the barrage of acronyms and options you have there. Let me help you navigate the waters: BYOD (Bring Your Own Device):  Is basically when employees can use their personal devices for business tasks. COPE (Corporate Owned, Personally Enabled):  The counterpart to BYOD, where the enterprise owns the devices and the employees configure the device to suit their needs. MDM (Mobile Device Management):  This was the first solution to the ‘infiltration’ of mobile into the workspace. As the name suggests, with this solution employers would have the power to manage and control the entire device. Common examples would be to force a passcode for the device or to remotely wipe all the data from a lost device. While an MDM solution might work for a COPE scenario, it was highly unpopula...

Running old Android Studio without Java 6

From  http://tools.android.com/tech-docs/configuration : You can also place use environment variables to point to specific override files elsewhere: STUDIO_VM_OPTIONS , which vmoptions file to use STUDIO_PROPERTIES , which property file to use STUDIO_JDK , which JDK to run studio with Note that this last variable allows you to for example run Android Studio with Java 7 on OSX (which normally picks Java 6 from the version specified in  Info.plist ): $ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk $ open /Applications/Android\ Studio.app

The 360 degree leader

Another self help book full of platitudes. But it did have some interesting anecdotes and thought provoking aspects to it. Here are my take aways from it: Even if you are not a manager, you should strive to enhance your influence in your organization. I feel the best way to do this is to help others- they could be in your team or another team, but you never know when you might need them to return the favor! "Influence must be earned." "The person who keeps busy helping the one who is below him won't have the time to envy the person above him." Try and network more. Easier said than done, but it would be good to strike up conversations with folks while in the elevator, while getting coffee...you get the idea. The problem here is not that you know this needs to be done, it is how you actually do it. Different ways will work for different folks, but it is good to keep this at the back of your mind. Maybe you could try and setup some knowledge sharing session...

Activity life cycle

From http://androidcookbook.com/Recipe.seam?recipeId=2688 onSaveInstanceState(Bundle) and onPause() Use onPause to save data that should be preserved long term, use onSaveInstanceState for transient states. For example in a game the current score could be saved in onSaveInstanceState and only saved in onPause if it was good enough for the High Score table, in which cause the High Score table (in SharedPreferences, a database table, or a file) is updated. onSaveInstanceState\onRestoreInstanceState and the Android Lifecycle The SDK documentation says that  onSaveInstanceState(Bundle)  may run just before or just after  onPause() . As for onRestoreInstanceState(Bundle)  that occurs after  onStart()  and before  onResume(). onSaveInstanceState() is not called when the user navigates to another activity. So if the user presses the back button, this callback won't be called. But if the Android home button is pressed this callback is call...

Multi Threading in Android

It is good practice to not do computation intensive work on the UI Thread. In fact starting from HoneyComb, you get a NetworkOnMainThread exception if you try and do any network processing on the main thread. So we should do background work in a new thread. One thing we need to consider is that only the UI thread can update the UI, so when our background thread wants to update the UI, we need a means to communicate between threads. Actually even your background thread can update the UI, but this is really dangerous and your app can crash! Android provides a lot of multi threading constructs for us. AsyncTask is by far the easiest way of multithreading in Android. When you create a new AsyncTask object the framework creates a new thread for you and provides methods to communicate with the UI. No threads, no handlers and no Executors (Because it uses these classes internally)! So why not use AsyncTask all the time? Well, because these are suited for background work that typically l...

Env vars on Ubuntu

To set them, export VAR=1 To check them, printenv To unset, unset VAR. On Ubuntu, you can set vim ~/.pam_environment and then write: JAVA_HOME=/usr/local/bin/jdk1.6.0_30 PATH DEFAULT=${PATH}:${JAVA_HOME}/bin Or, you can go to ~/ .bashrc and write: export JAVA_HOME="/usr/local/bin/jdk1.6.0_30" export PATH=$PATH:$JAVA_HOME/bin

Vim pasting

Vim keeps messing up your pastes. Type :set paste Pasting it now works. Once done, you can type :set nopaste Thanks to http://www.protocolostomy.com/2008/04/04/vim-messing-up-indentation-on-your-pasted-code/

High Res timer on Win using C++

Took this from http://stackoverflow.com/questions/1739259/how-to-use-queryperformancecounter #include double PCFreq = 0.0 ; __int64 CounterStart = 0 ; void StartCounter () { LARGE_INTEGER li ; if (! QueryPerformanceFrequency (& li )) cout << "QueryPerformanceFrequency failed!\n" ; PCFreq = double ( li . QuadPart )/ 1000.0 ; QueryPerformanceCounter (& li ); CounterStart = li . QuadPart ; } double GetCounter () { LARGE_INTEGER li ; QueryPerformanceCounter (& li ); return double ( li . QuadPart - CounterStart )/ PCFreq ; } int main () { StartCounter (); Sleep ( 1000 ); cout << GetCounter () << "\n" ; return 0 ; }

Diff

Do a 'git status' in the directory you are concerned with. This will give you the list of files that have changed. Then you can do:  'git diff filename.java > changes.patch' This creates the patch file!

Unable to update Android SDK on Windows?

Some things I had to try to get it to work: Close Eclipse and any other folder that had the android sdk folder opened. Go to /tools Right click on android.bat and select 'Run as Administrator' This should work and you should be able to update the SDK now. If not, well you are screwed...

Logging from native service in Android

To log to a text file from a native daemon process, push the empty file beforehand to /data. Next check that the owner of the process and the location where you are writing are the same.

Busybox on android

This link seems to work http://benno.id.au/blog/2007/11/14/android-busybox Though we have to add busybox to the PATH each time.

Compiling AOSP

Before your images run successfully, y ou need to import the proprietary drivers. So if you want to compile gingerbread and let’s say you need to run it on a Nexus 1, you need to take an original Nexus 1 with gingerbread and import the drivers.  To do this connect the original Nexus One to your build machine and run “ /device/htc/passion/extract-files.sh. If you dont have a device with you, drivers can be downloaded as well. Go to  https://developers.google.com/android/nexus/drivers  and grab the tar files from there. Untar them in the root folder of your android source and run all of them. This should create a vendor folder with the device you need.

Android devices

Taken from  https://sites.google.com/site/androidopenkangproject/downloads-1/downloads  maguro  GSM Galaxy Nexus  toro  LTE Galaxy Nexus  crespo  Nexus S   crespo4g  Nexus S 4G  p4  Galaxy Tab 10.1" - 3G (P7500)  p4vzw  Galaxy Tab 10.1" - Verizon   p4wifi  Galaxy Tab 10.1" - Wi-Fi  stingray  Motorola Xoom - Verizon  wingray  Motorola Xoom - Wi-Fi   tenderloin   HP Touchpad   vivow  HTC Incredible 2  supersonic  HTC Evo 4G  inc  HTC Incredible   vzwtab  Galaxy Tab 7" - Verizon In addition Nexus 7 is called grouper Now these were the devices. Next we have boards. These board names are used when we compile the kernel using the _defconfig command. You can retrieve them by going into the bootloader of your phone Nexus One:       Mahimahi Nexus S    : ...

Perl Regexp

Great link: http://mailman.linuxchix.org/pipermail/courses/2003-August/001305.html

Virtual Box Shared Folder

Just restart the Vm after making the changes and it should work http://www.howtogeek.com/75705/access-shared-folders-in-a-virtualbox-ubuntu-11.04-virtual-machine/

Good Android Links

http://www.vogella.com/articles/AndroidListView/article.html#listsactivity_simpleadapter

endmenu in different file than menu?

So I was adding my driver to the Linux kernel. Made a new Kconfig file and added 'menu' and 'endmenu' sections. But when I compiled the kernel I got an error saying 'endmenu in different file than menu'. Reason: There has to be a new line character after endmenu in your Kconfig file!

A binary with debug symbols with the Android NDK

First go into the Android.mk file in your jni folder and add this line: LOCAL_CFLAGS  += -g This is going to enable the debug compile option. You might have a separate option for logging more data. Next go into Application.mk and uncomment this line: APP_OPTIM := debug (or add it if it isnt there) This should be sufficient. Now when you run the ndk-build (You can run ndk-build V=1 to enable the verbose option), you should get the debuggable binaries. For some reason the binary I get in the libs/armeabi folder is not the debuggable one, this one has its debug options stripped out. To get the debug one grab it from obj/local/armeabi.