Using root User on Ubuntu

By default, Ubuntu are using sudo by a sudoer to issue a root-only command rather than using root user. Sometimes it is annoying while you are configuring your Ubuntu box by typing sudo and password on every (root-only) command that you type. You can activate the root user (and setup/change root password) using the following command: aryo@ubuntu:~$ sudo su – [sudo] password for aryo: root@ubuntu:~# passwd Enter new UNIX password: Continue reading Using root User on Ubuntu

Fixing Apache 2 “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName” Error on Raspberry Pi Wheezy

You might probably find this error while starting/restarting Apache web server on Raspberry Pi Wheezy: root@raspi:# /etc/init.d/apache2 restart [….] Restarting web server: apache2apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName … waiting apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName . ok This error caused by Apache’s ServerName confguration is missing in apache2.conf file. So, as Continue reading Fixing Apache 2 “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName” Error on Raspberry Pi Wheezy

Android: Passing ArrayList of Object Within an Intent

An intent is an object that is very useful to pass variables between activities in Android. Basic primitive data types such as Integer, String, Boolean are easy to be passed through an intent. On my previously written article on how to switch between android activities I already explained on how to pass a char sequence variable. But Android has no custom object data type that can be passed directly through an Continue reading Android: Passing ArrayList of Object Within an Intent

Android: Simple Class For Easy Writing And Reading SharedPreferences String Value

SharedPreferences is used to store small configurations or settings data in your Android application. For example, as username or user preferences data storage. Just like variables, shared preferences can be identified by “key” string as “variable” name. Shared preferences are relatives to application. So it can not be accessed by other application directly. In the following example, I would like to store the username of logged in user so in Continue reading Android: Simple Class For Easy Writing And Reading SharedPreferences String Value

Thread in Android: An Example

StrictMode is most commonly used to catch accidental disk or network access on the application’s main thread, where UI operations are received and animations take place. Keeping disk and network operations off the main thread makes for much smoother, more responsive applications. By keeping your application’s main thread (UI thread) responsive, you also prevent ANR (Application Not Responding) dialogs from being shown to users. Network requests being made on UI thread may Continue reading Thread in Android: An Example

Communicating PHP with Android Java using JSON

When you have several variables (data) which you would send to Android using regular text on HTTP, then JSON would become an alternative format to XML. Android has it’s own JSON parser class which able to convert text on JSON format into a JSON Object. Since version 5.2.0, PHP has it’s built in json_encode() and json_decode() function to convert an array into json string and vice versa.

Set Background Color of Android View Programmatically

While you are generating or displaying content through list views, it is sometimes you need to make a zebra-styled rows or coloring the view of row background into a custom color depending on row’s content. This snippets is applicable to any android view which is inheriting View class. So to change or modify view’s background color, it is as easy as the following code on your activity class: View v Continue reading Set Background Color of Android View Programmatically

Inflate Android Layout Using Layout Inflater Service

Below is a small snippet in Android Java code to inflate a layout xml file into as a View using a Layout Inflater Service. Very useful if you intend to insert or include (inflate) any layout into another layout during runtime. AbsoluteLayout mainLayout = (AbsoluteLayout) findViewById(R.id.your_main_layout); LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); View menuLayout = inflater.inflate(R.layout.your_menu_layout, mainLayout, true); Assuming that your current activity has an AbsoluteLayout container named mainLayout in which a Continue reading Inflate Android Layout Using Layout Inflater Service

MacOS X: Configure Apache HTTP Server to Support HTTPS

MacOS X 10.8 – Mountain Lion has built in Apache HTTP server as I previously mentioned here. By default, the web server has disabled it’s functionality to handle HTTPS request, it is HTTP over SSL a.k.a Secure HTTP. It is a good idea to test your HTTPS web application on localhost during development. Then enabling HTTPS functionality in Apache web server is a must. The steps to enable HTTPS functionality Continue reading MacOS X: Configure Apache HTTP Server to Support HTTPS