Monday, May 28, 2012

Either in Scala: A language demonstration

Some of you might have noticed that I (finally!) started learning Scala. I used it for a while now and already made a few posts about it on my german blog.
As I am still addicted to the last.fm API and I wanted to create somthing useful while learning a new programming language, I decided to start coding a brand-new all-shiny last.fm API library for scala, because nothing sufficient exists in this area. From my point of view, the best scala approach until now was made by the Guardian.

So, lets start by making a simple sample request:

class Artist(configuration:Configuration) {

  val apiService = configuration.apiService;

  def getInfo(name: String): Either[ArtistProfile, Error] = {
    val call = new Call("artist", "getInfo", Map("artist" -> name))
    val response = apiService.service(call)
    response.result(ArtistProfile.apply)
  }
}

The code looks fairly readable, doesn't it? We have a class which takes a parameter of type Configuration and a method which returns either an ArtistProfile or an Error.
Lets dig a bit into that:
The first line of getInfo creates a new call object, which stores e.g. the method to call and the methods parameters, so no magic here.
In the second line, we use the apiService field to receive the response via the service method. Nothing special is going on until now. As you can see, no type is specified for the response variable. This is one handy aspect of scala called type inference. In many cases, the Scala compiler can automatically assume the type of the variable. The val statement makes the variable immutable(say: final in Java), in contrary to a var statement. It should be sayd that you also can specify the type if you want to.
Now the response variable should contain on Object of type Response.

Lets take a look inside that class:


class Response(val xml: NodeSeq) {

  /**
   * Gets the root element of the xml inside the <lfm> tag
   */
  val dataXml = xml(0).child.collect {case e : Elem => e}
  
  /**
  * Return the Error or None
  */
  val error: Option[Error] = Error(xml)

  def result[T]( xmlConverter :(NodeSeq) => T) : Either[T, Error] =
    error.toRight(xmlConverter(xml))

}

The constructor takes an xml. In scala, all constructor parameters are stored as class fields. Again, the xml field is made immutable so noone can change it.
I don't want to go much into the details of dataXml, only that it contains the xml of the API response. The error field is far more interesting:
Error(xml) produces something of a type Option which takes Error as the type of the generic. Generics are typed between square brackets in Scala, so it is like in Java.
The option type represents either Some(Object) or None. Both Some and None are of type Option, of course. So Option[Error] means, either there is Some(Error) or None.

Now to the result method:
As you can see, it returns an Either[T, Error]. Either can be used to represent a kind of type choice. Either the API request was successful and result returns the resulting object of type T or an error occured, in which case, we return an Error object. Either has two subtypes Left and Right, which represent the left, respective the right generic of Either.
The Option type is a bit similar to Either and conveniently has two functions toLeft and toRight. You can guess that they accordingly return a Left or Right. In the example above, toRight returns an Error if the value of the error field is Some(Error).
In the None case, it returns an object of type T.

Wait! What is xmlConverter?
The answer is: A function. Scala is not only object-oriented, but also functional. If we want to parse the xml to a result object of type T, this could become a bit tedious in Java, but not in Scala.
We simply can use a function as argument, which converts the result's xml into an shiny object.
The variable name for this function argument is xmlConverter. It takes, as mentioned before, a NodeSeq (a set of xml nodes) and returns something of type T. We don't need to take care how it does that, only that we can use it.
Long story short, xmlConverter(xml) takes some xml and returns an object of type T. The created object now is  a parameter for the toRight method of the Option[Error]. If there wasn't an error, our converted object is returned and else an error.
In Java, you would create an interface(say: Lots of different interface implementations) which you then can use as a function arument, but It's not nearly as powerful as functions as argument of other functions.
At first glance it seems like magic, but if you have tried some Haskell before, it's nothing unusual anymore.
So now we have a generic result-XML to resulting object method.

Back to the artist class:

    response.result(ArtistProfile.apply)

Here we can see that the function we use here is called apply and belongs to the ArtistProfile class. It should be said that in this case, apply is static and serves as a factory method. The factory pattern is very common in Scala.

