IBM Developerworks has a handy little tutorial, titled
Mastering Ajax, Part 2: Make asynchronous requests with JavaScript and Ajax. There's nothing really new or earth-shattering there; it does, however, have all the information about creating and handling cross-browser XMLHttpRequest objects in one place.
Tuesday, January 31, 2006
Sunday, January 29, 2006
Running Cygwin from USB
Normally, installing cygwin on a PC means that you'll need administrative privileges on the system. This is needed because the cygwin startup needs several mount points to be set, which are stored in the Windows registry.
However, it is possible to install cygwin on a USB stick, and run it on any host PC without the need for admin privileges and/or registry hacks. The following batch script will figure out the correct drive letter for the stick, create the mount points, and start cygwin, and has been tested in Windows 2000 and XP; you only need to have write access to c:\temp on the host machine.
However, it is possible to install cygwin on a USB stick, and run it on any host PC without the need for admin privileges and/or registry hacks. The following batch script will figure out the correct drive letter for the stick, create the mount points, and start cygwin, and has been tested in Windows 2000 and XP; you only need to have write access to c:\temp on the host machine.
@echo off
for /F "delims=\: usebackq" %%i in (`cd`) do SET USB_DRIVE=%%i
echo USB driveletter is %USB_DRIVE%
REM pause
SET CYGWIN=tty title
SET PATH=%USB_DRIVE%:\cygwin\bin;%PATH%
echo PATH has been set to %PATH%
echo.
@echo on
mount -f -u -b %USB_DRIVE%:/cygwin /
mount -f -u -b %USB_DRIVE%:/cygwin/bin /usr/bin
mount -f -u -b %USB_DRIVE%:/cygwin/lib /usr/lib
@echo off
echo User mount points have been created.
echo.
echo @ECHO OFF > c:\temp\usbcygwin.bat
echo %USB_DRIVE%: >> c:\temp\usbcygwin.bat
echo CHDIR \cygwin\bin >> c:\temp\usbcygwin.bat
echo bash --login -i >> c:\temp\usbcygwin.bat
echo created c:\temp\usbcygwin.bat, starting cygwin.
echo.
c:\temp\usbcygwin.bat
Friday, January 27, 2006
Scripted FTP in Unix
A scripted FTP session in Unix can be made with this (Korn) shell script:
This needs a file .netrc in your home directory where the userid and password for the session are stored. This file must have its access permissions set to 600.
The format of this file is:
where "userid" and "passwd" are substituted with the userid to use on the host, and the password for that user.
#!/usr/bin/ksh
if [ "$1" -eq "" ] ; then
echo specify a file to send.
exit 1
fi
echo sending file $1 to /home/userid/ff on hostname.domain.
echo "open hostname.domain
verbose
cd ff
bin
put $1
quit" | ftp
This needs a file .netrc in your home directory where the userid and password for the session are stored. This file must have its access permissions set to 600.
The format of this file is:
host hostname.domain login userid password passwd
where "userid" and "passwd" are substituted with the userid to use on the host, and the password for that user.
scripted FTP in DOS
When you want to send files from a DOS prompt in Windows to some other machine, this script may come in handy. Modify as fit; one might for instance want to send more than one file.
Because I'd rather not hardcode a password into the script, the script tries to get that from an environment variable.
Because I'd rather not hardcode a password into the script, the script tries to get that from an environment variable.
@echo off
rem script to quickly get a file from /home/userid/ff on hostname.domain.
rem userid is hardcoded, set property FTPPASS in environment before use.
if "%FTPPASS%"=="" goto nopass
if "%1"=="" goto nofilen
> quickget.ftp echo USER userid
>>quickget.ftp echo %FTPPASS%
>>quickget.ftp echo cd ff
>>quickget.ftp echo bin
>>quickget.ftp echo get %1
>>quickget.ftp echo bye
ftp -n -s:quickget.ftp hostname.domain
del quickget.ftp
goto einde
:nopass
echo No password specified in environment (set FTPPASS=********)
goto einde
:nofilen
echo No file name specified
goto einde
:einde
Subscribe to:
Posts (Atom)