Adam wanted a spellchecker for his new blog without paying for it. I outlined a possible solution:
if you want to do it with writing as little code as possible then you
will want to do it in Bash where you have "spell" and "cat" already. www.cygwin.com
however, if you want to do it in the easiest way for you possible perhaps an
ASP page on your local machine that you fill in the details on which spell
checks against the attached dictionary file offering both a preview with
highlighted possible spelling mistakes
The spell check is just:
' remove all punctuation symbols with Replace
' replace all whitespace chars with spaces
' recursively replace 2 spaces with one space (this step may be unnecessary)
' split on space and compare each var in resulting array with file (contents
' of which are in memory - its just an InStr(vbCrLf & strWord & CrLf, strDict)
' warning: dict file may be newlines only not CRLF
Or better yet get the words with a regex (supported in IIS5) along the lines
]* and then cycle through the matches.
So program flow is like this:
Big text box with Preview and BlogIt buttons
Preview => Show text from box with possible spelling mistakes in red
and box appears below for editing with Preview and BlogIt buttons
BlogIt => Force it through to submit page of blogspot.
And while he messed with how to get the spellchecked story to post from his local machine to his blog I wrote it (in ASP).
Then it turns out that the blogger API is for XML-RPC which ASP can’t do (easily). So he wants me to rewrite, preferably in PHP which is what he has the submission stuff in.
I had never written any PHP before but I did the conversion which apart from a few sticking points was very easy (JSP/ASP/PHP are very very similar in the fundamentals).
The code shortened to 298 lines (from 363) and no longer requires an external sorting library as there is one built in to PHP.
Part of this reduction in size was due to the inlining of the ExtractWords function as with PHP’s regular expression support (just like Perl’s) it was a two-liner.
BUT there is no equivalent of
Option Explicit in PHP! The best you can do is set ERROR_ALL in php.ini which is not the same thing at all. I must be overlooking something but I can’t find information about it anywhere on the web.
I still have some kind of problem with escaped apostrophes (PHP’sbastard hack called magic_quotes which I was happier not to know about) and the sorting is irrelevant because the algorithm does not take advantage of it and stop searching the dictionary when there is no longer any chance the word is in there (for that matter the dictionary isn’t sorted either!)
Finally I get a solution to my missing get_aspx_ver.aspx 404 and alert email:
"VS.NET looks for this file if it needs to determine what version of the framework you’re using. Since it doesn’t care about the contents of the page, it just looks in the headers and ignores the Internal 500 message. — The file doesn’t exist, but VS has to call *something* to get a response header."
"It’s not actually a problem, it’s “supposed to work that way”. Heh whatever. It’s still a pain. Suggested workarounds from Microsoft include changing your error handler to ignore calls to the file or to just create an empty one."
Inspired by googlefight.com I’ve written a little Java screen-scraper that tells you how many jobs a certain keyword or combination of keywords finds on jobserve.com (IT jobs section only) and scheduled it to run every night at 3am.
Here’s the number of jobs for a given programming language or keyword.
Seeing as nowhere on the internet can I find an explanation of this error I thought I’d share the fruits of my long search for this bug.
It means (at least in my case) that you are accessing a web service with SOAP and passing a SOAPAction parameter in the HTTP request that does not match what the service is expecting.
I got in a pickle because we moved a web service from one server to another and thus I changed the “namespace” (don’t get confused between web service namespaces and .net namespaces) in the calling C# file to match the new server. But the server doesn’t care about the actual web reality of http://yournamespace.com/blah it only cares that you send it what you have said you are expecting on the server. It doesn’t care if there’s actually anything there or not.
So basically the web service was moved from http://foo.com/servicename to http://bar.com/servicename but the “namespace” of the web service stayed as http://foo.com/servicename because no one changed it.
And that only took about 4 hours to work out!
If you’re having a similar problem but can’t work what I’m saying here, feel free to mail me on email@example.com – I wouldn’t wish my four hours on anyone!
Had to take over a medium-size ASP.NET application at work and so I’m writing unit tests in the excellent, idiomatically translated NUnit, a port of the brilliant JUnit. I’m using Visual Studio 2003 and thus framework 1.1 which means I needed this fix to use NUnit with .Net framework 1.1
My MSc involves a lot of greek letters for representation in mathematical and pseudo-mathematical proofs and formulas. Apart from alpha, beta, pi and sigma I don’t know any of them so I’ve made myself a crib sheet and online test so I can learn them.
“WASTE is a software product and protocol that enables secure distributed communication for small (on the order of 10-50 nodes) trusted groups of users.“
“WASTE is designed to enable small companies and small teams within larger companies to easily communicate and collaborate in a secure and efficient fashion, independent of physical network topology.”
WASTE also seems to have created a permanent rift between programmer Justin Frankel (one of the authors of WinAmp and his employer Nullsoft (owned by AOL Time Warner) who pulled it. Here is my mirror of WASTE
I’m not making a big anti-war stand or anything but I liked this picture. (Found on a freesite on freenet that is something to do with OneArmedBlackLesbianSingleMothersForJesus.com)
This is old news now really but Morrissey’s new songs that he performed on last year’s tour were fantastic. In order: The First of the Gang to Die, The World is Full of Crashing Bores, I Like You, Irish Heart English Blood, Mexico. If you’re having trouble getting hold of mp3s, let me know: firstname.lastname@example.org
First of the Gang to Die lyrics and mp3
He hasn’t had an email address since 1990 and he wrote one of the 12 most significant scientific monographs of the 20th century. He rules.
This isn’t news but in case you haven’t seen it here is the classic Knuth (Ka-NOOTH) quote:
On March 22, 1977, as I was drafting Section 7.1 of The Art of Computer Programming, I read four papers by Peter van Emde Boas that turned out to be more appropriate for Chapter 8 than Chapter 7. I wrote a five-page memo entitled “Notes on the van Emde Boas construction of priority deques: An instructive use of recursion,” and sent it to Peter on March 29 (with copies also to Bob Tarjan and John Hopcroft). The final sentence was this: “Beware of bugs in the above code; I have only proved it correct, not tried it.”