Archive for the 'Code' Category
01/14 99 Lisp Prolog Erlang problems
Since I have been lapsing in my Erlang practice, I am playing with L-99: Ninety-Nine Lisp Problems, based on a Prolog problem list – which is fitting, since the first Erlang interpreter was written in Prolog…
I’ll post links to my solutions when I have enough – I have done P01 to P20, with the exception of P13. Feels good to get back in the groove…
Update
I posted some sample code in the comments, but here is a permanent link to the source code.
11/23 Woops
> How can I write a regexp to match CJK characters?
> Thanks in advance:)print “Yes!” if varname =~ /^CJK$/
Needless to say the helpful(?) dude providing the unhelpful regex/ruby code was a proud citizen of ASCII-land… Mwahahaha!
11/08 Protecting your comments with captcha
One of the ways of protecting one’s blog comments from spammers is to add a captcha functionality: it displays a distorted image of a word – or at least of a few letters. This is supposed to prevent automated spamming programmes to drown your site with spam. Ah well, it’s not going to last forever. See this RentACoder Bid:
I have a program that will display an image with letters on it, i need you to type these letters into the textbox on the program and press enter each time to submit the image with the text you typed. After you submit the text, a new image will show, keep doing this over and over.The images and letters recorded will be saved to my database to train an OCR algorithm i’m working on, it needs atleast 5,000 images deciphered. I don’t have the time to do this my self, this is where you come in.
NOTE: You must have a fairly FAST connection or it will take you a long time to do 5,000. If your really fast it should take you one second to submit one image with atleast 5 letters on it. If you have a SLOW connection, it will take twice or three times as long!
If you bid on this and cannot finish 5,000 images in 2 days, I will only extend the dedline under extenuating circumstances. If you have a slow internet connection, you will not be able to complete this project within 2 days. If you have a DSL/Cable Modem it will take you 1-5 hours. If you have anything slower (not recommended) it will take you 2 days non stop to finish this. Keep this in mind before bidding!
PLEASE POST YOU’RE INTERNET CONNECTION WITH YOUR BID REQUEST. Your internet connection will determine whether I pick you and whether I will give you a bonus when the project is done.
Good Luck!
Basically this dude wants to recruit low-cost web monkeys who will enter the answer to 5,000 captchas. Whether the thing behind this is really an OCR application or whether it’ll compute hashes of the image and associate that to the answer is debatable. Nonetheless, it shows that captchas – beside the obvious accessibility issue – are not going to last as a solution to spamming. I’ll sit in my corner of the web and look out for the next thing
08/21 mb update
I have decided that the only way to make mb faster was to change the underlying structure from {Encoding::atom(), String::list()} to {Encoding::atom(), String::binary()}. Which implied a thorough overhaul of the code. I am almost done, although still fighting with some issues. Still, preliminary tests tend to show that the change was worthwile: mb:reset() – the creation of the encodings-related text files into dets tables – is easily faster by half. Only one test in the test suite passes so far, and it too executes quite faster than the original.
As a side note, I have discovered something puzzling. Say you have a variable Code1 which contains the integer value 0×2121. I was expecting that doing <<Code1>> would yield <<33,33>>. Nopesky. It yields <<”!”>>. You have to do <<Code1:16>> – and hope the integer is not greater than 65535: if your integer was, say, 0×012345, <<Code1:16>> would yield <<35,69>>. Ah well…
I am maintaining the source code with git. It is quite pleasant to use, although I have yet to manage to push the repository correctly to the public repository. So nothing is published yet, except partial docs. MNK, who gave me a FreeBSD jail to play with, and is hosting the whole thing, is playing with a git to mercurial bridge. We’ll probably have one day a <your_scm> to mb repository bridge. Maybe.


