Pages

Friday, 20 July 2012

Center Align an Image

The easiest way to centre align an image in html is to wrap the <img> tag inside a <div> tag and text-align to center.
<!-- html elems -->
<div class="wrapper-img">
    <img src="images/pic.png">
</div>
/* css */
.wrapper-img {
    text-align: center;
}
Example of a centre aligned image using the above snippets:



Tuesday, 17 July 2012

JQM: Fix PhoneGap Android textarea Jumping Around

Android 2.3 browser is buggy when it comes to CSS3 properties. Recently we got this
weird bug when user types something in a textarea component. The page jumps around with
each character we typed.
We can fix that by not using any CSS3 3D properties like -webkit-transform: translate3d(0, 0, 0);.
Also, in the AndroidManifest.xml file add windowSoftInputMode="adjustPan" in the activity tag.
Modified activity tag will look like:
<activity
    android:name=".ProjectNameActivity"
    android:configChanges="orientation|keyboardHidden"
    android:windowSoftInputMode="adjustPan"
    android:label="@string/app_name">

Tuesday, 3 July 2012

Make STS Faster with STS.ini & Java Opts Settings

If you have a system with 3 GB RAM you can use the following settings to make your STS faster than the default.

STS.ini settings
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-product
com.springsource.sts.ide
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
384M
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xmn128m
-Xms1024m
-Xmx1024m
-Xss2m
-XX:PermSize=256m
-XX:MaxPermSize=512m
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=50
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-XX:+UserParallelGC
JAVA_OPTS environment variable value:
-Xms512m -Xmx1g