java

Java

Java

Hi there,

What better way to celebrate Canada Day than to talk about Java, the legacy of a Canadian computer scientist, James Gosling.

Java is a general-purpose computer-programming language that is:
• concurrent,
• class-based,
• object-oriented, and
• specifically designed to have as few implementation dependencies as possible.

It is intended to let application developers “write once, run anywhere” (WORA), meaning that compiled

Java code can run on all platforms that support Java without the need for recompilation.

Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of computer architecture. […]

Java was originally developed by James Gosling at Sun Microsystems[…]. The language derives much of its syntax from C and C++, but it has fewer low-level facilities than either of them.

Source: Wikipedia

 

Java :: Features

Java features

Java features

 

Several articles describe quite in depth Java’s many features.

I found an article that talked about Java’s features on JavaTPoint. Here is a recap of the features discussed in the article:

 

Simple

“Java is very easy to learn and its syntax is simple, clean and easy to understand.” — JavaTPoint

 

Object-oriented

“Java is object-oriented programming language. Everything in Java is an object.” — JavaTPoint

 

Platform Independent

“Java code can run on all platforms that support Java without the need for recompilation” —
Wikipedia

Java is a “write once, run anywhere” type of language.

 

Secured

“Java is best known for its security. With Java, we can develop virus-free systems. Java is secured because:

• No explicit pointer
• Java Programs run inside virtual machine sandbox” — JavaTPoint

 

Robust

“Robust simply means strong. Java is robust because:

• It uses strong memory management.
• There are lack of pointers that avoids security problems.
• There is automatic garbage collection in java which runs on the Java Virtual Machine to get rid of objects which are not being used by a Java application anymore.
• There is exception handling and type checking mechanism in java.” — JavaTPoint

 

Architecture-neutral

“Java is architecture neutral because there is no implementation dependent features e.g. size of primitive types is fixed.

In C programming, int data type occupies 2 bytes of memory for 32-bit architecture and 4 bytes of memory for 64-bit architecture. But in java, it occupies 4 bytes of memory for both 32 and 64 bit architectures.” — JavaTPoint

 

Portable

“Java is portable because it facilitates you to carry the java bytecode to any platform. It doesn’t require any type of implementation.” — JavaTPoint

 

High-performance

“Java is faster than other traditional interpreted programming languages because Java bytecode is “close” to native code. It is still a little bit slower than a compiled language (e.g. C++). Java is an interpreted language that is why it is slower than compiled languages e.g. C, C++ etc.” — JavaTPoint

 

Distributed

“Java is distributed because it facilitates users to create distributed applications in java. RMI and EJB are used for creating distributed applications. This feature of Java makes us able to access files by calling the methods from any machine on the internet.” — JavaTPoint

 

Multi-Threaded

“A thread is like a separate program, executing concurrently. We can write Java programs that deal with many tasks at once by defining multiple threads. The main advantage of multi-threading is that it doesn’t occupy memory for each thread. It shares a common memory area.” — JavaTPoint

 

Dynamic

Java is a dynamic language. It supports dynamic loading of classes. It means classes are loaded on demand. It also supports functions from its native languages i.e. C and C++.

Java supports dynamic compilation and automatic memory management (garbage collection).” — JavaTPoint

 

Java :: Users Headcount

So, the question is: “how many people use Java around the world?”

I have not found an updated estimate for 2018 or even for 2017. From what I read, that number oscillated around 9 million developers in 2010.

Here are some articles to consider:

 

Java :: Many Uses

Because of its many features, Java is the keystone of many online games, video applications, chat applications, banking applications, trading applications, e-Commerce applications (such as a shopping cart), etc.

Here are some concrete examples:

NASA :: WorldWind

NASA Worldwind Java

NASA Worldwind Java

NASA WorldWind Java enables you to build a cross-platform geospatial desktop application in Java” — NASA WorldWind.

Demo

WorldWind Java GitHub repository

 

Trading Application :: MUREX

This trading application, written in Java, provides a fully integrated front-to-back for Banks connectivity.

