Technology news and Jobs
The Linux distillery
Developing for Linux netbooks
The Linux distillery
Developing for Linux netbooks | Developing for Linux netbooks |
|
| by David M Williams | |
| Monday, 07 July 2008 | |
|
Page 3 of 3 Disk space, too, is at a premium. The netbooks mentioned in this column all use small capacity solid state hard drives. This is a good and a bad thing. Benefits include fast boot time and low heat emission (and therefore less cooling required and so overall a quieter system.) Unfortunately the biggest disadvantage is solid state drives are more expensive than platter-based hard drives for much less available storage. Instead of a laptop with 120Gb of disk space, the typical netbook is looking at sizes in the range of 4Gb, plus or minus a handful of gigabytes.Featured Whitepaper
5 Best Practices for Smartphone Support
By default, df lists disk sizes in terms of 1K blocks. You can get more meaningful output by appending the –h flag like so: [david@dmw ~]$ df –h This yields a more “human friendly” output, where size is represented in terms of megabytes (“M”) and gigabytes (“G”.) It is a simple matter for a program to execute this command and parse its output at run-time. Your application can make decisions based on this information, like whether to make local caches of data or not. If disk space is tight your app can intelligently disable caching. Of course, another possibility is your application might opt to store its data somewhere other than the local disk. It could save information online, for instance. This leads us nicely into one more major consideration when programming for a netbook: are you online? After all, netbooks are often designed with ubiquitous network connectivity in mind. Thus, your app may want to know if the device is presently networked. Once again a simple Linux command line comes in handy, and again it is a simple matter for a program to execute this at run-time and interrogate the output. Use the command ifconfig by itself, without parameters, to list the current state of all the network interfaces on the computer. There will be several lines of output but the important things are to check for the word ‘UP’. If you like, you can also parse the file to determine precisely which network interface is up – this will help identify, for instance, if the computer is tethered in some way (eth0, the Ethernet port, is up) or if it is connected via WiFi or 3G modem or any other way. So, let’s recap. Fundamentally, programming for the range of netbooks requires some consideration of the hardware constraints: display, RAM and disk size – not to mention an interest in whether the device is networked. These items can all be checked at the time the program is running which allows you to make decisions affecting how the program will render its display or how it will manage memory and data. All of this leads to a better user experience. Of course, it also goes without saying but be sure to write your programs well: if you allocate memory, be sure to free it somewhere else. If you open a file, be sure to close it later. Memory leaks and bad coding are never a good thing but moreso when the device only has limited memory to begin with! |
| < Next story in category | Previous story in the category > |
|---|




Tags




