array ( 0 => 'Igor Stirbu\'s blog', 1 => 'Igor Stirbu\'s blog', ) asdf vs hjkl | programmare humanum est

One video card, two monitors

For about eight years I've been a proud owner of a 15" LiteOn monitor which is the only piece from my first computer that survived till today. Now I have an addition, a 22" Benq E2200HD and along with that came an ATI Radeon HD 4350 video card. One of the goals is to put both monitors at work using the VGA and DVI outputs from the video card.

Some details on the setup: I want to use Benq monitor as the primary output and it has a native resolution of 1920x1080. LiteOn monitor has a native resolution of 1024x768. Benq monitor is connected to the DVI port using an adapter and LiteOn monitor is connected to the VGA port.

There are just too many tutorials explaining how to setup dual head and most of them complete each other so I cannot state one source that helped me most. At the beginning I used only the Benq monitor and configured the second output manually through xrandr tool (a nice gui is grandr). After a lot of tries I got to the final configuration for xorg.conf that extends the workspace on both monitors, the LiteOn monitor being on the right side of the Benq one.

The original configuration file I generated using Xorg -configure and then stripped unused so far stuff. I have also an on-board "ATI Radeon 2100" card which I don't use right now. Xorg detected the on-board card and generated screen and device sections which I removed. Using the on-board card along with the HD4350 is a challenge for some other time.

Here is a part from the xorg.conf file that is related to configuring the extended workspace.

Section "ServerLayout"
	Identifier     "X.org Configured"
	Screen      0  "Screen0" 0 0
	InputDevice    "Mouse0" "CorePointer"
	InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Monitor"
	Identifier   "Monitor0"
	VendorName   "Monitor Vendor"
	ModelName    "Monitor Model"
EndSection

Section "Monitor"
	Identifier   "Monitor1"
	VendorName   "Monitor Vendor"
	ModelName    "Monitor Model"
	Option       "RightOf" "Monitor0"
EndSection

Section "Device"
	Identifier  "Card0"
	Driver      "radeon"
	VendorName  "ATI Technologies Inc"
	BoardName   "RV710 [Radeon HD 4350]"
	BusID       "PCI:2:0:0"
	Option      "monitor-DVI-0" "Monitor0"
	Option      "monitor-VGA-0" "Monitor1"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	SubSection "Display"
		Viewport   0 0
		Depth     24
		Virtual 2944 1080
		Modes	"1920x1080" "1024x768" "800x600" "640x480"
	EndSubSection
EndSection

In this config there are a couple of important places that need to be setup properly. The first one is to configure the order of the monitors. I thought of "Monitor0" being the Benq model and "Monitor1" the LiteOn one and specified in the "Monitor" section for "Monitor1" the layout I want.

The next important part is to map correctly the physical ports to "Monitor" sections in "Device" section. It is required to follow the pattern

Option      "monitor-OUTPUTNAME" "MonitorIdentifier"

The OUTPUTNAME can be obtained by running xrandr tool and look for port names. The name of the output should be selected completely up until the first space, ie "DVI-0" and not just the "DVI" part. Here is the output on my setup:

016:31[istirbu@kubi:~]$ xrandr 
Screen 0: minimum 320 x 200, current 2944 x 1080, maximum 2944 x 1080
VGA-0 connected 1024x768+1920+0 (normal left inverted right x axis y axis) 304mm x 228mm
   1024x768       75.0*+   70.1     60.0  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   640x480        75.0     72.8     75.0     66.7     59.9  
   720x400        70.1  
DVI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 476mm x 268mm
   1920x1080      60.0*+
   1680x1050      60.0  
   1280x1024      75.0     60.0  
   1440x900       75.0     59.9  
   1280x960       60.0  
   1280x800       59.8  
   1152x864       75.0  
   1152x720       60.0  
   1024x768       75.0     60.0  
   832x624        74.6  
   800x600        75.0     60.3  
   640x480        75.0     59.9  
   720x400        70.1  

The last part is the screen section and the important line is the "Virtual" entry. Because I chose to align the monitors in a horizontal fashion, the width in "Virtual" has to match the summation of both monitors' width, ie add 1920 and 1024. The height is left 1080 as it is the largest of both resolutions.

Kana cards

Basic Japanese lessons imply writing and reading Hiranaga and for beginners it's quite hard remember all of them in a short period of time. Knowing that memorization cards can speedup I tried to find some and the closest best match I found on polarcloud. Some improvements that I needed were a larger kana on the front side, a small kana on the back to avoid unnecessary flipping, higher font quality, no redundant text on the cards.

