One-liner: Converting a Text File to Unicode on the Command Line
Posted by: JDS
One Liner: dynamically enabling and disabling one's second CPU
Posted by: JDS
jeff@frogpad:~$ ls -l /sys/devices/system/cpu total 0 drwxr-xr-x 6 root root 0 2008-06-11 08:01 cpu0 drwxr-xr-x 3 root root 0 2008-06-11 09:00 cpu1 drwxr-xr-x 2 root root 0 2008-06-11 09:00 cpuidle -rw-r--r-- 1 root root 4096 2008-06-09 11:27 sched_mc_power_savings jeff@frogpad:~$ cat /sys/devices/system/cpu/cpu1/online 0 jeff@frogpad:~$ sudo echo 1 > /sys/devices/system/cpu/cpu1/online bash: /sys/devices/system/cpu/cpu1/online: Permission denied jeff@frogpad:~$ sudo sux - root@frogpad:~# echo 1 > /sys/devices/system/cpu/cpu1/online root@frogpad:~#
So, it looks like you have to actually be logged in (or su'ed in) as root for this to work -- sudo doesn't cut it. Don't know why. Also note that I use 'sux' instead of 'su'.
Linux is Better Than Windows
Posted by: JDS
So, I posted this long rant to some guy's website about why Linux is better than Windows and how he was wrong wrong wrong. I thought I would save it here, and tweak it into an article.
http://coconuter.blogspot.com/2008/04/windows-vs-linux-comparison-and-review.html
Anyway, he presented a couple of common misconceptions about Linux. I think the most common one is that whole command-line thing. Here are my comments posted to his site:
Howdy. Linux is not harder to use than Windows, it is just DIFFERENT to use than Windows, and to some people that equates to harder. Linux is easier to use for people who have never used a computer before than it is for long time Windows users, because of the difference. Also, there are some common misconceptions in your article that I would like to dispell:
1) Linux is not harder to use than Windows, just different to use (covered that already)
2) You NEVER EVER EVER need to use the command line with Linux. NEVER. This is a leftover impression from old Linux days when this was true. It is, simply put, false and misleading. You do, however, have the option of using the CLI, if you want.
3) Linux has better out-of-the box driver/hardware support than Windows. Ever try connecting to a wired network after just installing WinXP? Can't do it. Need to insert driver disk. Not on Linux, though, your NIC will be up and running immediately. And that is just one example.
4) With all of the available free software for everyday tasks, and nearly impervious to malware, Linux is much better than Windows for the average user.
Linux is NOT good for a lot of people, though! Gamers, people with specifc software needs like niche market software or other Windows-only apps are better off using Windows.
"Grandma" though, and average users like her, using office apps, email, and web, primarily, are BETTER off using Linux.
Okay, seeya! Bye!
Okay, so, yeah, sticking in a paragraph that makes it look like I am not biased -- the Windows is good for some people paragraph -- is maybe a little obvious bias-cover-up. But whatchagonnado? When one finds something that one loves, one wants to tell the world, doesn't one? But really, the part that irks me the most about Windows users' comparisons of Linux is the generally outdated and incorrect comparisons.
I will admit, Linux can be a bit confusing. The vast number of choices is really quite overwhelming. So from here on out, I'll try to stick to comparison by using a particular distro vs Windows, and not "Linux" which really covers a lot more territory and at the same time is a lot more granularly specific than the term "Windows".
So for future posts, it is going to be LinuxMint vs Windows. I was going to go with Ubuntu, but as far as comparisons of interest to "averege" users go, LinuxMint levels the playing field even more than Ubuntu, with its out-of-the-box software choices.
MySQL Key error when inserting new row
Posted by: JDS
When trying to add an article to my little-kid blog, I got this error:
…Duplicate entry ‘0’ for key 1 …
Where the elipses are the specific INSERT statement and MySQL error number. Not relevant, here, because this was not caused by NucleusCMS or MySQL.
I discovered that my MySQL server instance had been recently upgraded by my ISP. I think this is the source of the problem, but I am not certain. At any rate, the real problem was that the auto incrementing ID for the content table, "prefix_nucleus_item.inumber", had been changed to not be auto incrementing. WTF? Anyway, the solution was easy:
ALTER TABLE prefix_nucleus_item CHANGE inumber inumber int(11) NOT NULL AUTO_INCREMENT DEFAULT 0;
Alternatively, this can be accomplished with something like PHPMyAdmin. Or by creating a PHP script with this one liner in it (a real pain but the only solution available for some ISP situations). But you do need direct access to your MySQL tables in one way or another.
ImageMagick One Liners and Notes
Posted by: JDS
First of all, see this excellent article: http://redskiesatnight.com/2005/04/06/sharpening-using-image-magick/
convert -resize 480 -rotate -90 -unsharp 1.5x1.2+1.0+0.10 IMG_8722.JPG the-three-boys.png
NOTE: "-rotate" is optional! duh.
Ubuntu 8.04 on a Thinkpad R61
Posted by: JDS
However, in Ubuntu 8.04, everything pretty much works Real Good(TM)
Okay, so, I really frikin love LinuxMint Daryna. That's LinuxMint 4. Actually, though, it felt like Mint 3.1 was a bit better, more polished, I don't know, friendlier, than LinuxMint 4. Anyway, that's neither here nor there. The point is, Daryna is pretty effin great. Really.
Also, I have always felt that Ubuntu, while sound of concept lacked a smidge in the execution department, and that is where an OS like Mint really shone: in the finall fit and finish of the OS.
However, Ubuntu 8.04 may just prove to be the very best Ubuntu release, nay, the best Linux Desktop Distribution release ever. We'll see.
Okay, back to Daryna. I think Mint is absolutely fantastic. But, unfortunately, some things just plain dain't work right on my rather new Lenovo Thinkpad R61. Wireless? Worked well. Built-in webcam? Worked great. But things that I really really want to work perfectly on a laptop did not. One major, the other minor: Suspend/hibernate and the trackpad.
Now, in Ubuntu 8.04 -- and this isn't the final version even -- the trackpad works perfectly, and suspend/hibernate has worked so far out-of-the-box. Flawless.
Oh, I just remembered another thing that was a bit dodgy in Daryna on this laptop: LCD brightness. Didn't work at all. Well, the screen brightness buttons did something -- they caused the brightness OSD to show up with what the system thought was the actual brightness -- but the brightness never changed. Now, however, all of the power management functions, including screen brightness, work. Perfectly, in fact. In fact, I don't think there is anything that doesn't work!
Other things that are really cool about Ubuntu 8.04:
- Screen configurator actually worked! It detected the external monitor, and had a neat little GUI that let you drag around the positioning of the connected monitors -- left of, right of, top of, etc. or cloned. Admittedly, this GUI was a bit buggy! But it did work and did not crash. Just quirky bugs.
- FireFox 3 is fucking fast as hell
- Actually, *everything* is faster. This is just subjective, but everything just seems to run faster: nautilus, VMWare (when I finally got that running), FireFox 3, etc.
- Actually, actually, not just speed, but FireFox 3 is better -- way better -- than FF2 in almost every respect. System integration is better. FF3 is faster. FF3 does popups, dialogs, and notices better (Take the "save password now" dialog. Before FF stopped and waited for you to make a decision on save now or later. Now, FF continues on through to what you were doing -- browsing a website -- and, if you want, you have plenty of time to click or ignore the very unobtrusive "save now?" dialog.)
- It was really easy to just add all the "extra stuff" -- MP3 playback, Java, video codecs, etc, with the "ubuntu-restricted-extras" meta-package. I don't know when that got added, all I know is that I don't remember seeing it before 8.04. (Automatix anyone?)
- Holy crap, even the little things that didn't seem to work before now work perfectly. NetworkManager, always a cool feature since 7.04, now is even better than ever. You can look at and edit the saved wireless access points. The VPN plugin worked perfectly for me. did you get that? PERFECTLY. No making a shell script to log on to my VPN -- NetworkManager just takes care of it! Mind you, I am useing another thing that worked perfectly and easily, the "vpnc" Cisco VPN client. (I think in my previous job, for a Large University, I couldn't use the vpnc client only because the buracracy there did not allow peons to configure their own VPN clients, and to use vpnc you really need to have the Group and User passwords. But I digress. Also, I have no way to test this anymore. Don't work there! (yay)).
I do think that some things need to get changed at the level of "choosing which packages belong on the CD" level. Like Evolution, a shitty, buggy, unstable, clunky app. (Does anyone actually use Evolution except Novell employess and the Evo developers?) Mplayer browser plug-in is way better than Totem's browser plugin. And Amarok? Waay better than Banshee or Rhythmbox. And where is K3B? I think Ubuntu draws lines between its core disto (Gnome-based) and the "official derivatives" (KDE-based Kubuntu, and XFCE-based Xubuntu) a little to tightly along Desktop lines, and there are simply some KDE apps (or just non-Gnome, e.g. Thunderbird) that are better than their Gnome counterparts (and Gnome apps that are better than their KDE counterparts). And that is another thing that LinuxMint does so well. Mint does not just "add codecs" to Ubuntu. Mint goes in and tweaks packages to make choices by what works best, irrespective of Desktop environment.
Anyway, I hope the Elysa release is as good as Ubuntu 8.04 has shown to be so far. It hasn't been all roses, though. The biggest problems so far are:
- NVIDIA drivers work well, when they are being used, but cause problems with other stuff, like the aforementioned screen configurator and with suspend/hibernate. Among other things. A non-issue for me at the moment as I can do without 3D acceleration. But it would be nice to have, certainly! I'll look into it...
- The screen settings get remembered across reboots BUT I have to remove the external monitor when I reboot! Or else I just get a blank screen -- on BOTH monitors! The laptop is running, mind you, it is just the screens that are blank. The workaround (sucky) is to remove the external monitor, reboot, and reattach the monitor after boot has finished. It is weird and doesn't make sense because the boot splash can even be seen on the external monitor when I have it plugged in during reboot, but something gets screwed up right as the boot sequence is wrapping up. This problem is definitely the worst one I've run into so far and I wouldn't have even noticed it at all but for my need to use my awesome, huge, fantastic external monitor.
The solutions for both of these problems are not too bad: just don't use the NVIDA drivers (of course, then there's no compiz), and do the reboot workaround.
Update: Not everything is so rosy.
Okay, so, there is this bug. Oh, well, not everything is perfect. The problem is with Pulseaudio and the solutions are
- Remove Pulseaudio
- Change default sound server to something else
- 'pulseaudio -k' when the bug occurs (i.e. kill pulseaudio). Then, maybe, just maybe, start it up again.
Not a showstopper for me, but very, very annoying.