Hopefully you have now learned how beautiful an innocent-looking piece of code can be and how powerful Scala as a functional, object-oriented language is. Comparing to Java, Scala is much less verbous: Optionan braces and semi-colons, forced indentation for beautiful code and so many more genious things which aren't available in Scala.
It should be said that you can use any of your old Java code within Scala, as it runs inside the Java Virtual Machine.

Saturday, September 17, 2011

Race conditions are the result of lazy coders

Today I got a ticket about a race condition my boss identified in a self-written java data class(Java's  GreogorianCalendar class is extremely slow and just crap). The problem is very subtle and hard to reproduce.

Take a look at the following sample Java snippet:

class DateTime {
  MyCache datetime = null;

  private void initDateTime() {
    // Creates a fresh MyCache object
    // and initializes datetime.colonTime to null
    datetime = new MyCache();
  }

  String getColonTime() {
    // datetime is some kind of 
    // lazy caching variable declared 
    // somewhere(does not matter)
    if (datetime == null) {
      //Uses lazy to initlialize variable, takes some time
      initDateTime(); 
  }

  // Colon time stores hh:mm as string
  if (datetime.colonTime == null) {
    StringBuilder sb = new StringBuilder();
    //Now do some steps to build the hh:mm string
    //...
    //set colon time
    datetime.colonTime = sb.toString();
  }
  return datetime.colonTime;
  }

  public static class MyCache() {
    String colonTime = null;
    public MyCache() {}
  }
}





The problem is that the getColonTime( ) method sometimes returns null although it always should return a time in the format hh:mm, like 17:49. Your first reaction sure is "No, it will always return something, because datetime.colonTime gets the value of the StringBuilder."
You're - of course - wrong, but it is very normal that you thing this way. The little devil is sitting in the details, waiting with his triton to peak you really hard.

Assume that we have two threads A and B who call getColonTime() at the same time (or nearly, if you only got one CPU). Threads are managed by something called a scheduler, who determines which thread has to pause and which one has to be run next. There are various scheduling algorithms, but most of them act like threads were having a party and the scheduler has to divide the CPU time cake. He does by serving each thread a piece of the cake while the other threads got to wait for their own slice.
So each thread has a defines period of time it is allowed to run before being paused again by the scheduler (e.g. it ate his piece of cake and now enqueues again to get a new one). Oh and our little devil is the boss of the scheduler ;)

Back to the problem:
What happens if two threads A and B call getColonTime() at the same time? First, A enters the first if block, because datetime is null.  As it happens, the scheduler decides to pause A before it can execute initDateTime(). Now B can run, it enters the method, jumps into the first if block and creates a new MyCache instance. Notice that, as the comment says, this also will set datetime.colonTime to null.
It then resumes and executes the contents of the second if block. It's a really widely used lazy pattern - initialize the variable's value when needed once and afterwards only return that value on subsequent calls.
So, B reaches the line datetime.colonTime = sb.toString() and our colon time member now got a value and continues to just before the return statement. Our evil scheduler now might think that this might be a good opportunity to pause A and resume  B.

Thread B now calls initDateTime() the second time. The result is, guess what, a new MyCache instance is being assigned to datetime. As our intention was to initialize datetime.colonTime lazy, the value of the latter is null again. So where's the problem? It will run through the second if block again, gets the value of the StringBuilder and everything is fine again, isn't it?
Surely not. Little devil has one of its really evil days and pauses thread A before it can execute the datetime.colonTime = sb.toString() command. As a result, datetime.colonTime is still null.
Again, thread A is resumed. There's only the return statement left, so the method will return the value of datetime.colonTime, namely null.

I took a lot of efforts to write a unit test which triggers this problem at least sometimes, lets say for one in a hundred calls, but I failed. The probability for this to occur is so low that the result was null only in 5 or 6 in total of all test runs. Each test runs that method about 200 000 times using multiple threads and I did a lot of test runs....

So whats next?
I will have to make sure that I can write a reasonable test which provokes these errors. While browsing the internet, I stumbled upon a really young project called thread weaver which looks really promising Maybe I'll give it a shot on monday.

Saturday, August 20, 2011

