|
|
I'd like a calendar... Saturday, December 2 2000
Not having to ride my bike to Venice today meant that I had something of a jumpstart on the day. And it was an amazingly productive one for me at Bathtubgirl Central. The first success was the creation of a content manager allowing Bathtubgirl to manage her journal entries without worrying about picky HTML things like navigation. True to form, of course, Bathtubgirl hit me with one of her trademark "little requests," the kind that doesn't take much effort to say but which requires considerable effort to develop. Suddenly she wanted a navigation system that resembles a calendar. I grumbled a little and then sat down and coded it completely from scratch. And so here is the source for the functions that read the database, retrieve journal entries for the latest entry-containing month and then draw a calendar of links to those entries:
function GetLatestBTGJournalEntryID(byref dtmDate)
dim strSQL, intOut, rst
strSQL="select articleID, ReleaseDate from articles where ReleaseDate=(select max(releaseDate) from articles where SectionID=3)"
set rst=arst(strSQL)
if not rst.eof then
intOut=rst("articleID")
dtmDate=rst("ReleaseDate")
end if
set rst=nothing
GetLatestBTGJournalEntryID=intOut
end function
function ThisCalendar(dtmStart)
dim strOut, rst, intThisMonth, intMonth, dtmCursor, intDay
dim dtmLast, intArticleID, intWeekDay, intWeekDayFirst, arrThis(31), dtmLastDayLastMonth, dtmFirstDayNextMonth, i
if dtmStart="" then
intArticleID=GetLatestBTGJournalEntryID(dtmLast)
dtmLast=cdate(dtmLast)
else
dtmLast=cdate(dtmStart)
end if
intThisMonth=month(dtmLast)
dtmCursor= cdate(intThisMonth & "/01/" & year(dtmLast))
dtmLastDayLastMonth=dateadd("d", -1, dtmCursor)
dtmFirstDayNextMonth=dateadd("m", 1, dtmCursor)
intWeekDayFirst=weekday(dtmCursor)
set rst=aRst("select articleID, ReleaseDate from articles where ReleaseDate>'" & dtmLastDayLastMonth & "' and ReleaseDate<'" & dtmFirstDayNextMonth & "'")
i=1
do until rst.eof
arrThis(day(rst("ReleaseDate")))=rst("articleID")
i=i+1
rst.movenext
loop
set rst=nothing
strOut="<table bgcolor=990099 cellpadding=0 cellspacing=0 border=2>" & vbNewLine
intWeekDay=1
strOut=strOut & "<tr>" & vbNewLine
strOut=strOut & "<td colspan=7>" & vbNewLine
strOut=strOut & Monthname(intThisMonth) & " " & right(year(dtmLast), 2)
strOut=strOut & "</td>" & vbNewLine
strOut=strOut & "</tr>" & vbNewLine
strOut=strOut & "<tr>" & vbNewLine
i=0
do until intWeekDay=intWeekDayFirst or i>33
strOut=strOut & "<td> </td>" & vbNewLine
intWeekDay=intWeekDay+1
i=i+1
loop
intDay=1
i=0
intMonth=intThisMonth
do until intMonth<>intThisMonth or i>32
if weekday(dtmCursor)=1 then
strOut=strOut & "<tr>" & vbNewLine
end if
if arrThis(intDay)<>"" then
strOut=strOut & "<td><a href=today.asp?articleid=" & arrThis(intDay) & ">" & intDay & "</a></td>" & vbNewLine
else
strOut=strOut & "<td>" & intDay & "</td>" & vbNewLine
end if
if weekday(dtmCursor)=7 then
strOut=strOut & "</tr>" & vbNewLine
end if
dtmCursor=dateadd("d", 1, dtmCursor)
intMonth=month(dtmCursor)
intDay=day(dtmCursor)
i=i+1
loop
i=0
do until weekday(dtmCursor)=1 or i>8
strOut=strOut & "<td> </td>" & vbNewLine
dtmCursor=dateadd("d", 1, dtmCursor)
i=i+1
loop
strOut =strOut & "</tr></table>" & vbNewLine
ThisCalendar=strOut
end function
Next I hooked up a second webcam that peers into the former privacy of Bathtubgirl's bedroom/office area and FTPs fresh images every five seconds to her webcast page. Bathtubgirl was all coy about the new webcam at first, like she didn't want people seeing her in bed or pulling bong hits, but everybody who knows Bathtubgirl knows that once the technology for exhibitionism is in place, her coyness has a way of evaporating. Just as information wants to be free, web personalities want to be exhibitionists.
My final success of the day was the one I'd least expected: setting up a proxy server system allowing Eva, the new Spanish girl living in the basement, to connect her Macintosh to the internet via Bathtubgirl's DSL connection. This required me to install WinProxy (a shareware proxy server application) and an additional Ethernet card in Bathtubgirl's main PC. Somehow I managed connect the cables correctly and configure all the IP addresses with the right numbers, because, miracle of miracles, I actually got a web page to load this afternoon on Eva's machine. My experience with networking and operating system issues has been so fraught with failure and flakiness that I'd expected to be assaulted by at least three different instances of "if it can go wrong it will go wrong." The only thing that can go wrong now is for WinProxy's introductory period to expire, but that's thirty days out, a full decade of internet time!
In the evening I found myself hanging out with my housemate John eating corn chips. There was nothing particularly odd about this, but then John broke out a bottle of what appeared to be Tabasco sauce. But it was something else, something that could be bought from Smart & Final for a mere $3. It was habañeros sauce, made from the absolutely most powerful peppers on Planet Earth. These were the peppers that made Homer trip so hard on that one epic Simpsons episode. Being guys and all, we found ourselves trying to out-macho one another with how much of the stuff we could take on each of our chips. This was not a good idea. It was a slow heat that finally snuck up on us and bit us, making us wish we hadn't been so competitive. I could tell the stuff was hot because it was even burning my stomach a little. I'd never eaten anything before that I could feel burning in my stomach. After a half hour or so it subsided. It's not like wasabi, the heat that fades instantaneously.
For linking purposes this article's URL is: http://asecular.com/blog.php?001202 feedback previous | next |