Hacks and solutions from /dev/null

Me. On hacking and searching for solutions. (Read: My techical weblog.)

ALL INFORMATION IN THIS DOCUMENT IS WITHOUT ANY WARRANTY! USE AT YOUR OWN RISK!


Page map

Back to Fluxbox | Amarok and mp3 | mkv PS3 Media Server problem | The day I switched to KDE | The day I switched to Enlightenment | StarCraft 2 | Duke Nukem 3D | xterm backspace issue | MPlayer ogm issue | StarCraft on Slackware64 | Is this really hacking? | Hacking Perl on Android. | My new i5 computer. | Spotify not working on Slackware64? YEAH RIGHT!. | Windows software, and Linux alternatives. | Sega Mega Drive emulator. And Slackware64. | PS3 as media center. And Slackware Linux. | Last.fm scrobbling troubling on Slackware64 13.1 | Hacking inlook 1.0.0-pre1.pl | Hacking viewtxt.pl | Hacking birthdays.pl | /dev/dsp error | Hacking inlook 0.8.14 | Hacking inlook 0.8.12.pl | Hacking inlook-0.8.8.pl | xzgv 0.8 issue | Hacking Songs v0.3

Back to Fluxbox

2011/12/05

Well, so, I went back to Fluxbox. Everything works fine, even SC2.

Amarok and mp3

2011/11/13

Well, so Amarok wouldn't play mp3-files. Here's a solution for us slackers. You can use MPlayer in order to play mp3-files in Amarok. You have to configure Amarok and Phonon, and set MPlayer to be first priority for playback. Then it should work (at least it did on my computer).

mkv PS3 Media Server problem

2011/11/13

For a long time I've had troubble with getting mkv-files to work properly with Java PS3 Media Server. Here's a quick solution that should work on any system, under expert settings:

acodec != ac3 :: -lavcopts acodec=mp2:abitrate=384
:)

The day I switched to KDE

2011/08/20

Well, so I use KDE. I found it very handy, and it does not swallow a lot of CPU/RAM, at least not that I can see on GKrellM or in any other way see.

I just got bored, and wanted (yet again) to try something different. KDE seems to suit my needs at the moment.

The day I switched to Enlightenment

2011/07/06

Now... How do I start this one. Well, I've been using Fluxbox for like 7-8 years or something. I got tired of it, and wanted something different. I still think that Fluxbox is handy and can cover most of my needs, but I tried a few WM/DE's, and ended up with... Enlightenment!

After KDE back in the 90's, I used E16 for a periode, and after that Blackbox, GNOME (RedHat 9, at the time I used it on my laptop), and got stuck with Fluxbox, eventually.

I downloaded the SlackE17-package, and just (as root) installpkg slacke17-r56352-x86_64-1jp.txz. That's it. It's there. On the system.

After that I configured ~/.xinitrc and added enlightenment_start. I got some language issues (norwegian characters) with BASH, but seek and thou shalt find!

It took me a some hours to completely design the GUI as I wanted it to be, but eventually with great succes. I'm now a happy slacker, and just wanted everyone to know that there indeed is a simple solution for using Enlightenment on Slackware with little effort.

StarCraft 2

2011/06/23

I've been loving StarCraft since the very first release back in '98. Now, over a decade later, Blizzard released "StarCraft 2". Here's how I did it on my Slackware64 workstation.

First step: As root (su or sudo): mount -o ro,unhide,uid=1000 /dev/cdrom /mnt/cdrom/. This should give the result we want, and as you can imagine it's all located in /mnt/cdrom.

