Simple Gallery application for Android

Today, I'm very proud of myself to create simple gallery application in Android. Likewise, it's my so-called first ever Android application and I really like what I've done. Because, I'm very new at creating Android application and Java language. Now I feel that developing Android application isn't that difficult to do.

Objectives of this application is display thumbnail images at the first screen. Once click on these thumbnail images, the actual image will be displaying within in Dialog box.

First of all, I need to add some XML coding in main.xml for layout of my application under res/layout. Displaying thumnail photos as GridView format. That's why I've added the following GridView layout.

view plain print about
1<?xml version="1.0" encoding="utf-8"?>
2
3<RelativeLayout android:id="@+id/RelativeLayout01"
4android:layout_width="fill_parent"
5android:layout_height="fill_parent"
6xmlns:android="http://schemas.android.com/apk/res/android">

7
8<GridView xmlns:android="http://schemas.android.com/apk/res/android"
9 android:id="@+id/gridview"
10 android:layout_width="fill_parent"
11 android:layout_height="fill_parent"
12 android:columnWidth="90dp"
13 android:numColumns="auto_fit"
14 android:verticalSpacing="10dp"
15 android:horizontalSpacing="10dp"
16 android:stretchMode="columnWidth"
17 android:gravity="center" />

18
19</RelativeLayout>

[More]

Using parseFloat function in Javascript

Today, I found one of weird problem in my project about using parseFloat() function of Javascript. The usage of parseFloat() function parses a string and returns a floating point number.

example usage of parseFloat()

view plain print about
1document.write(parseFloat("10.33"));
2<!--- return value is "10.33" --->
3
4document.write(parseFloat("I AM PPSHEIN"));
5<!--- return value is "NaN" --->

[More]

My first web based mobile project

Here is my first web-based project for my company. Our target is for customer who want to register Patient thru online. This project is based for iPad but it can work either on Android based tablet. For this project, I've used jQueryMobile framework, Coldfusion 9 and Oracle 11g. For jQueryMobile part, I've created our own customize theme for this project and added some JS coding into jQueryMobile existing scripts. Just example: my boss want me to highlight which field has been filled up by users and need to categorize for mandatory field. As you know, it's difficult to change or add some JS coding into their existing core JS file because we need to know the flow of existing JS coding. Likewise, what we add or change JS coding will impact the whole existing JS coding. I took 2 days to study the whole existing JS coding but it's not enough time honestly for it.

Below is some of my change logs into jQueryMobile existing JS coding for this project.

[More]

Playing with CFThrow

Today, I found that cfthrow is very useful to me for error handling in my project. Because prior programmer of my current wrote some funny code for error handling without using cfthrow. I'm not sure whether they don't know cfthrow or not. Honestly, I didn't know most of Coldfusion Tags and functions before I took CF8 exam. When preparing for CF8 exam, I know most of tags and functions of CF8. Thanks, CF8 exam.

Ok, let's continue. Here is funny coding our prior programmer wrote.

[More]

Query of query problem between Coldfusion 9 and Coldfusion MX 7

Today I've found the weird error in my project. It's because of "query of query" problem between Coldfusion 9 and Coldfusion MX 7. As Coldfusion developers know, one of the coolest features in CF is query of query and know how to use this one, either. But, being CF developer, we must know which features, functions, tags, issues, etc are fixed or missed in the every version of Coldfusion. For me, I can only know and approach which new features, functions and tags are available and being enhanced in the every version of Coldfusion except issues.

[More]

Simple UDF for LIKE searching type

I bet, every programmer know "LIKE" searching type in all RDBMS. It's so simple and can help us to search by all types of character. Unfortunately, we need to avoid using LIKE command if we really don't need it because it can make query performance to getting slow and sometimes, RDBMS can be crush. Today, I need to use create simple UDF in Coldfusion for LIKE command. Because, we need consistency for LIKE command in our searching query.

That's why I wrote following UDF for LIKE.

view plain print about
1<cffunction name="UdfForLIKE" returntype="string" output="No">
2    <cfargument name="SearchParam" type="string" default="">
3    <!--- If search method doesn't declare, STARTING is default. --->
4    <cfargument name="SearchMethod" type="string" default="STARTING">
5    <cfset ReturnResult = "">
6    <cfswitch expression="#SearchMethod#">
7        <cfcase value="STARTING">
8            <cfset ReturnResult = SearchParam & "%">
9        </cfcase>
10        <cfcase value="ENDING">
11            <cfset ReturnResult = "%" & SearchParam>
12        </cfcase>
13        <cfcase value="WITHIN">
14            <cfset ReturnResult = "%" & SearchParam & "%">
15        </cfcase>
16        <cfcase value="EXACT">
17            <cfset ReturnResult = SearchParam>
18        </cfcase>
19        <cfdefaultcase>
20            <cfset ReturnResult = SearchParam & "%">
21        </cfdefaultcase>
22    </cfswitch>
23    <cfreturn ReturnResult>
24</cffunction>

[More]

Download Facebook Video Part 2

I wrote how to download Facebook video Download Facebook video without installing addons in my old post. At that time, Facebook using "embed" tag as displaying their video and it's easy to get original mp4 video from Facebook. Yesterday, one commenter wrote that he cannot download Facebook video regarding the instruction of my previous post. I was confused and cannot understand why he cannot download at all. That's why I've open Facebook video page and reviewed source code of it. Oddly, Facebook don't use "embed" tag as displaying their video anymore and changed their coding for using javascript as displaying. That's why I need to find out how to download original mp4 file of this movie from Facebook again.

[More]

How to write clean code

Yesterday, I've read "Clean Code" book by Robert C. Martin. It's very useful for programmers like me to read this book because which describes how to write clean code and useful code. I'll show few part of this book.

Ok, this book shows how to give a name for variables, functions, etc. Before, I gave a short name to most of my using variables and functions like "sname, gPersonInfo, etc". Once I've read this book, I've got a lot of knowledge how to write and give a name for variables and functions.

Here is example when I developed before.

view plain print about
1component {
2    public struct function gPerson(required String pName, required String pDOB){
3        sPerson = structNew();
4        sPerson.fName = arguments.pName;
5        sPerson.DOB = arguments.pDOB;
6        return sPerson;
7    }
8}

[More]

Type in cflock is very important

Today, I realized that "type" in cflock is very important and essential for shared data manipulation. In Adobe Coldfusion documentation, which said "type" is optional in cflock but when we need to process shared data, it's not optional. IT'S VERY IMPORTANT. Why I know like that is because of I'm currently preventing about concurrency issues for my project. In these coding, we already used cftransaction as putting the whole queries and processes within cftransaction but cannot prevent at all. After that, I've put cflock again outside of cftransaction like that.

[More]

Top of Page