Posts

Showing posts with the label linux

OpenClock and Gentoo

Image
OpenClonk is an open source game that has been in development for some time. Its fun and free. I downloaded a binary some time ago and started using it, but the latest release just doesn't work on my Gentoo machine in binary form. After some digging I didn't found an ebuild for this release, just for the live version. So I wrote my own and added to Gentoo's bug database . I learned a few things along the way but didn't get it as clean as I wanted. If someone knows how to convince cmake to install to a different directory than the prefix used it would be great. I ended up doing a patch for the generated cmake_install.cmake . If anyone knows how to avoid that patch I would appreciate the help. Here is a preview of the game:

Hidden Features...

I bought a Samsung SyncMaster XL2370HD recently. It has more than what I needed but I couldn't find one without the features I didn't need (HDTV) for a cheaper price so I bought it. I honestly though about returning it because the colours and fonts were horrible when I first connected my laptop through HDMI. I played a LOT with the settings but didn't get anything good. I finally solved the issue by renaming the source. That's right: you go the options, rename the source HDMI to PC and everything should start to working perfectly. They should call this feature "Source Fixer" instead of "Name Editor" as it turns off many of the "default" processing features that I don't need. So, if you had a problem with weird colours or fonts in your monitor when using an HDMI cable try to rename the source HDMI. It is called "Edit Name" in my monitor and it will show you a list of devices (it won't allow you to input one). Just choose P...

More on Jack...

Well, jack isn't working well with non jack applications. The jack-plug doesn't always work and I can't get it to be stable. I'll continue to look into it. If I find anything I'll post it here. For now I'll use jack with applications that support jack.

Using jack to record telcos and screen

Image
At my job we use VOIP regularly when making conferences or simply calling a colleague. We also have a screen sharing tool that we use to share the screen to remote participants. This is also used to make remote training sessions. What I've been missing is a way to record both the shared screen and sound for later viewing. I hacked jack a little in the past but didn't manage to get it working. I've been having some free time so I decided to hack it today and I finally got it working. So, from the start. Gentoo's JACK guide on the wiki is not bad but I honestly didn't pay much attention to it. I have the jack use flag enabled globally so it was time to get it going. First I emerged qjackctl . It is nice program that sits on the tray area (I have it default to hidden) that starts the jack daemon and that allows you to control what is connected to where. I also emerged alsa-plugins to get the alsa-jack plugin. Finally I emerge jamin . I need it just to be able to...

Howto make your private VM Cluster, Part III

Continuing with my saga , next up is DRBD . I'm using DRBD because I also want to test it as a viable alternative for network raid . To use DRBD I first created a LVM volume to use: lvcreate -n drbd-demo -L 100M internal-hd Then I configured DRBD on both nodes, fortunately gentoo simplifies a great part of the process (you have to do this on both nodes): cd /etc cp /usr/share/doc/drbd-*/drbd.conf.bz2 . bunzip2 drbd.conf.bz2 Then I created a wwwdata resource by first configuring it (again on both nodes). This is done by creating a file /etc/drbd.d/wwwdata.res with the contents: resource wwwdata { meta-disk internal; device /dev/drbd1; syncer { verify-alg sha1; } net { allow-two-primaries; } on node1 { disk /dev/mapper/internalhd-drbd--demo; address 192.168.100.10:7789; } on node2 { disk /dev/mapper/internalhd-drbd--demo; address 192.168.100.11:7789; } } I added the drbd module ...

Howto make your private VM Cluster, Part II

In the previous entry I showed how to build the basic structure for your own private VM Cluster. Today I'm going to show you how to create a cluster with two VMs that provides High-Availability for a WebServer using DRBD to replicate the Web Site. First you need to create a virtual machine. I decided to create a VM with Gentoo . I will use LVM to keep the partition to use for drbd small since this is a simple test. I created a qemu-img for a base gentoo installation (my goal is to install gentoo on the VM and then reuse it as base for the other VMs). To create the image just run: qemu-img create -f qcow2 gentoo.qcow2 10G I started the VM using that image and followed Gentoo's installation guide . My partition scheme was 100Mb (boot), 512Mb (swap), 5Gb (root), rest for lvm. I used the gentoo-sources, configuring all virtio devices, drbd and the device-mapper. I configured genkernel to use lvm so it detects the lvm volumes at boot. I used grub and added all the genkern...

Howto make your private VM Cluster, Part I

I wanted to make some experiments with DRBD , pacemaker and others. The goal is to test a few configurations for an high availability scenario. Since I don't want to make changes to my machine the solution is to use Virtual Machines. I decided to go all open source and use KVM . Since I want more that a single VM I decided to setup a private bridge to which all the VMs would connect. The bridge would provide DHCP and DNS services and NAT + Firewall to the internet. I use Gentoo . If you use another distribution or firewall tool you should adapt these instructions and scripts to fit your needs. First I created a script that sets up my bridge. The script is as follows (I called it setupBridge): # !/bin/ bash set -x # Setup the bridge sudo brctl addbr br0 sudo ifconfig br0 192.168.100.1 netmask 255.255.255.0 up # Launch DNS and DHCP Server on br0 sudo dnsmasq -q -a 192.168.100.1 --dhcp-range=192.168.100.50,192.168.100.150,forever --pid-file=/tmp/br0-dnsmasq.pid # Launch updated fire...