Lifting Combo.fm to a new level with Scala

It's project week at my company! So every employee can spend one week on whatever he likes to, as long as it has benefits for the company.

I will spend this week trying to learn ScaLa. This would of course be really boring if I wouln't have a project at my hands that will be the result of this.
So I came up with Combo.fm. It is currently written in PHP, Smarty, some MySQLi and JavaScript. Especially PHP and partly Smarty can be a bit painful and aren't really contributing to the fun I normally have while programming.

The goal of the project is to evaluate IDE/Tomcat integration with Scala, getting to know the language and to try the LIFT-Framework. I am looking forward to a great programming experience and a lot of fun, fun and again - fun.
Combo.fm will be rewritten from scratch using the existing HTML and JavaScript code and hopefully extended by some features I wanted to have long ago, like authentication and a lot of other awesomeness.
Of course, the results will be published as open source code on a newly created git repository.

I will report about the next steps soon!

Monday, May 02, 2011

Twitter share button with changeable url and no external widgets.js

Yesterday I wanted to add a "share on Twitter" button to the Combo.fm homepage, so users can share their created combo stations via Twitter, The normal button available by Twitter did not work as I wanted it to, it initializes the Button on page load. If you want to change the url afterwards, nothing happens and even the iframe solution did not work. Shame on you, Twitter!

So I created a custom solution which basically can do the same, but without the counter. Best thing is, it does not depend on the widgets.js so the page doesn't take ages to load.

I basically used the link solution for the tweet button. So assume we want to share an url mydynamicurl.com/mysubpage, but use example.com as the count url(in case twitter or I get this fixed).
The example.com/mydynamicsubpageurl is created within the website dynamically, depending on the users input and you are in no way able to put it as your current url.

Put the following code somewhere in your section:

<script type="text/javascript">
function shareOnTwitter(url) {
popupWindow = window.open(url,'popUpWindow','height=300,width=500,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes');
</script>

This function is responsible for creating a popup window where you can tweet the shared url.

For the share button use the following:

<a id="shareOnTwitter" title="Tweet example.com!" href="http://twitter.com/share?url=%%shareUrl%%&counturl=http://example.com&text=Check%20outthis%20awesome%20dynamic%20page&via=mytwitteruser" onclick="shareOnTwitter(this.href);return false;"><img alt="Tweet this!" src="http://twitter-badges.s3.amazonaws.com/t_small-a.png"></a>

The parameters are explained in the tweet button documentation linked above. If the user clicks the link, the shareOnTwitter function will be called with the link's href attribute, which will open a nice popup window that uses Twitters intent page for tweeting.
See that I use a placeholder %%shareUrl%% in the url. We will use jQuery and the JavaScript replace function to insert the actual url:
function setTwitterShareUrl(url) {
$('#shareOnTwitter').attr('href', $('#shareOnTwitter').attr('href').replace(/%%shareUrl%%/,url));
}


If you want to change the url more than one time, you might want to use the link in a template element and call the replace() function simply on the html. Then replace the old share link attribute with the new one.

Saturday, March 19, 2011

burny|net - My own personal website

The last days I spent parts of the spare time I should have spent learning maths into creating a new personal homepage, including a German blog!
You can reach it at http//www.burnynet.de/.
Don't be afraid, I will continue blogging here, too. But my mother tongue just leaves me more freedom to express what I think. A blog is like a public diary, so in consequence it is mainly for my personal record - but too for entertaining you of course :)
burny|net is not German only. I created this page mainly for the purpose to have a central place which bundles all my projects and virtual identities into one website. Plus, as you aready might have seen, Combo.fm has its home there, too :)

I hope at least my dear german readers will visit my homepage from time to time - it is work in progress and an RSS feed will come, of course, but really worth visiting. Just check out my newest blog entry there, I guess you will have a lot to laugh (even those who use Google Translate ;) ).

Tuesday, March 15, 2011

Combo.fm improves your listening experience on last.fm

History
Nearly a year ago I wrote about the radio query language and wrote a Java application called Combo.fm as a proof of concept.
Naturally, at least as far as I'm concerned, proof of concept projects are not maintained very well and buggy and the Java application was no exception. It just had some major backdraws regarding usablitly, portability and layout which made it a no-fun project.

