(续)Function static变量引发的血案
Function static variable的后续研究和例程
Programming, Graphics Rendering and Life
Function static variable的后续研究和例程
函数静态变量引发的奇怪crash
Modern opengl (core profile), the line width is limited by system. In order to draw a free width line smooth, we draw multiple triangles to construct a thick line. pyopengl implmentation is at github: https://github.com/stonewell/code-snippets/tree/master/opengl%5Fthick%5Fline
In modern opengl (core profile), there are a lot of tutorials on how to draw a circle using fragment shader, but most of lack of source code and only show how to draw at (0,0). This code piece draw circle at given center point with specified radius. pyopengl implementation is at github: https://github.com/stonewell/code-snippets/tree/master/opengl%5Fcircle
calculate div and mod result between 2 uint64_t values without directly using / and % operator
Rendering 2d text with opengl, either using bitmap font or freetype library
SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages. SWIG is used with different types of target languages including common scripting languages such as Javascript, Perl, PHP, Python, Tcl and Ruby. The list of supported languages also includes non-scripting languages such as C#, Common Lisp (CLISP, Allegro CL, CFFI, UFFI), D, Go language, Java including Android, Lua, Modula-3, OCAML, Octave, Scilab and R.
summary
Original Post URL:https://panthema.net/2008/0901-stacktrace-demangled/ // stacktrace.h (c) 2008, Timo Bingmann from http://idlebox.net/ // published under the WTFPL v2.0 #ifndef _STACKTRACE_H_ #define _STACKTRACE_H_ #include <stdio.h> #include <stdlib.h> #include <execinfo.h> #include <cxxabi.h> /** Print a demangled stack backtrace of the caller function to FILE* out. */ static inline void print_stacktrace(FILE *out = stderr, unsigned int max_frames = 63) { fprintf(out, "stack trace:\n"); // storage array for stack trace address data void* addrlist[max_frames+1]; // retrieve current stack addresses int addrlen = backtrace(addrlist, sizeof(addrlist) / sizeof(void*)); if (addrlen == 0) { fprintf(out, " <empty, possibly corrupt>\n"); return; } // resolve addresses into strings containing "filename(function+address)", // this array must be free()-ed char** symbollist = backtrace_symbols(addrlist, addrlen); // allocate string which will be filled with the demangled function name size_t funcnamesize = 256; char* funcname = (char*)malloc(funcnamesize); // iterate over the returned symbol lines.
The iOS8 or newer platform now supports dynamic library, here is a link details about the dynamic linking. http://ddeville.me/2014/04/dynamic-linking/
Orginal Post URL:http://bruzer.net/2014/12/13/software-engineering-checklist/ Science and Engineering are fundamentally different activities. Science produces knowledge and Engineering produces products. Computer Science is a body of knowledge about computers and their use. The Computer Science field is the scientific approach to computation and its applications. A Computer Scientist specializes in the theory of computation and design of computational systems. Software Engineering is the multi-person development of multi-version software programs. Software Engineering is about the application of engineering to the design, development and maintenance of software.
When create executable or dynamic library, sometimes they need to depends on third-party shared library, so how system find the third-party shared library and how can you make sure the system find the right version of library instead of some library in same name? Solution could be pack the correct third-party library with your executable or library, but how to let system find the packed library? most platform has search directory list to find dependent libraries, even you put the third-party library in the same directory, the system still could find wrong one.
jar.mn document http://dxr.mozilla.org/mozilla-central/source/build/docs/jar-manifests.rst https://developer.mozilla.org/en-US/docs/HowMozilla'sbuildsystemworks https://developer.mozilla.org/en-US/docs/UsingDependentLibrariesInExtension%5FComponents https://developer.mozilla.org/en-US/docs/Bundlingmultiplebinary%5Fcomponents https://code.google.com/p/gears/source/browse/trunk/gears/base/firefox/static%5Ffiles/components/stub.js https://developer.mozilla.org/en-US/Add-ons/CreatingCustomFirefoxExtensionswiththeMozillaBuildSystem https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Guide/Cross-threadcallsusing%5Frunnables
dynamic_cast requires RTTI flag when do compiling, the RTTI will increase object size. and RTTI only generate for polymorphic classes. class A { public: std::string m_Data; } although A class is not polymorphic, but the m_Data is a instance of polymorphic class, the sizeof(A) will change when compile with/without RTTI. programmer should be very carefully when link with third-party library, it is more difficult to find out the crash compare to pack problem.
summary
To create auto increment build number without third-party component, script or other code, just pure ant tasks. please refer to http://stackoverflow.com/questions/1431315/build-numbers-major-minor-revision
summary
When using PowerMock https://code.google.com/p/powermock/ to do unit test, some times jvm may report bytecode version mismatch and refuse to run, it caused by PowerMock will dynamic change the bytecode. Add -noverify option to fix the problem
The error message looks like Error occurred during the SSL handshake: invalid SSL session It may caused by JVM needs the JCE, download JCE from Oracle and follow instructions in README http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
Decode a hex string by using look up table char m_table['f' + 1]['f' + 1] = {0}; void initDecodeTable() { const char * hexValue = "0123456789abcdefABCDEF"; int len = strlen(hexValue); for(int i=0;i < len;i++) { for(int j=0;j int v; char tmp[2] = { tolower(hexValue[i]), tolower(hexValue[j]) }; sscanf(tmp, "%x", &v); m_table[hexValue[i]][hexValue[j]] = (v & 0xFF); } } } void decodeHex(const char * pIn, int inLen, char * pOut, int & outLen) { outLen = inLen / 2; for(int i=0; i < outLen;i++) { pOut[i] = m_table[pIn[i * 2]][pIn[i * 2 + 1]]; } if (inLen % 2 !