To install the Recovery Console in Windows XP, follow these steps:
1. Insert the Windows XP CD into the CD-ROM drive.
2. Click Start, and then click Run.
3. In the Open box, type d:\i386\winnt32.exe /cmdcons where d is the drive letter for the CD-ROM drive. In the case of 'Microsoft Windows XP Professional x64 Edition, type d:\amd64\winnt32.exe /cmdcons where d is the drive letter for the CD-ROM drive.
4. A Windows Setup Dialog Box appears. The Windows Setup Dialog Box describes the Recovery Console option. To confirm the installation, click Yes.
5. Restart the computer. The next time that you start your computer, "Microsoft Windows Recovery Console" appears on the startup menu.
petrichor (/'pe - tri - kor'/) is the familiar scent of rain on dry earth
this tech blog is the wafting fragrance of my geeky outpourings, one post at a time
Thursday, October 29, 2009
Thursday, October 22, 2009
gdb: incredibly useful stuff!
For ages, I'd wanted gdb to search for the source file recursively inside a given "dir". Now I finally figured out how to accomplish this. Not by a 'recursive dir search', but by setting a 'substitute path' in gdb. This makes life so much easier now! Woohoo! :D
Much much thanks to this source for setting substitute-paths for gdb:
So this is my current ~/.gdbinit file:
You can now automatically "list" code immedidately after attaching gdb to an httpd process - totally painlessly. This is so much better than having to set each "dir" in gdb for each source directory you wanted to "list" as you debugged it. I love "set substitute-path" - it rocks!
Some more cool gdb stuff I learnt today:
Much much thanks to this source for setting substitute-paths for gdb:
You know, by using a set substitute-path <library-source-path>
installed-source-path in the $HOME/.gdbinit file it is possible to
install the library source somewhere and have gdb replace the path
where the library's debug info says the source should be with where
you've installed the library's source.
On my system, for example, by using the 'strings' command, I'm able
to see that glibmm's debug info says that the source should be found
in /build/buildd/glibmm2.4-2.14.2/. I actually installed glibmm's
source in /usr/src/glibmm2.4-2.14.2. So by including the line set
substitute-path /build/buildd /usr/src in ~/.gdbinit, gdb has no
problems finding glibmm's source any more.
This works with all debuggers (even nemiver) as long as ~/.gdbinit is
processed by gdb when it starts up. :-)
So this is my current ~/.gdbinit file:
set substitute-path /sandbox/builds/appframework_dev /data/source/branches/appframework_devAnd I tested it on piidentity.net right away. IT'S AWESOME! Works right outta da box!
You can now automatically "list" code immedidately after attaching gdb to an httpd process - totally painlessly. This is so much better than having to set each "dir" in gdb for each source directory you wanted to "list" as you debugged it. I love "set substitute-path" - it rocks!
Some more cool gdb stuff I learnt today:
- interpreter-exec mi "-file-list-exec-source-files"
(which is equivalent to "info sources") - interpreter-exec mi "-file-list-exec-source-file"
(which is equivalent to "info source") - GDB has a ncurses-based GUI called TUI mode! Whoa!
http://sources.redhat.com/gdb/current/onlinedocs/gdb_26.html
Tuesday, October 20, 2009
windows: how to schedule a high-frequency task
Task Scheduler doesn't let you schedule tasks with fine-grained frequencies. For example, you can't schedule a task to execute every minute, or every few hours. The maximum frequency that can be given to a task is "daily" which sucks because you need to run some programs more often than that (linux's cron is still the king!)
Here's the solution. It involves using the rather powerful "schtasks" windows command:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/schtasks.mspx?mfr=true
Here's what I used:
And this is my super-simple autoupdatesourcecode.bat:
Here's the solution. It involves using the rather powerful "schtasks" windows command:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/schtasks.mspx?mfr=true
Here's what I used:
schtasks /create /sc hourly /mo 2 /tn "autoupdatesourcecode" /tr c:\tools\autoupdatesourcecode.bat
And this is my super-simple autoupdatesourcecode.bat:
cd d:\Codebase\trunk\pi\ d: svn up
Wednesday, October 14, 2009
c++: auto_ptr::release()
auto_ptr::release()
The release() function removes ownership of the stored object from the
invoking auto_ptr and returns a pointer to the object. After a call to release(),
the pointed-to object is not automatically destroyed when the auto_ptr object
goes out of scope.
-- Herb Schildt's C++ Programming Cookbook, Chapter 7, page 489
The release() function removes ownership of the stored object from the
invoking auto_ptr and returns a pointer to the object. After a call to release(),
the pointed-to object is not automatically destroyed when the auto_ptr object
goes out of scope.
-- Herb Schildt's C++ Programming Cookbook, Chapter 7, page 489
Monday, October 12, 2009
c++: deleting elements from a map
Q: Does std::map.erase() properly delete pointers, or does it create memory leaks?
A: It properly does not delete pointers, because it can't assume that nothing else points at the same thing. std::map cleans up the memory *it* explicitly allocated. *You* clean up the memory *you* explicitly allocated.
Here's how to safely delete all elements in a map, that will work for any container:
A: It properly does not delete pointers, because it can't assume that nothing else points at the same thing. std::map cleans up the memory *it* explicitly allocated. *You* clean up the memory *you* explicitly allocated.
Here's how to safely delete all elements in a map, that will work for any container:
std::map<int, char*> Mappy; int main() { for(int Index = 0; Index < 10; ++Index) Mappy.insert(std::make_pair(Index, new char[10])); for(std::map<int, char*>::iterator MapItor = Mappy.begin(); MapItor != Mappy.end(); ++MapItor) { char* Value = (*MapItor).second; delete Value; } system("pause"); return 0; }
Wednesday, October 7, 2009
visual studio: how to show the full file path in the title bar
http://www.helixoft.com/blog/archives/32
Tuesday, October 6, 2009
batch file to fix WMI errors
There's a lot to learn about batch file scripting from this example!
source
source
net stop winmgmt pause c: cd c:\windows\system32\wbem rd /S /Q repository regsvr32 /s %systemroot%\system32\scecli.dll regsvr32 /s %systemroot%\system32\userenv.dll mofcomp cimwin32.mof mofcomp cimwin32.mfl mofcomp rsop.mof mofcomp rsop.mfl for /f %%s in ('dir /b /s *.dll') do regsvr32 /s %%s for /f %%s in ('dir /b *.mof') do mofcomp %%s for /f %%s in ('dir /b *.mfl') do mofcomp %%s mofcomp exwmi.mof mofcomp -n:root\cimv2\applications\exchange wbemcons.mof mofcomp -n:root\cimv2\applications\exchange smtpcons.mof mofcomp exmgmt.mof
Monday, October 5, 2009
linux: adding swap space on-the-fly to your system
You might find that the swap partition you specified at install-time just isn't enough anymore. Maybe you've added more RAM to your machine and need to increase the swap partition accordingly. Or maybe you're upgrading your system to a version that uses more swap in relation to physical RAM. Perhaps you're running Oracle. In case your machine is swapping like mad and you just can't take it down right now to add more RAM, you can add more swap space on the fly using the following procedure. As an example, to keep the machine from running out of memory entirely and freezing up, we'll add 128 MB more swap space by creating a swap file. First we check out the memory usage:
Make sure we have 128 MB laying around somewhere:
OK, we're going to make a swap file in /opt by using dd to create a file 128 MB in size.
Let's not make it world-readable...
Now we set up the swap area and enable it.
And voila! Twice as much swap as before.
You can append a line like this to /etc/fstab to enable your swap file automatically at boot time:
source
[root@domain /root]# free -m
total used free shared buffers cached
Mem: 251 242 8 22 11 32
-/+ buffers/cache: 198 52
Swap: 133 133 0
Make sure we have 128 MB laying around somewhere:
[root@domain /root]# df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/hda9 132207 33429 91952 27% /
/dev/hda1 15522 2537 12184 17% /boot
/dev/hda6 6143236 739000 5092176 13% /opt
/dev/hda7 1035660 836204 146848 85% /usr
/dev/hda5 2071384 344048 1622112 17% /usr/local
/dev/hda8 303344 14439 273244 5% /var
OK, we're going to make a swap file in /opt by using dd to create a file 128 MB in size.
[root@domain /opt]# dd if=/dev/zero of=swapfile bs=1024 count=132207
132207+0 records in
132207+0 records out
[root@domain /opt]# ls -l
total 132364
drwxr-xr-x 20 usr-3 users 4096 May 22 10:46 usr-3
drwxr-xr-x 2 root root 16384 Feb 21 07:04 lost+found
-rw-r--r-- 1 root root 135379968 May 29 11:52 swapfile
Let's not make it world-readable...
[root@domain /opt]# chmod 600 swapfile
[root@domain /opt]# ls -l
total 132364
drwxr-xr-x 20 usr-3 users 4096 May 22 10:46 usr-3
drwxr-xr-x 2 root root 16384 Feb 21 07:04 lost+found
-rw------- 1 root root 135379968 May 29 11:52 swapfile
Now we set up the swap area and enable it.
[root@domain /opt]# mkswap swapfile
Setting up swapspace version 1, size = 135372800 bytes
[root@domain /opt]# swapon swapfile
And voila! Twice as much swap as before.
[root@domain /opt]# free
total used free shared buffers cached
Mem: 257632 254632 3000 2512 36172 15096
-/+ buffers/cache: 203364 54268
Swap: 268708 136512 132196
You can append a line like this to /etc/fstab to enable your swap file automatically at boot time:
/opt/swapfile swap swap defaults 0 0
source
Subscribe to:
Posts (Atom)