Saturday, September 1, 2018

The history of "foo" & "bar"


http://programmers.stackexchange.com/questions/69788/using-foo-and-bar-in-examples

Start Python for C, C++ programmmer


Python Tutorial
http://docs.python.org/2/tutorial/index.html

Matplot Lib.
http://coreapython.hosting.paran.com/manual/Matplotlib%20-%20pylab%20-%20matlab%20style%20python%20plotting%20(plots,%20graphs,%20charts).htm (Korean Version)


Python: Tips 1

sprintf in Python
------------------------------

How to do a sprintf in Python
http://www.johnkerl.org/python/sprintf.html

[Tutor] sprintf-like functionality in Python
http://mail.python.org/pipermail/tutor/2003-August/024921.html

Python/파이썬] C언어의 sprintf 함수 구현 예제
http://mwultong.blogspot.com/2007/01/python-c-sprintf.html


gmtime conversion in Python
------------------------------

Python time gmtime() Method

http://www.tutorialspoint.com/python/time_gmtime.htm


import time
time.gmtime(xxxxxxxxx.xxx)


Python isNumber
------------------------------



http://mwultong.blogspot.com/2007/01/python-isnumber-isnum-isnumeric.html

def isNumber(s):
  try:
    float(s)
    return True
  except ValueError:
    return False

Case Ranges

in the Linux kernel, you can find below code

switch (val) { case 1 ... 10:         /* ... */         break; case 11 ... 20:         /* ... */         break; default:         /* ... */ }
It is a GCC extension.




CPU load & CPU stat

     user    nice   system  idle      iowait irq   softirq  steal  guest  guest_nice
cpu  74608   2520   24433   1117073   6176   4054  0        0      0      0

Algorithmically, we can calculate the CPU usage percentage like:
PrevIdle = previdle + previowait
Idle = idle + iowait

PrevNonIdle = prevuser + prevnice + prevsystem + previrq + prevsoftirq + prevsteal
NonIdle = user + nice + system + irq + softirq + steal

PrevTotal = PrevIdle + PrevNonIdle
Total = Idle + NonIdle

# differentiate: actual value minus the previous one
totald = Total - PrevTotal
idled = Idle - PrevIdle

CPU_Percentage = (totald - idled)/totald


cpu  114466 58760 208131 183612 1490 18 5178 0 0 0
cpu0 20966 6912 72976 161278 1200 3 3263 0 0 0
cpu1 18880 6959 39092 4213 20 5 112 0 0 0
cpu2 18665 6782 29917 4321 21 2 50 0 0 0
cpu3 18134 6434 27657 4442 21 2 62 0 0 0
cpu4 10008 8231 10491 2308 63 0 1003 0 0 0
cpu5 9338 8080 9868 2382 64 0 240 0 0 0
cpu6 9210 7570 9186 2392 40 2 226 0 0 0
cpu7 9265 7792 8944 2276 61 4 222 0 0 0



http://stackoverflow.com/questions/23367857/accurate-calculation-of-cpu-usage-given-in-percentage-in-linux

Notpad++ plugin x64

[Release]
- Add Library
Property > Linker > Input > Additional Dependencies
add the library full path (include file name)

- Add preprocessor define
Property > C/C++ > Preprocessor > Preprocessor Definitions
add define word e.g., __TEST_DEF__


[Debug]
error D8016: '/Ox' and '/RTC1' command-line options are incompatible
- Property > C/C++ > Code Generation > Basic Runtime Checks
from "Both (/RTC1, equiv. to /RTCsu) (/RTC1)" to "default"


About source code
how to use zlib in C++
http://windrealm.org/tutorials/decompress-gzip-stream.php
Base64, open source in apple
https://opensource.apple.com/source/QuickTimeStreamingServer/QuickTimeStreamingServer-452/CommonUtilitiesLib/base64.c


// display string in new tab window
::SendMessage(nppData._nppHandle, NPPM_MENUCOMMAND, 0, IDM_FILE_NEW);

HWND hCurrScintilla = getCurrentScintillaHandle();
::SendMessage(hCurrScintilla, SCI_SETTEXT, 0, (LPARAM)SSRM_log);

[Change Project Name]
open editor and change file name and directory path
 - XXX.sln
 - XXX.vcxproj




Machine Learning

Russ Salakhutdinov


Russ Salakhutdinov,
 Professor at Carnegie Mellon University, Director of AI Research at Apple

http://www.cs.cmu.edu/~rsalakhu/talk_Simons_part1_pdf.pdf
http://www.cs.cmu.edu/~rsalakhu/talk_Simons_part2_pdf.pdf
http://www.cs.cmu.edu/~rsalakhu/talk_Simons_part3_pdf.pdf
http://www.cs.cmu.edu/~rsalakhu/talk_Simons_part4_pdf.pdf