Thursday, December 30, 2010

Reading PDFs & Jpegs In The Terminal

Everynow and then I need to look at a pdf in the console. To do this fb is used to create a framebuffer to get fb install fbida-fg package.

Tuesday, December 28, 2010

Eclipse Autocomplete

To get instant autocompletion in Eclipse goto Windows → Preferences Java Editor → Content Assist → Auto-Activation

Then set Auto-Activation to zero, or a number much smaller than the 200 ms delay.

Something Old

This was the first thing that I ever wrote that seemed to be any good to me.

Ponder, Command and Conquer

more signals at eleven
This is an object of type IOConciousStream

I am the invisible man
wandering the land of the ghosts
In triple darkness my cipher is manifest
without a living dharma would there be karma?
I create mad vibes for my tribe

While we ponder, and wander
about creation of our nation
Seeking ethereal simulation
by engaging in random procreation
can you have a sunflower sutra
without the creation of a latin sura?

I get high off seminal earth, the windy word and the cleansing fire.
While you and I verse we can deceive entropy and the hearse

This life is a trial on the truth forsooth none of can escape the noose
And while sipping on crushed grapes I contemplate
Ghandi the Askari sitting under Olumo,
dancing on Pluto and laughing at Profumo.

Well, I init call on PlanB which floats the function,
ActiveMeasures(int p*)
We issue a final call, a clarion to all or if you want
wear the grinning mask and engage in scheming tasks
but remember that the Ghostface Killer and Bobby Digital will overthrow your whole citadel

We close like Ibn Khaldun yelling koom fa ya koom
And voice cries out in the wilderness Iqra! Iqra! Before your doom Ahad laila Ahad !

I am the invisible man surrounded by ghosts and motes
I drop lyrics and rimes to hebephrenics
Integrate with surds and paralleize the new ontogeny

people instill fear in their progeny
due to their own mental dichotomies
we all commit crimes in chasing dimes
heed the word and weed your deeds

Thank you patient reader

Banji Trimegistus, Kassim Ibn Hammed

Don’t make me get all iambic on your pentameter

Fixing Update-alternatives' No such file or directory Messages

I found out that if I get the message "failed to read link /usr/bin/: No such file or directory" removing and recreating the symlink helped.  Below are the steps that I followed, this was all by trial and error, reading the alternatives man page and looking at what people have posted on the web.

  1. When an error message in the form, failed to read link /usr/bin/: No such file or directory was sent by alternatives I would do an ls -l to see where the symlink was pointing. 
  2. Remove the symlink /usr/bin/ if it was pointing to /etc/alternatives.
  3. Create a new symlink in /usr/bin/ pointing to /usr/java/jdk1.6.0.21/bin/.
  4. Run /usr/sbin/update-alternatives –install /usr/bin/   $JAVA_HOME/bin/ $JAVA_ALTERNATIVE_PRIORITY 
  5. Do /usr/sbin/update-alternatives –auto

After I went through all the steps I did not get any complaints from Fedora and my Java seemed to be correct. 


To see exactly where the ymlinks are pointing too use the ll command.  An example of its output is below.

$ ll /usr/bin/javasw
lrwxrwxrwx 1 root root 24 Dec 28 01:20 /usr/bin/javasw -> /etc/alternatives/javasw

Unfortunately running ll /usr/bin/jar gives a no such file or directory message.  Typing jar works but need to make sure its the right jar.  so that when I call on libraries they will be the right ones.

Monday, December 27, 2010

Beautiful photos

Come and see.

Configuring Alternative Packages in Fedora

In this world of multiple Javas and other packages, and Debian created the alternative system to make it easy to pick which implementation of of a package should be selected. Though the man page is helpful Chris Taylor's Wednesday Why gives a succinct explanation of why Fedora adopted this technology.

Most of the time to set up an alternative do the following command:

sudo alternatives --install

For example if I have jdk1.6.0_21 & jdk1.6.0_23 installed and I want to use the latter's compiler I would do,

sudo alternatives --verbose --install /usr/bin/javac javac /usr/java/jdk1.6.0_23/bin/javac 16023

That way if jdk1.60.21's files are untouched by the symlink /usr/bin/javac now points to /usr/java/jdk

From what I have read so far alternatives is a good way of managing symlinks on your system.

