When I Need Words

Writing Statement of Purpose is the hardest thing you will ever do in your life. That’s for my case, though.

I need words! It is hard to combine those words into a strong and extraordinary essay. Well, basically what happened to me is just myself being perfectionist and my mind just wandering around without even start to type any single word. And which is why Mr. Ruli Manurung, my beloved lecturer, scold me right in my face, telling me to STOP thinking and START typing.

He said that we cannot make what is so-called a perfect essay. All we can do is just start making one, and shape it along the way to perfection. If we do not start from now, you will never start forever. Okay, that’s directly slap me. All these years I’ve been doing nothing because worrying if I am not perfect enough to start applying for university.

But then again, I have to start NOW or NEVER. Okay, let me share a little bit of my progress and what I’ve been doing so far:

Continue reading “When I Need Words”

Being Away from Social Media (Day 3: The Reason)

I promised myself after my 25th birthday, I have to start reducing my activity in social media. So today is the 3rd day of my fasting, and with this post (and some future posts) will talk about how is it like doing fasting of Social Media 😛

Background Story

I did a lot activities on my Facebook page, especially when I want to express myself about recent issues. I also got news from Facebook instead of newspaper or websites. I expressed my opinion on my Facebook wall, did discussion with friends regarding certain issues in their comment box, and shout to annoying Facebook people directly. Other than Facebook, I also used Path to share some activities, especially my travelling-selfie.

I started realizing that I was too much exposed by those social media when many of my friends told me that I was always on the top of Facebook news feed. Although they were rarely “like” or comment my Facebook activities, they knew my activities, opinions, and even rant about something. In the end, I decided that I have to end this unhealthy exposure by deactivate some social media accounts that I was extensively using.

I think social media has made me too boastful. It made me care too much on my image, increase my self-esteem to unhealthy level, and too distracting. Spending more time for something more productive will bring more good to me in the future.

Continue reading “Being Away from Social Media (Day 3: The Reason)”

(Almost) Seamlessly Integrate Android Layout XML to Code Behind Reference

It’s been a while since my last post. With this post, I would like to share a little bit of my toolkit which I use extensively on my Android project. 🙂


So basically, when you are developing apps for Android, you use Android XML file to define the User Interface (UI) layout structure, then you code using Java for the implementation. Basically they resembles the .NET WPF/Silverlight’s XAML development, which they also use XML file to define the UI layout. But the worst thing I hate in the Android implementation is that basically the XML file and the Java code behind doesn’t really integrated seamlessly.

What made me say that .NET XAML is far years ahead compared to Android XML layout file? See the difference between those two frameworks below. Example: I want to make a simple WPF application containing a text box and a button. The button will be set disabled immediately after clicked, and show message box containing the text in the text box.

NET Framework WPF

In .NET Framework, the XAML file is seamlessly integrated with the code behind. In XAML you can define a Name for each of your control (widget), and call it directly from the C# code behind using the defined name


<Window x:Class="LatianWPF.MainWindow"
        Title="MainWindow" Height="350" Width="525">
             Width="497" />

            Click="ButtonB_Click" />


public partial class MainWindow : Window
    public MainWindow()

    private void ButtonB_Click(object sender, RoutedEventArgs e)
        ButtonB.IsEnabled = false;


To perform the same task in Android, you have to call findViewById for each widget ID defined in the XML layout file, and cast and store the returned value from the function call to the instance variable. This leads to messier code compared to .NET style, because you have to call and assign every reference in code behind before you can access what is defined inside XML layout file. Basically you do the integration between XML layout file and code behind manually.

Android XMLJava
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    tools:context="${packageName}.${activityClass}" >

        android:ems="10" >

        android:text="Button" />


public class MainActivity extends ActionBarActivity implements View.OnClickListener {
	private Button button1;
	private EditText editText1;

