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

SEARCH KEYWORD -- number



  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 value int getMaxInt(){           return (1 << 31) - 1;//...

   Bit operation, Tips     2012-12-19 12:53:33

  What is pjax and why we should use it?

What is pjax? Now many websites such as Facebook, Twitter support one browsing style which is when you click one link on their sites, the page will not be redirected, instead only the page contents are updated and URL on address bar is changed. This kind of user experience is much better compared to load the whole page with a blink. There is one important component in the above browsing experience, these websites' AJAX refresh support browser history, when refreshing the page, the address on the...

   pjax,AJAX,history     2013-04-23 12:22:37

  Shortcut keys in Sublime Text 3(Animated demo)

Sublime Text 3 is a light weight code editor which supports lots of languages. It has lots of shortcuts and plugins easing work of programmers. In this post, we will introduce some shortcuts supported in Sublime Text 3 and show how powerful they are. 1. Select sibling matching(equal) word (Ctrl + D) Put the cursor on one word, press Ctrl + D to select the word, then press Ctrl and following by pressing D, it will select next matching word. The number of Ds pressed will mean number of matching wo...

   TIPS,SHORTCUT KEY,SUBLIME TEXT     2016-04-28 02:41:28

  Chrome overtakes IE as the No.1 browser

According to data from market research company StartCounter, by May 2012, Chrome has overtakes IE as the No. 1 web browser globally. Firefox and Safari is following IE to be 3rd and 4th most popular web browser.In May, market share of Chrome is 33%, while IE only gets 32%. Firefox is slowly dropping, which has a share of 25%.  However, with release date of Windows 8 approaching, IE 10 will also be shipped with Win8, at that time, the number of users who use IE may increase because according...

   Chrome,No.1,IE,StatCounter     2012-05-21 06:03:04

  Don't Overload #nil?

There’s a popular post on Hacker News about writing confident code by, among other things, overloading Object#nil? and returning “null objects” instead of nil itself.DO NOT DO THIS.In Ruby, all objects (except nil itself) coerce to the boolean value true. Your object will be nil and true at the same time. Bad things will happen. Your coworkers will cry. Sad people from around the world will ask bewildering questions on your mailing list.Here’s what happen...

   Ruby,#nil,Overload,Object     2011-11-10 10:50:22

  Go channel explained

In Go, a channel is a type of concurrent data structure that allows two or more goroutines (Go's term for lightweight threads) to communicate with each other. Channels provide a way for goroutines to send and receive values, and they are an essential part of Go's concurrency model. Here's a simple example that demonstrates how to use channels in Go: package main import ( "fmt" ) func main() { // Create a new channel with the `make` function ch := make(chan int) // Start a new ...

   GOLANG,CHANNEL     2022-12-10 22:24:26

  Forgotten TODOs: ideas for contributing to open-source projects

I often talk to students that want to contribute to open-source projects, but just don't have an idea what to work on. Here's a tip if you're in a similar situation (e.g. you want to apply for GSOC) : 1 git clone repository_url_of_some_open_source_project target_directory 2 grep -RIn TODO target_directory/* So, find the URL of the repository project you want to contribute to, checkout the repository using git/mercurial/svn and then find all the TODOs in the source code using grep. The -RI...

   Open source,constribution,TODO,participation     2012-03-03 22:30:28

  Using keytool to create certificate chain

JDK provides a command line tool -- keytool to handle key and certificate generation. This tool has a set of options which can be used to generate keys, create certificates, import keys, install certificate and export certificates etc. In this tutorial, we will show how to create certificate chain using keytool. If you want to understand how to create certificate chain programmably, please refer to Generate certificate in Java -- Certificate chain. To begin, we first generate a key pair whi...

   JAVA,KEYTOOL,CERTIFICATE CHAIN,CERTIFICATE     2015-12-17 07:09:33

  String.length() vs String.getBytes().length in Java

In Java, String.length() is to return the number of characters in the string, while String.getBytes().length is to return the number of bytes to represent the string with the specified encoding. By default, the encoding will be the value of system property file.encoding, the encoding name can be set manually as well by calling System.setProperty("file.encoding", "XXX"). For example, UTF-8, Cp1252. In many cases, String.length() will return the same value as String.getBytes().length, but in some ...

   Java,UTF8,String,Encoding,Sample     2015-04-01 22:22:23

  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