I turned off my dell wireless card and couldn’t turn it back on

Among others I work on a Dell Vostro A860 Laptop. It’s running Slackware 64 Current. Yesterday I wanted to watch a movie while waiting at the airport for my wife so I turned off Wi-Fi using FN+11 (pressed a few times until both Bluetooth and wi-fi were disabled).

Today when I booted wi-fi was not working. I kept pressing FN+11 (as the laptop toggles trough combination of bluetooth off/on, wi-fi off/on, and any other possible combination). I used rfkill list all to check their status. I got to the point when both radios were reporting Hard blocked : no but Soft Blocked for wi-fi was still on. I tried restarting Network Monitor, removing the Atheros kernel module and everything else that came to mind. Than I remembered that documentation could be something useful. So I found that I need to run:

[ccNe_bash]
rfkill unblock wifi
[/ccNe_bash]

Easy enough, wi-fi connected properly again.

Make Joomla 1.0 work with PHP 5.3

With the recent posts regarding resurrecting old stuff, recently I had to resurrect a Joomla 1.0 site. Soon enough I discovered that the home page doesn’t display correctly. No errors, just lots of white space :). The problem is that Joomla 1.0 is not really made for PHP 5.3. Of course I could have started a virtual machine with the right environment but I wanted it running along some newer sites. Here’s an easy fix:

Edit ./includes/Cache/Lite/Function.php, find the line reading

[ccNe_php]
$arguments = func_get_args();
[/ccNe_php]

and replace with:

[cce_php]
$arguments = func_get_args();
$numargs = func_num_args();
for($i=1; $i < $numargs; $i++){
$arguments[$i] = &$arguments[$i];
}
[/cce_php]
Check now, it should be working. Enjoy your new old site 🙂

 

Automatically sync photos from digikam to your mobile phone

I shoot a lot of pictures. My collection keeps growing (for example ~90 Gb right now) and since last year I discovered the joy of using digikam to tag and organize them. I’m using the beta 2.0.0 version and use mysql to store it’s databases (as opposed to the default sqlite) as it’s easier to interact and backup. What I want is to carry some of those pictures with me, specifically on my phone. I used to simply resize and copy files by hand but that means that I never have the latest pictures on my phone. So I devised a script that automatically resizes and syncs pictures to my phone. This is it:

[cce_bash]
#!/bin/bash

# your digikam database, user and password
DB=”digikam”
DBPASS=”password”
DBUSR=”user”

SQL=”SELECT Albums.relativePath,”#”,Images.name FROM `Albums`,`Images`,`ImageTags` WHERE ImageTags.tagid=20 and Images.id=ImageTags.imageid and Albums.id=Images.album”

SRC=”/data/foto”
DST=”/data/n900-foto”

MOBILE=”192.168.1.100:/home/user/MyDocs/foto”

while read IMG; do
ALBUM=`echo $IMG | awk ‘BEGIN { FS = “#” } ; { print $1 }’ | awk ‘{sub(/[ t]+$/, “”);print}’ | sed -e ‘s/^[ t]*//’`
IMAGE=`echo $IMG | awk ‘BEGIN { FS = “#” } ; { print $2 }’ | awk ‘{sub(/[ t]+$/, “”);print}’ | sed -e ‘s/^[ t]*//’`
mkdir -p “$DST$ALBUM”
if [ ! -f “$DST$ALBUM/$IMAGE” ]; then
echo “Resizing $IMAGE and copying to $DST$ALBUM”
convert “$SRC$ALBUM/$IMAGE” -resize “1600×1600” “$DST$ALBUM/$IMAGE”
fi
done < <(mysql –skip-column-names -u$DBUSR -p$DBPASS $DB -e “$SQL”)
echo “Syncing to the phone…”
rsync -rv –delete $DST $MOBILE/
[/cce_bash]
Simple enough. Let’s go trough it:

Since I use a Nokia N900 I can have the pictures rsynced via ssh. Of course you can change the script to rsync to a standard folder (if you mount your phone using usb). The trick I use is to have a tag called “mobile” that I use to tag pictures I want synced to my phone. In my setup this tag has the ID 20 and that’s what the script searches for in the database. You can use a tool like phpmyadmin to find this id. Then the script uses Image Magick’s convert to proportionally resize the pictures to have the longside 1600 pixels. Since it checks first if the file already exists it only resizes new tagged files. It also maintains the folder structure of the original images – this way I will find them in the same folders on the phone as on the desktop. Lastly it rsyncs the files (in my case over ssh which is set up to use key based authentication).

Here’s a nice way to enjoy linux both at home and in your pocket 🙂

Moving a solaris guest from VMWare to Virtualbox

