background preloader

Hacks

Facebook Twitter

Wordpress

OCR and Neural Nets in JavaScript. A pretty amazing piece of JavaScript dropped yesterday and it’s going to take a little bit to digest it all.

OCR and Neural Nets in JavaScript

It’s a GreaseMonkey script, written by ‘Shaun Friedle‘, that automatically solves captchas provided by the site Megaupload. There’s a demo online if you wish to give it a spin. Now, the captchas provided by the site aren’t very “hard” to solve (in fact, they’re downright bad – some examples are below): But there are many interesting parts here: The HTML 5 Canvas getImageData API is used to get at the pixel data from the Captcha image. If we crack open the source code we can see how it works. The first step is pretty clear: The captcha is copied into the canvas and then converted to grayscale. The canvas is then broken apart into three separate pixel matrices – each containing an individual character (this is quite easy to do – since each character is a separate color, they’re broken apart just based upon the different colors used). So – after all this work, what do we have? Selective Expandable posts. Translations by other bloggers: Chinese, Thai Earlier, I had announced Peekaboo posts which shows post summaries in main page and expands them in the main page itself.

Selective Expandable posts

But, some people would still like to use the classic way of expanding posts which takes the reader to the post page upon clicking "Read more" link. One of them asked me how to display the "read more" link only for some long posts and not others. I gave him a combination of peekaboo and non-peekaboo code that serves this purpose. As I started getting more such requests, I thought I will post the code for everyone who wants to use.

Tag in your template and add all the code from this page before it. 2. 3. Type your summary here<span id="fullpost">Type rest of the post here</span> If you create a new post now, it shows you clearly where to type the summary and where to add the rest of the post. Note 1: If you are not able to find the lines to change, you may not have expanded the template. Hoctro&#039;s Place. Expandable posts with Peekaboo view. Translations by other bloggers: Spanish, Indonesian, Chinese, Malaysian Your blog's main page usually shows the entire content of each post.

Expandable posts with Peekaboo view

If your posts are usually more than 2 paragraphs, then your visitor will find it difficult to quickly find the topic of interest to him because he needs to scroll down a lot. This is where expandable post summaries helped in the old Blogger. This hack serves the same purpose for the new Blogger and more! That is, main page will show only post summaries and when you click "Read more", the full post appears in the main page itself (Peekaboo view)!!

Step 1: Find the tag in your template and add all the code from this page before it. Step 2: Find the includable called 'post' and copy/paste the changes highlighted in red in this page (Be very careful and avoid mistakes. Step 3. Type your summary here<span id="fullpost">Type rest of the post here</span> [If you are visiting my blog for the first time, don't miss these other nice things I offer:1.