Extending the Google v8 JavaScript Engine
March 20, 2009 on 6:13 pm | In software-dev | 1 CommentHi, all!
In late February i happened to come across a very interesting open source project, Google’s v8 JavaScript engine. Being a long-time hacker of add-ons for the Mozilla SpiderMonkey engine, i felt compelled to try it out.
After a couple of days i was convinced that v8 was a cool platform to work with and put together a project page for my v8-related hackings:
http://code.google.com/p/v8-juice/
v8-juice (the v8 JavaScript Userland Integratable Components Emporium) is its name.
If there are any other C++/JavaScript half-breeds out there, the project is looking for talented hackers to improve and expand it.
Happy hacking!
Four reasons to take a closer look at the Fossil SCM
January 12, 2009 on 4:30 pm | In General, software-dev | 1 CommentThis post was originally made to the mailing list of the Fossil source control system on January 11th, 2009, with the subject line “A letter to the new or unconverted fossil user”. After reading it over again, i figured i could recycle it as a blog post to evangelize Fossil a bit. It might also make good food for the 200+ spambot suscribers to this blog from @mail.ru.
…
This is addressed those of you who are new to fossil and those who have used it for a while but just aren’t quite sure whether they like it or not…
Sometime in late 2007 i came across a link to fossil on sqlite.org. It was a good thing i bookmarked it, because i was never able to find the link again (it might have been in a bug report or something). The reasons i first took a close look at it were (A) it stemmed from the sqlite project, which i’ve held in high regards for years (e.g. i wrote JavaScript bindings for it: http://spiderape.sourceforge.net/plugins/sqlite/), and (B) it could run as a CGI. That second point might seem a bit archaic, but in practice CGI is the only way most hosted sites can set up a shared source repository with multiple user IDs. (i’m not about to give out my only account password or SSH key for my hosted sites, no matter how much i trust the other developers, and none of my hosters allow me to run standalone servers or add Apache modules.)
So i tried it out. The thing which bugged me most about it was having to type “commit” or “com” instead of “ci” for checking in (as is custom in all other systems i’ve used), despite the fact that fossil uses “ci” as a filter in things like the timeline view. Looking back now, i have used fossil for about about 95% of my work in the past year (http://blog.s11n.net/?p=71), in over 15 source trees, and i now get tripped up when i have to use svn or cvs.
So, having got over typing “fossil com -m …”, here’s why i love fossil so much…
Point #1: CGI
Again, this sounds archaic, but fossil has allowed me to share source trees which i cannot justifiably host in other projects i work on (they don’t belong to those projects), which i cannot host in Google Code (because google code doesn’t allow/recognize Public Domain as a license, and i refuse to relicense just to accommodate them), and for which SourceForge is overkill (and way too slow). With fossil i can create a new repo, have it installed on my hoster (http://fossil.wanderinghorse.net), and be commiting code to it within 5 minutes.
Point #2: Wiki
i hate wikis. i really do. Always have. They all have a different syntax and the content tends to get really disorganized really quickly. Their nature makes it difficult to reorganize them without replacing old pages with lots of “has been moved to [TheNewPage]” links. i’m one of those “code for tomorrow” coders (i.e., code such that it’ll be easy to reorganize/refactor later). i like to document the same way, and wikis make that problematic. Then again, no documentation system is really good in that regard.
That said, fossil has made me love having a centralized, common documentation platform. Whereas i used to document everything in the API docs (header files) and often include an ODT file for a library manual, fossil has become my preferred platform for non-API documentation because it’s just so easy to do. No matter where i am, i can log in and write (i write a lot). The added ability to export my wiki pages, edit them in xemacs, and re-import them just makes it nicer, as i can tweak as much as i want without ending up with 10 “updated wiki page SoAndSo” messages in the commit log.
Point #3: running a server locally
Fossil runs not only as a CGI, but as a server. i don’t WANT to host my own server (and don’t have the rights to on my hosters). i hate server-side maintenance (a hate born from years of administering systems). But the server has other uses. When working on the wiki, bug reports, etc., the local server is the way to do it. It’s blazingly fast and much more productive. When you’re done, just run “fossil push” and everything’s synced.
Point #4: the single-file repository
Having all controlled content inside a single container file has been a godsend when it comes to backups and copying/moving a repository. There are no access or file ownership issues, which are often problematic with other server-side systems (at least on the initial install). For about 5 years i administered a CVS repo for a company for, and every time someone added a directory to the (huge and dynamic) source tree i had to log in and “chmod 4775″ the directory before others could commit to it. Fossil’s model inherently eliminates that type of problem, and i’m a *huge* fan of solutions which inherently (that is, due to their very nature) avoid certain foreseeable problems. The single-file repository model’s flexibility would seem to become more problematic for massive repositories (a few hundred MB+) with many users with differing levels of access (e.g. OpenOffice, Firefox, or the Linux Kernel), but 99.9% of projects never reach anywhere near that size or complexity. (For that level of project, it would seem the world is quickly migrating to git.)
In summary:
i remember my first reaction to fossil being, “this will be an excellent solution for small projects [like the dozens we've all got sitting on our hard drives but which don't justify the hassle of version control].” A year of daily use in over 15 source trees has confirmed that, and i continue to heartily recommend fossil to other developers i know who also have their own collection of “unhosted” pet projects.
Even if fossil stagnates today, never adds another feature, and never gets another bug fix (what bugs?), this is a tool i see myself using for many years to come. (No, honestly, i don’t know what bugs you’re talking about.)
Happy hacking!
All models are wrong…
November 19, 2008 on 4:02 pm | In software-dev | 1 CommentGeorge E. P. Box is credited with the quote “essentially, all models are wrong, but some are useful.” Amen. Today i came across this enlightening page about models in general, and the properties that “more useful” or “better” models all have (or should have) in common:
http://www.idiagram.com/ideas/models.html
The list of entries applies almost 100% to computer models, except that i will differ on point 9 of the list (a model must be Falsifiable), because i don’t think that a computational model must be falsifiable in that sense. A computational model/API may be unsuitable (and therefore “false”) for a given use case, but the computational model as a whole either is or is not, it need not be true or false in the conventional sense.
In any case, it’s an enlightening read for those interested in modeling or “studies in commonality” in general.
Qt Developer Days: Oct 13-15, 2008
October 15, 2008 on 4:27 pm | In software-dev | 1 Commenti just got back from the Munich, Germany session of this year’s Qt Developer Days 2008, and now have a few things to say about Qt and ostriches…
First off, if you’re an avid Qt developer and you’re not already a guru, the DevDays
almost certainly has something for you. i’ve used Qt off and on since the middle of 2000, but am very far from being a Qt guru. In August i heard about the DevDays and saw that it would coincidentally be held less than 100 meters from my current place of work. So i signed up with the hopes that i could learn some things to help me improve QBoard and to get some tips which might be useful for another Qt-based project i hope to eventually start writing some day. (And it gave me a great excuse to skip work for three days.)
This was my first ever software seminar, so i had absolutely no clue what to expect. i certainly didn’t expect an ostrich.
Overall i’m glad i went. While most of the topics were, in my opinion, too high-level (that is, not complex enough), some of the presentations were really good and were at a reasonable complexity level (especially the “The Depths of Qt” presentation, the session from which i learned the most). All of the speakers knew their topics well and while most were also good presenters, one or two of them will need to work on their presentation skills before next year’s conference.
Day One was basically an intro to Qt, with an instructor showing us (about 45 people) the basics of Qt and answering questions (most of them from yours truly). At the start of the presentation the instructor explained that the course was actually over-booked. They normally take only 25 people, but the web page registration process had a bug and didn’t close registration until some 47 people had registered. So we were packed in a bit tight, and i was glad i hadn’t bothered to take my laptop (i was one of only two or three without a laptop that day). Aside from the tight seating (and the correspondingly long lines for the lunch buffet (none of it containing ostrich meat)), the course was (IMO) a success, and i went away feeling that i had a better understanding of the basics of Qt.
The most notable thing about Day One was this: of the 45 or so participants present, there were 3 or 4 women in the group. As we all took our seats before the presentation started, i listened to what was going on in the room. i could hear about 40 pairs of hands typing away and clicking on mice, most of them trying to figure out if there was a wireless network (there was, but at 108 Euros for 1 week of access… no, thanks). And i heard 3 or 4 female voices chattering away. None of the men spoke, despite their close proximity to one another - they were all too obsessed with their PCs. The women, however, chitchatted freely with one another (very possibly about ostriches). It was an interesting observation, though i don’t dare to [publically] speculate on the deeper meaning of it.
Days Two and Three were completely different from the first day. When i arrived i was amazed to see not 40-some-odd people, but around 400-500, most of them obviously programmers (the black t-shirts are a dead giveaway) but also a number of business-side customers and managers, but no ostriches were yet to be spotted [that's the cheatah's job, actually]. The first few hours of Day Two was marketing hype and other (largely off-topic) presentations from Qt/Trolltech/Nokia management (each presenter made the point (several times) about Qt now belonging to Nokia), and an interesting (but also largely off-topic) discussion of concurrency and multi-CPU/core/thread platforms by the Editor in Chief of Dr. Dobb’s Journal, Mr. Jonathan Erickson. (While i didn’t notice it at the time, another visitor later pointed out how Mr. Erickson (quite innocently) suggested the use of Boost Threads, instead of advertising the QThread class of the seminar’s sponsor. Also, i found it funny that his last name is Erickson but he’s at a Nokia conferrence.)
After that it was a series of technical presentations, just over an hour each and running three at a time (you had to pick which of three to visit). As in Day One, they had apparently over-booked just a bit, and invariably we had a significant number of people who had no seats and ended up lined up along the walls or on the floor in front of the podium. (The caterer, by the way, did an excellent job of handling the crowds (and the food was exceptional), except that during one break we ran out of coffee. A downright tragedy.)
A few things really surprised me about the conference in general, namely:
- The Qt developers call it “Cute”, not “Q-T”, which of course opens it up to tiresome puns like “it’s a cute bug” and “it’s not compatible with cute” [i.e. "it's ugly"].
- How many of the visiting developers were developing for Windows. The vast majority.
- How many visitors and Qt developers use/develop for an Apple product. That didn’t actually surprise me, but depressed me nonetheless. (i mean, Apple has less than 10% of the market, more than 90% of the hype, and less than 10% of their market share or hype are deserved.) i can’t count how many times i heard, “[this or that feature] cannot work the same in Mac because Apple won’t let us do it.” Apple “won’t let them” change the default font sizes or recolor a GUI button to red. My OS vendor doesn’t have any say-so in how i use my machine, and i can’t for the life of me understand why people tolerate that from any OS vendor.
- i was the only visitor i saw without a company name on his name tag. My assumption is that most Free/Open Source developers probably didn’t want to shell out the cost of admission, which was admittedly more than a few coins.
- 98% of the visitors had short hair. i apparently no longer fit the current software developer stereotype and will need to re-think my place in society. (Only two other men had hair nearly as long as mine, and the guy with the long dreadlocks could certainly have much longer hair if he’d bother to wash it.)
- Despite all the ostrich references, i hadn’t seen a single ostrich.
In any case, if you get a chance to visit Qt Dev Days in the future i can heartily recommend it, especially if you haven’t been to one the previous year. i don’t know if visiting Dev Days two successive years would provide enough new content to justify the cost (at least for the private developer, such as myself, paying out of his hobby budget), as the presenters often said, “this presentation is similar to the one given last year.” But the seminar was informative and a great opportunity for networking (if one is into that type of thing).
And if a Qt’er mentions ostriches (and does so way out of context, as in “I’m glad this slide has no ostrich on it”)…
After the next-to-last session i caught up with one of the Qt developers and said, “you’re the 3rd or 4th presenter i’ve heard make pointless ostrich references. There’s gotta be a story there. What is it?” He broke his previously serious manner to laugh and explained that it’s a running gag with the sole purpose of getting people to ask, “what’s with all the ostrich references?” Apparently this gag changes from year to year - last year a visitor raised his hand during one of the sessions to ask, “why does everyone keep mentioning steak restaurants?” While i did refrain from asking during the session (i considered it too off-topic), i couldn’t resist asking when i got the chance. And, like it or not, there’s the answer.
Anyway…
Happy hacking and happy ostrich hunting!
PS: if you were at DevDays and are curious who i am - i was the one with the bandana on his head (it keeps The Hair out of my eyes).
Using GNU Readline in QtScript
September 14, 2008 on 11:58 pm | In General, software-dev | 1 CommentThe past few weeks i’ve been delving pretty deeply into QtScript, which is essentially a JavaScript engine based on Qt (and part of the Qt distribution).
Today i threw together a little goodie for QtScript which allows one to use GNU Readline-like functionality from scripts. The code is at:
http://code.google.com/p/qboard/source/browse/QtScriptBindings/src/readline/
Just tweak the .pro file (to change the output path), then follow the instructions in the README file.
A quick demonstration of how to use it:
First, load the module into your app:
myJSEngine->importExtension("readline");
Then use it from script code:
Readline.history.load("/path/to/my/history/file");
var s = Readline.read("prompt: ");
if( s === undefined ) { /* user tapped Ctrl-D/EOF */ }
else { print(s); }
That’s all there is to it.
Happy hacking!
The GNU GPL: Free as in Will?
March 24, 2008 on 4:53 pm | In General, software-dev | 12 Comments[Achtung: if you are easily offended when people bad-mouth the GPL, and claim that anyone who speaks agains the GPL "doesn't get it", then please do not read this post. i'm sick to no end of people claiming that i "don't get what the GPL is about" just because i speak out against it. They're getting to be as bad as Apple fanatics have been for years.]
Let’s talk for a moment about the GNU General Public License (GPL), arguably the most common license applied to Open software. Without it, the whole Free/Open Source Software (FOSS) movements and cultures which we know today very probably would never have arisen. Instead, the world of free licenses, e.g. the venerable BSD- and MIT-style licenses, would probably be common within academic circles but would probably never have been adopted by [m]any mainstream projects. Why not? Quite simply because they are not viral, as the GPL is. Once the GPL is used as a license, it is neigh impossible to separate that code from the GPL, short of reimplementing it from scratch (except in the case of single-author projects, where the author is free to change the license on future versions but cannot retroactively change it on versions released under the GPL).
For me, the GPL is kind of like comedian Sacha Baron Cohen - an object of both fascination and disgust. On one hand, the GPL is a critical element in the whole FOSS framework. Without it we would probably see lots more fragmentation of software projects, particularly with companies adopting free code and then keeping it closed. On the other hand, however, what the GPL preaches and what it delivers are two completely different things. In any case, without the GPL we would likely be 10 to 15 years behind where we are now in mainstream computing environments, as we would still lie completely in the grips of commercial enterprises.
The GPL lays down a set of rules which are both harsh and formidable enough to be able to keep self-serving commercial entities off of our collective backs while we (”the royal we”) get down to the serious business of advancing the field of computer science (and, indirectly, many other fields) to the benefit of humankind as a whole.
But that’s where my praise of the GPL ends. Why? Because what it delivers - in its harshness - is quite at odds with what it claims to deliver. That is not to say the that the GPL does not deliver what it should deliver. It does indeed do that. But its Holy Book (the text of the GPL) herds us in with dreams of freedom. Once we’re emotionally involved it then slaps on the shackles. And everyone we ever touch afterwards will get those shackles slapped on to them, whether or not their beliefs are consistent with the GPL’s underlying philosophies.
The GNU GPL is based upon the so-called “four freedoms”. They are (taken verbatim from the GNU web site):
- The freedom to run the program, for any purpose (freedom 0).
- The freedom to study how the program works, and adapt it to your needs (freedom 1). Access to the source code is a precondition for this.
- The freedom to redistribute copies so you can help your neighbor (freedom 2).
- The freedom to improve the program, and release your improvements to the public, so that the whole community benefits (freedom 3). Access to the source code is a precondition for this.
(Source: http://www.gnu.org/philosophy/free-sw.html)
As anyone who has anything to do with [non-Windows] software development knows, GNU’s definition of “free” is “free as in freedom.” But what dictionary did the GPL author(s) use when looking up a definition for “freedom”?
My philosophical problems with the GPL’s concept of freedom lie specifically in freedoms 2 and 3, the freedoms to redistribute the code with or without changes (those two points are conceptually the same thing - I’m not sure why they are considered to be separate points in that list. Perhaps because “three freedoms” doesn’t have the same ring to it.).
I’ve said this before (and I’ve upset people by saying it) and I’ll say it again: freedom implies choice, and the GPL strictly removes any choice from the user. The fact is, if you modify code which has the GPL license, and you give anyone a copy of your program (that is, the program is not strictly used for one’s own internal use), then you are forced to give the source code to your program out as well (though you may defer doing so until someone asks for it). Forced. There is no Freedom in Forced.
Now hold on a minute - I’m not at all saying that the release of source code should be restricted! Every line of source code for every project I release is released for all to read, modify, and redistribute as they see fit. As they see fit. They have the freedom of choice.
The vast majority of my own source code is released without copyright, into the Public Domain. Some of my code uses the less-restrictive LGPL, which I actually am a big fan of, and which I find to be a wonderful compromise between the GPL and the real world. Some of my code uses MIT- or BSD-style licenses, mainly in cases where I have adopted code released under those licenses. In my opinion, MIT/BSD-style licenses are about as close to Public Domain as one can get while still having a license.
It is technically true that the idea of Public Domain is not legally valid in all jurisdictions (if I’m not mistaken, Germany (where I live) is one of those jurisdictions). But is is also true that some jurisdictions do not accept any concept of “Intellectual Property”. In such jurisdictions, we can effectively call all software Public Domain. Thus the GPL is, in some contexts, as invalid as Public Domain is in other contexts. So don’t harp about how legally enforceable the GPL is. Just as with the GPL, I’ve never heard of a valid legal case where some known Public Domain resource was challenged and subsequently given over to a single entity. Legalities, in any case, are local conventions and not unbreakable divine laws.
Now back to the point… let’s look over the list of the Four Freedoms, this time with the following differences in our perception:
- A reasonable, conventional definition of Freedom (i.e. one which includes choice). Or, “Free as in Will,” if I may now coin a phrase.
- Instead of the context of resources licensed under the GPL, consider the context to be Public Domain resources.
Go on and take a look, then please continue…
Did you notice the difference? Namely, the difference that the Four Freedoms, as listed above, apply to resources released into the Public Domain. They also apply to a number of other FOSS-compatible licenses. But they do not, given any reasonable definition of Freedom, apply to the GPL.
Does this mean the GPL is somehow evil? No, of course not. The purpose of this is simply to point out that the GPL does not practice what it preaches. That said, what is practices is an essential part of the FOSS culture(s), but what is practices is not what it claims, in its manifesto, to practice.
Over the years I’ve received several mails from people new to the FOSS concepts, and they’ve asked me questions like, “what license should I use for my code?” The answer of course, depends on what you want to achieve. For many projects, the GPL is certainly suitable (given the caveat of the perverted definition of “freedom”), or arguably even essential (e.g. in my opinion, the Linux kernel). For some other purposes the GPL will forever limit the audience of the code and hinder its adoption, as commercial entities often don’t want to touch GPL code, whereas they are less reserved in their adoption of Public Domain, MIT, BSD, Apache, or similarly licensed code. (Even MSIE contains, according to its About dialog box, code from the original Mosaic browser.) Some real-world examples of this are the sqlite and OpenOffice projects, the former being Public Domain and the latter using the LGPL. (In my humble opinion, the LGPL was a perfect choice for OpenOffice, allowing the unrestricted creation of plugins without forcing plugin developers to conform to OO’s license.)
If there’s anyone out there who can explain to me how GNU’s definition of Freedom really is aligned with the common definition of the word, I would love to hear it. For those interested in flame wars, feel free to flame, but I won’t be drawn in to them.
:-D
Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^