Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/feed-rss2.php on line 8
‘Admin’ Articles at TC101 Fall 2015 https://kenscourses.com/tc101fall2015 Introduction to Programming Python and C++ Thu, 26 Nov 2015 04:53:46 +0000 en hourly 1 https://creativecommons.org/licenses/by/4.0/ BONUS POINTS! https://kenscourses.com/tc101fall2015/2015/bonus-points-6/ Thu, 26 Nov 2015 04:53:46 +0000 http://myfreakingcrazythoughts.wordpress.com/?p=404 Continue Reading →]]> Well this is a video of myself talking about my experience in Flip learning and how to be succesful in the subject.

I really had a great time with Ken as my teacher and his way of teaching is incredible! I had never been on a class where I feel like the teacher was actually my friend and he helped us a lot through our way in the course.

I highly recommend a flipped class room and even more if you have the opportunity to be with Ken Bauer, he is one of the best teachers that I ever had.

Thanks Ken!

-The admin, Esaú.

PS: Here is the video.

]]>
https://creativecommons.org/licenses/by/4.0/
Final Project! https://kenscourses.com/tc101fall2015/2015/final-project-10/ Thu, 26 Nov 2015 04:39:20 +0000 http://myfreakingcrazythoughts.wordpress.com/?p=386 Continue Reading →]]> We did it!

My buddy and I finally acomplish our project for our TC101 class.

Well, basically, our program had to do the following:

“You will create a command-line program that uses two-dimensional arrays or matrices to process images. You cannot simply call graphics libraries to manipulate the images directly but must implement the functions with your own algorithms. The input to each operation is an image (you choose to support any of JPEG, PNG) and the output is the modified image. The idea is to have a final project which shows your mastery of the topics in this course”.

I was really hard to acomplish but Eduardo and I worked together and we made it!

The user is able to type in the name of the file (a picture) and the program will process the image outputting a different file than the first one.

There is a huge code!

It looks like this:

#include <Magick++.h>
#include <iostream>
#include <cmath>
using namespace std;
using namespace Magick;

void grayscale (string in, string out){
  Image image;
  image.read( in );
  int x = image.rows();
  int y = image.columns();
  Color image_array [x] [y];
  Color original;
  Color graysc;
  int col;


  for (int i=0; i < x; i++){                    
    for (int u = 0; u < y; u++){               
      original = image.pixelColor(u,i); 
      image_array [i][u] = original;
      col = (original.redQuantum() + original.greenQuantum() + original.blueQuantum()) / 3;
      graysc.redQuantum(col);
      graysc.greenQuantum(col);
      graysc.blueQuantum(col);
      image_array [i] [u] = graysc;
      image.pixelColor(u, i, graysc);
    }
  }
  image.write( out );
}

void scale(string in, string out){
  Image image;
  image.read( in );

  int x = image.rows();
  int y = image.columns();
  int xf = x/2;
  int yf = y/2;
  Image image2( Geometry(yf, xf), Color(MaxRGB, MaxRGB, MaxRGB, 0));
  Color image_array [x] [y];
  Color image_array2 [xf] [yf];
  Color pixel1, pixel2, pixel3, pixel4, pixel5;
  int red,blue,green;
  Color newRGB, newRGB2;

  for (int i=0; i < x; i++){
        for (int u = 0; u < y; u++){
              pixel1 = image.pixelColor(u,i);
              image_array [i][u] = pixel1;
        }
  }

  for (int i=0; i < x; i = i+2){
       for (int u = 0; u < y; u = u+2){
       	     int x2 = i/2;
       	     int y2 = u/2;
             pixel2 = image_array [i] [u];
             pixel3 = image_array [i+1] [u];
             pixel4 = image_array [i] [u+1];
             pixel5 = image_array [i+1] [u+1];
             red = (pixel2.redQuantum() + pixel3.redQuantum() + pixel4.redQuantum() + pixel5.redQuantum())/4;
             blue = (pixel2.blueQuantum() + pixel3.blueQuantum() + pixel4.blueQuantum() + pixel5.blueQuantum())/4;
             green = (pixel2.greenQuantum() + pixel3.greenQuantum() + pixel4.greenQuantum() + pixel5.greenQuantum())/4;
             newRGB.redQuantum(red);
             newRGB.greenQuantum(green);
             newRGB.blueQuantum(blue);
             image_array2 [x2] [y2] = newRGB;
       }
  }

  for (int i=0; i < xf; i++){
       for (int u = 0; u < yf; u++){
             newRGB2 =image_array2 [i] [u];
             image2.pixelColor(u, i, newRGB2);
       }
  }

 image2.write( out );
}

