Call of Duty / Black Ops / Modern Warfare Disconnecting from Xbox Live on Start Up

April 4th, 2011

Off beat post this.

My sons Xbox started misbehaving the other day, and refused to run the Call of Duty games connected to XBox Live. The games would start up Ok, but then disconnect from XBox Live - not good. Googled a lot but not much out there (a lot about it disconnecting during games but not on start up.)

General advice was to clear the system cache, or wait at the dashboard for a while, open ports on the router, reset the console, recover gamertag, but these didn’t work. Other games like Team Fortress would play OK, though.

Finally I tracked down the solution, which was to set a FIXED IP Address for the XBox on the router. It had been working fine previously on DHCP, but suddenly stopped working. The fixed IP address resolved all the issues on all the games.

I am an utter cult :)

Simple Linux Slideshows

March 6th, 2011

For running in X:

Use feh

sudo apt-get install feh

Set up a directory with photos in it, e.g. ~/photos or ~/Pictures and then run this command:

feh -zZxF -D 10 ~/photos

(-z for random, -Z for autozoom, -x for borderless windows, -F for fullscreen, -D for time on screen)

You might try using unclutter to get rid of the mouse cursor, but on some setups this doesn’t work well with feh, alternatively just move the mouse down into a corner somewhere

For framebuffer: (assumes you have your framebuffer up and running OK, see here for how)

Use fbi

sudo apt-get install fbi

Set up a directory with photos in it, e.g. ~/photos or ~/Pictures and then run this command (n.b. you might need sudo depending on your setup):

