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

SEARCH KEYWORD -- implementation



  Why can System.out.println be used to exit while loop

Let's first take a look at one simple Java thread code snippet which is supposed to exit the while loop after the first loop run. public class StopThread { private static boolean stopRequested; public static void main(String[] args) throws InterruptedException { Thread backgroundThread = new Thread(new Runnable() { @Override public void run() { int i = 0; while (!stopRequested) { i++; } } }); backgroundThread.start(); TimeUnit.SECONDS.sleep(1); stopRequested = true; } } But the tr...

   JAVA,THREAD,VOLATILE     2018-12-21 19:25:54

  Strangest line of python you have ever seen

The other day @HairyFotr and @zidarsk8 were doing some codegolfing with implementations of nondeterministic finite state machineand asked me to blog their results.For those of us who often forget what all of this computer science mumbo jumbo means, here’s a quick explanation from wikipedia:In the theory of computation, a nondeterministic finite state machine or nondeterministic finite automaton (NFA) is a finite state machin...

   Python,Strange,Research,Work rationale     2011-11-19 02:05:03

  Can two new objects point to the same memory address in GoLang?

Do you have any idea what the output will be for below GoLang snippet? package main import ( "fmt" ) type obj struct{} func main() { a := &obj{} fmt.Printf("%p\n", a) c := &obj{} fmt.Printf("%p\n", c) fmt.Println(a == c) } Many people would think that a and c are two different object instances which have different memory addresses. Hence a == c will be false. But if you try to run the above program, you would see below output 0x5781c8 0x5781c8 true To get to know the reason wh...

   GO,GOLANG,VARIABLE ESCAPE,ZEROBASE     2019-04-06 01:19:52

  Benefits and Drawback of a Layered Architecture

Most enterprises today are application centric. But the problem with the application is that their database schemas, user interfaces, programming interfaces and object models are tightly coupled and difficult to change. If you want to add a new field to a database table and you’re lucky, the change will reflect through the entire system. But often the change needs to be replicated manually across the entire system. And as applications are difficult to change, adding business rules or proce...

   JAVA, PROGRAMMING,WEB DEVELOPMENT,ENTERPRISE APPLICATION     2017-05-04 08:19:34

  Remote execute command in Java example

Frequently there is a need to logon to a remote system and run some commands or programs to get the output, many software can serve this purpose such as putty and gitshell.These software usually provide secure access to the remote system. But have you ever wondered what to do if you need to run commands on many different systems at the same time and get all these results back at a single place? Especially in big data era, many tasks may run on different distributed systems and you want o have a ...

   JSch, Example, Distributed system, SSH2     2014-12-12 03:20:19

  Scala Macros

This is the home page of project Kepler, an ongoing effort towards bringing compile-time metaprogramming to Scala. Our flavor of macros is reminiscent of Lisp macros, adapted to incorporate type safety and rich syntax. Unlike infamous C/C++ preprocessor macros, Scala macros: 1) are written in full-fledged Scala, 2) work with expression trees, not with raw strings, 3) cannot change syntax of Scala. You can learn more about our vision of metaprogramming from our talks. We propose to enrich Scala ...

   Scala,Macro,Efficiency,Maintainebility     2012-02-01 00:12:15

  Prototypes and Object Orientation

David Chisnall takes a look at the two dominant paradigms in object-oriented languages (classes and prototypes) and discusses the strengths and weaknesses of each.Two terms are quite often confused when describing programming languages:class-based and object-oriented:Simula was the first class-based language. It provided classes (actually implemented using closures) as a means of encapsulating abstract data types.Smalltalk was the first object-oriented language. It provided a...

   Prototype,OOP,Differential,Comparison,Mo     2011-09-02 11:51:26

  Why Python is important for you

I believe that Python is important for software development. While there are more powerful languages (e.g. Lisp), faster languages (e.g. C), more used languages (e.g. Java), and weirder languages (e.g. Haskell), Python gets a lot of different things right, and right in a combination that no other language I know of has done so far. It recognises that you’ll spend a lot more time reading code than writing it, and focuses on guiding developers to write readable code. It’s possible to...

   Python,Importance,Paradigm     2012-02-12 04:49:09

  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 b...

   Cloneable,super.clone(),clone,Java     2015-01-07 05:25:52

  Should we use Abstract class or Interface?

When we write programs, we may often get into a situation where we don't know whether we should use Abstract class or Interface when we want to define an abstract object. These two are very similar and they are interchangeable in many cases. On Stackoverflow, this question is asked lots of times and it's related to many programming languages. Also in the official documentation of PHP regarding the Abstract class and Interface, people are arguing about this. To understand this question, their dif...

   DIFFERENCE,INTERFACE,ABSTRACT CLASS,COMPARISON,OOP     2013-04-15 11:44:36