Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 PROGRAMMING


  If programming language is a knife, what would it be?

The following diagram shows that if is a programming language is a knife, what would it be.? This figure I personally feel very interesting.I try to give my  explanation for some languages  here:.C + +, C and Pascal are the Swiss Army knife. The knife of the C language has a USB, that can do hardware operation. C++, a knife with everything, C + + is a variety of languages​​. Swiss army knife (figure C+ + is very powerful, do not think that it is fictional, this knife is real, called Wenger a giant knife, http://www.wenger.ch/giant-knife-wenger-swiss- army-knife Java / C...

25,332 2       PROGRAMMING LANGUAGE KNIFE SWISS ARMY LIFE


  Generating CSR using Java

A CSR(Certificate Signing Request) is a kind of request generated by an application and is to be sent to a Certificate Authority to create a signed certificate which can be distributed. It usually contains certificate information such as subject name, public key info and signature info.In Java, keytool can be used to generate a certificate request with option -certreq.  But sometimes if an application wants to create a CSR programmatically, keytool will not do a favor, instead you should use APIs provided by Java to generate CSRs.Basically the steps to generate a CSR are :Get the key...

25,209 0       JAVA SECURITY CSR CERTIFICATE REQUEST


  The tic-tac-toe game with Python

In this tutorial, we will show how to build a tic-tac-toe game with Python. We will use functions,arrays,if statements,while statements, for loops and error handling etc.First, we need to create two functions, the first function will display the borad of the game:def print_board(): for i in range(0,3): for j in range(0,3): print map[2-i][j], if j != 2: print "|", print ""Here we used two for loops to loop through the map, this map is a two dimensional array which contains the location information.The board looks like: | | | | |...

25,004 1       PYTHON TIC-TAC-TOE


  JShell -- The command line tool to run Java code in Java 9

Java 9 is currently a work-in-progress and is planned to be GAed in March 2017. Quite a few new features will be introduced in the new release. The coolest feature is project Jigsaw which is to modularize the Java packages so that a customized JDK can be built and shipped with only the necessary modules to fulfill their project requirement. Apart from this feature, another big new feature is project Kulla -- JShell.In simple, JShell is a command line tool which can be used to run Java code snippet without wrapping them into classes. It is similar to tools for other languages suc...

24,508 8       JAVA 9 JSHELL KULLA


  Maybe we need //Comment comment

Do we need comment in our programs? Depends, if we can write a program which can clearly tell s the reader what the program does, then we had better to avoid unnecessary comments. However, if the program we develop is complex enough and it involves some uncommon logic which needs more explanation, then we have to add comment and make sure the comment we add can correctly tell the readers what we do.The worst scenarios is not you forget or you don't want to add comment, it's that you add comment but the comment you add is wrong or may diverge the readers to think something else. We don't want t...

24,399 1       PROGRAMMING COMMENT


  Different types of keystore in Java -- PKCS11

PKCS11 keystore is designed for hardware storage modules(HSM). It's an interface to talk to the HSMs. It doesn't actually store any keys but provide a set of classes to communicate with the underlying HSM. The actual keys and certificates are stored on the HSMs.The reason for storing the keys and materials is to ensure security and efficiency. Since the keys are on the HSMs, they are safe to be stolen. All encryption/decryption operations are performed on the HSMs as well, this increase the processing speed. They are frequently used in applications requiring high speed and extra sec...

24,141 2       JAVA KEYSTORE PKCS11 HSM


  Using Java keytool programmatically

Java provides a command line tool to access and operate different keystore which store keys and certificates. This tool is named keytool and is located at \bin. On command line, you can issue below command to generate a keystore named mytest.jks which contains a private key and certificate chain.keytool -genkeypair -alias mykey -keyalg RSA -sigalg SHA256withRSA -dname CN=Java -storetype JKS -keypass password -keystore mytest.jks -storepass passwordSometimes, in testing purpose, we may want to issue these command in our applications instead of start a command line terminal. This is...

23,877 14       JAVA KEYTOOL


  Traditional recursion vs Tail recursion

Recursion is a frequently adopted pattern for solving some sort of algorithm problems which need to divide and conquer a big issue and solve the smaller but the same issue first. For example, calculating fibonacci  accumulating sum and calculating factorials.In these kinds of issues, recursion is more straightforward than their loop counterpart. Furthermore, recursion may need less code and looks more concise.For example, let's calculate sum of a set of numbers starting with 0 and stopping at N where N might be a large number. The loop way is quite simple for this issue.private stati...

23,608 5       ALGORITHM RECURSION TAIL RECURSION TRADITIONAL RECURSION