Recaptcha 2 is now on site

There was a spamming problem on my blog a few months ago. Though I have Akismet to block them, I quickly get bored seeing my spamming box is filled with trashes. It is necessary to include some kinda of verification stuff for the comment module.

Unfortunately, due to my laziness I left an unfinished verification system for months. :(

Well, the comment function here is no longer disabled. I just implemented Recaptcha 2. K, now please get busy commenting! XD





Windows Server 2012 on ESXi 4.1


My I.T infrastructure at home has 4 ESXi 4.1 servers which host a number of VMs that are used for home and work purposes.  However, my organically grown infrastructure has now reached the point where it needs re-organising.  As part of that I’m installing new A/D controllers and decided to use Server 2012.

And then found that ESXi 4.1 doesn’t support it.  Try it and you’ll get the Server 2012 sad face appearing.  I don’t have time just now to update to ESX5.X on my servers, so I hunted around the Internet to see if there was a workaround.

I found these set of instructions ( really don’t do this for a production environment )

    • Create a  new VM over the vSphere Client.
    • As “Guest Operating System” use Microsoft Windows Server 2008 R2 (64-bit)
    • After VM has been created but before first power on, download the following  bios file and upload it to your ESXi datastore into the folder of the VM
    • Now open the .vmx file of the new VM and add the follwing lines
bios440.filename = "bios.440.rom"
mce.enable = TRUE
cpuid.hypervisor.v0 = FALSE
vmGenCounter.enable = FALSE
    • Power on VM and Server 2012 will install and run


之前一段时间里我的附属服务器,也就是这个博客所在服务器,的数据库总是会定期挂掉。通常会显示Error establishing database connection.






[C++]Doubly Linked List with Iterator

During the study week I tried to implement an integer list using Visual C++. My goal is to be as similar to as the list and iterator in the standard library. My goal is to simulate the implementation of the standard library list and iterator.

There are many people having issues with insertion and deletion of the iterator. In order to delete the boundaries of the list, the iterator need to have the access of the front and back of the list. According to the standard iterator, it does not have such a function:

A sample source main is:

#include "DoublyLinkedList.h"
using namespace std;
int main(){
	DoublyLinkedList dll;
	while (!dll.isEmpty()){
		cout << "[DLL]Element:" << dll.getBack() << endl;
	int a[] = {55,66,77,88,99};
	DoublyLinkedList dll2(a, a + 5);
	for (DoublyLinkedList::iterator it = dll2.begin(); it != dll2.end(); ++it){
		cout << "[DLL2]Element:" << *it << endl;
	return 0;



Source Code(Please feel free to fork & contribute):

[Master C++ Pointer #1]Retrieve private and protected stuffs in C++

[You may only do this practice on Linux..Coz windows behaves weirdly allocating memory for stack variables~ :( ]


This practice is made by Parthas Menethil(Luke.J.Sun). All rights reserved.

C++ is such a flexible language to have fun. You can break the common rule an do fantastic things. In this post, I am going to work with you to hack private information out from classes using only pointers!

I have three classes declared and instantiated one instance of each class in main. Some of the values inside the class are inaccessible by normal methods. We are going to pull them out from the memory.

NOTE: This program should be complied targeting 32bit operating system. The preferred compiler would be GCC 4.6.3

/*	How to access values in a class abnormally
 * */
#include <iostream>
using namespace std; // Not a good habit, just for testing
class A{
	int apples;
	double weight;
	unsigned int bugs;
	A() : apples(100), weight(99.9989), bugs(123456){}
class B{
	double exam_grade;
	double test_grade;
	double quiz_grade;
	B(double exam, double test, double quiz){
		exam_grade = exam;
		test_grade = test;
		quiz_grade = quiz;
	virtual void placeholder(){ /* Nothing to show */ }
struct Date{
	int day;
	int month;
	int year;
	Date(int d, int m, int y){
		day = d;
		month = m;
		year = y;
class C : public B{
	Date *d;
	C() : B(55, 50, 60.9){
		d = new Date(20, 9, 1993);
		delete d;
int main(){
	A a;
	B b(99,98,97);
	C c;
	cout<<"C++ is flexible!"<<endl<<endl;
	cout<<"Example done by Parthas Menethil(Luke.J.Sun)"<<endl<<endl;
	cout<<"Size of class A: "<<sizeof(a)<<endl;
	cout<<"->int(4) + double(8) + uint(4) = 16"<<endl;
	cout<<"Size of class B: "<<sizeof(b)<<endl;
	cout<<"->virtual table pointer(4) + double(8) * 3 = 28"<<endl<<endl;
	cout<<"Now let's retrieve everything from memory..."<<endl;
	/* Instance a */
	cout<<"In instance a:"<<endl;
	// Take stuffs from the beginning pointer
	// Change the pointer to a char pointer so offset would moved by 1 per increasement, use sizeof to count the size of variable type
	cout<<"[Private]weight:"<<*(double*)((char*)(&a) + sizeof(int))<<endl;
	cout<<"[Private]bugs:"<<*(unsigned int*)((char*)(&a) + sizeof(int) + sizeof(double))<<endl<<endl;
	/* Instance b */
	cout<<"Ininstance b:"<<endl;
	// Pass the initial virtual table pointer
	cout<<"[Private]exam_grade:"<<*(double*)((char*)&b + 4)<<endl;
	// Move forward to pass the first double and retrieve the second one
	cout<<"[Protected]test_grade:"<<*(double*)((char*)&b + 4 + sizeof(double))<<endl;
	// Move forward to pass the second double and retrive the third one
	// The use of sizeof is not necessary because sometimes we know the variable type length
	// double has the length of 8
	cout<<"[Public]quiz_grade:"<<*(double*)((char*)&b + 4 + sizeof(double) + 8)<<endl<<endl;
	/* Let's try to retrieve the values in the Date object in C class */
	/* Instance c */
	cout<<"Instance c:"<<endl;
	cout<<"[Protected]d->day:"<<"[Your answer?]"<<endl;
	cout<<"[Protected]d->month:"<<"[Your answer?]"<<endl;
	cout<<"[Protected]d->year:"<<"[Your answer?]"<<endl;
	return 0;

At the beginning, I counted and explained the sizes as well as structures of class A and B, and then retrieved all values from A and B using only pointers.

To get the variables’ values from class C is tricky, you can try to do it by yourself! I believe that you can find the right answers out!

My solution will be released in the next post about this topic. Before that, try it out!

The right output should be:

C++ is flexible!

Example done by Parthas Menethil(Luke.J.Sun)

Size of class A: 16
->int(4) + double(8) + uint(4) = 16
Size of class B: 28
->virtual table pointer(4) + double(8) * 3 = 28

Now let’s retrive everything from memory…
In instance a:

Ininstance b:

Instance c:

Try to match my output. There could be many ways to do the samething in c++.

[GoLang]A simple game – Rock Paper Scissors Lizard Spock

Last week, I just noticed that in this semester(2013 Fall), the Intro C Language(IPC144) course’s assignment 1 is a game called Rock Paper Scissors Lizard Spock. The first I encountered this game was when I was learning Python language on a online course. Unfortunately, I quit that course coz I was way too busy, but the game concept was embed into my mind.

Since it has been a long time that I have not actually  on my normal study pace due to the “DEATH” of my deeply loved 4-year-old laptop. Now thanks to my dear sister like friend, I got a temporary laptop and am able to be back on the track of studying Go Language.

Today I am going to make a “Rock Paper Scissors Lizard Spock” game using Go Language. I have seen many people use tons of if statements to judge the result of two players. The judgement part is indeed the tricky programming part of this game, and I am going to think of a clear way to implement it. Finally that part results into four lines of code. I cannot be 100 percent sure that it it right, but anyway hopefully there would be no bug.

My code would be available publicly on GitHub. Please feel free to fork and improve.

In addition, absolutely, I will finish the bonus part of that game which is Human versus Artificial Intelligence. It would be coming soon.

GitHub Repo(The folder is called RPSLS):

Parthas.Menethil (Luke.J.Sun)

Basic Math

It took me so long time because that I was doing all of this on an IPAD!
This basic math program takes advantages of the object oriented programming and is built based on git source managing system and all commit histories are stored on GitHub.


Although our dear professor H did not cover the arguments in C++ on the last lecture, we, who are good at self studying, worked out the exercise.

This project takes advantages of the following new stuffs covered in OOP344:
Preprocessor macro
Object Oriented Programming

Fortunately my iPad does compatible with all stuffs needed. XD

Source Code:
Coming Soon. Please check GitHub while it is unavailable.

How integers in VC++ 2012 are stored in memory on windows

This article is written by Luke(Parthas.Menethil.Sun). All rights reserved.

When we assign an integer to a variable, in fact, we store that number in some standard format into our memory somewhere. I have always been curious about how they are stored into our memory. Let’s check it out here.

Based on different languages, compilers, compiling configurations and systems, the answer may be various. My environment is using Visual Studio 2012 with the CL 17.00.51106.1 for x86 complier on Windows 7.

My testing code is simple:

int main(){
	int i = 0x12ABCDEF;   // Assign a hexadecimal number
	printf(&quot;%x&quot;, &amp;i);     // Get the memory address of that variable
	return 0;

First I assign a number to fill all bytes of the integer and output its memory address.

While running, we can use hex editors like WinHex to monitor what’s going on in the memory.

We can see at the specific offset, the variable in each byte is stored in the reverse order.

How to change the password on you INT322 website

As you guys who have a zenit account, your website should be:

But when you visit that webpage there’s a prompt pops up asking  username and password and you cannot see the website without providing them.

How to make your own password without removing them?

The htpasswd can add a username for you:


htpasswd -b ~/.htpasswd username password

The command will generate a token string based on provided username and password and attach the token string to the .htpasswd file in your home directory.

NOTE: Do NOT overwrite or delete any previous things from that file or your professor cannot access your website.

FAQ for geeks:

1. I found that there are some other information in the .htpasswd file and they seem to be our professor’s username and password. Could we take advantage of that to see my classmates’ web pages?

Technically and ethically NO. Those passwords are generated by some hash arithmetic which is irreversible.

2. There are some online Apache password file generater. Should I use them?

NO. Not every site is using HTTPS protocol to protect your data during the transmission, your username and password can be sniffed by others. Even though they use the safe protocol, your username and password might be recorded by their website which creates potential threats for you.

This article is written by Luke(Parthas.Menethil.Sun). All rights reserved.