Excerpt from new Android Training by Google:
Supporting different screen sizes usually means that your image resources must also be capable of adapting to different sizes. For example, a button background must fit whichever button shape it is applied to.
If you use simple images on components that can change size, you will quickly notice that the results are somewhat less than impressive, since the runtime will stretch or shrink your images uniformly. The solution is using nine-patch bitmaps, which are specially formatted PNG files that indicate which areas can and cannot be stretched.
Therefore, when designing bitmaps that will be used on components with variable size, always use nine-patches.
2011-12-16
2011-11-08
Multiple gcc versions on Ubuntu machine
# let the beast in su # install the older gcc versions apt-get install gcc-4.4 apt-get install g++-4.4 # configure update-alternatives --remove-all gcc update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 44 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.4 update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 46 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.6 # switch gcc update-alternatives --config gcc
2011-09-26
git user configuration override
In case if it's required to have a different user configuration from the one stored in .gitconfig, there is two possible ways to achieve this:
Local (per git)
This method will override default or git's user configuration. Add following to .bashrc:
Local (per git)
$ cd git-repo $ git config user.name "Name Surname" $ git config user.email "name.surname@domain.com"Global
This method will override default or git's user configuration. Add following to .bashrc:
function gitswitch () { case "$1" in "custom") export GIT_AUTHOR_EMAIL="name.surname@domain.com" export GIT_AUTHOR_NAME="Name Surname" export GIT_COMMITTER_EMAIL="name.surname@domain.com" export GIT_COMMITTER_NAME="Name Surname" echo "Using custom configuration." ;; "default") unset GIT_AUTHOR_EMAIL unset GIT_AUTHOR_NAME unset GIT_COMMITTER_EMAIL unset GIT_COMMITTER_NAME echo "Using default configuration from .gitconfig." ;; *) echo "Bad argument - please specify 'custom' or 'default'." ;; esac }And then:
$ gitswitch custom Using custom configuration. $ gitswitch default Using default configuration from .gitconfig. $ gitswitch ? Bad argument - please specify 'custom' or 'default'.
2011-08-29
To Go or not to Go?
Apparently Go language makes more and more community attention. Today made a 15 min try and was surprised how simple and fast you can get into it.
Surprisingly, there is bindings for GTK which allows to write GUI apps for both Linux and Windows, and one of the demos looks as simple as:
Surprisingly, there is bindings for GTK which allows to write GUI apps for both Linux and Windows, and one of the demos looks as simple as:
package main import ( "os" "github.com/mattn/go-gtk/gtk" "fmt" ) func main() { gtk.Init(&os.Args) window := gtk.Window(gtk.GTK_WINDOW_TOPLEVEL) window.SetTitle("GTK Table") window.Connect("destroy", gtk.MainQuit) swin := gtk.ScrolledWindow(nil, nil) swin.SetPolicy(gtk.GTK_POLICY_AUTOMATIC, gtk.GTK_POLICY_AUTOMATIC) table := gtk.Table(5, 5, false) for y := uint(0); y < 5; y++ { for x := uint(0); x < 5; x++ { table.Attach(gtk.ButtonWithLabel(fmt.Sprintf("%02d:%02d", x, y)), x, x+1, y, y+1, gtk.GTK_FILL, gtk.GTK_FILL, 5, 5) } } swin.AddWithViewPort(table) window.Add(swin) window.SetDefaultSize(200, 200) window.ShowAll() gtk.Main() }
2011-07-29
Subscribe to:
Posts (Atom)