Thursday, December 11, 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:

  1. Extract the file in /system/etc/init.d/03MTKTweakElse
  2. Comment out the line "rm /dev/log/main", this statement will disable the logcat to function
  3. 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:
  1. Enter the shell
       adb shell
  2. Change to root
       su
  3. Remount the /system as Read-Write
       mount -o remount rw /system

Monday, November 10, 2014

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

Wednesday, November 5, 2014

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



Thursday, August 21, 2014

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.

Friday, August 1, 2014

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.

Wednesday, July 16, 2014

Setting Tomcat JVM in service mode

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:


Wednesday, June 4, 2014

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.

Thursday, May 29, 2014

Dojo: Problem of having TabContainer inside ContentPane in IE8

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="tabControl" 
             data-dojo-type="dijit/layout/ContentPane" 
             title="Tab" closable="false">
            Testing tab
        </div>
        
    </div>

</div>

The above code fragment is suppose to create a ContentPane and put a TabContainer into it:


Everything goes fine with IE 10, IE 9, Chrome, Firefox, but in IE 8, we have:


Look! The TabContainer just floating on top of the ContentPane. How to solve this issue?

Put CSS position: relative in the ContentPane and the issue will be fixed.

Why? Because in IE 8, the TabContainer is position:absolute. If ContentPane position CSS is not assigned, the TabContainer will leave out of it. By assigning position:relative to ContentPane, the position of TabContainer will be limited inside the ContentPane. Like this:







Upgrade nodejs in conda (from v18 to v26)

If your conda env is nodejs v18, doing a conda install nodejs=26 is likely to create a lot of conflict. Consider remove those conflicting p...