just another web log

18 Dec 2014:
How to cheat at regex crosswords
So what were those tricky Regular Expressions I spoke of last time?


Which offers clues as regex, its great fun. I had tried a while ago but not bother to saved my score, this time I wanted to log in and conqueror all the puzzles.

I got 42 in before I hit a road block. The puzzles had become steadily harder, for instance, masking a 'O'(oh) as a '0'(zero) in a number 2014(2O14). Other tricks included making out a clue was important but giving it the meta-character of *(match 0 or more occurrences) or ?(match 1 or more occurrences) and then opting for the 0 part of those matches. Essentially making them irrelevant.

What was really frustrating with the later puzzles was the fact that when you validate your answer you get no feedback other than it was wrong, no indication what row or column needs attention.

"If in doubt cheat"

Well, it's not really cheating just offering a helping hand.

I viewed the source code of the http://regexcrossword.com/js/libs-48b2489b.js file and used Chromes tools to "Prettify" it then I saved it to my local machine and set fiddler up with an autoresponder rule for

pointing at my local copy of the file. Then I found where the regex test where made and inserted
console.log('/^'+t[i] + '$/.test("' + e + '") ' + (n = new RegExp("^" + t[i] + "$"), n.test(e)) );

line 13766

This meant that when I validated a puzzle all the regex up until a failing one would be displayed.

Joke is, I used this on two of the Volapk puzzles and no more!

Now I need to see about this ultimate regex crossword...
18 Dec 2014:
Demystifying the prime number regular expression
I was discussing some tricky Regular Expressions with a colleague when it was mentioned that Regular Expressions could be used to find prime numbers.

A quick Google found http://vijucat.wordpress.com/2013/12/21/a-regular-expression-to-match-prime-numbers/
but I was disappointed to find the explanation wanting...

A Prime Number is a simply a number that can only be divided by itself and one. So 3 is a prime number as is 17 but 15 is not.

The following practical demonstration using the magic Regular Expression...

String.prototype.pad = function(input, length) {
    var result = this;
    while (result.length < length)
        result = input + result;
    return result;

var char = "+";
for (var i=1;i<=32;i++) {
                var value = char.pad(char,i);
                console.log((i+"").pad("0",2) + ' ' + value + ' ' + /^(?!(..+)\1+$)/.test(value));

01 + true
02 ++ true
03 +++ true
04 ++++ false
05 +++++ true
06 ++++++ false
07 +++++++ true
08 ++++++++ false
09 +++++++++ false
10 ++++++++++ false
11 +++++++++++ true
12 ++++++++++++ false
13 +++++++++++++ true
14 ++++++++++++++ false
15 +++++++++++++++ false
16 ++++++++++++++++ false
17 +++++++++++++++++ true
18 ++++++++++++++++++ false
19 +++++++++++++++++++ true
20 ++++++++++++++++++++ false
21 +++++++++++++++++++++ false
22 ++++++++++++++++++++++ false
23 +++++++++++++++++++++++ true
24 ++++++++++++++++++++++++ false
25 +++++++++++++++++++++++++ false
26 ++++++++++++++++++++++++++ false
27 +++++++++++++++++++++++++++ false
28 ++++++++++++++++++++++++++++ false
29 +++++++++++++++++++++++++++++ true
30 ++++++++++++++++++++++++++++++ false
31 +++++++++++++++++++++++++++++++ true
32 ++++++++++++++++++++++++++++++++ false

And now you can clearly see that the nature of the found prime number is in fact the length of the string tested by the Regular Expression.

More regex fun next time.
16 Dec 2014:
motioning the raspberry pi camera into dropbox
The key premise for setting up my Raspberry Pi camera last time was to catch bad guys and I went out of my way to store the captured images on an FTP server. This way if the machine is taken I still have the images.

Problem being I had to constantly monitor the FTP server and download any images to see them. Not to mention I was restricted by disk space on that server. I needed a better solution.

What I found was a great article at rasp.tv about setting up a Dropbox app that could write files from the Pi.

It is fairly straight forward, log in to your Dropbox account, visit the developers pages and create an entry for a new application that has file access and copy down the secret keys. Then install a bash script from https://github.com/andreafabrizi/Dropbox-Uploader and enter the keys.

Now a simple command will upload files from the Pi to your Dropbox account.

Edit the motion.conf and change the "on_picture_save" line to be
on_picture_save /home/pi/dropbox/Dropbox-Uploader/dropbox_uploader.sh -f /home/pi/.dropbox_uploader upload %f %f && rm %f
Note the path to script and the fact I remove(rm) the file if the upload is successfully(&&)

I also found I wanted the photos to appear in a different folder for each day.
jpeg_filename %Y%m%d/%H%M%S-%q%v
ensures the year(%Y) followed by the month(%m) and day(%d) make up the folder name which the Dropbox-Uploader script creates recursively for me.

Now on my Android phone I can view the days thumbnails and delete at will.

FYI if you get motion crashing with
[0] Motion thread 1 restart
[1] Thread 1 started
[0] Thread 1 - Watchdog timeout, trying to do a graceful restart
[0] Thread 1 - Watchdog timeout, did NOT restart graceful,killing it!
[0] Motion thread 1 restart
[0] Motion thread 1 restart
[0] Motion thread 1 restart
[0] Motion thread 1 restart

a quick
sudo apt-get update -y
sudo apt-get upgrade -y
sudo rpi-update
sudo shutdown -r now

will fix it

07 Dec 2014:
wacky wuaki denies free account unless accompanied by parent company
It turns out my mobile provider http://www.orange.co.uk is now owned by http://ee.co.uk/
Nothing much has changed since they took ownership other than a large amount of spam texts that i cannot refuse because there are from the carrier. But yesterday they sent one I was interested in. "Here's a Christmas treat on us. Pick a film rental from Wuaki to watch."

I had never heard of http://wuaki.tv/ before so my first task was finding out how legit they were and what I need to install to use their service. Seems OK except for the name so all I need to do is register ...

So I fill in the "Register new account" and after failing to accept a decent password, which hints to no hashing in the database [BIG FROWN] it said the usual "We have sent a confrimation email, please follow the instructions to validate ... blah blah". So I wait ...
and wait ...
No email. The website has a FAQ that shows how to get the registration email sent again, do that and email appears a few minutes later. It only has one "click here to continue" link but ...


Odd, try copying and pasting link 404. Try fiddling the URL to have more or less in the path, strip any extra unneeded bits.


Follow the "resend registration" email again ... wait. Eventually the email arrives and its a different link but, you guessed it


Previously perusing their FAQ I noticed that keep mentioning a parent company http://www.rakuten.com/ and that accounts could be reused.

So off I go to http://www.rakuten.com/ and create an account, even better no registration email!!


Not so quick cannot log in to http://wuaki.tv/. Scratch head and try again 10 minutes later and ...


Now we have watched "Guardians of the Galaxy" and everyone is happy!
loading results, please wait loading animateloading animateloading animate
[More tags]
rss feed



flog archives

Disclaimer: This page is by me for me, if you are not me then please be aware of the following
I am not responsible for anything that works or does not work including files and pages made available at www.jumpstation.co.uk I am also not responsible for any information(or what you or others do with it) available at www.jumpstation.co.uk In fact I'm not responsible for anything ever, so there!

[Pay4Foss banner long]