Right now, there's no GUI interface for doing this. You need to start Chrome with the following flags:
--proxy-server="socks5://127.0.0.1:1080" --host-resolver-rules="MAP * 127.0.0.1"
Monday, September 16, 2013
Wednesday, December 12, 2012
Compile octave
Latest version of octave needs texinfo and newer version of gcc.
1. Install gcc 4.7.1. gcc needs additional 3 components which have to be downloaded separatedly:
unzip and copy them to gmp mpfr and
mpc or gcc-4.7.1 source dir
mkdir ~/gcc-4.7.1
cd ~/gcc-4.7.1
~/downloads/gcc-4.7.1/configure --enable-languages=all
make
sudo make install
2. Install texinfo
./configure
make
sudo make install
3. Install blas and lapack. On my environment, this is done by:
yum install blas
yum install lapack
And for me, I have to manually create a sym link libblas.so and liblapack.so as octave configuration cannot find the versioned so.
sudo ln -s libblas.so.3.0.3 /usr/lib64/libblas.so
sudo ln -s liblapack.so.3.0.3 /usr/lib64/liblapack.so
4. Install gnuplot-4.4
5. Install octave
cd octave-3.6.2
LD_RUN_PATH=/usr/local/lib64 LDFLAGS=-L/usr/local/lib64 ./configure --without-curl
LD_RUN_PATH=/usr/local/lib64 make
-j 8
You may need to use different directories other than /usr/local/lib64 depending on where your blas/lapack/gfortran libraries are located. If error happens, look at config.log to get more detail.
Wednesday, October 10, 2012
Creating and inserting into bucketed table
The clause for bucketing is:
[CLUSTERED BY (col_name, col_name, ...) [SORTED BY (col_name [ASC|DESC], ...)] INTO num_buckets BUCKETS]
The CLUSTERED BY and SORTED BY creation commands do not affect how data is inserted into a table – only how it is read. This means that users must be careful to insert data correctly by specifying the number of reducers to be equal to the number of buckets, and using CLUSTER BY and SORT BY commands in their query.
According to https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL+BucketedTables, with hive.enforce.bucketing=true, we don't need CLUSTER BY clause in the insert query. This is NOT correct. We still need CLUSTER BY in insert query.
What hive.enforce.bucketing does is "DISTRIBUTE BY". In order to do sorting automatically, we need "hive.enforce.sorting=true" or have CLUSTER BY in the insert query.
So what "CLUSTERED BY" in the table definition means is "DISTRIBUTE BY" and hive.enforce.bucketing only enforces "DISTRIBUTE BY".
Wednesday, October 03, 2012
Memory units
Different units for size are used in different contexts.
context unit
ps 1024 bytes
cat /proc/meminfo 1024 bytes
free 1024 bytes
du 1024 bytes
ls -l 1 byte
context unit
ps 1024 bytes
cat /proc/meminfo 1024 bytes
free 1024 bytes
du 1024 bytes
ls -l 1 byte
Wednesday, July 06, 2011
compile mpich2
If you are using gcc version >= 4.3 to compile mpich2-1.3, which can be downloaded from http://www.mcs.anl.gov/research/projects/mpich2, you are likely to get tons of multiple definition errors. It took me quite a while to figure out the reason and the solution. This is caused by the --std=gnu99 used in hwloc. But using gnu99 will change the meaning of "extern inline" used in many c header files as explained in http://gcc.gnu.org/gcc-4.3/porting_to.html. Knowing this, the solution is quite simple: using the following command to configure:
CFLAGS=-fgnu89-inline ./configure
CFLAGS=-fgnu89-inline ./configure
Wednesday, April 13, 2011
Effective alternative minimum tax bracket
2010 AMT bracket for the alternative minimum taxable income (AMT income)
assumming no qualified dividend or long term capital gain.
The strange thing is that the tax rate decreases for high AMT income. This is due to the fact that the "Exemption Amount" (Form 6251 line 29) is reduced when the AMT income is between 150,000 and 439,800.
References:
Form 6251
Form 6251 Instruction
assumming no qualified dividend or long term capital gain.
| from | to | bracket |
| 0 | 72,450 | 0 |
| 72,450 | 150,000 | 0.26 |
| 150,000 | 227,960 | 0.325 |
| 227,960 | 439,800 | 0.35 |
| 439,800 | above | 0.28 |
The strange thing is that the tax rate decreases for high AMT income. This is due to the fact that the "Exemption Amount" (Form 6251 line 29) is reduced when the AMT income is between 150,000 and 439,800.
References:
Form 6251
Form 6251 Instruction
Friday, May 28, 2010
rogue virus leading to antispy-guide.net
My wife's computer was infected by a rogue virus. It's constantly asking to buy anti-virus software from antispy-guide.net. And it blocked the execution of other program by saying they are infected.
The only exception is browser. You can still open a browser. Apparently, they don't want to block the way so that the infected user can purchase their software.
Here is how I dealt with it:
In explorer, copy \windows\system32\taskmgr.exe to some other place. Then rename it as firefox.exe and run it. Now the task manager appears. In the task manager find and kill a process with a very strange name which unfortunately I forgot what exactly it is. And I also deleted the corresponding .exe file from the file system.
Now everything is back to normal. I am not sure this is a permanent fix. But so far so good.
Thursday, April 22, 2010
Increase limit on RLIMIT_NOFILE or other resources
Use setrlimit() to change the soft limit. But there is a hard limit which the setrlimit can not increase beyond.
In order to change the hard limit, you need to change the setting in following file
/etc/security/limits.conf
The syntax of the lines is as follows:
[domain] [type] [item] [value]
Use man limits.conf to see detailed explanation.
In order to change the hard limit, you need to change the setting in following file
/etc/security/limits.conf
The syntax of the lines is as follows:
[domain] [type] [item] [value]
Use man limits.conf to see detailed explanation.
You can use command 'lsof -p [pid]' to see files opened by process pid.
Install Gnome On centos machine
Citing from
http://wiki.centos.org/FAQ/CentOS5#head-e99a7921ab6ce47e1cbf7d8cc8cadecf92b7ce94
yum --exclude=nautilus-sendto groupinstall "GNOME Desktop Environment"
http://wiki.centos.org/FAQ/CentOS5#head-e99a7921ab6ce47e1cbf7d8cc8cadecf92b7ce94
yum --exclude=nautilus-sendto groupinstall "GNOME Desktop Environment"
Friday, February 12, 2010
NX broken session
If the remote server is restarted during an NX session, then you will encounter error when establishing a new session. You need to go to /usr/NX/var/db/running and delete files in the directory.
Friday, January 29, 2010
Passing Special Characters to Commands
Citing from The Linux Cookbook: Tips and Techniques for Everyday Use
Some characters are reserved and have special meaning to the shell on their own. Before you can pass one of these characters to a command, you must quote it by enclosing the entire argument in single quotes (`'').
For example, here's how to pass `Please Stop!' to a command:
'Please Stop!'
When the argument you want to pass has one or more single quote characters in it, enclose it in double quotes, like so:
"Please Don't Stop!"
To pass special characters as a string, give them as:
$'string'
where string is the string of characters to be passed. Special backslash escape sequences for certain characters are commonly included in a string, as listed in the following table.
ESCAPE SEQUENCE DESCRIPTION
\a Alert (rings the system bell).
\b Backspace.
\e Escape.
\f Form feed.
\n Newline.
\r Carriage return.
\t Horizontal tab.
\v Vertical tab.
\\ Backslash.
\NNN Character whose ASCII code is NNN in octal (base 8).
To demonstrate the passing of special character sequences to tool, the following examples will use the figlet tool, which displays the text you give as an argument in a "font" made up of text characters (see Horizontal Text Fonts).
To pass a backslash character as an argument to figlet, type:
$ figlet $'\\' [RET]
To pass a form feed character followed by a pilcrow sign character (octal character code 266) to figlet, type:
$ echo $'\f\266' [RET]
Some characters are reserved and have special meaning to the shell on their own. Before you can pass one of these characters to a command, you must quote it by enclosing the entire argument in single quotes (`'').
For example, here's how to pass `Please Stop!' to a command:
'Please Stop!'
When the argument you want to pass has one or more single quote characters in it, enclose it in double quotes, like so:
"Please Don't Stop!"
To pass special characters as a string, give them as:
$'string'
where string is the string of characters to be passed. Special backslash escape sequences for certain characters are commonly included in a string, as listed in the following table.
ESCAPE SEQUENCE DESCRIPTION
\a Alert (rings the system bell).
\b Backspace.
\e Escape.
\f Form feed.
\n Newline.
\r Carriage return.
\t Horizontal tab.
\v Vertical tab.
\\ Backslash.
\NNN Character whose ASCII code is NNN in octal (base 8).
To demonstrate the passing of special character sequences to tool, the following examples will use the figlet tool, which displays the text you give as an argument in a "font" made up of text characters (see Horizontal Text Fonts).
To pass a backslash character as an argument to figlet, type:
$ figlet $'\\' [RET]
To pass a form feed character followed by a pilcrow sign character (octal character code 266) to figlet, type:
$ echo $'\f\266' [RET]
Wednesday, April 08, 2009
Binary numerical file IO in PERL
#following is a simple example
open FP, '>a.bin';
binmode FP; #make it binary file
@values=(3.2,3.3,3.4); #list of floating values
$a=pack 'f3' , @values; #pack as 32bit floating point value
#use 'd' for 64bit floating point
syswrite(FP,$a,12); #save to file
close FP;
open FP, '>a.bin';
binmode FP; #make it binary file
@values=(3.2,3.3,3.4); #list of floating values
$a=pack 'f3' , @values; #pack as 32bit floating point value
#use 'd' for 64bit floating point
syswrite(FP,$a,12); #save to file
close FP;
Tuesday, February 17, 2009
US Government Balance
Federal Reserve balance sheet: http://www.federalreserve.gov/releases/h41/current/h41.htm
US Treasury Monthly Statement: http://www.fms.treas.gov/mts/
US Treasury Monthly Statement: http://www.fms.treas.gov/mts/
Tuesday, August 05, 2008
Styling form file input
Due to certain security considerations, it is very difficult to change the style of file input.
Here is a good post on how to do it.
http://www.quirksmode.org/dom/inputfile.html
Following is quoted from above article:
Here is a good post on how to do it.
http://www.quirksmode.org/dom/inputfile.html
Following is quoted from above article:
- Take a normal < type="file">
- To this same parent element, add a normal <> and an image, which have the correct styles. Position these elements absolutely, so that they occupy the same place as the < type="file">.
- Set the z-index of the < type="file"> to 2 so that it lies on top of the styled input/image.
- Finally, set the opacity of the < type="file"> to 0. The < type="file"> now becomes effectively invisible, and the styles input/image shines through, but you can still click on the "Browse" button. If the button is positioned on top of the image, the user appears to click on the image and gets the normal file selection window.
(Note that you can't use visibility: hidden, because a truly invisible element is unclickable, too, and we need the < type="file"> to remain clickable) - When the user has selected a file, the visible, fake input field should show the correct path to this file, as a normal < type="file"> would. It's simply a matter of copying the new value of the < type="file"> to the fake input field, but we need JavaScript to do this.
Linking with static runtime libraries with MFC
In Visual C++, due to some conflicts between libcmt.lib and nafxcw.lib, you need to
make following changes in Linker->Input
Additional Dependencies: nafxcw.lib libcmt.lib
Ignore specific libraries: libcmt.lib nafxcw.lib
make following changes in Linker->Input
Additional Dependencies: nafxcw.lib libcmt.lib
Ignore specific libraries: libcmt.lib nafxcw.lib
Wednesday, May 28, 2008
Using C99 support in Intel Compiler
C99 only works for C. Not C++. So the code must be compiled as C code not C++ code.
Thursday, April 24, 2008
javascript variable scope
The scope of a variable is the current function or, for variables declared outside a function, the current application.
Aassigning a value to an undeclared variable implicitly declares it as a global variable.
Each function is associated with its closure chain
A variable is undefined if cannot be found in the current closure chain,
and the access attemp will generate error.
The global function 'eval' uses current closure chain to evaluate the string.
If a function is still accessible, its function closure chain is still in memory.
Aassigning a value to an undeclared variable implicitly declares it as a global variable.
Each function is associated with its closure chain
A variable is undefined if cannot be found in the current closure chain,
and the access attemp will generate error.
The global function 'eval' uses current closure chain to evaluate the string.
If a function is still accessible, its function closure chain is still in memory.
Tuesday, April 22, 2008
Image flicker in IE6
This is due to IE 6 keeps check for the background image specified in css property everty time the element is moved over. Note that IE 5 or IE 7 do not have this problem.
A good post about this problem is at http://www.mister-pixel.com/
The solution is to add following javascript code inside the HEAD of the page:
try {
document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
This fix works only with Internet Explorer 6, Service Pack 1 or newer.
Also, the fix does not apply if you change the background image on :hover. It only prevents the flicker of the same background image, when changing other rules inside the :hover state. But you can still change the background position.
A good post about this problem is at http://www.mister-pixel.com/
The solution is to add following javascript code inside the HEAD of the page:
try {
document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
This fix works only with Internet Explorer 6, Service Pack 1 or newer.
Also, the fix does not apply if you change the background image on :hover. It only prevents the flicker of the same background image, when changing other rules inside the :hover state. But you can still change the background position.
Thursday, September 13, 2007
Save file using different extensions in MS Word
Usually, MS Word will append a fixed extension for a given file type. If you want to use a different extension, you need to enclose the file name in quotes. For example, "textfile.dat" will force MS Word to use dat as extension.
Open a file by drag-and-drop in MS Word
Unlike many other editors, for MSWord, the file should be dropped in the menu area.
It should not be dropped in document area. If it's dropped in document area,
it will become an embedded file.
It should not be dropped in document area. If it's dropped in document area,
it will become an embedded file.
Subscribe to:
Posts (Atom)