Posts

Showing posts from 2015

Using Google Chrome Inspect Element to Analyze the website

Image
I'm developing my new profile website. I want to reduce the loading time of my page. Google Chrome also provides the tool to help developer to analyze the websites.  So it's time to play with the "Google Chrome Inspect Element to Analyze the website"

1. I want to see how each element take time to load.

then I go back and modify some images and code. This is the result.
For the images I use the Photoshop "Save as Web" feature to help me consider which option is the best for my website. Actually, I will reduce the quality of the images down to 60-80% depend on each images.

This will greatly reduce the image file size but it still look beautiful. Furthermore, there are other options e.g. reduce the number of colors, reduce image size, use the vector file and more. This Technics are depend on each images. In the example below, You can see that jpg format gives the better image quality compare to .gif at the same file size. I think jpg is great for photo while g…

Begin to use vim in IntelliJ

Image
Install IdeadVim which is the most popular vim emulator in IntelliJ.

One of the most annoying thing using vim is the key esc. It's take 1-2 sec. to touche that esc key so I change it to j then k (my friend recommend this j,k key). The problems is I don't know how to change it until I found the answer in stackoverflow.



Study vim

openVim the interactive vim that gives you better exp. than just read the book.








Best way (for me) to paste the source code into the blog

I have search and found many tools and webs.

I decided to use hilite.me as my main tools

because it is beautiful, independent(no need to add code in to blogger's template)

the code look like this 


android { compileSdkVersion 18 buildToolsVersion "18.1.0"defversionPropsFile=file('version.properties') if (versionPropsFile.canRead()) { defProperties versionProps = new Properties() versionProps.load(new FileInputStream(versionPropsFile)) defcode= versionProps['VERSION_CODE'].toInteger() +1 versionProps['VERSION_CODE']=code.toString() versionProps.store(versionPropsFile.newWriter(), null) defaultConfig { versionCode code versionName "1.1" minSdkVersion 14 targetSdkVersion 18 } } else { throw new GradleException("Could not read version.properties!") } // rest of android block goes here }

[Android Gradle] Auto count the buildNumber and replaced in versionCode using gradle

Image
There are two methods.1. Modify the Android Manefist in gradle.buildtask('increaseVersionCode') << { defmanifestFile=file("AndroidManifest.xml") defpattern= Pattern.compile("versionCode=\"(\\d+)\"") defmanifestText= manifestFile.getText() defmatcher= pattern.matcher(manifestText) matcher.find() defversionCode= Integer.parseInt(matcher.group(1)) defmanifestContent= matcher.replaceAll("versionCode=\""+++versionCode +"\"") manifestFile.write(manifestContent) } tasks.whenTaskAdded { task ->if (task.name =='generateReleaseBuildConfig') { task.dependsOn 'increaseVersionCode' } }ref. stackoverflow2. Create modify the new files
android { compileSdkVersion 18 buildToolsVersion "18.1.0"defversionPropsFile=file('version.properties') if (versionPropsFile.canRead()) { defProperties versionProps = new Properties() ve…