Head First – Python: 1st exercise

 

page 13 in o’reilly’s head first python

the question was to convert a list of movie titles into a list which contains movie titles and the movie release years.

what i have:
["the holy grail", "the life of brian", "the meaning of life"]

what i want:
["the holy grail", 1975, "the life of brian", 1979, "the meaning of life", 1983]

my solution:

#!/usr/bin/python

#create list for movie titles
movies = ["the dark knight", "donnie darko"]

#extend the list with two further titles
for i in ["8 mile", "game of thrones"]:
    movies.append(i)

#print how many titles are in the list
print("list contains", len(movies), "entries")

#print the list
print("actual list:", movies)

#create list with the movie release years
years = [2008, 2009, 2010, 2011]
#set first insert index
count = 1
#insert year as often as years in the years list
for year in years:
    #insert year
    movies.insert(count, year)
    #increment for two
    count += 2

#print result (new list)
print(movies)

and yes.. i’m fully aware that this are not all movies.. and yes.. the years are wrong too.. and yes.. it wasn’t necessary to append two of the movies in a second step.. bite me!

moc – music on console

hey socialnerds,

i spent a lot of hours on finding the best solution for listening to music on my linux box.. and with pretty much every solution i tried there was a lack of important features like playlists or keyboard shortcuts or it consumed so much performance that it wouldn’t run fluently or at all on older machines.

anyway.. here it goes.. i found moc “music on console”
its a (nc)console based music player and it does everything you need and lets say.. it just works!

installation (arch linux):

sudo pacman -S moc

moc is server – client based so you have to connect to the moc daemon with its client “mocp” in order to control it.

just type:

mocp

and enjoy your music.

if you need further help just press h (help) in the moc interface

h

 

wine keeps crashing 3d applications in archlinux (64bit)

hey folks,

i had this annoying situation with running 3d applications, basically games, in wine on my arch64 box. they wouldn’t start at all producing errors about my XServer when trying, but i got it solved by google-ing around way to many minutes!

following two links brought me enlightenment:

investigating the problem:
http://wiki.winehq.org/3DDriverIssues

solution (which worked for me):
https://wiki.archlinux.org/index.php/Wine#Graphics_Drivers

i hope i could save you some of those minutes..

edit: if you want to have networking/multiplayer working with games using directplay to connect to the network you have to install winetricks (http://wiki.winehq.org/DirectPlayGames)

sudo pacman -S winetricks

and run

sudo winetricks directplay