Thursday, 24 July 2008

Viewing your Drives

sudo fdisk -l
(For posterity.) I forget this command.

And. Well. Forgetting this command is a little more understandable (I use it to mount my NTFS drive):
sudo mount /dev/hdb1 /media/kat120data/ -t ntfs -o nls=utf8,umask=0222
(all one line)

For those of you who don't know, drives connected with an IDE cable are listed as hda, hdb, (etc.) Their partitions have a number... for example, hda1, hda2, hda3... Drives that are connected via USB (external) or SATA (internal) connectors are labeled with 's', for example: sda1. There are a lot more filesystems than this, and they require different commands for mounting properly.

Be warned that NTFS drives (formatted under Windows NT or Windows 2000) don't necessarily have reliable write access under Linux. They're working on it. You can install some packages to mess around with it. Hard drives formatted with FAT32 (Windows XP, Windows 98, Windows 95...) have reliable read/write access when mounted in Linux.

Because of ext3 (Linux filesystem) benefits, I was really wound up to format my new USB external hard drive in ext3. Upon opening the box and reading the documentation, it is already formatted in FAT32. I've decided to leave it this way because I want my friends to be able to easily read the data off my drive (in case I cart it over to their place). Windows and ext3 don't intrinsically get along.

Most of us have only heard about FAT32 and NTFS, but the amount of computer filesystems is huge.

Sunday, 20 July 2008

CD Will Not Eject, Unmount (again)

Cliff's Notes:
- Close all applications that were referencing the DVD/CD (k3b, kaffeine).
- Close all Konqueror windows.
- use "pkill Konqueror", "pkill k3b", etc. in the command line for good measure.
- THEN try to eject your DVD/CD

Story:

Let. Go. My. DVD.

This time I get
umount: /media/hdd is not in the fstab (and you are not root)
Please check that the disk is entered correctly
I've just been burning DVDs like mad because my primary hard drive indicates it's failing while booting.

