Older blog entries for cdfrey (starting at number 18)

Barry version 0.0.1 released
    If you have a BlackBerry, and wish to retrieve data from it on your Linux system, consider paying a visit to the Barry Project page and giving the latest release whirl.

    This is of course a very early alpha release, but so far it has the capability to download calendar items, email messages (dates not supported yet), and address book entries. It attempts to convert the address book entries into LDAP LDIF format, and the email into mbox format.

    You can also use the command line tool to capture protocol data during database retrieval, in case you wish to lend a hand in the reverse-engineering process.

    The library and tool are written in C++. The ultimate goal of this project is to create a fully functional syncing mechanism on Linux. My goal is to have the API easily available in Python, perhaps via SWIG, so GUI folks can use it to integrate with their application of choice; but I haven't gotten that far. People with C++-to-Python experience are extremely welcome right now, even to just give advice on some of the pitfalls to avoid on the C++ side, so when the Python integration time comes, it will be as painless as possible.

    I hope to see you on the mailing list if you are interested in this project.

One of the projects currently on the front burner for me is a library and application set for syncing the USB model of the RIM Blackberry handheld on Linux. Net Direct is the company behind this project, with full plans to open source it when it's ready. I may put it on SourceForge early if there is interest, but there's not a lot of code to hack on yet.

The first major task, of course, is to figure out the binary protocol that these devices use. I know about the documentation for the serial protocol at the Cassis project, but unfortunately, the USB protocol isn't the same.

There are rumours that the USB protocol may have been reverse engineered already, but my Google searches come up empty. If anyone knows of such a document, please email me. It would bring this project to fruition much faster.

While I'm on the topic, let me plug two fine USB tools:

  • usbsnoop - a Windows filter with source code that intercepts the USB conversation between application and device.

  • libusb - an LGPL cross-platform library that lets you work with the low level USB interface in userspace, without developing a kernel driver first.

To all the folks that replied to my previous diary entry, thanks! I apologise for being so busy I couldn't respond in depth as I wanted to.

Thanks to all the folks that bumped me up to Apprentice, which lets me comment on articles. Much appreciated.

ncm:

    Monotone

    What made you pick Monotone? I haven't yet made the time to evaluate all the distributed source control systems yet to find which one I like best, so I'm always eager to hear other people's reasons for their choices.

    The ever present C++ debate

    What worries me about the indulgence of template based generic programming over OO inheritance and virtual functions is that with templates, you are duplicating code for each type you wish to code for. This doesn't happen with OO, albeit with a slight performance hit of virtual functions.

    This code duplication caused by templates is fine for code that you'd normally write anyway. For example, for_each instead of for loops, or any similar small piece of code.

    But the larger your template functions become, the more each instance costs every time you use it.

    Take the mozilla string hierarchy currently in discussion. How would you use templates to provide the same string functionality without the code duplication of templates? Mozilla is plenty big enough as it is.

    Creating template versions of the mozilla string class, perhaps parameterized with the various functionality as template arguments, would cause each function that needed a general string argument to be a template as well, to accept whatever the user passed in. Am I missing something obvious here?

    I must be, because there are a lot of C++ gurus that keep saying inheritance is bad, but tend not to go into detail. :-)

Thanks for the site renewal, quad!

I finally got around to adding some features to the GNU split command, which I felt were sadly lacking ever since I thought of them. :-)

I often use split to break huge files into multi-CD images, such as for backups or archiving. At the same time, I often find I'm low on disk space, so I would like to process each split file chunk as they appear instead of doing it all at once at the end.

I wrote a patch that adds exec and pause functionality with the following arguments:

  -e, --exec=CMD          run CMD after each output file is closed
  -w, --exec-wait=CMD     run CMD after each output file is closed
                          and wait for the child to exit
  -p, --pause             pause for keypress after each output file is closed

I find these features very useful, so I hope they make it into the official coreutils tarball.

If anyone has any tips on how to handle recovering a tty-based STDIN (see the split source code), please let me know. I'm currently just open()ing the tty on STDOUT, but that is not ideal.

uriel:

I can relate to your complaint. I joined advogato for the same reason, except I wanted to comment on the FreeDCE article from a while back.

I appreciate that advogato is not your average blog site, and because of that, it is remarkably spam-lite. Still, it is frustrating when becoming a full fledged member requires bugging other people to certify you.

I suppose I should get back to hacking now too. :-)