Wporta shows how to install and configure Java for a 64 bit system. I might write a bash script to automate this configuration if there is a need. Another good resource is here.

An Old Vim Buffer Trick

When switching between buffers I usually forget that instead of typing :nextbuffer I can simply do :b where is the number of the next buffer. Or even better yet;

<CTRL>-^ to switch to the next buffer

To open the buffer in a new window in a new window <CTRL>-w followed by <CTRL>-^

With all those short cuts why remap the keys as Gmikeus shows us. butin matters of workflow there is no disputation. I do like Gmikeus' article which contains a lot of cool info.

I still find it easier to type :b in command mode. Well if I ever forget again I will look at either the buffer FAQ or's useful commands list.

Hopefully now that I've written this the vim short cuts will ne'er be forgot.

Hip Hop Was A Popular Art Form And It Still Is

Almost all the shots in DWYCK are closeups. Its possible that they were made with a handheld on some kind of stand. Furthermore since there are a number of cuts they only needed one camera person. Having one camera person probably helped keep the costs of video production cheaper, its possible that Gang Starr got one of their friends to shoot and edit the video. I would not be suprised if the dancers were friends or around-the-way girls.

Oh My God! Fela Also Played Rock!

The beginning of Confusion starts with something that sounds like Stereolab's mellow mix of drums, and horns with synthesizers. Then I heard a mix of rhythms that sounded like a dash of the Doors bringing the big beat from Texas Radio

But then ... in the Juju of Kollington & Sunny Ade, that my parents listened to, the same bars were caressed on electric guitars. Some Indian music is so eerie because the beats are familiar, but its all irie. Its funny that Fela's and The Door's keyboarding sounds comes from the same place..

The music is a mellow chill song till the horns blow. The eruption of woodwinds quickens the blood and attacks the heart with its urgency. Then the maestro's big, confident voice, bursts out telling us the meaning of trouble. The voice tells us; "we all know I am larger than life. This is the essence of man, by this riff I conquer, for I make all rhythms new."

And yet despite the power of his songs it was not enough. The Zarathustra of his country who spoke to the new age but we had not killed of the old one instead it got coopted into reaction.

Saturday, December 25, 2010

The Junkie's Christmas Part1

The first ever piece of William Burroughs spoken word material that I ever heard was The Priest they called him. Later on I heard the Christmas version and the film never disappoints.

Getting the other parts of this fil is left as an exercise to the reader.

Use The Shift Command To Iterate Over Bash Positional Parameters

I was writing a script where both an array and a string needed to be passed to a bash function. As in the example below.
On the caller's side there is no problem doing that but in the function is where the magic happens.

Funcer "$var1" "${anArray[@]}"

Now in Funcer imagine that our code was as such as

Funcer ()
local hostname="$1"
local host_params=("${2@}")

Bash's interpreter will assume that our array of args has only one item and will ignore $2. You might think that using the the the statement local host_params="${2[@]}" will be copacetic but then the interpreter will show you this is very wrong. The thing you need to do is use shift to move to the next parameter as shown below.

Funcer ()
local hostname="$1"
local host_params=("${@}")
for host in ${host_params[*]} ; do

   echo -en "\"$host\","

echo '\n'

} # ---------- end of function Funcer ----------

There is more information at here and in the ABS.

Friday, December 24, 2010

ALL CAPS For My Jellied SQLed Soul

I have not been able to do anything with my C# project or bash scripts for the past two days my brain has been like jelly when it comes IT which makes Banji sad. To cheer myself up I watched MF Doom/Danger Doom videos which inspired me to write the piece of hack verse about some of my favourite things.

Two MF Doom Imitators walk into a bar.......
After eating peanuts from jars
and talking about state of Monster Island's Czars
they compared rhyming scars

In the heat of arc lights
after much fuss, and a short fight
one sent out a stream of glossolalia in hex
The second pseudoinnovator cleared a cache with expect.
(he needed a place to store the beloved paraclete)

Then under the singing leaves
Deborah consults with a Bible Geek
about the location of the furthest babbling brook,
They need a place to dry the pages of a profane book.
while dancing to the tunes of Apook.
I guess this is no Burroughs material,
unlike his stuff my pages are ethereal