"Bank of China has chosen Murex's MX.3 platform to provide a fully integrated front-to-back solution for treasury and trading." -- WatersTechnology

 

Java :: Set-up

  1. Download Java
  2. Install Eclipse

 

Java :: “Hello World!”

Write your first program in Java:

  1. Open Eclipse
  2. Click “Workbench” on the top-right corner of the screen
  3. Click on the arrow of the new icon (a menu will unfold)
  4. Click on Java Project
  5. Name your Java project and click “Finish”
  6. Click on “Create”
Java new project

Java new project

 

Cheers!

@CodePyXi

MAMP

Hi there,

Here are few notes on how to set up a local server environment on Mac OS X by installing PHP, MySQL, and Apache using MAMP.

The goal of this post is to be able to have a sandbox (a local server environment) in order to create a web site prior to uploading it on the web.

 

4 Steps to follow

There is already a webpage with steps to follow in order to get this done:

Installing WordPress Locally on Your Mac With MAMP

• The URL (http or https) designates the protocol that is used to locate the file or resource on the World Wide Web (www). In other words, the protocol is in charge of “calling” the server on the Internet World Wide Web.

Dissecting a web address (the URL)

http(s)      ://      www.      (sub-domain.)      DomainName.      com

NOTE 1: Items in parentheses are optional.

For instance, let us dissect the web address for this site: PyProject where you are right now if you are reading these lines 😉

dissect_pyproject

https://www.pyproject.com/

  • Protocol : http
  • DomaineName: pyproject.com
  • Top-Level Domain: .com
    You can also have :
    .net
    .org
    .edu
    .ca
    .fr
  • root folder :

    The root directory of your website is the content that loads when visitors access your domain name in a Web browser.

    Your website’s root directory depends on whether the domain name is your primary domain name or another type […]

    Your primary domain name’s root directory is the root of the hosting account, which can be symbolized as a single forward slash (i.e. “/” without the quotation marks), or as an entirely blank field.
    Source: GoDaddy

    If all the wordpress files were directly placed into the htdocs directory, then the hierarchy be as follows:

    root_folder_hierarchy_2

    Once your implementation has been finished, verify this by typing:
    localhost:8888/

    Furthermore, if the wordpress folder was placed in the htdocs directory, then the hierarchy would be:

    root_folder_hierarchy_1

    Once your implementation has been finished, verify this by typing:
    localhost:8888/wordpress/

    Finally, taking this idea a step further, let us say that all the wordpress files placed in another file called toto, then the hierarchy would look like:

    root_folder_hierarchy_3

    Once your implementation has been finished, verify this by typing:
    localhost:8888/wordpress/toto/

hypertext access file (alias .htaccess file )

If needed, it is possible to delete the word from the root file.

.htaccess files provide a way to make configuration changes on a per-directory basis […]
.htaccess files (or “distributed configuration files”) provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.
Source: Apache.org

In addition, here is a useful tutorial in order to play with the .htaccess configuration file.

The Wikipedia explanation is also quite good:

A .htaccess (hypertext access) file is a directory-level configuration file supported by several web servers, used for configuration of site-access issues, such as URL redirection, URL shortening, Access-security control (for different webpages and files), and more.

Analogy by R:

htdocs est le dossier équivalent au dossier www sur ton serveur

Meaning, the htdocs file is the equivalent to the www-file on the server.

Sub-domain

In addition, let us say that I want to add a sub-domain like “portfolio”. Here is what the ulr structure will look like:

https://portfolio.pyproject.com/

      • Protocol : http
      • DomaineName: pyproject.com
      • Subdomain: portfolio
      • Top-Level Domain: .com
        You can also have :
        .net
        .org
        .edu
        .ca
        .fr

It is worth mentioning that the subdomain name replaced the “www” part.

GoDaddy has a usefule article on subdomains.

Furthermore, here is some info about the Domain Name System

The Domain Name System (DNS) has a tree structure or hierarchy, with each non-RR (resource record) node on the tree being a domain name. A subdomain is a domain that is part of a larger domain; the only domain that is not also a subdomain is the root domain.
Source: Wikipedia

