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

SEARCH KEYWORD -- long



  Hexadecimal and long in Java

Today I encountered a hexadecimal operation problem when I was implementing a bit reverse function for integer type. Basically in the implementation, there is an operation which is to do the bit operation & between one long integer and a hexadecimal number 0x00000000FFFFFFFFF. I was expecting that the high 32 bits of the long integer will be zeroed. But unfortunately I didn't get the expected result. The basic implementation is: long num=0x00F0_0000; num = (num>>16) | (num<<16); ...

   Hexadecimal,long,Java,bitwise operation     2014-06-18 23:44:32

  PHP to get long running process progress dynamically

Frequently in web applications, we may have a request to the back end system which may trigger a long running process such as searching huge amount of data or a long running database process. Then the front end webpage may hang and wait for the process to be finished. During this process, if we can provide the user some information about the progress of the back end process, it may improve user experience. Unfortunately, in web applications, this seems not an easy task because web scripting lang...

   AJAX,PHP,progress,long process,demo     2012-06-04 07:29:37

  Smuggling data in pointers

While reading up on The ABA Problem I came across a fantastic hack.  The ABA problem, in a nutshell, results from the inability to atomically access both a pointer and a "marked" bit at the same time (read the wikipedia page).  One fun, but very hackish solution is to "smuggle" data in a pointer.  Example:#include "stdio.h"void * smuggle(void * ptr, int value){  return (void *)( (long long)ptr | (value & 3) );}int recoverData(void * ptr){  return (long long)ptr &...

   C,Pointer,Bit,Data,Atomic,Smuggle     2011-11-14 08:15:59

  Have Apple considered to develop iPad for aerospace use?

Today, I read article about China's Shenzhou 9 Spacecraft which is expected to be launched in middle of June. In this article, it mentions that the Chinese astronauts may bring some mobile devices with them in order for them to relax in such a long journey to outer space. The most probable devices they may bring are some tablets because laptops are too heavy to be placed in spacecraft which has limit space and weight capacity., while smartphones are too small and not so convenient for astronauts...

   Apple,iPad,Aerospace,Shenzhou 9     2012-06-14 05:41:20

  C programming tips in SPARC architecture

If you are a newbie of C programmers in SPARC architecture (For example, working on Solaris), you should pay attention to the following tips:(1) By default, SPARC is big-endian (For Endianness, you can refer http://en.wikipedia.org/wiki/Endianness). It means for an integer (short, int, long, etc), the MSB will be stored in the lower address, while the LSB will be stored in the higher address. (2) SPARC requires byte-alignment. It means for a short (2 bytes long) variable, the star...

   C     2014-06-01 03:56:30

  About short URL and its implementation

IntroductionURL shortening is a kind of technique to convert a long URL to a short URL. There are many companies now providing this kind of service, we now take Google's URL shortener service http://goo.gl/ as an example.First we navigate to http://goo.gl/, then we enter a random URL into the text field, here we use http://www.url-to-be-shortened.com as the input, it will return us an shortened URL : http://goo.gl/ZSVMM. URL ParsingWhen we type http://goo.gl/ZSVMM in browser address bar, the DNS...

       2012-07-02 07:15:09

  How to organize a successful technical party?

Since last year, I began to take part in some technical parties. Some are held very successful, while some seem not. In this article, I will share ideas about how to organize a successful technical party and use Golang programming language as an example. To hold a party, there must have been a stable user group first. According to the number of user, there may need a committee or a president, and the job of the organizer is searching for the sponsors, selecting the topics, etc. Although there ha...

       2015-05-15 22:28:38

  Using MemoryMappedBuffer to handle large file in Java

When handling large files, it will largely affect the process speed while using traditional FileInputStream, FileOutputStream or RandomAccessFile since they trigger lots of read and write operations. In Java NIO, a new way of handling large file is introduced which is to use MmeoryMappedBuffer to create memory mapped file. Memory-mapped I/O uses the filesystem to establish a virtual memory mapping from user space directly to the applicable filesystem pages. With a memory-mapped file, you can pre...

   JAVA,IO,NIO     2015-11-13 01:58:08

  How many bytes a boolean value takes in Java?

Have you ever wondered how many bytes a boolean value takes in Java? One byte, this might be the answer comes out of your mind right away. But is it? Let's dig in more. Per Oracle documentation on boolean value definition, there is below statement: boolean: The boolean data type has only two possible values: true and false. Use this data type for simple flags that track true/false conditions. This data type represents one bit of information, but its "size" isn't something that's precisely defin...

   JAVA,INTERVIEW,SIZE,BOOLEAN     2020-02-29 02:49:18

  Sustainability

When I was in business school 25 years ago, I don't recall the term sustainability used. Maybe it was, but it certainly didn't register in my brain. The mantras that I recall were return on investment, shareholder value, revenue growth, and driving efficiencies in the business.But as I look at many of the challenges facing businesses today, it seems to me that the focus on performance and efficiency often comes at the cost of sustainability. This talk by Clay Christensen really drives that point...

   Sustainability,Productivity,Efficiency     2011-11-21 10:07:16