I’m a big fan of Virtualbox. It’s easy, fast and free. Recently I had to revive an older Solaris guest that used to run under vmware, and to set it up to run under Virtualbox. I quickly found out that after the grub screen it enters a reboot loop and nothing seemed to help. I could boot into failsafe and mount the root partition as /a/

Someone suggested that the problem was that vmware had the disk as SCSI (c0t0d0s0) and virtualbox enumerated them as IDE (c0d0s0). I tried setting the disk on a virtual SCSI controller but it didn’t help. I set it back to IDE and proceeded to inform Solaris of the new setup: (it takes a bit of tinkering, be sure to have a backup of the image)
Read more “Moving a solaris guest from VMWare to Virtualbox”

vi usage reference

Recently I had to do some work on a Solaris Server. This meant two things: finding a new appreciation for the user friendliness of the linux console and second it meant that I had to use the barebones vi. You know, the one where the arrows and backspace won’t work. Smart. So here’s a little list compiled with the more important functions

First I had to

[ccNe_bash]
export TERM=xterm
[/ccNe_bash]

before vi worked correctly.

Create new file or Open existing file in vi
vi without any file name will open a new file where you can enter and edit text and when coming out you will be asked to enter a file name where to save the text. vi with a file name as argument will open that file for editing if the file already exists it opens it otherwise it creates a new one.

Modes

vi operates in following two modes :
Command Mode : After a file is opened it is opened in command mode ,that is , input from the keyboard will be treated as vi commands

– Insert Mode: To enter the text you have to put vi in insert by pressing ‘i’ or ‘a’ after which you can write the text and you will see it on the screen. To switch between these modes press Esc

Saving & Exiting vi editor
You can exit vi in different ways :

  • Quit without saving : If you don’t want to save the work :q will take you out without saving your editing in vi.
  • Write & quit : . Simple :w saves the current file but don’t exit. For save and quit :wq is used in vi.
  • Forced Quite : An ! after exit commands ( :q! , :wq! ) forces quit from vi after ignoring editing (for :q!) or writing (for :wq!) all the change

 

(vi) Command  
Moving Cursor in File
Left h
Right l
Up k
Down j
Line
First ^ or B
Last $
Sentence
Next sentence )
Previous sentence (
Paragraph
Next }
Previous {
file
Go to end of file :$
on character forward :w
One word forward :W
go to a line number :line_number
display file info ^g
Inserting and appending text
inserts text to the left of cursor i
inserts in the beginning of line I
appends text to right of cursor a
appends to the end of line A
Adding new line
add a new line below the current line o
adds a new line above the current line. O
Deleting the text :
deletes text above the text x
deletes text character on right of cursor X
deletes line 25 25d
deletes current line dd
delete till end of current line D
Replacing a character & word
replace the character above the cursor r
replaces characters until Esc is pressed R
replaces the word from cursor to the end indicated by $ cw
replaces till end of line C
Substitute
substitutes current character s
substitutes entire line S
Undo last changes
undo last change u
undo changes to the current line U
Copy and pasting lines
copies the current line into buffer yy
copies 5 lines from the current line 5yy
pastes the current buffer p
Searching
Searches for name in the file :/name
n continues search forward. n
N searches backwards N
Saving
saves the text but does not quit :w
saves & quit :wq!
save ZZ
Quit without saving q!
Search & Replace s/<search>/<replace>/g .
Repeat last command .
Recovering an unsaved file
vi -r filename

I created this page using vi’s man page and various pages found on the web.

OpenOffice.org / Libreoffice pasted numbers automatically get changed to dates

I’ve been pasting some information from some weblogs into Calc (the OpenOffice / LibreOffice Excel equivalent) and some version numbers like 1.5.30 got changed to dates. All the documentation pointed me towards changing the cell format to text. That only works if you type the numbers, not if you paste them. When you paste them the cell format get changed to number again. Read more for the solution…

Read more “OpenOffice.org / Libreoffice pasted numbers automatically get changed to dates”

Akismet troubles traced back to DNS issues.

My API key for Akismet was suddenly unconfirmed by reason of not being able to reach akismet.com My provider had indeed troubles with their primary DNS so I switched to the google public one. (8.8.8.8). This is a server not a browsing machine so I don’t have any privacy worries.

Long storry short, I changed the DNS and expected the problem to go away. Next day I was happy to find out that it didn’t. I pinged akismet.com from the console, tried http connection to it with links everything was fine. For good measure I tried other DNS entries, tried a mtr to akismet.com but still everything was fine and the key in Akismet Configuration refused to work.

Than, after a slap on my forehead I remembered THIS. Right, after
[cce_bash]
service httpd stop
service httpd start
[/cce_bash]
Everything went back to normal.