That is why I drove myself to Mexico.
so that I could here I on I's Dead City radio.
chanting "born like this", I wear horns like this.
Walk like a Tool Master of Brainerd
on a pilgrimage to the newest iteration of Hurd
I eat corn and fish, the two of them together are most delish.

The destroyer is here, but never fear
Since they cut down all the Yage
how can they take a gauge
on your bersker rampage?
Are you an archon engaging in a little kayfabe? ;-)

Now hear comes Elijah with his sacred hair on fire
Enoch recites the Babylonian King List for Enkidu who makes a moue
at the 365th, new you
Angel headed hipsters haloed in street lights
pick up the fight against reactionaries
in stalhhelm

All because the Cannon Group gave them a dare!
But this ain't no night of long knives,
or the rebirth of Dr Fibes.

Thats as silly as a mash up of Iggy Pop in The Land That Time Forgot.
The scissors of fate made their cut
to late and now
axis mundi has gone bye.
Louis! Louis! can you ken why?

Mlk holds us in his brass embrace.
Dipping us into the fire of Golgotha
As his Ashera sings us assurances
culled from the best of commercial occurrences
Parnassus on his wheels of steel laughs because
the sacrifices will not bring Carthage into the new age.
He read the entrails of a million snails to pierce the future's veil.
With one eye he peers into infinite night.

I drink rockstars while Carmela's daughter parks cars
The psychopomp on a horse
dances over Nietzsche's corpse
In the meantime King Geedorah walks in,
from looking at 42 views of sin.
With his mouth agape, and knees aquake he
the Germans with street sweepers
the MF Doom praise keepers,
the figments of imagination from many nations
And he asks what video brought about this strange discourse?
And we shout Why ALL CAPS of course!

Tuesday, December 21, 2010

A Flac to Mp3 Conversion Shell Script

I've had to do it enough times that I wrote a script yesterday to automate the conversions for me. There is a related one for converting aac files to mp3. Eventually I will just build one app that will convert any audio format to mp3.






#Audio File Metadata Tags


declare -a tagList # Store the tags in this array

#=== FUNCTION ================================================================
# NAME: DisplayUsage
# DESCRIPTION: Prints help information and exits
echo -e
echo -e "usage: $0 [directory]"
echo -e "Options:"
echo -e " -h or --help or displays options for $0"

# Statements dealing with calling the help function.
# If no args are given to fix_permisions then call DisplayUsage.
if [[ "$numOfArgs" -lt 1 ]]; then

# If first arg is -h or --help call DisplayUsage.
if [[ "$1" == "-h" || "$1" == "--help" ]] ; then


#=== FUNCTION ================================================================
# NAME: FillsTagList
# DESCRIPTION: Fills the taglist array with a flac file's metadata
# PARAMETERS: Gets passed a flac file
# RETURNS: Should return an error if there is problem (not done yet)
FillsTagList ()
local ftc_flacFile="$1"
local count=0

    # Create a tmp file where the flac metadata is stored.
touch flac_tags.tmp
metaflac --export-tags-to=- "$ftc_flacFile" > flac_tags.tmp


exec 0<flac_tags.tmp

for line in $(cat flac_tags.tmp) ; do

    # Now that we are done delete the tmp file.
rm flac_tags.tmp
unset count
} # ---------- end of function FillsTagList ----------

#=== FUNCTION ================================================================
# NAME: GetSongMetadata
# DESCRIPTION: The data that we got from FillsTag is put into the tag
# variables.
# PARAMETERS: Uses global variables
# RETURNS: Later on will make it throw an error code if there are
# problems.
GetSongMetadata ()
local fileName="$1"
FillsTagList "$fileName"


} # ---------- end of function GetSongMetaData ----------

#=== FUNCTION ================================================================
# NAME: ConvertsToMp3
# DESCRIPTION: Sends a flac file to functions that get its metadata.
# When the metadata is acquired then convert the flac to an
# mp3 using a bitrate of 256.
# PARAMETERS: a flac file.
ConvertsToMp3 ()
local flacFile="$1"

    # We only want to convert files that are not copyprotected (DRM free).
if [ ! -r "$flacFile" ] ; then
echo -en "$flacFile is unreadable. ConvertsToMp3 error code "
echo -e "$FLAC_FILE_UNREADABLE, (copyprotected flac file)."
        # Next call GetSongMetadata to fill the IDv3 tags.
