Archive for January, 2011

Fast memory copy (SSE4)

January 29th, 2011 No comments

Visual Studio 2008 has supports “Enable Instruction Functions” options (see a project settings -> C/C++ -> Optimization). Note that this option can enlarge code.

Also memcpy function implementation has written with using sse2 (movdqa).

int CopyMemSSE4(int* piDst, int* piSrc, unsigned long SizeInBytes)
// Initialize pointers to start of the USWC memory

mov esi, piSrc
mov edx, piSrc

// Initialize pointer to end of the USWC memory
add edx, SizeInBytes

// Initialize pointer to start of the cacheable WB buffer
mov edi, piDst

// Start of Bulk Load loop
// Load data from USWC Memory using Streaming Load
MOVNTDQA xmm0, xmmword ptr [esi]
MOVNTDQA xmm1, xmmword ptr [esi+16]
MOVNTDQA xmm2, xmmword ptr [esi+32]
MOVNTDQA xmm3, xmmword ptr [esi+48]

// Copy data to buffer
MOVDQA xmmword ptr [edi], xmm0
MOVDQA xmmword ptr [edi+16], xmm1
MOVDQA xmmword ptr [edi+32], xmm2
MOVDQA xmmword ptr [edi+48], xmm3

// Increment pointers by cache line size and test for end of loop
add esi, 040h
add edi, 040h
cmp esi, edx
jne inner_start
// End of Bulk Load loop

return 0;

#define DATA_SIZE 0x01000000

int main(int argc, char* argv[])
int *piSrc = NULL;
int *piDst = NULL;
unsigned long dwDataSizeInBytes = sizeof(int) * DATA_SIZE;

piSrc = (int *)_aligned_malloc(dwDataSizeInBytes, dwDataSizeInBytes);
piDst = (int *)_aligned_malloc(dwDataSizeInBytes, dwDataSizeInBytes);

memset(piSrc, 255, dwDataSizeInBytes);
memset(piDst, 0, dwDataSizeInBytes);

CopyMemSSE4(piDst, piSrc, dwDataSizeInBytes);


Additional links:

Is process a member of the Administrators local group

January 29th, 2011 No comments

The CheckTokenMembership function determines whether a specified security identifier (SID) is enabled in an access token.

Routine Description: This routine returns TRUE if the caller's
process is a member of the Administrators local group. Caller is NOT
expected to be impersonating anyone and is expected to be able to
open its own process and process token.
Arguments: None.
Return Value:
TRUE - Caller has Administrators local group.
FALSE - Caller does not have Administrators local group.
BOOL IsUserAdmin(void)
 BOOL bResult;
 PSID AdministratorsGroup;
 bResult = AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
                                    DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0,
  if(!CheckTokenMembership(NULL, AdministratorsGroup, &bResult))
   bResult = FALSE;


integer types with specified widths

January 27th, 2011 No comments

stdint.h is a header file in the C standard library introduced in the C99 standard library section 7.18 to allow programmers to write more portable code by providing a set of typedefs that specify exact-width integer types, together with the defined minimum and maximum allowable values for each type, using macros. This header is particularly useful for embedded programming which often involves considerable manipulation of hardware specific I/O registers requiring integer data of fixed widths, specific locations and exact alignments. stdint.h (for C), and stdint.h and cstdint (for C++).

stdint.h defines:


stdint.h is not shipped with older C++ compilers and Visual Studio C++ products prior to Visual Studio 2010.


How to center a window on the screen

January 26th, 2011 No comments
#include <QStyle>
#include <QDesktopWidget>

                                        qApp->desktop()->availableGeometry() ));

Qt wiki

Back up my Opera files

January 23rd, 2011 No comments

To backup Opera you need backup the following folders:

  • Folders: sessions, skin, styles, toolbar, webserver
    Win32: Application Data\Opera\Opera
    Win64: C:\Users\<username>\AppData\Roaming\Opera\Opera
  • Folders: cache, icons, mail, opcache, temporary_downloads, thumbnails, vps, widgets
    win32: LocalSettings\ApplicationData
    win64: C:\Users\<username>\AppData\Local\Opera\Opera

For more info, see “How do I back up my Opera files?

Tags: , ,


January 18th, 2011 No comments

BigBlueButton enables universities and colleges to deliver a high-quality learning experience to remote studies.

BigBlueButton is an active open source project that focuses on usability, modularity, and clean design — both for the user and the developer. The project is hosted at Google Code.

BigBlueButton is built by combining over fourteen open source components.


Additional articles:

about Tools

January 16th, 2011 No comments

Tools amplify your talent. The better your tools, and the better you know how to use them, the more productive you can be.

The Pragmatic Programmer: From Journeyman to Master

Andrew Hunt (Author), David Thomas (Author)

Tags: ,

Simon Sinek: How great leaders inspire action

January 15th, 2011 No comments

About this talk

Simon Sinek has a simple but powerful model for inspirational leadership all starting with a golden circle and the question “Why?” His examples include Apple, Martin Luther King, and the Wright brothers — and as a counterpoint Tivo, which (until a recent court victory that tripled its stock price) appeared to be struggling.

About Simon Sinek

In 2009, Simon Sinek released the book “Start With Why” — a synopsis of the theory he has begun using to teach others how to become effective leaders and inspire change. Full bio and more links

Tags: , ,

Generate a Visual Studio 2010 project file from a qmake pro file

January 10th, 2011 No comments

qmake -spec win32-msvc2010 -tp vc <project_file>.pro

Ubuntu-certified hardware

January 10th, 2011 No comments

The hardware table has all been awarded the status of Certified or Ready for Ubuntu.