sunnuntaina 19. lokakuuta 2008

Quick guide to CVS on Windows

Exceptionally I'll do this post in english.

Every now and then I need to write quick intros to collegues on how to start using CVS. Maybe if I blog it once, I can point the post instead of writing e-mails on the topic again and again.

The purpose for using CVS is to maintain revision history for a set of files. Usually source code and related documentation. This enables controlled changes and concurrent development for teams that work over the same files.

My tool of choise for using CVS on Windows platform is the Tortoise CVS. It's easy to use and integrates nicely to your Windows explorer.

Some recurring terms in use of CVS that you need to understand are:
  • remote user account
  • terminal client
  • CVS-root
  • repository
  • local sandbox.
The place where your files are located is most probably Linux-/Unix-type of
server. On that server there is one certain directory that called the CVS-root. In this directory there can be serveral projects hosted and each one of these is called project's repository, which is the master location for the files. You will get and work with a copy of thise files at your local sandbox.

So as an example; Let's say that the server name is foo.bar.fi and on that host there would exist a CVS-root /srv/cvsroot. Furthermore the CVS-root holds the project you are working on and the file repository for the project is called myproject. That is the information you need to locate and use the repository.

Additionally you need remote user account and access to the server foo.bar.fi in order to get to the files at all. In this example, let's call your user account mylogin.

Once you have all that figured out, you have all the capabilities you need to use CVS. You only then need the tools, so download a copy from the Tortoise CVS site and install it on your workstation. After that you're all set.

First thing to do is to ensure that your remote access to the server works. Remote access is nearly always done over a secure terminal client. The client for this task with Tortoise CVS is the TortoisePlink.exe that was installed on your host. First test that your access to the host works by trying to log in from command line:


cd "Program Files\TortoiseCVS"
TortoisePlink.exe -ssh -l mylogin foo.bar.fi


If this is the first time you connect to the host, you will be asked to verify the encryption key that the remote server is going to use. The key fingerprint is the one you need to look out for.





You must make sure that this is the one you should expect to get from the host. If the fingerprint matches, accept it and you should be asked for a password. Enter your password and you should see successful login happening. Then just logout.

Now your remote access should be functional and we get to checking out some files.

Open Windows explorer/My Computer on your preferance, create a directory cvswork and right-click on the cvswork directory. On the menu that appears, there should be option CVS checkout. Select that one and you get a dialog to which you must enter the CVS access information:



When selecting ok, you will be prompted for a password (possibly even a few times) and after that the files are downloaded to your host.

Then go editing the files at the location where you got them. Once you are done, you should:
  • right-click on the local sandbox and select update (this way you will get all the updates to the files that your team mates have done before you commit your changes)
  • right-click on the local sandbox and select commit
  • when asked so, enter comment about the changes you did to the files so that the change history of the files will get reasonable notes about what has been done.
On both of these steps you might be asked for passwords so just enter it when asked. After commit your changes are stored to the master repository and all your team mates get your changes after they do an update.

You can get rid of the constant querying for a password by using SSH-public key authentication, but that is worth a post of it's own.

sunnuntaina 5. lokakuuta 2008

Rsync paikallisilla levyillä

Sykronoidessa hakemistoja paikallisesti tai vaikka verkon yli
rsync on mitä oivin työkalu.

Paikallisesti ajettuna hyvä komento on:


rsync -vrupogt /lahde/hakemisto/ /kohde/hakemisto


jossa parametrit tarkoittavat seuraavaa:
  • -v tulostaa tietoja työn etenemisestä
  • -r rekursoi lähdehakemiston alihakemistot
  • -u kopioi ainoastaan tiedostot jotka on päivittynyt
  • -p pidä käyttäjäoikeudet samoina kuin lähdetiedostoissa
  • -o pidä tiedoston omistajan UID samana kuin lähdetiedostossa
  • -g pidä tiedoston GID samana kuin lähdetiedostossa
  • -t pidä tiedoston aikaleimat samana kuin lähdetiedostossa.
Verkon yli tehtäessä kannattaa käyttä ssh:ta ja kompressointia, mutta siitä ehkä lisää myöhemmin.

