Categories
Cellphone

Android Version 2.3.3 Sucks Battery?

I just updated my Android X to version 2.3.3 a few days ago, and now it seems my battery doesn’t last as long!

I haven’t changed any settings, I only keep the bluetooth on (no wi-fi or gps) and whereas my battery would usually last around 14+ hours with normal usage, this new version seems to die in around 8 hours.

UPDATE: I had a reason to flush my android and start from scratch, and this seemed to clear up the battery problem! Why? Who knows! Logic would indicate some app was causing a problem, but I am careful on apps and when I reinstalled everything the battery life was still good.

Categories
Unix Websites

Running root commands in PHP via Apache

I have a web application that needs to perform shells commands as root within a PHP function, and you would think that would be pretty straight forward… but it did take my a few googles to get all the details, so here are my handy notes on it. This is on a Linux system running Apache, and we’ll be using “sudo” within “shell_exec” to run the commands.

The main thing is to edit the /etc/sudoers file, and typically you can (as root) use the ”visudo” command to do so.

Make sure apache can run commands, AND not require a password:

apache  ALL=(ALL)       NOPASSWD: ALL

Then you need to comment out this line:

#Defaults    requiretty

If you don’t, then you will see these errors in /var/log/secure: “sorry, you must have a tty to run sudo”. Now you are ready to go, and the PHP code is simple:

$results = shell_exec(‘sudo date’);

Categories
Photos

Borders without Books

It is sad to see all these bookstores closing these days, and even the large bookstores are suffering. Perhaps some karma at play, seeing how they forced the little bookstores to close in the past!

But nonetheless, I am sad to see this particular Borders shut down, since they had an AWESOME selection of tech books! And I was just there a few days ago to see ALL the bookshelves empty of knowledge.

They were selling everything in the store, even those big-ass bookshelves. I thought briefly of putting in a 12 foot high bookshelf in my home office but decided against it.

Categories
Unix

SquirrelMail working with change_sqlpass

I installed SquirrelMail 1.4.21 the other day, and I wanted to add the plugin for password changes. I chose the one that works with MySQL, since I use Dovecot with the MySQL option for users/passwords.

I downloaded the change_sqlpass plugin, and ran into an issue where once the user changed the password, it gave an error “Your session has expired, but will be resumed after logging in again.”

I had to dig around to find some patches people recommended to use, but that plugin download is over 5 years old and has not been updated with it! You basically need to update one file, “functions.php”, so I have done so and you can just grab it here.

Categories
Websites

Changing to PHP5 in Yahoo Web Hosting

I was updating some code on a Yahoo hosted site, and it wasn’t working because Yahoo will default you to PHP4 on their hosting. My code of course requires PHP5.

I spent a fair amount of time searching around for an answer and finally found it at http://help.yahoo.com/l/us/yahoo/smallbusiness/webhosting/php/php-38.html

I was surprised at how difficult it was to find this switch option! After I made this post, Yahoo support replied to give me the proper link and some more information, which I must compliment Yahoo support for doing.

Categories
Unix

Pure-FTPd is good

I sure do like pure-ftpd, it chroots user logins so they can’t chdir all over the place, and is easy to configure and use.

I did have one case lately where I would connect in and it would hang while “entering passive mode”. It turns out I needed to add some extra stuff into iptables. This did the trick:

-A RH-Firewall-1-INPUT -p udp -m udp –dport 20 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp –dport 20 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp –dport 21 -m recent –set –name FTP –rdest -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp –dport 1024:65535 -m recent –rcheck –seconds 9800 –name FTP –rdest -j ACCEPT

-A RH-Firewall-1-INPUT -p udp -m udp –dport 20 -j ACCEPT -A RH-Firewall-1-INPUT -p tcp -m tcp –dport 20 -j ACCEPT -A RH-Firewall-1-INPUT -p tcp -m tcp –dport 21 -m recent –set –name FTP –rdest -j ACCEPT -A RH-Firewall-1-INPUT -p tcp -m tcp –dport 1024:65535 -m recent –rcheck –seconds 9800 –name FTP –rdest -j ACCEPT

Categories
Cellphone

Android phone contacts all kafloobered

A few days ago, my nice Android Motorola X phone went all wonky and kafloobered up my contacts!

Yes, that’s right — kafloobered.

It mixed up names and phone numbers so that when I got a call and it said “John Smith calling” it was really someone else. So I’d answer the phone and say “Hey John,” and it would be the guy you’ve been avoiding for the past few weeks because he wants you to introduce him to your wife’s friend who really doesn’t like him… anyway, I digress.

What I had to do was to drop my sync settings in the phone, and re-sync to my exchange server and gmail account again. That fixed it!

Categories
Coding Websites

http AJAX fails in Internet Explorer

I ran across an interesting bug recently where I had an AJAX routine failing when I viewed the page in IE8. When you clicked the little warning icon in the lower left, it gave a message of “Object doesn’t support this property or method”!

It was failing around code that looks like:

function parseCalcResponse() {
if (http.readyState == 4 && http.status == 200) {
results = http.responseText;
results = results.split(“|||”);
document.getElementById(‘test’).innerHTML = results;
}
}

It turns out, the fix was to declare “results” at the top of the function code with:

var results=”;

And that fixed it!

Categories
Unix

SVN in chroot says you don’t exist

You may one day set up a chroot environment and find you get this message when you try to ssh or use svn (using ssh):

You don’t exist, go away!
svn: Connection closed unexpectedly

In addition to my assurance that you do indeed exist in the universe, let me tell you how I fixed it.

Check your chroot /etc to make sure passwd and shadow exist for your user and the IDs are correct.

Then, note that when svn does a repository connection it uses libnss_files.so which can require proper DNS resolution. In my case, I had to add the repository domain name into the chroot /etc/hosts file.

Then I existed in more ways than one.

Categories
Hardware Unix

Fedora13 kernel update breaks video

I did my usual old “yum update” the other day and it hosed up my video upon reboot!

Never fear, it is a known problem, and has probably already been fixed by the time you read this.

But one thing I learned is that you should have akmod installed so the system will be smart and use a previous video driver if it fails. To do this, all I needed to do was:

yum install akmod-nvidia

then, on reboot, it was all working again.

[Update]

One thing to note is that when you do a yum update, make sure if there is a new kernel that there is a corresponding nvidia update for it! If not, then DO NOT yum update, and try again in a day or so. Eventually there will be a matching nvidia update and you are safe to update. Example:

Installing:

kernel x86_64 2.6.34.9-69.fc13 updates 22 M

kernel-devel x86_64 2.6.34.9-69.fc13 updates 6.4 M

Removing:

kernel x86_64 2.6.34.7-63.fc13 @updates 102 M

kernel-devel x86_64 2.6.34.7-63.fc13 @updates 23 M

Installing for dependencies:

kmod-nvidia-2.6.34.9-69.fc13.x86_64 x86_64 1:260.19.36-1.fc13.3 rpmfusion-nonfree-updates 2.8 M

Removing for dependencies:

kmod-nvidia-2.6.34.7-63.fc13.x86_64 x86_64 1:260.19.29-1.fc13 @rpmfusion-nonfree-updates 12 M