Tuesday, January 15, 2013

Remove wgasetup.exe Windows Genuine Advantage

Remove wgasetup.exe Windows Genuine Advantage

1) After windows starts, start > run > taskmgr

2) Click on the “processes” tab > find the “WGASetup.exe” process > right-click it > select “End Process Tree”.

3) start > run > control.exe schedtasks > Scheduled Tasks pops up.

4) Delete the “WGASetup” task.

5) Delete the following folder: “C:\WINDOWS\system32\KB905474″

6) Restart Windows.

Tuesday, January 8, 2013

Audacity - is free, open source, cross-platform software for recording and editing audio sounds.

Audacity - is free, open source, cross-platform software for recording and editing audio sounds.

http://audacity.sourceforge.net/

WinSplit Revolution

WinSplit Revolution is a small utility which allows you to easily organize your open windows by tiling, resizing and positioning them to make the best use of your desktop real estate.

Reference:
http://winsplit-revolution.com/

Glances is a CLI curses based system monitoring tool for GNU/Linux and BSD OS.

Glances uses the PsUtil library to get information from your system.

It is developed in Python.

# cd /usr/ports/sysutils/py-glances
# make config-recursive
# make install clean
# rehash
# glances

Note: press "q" to quit.

http://nicolargo.github.com/glances/

Use lockf to prevent running multiple rsync processes

Use lockf to ensure only one instance of rsync is running at a time.

#!/bin/sh
runRsync () {
  mode=${1}
  lockFile=/tmp/test.lock
  runCount=0
  runMax=5

  date "+rsync update starts at %Y-%m-%d %H:%M:%S"

  while [ $runCount -lt $runMax ]; do
    ### program to execute.
    if [ $mode = "PULLING" ]; then
      lockf -t 0 ${lockFile} /usr/local/bin/rsync -avu --ipv4 --stats --safe-links --password-file=/usr/local/etc/rsyncd.passwd_rsyncbot rsyncbot@1.2.3.4::mybackup /home/srv/mybackup/
    elif [ $mode = "PUSHING" ]; then
      lockf -t 0 ${lockFile} /usr/local/bin/rsync -avu --ipv4 --stats --safe-links --password-file=/usr/local/etc/rsyncd.passwd_rsyncbot /home/srv/mybackup/ rsyncbot@1.2.3.4::mybackup
    fi

    ### checking the exit status of the previous command.
    if [ $? -eq 0 ]; then
      break
    fi

    runCount=`expr $runCount + 1`

    if [ $runCount -eq $runMax ]; then
      break
    fi

    ### retry after ten seconds.
    sleep 10
  done;

  date "+rsync update ends at %Y-%m-%d %H:%M:%S"
}

#umask 27

### pulling from remote files to local
runRsync "PULLING"

### pushing from local files to remote
runRsync "PUSHING"

echo '[DONE]'

Reference:
http://blog.ijun.org/2010/02/rsync-synchronizing-two-file-trees_19.html

xz is a lossless data compression program and file format

xz is a lossless data compression program and file format which incorporates the LZMA2 compression algorithm.

xz is essentially a stripped down version of the 7-Zip program, which uses its own file format rather than the .7z format used by 7-Zip which lacks support for Unix-like file system metadata.[2]

Compress the file foo into foo.xz using the default compression level (-6):
# xz -zk foo

Decompress bar.xz into bar and don't remove bar.xz after decompression:
# xz -dk bar.xz

Using xz with tar (compress):
# tar Jcvf foo.tar.xz /home/backup

Using xz with tar (decompress):
# tar Jxvf foo.tar.xz

Reference:
http://en.wikipedia.org/wiki/Xz

Friday, December 28, 2012

Given the following complex C declarations, what does each one mean? Also, what are some rules for reading complex C declarations?

Given the following complex C declarations, what does each one mean? Also, what are some rules for reading complex C declarations?

1.) int (*p)[ 5 ];   
2.) char *x[ 3 ][ 4 ];
3.) int *(*a[ 10 ])();
4.) int (*t[])();

C declarations can sometimes be quite complex to read and to understand. I remember sometimes getting a headache just looking at some of the C declarations in other people’s code until I realized that there is a rule that can translate the declarations into plain and simple English. Interviewers also love to test out the ability of candidates to break down and understand those declarations. The way to approach this problem is to use that general rule that will help you read any C declaration – otherwise, you can easily find yourself very confused. Here is a good rule to follow when trying to make sense of a C declaration:

A Rule for Reading Complex C Declarations

Start at the variable name, also known as the identifier. Without skipping a right parenthesis, look right and say what you see – even if you see nothing continue. Without skipping a left parenthesis look left again and say what you see. If you are currently inside a pair of parentheses, jump outside this level. Look right and say what you see. Look left and say what you see. Keep doing this until you say the variable type or return type.
An important note: you should always remember that functions and arrays are read left-to-right and have precedence over pointers, which are read right-to-left.
Before reading the answers, it is best to use the rule given, and try it out for yourself. For the first example, we start at p. We look right and there is a parenthesis, which we don’t want to skip until we look left. So we look left and get that p is a pointer. Now, we can jump outside the parentheses, and we look right and find an array of size of 5, so now we can add to our statement that p is a pointer to an array of size 5. Now, we look left and find the ‘int’, so we can finish our declaration by saying that p is "a pointer to an array of 5 ints".
For the second example, we start with x. We look right and find an array composed of 3 arrays of size 4. You may have been tempted to jump back left to the pointer after reading out "array of size 3", but you must note that arrays take precedence over pointers, so continuing on with the second array is important. So now we see that x is an array composed of 3 arrays of size 4, and the next step is to move left. We see a pointer, so now we can say that "x is an array composed of 3 arrays of 4 pointers to char".
For the last two examples, we’ll just be giving the answers, since you should be able to figure them out on your own now – try figuring them out on your own before reading any further. In the third example, a is "an array of 10 pointers to functions returning an int pointer". For the fourth example, t is "an array of pointers to functions returning an int".

Reference:
http://www.programmerinterview.com/index.php/c-cplusplus/c-declarations/