Well, it would appear that I've been interrupted by telemarketer calls one too many times. I've decided to do something about it in my own little way.

I've started my own Telemarketer Boycott List. This is mainly for my own memory enhancement, so I can remember the parasites^H^H^Hcompanies that try to turn me into a customer, and thereby avoid them in any future business dealings.

I'm putting it on the web in the hopes that others can benefit from my list, and perhaps create lists of their own.

I'm under no delusions that this will make a great dent in the telemarketing industry, but it will grant me an amount of personal satisfaction.

Marcus: You lucky dude.
C++ and SQL

Spent most of today reading through the various websites for for C++ wrappers of SQL databases. The best ones, in my opinion, are the official ones: mysql++ and libpqxx. Unfortunately, these are both tied strictly to their specific databases and are not database independent.

Also in the mix are DBConnect and GQL. Both are rather pointer-happy, but at least DBConnect encourages use of it's own smart pointer to avoid copious use of delete. On the plus side, they are database-independent.

Only mysql++ has the SSQLS feature. What is that you ask? It is a mechanism whereby you can easily create structures that mirror your database tables, and then go around using them as members of container objects, and doing things like:

query.insert(row_data);

This makes the library code extremely hairy (so hairy that it motivated a fork of the code a few years ago), but gives the advantage of enabling the compiler to check your field names, localizing your C++-to-SQL linkage in one place, and letting the library take care of generating properly escaped SQL code.

So far, my research confirms that the free software community still lacks a proper database independent C++ SQL library that shields the programmer as much as possible from quoting issues. As always, please email me if you know better.

Cool Program of the Day

Unpaste is a program by Jeroen Vermeulen that attempts to find repeated code in your C, C++, and Java programs. It is a work in progress, but already useful. It scans all the files you give it, and detects duplication even with name changes or differences in const.

Humour

Sometimes reading code can be funny (see the bottom of this file).

27 May 2005 (updated 27 May 2005 at 01:06 UTC) »
Snippets

boog, your Snippets project is cool, but it's not a new idea. It reminds me of a similar project with the same name which I ran across back in the days I used to be a regular FidoNet user. It was run by a fellow named Bob Stout. Here is his original Snippets archive.

The license of each of the contributions varies with the contributor, but they are all freely available for use last time I checked.

You might consider joining forces with Bob Stout and combining your efforts to produce one large repository (perhaps mirrored on both sites). Not sure if you tried this already, but it would appear that the original Snippets site could use a little help.

Fun

While perusing the site, I found a link to The Parable Of Two Programmers. Excellent read.

C++ and the Web

After writing a dynamic website for a client in PHP, I was struck by the lack of help that the language and interpreted nature of PHP gives a programmer for dealing with large sites. Also, I'm amazed at how many XSS and SQL injection attacks I see for PHP websites posted on Bugtraq. It reminds me of the arguments against C I used hear from anti-C people, who used to blame buffer overflows on the language. At the time, I thought it wasn't right to blame the language when it was the programmer's fault, but now I'm on the other side of the fence, taking a step backward (in my opinion) from the safety of C++ to the wild west of PHP.

And the problems with C pointed out in the past by security-conscious language bigots :-) are all "fixed" in PHP. There are no buffer overflows. There are no memory leaks. There are no real number size issues.

Instead, I'm now on the bigot side, and really missing strict type checks, and really missing a compiler to check all syntax. Wondering how people manage with this.

So I got to thinking, and I'm trying to design a PHP clone in C++. I'm writing about it now so that people can head me off at the pass if something like this already exists. My goals are to make it nearly impossible, or at least harder, for a programmer to put XSS or SQL injection bugs into their websites. Make the compiler check for these things. That's what C++ is for anyway.

Perhaps C++ can give the same structure and organization to a website that it gives to a large local application.

Some of these ideas were inspired by Joel Spolsky's article referenced by ncm's recent post, which referenced titus's recent post. I agree with Nathan, but Joel's article did get me thinking. His type method should fit nicely into C++, where everything is a type, and instead of the programmer doing the checking by reading "wrong" code, the compiler will do it, and enforce it.

So that's my idea, which I plan to call CPPHP. I hope to have some code someday soon that actually works. Right now I'm just prototyping my design. If this already exists somewhere, or if you just want to send feedback, please email me.

Edited to add:

I just want to plug John Torjo's win32gui library, which has some ambitious aims for programming GUI's with C++. If that could be done for the web, that would a wonderful advance.

9 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!