Samuel Kroslak’s blog

Archive for the ‘Linux’ Category

Intellij IDEA after install tips

without comments

I worked with IDEA on OpenSUSE 10.3 linux distribution, but most of the mentioned settings should be cross OS. I also found blog post by Hamlet D’Arcy over THERE. Hamlet describes his top 10 list for IDEA. Check it out too.

  1. Set proper VM setting for IDEA, according to your machine. You can find one useful and straightforward property file at %idea_install_dir%/bin/idea.vmoptions. I don’t remeber defaults, but I have 2 GB of ram so I set it like this:-Xms64m
    -Xmx768m
    -XX:MaxPermSize=768m
    -ea
  2. Print-out keymap and stick it somewhere where you can see it. You can find it at IDEA welcome page. From the beginning, IDEA keymap seemed a little unconfortable to me, but after a while, I get used to it and now my writing – generating :> – speed is much faster than in eclipse. Early investment into keymap is totally worth it.
  3. IDEA has best plugin system I ever seen. Look into Amount of plugins isn’t as huge than eclipse repository, but it’s big enough. It’s worth to notice that most useful plugins are installed by default. Browse to File -> Settings -> Plugins. Most of the time there is no need to go to internet, complete plugin repository is here and can be installed on click. From optionals, those are quite good in my opinion:
    1. ‘Identifier Highlighter’ – if you are used to have variable usages highlighted (as in eclipse), this is it. Most of the people disagree and find it annoying, but I like it. It has many settings.
    2. SQL Query plugin – very nice universal SQL client built in to IDE. Contains DB browser and many features you could expect from others stand-alone SQL clients.
  4. use keyboard shortcuts! Main strength of IDEA is in high-quality editor, which is not perfect, but surely better than other two’s (eclipse, netbeans)

Written by Samuel Kroslak

February 29, 2008 at 10:47

Posted in Java, Linux

Writing with LaTeX on linux with pleasure

without comments

For last 3 years, I was balancing between OpenOffice and Latex and I always slipped back to OpenOffice, just because the comfort that OO provides. But beautiful Latex world was so desirable for me, that it couldn’t let me sleep.

Finally, after 3 years of wandering I managed to get it working as I expect it to work. Of course Latex is here and working for very very long time and it is still professionals choice, however with installation and configuration it is pretty challenging to get it into a shape you expect it to be. I moved recently to OpenSUSE with KDE environment and I had some free time, so I decided give it a shot here. Best user friendly tool I found on KDE is Kile, so why not:

yast -i kile texlive-latex

And guess what. Everything just works out of the box. I mean, I managed to install Latex on other distribution (even on one especially crazy called MS Windows XP…), but I never manage to get it into right shape with my primary language – Slovak. We have some pretty crazy diacritics here, I just can’t help it, I want it all there :> Few times I got it working, but diacritic was just ugly (misplaced). After I installed Kile and texlive-latex package on OpenSUSE 10.3, I opened Kile and with simple wizard I generated header which looks like this:

\documentclass[a4paper,12pt]{book}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[slovak]{babel}
\usepackage[T1]{fontenc}
\usepackage{graphicx}

From now on I’m lucky Latex newbie user with really nice looking .pdf output with correct diacritics. See it for yourself – HERE. I’m not into technical details of Latex, I just want to use it, so I don’t know what’s right here or what’s wrong there, I just wanted to make report of successful out-of-box installation with OpenSUSE 10.3

Written by Samuel Kroslak

February 23, 2008 at 16:13

Posted in Latex, Linux

Custom DSDT loading on Toshiba P100/P105 laptops for Ubuntu/Debian

with one comment

Well, all Toshiba notebooks that belong to serie P100/P105 (or maybe also others), have problems with ACPI interface on Linux platform. Generally, sound is not working and there are problems with fans on GPU and CPU. Toshiba doesn’t officialy support Linux OS, so it is pointless to call to support. Fortunately, community has solution. You can install Linux OS, record your (dynamicly generated) DSDT file, correct it, recompile and copy it to directory where Linux can find it when it is loading kernel. All the knowledge and hints here are copy-pasted from various sources (I will try to cover them), so credit goes to community. I will try to make little guide of how to do custom DSDT and add my personal experience. Behold.

