Skip to content

Instantly share code, notes, and snippets.

View whoo24's full-sized avatar

Wooyeong Choe whoo24

  • Oslo, Norway
View GitHub Profile
@whoo24
whoo24 / DataContractSerializerSample.cs
Created December 5, 2016 15:05
객체의 관계까지 Xml로 Serialization 해주는 DataContractSerializer 샘플
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Xml;
namespace DataContractSerializerSample {
[Serializable, KnownType(typeof(DerrivedSerializableModel))]
public class SerializableModel {
public SerializableModel node;
}
@whoo24
whoo24 / Const.cpp
Created November 29, 2016 06:33
Study of const in c++
#include "stdafx.h"
class ClassA {
};
class ClassB {
int value_ = 0;
int* ptr_ = nullptr;
ClassA member_;
@whoo24
whoo24 / regex.cs
Created November 29, 2016 06:15
Get decimal string in (0.0, 1.0, 2.0) using Regex.
using System;
using System.Text.RegularExpressions;
namespace regex {
class Program {
static void Main (string[] args) {
FindDecimalNumber();
FindCapturedDeciaml();
}
@whoo24
whoo24 / Dijkstra.cs
Created November 8, 2016 09:14
Getting shortest path using Dijkstra algorithm on C#
using DijkstraAlgorithm.GraphController;
using System.Collections.Generic;
using System.Linq;
namespace DijkstraAlgorithm {
public class Dijkstra<T> {
readonly int kInfinity = int.MaxValue - 1;
public void dijkstra (Graph<T> G, Graph<T>.Node r, out Dictionary<Graph<T>.Node, Graph<T>.Node> result) {
List<Graph<T>.Node> S = new List<Graph<T>.Node>();
@whoo24
whoo24 / Graph.cs
Created November 8, 2016 08:07
Getting minimum spanning tree using Prim algorithm on C#
using System.Collections.Generic;
namespace PrimAlgorithm {
public class Graph<T> {
private List<Node> nodes_ = new List<Node>();
public class Node {
private List<Edge> edges_ = new List<Edge>();
private T context_;
@whoo24
whoo24 / Floyd.cs
Created November 6, 2016 14:05
floyd algorithm for finding shortestpath
using System;
using System.Collections.Generic;
namespace FloydAlgorithm {
public class Floyd {
public void floyd (int n, Graph W, ref Graph D) {
int i, j, k;
D.CopyFrom(W);
for (k = 0; k < n; k++) {
for (i = 0; i < n; i++) {
import os
import fnmatch
prefix = "page-"
postfix = ".jpg"
add_num = 1;
digits = 3;
v = []
@whoo24
whoo24 / singleton_using_nested_class.cpp
Last active January 14, 2022 01:22
The nested class named FProtection prevents the creation of instances by direct calling the constructor.
#include "stdafx.h"
template <typename T>
class TSingleton {
public:
TSingleton() {}
~TSingleton() {
delete(Instance_);
}
@whoo24
whoo24 / split_jpg.cs
Created August 12, 2015 10:46
It splits two images from given image file.
using System;
using System.Drawing;
namespace split_jpg {
class Program {
static void Main (string[] args) {
try {
string filename = args[0];
Bitmap src = Image.FromFile(filename) as Bitmap;
int split = 2;
@whoo24
whoo24 / fiber_test.cpp
Last active August 29, 2015 13:57
Using fiber on Windows
#include "stdafx.h"
#include <windows.h>
PVOID ParentFiber;
VOID WINAPI logicFiber (PVOID pvParam) {
printf("logicFiber\n");
SwitchToFiber(ParentFiber);
}