IP address

An Internet Protocol address (IP address) is a numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication.
An IP address serves two principal functions:
• host or network interface identification and
• location addressing.
Internet Protocol version 4 (IPv4) defines an IP address as a 32-bit number.
Source: Wikipedia

Since we are setting up a local server environment, let us see the difference between a local IP address versus an external IP address.

External IP address:

      • Given by: Internet Service Provider
        When the web browser requests a webpage, it sends this IP address along with it.
        It is worth mentioning that every website has its own IP addres.
        If you are curious to know what is your external IP address, head to Bing or Google and type: “IP address” they will give it to you.
      • Dissecting the external IP address: Recall that the “Internet Protocol version 4 (IPv4) defines an IP address as a 32-bit number”
        This means that the IP address has 4 blocks of numbers each ranging from 0 to 255.

32-bit_IP_address

Local IP address:

      • Given by: Network Router
        Routers with default settings provide a local IP address to all connected computers. This IP address is for internal use.
        Since the goal of this blog post is to set up a local server environment, this will become handy.
        The IP
      • Dissecting the local IP address: The network router will adjust the local IP addresses in order to provide hierarchical order information about the devices connected to it.
        Most local IP addresses start like this: 192 . 168 . ___ . ___
        The last digit represents the number of devices connected to it in the order of arrival.

MAMP administrator page

      • WordPress   ←   App MAMP  →   Internet (www)
        The objective is for WordPress.org to communiate with the Internet
      • WordPress   ←   App MAMP  →   Local Network (Network Router)

Local        ⇔        Web

locahost        ⇔        http(s)
local server environment                 web hosting services
MAMP        ⇔        Orongo/Bluhost/ …

localhost:8888/MAMP

Port: 8888
Software used: MAMP.app

      1. Click MAMP icon
      2. localhost:8888/MAMP/?language=English
        This step will open the MAMP dashboard
      3. PHP
        Click on php Info
        localhost:8888/MAMP/index.php …
        Apache port: 8888
        NOTE: This status site will warn us if there are updates to do.
      4. MySQL
        Click on phpMyAdmin
        phpMyAdmin Dashboard
        • localhost
        • 3306  →   phpMyAdmin port
        • root
        • root
        • /Application/MAMP/tmp/mysql/mysql.sock
        • This dashboard will allow you to save a DataBase when time comesExport method  →   Quick (by default)
        Import method  →   If there is a problem with the database and you need to re-install a database (previously saved), it will be done with this tab.

UTF8

According to Wikipedia, there are 52 official languages. So, the world has come with ways of writing these rich assortment of alphabets and characters.

The Unicode Character Table explains the UTF8 as follows:

A character in UTF8 can be from 1 to 4 bytes long. UTF-8 can represent any character in the Unicode standard. UTF-8 is backwards compatible with ASCII. UTF-8 is the preferred encoding for e-mail and web pages

Default configurations

      • Apache Port: 8888
      • Nginx Port: 7888
      • MySQL Port: 8889

Downloading WordPress

If you are following the steps enunciated on “Installing WordPress Locally on Your Mac With MAMP”, the last step is the WordPress download.

Web-server: Apache
Macintosh HD/Applications/MAMP/htdocs

      • Recall: htdocs is the root folder
        MAMP document root: htdocs

NOTE 2: The current PHP version is 7.2.1. So, befaure launching the website via the web hosting service, it will be important to verify the compatibility of the PHP version with WordPress.

NOTE 3: The local server environment can be on my computer as well as on the cloud.

Database

wordpress  →   collation  →   create

Query

NOTE 4: Before launching the website online, change the DataBase host.

      • Name: wordpress
      • Username: root
      • Pass…: root
      • Host: localhost

Voilà!

Hotel Montreal Espace Confort

mkdir -p Saturday/Code/Dance

Hi there,

Here is another opportunity to JOIN a code and dance session this month.