(sudo)fbi -ua -t 10 ~/photos/*

(-u for random, -a for autozoom, -t for time on screen)

Press V on the keyboard to hid the status line (although its a nice added feature)

(A nod in the direction of KMandla for getting me going on this :) )

Meld - saved me from myself!

March 4th, 2011

Meld is a file/directory differencing programming (with GUI). (in the repos)

I was under orders to put together a new website for my work, and didn’t want to pay out for web designers, so I turned to Drupal 7 for the first time and had a play. Over the last couple of months, in bits of spare time, I tinkered and fiddled, setting up home pages, news pages, forums, sidebars and menus, getting the theme right. Lots of good help from the community, but ignoring all guidance about not fiddling with the “core”.

Anyway I got to a position where I could go “live”, so reorganised the domain forwardings, adjusted a few absolute link references and we were off. At this point my sysadmin brain kicked in (it’s very small :)). Back it up? What if Drupal updates overwrite all my work so far?

So I ftp’d a copy of the drupal folders down to my machine, and saved out a copy of the MySQL database using phpmyadmin. A good start, but what about all the changes I had made? Introducing Meld.

Just open it up, point it at the two directories you want to compare, and let it rip. Amazing. It identifies and highlights all the differences between the two folders (including sub directories) or files.

A folder view

Meld Directory Compare

A file view

Meld File Compare

So with this tool I am now able to document all the changes I made to the “core”, and recover if and when I update Drupal or any installed modules. By the way, Drupal is a huge leap forward and a great website/blog/forum website builder.

Jinamp Party Piece

February 26th, 2011

Jinamp Party Piece

Ok, daughter having birthday party, kicking us out of the house for the evening. Last year, I set her up with Audacious on the htpc so that she and her guests could chose music to play, with a couple of backup options of using xbmc or a DVD full of mp3s. This year we have a new machine running as htpc, no DVD drive. Also, daughter just wants a shuffled playlist to run, with no intervention.

A few weeks ago I was mooching about on KMandla’s new wiki of CLI apps, and came across jinamp , which is a sort of background player. What it does is takes the feed of a directory or playlist, shuffles it, then sequences it to a player of its or your choice, then disappears off into the background.

So I built up a playlist using audacious, called it pop.m3u and saved it to a shared place on the network. I needed to tidy up this list to just have file paths and names so:

sort pop.m3u > pop.lst

*.lst is the default file format for playlists with jinamp. Next I just opened up pop.lst and deleted all the EXTINF lines, which were now nicely sorted to the top. So now the playlist contents looked like this:

/path/to/song1.mp3
/path/to/song2.mp3
/path/to/song3.mp3

Order doesn’t matter because it is going to get shuffled anyway ;)

So downloaded and installed the latest (and pretty old) version of jinamp

sudo dpkg -i jinamp_1.0-1.i386.deb

I also had to install mplayer, as I was going to use this as my player:

sudo apt-get install mplayer

Added just one line to mplayer’s ~/.mplayer/config file for now:

af=volnorm

in the hope that this would help to normalise sound levels (seems to do something)

Right ready to test now, here is the basic command to get it running:

jinamp -p /usr/bin/mpayer /path/to/pop.lst

There is a little pause, and then music starts playing, you are back at the command prompt, and can no longer interact with the program. If you look in htop, you will see an entry for jinamp and also one for mplayer playing the file.

I set up the htpc with a fullscreen terminal, which would just serve to confuse (no fiddling) and amaze (how cool and geeky!) 17 year olds :) Had to run this with X, as for some reason I can’t get a VT over hdmi.

But of course you need to be able to interact with jinamp, to stop it (it will just keep on going!) or to skip to the next song. You might also want to display the title and artist of the current playing song as well. This is where jinamp-ctl comes in.

jinamp-ctl stop

will stop the thing running and close the player.

jinamp-ctl next

will move you to the next song on “jinamps” list.

jinamp-ctl query

will show you the name of the currently playing song (along with its full path!)

So I set about figuring out how to start the player, and then show the name of the currently playing song in the middle of the screen, without the mp3 extension, no cursor or mouse cursor, in a lovely cyan colour with a black background. I needed a script!

To remove the terminal cursor you have to type:

setterm -cursor off

To remove the mouse cursor, the easiest solution I found was to install “unclutter” and then run it, removes the idle cursor from the screen after 5 seconds by default. Further usage and investigation shows that unclutter runs at start up so if you like having it in your session, you don’t need the command. If you want to choose when to start unclutter, then edit the /etc/default/unclutter file and change true to false.

sudo apt-get install unclutter

unclutter

To change the colour of the screen text I needed “tput” which is already installed by default.

tput setaf 6

makes text cyan

tput setab 0

makes the background black (already is but useful to know)

tput bold adds

bold to the text to make it stand out more.
More on this here

Next was to strip the filename back to you the Artist and Title from the output of jinamp-ctl query. I did this by piping jinamp’s output into xargs and basename as follows:

jinamp-ctl query | xargs -0 -n1 -imp3 basename mp3 | cut -d”.”

It took a fair bit of googling to find all the elements required for this :)

Then I needed this output to update regularly. Too tricky for me to figure out what was required when the song actually changed, so I just went for a routine that fired every five seconds:

sleep 5

Finally, the solution to centre the text output on the screen. This takes a bit of trial and error, I am sure it can be figured out programatically rather than adjusting numbers, but for my purposes, this worked. The htpc screen is running at 800×600 (because the htpc is also linked to another older TV that can’t cope with more) so a terminal at full screen has @ 80 columns and 30 lines. I found that:

perl -e ‘print “\n”x10′;

added enough blank lines, and then piping all the output through to:

sed  -e :a -e ’s/^.\{1,57\}$/ & /;ta’

put the text more or less in the centre. ( I also set terminal font size to 16 ). Life is too short for me to learn and understand sed :)

So the final script called jinamp.sh looks like this:

#! /bin/bash#hides cursor
setterm -cursor off &

#hides mouse cursor after 5 seconds
unclutter & # (only needed if you haven’t rebooted)

#starts jinamp with named playlist

jinamp -p /usr/bin/mplayer “/media/music/burn/pop.lst”

#displays playing file every five seconds when jinamp is running

tput setaf 6;
tput setab 0;
tput bold;
while [ 1 ]; do
jinamp-ctl query | xargs -0 -n1 -imp3 basename mp3 | cut -d”.” -f1 && perl -e ‘print “\n”x10′; sleep 5; done | sed  -e :a -e ’s/^.\{1,57\}$/ & /;ta’

This is all fine, but daughter might wish to move to the next song. To save her fiddling about at the htpc with wireless mini keyboards and remotes, I simply set her up with a putty ssh session into the htpc so that she could type jinamp-ctl next.

Party is tonight, so we’ll see how well it goes. Had the thing running all morning without a hitch, but will have to write instructions in case of power failure, or some oik unplugs the htpc, etc…..

Audio Books in the Public Domain

February 20th, 2011

Got a hold of this through the AudioBooks app on my HTC phone

Librivox

which is a repository of some 7000 audio books from all types of literature from 1923 to earlier. OK, its old but some good stuff in there.

Xubuntu User “Face” or Avatar on GDM login screen

February 13th, 2011

There doesn’t appear to be a way within settings to add a user image to the gdm user login screen, but this can be resolved in a simple way:

Get your image or avatar, make sure its a sensible size e.g. 96×96 pixels.

Copy it to your home directory

Rename it .face

Logout and then see your new avatar on the login in screen.

The same icon also shows up when you go into Users and Groups.

Simples :)

PS2 Eyetoy Webcam on Xubuntu 10.10 Recording and Playback

January 9th, 2011

More fun to be had with your PS2 eyetoy as webcam. This all was tested using the silver eyetoy, but I see no reason why the black one won’t function just the same.
(Remember this is without pulseaudio!)
(a copy of the post I made on Ubuntuforums)
Recording Sound:

First off, define which device is generating the sound from the microphone

Code:

aplay -l

This tells me my eyetoy microphone is card 1, device 0, which translates to plughw:1,0. To record sound from the mic enter this command in a terminal:

Code:

arecord -f cd -t wav -c 2 -D plughw:1,0 foobar.wav

This records a wav file at CD quality.

Video Playback:

Lots of choices here:

Code:

mplayer tv:// -tv device=/dev/video0

Code:

cvlc v4l2:///dev/video0

and the monster that is gstreamer (you’ll need to ensure gstreamer-tools is installed)

Code:

gst-launch v4l2src device=/dev/video0 ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! xvimagesink

Capturing Video - Video and Sound:

This proved harder than I thought as vlc, ffmpeg and mencoder flatly refused to do the job with all the command lines I found out on google.

Using gstreamer again, although this is a bit unwieldy:
Capture Video only (no concurrent playback):

Code:

gst-launch v4l2src device=/dev/video0 ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! queue ! videorate! 'video/x-raw-yuv,framerate=30/1' ! theoraenc ! queue ! oggmux ! filesink location=output.ogg

Capture Video and Sound (with concurrent playback):

Code:

gst-launch v4l2src ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! tee name=t_vid ! queue ! videoflip method=horizontal-flip ! xvimagesink sync=false t_vid. ! queue ! videorate ! 'video/x-raw-yuv,framerate=30/1' ! queue ! mux. alsasrc device=plughw:1,0 ! audio/x-raw-int,rate=48000,channels=2,depth=16 ! queue ! audioconvert ! queue ! mux. avimux name=mux ! filesink location=output.avi

FFMPEG
Capture Video and Sound (variants on):

Code:

ffmpeg -t 10 -f video4linux2 -s 640x480 -r 15 -i /dev/video0 -f alsa -ac 2 -i plughw:1,0  -aspect 4:3 -s 720x400 -qscale 3 video-with-sound.flv

Code:

ffmpeg -t 10 -f video4linux2 -s 640x480 -r ntsc -i /dev/video0 -f alsa -ac 2 -i plughw:1,0 -qscale 3 video-with-sound.avi

Just video:

Code:

ffmpeg -f alsa video4linux2 -s 720x480 -r 30000/1001 -i /dev/video0 -sameq -aspect 4:3 -f avi -vcodec mjpeg -r 30000/1001 -y output.avi

Enjoy

Acer Aspire 110L Netbook CLI Installation

January 3rd, 2011

Did this a couple of years ago, forget what I did, so wrote it down this time. Had a bit of a fight getting the framebuffer up and running, but finally found the right blog post!

Distro:
Xubuntu 10.04 LTS ALT CD

Wired Connection (to start with)

#Apps
moc
mc
mplayer
fbi
htop
e-links
alpine

#Installs
openssh-server
screen
portmap
nfs-common
hwinfo
alsaequal + caps + libasound2-dev + libasound2-plugins + swh-plugins
aria2
wicd-curses
alsa-utils
build-essential
v86d

#Tweaks to Framebuffer

#edit /etc/default/grub
#add as follows:

GRUB_COMMAND_LINE_DEFAULT= nomodeset video=intelfb:mode_option=1024×600-24,mtrr=3,scroll=ywrap  (plus whatever else you want there)

GRUB_GFXMODE=1024×600
GRUB_GFXPAYLOAD_LINUX=1024×600

#in terminal:
sudo update-grub2

#edit /etc/initramfs-tools/conf.d/splash
#and add:
FRAMEBUFFER=yes
#or in terminal:
echo FRAMEBUFFER=y | sudo tee /etc/initramfs-tools/conf.d/splash
#then:
sudo update-initramfs -u

#reboot

#Tweaks to wicd
#It fails to start the network connection manager on installation added static IP, but it still takes a minute or two to make the connection, after that solid and quick to try manual config next

#Tweaks to Grub2
#see above for framebuffer
#only other change was to reduce grub timeout to 3:
#in terminal:
sudo nano /etc/default/grub
#edit as below:

GRUB_TIMEOUT=3

#in terminal:
sudo update-grub2

#Tweaks to mplayer
#Found that I needed to use vo=fbdev2 to play back movies on the framebuffer
#Also doesn’t completely take over when scale=1024:-3 & fs=yes is used so having to run setterm -cursor off blank 0,
#however in most situations will use video at fullscreen
#config file (in ~/.mplayer/config) as follows:
#in terminal:
nano ~/.mplayer/config
#add the following:

###
#gives proportionate scaling and centres on screen
#fs=yes
#vf=scale=1024:-3
####
#gives fullscreen :)
vf=scale=1024:600
###
vo=fbdev2
dr=yes
double=yes
framedrop=yes
ontop=yes
cache=8192
lirc=no
alang=en
slang=en
ao=alsa
#cuts down on the chatter - comment out if you need to debug
really-quiet=yes

#Tweaks to NFS
#Of course ensure portmap and nfs-common are installed on the AA0, and you have a working nfs server serving up shares you can connect to!
#Just did the usual, created mount points in /media and setup nfs shares in my fstab
#for example:
#in terminal:
sudo mkdir /media/films

#in fstab:

myserver:/films    /media/films    nfs    rsize=8192,wsize=8192,timeo=14,intr,bg

#Tweaks to AA0
#Fan Control - basically shuts it up
#acerfand / acer_ec.pl
#see acer fan post

#Hot plugging for SD cards
#in terminal:
sudo nano /etc/modprobe.d/aa0-fix-sd-slots.conf
#add the following content:

# Enable USB card reader
options pciehp pciehp_force=1
install sdhci for i in 2381 2382 2383 2384; do /usr/bin/setpci -d 197b:$i AE=47; done; /sbin/modprobe –ignore-install sdhci

#Then edit /etc/modules:
#in terminal:
sudo nano /etc/modules
#add the following to the end of the file:

#fixes SD slots
pciehp

#reboot

#Tweaks to alsaequal

#Create/edit ~/.asoundrc
#in terminal:
nano ~/.asoundrc

ctl.equal {
type equal;
}

pcm.plugequal {
type equal;
slave.pcm “plug:dmix”;
}

#switch the commenting of the next two lines if you don’t want alsaequal as your default soundcard
#pcm.equal {
pcm!.default {
type plug;
slave.pcm plugequal;
}

#force-reload all your alsa modules:
#in terminal:
sudo alsa force-reload
#and start EQing with:
#in terminal:
alsamixer -D equal

#starting up moc with mocp, then playing music, press q, moc goes away but music carries on, then:
#in terminal:
alsamixer -D equal
#and play with the settings until you are happy

#alsaequal does tend to use a fair few cpu cycles, moc running at @ 25% CPU.

#Tweaks to

I’ll have a proper play with alpine and elinks later

Zenity Exit / Shutdown Script for Openbox

January 1st, 2011

Finally got around to doing this.

Use the zip file included at the bottom, as all the double hyphens get lost on this blog.
Also, depending on with version of zenity you have (e.g. on Debian Squeeze / #!-10), you may need to remove the  “- - no-cancel” options in the second half of the script. Enjoy :)

#!/bin/bash
# Multiple Exit Script using Zenity for non GDM installs
# Requires zenity and an edit to sudoers to allow all users to use the shutdown command
# As follows:
#
# Open a terminal
# EDITOR=nano
# sudo visudo
# Scroll to bottom of file and add this: (not the #)
# ALL ALL=NOPASSWD:/sbin/shutdown
#
######## This part is the Exit Type picker  ##########

title=”EXIT: What do you want to do ?”
exit_type=`zenity  –width=”530″ –height=”220″ –title=”$title” –list –radiolist –column=”Click Here” \
–column=”Exit Type” –column=”Description” \
TRUE “Logout” “Log Current User out and return to Login Screen”\
FALSE “Reboot” “Reboot the PC”\
FALSE “Shutdown” “Shutdown the PC”\
FALSE “Cancel” “Cancel the Exit” \
| sed ’s/ max//g’ `

echo “$exit_type chosen as the Exit Type!.”

#user must select a target type (Check if they cancelled)
if [ ! “$exit_type” ]; then
zenity –error –title=”Error” –text=”You must make a selection!”
exit
fi

######### This part takes the selection and applies it!  #############

# Edit this first section if not using openbox! #
if [ “$exit_type” = “Logout” ]
then
# Do logout here.
openbox –exit && sleep 1 | zenity –progress –percentage=95 –title=Logout –auto-close –auto-kill –no-cancel –width=300

elif [ “$exit_type” = “Reboot” ]
then
# Do Reboot here.
sudo shutdown -r now | zenity –progress –percentage=95 –title=Reboot –auto-close –auto-kill –no-cancel –width=300

elif [ “$exit_type” = “Shutdown” ]
then
# Do Shutdown here.
sudo shutdown -h now | zenity –progress –percentage=95 –title=Shutdown –auto-close –auto-kill –no-cancel –width=300

else

#if [ “$exit_type” = “Cancel” ]
#then
# Do Cancel here.
sleep 1 | zenity –progress –percentage=95 –title=Cancelling Exit –auto-close –auto-kill –no-cancel –width=300
fi

exit.zip

Fix the Noisy Fan on an Acer Aspire One

December 31st, 2010

There are two ways of doing this, depending upon the bios and kernel you are using

1. For older bios’ <3309 or for setups with an older kernel (say pre Ubuntu 10.04)

This is an oldie but goodie, thanks to netbook tech for guidance on this

#Download as follows:
wget http://electronpusher.org/~rachel/acerfand
wget http://aceracpi.googlecode.com/svn/trunk/acer_ec/acer_ec.pl

#Copy both files to /usr/local/bin
sudo cp acerfand /usr/local/bin/
sudo cp acer_ec.pl /usr/local/bin/

#Make acerfand executable
sudo chmod 755 /usr/local/bin/acerfand

#Add acerfand to your rc.local so that it fires up on boot
sudo nano /etc/rc.local
place /usr/local/bin/acerfand at the bottom of the file, before the exit 0

#Restart

#Configure
edit acerfand at your peril :)
or create an /etc/acerfand.conf with the following content:

INTERVAL=5
FANOFF=60
FANAUTO=70

These are the default values, temps are in celcius

This makes my setup with 10.04 LTs and bios 3310 shutdown after @ 30 seconds, so…

2. for newer bios > 3309 of newer kernels > Ubuntu 10.04+

This method can be u tried on older setups if 1. doesn’t work. From 2.6.31 this is included in the mainline kernel

Download this file:

wget http://www.piie.net/files/acerhdf_kmod-0.5.25.tar.gz

tar zxvf acerhdf_kmod-0.5.25.tar.gz
cd acerhdf_kmod
make
sudo make install

You might need to install you linux headers for your kernel to make/make install

Add acerhdf to /etc/modules so that it runs on boot

Run this command as root:

sudo -i

echo -n “enabled” > /sys/class/thermal/thermal_zone0/mode

Now test by running

sudo modprobe acerhdf