Tuesday, June 14, 2011

Spotify, Wimp and TDC Play - a comparison

Standard
Introduction

I am using a Logitech Squeezecenter setup at home for listening to music. My goal is to only store the music locally that i have in lossless format. All the mp3 I have bought online earlier is really only a waste of space on my local server. It is a much better idea to have your lossy music streamed to you through a cloud music service. By now the quality is probably better than the mp3's I have been storing for years, there is a lot of new music for listening.

So in order to describe what my opinion is here is a short description of my setup

Hardware Setup

Old server running FreeBSD 6 with a couple of disks and a Squeezecenter server version 7.5.4. The architecture is i386.

Wimp

Activation of a trial account is very very easy. All you need is an active mobile phone number in order to start your trial period. In Denmark Telenor is a Wimp reseller and if you have two products (eg. phone and internet) through Telenor you will get a 50% discount. The normal price is 99 DKK a month, and you will be able to get it at 49 DKK.

I have neither so for me the price is 99 DKK which I find to be ok for access to 9 million songs online with new added regularly.

The quality of the streamed music is OK, but not fantastic. The format is 256 variable bit rate MP3. I am a bit particular with the quality of my music, so for me it is OK for streaming to a phone / stereo for general listening purposes. There is no DRM on the streams you recieve which is really nice. I still prefer my lossless flac tracks to this any day.

The app for android / iPhone is really really great. Easy to use and everything is cross referenced. If you are a Telenor customer you can stream directly to your phone without an extra cost - otherwise see to it you have a flatrate data plan.

One major drawback of Wimp is the necessity to activate, once your 30 day trial is over, through their Adobe Air application. There is no way at all I am typing in my credit card details in anything Adobe took part in making.

So currently I am hoping they take my advice and produce a simple http/ssl webapp for the customers to supply their billing details sometime soon.

TDC Play

I currently have a TDC mobile phone with data plan. This gives me access to TDC Play without any extra cost. As far as I know you cannot use this service as a non TDC customer.

Unfortunately the format is a windows infected WMA with loads of DRM. Even on a windows pc you cannot move your downloaded tracks to a new folder without invalidating them - making it necessary to fetch them again. The sound quality is also significantly lower that Wimp and especially Spotify Premium. This is really only usable on a mobile device.

From my Squeezecenter TDC play is unusable. Their answer is "buy one of our data lines and use our hardware box". Useless. I already have a hw box thank you.

I have tried the TDC play app on my Android and must say their app is not very good. Difficult to search and very little cross referencing between tracks and artists.

Spotify

Perhaps the most hyped music service out there. But the trees do not grow into the heavens.

Activations is quite difficult in Denmark since Spotify do not support Danish customers. This is not really the fault of the Spotify People, but rather due to some very technology scared people at the Danish music agency KODA. The danish RIAA.

This is easily fixed by creating a Swedish paypal account and then using this creating an account with Spotify. Easy Peasy.

The price is very acceptable at 99 SEK making it comparable in price with Wimp at 99 DKK.

The music library is impressive. Around 12 million songs.

The quality on the Spotify premium is excellent. 384 kbit ogg vorbis. This is the reason I really looked forward to trying this with my Squeeze center setup. However this turned out to be not so easy anyway.

The Squeezecenter today is either one you run on your own server or you can use the one supplied på Logitech "in the cloud". If you add your spotify account to this, then you have to select the cloud server when using spotify. Making it impossible to search your locally stored music. And vice verca.

Wimp handles this beautifully. You use the plugin in your server and you can search, mix and make playlists of your own music and wimp music as you see fit. You cannot with Spotify.

A fix is using the spotify backend on your server enabling this. However this is restricted to a narrow set of platforms and only in 32 bit. This requires a local install of libspotify and perhaps also the spotifyd server executable. I cannot really tell. This can then be accessed though a third party plugin to Squeezecenter and used like Wimp.

This is a list of supported platforms. They state Intel/Arm, but the list is in fact much shorter since they also require specific operating systems.

http://developer.spotify.com/en/libspotify/overview/

On FreeBSD it is not really even an option I am afraid. There is really no need for a binary client at all. Spotify needs to open up its client as open source and let ppl (re)implement it where needed. At least for premium accounts.

So on my setup I can only listen to spotify when using Logitechs cloud service. Not when using my own server. Bummer.

Conclusion

At least seen from a Squeezecenter user on Unix.

To put is short: Wimp 1 - Spotify 0 - TDC Play : No Contest.

