Thoughts and things.
I'd like to start writing more, hopefully in a way that encourages others to respond, so I've started writing on Medium.
You're much more likely to find things there than here!
cherry valley forever
untitled

tannertan36
Fai_Ryy

roma★
trying on a metaphor

@theartofmadeline

titsay

❣ Chile in a Photography ❣
official daine visual archive
🩵 avery cochrane 🩵

Discoholic 🪩
todays bird

gracie abrams
Claire Keane

pixel skylines
macklin celebrini has autism
$LAYYYTER

if i look back, i am lost
Aqua Utopia|海の底で記憶を紡ぐ
seen from Bangladesh
seen from Chile
seen from United States

seen from Greece
seen from Bangladesh

seen from Germany

seen from Italy

seen from Argentina

seen from Thailand
seen from Argentina
seen from United States

seen from France
seen from Bangladesh
seen from Malaysia
seen from United Kingdom
seen from United States
seen from United States

seen from Colombia
seen from Chile

seen from United States
@jphastings
Thoughts and things.
I'd like to start writing more, hopefully in a way that encourages others to respond, so I've started writing on Medium.
You're much more likely to find things there than here!

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Thoughts on Twitter as a Weapon
My brother just showed me to "an interesting news story" - it really is.
Mr. Syed won't be the first person to use advertising space to get eyeballs on a private grievance (though you can argue this one has public appeal too), but before the dawn of promoted messages on social media this method of being heard cost serious money; I think the decreasing cost and general availability of releasing weighty negative advertisements is a serious potential problem.
The parallel Ms Wakefield draws with David & Goliath in her article is apt - Goliath isn't tech-savvy enough to use a targeted weapon like David and the damage is done before Goliath gets a chance to respond. My concern arises when I imagine a world where self-righteous Davids attack Goliaths in preference to more amiable methods of solving the problem; Goliaths will find this very difficult to defend against, as every person - David or otherwise - who they raise a shield at is a potential customer seeing a less compelling service.
Mr. Syed tells the BBC that he turned to promoted tweets after being frustrated at the lack of a suitable response from the usual complaint channels, this I applaud. It's clever, targeted and doesn't appear (too?) vindictive (we've all been down the poor customer service route with a Goliath before) so here's to hoping we, as Davids with a newly publicised anti-Goliath weapon, can keep ourselves from becoming too aggressive.
The Extra Mile
I'm not sure whether it was the company or the lovely lady who looked after me (or both), but Optical Express have surprised me this afternoon with a personal touch uncharacteristic of busy London shops.
I asked how quickly I could have new prescription sunglasses made and she not only offered the company's standard 2-day turn around, but also offered that if I was prepared to deliver the frames to their lab/branch myself I's reduce that time by a day, as their intra-store delivered are every morning.
It may seem little, but this thinking-outside-the-system really impressed me. It'd be very simple to say "this is the process", but I've now delivered my glasses (a short 10 minute walk away), will receive my glasses sooner and, if they don't have any other glasses to pick up tomorrow, they've saved themselves a journey.
A lovely little win-win because of some attention and flexible thinking.
Bossman Greg has posted an thorough and readable rundown of REST design concepts. Well worth a read.
This was exactly what I was looking for.
If you're investingating JSON returned from a web service, get the control you need with the terminal and jsonpp:
brew install jsonpp curl -u username:password http://awesome.com/stuff.json | jsonpp
BOOM. As they say.

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Thoughts on Storing Passwords
Yesterday at work I was discussing the design of password databases with my boss. I don't claim to have any deep knowledge in the area, but we came out with the following structure which seems to have good inherent security as well as the possibility to improve that as technology improves.
What's stored
Password
Store: Password
Without going over password databases 101, you obviously should never store just a plaintext against an email address/username, as in the eventuality where your database is compromised — let's say Doctor Claw has stolen your database — anyone with that data can access anyone else's accounts. Bad times.
Hashed password
The simple solution is hashing the passwords using a one-way hash algorithm. You store HASH(password), and when the user wants to authenticate, you compare HASH(what_they_sent) against the stored HASH(password) and if they match then the passwords are the same[1].
Store: Password hash
The benefit here is that Doctor Claw now can't use the data he has to log in to anyone else's account. If he tries sending a hash from the stolen database to the site, the calculation performed will be HASH(the_hash_doctor_claw_sent) which will not match HASH(the_real_user_password).
The hash algorithm used can be one of many, MD5 is an old favourite, but it's considered insecure these days, and the same goes for SHA1. The current advice is to use SHA256, but this will undoubtedly change with time.
Salted hashed password
There's a cloud in our perfect passworded sky; storage is cheap and people in the real world often don't use complex passwords. Doctor Claw has done some pre-work and he's set a home computer off calculating the hashes of all the most popular passwords — he'd put this in a lookup specialised database called a rainbow table. He can now do a rapid lookup to see if any of the hashes in his stolen database match any in his rainbow table and will immediately know the original password for that user account.
Store: Salted password hash, Salt
The solution is simple, salt the password. To do this, when you're writing a password to your database you follow these steps:
Generate a salt by creating a random string of characters, like gZ7s(28d}"+
Concatenate the salt and the password before you hash them (you could append the salt, prepend it, or anything else repeatable).
Write the result of HASH(salt + password) to your database along with the salt you used.
Now when a legitimate user sends you the right password, you simply add the salt to it in the same way, hash it, and compare against your database. Doctor Claw on the other hand has to generate a rainbow table for each entry in the stolen database, and he doesn't necessarily know that the salt is prepended, appended or sprinkled around within the password. Doctor Claw's life grows harder…
Repeated hashing & derrived keys
Any technologically savvy person can see that available computing power is by no means static and Doctor Claw could potentially have created or bought himself use of a botnet to generate his rainbow tables, allowing him relatively speedy access to getting at your customer data yet again. So how can we tackle this one?
Store: Derrived key, salt, iterations
The one thing which is, within the forseeable technological future, always going to be true is that generating a hash takes time. Not necessarily much time, but it does (currently around the hundreds of microsecondsmark). The one thing which Doctor Claw here has always been interested in has been accessing accounts fairly quickly (on the order of days, not years or decades), so this is something we can use to our advantage.
Rather than storing just the hash of a salted password (1), we can store the hash of the salted hash of a salted password (2), or the hash of a salted hash of a salted hash of a salted password (3). With each additional salting and hashing we're increasing the amount of time it takes us to check a legitimate user's credentials, but also increasing the time it takes Doctor Claw to either brute force all possible passwords to their hashes, or generate a rainbow table.
If you salt and hash in the order of thousands of times for each password, it takes you around one second to authenticate that the password your legitimate user has sent you is correct or incorrect, but for Doctor Claw to reverse engineer or guess any user's password even from a complete password database will take in the order of millennia. Doctor Claw has been foiled again.
Your design could specify "we repeat hashing 1000 times", but this is a bit restrictive, as within 2 years computers may be quick enough that 1000 iterations may only take milliseconds rather than seconds, so it's worth considering storing the salt, the derrived key and the number of repetitions of hashing that has taken place to create that hash. This means that if you want to upgrade your database to take account of that new quantum processor that's just been released, you only need to set a program iterating through your database, reading the info, hashing another N times, and replacing the data with the new derrived key and the incremented value for 'iterations'.
It's important to note that if you were to always put the salt in the same position next to the hash before performing the next hash, it would be simple(ish) for Doctor Claw to create a rainbow table of all possible salt + hash combinations and skip all the hard work you've done iterating a large number of times, so it's a good idea to have your hashing being a function of the previous hash, the salt and the iteration number. A entirely unoptimised example of this would be:
function hashIt(string,salt,iterations) { if (iterations <= 1) { var hashThis = string; } else { var hashThis = hashIt(string,salt,iterations - 1); } // Split the salt at a predictable, non regular point var saltParts = salt.splitAtPosition(iterations % salt.length); // Do the hash return SHA256(saltParts[0] + hashThis + saltParts[1]); }
There are formalised methods for achieving this, like PBKDF2, to prevent the need to worry about small but important details like this.
Conclusion
Password databases require some serious thought (there are very likely to be angles of attack I haven't considered above too) but if you've avoided the traps I mentioned above then you're in reasonably good stead!
[1] There is a possibility that there would be a hash collision - because the hash is not a 1:1 mapping, it is a certainty that there are values for A and B such that HASH(A) == HASH(B), but by choosing the right hash algorithm this can be reduced to a statistical improbability.
Jenkins and Ruby
I was trying to integrate my Cucumber and RSpec tests with Jenkins earlier this week and came across a bunch of character encoding errors.
It took me a while to figure out the problem, essentially Jenkins loads a session without all your usual environment variables, so your PATH and LANG won't be set to the same as a terminal window, making the outcomes different.
My Jenkins executed shell script now looks like this, note the PATH and LANG exports!
export LANG=en_GB.UTF-8 export PATH=/Users/admin/.rvm/gems/ruby-1.9.3-p385/bin:/Users/admin/.rvm/gems/ruby-1.9.3-p385@global/bin:/Users/admin/.rvm/rubies/ruby-1.9.3-p385/bin:/Users/admin/.rvm/bin:/usr/local/bin:$PATH rvm use 1.9.3 --install --binary --fuzzy bundle install ruby --version gem --version rake spec rake features
It's a Good Day for this film to Die Hard
John McClane, a man who puts his job as a policeman above all else, is quickly brought to realise that he missing out on the finer things in life. Just as this sinks in, he discovers he is alone, caught behind enemy lines in an unlikely situation where his unique blend of don't-give-a-shit and in-your-face arrogance can aggravate "the baddie" to the point where they sideline their original plot in order to stop him instead. In doing this he buys enough time for: the baddies to thin themselves out (and be picked off), the reinforcements to arrive, and his ex-wife/partner/family member to appreciate his passion for his job. Cue credits: the baddies are foiled, family is closer; "Yippee-ki-yay mo fo". This is the plot of Die Hard, Die Hard 2: Die Harder, Die Hard: With A Vengence and Live Free or Die Hard. It works. It's not complicated—it doesn't need to be—it's a Die Hard film. My general point is: It is *not* a Good Day to Die Hard. One or two people do die, but not particularly hard. There is no 'behind enemy lines', there's little quick talking attitude to get our protagonists out of trouble (there's little talking at all), there isn't really a baddie to speak of, there's no plot (which the baddies are tying to complete; there's also no plot to the film), there's no "good man trying to do right by his own morals", there are no reinforcements, and in general **there is no tension**. The film starts with an extended action sequence which finishes an hour an half later, having given Bruce Willis enough time to catch his breath and say enough to allow him to call it a "speaking role". The clincher? (if one was needed) We do not watch Die Hard films for cerebral engagement, we watch for simple, enjoyable action with enough predictable moments for the secondary characters to shake their heads at each other, chuckle, and say "That John McClane, always getting into trouble." - this film misses that by such a margin as to be completely unfollowable, forgettable and, frankly, irritating. The words "Yippee-ki-yay" don't even pass Bruce's lips. Do not waste your time with the so-called "5th" Die Hard film. It never existed.
mini_magick and Apache Passenger
A note out there to anyone else having the same problem as me: If you're trying to use [mini_magick](https://github.com/minimagick/minimagick) in a ruby application being run via [Passenger](https://www.phusionpassenger.com/) on Mac OS X Mountain Lion's Apache2, when you've installed imagemagick via [Homebrew](http://mxcl.github.com/homebrew) - *mouthful* - then you may notice that that you get a Server Error when you try to process an image. This may be because the `PATH` variable Apache is supplying to your ruby instance doesn't have `/usr/local/bin` in it, which is where homebrew installs to. It seems that the `_www` user doesn't check the `/etc/paths` file for additions to the PATH variable, so you get squat. My solution is hacky, but it gets the job done. I have a file called `/etc/apache2/other/passenger.conf` which holds the details for the virtual hosts for my passenger apps. I added the `SetEnv` line at the top to force Apache to set the PATH variable correctly. It now looks something like this: SetEnv PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin ServerName my.rubyapp.com ServerAlias my.rubyapp.com DocumentRoot /var/www/myapp/public RackEnv production Order allow,deny Allow from all ErrorLog "/var/log/apache2/my.rubyapp.com_error-log" CustomLog "/var/log/apache2/my.rubyapp.com_access-log" common
dear jp, i already wrote you concerning this on vimeo: i work for an agency researching footage for a tv commercial. we like your fire night clip a lot, since we are looking for light trails made with fire. we would like to use up to 5 seconds. if you're not interested in this to begin with, please let me know anyway, if you have the time. thanks and cheers from Berlin, tom
Hey Tom, sorry I haven't gotten back to you! I don't use tumblr (or vimeo) so much anymore. You're welcome to use my clips, they're all Creative Commons BY-NC-SA, does that cover your needs?

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Speakable Web Links
A long time ago [benosteen wrote](http://benosteen.tumblr.com/post/465782940/thinking-about-making-a-url-shortener-which) that he'd link to make a URL shortener that creates speakable URLs. Looking back over this (hideously unkempt) blog I realised I finished building exactly this a few weeks back. Take a peek at [Iconic.im](http://iconic.im).
Crunch Boxes
After a quick support request from the Plex team I [mentioned](http://www.exquisitetweets.com/tweets?ids=27961963239.27962240192.27962528580.27962628615) how much I'd like a linux version of the Plex Media Server so I could look to getting it working on a [Drobo FS](http://www.drobo.com/products/drobo-fs.php). As the anonymous Plexian noted, the major issue with this would be the lack of power in Drobo's CPU for transcoding — you just wouldn't be able to live-stream videos to mobile devices from PMS running on embedded systems. With a bit of tinkering you can farm out data intensive tasks like this to more powerful processors, I suggested leveraging the power from a PMS on a traditional computer on the network, but it got me to thinking: Wouldn't it be cool if you could buy or create a totally headless computer which you could hook up to power and the network and would provide number crunching power to any application which needed it? My first thoughts would be to create/use a specific distro of linux. You'd create daemons for a few common place CPU intensive tasks (video transcoding for example) and, as the OS would be standard, any specific daemons could be pushed to the 'crunch box' to perform any other task. The major benefit of these, as far as I can see, is being able to have the grunt force for processing sleeping on your network, using minimal power, until it's required. I'm pretty conscious of how much power my iMac would use if I left it on just to funnel video to my iPhone via Plex while I'm travelling. So, for anyone reading this, do you think such a system could be created? Is there anything you would want included?
I had some time to kill on a lazy summer's day and I noticed that splendid chap [Max](http://twitter.com/mxcl), had [posed a question](http://twitter.com/mxcl/status/16838493726) to the lazy web: > Is there a tool for measuring profanity in code-bases? If not, can someone write it and call it "pottymouth"? Ta. So I did. If you know ruby then maybe to can help it be a little better, fork [the repo](http://github.com/jphastings/pottymouth) and see what you can do.
I built [Blinkers](http://toys.byJP.me/blinkers), a little greasemonkey script/Firefox extension that will prevent you from seeing your own Facebook news feed. Why? Because we all know it *eats time* and poops procrastination guilt. If you're still having difficulty avoiding the internets while you work, consider using my [DialUp](http://vimeo.com/9632924) application (or help me make it better!)
I've released [Thimblr](http://toys.byJP.me/thimblr) -- a tool to speed up your Tumblr theme development. Its a Ruby gem, so it's very simple to install, with `gem install Thimblr`, once that's done you just need to run `thimblr`, as a binary is installed for you with the gem. This screencast should help you with the basics, though I've designed it to be totally self explanatory, but if you have any problems please open an [issue on github](http://github.com/jphastings/thimblr/issues) and I'll get right on it! Please note, because I don't have a windows box to test on at the moment it just plain won't work at the moment. If anyone knows of a good place to store settings files etc. in windows then let me know and I'll get it working.

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
I finally got round to completing project prime, it's a collaborative artwork based on four of [my poems](http://poetry.byJP.me), Chapters [I](http://poetry.byJP.me/poem:chapteri), [II](http://poetry.byJP.me/poem:chapterii), [III](http://poetry.byJP.me/poem:chapteriii) and [IV](http://poetry.byJP.me/poem:chapteriv). Though these are, perhaps, uninspiring names they were chosen to allow readers (in particular the collaborative artists involved with this work) to form their own interpretations and impressions of the poetry. Over the course of several weeks 44 people submitted a little information about themselves and their impressions of each of the pieces. Each person is represented in the artwork below by a coloured shape. Each shape's centre is placed on the canvas according to their age, with older people towards the right, and the first people to collaborate nearer the bottom. The colour of the shape shows their preference towards each poem the stronger the primary colour the more they liked that poem; red for Chapter II, green for Chapter III and blue for Chapter IV. Chapter I has is preference shown by transparency, the faster a shape pulses the more it was liked by the person it represents. If you're interested in the code I used to generate the work, you can see it [in a gist on github](http://gist.github.com/gists/362995) -- I hope you enjoy it!
Sweet idea
Thinking about making a url-‘shortener’ which shortens urls if pronounced eg http://foo.bar/guid -> http://nowsay.it/waterwingflapjack
If he doesn't get on it soon I certainly will! URLs can be a real pain to speak.