Monthly Archives: June 2018

DevCon6 conference by Programmez Magazine

On stage yesterday for DevCon6 Conference ; a live coding show in Paris organized by Programmez Magazine. My session was about the C language of Daddy ! And the implementation of LMDB NoSQL under Windows. It’s fast ! 1.000.000 rows inserted in 2 seconds !

Advertisements

LMDB in DLL in Release x64 under Windows

Using OpenLDAP-LMDB in Relase x64, I can put elements at this stages:

  • 10.000  simples key/values in 16 ms
  • 100.000 simples key/values in 140 ms
  • 300.000 simples key/values in 421 ms. My record  !
  • 1.000.000 simples key/values in 6s -> in this case, the DATA.MDB work data file is 820MB in size.

 

lmdbdll_release

LMDB is one of the fastest NoSQL it exists and I know.

 

Need a simple logger in Win32 ?

If you need like me, a logger for your deamons and services… just look at this simple logger:

#pragma once
#include <string>

class CLogger
{
public:
	CLogger();
	virtual ~CLogger();

public:
	void Init(std::wstring name);
	void WriteLog(std::wstring message);

private:
	std::wstring _name;
	std::wstring _path;
};

You put the name of the file in Init() method as then, you just call WriteLog() ! Let’s ook at the code impl:

#include "stdafx.h"
#include "Logger.h"


CLogger::CLogger()
{
}


CLogger::~CLogger()
{
}

void CLogger::Init(std::wstring name)
{
	_name = name;

	TCHAR szTemp[255];
	_stprintf_s(szTemp, _T("C:\\TEMP\\LOGS"));
	::CreateDirectory(szTemp, NULL);

	TCHAR szPath[255];
	_stprintf_s(szPath, _T("%s\\%s"), szTemp, name.c_str());

	_path = szPath;
}

void CLogger::WriteLog(std::wstring message)
{
	std::string path(_path.begin(), _path.end());

	SYSTEMTIME st;
	memset(&st, 0, sizeof(SYSTEMTIME));
	::GetSystemTime(&st);

	TCHAR sz[1024];
	_stprintf_s(sz, 
		_T("%02d:%02d:%02d.%03d - INFO - %s\r\n"), 
		st.wHour, st.wMinute, st.wSecond, st.wMilliseconds, 
		message.c_str());

	std::wstring wsz = sz;
	std::string msgToWrite(wsz.begin(), wsz.end());

	HANDLE hFile = ::CreateFileA(path.c_str(), 
		GENERIC_WRITE, FILE_SHARE_WRITE, 
		NULL, OPEN_ALWAYS, 
		FILE_ATTRIBUTE_NORMAL, NULL);

	LONG l = 0;
	::SetFilePointer(hFile, 0, &l, FILE_END);
	
	DWORD dwLen = 0;
	::WriteFile(hFile, 
		msgToWrite.c_str(), msgToWrite.length(), 
		&dwLen, NULL);
	
	::CloseHandle(hFile);

	printf_s(msgToWrite.c_str());
}

 

Programming IoT with Azure and MXCHIP device

I recently have done a 2 days event in MS Office about programming MXCHIP and Azure IoT stuff. It’s amazing what that kind of little hardware can achieve. For now, I have to make a demo for my managers.

The code and compilers are included into VSCode extensions and SDK Kit.

Everything is simple in the demo mode. But in real, you spend a lot of time… :)

Microsoft is buying GitHub

The open-source community are not very happy. In my opinion, it’s the same thing that when Oracle buy Java and MySQL… You think of something just foolish. The problem is that Microsoft tell us that the company has changed and they do Open-Source.

First, we don’t have all the same definitions of what is Open-Source development. Microsoft vision is not Richard Stallman vision.

Some people tell us that a lot of companies/people will leave Github. True or False ?

Let’s take time to see and we will comment in 6 months.

Coding Live at DevCon6 for Programmez Magazine

Monday 25 June 2018, I will be a speaker for a Programmez magazine event.

I will code C live ! It will be about coding LMDB for Windows as a DLL and testing a client that can make 1.000.000 rows in 1 second. Can you say that ?

Make OpenLDAP-LMDB OSS project a DLL

Source code from https://github.com/LMDB/lmdb. To make a DLL, it’s just some syntax errors compilation in MSVC 17. But if builds after minor corrections.