Android Design Issues – One Complex Activity VS Many Simpler Activities

February 21st, 2012

I ran into this design issue when developing an app and it seemed to make more sense, at least usability-wise, to just use one Activity class with multiple tabs versus dividing the app into many smaller activities.

Here are some things to consider when deciding the best approach for your app

  • Android can get rid of unused activities in order to reclaim RAM.
  • It’s easier to introduce memory leaks by trying to have a single activity stick around for a long period of time rather than having lighter activities that come and go
  • State management for dealing with eviction from memory (e.g. orientation change, RAM reclamation) can become more challenging or more inefficient
  • You may find many features of Android, like notification and app widgets, become progressively more challenging to use when you cannot simple launch an appropriate activity
  • Java does not support multiple hinheritance, so if you have features that requrie separate Android base classes (e.g. preferences and maps) it’s imposible to implement them all in one activity???

 

 

Rererences:

http://groups.google.com/group/android-developers/browse_thread/thread/079ead52980f7b66?pli=1

LAMP server in Ubuntu 11.x / 10.x

October 1st, 2011

It doesn’t get any easier than this.

sudo apt-get install lamp-server^

It will install all these packages for you…

apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common
libapache2-mod-php5 libapr1 libaprutil1 libaprutil1-dbd-sqlite3
libaprutil1-ldap libdbd-mysql-perl libdbi-perl libhtml-template-perl
libmysqlclient16 libnet-daemon-perl libplrpc-perl mysql-client-5.1
mysql-client-core-5.1 mysql-common mysql-server mysql-server-5.1
mysql-server-core-5.1 php5-cli php5-common php5-mysql

I noticed that PHP doesn’t work after the install. So all you have to do is restart apache.


$ sudo /etc/init.d/apache2 restart

Installing rsyslog

September 22nd, 2011

# INSTALL RSYSLOG
sudo yum install rsyslog

# DISABLE STOCK SYSTEM LOG
sudo /etc/init.d/syslog stop
sudo /sbin/chkconfig –level 2345 syslog off

# ENABLE RSYSLOG AT STARTUP INSTEAD
sudo /sbin/chkconfig –level 2345 rsyslog on

#Now EDIT /etc/rsyslog.conf AS FOLLOWS
$umask 0000
$ModLoad imudp
$UDPServerRun 514

My .vimrc and .gvimrc

September 22nd, 2011

I find these settings handy specially for coding in python.

.vimrc

syntax on
set ai
set number
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set autoindent
set smarttab
set smartcase

.gvimrc

set guifont=Bitstream\ Vera\ Sans\ Mono\ 9
set lines=45 columns=110

These are useful in windows gvim


set guifont=Consolas:h10
set guifontwide=MingLiU:h10 "For windows to display mixed character sets
set encoding=utf-8

Color schemes are optional

colorscheme torte

How to remove blank lines in Netbeans

September 22nd, 2011

Netbeans 7.0.x doesn’t provide a shortcut to delete blank lines. Fortunately this can be achieved by doing a replace operation:

Make sure you select regular expressions checkbox.

Search patter: \n\s*(\n)
Replace with: $1

Installing PostgreSQL 8.3 from Source

August 14th, 2010

So you like to cook things from scratch.

mv postgresql-8.3.11.tar.gz /usr/local/src
tar xvfz postgresql-8.3.11.tar.gz
cd postgresql-8.3.11
./configure
gmake
gmake install
adduser postgres
mkdir -p /usr/local/pgsql/data

chown -R postgres.postgres /usr/local/pgsql/data
su - postgres

/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data > /var/log/pg.log 2>&1 &

ImportError: No module named ext.reader

October 20th, 2009

I got this error while playing around with ZSI. The solution is as simple as installing PyXML.

http://pyxml.sourceforge.net/

For Ubuntu or Debian users a sudo apt-get install python-xml will do the trick. If this doesn’t work for you most likely you have multiple instances of python in your system. Also make sure that the package is installed or included in your python path variable.

erick@mac01 ~ $ python2.4
Python 2.4.6 (#2, Mar 19 2009, 10:00:53)
[GCC 4.3.3] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import sys
>>> print sys.path
['', '/usr/lib/python2.4', '/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk', '/usr/lib/python2.4/lib-dynload', '/usr/local/lib/python2.4/site-packages', '/usr/lib/python2.4/site-packages', '/usr/lib/site-python']
>>>

Making web services call with HTTP Basic Auth in python

October 7th, 2009

Here is a sample code that will allow you to make web services call that requires HTTP basic authentication.

Assuming we have generated TimeService_services.py and TimeServices_types.py files  using wsdl2py we can do the following

loc = TimeServiceLocator()
kw = {'tracefile': sys.stdout}     # print output to the screen
proxy  = loc.TimeServicePort(url='http://localhost/TimeService.wsdl', ** kw)
proxy.binding.SetAuth(AUTH.httpbasic, 'username', 'password')
# make ws call

Speakers makes crakling static noises.

June 18th, 2009

The sound in my ubuntu 9.04 stopped working correctly, and instead of playing a song, all I heard was static.

I tried a number of different things such as restarting pulseaudio and reloading the kernel modules. But the problem was that the PCM mixer’s volume was muted, and a way to change it is with alsamixer.

 alsamixer -Dhw

keys stop working when using VMWare under Ubuntu

May 7th, 2009

Sometimes the keyboard stops working properly when I run windows inside a VMWare virtual machine. The key bindings gets all screwed up and the the cap locks, shift, and ctrl keys stop working.

As a workaround you can just execute setxkbmap in to remap the the keyboard.

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/195982