New versions pending

June 2nd, 2005

Just to let you know I haven’t forgotten [well actually I had forgotten, until those accursed reminder dialogs started popping up] and will be posting new versions of JujuEdit, BookReader and eLibrary in the next couple of weeks.

Mid-June is my approximate deadline for these. If for some reason I fail to meet this I will make available previous versions with the expiry dates disabled.

Initializing a struct

May 15th, 2005

Just saw something in some of Raymond Chen’s sample code that made me go "Wha…?!?" in a good way. It’s a line where he initializes a classic Windows struct, MONITORINFO, which like a lot of windows structs starts with a cbSize value [to hold the structures byte size— used as a kind of version/error check].

Normally in such instances I would write [with a sigh]:

MONITORINFO mi;
ZeroMemory(&mi, sizeof(mi));
mi.cbSize = sizeof(mi);

Whereas I noticed that Raymond wrote:

MONITORINFO mi = { sizeof(mi) };

which achieves exactly the same effect incredibly neatly! I can’t believe I was unaware of this technique [specifically the fact that even though only the first value is specified, the entire struct in initialized to zero]. Brilliant! And you don’t even have to know the name of the stupid cbSize member!

BTW: I know I’m not the only one who uses [until now] the tedious long form— If you are a C/C++ person I hope this tidbit can save you valuable seconds as well. And if you are a legend who already uses the short form, please don’t think less of me for not seeing it myself… ;)

JujuEdit: Status

April 20th, 2005

Since this blog is supposed to be about my software, I thought maybe I should post some info about development status.

Done [for next release]

  1. fixed UTF-8 auto detection problem - was stuffing up with consecutive characters
  2. enabled find in read-only mode
  3. fixed ctrl-tab switching to be more consistent
  4. fixed minor issue when opening from a shortcut
  5. fixed problem with launching from a command line [was causing problems for disk space check]
  6. improved file history, sharing list across all open windows
  7. got rid of auto extension adding to non-recognized file types
  8. fixed find-again issue with end of file not being updated after text changes
  9. added window list and window close all
  10. added hot key for open new window in all file open modes [hold down shift]
  11. added FTP support with smart options for password handling [too easy to screw up though, see below]
  12. fixed: using line end symbol $ in regexps doesn’t detect \r\n in CRLF mode [only \n]
  13. fixed: line selection & syntax hilighting wraps back to end of previous line when formatting characters are visible [cosmetic]
  14. scroll thumb is proportional for small documents [allow line based mode for files smaller than X, byte position otherwise]
  15. supports legacy copy/paste/cut keys
  16. Supports OLE drag/drop, which was an utter pain to implement, so I hope someone actually uses it [i never use drag and drop between applications]
  17. Got rid of unsightly temporary font size change when printing
  18. Improved navigation speed for stupidly large files [and files with stupidly long lines]
  19. search/replace updates text in the status bar
  20. added count to find dialog
  21. Simplified Read Only file handling, bringing it into line with convention
  22. Fixed crashing when viewing certain binary files in text mode [uncommon, and file specific]
  23. fixed annoying problem with null terminated files being loaded as binary

To Do [some of which may make it into next release]

  1. force fixed font in binary viewing mode— proportional looks stupid
  2. google/web/dictionary search from selection?
  3. auto refresh seems to sometimes reload files without good reason
  4. file history needs to avoid binary and other uncommon files, and perhaps even files quick loaded via the alt-pg method
  5. FTP mode needs to create a local copy as well [so as to avoid overwriting issues]
  6. user definable syntax colors
  7. user definable accelerator keys
  8. user definable options [property sheets!] eg: defaults, codepages, encodings etc
  9. wrap by characters [user configurable, eg 80 character]
  10. middle mouse button pan-style scrolling
  11. persistent undo? tests ok, we’ll see…
  12. using alt-page-up and -down to scan similar filetypes floods the recent file list inappropriately
  13. more comprehensive syntax hilighting / profiles… maybe try creating a smarter PHP config which can correctly parse/hilight both HTML and PHP in the same file?
  14. Improve robustness of bookmarks, which tend to get jiggled about too much by editing [may be fixed already??? — needs further testing!]
  15. unicode fields for find/replace