	protected void onCreate(Bundle savedInstanceState) {
		this.button1 = (Button)findViewById(R.id.main_button1));
		this.editText1 = (EditText)findViewById(R.id.main_editText1));
	public void onClick(View v) {
        Toast.makeText(this, editText1.getText(), 10000);


I want Android to have similar capability like .NET Framework which I don’t have to assign the reference to the widget manually by calling findViewById on each widget. This is to simplify the code and to make the code cleaner.


Continue reading “(Almost) Seamlessly Integrate Android Layout XML to Code Behind Reference”

Marathon Coding

I love doing what I may call marathon coding:

Code one functionality you are going to implement from start to end. If the functionality means that you have to create a very big class from start to end, then do it. DO NOT debug or try to run the program before the functionality you desired is exactly implemented. The threshold is that your program will be able to produce the output you desired by the specified input. Doing debugging in the middle of your coding can distract your focus on implementing your functionality into real code. So just omit the debugging until the threshold is met.

You may also omit some of exception handling during this phase. In Java programming, this means that you have to catch every checked-exception and re-throw it as RuntimeException. This will ensure that any error inside your library will be brought up to the surface. Structured and well-formed exception handling takes time to do, so we can do it after the implementation is completed. But in a case that an exception handling is inclusive in the program flow, you must do the exception handling in this phase. It’s all on your judgement on how you design your program flow.

Continue reading “Marathon Coding”

Ambiguous Result

Another quo-de for today. You can see how ambiguous this function call

protected void onPostExecute(RefreshTaskResult<ActionResult<SquadInfoShort>> result) {
	// Check result
	if(result.getResult().getResult()) {

What result?

Using Generics in an Ugly Way

Previously I was talking about generics. You can see how I do with generics to the confusing level:

new AsyncTask<Void, Void, RefreshTaskResult<ActionResult<List<SquadInfoShort>>>>() {
	protected RefreshTaskResult<ActionResult<List<SquadInfoShort>>> doInBackground(Void... params) {
		try {
			ActionResult<List<SquadInfoShort>> result = client.getSquadList();		
			return new RefreshTaskResult<ActionResult<List<SquadInfoShort>>>(result);
		} catch (Exception e) {
			// Catch any exception
			return new RefreshTaskResult<ActionResult<List<SquadInfoShort>>>(e);

See how many < > to feast your eyes.

Generics in WCF REST JSON Communication


So I got a task in designing a scalable and modular Service Oriented application using JSON and WCF. I am designing a web service using WCF. The communication between the web service and the client will be using JSON. While the server is using .NET Framework, the client is using Android Java. I aim to design the service as modular as possible. For every web service request from the client, the server will return the response in some kind of “envelope”. The “envelope” contains the execution result, whether it is success or not, the text message from web service, and the attachment which may contains object of specific type as the result of the service call.

I want to develop the modularity in my service framework, where I can make the “envelope” object as generic object that accept any kind of attachment type. And I want to deserialize the JSON response from server in my Android directly into specified “envelope” and attachment type, so that I can use it fairly easy in my code.


Continue reading “Generics in WCF REST JSON Communication”

Entity Framework: Design Approach

I’ve been using Entity Framework since its introduction. Entity Framework (EF) is a powerful Object-Relational Mapping (ORM) framework for .NET Framework. I’ve been debating with my teammates whether EF is better than other ORM such as OpenAccess, which I believe is true, because EF provides the necessary feature to connect our program to the database, especially if you are using Microsoft products, SQL Server. In my thinking, why bother using custom ORM to connect to SQL Server while actually Microsoft, the creator of everything (well, not, only .NET Framework and SQL Server I’m talking about here) provided the powerful tools to support your needs. In fact, Microsoft fully support the EF and provides the latest features as their development (EF and SQL Server) (should) inline each other.

Ok, I’m not going to debate about which one is better. I am going to talk about Code First approach to build your model from scratch. This is the first time I am trying using Code First approach, while previously I always use Database First or Model First approach.

Ways to Model Your Database

Entity Framework has been evolving quite rapidly. In the newest version, I noticed they are now using DbContext class instead of the old ObjectContext. And the new generated classes (if you are generating the model from existing database), will be just Plain-Old-CLR-Objects (POCOs). In previous EF, all the model classes must be derived from EntityObject. This offers more flexibility in designing your model classes.

One other notable changes I found is that the entity framework do not require the resource file definition in the connection string anymore. This will offer more flexibility in porting your model into separate DLL library and reuse it wherever you want. I am going to explore this finding later.

So to model your database, you can use three different approach: Database first, Model first, or Code first. Below is the explanation of each one of the way
Continue reading “Entity Framework: Design Approach”