Ubuntu/Debian shared steps

This part is for both distributions. First, install neccessary programs:
apt-get install iasl

Then grab DSDT file from your machine and save it in current directory as dsdt.dat:
sudo cat /proc/acpi/dsdt > dsdt.dat

Dismantle dsdt.dat to readable dsdt.dsl:
iasl -d dsdt.dat

Compile dsdt.dsl with this command:
iasl -tc dsdt.dsl

As you try to compile dsdt.dsl and you have buggy DSDT, you will certainly see multiple errors. And now comes my favourite part – let’s get rid of them! Leave terminal window where you compiled dsdt.dsl open, to see the numbers of lines, you’re gonna need em. First, backup dsdt.dsl just in case:
cp dsdt.dsl dsdt_bak.dsl

And open dsdt.dsl for editing:
gedit dsdt.dsl {or 'kwrite dsdt.dsl' if you're using KDE, or 'vi dsdt.dsl' if you are feeling funny}

Here comes the list of fixes we have to do in dsdt.dsl file:

  1. Search for string “_T_0″ and replace it with “T_0″. Then replace all “_T_1″ with “T_1″ and do the same thing with all such variables, there should be 8 of them, last one is “_T_7″.
  2. Find string “Method (BTST, 0, NotSerialized)”, it should look like this:
    Method (BTST, 0, NotSerialized)
    {
    If (\_SB.ECOK)
    {
    Acquire (\_SB.PCI0.LPCB.EC0.MUT1, 0xFFFF)
    Store (\_SB.PCI0.LPCB.EC0.KSWH, Local0)
    XOr (Local0, 0x01, Local0)
    Store (\_SB.PCI0.LPCB.EC0.BTHE, Local7)
    Release (\_SB.PCI0.LPCB.EC0.MUT1)
    If (Local0)
    {
    ShiftLeft (Local7, 0x06, Local6)
    ShiftLeft (Local7, 0x07, Local7)
    Or (Local7, Local6, Local1)
    Or (Local0, Local1, Local2)
    Return (Local2)
    }
    Else
    {
    Return (Zero)
    }
    }
    }
    We need to add one more Else statement here, to return zero. This is how it should look: Method (BTST, 0, NotSerialized)
    {
    If (\_SB.ECOK)
    {
    Acquire (\_SB.PCI0.LPCB.EC0.MUT1, 0xFFFF)
    Store (\_SB.PCI0.LPCB.EC0.KSWH, Local0)
    XOr (Local0, 0x01, Local0)
    Store (\_SB.PCI0.LPCB.EC0.BTHE, Local7)
    Release (\_SB.PCI0.LPCB.EC0.MUT1)
    If (Local0)
    {
    ShiftLeft (Local7, 0x06, Local6)
    ShiftLeft (Local7, 0x07, Local7)
    Or (Local7, Local6, Local1)
    Or (Local0, Local1, Local2)
    Return (Local2)
    }
    Else
    {
    Return (Zero)
    }
    }
    Else
    {
    Return (Zero)
    }
    }
    When you are done, do exactly the same with method called “Method (EVNT, 1, NotSerialized)”.
  3. There probable will be errors regarding this part> “Name (_HID, “*PNP0C14″)”. I don’t remember exact error, but you have to simply delete asterix sign “*” in those names. After editing it should look like “Name (_HID, “PNP0C14″)”.
  4. We need to hack DSDT, so it will not recognize Linux and it will think we run MS Windows OS, funny, isn’t it? Find this block of code (may look differently on your machine): Scope (\_SB)
    {
    Method (_INI, 0, NotSerialized)
    {
    If (DTSE)
    {
    TRAP (0x47)
    }
    Store (0×07D0, OSYS)
    If (CondRefOf (_OSI, Local0))
    {
    If (_OSI (“Linux”))
    {
    Store (0×03E8, OSYS)
    }
    Else
    {
    Store (0×07D1, OSYS)
    If (_OSI (“Windows 2001 SP2″))
    {
    Store (0×07D2, OSYS)
    }If (_OSI (“Windows 2001.1″))
    {
    Store (0×07D3, OSYS)
    }If (_OSI (“Windows 2001.1 SP1″))
    {
    Store (0×07D4, OSYS)
    }If (_OSI (“Windows 2006″))
    {
    Store (0×07D6, OSYS)
    }If (LAnd (MPEN, LEqual (OSYS, 0×07D1)))
    {
    TRAP (0×3D)
    }
    }
    }
    }We need to comment out most of it and return value for MS Windows. Resulting block of code:


    Scope (\_SB)
    {
    Method (_INI, 0, NotSerialized)
    {
    If (DTSE)
    {
    TRAP (0x47)
    }

    Store (0×07D0, OSYS)
    // If (CondRefOf (_OSI, Local0))
    // {
    // If (_OSI (“Linux”))
    // {
    // Store (0×03E8, OSYS)
    // }
    // Else
    // {
    // Store (0×07D1, OSYS)
    // If (_OSI (“Windows 2001 SP2″))
    // {
    // Store (0×07D2, OSYS)
    // }
    //
    // If (_OSI (“Windows 2001.1″))
    // {
    // Store (0×07D3, OSYS)
    // }
    //
    // If (_OSI (“Windows 2001.1 SP1″))
    // {
    // Store (0×07D4, OSYS)
    // }
    //
    // If (_OSI (“Windows 2006″))
    // {
    // Store (0×07D6, OSYS)
    // }
    //
    // If (LAnd (MPEN, LEqual (OSYS, 0×07D1)))
    // {
    // TRAP (0×3D)
    // }
    // }
    // }
    Store (0×07D6, OSYS)
    }

  5. Almost done, we have to fix problem with nVidia GPU fan at least. Search for string (name of the method) – “Method (_REG, 2, NotSerialized)”. Whole method looks like this: Method (_REG, 2, NotSerialized)
    {
    If (LEqual (Arg0, 0x03))
    {
    Store (Arg1, Local0)
    If (Local0)
    {
    Store (0x01, ECOK)
    Acquire (\_SB.PCI0.LPCB.EC0.MUT1, 0xFFFF)
    Store (\TMOD, \_SB.PCI0.LPCB.EC0.TMOD)
    Release (\_SB.PCI0.LPCB.EC0.MUT1)
    }
    Else
    {
    Store (0x00, ECOK)
    }
    }
    If (\_SB.ECOK)
    {
    Acquire (\_SB.PCI0.LPCB.EC0.MUT1, 0xFFFF)
    If (LEqual (OSYS, 0×07D6))
    {
    Store (One, \_SB.PCI0.LPCB.EC0.OSTP)
    \_SB.PHSR (0×0D, 0×00)
    }
    Else
    {
    Store (Zero, \_SB.PCI0.LPCB.EC0.OSTP)
    }Store (0×03, \_SB.PCI0.LPCB.EC0.RG59)
    Store (\_SB.CIRE, \_SB.PCI0.LPCB.EC0.CIRE)
    Store (\_SB.PHSR (0×05, 0×00), DOFF)
    Store (\_SB.PCI0.LPCB.EC0.ACDF, \PWRS)
    Release (\_SB.PCI0.LPCB.EC0.MUT1)
    }
    }We need to add one line just before last bracket, so resulting block looks like this:

    Method (_REG, 2, NotSerialized)
    {
    If (LEqual (Arg0, 0x03))
    {
    Store (Arg1, Local0)
    If (Local0)
    {
    Store (0x01, ECOK)
    Acquire (\_SB.PCI0.LPCB.EC0.MUT1, 0xFFFF)
    Store (\TMOD, \_SB.PCI0.LPCB.EC0.TMOD)
    Release (\_SB.PCI0.LPCB.EC0.MUT1)
    }
    Else
    {
    Store (0x00, ECOK)
    }
    }
    If (\_SB.ECOK)
    {
    Acquire (\_SB.PCI0.LPCB.EC0.MUT1, 0xFFFF)
    If (LEqual (OSYS, 0×07D6))
    {
    Store (One, \_SB.PCI0.LPCB.EC0.OSTP)
    \_SB.PHSR (0×0D, 0×00)
    }
    Else
    {
    Store (Zero, \_SB.PCI0.LPCB.EC0.OSTP)
    }Store (0×03, \_SB.PCI0.LPCB.EC0.RG59)
    Store (\_SB.CIRE, \_SB.PCI0.LPCB.EC0.CIRE)
    Store (\_SB.PHSR (0×05, 0×00), DOFF)
    Store (\_SB.PCI0.LPCB.EC0.ACDF, \PWRS)
    Release (\_SB.PCI0.LPCB.EC0.MUT1)
    }
    // Martin Lorang’s hack
    Store (0×3C, VTMP) // 55°C avec glxgears, 48°C au repos, temp ext 24°C
    }

    This is hack from – guess who.. – Martin Lorang, you can also use different numbers for different target temperatures. This is value that I use, here are others, if you feel adventurous:


    Store (0x30, VTMP) // 72°C avec glxgears, 65°C au repos, temp ext 24°C
    Store (0x3C, VTMP) // 60°C con glxgears, 52°C en reposo, temp ext 24°C
    Store (0x46, VTMP) // 55°C con glxgears, 50°C en reposo, temp ext 24°C

We are done with editing today, recompile customized dsdt.dsl again:
iasl -tc dsdt.dsl

And hopefully you don’t see errors this time. If so, try to reread list of fixes if you by any chance forget about something, or try to google different solutions. This guide was helpful for me on my Toshiba P100-324. Now copy compiled DSDT file to initramfs:
sudo cp dsdt.aml /etc/initramfs-tools/DSDT.aml

And reconfigure linux image:
sudo dpkg-reconfigure linux-image-$(uname -r)

Debian users, reboot and you are free to go now. Ubuntu users, read next paragraph ->

Few steps more for Ubuntu users

Download THIS package and run these commands:

tar xvf toshiba_dsdt_kernel_fix.2.6.22-14_2007111300.tar.gz
cd toshiba_dsdt_kernel_fix.2.6.22-14_2007111300/
dpkg -i *.deb

After reboot, you should be ok too. This is needed, since Feisty, something is screwed up there, so Feisty and Gutsy don’t load DSDT.aml properly, and this fix is more than handy. Maybe they will sort it out untill next release…

Sources:
http://ubuntu-utah.ubuntuforums.org/showthread.php?t=349491&page=12
http://ql.homelinux.net/wiki/doku.php?id=ubuntu-7.04:dsdt#le_ventilateur_de_la_gc_nvidia
http://ubuntu-ky.ubuntuforums.org/showthread.php?t=580876&page=3
https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.22/+bug/136469

Written by Samuel Kroslak

January 11, 2008 at 17:15

Posted in Linux

Tagged with , ,

“There and back again” – Linux distributions

without comments

From my first attempt to use computer as a child, i followed IT development from eyes of MS OS’s platform. I started on MS-DOS with nice blue classic file manager which was my first master and teacher. Those of you who know, keep remembering, those of you who don’t, don’t worry :>. Then I jumped over Windows 95 (I don’t know where the hell was 3.11, I never put my hands on it…), then 98, 2000 and finally XP. In 2002 I tried my first Linux distribution and I choose Mandrake (now Mandriva), just because it was easiest for Windows users at those times. Of course I didn’t like it and returned back to Windows 2000/XP, although I couldn’t sleep well since then. After few years I settled myself on Ubuntu and finally moved all my stuff there and made it primary OS. It was back in late 2005 and since then I never moved back to MS world. MS Windows was transformed from my OS of choice to OS that I would recommend for my parents/grandparents or no-IT oriented friends. For myself, I wanted something more scalable, free, better performance… let’s cut that here, you know that stuff. So my story begins on Ubuntu.

Ubuntu was my OS of choice for about 1 year. I also tried Kubuntu – Ubuntu with KDE environment. I like KDE, but KDE is not so well supported than Gnome in Ubuntu. Great experience, but, there was one but. I didn’t feel keen enough, running Ubuntu. I was showing sings of silent envy on Gentoo and Debian guys who have OS’s that were so “cool”, they could configure and manage their distributions to almost crazy details and squeeze more performance from their machines on their hard-core distributions. I started to feel lame on Ubuntu and when I saw postings on some forums that said: “Ubuntu is for users to learn how linux works and for real men, there is Debian“. So I moved to Debian as real men, and as real men, I struggled with it for about 1 year to get at least 80% functionality that I had on Ubuntu. Sure, my OS was stable, hell-fast and I felt great, that I can push my machine in terms of performance. Yes, Debian IS more stable and is also faster than Ubuntu, when you know how to configure it right. But the major drawback for me was ease of use. On Debian, I found myself playing with OS much more than on Ubuntu. And from end-user point of view, honestly, things are not working so well and smoothly as they are working on Ubuntu.

So I ended up moving all my stuff back to Ubuntu and I promised myself – never dig again into hard-core OS’s. Not because they are bad, I’m pretty sure they are great, but because digging into keen OS’s took me great deal of my time, that I could spend much better. OS’s isn’t related to my career focus and never will be. I learned a lot about OS’s for these years and that counts for something (I hope), but it is enough for now. I’m staying with easy to use distributions for years to come.

PS: My choice of Ubuntu as distribution for day-to-day use is random. I consider Ubuntu in equal relationship with other distributions on same level – OpenSUSE, Mandriva and maybe Fedora. Ubuntu is not superior to them, or in other words – I’m not trying to follow Ubuntu hype.

Written by Samuel Kroslak

January 11, 2008 at 10:35

Posted in Linux

Tagged with , ,

Java Web Start under Linux

with 4 comments

I couldn’t believe it, but the whole java web start and stuff around it is just messed up on Linux platform. First, I tried to develop simple Hello world application and it worked OK. Great, I said to myself, but when I wanted to force JWS into some serious cooperation with serious ‘Hello World 2′ application, I encountered many problems there.

First – JWS under Linux has really poor tools. I mean, yes, they work, but don’t expect such a comfort as you have on MS Windows platform. No detailed information about errors if they are any. JWS simply won’t run and when I want to have some feedback, I have to run my Windows XP box and run JWS app from there to find out what’s going on.

Second – Jar signing. When you want to do something serious, you will certainly want to sign your .jar files with your deployed application. So I bundled all my application’s .jar files and .jar libraries into one .jar archive (BTW. see JPackIt which does this and it does really good job, but unfortunately has issues with JWS…this is another story) and I wanted to sign this .jar. OK, let’s Google how to do that…

keytool -genkey -keystore mykeystore {create keystore}
jarsigner -keystore mykeystore mindtermfull.jar mykey {sign jar}

That’s nice and easy, however I encountered very wild errors on my Linux box and I’m still not able to fix them.

keytool error: gnu.javax.crypto.keyring.MalformedKeyringException: MAC verification failed

If anybody has experience in signing .jars on Linux, please share you knowledge in comments. On MS Windows XP box, it went smoothly and now I have my .jar signed and can keep moving…

OS used: Debian Lenny and MS Windows XP EN Professional
JDK 6 with latest updates on both platforms

Part 2 – some good news

Niklas Mehner made some good points in comments to this post, that led me into right direction. I discovered that Java has more solid ground in Linux than I thought. First, JWS has many settings I didn’t know about and you can access it by simple command “javaws -viewer”. Second, I thought I’m using 1.6 sun jdk, but there was still GJC stuck in my system and that was why I encountered such errors. Now everything works like a charm and commands that I wrote before are working too.
Next time I will try to look at problems I encounter more deeply before blaming innocent pieces of SW in blog posts …

Written by Samuel Kroslak

December 12, 2007 at 21:21

Posted in Java, Linux

Tagged with , , ,

Debian customized installation

without comments

Introduction to customized installation of Debian distribution with KDE desktop environment on desktop/laptop. No deep knowledge of *nix OS required, but some basic knowledge is required. Let’s build a stable and high-performance OS installation in few (really) easy steps. I admit this is not complete guide how to install Debian (this is enormous task to even cover this topic), more exactly this is my way to do it. Many things here that I will state will be for sake of simplicity, so please don’t be angry if you find something ‘not quite exact’. However if you find misconceptions or anything that can help me to make this guide better, please post it in comment, thanks. (Hint> at the end of article is handy summary with files included, so you can skip all that crap if you want)

Why are we doing it? – optional reading

I’m using various linux distributions for about a 3 years now. I’m definitely NOT geek on this platform, no advanced shell scripts and that kind of stuff, I’m using linux because I like the way it works and because for me personally it is much better platform than MS Windows or Mac OS X. Of course, linux has it’s own drawbacks and disadvantages, but they – in my opinion – are acceptable for the value it gives you in return. Open source, etc.. that’s another story. I tried almost every popular distribution that is out there for last 3 years and I must admit that pure-good-old Debian is for me the winner. It is very stable and you can take advantage of HUGE ubuntu user base – most tips, tricks, scripts, etc. that are written for ubuntu are usually working on Debian too. First, I installed Debian and started to customize the installation as I worked and used it every day. Next I discovered that there is bunch of stuff I don’t need and there are also things that can do better. So I made my way through Debian jungle and made myself a little guide how to install, configure and maintain this system. Here it goes…

Choosing version, media, etc.

Debian is distributed in 3 different parallel releases – stable, testing and unstable. Read wiki for details, I choose ‘testing’, because it is not as old as ’stable’ and is not suffering with problems with ‘unstable’. Don’t worry about the name ‘testing’ – they didn’t mean it like that :>. Despite the name, it is much more stable than you think. My architecture is ‘i386′, if you don’t know what that mean, then your architecture is most probably the same. I didn’t tried 64-bit version of Debian yet and I think it’s not worth it – definitely not for desktop/laptop that you are using for your common day-to-day needs. I once tried to run 64-bit Kubuntu linux and it was everyday struggle with almost all applications that I encountered (not every application is 64-bit ready, and those which claim they are, they are sometimes not too). So keep 64-bit version for server usage just for a few moments until things settle up a little bit.

Not only Debian comes in different releases, it also comes in different installation methods. I chose net install, which is best way, if you have serious Internet connection and you want to set things up your way. But to install it this way, you need to know exactly which packages do you need and thus this is is best installation method if you already worked with Debian (or Debian based distro like ubuntu, mint, kubuntu, etc) before. Or you can download LiveCD of debian and try what things/features you like and then proceed to this type of installation. Don’t hurry, you can install clean OS and play with packages later. Get yourself a suitable installation media – search for net install CD. Debian is very universal OS, so Debian official website can be really confusing sometimes. Navigate directly to page http://www.debian.org/devel/debian-installer/ and find line of links with this title>

netinst (generally 135-175 MB) and businesscard (generally 20-50 MB) CD images

choose your architecture (i386) and download ‘debian-testing-i386-netinst.iso’. Burn (or mount if you are using VM) and you are good to go.

Installation

Assuming that you have installation medium ready, we can boot from it and start installation. Just for now, keep everything you don’t need to change (or don’t understand) at default and proceed through steps. Just pretend you are installing Windows XP and clicking on Next> button :>. We will stop at the point “Debian software selection”, where you can choose packages you want to install.
Debian software selection dialog.

Make sure only to check “basic system” nothing more. No desktop environment, nothing like that. Now go through the rest of installation. (sorry for that ugly picture, I will try to make better one next time…)

Installation of desktop enviroment

Nothing fancy. After first stage of installation we ended up with plain command line, that’s what we wanted :>. Now we are going to add required repositories to be able to install KDE environment>

nano /etc/apt/sources.list

will open up file with our repositories, just add strings ‘contrib non-free’ at the end of every line, so the ’sources.list’ file will look like the one in resources at the bottom of article. Then fire commands>

apt-get update
apt-get install x-window-system kdebase kdm

This will ensure that KDE desktop enviroment will be installed correctly AND it will be clean core KDE desktop environment, not that KDE default installation which comes by default and is (in my opinion) overloaded with application that you will rarely use. That’s it, we are quite finished with installation. In my case I had to reconfigure X system, because my nVidia laptop video card wasn’t working correctly (she was refusing to set correct resolution). You will reconfigure X with command>

dpkg-reconfigure xserver-xfree86

When you will be asked for video driver and you have nVidia, choose ‘nv’.

Summary and my files

1, download Debian net install CD from ‘testing’ release and burn
2, boot and install with default options, when you encounter ‘Debian software selection’, choose only ‘base system’
3, edit /etc/apt/sources.list and add non-free and contrib repositories
4, apt-get update; apt-get install x-window-system kdebase kdm
5, after restart, dpkg-reconfigure xserver-xfree86 if needed
Files for your inspiration> sources.list apt-getInstall.sh

All for now, any comments for improvement of this how-to?

Written by Samuel Kroslak

December 9, 2007 at 20:24

Posted in Linux

Tagged with ,