HPR – cron

January 29th, 2010

In this months Hacker Public Radio is on cron. First let me list out some good introductions to the topic:

  • https://help.ubuntu.com/community/CronHowto
  • http://unixhelp.ed.ac.uk.CGI/man-cgi?crontab+5
  • http://unixgeeks.org/security/newbie/unix/cron-1.html
  • http://en.wikipedia.org/wiki/Cron
  • Virtually the entire show was taken from these links so rather than repeat myself here I suggest you either listen to the show or follow the links yourself. I did give an example of how you might add a script to cron and I’ll list that here.

    username@computer:~$ vi /home/username/bin/hello.bash

    username@computer:~$ cat /home/username/bin/hello.bash
    #!/bin/bash
    echo "hello world"

    username@computer:~$ /home/username/bin/hello.bash
    bash: /home/username/bin/hello.bash: Permission denied

    username@computer:~$ chmod +x /home/username/bin/hello.bash

    username@computer:~$ /home/username/bin/hello.bash
    hello world

    username@computer:~$ export |grep EDITOR
    declare -x EDITOR="vim"

    username@computer:~$ crontab -l
    no crontab for username

    username@computer:~$ crontab -e
    no crontab for username - using an empty one
    No modification made

    username@computer:~$ crontab -e
    no crontab for username - using an empty one
    crontab: installing new crontab

    username@computer:~$ crontab -l
    # m h dom mon dow command
    * * * * * /home/username/bin/hello.bash > /home/username/hello.output 2>&1

    username@computer:~$ cat /home/username/hello.output
    hello world

    Following on from my recommendation of Spud Show last time I’d like to recommend Rathole Radio this time. This is a show by Dan “programmer, musician and full-time layabout from Merseyside, UK.” Lynch aka the UK Outlaw. To quote the man himself “Rathole Radio is a fortnightly Internet radio show and podcast about culture, technology and politics with humour, guests, the best in new music and even exclusive live performances.”

    I love the eclectic sound derived as a result of Dan’s simple motto “I only play stuff I like.”

    Go have a listen.

    Connection points in Visio

    January 19th, 2010

    I like to use the connection line tool when creating interrelationships between shapes in visio drawings. The advantage of this is that you can move shapes around and the line will stay connected to both. Although the line ordering will get messed up, at least you haven’t lost the logic. A connection point will appear as a white ‘x’ on your object and when you connect the line the end point will briefly turn red to indicate a join.

    visiobox-connectionpoints_0

    A problem I often come across when editing diagrams is that there are too few connection points. A rectangle shape typically has only 4 connection points but I usually want to add more connection lines. Eventually I tracked down an article entitled Work with connection points that explained how to add more connection points.

    The trick is first to select your target object, then select the “Connection point tool” – a blue “X”. You will find it on the menubar in the same drop down menu where you selected the line (Connector Tool).

    visiobox-connectionpoints_3

    Now hold down the Control key and each click will add a connection point.

    While you’re at it try giving dia a spin.

    Say Thanks.

    January 7th, 2010

    I was preparing to write up the scrip/show notes for my next HPR on the way home from work tonight. Rather than listen to a technical podcast I decided to put on some background music. As luck would have it spudshow 400 had just been downloaded. You may know that I spoke about spudshow before. I was having a bit of an issue with kdm loading so I was a bit preoccupied and it took me a while to tune into what Brendan was saying. Then it occurred to me that he was using the word “ken” a lot. I am used to people using “ken” in sentences and not talking about/to me as in Dutch “ken” means “know”. Anyway when my brain finally kicked in I restarted the show and listened more carefully.

    Brendan had put together a special show entitled “Ken’s Spud Show” featuring all the artists that I had liked since the start of his show. I am absolutely amazed, thrilled, chuffed, honoured and as the entire selection is from me the music selection is brilliant :)

    Why did he do this ? Well in 400 episodes I was the only one ever to give him any feedback.

    I don’t know what his subscriber numbers are but it wasn’t very hard to find his show so I guess I can’t be the only one subscribing. So why don’t people send in some feedback ? The guy is producing good work and yet no one could be bothered to write him an email. I always make a point to email the podcasters that I listen to because I know from doing my episodes on HPR that you get very little feedback. But when you do get an email or a comment from someone (that isn’t spam) it makes your day.

    So I would like you to make a new years resolution with me.

    Say Thanks.

    This is especially true if you’re getting something for Free. Don’t limit yourself to podcasters. If you use FLOSS take the time to look in the man page or click on the help – about to find an email address and just fire off a one liner.

    User Agent switching for Google Chrome

    January 4th, 2010

    I’ve been giving google chrome a test run and so far I am undecided. It appears to be faster than Firefox but I’m not sure that it’s as fast as konqueror. One thing I noticed was how animated the whole Internet is with flash, image animations and javascript messing about. I’ll let you in on a little secret. For years I have not been seeing the Internet as most people experience it.

    • I turn image animation off in Firefox about:config then set
      image.animation_mode to once.
    • I use flash block to control which sites I allow to run flash.
    • I run the NoScript plugin to give me control over which sites I will let run javascript.

    All this leads to a more calm and much less distracting experience. I don’t block advertisements but the steps above ensure that I don’t see the hard sell ones.

    Within chrome there doesn’t appear to be any way to turn off animated images or control javascript and there is no NoScript extension as yet. Confusingly there are two FlashBlock scripts both appear to work fine.

    I was happy to see that the Xmarks (formally Foxmarks) plugin was available. I have been using it for years without problems. Since I installed it on chrome the performance has been flaky across all computers and browsers. It could be the maturity of the chrome plugin or the fact that I just doubled it’s workload by adding chrome on every computer. Either way I disabled it on chrome.

    One thing that is missing is the ability to switch User Agent string. Hard to believe that websites still think they know better than me what browser and OS I should be running. While there is no plugin or menu configuration, I found a site that explains how you can start chrome by passing it a user-agent switch.

    Typing the about: in the url bar will normally give:

    Google Chrome	4.0.249.43 (Official Build 34537)
    WebKit	532.5
    V8	1.3.18.16
    User Agent	Mozilla/5.0 (X11; U; Linux i686; en-US)
    AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.43 Safari/532.5
    

    After starting chrome with the command

    $/opt/google/chrome/chrome -user-agent="Mozilla/4.0 (compatible;
    MSIE 6.0; Windows NT 5.1)"
    

    Typing the about: in the url bar will now give:

    Google Chrome	4.0.249.43 (Official Build 34537)
    WebKit	532.5
    V8	1.3.18.16
    User Agent	Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
    

    I can’t really say much more at this stage other than I hope Firefox can go back to their roots and produce a small and fast browser again. I hope Google will continue their business arrangement with Mozilla so they can do that. One thing we learned since Firefox came on the scene is that Browser competition is good for everyone.

    The JakAttack is back

    December 30th, 2009

    It was an ordinary day.
    A day like any other when suddenly…

    As I was transferring my ogg casts to my ogg player I realised that there was a new JakAttack episode. The show is by Jon Watson and his wife Kelly Penguin Girl. It resulted from an earlier show that Jon had that was restricted to technology topics. Their network wouldn’t let them change to a more relaxed “tech ‘n talk” format so they left and started JakAttack on their own.

    They were going great guns for a while but when they moved back to Nova Scotia and bought a old house to renovate as a B&B, their podcasting time was limited. While others had given up all hope of ever seeing a new episode (even Dan put them in the graveyard section of http://www.thelinuxlink.net/) I knew they wouldn’t let us down.

    So here we are – over a year has passed since the last episode and out of the blue Jon and Kelly were back. Back and at top form. Find the next cast (whenever that will be) at:
    http://thejakattack.libsyn.com/

    To me six months from now: How to get Citrix running on Debian Sid AMD64

    December 22nd, 2009

    This is now the third time that I’ve had to research how to get working so it’s time for a post. This should probably work for Ubuntu systems as well.

    Go to the Citrix Site and download the file called:
    linuxx86-11.0.140395.tar.gz (or greater).

    This is a tarbomb so I advise creating a new directory and extract it there. Then run the setup script ./setupwfc

    mkdir citrix
    mv /tmp/linuxx86-11.0.140395.tar.gz citrix/
    cd citrix
    tar xzvf linuxx86-11.0.140395.tar.gz
    ./setupwfc

    Now the two extra things you’ll need to do.

    First install the package ia32-libs package which is “ia32 shared libraries for use on amd64 and ia64 systems”.

    sudo apt-get install ia32-libs

    Next you need to copy the firefox/iceweasel/whatever certs

    cp -v /usr/share/ca-certificates/mozilla/* /usr/lib/ICAClient/keystore/cacerts/

    Of course when I need this next I’ll have forgotten all about this post.

    SpudShow

    November 18th, 2009

    I listen to so many tech podcasts that I forgot that my ogg player can actually play music. Then while listening to the Linux Outlaws I heard that Dan Lynch had started a music podcast called Rat Hole Radio. So I set out to modify bashpodder not to speed up all my podcasts. In doing so I went down a rathole of my own where a simple change turned into a major project. Those that have seen Hal’s attempt to fix a light bulb in the opening sequence of “Malcolm in the Middle” Season 3 Episode 6 “Health Scare” will know what I mean.

    Once I was back up and running I went looking for some Irish podcasts and came across Spud Show which features mostly unsigned female artists from Ireland and around the world. The show has been going for four years and although the presenter Brendan Bolger started out speaking English, he switched to Irish for a while. That turned out to be a long while as the show is still in Irish but don’t let that put you off. The show comes out a few times a week and it’s always something different, fresh and new. He does a great job of linking to the musicians on the website and always makes a point of spelling out the artist’s URL’s (in the English alphabet).

    I had a happy few months going through the back catalogue and I can recommend the following shows (of course these are songs that I liked and more importantly were able to get the repeating sound of bob the builder out of my head.) :

    In short, give spudshow a listen. Now what was I doing again – ho yea – adding Rat Hole Radio to my feed . . .

    HPR ep0481 :: Mashpodder

    November 14th, 2009

    I have been using bashpodder for years as my podcatching client. For those that don’t know bashpodder is a shell script written by Linc Fessenden of the The Linux Link Tech Show and it is a simple sysadmin solution to a problem.

    • The problem: “get podcasts from the Intenet”
    • The solution: “assemble unix commands into a shell script and run from cron”

    For sysadmins while the problem may vary but the solution is always the same :) . I’m not embarrassed to say that bashpodder.shell inspired a lot of my own scripts and as a result I have gotten more familiar with the underlying tools like date, mkdir, wget, tr, sed, awk, cat, sort, uniq and grep.

    Over the years people (including myself) have modified the script to tailor it to their own personal needs. A few months back I was looking at the amount of changes that I had made and I have to say a lot of the elegance of Linc’s original masterpiece was lost. So I downloaded a fresh version of bashpodder and started the task of adding all the changes that I had made, most of which were adaptations that other users had contributed back. As I was browsing the site I realised that the majority of changes that I needed were already implemented by Chess Griffin’s mashpodder.

    Chess mentioned that he had ‘forked’ bashpodder on the (sadly no longer produced but still required listening) Linux Reality Podcast. I looked at it at the time I didn’t make a the jump because of the investment that I had made in bashpodder. However now after looking through the code for mashpodder I realised that most of the functionality I needed was already included.

    If you change, one of the major changes you will notice is in the mp.conf file which is where you add the lists of podcasts. Where the bp.conf file of bashpodder only had the option for the URL of the feed you wanted to subscribe to, mashpodder has two extra fields. Rather than explain it myself here is the comments that Chess had added to the default mp.conf file.

    # Mashpodder sample mp.conf
    # $Id: mp.conf 2 2009-01-29 22:36:28Z chess.griffin $
    #
    # Three fields, separated by spaces:
    # Field 1: rss feed
    # Field 2: name_of_directory or 'date'
    # Field 3: 'all' or 'none' or 'update' or a number greater than 0
    #
    # Field 1 is self explanatory.  Field 2 is where the episodes will be saved,
    # either in a user-named directory or a date-based directory.  Put the word
    # 'date' if you want date-based directories.  Field 3 is how many episodes to
    # fetch.  The term 'update' means episode names will be saved as if they were
    # downloaded but nothing will actually be downloaded.
    #
    # Examples:
    #

    I was able to put my music podcasts in an output folder and my “talk” podcasts in a folder called fast so that I could speed them up and convert them to ogg first.

    One caveat I found was that if I put all in the last field, mashpodder took a long time to run. Not that it was a major issue given I am running it in cron. I discovered that with the setting all mashpodder would check each file in a feed to see if it was downloaded. When I changes the last field to 3 it sped up considerably.

    [edit: Should be in the podcast section - sorry Linc]

    Ready for the Desktop

    October 2nd, 2009

    I’ve been using many different desktop environments over the years. Not only the many desktop’s available under Linux but also the various different iterations of Windows and Apple’s OS. Some allowed me to do my work quickly while others just frustrated me to the point that I spent more time fighting the computer than doing actual work.

    I have been thinking about what causes this frustration for a while. In today’s Hacker Public Radio episode I draw parallels between my frustrations at trying to start an automatic car with peoples frustration with computer interfaces. I realize that my frustrations may be with my own expectations rather than with the interface itself.

    In the computer world when I hear people say that “Linux is not ready for the desktop”. I have to look at all the people around me that are having no problem using Linux as their only computing environment. People across the spectrum of ages and abilities but the one thing they have in common was that they have no preconceived ideas of how a computer works. They approach it by asking ‘how do I…” as opposed to “why can’t I…”.

    So if you are having a problem with the Linux Desktop perhaps it is because it’s to much like what you have used before. Fortunately with free software there is a choice of how you interact with your computer. You’re not stuck with an automatic or a stick shift. Try out other desktop environments until you find one you like and most importantly ask questions.

    Can’t copy from a PDF file.

    September 21st, 2009

    Every so often I come across a PDF document that has been protected to prevent copying. You probably won’t notice this for a while until your copy and paste fails a few times. Finally you will see that the Edit -> Copy menu in Adobe Reader has been disabled/grayed out. Other readers like Okular show a more meaningful “Copying forbidden by DRM” message to alert you to what is going on.

    The logic behind this feature is to prevent copying but is completely pointless because of the “if you can see it you can copy it” principle more commonly referred to as the analogue hole. A determined thief can take photographs of all the pages effectively bypassing all the content protection completely. Sure it’s not a digital copy of the text but they still have a digital copy of the image of the text and more importantly they have the confidential information you were trying to protect.

    So all this protection achieves is forcing legitimate users to type text extracts instead of copying them. This will of course lead to errors in transcription and which will cause confusion down the line when your customers tries to order part number XI20458-AA7 when it is listed as X12O4513B-AA7 in the document. Can you spot the three differences ?

    For the moment the solution is to convertĀ  the PDF to text using the pdftotext tool from the poppler-utils package on kubuntu.

    $ aptitude show poppler-utils
    Package: poppler-utils
    [snip]
    Description: PDF utilitites (based on libpoppler)
     This package contains pdftops (PDF to PostScript converter), pdfinfo (PDF
    document information extractor), pdfimages (PDF image extractor), pdftohtml
    (PDF to HTML converter), pdftotext (PDF to text
     converter), and pdffonts (PDF font analyzer).

    To install on GNU/Debian based systems:

    $ sudo apt-get install poppler-utils

    Once this is installed you can simply run the command

    $ pdftotext bla.pdf

    This will output a file called bla.txt with all the text from the document. Oddly enough running

    pdftohtml bla.pdf

    results in the error “Error: Copying of text from this document is not allowed.”, so it remains to be seen how long it will be before pdftotext will be patched to remove this feature.