Tuesday, 4 December 2012

Pidgin pounces and viewing files in Linux command line

Couple of quick hints:

I was getting a bit annoyed with all the Pidgin pounces (popups telling me someone has logged in). I tried to remove them by selecting the buddy from the contacts list, "Add buddy pounce" and removing the selections but this did exactly nothing.

The way to remove this is not quite as obvious: Select Tools -> Plugins. Select libnotify in the list and click "Configure plugin". There you can deselect "Buddy signs on" and "Buddy signs off".

An even simplier trick that has helped me with using the command line: I usually search for files, even PDF's and the like with command line tools (find etc) since it's the fastest way. But what to do when you find what you are looking for? Open the directory with Nautilus? Tedious. I added the following to .bashrc:

alias v='xdg-open $1'

After this I can open any file with "v " provided file type has a default application.

Tuesday, 6 November 2012

Gnome tweaking

Default Gnome with Code Composer Studio (Texas Instruments' IDE based on Eclipse) has an annoying issue: tooltips are black text on black background. This obviously isn't very nice. The way to fix this is to install gnome-color-chooser and set the tooltip background color from there. Took me ages to figure out that this can't be set inside CCS.

Initially I set this to quite a bright color but Chrome OTOH uses a very light color as the font color, so that wasn't very good either. I have now settled for #C6C636 which works nicely both ways.

I also played around a bit with themes and found that Adwaite Cupertino SL as Window Theme and GTK+ theme and Ubuntu-mono-dark icon theme works best for me. These are installed by unzipping the packages to ~/.themes and selected using gnome-tweak-tool.

Friday, 26 October 2012

Thunderbird oddity

I had a minor but really annoying issue with Thunderbird: every time I opened a message, it would search for the first occurence of "no" and select that. This meant that if that "no" was in the middle of the message I needed to scroll to top of message.

In the end the reason was simple enough, I had a quick filter set at some point (Ctrl-F), but I can't think of any other application that works quite this way (remembers the setting & applies it automatically).

Monday, 15 October 2012

Rendering issues with Google Chrome on Linux

This was driving me nuts. Things worked on a Windows box, but in Linux Google Chrome had lots of problems rendering web pages. Main issue were CSS layers which were partially transparent or otherwise incorrectly shown but I also had issues with showing the text I typed into some text boxes. I also had other random issues which I think had to do with AJAX, e.g. on RYM I could not add ratings because clicking the stars wouldn't show anything (well, I could do it blind). There were plenty of pages with these issues, some pages were all but rendered useless.

Finally I found a reason and a solution: the GPU accelarated renderer seems to be very buggy. You can disable this by --disable-accelerated-compositing to the command line parameters, and at least so far everything seems to work well!

Sunday, 2 September 2012

md0: RAID array degraded

That's what I was seeing when I had problems with my Linux server with RAID5. This caused a failure to boot about two times out of three.Now it seems I found the solution. Let's see after I do a few more reboots but so far so good. I also got serial console working, including Grub with these instructions.

So maybe I can finally move that server back to the closet...

Monday, 27 August 2012

Marvel vs. Intel SATAIII

I had an interesting result when I moved my Samsung 830 256GB SSD drive from a Marvel SATAIII to Intel SATAIII port on my AsRock P67 Extreme4 mobo.

I originally had to put that and both my SSD's on the Marvel because Agility wouldn't be recognized by the BIOS otherwise. I just updated the firmware on the Agility to the latest one and this fixed the issue.

I was told that the Intel ports are much faster but it didn't look like it when comparing the results for the Agility (Marvel result on top):

So some results even dropped. But when comparing the Samsung results, whooppedoo!

That's one massive improvement there! This also shows what compression does, Agility compresses the data so CrystalDiskMark test gives a lot worse result for it than for Samsung. And just to make sure: 830 already had the latest firmware during the first test.

Wednesday, 4 July 2012

Ubuntu 12.04 LTS

I did a clean install for Ubuntu 12.04 on my work machine and first impressions are not good. I keep getting internal errors for various stuff every five minutes or so. Plus Canonical really decided to make your life miserable. For instance it used to be easy to set system proxy settings. Obviously too easy, because now you have to install dconf-tools and use that. Alt+tab doesn't work either (and Canonical thinks it's not a bug) so you have to install Compiz settings manager (ccsm) and turn Application Switcher on (I found Static Application Switcher works better). 

