Batch JPG Mover and Sequencer

Distros: All distributions

    A few posts ago I wrote about how to change file extensions. For too long I have wanted to write script that would manipulate JPG files for me so I did not have to keep typing in long strings into the shell manually. This is my first script so it is a little messy at the moment which made me decide to learn how to write Bash scripts. After I wrote the script I began reading beginners tutorials. Right now the script works though!

    I decided to call the script bm.sh, as in bowel movement because removing capitalized file extensions and renaming and sequencing a batch of JPG files all at once is sort of like removing waste… and it stands for batch mover as well.

    Eventually, I would like to add conversion abilities but that should probably be an entirely different script. The script can be downloaded at the script’s page. You can find more information as to the extent of what the script does there.

Practical Partitioning for a Linux System (Part II)

Part I - Practical Partitioning for an every day, at Home Linux System
Part II - Practical Partitioning for a Linux Server

    If you are going to be running a server that will be used quite a bit then it is a good idea to go overboard on the size of the swap partition. It is not a bad idea to make it 2GB or 3GB because if you run out of RAM and swap space you will either end up getting bogged down or worse, crashing.

    On the otherhand if you are running a server that will not be running any major processes and will only be used by you and a few friends and people who might come accross it by chance then just keep it to 1.5 to 2 times as you would for a home computer and you should be alright.

Simple Server Partitioning

    Depending on the type of system you are going to install will determine which mount points should be designated to their own partition and what size each partition should be. If you are going to be running a web server you would want the directory containing the internet content designated to its own partition because most of your content will be stored there. Keep in mind you will need to leave a lot of room for growth since, hopefully, you will be continually adding and updating the content. If you are going to be allowing users to upload media and/or add information such as articles your really going to need to leave a lot of room for growth. This is usually the var directory. Just to give you an idea, here is a simplified example of the how the partitions for small web server could look:

root 10GB
swap 1GB
home 20.5BG
var 68.5 (remaining space)

Practical Partitioning for a Linux System (Part I)

Part I - Practical Partitioning for an every day, at Home Linux System
Part II - Practical Partitioning for a Linux Server

    While it is possible to have functioning Linux system devoted to one partition it is not the most functional or safest way to run a system no matter what distribution or file system is being used. If you have ever lost all of your music, pictures, documents or settings to a bad error on your part or something else gone wrong then you know the terrible task of re-installing and trying to recover that data. Avoiding that troublesome situation is one of the many reasons you could, one day, look back and say you are glad you read this article.

    To make it easy we will be referring to a 100GB hard drive throughout this article.

The Basics

    Most distributions these days, if not all, have a built in partitioner in for installation. If you want to set up the partitions with a partition manager other than the one provided on the installation disc a great alternative is the GParted Live CD.

    Many people end up creating one partition that is mounted as root, indicated by the forward slash, “/”, and install the entire system on that one partition. Doing this will automatically place all system data, user home directories, the var directory…etc onto the same partition. Like I said before you would have a functioning system if you were to set up your partition this way. However, it is more practical to create separate partitions for some of the major mount points.

How Big Should the Swap Partition Be?

    This is a subject that does not seem to be exactly decided by most people. Some people will tell you the swap partition should be the same size as how much RAM you have, while others will tell you it should be two times the amount of RAM you have. Swap space is used when you are running a lot of applications at once and RAM fills up. When this happens the swap space is used as a, sort of, backup RAM. For a home computer I would recommend 1.5 to 2 times the amount of physical RAM you have.

Partitioning for the Home Computer

    If you are going to be installing a system for every day, at home tasks, you will mainly be using the home directory and etc directory. The home directory stores all of your settings and preferences for the applications you use as well as the files on your desktop. The home directory is basically your user space. When a user is created they get their own folder in the home directory.

    For a home computer I like to keep the partition tables simple. This is what I would recommend:

root 13GB
swap 1GB
home 86BG (remaining space)

    This article was getting a bit long so split it into two parts. Part II is on practical partitioning for a Linux Server.

Opera Flash Player in Debian, the Simple Solution!