int main(int argc,char **argv)
{
  InitializeMagick(*argv);

  try {
 string im;
 string out;
 int ans;
 cout << "Write your file name: ";
 cin >> im;
 cout<< "Write the name of your output file: ";
 cin>>out;
 cout<<"What do you wanna do?"<<endl<<"1. Grayscale."<<endl<<"2. Scale (1/2)."<<endl;
 cin>>ans;

while (ans != 1 && ans != 2){
  cout<<"Try again please: ";
  cin>>ans;}
if(ans == 1){
 grayscale(im, out);}
 if (ans == 2){
 scale(im, out);
}
}
  catch( Exception &error_ )
    {
      cout << "Caught exception: " << error_.what() << endl;
      return 1;
    }
  return 0;
//// c++ -O2 -o prog prog.cpp `Magick++-config --cppflags --cxxflags --ldflags --libs`
}

 

There is also a Repository made it in Github and that’s were our teacher is going to check it out.

Any question feel completely free to ask.

Thank you guys for everything.

-The Admin.

 

 

]]>
https://creativecommons.org/licenses/by/4.0/
Ability to create C++ project in IDE and run inside the IDE https://kenscourses.com/tc101fall2015/2015/ability-to-create-c-project-in-ide-and-run-inside-the-ide/ Wed, 28 Oct 2015 01:03:45 +0000 https://myfreakingcrazythoughts.wordpress.com/?p=141 Continue Reading →]]> In this tutorial I will show you how to install an Integral Development Environment (IDE) and to run a program inside of it.
In this occasion I will use CodeBlocks, an excellent IDE which gives support to the C++ language which is the one that we are using to write our codes.
Here is the video that I made, which allows you to see the whole process step by step as much as you want and the link to CodeBlocks webpage.

http://www.codeblocks.org/

]]>
https://creativecommons.org/licenses/by/4.0/
Ability to create C++ project in IDE and run inside the IDE https://kenscourses.com/tc101fall2015/2015/ability-to-create-c-project-in-ide-and-run-inside-the-ide-2/ Wed, 28 Oct 2015 01:03:45 +0000 http://myfreakingcrazythoughts.wordpress.com/?p=141 Continue Reading →]]> In this tutorial I will show you how to install an Integral Development Environment (IDE) and to run a program inside of it.
In this occasion I will use CodeBlocks, an excellent IDE which gives support to the C++ language which is the one that we are using to write our codes.
Here is the video that I made, which allows you to see the whole process step by step as much as you want and the link to CodeBlocks webpage.

http://www.codeblocks.org/

]]>
https://creativecommons.org/licenses/by/4.0/
Quiz #6! https://kenscourses.com/tc101fall2015/2015/quiz-6-17/ Thu, 08 Oct 2015 23:47:06 +0000 https://myfreakingcrazythoughts.wordpress.com/?p=115 Continue Reading →]]> For this quiz we had to create two programs.

In the first one we had to write a function called superpower that has two parameters of type long and returns a long which is first parameter raised to the power of the second.

For example, superpower (3, 4) would return 81.

And in the second program we wrote a function called stars that has one parameter of type int and prints (the function does not return anything) that many stars on a single line followed by a end-of-line character, so if we call the function with stars (5), the function will print like this:

*****

At first it was hard to write this codes but then, when I looked for help I could notice that actually they were pretty easy and with a few minutes of reading I could understand a little bit more about how the functions work.

You can check the codes at the bottom of this post or in my GitHub account in the Quizzes Repository, it’s up to you!

Here are the codes of my two programs.

SuperPower!

#include <iostream>
#include <cmath>

using namespace std;

long superpower (long a, long b){
  long superpower = 0;
  superpower = pow(a,b);
  return superpower;
}

int main (){
 cout<< superpower(3,4) <<endl;

 return 0;

}

Stars!

#include <iostream>
using namespace std;

void stars(int iStars){
  for (int i = 1 ; i <= iStars; i++){
    cout << "*";
  }
  cout << endl;

}

int main(){
  stars(5);
  return 0;
}

]]>
https://creativecommons.org/licenses/by/4.0/
Basic output (printing) and input (text based) in C++ https://kenscourses.com/tc101fall2015/2015/basic-output-printing-and-input-text-based-in-c-3/ Fri, 18 Sep 2015 22:17:30 +0000 http://myfreakingcrazythoughts.wordpress.com/?p=104 Continue Reading →]]> A computer program can do two main things, ask for information or give the user new information.

This two concepts are input and output, and it’s what we are going to talk about in this post.

First, their definition:

Output:

Any information that has been processed by and sent out from a computer or similar device is considered output.

Input:

Any information or data that is sent to a computer for processing is considered input. Input or user input is most often sent to the computer using an input device such as a keyboard or mouse.

