Yossi Kreinin writes a very fair and positive blog entry about why he can't believe he's praising Tcl. In response, I left this comment on his blog:
I'm so glad you've put aside language bigotry and evaluated Tcl fairly--when you do, it's easy to see how convenient it can be for some tasks.
Of course I'm biased, but I also think Tcl is a fantastic language for developing web applications-thus, my affinity for AOLserver.
When you reduce web development to the simple process of "consume bits from a data source, transform strings, output bits to a network socket" ... Tcl's simplicity really makes rapid development a breeze, coupled with AOLserver's library of Tcl procs to ease some common tasks.
I hope more folks give Tcl a fair shake, given it's one of the oldest and arguably the most mature scripting language out there.
Even if you have no interest in Tcl, do read Yossi's blog entry about it. He really takes a close look at what makes for a good embedded scripting language and that's useful for anyone who is building an application today that needs such a thing.
Tags: programming, Yossi Kreinin, Tcl
I love it when I can go against the angry mob!
Marten & Jonathan: Good for you! Take those bits closed-source, make customers pay for the functionality, and use that money to hire talented QA engineers. Let companies pay for the stuff and demand actual timely bug fixes to the real problems that linger in the MySQL code base.
Of course, I wholly expect that 18-24 months later, you re-open the source for these products, once they've been polished up. The companies will be pissed, but we all benefit from higher quality products.
Look around, folks ... this is the cycle we've observed many times of open source software. The fact that Sun is making these changes now is a good sign for MySQL's longevity as a technology and product and that is only good for the open source community.
Tags: Sun, MySQL, open source, business
Configuring a binary or combined binary & Tcl module into your server -
| ←Older revision | Revision as of 19:36, 16 April 2008 | ||
| (3 intermediate revisions not shown.) | |||
| Line 1: | Line 1: | ||
Typical AOLServer modules are written in either Tcl, C, or some combination of those languages (though, of course, new languages can be added via the C module interface). They are included into your runtime using a section of the [[AOLServer Configuration]] file. | Typical AOLServer modules are written in either Tcl, C, or some combination of those languages (though, of course, new languages can be added via the C module interface). They are included into your runtime using a section of the [[AOLServer Configuration]] file. | ||
== Configuring a binary or combined binary & Tcl module into your server == | == Configuring a binary or combined binary & Tcl module into your server == | ||
| - | As documented [ | + | As documented [http://aolserver.com/docs/devel/c/ in the AOLServer C Developer's Guide], a binary module is a dynamically loadable library (.so or .dll) that will be linked into the server at startup. To get AOLServer to try to link it in: |
# Put the file in the right directory: | # Put the file in the right directory: | ||
#* In the default configuration of AOLServer, the right place is usually {your installation directory}/bin (e.g., /usr/local/aolserver/lib). In the AOLServer configuration file, by convention, this directory name is written as "${bindir}". Some installations use a separate "${homedir}/lib" (thus ${libdir}) directory. | #* In the default configuration of AOLServer, the right place is usually {your installation directory}/bin (e.g., /usr/local/aolserver/lib). In the AOLServer configuration file, by convention, this directory name is written as "${bindir}". Some installations use a separate "${homedir}/lib" (thus ${libdir}) directory. | ||
| Line 29: | Line 29: | ||
extern "C" | extern "C" | ||
{ | { | ||
| - | NS_EXPORT int | + | NS_EXPORT int |
| - | Foo_ModInit(char* server, char* module) | + | Foo_ModInit(char* server, char* module) |
| - | { | + | { |
| - | ... | + | ... |
| + | } | ||
} | } | ||
</nowiki></pre> | </nowiki></pre> | ||
| Line 40: | Line 41: | ||
MODINIT = Foo_ModInit | MODINIT = Foo_ModInit | ||
</pre> | </pre> | ||
| + | |||
== Tcl Modules == | == Tcl Modules == | ||
Developing Tcl modules for use with AOLServer is just as straightforward, but have some interesting additional features: a Tcl library really can be installed only into the Tcl interpreters for a specific virtual server, and they can usually be reloaded dynamically. | Developing Tcl modules for use with AOLServer is just as straightforward, but have some interesting additional features: a Tcl library really can be installed only into the Tcl interpreters for a specific virtual server, and they can usually be reloaded dynamically. | ||
| Line 53: | Line 55: | ||
The syntax for loading pure-Tcl library modules is: | The syntax for loading pure-Tcl library modules is: | ||
| - | + | :<code>ns_param ''moduleName'' '''Tcl'''</code> | |
| - | + | For example: | |
| - | + | :<pre><nowiki>ns_param nssession Tcl</nowiki></pre> | |
[[Category:Documentation]] | [[Category:Documentation]] | ||
| ←Older revision | Revision as of 19:27, 16 April 2008 | ||
| (One intermediate revision not shown.) | |||
| Line 1: | Line 1: | ||
''(Lets not split these into seperate pages until there's enough content.)'' | ''(Lets not split these into seperate pages until there's enough content.)'' | ||
| + | We assume the reader is somewhat familiar with http://aolserver.com/docs/devel/c/, or its peer pages, and now is looking for more advanced development topics. | ||
* [[AOLserver and Tcl Crash Course]] - A Programmer's Introduction (Outline) | * [[AOLserver and Tcl Crash Course]] - A Programmer's Introduction (Outline) | ||
* '''AOLserver Internals''' -- a guide to common [[data structures]], a description of the lifetimes of a [[thread]], an [[interpreter]], a [[request]], and a [[connection]]. Discussions of memory allocation. The [[Private C API]]. | * '''AOLserver Internals''' -- a guide to common [[data structures]], a description of the lifetimes of a [[thread]], an [[interpreter]], a [[request]], and a [[connection]]. Discussions of memory allocation. The [[Private C API]]. | ||
| Line 7: | Line 8: | ||
---- | ---- | ||
* '''AOLserver Configuration''' -- a walk-through of the basic steps to properly configure AOLserver, from database pools to virtual hosting. | * '''AOLserver Configuration''' -- a walk-through of the basic steps to properly configure AOLserver, from database pools to virtual hosting. | ||
| - | |||
** Here's a starter for [[Virtual Hosting]] in AOLserver 3.x and 4.x. | ** Here's a starter for [[Virtual Hosting]] in AOLserver 3.x and 4.x. | ||
** [[Module inclusion]] and how your files are treated. | ** [[Module inclusion]] and how your files are treated. | ||
provide some factual information about SMLserver when it was AOLserver-related
| ←Older revision | Revision as of 20:39, 14 April 2008 | ||
| Line 1: | Line 1: | ||
| + | Early SMLserver releases provided a Stanard ML module for AOLserver (nssml.so). | ||
| + | == See also == | ||
| + | |||
| + | * A Functional Approach to Web Publishing ([http://www.itu.dk/~mael/mypapers/smlserver-4.1.0.pdf smlserver-4.1.0.pdf]), by Martin Elsman and Niels Hallenberg. | ||
| + | * [http://www.springerlink.com/content/vbkf26yab0elru3g/ Web Programming with SMLserver], ISBN 978-3-540-00389-2. | ||
Filled in the basics from reading the code.
New page
Wrote a draft of the page based on reading the code. Have not tried to generate examples.
New page
Even though the deadline for filing US Income Taxes is still a week and a day away, I decided to procrstinate no longer and get it taken care of tonight.
On the way home for work I stopped at an office supply store and bought TurboTax Deluxe, which I've used in years past. It's usually been pretty painless, but this year I had to fight with it before I even got started on the actual tax stuff...
Since I did last years taxes I've upgraded to a MacBook Pro and "trickled down" my PowerBook to Shauna. Once I bought the new machine I hooked the two laptops up with a cross over cable and rsync'ed the contents of ~michael/ off of the PowerBook and onto ~michael/PowerBook on the MacBook.
As needed I've had ready access to saved files & data and haven't had any problems with the rsync approach. TurboTax, however, doesn't believe it can open last years return (which I want since it'll speed things up for this year since I won't have to re-enter a lot of information that hasn't changed, etc.)
I went to the TurboTax website, but it wants me to "login" before it'll let me read the search results whose titles seem like they might plausibly be of help. I'm fairly sure I have a login but since I can guarantee it'd be a fairly complex password (and one that I've never used anywhere else) I know it'd take me a while to remember or find it.
So I ask Caleb to let me use his mother's laptop, login, go to Finder and see that it lists last years saved return as being a "Turbo Tax File" in Finder. On the MacBook finder shows it being a "plain text" kind of file. Running the Unix file command on both laptops reports that the file is data.
So I wonder; how does Finder know to associate the file on the PowerBook with TurboTax? And why on the PowerBook does it think it is a text file? The first thing that comes to mind: rscyncing the file wouldn't have preserved the resource fork.
In OS X you can examine the resource fork of a file using standard Unix tools using the filename/rsrc. That is, for my file "2006_Return" I can ls -l 2006_Return/rsrc.
That, however, only showed me that the resource fork was 0-bytes (i.e., empty) on both laptops.
Back to square one. Googling on "kind" (what the Finder column-label calls the file type it displays) is a bit difficult since kind is rather generic and people don't normally talk about a "kind of file" as much as a "file type."
I finally found a very detailed post on the Mac OS X Hints forums that laid out the algorithm Apple uses to associate a given file with a given application in the Finder.
From those clues I did some more searching on file type and creator signature codes and came up with a very helpful Indiana University Information Technology Services knowledge base article entitled "In Mac OS and Mac OS X, what are file types and creators?".
In old (pre-OS X) versions of the Macintosh operating system the file system mainted various pieces of metadata (apparently separate from the resource fork) for every file. Specifically a 4-character "file type" code and a 4-character "creator" code. Most new OS X software doesn't carry on this tradition, apparently, but might TurboTax?
Next question: how to check what the file type and creator codes are? (The Indiana U. KB article had links to some shareware/freeware tools that let you set & see them but I didn't think I should have to download or buy additional software.)
I fired up tclsh trying to remember if, on the Mac, there were any extra file subcomands for dealing with such things. I didn't see any; (file stat $file var, for example, did not have any legacy-Macintosh values in it. I'm pretty sure Tcl on the Mac could have solved it for me, but rather than dig up that arcane knowledge I decided to search and find what installed Unix tools might be up to the task.
I found that there were two helpful utilities available since I'd installed Apple's Developers Tools on both laptops: GetFileInfo and SetFile.
Running /Developer/Tools/GetFileInfo on the PowerBook showed me:
file: "/Path/to/return" type: "TaxR" creator: "MIT6"
On the MacBook the type & creator were the empty string. I was able to set these values with:
$ /Developer/Tools/SetFile -t TaxR /Path/to/return $ /Developer/Tools/SetFile -c MIT6 /Path/to/return
I restarted TurboTax 2007 and this time it saw my 2006 return and so I'm able to start finally...
Perhaps this blog post will be helpful to some future TurboTax Macintosh user who has transfered files from one machine to another...
The Netcraft February 2008 Web Server Survey says:
Unusually, America Online's open source AOLserver sees tremendous growth, jumping from 35 thousand to 105 thousand sites in just one month. AOLserver is a multithreaded, Tcl-enabled web server which can be used for large scale, dynamic web sites, but has not seen the release of a new version since 2006. The majority of the new sites served by AOLserver are hosted in Poland.
This isn't going to make any headlines, but for all those doubters out there who keep wondering who actually uses AOLserver, check out that growth.
The sad thing is, we could easily game the Netcraft survey by doing a few simple things:
The costs involved would be around $10K for the first year, plus the cost of the actual AOLserver hosting, plus the $70K working capital in reserve to meet ICANN's requirements. This could all be set up on Amazon EC2/S3 to avoid having to provision real hardware as the customer demand grows.
Of course, what would be the point? Would having more significant numbers in the Netcraft surveys give AOLserver more credibility? I sure hope not--that would be foolish.
(via Mark Mcgaha)
by Ham-the-geek (noreply@blogger.com) at February 22, 2008 10:50 AM
Missed a space in the indenting fix.
| ←Older revision | Revision as of 18:21, 8 February 2008 | ||
| (One intermediate revision not shown.) | |||
| Line 16: | Line 16: | ||
'''EXAMPLES''' | '''EXAMPLES''' | ||
| + | <pre><nowiki> | ||
| + | % set html {One good website is <A href='http://google.com/'>Google</A>. | ||
| + | Another is <a href='http://www.yahoo.com'>Yahoo!</a>} | ||
| - | + | % ns_hrefs $html | |
| - | + | http://google.com/ http://www.yahoo.com | |
| - | + | </nowiki></pre> | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
---- | ---- | ||
[[Category Documentation]] - [[Category Core Tcl API]] | [[Category Documentation]] - [[Category Core Tcl API]] | ||
EnterpriseDB, the Oracle-compatible database company, today announced EnterpriseDB Advanced Server Cloud Edition, a version of the company’s flagship RDBMS that is built on the Amazon Elastic Compute Cloud (Amazon EC2) and Amazon Simple Storage Service (Amazon S3) Web services. EnterpriseDB has selected Elastra, the world’s first provider of elastic relational databases on demand, as its premier cloud computing software partner. Elastra’s Elastic Database Technology enables EnterpriseDB Advanced Server to run in a virtual, highly scalable, cloud-computing environmentWow.

Jane Austen uses double em-dashes at times. The naive approach I tried in TeX at first— consisting of two consecutive em-dashes—leaves a small but visible amount of whitespace.
A bit of Googling turned up a 1994 comp.text.tex post from Donald Arseneau (who, in addition to being a TeX-nician is also a Tcl'er!) that gave a satisfactory solution:
\mbox{---\kern-1pt---}\penalty\exhyphenpenalty
It's been over two years since we've taken the photo album down on the family website, shiobara.com--June 2005, to be exact. It's time to give it some proper care and feeding. The first step was to replace the old site with Wordpress, which required some changes to AOLserver in order to get it to work right. I then created a new theme that's a little less cluttered and with colors that aren't quite as offensive. Here's a "before and after" set of screenshots:

(shiobara.com, before)

(shiobara.com, after)
I realize I have no graphic design ability--hell, I can't even coordinate colors when I dress myself. Someday, I'll find someone who's ridiculously talented and wants to do the graphic design for me to save me the embarassment of doing it myself. Until then, I'll just keep hacking away at it myself.
Now that the site is all in Wordpress, the next step is to clean up the photo album. I took it down back in 2005 and wanted to redo it, but never got around to it. So, recently, I've started working on a Media Gallery plugin for Wordpress that uses jQuery, jCarousel Lite and ThickBox. It's pretty slick, and once we've launched the photo album, I'll release the plugin as open source. If you'd like a sneak peak to beta test it, just ask.
Tags: family, photos, Wordpress, plugins, web design, jQuery
Among all the Marginal Revolution Markets in Everything posts, one that personally intrigued me was #4, personalized romance novels.
For $55.95 a company in Florida will produce a unique book based on various details you provide (name, hair color, favorite car, favorite radio station etc.) and then plug those details into a pre-fabricated story running between 180 and 210 pages.
As Tyler Cowen noted:
Some people actually like this idea:
"It was an addictive read because it makes you the star," said Pete Hart, 34, who received a pre-fan novel called "Vampire Kisses" from his girlfriend. "I was referred to as Pedro in the book, which is my nickname. I found that quite charming."Another fellow noted:
"It read more like a novel or novelette and less like a typical romance novel," he said. "I enjoyed reading it. Besides, I was in it."
I'm intrigued, since I've made typesetting a hobby, and in part because of the huge profit margins. In my experience producing a single 180-210 page book shouldn't cost more than ~$7, so $55.95 would represent an eight times markup. Not bad...
Of course not being a reader of romance novels (or chick-lit generally) I'm somewhat skeptical of the appeal. But I recognize I'm probably not representative of the demographic and so I shouldn't necessarily consider my own opinion too highly. Better to try an experiment and attempt to quantify the appeal generally.
I am going to prepare a personalized book for my wife for Valentine's. This will provide me with one data point. However a sample size of one (especially when she might be biased to say nice things regardless of what she really thinks) isn't large enough to draw any conclusions from.
As long as I'm going to be creating a personalized book for my wife the marginal effort to create an additional personalized book for someone else is very low. (I'm already going to write a Tcl script to take a list of changes and apply it to the original text; re-running the script with someone elses list of changes would be trivial.)
My inivitation to you, dear reader:
I'm willing to produce a personalized trade-paperback (6"x9") version of Jane Austen's Pride and Prejudice for you.
I only ask two things:
The characters whose names could be changed to customize the story (links are to character summaries at Wikipedia) include:
This chart from Wikipedia shows the relationships between the aforementioned characters.
Location names that could be changed include: Rosings (Lady Catherine de Bourgh's estate); Netherfield (the estate leased by Mr. Bingley); Meryton (the village near where the Bennet's live); Brighton (where Lydia is invited to go with the militia); and Pemberley (Mr. Darcy's estate).
Given that Valnetine's Day is two and a half weeks away, and to allow time for production and shipping, please email me (michael at cleverly dot com) with the following no later than Saturday, February 2nd, 2008:
Please put Pride & Prejudice in the subject line of your email to decrease the chances of your email being inadvertantly miscategorized as spam. If you haven't received an acknowledgement from me within 48-hours please send another message.
I'm willing to ship internationally; however, I doubt time would permit your books arrival prior to February 14th, and the shipping expense would undoubtedly be greater.
Incidentally, if the idea of this experiment offends any die-hard fans of Jane Austen you have my apologies in advance.
In the "scratch your own itch" department, I decided to get Wordpress working under AOLserver. Wordpress is written in PHP, and while AOLserver can load PHP as a module, it doesn't play nice when you configure AOLserver with multiple virtual servers. The other option, running PHP as CGI using nscgi and php-cgi, does work for the most part. However, there were a few issues I ran into that required changes to nscgi, which I'll outline below.
PHP expects an additional environment variable, REQUEST_URI, to be included on CGI requests. Of course, this isn't part of the CGI/1.1 specification. Basically, PHP expects REQUEST_URI to contain the Request-URI (from the HTTP/1.1 specification, see section 5.1.2). So, I added this in.
In order to map an URL to be handled by nscgi, you previously had to make the change in your config .tcl and restart AOLserver. One of the great things about AOLserver is the fact that you can modify some settings at runtime, without a restart. So, I looked at whether it would be possible to add additional mappings at runtime, and it appears that under the hood, nscgi also uses the Ns_RegisterRequest C API which is supposed to be safe to execute at runtime. So, I added a new Tcl command, ns_register_cgi, which is now part of nscgi. It is just a wrapper around CgiRegister, and thus takes the same argument.
For example, if you wanted to map all requests to "/foo" (including "/foo/bar") to a PHP script "/var/www/myfoo.php", you would use something like this:
foreach method {GET POST HEAD} {
ns_register_cgi "$method /foo /var/www/myfoo.php"
}
This maps GET, POST and HEAD requests to URLs starting with "/foo" to the script specified.
Caveat: It is currently possible to load the nscgi module multiple times in the same AOLserver process, for each virtual server. It is also possible to load it multiple times for the same virtual server. I'm not sure why anyone would do that, but it's possible. In that circumstance, the behavior of ns_register_cgi is undefined--as in, I haven't tested it. It may or may not work correctly. If you run such a configuration, where nscgi is loaded multiple times in the same virtual server, please test this carefully and share your findings. Thanks.
I've commited the changes to SourceForge CVS, both in HEAD (rev 1.33, diff) and the aolserver_v40_bp branch (rev 1.23.2.4, diff).

After yesterday's yawner of a Macworld Expo, I wasn't really expecting today to yield much interesting news. Of course, I wake up to the news that Sun acquired MySQL! Both Jonathan Schwartz and Kaj Arnö share with us some of the best-laid plans of mice and men.
My first reaction was most definitely "WTF?!?" After the initial shock subsided, I wondered if it was April already. Checking my calendar, I realized it wasn't. Ah, maybe I'm still sleeping and this is just a really lucid dream? Nope. Okay, so how do I get from "denial" to "acceptance" as quickly as possible?
Sure, the next phase set in quick: anger. How dare they do this? First, Sun gives up the legacy of their SUNW ticker symbol in exchange for JAVA. Now they're going after my beloved MySQL database? Please don't tell me the next press release to come out is the announcement of a renamed MySQL into some craptastic "Sun Enterprise Data Management Suite," codenamed "Monkeybutter."
Fine, I'm being completely irrational, I know it. Things can't get that bad, that quickly, right? I mean, if we're all supportive and positive, things will just keep getting better for both Sun and MySQL, right? I mean, Sun infusing more money into MySQL will inevitably make it a better product, right? Just let some good come out of this situation, please?
Oh, what's the use? Companies are struggling so hard to find MySQL talent, and it's allegedly "the world's most popular open source database" according to MySQL itself. Sun bet the farm on Java and subsequently we've watched the company fall into the pit of irrelevancy. Who really cares what happens to either of these companies any more?
You know who? I do. I love Sun hardware and I love using MySQL databases. If there's some benefit to be had here, I'm sure Jonathan Schwartz will find it and exploit it to the benefit of his customers. In any business, if I had to bet on someone, I'll always pick the guy with the pony-tail and T-shirt to win. If you've ever seen me in person, you'll know exactly why. :-)
As much as people wonder "who still uses Tcl?" or "what the heck is Tcl?" ... it's still alive and well and under steady new development. The long-awaited release of Tcl 8.5 happened this past December 20, 2007. You can download it from here.
The discussion on Slashdot about it shows that there's still a lot of misinformation and outright FUD being spread about Tcl, now 20 years old. Of course, the Tcl community seems to focus more on excellence in engineering than evangelism and PR, so Tcl will likely remain "a well-kept secret, sitting out in plain sight" for the next 20 years.
For people who are already familiar with Tcl but would like to know what significant changes were introduced in Tcl 8.5, Michael Cleverly has a fantastic write-up on it. I highly recommend reading what he wrote if you're looking to take advantage of Tcl 8.5's new features.
Tags: Tcl
| ←Older revision | Revision as of 16:49, 10 January 2008 | ||
| (One intermediate revision not shown.) | |||
| Line 480: | Line 480: | ||
<pre> | <pre> | ||
ns_limits set default -maxupload [expr 25 * 1024 * 1024] ;# Maximum file size set to 25Mb | ns_limits set default -maxupload [expr 25 * 1024 * 1024] ;# Maximum file size set to 25Mb | ||
| + | </pre> | ||
| + | |||
| + | |||
| + | == Return a file generated live == | ||
| + | |||
| + | Example using the db_foreach function from OpenACS, for the sake of code readability: | ||
| + | |||
| + | <pre> | ||
| + | db_foreach get_mailing_addrs " | ||
| + | |||
| + | select company_name, | ||
| + | address, | ||
| + | city, | ||
| + | province_abbrev, | ||
| + | postal_code | ||
| + | from ce_members | ||
| + | order by company_name" { | ||
| + | |||
| + | append csv_text "\"$company_name\",\"$address\",\"$city\",\"$province_abbrev\",\"$postal_code\"\r\n" | ||
| + | } | ||
| + | |||
| + | ns_set update [ns_conn outputheaders] content-disposition "attachment; filename=\"member-addresses.csv\"" | ||
| + | |||
| + | ns_return 200 application/octet-stream $csv_text | ||
</pre> | </pre> | ||
Mark Roseman has created a new Tk website (tkdocs.com) which aims to provide "a language neutral, up-to-date (8.5+) best practice tutorial and associated documentation".
The tutorial is coming along quite nicely, with code examples for both Tcl and Ruby. Presumably examples for other languages (Python, Perl, etc.) may yet be forthcoming—or would be included if someone steps up and contributes them.
The site, as new is it is, is already off to an excellent start. Kudos to Mark!
The weekly Hackfest took a bit of a break due to the winter holiday and resumed this past Monday. The goal for this session was to turn the visual design created last time into actual FBML that would render inside a profile box.
The first step was to create the database schema, which was mostly outlined in the design document. I went ahead and created actual DDL scripts for MySQL based on what was described in the design doc. I'm expecting these to change as development progresses, but this represents the minimum required to implement our current visual design.
The general approach for the profile box implementation is to use profile.setFBML to set the FBML of the profile box to simply "<fb:ref handle="profile_box"/>". We want to do this because every day when the profile box needs to be updated for every single Facebook user who has added our application, we don't want to have to invoke profile.setFBML with the newest information--that just won't scale well. Having the profile box simply contain an <fb:ref> means we can effectively update everyone's profile box with a single call to fbml.setRefHandle, once per day.
I've also created a SQL script that can be used to populate the MySQL database with sample data for testing. The only MySQL-specific part of it is the use of "CREATE TABLE ... LIKE ..." which allows us to use the submission_template and votes_template tables to create our individual instances of those tables for each list_id, rather than embedding the DDL for each of those in our code itself.
After all this, here's a screenshot of the profile box off my own Facebook profile page, pulling the sample data out of the database and rendering it via FBML:

The rating widgets--the "thumbs up" and "x" icons--don't actually work yet, but that's going to be next week's challenge, getting the Facebook "mock AJAX" working.
Tags: Hackfest, New Jersey, Facebook, MySQL
Once upon a time (Tcl 7.x; probably earlier too?) the best way to test for string equality in Tcl was:
if {[string compare $x $y] == 0} ...
Beginning with Tcl 8.1.1 the preferred way became:
if {[string equal $x $y]} ...
Beginning with Tcl 8.4 and the introduction of the eq and ne operators testing for string equality became much more concise:
if {$x eq $y} ...
Much more readable, concise, and less to type. In Tcl 8.5 we get a simillar improvement for testing whether a particular item is a member (or not) of a list:
if {$x in $y} ...
Which IMHO is a huge improvement over the former idiom:
if {[lsearch -exact $y $x] != -1} ...
Naturally ni is to ne as in is to
eq. And to top it all off, ni is fun to say too.
In Tcl 8.5 you can now define, at the script level (instead of needing to write in C) custom math functions. For example here is a factorial function:
proc tcl::mathfunc::fact {n} { if {![string is integer -strict $n] || $n < 0} then { return -code error "fact is only defined for non-negative integers" } set result 1 # remember, n! (n factorial) is the product of all integers between 1 and n # except 0! which is defined to be 1 for {set i 2} {$i <= $n} {incr i} { incr result [expr {$result * $i}] } return $result }
Then we can use fact($n) in expr, if, while, for, etc. just like any of the "built-in" math functions.
Since we now have arbitrary precision integers (thanks Kevin!) we can compute factorials that exceed the native size of a long integer, i.e., 42!
% expr fact(42)
1405006117752879898543142606244511569936384000000000
Defining your own math functions makes solutions to Project Euler problems easier to write. YMMV. The other features of Tcl 8.5 will probably be exciting to an even wider audience.
As of January 2008 the Google calculator can only calculate up to 170!. We can do twice as better quite quickly (timings from my 2.4 GHz MacBook Pro laptop):
% time {expr {fact(171)}} 1000
295.348728 microseconds per iteration
% time {expr {fact(340)}} 1000
791.435306 microseconds per iterationAfter more than four years in the making, Tcl 8.5 was released a few days before Christmas. And wow, what a treat it is!
This release is, in my opinion, the best ever.
I first became acquainted with Tcl 10-years ago via Philip Greenspun's original Database Backed Websites book. At the time AOLserver 2.x was closed source but available at no cost. I never had much hands on experience with the Tcl 7.6, 8.0, 8.1 and 8.2 releases; I made the jump straight to Tcl 8.3 (IIRC) once America Online open sourced the code base for AOLserver 3.x.
Since Tcl has been around for twenty years now, there is a fair amount of outdated information on the web regarding Tcl's features, performance and capabilities that doesn't apply at all to modern Tcl versions.
There are a number of features that excite me in this release. I intend to blog a bit about each of the following (I'll update this post with links to subsequent posts as they get written):
Stay tuned.
Addendum: Dossy points out that I overlooked the biggest news: the {*} expand operator, which means an expansion from the 11-rule endekalogue to a 12-rule dodekalogue. (Tcl 8.5, now with 9% more syntax!)
| ←Older revision | Revision as of 21:19, 23 December 2007 | ||
| Line 1: | Line 1: | ||
| - | : mailto:ximon.eighteen@ | + | : mailto:ximon.eighteen@gmail.com |
| - | + | See: http://ximoneighteen.com/ | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
[[Category:Person|Eighteen, Ximon]] | [[Category:Person|Eighteen, Ximon]] | ||
del.icio.us/dossy (RSS) links since December 10, 2007 at 09:00 AM:
After hearing about the Taproot Foundation from Jennifer, who came to the November MySQL Meetup and told me about it, I decided to complete a profile as a volunteer. Shortly after, someone contacted me and we had a brief chat and scheduled me for their December 11th orientation at the Time-Life Building in NYC, which was this past Tuesday.
In a nutshell, the Taproot Foundation is nonprofit organization that awards service grants for other nonprofits' projects, to be performed by volunteers, for free.
Attending the orientation and completing the volunteer agreement form was the last step before I could be selected by an account director to work on a service grant (project). Now, I'm just waiting to hear from someone who wants me on their team.
Why am I signing up to volunteer my time for free? Especially after my recent financial stumble just a few weeks ago? How can I possibly have time to volunteer when I should be trying to squeeze every billable hour out of my non-sleeping time?
I like to say, "The best gifts are the ones you cannot wrap." I've always enjoyed giving of my time and talents where they are wanted. As a teenager, I worked as a volunteer at a local hospital, as well as at a homeless shelter. As an adult, I've been playing guitar for the Sunday school children at church, as well as singing in the church choir, and I plan to participate in the Sierra Bravo's F1 Overnight Website Challenge in March 2008. Volunteering through the Taproot Foundation is the kind of thing that really suits me.
I'll write more about my experiences volunteering for Taproot once I'm on a service grant. Until then, if you want to ask me questions, feel free to leave a comment below. Or, perhaps you want to sign up as a volunteer yourself!
Tags: Taproot Foundation, volunteering