ExtendJ!

All

Intro

Reading some things and found ExtendJ, very nice tool. There is actually a paper [2].

Multiplicities: the idea programing with one object the same way you deal with many.

ExtendJ

Developed by Jesper Öqvist and other students, they implemented a series of extentions on Java. For example the Spread method. You do one thing the same way you do the many objects.

For them to do this, they implemented the @any operator.
Example of making several people work at the same time!

   People A = new People(“A”)

   People B = new People(“B”)

   @any

    peoples.work();

                          status = A.status();

 

In this case status is equals to working!! AMAZING! But ExtendJ is more power and helps to build extentions to Java code, for example Data Flow analysis and other mechanisms above – extending – Java, basically providing hook points so you can attach your extentions, i.e. extention points.
The original website is this [3] and the source here is [4].

Citation

@inproceedings{Oqvist:2018:EEJ:3191697.3213798,
 author = {\"{O}qvist, Jesper},
 title = {ExtendJ: Extensible Java Compiler},
 booktitle = {Conference Companion of the 2Nd International Conference on Art, Science, and Engineering of Programming},
 series = {Programming\&\#39;18 Companion},
 year = {2018},
 isbn = {978-1-4503-5513-1},
 location = {Nice, France},
 pages = {234--235},
 numpages = {2},
 url = {http://doi.acm.org/10.1145/3191697.3213798},
 doi = {10.1145/3191697.3213798},
 acmid = {3213798},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {Compiler Generators, Extensible Compilers, Reference Attribute Grammars},
}

REFs

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

[2] ExtendJ: extensible Java compiler

[3] https://extendj.org/getting_started.html

[4] https://bitbucket.org/extendj/extendj

Elixir

All

Intro

I remember the class of professor Ismar Frango, back in 2012 on Paradigms of programming. It was mind blowing to think recursively but to implement in C or C++ it was a bit tough. Nowadays, with python and elixir, dude! it’s much easier.

Elixir

I started learning Elixir some time back, when I make a mistake in one of my python programs and Elixir came with “end” in function. It was like, well, this is a broken python. But not, it’s much more than that.

To learn I use this blog [2] and this tutorial [1] It’s from there that I stole the code below. Elixir is very powerful for pattern matching [3].

defmodule Recursion do
  def print_multiple_times(msg, n) when n <= 1 do
    IO.puts msg
  end

  def print_multiple_times(msg, n) do
    IO.puts msg
    print_multiple_times(msg, n - 1)
  end
end

Recursion.print_multiple_times("Hello!", 3)

 

REFs

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

[2] https://elixir-lang.org/getting-started/recursion.html

[3]https://medium.com/mobileforgood/5-things-we-like-about-elixir-coming-from-python-c19cbae7484d

 

Bob Dylan

All

I created this post a long time ago, when the Nobel prize was annouced and before Bob refusing to go there.

Well, here comes the hystory of a hurricane! Congrats Dylan! You’re just great

 

Python Fractal from [1]

import turtle
PROGNAME = ‘Sierpinski Triangle’
#Credits: This code was written by editing the code from http://www.lpb-riannetrujillo.com/blog/python-fractal/

myPen = turtle.Turtle()
myPen.ht()
myPen.speed(5)
myPen.pencolor(‘orange’)

points = [[-175,-125],[0,175],[175,-125]] #size of triangle

def getMid(p1,p2):
return ( (p1[0]+p2[0]) / 2, (p1[1] + p2[1]) / 2) #find midpoint

def triangle(points,depth):

myPen.up()
myPen.goto(points[0][0],points[0][1])
myPen.down()
myPen.goto(points[1][0],points[1][1])
myPen.goto(points[2][0],points[2][1])
myPen.goto(points[0][0],points[0][1])

if depth>0:
triangle([points[0],
getMid(points[0], points[1]),
getMid(points[0], points[2])],
depth-1)
triangle([points[1],
getMid(points[0], points[1]),
getMid(points[1], points[2])],
depth-1)
triangle([points[2],
getMid(points[2], points[1]),
getMid(points[0], points[2])],
depth-1)
triangle(points,4)

REFs

[1]http://www.101computing.net/python-fractals/

GLS School

All

Intro

I was watching Learn German with Jenny[2] and I remembered my GLS classes. GLS, which stands for German Learning School, is a school in Berlin about zu + infinitive.

By the way, Berlin is fantastic, is one of the best schools I have ever been, special people and stuff all over. So many things to do, and people all over the world always very nice and open. There were some not that cool people but the percentage was very low actually. Being there during the World Cup was very special.

The wall is very very interesting, it shows how bizarre and segregative the humans can be.

Zu + inf / Verb + inf

Ich habe Lust ins Kino, zu gehen.

Ich habe versprochen, ihm am Wochenende zu helfen.

Those sentences doen’t have subjective and actually use the verb in the infinitive[1]

There are verbs that don’t need to zu though:

Present: Ich sehe den Postboten kommen.

Past: Ich habe den Postboten kommen sehen.

Present: Sie hat das baby schreien horen.

References

[1] https://mein-deutschbuch.de/infinitivsaetze.html

[2] https://www.youtube.com/watch?v=dCccMZKLT3M

 

 

Pedagogy of the OPPRESSED

All

Nowadays is seems to be a not popular thing to talk about Paulo Freire, but I will write this post anyways.

The oppressed shall not be the oppressor of the oppressor.

Pedagogy of the oppressed

   1 – Find the oppressor
             The delimitation of rules and lines makes the oppressor less humanized, since making another human being oppressed makes one less human.

    2 –  The oppressor should strugle to have equal right, i.e. not having a huminized relationship.

3 – Freedom of the oppressor’s power though transformation of reality. Freedom is not an manifestation but rather a entire mobilization and change.

    4 – The pedagogy will become therefore the pedagogy of all mans.

 

Movie reference
  In the end of The Hunger Games – Mockingjay – Katniss , must kill the oppressor (Snow) and then she actually realize that the oppressor will just be replaced and kills Coin.
[1] Pedagogy of the Opressed. Paulo Freire

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