The goal of these get-togethers is to work on a project of your own along with fellow programmers for approximately two hours and then shake the week’s stress away on the dance floor.

Code sesh :

We will meet at the Tea Lounge of the Hotel Montreal Espace Confort.

Hotel Montreal Espace Confort (lobby)

Hotel Montreal Espace Confort (lobby) Photography by Maryia Georgieva

This is a cozy, delicious and laid-back place to code. There is Wi-Fi.

  • Date: May 26th, 2018
  • Time: from 2pm to 4pm
  • Venue: Hotel Montreal Espace Confort
    2050, rue Saint-Denis, Montréal, QC, H2X 3K7

Dance sesh :

There are many places where you can dance on a Saturday in Montreal. However, just for the sake of dancing on the same dance floor here is my suggestion: Moka

  • Date: May 26th, 2018
  • Time: from 4pm to 8pm
  • Venue: Moka Social
    Espace-Des-Arts
    9, rue Sainte-Catherine Est, #101, Montréal

New coders

If you are new to coding, bring a book, a project and your questions. Then ask some more questions. Finally, start coding. There is no “perfect” way to start, so you might as well start.

When I started many people told me to find a project and then start to code from there. Frankly, I was skeptical. I thought a more structured (read academic) way would be more suitable. If you are curious to start, I would suggest to start with a project and then dive into a book. It will be much more fun.

Seize this very minute.
What you can do, or dream you can, begin it.
Boldness has genius, power and magic in it.

Johann Wolfgang von Goethe

New dancers

If you are new to salsa or dance in general, this is a golden opportunity.

Carpe Potestatem

You may start with a beginners class before our get-together or just dive into on May 26th.

In case you want to learn the basics, here are some places to start for free.

    • Club 649: On Mondays there is a beginner salsa lesson at 9:30pm.
    • Salsa Etc: Free trial class (beginner level) on May 27th, 2018.

Also, bring a pair of comfortable shoes and let yourself enjoy the rhythm, the melody and the people.

Just so you know, this is no dancing contest. Believe me: everyone is busy spinning and enjoying themselves. So, relax and have fun!

“Let the greate world spin” written by Colum McCann

See you on Saturday.

EventBrite :: mkdir -p Saturday/Code/Dance

@codepyxi

mkdir_-p_mkdir_code_dance_18-fev-2018

mkdir -p Sunday/Code/Dance

Hi there,

This coming Sunday, February 18th, the very first session of Code and Dance will take place.

Whether you are a newbie to the coding world or work with:

• ASM
• C
• C++
• OCaml
• Python
• Java
• Haskell
• Swift
• PHP
• Perl
• Elixir
• Clojure
• MATLAB
• JavaScript

just to name a few, you are welcome to drop by.

Bring your homework/project/idea and dedicate some time to it along with some other fellow coders.

Coding in groups is:

  • fun,
  • productive, and
  • ideal to bounce ideas off.

Here is a TedTalk by Steven Johnson that might shed some light on where good ideas come from 😉

The idea is to meet at Montreal Espace Confort‘s “coding lounge” in order to code for a couple of hours. Afterwards, the dance part will kick in.

If you are willing to learn how to salsa, an intro free class will be available from 4:00pm to 5:30pm by Mr. Alberto Azpuru from the dance school Salsa Etc. It is important to register beforehand in order to attend the salsa class.

Forseeing questions that might arise, here are some answers:

  • Do I need a special attire? No. Just wear comfortable shoes and clothes. Jim Carrey’s “Cuban Pete” attire belongs in a movie or a dance show. So, no worries about that.
  • Do I need to know the basics beforehand? Nope. The only two things you need is a dose of courage to step outside your comfort zone and your willingness to have fun.

If you have other questions, please leave them in the comment section below.

Recap: mkdir -p Sunday/Code/Dance

Code Section

Date: Sunday, February 18th, 2018
Time: from 1:00 p.m. to 3:30 p.m.
Venue: Coding Lounge at Montreal Espace Confort
2050, rue Saint-Denis, Montreal, QC

 

Dance Section

