Monday, December 27, 2010

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"
shift
local host_params=("${@}")
for host in ${host_params[*]} ; do

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

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
sees;
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.

#!/bin/bash 

numOfArgs=$#

DIR_NOT_FOUND=12
DIR_FOUND=0

FLAC_FILE_UNREADABLE=7
HELP_DISPLAY_VAL=5

NUM_OF_TAGS=6

#Audio File Metadata Tags
artist=""
track_num=""
song_title=""
genre=""
album=""
year=""

trash="/home/griot/.local/share/Trash/files"
log_file="flac_conversion.log"

declare -a tagList # Store the tags in this array

#=== FUNCTION ================================================================
# NAME: DisplayUsage
# DESCRIPTION: Prints help information and exits
# PARAMETERS:
# RETURNS: HELP_DISPLAY_VAL
#===============================================================================
DisplayUsage()
{
echo -e
echo -e "usage: $0 [directory]"
echo -e "Options:"
echo -e " -h or --help or displays options for $0"
exit $HELP_DISPLAY_VAL
}

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

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

flacDirectory="$1"

#=== 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

BACKIFS=$IFS
IFS=$'\n'

exec 0<flac_tags.tmp

for line in $(cat flac_tags.tmp) ; do
tagList[$count]=${line##*=}
((count++))
done

    # 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"

artist=${tagList[0]}
song_title=${tagList[1]}
album=${tagList[2]}
year=${tagList[3]}
track_num=${tagList[4]}
genre=${tagList[5]}

} # ---------- 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.
# RETURNS: FLAC_FILE_UNREADABLE
#===============================================================================
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)."
return $FLAC_FILE_UNREADABLE
else
        # 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
fi

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.)
# RETURNS: either DIR_FOUND or DIR_NOT_FOUND
#===============================================================================
VerifyDirectory ()
{
local targetDir="$1"
echo -e "$targetDir in VerifyDirectory"

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


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

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

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

   done
fi


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-2.6.34.7 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.