And this only after about two hours, barely time to install a few things. Canonical really seems to want people to switch over to Mint, don't they?

BTW, which idiot at Google decided I don't need to set an ignore list for the proxy? There is no such setting in the proxy settings page any more, at least for Ubuntu 64-bit version.

Friday, 1 June 2012

Being too clever in Git and then some

Everybody already knows about commit squashing in Git. What's less known is the new --autosquash feature in Git 1.7. There is a nice article about this in Technosorcery. What I do wonder about this is the whole point of "squash" because you need to have exactly the same comment (or start of) as the one you want to squash into.

So the difference between squash and fixup is that the latter doesn't add the same commit message twice, so why would I want to use squash? It would make sense if it could have some other message, now you probably just delete the message?

Well, so I was doing some squashing in a repository when I managed to mess things up. It was early in the morning, mind.. what I did was to squash commits to a commit I had already published, and this is obviously a big no-no.

Thankfully for me, in Git you can fix your mistakes.

$:~/src/dsp_prod$ git reflog
73ded3c HEAD@{0}: ORIG_HEAD: updating HEAD
1813552 HEAD@{1}: commit: My really important commit I have already published!
9e63b6e HEAD@{2}: rebase -i (fixup): updating HEAD
73ded3c HEAD@{3}: commit: # This is a combination of 3 commits.
9e63b6e HEAD@{4}: rebase -i (fixup): updating HEAD
6d1b4bb HEAD@{5}: commit: # This is a combination of 2 commits.
9e63b6e HEAD@{6}: rebase -i (fixup): updating HEAD
46d9505 HEAD@{7}: checkout: moving from master to 46d9505
5159b02 HEAD@{8}: checkout: moving from master to 5159b02
5159b02 HEAD@{9}: checkout: moving from master to 5159b02
5159b02 HEAD@{10}: checkout: moving from master to 5159b02
5159b02 HEAD@{11}: checkout: moving from master to 5159b0255aec18330384a1a115058560a6a4574a
5159b02 HEAD@{12}: commit: fixup! Fixed compilation issue.
20f23cb HEAD@{13}: commit: fixup! Merged with stash.
8916f61 HEAD@{14}: commit: fixup! Some fixes.
$:~/src/dsp_prod$ git reset --hard HEAD@{12}
HEAD is now at 5159b02 fixup! Fixed compilation issue.

Yeah, I hadn't quite figured out how to use fixup at that point either. Resetting to ORIG_HEAD didn't help, but using a combination of reflog & reset --hard did the trick and my commit history was back to what it was before my mistake.

Btw, if you want to see the reflogs but want a nicer output (which lacks some of the stuff) you can also say "git log -g".

Thursday, 12 April 2012

Miscellaneous Linux tips

I have found out plenty of small but useful Linux related stuff lately.

How to visualize your disk usage:
KDirStat, Filelight - for KDE,
Baobab, gdmap - for Gnome,
Philelight - Web-based.
JDiskReport - Java-based.

Some of those are in the Ubuntu repositories (and maybe other distributions).

How to setup Office Communicator in Pidgin:

  1. sudo aptitude install pidgin-sipe (assuming pidgin is already installed).
  2. Add a new account of type Office Communicator.
  3. Use email address as username and whatever login your domain requires (mine worked with the email address).
  4. Enter password.

And that's it. Works like a charm.

How to setup Facebook chat in Pidgin:

  1. sudo aptitude install pidgin-facebookchat (assuming pidgin is already installed).
  2. Add new account of type XMPP.
  3. Make sure you have your facebook account's username set. Use this as the username (surprise, surprise).
  4. Domain is "chat.facebook.com".
  5. Enter password.

And that's it!

Friday, 23 March 2012

Eclipse shortcuts

