Monthly Archives: December 2006

Allocate consecutive sectors for large file

#include <stdio.h>#include <tchar.h>#include <windows.h>#include <iostream> int CreateFileOfSize(LPCTSTR filename, __int64 len){ HANDLE hfile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_READ, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,// FILE_ATTRIBUTE_SPARSE_FILE flag will not allocate disk space 0); if(!hfile) { return GetLastError(); } LARGE_INTEGER li; li.QuadPart = len; if( 0 == … Continue reading

Posted in Computers and Internet | Leave a comment

All files in SD card are missing…

I was using a laptop sending a file of 5Mb to my phone via wirelessconnection. After sending, the phone popped up prompting if I wanted toreceive it, I chose yes. But then I don’t know where it was, so I … Continue reading

Posted in Uncategorized | Leave a comment

build boost 1.33.1 with VC80

Open "Visual Studio 2005 Command Prompt",change to boost directryset PYTHON_VERSION="2.5"set PYTHON_ROOT="c:\python25"set PYTHON_LIB_PATH="c:\python25\libs"E:\opensource\boost\boost_1_33_1>bjam "-sTOOLS=vc-8_0" install

Posted in Computers and Internet | Leave a comment

book review: Service Oriented Architecture A Planning and implementation Guide For Business and Technology

Service Oriented Architecture A Planning and implementation Guide For Business and TechnologyThis is not a book for Engieers, it is a book best for sales and people that talk more that do something. After a glance of it, I don’t … Continue reading

Posted in Books | Leave a comment

book review: XSLT Cookbook 2nd Edition

I want to have a turtorial on XSLT, but this book is not the right one. It provided a lot of small scripts, I think those little tips can be easily found in internet by google.

Posted in Books | Leave a comment

Lottery calculator

import randomimport structfor i in range(0, 5):    ndict={} #empty dict    while len(ndict) < 6:        n = random.randint(1, 33)        ndict[n] = n    keys = ndict.keys()    keys.sort()    #for k, v in ndict.iteritems():    red_nums = ‘ ‘    for k in keys:        print ‘ … Continue reading

Posted in Computers and Internet | Leave a comment

Simple string operation in python

def get_ext(s): # get extension part of file name dot_pos = s.rfind(‘.’) if dot_pos<> -1: print ‘dot position is ‘, dot_pos, ‘ input is ‘, s s = s[0:dot_pos] print ‘output is ‘, sget_ext(‘a.b’) # test the functionget_ext(‘a.b.c’)

Posted in Computers and Internet | Leave a comment