Author Archive

PHP 5.3 big changes!

Lots and lots of things are deprecated!  Probably a good idea to change the error reporting to something like: error_reporting = E_ALL & ~E_NOTICE ~ E_DEPRECATED magic_quotes_gpc,register_globals,safe mode seem to be deprecated Short PHP tags are disabled by default: short_open_tag = On more to come I’m sure…….

MySQL reset lost root password

/etc/init.d/mysql.server stop /usr/local/mysql/bin/safe_mysqld –user=mysql –skip-grant-tables –skip-networking & /usr/local/mysql/bin/mysql mysql> UPDATE mysql.user SET Password=PASSWORD(‘MyNewPass’) WHERE User=’root'; mysql> FLUSH PRIVILEGES; mysql> exit /etc/init.d/mysql.server restart Probably a good idea to clear the MySQL history afterwards or pull in the update from a txt file and delete!

Appcmd IIS7 command line tool

Appcmd list sites Appcmd list site “sitename” /config Appcmd start/stop sites “Default Web Site” (or whatever site you want to start) Appcmd add sites /name:”Site 5” /id:12 /bindings:http://mysite5.com:80 /physicalPath:C:\inetpub\site5 Backup IIS config: appcmd add backup appcmd list backup appcmd restore backup It has much much more functionality – appcmd /h

Save password for mapped network drive

When you map a network drive in Windows, with a non-domain user for example, Windows will save the username but not the password.  To persistently store the password, use the following from cmd: net use x: \\server’s.DNS.name\share /savecred /persistent:yes

Auto restart IIS when service unavailable

A bit crude but it works.  Make a schedule task for this batch file: del testsql1.asp C:\wget\wget.exe –timeout=30 –tries=1 http://www.website.com/testsql1.asp find /C “SQLServer Test Code 1″ testscript.asp IF ERRORLEVEL 1 IISRESET /RESTART /TIMEOUT:120 /REBOOTONERROR

Force group policy update

To manually force Group Policy to refresh under Windows 2000, you use the command secedit /refreshpolicy Microsoft has replaced this command in Windows 2003 and XP with this command: gpupdate

Stop BackupExec failing on corrupt files

I expect there will be a flag for this in future versions, but for now regedit is needed: HKEY_LOCAL_MACHINE\SOFTWARE\VERITAS\Backup Exec\Engine\Backup [For versions 9x and 10x] HKEY_LOCAL_MACHINE\SOFTWARE\SYMANTEC\Backup Exec for Windows\Backup Exec\Engine\Backup [For versions  11x and 12x] On the menu bar, select Edit | Add Value In the Value name field, type in “Fail Jobs On Corrupt […]

IIS File Upload Limit

By default IIS sets the upload filesize limit to a measly 200KB.  To edit this you need to enable direct metabase editing in IIS, then edit c:\windows\system32\inetsrv\Metabase.xml .  You need to modify the MaxRequestEntityAllowed which is in bytes.  Restart IIS.

SMTP Reply codes

Code     Meaning 200     (nonstandard success response, see rfc876) 211     System status, or system help reply 214     Help message 220     <domain> Service ready 221     <domain> Service closing transmission channel 250     Requested mail action okay, completed 251     User not local; will forward to <forward-path> 354     Start mail input; […]

BASH create random password

apg -MSNCL  -m8 -x11 -n10 -E\%\\\/\|\`\<\>\+\{\}\”\’ or < /dev/urandom tr -dc A-Za-z0-9_$*?! | head -c10 Another useful implementation thanks to www.cyberciti.biz, a sample random password generator (put in your ~/.bashrc): genpasswd() { local l=$1 [ “$l” == “” ] && l=20 tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs } Run it: […]