Numpy testing for good

All
Intro
   I remember to strugle a lot for comparing unit testing arrays one day and then my boss came and “Francisco, come on, use Numpy testing!” Boom! nice clean.
Numpy testing
  You can find it here [1] and currently uses pytest framework to test the things.
assert_almost_equal
   What saved me that day was assert_equals and all its friends.

(Share)latex

All
Intro
I’m sad that sharelatex will be integrated to Left, I really like its UI and all.
I think I will need to adapt, since I’m on the loser side, which I’m proud of though.
All my life is on Github and Sharelatex, I just hope they don’t dump all of it on the trash actually.
My tip of the day is the use of latex for math, which is quite simple:
\begin{equation*}
  1 = 3 - 2
\end{equation*}
Code stolen from [1].
Ref

Abstract Class in C++ / ABC

All

Intro

I was wondering recently if I miss some C++ class because I did not remember the keyword abstract in C++. Like, there was an abstract class, but not the abstract keyword.

The magic is done via virtual function =0 –>  the so-called pure virtual function.

Early binding and late binding

Virtual function  & Pure Virtual

class AbstractClass {
public:
  virtual void AbstractMemberFunction() = 0; // Pure virtual function makes
                                             // this class Abstract class.
  virtual void NonAbstractMemberFunction1(); // Virtual function.

  void NonAbstractMemberFunction2();
};

 

Virtual functions: the correct function will be called, derived or base class.

Pure virtual functions: It must be overridden by the inherent class.

REFs

[1] https://www.geeksforgeeks.org/virtual-function-cpp/

[2] http://www.cplusplus.com/doc/tutorial/polymorphism/

 

Complexity

All

Intro

I was reading an article from MURRAY GEEL-MANN  it was enlighting. The article is small and very interesting, it’s simple. Reading you can see how brilliant is the guy that wrote it, you can see that actually he talks about quarks and gluons the same way I talk about my favorite soccer team, Palmeiras.

Effective complexity and logical deepness

He was describing that actually, some phenomena are not complex but rather have some degrees of logic behind[1]. As a fractal, like the one below, which comes from the Fibonnaci sequence, in fact, Fibonacci word. They describe it with more details on [2]. Btw the link is for Wikiwand – ” Wikipedia fastest reader”.

download (2)

                                      copied/stolen from [2]

REFs

[1] https://onlinelibrary.wiley.com/doi/pdf/10.1002/cplx.6130010105

[2]http://www.wikiwand.com/en/Fibonacci_word_fractal

 

LUA Programming

All

Intro

Hey boy, just use this Lua script and everything will be ok on your game. It’s all embedded!

Lua

An interesting tutorial about Lua embedded is [1]. So cool to learn about embedding Lua in C and C++. The code below, from the same source, is so simple and prints:

The average is  30
The sum is      150
#include <stdio.h>

#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"

/* the Lua interpreter */
lua_State* L;

/* The function we'll call from the lua script */
static int average(lua_State *L)
{
        /* get number of arguments */
        int n = lua_gettop(L);
        double sum = 0;
        int i;

        /* loop through each argument */
        for (i = 1; i <= n; i++)
        {
                if (!lua_isnumber(L, i)) 
                {
                      lua_pushstring(L, "Incorrect argument to 'average'");
                      lua_error(L);
                }

                /* total the arguments */
                sum += lua_tonumber(L, i);
        }

        /* push the average */
        lua_pushnumber(L, sum / n);

        /* push the sum */
        lua_pushnumber(L, sum);

        /* return the number of results */
        return 2;
}


int main ( int argc, char *argv[] )
{
        /* initialize Lua */
        L = lua_open();

        /* load Lua base libraries */
        lua_baselibopen(L);

        /* register our function */
        lua_register(L, "average", average);

        /* run the script */
        lua_dofile(L, "average.lua");

        /* cleanup Lua */
        lua_close(L);

        return 0;
}

REFs

[1] https://debian-administration.org/article/264/Embedding_a_scripting_language_inside_your_C/C_code

