I have recently received quite a few inquiries of developers asking me where the latest version of the Conduit Developer Kit can be downloaded, as it seems to have disappeared from Access’s web site.

The CDK is needed by developers wanting to create so-called Conduits. A Conduit is a program that ties into the hotsync process and synchronizes data between the handheld and the PC – a popular example is the desktop part of DataViz’s DocumentsToGo.

A bit of googling has led me to the following URL – it contains version 4.02 of the SDK:
http://downloads.zdnet.com/abstract.aspx?docid=184535

I recently ran into an issue while adding bitmaps to a new Tamoggemon app. I created the bitmap resources in Resource Editor, and then edited the bitmap files with GIMP 2.4.

This resulted in total mayhem: the colors of the bitmaps appeared heavily distorted and were completely unusable. After a few hours of tinkering, I found out that the problem is due to the Palm OS tools needing a very special and pretty obscure bitmap format.

Even though converters are available, most of them aren’t cheap – thus, I set out to find another way. Follow the steps below and you’ll have perfect bitmaps in a jiffy:

Export the xrd file as a (temporary) 24bit BMP file onto your desktop. Do NOT allow GIMP to write into the file hyperlinked from the resource HTML file.

Then, open the resource HTML file in the resource editor. Open the bitmap that you wish to “edit”, and click Import. Pick the temporary file created before and “import” the data. Voila – it works. You can now delete the temporary bitmap…

The reason why I ****** up was that I used GIMP to directly edit the bitmaps as referenced by the resource HTML file. Once again – do NOT edit the bitmaps in the /rsc folders with anything except the PalmSource XRD editor!

Yours truly recently had a VERY weird issue concerning system prefs. The structure given below worked well while in main memory, but saving/restoring it via the Preference API led to total fuxation of all values below the logging struct:

typedef struct{
UInt16 autoOff:1;
UInt16 timestamp: 2;
UInt16 flashscreen: 1;
UInt16 autoConnect: 1;
UInt16 pingpong: 3;
UInt16 bell: 1;
UInt16 wrap: 1;
UInt16 reserved: 6;

FontID font;
} OptionsType;

//LEAVE the __attribute__((packed)) in place - the prefs comnpile without it,
//but CHANGE WHEN BEEING SAVED AND THEREBY CREATE A LOGIC BOMB

typedef struct
{
char server[52]; // 50+1 Not sure on this one
char nick[20]; // 16+1
char realname[31];
}default_struct;

typedef struct
{
Boolean enabled;
Boolean logPvt;
Boolean filePerChannel;
char volname[40];
char parent[256];
}logging_struct;

typedef struct
{
Boolean alertnetdrop;
Boolean lowbatshutdown;
}bgm_struct;

typedef struct{
UInt16 appNetRefNum;
NetSocketRef socketRef;
NetIPAddr addr;
UInt16 port;

UInt32 bugged_last;

//These prefs are used by the network routines themselves
//and will one day replace the global variables
char server[51]; // 50+1 Not sure on this one
char channel[31]; // 30+1
char nick[17]; // 16+1
char pass[17]; // 16+1
OptionsType display;
bgm_struct background;
//These are UI ONLY variables and are NOT intended for any other use
//except as defaults for new ServMgmt entries => padding is 4by
default_struct defaults;
logging_struct logging;

Int32 sample;
} myIRCPreferenceType;

The reason for this issue has to do with weird padding issues – GCC adds extra bytes that do nothing, but are needed for some reason or another.

However, GCC supports a special command that disables the padding algorithm temporarily for a structure of choice. Adding these to offending structure definitions fixed the problem:


typedef struct
{
char server[52]; // 50+1 Not sure on this one
char nick[20]; // 16+1
char realname[31];
}default_struct __attribute__((packed));

I am at a loss at why this works – but the program now works flawlessly.

Does anyone of you have any ideas as to what’s happening here?

When your PC crashes, PODS may show you an alert containing the text “Workspace in use, choose a different one”. This is very annoying, as PODS refuses to start under such circumstances.

Luckily, fixing the problem is easy. Navigate to the path shown in the dialog, and go into the .metadata folder. Delete the .lock file there – and voila, PODS will work again(after a system reboot)!

