There is an IIS web server in my company network. I did use Chrome on my Windows machine to access that web site without providing my credentials. However, after I did some change some where, it has been asking me the user name and password since then.
Finally I figured out why. Chrome uses Windows "Internet options" for NTLM authentication. If you place the web site in "Trusted sites" and Chrome won't try NTLM authentication. Only the web site in "Local Intranet", Chrome will use NTLM authentication and you can access that site without credentials.
Wednesday, September 7, 2011
Transfer database connections between two Eclipse workspaces
I have two Eclipse workspace A and B, and created several database connections in workspace A. How can I get all those connections set up in workspace B without do it one by one?
- Go to workspaceA/.metadata/.plugins/org.eclipse.datatools.connectivity
- Copy ServerProfiles.bak and ServerProfiles.dat to workspaceB/.metadata/.plugins/org.eclipse.datatools.connectivity
- Restart Eclipse
JRuby Rails 3 render a file on a windows server
I want to render public/401.html if the user is not authorized to access the web site.
My environment is jruby 1.6, rails 3.0.5, and tomcat 7.0.11 on windows.
And I found the code from "JRuby cookbook"
PUBLIC_DIR = if defined?($servlet_context)
$servlet_context.getRealPath('/')
else
"#{RAILS_ROOT}" + '/public'
end
Unfortunately this code still didn't work, still got "Missing template".
The reason is windows path. PUBLIC_DIR will be "c:/tomcat/webapps/myapp" and the file is "c:/tomcat/webapps/myapp/401.html". When rails searches the view paths, it tries to add each item in view paths as a prefix of your file. One of the view paths is "c:/", then the path which rails tries to search looks like "c:/c:/tomcat/webapp/myapp/401.html". Of course, Rails cannot find the file.
$servlet_context.getRealPath('/').gsub(/^\w:/, "").gsub(/\\/, "/")
My environment is jruby 1.6, rails 3.0.5, and tomcat 7.0.11 on windows.
And I found the code from "JRuby cookbook"
PUBLIC_DIR = if defined?($servlet_context)
$servlet_context.getRealPath('/')
else
"#{RAILS_ROOT}" + '/public'
end
Unfortunately this code still didn't work, still got "Missing template".
The reason is windows path. PUBLIC_DIR will be "c:/tomcat/webapps/myapp" and the file is "c:/tomcat/webapps/myapp/401.html". When rails searches the view paths, it tries to add each item in view paths as a prefix of your file. One of the view paths is "c:/", then the path which rails tries to search looks like "c:/c:/tomcat/webapp/myapp/401.html". Of course, Rails cannot find the file.
$servlet_context.getRealPath('/').gsub(/^\w:/, "").gsub(/\\/, "/")
Friday, August 19, 2011
How to debug Pig UDFs in Eclipse?
It is not that hard as you think actually.
- Create a maven project using m2eclipse.
- Add org.apache.pig:pig as dependency.
- Click "Debug configurations ...".
- Create a "Java Application".
- Main class "org.apache.pig.Main".
- In Arguments tab, put "-x local" and other arugments in "Program arguments".
- In Environment tab, create a variable "PATH" as "${env_var:path};c:\cygwin\bin" if your OS is Windows.
- Debug your script, and Eclipse will stop at the breakpoint you set in UDF.
How to debug Hadoop MapReduce jobs in Eclipse.
It is actually very easy to debug Hadoop MapReduce jobs in Eclipse, especially when you use maven.
- Create a maven project using m2eclipse.
- Add org.apache.hadoop:hadoop-core as dependency.
- You can set breakpoint at any line in your code.
- Right-click your drive class, Debug As -> Java Application
- In arguments tab of launch configuration, put "-fs file:/// -jt local -Dmapred.local.dir=c:/temp/hadoop your_input_file c:/temp/hadoop/output" in "Program arguments"
- If you run on Windows, you have to use Cygwin because hadoop uses external shell command "chmod". In Environment tab, add environment variable PATH, value is ${env_var:path};c:\cygwin\bin. Then hadoop can find chmod.
- Click debug, you can debug your MapReduce code in eclipse. Hadoop is running in local mode.
Tuesday, August 16, 2011
If java is installed in c:\Program Files\Java\, it is headache to make Hadoop/Hive works. Hive reports an error like this:
/workplace/apps/hadoop-0.20.2-cdh3u1/bin/hadoop: line 300: /cygdrive/c/Program:
No such file or directory
Apparently the space in JAVA_HOME doesn't work.
I tried several solutions on the Internet, but none of them works. For example,
export JAVA_HOME=/cygdrive/c/Program\ Files/Java/jdk1.6.0_25
export JAVA_HOME=/cygdrive/c/"Program Files"/Java/jdk1.6.0_25
Here is how I solve this problem: create a soft link like this
ln -s /cygdrive/c/Program\ Files/Java/jdk1.6.0_25 /usr/java/default
and set JAVA_HOME in ${HADOOP_HOME}/conf/hadoop-env.sh like this
export JAVA_HOME=/usr/java/default
Friday, May 6, 2011
SyntaxHighlighter Vertical Scrollbar
SyntaxHighlighter 3.0.83 seems have annoying issue, there is always a vertical scrollbar which you can only scroll a little. I found a solution here http://xbfish.com/2011/04/26/remove-vertical-scrollbar-in-syntaxhighlighter/, but it doesn't work.
After several tries, I found that commenting line-height in shCore.css works
After several tries, I found that commenting line-height in shCore.css works
.syntaxhighlighter a,
.syntaxhighlighter div,
.syntaxhighlighter code,
.syntaxhighlighter table,
.syntaxhighlighter table td,
.syntaxhighlighter table tr,
.syntaxhighlighter table tbody,
.syntaxhighlighter table thead,
.syntaxhighlighter table caption,
.syntaxhighlighter textarea {
-moz-border-radius: 0 0 0 0 !important;
-webkit-border-radius: 0 0 0 0 !important;
background: none !important;
border: 0 !important;
bottom: auto !important;
float: none !important;
height: auto !important;
left: auto !important;
// line-height: 1.5em !important;
Subscribe to:
Posts (Atom)