Entries Tagged as 'Non-FLOSS'

[TipJar] Rock-a-bye-baby

[Advanced Disclaimer: Use the information in this posting at your risk]

If you want to minimize the amount of electricity used by your computer but dislike shutting down your computer because of the amount of time it need to start it up and open your applications, there is a compromise to be had if your operating system is configured properly to hibernate.

Hibernating an operating system means that all the information in the system memory (RAM to be precise) is written down as a “snapshot image” to the hard disk. The PC hardware is then turned off since the hard disk will not lose its information when powered down. When the machine is turned back on, the booting process of the operating system will look for a store snapshot image and load it back into the system memory. If this is successful, you will have your desktop at the same state as when it was hibernated. The time it needs to resume a hibernated image is relatively small compared to when booting the operating system from scratch (or what is called a cold boot).
All modern operating systems have support for hibernation but not all are enabled by default. To following steps will enable this feature in Windows XP:

  1. Go to Start->Control Panel->Power Options.
  2. Go to the “Hibernate” tab and ensure that the “Enable hibernation” check box is ticked. Click OK to dismiss the dialog and apply the change.
    WARNING: This will reserve space on the system drive equal to the amount of RAM in your computer. If you have 2GB of RAM, 2GB of hard disk space will be set aside for hibernation.
  3. To hibernate, shutdown the machine but select the hibernate option. The machine will be turned off automatically (if this is properly configured).
  4. To resume the hibernated image, turn on the machine. The image will be invalidated after a successful resume.

NOTES:
– Some applications, usually those that have time-bound login sessions, do not like being hibernated.
– The space set aside for the hibernation support is different with the space allocated for the virtual memory.
– If the machine fails to resume or hangs while in the process of resuming, reboot the machine and boot into safe mode (Press F8 after the BIOS screens). Reboot the machine to invalidate the hibernate images and the machine should boot normally after.

[TipJar] Removing zip integration from Windows Explorer

Zip integration was introduced starting Windows XP which enables the Windows Explorer to treat zip archives as a normal directory. This allows users to visit the content structure of the archive without depending on an external application like Winzip or extracting the content.

The downside of this integration is that Windows Explorer needs to finish reading all of the zip archives in the directory being visited before the directory contents are listed. This can cause a significant performance slowdown if there are many or huge zip files in the directory.

To disable the zip integration, the following command can be invoked (requires admin privileges):

regsvr32 /u zipfldr

The command above will clear all zip file associations. If you have Winzip installed, launch a new instance and Winzip will prompt if you want to restore the association. Select the ‘Yes‘ option otherwise zip archives will not be handled properly when double-clicked from Windows Explorer.

NOTES:

  • If Winzip was configured to not show the prompt above, the associations can be done from the Tools->Configuration->System menu.
  • If you are using a different application for handling archives (e.g. WinRar, 7zip, etc.), explore it’s configuration window or refer to the manual.
  • The command “regsvr32 zipfldr” will restore the zip integration of Windows Explorer.
  • BONUS: Dump Winzip and switch to 7zip. It supports more archive types, achieves significantly better compression, and best of all it is Open Source and free!

[TipJar] Freeing up disk space in Windows

If you need to free storage space in your C:\ drive, here are the following files that are *relatively* safe to remove. See notes and disclaimer below.

  • Log files placed in log directories. Consult the application manual or your friendly neighborhood techie if you are in doubt.
  • Files with the “BAK” or “BACK” extensions. These are usually temporary files created by applications performing actions that physically alter the files. Evaluate if you still need the backup prior to removal.
  • Files with names starting with the tilde (~) symbol. These are temporarily files created by some applications (notably MS Office) that it failed to remove after the file was closed.
  • Zip files created to send whole directories via email. These should ideally be deleted after sending but for some reason they were left there. :)
  • [May require elevated privileges] Contents of the “%SYSTEMROOT%\Temp” directory. Delete as much of the files you can but there will be some file not available for removal as they are currently in use.
  • Contents of the “%USERPROFILE%\Local Settings\Temp” directory. Delete as much of the files as you can but there will be some not available for removal as they are currently in use.
  • [May require elevated privileges] Directories in “%SYSTEMROOT%” that follows the format “[identifier]$”. These are information required to uninstall Official Windows patches.
    • DO NOT REMOVE directories that do not follow the format above.