Now if only the Wimp People would get rid of that Adobe Air thing.. Even introduce paypal perhaps?

Friday, May 20, 2011

Land Rover - A borrowed car from the shop

Standard
A borrowed set of wheels..
I recently had my brakes done at the Land Rover dealer. After getting my car back I noticed a disturbing use of brake fluid, and I subsequently had to take the car back to have the brakes fixed for both front wheels.



Apparently the dealer got a faulty set of refurbished calipers, and after a short while they started leaking heavily. In fact so much that the car had complete brake failure.

The issue was fixed on the guarantee, so aside from some driving back and forth and time spent on this little was lost.

As a small bonus I got to drive a tricked up Defender for a day.

The car was a 90" soft top van with the new 2.5 TD5 power plant. Additionally the car was equipped with a bull bar, snorkel, lift kit and large wheels with BF Goodrich T/A Mud Terrain.

It was very windy the day I had it and I have to say this car is by far the noisiest thing i have EVER tried. Not even my own Discovery 3.9 EFI v8 with its exhaust broken right after the manifold comes even close.

In fact I think it is about the same amount of db in the cabin at 100 km / h as my dads old Massey Ferguson 165 at 2500 rpm at plowing.

The diesel is quite noisy in itself. But if you add to this that the tires are very noisy on road and that the soft top makes an extreme amount of flapping noise - especially on the highway of cause - It really put me off considering a soft top Defender. It is really only usable on the African savanna.

My suggestion is to buy a hard top or a pickup version.

Aside from that the car has a good engine. It was the first try of the Defender 2.4 for me.

And I have to admit it does look quite nice on my driveway. I really like this car in white.

Thursday, April 21, 2011

Sunday, May 16, 2010

NFS version 3 on FreeBSD using unfsd

Standard
Introduction


I have had some problems reading files larger than 2 gb through nfs2. It is afaik a limitation of the standard it self. Therefore it is necessary to look at some of the later versions of this protocol for file operations on larger files.

I am not sure what the current standard in FreeBSD is (version 7.x.x) since I am still using the version 6 of FreeBSD. However this setup should also work with later versions of the OS.

Software installation

You should add the unfsd daemon using the ports collection or add it via a precompiled package. If you follow the attached link to this blog entry, it links to the installation page on freshports.org.

Subsequent configuration

The installation package does not include a rc script to start and stop the daemon, so i modified the system one in /etc/rc.d/nfsd to fit unfsd in /usr/local/etc/rc.d.

This is the rc file

# PROVIDE: unfsd
# REQUIRE: mountd
# KEYWORD: nojail

. /etc/rc.subr

name="unfsd"
rcvar=`set_rcvar unfs_server`
command="/usr/local/sbin/${name}"

load_rc_config $name
command_args="${unfs_server_flags}"
exports="${unfs_server_exports}"
pidfile=/var/run/${name}.pid
start_precmd="unfsd_precmd"
stop_cmd="unfsd_stop_cmd"
start_cmd="unfsd_start_cmd"
sig_stop="USR1"

unfsd_precmd()
{
    if ! sysctl vfs.nfsrv >/dev/null 2>&1; then
        force_depend nfsserver || return 1
    fi

    if ! checkyesno rpcbind_enable  && \
        ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
    then
        force_depend rpcbind || return 1
    fi

    if ! checkyesno mountd_enable  && \
        ! /etc/rc.d/mountd forcestatus 1>/dev/null 2>&1
    then
        force_depend mountd || return 1
    fi

    if checkyesno nfs_reserved_port_only; then
        echo 'NFS on reserved port only=YES'
        sysctl vfs.nfsrv.nfs_privport=1 > /dev/null
    fi
    return 0
}

unfsd_start_cmd()
{
    $command -e $exports -i $pidfile $command_args
}

unfsd_stop_cmd()
{
    if [ -f "$pidfile" ] ; then
        kill `cat ${pidfile}`
    fi
}

run_rc_command "$1"

This is the entries needed in /etc/rc.conf

unfs_server_enable="YES"
unfs_server_exports="/etc/uexports"

You should then add a /etc/uexports file to fit the format of unfsd. It is different from the system supplied nfsd from FreeBSD, so I suggest using a seperate file for this. In that way a rollback to the old version is a matter of re enabling it in rc.conf.

If you do not specify a named export file the unfsd will parse /etc/exports, and that will not work unless you edit it to fit the unfsd format.

Man unfsd will give you some examples of the format.

Conclusion

This will make it possible for you to use 2 gig plus files with nfs. In addition you will be able to use larger read and write sizes if you so choose.