Distros: Debian Lenny/Sid and possibly all versions of Debian and Debian based distributions.

    Just a quick note: I haven’t had the need to do this in other versions of Debian or any other distributions so I cannot say for sure but it is very possible that this setup could work in those Debian based distributions such as Ubuntu, Kubuntu, Damn Small Linux or any others.

    After installing a number of versions of Opera and attempting to use many different versions of libflashplayer.so as well I finally got flash support in Opera! It’s actually a very simple solution as well. So let us get on to it!

Getting The Right Version of Opera

    I tried to stay away from the beta version of Opera and was somewhat sucessful but found that Opera 9.50 worked the best. You may download Opera 9.50 or visit www.Opera.com/download to select a non-beta version if you do not want to use the beta version. Be sure to select your distribution in the drop down box. If you decide not to use the beta version libflashplayer.so file may work better then the current one available from Adobe.

    If you have downloaded the beta version of Opera you must now extract the tar.gz if you checked the checkbox to download a tar.gz. If you didn’t download the tar.gz then install the .deb (Debian package file) or RPM (RPM Package Manager for Redhat based distributions) file via the command line:

To install a DEB file enter:dpkg -i opera-version.deb
To install an RPM enter:rpm -ivh opera-version.rpm

Installing Adobe Flash Player

    Now that Opera is installed you need to install Adobe flash player. You can download the latest version from www.adobe.com. Download the .tar.gz file and extract it to your desktop. You can do this via the command line easily. You will want to run this as root or use sudo so that flash is installed sytem wide and not just for your user account:
sudo tar xvf install_flashplayer.tar.gz

    Once the file is extracted you can run flashplayer-installer by going to the directory you extracted it to and typing ./flashplayer-installer and following the instructions of the installer. The installer basically copies libflashplayer.so to your Opera plugin directory, usually /usr/lib/opera/plugins. Or you can simply copy libflashplayer.so to Opera’s plugin folder via the command line yourself:
sudo cp libflashplayer.so /usr/lib/opera/plugins

And if the directory does not yet exist enter this:
sudo mkdir /usr/lib/opera/plugins && sudo cp libflashplayer.so /usr/lib/opera/plugins

    Using the && tells the command line to run the first command and immediatly after that run the next command. You can use this in many situations. It comes in quite handy when running commands that take some time to finish. Now start Opera and watch something educational on Youtube.

NOTE: There are known issues with Flash support in Opera. What I have noticed is when using multiple tabs of which there is Flash content on and you go back in history, the Flash will crash but the rest of the content on the webpage will be fine.

iPod Linux Alternative for Playing All Audio Formats

Distros: All Distributions
NOTE: This works with other music players such as iRiver, Archos and iAudio players.

At the moment iPod Linux is only fully supported for fourth generation iPods and earlier. I wanted to play Ogg Vorbis, Flac and other audio formats since I rip CDs to those formats. Instead of converting all of those files to formats that will take up more space and waste my time I began my search for an alternative to iPod Linux.

The software I came across plays pretty much any audio format and probably most video formats for video iPods. This free software I found is called Rockbox. It uses the original software that comes on the iPod but is a software replacement for the original firmware. The best part is that there is not installation required. All you need is to be able to copy a folder to your iPod to run Rockbox. It creates a new interface with a few more options and abilities. To see if your iPod or music player is supported by Rockbox see build.rockbox.org. If you are using an iPod, odds are it probably is supported.

Why Use Rockbox?

Besides the ability to play many different audio formats that are not supported by iTunes or the original iPod firmware there are a few other interesting aspects to Rockbox. For one, it has many different themes and fonts that can be downloaded. So you are able to customize the look of the menus and the play screen. You can even create your own themes because they are all editable.

Some Features
  • Gapless playback

  • Replay Gain
  • 5 band fully parametric equalizer
  • OTF (”on the fly”) playlists
  • True random shuffle (fresh randomly shuffled list every time)
  • Custom User Interface themes
  • Stereo recording to WAV/AIFF/WavPack (lossless) and MP3 (supporting devices)
  • FM radio, including FM recording (supporting devices)
  • Remote control (supporting devices)
  • Digital SPDIF input/output (supporting devices)
  • Last.fm support (even on players lacking RTC)
  • Cue sheet support
  • Changeable selector bar
  • Album art