A blogger titling himself “Charles the MCP” has posted what appears to be a tutorial for running Palm OS Developer Suite under Vista:
http://charlesmcp.blog.com/1552399/

Essentially, it all comes down to replacing the make.exe that ships with PODS with an improved one available from the internet. This then enables compilation of applications…

Charles the MCP also contains loads of other stuff on Windows Vista – anyone interested in taking the plunge should definitely keep an eye on him:

http://charlesmcp.blog.com/

Users of non-english versions of Windows were left out from the joys of debugging with the Palm OS Developer Suite due to the program searching for the “LISTENING” string of a netstat output in order to find the Palm OS Simulator.

Then, German users figured out a way to make debugging work: install an English netstat.exe. But this isn’t as easy as it sounds – finding one can be very, very difficult. In the end, an instruction sequence for “patching” a German netstat.exe was devised…it simply edited the string resources in the file to make it print LISTENING instead of its merman equivalent, ABHÖREN. However, this instruction is in German too…

The final solution is here… . Download my pre-patched Netstat.exe from, here and place it in the root directory of your PODS install(just below/PalmSource/PODS/). After that, you’re set to go…

I tested this on a workstation running PODS 1.2 and a German version of Windows XP SP2 – and debugging worked really, really well…

Fixing the indentation of bigger blocks of code by hand is a big chore – thus, many intelligent editors(e.g. SrcEdit) have had automatic indentation support for quite some time. PODS can do this, too – the secret is a set of key combinations.

Press Ctrl+I to indent a selected bit of code by one tap(aka add one tab space on the beginning of each line). Press Ctrl+Shift+I to remove one tab character(or a bunch of spaces) from the front of each of the selected lines.

I have tested this with PODS 1.2 and had no problems…could come in handy some day…

Welcome to part 2 of the TamsPalm pnoJpegLib tutorial – in case you missed part 1, it is right here!

Step 3: include JPEG resources
pilrc users can include JPEG resources via the data keyword – for us PODS users, this is a bit more difficult. First, create a subdirectory in the /rsc folder of your project. Then, open AppResources.xrd and add a resource. Uncheck the Show only common resources checkbox, and create a resource of any of the ” types. A window will pop up – you can enter a custom creator ID and the target file there(via Windows Open File dialog – choose All Files and click the JPEG file).

The PODS will then bind the file(it must be smaller than 64k) into the PRC at compile time!

For all resource HTML junkies, here is a sample of the resulting code. The HTML delimeters were replaced with () to make the post compatible with WordPress:

(RAW_RESOURCE RESOURCE_ID="1010")
(RES_TYPE) 'tmgn' (/RES_TYPE)
(DATA_FILE) "./jpegs/lvl10.jpg" (/DATA_FILE)
(/RAW_RESOURCE)

Step 4: move JPEG data to a PalmOS bitmap
Now that the raw JPEG data is waiting in a resource, its time to decompress it. This code shows how to do it – the work happens in the read call:

//Prepare JPG lib
BitmapPtr jpgData=NULL;
BitmapPtrV3 jpgV3;
if(jpgenable)
{
pnoJpeg2LoadFromHandle(jpgrefnum,jpgp,h);
pnoJpeg2SetGrayscale(jpgrefnum,jpgp,false);
pnoJpeg2SetScaleFactor(jpgrefnum,jpgp,1);
pnoJpeg2Read(jpgrefnum,jpgp,&jpgData);
pnoJpeg2Bmp2DoubleDensity(jpgrefnum,jpgData,&jpgV3); //For HiRes only

}

h is a handle to a resource which can easily be obtained with DmGetResource – don’t forget to free it after use. The Bmp2DoubleDensity code is needed only on HiRes handhelds – leaving it out/drawing the jpegData bitmap creates weird results. The pointer can then be reused with a different resource or can be left in memory for reuse when you need to decompress the image once again.

On my Treo 680, decompressing a small 320×320 image takes next to no time – excessive buffering probably wont pay out here. Also, your monitor’s display is no assessment of quality for setting the correct compression factor – use your handheld’s screen and an application like RescoViewer.

Step 5: draw the bitmap
Now, we’re basically done. You have your (V3) bitmap – so do what you want with it!

