Showing posts with label IT. Show all posts
Showing posts with label IT. Show all posts

14 February 2011

06 February 2011

[Tech notes] How to delete objects in Java?

There is no delete or free keyword in Java. The only thing that can collect the unreferenced memory chunk is garbage collector (GC). To take advantage of that, the best practice is to 'null' out your object reference whenever you want the GC to free that object:


MyObject a = new MyObject();

... /* Do something with object a */

a = null; /* Tell GC to free the memory referenced by a! */

05 February 2011

[Tech notes] What is Anti-aliasing?

Basically it is a technique to make your image/graphics smoother or reduce jagged edges of your graphics.

See the references below:

http://www.pantherproducts.co.uk/Articles/Graphics/anti_aliasing.shtml
http://en.wikipedia.org/wiki/Spatial_anti-aliasing

What is focus in computing?

'In computing, the focus indicates the component of the graphical user interface which is currently selected to receive input. Moving the focus away from a specific user interface element is known as a blur event in relation to this element.'

By convention, the tab key is used to move the focus to the next focusable component and shift + tab to the previous one.

There are several window management policies for focus:

Click to focus

On most mainstream user-interfaces, such as ones made by Microsoft and Apple, where one must click the mouse inside of the window for that window to gain focus.

Focus follows pointer

Another common policy on UNIX systems using X11 is the "focus follows mouse" policy (or FFM), where the focus automatically follows the current placement of the pointer.

01 February 2011

[Tech notes] Android API levels

The following table specifies the API Level supported by each version of the Android platform:

Platform VersionAPI Level
Android 2.39
Android 2.28
Android 2.17
Android 2.0.16
Android 2.05
Android 1.64
Android 1.53
Android 1.12
Android 1.01

The API Level identifier serves a key role in ensuring the best possible experience for users and application developers:
  • It lets the Android platform describe the maximum framework API revision that it supports
  • It lets applications describe the framework API revision that they require
  • It lets the system negotiate the installation of applications on the user's device, such that version-incompatible applications are not installed.

Applications can use a manifest element provided by the framework API — uses-sdk — to describe the minimum and maximum API Levels under which they are able to run, as well as the preferred API Level that they are designed to support.

Development Considerations

Application forward compatibility

Android applications are generally forward-compatible with new versions of the Android platform.

Because almost all changes to the framework API are additive, an Android application developed using any given version of the API (as specified by its API Level) is forward-compatible with later versions of the Android platform and higher API levels.

Application backward compatibility

Android applications are not necessarily backward compatible with versions of the Android platform older than the version against which they were compiled.

Reference

31 January 2011

Virtual function

In object-oriented programming, a virtual function or virtual method is a function or method whose behaviour can be overridden within an inheriting class by a function with the same signature. This concept is a very important part of the polymorphism portion of OOP.

The purpose of having a virtual function is as follows:

In OOP when a derived class inherits a base class, an object of the derived class may be referred to (or cast) as either being the base class type or the derived class type. If there are base class methods overridden by the derived class, the method call behaviour is ambiguous.

The distinction between virtual and non-virtual resolves this ambiguity. If the function in question is designated "virtual" in the base class then the derived class's function would be called (if it exists). If it is not virtual, the base class's function would be called.

Virtual functions overcome the problems with the type-field solution by allowing the programmer to declare functions in a base class that can be redefined in each derived class.

Programming language supports for virtual function:

C++: virtual methods are declared by using the virtual keyword followed by the function name and the parenthesis ().

Java: In Java, all non-static methods are by default "virtual functions." Only methods marked with the keyword final, which cannot be overridden, along with private methods, which are not inherited, are non-virtual. To override a method, use an annotation '@Override' (could be omitted) followed by function definition.

Python: In Python all class functions (methods) are virtual. And no special keywords needed to make overriding or virtualization happen. It just works automatically!

Reference: wiki

21 January 2011

[Tech Notes] Android basics II - Android SDK building blocks