So about two weeks ago I got the idea to re-write the whole thing from scratch using pure HTML, CSS 3, and JavasScript. I did some investigations and as I am a curious guy I tried some new stuff like jQuery, Felix Brun's Javascript Last.fm API and the 960 grid system. They are both awesome in and of themselves, but in combination they can create a quite nice look and feel.
The result was overwhelming and the project drastically improved my Javascript and CSS knowledge. No wonder Google lets their employees spend 20% of their working time on own projects - at this point they are doing something right.

The new Combo.fm
Enough talking, just see yourself:


I added last.fm's new mix radio and also the friends radio. Using cutting edge HTML 5, Combo.fm should work with all major browsers like Google Chrome, Mozialla Firefox and reqkonq.
As I am a person with lots of ideas, the current version is, lets say: A tiny step for me, but a huge one for the last.fm community. And now replace "step" with "beer" ;)

Its current features include:

  • Listen to similar artists, tags, your library, mix radio, recommendations, neighbours and the friends radio
  • Combine stations as you like by connecting them with and, or and not
  • Mainstream-ness: Set how much mainstream your music should be
  • Set song repetition rate on a per-hour basis
  • Enable or disable discovery mode
Planned:
- Sharing stations over social networks like Twitter and (maybe) Facebook
- Shout your station urls - directly from Combo.fm
- Far in the future: Last.fm player on Combo.fm which displays Combo.fm station's name properly#

Notice: Combined radio stations are still in beta stage. There might be bugs and trouble and I personally ask not to abuse it. Thank you :)

This project needs your support!

Currently the problem is that especially the new Combo.fm is largely unknown. So:
Link it! Tweet it! Like it! Share it! Put in your forums signature! Join the project! 
Spread the word! 
The Last.fm messias has arrived and it has great news to say: You can combine Last.fm's radio stations, in any order and as many as you like!

Special Thanks
To the Last.fm guys. You are doing good and reasonable work! Go on with that!
To all the last.fm moderators who tested Combo.fm and reported bugs.
Skiye for the discussions, chats and testing until the late morning.

Thank you
for using Combo.fm! It means very much to me :)

Tobias Brennecke
The creator of Combo.fm

P.S.: Can I have spam, bacon eggs and spam, but without the spam in it?

Friday, March 11, 2011

KDE: Creating a RocketDock style quick launch bar

Since a few days I've been looking for a KDE replacement of RocketDock, which is basically a quicklaunch bar at the top of the screen.
Today I came up with a nice solution, which isnt a perfect replacement, but enough for what I wanted:

Saturday, March 05, 2011

A Spammer who won a prize and two new CD's

As always, it's been a long time since my last post. I didn't pass the test in higher mathmatics, so I have to learn a lot, plus the usual stuff I have to do for working.
I promise to continue the Ireland series and also will report you the new and noteworthy things from the FOSDEM 2011 in Brussels, where I've been with Nik.

This morning I woke up. Pling! New mail on my cell phone. It was a PM notification mail from Last.fm. You might know I'm one of the moderators there. It was something like
Maybe this is your golden chance! Just one click to win a prize! Give it a try
- it is free but if you have some luck... :)
Dear Spammer!
Thanks for being so stupid, that really made my day :D I mean, which intelligent human being either codes a bot who sends spam to mods or, if sending the message manually, checks that I'm not a bot.
Please, next time use a big red "PLEASE BAN ME" sign as avatar and the same text as profile name.
Thanks :D

Other news....I bought two new CD's, namely

I really love them both although one Euro per track is really an exception I made, because I love "Riders On The Storm" :)
And yes, I still buy CDs! I love it to put them into my CD player and read the inlet while the music is playing and most times the inlet contains lyrics, too, so you can sing the track which is playing currently. Plus you never can get a better audio quality than from CD.

Saturday, February 12, 2011

Ireland day 3: The wonderful barn

