Technology, Social Media, Travel
RSS icon Email icon Home icon
  • Tidy Up Your XML in Vim

    Posted on June 13th, 2009 John Berns 1 comment

    You have some nice, compact XML, the kind without whitespace or newlines, like this:

    01-raw-xml-in-vim-no-whitespace

    Not easy to read. OK for computers to crunch–but if you want to get an idea of the document’s structure at a glance or do some editing–well, you might want it formatted a little nicer.

    So let’s use Tidy to clean it up–all from the comfort of your Vim session…

    (You could also use xmllint–your choice–depends on what you have installed and what you prefer.)

    You can execute a shell command from Vim by typing:

    :!

    Then to tidy up your XML run tidy with the following options:

    tidy -mi -xml -utf8

    “-im” means indent and modify the original file; “-xml” means, you are dealing with XML and “-utf8″ is optional, it means “use UTF-8 for both input and output” so you’ll get readable characters instead of encodings if you have umlats or grave symbols.

    You can see all of tidy’s formatting, encoding and other options by typing

    tidy -h

    So the whole command we type into Vim is:

    :! tidy -mi -xml -utf8

    02-raw-xml-tidy-command

    You will drop to shell while the command executes:

    03-raw-xml-tidy-complete

    Hit “return” when you are done and then Vim will ask if you want to reload the file:

    04-raw-xml-reload

    And there you go, beautifully formatted HTML to read!

    05-formatted-xml

    Enjoy ;-) !

  • Tuning LAMP Systems

    Posted on June 29th, 2008 John Berns No comments

    I have been on a website performance and scalability kick lately. I thought I would share some articles I have enjoyed on the topic.

    IBM Developer Works has a nice little two part series on Tuning Lamp Systems (pt 2).

    Then again, IBM Developer Works often has some awesome articles. Scan it regularly if you can!

    Enjoy!

  • Total Freedom! Laptop with Ubuntu Gutsy Gibbon Linux, Nokia N70 Modem and AIS (One-2-Call) EDGE Wireless

    Posted on February 23rd, 2008 John Berns 2 comments

    As I post this, I am on my laptop running Ubuntu 7.10 (Gutsy Gibbon) and connecting the Internet via AIS EDGE wireless internet with my Nokia N70 mobile phone.

    One more critical step closer to completely abandoning Windows forever.

    The setup was fast and relatively simple once I found Howto connect to the Internet with a Nokia N70 from Ndlovu on UbuntuForums.

    For people that have my exact setup (Ubuntu Gutsy, Nokia N70 (connected via the USB cable packaged with the phone), AIS (One-2-Call) in Thailand) I can simplify the process a bit for you.

    All I had to do was create the two config files as per the instructions and save them. Then go to the command line and type “pon mobile” and hit enter. Fast and simple–and it worked the first time.

    Be warned–there is no feedback; you enter “pon mobile” and you get no “you are connected to the Internet” message–you just are.

    If you want to see what happened during the connection process (and to see if you are really connected) try typing “plog” from the command line. Plog is part of the PPPD package (along with “pon” and “poff”) and it shows you the last few lines of /var/log/ppp.log. If that file doesn’t exist, it shows you the last few lines of your /var/log/syslog file, but excluding the lines not generated by pppd. So you can see the status messages that have been written by PPPD about your connection in ppp.log.

    A few more notes:

    1. PPP is part of the default install for Ubuntu Gutsy–you probably have it installed unless you customized the install to NOT install it.
    2. Your user probably belongs to the dialout group already–no need to add. (But it’s not that hard to do, really.)
    3. The text he suggests to cut-and-paste all worked exactly as he has it–no need to tweak the settings

    It would be nice to have a graphic interface that stepped you through the process, showed you the phone was connected and had a simple little “Connect to Internet Via Mobile” and “Disconnect” buttons–but that’s just me being spoiled by how easy most things are in Ubuntu most of the time.

  • Ubuntu Calling…

    Posted on January 20th, 2008 John Berns No comments

    OK. I have had it with Windows. Really, I have. The annoyances, the arrogance, the in-your-face-f**k-you attitude they have for their users… It’s time for a change.

    I would love to buy a Mac or two (An iMac / MacBook Air combo would be nice), but looking at the bank statement, that ain’t gonna happen any time soon.

    So I guess I am going to go with Ubuntu. I love Ubuntu, I really do, and it would probably have been my first choice if Adobe apps ran on it, but sadly, there are no Linux versions of Photoshop and Lightroom. (So I guess I will still be running Windows, but only on rare occasions.)

    So, let the experiment begin!

    I am trying to, wherever I can, switch my apps to open source versions as well.

    Let’s see how this goes.

    So far, most days, I can seem to run Ubuntu all day and not ever have to switch back to Windows to do anything.

    Still looking for some killer replacements for my old-standby Windows apps. I guess I will find them as I need them. I can’t say I have played with many Linux desktop apps outside of server and network tools and the occasional editor; my Linux experiences have mostly been using it as a server, not a desktop. So there is a lot of opportunity to find some cool desktop apps I have not been exposed to before.