A subtle feature that I found very nice is how Rockbox pauses songs. Instead of instantly stopping, the song will fade out in about one and a half seconds. It is not extremely special but I think it adds a nice touch.

One feature that I found odd but somewhat handy is that you can flip the screen. I was very excited to see this option because when I hold my iPod the normal way to scroll songs my grip does not feel sturdy. With the screen flipped I can now hold it more comfortably. You might want to give it a try for a few days to see if you like it.

My favorite feature is that Rockbox will find every playable file automatically and add it to your library no matter what directory you place it in on the iPod. You do not need to use iTunes or any other music organization software to upload files. Instead, you treat your iPod as any other external storage device, dragging and dropping (or using cp in the command line) music files in any directory you’d like will add the songs to your library.

If this all sounds good to you, give it a try. If you don’t like it, to un-install it all you have to do is delete the “.rockbox” folder that you copied to your iPod. It’s certainly worth a try.

Installing Nvidia Drivers in Debian / Ubuntu / Kubuntu

Distros: Debian (3.1) Sarge, Debian (4.0) Etch, Debian (5.x) Lenny; Ubuntu &  Kubuntu (6.06) Dapper Drake, (7.04) Feisty Fawn, (7.10) Gusty Gibbon;


One quick note for those of you who are interested: This guide will get your Nvidia drivers working with Beryl, Compiz and Compiz Fusion!!!

When I first tried getting my Nvidia card working in Linux it was a nightmare. This guide will definitly work for all Nvidia Cards but I have added extra information on the Nvidia Geforce FX go5700 video card. For some reason there are consistent problems specifically with the Geforce FX go5700 video card in Linux. There is a very simple way to get it working properly though! It is more simple then you would think. All that is required are a few extra edits of your xorg.conf file.

This guide is mainly targeted for those running Debian based distributions and distributions which use xorg but the information provided here still may be of help if you are using this graphics card. For those running other distributions or who have already installed the drivers, it may be a good idea for you to skim over the article to make sure you haven’t missed an important steps, then go to the section titled “Odd Screen Issues.”

Installing Nvidia Drivers

There are a few different drivers out there, depending on the type of processor you have. I have linked to a couple of them but if you want to make sure of which one you need all of the Linux Nvidia drivers are located at www.nvidia.com/object/unix.html. However, here are the links, direct links, to the drivers provided by Nvidia.

NVIDIA-Linux-x86-1.0-9639-pkg1.run

This is for most x86 distributions.

NVIDIA-Linux-x86-100.14.19-pkg1.run

This is for those running Debian Lenny or Debian Sid (with kernel version 2.6.22-2) which are in testing right now. I do not know which other distributions this would be for but it is probably for those versions which are in testing or experimental.

NVIDIA-Linux-x86-14.23-pkg1.run

This is for those running Debian Lenny or Debian Sid who are using kernel version 2.6.22-3. If you just did a kernel upgrade you will need to re-build the Nvidia module with this.

NVIDIA-Linux-x86_64-100.14.19-pkg2.run

This is for those running 64 bit processors.

Before we run the file we just downloaded we must stop Gnome display manager (gdm). Doing this will bring you to a shell so read the rest of this section before stopping gdm:
sudo /etc/init.d/gdm stop

Once gdm is stopped run the file we just downloaded by entering:
sh NVIDIA-Linux-x86-YOUR-VERSION

You may get a message from the compiler, looking something like the quote below. Just choose No when this dialogue appears.

The CC version check failed:
The compiler used to compile the kernel (gcc 4.1) does not exactly match the
current compiler (gcc 4.2). The Linux 2.6 kernel module loader rejects…

And once everything is installed you will be asked if you want files configured automatically. We will be configuring things manually, the safe way. Once you exit the compiler type startx and read the next section of this guide.

Configuring xorg.conf

