• How to add a YouTube channel feed to Google Reader?

    rss

    Before they rehauled Google Reader for G+ you could import a YouTube channel feeds into your Google Reader just by copying and pasting channels link into Google Reader, no problem. A link that looks like this used to work:

    http://www.youtube.com/user/CHANNEL_NAME

    But, now it doesn’t work any more (I wonder why they broke it and why isn’t it fixed?).. Fortunately I was left with some of the older YT feeds that still worked so I looked at how their links look now. What you can now do to import channels into Google Reader is to use this link form:

    http://gdata.youtube.com/feeds/base/users/CHANNEL_NAME/uploads?alt=rss&v=2&orderby=published&amp

    Make sure to replace CHANNEL_NAME with your desired channel name and there you have it.

  • Making sound files for REminiscence (Flashback) work

    As REminiscence README indicates (“To hear background music during polygonal cutscenes with the PC version, you’ll need to copy the .mod files of the Amiga version”), you will have to copy Flashback sound files into the DATA directory within your REminiscence directory. They can be obtained here. After you have downloaded and extracted the files, you will rename them as follows:

    ascenseur -----> mod.flashback-ascenseur
    ceinture ------> mod.flashback-ceinturea
    chute ---------> mod.flashback-chute
    debut ---------> mod.flashback-jungle
    desinteg ------> mod.flashback-desintegr
    donneobj ------> mod.flashback-donneobjt
    fin -----------> mod.flashback-fin
    game_over -----> mod.flashback-game_over
    holocube ------> mod.flashback-holocube
    intro ---------> mod.flashback-introb
    journal -------> mod.flashback-options1
    level4 --------> mod.flashback-teleporta
    logo ----------> mod.flashback-logo
    memoire -------> mod.flashback-memoire
    missions ------> mod.flashback-missionca
    missions2 -----> mod.flashback-fin2
    options -------> mod.flashback-options2
    planetexplo ---> mod.flashback-teleport2
    reunion -------> mod.flashback-reunion
    taxi ----------> mod.flashback-taxi
    voyage --------> mod.flashback-voyage

    If you did everything properly, you should hear this beautiful music after you launch REminiscence (and all the other music clips throughout the game of course).. Voila!

  • Removing multiple elements from a list in Python

    Removing multiple elements from a list in Python

    Let’s say you need to filter a Python list and remove all elements that match a given criteria. If you wanted to remove a single element, you could just use ‘del list[i]’ (example). But if you wanted to remove multiple elements this might be a problem since you would be modifying and iterating over the list at the same time (keeping track of list indexes can become very confusing, very fast).

    A simple solution to this problem would be to keep record of all list elements (indexes) that need to be removed, and to remove tham afterwards. Also, one other thing to be wary about is that the removal process should be done in reverse because otherwise you would shift all the elements to the ‘left’ every time you removed an element from a list and you would (again) have to keep track of list indexes.

    A simple function example:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    matchingFilter = ['criteria1', 'criteria2']

    def criteriaFiltering(aList, matchingFilter):
       deletionIndexes = []
       i = 0

       for listLine in aList:
          for match in matchingFilter:
             if match in str(listLine):
                continue             
             else:
                deletionIndexes.append(i)
                break
          i += 1

       for number in reversed(deletionIndexes):
          del listLines[number]

       return aList

    This might not be the fastest ‘algorithm’ to do the job, but it works well enough for me..

  • How to remove ‘lastsaid’ history and chat logs from Pidgin

    Turning on History plugin in Pidgin will insert the last conversation into your current conversation. All this lastsaid entries can be found somewhere inside of blist.xml file which is located in your Pidgin conf directory (/home/username/.purple directory in GNU/Linux (not sure about where it is in MS Windows though)).

    This is convinient if you want to view what was written before you accidentialy closed the chat window or if you forgot what were you last talking about with someone and if you want that information quickly. But, it is not convinient at all if you want to wipe it along with chat logs since lastsaid entries are at a different location and are not the only entries that can be found in blist.xml so you can’t just remove that file either. If you use a couple of protocols and have more than just a few buddies, removing lastsaid lines from blist.xml manually would probably prove to be pain in the ass.

    So, what every curious programmer does in case he doesn’t have a feature he wants/needs? – He just makes it. :D Since I started playing with Python, I decided to create a small py3k script I could use every once in a while to completely wipe both lastsaid history and chat logs from Pidgin.

    What you need to do to make this script work is – you need to put it into your Pidgin conf directory (just put it into a file called something.py) and after that just run the script (you need to have python installed on your machine to run this script).

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    #! /usr/bin/env python3
    import xml.etree.ElementTree as etree
    import shutil
    import os

    # deletes 'lastsaid' blist.xml entries
    if os.path.exists("blist.xml"):
       tree = etree.parse("blist.xml")

       buddies = tree.findall(".//buddy")      
       for buddy in buddies:
          nodes = buddy.findall("setting")    
          for node in nodes:
             if node.attrib == {"type": "string","name": "lastsaid"}:
                buddy.remove(node)

    tree.write("blist.xml")


    # deletes chat log files if they exist
    if os.path.exists("logs"):
       shutil.rmtree("logs")

    I hope this helps. Also, if you have any questions/problems with the script, feel free to drop a comment..

  • SVN over SSH in kdesvn


    This one might just spare you about 2-3 hours of your time doing SVN+SSH kdesvn googling. One would think it would work out-of-the-box, but it doesn’t. To get kdesvn to work with SSH, there is one small undocumented trick – using an environment variable (as if you were using command line SVN+SSH). To do that, put the following line into your .bashrc:

    1
    export SVN_SSH="ssh -l <your_remote_ssh_username>"

    If you try using SVN+SSH without it, kdesvn will try to login to remote server using your current username (the one you are using on your local machine). Of course, each time unsuccessfully because it’s not the right username. After that, go to Subversion->General->Checkout a repository, and enter:

    1
    svn+ssh://path_to_your_svn_repository

    …in the URL field. Also, choose the target directory and check any other desired options. After that, just bookmark the connection and you’re all set up.

  • GEdit FTP browsing / editing under KDE
    (using GNOME bookmarks without Nautilus)

    Problem with using GEdit (v2.30.4 in the moment of writing this post) for FTP browsing/editing under KDE (if you don’t have Nautilus installed in your KDE) is that since it is a GNOME app – you need a way to somehow manage your connections which is usualy done through Nautilus by using GNOME bookmarks (the ones you would create by going to Places -> Connect to Server) and at the moment there is no way to create this bookmarks from within GEdit.

    Anyway, you can do the same thing by editing .gtk-bookmarks file located in your home folder even if you don’t have Nautilus installed. Here’s a few examples of what you can put inside:

    1
    2
    3
    4
    5
    ftp:[email protected]/ bookmark_name
    ftp:[email protected]/:3322 bookmark_name
    ftp:[email protected]/ bookmark_name
    ftp:[email protected]/folder_path_option/ bookmark_name
    sftp:[email protected]/ bookmark_name

    The first one is just a regular FTP login bookmark. The second one uses a different port than the default one. The third one is for usernames containing @ (like in the image below) which you have to replace with %40 to differentiate them from @ for domain association. The fourth one uses the folder_path_option like in picture below and the fifth one is for using sFTP. Of course, you can combine all this together depending on your needs…

    Browsing/editing directly from GEdit is much faster than using Filezilla which prompts for uploading every time after you edit and save the file which is kinda annoying, or for example using Krusader which works well with FTP, but if you use sFTP – then it edits files localy instead of online so you have to save them as a new file and upload them again… You get the drift.

Back to top