The READIN Family Album
Me and a frog (August 30, 2004)

READIN

Jeremy's journal

One never stops reading, though books come to an end, just as one never stops living, even though death is a certainty.

Roberto Bolaño


(This is a page from my archives)
Front page
Most recent posts about Programming Projects
More posts about Projects

Archives index
Subscribe to RSS

This page renders best in Firefox (or Safari, or Chrome)

Thursday, February 17th, 2005

🦋 User Interface feature

When you have a list box that gets items added to it on a continuing basis over the course of a program, it is nice for the list box to scroll downwards as items are added, so the most recent one is always visible. Except when the user is involved in reading some older items -- then this behavior is very annoying. Here is a solution, as implemented in an MFC application -- pretty easy to translate to C/C++* -- other languages, you're on your own:

int GetVisibleCount(CListBox &lb)
{
    CRect rct;
    lb.GetWindowRect(&rct);
    int iHgt = lb.GetItemHeight(0);
    return (rct.bottom - rct.top) / iHgt;
}

    // handler for a custom "Add Item" message
LRESULT CMyDlg::OnAddItem(WPARAM wp, LPARAM lp)
{
    const char *msg   = (const char *) lp;

    int iTop = m_lbRealtimeStatus.GetTopIndex();

    m_lbStatus.AddString(msg);
        // "static" because I am never resizing the 
        // lb -- if you are you will need to calc 
        // this every time.
    static visibleCount = GetVisibleCount(m_lbStatus);
		
    if (iTop == m_lbStatus.GetCount() - 1 - visibleCount)
        m_lbStatus.SetTopIndex(iTop + 1);
    return 0L;
}