Date: Sunday, February 18th, 2018
Time: from 4:00 p.m. to 5:30 p.m.
Venue: 4461 Rue Saint-Denis, Montréal, QC H2J 2L2
Price: Free as long as you register before February 18, 2018 at noon.

Please register at the EventBrite page.

See ya Sunday!

@codepyxi

 

OCaml

Hi there,

ocaml

Here is an interesting language I came accross today: OCaml.

What is OCaml? OCaml is a general purpose industrial-strength programming language with an emphasis on expressiveness and safety. It is the technology of choice in companies where a single mistake can cost millions and speed matters, and there is an active community that has developed a rich set of libraries.

Source: https://ocaml.org/learn/

Moreover, I found an interesting article talking about the pros and cons of this language. Esper Tech Blog, the author of the article addressed my next quesiton as well: “who uses OCaml?”

To my surprise, many well-know companies use it such as:

The tools that will get you started are:

The Web-based OCaml compiler makes it easy to jump-start playing around with the language.

Have fun!

@codepyxi

Install Django in a virtualenv

djangoproject

djangoproject

Installing Django in a virtual environment

Django is an open-source MTV (Model Template View) framework written in Python for building web applications.

Get Started:

Step 1) pip

If you already have Python 2 or Python 3 installed in your computer, go ahead and verify you have pip:

In your Terminal run:

$ which pip
/usr/local/bin/pip
$ pip –version
pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)

If you do not have pip, the run:

$ sudo easy_install pip

Step 2) virtual environment

Install the virtual environment

$ sudo pip install virtualenv

mac_terminal_pip_install_virtualenv

Done! The virtual environment is installed.

Navigate where you want to test/play with Django

Go to the main directory where you want to work.

Here are some useful commands to navigate in your Terminal:

  • pwd
  • ls
  • cd
  • cd ..
  • clear
  • mkdir

I decided to work from the Desktop:

~ $ cd Desktop

Create a directory where you want test/play with Django

Next, create a directory where you want to work from:

:Desktop $ mkdir DjangoVM

Name your virtual environment

It is time to name your brand new virtual environment:

DjangoVM $ virtual sandbox

I decided to name my virtual environment “sandbox” but you can name it whatever you like.

Congrats! Your virtual environment is now installed.

mac_terminal_virtualenv_name

See it for yourself:

:DjangoVM $ cd sandbox
:sandbox $ ls
bin                 lib
include        pip-selfcheck.json

Entering the Virtual Environment

enter_virtual_environment

$ source bin/activate
(sandbox)  :sandbox $

That’s it.

The name sounds cooler than what we just got. I mean, we had much more going on while installing pip or even virtualenv. Well, again, that is it.

Step 3) django

Before installing Django, let us check which version of Python we have. That way, we will pick the right Django version.

(sandbox)  :sandbox $ python -V
Python 2.7.10

If you want to take a break, read this WTF Moment.

python_django_versions

Here we are! The moment of truth. Let us run this command and install django.

(sandbox)  :sandbox $ pip install django==1.11
Collecting django==1.11
Downloading Django-1.11-py2.py3-none-any.whl (6.9MB)
100% |████████████████████████████████| 6.9MB 148kB/s
Collecting pytz (from django==1.11)
Downloading pytz-2017.3-py2.py3-none-any.whl (511kB)
100% |████████████████████████████████| 512kB 1.5MB/s
Installing collected packages: pytz, django
Successfully installed django-1.11 pytz-2017.3
(sandbox) Xis-MacBook-Pro:sandbox xi$

Look at that!

I recommend this YouTube video in case you want to learn more about:

(sandbox)  :sandbox $ pip freeze
Django==1.11
pytz==2017.3
(sandbox)  :sandbox $ pip install django --upgrade

Fun fact!

I met Kojo at PYCONCA 2017. Super cool guy who likes to talk about Django.

Here he is for you to meet:

Happy coding!

@codepyxi

WTF Moment: python -v

Hi there,

While installing Django I typed in the Terminal by mistake

$ python -v