Wednesday, March 3, 2010

ACPI brightness on Ubuntu with Nvidia cards and Intel Vpro chipset

Standard
Introduction
I have long had no response on my laptop, a HP 8510w on the brightness buttons. That is the fn+F9 and fn+f10.

It has been a source of irritation, and I decided to fix it.

Here is  how:
  1. Install nvclock
  2. Create nvclock wrapper scripts
  3. Create the necessary acpi config event mappers for acpid. 
Installation of nvclock

sudo apt-get install nvclock

Create nvclock wrapper scripts
Create file /etc/acpi/hp-brightness-up.sh:

#!/bin/sh
/usr/bin/nvclock -S +10


Create file /etc/acpi/hp-brightness-down.sh:

#!/bin/sh
/usr/bin/nvclock -S -10


 Create ACPID config files
Create file /etc/acpi/events/hp-brightness-up:

event=video C160 00000086 00000000
action=/etc/acpi/hp-brightness-up.sh
 

Create file /etc/acpi/events/hp-brightness-down:

event=video C160 00000087 00000000
action=/etc/acpi/hp-brightness-down.sh
 

 Restart ACPID subsystem
The acpid system is restarted like this:

sudo /etc/init.d/acpid restart


Final notes
If you have problems with this check to see if the event codes written above match the ones actually returned by the acpi subsystem of your laptop. The tools acpi_listen and acpital will both tell you more info. Start one of these programs in a terminal and to pressing the buttons you wish to configure.

Thursday, September 10, 2009

Python inheritance using object and class variables

Standard
Introduction:
When you have been working with Java for many years, it is sometimes fun to delve into other languages to get some new inspiration. For the past few days I have been meddeling around with Python / Django and Google App engine.

A discussion over MSN with a friend resulted in me coding this small example of how Python class and object variables differ greatly from what is normal in Java. Also this example illustrates very simple interitance from object->Vehicle->Car and Truck.

Code:
Package for vehicles:

'''
Created on Sep 10, 2009

@author: nikolaj
'''

class Vehicle(object):
'''
classdocs
'''
number_of_vehicles = 0

def __init__(self, color, number, weight):
self.number = number
self.weight = weight
self.color = color
Vehicle.number_of_vehicles += 1
print '(Initializing Vehicle %s which is of type %s)' % (self.number, type(self))


def __del__(self):
Vehicle.number_of_vehicles -= 1

if Vehicle.number_of_vehicles == 0:
print 'Vehicle: I am the last one on the streets now ...'
else:
print 'Vehicle: There are still %d of us left.' % Vehicle.number_of_vehicles

class Car (Vehicle):
'''
classdocs
'''
number_of_cars = 0

def __init__(self, color, number, passengers, weight):
Vehicle.__init__(self, color, number, weight)
self.passengers = passengers
Car.number_of_cars += 1

def __del__(self):
print 'Car: %s says bye. I am off to the scrap heap' % self.number
Car.number_of_cars -= 1

if Car.number_of_cars == 0:
print 'Car: I am the last Car on the streets now ...'
else:
print 'Car: There are still %d Cars left.' % Car.number_of_cars

def howmany (self):
print "Car: %d cars and %d vehicles in total" % (Car.number_of_cars, Car.number_of_vehicles)

class Truck (Vehicle):
'''
classdocs
'''
number_of_trucks = 0

def __init__(self, color, number, tonnage, weight):
Vehicle.__init__(self, color, number, weight)
self.tonnage = tonnage
Truck.number_of_trucks += 1

def __del__(self):
print 'Truck: %s says bye. I am off to the scrap heap' % self.number
Truck.number_of_trucks -= 1

if Truck.number_of_trucks == 0:
print 'Truck: I am the last Truck on the streets now ...'
else:
print 'Truck: There are still %d Trucks left.' % Truck.number_of_trucks

def howmany (self):
print "Truck: %d trucks and %d vehicles in total" % (Truck.number_of_trucks, Truck.number_of_vehicles)


Executable pyton main

from dk.hsys.model.vehicle import Car
from dk.hsys.model.vehicle import Truck

'''
Created on Sep 10, 2009

@author: nikolaj
'''

def main():

car = Car('Blue', 'RH20358', 4, 725)
car2 = Car('Yellow', 'DC79929', 2, 800)
car2.howmany()

truck = Truck('Red', 'CV34254', 22, 32)
truck2 = Truck('Green', 'BD7638', 2, 4)
truck3 = Truck('Black', 'HG76543', 30, 40)
truck.howmany()

