Posts

Showing posts from 2014

Enable logcat in RedMi / HongMi AOSP 4.2.2

For some reason the logcat in AOSP 4.2.2 maybe disabled by default. To re-enable it, follow the steps below: Extract the file in /system/etc/init.d/03MTKTweakElse Comment out the line "rm /dev/log/main", this statement will disable the logcat to function Push back the file to the device C:\> adb push 03MTKTweakElse /system/etc/init.d/03MTKTweakElse You may not have the privilege to write on the directory /system, to handle this, remount the /system partition using: Enter the shell    adb shell Change to root    su Remount the /system as Read-Write    mount -o remount rw /system

Show multiple lines of title in Android ActionBar

To show multiple lines of title in Android ActionBar, one of the most common solution is to assign some of the text in SubTitle. Here we have another approach: Basically we get the TextView object of the title in ActionBar, set it's max lines attribute to 2: int titleId = Resources.getSystem().getIdentifier("action_bar_title","id","android"); TextView title = (TextView) findViewById(titleId); title .setSingleLine(false); title .setMaxLines(2); title .setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); Then we can set a long title to the ActionBar where the text will be displayed as two lines: getActionBar().setTitle("... your long title here ...");

ArcGIS: Query for a simplified feature set

To query a simplified feature set using QueryTask, you can set the "MaxAllowableOffset" property through           com.esri.core.tasks.ags.query.Query.setMaxAllowableOffset( ) or if you're using ArcGIS Android SDK version 10.2.4 already, then it should be:            com.esri.core.tasks.ags.query.QueryParameters.setMaxAllowableOffset( )

Cool Utilities for OSX Terminal

open pbcopy, pbpaste mdfind screencapture launchctl say diskutil brew Ref: http://lifehacker.com/eight-terminal-utilities-every-os-x-command-line-user-s-1593793109

Trigger breakpoint in Javascript

To trigger breakpoint in Javascript, you can add a 'debugger' in your code. For example: function testing() {     alert(123);     debugger;     alert(456); } The debugger will be triggered at runtime.

Restart VirtualBox services in OSX (Useful for running genymotion in mac)

Run the following command to restart VBox in mac: sudo /Library/StartupItems/VirtualBox/VirtualBox restart Whenever your genymotion emulator cannot restart in macos, try this.

Selenium automates browsers

Selenium automates browsers. Control the browser through Java code: http://docs.seleniumhq.org/

Setting Tomcat JVM in service mode

Image
Running Tomcat (Service mode) with default Java Virtual Machine (JVM) could cause some strange problem sometimes. It's because your own development may depends on a particular VM (e.g. the HotSpot VM). In this case, you will need to specify the JVM instead of using the default one. To do this, run the tomcat7w.exe in TOMCAT_HOME\bin\ , and select the the Java  tab. You will find the Java Virtual Machine option as shown below:

Using slapadd in OpenLDAP

A correct way to use slapadd: /sbin> slapadd -f d:\OpenLDAP\etc\openldap\slapd.conf -l d:\data\root-unit.ldif Note that -F d:\OpenLDAP\etc\openldap won't work, you must use the -f parameter.

Dojo: Problem of having TabContainer inside ContentPane in IE8

Image
In Dojo, the popular JavaScript library, we have ContentPane which allows us to put different widget into it, such as TabContainer , DataGrid , etc. They works fine in most browsers, but in IE 8, that could be a bit tricky. Suppose we have the following code fragment: <div id="testContentPane"       data-dojo-type="dijit/layout/ContentPane""       style="height: 200px; overflow: auto; border: 5px blue solid;">     testing 1 <br> testing 2 <br> testing 3 <br>      testing 4 <br> testing 5 <br> testing 6 <br><br>          <div id="testTabContainer"           data-dojo-type="dijit/layout/TabContainer"          style="width:80%; height:200px;"           disabled='disabled'>                   <div id="t...

Using JavaScript to detect IE 8

I was just thinking to use the following JavaScript to detect IE 8:   navigator.appVersion.indexOf("MSIE 8") > -1 But you know, when IE 8 is in compatibility mode, the agent string will become MSIE 7 instead. So, use the following to check for IE 8 for safe:   navigator.appVersion.indexOf("Trident/4") > -1

Android: Easy Stock Quote

Image
An easy to use stock quote app available: Easy Stock Quote (簡易股票報價) Features: Stock Quote Easy to use Large font for easing viewing https://play.google.com/store/apps/details?id=com.mk2.easystock&hl=en

Android ListView Animations

Just found a library ListViewAnimations which delivers nice animations for list items in Android. To start an animation programatically, we may consider something like: v . clearAnimation (); Animation animation = AnimationUtils . loadAnimation ( getActivity (), R . anim . slide_top_to_bottom ); v . startAnimation ( animation );

Using Google Map API to access Google Earth Enterprise

Nice references for showing Google Earth Enterprise maps using the Map API: gee-samples Main page for GEE The major thing is that we will use GFusionMap object instead of google.maps.Map object in the JavasScript. So that we can specify the GEE server definitions when we create the map object.

ArcGIS Server Cached Map Expiry Time

The tiled cached map expire time can be controlled by a variable "cacheControlMaxAge" in ArcGIS Server Administrator Directory, available starting at ArcGIS for Server (Window) 10.2. Ref:  http://resources.arcgis.com/en/help/main/10.2/index.html#//015400000577000000 The default HTTP header "max-age" is 86400 (i.e. 24 hours), which seems cannot be changed in ArcGIS Server 10.0. For Android SDK 10.2, the map caching activities only works on the particular session. That means when the user quit the app and start it again. The previous cache will not be used.

OpenOffice keeps showing the restoring window in OSX

Image
If your OpenOffice just keeps showing the restoring window / reopen document window in OSX: Simply remove all the contents in the following directory: /Users/<user name>/Library/Saved Application State/org.openoffice.script.savedState Horrible implementation...

Check httpd.conf syntax

Simply run the following command: httpd -t It will shows "Syntax OK" if your httpd.conf works.

Amazing web effects

Just found a list of amazing web effects, bravo! http://www.hksilicon.com/kb/articles/370284/8-Web#.UuG4tU7OrTo