Posts

Changing your Mac OSX Terminal's default text editor

For just this session, simply type: export EDITOR=emacs (or replace emacs with vim , nano or whatever) Personally, I like to use emacs on servers, but on my Mac TextWrangler is way more helpful. One of the great things about TextWrangler is that you can get it to magically pop edit requests out of the Terminal simply by installing it and typing "edit". To make all other programs use this method try: export EDITOR="edit -w" For a more permanent fix, add the same line to your .bashrc file. If you've not already got one of those, type: edit ~/.bashrc (The one exception is git, which you'll need to configure thus:) git config core.editor "edit -w"

Mobile Detection Script (Javascript redirect for iPhone / Android / Blackberry)

I struggled to find us a usable mobile javascript redirect - even StackOverflow's helpful crew were awash with geeky prejudice along the lines of "not all mobiles have javascript enabled"... Almost all of the modern web requires javascript to be on, and if you're a) one those geeks who has it switched off or b) have a pre-Android/iPhone/Blackberry handset then you can try your luck with the main non-mobile site anyway. So here goes - a short, quick, simple mobile detect + redirect script: /* Klik Mobile Detection Script */ function touchAndGo(where) {   var ua = navigator.userAgent.toLowerCase();   if (ua.search("iphone") > -1 ||  ua.search("ipod") > -1 ||  ua.search("android") > -1 ||  ua.search("blackberry") > -1 || screen.width <= 480) {     location.href=where;   } } touchAndGo("http://touch.mysite.com/");

Voice Memos Don't Sync To Your iTunes?

Lots of people with this problem, lots of RUBBISH advice from Google. Simply delete the PLAYLIST called "Voice Memos" from your iTunes (don't worry, your existing memos won't be deleted, just the playlist itself) then re-sync. Voila. Another tip that works if you just want one explicitely is to Trim the voice memo on your phone (click the trim button) you don't actually have to reduce it's size in any way, it's enough to convince iTunes that this is a new memo.

FTP / SSH - Why the distinction?

Using FTP and SSH on a daily, nay hourly basis - I understand the uses, application and history of both. However, is there REALLY any need in the modern age for a distinction between the two? Is it essential that an SSH client have no concept of the client system it's operator is sat at? Or is simple stubborn geeky conservatism to blame for not allowing the out-of-the-box thinking to put these two protocols in the same box? ssh my.server sudo chmod -R u+rw htdocs cd htdocs put index.html get styles.css exit happy UPDATE ---- You can! Someone kindly pointed out the existence of SFTP that does not require an FTP server to be running - it uses SSH to connect then the SSH file transfer protocol. NICE.

MySQL TimeStamp Confusions sorted!

Confused by MySQL DATETIME timestamp fields not updating / updating at the wrong time? KlikApps have a super guide at http://www.klikapps.co.uk/mysql-timestamps-created-updated-explained.html

Why New EU Regulations Around Cookies Are Wrong

New EU regulations mean websites will have to alert users when a cookie is used http://www.theregister.co.uk/2009/05/18/eu_cookie_monster/ This is crazy. Cookies are basically barcodes, that a website asks your computer to hold on to on the first page that you load, then gets sent the barcode number back each time you ask for a new page. Without it, the web-site would not be able to keep track of whether you are logged in, what you've put in your basket, etc. Anyone even marginally technical can show that cookies: a) pose no security risks in themselves b) are used by every DYNAMIC web-site. In fact, you cannot shop or interact with a modern web-site WITHOUT cookies, so pretty much every single site uses them in one way or another. So the fear is that this crazy law will pop-up a message on every single site you visit - your default response being frustration, followed by clicking 'accept' - because if you don't you can't use that site you've visited! ...

Why UK-wide Firewall Will Be Difficult to Implement

Conservative Ed Vaisey has announced that he wants the UK to filter Porn by default - either with a Chinese style country-wide wall, or by encouraging ISPs to do so. Nobly he is including the provision to then allow people to call up their ISPs and have it turned off for them. It's an interesting idea, and you can see why this is a great thing for kids accessing the Internet, but - and it's quite a big but - it won't be easy to do. Why? We filter out child-porn don't we? Isn't this just an extension? Well... no. Here's why. There is a grand consensus between all major ISPs and - crucially - web-sites that child-porn is a freedom-of-speech bridge too far. But the same is NOT true of mainstream porn. In order to block it, you would therefore have to block Flickr, Google, MySpace and a whole host of other pillars of the web-world. Without them also agreeing, you would be looking at such a crippled net that the majority would simply opt to have it switched off, ...