Skip to content

Instantly share code, notes, and snippets.

View johnhmj's full-sized avatar
😃
online

John "DumbSheep" Hsieh johnhmj

😃
online
View GitHub Profile
@johnhmj
johnhmj / main.cpp
Last active August 29, 2015 14:00
Socket, client socket, HTTP request
#pragma comment(lib, "Ws2_32.lib")
#include <iostream>
#include <WinSock2.h>
#define BUF_SIZE 4096
//
int main(int argc, char* argv[])
{
struct hostent *d;
struct sockaddr_in a;
SOCKET s;
@johnhmj
johnhmj / W32Tester.cpp
Last active August 29, 2015 14:01
Socket, client socket, HTTP request (class)
#include "W32Tester.h"
//
CSocketClient::CSocketClient()
{
memset((void*)&this->m_wsadata, 0, sizeof(struct WSAData));
memset((void*)&this->m_saddr, 0, sizeof(struct sockaddr_in));
this->m_s = INVALID_SOCKET;
this->m_AFamily = AF_INET;
this->m_Port = 0;
this->m_hostent = NULL;
@johnhmj
johnhmj / main.cpp
Created May 19, 2014 00:39
server of Winsock localhost connection in May 19, 2014
#include "w32socket.h"
#include <iostream>
#include <Windows.h>
//
int main(int argc, char* argv[])
{
char domain[] = "localhost";
char ip[] = "127.0.0.1";
char request[] = "from server\n";
char buffer[BUF_SIZE];
@johnhmj
johnhmj / main.cpp
Created May 19, 2014 00:36
client of Winsock localhost connection in May 19, 2014
#include "w32socket.h"
#include <iostream>
#include <Windows.h>
//
int main(int argc, char* argv[])
{
char domain[] = "localhost";
char ip[] = "127.0.0.1";
char request[] = "from client\n";
char buffer[BUF_SIZE];
@johnhmj
johnhmj / AAEngine_Compare.txt
Last active August 29, 2015 14:07
User's settings of AAEngine.ini (CL139553)
正在比較檔案 AAEngine_Default.ini 和 AAENGINE_UPDATED.INI
***** AAEngine_Default.ini
BuildingQuadStaticMeshName=EngineBuildings.BuildingQuadMesh
ProcBuildingLODColorTexelsPerWorldUnit=0.075
ProcBuildingLODLightingTexelsPerWorldUnit=0.015
MaxProcBuildingLODColorTextureSize=1024
***** AAENGINE_UPDATED.INI
BuildingQuadStaticMeshName=EngineBuildings.BuildingQuadMesh
ProcBuildingLODColorTexelsPerWorldUnit=0.075000
ProcBuildingLODLightingTexelsPerWorldUnit=0.015000
@johnhmj
johnhmj / main.cpp
Last active August 29, 2015 14:22
Quiz 3 & 4(IP = 120.117.156.61, STUST), https://www.ptt.cc/bbs/C_and_CPP/M.1433693969.A.3FD.html
#include <iostream>
#include <limits>
#define STUDENTNUMBER 8
#define STUDENTDATA 4
void ScoreInput(int a[][STUDENTDATA]);
void ScorePrint(int a[][STUDENTDATA]);
void ScoreSorting(int a[][STUDENTDATA], int f);
using std::cin;
using std::cout;
using std::endl;
#include <iostream>
#include <cstdlib>
// Integrated Development Environment
// Visual C++
using namespace std;
//
void main(int argc, char** argv)
{
system("PAUSE");
}
<script language="javascript" type="text/javascript">
<!--
// 函式
function check(year, month, date)
{
// 宣告 Date 物件
var today = new Date();
// 用年月日判斷
if ( year > today.getFullYear() )
{
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#define RANDOMIZE srand((unsigned)time(NULL))
// Integrated Development Environment
// Visual C++
using namespace std;
//
#include <iostream>
#include <cstdlib>
#include <cmath>
// 12 Months of a year
#define MAX_MONTHS 12
// Integrated Development Environment
// Visual C++
using namespace std;
//
class CArrayType