The last DVD seemed to burn, but produced an error at the end that it failed anyway. I re-loaded the DVD anyway and it popped up with the DVD name. I was able to open data on the disc. Soon after, I closed the pdf and pressed the button on the drive to eject. It wouldn't let me. The light is not on. The drive is not 'working' (no auditory indications that it is running). Ejecting the CD from the icon on the Desktop does not work and gives me the same error as well. Unmounting from there does the same. I did a search for this to come up with a command line solution.
eject
Will by default eject the cdrom. (By the way, the UNIX manual for eject is very well-written. "man eject | more"). I tried:
eject dvd
(with and without "sudo" beforehand) but it gave me an error
umount: /media/hdd: device is busy
umount: /media/hdd: device is busy
Error: umount failed
eject: unmount of `/media/hdd' failed
Is there a command line way to force the drive to "stop" so I can eject it? Due to advice here, ejecting via the desktop icon should work, so I have to make sure that all programs referring to the cd/dvd are not running. *rolls eyes*
pkill k3b
and then attempting to eject still gives me the same error. I was about to accuse them of being liars, but I started thinking "there can not possibly be another application locking up the DVD. " And then... "A Konqueror window opened when I loaded the DVD. But I closed that." And then... "but there is another Konqueror window open, listing the contents of my hard drive. That was open at that time, and it's still open now."

Huh.
I closed all my Konqueror windows.
I typed "pkill Konqueror" in the command line for good measure.
And yes, now the DVD will eject (via right-clicking the DVD icon on the desktop).

Tuesday, 20 May 2008

Need Rasterizing PDF Firefox Plugin

Not really a Linux issue, but a FOSS issue:

I'd like a pdf plugin for Firefox that automatically rasterizes a pdf that's being opened and inserts it inline, or opens it in a new window. This would be especially helpful if the pdf is only one page.

Rasterization at 72dpi would only be necessary as it is on screen. Therefore, rasterization should be pretty fast.

The reason I've thought of this: my city's library insists on providing links to things that look like posters or news articles, but it's a pdf. Therefore, I must open my laggy pdf software on my machine and go through that whole dialog.

Yes, I know, I could just get more RAM (but my motherboard doesn't play nice with RAM and I'm also frugal).

Monday, 7 April 2008

Worms & WINE Are Not as Expected

Today I came across a web page with a download for the old computer game Worms 2. I recall playing this and Worms: Armageddon with my fellow residence friends when I was in University (affectionately called "rezbians"). I wondered if it could run on Linux. I know there is a web page somewhere which tells you such things.

I typed "worms wine" into Google before thinking. I got unexpected results which should (?) have been expected.

Sunday, 20 January 2008

Lost Sound when Plugging in USB flash

I was playing an .avi in kaffeine, and at the same time I plugged in a 512MB USB flash drive. Immediately I lost sound in Kaffeine, though video was still playing. I check Youtube via Firefox, same thing.

I used to have a problem in Amarok where if Amarok crashed, it would mute the sound without my noticing. Thankfully I remembered to check this in Kaffeine, but that was not the problem.

I don't mess with the sound settings often, so I had a fun time trying to find them (turns out they're not in your system or settings menu... try looking for KMix in the Multimedia menu instead.)

I log on to the freenode IRC channel #kubuntu, and a couple nice folks there had some suggestions for me.

I was told to pay special attention to KMix lines: master, master mono, PCM. These were all fine (at or near the top).

(You can also open alsamixer via the command line)
alsamixer
I was then advised to restart ALSA.
sudo /etc/init.d/alsa-utils restart
This did not work. I tried closing all my programs which might be using sound, and running the command again. This did not work either.

I ran the command, and then rebooted. This works! Now I have my sound back.

Tuesday, 15 January 2008

Mounting ntfs Drives in Kubuntu

Find the device and its partition in a terminal window:
sudo fdisk -l
Bootable devices will be marked. The actual drive used to boot will have partitions split up into swap space. IDE devices often (but not always) start with 'h', SATA devices and USB flash drives start with 's'. fdisk will indicate which file format the drive is formatted in. Hard drive letters indicate a specific device (i.e. a hard drive), numbers represent different partitions used in that device. Subsequent letters indicate addtional devices, and will likely be added incrementally (for example, if you have a SATA hard drive mounted first and then attach a USB flash drive, the hard drive should be sda, and the flash drive should end up being sdb.)

Numbers indicate a partition of that particular mounted device. Linux will reserve room for swap space and a boot sector in addition to the filesystem where you will store your files.

Mount the device to a destination folder. Replace 'hda1' below with the drive you wish to mount, and change the '/home/...' directory to where you want to mount the files to (the directory in this case will act like a link or bookmark). The folder in the home user's directory will be "ubuntu" (not your computer name) if it's running off a live cd.
sudo mount /dev/hda1 /home/ubuntu/Desktop/folder -t ntfs
-o nls=utf8,umask=0222
This is for mounting ntfs drives only!

(I've found other commands to "mount an ntfs drive", but they don't seem to work.)

Wednesday, 28 November 2007

Jerky Video off CD .avi in Kaffiene after /hdd Permisison Problems

I've noticed sometimes when I get problems like listed earlier this day (finicky CD/DVD ejecting & unmounting permissions), I get jerky motion when I finally am able to play something like an .avi off the mounted disc. I can stop Kaffiene and even pkill it, but it still continues. The problem stops if I reboot and run the .avi off the cd/dvd again.

Any idea what's going on in the background here? Is there another process I have to kill, or do I simply have to wait a long time before jerkiness doesn't become an issue? Or is reboot the only solution?

CD Will Not Eject, Unmount

  1. burned using k3b
  2. still showed as blank cd-rom on desktop
  3. used physical eject button on cd, closed drive after it opened
  4. tested data on cd: cd showed up with label, file opened
  5. tried to eject (gave error)
  6. tried to unmount (gave error i.e. "error: kio_media_unmounthelper unmount: /media/hdd is not in fstab")
  7. (light on cd-rom drive is flickering)

Solution: If I wait a couple minutes, I can then use right click->eject

I guess other apps aren't releasing permissions to the drive to preven accidental manipulation and use by other programs?

(edit: same dealie with my USB flash stick. I moved files into a directory on my desktop. Well after it was finished, I attempted to right click-> safely remove, and it gave me the same error)

Tuesday, 23 October 2007

PDF Manipulation; Tesseract OCR

Little bit of story to begin.

Working in a small print shop, I've had to deal with pdfs a lot more. One reason is setup: customers bring in all sorts of wonky files at the incorrect finished size and setup. Customers make files in Word, which may spontaneously change formatting (hey... how are WE supposed to know what your document is supposed to look like?) We get a lot on bands printing 11x17 posters, but they also want handbills, which are not set up. "Ready to print" is rarely the case.

Word also likes to not printed coloured backgrounds, even if you tell it to.

For pdf manipulation, I use three main tools: Adobe Photoshop, Adobe Acrobat Professional, and Xerox Freeflow Makeready.

The beauty about Photoshop is that you can actually open up a PDF. It will rasterize the file (essentially "make it into a picture") , which is great if you have you're getting issues with formatting. The downside is that it rasterizes the image. Gone is the editability (is that a word?) of the PDF. Always save as a copy before working on an image!

This concept gives light to the structure of the pdf as well. PDFs are similar in concept to web pages (HTML, if you're familiar with it). The document doesn't contain an image. It is a document explaining the structure of different elements, and how they should be displayed. This is why you are able to search many pdfs.

With extended use of Freeflow, it becomes obvious too that making a document n-up (multiple copies of the same thing in a page) is a function of the markup in the PDF. If you make a document 4-up, the size of the file doesn't change (or does by a miniscule amount). However, if you make a (rasterized) image 4-up and save it as an image again, it gets much larger.

Acrobat Professional is great for some purposes, but some of the tools are clunky to use. Worse still, some tools that look intuitive to use, aren't. Furthermore, it's still buggy. Crop kind of works. The "layers" tab is essentially useless.

Freeflow has some great tools. For example, you can view the contents of a pdf in its layers, and manipulate the layers (you could insert an image which is one colour and move it to the bottom of the layers... making it the background colour). It's also really easy to make things n-up. I'm surprised I don't see this more. Computers can do math much more quickly than we can. As humans, it's not that difficult for us to do (if nice round-numbered measurements are used), but it is time consuming.

Put into perspective the hundreds/thousands of dollars these programs cost and the fact that I still have to switch between them to solve some problems, plus there are still some problems they don't solve...

A large problem I would like to solve:
Collecting some of my images together at home into pdfs. Some of these are just images, some are images of text.

Using Linux, I wasn't about run out and buy a $440 copy of Acrobat Professional. Kpdf is a great lightweight viewer, but that's about all it can do. I supposed I could use a workaround using LaTeX, OpenOffice, or ImageMagick, but that might get tedious or cumbersome. I asked on IRC about ImageMagick, but I couldn't get a definite answer.

I came across some solutions quite by accident.

PDF Hacks contained a solution. Apparently you can make all images in a directory into a pdf with ImageMagick ("hack" 48, p125).
convert -density 100 -quality 85 \ -page "800x800>" -resize "800x800>" *.jpg album.pdf
Well, that's simple. Easy to write as a shell script or program, too.

I came across Tesseract quite by accident. It happened to be a July 2007 Linux Journal article. Tesseract can take a uncompressed tif image and use OCR to port it into an actual text document. It does it with an excellent success rate (97-100%).

The author says he uses it to scan in his textbooks, so he doesn't have to lug heavy books around campus.

Plus: both ImageMagick and Tesseract are free.

Installing and Switching Between Extra Desktops / Window Managers

You don't have to commit to one Desktop style. You can install GNOME, KDE, XFCE (among others), and just switch between them.

  • GNOME is the desktop used in Ubuntu.
  • KDE is the desktop used in Kubuntu.
  • Xfce is the desktop used in Xubuntu.

To switch between the desktops, log out. When you log back in, click the "session" button and select which window manager you want to use. Easy as pie.

To install, you can use Synaptic Package manager, or apt-get (on the command line). However, these methods don't keep track of dependencies, so it's recommended you use aptitude (on the command line) instead:

sudo aptitude update
sudo aptitude install kubuntu-desktop
sudo aptitude install xubuntu-desktop
Link in title as always, or here.