instead of:

$ python -V

and I got the weirdest response :

# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py
import site # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py
import os # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.pyc
import errno # builtin
import posix # builtin
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py
import posixpath # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/stat.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/stat.py
import stat # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/stat.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/genericpath.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/genericpath.py
import genericpath # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/genericpath.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/warnings.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/warnings.py
import warnings # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/warnings.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/linecache.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/linecache.py
import linecache # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/linecache.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/types.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/types.py
import types # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/types.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py
import UserDict # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_abcoll.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_abcoll.py
import _abcoll # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_abcoll.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/abc.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/abc.py
import abc # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/abc.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_weakrefset.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_weakrefset.py
import _weakrefset # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_weakrefset.pyc
import _weakref # builtin
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy_reg.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy_reg.py
import copy_reg # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy_reg.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/traceback.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/traceback.py
import traceback # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/traceback.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py
import sysconfig # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py
import re # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_compile.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_compile.py
import sre_compile # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_compile.pyc
import _sre # builtin
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_parse.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_parse.py
import sre_parse # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_parse.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_constants.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_constants.py
import sre_constants # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_constants.pyc
dlopen(“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_locale.so”, 2);
import _locale # dynamically loaded from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_locale.so
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py
import _sysconfigdata # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_osx_support.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_osx_support.py
import _osx_support # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_osx_support.pyc
import encodings # directory /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/__init__.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/__init__.py
import encodings # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/__init__.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/codecs.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/codecs.py
import codecs # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/codecs.pyc
import _codecs # builtin
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/aliases.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/aliases.py
import encodings.aliases # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/aliases.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py
import encodings.utf_8 # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.pyc
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
dlopen(“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so”, 2);
import readline # dynamically loaded from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so
>>>

Needless to say, that I said to myself: “WTF just happened there!!!”

I Googled (obviously!) the “error” and could not find anything that explained it. My adrenaline was undoubtedly rising. I thought I downloaded some weird virus or something. At 6am, that is the best shot of coffee you can get 😉

I found an excellent and concise article saying: “All is well. You’re just getting a peak behind the curtain….” that dispelled my scary thoughts.

Keep having fun coding!

@codepyxi

Scratching the Programming Surface

Hi there,

I just finished my first week (or week-0 as it was called) in computer science (a.k.a. CS). The language used was Scratch.

Scratch is a free visual programming language developed by the MIT Media Lab.  […]  It provides a stepping stone to the more advanced world of computer programming. It can also be used for a range of educational  […]  purposes from math and science projects, including simulations and visualizations of experiments, recording lectures with animated presentations, to social sciences animated stories, and interactive art and music.

Scratch allows users to use event-driven programming with multiple active objects called sprites. Sprites can be drawn, as vector or bitmap graphics, from scratch in a simple editor that is part of Scratch, or can be imported from external sources, including webcams.
Source: Wikipedia / Scratch (programming language)

 

When a random person (not a programmer –> ) thinks about programming, the first thing that comes to mind is a black (or white) background with unappelling characters making no sense … or at least that is what one thinks.

Noticing the differnce between Natural languages and Formal languages is useful to understant WHY one might have the impression mentioned above about programming.

 

Formal and natural languages

Natural languages are the languages people speak, such as English, Spanish, and French. They were not designed by people (although people try to impose some order on them); they evolved naturally.
Formal languages are languages that are designed by people for specific applications. For example, the notation that mathematicians use is a formal language that is particularly good at denoting relationships among numbers and symbols. Chemists use a formal lan- guage to represent the chemical structure of molecules. And most importantly:
Programming languages are formal languages that have been designed to express computations.
Source: Allen B. Downey (November 2012). Think Python: How to Think Like a Computer Scientist. Retrieved Green Tea Press

 

Having been there myself, I concur that at first glance programming (a.k.a. coding) can look quite cryptic. Nevertheless, once one starts getting used to the programming language tools (characters, functions, etc) and using them, only then that one becomes fortunate enough to see beauty emerging from it.

