p7zip Command Line

In CentOS to use p7zipĀ  from command line the cmd is 7za and not p7zip or 7z, I wasted some time on this as most manuals online tell you to use p7zip [options] filename.

To extract a file you would do:

7za x filename.7z

You can substitute the .7z extension with whatever archive extension you are trying to xtract e.g tar,gz,zip etc as long as its an extension that can be handled by 7zip which should be most of the common formats.

get Junit4 working on Centos5

Like most people I prefer to use centos supplied apps from their repos as it just makes keeping things updated easier. So I use the eclipse supplied by centos which does not have Junit4 if you would like to enable it here are the steps I followed:

1.Download eclipse from there site the .tar version

2.Extract folder org.junit4_4.5.0.v20090423 and file org.eclipse.jdt.junit4.runtime_1.1.0.v20090513-2000.jar and copy them to folder /usr/share/eclipse/plugins/ download file junit-4.1jar and place it in folder org.junit4_4.5.0.v20090423

3.Restart eclipse and you should be set. Happy Testing!!!!

NB: Depending on the eclipse version you download the numbers on the folders and files may be different, and incase the new versions require a different file than junit-4.1.jar eclispe will tell you the new version needed.

the Junit-4.1.jar I used is here or you can google it if you want.

Play music with Gtkpod and xmms

By default Gtkpod uses xmms to try and play songs from your Ipod, a few linux distributions come with xmms. If yours came installed with it first remove it as it does not play music from your Ipod. Then go ahead and install
xmms-mp3

You should now be able to play music from your Ipod with Gtkpod. Although xmms is not the latest player I like it because it’s small and lightweight.

Which is easier to install win or linux

I was just reading this article and I just remembered going through the same last week as I cleaned out a windoz box for a friend. Rebooting like 20 times after an update of this or that, and that’s on new hardware. I could not even compare the experience to when I do installs on my Linux test box, most installs are done in less than thirty minutes and you are up and running. Installing Linux is such a breeze I don’t even have to think that much about it, while for windoz i have to plan for it and make sure I have enough time to just sit there and watch precious time being wasted.

I had to install the base OS and each service pack separately and restart some more, now on linux you might have to reboot only if there is an upgrade to the kernel, but generally updates don’t require a reboot.

Convert wma/mp3 to ogg

Had a few wma’s I needed to convert to a different format as I was having trouble streaming them over the net with my internet jukebox. I decided to go with ogg since I don’t have a decent hardware setup, GUI converters did not give me the best output. I tried both oggconvert and soundconverter both are great apps, but my hardware didn’t do them justice, but the command line came to my rescue. To convert the wma’s to ogg I used this cmd

find -name '*wma' -exec ffmpeg -i {} -acodec vorbis -ab 128k {}.ogg \;

This will convert all wma’s in the folder and subdirectories to ogg and you don’t have to take out empty spaces in the file names, it handles them ok.
All the new files have a name “track name.wma.ogg” to rename them to “track name.ogg” I was given this handy scripts by my friends at LinuxQuestions.org.

for file in *.wma.ogg; do mv "${file}" "${file%.wma.ogg}.ogg"; done

and

for file in *.wma.ogg; do mv "${file}" "${file/.wma.ogg/.ogg}"; done

This last one is a more general solution that keeps the first part, and the last part, regardless of the extensions used

for file in *.wma.ogg; do mv "${file}" "${file%%.*}.${file##*.}"; done

just change your variable to suit whatever you are working with.

Trying out a lightweight Linux Distribution

I started trying out a few lightweight linux distributions for and old box “PIII, 256Mb” and it has been an interesting experience. Right now am checking out zenwalk and will try crunchbang in a day or so. It seems zenwalk is better suited than most common linux distros for new comers to linux than even well known ones like ubuntu and fedora.
Just to make a point clear am not bashing fedora or ubuntu, i have used both at one time or another and a few more. But I was looking for something I can use on a box for grandmama, that means few updates, no hassle install and most of the stuff running out of the box flash,mp3 etc.. I was just gonna try it for a day or so(Zenwalk) but it has ended up getting itself permanently on one of the partitions because it it is so user friendly, even my other half who is not sold on linux has been using it without any major complaints just the usual “where is word” and their collection of games even kid friendly ones is quite good.
Personally my main distro on my desktop/server is Centos, am looking forward to learning some new things along the way. I will come back and write on what I found out.

Edit: Tried cruchbang and a few more since I wrote the post and of those I tested slack based distros have the crown namely with Zenwalk and vector linux. One of the biggest problem with other linux distributions I found out during the test is that while the full live desktop versions running kde and gnome work ok out of the box, the xfce light verson most suitable for old hardware have video problems. I have now decided to stop the test and insted have opened up several bug reports with the ones I had problems with to try and resolve these problems.

Launch Adobe Reader from cli

I have adobe reader Installed on my box but there is no icon to launch it, so I checked up on how to do this:
From CLI type

acroread

to create a custom launcher use the command

%acroread

with the percentage sign added.
i normally don’t use it on my box but every now and then I come across a secured pdf that kpdf won’t open.
For more options check out this link
NB not all distros require the percentage sign when adding the cmd to a custom launcher.

yum-complete-transaction

After upgrading my box to centos5.3 I started seeing an error

There are unfinished transactions remaining. You might consider running yum-complete-transaction
first to finish them

On trying to run yum-complete-transaction the cmd was unrecognized.
. Solution: Install yum-utils, drop down to root environment (su -) and run the cmd yum-complete-transaction, it should run and fix your yum problem

.

Restoring wordpress from database

I messed up the permissions on my box and on restart three quarters of the services would not come up so doing a database backup was out. All my previous DB backups had the plugins still active. So when I tried to restore using them the blog is viewable, but when I try to log in I get a blank page on checking my Apache logs I saw the following error

Cannot use string offset as an array in wp-includes/capabilities.php on line 116

Restored database a couple of times nothing worked, tried upgrading & updating database nothing worked. Finally just installed WP from scratch with blank database. Opened up PhpMyadmin replaced new WP tables with tables from old WP DB backup, skipped table wp_options as it broke the new WP and both user tables as I had already setup the new user data on install, but I guess if you want to keep the old user data you can transfer these too.
Now I just made a backup of wp_options after restoring all the settings e.g blog name etc and turning off all plugins. This way next time all I have to do is just switch this table with the one from a backup whose plugins were still on at backup and am good to go.