Older blog entries for eMBee (starting at number 2)

RosettaCode vs Stack Overflow

Stack Overflow is a great site. Every time when a search on a problem takes me there i look forward to the helpful and insightful answers. In ways, posting a question on Stack Overflow is similar to creating a task on RosettaCode.

On Stack Overflow a problem gets posted in form of a question, and people attempt to solve the problem by answering it. Question and answers can be discussed and updated. Once the poster of the question is satisfied, an answer may be chosen as being accepted.

On RosettaCode a problem gets posted in form of a Draft Task and people attempt to solve the problem by creating an implementation in their favorite language. Task and implementations may be discussed and revised until a consensus is found. Once discussion stabilizes and people focus on implementing, the task may be promoted from Draft Task to Task status

The key difference is that the questions and answers on Stack Overflow can be of various qualities. There are lots of duplicates, and not always are the answers useful. On RosettaCode on the other hand the poster is motivated to solve the Task her or himself. Also the goal of all Tasks is to produce a usable implementation, and the discussion does not end when an answer is accepted by the poster but it continues until a consensus for an acceptable task definition is found. And then after that the Task stays active as long as new solutions in different languages get added. Also RosettaCode gets referenced frequently in Stack Overflow discussions

On RosettaCode people are not motivated to answer by getting points but because the answer helps shape the Task and thus ultimately the quality of the whole site. They take ownership of the task by providing their implementation. They don't want to help a fellow with a question but produce something of lasting benefit for all future visitors of the site.

As Stack Overflow grows, it will be harder and harder to sift through all the questions to find the right answer, whereas the growth of RosettaCode will lead to a library of problems and solutions where one can find practical code examples that have a clear relationship to the question (the Task) with several complete implementations that allow for analysis and comparison.

When i have a problem to solve i try to see if it is generic and interesting enough for RosettaCode. Then i formulate a Task, and make an attempt at solving it myself. The discussion often helps me to identify problems that i had not foreseen, edge cases, and different approaches. Every new task includes a lot of learning and goes beyond just solving the immediate problem.

I don't know if the creator of RosettaCode had this kind of use in mind, but i hope he can see the value of this approach. And it is not only new Tasks that get created this way, but also solutions to existing Tasks too. Just in the past week i found three Tasks that were directly applicable to problems i am currently solving. And one of the Tasks motivated me to produce a generic solution to a problem that i had solved in an adhoc manner before.

By using RosettaCode i am not just solving problems for myself, but i help generate solutions that are useful for other people too.

Syndicated 2012-01-09 17:58:55 from DevLog

a replacement for the cal commandline tool in pike

cal is a commandline tool to display a monthly or yearly calendar. It's convenient to use for lookup when there is no gui at hand.

It has a few limitations and irritations however. The most annoying one is that whenever i want to display a different month i have to enter a year as well. If you enter cal 2 it will display the year number 2, and not the month that i'd expect.

This pike version of cal fixes that. If you enter a number small enough to be a month then it will display the corresponding month of the current year.

The pike version has other features too. Thanks to pikes extensive calendar support, cal.pike can handle calendars other than the gregorian calendar. You can see a list of supported calendars in the pike module reference. To use a different calendar, just enter the name of the calendar as a first argument. The only calender from that list that doesn't work is Stardate because that doesn't have any months.

Further, motivated by this calendar task on rosettacode.org i have added support for varying terminal sizes. The program will check the calendar in an optimal with for the terminal. For a calendar with 12 months this means it will either fit as 2x6, 3x4, 4x3 or 6x2 rows and columns. The pike version for that task is btw only the year display. Support for showing a month and other stuff has been removed.

Other features: pikes calendar system supports events to mark holidays. Days that fall on an event are displayed in green. It is possible to choose events by region.

cal.pike is available under the GNU GPL v3. You can download it here

Syndicated 2012-01-05 16:35:06 from DevLog

use rosettacode.org to learn programming in pike

A few months ago i discovered rosettacode.org, a website where various programming tasks are implemented in many different languages.

rosettacode is not only useful to compare languages, but also to learn new ones. You can see how a problem solved in a language that you know, looks like in the language you are learning. Or you can try to implement it in that new language, using the existing implementations as a reference.

For me to learn a new language, i need to be able to do something useful with it. Simply taking a book and doing exercises that are thrown away is not very motivational.

But doing the same kind of exercises on rosettacode is quite different, because the result is useful to those who want to use the solution for comparisons.

Solving tasks on rosettacode of course only works with tasks that are not already solved in your target language. But that is not usually a problem because no single language on rosettacode has all tasks solved. And there are new tasks every week.

For pike there are still a few hundreds of tasks unsolved, ranging from trivial to very hard. So there is something for every level. And don't fear of making a mistake. Your solutions will be reviewed by others, and corrected or discussed if necessary.

If solving existing tasks does not satisfy you, you can also make up new tasks.

Writing tasks can be fun and challenging. But again, no fear. Others will add appropriate questions and point out where your task is unclear or could be improved. That alone is a great learning experience. Then providing your implementation and comparing it with the solutions others come up with is educational. Some people may come up with an approach that you have not thought of, giving you further insight into the problem, and may even cause you to adapt your own solution.

In summary, whether you are completely new to pike or an experienced developer, rosettacode is a place where you can improve your skills, contribute to others learning experience, and show off pikes unique features. I hope you will join me in increasing pikes presence on the site.

Syndicated 2011-12-25 15:02:33 from DevLog

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!