Getting XML Tidy (xmllint) to work on TextWrangler 4.0

TextWrangler has recently released a major update – version 4.0. A lot has changed, check out the release notes here.

One of the things that changed is the way it handles scripts and text filters. If you don’t want to read through the whole thing, here’s the main part:

There are two fundamental types of runnable file: “text filters”, which accept the selection range (or entire document, if no selection) as input, and which return text that replaces the selection range (or document); and “scripts”, which do neither. In unix-y terms, text filters accept the selection range on STDIN, and STDOUT replaces the selection range.

It just happens that I use XML Tidy a lot to format xml documents in a pretty way. To do that I had a nice little script (which is just a xmllint command really) for which I assigned a shortcut (alt+cmd+p). That made my workflow pretty fast. The problem is that this script stopped working as before so it took a while to find out why but I found a thread in google groups about this issue and someone from Barebones helped find the solution.

So in summary, here’s what you have to do to make XML Tidy work again in TextWrangler 4.0:

  • Paste this into a file

#!/bin/sh
XMLLINT_INDENT=$'\t' xmllint --format --encode utf-8 -
  • Save with the name tidy.sh under ~/Library/Application Support/TextWrangler/Text Filters/
  • Open TextWrangler, write some unformatted xml, and try it out from Text menu > Apply Text Filter
  • To make it even easier, go to Preferences > Menus and Shortcuts and set a shortcut like I did (alt+cmd+p)

Hope that helps!

How to fix warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)

I recently encountered a problem when logging through SSH in to certain servers that I use for work when using my new Macbook Pro (running Lion 10.7.3).

So right after the login was completed I was getting the following message:

warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)

It only happened on certain servers, for others everything would work just fine.
This caused a few problems when running some perl scripts that would complain about the locale variables not being set, even though my Terminal app was setup correctly.

To fix this I simply added the following to my ~/.bash_profile:

export LC_CTYPE="en_US.UTF-8"

Let me know if that helped you by leaving a comment below!






		

Lior Ron talks openly about Google Hotpot

It’s a great thing when companies talk openly about their projects. Of course, never revealing the really juicy classified-type of information but giving out some very interesting details. Google has nurtured such a culture and this video is a great example of that. Lior Ron, Google’s product manager for geo search, talks openly about Hotpot and the thinking behind its creation on an episode of ThisWeekIn Startups.

(Go directly to min 4:50).

 

Jeremy Cowart

I just want to quickly share a great photographer that has conquered some real clients like ABC, E!, Fox, Sony, and many others.

He has a distinct style producing strong and bold images. The visual impact of his pictures makes you want to keep looking at them. Also worth mentioning is his beautiful website (it probably helps that fact that he was a designer before).

Jeremy Cowart - Website

http://www.jeremycowart.com/

Fixing the “unexpected T_ENDWHILE” error in WordPress + xampp

I have recently been through a lot of pain trying to configure a local installation of WordPress using xampp. The problem was that after activating a theme (not the default one) I was getting an error:

Parse error: syntax error, unexpected T_ENDWHILE in (...........)

This was driving me crazy but after a lot of searching I FINALLY found the solution! I’m so happy that I want to share it with the world because I really only found this valuable piece of information in one page (and I did a lot of searching, believe me).

When installing a local copy for use in a development environment one of the main problems to tackle is making sure that your local server is as close as possible to your production environment. There are many variables that can change like software versions and configuration parameters. For this specific case it’s one simple parameter in the php.ini file that was causing issues.

Some php developers like to use short open tags, and even though I do agree that it can save some time and make the code a bit cleaner, there’s a lot of discussion around it.

Long story short, apparently the php.ini file included in xampp has the option:

short_open_tag = Off

by default. By simply changing this to:

short_open_tag = On

all my problems were magically resolved!

I hope you find this useful.

List of essential free software

After cleaning up my computer and having to reinstall everything I decided to tidy up my archives and take advantage of my brand new 1 TB Lacie external hard drive to put all those little tools I always end up installing sooner or later. These take up something like 170mb and can be really handy. Please note these aren’t listed in any particular order, and I’m also excluding basic things like Firefox – that’s mandatory ;)


7-Zip

The best compression tool around. Has support for nearly all formats you’ll ever use in your life. Make sure you tru the 7zip format, it has really good compression rates.

Download: http://www.7zip.com
Portable:
http://portableapps.com/apps/utilities/7-zip_portable

Continue reading…

Screenshots on steroids with PrtScr

I love simple tools that make my life easier, and I just found out one of those. And this one has an extra WOW factor because it’s beautiful in the way it does what it does – grab a screenshot. It’s called PrtScr and you can find it here: http://www.fiastarta.com/PrtScr/ You’d better see it by yourself:

 

Build your own camera stabilizer

This is quick one, and one of the best tips I’ve seen lately! If you’re like me and don’t have a decent tripod or you don’t like taking it everywhere you go, and also if your lenses have no image stabilization, this may come in handy. In a few minutes you can build your own flexible stabilizing device/flexible tripod, and best of all, you can carry it in your pocket! If you don’t believe me just take a look at the video:

f-stops explained

This is a subject that for a long time has caused a lot of confusion in my head. Also, I have the feeling that very few people actually know what they’re talking about when refering to f-stops or apertures in photography. Because I’m a geek I decided to go a little deeper and finally cleared all my doubts. Well at least almost all of them. I’ll try to explain here what I’ve learned in the most simple way in the hope of making someone happier, and also to test my own knowledge. First things first…


What’s the aperture?

I assume you have a slight clue on this, but anyway, simply put, the aperture is the actual hole that sits in your lens and lets light go through it until it reaches the sensor (or film plane).  The size of the hole can be controlled by the photographer if the lens (on older systems) or the camera allows it. The f-stop scale that we see in most lenses has this kind of progression:

f/1.4 – f2 – f2.8 – f4 – f.5.6 – f8 – f11 – f16 – f22 – f32

Most lenses nowadays have a slightly longer scale because they offer some steps in between.

Continue reading…