GetSongMetadata "$flacFile"

flac -dc "$flacFile" | lame -b 192 -h --ta "$artist" --tn "$track_num"\
--tt "$song_title" --tl "$album" --tg "$genre" --ty "$year" \
--add-id3v2 - "${flacFile%*.flac}.mp3" &>>$log_file

mv "$flacFile" "$trash"

} # ---------- end of function ConvertsToMp3 ----------

#=== FUNCTION ================================================================
# NAME: VerifyDirectory
# DESCRIPTION: Tests if the directory given as arg to script exists.
# PARAMETERS: $1 (directory to search for text files.)
VerifyDirectory ()
local targetDir="$1"
echo -e "$targetDir in VerifyDirectory"

if [ -e "$targetDir" ] ; then
return $DIR_FOUND
echo -e "$targetDir not found sending $DIR_NOT_FOUND back"
} # ---------- end of function VerifyDirectory ----------

VerifyDirectory "$flacDirectory"
#echo "$dirTestResut was the result of calling VerifyDirectory"

if [[ "$dirTestResut" -eq "$DIR_NOT_FOUND" ]] ; then
echo -e "Cannot find $flacDirectory"
cd "$flacDirectory"

for file in ./* ; do
       if [[ ${file##*.} = "flac" ]] ; then
           ConvertsToMp3 "$file"


Also I am finding out that the bashsupport plugin for vim is very cool.

Rebuilding My Fedora 13 Kernel

When I would use Slackware I did Kernel rebuilds every six months. But the first time I tried to do one in Fedora 5 it did not go well. After spending 5 hours I decided to stick with the standard FC kernels. All of that changed about two weeks ago.

My laptop would keep crashing and the network modules would fail for some reason. It was doing this daily and I got so tire of it that I decided that I would have to do the following things:
  1. Remove unneeded modules and options from the kernel.
  2. If it still gave me problems first look in the logs for messages
  3. Run strace & ktrace on the applications that I was using during the panic.
  4. If its still giving me problems rebuild the kernel again but this time with logging.
To rebuild the kernel I mainly just followed the steps in Timme's Howtoforge article.

The Rebuild Process

First find out exactly what hardware I have by running the commands either one of these commands lspci, or lshw. I did not need to run lsusb to see the usb devices since either of the two latter commands will give you that. Then After I followed steps 2 - 2.5 of Howtoforge's fedora compilation guide. But during step 2.5 I would do the following;

As I was selecting options for each kernel subsystem the output of lswh -class & lswh -businfo the output of lshw guided me in choosing what to include or not in my kernel. This customization took sometime, it also involved me looking up what certain kernel features did to see if enabling them would be of benefit to me. It took sometime to verify specific hardware variants but after spending most of the night on that I was done with the kernel config.

After I followed steps 2.6 - 2.7 I was able to reboot the laptop with the custom kernel on the first try. The fact that my compile and build went so smoothly tells you that Falko Timme wrote a good article on the kernel build process and I am not going to duplicate his instructions here.

Recompile's Impact

After I did that the have been no kernel panics and power management is working again. Before the kernel recompile if the laptop got disconnected for more than 5 seconds it would shut down. Even though it was supposed to go into hibernate mode it would not instead processes would die an ugly groody death, the disk would need to be fscked and I would get irritated about the cable being jostled.

Now the battery's power levels are detected again so I can run it for half an hour on the battery. There are no kernel panics and the apps are running better. Unlike the times when I used to rebuild my kernel for Slackware I did not have to go through separate steps to make sure that the sound & wifi cards were working. I'm guessing that at least for the wifi card since its built in and not using the PCMCIA slot it makes it easier for Linux- kernel to handle it.

Possible Project

Since it took me so long to get done with make menuconfig I think I will try and automate that step by generating a list of a machine's hardware then using that list of hardware components and desired services to turn on options in the kernel .config file.

That might cut down on the time I have to review the hardware. Then to take it to the next level actually have the kernel be built and installed on VM to see if it boots the machine. And if the build fails I can review why. But since the system is a lot more stable right now I will not be doing anymore troubleshooting of crashes since there have not been any mission critical failures in the past two weeks.