Notes and Mandatory Disclaimer:

  • As this tip deals with deleting of files, the information is intended for educational purposes only. Please think twice about permanently removing files (shift+delete, removing from the recycle bin). Use the information above at your own risk.
  • To know where your %SYSTEMROOT% and %USERPROFILE% directories are, execute the command echo “%SYSTEMROOT%” and echo “%USERPROFILE%” in a command window.
  • When removing uninstall information for Windows patches, consider leaving behind folders with “Date Modified” values of at most one month prior to the current date. The probability of uninstalling patches installed at older dates becomes small if the machine is in constant use.
  • Some files may require elevated privileges that are not granted to normal users. If this is the case and you need to free up space, seek assistance from your workstation administrator.

Looping in Windows batch script

We have a Rational Team Concert process that is executed by a scheduled task. The task tries to download the code from a server that unfortunately does act up from time to time during the middle of the download process. RTC currently does not have a retry function so the result needs to be manually checked and the process be restarted. Its not convenient so I created a batch loop in order to minimize the human interaction.

Below is the base script that will retry the operation up to the figure specified in the attempts variable. The script uses the ping command to effect a delay between the retry attempts. For what it is worht I am releasing it under Creative Commons just for the sake of attribution. :)


REM
REM Function: A sample batch script on how to retry a utility or another batch script that fails intermittently.
REM
REM Author: ramfree17
REM Email: ramfree17@gmail.com
REM
REM License under: Creative Commons Attribution v3.0 Unported [http://creativecommons.org/licenses/by/3.0/]
REM

@echo off

set attempts=10
set counter=0

call :load_func

goto done

:load_func
set /a counter+=1
echo Attempt %counter% out of %attempts%

if %counter% GTR %attempts% goto :eof

C:\ibm\sdp\scmtools\eclipse\scm load "TestWS" -r "https://someserver.com/jazz" -u "testUser" -d "d:\Workspace\rtc" -f -P [password]

REM Check the result. 0 is successful.
if %ERRORLEVEL% NEQ 0 ( ping -n 10 google.com
call :load_func)

goto :eof

:error_section
echo. ERROR: Unable to perform the action. Please see the log if any.

:done
echo exiting sample script.

Auto-run virus on my USB drive

This morning I was copying some files in my USB drive and I found some peculiar files in the root directory: password_viewer.exe and autorun.inf. These are peculiar because I have embarked in a personal Use Linux-only policy in my home systems so I have no need for Windows auto-run feature and I hate that feature to the core so I disable them. I did some quick searching in the Internet and these are normally associated with the w32.sillyfdc worm.

This got me thinking on where I would have contracted that virus as I am pretty paranoid when it comes to my devices. Then it hit me, I had some photos developed at Picture City Digital shop in Robinson’s Pioneer. Sure, I saw the attendant run a manual AVG scan on the contents of my thumb drive but apparently it was not enough because: (1) the scanner real-time file protection was not activated, and (2) I am not sure when was the last time they have updated their virus definitions.

No big deal for me really because I was already prepared to have my drive infected as I only have the pictures to be developed in there. I think the scanning procedure done in the shop threw me back into a sense of complacency that I didn’t double check anymore if it was infected. The drive was used once more by my officemate on his Vista-loaded laptop but I am confident that he is as paranoid as me and his AVG was able to quarantine the infection automatically. He didn’t even notice it until I brought it up this morning.

My take-away tips for this experience are:

  • Convert to using linux as your primary system. Ok, I just have to put that in. :)
  • If using printing shop services for your digital pictures, put them in a read-only media like a CDRW or a SD-card with the write-lock enabled.
  • If you are adamant in using Windows, turn-off the auto-play feature altogether. Most of the time it is more trouble than useful.
  • When using Windows, keep your anti-virus software and definitions up to date and turn-on the real-time file protection if you have a habit of inserting media used from untrusted places.

ciao!