Here are three ways to reset auto_increment in MySQL:

1) Drop the table and recreate it.
‘DROP TABLE myTable;’
‘CREATE TABLE myTable( … etc …’

2) Alter the auto_increment to a specified index
‘ALTER TABLE myTable AUTO_INCREMENT = 1;’

3) Truncate the table to delete all rows and reset auto_increment
‘TRUNCATE TABLE myTable’

The method you use would depend on exactly what you are trying to achieve, be warned if you use the wrong method for your situation you may end up deleting data you did not want to.

auto_increment is just there as a unique index value it does not matter if the first value used is 1 or 1000, so there is no need from MySQL’s perspective to reset it to 1 if you DELETE all the rows in a table, unless of course your application needs to or you want to.

Some MySQL tips:

Running a shell script from within MySQL:

mysql> \! /user/myscript

Running a script of MySQL commands from within MySQL:

mysql> source /user/myscript;

Running MySQL from within a shell script and running commands to create a database and user:

mysql -u$ROOTUSER -p$ROOTPASSWD << CREATE_DB
CREATE DATABASE $DBNAME;
GRANT ALL PRIVILEGES ON $DBNAME.* TO "$DBUSER"@"localhost" IDENTIFIED BY "$DBPASSWD";
FLUSH PRIVILEGES;
CREATE_DB

Running MySQL from shell script or command line and passing a single command

mysql -u root -p -e STATUS | grep -i uptime

Setting up some secure services on a Linux VPS today, using Debian Lenny, had a bit of a battle with stunnel4. The stunnel.conf file I was using had been brought across from this servers predecessor (another story for another day maybe). It had worked there but I could not get it to work on this new server.

Went of searching on Google and saw several other people asking the same question, I have this error message what does it mean ‘inetd mode must define a remote host or an executable’. But no answers.

I knew I did not want inetd mode and went through the stunnel man page, it told me how to use inetd mode but not specifically how to not use it. I was coming to the conclusion that maybe the Debian packager had compiled stunnel with some particular configuration, when I came across a perl script on the stunnel.org site that was to make stunnel4 compatible with stunnel3.

I did a which stunnel on my server and it said /usr/bin/stunnel , I opened that with vim and lo and behold it was that perl wrapper script. I looked in there and saw the executable it was using was stunnel4. I used that instead of stunnel with my stunnel.conf file and hurray it worked.

So the short answer to the question I have this error message ‘inetd mode must define a remote host or an executable’ using stunnel on Debian linux what do I do? don’t use stunnel it is a wrapper script, use stunnel4.

Recently I purchased an I-Mate Ultimate 8502 smartphone. Seems the company has gone under or at least dormant, so Expansys were selling the handsets off cheaply. Was just what I wanted, a smartphone with no contract, not locked to any network.

Setting the phone up I wanted to set the today screen wallpaper, seemed simple enough go to Start/Settings/Today and use the browse and tick the Use this picture as the background box. Except that all the images I tried to use appeared whitish, turns out that is the transparency setting, and there was no option to adjust it when setting the wallpaper that way.

There is another way to set the wallpaper, open the File Explorer program, navigate to the folder that contains the image you want to use, click on the image you want to use, it will be displayed, click the menu option at the bottom right of the screen, click the Set As Today Background option, it then displays a thumbnail of the image with a selection box over it to select the area of the image to display, and a box to select the transparency, set 0 for no transparency, then click OK at the top right of the screen.

This works for me, your mileage may vary.

A little while ago I rebuilt the home Linux server, it used to have two 160GB Sata drives arranged as a software RAID 1, 2 2GHz Xeon Processors, 2Gb of RAM and was running Fedora Core 3 so you can see when it was last rebuilt.

I went for Centos 5, as I wanted longer term support for the OS, and upgraded the hard disks to a pair of 500GB Sata drives, had a bit of an incident with the 160GB drives which resulted in one of them dead, which is another story, but wanted more space anyway.

