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

 PROGRAMMING


  What does super.clone() do?

Object class has a protected clone() method declared to make it possible for all classes make a clone of itself when needed. The clone() is often used when a new instance of the class is needed while at the same time to maintain the same state as the original object. Any class which wants to have clone enabled has to implement the marker interface Cloneable.If a class which implements Cloneable doesn't override the Object.clone() method, the Object.clone() method will be called to just make a binary copy of the original, which amounts to a shallow clone, with all the referenced objects staying...

29,010 0       JAVA CLONEABLE SUPER.CLONE() CLONE


  20 bit operations programmers should know

While talking about bit operation, programmers usually think about its efficiency. In embedded programming and system core optimization, appropriate use of bit operations is always a fascinating. When finding a job, it will help you a lot if you use bit operations when writing codes. Mastering simple bit arithmetic skills is necessary.1. Get maximum int valueint getMaxInt(){          return (1 << 31) - 1;//2147483647,   }  Another way:int getMaxInt(){     &nbs...

27,932 6       TIPS BIT OPERATION


  Save QWidget as image

Qt library is an excellent GUI library for C++ programmers developed by Nokia and now is an open source project. Often, we may use QPainter to draw strings, lines or images on a QWidget. We can override the QWidget's paintEvent() method when we want to use QPianter object to draw something on a QWidget.If we want to save the items drawn on QWidget as image for later reference, what can we do? We can save a QWidget as an image. Here is the code for achieving this:QPixmap pixmap(this->size());this->render(&pixmap);pixmap.save("test.png");Quite simple, right? Yes, these are all the code...

27,091 1       C++ IMAGE QT QWIDGET


  Set file permission in Java

Prior to Java 6,  there is no good solution at the Java level to provide file permission management. You need to implement your own native methods or call the Runtime.exec() to invoke the system routine such as chmod in LInux. Since Java 6, Java introduces a set of methods which can be used to set the file permission at Java level. These methods include:File.setReadable(boolean);File.setWritable(boolean);FIle.setExecutable(boolean);File.setReadable(boolean, boolean);File.setWritable(boolean, boolean);FIle.setExecutable(boolean, boolean);Here File.setReadable(boolean, true) is the same as ...

26,962 0       JAVA FILE PERMISSION POSIX LEARNJAVA


  Google Dart? Don’t bet against JavaScript

Procotols, programming languages and operating systems all compete in a constantly evolving software ecosystem. Out of that ecosystem only a few technologies truly have staying power and survive over the long term. An example? How about Ethernet? It’s been a survivor over the last thirty years despite existing in a constantly changing landscape that’s been populated with many worthy competitors. Ethernet’s grasp has been so strong, there even an informal law, known as Metcalfe’s second law, that says “nev...

26,611 0       GOOGLE DART JAVASCRIPT COMPARISON FUTURE


  Run executable jar on double click on Windows

Normally after installing Java, there will be an association between .jar and the javaw.exe. This enables the executable jar to be opened on double click. You can check the association by going to Control Panel -> Programs -> Default Programs -> Associate a file type or protocol with a program.The default program of a file type can be changed in this dialog. However sometimes there are cases where the file association for .jar may be altered after a third party application installed. The executable jar may not be able to be started normally post that and it still doesn't work eve...

26,065 3       JAVA WINDOWS JAR EXECUTABLE JAR


  The difference between System.load and System.loadLibrary in Java

When writing code using native library in Java, normally the first step is loading some native library.static{  System.load("D:" + File.separator + "Hello.dll");}JDK provides two ways to load libraries:System.load(String filename)System.loadLibrary(String libname)This post will try to explain the differences of these two ways.According to Java Doc on System.load(), it has below description.Loads the native library specified by the filename argument. The filename argument must be an absolute path name.The parameter of this method should be an absolute file path with the exten...

25,780 1       SYSTEM.LOADLIBRARY SYSTEM.LOAD JAVA JNI NATIVE


  Add compiler argument to build Maven project

Maven is a software project to manage a project's build, reporting and documentation from a central piece of information. It's now widely used t build and deploy projects. It can help automatically maintain the dependencies of projects. There is a central project configuration file named pom.xml. Here you can configure the project you want to build. In this post, we will show you how to add compiler argument when using javac to compile Java source code. Sometimes we need to pass compiler arguments when we compile source code, for example, we may want to specify the -source and -targe...

25,596 1       MAVEN COMPILER ARGUMENT COMPILER OPTION JAVA 8