The third day I didn't do anything special, I was just soo happy to see Isy again <3
Yesterday's bus trip to Leixlip was nearly painless except the bus had to wait for a traffic accident to be cleaned up. Isy and me had a lot of things to talk about and time passed by too fast! Nina, Zoe and the rest of the family were so friendly and lovely as all the other poeple in Ireland, which is maybe a bit unusal for german poeple, but I was happy :D

When she sent me her letter weeks before, I googled her address and saw a strange building called "The Wonderful Barn" just a footstep away.
So now I liked to see it and went there with her and little Tadgh. He looked really sweet in his buggy and was very happy about the walk for fresh air and a shiny blue sky.
So here it is, the Wonderful Barn:

Friday, February 11, 2011

Ireland day 2: Dublin Bay

So here is a new episode about my trip to Ireland last autumn (how time can fly by...).
Dublin isn't that far away from the Irish Sea, it's got a large area of docks and that stuff. You could see the cranes and some red-white chimneys in the far distance and it was clear to me that I wanted to go there.
On my trip, which partly was a long walk down the liffey, I took of course some nice photos which I want to show you. If you like the photos, take a look at my Picasa web album at https://picasaweb.google.com/t.burny/IrelandDay2DublinBay#. All picutures have a Creative Commons cc-by-nc-sa 3.0 license :) If you want to have them in full 12 megapixels, just contact me.

Breakfast started with a really funny and interesting article in a news paper lying around at the hostel:

Tuesday, February 01, 2011

KDE 4.6 is out and I love it!

Today I discovered KDE has released version 4.6 of their desktop Suite.
It is really awesome and much faster, although I still have to explore the details a bit further (never used e.g. "Activities"). I was surprised by the really cool login screen, then by the faceted search feature of dolphin, etc....
Desktop and Dolphin

I came to that point when I booted kubuntu on my desktop pc to upgrade it to Kubuntu 10.10 Maverick. When I clicked on the wifi icon, something totally different than on my laptop showed up. Have to admit I have been using Windows 7 on it for a while, but I was astonished how fast Kubuntu (still with old KDE) was. I thought that I might have missed something during the various dist-upgrades on my laptop and stumbled upon the great news. I first updated on my laptop(just add ppa:kubuntu-ppa/backports to your software sources via KPackageKit), which didn't make any effect on that network-manager tray icon, the old one was still there.

Thursday, January 20, 2011

T42p: Making AccessIbm Button launch an application

Under Kubuntu, the "Access IBM" button has no function. I just decided to change that, luckily it's like a key on the normal keyboard so we can assign an action to it.
In my example this will be konsole, the KDE terminal. You can't ever get enough of them ^^
Follow these simple steps:

  • Open KDE system settings dialog
  • Click 'keyboard shortcuts and gesture control'
  • Now "My Shortcuts" on the left should be highlighted. At the bottom center of the dialog, click "Edit", then "New->Global Shortcut->Command/Address"
  • Give the Action a name, e.g. "AccessIbm Button"
  • Go to the "trigger" tab, click on the button and press the "Access IBM" key. If the caption changed, you can succeed, else retry
  • Go to the action tab and type /usr/bin/konsole into the text field
  • Click "Apply"
Now you're done! Press the "Access IBM" key to test it and have fun ;)
From what I've seen you also can assign dbus signals, keystrokes(keyboard macro functions!) , etc. just play around with it a bit.

Ireland day 1: Dublin (part 3) - Dublin at Night

In this post, I will mostly let pictures talk and maybe say only a few words on single ones. Most of them are bridges, which are illuminated by green light from below.Looks really beautiful, doesn't it?

Custom House at Night

Millenium Bridge

Wednesday, January 19, 2011

Ireland day 1: Dublin (part 2)

So, finally I got some spare time to write the rest of the Ireland series and the photos are all uploaded now, too.
The Historical Walking Tour started at the front of Trinity College. After walking through the front gates we had a look at the wonderful courtyard and the

A part of the Trinity College courtyard*

He told us some interesting stuff about the college's history, but I can't remember anymore, too bad!
Here is some nice photo of the Library Square:

Libary Square*

