Introduction to Programming Python and C++

Author Archives: Ricardo Newton

Mastery30 – Visualization of Data with tools

Hello this is about the usage of visualization with tools, I  found on the internet there were some libreries that helped with this and the best 5 were:

1. D3

2. Vega

3.Procesing

4.Gephi

“For people just starting out, I’d suggest starting either with Processing or D3,” says Jan Willem Tulp. “Both of them have a very large user base and a great number of examples you can learn from.” 

The online data visualization community can be good for answering questions.  Statisticians may know data, but still be learning the basics of design. Designers may know how to create something that’s aesthetically pleasing, but still be learning about statistics.

So, be sure you select the one you like the best and fulfills all your needs. Some may say java is good too so you can try that one. It is better if you search on google for what you will be needing and be sure it makes all the things you need it to.

 

Bonus Quiz

#BONUSQUIZhttps://youtu.be/0rNO8aMuIB8

Project – (second post, description earlier post)

  Here is the code of our project. I made earlier a post about some problems and the description of them. It is on github. I left as well some codes that were used to test our library the ones inside the prenthesis. It was difficult I have to say. 

https://github.com/kenwbauer/TC101F15_Team17/blob/master/FINAL%20CODE

Project

96

Normal
0

21

false
false
false

ES-TRAD
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Tabla normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}

Hi, this is a blogpost about my I wanted to do this since a few days ago but I had no time, you know its finals and everything gets crazy. First I would like to start saying this was hell, way too difficult. I first had to search all over the internet for information. I had a lot of problems with using the library on mac so I did it in Ubuntu. Once I had it I couldn’t even compile the sample program, that is when I went with Ken and asked for some help, the thing was I had installed another thing I thought it was the library and that is why I could not compile anything. Once everything with magick++ was set up I started the coding process, we have the code know the thing is that, I don´t finish to understand why, but it only works with some images not with all of them. I don´t know if it is something with my code or the Ubuntu software or other thing. Here are some pictures of the process, I first published in github some separated codes that were the sample ones, but with some modifications.

I did this one with the same crop one

 This is the picture that my code lets me modify… I will post the final code later today.

It is in jpeg format. Other different images showed up some error i couldt figure out

 

I will post later tonight more about this and the final project see you…

WSQ16 – Cars

I  had to search too much info to get to understand this, but well here it is. I´m like crazy because I have a lot of stuff left to do and almost any time left.. but anyway https://github.com/ricardonewton/TC101/blob/master/cars

 

#Mastery22 – When to use what type of repetition in a program

Hello this is about repetitions in programs. A repetition is an integral part of a programming language. These repetitive operation or sentences are named as ”iterations”. An iteration means that a process is repeated again and again. To do this, the principal method is the loop which are commonly used in any programming work. Loops are used when wanting to reduce a process into simpler coding, when something has to be repeated on and on.  Loops are the basis of the repetition in any programming language.  There are different types of loops of course, like while, for etc.

 

While- a code of bock that uses a while has to include a condition to be valid and for it to compile and work correctly. They allow the program to perform a particular action while a set condition is true.

 

 

 


Break and continue- It can be used to end a loop before some condition. If you type continue, the loop continues to do its work, obviously.

 

This processes enables the programs to repeat an action as long as a particular set condition remains true.

 

A for loop is another kind of repetition when coding in c++. A for loop can provide the beginning of the loop, obviously a condition and updates like…

( i=0 ; i

 

 

 

 

 WATCH MY VIDEO  https://youtu.be/R6TX6gDnFhg

 

#Mastery18 – Nesting of conditional statements

Hello this is of nesting statements. It is possible to nest if-else else statements; this means you can use this means using functions one inside another.

96

Normal
0

21

false
false
false

ES-TRAD
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Tabla normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}

 

 How to write a nested statement?

 

For example, the syntax is the following…

If (expression 1) {

  If(expression 2) {

   }

}

 

You can also nest an else if… else in a similar way as you nested the if statement.

 

