After much playing around with the Palm Pilot simulator and debugger, I have figured out how to use PalmOS's shared library features. Note that this is not "official" in any way, but it seems to work for me. Comments are welcome. This document is divided into four sections:
* Intro to shared libraries on the Palm Pilot
* How to use shared libraries
* How to make your own shared libraries
* Conclusions
Note that I have only experimented with the Palm Pilot Pro; I have not tried the Palm Pilot Personal, and the old Pilots with PalmOS 1 almost certainly won't work (they don't have the SysLibLoad function, but I guess someone could emulate it...).
Intro to shared libraries on the Palm Pilot
Shared libraries (sometimes called "system libraries") on the Palm Pilot enable many applications to share common code, without having to have a copy of the code in each application's code resource. For example, there can be one copy of encryption routines, or a version of the standard C library, and many applications can be using it.
Shared libraries can also help you get around the 32K code size limit; you can break up your code into a main portion (of at most 32K), and a number of libraries (each of at most 32K).
Shared libraries are implemented as resource databases, with a resource type of libr and a resource ID of 0. In contrast, an application is a resource database with (usually) four resources: code 0, code 1, data 0, and pref 0. The libr 0 resource in a shared library corresponds exactly to the code 1 resource in an application.
A shared library on the Palm Pilot is not like one on most varieties of Unix. Whereas for Unix, shared libraries export a symbol table, and the operating system's dynamic loader maps calls based on their symbol name, for the Palm Pilot, shared libraries export a dispatch table. A dispatch table is basically a list of addresses of the functions in the library that can be called from other applications.
Every shared library must include the following four functions as the first four entries in its dispatch table:
open
Applications call this to initialize the library.
close
Applications call this to free storage allocated by the library, prior to exiting.
sleep
The system will call this routine for each shared library that is in use when the system is about to power down.
wake
The system will call this routine for each shared library that is in use when the system has just powered up.
These functions do not need to have these exact names; the names used internally by the shared library have no relation to the names applications use to access the functions. For example, the open routine in the Serial Library is called SerOpen, and the one in the Network Library is called NetLibOpen.
The remainder of the functions in the dispatch table can do whatever the library designer wants. I'm not sure what the size limit of the dispatch table is, but I haven't hit it yet (it's at most about 5500 functions, but it could be less).
How to use shared libraries
The Palm Pilot Pro, as shipped, comes with two libraries pre-installed: the serial library and the networking library. This section explains how to install third-party shared libraries, and how to write programs that use them.
To install a shared library, simply HotSync (or use something like pilot-xfer) the .prc file to your Pilot. In my experience, if you already have a copy (or an older version) of a library on your Palm Pilot, you need to delete it (with the Memory application) before installing the new version. I'm not sure why that is, and I'll look into it more later.
Once the library is installed, applications can use it. In order for a shared library to be used, it needs to be entered into the loaded library table. Once that has been done, its index in the loaded library table is called its reference number.
An application that wishes to use a shared library should use the SysLibFind function. This function looks up a shared library in the loaded library table, and gives back the reference number.
If SysLibFind fails, it means the library is not currently loaded. The application can try to load the library itself by using the SysLibLoad function. Once a reference number for the library has been obtained, the library's open function should be called. These functions can often be called from the StartApplication routine.
In the example below, the application is trying to use the library called "Gauss Library", which is stored in a resource database of type 'libr' and creator 'Gaus':
Err err;
UInt GaussLibRefNum;
...
err = SysLibFind("Gauss Library", &GaussLibRefNum);
if (err) err = SysLibLoad('libr', 'Gaus', &GaussLibRefNum);
ErrFatalDisplayIf(err, "Cannot load Gauss Library!");
err = GaussLibOpen(GaussLibRefNum);
/* Check for errors in the Open() routine */
Note that SysLibLoad is not defined in some header file distributions. If you get an error regarding this, put the following near the top of your C file:
Err SysLibLoad(ULong type, ULong creator, UIntPtr refNumPtr)
SYS_TRAP(684);
Every function in a shared library must take a UInt refNum as its first argument. For example, if the above Gauss Library implements arithmetic on Gaussian (complex) integers, and it contains a function Err GaussLibAdd(UInt refNum, Gauss_t *sum, Gauss_t *a, Gauss_t *b), the application would call it as follows:
Gauss_t a, b, sum;
Err err;
...
err = GaussLibAdd(GaussLibRefNum, &sum, &a, &b);
The application would also have #include "GaussLib.h" in it (this header file would generally be distributed with the library). The GaussLib.h header file would have definitions for any data types used by the library, as well as declarations for the library functions. For example, the declarations in GaussLib.h might be:
Err GaussLibOpen(UInt refNum) SYS_TRAP(sysLibOpen);
Err GaussLibClose(UInt refNum, UIntPtr numappsP) SYS_TRAP(sysLibClose);
Err GaussLibSleep(UInt refNum) SYS_TRAP(sysLibSleep);
Err GaussLibWake(UInt refNum) SYS_TRAP(sysLibWake);
Err GaussLibCreate(UInt refNum, Gauss_t *val, Long re, Long im)
SYS_TRAP(sysLibCustom);
Err GaussLibRead(UInt refNum, Gauss_t *val, Long *re, Long *im)
SYS_TRAP(sysLibCustom+1);
Err GaussLibAdd(UInt refNum, Gauss_t *sum, Gauss_t *a, Gauss_t *b)
SYS_TRAP(sysLibCustom+2);
Err GaussLibMul(UInt refNum, Gauss_t *prod, Gauss_t *a, Gauss_t *b)
SYS_TRAP(sysLibCustom+3);
These declarations would enable applications to call, in addition to the four "standard" functions, the functions GaussLibCreate, GaussLibRead, GaussLibAdd, and GaussLibMul.
Finally, when the application is about to exit, it should close the shared library by calling its close function. This is often done in the StopApplication routine. In addition, an application may choose to unload the library from the loaded library table. It should only do this, however, if the library is not in use by other applications (the close() function in the library could return information about whether any other applications are using the library). Libraries are unloaded by calling the SysLibRemove function (after which the reference number is invalid). For example,
UInt numapps;
err = GaussLibClose(GaussLibRefNum, &numapps);
/* Check for errors in the Close() routine */
if (numapps == 0) {
SysLibRemove(GaussLibRefNum);
}
How to make your own shared libraries
This section will outline how to create a shared library using the Unix tools. A shared library is created in the same way as a regular Palm Pilot application, with a couple of notable exceptions:
* The library can have no data or bss segment. This means no global or static variables. Static constants (including literal strings) are fine, though, as these go in the text (code) segment.
* The m68k executable is linked with the -shared flag to gcc, which prevents the C run-time (crt0) and standard C libraries from being automatically included. Instead of the C run-time, the first object file in the link command must be the one that begins with your library's dispatch table. More on this later.
We will now see how to create the Gauss Library, which was described above. Here is the complete GaussLib.h:
#ifndef __GAUSSLIB_H__
#define __GAUSSLIB_H__
/* Data structures */
typedef struct {
Long re, im;
} Gauss_t;
/* Function declarations */
Err GaussLibOpen(UInt refNum) SYS_TRAP(sysLibTrapOpen);
Err GaussLibClose(UInt refNum, UIntPtr numappsP) SYS_TRAP(sysLibTrapClose);
Err GaussLibSleep(UInt refNum) SYS_TRAP(sysLibTrapSleep);
Err GaussLibWake(UInt refNum) SYS_TRAP(sysLibTrapWake);
Err GaussLibCreate(UInt refNum, Gauss_t *val, Long re, Long im)
SYS_TRAP(sysLibTrapCustom);
Err GaussLibRead(UInt refNum, Gauss_t *val, Long *re, Long *im)
SYS_TRAP(sysLibTrapCustom+1);
Err GaussLibAdd(UInt refNum, Gauss_t *sum, Gauss_t *a, Gauss_t *b)
SYS_TRAP(sysLibTrapCustom+2);
Err GaussLibMul(UInt refNum, Gauss_t *prod, Gauss_t *a, Gauss_t *b)
SYS_TRAP(sysLibTrapCustom+3);
#endif
The format of this header file is simple; the first part defines data structures, and the second declares the library functions. Note that each library function declaration is followed by a SYS_TRAP attribute. The four standard functions should have the values listed above, and subsequent functions should have arguments to SYS_TRAP starting at sysLibTrapCustom and incrementing from there.
We now start looking at GaussLib.c. The first section of the C file sets up declarations for functions that the dispatch table will use, as well as defining the globals structure for the library. Remember that since the library can have no global variables, it needs to dynamically allocate space for its globals. It does this by having a single structure which contains all of its globals, and it allocates memory for this structure in the Open function, and frees it in the Close function. The only global variable we will use in the Gauss Library is a reference count of the number of applications currently using the library. The beginning of GaussLib.c, then, looks like:
#include
#include "GaussLib.h"
/* Dispatch table declarations */
ULong install_dispatcher(UInt,SysLibTblEntryPtr);
Ptr *gettable(void);
/* The globals structure for this library */
typedef struct {
UInt refcount;
} GaussLib_globals;
The first piece of code in GaussLib.c must be the code which sets up the dispatch table. For any library, it looks like this:
ULong start (UInt refnum, SysLibTblEntryPtr entryP)
{
ULong ret;
asm("
movel %%fp@(10),%%sp@-
movew %%fp@(8),%%sp@-
jsr install_dispatcher(%%pc)
movel %%d0,%0
jmp out(%%pc)
gettable:
lea jmptable(%%pc),%%a0
rts
jmptable:
dc.w 50
dc.w 18
dc.w 22
dc.w 26
dc.w 30
dc.w 34
dc.w 38
dc.w 42
dc.w 46
jmp gausslib_open(%%pc)
jmp gausslib_close(%%pc)
jmp gausslib_sleep(%%pc)
jmp gausslib_wake(%%pc)
jmp gausslib_create(%%pc)
jmp gausslib_read(%%pc)
jmp gausslib_add(%%pc)
jmp gausslib_mul(%%pc)
.asciz \"Gauss Library\"
.even
out:
" : "=r" (ret) :);
return ret;
}
ULong install_dispatcher(UInt refnum, SysLibTblEntryPtr entryP)
{
Ptr *table = gettable();
entryP->dispatchTblP = table;
entryP->globalsP = NULL;
return 0;
}
The only part of the above code that will change for different libraries is the section between the jmptable: and out: labels. Here's how to work it out: suppose your library has n functions, including the four standard ones (for GaussLib, n is 8). Then on the first line, you would put dc.w 6n+2 (here, 6n+2 = 50).
The next n lines are of the form dc.w 2n+4i-2, as i ranges from 1 to n.
The next n lines are of the form jmp internal_function_name(%%pc), where each internal_function_name is the name of one of the library functions, as named in the source code for the library, which may be different from the name in GaussLib.h. (In fact, if it has the same name, you may run into problems unless you change the definition of SYS_TRAP.) The first four should be the standard four functions, and the remaining ones must be in the same order as they are listed in the header file.
The last line contains the textual name of the library, which applications will use in a SysLibFind call.
Now you should define the four standard functions. The open function should, if necessary, allocate memory for the library globals. Note that the amount of dynamic memory available is limited. If you have a large amount of constant data (such as a word list), include it as static const data in your program, so that it ends up in the text segment. If you really need a large amount of variable data, consider putting it into a database, and only including a pointer (or handle) to the database in the globals structure. Here is a template for the open routine:
Err gausslib_open(UInt refnum)
{
/* Get the current globals value */
SysLibTblEntryPtr entryP = SysLibTblEntry(refnum);
GaussLib_globals *gl = (GaussLib_globals*)entryP->globalsP;
if (gl) {
/* We are already open in some other application; just
increment the refcount */
gl->refcount++;
return 0;
}
/* We need to allocate space for the globals */
entryP->globalsP = MemPtrNew(sizeof(GaussLib_globals));
MemPtrSetOwner(entryP->globalsP, 0);
gl = (GaussLib_globals*)entryP->globalsP;
/* Initialize the globals */
gl->refcount = 1;
return 0;
}
The first two lines of code are the idiom that any library function would use if it needed to access some value in the globals structure. The next section deals with the case that some other application has already opened this library. In our case, we just increment the reference count, but other libraries may want to return an error code.
The section after that is the idiom for allocating the memory for a globals structure, and the last section is the library-specific initialization of the global variables.
The close routine should free any memory or close any databases allocated or opened by the open routine, but only if no other application currently has the library open. Here is a template for the close routine:
Err gausslib_close(UInt refnum, UIntPtr numappsP)
{
/* Get the current globals value */
SysLibTblEntryPtr entryP = SysLibTblEntry(refnum);
GaussLib_globals *gl = (GaussLib_globals*)entryP->globalsP;
if (!gl) {
/* We're not open! */
return 1;
}
/* Clean up */
*numappsP = --gl->refount;
if (*numappsP == 0) {
MemChunkFree(entryP->globalsP);
entryP->globalsP = NULL;
}
return 0;
}
This routine first gets a pointer to the library's global data. If this is NULL, the library is not open. This error can be signalled to the application with a result code, as above, or the library can do something like ErrFatalDisplayIf(!gl, "Gauss Library is not open!"); instead.
The remainder of this routine should be used to deallocate the library global memory, if the library reference count has dropped to 0. In this case (which is a good idea), we also return the number of applications that still have the library open. If this is 0, the application that just closed us should remove the library from the loaded library table.
The sleep and wake routines are usually trivial; only if your library actually cares (as, say, the Network Library might) when the Palm Pilot is turned on or off should anything happen here.
Err gausslib_sleep(UInt refnum)
{
return 0;
}
Err gausslib_wake(UInt refnum)
{
return 0;
}
From here on in, you just write the code to implement your library functions. In our example, none of our functions access the library globals, so it is very easy:
Err gausslib_create(UInt refNum, Gauss_t *val, Long re, Long im)
{
val->re = re;
val->im = im;
return 0;
}
Err gausslib_read(UInt refNum, Gauss_t *val, Long *re, Long *im)
{
*re = val->re;
*im = val->im;
return 0;
}
Err gausslib_add(UInt refNum, Gauss_t *sum, Gauss_t *a, Gauss_t *b)
{
sum->re = a->re + b->re;
sum->im = a->im + b->im;
return 0;
}
Err gausslib_mul(UInt refNum, Gauss_t *prod, Gauss_t *a, Gauss_t *b)
{
prod->re = (a->re*b->re)-(a->im*b->im);
prod->im = (a->re*b->im)+(a->im*b->re);
return 0;
}
We now try to compile GaussLib.c into a shared library resource database. The first step is to compile each C file into an object file. In our case, we only have one C file:
m68k-palmos-coff-gcc -O5 -c GaussLib.c
We now link all of our object files into a program file. If you have more than one object file, the one that starts with the dispatch table must come first. Some libraries may need the -lgcc at the end of this line, and some may not; try it without, and if you get errors, try it with.
m68k-palmos-coff-gcc -shared -o GaussLib GaussLib.o -lgcc
Now, make sure your data and bss segments are empty:
m68k-palmos-coff-objdump --section-headers GaussLib
GaussLib: file format coff-m68k
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000224 00010000 00010000 00002000 2**2
CONTENTS, ALLOC, LOAD, CODE
1 .data 00000000 00000000 00000000 00000000 2**2
ALLOC, LOAD, DATA
2 .bss 00000000 00000000 00000000 00000000 2**2
ALLOC
If the "Size" field of the data or bss if not 0, check your library carefully for global or static data, and either make them static constants (if possible), or else move them to the library globals structure.
Next, extract the text segment from the program file, delete the data and other non-useful segments, and rename the text segment to the library segment:
m68k-palmos-coff-obj-res GaussLib
rm -f {code,pref,data}0000.GaussLib.grc
mv code0001.GaussLib.grc libr0000.GaussLib.grc
Now build a resource database (prc) file, containing only the library segment:
build-prc GaussLib.prc GaussLib Gaus libr0000.GaussLib.grc
At this point, everything is ready to go, except for the fact that build-prc assumes the database it creates is of type 'appl'. Shared libraries should be of type 'libr'. It would be good if a future version of build-prc would have an option for this, but for now, here is appl2libr.c:
#include
int main(int argc, char **argv)
{
FILE *prc;
char kind[5];
if (argc < 2) {
fprintf(stderr, "Usage: %s file.prc\n", argv[0]);
exit(1);
}
prc = fopen(argv[1], "r+");
if (!prc) { perror("fopen"); exit(2); }
if (fseek(prc, 0x3c, SEEK_SET)) { perror("fseek"); exit(2); }
kind[4] = '\0';
if (fread(kind, 4, 1, prc) != 1) { perror("fread"); exit(2); }
if (strcmp(kind, "appl")) {
fprintf(stderr, "%s is not an appl file\n", argv[1]);
exit(3);
}
if (fseek(prc, 0x3c, SEEK_SET)) { perror("fseek"); exit(2); }
strcpy(kind, "libr");
if (fwrite(kind, 4, 1, prc) != 1) { perror("fwrite"); exit(2); }
if (fclose(prc)) { perror("fclose"); exit(2); }
return 0;
}
Compile this program, and convert your prc file to have type 'libr':
gcc -o appl2libr appl2libr.c
./appl2libr GaussLib.prc
You're done! GaussLib.prc is now a shared library, ready to be uploaded to a Palm Pilot. You can distribute the prc file along with applications that use it, and/or you can distribute the header file so people can write their own applications that use the library.
For reference, here is a Makefile:
LIBNAME = GaussLib
CREATOR = Gaus
CC = m68k-palmos-coff-gcc
XTRALIBS = -lgcc
OBJRES = m68k-palmos-coff-obj-res
BUILDPRC = build-prc
$(LIBNAME).prc: libr0000.$(LIBNAME).grc ./appl2libr
$(BUILDPRC) $@ $(LIBNAME) $(CREATOR) libr0000.$(LIBNAME).grc
./appl2libr $@
./appl2libr: appl2libr.c
gcc -o $@ $<
libr0000.$(LIBNAME).grc: $(LIBNAME)
$(OBJRES) $(LIBNAME)
rm -f {code,pref,data}0000.$(LIBNAME).grc
mv code0001.$(LIBNAME).grc libr0000.$(LIBNAME).grc
$(LIBNAME): $(LIBNAME).o
$(CC) -shared -o $(LIBNAME) $(LIBNAME).o $(XTRALIBS)
$(LIBNAME).o: $(LIBNAME).c
$(CC) -O5 -c $(LIBNAME).c
clean:
rm -f libr0000.$(LIBNAME).grc $(LIBNAME).o
spotless: clean
rm -f appl2libr $(LIBNAME).prc $(LIBNAME)
Monday, December 31, 2007
Shared libraries on the Palm Pilot
Monday, December 17, 2007
UIPickColor
The first two parameters are similar to each other: they are pointers to
the index and the RGB values. You can set either (but not both) pointers
to NULL if you want. They're the default, starting values for the picker.
The third parameter is which mode to start in: RGB sliders or "chits": 256
small squares that you can tap upon. Pass UIPickColorStartPalette or
...RGB.
Fourth param is the title (leave null for the default), and fifth is the
help tip ID (which is currently unused).
When the function returns, the color index and/or rgb variables you passed
a pointer to will have the user's selected data in them. The RGB value may
be "more correct" than the index, since this function won't change the
palette and thus the user could pick an RGB value that isn't in the current
palette. If you care, you'd want to change the palette yourself now that
you know the user wants that particular shade.
Here's a small excerpt taken from some sample code I wrote for PalmSource,
many moons ago. (The only reason to pass &myColorindex is to allow usage
of the Palette view even though we really only care about the RGB return
value. So they both need to be provided, with appropriate initial values.)
UIPickColor(&myColorindex,
&myRgb,
UIPickColorStartPalette,
"Pick it!",
0);
// change the color of field text to the chosen setting (while our app
is running)
UIColorSetTableEntry(UIFieldText, &myRgb);
// get everything to redraw with the new setting
FrmDrawForm(FrmGetActiveForm());
Thursday, December 13, 2007
Tuesday, December 11, 2007
Palm Programming Tutorial(BmpSetTransparentValue)
For the BmpSetTransparentValue() function, tr are two arguments one is the bitmap pointer, and the other is the transparent value.
In my app, I have used pure wite transparent color, and I set it 0xFFFF
BmpSetTransparentValue((BitmapType*)bmpV3, 0xFFFF);
make 5-6-5 bitmap coding (16bit)
RGBColorType color;
//UInt8 R,G,B ( color.r, color.g, color.b )
R = (R-7) / 8;
G = (G-3) / 4;
B = (B-7) / 8;
put all colors to one value
UInt16 color = (R<<11) | (G<<5)>| B;
Set Custom "Ringtones" for Your Email Inbox
Custom ringtones on our phones have been making it easy to tell who's calling (and whether we want to answer) without looking at our phones for years now, so why aren't we doing the same thing with our incoming email? A frequently firing new-email alert can throw you off a productivity sweep with nothing more than a gentle ding. You rush to your inbox to open this new gift of an email just to find that... oh... it's another borderline offensive mass email chain from your cousin-in-law. Today I'll show you how to set up custom alerts with your favorite desktop email client to minimize email distraction without missing important messages.
This post was inspired by this excellent post at weblog Inspect My Gadget.
A lot of people turn off email notifications altogether to ensure they avoid the distraction of the constant, IM-like flow of new email, but that also means that when a really important message arrives, you may not get to it in the timely manner it requires. You can take advantage of custom alerts (i.e., custom ringtones for your email) to help firewall your attention so that only the messages that need to be brought to your attention are, and the emails you don't need to get to quickly aren't. Whether you're running Thunderbird, Outlook in Windows, or Mail.app on your Mac, each has the ability to perform custom alerts for incoming mail. First I'll show you the customized email alerts I use to give you a few ideas of where you can start, then I'll show you how to set it up in your client of choice.
When To Use Email "Ringtones"
By Groups: If you use your desktop email client to deal with both personal and work email, you may want to set up different alerts for each (or only alerts for the more important group). Likewise, if you're just using the client for personal email, you might want to set different notification sounds for friends and family.
- By Individual: If you want to get really specific, you can set custom alert tones by individual. This won't be the most practical for all clients (it would be especially painful to set up with Thunderbird), but the concept of matching a snippet of your contact's custom phone ringtone with your email notification is enticing.
- By Subject: If you've got a buzzword or two that you always want to keep on top of, you might want to consider a custom alert for any email containing that special topic.
- By Priority: I don't know a lot of people who actually set priority when they send emails, but if you're dealing with folks who do, it might be worthwhile to set a special alert for your high priority messages. Then again, you can still set up your own list of priority contacts and non-priority contacts to achieve the same basic goal.
If you really want to use custom notifications to streamline your inbox and minimize distraction, I'd recommend setting custom alerts only for important emails—that means long threads discussing this YouTube video with your friends won't receive a notification at all, but that all-important email from your boss will set off a fire-alarm-esque alert.
Now that you've got a better idea how and when you might use custom alerts, here's how to set them up.
Custom Email Notifications in Thunderbird

That means that all you have to do is set up the appropriate filters to either move or copy a message to a separate folder in Thunderbird when you receive new email, at which point you can set up an alert specific to that message by its folder. Alternately, if you're using Thunderbird as the ultimate Gmail IMAP client, you may already have filters set up in Gmail that you can use, in which case you'd only need to set up the customized alerts.
Remember that Thunderbird's address book supports groups, which means that if you want to create separate alerts by group, creating a filter that can copy new email into separate folders by contact groups is a cinch.
Custom Email Notifications in Outlook

Custom Email Notifications in Mail.app

Posted by
sumesh
at
12:29 PM
|
Labels: Lifehacker
Hot Image Your PC's Hard Drive with DriveImage XML
You don't need a complicated boot CD or expensive software to create a restorable system disk image for your PC: free utility DriveImage XML can save a full, working snapshot of your Windows hard drive while you work on it. (That's hot.) When your PC crashes and burns or just slows down over time, the best insurance you can have is a mirror image of your operating system, complete with drivers, user settings, software applications, and documents in one place. A while back we covered how to partition and image your Windows hard drive using the Linux-based System Recovery Boot CD, a process that involves command line work, disk-burning, rebooting, and video driver wrangling. With DiskImage XML, imaging your PC's hard drive is a matter of a few clicks, no reboots required. Let's check it out.
Create a New System Image
First, download DriveImage XML for free and install it as usual. You can store your system image anywhere you'd like, but I highly recommend saving it on a disk other than the one you're imaging. So if you plan to image your C: drive, purchase an external hard drive to store C:'s image, or right after you create the image, burn the files to CD or DVD. This way if your C: drive fails or breaks, you still have your image available on a separate physical disk.
When you launch DriveImage XML (DiX), click on the "Backup" button on the lower left of the screen. It will scan your PC and list all the hard drives connected to your system. To image your C: drive (most likely your system's primary, active disk), select it and click the Next button to launch DriveImage XML's backup wizard. Click Next again to set where DiX should save your image, and a few additional options, as shown.
The settings here will affect how large your image file is and how it can be restored. Here's a rundown of what each does.
- Raw mode. In "raw mode," DriveImage XML makes a sector by sector copy of your drive, including unused space. This means your image file will be the same exact size of the drive, and it can only be restored to a drive of that same exact size. For most home use situations, leave this box unchecked. (There's no sense in backing up blank disk space.)
- Split large files. If you plan to burn your disk image to CDs or DVDs, select "Split large files," which will break your image file down into smaller chunks. This way you can easily save them to smaller-sized disks later on. If "Split large files" is NOT checked, you'll get one giant image file, either as large as the disk itself or as large as the used space on the disk (depending on whether "Raw mode" is enabled.)
- Compressed. If space on your destination drive is at a premium, select the "Compressed" option to make your image file up to 40% smaller than in normal mode. Compression will slow down the imaging process, but it will help save on disk space.
- Hot Imaging Strategy. The hot part of DriveImage XML is that it can image your drive while you work but that means that files you're using while it does its thing have to be locked to be copied correctly. DiX will try two strategies: locking the drive entirely (if you're not using the computer and saving files), or using Windows' built-in Volume Shadow Services to get the last saved state of the drive. Leaving this at the default "Try Volume Locking first" is fine for home use.
Click the Next button to start creating the drive image file. Depending on the speed of your computer, and the size of your hard drive (and amount of used space), this process can take a significant amount of time. Consider starting it before you leave your computer for the evening, or during your lunch break. DriveImage XML will keep a running counter of how much time it's been copying the disk and how much time is left until it completes, as shown.
DiX isn't fast, especially if you've got a lot of data to image. On the spare PC where I ran DiX, about 12GB of used space took about 35 minutes to image. When the imaging process is complete, you'll have two types of files stored on the destination: a single .XML file (hence DriveImage XML's name), and either one or several .DAT files (depending on whether or not you selected "Split large files.") The .XML file is a list of all the files in the image. The .DAT file(s) contain the actual image data. Here's what the file listing on my external drive looks like, once my image was complete.
Once you've saved a system image, you can use it in three ways: to restore individual files from their saved state; to restore your PC back to the exact state it was when you saved the image, or to make an exact copy of the drive to another partition or hard drive.
Browse and Restore Individual Files
To view and copy files contained within an image to your PC, click on the Browse button on the lower left of the DriveImage XML window, and click "Load Image." Then select the .XML file for the image you saved. (Remember, every image has exactly one .XML file associated with it.) DiX will read the .XML listing and display all the files contained within the image, as shown.
Navigate the folder tree as usual, and right-click any file to view it, launch it using its associated application, or extract it (restore it to your current PC setup.) You can also right-click on an entire folder like "My Documents" and choose "Extract" (or press Ctrl+S) to copy it to your current PC setup.
Perform a Complete System Restore
If your computer's hard drive crashed entirely, you can restore it to its past state using the DiX image you created. Restoring an image to a target disk will delete everything on the disk and copy the contents of the image to it. That means you cannot restore an image to a drive you're already using (because you can't delete the contents of a disk already in use). So if you booted up your computer on your C: drive, you can't restore an image to your C: drive. You need access to the target drive as a secondary disk. There are a few ways to do this. You can install the target drive as a slave in another PC in addition to its primary boot drive, or you can buy a hard drive enclosure and connect the target as an external drive.Either way, to restore a disk image to a drive you intend to boot from, you'll need:
- A PC running DriveImage XML
- The saved disk image files, whether they're on CD, DVD, on the host PC or on an external drive
- A target drive with a partition at least the size of the drive image files. (You can use Windows built-in Disk Management console or your partition manager of choice to create a new partition to restore to.)
To start the restore process, in DriveImage XML, click on the Restore button, then click the Next button, which will launch the drive restore wizard. From there, select the .XML file associated with the image, and then select the target drive. (Remember, the target drive must be an existing partition that's the same size or larger than the image, and it must not be the active system drive.) All files will be deleted from the target drive on restore, so be double sure there's nothing there you need to save. Like the image creation process, Dix will display a progress bar and estimated time as it restores the image to the drive.
Once the image has been copied and restored onto the target drive, you'll have to make that drive the active, boot partition for your PC to start using it. Either install the disk back into your PC, or use the Disk Management Console to set the target partition as "Active" and reboot your PC. Alternately, you can create a bootable Windows CD with DriveImage XML on it. Here's more on DriveImage XML on a BartPE bootable CD.
More DiX Actions
You can also copy an entire existing partition to another blank partition without making an image at all, using DiX's Drive to Drive feature. (This could be useful to make a full copy of a data partition, for example.) Finally, you can schedule regular disk image operations using Windows Task Scheduler and Dix command line options. For more on that, in DiX's Help file, under the Feature folder, see "Task Scheduler."
Comparison to Commercial Alternatives, and Why DriveImage XML is Not Quite Time Machine for Windows
Commercial software that retails betweens $50 and $70, like Norton Ghost and Acronis TrueImage, do exactly what DiX does for free. However, DiX does NOT do incremental images like most commercial products and Mac OS X's built-in Time Machine does. Every time you create an image it's a full and complete backup of the disk, which means that regularly scheduled imaging can eat up hard drive space fast.
Also, DiX's image files aren't browse-able using Windows Explorer, the way Mac users can explore Time Machine's backups using the Finder. However, the developers say that DiX is not necessarily required to restore files from the images it creates. The .XML file is not proprietary and readable by any program out to do so, and the image file itself is just all your files squashed into one big .DAT file. The .XML file acts as a map to the .DAT file, and if DiX wasn't around, in theory other programs would be able to grok it pretty easily. Which is nice, but still not as transparent as Time Machine's backup files.
Video Demonstration
Finally, if you haven't had enough of DriveImageXML, here's a video tutorial on using it, posted by its makers on YouTube.
How do you insure a speedy recovery from a system crash or just back to a clean and shiny Windows installation? Have you tried DriveImage XML? Tell us about it in the comments.
Posted by
sumesh
at
12:26 PM
|
Labels: Lifehacker
Monday, December 10, 2007
Use Your iPhone's Internet Connection On Your Laptop
NOTE: You're probably asking yourself: "Isn't the EDGE data network that the iPhone uses SLOW?" Well, yes it is. But if you're at all like me, sometimes a slow full-screen browsing session is better than slow browsing on the small screen. I've only tested this method on my MacBook Pro, but since SSH is platform independent, this should be a workable solution on Windows, Mac, or Linux. What You'll NeedFor this guide, you'll need:
Prepare Your iPhone![]() Start Up Your Ad-Hoc NetworkThis process differs depending on what operating system you're using. As I said above, I've only tested this on a Mac, but I'll point to instructions on how to do the same on Windows as well.
On a Windows PC you'll need to set up Internet Connection Sharing. You can find instructions for doing so here. Good luck! Once you create your network, your computer won't be able to connect wirelessly to any Wi-Fi hotspot, just other devices. Connect Your iPhone to Your Computer![]()
Connect Your Computer to Your iPhone's InternetNow it's time to make use of the SSH server we installed on our iPhone. From this point on, we're basically following our previous guide to encrypting your web browsing with an SSH SOCKS proxy. Open up your command line application of choice and enter the following: ...where YourIPAddress is replaced with whatever you wrote down above.
After you've entered the correct password, the prompt will appear to hang. That's actually what should be happening, so you're on the right track. Set Your Browser to Use SOCKS ProxyAt this point you just need to set your browser or operating system to use the SOCKS Proxy we've just set up to route our internet connection through the iPhone's EDGE connection. Gina's post shows how to do this with Firefox, though I'll admit I had some trouble getting the proxy to play properly with Firefox on my Mac. Your mileage may vary, but as an alternative I'll show you how to set it up in Safari, which worked well for me.
|
Posted by
sumesh
at
7:06 PM
|
Labels: Lifehacker
The 20 Best iPod Utilities [Feature]
![]() With a new generation of iPods on the market this holiday season, your reliable old iPod may not seem as shiny as it once did. But with the help of third party applications and utilities, you can unlock tons of useful functionality you never knew was there and revive that aging iPod so it doesn't look quite so bad next to its successors. Whether new or old, the following 20 iPod utilities can help you get the most from your iPod. Transfer (and Play) Music to and from Your iPodWhile syncing music to your iPod has always been a breeze, pulling music off your iPod isn't quite at easy—unless you're using one of these handy apps, that is.
Converters: Video and AudiobookYes, you could purchase TV shows and movies from iTunes, but if you've already got the DVD or you've downloaded a video that happens to be in the wrong format, why should you shell out more cash to Apple—especially when you can easily convert them for your iPod using free apps?
Miscellaneous iPod Utilities
Upgrades for Older iPodsA number of third party applications and utilities exist to expand the functionality of your existing iPod by modifying or installing new software onto your iPod. For example:
![]() iPhone and iPod touch OnlyOkay, so if you do happen to have one of the fancier new iPods, you do have access to a few other fairly exciting third-party developments.
Did we miss a favorite of yours? Let's hear what iPod apps and add-ons make your iPod—new or old—sparkle. |
Posted by
sumesh
at
6:46 PM
|
Labels: downloads, Lifehacker, Tips
Rip DVDs in Linux the (Semi-)Easy Way
With its hacker-friendly aesthetic and open source mentality, you'd think a Linux desktop would be the best place to assert your digital rights—you know, make backup copies of your DVDs, convert them for iPods, that kind of thing.
And you'd be half right. There are plenty of programs that let you take control of your video discs, but they're only useful if you can make it through a maze of configuration menus, command line options, choices about bit rates and codecs, and the occasional confusing message about a missing library.
I've tried out a good number of DVD ripping and conversion programs, and I've made peace with one method, and one program, that gets the job done more often than not. It's not exactly one-click, but once your system is set up, you can drop in DVDs and back them up or convert them with relative ease.
Note on system differences: I set up my ripping/burning system on a Lenovo Thinkpad T61 running a brand-new installation of Ubuntu 7.10 (Gutsy Gibbon). As with so many things Linux, packages and commands may vary based on your system. But for the most part, the tools I use in this walkthrough work across distributions and on both major desktop environments, GNOME and KDE.
Make your system media-friendly
The key ingredient to ripping in Linux is enabling your system to read encrypted DVDs—the kind you buy and rent. Since Linux lacks (to my knowledge) a licensed DVD player, we'll be using the libdvdcss2 package to get access. You might find the libdvdcss2 package in your distro's repositories, but you'll definitely find it at the VideoLAN web site, and Ubuntu users can install it from the Medibuntu site.If you're going to be shrinking your DVDs down to portable media formats like DivX or MPEG-4, you need the corresponding codecs installed. For Ubuntu users, that means heading to Applications->Add/Remove, typing in gstreamer and installing all the packages that come up, along with installing the w32codecs package from the Medibuntu source above. In other distros, try searching your installation programs for terms like "codec," "divx," "restricted," and other relevant phrases.
The program I'll be using to shrink dual-layer DVDs down to burn-able size is K9Copy, available in many repositories. It's straight-forward, it doesn't ask 47 questions about your bitrate preferences, and it works mostly on its own. Although it's KDE based, it runs in GNOME environments without too many required libraries.
Finally, here are the programs I recommend for playing and burning video files and ISOs. Use what you know best, but I've had the best success with these selections:
- VLC Media Player: Just like on Windows and Mac, the Linux version of this all-in-one wonder plays nearly anything resembling video or audio. You could use it to play back entire DVD backup folders, as Adam prefers, or even play the DVD image itself.
- DeVeDe and ManDVD: For creating burnable DVD images from video files. DeVeDe can handle fancier conversions, but ManDVD lets you create some pretty slick-looking front-end menus.
- K3b or GnomeBaker: These burning programs for KDE and GNOME seem to just work, and often catch errors before burning rather than create coasters, in my experience.
Getting started

Select the "DVD" category on the left of the menu that pops up, then change the "Output directory" to a convenient location. This is where the "AUDIO_TS" and "VIDEO_TS" folders that make up a DVD will go before an ISO is made. I had trouble getting the folders to go into a Windows-formatted storage partition on my Ubuntu system, and while I think KDE-based users might have more success, plan on having at least 9 GB free on your actual Ext3 (or Linux-formatted) drive or partition. You can change the "DVD size" setting here if you have trouble burning to disc, but the default 4400 MB is what most single-layer DVD-Rs can hold.
Now select the MPEG-4 category, unless you don't plan on compressing DVDs down to video files. I've found success choosing the XviD codec, selecting the "2 pass" option and changing the codec under the "Audio" tab to AC3, but video geeks will know what to do here. You can also easily opt for better quality rips and larger files by adjusting the "File size" option in the "Video" tab or splitting the rips onto two or more CD-Rs. Note that these are just the default settings; you can rip to another format, like the iPod-friendly MPEG-4 using the "MPEG4 Encoding Options" tab at the main window's bottom edge.
Hit "OK," and now it's time to choose what we want to retain from the DVD. If you want to copy everything—including menus, featurettes and all the language and subtitle tracks—select the "DVD Playback Options" menu from the right-hand edge and check the "Keep original menus" button at the bottom. Otherwise, you can go title by title through the DVD, deciding which audio, video and subtitle tracks to drop for better picture quality. If you're unsure what to pick, hit the camera button at the top left to preview the video and change the subtitle and audio options to see what's best.
Let 'er rip

Posted by
sumesh
at
6:44 PM
|
Labels: Lifehacker, Lnux Tip
Friday, December 7, 2007
Paypal hacking
It won't work on products because it sends the seller an email along the lines of "you have received $0.01 from (your paypal name) for (the product)" However this works great on automated software scripts where it detects that you gave a payment and emails you a link to download the software.
IT'S BACK FROM THE GRAVE, REPUBLISHED!

Download it here: link to download tamper data


In Firefox menu go to tools then Tamper Data.
Once the window shown below pops up press Start Tamper

The Tamper with request window will pop up. Click the Tamper button.

Find the parameter called amount and change the value to 0.01 because that is the lowest amount PayPal will process. Next mess with the parameter called no_shipping, if it is even there, until your shipping comes out free. When you are done click the OK button at the bottom of the window.


Thursday, December 6, 2007
Movies On Your Treo - Easy Method #1
Ingredients
Needed:
- FairUse Wizard 2
- TCPMP
- A DVD drive on your PC
- A Computer running Microsoft XP
Recommended:
- SD Card Reader or
- Softick CardExport
The two "needed" programs allow you to convert your DVDs into a format that can be viewed on your Treo. Both are freeware. (The sites accept donations, and we encourage you to support the developers.) You will not need any other software (decrypters) to do the job. There is a good chance that this method will work as well for Windows Mobile devices as for Palm OS devices. This tutorial is based on my experience with a Treo 650 & 700p, and I encourage anyone with a WM5 device to comment.
The only equipment you should have is an SD card reader. It makes transfer of larger files much easier, and I have heard that hotsyncing large files to your device with the Palm install tool does not work well.
Instructions
The first thing I like to do when starting a video encryption is to set up everything. I put a folder labeled "Treo Movies” in the "My Documents" folder on my computer's desktop.

By doing this first, I know where I am going to place all projects and where to find all finished work. Then I put a folder on my SD card where I am going to transfer the movies once they have been converted. I call it “Movies”.

As with any computer or Palm project, proper preparation makes the whole thing go smoother.
Now, install everything: FairUse Wizard 2 to your PC, TCPMP to your Treo, and Softick CardExport if you choose to use it. Last time I checked, it was loathe to work with Fat32 (4ghz cards) so if you have a 700P or a ROMmed 650 you may want to use a card reader. I do, as Softick didn't want to play with any of my 4 gig cards.
Starting Encryption
Place the DVD you want to convert into your computer's DVD drive. If any programs are open, close them. Next, open Fairuse Wizard. Fairuse Wizard's opening screen will come up.

Notice "start new project" is already selected:
Next select where the finished movie will go. Select the "Treo Movies" folder in "My Documents" if you've set it up as I recommended.
Select "Next". There may be a point in the process where you are notified that the disc is encrypted. The program will still do the work. Please make sure you own the disc. There are penalties for pirating, and also for sharing completed projects.

You will be given a screen to select the DVD writer you are using for the project. Select the driver that has the DVD you wish to convert. Then select OK.

You will be given choices of the files that the DVD has on board but FairUse Wizard will automatically select the correct file. It is noticeable because (in a single movie) it is the largest file, recognizable by the size in megabytes already highlighted.

Notice that “Hide Chains” and “Cache the selected program chains (multisession)" have already been selected for you. If you wish to do a TV series with multiple episodes on disc, you will have to realize that the first episode will be highlighted. Once encryption of the first episode is done, you will have to restart FairUse Wizard and then select the second episode manually (noticeable by its matching large file size but lower file position). Continue until all episodes have finished.
Now it starts:

FairUse begins its work.
There will be one more pause where you will have to do something before it goes autopilot. For a Harry Potter video the stoppage will look like this:

All you have to do is select next. It will bring up some choices: On this next screen you should select IVTC. If you don't, the computer will do it for you.

Once this is done, You will be introduced to a screen that asks you to choose the output file size. Kill me, but I like big Audio, Video. Give me 400meg for movies for reduced pixelation with blacks and great audio. Down to 250 meg has been pointed out to me as being workable. Here is a screenshot of me goin' BIG!!

As far as Resolution goes, I think the program selects the proper amount without interference. Experiment and see what you like but the setting chosen has always worked for me.

Auto Pilot from here on out. The program will finish without you having to do anything.
First Video Encryption:

Then the Audio encryption:


Finally the finished product:

Once the video encryption process is finished there will be large leftover files in your "Palm Movies" folder along with the finished movie. At this point I usually go back in to my "Palm Movies" folder on my desktop and clean up the mess. You want to delete all the files with the exception of the completed movie. Your completed movie can be recognized by its file size (a little over 400meg for this tutorial) and the way it looks (a circle in the Windows colors scheme with a "play" icon). Cleaning up makes movies easy to find and keeps your hard drive from becoming cluttered.

After cleanup is done and the movie has been converted to a file compatible with TCPMP you must choose the way you want to load the movie file. The way I do it is drag and drop it to my SD card using the reader
It is now time to play it! Open TCPMP on your device. Use your menu button to open TCPMP's menu screen. Select "Open Files"

Go to the file that has your movies (in this case "Movies"):

Select the movie you wish to view (in this case "Shogun Assassin" and a check will appear in the box and the selection will be highlighted in yellow). Select OK.

The movie will come up. Select "Play" to watch.

To fine tune viewing you have options. If you need more volume, select "Prefs". Select "Audio" and then use the "Volume" slider bar to make small adjustments in volume.

To make large adjustments in volume select the "Preamp" slider. This will help if the volume needs major increases. A combination of the two will help fine tune the movie volume to your specific need.

On this demo I specifically chose a Letterbox (Widescreen) movie to demonstrate. When converting movies there is usually a border at the top and bottom. If you convert a Full Screen movie, it usually plays fine once volume is adjusted. With a Widescreen conversion, the movie can appear very small. For some this is fine. For others, you may wish to make the movie appear larger. There is a way to fix this. Go back and select "Prefs". Select "Video"

Notice the screen defaults to "Fit Best". It gives you this picture using my example:

If I change the setting to "Fill Screen"..

I get this. Better.

There is a small amount of left and right picture lost but no real loss of image quality. It also renders the movie more easily viewable.
Posted by
sumesh
at
11:50 AM
|