The steps outlined above took me quite some time to figure out – feel free to benefit from my experiences! If you have any comments, just post them here. Commenting on TamsPalm is free and anonymous!

Decompressing JPEG images on Palm OS handhelds is easy if you are a user – just get RescoViewer. Developers who want to benefit from JPEG compression(great for backgrounds in games,…) on the other hand need to fight pnoJpegLib. I now have a program working – here’s what I did:

Step 1: make pnoJpegLib compile
After downloading the library from its homepage and including it into your PODS project(move both into the projects path and refresh the project by right-clicking onto the file tree list and clicking refresh), include the header file into all files that need to access the pnoJpegLib. I use the code below, the library resides in a subdirectory:

#include "pnojpeglib/pnoJpeg.h"

Then, open pnoJpeg.c and pnoJpeg.h and remove the inline statements to make the function definitions look like this:

Err pnoJpeg_OpenLibrary(UInt16 *refNumP)

After that, the project should compile. In case it still doesn’t, my files will be at the bottom of the second part of this article!

Step 2: prepare pnoJpegLib
Now, in the app opening code, include the following:

if((err=pnoJpeg_OpenLibrary(&jpgrefnum))!=errNone)
{//die
FrmCustomAlert(AltNotification,"JPEG library not found. Please install it from the distribution file!n","Background images disbled!","");
jpgenable=false;
return;
}
//Create JPEG ref
jpgenable=true;
pnoJpeg2Create(jpgrefnum,&jpgp);

jpgenable is a Boolean value that lets you determine if the library is installed onto the Palm OS device where your app currently runs. jpgrefnum is a global UInt16, and jpgp is a global pnoJpeg2Ptr.
!!!There is NO NEED to allocate memory – the library handles this on its own. All you need to do is define the pointer!!!

Closing the library is easy, too – use the code below:

if(jpgenable)
{
pnoJpeg2Free(jpgrefnum,&jpgp);
pnoJpeg_CloseLibrary(jpgrefnum);
}

pnoJpeg2Free must be used once for each pointer you define. You can have multiple pointers in your app. Such a “pointer” essentially stores source and conversion information about a jpeg image and can be passed to the reader in order to generate bitmap data!

Congratulations – we now have pnoJpegLibrary ready to convert images. The second part of this article will look at adding jpeg files to your project and drawing them…tune in soon!

Palm OS has a nasty little “habit” of forcing code resources to have a defined maximum size – if that size gets exceeded, the code needs to be “swapped out” into another resource(called segmenting). Creating such multi-segment applications in projects that have Managed Make enabled is difficult – but a reader sent me this tutorial some time ago(which works really well):

In case you need it, here is a copy of my notes on going multisegmented
(including some quoted comments from other list subscribers and things
I found on the net — thanks guys, and sorry I didn’t include credits).
My comments are in square brackets.

================== Multisection/Multisegmented Applications =======

1 – Create a “Managed Make 68 C/C++ Project” (only managed project works
with me)
2 – Create a file named “Sections.def” in the root of your project
3 – In the top of “AppMain.c” or equivalent, include the file “Section.h”
4 – Now, edit the file “Sections.def” and “Sections.h” to define what
sections your project will have.

Sample: “Sections.def”
=======================
application { “_temp_” TEMP }
multiple code { “code1″ “code2″ }
=======================
[You must have at least one segment in the 'multiple code' definition.
The names must match those in Sections.h. Try to minimize the number
of sections you define and use, while making sure none of them grow
too big. In place of "_temp_", use your application's name. In place
of "TEMP", use your Creator ID.]