torstaina 2. lokakuuta 2008

Linux, iPod ja audible.com

Audible on paikka jossa on valtavia määriä audiokirjoja. Audiokirjat ovat minulle mieleen, koska lukeminen onnistuu siten että on kädet vapaana (autossa, bussissa, junassa, kävellessä jne).

Audiblen kirjoissa käytetään DRM:ää joiden hallinta on toteutettu tavalla jota Audible Manager sitten tottelee. Manager on saatavilla ainoastaan Windows ja OS-X käyttöjärjestelmille, Linuxia ei tueta. Mutta tähänkin löytyy jonkinlainen toimiva ratkaisu.




Ympäristö ja mitä tarvitaan:
  • Kubuntu 8.04
  • Wine
  • Amarok
  • iPOD
  • Tunnus Audibleen

Ensimmäisenä hae Audible Manager Audiblen saitilta. Tämä on perinteinen Windows exe-tiedosto. Siirrä tämä tiedosto jonnekin Wine:n hakemistoon.

Tämä onnistuu esim KDE:n käynnistysvalikon kautta K -> Wine -> Browse C:\ Drive. Tipauta asennustiedosto (en muista nimeä, mutta sanotaan että nimi olisi vaikka "installer.exe" ja polku wine:n C-aseman juureen "/home/bitteri/.wine/drive_c") vaikka C:n juureen ja suorita se esim komentoriviltä:



wine "/home/bitteri/.wine/drive_c/installer.exe"



Asennuksen jälkeen KDE:n käynnistysvalikoissa Wine:n alla tulisi näkyä Audiblen Manager ja download manager.

Tämän jälkeen menet Audiblen saitille, suoritat ostoksesi jne. Lopulta näet Audiblen saitilla kirjat jotka olet hankkinut ja saat mahdollisuuden downloadata nämä. Klikkaa downloadia jolloin sinulle tarjotaan tiedostoa "aw_dhelper.pl". Tallenna tämä jonnekin em. winen virtuaalisen C-aseman polkuun.

Tämän tiedoston avulla saat downloadattua ostamasi audion. Tämä tapahtuu Audible Managerin mukana tulleen Download Managerin avulla:



wine /home/bitteri/.wine/drive_c/Program\ Files/Audible/Bin/AudibleDownloadHelper.exe c:\dl_helper.pl



Tämä downloadaa aa-tyyppisen tiedoston joka on Audiblen DRM suojattu audiotiedosto. iPOD tukee tätä formaattia, joten seuraava askel on siirtää tiedosto soittimeesi.

Ensimmäiseksi sinun tulee löytää lataamasi tiedosto, joka löytyy wine:n virtuaalipolun:

/home/bitteri/.wine/drive_c/windows/profiles/All\ Users/Documents/Audible/Downloads

alta. Siirrä tiedosto jonnekin paikkaa missä haluat tiedostoja säilyttää.

Seuraavaksi käynnistä Amarok, yhdistä iPODisi siihen ja varmista että soittimesi sisältö näkyy Device tabin alla. Kun tämä on tehty, vaihda Amarokin näkymä Files näkymään ja etsi polku mihin juuri tallensit .aa tiedostot. Kohdista tiedostot, oikean hiirenpainikkeen kautta valitse Transfer to Media Device. Palaa takaisin Amarokin Device tabiin ja valitse Trasfer joka siirtää tiedostot laitteeseen.

Itselläni on käytössä iPOD mini ja päätasolla on oma valikkonsa audio-bookeille. Voi olla että näitä ei listata päävalikossa, jolloin sinun pitää etsiä iPODisi asetuksista oikea kohta joka kytkeä päälle nähdäksesi laitteeseen tallennetut audiobookit.

Ryhdyin itse asiakkaaksi kuluneella viikolla ja näitä ohjeita seuraten sain homman toimimaan.

Nämä ohjeet on pitkälti hyvin vapaamuotoisesti käännetty ohjeista jotka löysin täältä.

This post is very rough translation to Finnish from Brian's blog posting. Brian; thanks for the great instructions!

Edit; Homma ei toimikaan välttämättä näin hyvin aina.