There are only two necessary changes required to make the Nvidia card work with Linux now. Simply edit your xorg.conf, located in /etc/X11/. It should look something like:

Section "Device"
    Identifier "nVidia Corporation NV36 [GeForce FX Go5700]"
    Driver "nvidia"
    ...
    #Option "ModeValidation" "NoVertRefreshCheck"
EndSection

The last Option, above, is for those users running the Geforce FX go5700 card. The # in front of the line means it’s commented out. If everything boots up fine but you get a blank screen or crazy lines accross the screen this commented line will save you. If you have any odd screen issues simply uncomment the line from the shell and restart X server by pressing Ctrl+Alt+Backspace.

Also, under Section “Module” add the following line:
Load "glx"

If Section “Module” does not exist, simply create it. If you have to create it, it should look like:
Section "Module"
    Load   "glx"
EndSection

Save the file and exit your text editor. Now save any other work you need saved and hit Ctrl+Alt+Backspace, this will restart X server. You should see the Nvidia logo appear and then you will be brought to the login screen. If you get a blank screen or any odd screen problems press Ctrl+Alt+F1 login with your username and uncomment the line we added in Section “Device”. Save the file, and restart gdm by typing:
sudo /etc/init.d/gdm start


Odd Screen Issues

This is mainly why I wrote this article. Many of us with the go5700 card encounter a black screen or lines accross the entire screen. This may be encountered with other cards but I have only used this model. To fix this add one line to the device section in your xorg.conf file or if you followed the instructions in the previous section just remove the # from the line we commented out. It should look like:
Section "Device"
    Identifier "nVidia Corporation NV36 [GeForce FX Go5700]"
    Driver "nvidia"
    ...
    Option "ModeValidation" "NoVertRefreshCheck"
EndSection

Once you save the file simply reset X server by pressing Ctrl+Alt+Backspace or restart Linux by typing shutdown -r now. If this guide worked for you don’t forget to Digg it, thanks!

Changing File Extensions the Easy Way

Distros: All Distributions

You might not have to do it often but changing file extensions can become a major task. Maybe a word processor you are using will only open a certain type of text file. Sometimes all you have to do is change the file extension to open that file with that application. Also, Linux and UNIX are case sensitive. You can run into problems with some applications because of this.

My digital camera stores Joint Photographic Experts Group (JPEG or JPG) files in capital letters, even the file extensions. When I try to using these photos with some applications they are not displayed in the “Open prompt” because the application is looking for *.jpg when my files are actually *.JPG.

If you only have one or two files that need to be renamed it is easiest to rename them in via the GUI or use the mv command, like: mv oldName.EXT newName.ext, however, if you need to change twenty files, this can be a sickening process. The easiest and fastest way to change the file extension of each file in an entire directory is by using the following in the command line.

for f in *.JPG; do mv $f `basename $f .JPG`.jpg; done;

How it Works

Lets take a look at the command and break it down. If you understand how it works you’ll be able to remember how to use it and modify it to suit your needs. This can be used for any type of file, not just JPGs.

In regards to the first part, for f in *.JPG;, this is the beginning of a for loop. I will not be going into detail about how for loops operate. If you are not familiar with for loops I suggest some reading on the subject.

for f in *.JPG;

The for loop here creates a list of each file within the working directory that ends in .JPG. The letter f is the variable. It will represent each file ending in .JPG and each file is processed individually. Since we are using a loop here, the shell (command line) will automatically go down the list and processes each file until it reaches the last file.

do mv $f `basename $f .JPG`.jpg;

This section uses the list, created by the for loop. The $ in front of the f tells the shell that this is a variable. So here we are using mv to change the name of each file ($f) in conjunction with basename. The way we are using basename here removes the file suffix (file extension) and after that we add a new one, the lower case extension.

If you want to change the file extension completely, not just the case, all you would have to do is replace the lower case .jpg with the file extension that suites your needs.

done;

This section just tells the shell (command line) there is no more information that needs to be processed. If you leave it out you will be prompted for more input. That is all there is to it, you are done; changing your file extensions. Enjoy!

Next Page »
FireStats icon Powered by FireStats