A few objects are defined in the Android SDK that every developer needs to be familiar with. There are the building blocks of your android applications.

The most important ones are: Activities, Intents, Services, and Content Providers.

Activities - represents a user interface screen. Applications can define one or more activities to handle different phases of the program.

Intents - a mechanism for describing a specific action, such as "pick a photo". Everything has to go through Intents before creating activities or actions.

Services - a service is a task that runs in the background without the user's direct interaction, similar to a Unix daemon.

Content Providers - a set of data wrapped up in a common API to read and write it. This is the best way to share global data between applications.

[Ubuntu] Change desktop launcher icon

How to change desktop launcher icon? It is surprisingly easy, check here.

[Tech Notes] Android Basics I - Android System Architecture

Android system architecture:

Get get the big picture of system architecture, please check out this documentation online. To sum up, there are four primary layers for the software system - Linux Kernel, Libraries and Android Runtime, Application Framework, Applications and Widgets.

This concept is essential because you need to know what layer (s) you will be dealing with when developing apps, making your own frameworks and libraries or even modifying Linux Kernel. For application development, you will not see Linux Kernel, all you can see is Application Framework and Application layers.

Android System Architecture

19 January 2011

Howto: using webcams with Linux Ubuntu?

Check out this link. You will need a UVC compatible webcam. This way you can do video call using Skype or Gtalk in Ubuntu!

01 December 2010

SQL constraints concepts

Constraints are used to limit the type of data that can go into a table.

Constraints can be specified when a table is created (with the CREATE TABLE statement) or after the table is created (with the ALTER TABLE statement).

Here are several SQL constraints:

  • NOT NULL
  • UNIQUE
  • PRIMARY KEY
  • FOREIGN KEY - A FOREIGN KEY in one table points to a PRIMARY KEY in another table.
  • CHECK
  • DEFAULT

14 November 2010

Symbian OS: one of the most successful failures in tech history

Guest post: Symbian OS: one of the most successful failures in tech history

An article about Symbian OS. Interesting to look back at some tech history and think about what we have now.

02 September 2010

Message translation

Message translation
Google Gmail translation service.

04 August 2010

A project idea

On the subway back home today, I suddenly came up with an idea about making a web shell. I googled this idea after I got home and found that some people already had that exact project deployed. However I still think this idea is fun and might be a future standard for the upcoming WebOS.

Everybody has creativity, but to realize your idea and sell it to the world is another thing.

27 July 2010

Delegation Pattern

A nice explanation here: http://en.wikipedia.org/wiki/Delegation_pattern

The python code example on that web page even elaborates this design pattern in more details.

26 July 2010

Google Code University

A great website for learning CS technologies, especially with Python, AJAX, web security and distributed computing. Google is really spreading knowledge to the general public.

22 June 2010

Whats the difference between an interface and a abstract class?

While the purpose of Interface and Abstract Class are same, Abstract Class can have implementation of the method and also fields. An Interface cannot have implementations of the method or any fields. And a class can extend only one Abstract Class, but can implement multiple interfaces.

05 June 2010

Bookmark service from Diigo

http://www.diigo.com/
Use Diigo so that you don't need to use Google Chrome bookmark or Google Bookmark. Diigo is more powerful and easy to use.

04 June 2010

Git Directory / Git Working Trees / Git Index

What are they? What is the relationship among them?
Git Directory is the '.git' directory in the root of your project. It contains all the meta information and Git's history for your project. You can go to .git directory and type in command 'tree -L 1' to show all the files/directories inside it.
http://book.git-scm.com/1_git_directory_and_working_directory.html
Git Working Tree is not Git Directory. The working tree is basically a tree of all the HEAD commits. Each HEAD commit is a node in that tree.
http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#def_working_tree
Git Index is a staging area between your working directory and your repository. When you create a commit, what is committed is what is currently in the index (a file), not what is in your working directory.
http://book.git-scm.com/1_the_git_index.html A working directory is your current checkout files. Ultimate reference: Git User Manual