Trinity College had a lot of famous students, like Oscar Wilde, and also is - from what I understood - much involved in the Irish history and the history of dublin. For more details, have a look at Wikipedia.
Walking back to the front gate, you can find the Irish Houses of Parliament, which now inherits the Bank of Ireland.

Wednesday, September 29, 2010

Ireland day 1: Dublin (part 1)

So here I am now, in Dublin.
Flight was relatively relaxed, only few turbolences. I was a bit nervous before departure that I have forgotten something important so I would be taken off the plane in the last minutes, but everything went fine.
Isa recommended the three days ticket by DublinBus, the local public transport company, because I'll move to her tomorrow. I had some issues with the ticket's RFID chip, it was damaged so it could not be read. Luckily the bus from the airport(line 747) has its first stop at O'Connell Street, directly on the opposite side of Dublinbus headquarters and exchange was quite easily.
You have the possibility to get a "Freedom of Dublin" ticket for 24 € for adults and 13 or 14 euros for Students. With that ticket you can go on the dublinbus sightseeing and normal bus lines and drop off at any place you like. However, all desired places can also be reached by foot easily, so in my eyes you should think about it twice. As the ticket is valid for 3 days like mine (I paid 13.50 €  without the sightseeing feature) it is only worth if you either want sightseeing by bus or go to the outer regions.
After arrival I went to "The Times Hostel", which is a footstep away from Trinity College. On my way there I passed the O'Connel Bridge, which is wider than it is large.

Monday, September 27, 2010

Holidays in Ireland

Readings free time at University Dortmund is nearly over, it ends on 10th of October, but I still had to take some of the holidays from work, so I decided to spend part of the time into a one-week-trip to Dublin and Leixlip, a small town in County Kildare, Ireland.

Let me mention I never made such a trip before. Of course I've been traveling by plane a few times, but always with friends or family. Now I'm flying alone the first time, to a country I rarely know except from the news or wikipedia. I'm not scared, in contrary! I'm exptremly curious what I will experience and a bit nervous, to be honest.
So, I'll take the plane from Frankfurt Hahn Airport here in Germany to Dublin at 29th September and come back on 5th October. I'll stay one day at a hostel somewhere there,for approx. 15-20 € a night. I only once slept in a hostel before (in Munich) and I guess this will be interesting ;)

From Thursday on Isa, an Au-pair and good friend which I know from my old school, invited me to spend the rest of the days at her. She is a really kind, funny and lovely person(you know, that kind you can phone with five or more hours at a time and never get enough) so I'm very happy that we will finally meet again after 2.5 years :)


I don't really know what exactly will expect me either in Dublin or in Leixlip at Isa, so I'm very curious about all this holiday thing.
From what I guess Isa and me will have a lot of fun, because we have a lot of things in common, so I am very glad we have contact again since a few weeks.
We will see :)

Well a few things I know fore sure: In Leixlip it will be about 10-15°C outside temperature, with wind and rain, Guinness beer(I can't get enough of this wonderful stuff!) and the mysteries of different kinds of whiskey which will reqire some personal research, including an intensive case study...

Hopefully I get the opportunity to post some pictures and experiences omy f trip in here, so hang on!

Cheers,
Tobi

Friday, September 03, 2010

Going AdSense-free

Hello everybody,
some of the best ideas you can get by just cycling.
So while cycling home, I thought about my blog, what to write and about the adverts, too.
When I started blogging, I thought it would be a good idea if people can show they like my blog by clicking one of the adverts. The point is, this did (expectedly) not work out for me and to be honest, I like your personal feedback more than any money.
Plus, I discovered AdSense and Google Friend Connect lets the page load in about 6 seconds and I hate nothing more than slow web pages.
So, to protect your privacy and improving your reading experience I removed all adverts from the page. Now it takes 3 seconds with Firefox and 0.5 with Chromium.
If you love my blog, just feel free to leave me a message or comment, you'd make me very happy by doing so. Nevertheless if you think you cannot be thankful enough, just feel free to have a look at my whishlist on Amazon :)

Hopefully you are now able to really enjoy reading this blog, plus I have a little candy for you: You will not have to wait much longer for the next post, only a couple of days maybe!
So just have a visit here from time to time or directly grab the RSS feed from the right column :)

