Add another admin user in ubuntu

Posted November 28, 2009 by titan2x
Categories: Hacks

In Ubuntu the first user you create will have special privileges. The way this works is the first user is automatically added to a number of system groups. (For the curious, these are: adm dialout cdrom plugdev lpadmin admin sambashare)

If you want another user (for example your wife) to have equal privileges, this one-liner does it:

for i in $(grep :user1 /etc/group | cut -f1 -d:); do sudo adduser user2 $i; done

Replace ‘user1′ and ‘user2′ appropriately. If you don’t want to give all the same powers to your otherwise lovely companion, you can exclude some groups like this:

for i in $(grep :user1 /etc/group | cut -f1 -d: | grep -v adm); do sudo adduser user2 $i; done

Chrome Fullscreen

Posted November 24, 2009 by titan2x
Categories: Musings, Software

An insightful post on Slashdot about Chrome OS and the fragmented product lines google is creating recently:

http://tech.slashdot.org/comments.pl?sid=1454298&cid=30208494

A more appropriate name for [Chrome OS] is “Chrome Fullscreen”.

An even more appropriate name for it is “Chrome’s Google-Confusion-Fest”. Because Google is starting to bewilder me with parallel, seemingly conflicting options!

1) There’s Chromium O/S, which is pretty much just a Linux distro with a browser.

2) There’s Android O/S, which is pretty much just a Linux distro with a browser, that’s incompatible with Chromium.

3) There’s Google Gears, which is pretty cool, but doesn’t work with Chromium O/S, or Chrome the browser.

4) There’s Chrome itself, whicch is just a browser, without a distro of any kind, and paradoxically, doesn’t work on Linux.

In short, while Google has been lobbing all this juicy-looking stuff out onto the marketplace, it’s been set up in such a way as the boxes are likely to fall on anxious developers.

This looks to me more like a minefield than a fruited plain!

Come on, Google! If you want me, a developer, to “jump on board” with your stuff, you’d better get it all talking to each other, because your deeply fragmented product lines are causing me to shun your products.

Making CapsLock an additional Ctrl in KDE4

Posted November 17, 2009 by titan2x
Categories: Uncategorized

I had a hard time finding this option in KDE4.

It’s in System Settings / Regional & Language

It would have been more intuitive in Keyboard & Mouse

mpg123 on Fedora11

Posted November 1, 2009 by titan2x
Categories: Hacks, Musings

I needed mpg123 to burn an audio CD with cdrecord on my Fedora 11 system at home. Since it’s not in Fedora’s standard repos, googled for it, and found this.

http://www.atrpms.net/dist/f11/mpg123/

So far so good, I just needed a few more libraries as dependencies, however, the package names were not really intuitive.

  • libartsc – arts
  • libaudio – nas-libs
  • libportaudio – portaudio

It was mere luck that first I looked for libportaudio, and tried simply “portaudio” for little logical reason. Following the same package naming logic I could find “arts”. Finally found “nas-libs” with google.

Remedy to my ASUS Eee PC 1000 issue

Posted October 3, 2009 by titan2x
Categories: Hacks, Musings

I have a major problem with the title netbook from the day I bought it. After roughly 6-8 hours overall running time, it freezes at some point randomly, with nothing interesting in /var/log/messages or anywhere else. It runs Easy Peasy btw.

I stumbled upon a remedy by chance. If I turn off wireless networking when I’m not connected, it doesn’t seem to freeze. Although it’s a little bit annoying to switch wireless on and off when I work in different places, it’s far better than the frequent freezes. I wonder what is the underlying problem, but it’s not really worth the time and effort to properly debug it.

Ternary operator in Python

Posted August 27, 2009 by titan2x
Categories: Hacks

There is NO ternary operator in python but here’s something similar that is COOL:

val = (‘val1′, ‘val2′)[x < y]

… as an imitation of …

val = x < y ? 'val2' : 'val1'

Lighttpd in Fedora

Posted July 6, 2009 by titan2x
Categories: Hacks, Musings

Installed lighttpd and then went on to configure the userdir module so that localhost/~myuser works. But it didn’t. There is only one config file, /etc/lighttpd/lighttpd.conf and I searched through all options with "user" in them but nothing. Finally I looked at the settings on my Ubuntu box, and found the missing piece:

userdir.path = “public_html”

Japanese input method in Fedora 11

Posted June 28, 2009 by titan2x
Categories: Hacks, Software

It’s great that these things keep getting easier. I used to have to tweak .gnomerc and .uim files and running uim-xim at startup… Probably that’s a thing of the past. Here’s how you do it the modern way.

yum install scim-lang-japanese

Next, go to System | Preferences | Input Method. This brings up the IM Chooser dialog. I selected IBus because it was marked recommended. Then in Input Method Preferences, and choose the Input Methods tab and select the input methods you want. That’s it! You can swith to Japanese input with Ctrl – Space.

Installing Fedora 11

Posted June 27, 2009 by titan2x
Categories: Musings, Software

My hard disk started showing signs of slow and painful death, so after I backed up all my data I confirmed with smartctl that yes, it’s dying.

smartctl -t long /dev/sda
smartctl -a /dev/sda

This looked like a good opportunity to try something new, at least Kubuntu instead of Ubuntu. So I went for the much celebrated Fedora 11.

The live CD

My half-broken hard disk was still in the computer when I started the Live CD and Fedora scored some plus point for showing a warning about the disk, and a very cool GUI for the smartctl self tests.

Next I replaced the hard disk with two new ones, and started the Live CD again and wanted to use the fancy GUI for smartctl. I looked through the menus, the Gnome applets but couldn’t find it. Wonder where it is, it’s a shame to hide this superb tool in a dusty corner. So I did the smartctl the old way. (By now I know where it is: Applications / System Tools / Palimpsest Disk Utility.)

Then I had some MAJOR problems with the disk partitioner. I have two disk of the same sizes and I used to have them in a software RAID1, but that’s not what I intended for this time. The installer’s partitioner oddly showed me only one disk, and with an odd name. It looked like some kind of mirroring setup, so I checked /proc/mdstat and lvs but I couldn’t find anything. For hours I didn’t know what hit me, when finally I figured out it’s dmraid.

dmraid

I was very disappointed by this dmraid thing. Why does the installer try to be so damn smart and do something I don’t want without asking me? And then why is it so damn hard to turn it off? I passed nodmraid kernel param to the installer as suggested by google sensei, but no dice. Finally I managed to turn the bloody thing off with:

  1. Rest both partition tables
  2. Start the installer, and if you’re lucky it will ask you to reinitialize the partitions, go for it and exit the installer
  3. Run dmraid -an and dmraid -x, or something like that, I don’t remember exactly
  4. Just to be safe, I created my partitions in cfdisk before going back to the installer.

Finally the installer showed the disks as they really were and I could get on with the installation.

After installation

So far so good. I liked that upon first start-up the system offered to setup ntp synchronization. It’s also nice that the nfs client tools work well out of the box, in some systems I often need to tweak /etc/init.d scripts to get nfs partitions automatically mounted at boot. And I could setup my RAID1 partitions just fine in my good old-fashioned mdadm way.

SQL Server replication

Posted June 9, 2009 by titan2x
Categories: Hacks

Boy, is this complicated? Yeah, but hey, replication is a serious business…

http://msdn.microsoft.com/en-us/library/ms151247(SQL.90).aspx

Anyway, I just managed to set it up, and the one thing that wasted most of my time was broken stored procedures. The lesson here is, before publishing a stored procedure for replication, recreate it at the source first! (Right click, Modify, F5)

Actually replication might be overkill. Instead of that, daily full restore from daily full dumps might be a viable alternative.

Dump database T-SQL hint:

BACKUP DATABASE [SameName]
TO  DISK = N’D:\the long long path\SameName_backup_200906091739.bak’
WITH NOFORMAT, NOINIT,
NAME = N’SameName_backup_20090609173911′,
SKIP, REWIND, NOUNLOAD,  STATS = 10
GO

Restore database T-SQL hint:

RESTORE DATABASE [SameName_Restore]
FROM  DISK = N’D:\the long long path\200906091105.bak’
WITH  FILE = 1,
MOVE N’Dev’
TO N’D:\the long long path\SameName_Restore.mdf’,
MOVE N’Dev_log’
TO N’D:\the long long path\SameName_Restore_1.ldf’,
NOUNLOAD,  STATS = 10
GO