Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kinchungwong's full-sized avatar

Ryan Wong kinchungwong

View GitHub Profile
@kinchungwong
kinchungwong / Stacktrace.txt
Created July 25, 2014 20:22
Microsoft (R) Visual C++ Package Server has stopped working
> cpfe.dll!expr_before_type_adjustment() Unknown
cpfe.dll!an_edge_member_selection_entry_impl_t<edge::member_selection_entry>::set_scope_cache() Unknown
cpfe.dll!an_edge_member_selection_entry_impl_t<struct edge::member_selection_entry>::scope(void) Unknown
cpfe.dll!edge::intellisense_operation::scope_at_cursor() Unknown
cpfe.dll!edge::intellisense_operation::get_auto_complete_members() Unknown
vcpkgsrv.exe!CMemberListInfo::InitStatus(class CEdgeTranslationUnit *,unsigned short const *,struct IEdgeSnapshotSession *,unsigned long,bool,bool,bool &,bool &) Unknown
vcpkgsrv.exe!CEdgeTranslationUnit::GetMemberListStatus(struct IEdgeSnapshotSession *,unsigned short const *,long,int,int,int *,int *) Unknown
rpcrt4.dll!_Invoke@12() Unknown
rpcrt4.dll!_NdrStubCall2@16() Unknown
ole32.dll!CStdStubBuffer_Invoke(IRpcStubBuffer * This, tagRPCOLEMESSAGE * prpcmsg, IRpcChannelBuffer * pRpcChannelBuffer) Line 1590 C++
@kinchungwong
kinchungwong / Cpp_Fibonacci_NonWorkingSkeleton_V2.cpp
Created November 29, 2013 01:13
The second step of implementing Fibonacci with C++ Metaprogramming, involving lazy-evaluation.
#include <iostream>
using namespace std;
template <class First, class Second> struct Add;
template <int First, int Second>
struct Add<
std::integral_constant<int, First>,
std::integral_constant<int, Second>>
{
@kinchungwong
kinchungwong / Cpp_Fibonacci_NonWorkingSkeleton.cpp
Created November 29, 2013 00:51
C++ TMP - Non-working skeleton for Fibonacci that contains lazy evaluation using integral constant types.
#include <iostream>
using namespace std;
template <class CValueOne, class CValueTwo> struct Sum;
template <int N1, int N2>
struct Sum<std::integral_constant<int, N1>, std::integral_constant<int, N2>>
{
typedef std::integral_constant<int, N1+N2> type;
};
@kinchungwong
kinchungwong / Cpp_Fibonacci_Working.cpp
Created November 29, 2013 02:24
This Fibonacci implementation is part of a compare-and-contrast with this other Fibonacci implementation: https://gist.github.com/kinchungwong/7701952 Technically speaking, this version (300 lines of commented code) has 46 essential semicolons for its implementation part (excluding the main function), while the other implementation (34 lines of …
// -------------------------------------------------------
//
// A fool's journey into C++ template metaprogramming,
// --- the non-shortest-path version.
//
// -------------------------------------------------------
//
// Warning: This is a recursively cursed, non-terminating
// path. See Warning.
//
@kinchungwong
kinchungwong / Cpp_Fibonacci_ThreeLines.cpp
Created November 29, 2013 05:28
This Fibonacci implementation is part of a compare-and-contrast with this other Fibonacci implementation: https://gist.github.com/kinchungwong/7700777 Technically speaking, this version has 3 essential semicolons, while the other implementation (300 lines of commented code) has 46 essential semicolons.
#include <iostream>
// Technically The First Line of Code - by semicolon counting.
template <int N>
struct Fibonacci
: std::integral_constant<
int,
Fibonacci<N - 1>::value + Fibonacci<N - 2>::value
>
@kinchungwong
kinchungwong / dotnet_imaging_discussion_20160215.md
Last active May 1, 2016 15:11
Discussion of imaging platform in dotnet

https://github.com/dotnet/corefx/issues/5921

Typical use cases

  • Intensive versus non-intensive users
    • One possible metric is to measure the total number of megapixels of images loaded into memory at any moment
  • Performance or throughput requirements
  • Library interoperability requirements
  • Functional requirements
  • 2D primitives drawing
@kinchungwong
kinchungwong / OpenCvGetSetPixelAsScalar.cpp
Created October 13, 2016 10:36
Helper functions for reading and writing untyped OpenCV matrix elements (cv::Mat without pixel type) using cv::Scalar as values
template <typename T>
struct IsOpenCvVec
: std::false_type
{
};
template <typename T, int CN>
struct IsOpenCvVec<cv::Vec<T, CN>>
: std::true_type
{
@kinchungwong
kinchungwong / beginner_advice.md
Last active March 10, 2018 13:10
beginner_advice.md

This post ("beginner_advice.md") is in public domain.


So-called "beginner advice" for programming language education, especially for self-learners

I do not recommend C as a first language. However, there are different theories about what should be the first language.

  1. Foundational approach
  • ("grammar schools and universities")
@kinchungwong
kinchungwong / (2018.03.11_18.50pm).md
Last active March 12, 2018 03:22
Wiener Denoise with Row Buffer

Purpose: an illustration of "row buffer" concept with applicability toward OpenCV OE-17

This pseudo-code illustrates the use of row buffer (a memory pool of rows of pixels, each indexed with a key that can be treated as the row number of an abstract 2D image), and how it can be used to enhance the next generation of OpenCV FilterEngine.

About OpenCV OE-17 "FilterEngine"

"The next generation of OpenCV FilterEngine" is an evolutionary proposal. See: https://github.com/opencv/opencv/wiki/OE-17.-New-Filter-Engine

About the image operation "Wiener Denoise" (a silly misnomer).

@kinchungwong
kinchungwong / RowFilterLoop_ThreeInput_OneOutput.cpp
Created March 19, 2018 08:32
RowFilterLoop_ThreeInput_OneOutput.cpp
//
// RowFilterLoop_ThreeInput_OneOutput.cpp
//
#include <cstdint>
#include <memory>
// ======
// Helper classes (stripped out)
//