This type of statement allows a choice to be made between two alternatives. A choice must be made between more than two possibilities. For example, the sign function in mathematics returns a negative number if an argument is less than zero, returns a positive number if the argument is more than zero.

 

I took this chart from http://www.programiz.com/sites/tutorial2program/files/flowchart-if-programming_0.jpg

 

That explains a process for an if statement that also can be used nested.

 This program shows an example on how to use a nested statement and how it works.

WATCH MY VIDEO https://youtu.be/hT153pKWogI

 

 

#Mastery25 – Creation and use of strings in C++

 A string means an ordered sequence of characters, and in most programming languages such strings are enclosed in either single or double quotes.

 

In C++ the enclosing delimiters are double quotes. IFor example, the usual first C++ program displays the string literal “Hello, world!” on the screen with the following output statement.

 

Strings are objects that represent characters, it is actually a one-dimensional array of characters. It is kind of like the same way you declare an array but instead you use characters. Which is the structure of a string?

 

 

char name[number of elements] ={‘a’, ‘b’, ‘c’};

or

char name[] ={“abc” };

 

You can represent a string the same way you represent an array.

 

1

2

3

a

b

c

 

 

 

 

A standard library in C++ provides a string class type.

 

There are other ways to declare a different type of string.

 

Using namespace std;

String name;

 

Or

 

Std:: string name;

 

A string can be also assigned to each other or appended together using the + operator.

Strings can also be found as compsrisons…

 One of the most confusing part of using char*s as strings is that comparisons tricky.

Here is a simple example of the usage of a string;

 

WATCH MY VIDEO https://youtu.be/jk3wQsbn3mk

 

96

Normal
0

21

false
false
false

ES-TRAD
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Tabla normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}
table.MsoTableGrid
{mso-style-name:”Tabla con cuadrícula”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-priority:39;
mso-style-unhide:no;
border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .5pt;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-border-insideh:.5pt solid windowtext;
mso-border-insidev:.5pt solid windowtext;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}

 

 

#Mastery17 – Use of “switch” as a conditional

Hello this is that talks about using switch as a conditional. A switch sentence makes a variable to be tested to be equal against some values. Every value is named a case and the value is checked for every case.

 

The structure of a switch is…

 

Switch (the expression)

   

Case and constant expression: statement

 

[default : statement ]

 

When you make a switch statement make sure you are aware of:

       It is easier for the switch expression to work if it is an integer or an enumerated type.

       The number of cases is unlimited, each one has to be separated with the value they are compared to with a : .

       The constant and the expression compared have to be the same type.

       When a variable is equal to a case, the statements net to that case will execute until a break statement appears.

       A break the switch ends and the control jumps to the following line of the switch.

 

 

I found this diagram on http://www.tutorialspoint.com/cplusplus/images/cpp_switch_statement.jpg that may explain better this process.

The behavior of a switch statement goes like this:

 

If s converted value matches the expression – Control is transferred to a statement following the label.

 

If none of the constants match the ones on the case – Control is transferred to a default label.

 

96

Normal
0

21

false
false
false

ES-TRAD
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Tabla normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}

If none of the constants match the constants in the case labels – Control is transferred to the statement after the switch statement.

 

I created this simple program as an example for the usage of a switch conditional. It evaluates the number introduced and says if you are an adult or not.

 

WATCH MY VIDEO https://youtu.be/-_8H_XSRJR8

 

WSQ14 – Estimating e

Hello this is about estimating e. This was a little difficult for me because so I had to do a little research on some new libraries that I didn’t know how to use. Here is my code on github…

 

https://github.com/ricardonewton/TC101/blob/master/wsq11

 

I had some difficulties with syntax as always, but nothing too big.

96

Normal
0

21

false
false
false

ES-TRAD
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Tabla normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}

 

 

What should you work on?

Week #12 and more partial exams for you.

For this week's readings:
C++ (TC1017) should either be looking at support for your project, ImageMagick C++ libraries are a good start.
Python (TC1014) should be finishing chapter 11 (Dictionaries).