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

SEARCH KEYWORD -- Must read



  Want Me to Read Your Blog? Do This

It's deceptively easy to maintain traffic once you've scored that initial boost of visitor hits. In fact, one of the greatest determinations of this relies on a single make or break entry.Every blogger knows, if they look at their web analytics at all, that one of the most consistently viewed pages is the biographical entry. If it's linked on the home page or throughout the blog, the audience will invariably stay long enough to read it, at least 25%...

   Web blog,Traffic,About page,Biography     2011-12-05 13:16:37

  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

  How does PHP session work?

This article is about how PHP session works internally. Below are the steps : 1. Session in PHP is loaded into PHP core as an extension, we can understand it as an extension. When session extension is loaded, PHP will call core functions to get the session save_handler, i.e interface or functions for reading and writing session data. By default, PHP will handle session data by writing and reading files on the server. But PHP also supplies custom methods for handling session data, we can use sess...

   PHP, session, mechanism     2012-12-28 13:36:49

  Read white space with scanf()

Usually, when we want to enter string with white spaces in C, we need to call gets() or fgets(0 method. We usually will not use scanf(0 or fscanf() because they cannot accept white spaces when scan user inputs.   But when we specify the format in scanf() function, we may read strings with white space. the code section below illustrate this: #include <stdio.h>   int main(int argc,char **argv){        char name[30];      fprintf(stdout,"Please en...

   C,scanf,white space, string format     2011-09-26 11:45:43

  Check file readability in Java

File operation is quite platform dependent. Although Java is a cross platform programming language, the file operation in Java is also platform dependent. The obvious evidence is the file permission check. In Java, we can call canRead(), canWrite() and canExecutable() to check whether the program can read, write or execute the file specified. However, on Windows, when we call canRead() on a File object, we may get unexpected result. Actually, on Windows, when we call canRead() on a File object, ...

   Java,Files,Readable,Check     2013-12-05 06:10:15

  NIO vs IO in Java

Java 1.4 provides a new API for handling IO -- NIO. This is a non-blocking and buffer oriented IO API. Below are main differences between the NIO and IO in Java. IO NIO Stream oriented Buffer oriented Blocking IO Non-blocking IO N/A Using selector Stream oriented vs Buffer oriented The main difference is that IO is stream oriented where the data is read byte by byte and the data will not be buffered normally.This means there is no pointer to move forward and backward in the stream. I...

   JAVA,IO,NIO     2016-01-10 01:40:02

  A Programming Idiom You've Never Heard Of

Here are some sequences of events: Take the rake out of the shed, use it to pile up the leaves in the backyard, then put the rake back in the shed. Fly to Seattle, see the sights, then fly home. Put the key in the door, open it, then take the key out of the door. Wake-up your phone, check the time, then put it back to sleep. See the pattern? You do something, then do something else, then you undo the first thing. Or more accurately, the last step is the inverse of the first. Once you're aware ...

   Programming,Idiom,Strange     2012-01-04 08:12:25

  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

  ByteBuffer in Java

ByteBuffer is introduced in java.nio since Java 1.4. It provides a way of representing raw structured data such as from a file or from network. It enables fast access of underlying data compared to traditional ways like byte[] Prior to Java 1.4, if you want to represent a structured raw data, you need to create a byte[] and then having a set of checks to delimit the byte array to get the expected tokens. There are three ways to create a ByteBuffer: Wrapping an exiting array by calling ByteBuffe...

   JAVA,BYTEBUFFER,ALLOCATION     2015-07-08 03:17:44

  Save QWidget as image

Qt library is an excellent GUI library for C++ programmers developed by Nokia and now is an open source project. Often, we may use QPainter to draw strings, lines or images on a QWidget. We can override the QWidget's paintEvent() method when we want to use QPianter object to draw something on a QWidget. If we want to save the items drawn on QWidget as image for later reference, what can we do? We can save a QWidget as an image. Here is the code for achieving this: QPixmap pixmap(this->size())...

   Qt,C++,QWidget,Image     2012-08-19 12:01:18