jump to navigation

Recaptcha for Seaside 5-Jan-09

Posted by laza in Smalltalk.
Tags: , , , , , ,
add a comment

Recaptcha for SeasideA captcha is mechanism to prevent scripts and bots to spread spam, create fake votes or accounts. For this a captcha presents some kind of distorted text, which should be easy to read and reenter for any human, but should be hard to be deciphered by common OCR-Software. An implementation of such a method is reCAPTCHA from the Carnegie Mellon University. It uses images of text out of scanned books, which an OCR program failed to read. So in addition to stop spam, every solved reCAPTCHA challenge helps also to proof read the text out of scanned books. This captcha also can offer a sound stream of spoken digits for visually impaired users. You can read about the details here at the homepage of the reCAPTCHA project.

If you want to use reCAPTCHA in your project you could try a Seaside 2.9 component I did. You can find the package BowWave-Recaptcha in a SqueakSource repository called (surprise) BowWave. After you loaded the latest version in a Seaside 2.9 image (I didn’t check with Pharo though. Or VisualWorks. Or GemStone. Or GNU Smalltalk), you can use it as a Seaside component inside a form. But at first you will only see the following instead of the reCAPTCHA Box:

Missing configuration for recaptcha component

You have to add a reCAPTCHA configuration to your root component.

Add a reCAPTCHA configuration to the root component

Add a reCAPTCHA configuration to the root component

Now you will see two more configuration options under the group Recaptcha.

required reCAPTCHA configuration

required reCAPTCHA configuration

To get your own private and public key, you have to get an account at reCAPTCHA. There you have to add a domain you want the reCAPTCHA to be used for.

Keys from reCAPTCHA website

Keys from reCAPTCHA website

Now the reCAPTCHA Box should appear in your form as a component. Now you should ask if the captcha was answered correctly in some callback on submission of your form.

So let’s assume you created a callback with a submit button in your renderContentOn: method. (There is only one child, the captcha component in that instance variable)-

renderContentOn: html
  html form: [
    "... some other form elements ..."
    html render: captcha.
    html submitButton
      callback: [ self submitComment ];
      value: 'Submit Comment']

submitComment
  (self checkInput and: [captcha verify])
    ifTrue: ["Everything is fine"]

Voilà! That’s it.

On my Seaside demoserver is a rudimentary comment/reply component, which uses reCAPTCHA.

This is the first shot at it, so handle it with care and … ah … well … leave a comment. :D

Seaside Poll 31-Dec-08

Posted by laza in Smalltalk.
Tags: , , , , , ,
add a comment

Seaside 2.9 alpha 2 announced 30-Dec-08

Posted by laza in Smalltalk.
Tags: , , , , ,
add a comment

The second alpha release of Seaside 2.9 was announced today. This release mainly contains fixes for critical issues reported to the Seaside bug tracker and features a brand new Seaside builder. This is a convenient way to create taylored load scripts for various flavours of Seaside 2.9.

Choices for the Seaside Builder

Choices presented by the Seaside Builder

There have been also some fixes to JQuery “The Write Less, Do More, JavaScript Library”, which became a new part of Seaside 2.9.

JQuery for Seaside

JQuery for Seaside

So head over to my Seasidemo or use the Seaside Builder to have a look at the new stuff.

Update: I forgot to mention the new Seaside Control Panel. It nicely lets you start and stop different Seaside Servers running in one Smalltalk image.

Seaside Control Panel

Seaside Control Panel

Squeak in Jail 16-Dec-08

Posted by laza in Linux, Smalltalk.
Tags: , , , , , ,
add a comment

One of the best things in Smalltalk or Squeak is the fact that there are almost no artificial barriers and you are free to explore. In a local environment, like on your laptop, there is not much to worry about. But if you use Squeak as a server and expose it to the world, like when you run a Seaside server, then you would like to have at least one high barrier that protects yourself from misuse.

What follows is my experience in setting up a restricted environment (chroot) on a linux box to run a Squeak server. (more…)

Slick SUnit test progress display 28-Feb-08

Posted by laza in Linux, Misc, Smalltalk.
Tags: , , , ,
add a comment

In VisualWorks is a Cairo addition to the SUnitToo(ls) package(s). This shows a very slick progress bar while the unit tests are being processed. Here you can see a few Unit Tests on a very early seesmic API implementation.

Seesmic numbers via the API 22-Feb-08

Posted by laza in Misc, Smalltalk.
Tags: , ,
6 comments

Lately there has been a thread on seesmic about numbers in and around seesmic. There is also seesmic café episode 85 which presents additional numbers. I had some fun using the seesmic API and providing even more numbers.

Looking at about 40.000 of the latest videos posted on seesmic (during about a month):

English is the seesmic language

All in all ten different languages have been used. Not specified are all those videos from YouTube or qik. English dominates with 78%. This won’t come as a real surprise. Also not French being on the second place with 16%, because of the origin of the seesmic founders. Spanish is on the third place with under 1.5%. So far I think the order matches the overall distribution of spoken languages. Now let’s have a closer look at the remaining languages below 1%.

72 out of 40000 (0.18%) had been recorded in german followed by 43 italian, 31 japanese, 15 dutch, 13 chinese, 4 russian and 3 korean.

Thursday is the seesmic day

People don’t seem to like mondays.

Freida is the top seesmic user

The 40000 videos were posted by 1280 different users. Freida was the single user that posted the most videos, namely 1562. That are about 3-4 videos per hour constantly over a period of a month (assuming 8 hours of sleep per day).

Now how hard was it to get those numbers. It was very straight forward to have some implementation in Smalltalk to use the seesmic API. As an example the following snippet fetches information about the latest 50 videos on seesmic:

| session videos languages |
session := SMICSession username: ‘user’ password: ‘pwd’.
videos := session videolistMax: 50.

Doing the statistics is also very easy in Smalltalk:

"include above code here"
languages := Bag new.
videos do: [:video | languages add: video language].
Transcript show: languages sortedCounts.

Now instead of just showing the numbers of language distribution on the Transcript it is also easy to generate a URL that uses the Google graph API and produces above nice graphs.

Squeak on Lab with Leo 20-Feb-08

Posted by laza in Linux, Smalltalk.
Tags: , , ,
5 comments

In episode 149 Randal L. Schwartz talks with Leo about Squeak. He shows Squeak, OLPC and EToys. Although it is a fun story where the name Squeak comes from, I guess it is as true as the other rumors about the name.

Squeak Image Popularity 12-Dec-07

Posted by laza in Linux, Smalltalk.
Tags: , ,
add a comment

Debian users can take part in a so called popularity contest, reporting back which packages are installed on their systems. Squeak is not yet part of Debian, but there are Debian packages for squeak and so they show up in the statistics. Here is a diagram of the current distribution of Squeak image packages.

Squeak Image Popularity

Ubuntu has Squeak packages based on 3.8:

Ubuntu Image Popularity

Last Squeak BOF Video uploaded 13-Nov-07

Posted by laza in Smalltalk.
Tags: , , , ,
2 comments

I finally managed to upload a reduced version of the last video from the Squeak BOF at OOPSLA by Göran Krampe. Here Dan Ingalls and Krzysztof Palacz talk about the Lively Kernel.

Squeak BOF OOPSLA Videos 28-Oct-07

Posted by laza in Smalltalk.
Tags: , , ,
add a comment

Göran Krampe published a series of three videos from the Squeak BOF at OOPSLA ‘07. The videos are quite large and only accessible via bittorrent. Thanks to avidemux, here is a version of the first video (and the second one):