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

SEARCH KEYWORD -- Standard



  Why localStorage only allows to store string values

localStorage allows data to be stored in browsers across sessions, the data will be there even though the session is expired. It is frequently used to store static data so that they can be loaded when needed. But as per spec, it says that the keys and the values are always strings (note that, as with objects, integer keys will be automatically converted to strings). Why cannot store the object as it is? Take a look at an example: var str = "test"; localStorage.setItem("str", str); cons...

   JAVASCRIPT,LOCALSTORAGE     2020-04-05 00:54:29

  A Hello, World Servlet

Servlets are the pure Java solution to handle web requests. Many application will use servlets instead of JSP and others will use servlets in conjunction with JSP. Experienced JSP programmers use servlets in conjunction with JSP to create clearer and simpler applications. The servlets handle Java processing: form handing, calculation and database queries. JSP formats the results. Servlets belong in WEB-INF/classes. On this machine, the source is in Java source in /var/www/hosts/www.caucho.com/we...

   Web.xml,Tomcat,Servlet,WEB-INF     2011-05-08 10:31:39

  Amazon is a good company but doesn't have the best business model

Public opinion about a company is usually based on its performance. If it performs well, people will praise it, otherwise people will blame it. In 1999, Apple was still a broken apple(Steve Jobs's talent and effort was paid off yet). Public opinion about Apple was the closed model caused Apple's failure. They built hardware themselves, developed software themselves and delivered service themselves, this is certainly not sustainable. But Steve Jobs let everyone see this new model. In order to con...

   Business model,Amazon,Apple, Microsoft     2013-07-02 11:34:45

  JSON unmarshal in GoLang

In almost all mainstream programming languages, there is either built-in or third-party library to support parse JSON data because it is so popular for organizing and transferring data among different services. In GoLang, the built in json package also provides functions for marshalling and unmarshalling JSON data. Marshalling GoLang struct to a JSON string is relatively simple, just need to call json.Marshal(), it's a bit complicated to unmarshal an arbitrary JSON string into a GoLang struct ob...

   GOLANG,JSON,UNMARSHAL,EMPTY INTERFACE     2019-11-09 21:57:30

  Haskell’s effect on my C++: exploit the type system

Like most programmers, I was attracted to Scheme by the promise that it would make me a better programmer. I came to appreciate the functional style, but swapped to Haskell, a more developed language with a rapidly developing standard library. Unfortunately, for me, Haskell can’t yet replace C++ on a day to day basis, so I reluctantly spend my days tapping away at C++. So, were the promises true? has functional programming made me a better programmer? Better is a tough question,...

   Haskell,C++,Type system,Comparison     2012-02-06 07:44:35

  Learn Emacs: Keyboard Macros

An emacs keyboard macro is just a recording of user input into emacs, which means that most anything you can do in emacs can be recorded as a macro. Read that again. Pretty powerful.Here’s how it works. To start recording, typeC-x (and input the commands in your macro. Then typeC-x )to stop recording. Then typeC-x eto apply the macro once, orC-u 0 C-x eto apply the macro until the bell rings or end of buffer is reachedKeep in mind that you must not ring the bell when defining a keyboard m...

   Emac,Macro,Code,Example     2011-11-10 10:45:47

  Stop programming

You probably program too much. Just when you've really gotten into your work, when your brain is entirely wrapped around your code, when your hands, eyes, and thoughts are working in harmony, stop. Look up. Think about when you're going to finish for the day. Look forward to shutting off your computer. Get outside a little. ...

   Programming,Tips     2011-06-30 02:50:14

  CASSANDRA data model

Cassandra is an open source distributed database, it combines dynamic key/value and column oriented feature of Bigtable. Features of Cassandra are: Flexible schema, no need to design schema first, it's very convenient to add or delete strings Support range search on keys High usability, extensible. The single node error will not affect the cluster. We can think Cassandra's data model as a 4 or 5 dimensional Hash. COLUMN Columns is the smallest data unit in Cassandra, it is a 3 dimensional data...

   Cassandra,database,sort     2013-06-08 22:07:40

  A C++ program puzzle

Recently I came across a question asked by wang2191195 on a Chinese IT forum CSDN which asks about a C++ program puzzle. He has a code snippet which cannot be compiled. The code is:#include <cstdlib> #include <iostream> using namespace std; class Base{ public: virtual void func(){ cout << "Base::func()" << endl; } virtual int func( int num ){ cout << "Base::func( int " << num << " )" << endl; return 0; ...

   C++,Puzzle,Hide,Overload     2012-05-13 02:31: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