Python is one of the most popular programming languages in the world. It is widely popular for a plethora of tasks due to its flexible nature and ease of use. Python has also managed to beat other programming languages such as Java, which were once upon a time, the world’s favorite. In fact, the extent
Read more
Tag: java
The cultural impact of cloud technology
Posted onCloud technology is one of the latest forms of technology. A cloud is a place where exactly the data is stored. Also, the cloud is the place where the data is managed and processed. Cloud ensures that the data managed on a cluster or the network of servers. All of these servers are available remotely
Read more
What can we expect in Java update 2019?
Posted onJava is the most regularly used programming language for the creation of web applications. This high-level programming language develops by the Sun Micro-system. This language was designed for use in the world of internet and known for fastest, secure, and most reliable language of the computing platform. One interesting fact is that Java programmers are
Read more
How to make Vim indent C++11 lambdas correctly?
Posted onVim seems not indent C++11 lambas very well. How to make Vim indent C++11 lambdas correctly? For this following program, Vim indents it as #include <iostream> #include <string> #include <vector> #include <algorithm> int main () { std::vector<std::string> strs({“one”, “two”}); std::vector<std::string> newstrs; std::transform(strs.begin(), strs.end(), std::back_inserter(newstrs), [](const std::string& s) -> std::string { if (s == “one”) {
Read more
How to force a checkpointing of metadata in HDFS?
Posted onHDFS SecondaraNameNode log shows 2017-08-06 10:54:14,488 ERROR org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: Exception in doCheckpoint java.io.IOException: Inconsistent checkpoint fields. LV = -63 namespaceID = 1920275013 cTime = 0 ; clusterId = CID-f38880ba-3415-4277-8abf-b5c2848b7a63 ; blockpoolId = BP-578888813-10.6.1.2-1497278556180. Expecting respectively: -63; 263120692; 0; CID-d22222fd-e28a-4b2d-bd2a-f60e1f0ad1b1; BP-622207878-10.6.1.2-1497242227638. at org.apache.hadoop.hdfs.server.namenode.CheckpointSignature.validateStorageInfo(CheckpointSignature.java:134) at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.doCheckpoint(SecondaryNameNode.java:531) at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.doWork(SecondaryNameNode.java:395) at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode$1.run(SecondaryNameNode.java:361) at org.apache.hadoop.security.SecurityUtil.doAsLoginUserOrFatal(SecurityUtil.java:415) at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.run(SecondaryNameNode.java:357) It seems the checkpoint
Read more
How to print a line to STDERR and STDOUT in Java?
Posted onIn Java, how to print a string as a line to STDOUT? That is, the string and the newline character, nicely? And similarly, how to print the line to STDERR? In Java, you can print string in a new line by ‘System.out.println()’ to STDOUT: System.out.println(“my msg here”); In Java, print a string str to STDERR
Read more
How to get the epoch timestamp in Java?
Posted onIn Java, how to get the epoch timestamp, the number of seconds passed since the epoch? In Java, you can get the current time in milliseconds and then calculate the epoch time: long ts = System.currentTimeMillis()/1000; Example: $ wget –quiet https://github.com/albertlatacz/java-repl/releases/download/428/javarepl-428.jar -O /tmp/javarepo-428.jar && java -jar /tmp/javarepo-428.jar Welcome to JavaREPL version 428 (Java HotSpot(TM) 64-Bit
Read more
How to get an environment variable in Java?
Posted onIn Java, how to get the value (string) of an environment variable? You may call the System.getenv(name) library function in Java to get the environment variable value. public static String getenv(String name) Parameters: name – the name of the environment variable Returns: the string value of the variable, or null if the variable is not
Read more
Any good Java REPL tool/implementation?
Posted onAny good suggestions on a Java REPL implementation like ‘scala’ and ‘python’ or ‘php -a’? The java-repl tool https://github.com/albertlatacz/java-repl/ works nicely for most situations for me. It is released as a .jar. Hence, it is easy to download and run: $ wget –quiet https://github.com/albertlatacz/java-repl/releases/download/428/javarepl-428.jar -O /tmp/javarepo-428.jar && java -jar /tmp/javarepo-428.jar One usage example is as
Read more
How to manually kill HDFS DataNodes?
Posted onstop-dfs.sh report that there are no datanodes running on some nodes like hdfs-node-000208: no datanode to stop However, there are DataNode process running there. How to clean these processes on many (100s) of nodes? You may use this piece of bash script: for i in `cat hadoop/etc/hadoop/slaves`; do echo $i; ssh $i ‘jps | grep
Read more
how to skip mapper function in hadoop
Posted onIn hadoop I need to skip mapper function and directly execute the reducer function. We doing this to improve hadoop performance, if the hadoop framework is used to analyze same data sets, then mapper’s output will be same for different kind of jobs. To save the redundant computation for same results, I am planning to
Read more
if (p:string list) = c (is the only element)
Posted onif (p:string list) = [c] then (divide p1 c) showing unbound value c. i want to equalise (if one element in p which is (c:anything)) and use that variable let p = [“ocaml”] let f s = match s with | [c] -> print_endline c | _ -> print_endline “ops” f p It will print:
Read more
Making Hadoop Java process heap larger?
Posted onIn Hadoop 2.5.0, I use ‘ps -aux’ and find the Java process has options: -Xmx1000m However, my nodes have 32GB memory. How to make Hadoop Java process heap larger? In yarn-env.sh, you can find: # For setting YARN specific HEAP sizes please use this # Parameter and set appropriately # YARN_HEAPSIZE=1000 In hadoop-env.sh, you can
Read more
How to import a googlecode git project to github project
Posted onI wanna migrate leveldb (code.google.com/p/leveldb) to my github repository. Create a new repo on github.com with this link https://help.github.com/articles/creating-a-new-repository git clone https://code.google.com/p/ project-name.git Set the remote origin url as follows: git remote set-url origin https://github.com/ username/ repo-name.git git pull to pull the latest. git push origin master after making local changes. This is the original
Read more
How to package a Scala project to a .jar with sbt?
Posted onHow to package a Scala project to a .jar file with sbt? Manually packaging the .class files are fine but too tedious. A jar of just the project classes The command: sbt package will produces the main artifact as a jar into target/scala-2.x.y/project_name_2.x.y-zz.jar. Continuously building the package: sbt ~package Standalone jar with all dependencies If
Read more
How to set up the Java environment in Linux?
Posted onI am using Fedora 20. I installed the rpm from Oracle for the Oracle JDK. How to set up the environment so that the Java environment is Oracle JDK instead of the OpenJDK? The Oracle JDK is install to /usr/java/ directory. On my Fedora 20, it looks like this: $ ls /usr/java -l total 4
Read more
How to install JRE for Chrome on Linux x86-64
Posted onHow to install JRE for Chrome on Linux x86-64? Use JRE from Oracle on Fedora Linux x86-64 as the example: Download jre from http://java.com/en/download/manual.jsp?locale=en#lin . Select Linux x64. Install it by # yum install jre-7u40-linux-x64.rpm (the downloaded rpm). Make a softlink of the plugin:$ cd ~/.mozilla/plugins/; ln -s /usr/java/jre1.7.0_40/lib/amd64/libnpjp2.so ./ Restart Chrome and browse chrome://plugins/
Read more
How to install Scala on Fedora Linux
Posted onThis tutorial introduces how to install Scala 2.9.2 on 64-bit Fedora Linux 17. There are some changes needed to make scala work on Fedora Linux 17. Please check it out in the answer. Install Java Scala depends on Java, so please install Java first. In this tutorial, we installed JDK to: /usr/java/jdk1.6.0_24/lib/. Install Scala from
Read more
How to install Scala from the official Scala distribution
Posted onHow to install Scala from the official Scala distribution? This is needed on a Linux release with older version of Scala in the repository, e.g. Fedora 12. Use the install-scala.sh script: # wget https://raw2.github.com/zma/usefulscripts/master/script/install-scala.sh # sh ./install-scala.sh VER where VER is the scala version that you want to install. First step, install and configure the
Read more
How to Implement Hibernate Envers in an Application
Posted onTechnology Hibernate Envers is the frameworks for auditing entities. As the name suggests Hibernate Envers is developed on top of Hibernate, it will on Hibernate and Hibernate implemented JPA. Hibernate Envers provides easy auditing, versioning solution for entity classes. Advantages of Hibernate Envers: Auditing of all mappings defined by JPA specification. Auditing Hibernate specific mappings
Read more