Note taking (Do what I say, not what I do)

All

Intro

   I remember I taking notes on google docs and one collegue, just before leaving back to the UK, suggested BoostNote, which is quite interesting indeed.

BoostNode vs Google Docs

   I personally think BoostNote is great and everyone should use it actually, however, I myself will continue to work with my Google Docs, I just don’t want to bother about migrating one to another, all that thing. But here is a good tutorial [1]

Ref

[1]: https://www.youtube.com/watch?v=L0qNPLsvmyM

Information is useless without sharing

All

Intro

Listening to Seu Jorge, a Brazilian guy from Rio de Janeiro, I came to this song below. It’s called Ze do Caroco and talks about a guy in 70’s that actually developed a sound system in his Slum, aka favela, to broadcast good things of the people of their people. He used to broadcast exactly during the soap opera, aka novela, since those days these shows only used to portrait bad info about favela’s people. The song also claims there should be another person like this, going against bad reputation/news from the MAIN media groups.
Later Zeh do caroco was denounced by a neighbour since this person couldn’t watch the soap-opera!

Information is useless without sharing

I think one of the main reasons I created this blog was not to share some of the content I’ve been learning those last years in my field. From Performance to Paulo Freire, information is only knowledge when shared.

I would like also to thanks my college and close friend, Gabriel Alabarse, for all his all on our projects. Although since 2015 we don’t live in the same country, Canada vs Germany, we work close to spread this content for all the people.

REF

Extreme flexible word order

All

Intro

The English/pt/francais sentence structure is a bit rigid when you start learning languages with declination, like German, Russian or Arabic. They are extremely flexible, you can pretty much paint with each sentence. But at the same time, it makes the learning process more difficult.

Rules

A simple structure in German can have at least 4 ways to write:

Standard: SUBJ + OBJ + PRED Dir + PRED ind

German way:

SUBJ + VERB+ OBJ + PRED Dir + PRED ind

OBJ + VERB + SUBJ +PRED Dir + PRED ind

PRED Dir+VERB + SUBJ + OBJ + PRED ind

PRED ind + VERB + SUBJ + OBJ + PRED Dir +

regel 1:

If a modal verb is used – for future, past, or obligation – the main verb must be at the end: verbklasser.

regel 2:

if anything other than the subject comes on the first position, the pronoun must be in the third position!

So with those two rules, basic sentences can be built.

REFs

My German teacher, Lena.

TCL Language

All

Intro

Working a bit with TCL now and it’s actually a very interesting language and has a C like similar syntax. But is very powerful and you can define classes.

TCL

CLASS END_MILL_NON_INDEXABLE 
      {
        TYPE QRY
        QUERY  "[DB(SubType)] == [01]"
        FILE "qry=shank_mill_schema;rset=shank_mill_schema;" 
        DIALOG libref Diameter FluteLength CorRadMill TaperAngleB TaperedSDia Material Holder Descr
        RSET   libref Descr Diameter FluteLength CorRadMill TaperAngleB TaperedSDia MaterialDes HolderDes HolderRef
        UI_NAME "End Mill (non indexable)"
      }

Code from [2].

 

Ref

[1] https://www.tcl.tk/about/language.html

[2] https://docs.plm.automation.siemens.com/tdoc/nx/12.0.1/nx_help/#uid:xid390955

Event Tracing Windows or ETW

All

Intro

I remember when I went to a meeting on Google Montreal about ETW and tracing on Windows. The spearker was

ETW

It is the official tool for kernel tracing in windows platform developed by Microsoft. This allows the user to see call stacks and analysis system calls.
IU for ETW

It is the ETW but with some user interface features to improve ETW.

Tutorial

Bruce Dawson have done an amazing  tutorial, with videos al all here [2]

More info here

[1]here: https://msdn.microsoft.com/enus/library/windows/desktop/aa363668(v=vs.85).aspx

[2] https://randomascii.wordpress.com/2014/08/19/etw-training-videos-available-now/