Laptop Power Saving

Today I had an issue updating the kernel on my company's laptop. I ended up reconfiguring it from strach istead of doing the oldconfig option (make oldconfig didn't ask anything but the kernel hard locked on boot). I took the oportunity to try to get a more duration out of the battery. How? By consuming less power. PowerTop came in and lend a helping hand but it was not sufficient. When I enabled USB Suspend (CONFIG_USB_SUSPEND) the keyboard didn't work well. I have a keyboard, mouse and webcam connected to a hub that I use when I'm on my desk. Everything was working, power was being saving, even for the keyboard. The problem was that when the keyboard entered power saving mode and I pressed a key the first key that I pressed would be lost. The documentation talks about this issue but I didn't want to loose on the opportunity to increase my laptop's autonomy. Solution: udev to the rescue. I created a udev rule that detects the USB Keyboard (by vendor and produ...

When hackers have fun!

Today I was building the RRDTool from source and I noticed the output of the configuration part was ordering a CD. config.status: executing po-directories commands config.status: creating po/POTFILES config.status: creating po/Makefile config.status: executing default commands checking in... and out again ordering CD from http://tobi.oetiker.ch/wish .... just kidding ;-) ---------------------------------------------------------------- Config is DONE! This shows that hackers love to play ;-)

Simplified Option Icon 255 on Gentoo

I have an Option Icon 255 from work to use when I'm out of the office. It is a 3G USB pen. I've used many outside scripts and graphical user interfaces but I never liked them. They crashed a lot and never seemed natural. Also I wanted a script that actually worked all the time instead of failing sometimes because it took the device a couple more seconds to register in the network. My solution: a mix of udev and shell scripts. First I made udev rules for the device. I want it to always have the same name on the /dev file system and that as soon as I connect it to the laptop it should validate the PIN and register in the network.I created a "49-hso.rules" (hso is the name of the kernel driver for the device) in the "/etc/udev/rules.d" folder as follows: ACTION!="add", GOTO="hso_end" SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTR{hsotype}=="Control", SYMLINK+="wctrl0" SUBSYSTEM=="tty", SUBSYST...

Gentoo with LUKS and LVM

My company has security policy that forces us to encrypt the hard drive of the computer and any other media. Well, not the whole hard drive, but 99% of it: the 1% is what is required for the PC to boot and ask for a password to decrypt the rest of the drive. The good news is that I'm allowed to use Linux. The bad news is that they have red hat enterprise linux and I like Gentoo. For a long time I've been using kubuntu. It is not bad, but it is too easy to use that it borks some time and I like the control Gentoo gives. Since I only installed Gentoo 2 times, one in 2003 and another in 2007 I decided to write all the steps for a bare minimum Gentoo installation. I have tested these steps on a Virtual Machine using KVM. Next step is to make it on the real laptop. It should take something like 35 minutes to do this on a Core 2 Duo at 2.2ghz. Notice: This works for me. Use it at your own risk and remember that these commands wipe your hard drive so, if you want something special ...

Getting NetBeans to do Anti-Aliasing

I changed desktop environment from KDE to none when Gentoo marked KDE 4 as stable. Don't get me wrong: it has nothing to do with KDE 4 itself. The problem is that my computer is rather old and it was already getting a little slow with KDE 3.5. KDE 4 is heavier and slower bringing me to the tipping point. No, GNOME is not the answer: I switched from GNOME to KDE when GNOME got too bloated and don't get me started with mono... Now I'm using openbox , considering wmii or enlightenment but not a full desktop. I added adesklets to the mix, conky , tint2 and yeahconsole and I'm ready to work. A couple of days ago a colleague had issues with NetBeans on Gentoo, specifically the fonts had no anti-aliasing, hinting, whatever you want to call it. I tried it today because I was using NetBeans to do some PHP coding. Well, I had the same problem. After some investigation I finally found a way to get it back to work without running KDE or GNOME and I though of sharing it here ho...

CMake Cross-Compiling

I don't know if I already mentioned, but I'm writing and ODBC driver at work. A colleague of mine proposed that the driver is open sourced since it is not our main business. I hope it is, but I'm keeping my hopes high. In the mean time I can share what I have learnt. The driver is an ODBC-RESTful bridge, that is, ODBC requests are transformed into HTTP Restful requests. Although the initial goal of the driver was to be Linux only we had to change it because of the wonderful reporting tool chosen. So I had to port it to Windows. I wont go on the tiny details on how to write portable C code (basically using #ifdefs ) but on using CMake and cross-compiling. You see I went and tried to use Microsoft Visual Studio Express, the latest version, but the compiler was so slow, the IDE was, well, horrible and the Operating System is a stone in my shoe, even if executed in a virtual machine. So I decided to put MinGW to a good use and cross compile, that is, to compile on linux a win...

Back to C: CMake and CUnit

I'm back at programming in C. I proposed something 8 months ago at work that was totally ignore. Now my boss wants me to do it because the other alternatives have totally failed. The idea is to implement an ODBC Driver. If I have the time I'll put a tutorial here on how to do that on Linux. But back to the point of this entry. This small guide will help you create a simple project using CMake to build it and cunit to test it. Yes, I believe in test driven development, no matter the language. Let's imagine a simple project that produces an executable that prints the result of 2 + 3 (I know, lame but sufficient for this example). To make it easier to test I split the application. The functions will go into a library and there will be a source file that starts the program. The library header file is called "lib.h" (extra points for originality). Here are its contents: int add(int a, int b) ; The implementation is on the lib.c file as follows: int add(int a, int b)...

Updating my Six Year Old Laptop

Today I finally finished the update on my six year old laptop. I know it sounds crazy, but I bough a laptop back in end of 2001 and I still haven't replaced it. I put linux into it and never looked back Started with Mandrake at the time, I then made the switch to Gentoo. Since then I have always updated my system without any format like you have to do on other operating systems. I was unable to connect it to the internet for a while. This lead to a very outdated operating system. Luckily Gentoo is almost straight forward to update. The only problem is that my desktop environment is eating a little too much memory for my taste. I guess I'll need to tackle it later. On my project list is an idea to make a 3D chart on top of Java 2D. Why? Well, I already made such a chart for the company I work for, but at that time I used Java 3D. Now, there is nothing seriously wrong with Java 3D itself. Let me make it clear that it is very nice API. But to do a chart in Java 3D is an overkill. ...

The Building, Life and the Laptop...

It is funny how things turn out some times. No matter how many plans you make, destiny will always throw a curve ball at you. You may plan it all out: what to do, when to do it, even how to do it. But the fact is that when you try to actually do it, things will blow up in your face. The last entry I made in this blog was about the building I'm currently working on. Funny thing is that it has been over a month since I blogged and the building is still under constructions. But since someone very important, like the President, is coming for the official opening the work has suddenly switched into Warp 5 Speed. You have painters working side by side with welders; technicians configuring the elevator; technicians testing the air conditioning and more. The end result is that nobody can actually get any work done in the mist of all the noise and smell of paint. On top of that the building still has no full electrical power. We didn't work for a whole morning so the power company could...

The Power of the Community

It isn't new, other have already said it, but today I found another demonstration of the Power of the Community. A Community of motivated people created many successful software projects, like the GNU/Linux project. When the idea for a new project appears and a community builds up around it, the project at such a pace that commercial companies would say it is impossible. In fact, when the community that is developing an application that they will use it, magic happens. Today I was browsing through the web when I came across this set of videos on YouTube. It is about the Jokosher project. What is the Jokosher project? Well, I'll quote its home page: Jokosher is a simple yet powerful multi-track studio. With it you can create and record music, podcasts and more, all from an integrated simple environment. It may not sound that great, but this application was built like every application should. And is moving at a quick pace because of the community that surrounds it. But back,...

ARM, Symbian, Linux and the iPhone

I've been a little off-line lately due to some personal problems It involves the health and life of someone that is dear to me. This leaves me without any will our power to actually write anything. But at least I'll leave here a link to a series of articles on the story of the ARM processors, the Symbian and Linux use on Mobile Phones. And of course, the latest release from Apple the iPhone. Read on if you want to know a little about history, since my will to write is somewhere else...

Linux Kernel Internals...

Have you ever wanted to know the Linux Kernel Internals? Well, today, while browsing the web, I came across this article . It is an interview with Jens Axboe, the hacker that launched the development of the 2.5 branch of the Linux Kernel with his rewrite of the block layer. If you ever wanted to understand a little more about how Linux works, just read the interview. It is well worth the time it takes to read it. In fact, I'm know installing the kernel 2.6.19 on my Laptop and I'm following some of his advices, specially the notes about I/O Schedulers. What do you want? My Laptop is a 6 years old machine: if I can squeeze a little more performance out of it, I will!

The Community

Today I was browsing through my usual RSS feeds and I ran into this one . It is a presentation about "How To Herd Cats and Influence People". Jono is right on the money: the community is the key to keep a project alive. In fact he is even righter when he mentions that the process should be defined, not a peace of bureaucracy that no one wants to follow, but a simply defined. I'm saying this because I'm trying to contribute to Rhythmbox and I'm having difficulties on how should I make things. You see, when I involve myself in a project I like to respect the already made decisions. For instance: I don't want to start immediately by questioning the chosen architecture. The problem is that if I don't understand the architecture it will be difficult to contribute. What's there left to do? Well, I'll choose one implementation, the one that is quicker and that doesn't seem to break the application's architecture and move ahead; submit the patch an...