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

SEARCH KEYWORD -- keyword



  Speech balloon with pure CSS--One step further

Many of us want to add cool features to our websites to make our websites user friendly ad more attractive. Especially in Web2.0 era. Today we are talking about adding speech balloon feature to our webpage so that we can display beautiful help windows while users mouse over some help icons on our page. First, let me introduce one post written by Umar Ashfaq named "How to create a speech balloon with pure CSS". He also explains how this works. You can also refer Magic CSS shape for more informati...

   Speech balloon, Pure CSS,border     2013-03-16 04:11:58

  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

  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

  Rediscovering the RSync Algorithm

A:Ok, you’re synchronizing this over the web; and what do you use for the synchronization? B: Oh, we implemented the rsync algorithm. A: uhu. And what do you do with really big files? B: The same. A: And you also synchronise folders? B: Yes. A: And how do you do that? B: we iterate over the folder, using the algorithm on every file, recursing over subfolders. A: Can you try 2 things for me? First, a very large file; and second, a large codebase, and see if it holds. Introduction First ...

   ReSync algorithm,Discovery     2012-02-14 10:47:24

  The most stupid C bug ever

I have been programming for a number of years already. I have seen others introduce bugs, and I have also introduced (and solved!) many bugs while coding. Off-by-one, buffer-overflow, treating pointers as pointees, different behaviors or the same function (this is specially true for cross-platform applications), race conditions, deadlocks, threading issues. I think I have seen quite a few of the typical issues. Yet recently I lost a lot of time to what I would call the most stupid C bug in my ca...

   C,Bug,Stupid,Bug code,All     2011-08-26 02:37:29

  The most stupid C bug ever

I have been programming for a number of years already. I have seen others introduce bugs, and I have also introduced (and solved!) many bugs while coding. Off-by-one, buffer-overflow, treating pointers as pointees, different behaviors or the same function (this is specially true for cross-platform applications), race conditions, deadlocks, threading issues. I think I have seen quite a few of the typical issues. Yet recently I lost a lot of time to what I would call the most stupid C bug in ...

   C,Bug,Comment,Back slash     2012-04-22 03:40:49

  JavaScript: Passing by Value or by Reference

In JavaScript, we have functions and we have arguments that we pass into those functions. But how JavaScript handles what you’re passing in is not always clear. When you start getting into object-oriented development, you may find yourself perplexed over why you have access to values sometimes but not other times. When passing in a primitive type variable like a string or a number, the value is passed in by value. This means that any changes to that variable while in the function are com...

   JavaScript,Function,Pass by reference,Pa     2011-07-28 11:05:25

  Maybe we need //Comment comment

Do we need comment in our programs? Depends, if we can write a program which can clearly tell s the reader what the program does, then we had better to avoid unnecessary comments. However, if the program we develop is complex enough and it involves some uncommon logic which needs more explanation, then we have to add comment and make sure the comment we add can correctly tell the readers what we do. The worst scenarios is not you forget or you don't want to add comment, it's that you add comment...

   comment,programming     2014-07-23 04:38:04

  Currying in Python

What is Currying? Currying is like a kind of incremental binding of function arguments. Let’s define a simple function which takes 5 arguments: 1def f(a, b, c, d, e):2    print(a, b, c, d, e) In a language where currying is supported, f is a function which takes one argument (a) and returns a function which takes 4 arguments. This means that f(5) is the following function: 1def g(b, c, d, e):2    f(5, b, c, d, e) We could emulate this behavior the...

   Python,Curring,Binding,Implement     2012-03-19 12:59:10

  Three ways to define class in JavaScript

In object oriented programming, class is the template of object, it defines the properties and methods of a group of objects. Unfortunately, JavaScript doesn't support class, but we can have some workarounds to simulate class.1. Constructor functionThis is the classical approach, it is also the approach mentioned in many text books. It uses the constructor function to simulate class and it uses the keyword this to represent the object internally.function Cat() {  this.name = "Kelly...

   JavaScript,Class,Method,Private,Inheritance     2012-07-09 11:59:51