Input and Output example

Header Files:

To do input and output, you will need to load the iostream header file.

Like this:

#include <iostream>  // I/O

#include <fstream>   // file I/O

#include <iomanip>   // format manipulation

#include <string>

 

Which means that you’re confirming that your program will have the ability to receive and send information and manipulate it as you tell it to do it.

Streams:

There only exist 3 streams, which are:

Cout (terminal output)

Cin (Terminal input)

Cerr (error output) Mosly used for error messages.

Here are some code examples where you can see Cout and Cin:

#include <iostream>
using namespace std;

int main ()
{
  int v1, v2;
  int sum =0;

  cout<< "Please introduce the lower bound of the range:  ";
  cin>> v1;
  cout<< "Please introduce the higher bound of the range:  ";
  cin>> v2;

  int number =v1;
  while (number<=v2){
    sum= sum+number;
    number++;

  }
  cout<< "The inclusive sum is:  "<<sum<<endl;
  return 0;


}

I really hope this post can help to solve your doubts about Input/Output in C++, if you want to know more abot this I will let you the link of a really good page!

Once again, feel free to ask anything and I will be happy to answer.

Have a nice day!

-The Admin.

]]>
https://creativecommons.org/licenses/by/4.0/
Submit work via GitHub. https://kenscourses.com/tc101fall2015/2015/submit-work-via-github/ Fri, 18 Sep 2015 21:27:37 +0000 http://myfreakingcrazythoughts.wordpress.com/?p=98 Continue Reading →]]> As you might have noticed in my past post, sometimes I like posting my Codes of the tutorials that I made in a GitHub account.

But you can tell me, what’s the special thing with GitHub? Well, imagine that it is like Facebook but for programmers. YES, you can cheer all your codes with your friends and even ask them for help or work in a team project.

But, how do I submit all my work?

Well, this is really simple!

First we have to login to our GitHub account and create a new Repository which is something like a small blog for specific topics, in this case, my WSQ tasks.

Once you have created a new repository as I show you in the video which is below this post, then all you have to do is to create a new file and put your stuff in it, upload it to GitHub and let everyone sees your codes and your ideas!

That’s awesome right?

You can also share your GitHub via URL as I do in some posts, that will be leading you to get involve with more and more people who likes the same thing that you and maybe ever meet someone and start working together!

😀

Here is the video of how to submit your own stuff!

And of course, here’s the link of my GitHub account where you will be able to find all my work!

Feel free to pass by!

-The Admin.

]]>
https://creativecommons.org/licenses/by/4.0/
Basic output (printing) and input (text based) in C++ https://kenscourses.com/tc101fall2015/2015/basic-output-printing-and-input-text-based-in-c-4/ Fri, 18 Sep 2015 22:17:30 +0000 https://myfreakingcrazythoughts.wordpress.com/?p=104 Continue Reading →]]> A computer program can do two main things, ask for information or give the user new information.

This two concepts are input and output, and it’s what we are going to talk about in this post.

First, their definition:

Output:

Any information that has been processed by and sent out from a computer or similar device is considered output.

Input:

Any information or data that is sent to a computer for processing is considered input. Input or user input is most often sent to the computer using an input device such as a keyboard or mouse.

Input and Output example

Header Files:

To do input and output, you will need to load the iostream header file.

Like this:

#include <iostream>  // I/O

#include <fstream>   // file I/O

#include <iomanip>   // format manipulation

#include <string>

 

Which means that you’re confirming that your program will have the ability to receive and send information and manipulate it as you tell it to do it.

Streams:

There only exist 3 streams, which are:

Cout (terminal output)

Cin (Terminal input)

Cerr (error output) Mosly used for error messages.

Here are some code examples where you can see Cout and Cin:

#include <iostream>
using namespace std;

int main ()
{
  int v1, v2;
  int sum =0;

  cout<< "Please introduce the lower bound of the range:  ";
  cin>> v1;
  cout<< "Please introduce the higher bound of the range:  ";
  cin>> v2;

  int number =v1;
  while (number<=v2){
    sum= sum+number;
    number++;

  }
  cout<< "The inclusive sum is:  "<<sum<<endl;
  return 0;


}

I really hope this post can help to solve your doubts about Input/Output in C++, if you want to know more abot this I will let you the link of a really good page!

Once again, feel free to ask anything and I will be happy to answer.

Have a nice day!

-The Admin.

]]>
https://creativecommons.org/licenses/by/4.0/
Submit work via GitHub. https://kenscourses.com/tc101fall2015/2015/submit-work-via-github-2/ Fri, 18 Sep 2015 21:27:37 +0000 https://myfreakingcrazythoughts.wordpress.com/?p=98 Continue Reading →]]> As you might have noticed in my past post, sometimes I like posting my Codes of the tutorials that I made in a GitHub account.

