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

SEARCH KEYWORD -- Check-in



  Features of Google Android 4.1 Jelly Bean

In today's Google IO 2012 in San Francisco, Google announced its new Android system Android 4.1 Jelly Bean. It's a whole new Android OS and many new features are added to it. Let's check out what new features are added to Jelly Bean.1.  Projector ButterIt uses VSync and Tripple buffering to improve the interactivity experience and increase frame rate. It makes Jelly Bean the fastest and smoothest Android ever2. New home screenYou can customize the home screen. You can re-size the home scree...

   Android, Google IO, Android 4.1, Kelly Bean     2012-06-27 12:49:49

  Gracefully exiting from console programs in Ruby

Imagine you write a CLI program or a Rake task which loops through some data performing some work on it. You run it and then you remembered something. You’d love to kill the process with ctrl-c, but that will raise an exception somewhere in the loop. What you want is for the iteration to complete and then you want the program to quit. You could handle the Interrupt exception or add some conditions. But how about a cleaner and reusable way? No problem - you can trap signals, which...

   Ruby,Exit,Command window,Console,Graceful     2012-03-14 13:42:16

  How to check whether a web page can be loaded in iframe

Sometimes you may want to load other website's page in your own website's iframe, but due to some security concerns, other website may have security configurations which prevent you from loading their pages into your iframe. In this case, if you try to load them, you would see a blank page or a text message telling that it's prohibited. Fortunately, you can detect this before you actually decide to load it. To prevent a page from being loaded by an iframe from other site, the response ...

   HTTP,HTML,IFRAME,SECURITY,X-FRAME-OPTIONS,CONTENT-SECURITY-POLICY     2018-07-27 22:36:02

  The internals of slice in GoLang

There are 3 components of slice:a) Pointer: Points to the start position of slice in the underlying array;b) length (type is int): the number of the valid elements of the slice;b) capacity (type is int): the total number of slots of the slice. Check the following code: package main import ( "fmt" "unsafe" ) func main() { var s1 []int fmt.Println(unsafe.Sizeof(s1)) } The result is 24 on my 64-bit system (The pointer and int both occupy 8 bytes). In the next example, I will use gdb to poke t...

   GOLANG,SLICE     2019-06-30 02:55:22

  The first 30 tweets on Twitter

Six years ago, we didn't know what a tweet was. But now, there are 340 million tweets posted every day. Looking back, do you know what are the earliest tweets on Twitter when it was released? Let's check them out. Before that, let's check Twitter's background first. Six years ago, Twitter was called twttr (similar to Flickr), the earliest version was similar to an SMS broadcast service, i.e sending short message to friends to tell them what I am doing. It was put online on 22nd October, 2006, J...

   Twitter,history,story     2012-10-11 20:03:22

  Configure static IP for Linux

When a Linux server is running, it has to have an IP so that other machines can talk to it. It is often desired that the server would own a static IP so that every time other machines want to connect to it, the same IP address would be used. This is extremely useful when there are virtual machines installed on a host machine where the virtual machine would start and stop now and then.  To configure static IP address for a Linux server, the /etc/network/interfaces needs to be updated. Assumi...

   LINUX,NETWORK,STATIC IP,DNS     2017-07-08 08:39:58

  Get hostname from a URL using JavaScript

Sometimes we may have strings which contain some UR;s and we may want to retrieve the hostname from the URLs for some statistic use. For example, we may have a URL : http://www.example.com/aboutus.html. We may want to retrieve the www.example.com from the URL. How? Use regular expression. Here I give an example using JavaScript. If you want to check whether a string is a URL or not. Refer to Detect URLs in a Block of Text. In JavaScript, we can have a regular expression like var pattern=/(.+:\/\...

   JavaScript,URL,regular expression, Hostname     2012-06-15 09:16:45

  HeartBleed: Should C be blamed for the HeartBleed bug?

There is a discussion about the security of applications written in C on Hacker News recently after the report of HeartBleed bug in OpenSSL. In this discussion, some people are saying that the applications written in C are unsafe. It seems all or most of the faults should be laid on C. I think this is biased. The language itself should not be blamed.Safety is a relative term for programming languages. No language is absolutely safe. We claim some languages like Java and C# are safer than C/C++ b...

   C,HeartBleed,Analysis,Code review     2014-04-14 03:52:55

  Sites to go if you want to learn web development

Before you start to do web development, either for a hobby or for your start up project, you should be prepared for learning many different technologies including both front end and back end. You may need to deal with UI design, business logic design, data store and infrastructure setup etc. This seems a very complex. Indeed, if you know where you should go, the  it's actually not so hard. Here are some sites you should go when you face issues while you are doing web development. These site...

   Web development,Resource,Site     2013-09-19 08:12:23

  Singleton Pattern in Golang

Singleton pattern is the simplest design pattern in software design. It ensures that only one instance of an object exists globally, regardless of how many times the object is instantiated. Based on the characteristics of the singleton pattern, it can be applied to scenarios such as global unique configuration, database connection objects, file access objects, etc. In Go language, there are multiple ways to implement the singleton pattern. Today, let's learn together about some of these approach...

   GOLANG,SINGLETON PATTERN,TUTORIAL     2023-08-18 23:52:05