About Mikazo Tech Blog

My name is Mike, and this blog is my way of saving people time. If someone has a specific problem that I've encountered before, hopefully these posts will save them the extraneous Googling I had to go through to solve the same problem. Also, when I have something to say about technology today, I will post my thoughts here. If this blog has helped you out, even a little bit, vote on the poll below, or let me know by sending me an email. I'm always open to exchanging links with other blogs or websites that share a similar interest.

Tuesday, April 14, 2009

Switching to Fedora 10 and Wicd Wireless Network Manager

My last few posts have been pretty technical, so I thought I'd write an opinion piece for once, in case anyone cares. I've begun fiddling around with Linux again, and I went back to where I left off using Linux Mint, only I grabbed the new release of version 6. It felt essentially the same as Linux Mint 5, only this time it froze. A lot. Like more than it used to. I had the same problem with Ubuntu, and I know Mint is based on Ubuntu, so I decided to try an OS that wasn't Debian-based for once.

I downloaded the most recent version of Fedora, version 10. So far I really like it. I'm a big fan of GNOME, and I've found the switch relatively easy. I also noticed that I got a little more involved with the command line with Fedora, which is a good thing. I'm glad to learn more about the internal workings of a Linux distro, as it'll come in handy in the future.

My biggest project so far on Fedora has been trying to get the Wicd wireless network manager working. I hated the standard GNOME NetworkManager so I went looking for alternatives. The only problem was, after I installed Wicd 1.5.9, it wouldn't connect to WPA/WPA2 networks. After looking through some logs I determined that it was to do with an external command, wpa_supplicant not having enough privileges to do what it was supposed to. After lengthy conversations and help from the people on the Freenode #wicd IRC channel, I tried installing the release candidate for Wicd 1.6. One of the Wicd authors did some specific error-fixing for me before I got the latest revision. I also helped him uncover some other bugs. Anyway, it fixed my problem, but opened up a new one. Now Wicd would only connect if I restarted the daemon. It runs virtually identical with the same privileges from boot, but apparently it just doesn't want to work unless I restart it.

Anyway, it's been fun so far and I'm really getting stuck on Fedora.

Tuesday, April 7, 2009

Linux Mint/Ubuntu Overheating Laptop

Back when I tried Ubuntu, and later on when I tried Linux Mint, one of the biggest problems I noticed was their tendencies to heat up quite a bit and the fans run at maximum, even when running idle on my HP dv6568se laptop. It runs an Intel Core 2 Duo at 1.6 GHz.

After realizing that other people have had the same problem, I spent an afternoon Googling around for CPU frequency throttling and the different utilities that you can use. It took me a while until I found the right one. I have now throttled my CPU down to 1.0 GHz and the heat level isn't so bad anymore. Here's how I made mine work.

Modules you may or may not need in your /etc/modules file:

powernowd
cpufreq_ondemand
cpufreq_powersave
cpufreq_performance
cpufreq_conservative
cpufreq-userspace
battery
ac
processor
thermal
acpi-cpufreq

Then I installed kpowersave and cpufreq-utils from the package manager. I set kpowersave to run on startup by going to Control center, Sessions, and added it as a startup program.

Use cpufreq-info in a Terminal to see what frequency steps your processor is capable of, then use cpufreq-set -d [value in KHz] to set a minimum supported frequency and cpufreq-set -u [value in KHz] to set a maximum supported frequency. So the commands I used were:

cpufreq-info
cpufreq-set -d 1000000
cpufreq-set -u 1000000

Now my kpowersave utility reports the processor running at 1000 MHz and the heat problem has noticably improved.

Thursday, March 19, 2009

How To Upload Files with Perl and CGI

I took me quite a while of sifting through the internet looking how to do this. I played with different CGI.pm functions, and so on, but eventually sort of improvised my own script based on what I've seen. This script takes a method="get" parameter of the form "c:\folder1\folder2\file.txt". It does not do any string sanitation or error checking, it just uploads the file. I had to edit the stupid HTML brackets because Blogger doesn't like me typing it there. You'll have to replace the (less/greater than sign) with the actual symbol. Feel free to use if you want.

Code:

use CGI;

$query = new CGI;
print $query->header;
print $query->start_html('Upload file');

$form = $ENV{'QUERY_STRING'};
@args = split('=', $form);
$args[1] =~ s/%3A/:/g;
$args[1] =~ s/%5C/\\/g;
@pieces = split('\\\\', $args[1]);
$length = @pieces;
$localpath = "";
for ($i=0; $i<=$length-2; $i++) {
$localpath .= "$pieces[$i]\\";
}
$localname = $pieces[$length-1];
print "Uploading $localpath$localname";
$serverfile = $ENV{'DOCUMENT_ROOT'} . "/assgn3/cont/$localname";

open(FILEIN, "<$localpath$localname");
open(FILEOUT, ">$serverfile");
while ($line =
(less than sign)FILEIN(greater than sign)) {
print FILEOUT $line;
}
close FILEIN;
close FILEOUT;

print "Upload successful, redirecting to main.pl";
print "(less than sign)meta http-equiv='Refresh' content='4; url=main.pl'(greater than sign)";
print "
(less than sign)/body(greater than sign)(less than sign)/html(greater than sign)";


Donate to Mikazo Tech Blog