Comments & suggestions [+ extra bug reports] are welcome!

DST—Maybe It’s Not Just Me?

March 28th, 2005

Daylight Savings Time.

It seems that every time we pass in or out of this period, I have some kind of hassle. On previous occasions I would simply slap myself on the forehead, recompile and upload my website and move on, making a mental note to "watch out" for time zone issues in the future.

Not this time. This time I decided to find out why this keeps happening. And to my surprise, I think it may not be entirely my fault!

Stat!

Like a lot of software, my HTML editor checks file modification times to determine when pages need rebuilding. Unfortunately it seems that some incorrect documentation has led me to intepret the values returned by a certain low level system call incorrectly.

The documentation for the _stat(…) function implies that the returned st_mtime member contains a UTC time value, with the sample code using a ctime(…) call to convert it to a string representation, and ctime(…) is designed to take a UTC value as input.

From my own testing however [on an NTFS file system] it seems that st_mtime is pre-adjusted to the local timezone, meaning that passing it to ctime(…) will result in an incorrect time value, representing neither UTC or local time, because it will be performing the adjustment twice.

Returning such an adjusted value in st_mtime seems particularly inappropriate since the raw value will acually vary depending on the current time zone setting of the local machine as well as the Daylight Savings status! This seems to be the root cause of my files getting out of sync when DST changes occur.

I am now in the process of fixing my code so that I get UTC values instead of "adjusted" time when querying file properties… hopefully this will improve some of the issues I’ve been having.

BookReader & eLibrary & stuff

March 18th, 2005

Have been doing some serious code cleaning recently, fixing an age old link problem that had been preventing all of my software compiling with the multithreaded DLL versions of the C++ run-time libraries.

It was all down to a single stupid #pragma directive ticked away in a header file, which was actually excluding the required LIB file [although there was no obvious sign that this is why the lib was not linking properly — and I’d forgotten it was even possible to do that with #pragmas]. I think I added the directive years ago to avoid some MFC link error… clever me.

Now that I can finally link my software against the DLL runtime libraries, I can shave between 50 and 90K off the average executable size… but I probably won’t bother since it will be at the expense of a new DLL dependency. Still, it’s nice to get it sorted and at least have the option.

*

BookReader is in the process of getting UTF-8 support, which is a nice thing, and I’m testing a version of eLibrary which uses the aforementioned index files now available from Gutenberg.

*

JujuEdit… soon soon soon… I’ve got to get some new user configuration options in there; The damn thing doesn’t even have the standard Tools->Options property page, with everything still handled using sub menus with checkable items. Yuk.

JujuScript & Operator Conventions

March 14th, 2005

Have made available for download a "compiled" version of my JujuScript calculator, which got a bit of a fix-up with some recent JujuScript changes.

JujuScript is drifting further away from pure C/C++ syntax, and it’s kind of a relief because it was never 100% compatible anyway. It’s nice to not have to conform. Still there are areas I have to be careful about, such as operator precedence, where it would be kind of insane to break with C standards.

That said, I do think that C/C++ operator conventions* are annoying for the following reasons:

  1. There is no logical XOR operator, and the obvious choice for it [^^] means nothing. I can’t believe they didn’t add this for C++. Without it we must explicity cast the operands to boolean as in ((bool)a ^ (bool)b) .
  2. The bitwise AND, OR and XOR operators have higher precedence then their logical counterparts, but still fall below comparison operators. Comparison operators return boolean values, whereas bitwise operators are designed for integers. But the expression (a == b & c) compares a to b first [resulting in a binary value] and then does a bitwise AND with c … and doing a bitwise operation with a boolean is just stupid! To avoid this kind of confusion, I really think the bitwise operators should fall in precedence between arithmetic and comparison operators.

