This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const unsigned int ID_MSGBOX_STATIC = 0x0000ffff; | |
const wchar_t kMsgBoxTitle[] = L"Timed Message Box"; | |
int second_left = 0; | |
void CALLBACK msgbox_timer(PTP_CALLBACK_INSTANCE instance, void* context, | |
PTP_TIMER timer) | |
{ | |
HWND hwnd = ::FindWindow(nullptr, kMsgBoxTitle); | |
if (hwnd) { | |
if (second_left == 1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int StrToDecInt(const char* str) | |
{ | |
static const int kMAX = (int)((unsigned)~0 >> 1); | |
static const int kMIN = -(int)((unsigned)~0 >> 1) - 1; | |
static const int kMAX_DIV = (int)((unsigned)~0 >> 1) / 10; | |
static const int kMIN_DIV = (int)((((unsigned)~0 >> 1) + 1) / 10); | |
static const int kMAX_R = (int)((unsigned)~0 >> 1) % 10; | |
static const int kMIN_R = (int)((((unsigned)~0 >> 1) + 1) % 10); | |
int n = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int StrToDecInt(const char* str) | |
{ | |
static const int kMAX = (int)((unsigned)~0 >> 1); | |
static const int kMIN = -(int)((unsigned)~0 >> 1) - 1; | |
static const int kMAX_DIV = (int)((unsigned)~0 >> 1) / 10; | |
static const int kMIN_DIV = (int)((((unsigned)~0 >> 1) + 1) / 10); | |
static const int kMAX_R = (int)((unsigned)~0 >> 1) % 10; | |
static const int kMIN_R = (int)((((unsigned)~0 >> 1) + 1) % 10); | |
int n = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# This file is part of Adblock Plus <http://adblockplus.org/>, | |
# Copyright (C) 2006-2013 Eyeo GmbH | |
# | |
# Adblock Plus is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License version 3 as | |
# published by the Free Software Foundation. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MT_Queue { | |
public: | |
struct ELEMENT { | |
int thread_num; | |
int request_num; | |
}; | |
typedef ELEMENT* PELEMENT; | |
MT_Queue(int max_elements); | |
~MT_Queue(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************************ | |
** Edition: Demo | |
** Author: Kingsley Chen | |
** Date: 2013/11/19 | |
** Purpose: I/O issuer | |
************************************/ | |
#include "stdafx.h" | |
#include <conio.h> | |
#include <string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* remove non-alphabet from head and tail */ | |
int main() | |
{ | |
const char* alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
string text; | |
while (cin >> text) { | |
string::size_type begin = text.find_first_of(alphabet); | |
string::size_type end = text.find_last_of(alphabet) + 1; | |
text = text.substr(begin, end - begin); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const wstring SHUTDOWN_ACK = L"Server Shutdown"; | |
HANDLE g_requestSubmitted; | |
HANDLE g_requestReturned; | |
HWND g_mainDlg; | |
wstring g_requestText; | |
UINT APIENTRY ServerThreadFunc(PVOID param) | |
{ | |
bool isShutdown = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <algorithm> | |
#include <Windows.h> | |
class MT_Queue { | |
public: | |
MT_Queue(int maxElements); | |
~MT_Queue(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int APIENTRY _tWinMain(HINSTANCE hInstance, | |
HINSTANCE hPrevInstance, | |
LPTSTR lpCmdLine, | |
int nCmdShow) | |
{ | |
UNREFERENCED_PARAMETER(hPrevInstance); | |
UNREFERENCED_PARAMETER(lpCmdLine); | |
return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DLGMAIN), NULL, DlgProc); |