Scratch takes away the cryptic part of programming and instead it incorporates the “Natural Language Flow” to programming. It is visually interesting and fun to use.

As you know, I started my programming journey with Python. It took several attemps to find beauty in it. However, in my humble opinion, Scratch is a really nice entry point to finally say:

Hello, world!

So starting next month, February 2017, a serie of three (3) sessions will be offered as an introduction to the programming world.

Here is the format:

  • Session 1) Computer set-up + Vocabulary + say: “Hello, world!” + Intro to Sprites’ costumes and sounds
  • Session 2) Animation1 + Animation2 + Animation3
  • Session 3) Game1 + Game2 + Game3
  • Showcasing and playing a few games from the participants

 

This serie is particularly tailored to adults humble enough to start from Scratch 😉

Two conditions to join:

  1. Respect
  2. Register at the EventBrite page Eventbrite - Scratching the Programming Surface : Session I

 

See ya soon!

 

NOTE: If you are a programmer and would like to volunteer, send an email, then an interview will follow prior to joining.

 

Code Time :: Montreal Espace Confort

Hi there!

If you are in Montreal (Canada) on January 26th and want to code in a relax fun atmosphere, here is where:

Auberge Montreal Espace Confort

Wednesday, January 26th, 2017

From 6:00 p.m. to 8:00 p.m.

Please register via Eventbrite in order to have access to the coding lounge.

Eventbrite - Code Time :: Montreal Espace Confort

 

 

 

Who should attend?

  • if you are a developer (and want to code in a fun atmosphere):
  • then join!
  • elif you are a newbie in the programming world:
  • then say: “hello, world” and join!
  • else:
  • send us an email in order to tell us why you want to join 😉

 

Feel free to bring along any computer science / tech related projects, and questions you want to work on.

Advantages++ :

  1. Code in a relaxed fun atmosphere is really inspiring.
  2. Find answers to your coding questions or at the very least find a path to find an answer. Here is a start:
  3. Stumbling upon a coding wall is frequent in any coding journey. Take this opportunity to overcome these obstacles!
  4. Take a break from the winter wind an sip a cup of coffee with us.

 

You could buy a cup of coffee, pastries and code for two hours with us.

Here is the price list of the Hotel Montréal Espace Confort :

  • Coffee ($3.50)
  • Tea ($2.50)
  • Pastry ($3.50)

 

See you  soon!

Binary Tree

Coursera :: Python for Everybody Specialization

Hi there,

Remember the Coursera class I mentioned on the last post? Well, the course was such a success (for both organizers and students) that there is a second part to it.

This course has been so successful that we have decided to push further and offer an entire five-course Python specialization that covers the entire textbook and adds a project-oriented Capstone at the end of the specialization.

Source: Coursera

The second part of this specialization is about:

All classes are exceptionally well designed. The content is pertinent and everything taught by Professor Charles Severance is  very clear.

The best part: it is very enjoyable. In fact, you might even develop a craving for more Python and especially more data!

Before this class, I never asked myself where to find data. Data: to split, to parse, to format, to clean, to visualize and what not.

So, if you are looking for some data to play with, here are six open data sources:

If you have a favourite one, not listed here, please share.

Cities data sources contain information about restaurants.
Warning: Hypochondriacs, stay away from the restaurant data 😉

Also, for all newfound data troglodytes out there, here is a gem: Quantopian Fetch Method

“Quantopian [has got] a method called Fetcher which basically lets you grab CSV data from anywhere on the Internet: HTTP, HTTPS” — Dr. Jess Stauth

 

If you wonder what you can do with data coming from cities around the world, you might find some inspiration through the NYC Python talks. I once attended a meetup where they presented the ins and outs of NYC subway users. It was fun.

 

Here are some quotes to keep you going:

“It does not matter how slowly you go as long as you do not stop”
Confucius

 

“There is no elevator to success. You have to take the stairs”

Unknown

 

Stairs to Mont-Royal (Montreal, Canada)

Stairs to Mont-Royal (Montreal, Canada)

 

Have fun coding!