Sample: “Sections.h”
=======================
#ifndef _SECTIONS_H
#define _SECTIONS_H
#define EXTRA_SECTION_ONE __attribute__ ((section
(“code1″)))
#define EXTRA_SECTION_TWO __attribute__ ((section
(“code2″)))
#endif
=======================
[The names (here code1 and code2) can be whatever you want, but must
match those in Sections.def. You can use whatever you want as the
symbol defined. Here, it's EXTRA_SECTION_*, but could be anything.
You will use it again in #5, just below.]

5 – On the function definition specify what section will be used, the non
specified functions will be redirect to default section code.
[Try to group functions together to minimize the jumps between sections.
Be careful not to miss any, because they will default to your first
section, and possibly make it too big.]
Sample:
=======================
// [Here's where the compiler learns where to put the function:]
static void myfunc() EXTRA_SECTION_ONE;
// [Remember to add the macro every time you add a new function to your
// application!]

static void myfunc() {
// `the code`
}
=======================
If your project have a section defined and don’t use it anywhere, you got a
error. So, you need use the sections defined one time at least, or don’t
define it.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

For a managed project, in your project properties, you need to go to the
build panel and choose the prc-tools-68k-compiler->Symbols section and
add a line:

MULTISECTION_BUILD=true

to make the managed project look for your .def file. If you do everything else
in the prior posting it should then work. (The stock Sections.h file said to use
MULTIPLE_CODE_SECTIONS, but that didn’t work. I found the definition above
by looking at the generated objects.mk file.)
[I tried this and it worked; I didn't try MULTIPLE_CODE_SECTIONS - JT]

NB It also seems to require that some function be in each section or it will
complain about the section not existing at link time.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[Also, it might help after adding the files to the project, right click
on the project's name in the Navigation window and select Refresh,
before building the project.]

Jay Ts

Thank you very much for sending this in(a few months ago…whew, some things take a LOOONG time). All I can add is that you should clean the project whenever you get ld issues at compile time – there seems to be some kind of weird segmenting cache somewhere in PODS!

I develop my Palm OS applications on two machines – a desktop and a notebook computer. Source codes get exchanged via a CVS server – so far, this has always worked well.

However, I recently enabled Multisegment support for one of my apps on the desktop side – and after committing and moving to the laptop, ld bickered about missing segment information. This was caused by the PODS’s local cache containing a few files on segmenting support – they did not update after the commit.

The solution to this is in the Project menu – just click Clean and enjoy a painless rebuild!

Jeff Atwoods of CodingHorror recently wrote about IDE color schemes. He looked at black background-white text schemes – and IMHO forgot one of the biggest problems: reflections.

Both CRT monitors(I love my Siemens tube…its my central heating) and consumer notebooks(Acer Aspire 5622 WLMI) have reflective screens – and the blacker the background becomes, the more reflections you see.

Here are a few comparison shots(at the same ambient and screen brightness levels):
whitebgt Why I want a white screen background backbgt Why I want a white screen background

How is your UI set up?

In our current ALP discussion, David Beers just posted the following, extremely interesting bit of info:

And lest I forget to mention: PalmSource promises to continue supporting PODS which, of course, is a Windows IDE.

Now if that isnt good news..

Technorati tags:


As you may have noticed, I am currently working on Binary Clock 3.0 for Palm OS. The WristPDA suport basically is there, but there still is this one little annoying fatal alert that I can’t reproduce, don’t know where it hides and generally can’t do much against.

Anyways, since I have my silent Acer notebook, running Gremlins over night is finally possible without getting my family in a “Kill him” mood. For all of you new to the term, gremlins are the automatical testing tool in the Palm OS emulator/simulator. What they do is simple – they fire random clicks, taps, drags and characters at your application until it breaks.

Sounds good…but totally sucks for Binary Clock for a variety of reasons:
They tend to hang around Global Find all the time
Don’t ask me why, but 50% of the time I see the gremlins taping around global find entering crap text. Basically, they waste my poor Centrino Duo’s cycles testing the Palm OS…as if PalmSource couldn’t afford an Acer Aspire :-) .

They seem to restart the application way to often
Same thing as above. Binary Clock gets restarted all the time, and thus the gremlins keep hanging around the hint form. Great!

They dont seem to exercise the functions “hidden behind menus” very much
Dont ask me why this happens…but 10000 gremlins didnt manage to change the Binary Clock color…

Please don’t take this as “gremlins are bad” – but gremlins or any other “screen mass tappers” are IMHO not useful as sole testing tool. They may find the one or the other bug, but can not replace the human testing crew doing a few “hammer tests”… . What do you think?

© 2013 TamsPalm - the Palm OS / web OS Blog Suffusion theme by Sayontan Sinha