Martins blog | Last update: Wednesday, November 21, 2007 11:47 | martin*huijgen.com
11/21/2007 [169]

Autoreplace

Autoreplace replaces typos as you type them. It comes with an editable list so you can enter words you often misspell or mistype.

Since AutoHotKey is GPL, this little script is licensed under the GPL (v2) as well. I included all the sources.

Here is the zipfile: autoreplace.zip. It contains an installer and uninstaller.

Disclaimer: do not use this.

10/30/2007 [168]

BackupPST.cmd

My users have their Outlook profiles stored on the Exchange server but they also keep local PST files, which aren't included in the daily network backup routines.

I connected a USB drive to a server for the users to backup their PST files to. Since PST files are usually big (they can contain a maximum of 2GB each) and change daily, it's no use backing them up with Mbackup.

I wrote a script that copies the PST files to the shared backup disk, then deletes the older copies. The script lets you specify how many backups you want to keep.

Here's the script:
@echo off

:: BackupPST
:: Backs up PST files to a network share
:: Martin Huijgen, 2007-10-30.

:: ---------------- enter your settings here -----------------------

:: Credentials
set target_share=\\nasbak\publiek
set target_path=pstbackups
set uname=
set password=

:: Tempdrive
set tempdrive=t:

:: Where to look for PST files?
set source=%userprofile%\Local Settings\Application Data\Microsoft\Outlook
set look_in_subfolders=true

:: Number of backups to keep (keep at least 2 so as not to overwrite
:: existing good backups with a possibly bad new backup). The
:: script copies a new backup first and only *then* deletes the
:: older backups.

set nr_of_backups=2

:: ----------------- examples, do no change -------------------

:: Example 1:
:: set target_share=\\server01\backupdir
:: set target_path=myname\mydir
:: set uname=Tinus
:: set password=R0tt3rd4m
:: set tempdrive=t:
:: set source=C:\Documents and Settings\Tinus\Local Settings\Application Data\Microsoft\Outlook
:: set look_in_subfolders=true
:: set nr_of_backups=3

:: Example 2 (using system variables):
:: set target_share=%home%
:: set target_path=myname\mydir
:: set uname=%username%@%userdnsdomain%
:: set password=R0tt3rd4m
:: set tempdrive=t:
:: set source=%userprofile%\Local Settings\Application Data\Microsoft\Outlook
:: set look_in_subfolders=false
:: set nr_of_backups=3

:: ------------do not change anything below this line --------------

set tempfile="%temp%\~backupPST.tmp"

call :CleanUp

:: Get current dir
for /f "usebackq delims=" %%i in (`cd`) do set current_dir=%%i

:TestOutlook
:: Make sure Outlook is closed
tasklist|find /i /c "outlook.exe">%tempfile%
for /f "usebackq delims=" %%i in (%tempfile%) do set olnr=%%i
del %tempfile%
if /I %olnr% GTR 0 goto :Err_Outlook_on

:: Verify user input
if [%target_path%]==[] goto :Err_no_target_path
if not exist "%source%" goto :Err_source

:: Make sure target_path begins with a backslash
if not [%target_path%]==[] set first_char_of_target_path=%target_path:~0,1%
if not [%first_char_of_target_path%]==[\] set target_path=\%target_path%

:: Connect to target server
if not [%uname%]==[] set unamestr=/user:%uname%
net use %tempdrive% %target_share%%target_path% %password% %unamestr%
if not exist t: goto :Err_target

:: Make a dir to backup to
cd /d %tempdrive%\
if not exist %username% mkdir %username%
cd %username%
set backupdir=%random%%random%
mkdir %backupdir%

:: Copy pst files
copy "%source%\*.pst" "%tempdrive%\%username%\%backupdir%"

:: Delete oldest backup
cd /d %tempdrive%\%username%
for /f "usebackq skip=%nr_of_backups% delims=" %%i in (`dir /o:-d /a:d /b`) do rmdir %%i /s /q

goto :end

:: Error handling
:Err_Source
set err=Source directory does not exist.
goto :Err_General

:Err_No_Target_Path
set err=Target path does not exist.
goto :Err_Genreal

:Err_Target
set err=Cannot connect to target. Please check the parameters in the script.
goto :Err_General

:Err_Outlook_on
echo Outlook is running.
echo Outlook must be stopped before you can backup your PST files.
echo If Outlook is open, close it now. If Outlook is already closed
echo but you continue to get this error, you could try to force
echo the Outlook.exe process to close.
echo.
echo What shall we do?
:AskActOutlook
set /p actoutlook=[R]etry, [F]orce, [A]bort
if [%actoutlook%]==[r] goto :TestOutlook
if [%actoutlook%]==[R] goto :TestOutlook
if [%actoutlook%]==[f] goto :ForceCloseOutlook
if [%actoutlook%]==[F] goto :ForceCloseOutlook
if [%actoutlook%]==[a] goto :Err_General
if [%actoutlook%]==[A] goto :Err_General

