This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void setNumMappers(int numNodes) { | |
String mapred_side_xml_path = "/opt/hadoop-2.3.0-cdh5.0.1/etc/hadoop/mapred-site.xml"; | |
try { | |
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); | |
domFactory.setIgnoringComments(true); | |
DocumentBuilder builder = domFactory.newDocumentBuilder(); | |
Document doc = builder.parse(new File(mapred_side_xml_path)); | |
NodeList nodes = doc.getElementsByTagName("configuration"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What is web Session? | |
-------------------- | |
- An abstract concept to represent a series of HTTP requests and responses | |
between a specific web browser and server. HTTP doesn't support the | |
notion of a session. | |
- A session's data is stored on the server (only 1 session per client) | |
- Sessions are often built on top of cookies. | |
- The only data the client stores is a cookie holding a unique session ID | |
- And on each page request, the client sends its session ID cookie, and the | |
server uses this to find and retrieve the client's session data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get remove protobuf-compiler | |
sudo ldconfig | |
sudo apt-get install g++ | |
g++ --version | |
wget http://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz | |
tar xzf protobuf-2.5.0.tar.gz | |
cd protobuf-2.5.0 | |
./configure | |
make | |
sudo make install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First make java jar containing your all code. | |
Then got to terminal | |
$ cd project_root_dir/target | |
$ java -cp ./jar_file.jar com.main_class_name param_to_main_class [if jar doesn't contain manifest file] | |
$ java -jar jar_file.jar [if jar contains manifest file] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage() | |
{ | |
cat << EOF | |
usage: $0 options | |
This script can download 64 or 65 version centos. | |
OPTIONS: | |
-h Show the help and exit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
............... | |
.................. | |
#### Function to find and replace a text inside file using bash | |
updateLateCommandURLInPreseedFile(){ | |
echo "[INFO]:: Updating late command url in pressed.cfg file**************" | |
echo "" | |
cat preseed.cfg | sed 's_${IPADDR}_'"$IP"'_g' > temp.cfg | |
cat temp.cfg > preseed.cfg | |
rm temp.cfg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# 's_\^\*~_\n_g' is the line delimiter in input file replace with yours | |
sed 's_\^\*~_\n_g'| wc -l |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hk.prime; | |
import java.util.Scanner; | |
public class First100Prime { | |
int flag; | |
int first; | |
public First100Prime() { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.test; | |
import java.awt.Color; | |
import java.io.FileNotFoundException; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.net.MalformedURLException; | |
import com.lowagie.text.Chunk; | |
import com.lowagie.text.Document; | |
import com.lowagie.text.DocumentException; |