After getting it all set up with software RAID1 and LVM I then wanted to allocate more space to /var partition which is one of the LVM volumes. After looking around a bit it is actually quite simple, just two commands, which you need to be root to run. lvresize then resize2fs, below are examples of how I used them to add another 103GB to what is my /var partition, I had already added 200GB to this using this method and then decided to add the rest of the available disk space to this partition.

/usr/sbin/lvresize -L +103G /dev/VolGroup00/LogVol01

/sbin/resize2fs /dev/VolGroup00/LogVol01

If you attempt to add more than is available with lvresize it simple gives you an error message saying how blocks are available and how many you asked for, so you can adjust your request and simply try again.

man lvresize and man resize2fs will show you all the options available for these commands.

Another idea for a Christmas present for girls I found today was My Life a portable console game from Flair a UK based toy manufacturer.

To quote the manufacturers blurb My Life is a virtual life simulator designed especially for girls! It’s the ultimate digital pocket games console combining the charm of virtual fashion dolls with the ever increasing interest in video games.

This should keep one of the girls in the family happy, may even get more than one as they can interact with each other a bit and the girls can play together, now that would be a first :-).

Well at least another one of the Christmas list, plenty more to go though and its getting nearer all the time.

Starting to look around for ideas for Christmas Present this year, I was looking at what are tipped to be the top 10 sellers this year.

One I came across that is tipped to be a hit this year is the Elmo Live animatronic doll from Fisher Price.

Elmo is a popular character from the long running childrens TV program Sesame Street, this doll mimics the mannerisms of the TV character and talks and sings, it looks kinda cute and would probably make a great gift for some adults as well.

Well that is one present off the Christmas shopping list, Elmo Live, plenty more left to get yet though.

Today I was looking at the call log in my FritzBox which is a ADSL Modem Router with VOIP and PBX capabilities, and I saw hundreds of anonymous incoming telephone calls of 0 seconds duration.

Our FritzBox is configured to reject anonymous calls so the 0 duration was because of that, we had some problems with silent calls a while ago which is usually tele sales auto dialers with no one available to take the call if it is answered so we had BT (British Telecom) enable the caller ID service on our phone line and set the FritzBox to reject anonymous calls and any other annoying number.

Also set up its do not disturb feature so only certain numbers can get through between the hours of 10pm and 8am, marvelous it is, taken control of the telephone again, we receive the calls we want, when we want.

I spoke to BT about all these anonymous calls and after a little investigation the conclusion was they are coming from abroad as that is the only way they would be as completely anonymous as they are, and basically there is nothing BT can do about it, they suggested keep a log and if it is a problem they could give us a new telephone number. I know BT offer an anonymous caller reject service, whether that would work in this situation I do not know, but the FritzBox does a great job and more beside, with dialing plans and some VOIP accounts set up, all our phone calls are routed over the internet via the cheapest provider saving us a fortune on phone calls as well, and combined with a Dualphone Skype/PSTN telephone system with a couple of handsets it is a good system tailored to fit our requirements precisely.

So back to my original question, I don’t really expect an answer, I expect a computerised auto dialing system has thrown a fit somewhere and I hope when the company receives their phone bills for all these useless phone calls that somebody gets a rocket for incompetence not setting it up and monitoring it properly, this has been going on for 10 days at the moment, that is thousands of calls to our number and presumably we are not the only ones getting hit like this.

The tele marketing companies use these overseas call centres to get around the TPS (Telephone Preference Scheme) and cold calling rules in the UK, as these overseas centres are not covered by them, then when they make a contact and get through their initial sales script they can hand the call to their UK based colleagues as it is no longer a cold call. Two ways to deal with these nuisance calls, hang up immediately or if you have the time waste as much of their time as possible. We have the automated hang up here, works a treat.

Have fun out there and stay safe.

Photos from my trip to Thailand in February to March 2007, we visited Hua Hin for a few days these were taken there.

Photos from my trip to Thailand in November to December 2007. Mostly snaps of the house and surrounding area, with some of Loi Krathong festival in Sukhothai.

Next Page »