if __name__ == '__main__':
main()



Output:


(Initializing Vehicle RH20358 which is of type )
(Initializing Vehicle DC79929 which is of type )
Car: 2 cars and 2 vehicles in total
(Initializing Vehicle CV34254 which is of type )
(Initializing Vehicle BD7638 which is of type )
(Initializing Vehicle HG76543 which is of type )
Truck: 3 trucks and 5 vehicles in total
Car: RH20358 says bye. I am off to the scrap heap
Car: There are still 1 Cars left.
Car: DC79929 says bye. I am off to the scrap heap
Car: I am the last Car on the streets now ...
Truck: CV34254 says bye. I am off to the scrap heap
Truck: There are still 2 Trucks left.
Truck: BD7638 says bye. I am off to the scrap heap
Truck: There are still 1 Trucks left.
Truck: HG76543 says bye. I am off to the scrap heap
Truck: I am the last Truck on the streets now ...

Tuesday, August 25, 2009

Automount with ssh and nfs

Standard
Introduction

I have for a long time mounted and unmounted network file systems by hand when ever I had a need for them. It is not a big thing, but you have to open a terminal in order to do this every time. I experimented a little with automount and autofs and found, that you can dynamically do things in the mount specification files.

Autofs dynamically executes mount commands triggered when you access a defined folder in your system. This folder then becomes the mount point for a given network or local file system. Another use for autofs is access of cd's, floppies and other removable block devices.

This is especially usefull from a Laptop computer, that sometimes are connected to network file systems behind a firewall, sometimes connected to ssh/sftp systems when you are on the road.

The goal is to be able to dynamically let the laptop figure out, what protocol to use: NFS or SSH/SFTP depending on the location of your connection.

Preparing the software

You will need to add the autofs system to your distribution of choice, this is for Debian / Ubuntu:

$ sudo apt-get install autofs

This will add the autofs system to the list of installed packages on your laptop PC.

You will now need to add netcat and sshfs to your system - it is used to check if a ssh server is accessible and mount the nfs share via SSH if it is:


$ sudo apt-get install netcat sshfs

Autofs will add a daemon to your system for monitoring your configured mount points. The deamon needs to be told to reload configurations whenever you change your configuration:



$ sudo /etc/init.d/autofs reload
Reloading automounter: checking for changes ...
Reloading automounter map for: /misc
Reloading automounter map for: /mnt/media


The configuration for the autofs system is held in files in /etc/auto.* where you can add you mount points as you need them. There is several good examples in the ones already added by default. However I produced a new named auto.media and added it to /etc/auto.master in order to access my media drive. This is the contents:



#!/bin/sh
# check to see if this host has a working internet connection and a IP address
MYIP=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
ping -c 1 ${MYIP} >> /dev/null 2>&1
if [ "$?" -ne "0" ]
then
exit 1;
fi

# check to see if HOSTNAME can be pinged directly - if yes echo the mount lines for nfs
ping -c 1 HOSTNAME >> /dev/null 2>&1
if [ "$?" -eq "0" ]
then
echo "root -fstype=nfs,rw,sync,soft,intr,rsize=8012,wsize=8129 HOSTNAME:/foo/bar/&"
echo "data2 -fstype=nfs,rw,sync,soft,intr,rsize=8012,wsize=8129 HOSTNAME:/foo/bar/&"
echo "download -fstype=nfs,rw,sync,soft,intr,rsize=8012,wsize=8129 HOSTNAME:/foo/bar/&"
exit 0;
fi

# check to see if SSHHOST can be contacted - if yes use the ssh/nfs to mount using fuse
nc -z SSHHOSTNAME 22 > /dev/null 2>&1
if [ "$?" -eq "0" ]
then
echo "-fstype=fuse,rw,nodev,nonempty,noatime,allow_other,max_read=65536 :sshfs\#USER\@SSHHOST:/foo/bar/&"
exit 0;
exit 0;
fi


The file /etc/auto.media listed above should be made executable with permissions 755. When executed it will dynamically produce the contents of the auto.media file depending on the script execution. As a consequence the mount points will not be visible in /mnt until execution of the script has completed. So you will have to cd to a non existing folder like /mnt/media before you actually see it created in /mnt :-)


Conclusion and caveat

The above works fine for me. There could be a problem, if you are on a foreign network, where another server called HOSTNAME exists. You may need to add more intelligent identification check of the HOSTNAME server in order to make this work correctly in all networks.