For the cards I used LaTeX CJK packages, pdflatex, flashcards package, data from unicode.org, vim and a few python and bash help scripts. The pdf files are released under Creative Commons Attribution-Noncommercial-Share Alike license.

Kana cards

Best printed on A4 cardboard (280g/m2), with no margin or no page scaling, at a print center, if possible. Most printers will not be able to print the grid about 2mm from each edge but thats all right, the grid is just a guide for cutting. Ask at the print center if they can cut your cards precisely by the grid, if not, cut them by yourself. The kana on the last page are repeated to save paper when printing even number of sets.

Update: attached pdf files without grid.

Oferta

in

Ești tânăr și plin de energie? Vrei să lucrezi într-o echipă dinamică, plină de entuziasm și dornică să îmbrățișeze cele mai de vârf tehnologii? Ți-ar plăcea să faci parte dintr-o companie multinațională și multiculturală? Ai dori să faci schimb de idei și experență cu oameni chiar și de pe alte continente? Preferi un loc de muncă stabil cu salariu atractiv, bonusuri pentru proiecte și la sărbători? Ai vrea să participi la teambuildinguri ca să cunoști mai bine oamenii ce te înconjoară? Ai dori să-ți folosești la maxim capacitățile ca să rezolvi probleme? Ești capabil să aduci idei inovative pentru îmbunătățirea produselor și modului de lucru? Poți să treci ușor prin situațiile de stres și să menții spiritul de echipă? Atunci această carte nu este pentru tine.

A patra dimensiune

in

Ieri am dat de articolul de pe Slashdot în care se povestea cum să vezi în a patra dimensiune. Evident, ca orice cititor vechi de Slashdot, am trecut direct la comentarii în căutarea înțelepciunii (RTFA e pentru începători). Partea ciudată e că nu am rămas deloc dezamăgit. Primul link de care am dat a fost unul de pe Youtube și în el un tip, Carl Sagan, povestește foarte fain despre cum noi, entități 3d ar trebui să gândim a patra dimensiune din perpectiva a niște creaturi 2d care întâlnesc una 3d. Prezentarea e destul de elegantă și în același timp complexă. Încă nu îmi încape în imaginație partea cu proiectarea în 3d a unui obiect 4d, dar cu timp și exercițiu poate va ieși ceva.

Următorul și complet previzibil pas a fost trailerul desenului animat Flatland care mi s-a părut bestial. Abia aștept să pun mâna pe versiunea neoficială :). Pe lângă asta, am și făcut comanda la cartea după care e făcut filmulețul. Deși Flatland se poate găsi liber pe internet, prefer formatul de copac mort.

Fiind atât de entuziasmat de aceste resurse, am decis să mă uit peste TFA. Cei de la Dimension Math au făcut o treabă bună și recomand vizionarea filmelor.

Partea tristă e că noi nu putem vedea (în sensul comun a cuvântului) obiecte 4d ci doar putem să le intuim. Vederea e doar un tip de percepție dar fiind folosită extensiv și bine dezvoltată aduce o lene greu de imaginat întru dezvoltarea și perfecționarea altor simțuri. A crede că doar ceea ce se vede și se aude există nu este suficient. Oricum, totul e doar o iluzie. Spor la treabă.

To /boot or not to /boot

in

A couple of Linux distros suggest making a separate partition for the /boot folder. Well, they must have a reason for it but I never understood why. For an usual desktop it might make no sense to spend a partition just for something that is at most 100MB and the obvious step is to leave /boot a regular folder on the root partition. I've considered having /boot a separate partition an overkill until I discovered a couple of reasons that look fine to me.

First reason is that GRUB (I imply that the obvious choice for a boot loader is GRUB) can still load it's stage2 files if somehow the root partition is damaged. You may boot with no worry other operating systems, ie if you have another Linux installed or even Windows from another disk (using the map tricks).

Another reason may be more suitable for development machines where the software configuration changes depending on the project requirements. Having /boot a separate partition can save some time when removing the Linux root partition. And, one of the incomprehensible solutions, to use GRUB for managing several windows operating systems on the same machine. Sounds weird but there is nothing wrong with it, GRUB implements multiboot specification and it can handle more than it's used for.

Hacking in Debian

