Today i scanned several of my university lecture notes into PDF format. The ScanSnap document scanner makes this a very fast and easy process, and it includes text recognition. This feels good: i can save physical space by throwing away my notes, but still have them usefully available to me, in searchable format! yay!
Now that i've scanned these, i want to be sure that i don't lose them. I've never been much of a person for backups, to be honest. My idea of a backup is something i do just before i upgrade Linux! But i've started to think i'd like to get into at least semi-regular backing up.
With that in mind, i came across this article: What's Your Backup Strategy? by Jeff Atwood. The proposed solution works on Linux! Funny, i always assumed rsync was a ruby library: turns out it's a straightforward command line tool.
That was enough to get me a first backup onto an external hard drive. Now it's just a case of running that periodically to keep it up to date.
I'm not particularly interested in having a cron job because my computer isn't always on, and the external drive isn't always plugged in. So i just made myself a simple executable file to sit on the desktop and remind me to click it and synchronise the backup every so often.
#!/bin/bashsource=/home/aimee
target=/media/FREECOM\ HDD/echo Backing up $source to $targetread-p"Press enter to begin."sudo rsync -vaxE--delete--ignore-errors"$source""$target"read-p"Press enter to close."
See, i said it was simple! But a simple solution is better than no backup solution at all, right? :) Now that i've started with something i can tweak it as i find necessary.
By the way, i love the quote of Jeff's in that article: The universe tends toward maximum irony. Don't push it.
I am quite sure that nobody cares about this except for me, unless they happen to have a similar scanner to mine. I've had to do this process about 5 times now on different installs. I can guarantee that it works for Fedora, Debian, Ubuntu and Mint. I thought i'd share it because i'll probably need it again and someone else might find it helpful.
First you need xsane to be able to scan things at all.
sudoapt-getinstall xsane
Plug in your scanner by USB. Attempt to scan by typing scanimage. It won't work, but you need to see the error message.
scanimage
[gt68xx] Couldn't open firmware file (`/usr/share/sane/gt68xx/PS1Dfw.usb'): No such file or directory
scanimage: open of device gt68xx:libusb:004:002 failed: Invalid argument
See that PS1Dfw.usb? You need to get that file from http://meier-geinitz.de/sane/gt68xx-backend/ but be aware that your computer might ask for a different file such as ps1fw.usb or ps1fw.usb. Whichever it is, find it on the page and click it to download.
Assuming it's gone into your Downloads folder, move it to the right place.
Now try the scanimage command again. With any luck your scanner will burst into life and a whole load of crazy gobbledegook will splurge into your terminal window. This is the picture your scanner is seeing, trying to be displayed as text! Don't be afraid to Ctrl-C to stop it once you see it working. Or you can just wait for it to finish.
You can also do this to ensure that your scanner is configured correctly:
scanimage -L
device `gt68xx:libusb:004:002' is a Mustek Bearpaw 1200 CU Plus flatbed scanner
Now to actually scan something! Open up The Gimp and click File -> Create -> XSane -> gt68xx:libusb:004:002
It comes up with this super ugly XSane interface, where you can make a preview, choose the scan area, fiddle with the colour settings and DPI settings, and scan an image.
When it's done, it'll come back to The Gimp ready for you to edit the scanned image.
Protip: If you lose one or more of the XSane windows, you can get them back again by going to the Window menu of XSane and ticking on the ones you need.
Quite often i find myself wanting to resize a whole directory of images. Rather than opening them all in the gimp, i do it through the command line. I seem to do this often enough that it's worth recording here, for my own reference as well as for anybody else who would find it useful.
Change directory to where the images are and create a subdirectory for the resized versions.
cd ~/Photos/2010/04/05
mkdir resized
My phone likes to put spaces in file names which really confuses things, so i convert them to underscores. You can skip this step if your filenames contain no spaces.
for image in*.jpg; domv"$image"`echo$image|tr' ''_'`; done
Now for the clever bit: i run convert command on the image files, resizing them to 1024px and saving with a quality of 80%.
for image in*.jpg; do convert $image-resize1024-quality80 resized/$image; done
Lovely wonderful linux! :D
One thing to note: it always resizes along the top edge, which may not be the longest edge. If you have a portrait file which is 1536×2048 it comes out at 1024×1365 (not 768×1024 as you might have expected).
The resize option can take a percentage, so if you know all your images are the same size then you could just send a 50% to reduce to half size.
for image in*.jpg; do convert $image-resize50%-quality80 resized/$image; done
Imagemagick is super-incredible-awesome so there probably is a way to deal with differently sized images at different orientations. If anybody knows, please add it in the comments! :)
Most of my life is spent coding Ruby on Rails, but occasionally i venture into the world of PHP. When i do, i sometimes need to configure Apache because, unlike Rails, it does not happen automagically! To save myself always looking things up on the Internet, here is a little summary of the things i have learnt.
Don't do this!
When i very first started using Linux, i discovered that you could put files into /var/www and access them through http://localhost. This is a very bad idea because you don't have permissions to the /var directory (for good reason!) so i used to end up chmodding everything. Also, keeping anything outside your home directory is bad news because you're liable to forget to back it up before you do an upgrade! WHOOPS!
A perfectly good solution
The next thing i learnt was symlinking, or creating shortcuts. So you can set up a shortcut from the /var/www directory to an appropriate place in your home directory. For example:
Later on i started experimenting with Apache's RewriteRule and RewriteBase for nice 'pretty' URLs. You'll soon find out that the symlink method is no longer suitable because you're not using relative URLs anymore. It's time to learn about VirtualHosts, so that i can access my local files with a URL like http://mac2.aimee.
Apache2 keeps a list of available configurations under /etc/apache2/sites-available. I have one called aimee.conf because i am egotistical like that!
sudovim/etc/apache2/sites-available/aimee.conf
It must start with this line:
NameVirtualHost 127.0.0.1
Then, for each site that i want, i add a VirtualHost like this:
It really just needs to know where to find the source files. The log and directory index are not especially important. It's probably fairly obvious why i added them. There are plenty of other options you could use if you wanted to, but this is about all i use.
Next we need to enable the configuration. It's as simple as symlinking the file from the sites-available directory. You only need to do this once per .conf file (and i only use one for simplicity).
The next step is to configure the hosts file such that when i type http://mac2.aimee into a browser it knows to look on my actual computer rather than on the Internet.
sudovim/etc/hosts
I enter a line like this:
127.0.0.1 mac2.aimee
Finally, restart Apache and all should be very well!
sudo/etc/init.d/apache2 restart
The best of both worlds
If you want it both ways (and hey, why shouldn't you?!) it is quite simple to set up another VirtualHost for localhost. Just add it in like this:
This is how i made it work on Ubuntu Linux in a development environment. Other operating systems may behave differently. I have no idea about setting up production servers!
If Apache is in a different place on your computer, you can find it like this:
whereis apache2
To find your hosts file:
locate hosts
I am not an Apache expert, so if you have any questions, chances are i can't answer them! Scroogle is your friend! :)
To get SecondLife / OpenLife which are kinda dodgy on Linux
Just for curiosity because all the reviews have been good
I think Microsoft have done a really good thing here, generating such an interest and making it available to as many people as want to try it. From the looks of things it's a good release both in looks and in functionality, and they should get a lot of great publicity that should lay the disastrous year of Vista to rest. Plus loads of free testing and feedback of course!
Fear not, i am still a great big Linux fan, and i will continue to use Ubuntu as my operating system of choice. But you know, if Windows 7 is really worth it, i might just cough up the money for the real thing when it comes out and the beta expires.
I followed the instructions here: How to dual-boot Vista with Linux (with Linux installed first) to create some space for Windows 7, install it to the new partition, and then fiddle with GRUB to make the two play nicely together. In fact they did not play together to start with. Windows 7 tried to hide Ubuntu, and then i fixed that, and Ubuntu refused to let Windows 7 have a turn. I got "BOOTMGR is missing" and had to run the Windows 7 fix program on the DVD twice before it came back to life.
Anyway, i got it working now and there are some pretty cool things that have impressed me. This is not going to be a full review; that has already been done by plenty of other people … but here are some snapshots of my experience.
I was delighted to see that it comes with a "United Kingdom" theme, possibly because i entered United Kingdom as my location. How very thoughtful and welcoming! The background changes every 30 minutes with nice scenes from around the UK.
The "important message" is Windows 7 anxiously urging me to install a virus checker. Welcome back to the world of insecure operating systems, hah! I have installed the Kaspersky preview for Windows 7 which annoys me with popups every time i try to do anything. Rubbish, hey!
My first piece of feedback to Microsoft, if i could be bothered to give it … the Start button has a spiky highlight. It looks a little bit threatening, to me.
Previews are pretty awesome, especially in Internet Explorer 8 where each tab becomes a separate preview. When you hover over the preview, the full-size image appears. It's neat!
The hover colours themselves are actually really stunning! It seems to take colours from the icon, and apply a beautiful glassy effect, for example the Firefox one is mostly orange:
The 'show desktop' now works both as a click and a hover.
I've already done that a couple of times tonight to have a check on the time and temperature. It's quite nice that a quick mouse gesture (to the bottom corner) can quickly minimize and bring back again. However, the gadgets are not always visible, which may be a glitch or maybe i've just not understood when they show and when they don't.
Finally, Second Life! I was initially disappointed because Second Life claimed that it didn't like the video card driver. So i went to Control Panel – Hardware and Sound – Device Manager, right-clicked on my Display adapter and requested an update. Windows 7 found a good one for me!
Please don't all freak out on me … but … i am thinking of trying out the Windows 7 beta.
I think it's fair to say that Windows Vista did not quite meet all the expectations that Microsoft had for it in 2008. The user account protection was annoying, the visual effects to me smacked of "tried too hard" and i think a lot of Windows XP users felt it wasn't different enough to be worth an upgrade. People took their new Vista computers back to "upgrade" to XP, Dell are selling computers with Ubuntu, and the netbooks available in the high street have pushed Linux further into public awareness than ever before.
Vista was late, but i think they released it too soon. I think Microsoft's reputation took a knock, but they have a chance to repair it. Windows 7 is pretty much Vista done properly, and from everything that i've read so far, it looks as if they've actually done quite well this time. So i'm going to try and get hold of the beta and have a go at dual booting it. It certainly won't be my primary operating system of choice, but it could be useful for running SecondLife and/or OpenLife and i will admit i'm curious to see for myself what it's like.
I am here today to ask a question and then answer it. The question is: Can you run Ruby on Rails on a netbook? Specifically, an Acer Aspire One. My motivation is … since buying my netbook, i have completely fallen in love with it, and much prefer it to the desktop computer. I want to do as much as possible on the netbook. I don't think i'd spend a whole day coding on it, but just for quick little things it could be wonderful!
Now that MyChores is open source i really like this idea of code anywhere. Wherever i have my netbook and an internet connection, i can code! If there's an emergency bug needs fixing on MyChores, i could make the fix and push it. Or if i'm feeling lazy one Saturday morning there can surely be nothing better than a cup of coffee and coding in bed! ;)
So without further ado, let's see if you can put Rails on a netbook …
I find it odd that Microsoft seem to be dedicating so much TV air time to their "I'm a PC" response advertisments to the Mac vs PC ads of a few years back. The odd thing is, i never remember seeing any of these ads on television. And i would remember because they were done by Mitchell and Webb in the UK. I've only seen them on Youtube when browsing for amusement's sake. I reckon there could be plenty of people who are completely bemused by all these people saying, "I'm a PC" when they have never seen the original ads for reference. Maybe Microsoft will awaken people up to the realisation that actually, Windows is not the only option.
Here's one of the Mitchell and Webb ads: The Naughty Step.
I actually thought it was illegal to make direct comparisons between your product and a direct competitor's product in an advertising campaign, so i don't know how Apple got away with this whole series of advertisements.
Somebody should do an ad called "I'm a free-thinker!" I haven't sold my soul to Microsoft or to Apple. I don't owe anybody any money. I just owe a debt of gratitude to thousands of volunteers who willing donated their time, knowledge and expertise to create the world's best, most secure, most reliable, most flexible, freely available, freely modifiable and freely redistributable operating system.
Actually, IBM did a Linux ad, ages ago. Linux: The Future is Open. Has anyone done anything like that since?
Just a quick post to say, hello, and celebrate the fact that i'm on my netbook at my parents' home! :)
Predictably, they didn't know the password for the wireless internet. I thought it would be written down on a piece of paper somewhere, but no, it's worse than that … only my uncle in Yorkshire knows the password! Happily i managed to poach a network cable and use that. It's nice to have my own machine, with my email and calendar, and internet preferences and keyboard and everything just the way i like it! :)
This has been a tough week at work, and i was feeling rather overwhelmed yesterday, but several things all came together nicely today. It was a good day. I'm also very happy and relieved to say that my brother, who has been very ill for some time, is significantly better now.
I'm going to bed in a minute … i've been given some Nytol sleeping tablets which will hopefully help me to sleep better. I've had a lot of nightmares and sleepwalking lately. I can feel the tablets kick in as i type this (or maybe that's just psychological?!) … i think this is going to be a nice relaxing weekend.