Skip to content

Instantly share code, notes, and snippets.

@ssfang
ssfang / each_map_node_size_varies.md
Last active January 13, 2022 06:56
A map example using a pointer to the key as a member of value
//How I can properly implement 
//the runtime polymorphism on c++ std::map value_type without using pointer type
//i.e. node size is not the same anymore but varies.
// +---------------------+
// |_Node* _Left         |
// |_Node* _Parent       |
// |_Node* _Right        |
// |int _Color           |
// |bool _Isnil          |
@ssfang
ssfang / index.html
Created April 4, 2019 13:53
Colorful Pie Puzzle wheels // source https://jsbin.com/lazidox
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="wheels">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Colorful Pie Puzzle</title>
<style id="jsbin-css">
body {
@ssfang
ssfang / The process about Microsoft Office Document.md
Created March 21, 2019 04:04
The process about Microsoft Office Document

The process about Microsoft Office Document.md

Description of the way that Excel saves files

Applies to: Microsoft Office Excel 2003, Microsoft Office Excel 2007, Excel 2010. From: MS.

Summary

This article describes how Microsoft Excel saves files.

More Information

When you save an existing file in Excel, Excel creates a temporary file in the destination folder that you specify in the Save As dialog box. The temporary file contains the whole contents of your workbook. If Excel successfully saves the temporary file, the temporary file is renamed with the file name you specify in the Save As dialog box.

@ssfang
ssfang / Executing_Around_Sequences.md
Last active October 10, 2016 12:02
C++11基础心得与多线程编程外加主流服务端语言Java的互融
@ssfang
ssfang / Libevent_Windows_Build.md
Last active May 15, 2017 01:54
OpenSSL build on windows.
I:\src\c\libevent\build>timer cmake -DOPENSSL_ROOT_DIR="C:/Program Files (x86)/OpenSSL" -DOPENSSL_LIBRARIES="C:/Program Files (x86)/OpenSSL/lib" -DOPENSSL_INCLUDE_DIR="C:/Program Files (x86)/OpenSSL/include" -G "Visual Studio 14" ..

I:\src\c\libevent\build>timer cmake -DOPENSSL_ROOT_DIR="C:/Program Files (x86)/OpenSSL" -G "Visual Studio 14" .

timer cmake -DOPENSSL_ROOT_DIR="C:/Program Files (x86)/OpenSSL" -DOPENSSL_LIBRARIES="C:/Program Files (x86)/OpenSSL/lib" -DOPENSSL_INCLUDE_DIR="C:/Program Files (x86)/OpenSSL/include" -G "Visual Studio 14" ..
@ssfang
ssfang / setlocale_sample.md
Last active September 27, 2016 08:34
Internationalization and localization: Character set, Character encoding, setlocale

VS2008(文件->高级保存选项-编码:简体中文(GB2312) - 代码页 936)

#include <stdio.h>
#include <tchar.h>
#include <locale.h>

int _tmain(int argc, _TCHAR* argv[])
{
/*
@ssfang
ssfang / getsystemdir.cpp
Created August 12, 2016 09:52
GetApp32SystemDirectory
// Win32.cpp : 定义控制台应用程序的入口点。
//
#include <stdio.h>
#include <tchar.h>
// TODO: 在此处引用程序需要的其他头文件
#include <windows.h>
@ssfang
ssfang / ReadRegistryEntryUnderWow6432Node.md
Last active July 29, 2016 03:39
A 32bit app read a registry entry on a 64bit windows

A. The Wow6432 registry entry indicates that you're running a 64-bit version of Windows. The OS uses this key to present a separate view of HKEY_LOCAL_MACHINE\SOFTWARE for 32-bit applications that run on a 64-bit version of Windows. When a 32-bit application queries a value under the HKEY_LOCAL_MACHINE\SOFTWARE<company><product> subkey, the application reads from the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node<company><product> subkey.

The figure below shows the structure under Wow6432Node that 32-bit applications will see. A "registry reflector" copies certain values between the 32-bit and 64-bit registry views (e.g., mainly for COM registration) and resolves any conflicts using a last-writer-wins approach.

@ssfang
ssfang / TypeSignature.java
Last active May 3, 2023 15:37
Java VM Type Signatures
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
/**
* <h2>Type Signatures</h2><br/>
* The JNI uses the Java VM’s representation of type signatures. Table 3-2 shows
* these type signatures.
* <p/>
* Table 3-2 Java VM Type Signatures
*
@ssfang
ssfang / ConstString.cpp
Last active May 24, 2016 04:07
How does the compiler place strings?
// ConstString.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h" // #include <stdio.h>
#define define_string "Hello World!"
#define define_same_string "Hello World!"
#define define_another_string "Defined String!"
const char char_array[] = "Hello World!"; //.rdata