There are some ridiculously useful Eclipse shortcuts that I only recently learned. With editors I tend to be on the side of not bothering to learn one too thoroughly because I soon end up using something else anyways. For the past year or so I have almost exclusively used Eclipse so I guess I'm getting stuck with it. Even Code Composer Studio, which is my main editor at work nowadays, is based on Eclipse these days.

So I stumbled upon some shortcuts recently and ended up going through the full list of defined ones. I even made a cheat sheet and taped it on the bottom of my screen. Here's a few examples:

Alt + up or down: History. You can easily jump between points you have been to with this.
Ctrl+Q: Last edit. Moves you to the place where you last made edits.
Ctrl+Shift+up or down: Go to next or previous member. Really neat way of going through the functions.
Shift+Alt+up: Select enclosing element. Quick way to select blocks of code.
Ctrl+/: Comment and uncomment selection.
Ctrl+I: Correct indentation. Very, very handy when you move code around or copy-paste it from somewhere else.
Ctrl+J: Incremental search.
Ctrl+1: Quick fix. When Eclipse detects there is an issue on a line you go to that line and press this and Eclipse will suggest how to fix it.
Ctrl+Shift+N: Add include. You have a missing include? If Eclipse knows where it is, it will automatically add it with this shortcut. No more searching for the correct header!
Ctrl+=: Explore macro expansion. Shows the statement with macro definitions "opened".
Alt+up or down: Move selection up or down. More convenient than ctrl+x && ctrl+v.

And last but not least:
Ctrl+Shift+L: Show shortcuts.

I'm still to try Ctrl+Shift+F which formats selected code because it needs some setting up. But I already like the idea...

Monday, 27 February 2012

Order of Evaluation in C and the Tertiary Operator

I got an interesting issue with Coverity Static Analysis. There is code that looks like

foo = (foo == bar ? foo : ++foo)

CSA complained that there is an order evaluation violation. First I thought this was due to the fact that foo is in fact a class variable so the pre-increment would actually look like ++this->foo, but this is not a problem because the -> operator is evaluated before the pre-increment.

On discussion with Coverity they think that when the false branch holds true this would evaluate to

foo = foo = foo +1

But I think this is not true because the tertiary operator is a sequence point. More precisely the ? is. I think this might be due to the fact that K&R wanted the tertiary operator to work exactly like an if-then-else expression. Thus the correct way of looking at the expression would be to think of it as this:

if (foo == bar)
  foo = foo; 

Stupid code (not mine!) but there is no bug.

The key to this is to understand that the tertiary operator has a sequence point unlike the assignment operator!

Tuesday, 10 January 2012

Editing components and charts in Coverity Integrity Control

This wasn't the most clear-cut thing to do. Maybe this is explained in the CIC training which I skipped?

Anyways, it's relatively easy to edit the component map and charts in CIC. The instructions in the INSTALL.txt are a bit misleading, though. If you run the ImportCategories command again, you will get duplicate charts and there is no apparent way of getting rid of them.

The correct (?) way is to copy the files with the desired component map and charts from the CIC installation directory to CIM config directory and name them nodes.xml and categories.xml, respectively.

Then go to CIC config window, XML upload and load the file that has the changes. This will clear any existing data and apply the changes. This will not touch the actual data in any way.

Monday, 9 January 2012

Coverity SA Control

I have been running Coverity SA on a number of SW components and remembering the parameters was getting to be a bit of a drag. I had them documented in a Word document but opening that up every time was also getting annoying, so I wrote a script to handle this. This script allows you to add the components to a configuration script rather than on the command line and also helps unattended analysis (i.e. during nightly builds).

The script has a few key features:

  • Completely configurable targets (no need to change the script),
  • Configuration file can be defined on command-line or you can use the default,
  • Can read login information from .smbpasswd file for unattended execution,
  • Can select phase (build, analyze, commit) or run all three at one go (I would suggest to add a check for successful build, though).

The configuration file should have the following common settings:
# General settings

And for each build target also the following:

# Target is called "TARGET" (this would be the value of the -b parameter). If no prebuild is required, leave these empty