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

SEARCH KEYWORD -- extends



  jsonSerialize() in extended class

Since PHP 5.4.0, there is a convenient interface JsonSerializable which can be used to indicate that a PHP object can be serialized to JSON object. It has only one method which should be implemented by any class which implements this interface. The method is named jsonSerialize(). It's really easy to serialize an object to JSON object. Here is one example: <?php class ArrayValue implements JsonSerializable { public function __construct(array $array) { $this->array = $array; ...

   JSON,jsonSerialize,Inheritance,extends     2014-07-26 05:54:00

  Modal dialog in Java example code

In Java, we can create modal dialog so that the main JFrame cannot be operated on until the modal dialog is closed. To achieve this, we need to use one class in Java--JDialog. This class can be used to create an modal dialog.Example code : import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; public class Dialog extends JDialog{ public Dialog(){ super(); JPanel panel=new JPanel(); panel.add(new JLabel("Hello dialog")); this.getCont...

   Java,Modal,JFrame,JDialog,Demo,Code     2011-08-18 09:50:27

  Creating Dynamic PDF files using HTML and PHP

There always arise a need for converting content from one file format to another one. Some may need to convert some text into HTML and some may need to convert some HTML content to an image format. The main reason for the need to convert from one file format to another is because the target file format is best suited for targeted medium where the content need to be displayed. The targeted medium may be an email, a printed hard copy or a web browser. The text format is best suited for sending ema...

   PHP,HTML,PDF,Conversion,Generate,Library     2011-11-18 12:10:53

  Add ContextMenu to a customized View in Android

In Android, we may sometimes need to add ContextMenu to a View, it's not so easy to add ContextMenu to a customized View. Here we explain how to add ContextMenu to a customized View. First, we may need to create View.OnCreateContextMenuListener so that the customized view can register for it. Here is the class definition: public class GraphView extends View {     private View.OnCreateContextMenuListener vC = new View.OnCreateContextMenuListener() {       &...

   Android, ContextMenu,Customized view     2012-11-04 07:10:40

  Baidu may withdraw from NASDAQ

Baidu, the search engine giant in China, may withdraw from NASDAQ some day and then get re-listed on A-shares market in China. This message is conveyed by Robin Li, CEO of Baidu, on a Wednesday(Beijing time) interview. Baidu is now investing heavily on O2O(Online to Offline) service as it is an emerging market where all Internet giants in China are diving in. In addition to its own O2O products, which include delivery service Waimai and deals site Nuomi, it has invested in a number of othe...

   NASDAQ,ROBIN LI,O2O,BAIDU     2015-09-17 04:03:55

  Why I love everything you hate about Java

If you’re one of those hipster programmers who loves Clojure, Ruby, Scala, Erlang, or whatever, you probably deeply loathe Java and all of its giant configuration files and bloated APIs of AbstractFactoryFactoryInterfaces. I used to hate all that stuff too. But you know what? After working for all these months on these huge pieces of Twitter infrastructure I’ve started to love the AbstractFactoryFactories. Let me explain why. Consider this little Scala program. It uses â€Å...

   Java,Comparison,Modularity,API     2011-11-29 08:48:15

  Translating math into code with examples in Java, Racket, Haskell and Python

Discrete mathematical structures form the foundation of computer science.These structures are so universal that most research papers in the theory of computation, programming languages and formal methods present concepts in terms of discrete mathematics rather than code.The underlying assumption is that the reader will know how to translate these structures into a faithful implementation as a working program.A lack of material explaining this translation frustrates outsiders.What deepens that fr...

   Math,Algorithms,Formula,Program,Python     2011-11-14 08:43:15

  The Erlang Design Pattern

Over the last couple of weeks I did an OO programming experiment. I call it the Erlang design pattern. It is based on the Actor model but goes some steps further. At its core just like the Actor model there are active entities (objects) that have a thread and a message queue with the thread waiting on the message queue to do some stuff. The Erlang design pattern extends the Actor model by first dividing the software program into active (actors, that have their own thread) and passive ...

   Erlang,Thread,Pattern,OS Threads     2012-02-06 07:47:56

  How to send asynchronous requests in PHP

It’s easy to make asynchronous calls in PHP with just a little bit of HTTP header knowledge and some library code around PHP sockets. This technique is useful when posting requests to your own server for bits of logic you’d like to run in the background.  If you don’t control the endpoint, you might not be comfortable with some of the limitations, such as the inability to read anything from the response.  So, you couldn’t post data to a we...

   PHP,Asynchronous request,socket     2012-04-28 06:45:51

  Show Bootstrap tooltip in AngularJS ng-repeat elements

In contemporary web application development, many front-end frameworks have been used to accelerate the speed of development and circumvent browser compatibility issues. Among them, AngularJS and Bootstrap are two frequently used.  AngularJS is a MVC JavaScript framework developed by Google to provide easy synchronization between user view and data model. While Bootstrap is developed by Twitter and it eases the work of designing a simple and concise UI without much manual design work ...

   BOOTSTRAP,ANGULARJS,TOOLTIP,NG-REPEAT     2016-05-21 10:52:02