Debian is one of those things that are so meticulously prepared that sometimes it gets boring. When you install it (from cd, usb stick or even windows) takes you through several well thought steps where few things can go wrong (your entire hard disk can be erased, but that's just your own fault) and when its over, it just works. Need anything? Just run apt-cache search rss reader to get a rough description of all matched applications. Something looks interesting? Run apt-cache show akregator to see the description or directly apt-get install akregator to install it. I cannot stand it. I envy users of those operating systems that allow them to spend time defragmenting disks, hunting viruses, installing security updates, restarting the computer to the extent that I think of paying money for those moments of pure enjoyment. And what do I get from Debian? A boring system that works.

Apt pinning

It's very hard not to try to mess something up to make your day brighter, to wipe that plain look from your face, to put back that evil grin. I usually keep only the stable version cd just to be sure, you can never trust anything else but stable. That's why the first thing after installing a fresh debian I switch to testing/unstable/experimental version. It's a lot of fun! Besides this, enable contrib and non-free pools to bring in those dirty and nasty packages on my computer. How do you do that? There is a magical trick to do that and it's called apt pinning. There is a nonexisting file /etc/apt/preferences that should contain the following spell:

Package: *
Pin: release a=testing
Pin-Priority: 650

Package: *
Pin: release a=unstable
Pin-Priority: 600

Package: *
Pin: release a=experimental
Pin-Priority: 550

This tells apt to prefer packages from testing over other pools. And there is how a part /etc/apt/sources.list looks like:

deb http://ftp.lug.ro/debian/ testing main non-free contrib
deb-src http://ftp.lug.ro/debian/ testing main non-free contrib

deb http://ftp.lug.ro/debian/ unstable main
deb-src http://ftp.lug.ro/debian/ unstable main

deb http://ftp.lug.ro/debian/ experimental main

deb http://www.debian-multimedia.org testing main

But the question "why do I need unstable and experimental if testing is preferred?" arises and the answer is simple: to have access to the list of packages, their description and possibility to install them from other versions. To install a package from experimental pool you can use this:

# apt-get -t experimental install kde4

And what's with contrib and non-free? Well, some of the good stuff is illegal but that's not a reason not to have it. Especially if that's a NVidia video card driver.

Resources

Debian Multimedia

No no, I did not forget! There is that multimedia word in sources.list that implies fun stuff. And it really does. Check out the stuff on Debian Multimedia project to see all those nice codecs and applications. And a tip: do not ignore the FAQ page on Debian Multimedia. This repo is a must for a desktop system.

Resources

Building from source

A keen eye could not have missed the deb-src keywords. They specify the possibility to get the sources for the packages you have installed. Why would you want to do that? For the same reason you are still reading this article - you're a hacker. So, how do I get those sources? Here is it how:

$ apt-get source pidgin

And you don't have to be root! You can look through the sources as an user and the ones you see are the same you would get from the upstream maintainer. Yes, Debian keeps patches for the fixes (some are Debian specific, some did not get into upstream version yet) in ./debian folder along with the build scripts. If you decide to build your own version of the package, possibly with modified sources, you need first to bring all the development packages necessary for building that specific package with the following command:

# apt-get build-dep pidgin

Once apt is done installing them you can build the package. It is usually done as user and needs fakeroot command. After cd-ing in the uncompressed folder issue:

$ dpkg-buildpackage -rfakeroot -b

Maybe you want also to use -nc to prevent loosing your changes in the case the source files are overwritten before building (this depends on the package and may be not true for all cases). Sometimes I even used git or bzr to keep the history of the changes. The result is a set of files among which one or more .dpkg files. You can easily install them with dpkg:

# dpkg -i *.deb

but keep in mind that your package has a lower priority than a Debian package of the same version so you might need to instruct apt to hold it. And in case you find you change useful, feel free to send your patch to the package maintainer using reportbug or reportbug-ng application.

Resources

Building the kernel

Oh, you're a kernel freak downloading the latest versions? Or just rebuilding a Debian kernel? Debian has a tool that helps you build a kernel that integrates nicely with the rest of the system. It's called kernel-package and it provides the command make-kpkg. An usual invocation would look like this:

$ make-kpkg --rootcmd fakeroot kernel_image

And it's not over! There is module-assistant package that provides the m-a command. It helps building external modules for your current kernel. I use it for building nvidia and lirc modules. Here is how I run it:

# m-a auto-install lirc nvidia-kernel-legacy-96xx

Most of the spells are just spoilers and there is no reason for you not to read the man pages for those application or the Debian documentation. You learn to get your driver's permit, learn the tools you're using.

Resources

Salvează și încarcă adrese dintr-un fișier: extensie pentru Epiphany

Citirea neregulată a știrilor de pe reddit are ca efect deschiderea a prea multor file în navigator. Și mă mai ținea să trimit vreo cinci-zece adrese prin pidgin dar mai mult de-atâta mă enerva, sunt leneș. Așa că am decis să scriu o extensie pentru Epiphany care să-mi rezolve problema.

Hmm, de ce Epiphany? Ultima vreme folosesc pe măsură egală Iceweasel și Epiphany. De ce se utilizează Firefox/Iceweasel știm toți. La Epiphany ar mai fi câteva chestii de spus. Chestia care mi-a plăcut cel mai mult e că suportă (deocamdată) două motoare de randare de pagini – Gecko și WebKit. Pe lângă asta e ușor și scriptabil în Python.

Așa că am scris extensia în Python inspirându-mă din nenumăratele resurse găsite pe net. Evident, voi fi recunoscător pentru orice comentariu sau ajutor. Pentru o utilizare plăcută și fructuoasă, copiați fișierele .py și .ephy-extension în ~/.gnome2/epiphany/extensions/ și apoi activați extensia.

Tastatură pentru ... programatori?

Sunt cuprins de o nedumerire cumplită din cauză că mă simt marginalizat ca programator. Pentru orice meserie există magazine specializate care vând echipamente de calitate (și nu numai) ca să îți faci bine munca. Doar programatorii nu au asemenea magazine care să le pună la dispoziție tot ce au ei nevoie ca să fie eficienți. Deși, programatorii sunt avantajați din alt punct de vedere: pot să-și facă propriile unelte pentru ca să facă alte unelte ca să facă alte unelte șamd. Ați înțeles ideea. Doar că acele unelte sunt software.

Reiser și Reiser4

Am folosit ReiserFS odată cu prima instalare de Debian, cred că acu trei–patru ani. Are jurnal, viteză, tot ce-mi trebuia ca să meargă bine sistemul. Cum am obișnuința să-mi bag nasul prin ceea ce se întâmplă în kernel, aflasem de existența sistemului de fișiere Reiser4 care ar revoluționa prin conceptele sale tot ce era legat de sisteme de fișiere. Am rămas doar curios și urmăream zgomotul în jurul acestui sistem.

În toamnă am aflat că Hans Reiser, inițiatorul companiei NameSys, a fost acuzat de omorul fostei sale soții. De atunci am urmărit cu atenție știrile legate de Hans și Reiser4. Poate din motiv că e un caz fără precedent în care un geek o asemenea talie a apărut într-un context așa de sumbru. Până acum aveam un stereotip clar pentru cei din rasa „geeks” – oameni pașnici care-și văd de lumea lor virtuală și nu omoară nici măcar o muscă (poate doar în jocuri, preferabil cu un railgun).

Pe Slashdot a apărut un articol despre arestarea lui Hans și lumea s-a agitat la comentarii. Senzația pe care am avut-o când citeam comentariile era asemânătoare cu cea în timpul vizionării filmului Severance – nu știi dacă e momentul să râzi sau să-ți pui mâinile-n cap. În orice caz, e destul să te gândești la faptul că Nina nu a fost găsită, Hans e băgat la dubă și doi copii au rămas fără părinți.

Însă geek-ul din mine nu poate să nu să se gândească și la al patrulea factor: Reiser4. Novell și-a băgat picioarele în Reiser4 imediat după arestarea lui Hans. Se gândeau că vor fi judecați și ei dacă folosesc Reiser4? Probabil e doar un joc politic (urăsc dacă politica e îmbinată cu ceva, mai ales cu programarea). E păcat ca un proiect de asemenea amploare să rămână în gol din cauza celor întâmplate.

Autentificare la un alt nivel de abstractizare

Câteodată mi se întâmplă să navighez sau să caut ceva pe forumuri sau bloguri. La cele mai des vizitate am cont căci aşa e politica majorităţii siturilor – poţi să participi dacă eşti utilizator înregistrat. Partea urâtă a lucrurilor este că de fiecare dată când vrei să te înregistrezi pe un forum trebuie să introduci datele personale şi cel mai enervant – să introduci o parolă. Cum să ţii minte zeci de parole asociate la mai multe nume de utilizator?

Syndicate content