But you can tell me, what’s the special thing with GitHub? Well, imagine that it is like Facebook but for programmers. YES, you can cheer all your codes with your friends and even ask them for help or work in a team project.

But, how do I submit all my work?

Well, this is really simple!

First we have to login to our GitHub account and create a new Repository which is something like a small blog for specific topics, in this case, my WSQ tasks.

Once you have created a new repository as I show you in the video which is below this post, then all you have to do is to create a new file and put your stuff in it, upload it to GitHub and let everyone sees your codes and your ideas!

That’s awesome right?

You can also share your GitHub via URL as I do in some posts, that will be leading you to get involve with more and more people who likes the same thing that you and maybe ever meet someone and start working together!

😀

Here is the video of how to submit your own stuff!

And of course, here’s the link of my GitHub account where you will be able to find all my work!

Feel free to pass by!

-The Admin.

]]>
https://creativecommons.org/licenses/by/4.0/
C++ Coding Conventions https://kenscourses.com/tc101fall2015/2015/c-coding-conventions-2/ Fri, 18 Sep 2015 03:56:55 +0000 http://myfreakingcrazythoughts.wordpress.com/?p=82 Continue Reading →]]> The rules and advices are for everybody. In every environment and situation there will always be suggestions and norms that will keep order and sense in every possible ways.

In high level programming languages is absolutely the same, there are several conditions that help guiding the user while he is developing an application or a program, the only exception is that we don’t call them as “Rules”, instead, we know them as Code Conventions and of course, every programming language has different conventions to follow, they may look alike in some aspects but believe me when I tell you that the differences can also be huge.

In this mastery we are going to check out the Code conventions of C++. Outstanding the most important aspects of this rules so you can improve your skills programming and of course, following the right way to do it.

Microsoft defines “Coding Conventions” as following:

Coding conventions are suggestions that may help you write in a specific programming language.

Coding conventions can include the following:

  • Naming conventions for objects, variables, and procedures
  • Commenting conventions
  • Text formatting and indenting guidelines

The main reason for using a consistent set of coding conventions is to standardize the structure and coding style of a script or set of scripts so that you and others can easily read and understand the code. Using good coding conventions results in precise, readable, and unambiguous source code that is consistent with other language conventions and as intuitive as possible.

We can make a list of the main aspects about the coding conventions, including the most important aspects, such as:

  • General Recommendations.
  • Naming conventions.
  • Files
  • Statements

 

GENERAL RECOMMENDATIONS.

  1. Any violation to the guide is allowed if it enhances readability.

The main goal of the recommendation is to improve readability and thereby the understanding and the maintainability and general quality of the code.

  1. The rules can be violated if there are strong personal objections against them.

The attempt is to make a guideline, not to force a particular coding style onto individuals.

NAMING CONVENTIONS.

  1. Names representing types must be in mixed case starting with upper case.
  1. Variable names must be in mixed case starting with lower case.
  1. Named constants (including enumeration values) must be all uppercase using underscore to separate words.
  1. Names representing methods or functions must be verbs and written in mixed case starting with lower case.
  1. All names should be written in English.
  1. The prefix n should be used for variables representing a number of objects.
  1. Abbreviations in names should be avoided.
  1. Functions (methods returning something) should be named after what they return and procedures (void methods) after what they do.

FILES.

  1. C++ header files should have the extension .h (preferred) or .hpp. Source files can have the extension .c++ (recommended), .C, .cc or .cpp
  1. A class should be declared in a header file and defined in a source file where the name of the files match the name of the class.
  1. All definitions should reside in source files.
  1. File content must be kept within 80 columns.
  1. Special characters like TAB and page break must be avoided.
  1. Header files must contain an include guard.
  1. The incompleteness of split lines must be made obvious.

STATEMENTS.

  1. Types that are local to one file only can be declared inside that file.
  1. Variables should be initialized where they are declared.
  1. C++ pointers and references should have their reference symbol next to the type rather than to the name.
  1. Loop variables should be initialized immediately before the loop.
  1. The form while(true) should be used for infinite loops.
  1. Complex conditional expressions must be avoided. Introduce temporary Boolean variables instead.

Those were some of the most important conventions used for C++ divided by categories. Therefore it is really important to memorize as much as we can so we can improve our programming skills and make our code syntaxes even clearer so everyone with knowledge of the language will be able to understand it without problems.

Here is a page where you will be able to see all the Code Convention of C++ and some really good examples.

]]>
https://creativecommons.org/licenses/by/4.0/