goto :AskActOutlook

:ForceCloseOutlook
taskkill /F /IM outlook.exe
goto :TestOutlook

:Err_General
if not [%err%]==[] echo %err%
echo The script was not completed successfully.

goto :end

:CleanUp
cd /d "%current_dir%"
set current_dir=
if exist %tempdrive% net use %tempdrive% /del
if exist %tempfile% del %tempfile%
set err=
goto :eof

:End
call :CleanUp
goto :eof

10/19/2007 [167]

De helpdende IT-hand, deel 1: de vraag ontcijferen.

Hulp bieden aan gebruikers is drieledig: je ontcijfert de vraag, je zoekt uit wat het probleem veroorzaakt en je lost het op.

In de cursus De helpdende IT-hand beginnen we met deel 1: de vraag ontcijferen.

Om de vraag te kunnen ontcijferen, moet je weten hoe deze tot stand is gekomen. Hoe formuleert de gebruiker zijn vraag? We gaan uit van een gewone vraag:
Beste IT'er,
Als ik mijn computer opstart, komt er rook uit mijn toetsenbord. Zou je er even naar willen kijken?
Bedankt!
  1. Ontdoe de vraag van alle beleefdheden, die leiden toch maar af:
    Als ik mijn computer opstart, komt er rook uit. Zou je er even naar willen kijken?
  2. Geruik geen hoofdletters en geen interpunctie:
    als ik mijn computer opstart komt er rook uit zou je er even naar willen kijken
  3. Laat elke twintigste woord *en* het laatste woord weg:
    als ik mijn computer opstart komt er rook uit zou je er even naar willen
  4. Je vraag is nu moeilijk als zodaning herkenbaar; gebruik voldoende vraagtekens (ook bij bevestigende zinnen):
    als ik mijn computer opstart komt er rook uit zou je er even naar willen?????
  5. Bij woorden die door weglating van één letter een andere betekenis krijgen, dien je die weg te laten:
    als ik mijn computer opstart komt er ook uit zo je er even naar willen?????

Oefening 1: zet de volgende vragen om in gebruikersjargon:

1. Hoe kan het dat mijn Word-documenten zo groot worden?

2. Als ik thuis via vpn werk, kan ik wel mailtjes ontvangen maar als ik mailtjes probeer te versturen, blijven ze in mijn Postvak UIT staan. Maar als ik op kantoor kom, niet!

3. Hey Martin, mijn computer is nogal langzaam. Mijn neefje heeft er vorige week KaZaA op geïnstalleerd maar alles komt verschrikkelijk langzaam binnen. Als ik mijn virusscanner uitzet, gaat het snel.

.

.

.

.


Juiste antwoorden:
1. hoe kan het dat mijn word documenten zo groot??????
2. als ik thuis via vpn werk kan ik we mailtjes ontvangen maar als ik mailtjes probeer te versturen blijven in mijn postvak uit staan maar als ik op kantoor kom????????
3. mijn computer is nogal langzaam mijn neefje heeft er vorige week kazaa op geinstalleerd maar alles komt verschrikkelijk langzaam als ik mijn virusscanner uitzet gaat het????????


9/10/2007 [166]
Martin leest voor uit eigen werk. Vandaag:

Huijgen-getallen

Het Nieuw Natuurkundelijk Wetboek behandelt in een niet al te fors hoofdstuk de theoretische Huijgen-getallen. Huijgen-getallen zijn priemgetallen, maar dan binnenstebuiten. Het zijn natuurlijke getallen die niet met 1, 2 of zichzelf vermenigvuldigd kunnen worden.

Het zijn ook de enige bekende theoretische getallen die *wel* invloed hebben op het dagelijks leven van de mens als hun bestaan bevestigd wordt.

Momenteel zijn er vierduizend wetenschappelijke groeperingen rond de klok bezig met het speuren naar Huijgen-getallen. Tot nog toe zijn er drie bijna-ontdekkingen geweest, maar bij nader inzien waren ook deze getallen (15, 881 en 4) toch vermenigvuldigbaar met 1, 2 en/of zichzelf (zij het met moeite!).

Er wordt een distributed computing-project opgezet voor het zoeken naar Huijgen-getallen. De consensus is dat er volgend jaar, rond half vijf in de middag, geen Huijgen-getal wordt gevonden.

9/8/2007 [165]

NerdTests.com says I'm a Dorky Nerd King.  What are you?  Click here!

Meer artikelen in het archief.