I guess the precedence issue probably had something to do with the evolution of C, and is not the sort of thing you can change without breaking a lot of people’s code, but the ^^ operator has never been used in C, so adding it for C++ would have affected no one.

The only reason I can think of for leaving out logical XOR is to discourage people from relying on implicit casts to bool [and in fact it’s possible that the only reason we even have logical AND and OR is for their short-circuiting behaviour].

Here are some other things I think are strange about C/C++…

__________

* Java uses the same conventions.

eLibrary & Project Gutenberg

March 11th, 2005

eLibrary is a project started a few years ago, which never worked all that great, in part because of the crappiness of Project Guteberg’s database; basically I had the program downloading one giant directory listing of raw filenames, and one [inconsistent, apparently hand edited] listing file, and attempting to correlate them in order to create a usable index of titles and filenames. Given the unfriendly source data, there was only so much I could do, and so many books were missing or incorrectly indexed, and in some cases whole slabs of text files got mis-labelled as "audio books". By the time that started happening I had kind of given up on ever getting it right; because of the supreme crappiness of this approach [which took much-o tweaking with hideous regular expressions] there wasn’t all that much I could do to fix it.

Not any more!

Finally Project Gutenberg offers a machine readable index file [possibly they always had one, but if they did it sure was well hidden]. So now eLibrary can get a revision which will enable it to take full advantage of the amazing power of XML and not screw up author and volume names! [ eg in the current version I note that "The Bible, King James" was written by "Book 1, Genesis" ].

There are still other problems with PG texts though, namely shitty formatting, but I can moan about that in another post.

Argh.

March 5th, 2005

Ok, so i know Wordpress is not necessarily bug free, but I really wish its XMLRPC was a little more robust.

Read the rest of this entry »

Introduction

March 5th, 2005

Jujublog used to be my personal weblog, but then because it was less and less about Jujusoft and more and more about me avoiding work, I decided to move it to intepid.com.

Now I am reviving the JujuBlog name with an eye to providing more software/business related info here. Whether or not that will pan out I’m not sure, as I’ve never tried keeping more than one blog before.

We shall see…

Old News

July 1st, 2003

  • July 1, 2003 - Updated beta versions of Reader, eLibrary and JujuEdit. Sign up as a beta tester now!- Posted extra self-exe books
  • March 11, 2003 -Posted a new article about anti-aliasing, with nice illustrations.
  • February 21, 2003 - Posted beta versions of Reader, eLibrary and JujuEdit.
  • February 20, 2003 - Posted extra self-exe books , with improved version of reader embedded.
  • February 8, 2003 - With virtually no fanfare, jujusoft.com marks its first anniversary.
  • January 1, 2003 - Removed beta test area of site, beta test versions will probably be publicly available in the future.
  • December 24, 2002 - Updated self-exe books, which were going to expire 1st January 2003. Will now function until 1st April 2003.
  • December 2, 2002 - New public version of JujuTool(1.04) now available.
  • November 14, 2002 - Posted self-exe book "The Wonderful Wizard of Oz ", now available from the download page
  • November 6, 2002 - Posted first public demo of Reader, with a single self extracting book available for download (requires no installation)
  • October 29, 2002 - Posted new Reader beta (0.93) (see beta testing)
  • October 29, 2002 - New public version of JujuTool(1.03) now available. October 08, 2002 - Versions of Reader and eLibrary are being made available for registered beta testers. If you would like to be one of these then go to this page
  • October 06, 2002 - New version of JujuToolis available.
  • September 24, 2002 - JujuToolis now available for download.
  • September 03, 2002 - Added page describing TEA algorithmused for encrypting text.
  • August 29, 2002 - Jujusoft is now hosted by ICDSoft, a very nice service provider with incredibly reasonable prices.