Thursday, September 02, 2010

Upgrading to KDE SC 4.5

Recently KDE SC 4.5 came out and as I always try live on the cutting edge of software, I tried to update it which first ran me into the fact KPackageKit wouldn't update half of the whole KDE.
I found out by some googling(shame this became a verb! Forestling should become one...) that the reason is that the kubuntu-ppa might contain older packages than kubuntu backports, so the solution was to just disable all source which were no kubuntu archives.
For upgrading just add
deb http://ppa.launchpad.net/kubuntu-ppa/backports/ubuntu lucid main
deb-src http://ppa.launchpad.net/kubuntu-ppa/backports/ubuntu lucid main

into /etc/apt/sources.list.d/kubuntu-backports-ppa using your favourite editor or KPackageKit and run sudo update apt-get update (KPackageKit does that for you automatically).

If you are lucky you just have to run
sudo apt-get update
sudo apt-get dist-upgrade

If this does not work for you, just try alternating those two, eventually with the -f parameter until everything is installed and then reboot.

I discovered today that the ibus package wasn't installed, too so I installed it and run ibus-setup. We will see what that brings :)
KDE SC 4.5 runs a bit smoother, but sometimes it consumes peaks of 20% of the 1.8 GHz CPU of my T42p (which is still a good laptop :) ).
Have fun!

Thursday, July 01, 2010

On a short word: Printing using an LPT port over network

Recently I damaged the JetDirect card of my HP LaserJet 4050, because I accidentally drawed the network cable in the wrong direction, so the plastic cap an the card holding the cap broke off.
As a new card costs about 20-30 Euro, which I as a poor student simply do not have, I had to solve the problem otherwise. I discovered that my desktop computer doesn't have a LPT port anymore, but the laptop does. So I alwas printed using that laptop.
Now I thought, why don't access the printer via network, as the laptop is running all the time? So, to do it as easy as possible I simply installed samba, uncommented some lines in /etc/samba/smb.conf, hacked some 'restart smbd' in the terminal (the Samba start script was switched to upstart) and just selected the now shared printer on my desktop pc (which runs on Win 7 again -.-).
Plus now I can easily exchange files between laptop and desktop pc. Horray!

Sunday, June 06, 2010

Upgrading the T42p to Ubuntu Lucid Lynx (10.04 LTS)

A week or so ago I upgraded my IBM ThinkPad T42p(which is a very good laptop for a (now) very fair price of ~400 Euro on ebay) to Ubuntu Lucid.
Upgrade ran quite easily although the upgrade application had some visual bugs, but everything harmless. I hadn't enough space left on the first try, so it was time to delete some "garbage" applications (a good moment to do so :)). A big minus was that you cannot leave the installation unattended because sometimes windows pop up asking regarding this or that package. Okay in a way this makes sense, but why isn't the installations first simulated? The user could be asked for decisions which are then remembered to go through the upgrade process silently...

Well, after everything was done, I rebooted. I counted from splash screen on and didn't came to 10 until the login screen showed up.

First thing I discovered was that the backlight was dark and if setting to maximum via function keys, it went dark again after a while. Luckily I'm not the only one with this issue. Found a temporary fix on some ubuntu forum and everything is fine again now :) I also removed the PPA version of Firefox and Thunderbird to install the stable ones(much better regarding Firefox - I once had to use Opera for 3 weeks!) and everything is running fine again :)
I even discovered that Rhythmbox is a very good and nice replacement for Wine + Foobar 2000 (which runs nicely but has no "from system to playlist" file drag & drop). One thing it lacks of is silence skipping.
In foobar there is a plugin where pieces of a track are skipped if they are below a volume level (e.g. -48 dB) for a certian time, which is really useful for tinier DJ-ing. You can put a 10 seconds crossfade and a 3 Second silence detection for below said -48 dB and foobar could become a good replacement of a hundred bucks audio software for smaller parties.

Next thing to do is to extend the home partition on LVM, it is running out of space with no chance to save some any more....