Development

Quick way to create patch files based on modified date with xcopy

Recent projects and deployment method made it difficult to simply publish changes to a web server. Had been doing it manually (check for modified files, copy and transfer) and thought it was wasting too much time each day when change requests occur. After some quick research, I realized that the simplest method would just be to use the good old “xcopy” command in windows. (this is why command prompt tools should be taught in schools). For a quick refresher on batch commands, read http://www.computerhope.com/batch.htm.

I realize that a proper source control (like Git or Subversion) would be nicer but in my case, a simple batch file is just easier to work with.

Copy and paste the following code in your deployment folder that will create a patch folder based on last modified dates of working files.

[START EVENT.BAT]

@echo off
REM – http://www.computerhope.com/batch.htm
ECHO Usage : events [patch-num] [m-d-y]

SET SRC=c:xampphtdocsevents
SET DEST=c:deploymentevents

IF (%1)==() GOTO END
IF (%2)==() GOTO TODAYDATE

ECHO Copying files modified on %2
xcopy %SRC% %DEST%%1 /D:%2 /S /C /I /Y
GOTO END

:TODAYDATE
FOR /F “tokens=1-5 delims=/ ” %%a in (“%date%”) DO SET year=%%c
FOR /F “tokens=1-5 delims=/ ” %%a in (“%date%”) DO SET month=%%b
FOR /F “tokens=1-5 delims=/ ” %%a in (“%date%”) DO SET day=%%a

SET TODAY=%month%-%day%-%year%
ECHO Copying files modified on %TODAY%

xcopy %SRC% %DEST%%1 /D:%TODAY% /S /C /I /Y

:END
@echo on

[END EVENT.BAT]

Standard
Musings

Re-installing Windows XP on a Dell Inspiron Mini 9 (910) with a USB drive

Quick n dirty Guide to Re-installing Windows XP on a Dell Inspiron Mini 9 (910)

For fun to get blood pressure to suitable level.

  1. Go to Dell website and look-up the manual for the netbook. Note they mention re-installing operating system requires a optical drive and installation media. They forgot to add “Sucks to be you if you don’t have it”.
  2. Curse Dell for not providing restoration disc or thumb drive and wasting your time.

On a separate Windows machine

  1. Download WinToFlash (http://wintoflash.com/download/en/)
  2. Prepare a USB thumbdrive (1GB or more) and Windows XP CD-Rom (don’t have it? Borrow a suitable version that matches your netbook’s license)
  3. Unzip WinToFlash
  4. Run WinToFlash specifying your Windows XP CD Drive and USB Drive and let it transfer. Wizard mode works.

On Netbook

  1. Plug USB drive (with XP transferred) to Netbook
  2. Boot from USB Drive on Netbook
  3. Choose Option 1, run through XP setup process in text gui. Take note which your windows is going on, 1 (dell formatted) or 2 (most probably the case)?
  4. When done copying files, boot in Option 2 in graphical gui.
  5. When XP is done with setup, you might encounter a hal.dll missing error.
    • Windows could not start because the following file is missing or corrupt: <Windows root>system32hal.dll
    • Continue to boot from USB but select the debug boot “Debug boot rDisk 1 partition 2″ in boot.ini on USB drive [multi(0)disk(0)rdisk(1)partition(2)WINDOWS=”Debug boot rDisk 1 partition 2” /fastdetect]
  6. Allow Windows to finish setup
  7. Fix c:boot.ini (hidden file) to set default boot to “multi(0)disk(0)rdisk(0)partition(2)”
  8. Copy i386 from USB drive to c:
  9. Start patching and installing Dell drivers from Dell support site
  10. Curse Dell again for not providing restoration disc or thumb drive and wasting your time.

Disclaimer:

This is quick guide for me to read if I ever need to do this again (I hope not). Works for me, if it doesn’t work for you. Post questions to WinToFlash forums instead.

Standard