Second step: mkdir path-to-your-programs/StarCraft2, then cd into it. cp -r /mnt/cdrom/* . will copy all the data on the DVD to your StarCraft2/-folder.

Third step: Install/compile wine and set up multilib. See here for more information about this.

Forth step: wine Installer.exe will guide you through the rest. Note that you will need a battle.net-account. Don't worry, it's free, you already own a copy of the game. This means that when you login to the game, you enter the same e-mail address and password as your battle.net-account. Depending on your internet-connection, it may take a while to download the latest patches. So, be patient if you're not able to play the game rightaway.

Fifth step: Try launching the game with wine .wine/drive_c/Program\ Files/StarCraft\ II/StarCraft\ II.exe.

If this doesn't work, check the Application database at the official wine-site. On many systems it can take some time before the game starts, but after switching from Fluxbox to Enlightenment I've experienced only minor problems with that.

Enjoy!

Duke Nukem 3D

2011/05/29

While waiting for "Duke Nukem Forever", I wanted to play "Duke Nukem 3D", the good old one, on Slackware64. Here's how I did it. Guess you need multilib enabled. :)

First step: Of course we want to do it the legal way, so I payed and downloaded it from the official 3Drealms website.

Second step: You can use wine to install it, but it won't run it.

Third step: Download and compile EDuke32.

Forth step: While launching EDuke, it searches for gamedata in ~/.eduke32. I just copied the whole "Duke Nukem 3D"-directory into that one with cp.

Fine-tuning with Fluxbox: [exec] (Duke Nukem 3D) {/home/stian/programmer/eduke32_20110527-1897/eduke32}

That should be it.

xterm backspace issue

2011/05/12

This is just a small fix that will make xterm work more like a real X-terminal, meaning not giving "^H" e.g. while running a program written in Perl.

Add this to ~/.Xdefaults:

xterm.*backarrowKey: false

You may need to reload X11. Then it should work nice'n'shiny.

MPlayer ogm issue

2011/05/06

Well, the package of MPlayer that ships with Slackware 13.37 seems to not handle ogm-files (Ogg Media). I tried compiling from sourse and everything, but still... not working. I was not aware of that "Alien BOB" had a decent package for this.

Status: Problem solved. Even H.264 works flawlessly.

StarCraft on Slackware64

2011/05/01

Note: This section was completely re-written as of 2011/05/01.

I had some trouble getting StarCraft + Brood War up and go on Slackware64 13.37, but I found a solution.

StarCraft

First step: Enable multilib if you haven't already done it. "Alien BOB" got a very good review on how to set up multilib on Slackware64.

Second step: Download and compile Wine. I'm using v1.2.2.

Third step: I'm using the StarCraft version that ships with the expansion set. This means two CD's. In Linux this _could_ become a problem, because when you run wine StarCraft Installer blah blah Windows blah blah.exe you need to umount the first CD in order to complete the installation, which you can't - because you're already on it with mount /dev/cdrom /mnt/cdrom/. The solution is to mkdir StarCraft and cp /mnt/cdrom/* StarCraft/ and then cd StarCraft/. Start the installation program and type your name and CD-key (yes - I got a legal copy). umount /dev/cdrom and insert the second CD. I installed in the ~/.wine/drive_c/Program\ Files/-directory.

Forth step: With Slackware64 13.37, wine 1.2.2 and the lastest version of the NVidia-driver, you can just run winecfg and set the Emulate a virtual desktop to 640x480. This means that you do not need to change screen resolution with nvidia-settings.

This is where I started to get some serious issues. It seems like it's a good idea to 1) install the NVidia-driver, 2) compile wine and install StarCraft, 3) and then re-install the NVidia-driver. Before I did this it all crashed, and I had to restart X11.

Fifth step: And finally we're ready to go. I just run wine .wine/drive_c/Program\ Files/StarCraft/StarCraft.exe from my home-directory, and this will launch StarCraft.exe.

I have a very simple BASH-script that will launch StarCraft if you prefer not to do it by command-line (like me; I like to have it in the Fluxbox-menu).

Is this really hacking?

2010/12/21

I first posted this on my weblog, but it's in norwegian. This will be the english version.

Well, for a long time ago, I bought myself a bottle of Chivas Royal Salute 21 Y.O. on the swedish-boath (tax/duty-free) for like 700NOK. On the norwegian wine-monopoly it's like 1400NOK. I thought that the bottle seemed so nice that I wanted to make a lamp out of it. The problem was... I did not knew how. I will show you my solution:

Basic tools; bulb, lamptool and screen:

lamp1

Here's the most excpencive part, the screen, like 270NOK:

lamp2

This is my beatyful whisky:

lamp3

Here's how I come this far, and everything seems to work fine:

lamp4

Here's my Bob Dylan and chess altar, with the light on:

lamp5

... And finaly: The bottle-lamp:

lamp6

In total this did cost me around 350NOK in equipment, but the bottle is the whole point. It was excpencive, but very nice. Here's my review on how to make a lamp out of a nice bottle of whisky. :)

Hacking Perl on Android

2010/12/09

I recently got myself an HTC Desire with Android 2.2 and of course I wanted to hack Perl on it. This is what I did in order to make it work:

First step: Install 'Barcode Scanner' on Market if you haven't already got it.

Second step: Visit the Android scripting page.

Third step: Start 'Barcode Scanner' and scan the barcode. Follow the steps you will be given.

Forth step: Visit the perl for Android page. Scan the barcode.

Fifth step: Start SL4A from your applications. Now you should be able to hack Perl.

Sixth step: Your first program, i called it "hi.pl".
use Android;
my $droid=Android->new();
print "Enter your name here: ";
chomp(my $name=<STDIN>);
print "Hi, $name\n";

Enter Menu -> Save & Run. This should do the trick.

My new i5 computer.

2010/11/14

Recently I got myself an i5-CPU computer. It's Quad-Core with 2.80GHz and 4GB DDR3 RAM. Of course I wanted to use Slackware64 on it.

Everything went pretty well, but I had to do some tweaking.

In BIOS (or CMOS, if you like) I changed the soundcard from HD to AC97. I'm not quite sure if that was nescesary, but I did it anyway.

From /sbin/lspci:

01:00.0 VGA compatible controller: nVidia Corporation Device 0dc4 (rev a1).

When I first started X.org, it only worked with root! And the resolution was totaly wrong, as I'm using a 22" Widescreen Full-HD screen. I downloaded the propietary driver from http://www.nvidia.com/ , but still - only root could start X.org. I did set up Fluxbox as my default wm during the installation, but thanks to the kind people at ##slackware @ Freenode, I got the idea to run xinit /usr/bin/fluxbox and then xwmconfig as normal user. _THEN_ it worked.

I have yet to set up multilib and get Spotify to work, but I'll get there soon.

According to GKrellM the Core's are working fine together. I'm happy with that.

Conclusion: Great computer. DARE TO SLACK!

Spotify not working under Slackware64? YEAH RIGHT!

Update: 2011/08/23

Using alien to create a Slackware tgz-package from a deb-package works fine. Just check out the Spotify repository. RTFM! Google!

Update: 2011/04/01

With Slackware64 13.37 you do not need to compile extra libraries, and starting Spotify with just spotify works fine, and it remember the password and everything. You don't need to install GNOME, but you have to use rpm2tgz on the package in order to make a package.

Update: 2010/12/12

Spotify now got Linux previews. I tried the .deb-package, but got segfault when launching Spotify. Then i did the following:

Note: This will install GNOME!

First step: lynx --source http://gnomeslackbuild.org/net-install/64 | bash

Second step: Download the rpm-package.

Third step: Use rpm2tgz spotify*.rpm

Forth step: Run installpkg spotify*.tgz

Well. This is where I started getting some problems. It started fine the first time, but when I tried again... Nothing. See below for the solution.

Fine-tuning with Fluxbox: [exec] (Spotify) {rm -r /home/stian/.cache/spotify/ && spotify}

I cannot guaranty that this will work on _any_ _other_ _systems_ _at_ _all_! But it worked fine on my computer, although it doesn't remember the password when starting up. Just wanted everyone to know that the native Linux port of Spotify now works under Slackware64!

2010/10/18

Well, there are rumors out there: Spotify won't work on Slackware64. Well, that's not true at all. Here's what you need:

First step: Enable multilib! "Alien BOB" got a very good description on how to set up multilib on Slackware64. And in case you were wondering, yes - we need this in order to make Spotify work.

Second step: Compile and install wine.

Third step: Download Spotify. I didn't had to configure _anything_ at _all_ in order for spotify.exe to run. Take a look at ~/.wine. Try wine spotify.exe, should be plain and simple.

Fine-tuning with Fluxbox: I added this to my ~/.fluxbox/menu: [exec] (Spotify) {wine /home/stian/.wine/drive_c/Program\ Files/Spotify/spotify.exe}

That's about it. Of course you could enable Spotify URL's to work with Firefox.

Windows software and Linux alternatives.

2010/10/08

Ok, many out there probably thinks "Oh, how can I use Linux when I'm addicted to all this Windows software?". Here's the answer. (And of course there may be text/console-based alternatives, but I'll stick to the GUI in this case.)

Microsoft Office: OpenOffice, Oracle Office, KOffice, GNOME Office programs.
Windows Media Player: XINE, MPlayer, VLC.
Microsoft Internet Explorer: Firefox, Google Chrome, Opera, Konqueror, Epiphany.
Microsoft Outlook: Thunderbird, Evolution.
WinAmp: Audacious, qmmp, Rhythmbox, Amarok.
MSN: Pidgin, aMSN.
Adobe Photoshop: GIMP.
mIRC: XChat.

Microsoft Windows got a system monitor, I'm not sure what it's called, but both KDE and GNOME have alternatives. Additionally, you can get real-time system monitoring using GKrellM.

This seems to cover _most_ of the difficulties while converting from Windows to Linux. A good place to start: Ubuntu.

Sega Mega Drive emulator. And Slackware64.

2010/09/12

Well, I got a Slackware64 system on my desktop/workstation, and I _really_ wanted to play the good old games that I remember from being a kid. Well, here's the solution:

Xe - Multi System Emulator.

You may want to try and run xe --lite after installing it, and set the right region (Europe in my case). And then just xe ROM-NAME.smd.

A good place to start: Emuparadise.

PS3 as media center. And Slackware Linux.

2010/09/04

Ok, I got a PS3 recently. Now, I've improved it with media center features. Here's what you need:

  • A Playstation 3 (d'oh)
  • You will probably connect to it through LAN (give it an IP-address)
  • UPnP needs to be endabled
  • You need (in this case) a Linux-system (works on other OS'es as well)
  • Java PS3 Media Server (software)
  • A bunch of video-files (hopefully legal)
  • MPlayer, MEncoder and FFmpeg
  • Java
First step: I'm using 192.168.0.3 as an IP to my workstation, it goes to 192.168.0.1 which I'm using as a server. As long as you have the IP-addresses correcly, you can start and set up your Playstation 3 with an IP-address if you've not already done that. I'm using 192.168.0.5 for mine. Should be plain and simple if you know what you're doing.

Second step: On your workstation/desktop; make sure you already have MPlayer, MEncoder and FFmpeg. Use Google if you don't have that. I didn't had FFmpeg, so I compiled it from source as you always compile programs with GCC.

Third step: Download PS3 Media Server. I'm using v1.20.409 (beta). Just 'tar xzvf' the package and 'cd' into it. Now you will experience if you have Java or not. Again, see Google if not.

Forth step: Turn on your Playstation 3, and './PMS.sh'. Hopefully, this will do the trick, and if you have come this far, you'll probably get it all to work, as long as the status is "PS3 has been found !". :) Go to "Navigation/Share Settings" and add a folder with video-files in the "Shared folders" section. Just see around in the PS3 Media Server a bit, and try to configure it the best way you can.

Fifth step: Now you probably got everthing working, and you can start watching videos on your TV.

Fine-tuning with Fluxbox: It won't work to just edit ~/.fluxbox/menu with the path to PMS.sh, but I'm a nerd, and nerds finds solutions. This is how I manage to get a work-around (of course you need to set your own path in this case):
[exec] (PS3 media center) {cd /home/stian/programmer/mediacenter/pms-linux-1.20.409/ && PMS.sh &}

Note: You can enable Last.fm scrobbling if you want to.

Credits: Thanks to ksw for giving me the idea for getting PS3 to work as a media center.

Last.fm scrobbling troubling on Slackware64 13.1

2010/05/26

IMPORTANT NOTICE 3: It _was_ hardware-related. I'm now using new hardware, and everything works fine with Slackware64 and Audacious 2.4.0.

IMPORTANT NOTICE 2: The information below is out of use. The problem probably was hardware-related. I compiled the new Audacious 2.4.0 and it worked fine with scrobbling.

IMPORTANT NOTICE: The information below doesn't work out as it should. It caused system locks and reboots. I switched to qmmp, which compiled fine from source. I just wanted everyone to know.

Slackware 13.1 was released recently, and today I installed it on my workstation. It all seemed pretty nice, until... What the... No scrobbling with Last.fm in Audacious? It took me a long time to realize the problem. The Audacious development team had excluded the plugin for the 2.3-version which ships with Slackware 13.1. Well, ok. I guess you could do the same thing with version 2.2, but I went back to 1.5.1 which is used in 13.0. I downloaded the packages from my local mirroring site, and executed the following commands: su (You need to be root.) pkgtool And removed the Audacious-package (including the plugins). Then: installpkg audacious-plugins-1.5.1-x86_64-4.txz installpkg audacious-1.5.1-x86_64-3.txz. I'm happy. Once again.

Hacking inlook-1.0.0-pre1.pl

2010/03/12

Today I released inlook 1.0.0-pre1.

A problem I've been working on for a long time was solved with this code.

It works fine, but I guess I have to "polish" the code a bit. Anyhow I felt that the time was right to release pre1. I am actually using inlook as my main e-mail client right now. :)

Hacking viewtxt.pl

2010/01/28

Up late - again. Hacking. Perl. Searching for solutions.

I'm not quite sure on how important this was, but anyhow I think i solved a security-leak with the following line: if ((!$full=~/doc/)) {

Time will show how important this was. But hopefully this will prevent cracking and other stupid nonsence on my domain.

You may as well check out the full source for further details.

Hacking birthdays.pl

20090513

I'll never learn. Up late. Hacking. Perl. Again.

I've hacked a lite tool for remembering birthdays. See the source for details and instructions.

/dev/dsp error

20090408

Well. What can I say. Up late again. Not hacking, just searching for solutions. As stated before, I did a small hack with Songs v0.3. After installing Slamd64, and compiling Linux kernel 2.6.28 - /dev/dsp couldn't be found on my system, and I had no idea on what to do. Songs wouldn't play my wav-files, and unfortuntaly it doesn't support ALSA, but OSS only.

It's quite embarrassing, actualy. All I had to do was modprobe snd-pcm-oss.

So.

My /etc/rc.d/rc.local now containts these lines (among others, of course:)

echo "Now loading module: snd-pcm-oss"
modprobe snd-pcm-oss
Me. Happy. Now.

Hacking inlook-0.8.14.pl

20090401

Up late and hacking - again. The code below says it all I guess.

inlook-0.8.14.txt

It's quite messy, but it does the job. Now I am soon going to sleep.

Hacking inlook-0.8.12.pl

20080610

I've been late up coding, again. The whole night. Bless the caffeinated drinks.

Anyway, I've done some improvements on inlook. Now I have a spambox and sent-mail folder, which is used inside of inlook. Earlier you had to quit inlook and use 'cd' to reach the actual e-mail(s). Here's how the spambox works:

inlook-0.8.12.txt

It's VERY satisfying when the code works flawlessly.

Hacking inlook-0.8.8.pl

20071023

Well, where should I start. Inlook, my e-mail sending and receiving program needed an update. This time, I wanted to make a better configuration-system. The old solution looked like this:

  open(CONFIGUREFILE, "<$config_file") || print "$0: can't open $config_file: $!\n";
  @configure_lines=<CONFIGUREFILE>;
  chomp($mail_real_name=substr($configure_lines[0], 10));
This is of course not good. It makes the configuration-file (~/.inlook/inlookrc) less flexible and hard to modify. Although I have an automatic setup for configuring inlook when running it for the first time, I felt that I needed to perform a little and very simple hack.

The new solution is quite simple, and now looks like this (in this example, we want to find the real name from the configuration-file):

  open(CONFIGUREFILE, "<$config_file") || print "$0: can't open $config_file: $!\n";
  @configure_lines=<CONFIGUREFILE>;
  for ($i=0; $i<20; $i++) {
    if ($configure_lines[$i]=~/real_name/) {
      chomp($mail_real_name=substr($configure_lines[$i], 10));
      $check=1;
    } 
  }
  if (!($check)) {
    print "$0: configuration error: please check $config_file\n";
    &main();
  }
It does the job quite nice, and works perfectly. Now I have to change this for the whole code, which is going to take some time...

xzgv 0.8 issue

20070727

Running an x86_64 isn't that easy, after all - some programs just don't seem handle it. An example: I like xzgv (and yes - I'm aware that it's outdated), and used it all the time on my x86-laptop. Now, with x86_64 I got the following error messages while running make:

stian@xasthur:~/programmer/xzgv-0.8$ make
cd src && make xzgv
make[1]: Entering directory `/home/stian/programmer/xzgv-0.8/src'
gcc -O2 -Wall -DINTERP_MMX -DBACKEND_IMLIB1 `gtk-config --cflags`   -c -o main.o 
main.c
main.c: In function `do_logo_invert':
main.c:4590: warning: operation on `ptr' may be undefined
/tmp/cc9apfZc.s: Assembler messages:
/tmp/cc9apfZc.s:13445: Error: suffix or operands invalid for `pop'
/tmp/cc9apfZc.s:13448: Error: suffix or operands invalid for `push'
/tmp/cc9apfZc.s:13451: Error: suffix or operands invalid for `pop'
make[1]: *** [main.o] Error 1
make[1]: Leaving directory `/home/stian/programmer/xzgv-0.8/src'
make: *** [xzgv] Error 2
It took some time, but eventually I realised both the cause and solution. In xzgv-0.8/config.mk we can see the following compiling options:
CFLAGS=-O2 -Wall
After some thinking I found out the that I had to edit config.mk like this:
CFLAGS=-O2 -Wall -march=x86-64 -mtune=x86-64
I also had to uncomment a line in config.mk in order to make this work (like I've done on the line below):
# CFLAGS+=-DINTERP_MMX
Now, I've also created an x86_64 Slackware package which is available here.

Happy hacking!

Hacking Songs v0.3

20070719

Songs is a nifty program written by an enthusiastic individual which have written many hacks and programs. I use it with my noise-project and I really like it. It worked like a charm on my x86-laptop, but as I moved to x86_64 the program compiled fine, but exited with an error message. It would be sad if I couldn't use the program on my x86_64.

The error message I got was the following:

stian@xasthur:~/programmer/songs-0.3$ ./songs 
Sorry, on your machine sizeof(int) < sizeof(void *)
the program can't handle it.
Now, I e-mailed the author, and he explained to me that I could try to uncomment some lines in main.c and see if that worked. That's exacly what I did, and as expected it worked fine.

The lines that causes the problem is the following:

if (sizeof(int) < sizeof(void *)) {
  fprintf(stderr, "Sorry, on your machine sizeof(int) < sizeof(void *)\n");
  fprintf(stderr, "the program can't handle it.\n");
  return 1;
}
I decided to solve the problem with some sort of style, so I ran the following commands to create a patch.
stian@xasthur:~/programmer/songs-0.3$ cat main.c > new-main.c
(Note that in new-main.c I have modified the five lines above.)
stian@xasthur:~/programmer/songs-0.3$ diff -u main.c new-main.c > songs-0.3.x86_64.patch
You can download the patch from here, and copy it to the songs-0.3/-directory.

Use the following command to patch the program:

stian@xasthur:~/programmer/songs-0.3$ patch -p0 < songs-0.3.x86_64.patch
stian@xasthur:~/programmer/songs-0.3$ make
That's it. The program _can_ handle it! :-)

20070727 Update: I have now created a Slackware package with Songs, it's available here.

Back to page map.


This page was last modified Monday, 05-Dec-2011 03:33:39 CET
Copyright (C) 2007, 2008, 2009, 2010, 2011 Stian Skjæveland.
Verbatim copying and redistribution of this entire page are permitted provided this notice is preserved.

Valid HTML 4.01 Transitional Valid CSS!