So what I am doing is, every time I add an item, I check what the current topmost visible index of the list box is -- if it is not equal to the number of items in the list box less the number of visible items, then I do not scroll. (Note that this calculation doesn't work when there are fewer items in the list box than the max number that will fit on the screen; but that does not matter because there is no need to scroll anyways in that situation.)


* That is to say, C or C++ where you are not using MFC classes.

posted afternoon of February 17th, 2005: Respond
➳ More posts about Programming

Thursday, June 17th, 2004

Brad DeLong pointed me to a very nice site: Joel on Software is the musings of Joel Spolsky, founder of Fog Creek Software and a very insightful guy.

posted afternoon of June 17th, 2004: Respond
➳ More posts about Projects

Friday, March 12th, 2004

🦋 The Scales Fall from my Eyes

Yesterday one of my batch processes stopped working. I was a little baffled. The batch downloads some files from an ftp site, then expands them using pkunzip, then sends them to a program for processing. Pkunzip was telling me that I needed version 4.5 or later to expand the files -- never a problem in the past. I thought maybe the vendor had changed zip formats, which struck me as pretty bizarre. Everywhere on the web that I could find pkunzip, it was the same version as the one I was using (2.03g).

And then I thought to try opening the files in WinZip. That worked of course; and I was very happy to discover that a command-line add-in is now available, along with a new version of WinZip. So... problem solved! (And into the bargain, wzunzip is way faster than the pkunzip I was using.) But what was the problem? It hit me when I was reading the "What's New" page in the WinZip 9.0 help file:

In addition to supporting the original Zip file format, WinZip 9.0 also supports the 64-bit extensions to the Zip file format. The extended format lets you store all the data you need in Zip files of virtually unlimited size.

The original Zip file format limited the number of member files in a Zip file to 65,535, and the maximum size of both the Zip file itself and any member file to 4 gigabytes. For all practical purposes, the 64-bit extended format eliminates all these restrictions. Using the extended format, the member file size, Zip file size, and number of member files you can add to a Zip file are limited only by your system's resources.

So I checked and yep, the file size of the download is now a hair over 4G!

posted afternoon of March 12th, 2004: Respond
➳ More posts about The site

Monday, December 15th, 2003

🦋 Links that know when they are followed

It occurs to me that it might be nice to have links (to outside web sites) that knew when a reader clicked on them, in order to update statistics -- my idea is to sort my blogroll by how frequently each of the links is used. Here is an idea for how to do it: Currently the link is <a href="http://someurl">Link Text</a> -- but if the link were <a href="http://www.readin.com/blog/blog.asp?redirect='someurl'">Link Text</a>, then I could update my statistics and redirect. This might confuse some browsers' site history, causing the back button not to work properly; I'm pretty sure Explorer and Mozilla know what to do when confronted with such a situation but am not sure about earlier versions of Netscape. And I would want to have some Java code for mouseover, so that the browser's status bar would just display someurl when you hovered over the link.

Update: Weird, now (Tuesday) I see someone has browsed to my blog following a link of the type I am describing: my referrals log shows a visit from http://www.popdex.com/redir/?u=http://wampum.wabanaki.net/archives/000634.html. (The "u" redirect URL is the address of the Koufax Awards thread on Wampum.) Apparently someone followed a self-conscious link to the Koufax Awards, then followed the link on that page to my blog. And for some reason their browser remembered the self-conscious link as the referrer instead of the redirect.

posted afternoon of December 15th, 2003: Respond

Thursday, May first, 2003

🦋 Site maintenance

I've got things pretty well back into shape. The links were all lost so I will have to rebuild them by hand, not too hard to do but a pain anyway.

posted afternoon of May first, 2003: Respond

🦋 Site maintenance

Well I came up with a cool idea for how the site data should be physically organized -- a script to put that organization into effect -- ran it and bang, it deleted all my posts! So I'm trying to get them back, meanwhile the links are not going to be there, sorry.

posted afternoon of May first, 2003: Respond

Tuesday, April 29th, 2003

🦋 Useless Information

With regards to my previous post, I want to flesh out the idea of limiting information content in order to increase bandwidth. Actually -- well I guess its accurate to say "I want to flesh out" this concept -- but not sure it is currently within my ability to do so. This must be an existing meme though -- if you have any recommendations for reading on this subject, please contact me.

posted afternoon of April 29th, 2003: Respond

🦋 Motivations

So why did I create this journal? The reasons are severalfold. I've been pretty fascinated by the blogging phenomenon since last summer, when I discovered a couple of the sites I've been reading regularly since -- Calpundit, Talking Points Memo, and Body and Soul are perhaps the "big three" for me -- and have been wondering if I could sustain such a steady level of posting and keep it interesting, and how it would sound if I did.

I started my first "web log" before I knew that term, back in 1999 with the READIN book diary; but page generation was manual, not automated, and maintaining the site was a hassle, and I never really got far with it. Although, take a look at the page for Faulkner's The Hamlet to get an idea of where I wanted to go with it.

Once I found out about ASP it seemed like the perfect fit -- I just had to learn how to code automatically generated journal pages and good things would come of it. Two things I wanted to learn to do formatting-wise; expressing dates and times in human terms, and displaying links in a hierarchical format. All the m/d/yyyy dates and hh:mm:ss times you see on web pages don't do it for me. They are over-determined and difficult to read. I wanted to express recent dates as "Yesterday", "Last Sunday", and posting times as just "morning", "evening", etc. I think I have come up with a pretty coherent way of doing this! And the hierarchical links, well, take a look at the left hand side of this page, I think they are good.

Update: Thinking about the two formatting goals above, I realize they are both concerned with limiting the amount of information presented in order to maximize the amound of information communicated. Funny... And the archiving system I have vaguely in mind could be thought of along the same lines too.

posted morning of April 29th, 2003: Respond

Monday, April 28th, 2003

🦋 Blog Progress

This morning I put in date formatting -- it still needs more testing but all in all seems to work pretty well. Places I want to go in the near future: Archives, subject filter, view by date. Long-term goals: comments!

posted afternoon of April 28th, 2003: Respond

Friday, April 25th, 2003

🦋 Getting my link out there

I believe the next week or so I will spend, fleshing out my list of links so it has all or most of the sites I want to link to; and making some posts. Then I will e-mail a couple of my fave blog authors, and see if I can start having other people look at my journal.

Also, I want to add a "Daily" section to the list of links, which will show only for the current day pages that I am reading.

posted afternoon of April 25th, 2003: Respond

Previous posts about Programming Projects
Archives

Drop me a line! or, sign my Guestbook.
    •
Check out Ellen's writing at Patch.com.

Where to go from here...

Friends and Family
Programming
Texts
Music
Woodworking
Comix
Blogs
South Orange
readincategory