Tuesday 20 September 2016

Netbeans and ArrayList

You may want to download and install Netbeans (the use of this IDE is OPTIONAL, but recommended for our IA as it makes life easier. If you are comfortable with Geany, stick to it. You may want to give Netbeans a try, though.

Our last data structure (for SL) is the Java built-in ArrayList:


Friday 15 July 2016

How to install MySQL Workbench in Ubuntu

Installing MySQL Workbench in Ubuntu is very straightforward, but not always easy to come across.

Hope this quick tutorial helps get the job done without wasting time.

Let us take the most direct approach, using the Terminal to install what we need in order to use MySQL Workbench.

sudo apt-get update sudo apt-get install mysql-server mysql-workbench -y

The above will ask you to type your (user) password. If you have not used the terminal much, be aware that nothing will appear on screen as you type your password. This is a security measure and it is normal.
When the download and installation of the two packages finish, you will be presented with the following screen:

Enter a password that you will easily remember. You may use your Ubuntu user password if you want, but bear in mind that this will be the root password for the MySQL server; this is a individual service and its password is independent from the rest of your Ubuntu system. So you could use any password you want, just make sure you do not forget it!

Now you can open the Workbench, using the search function of your desktop or by typing mysql-workbench in the Terminal.
Next we need to connect to the MySQL service so we can start using the Workbench. You should see a Local instance under MySQL Connections in the main Workbench initial window.

When you click on the Local instance icon/rectangle, it will ask you for the root password of the MySQL service that you set during the installation.
If you do not want to enter the password every time, just save it to the key chain.

If you want to set up MySQL in other platforms, check the following links:
And that's all, folks! Happy SQL'ing

Friday 8 July 2016

Tweaking Ubuntu

I have been playing around with the new LTS version of Ubuntu 16.04 and in my efforts to tweak it to my comfort, did the following:

sudo apt-get install synaptic unity-tweak-tool chromium-browser mc gnome-themes-standard ubuntu-restricted-extras vlc audacious -y

If you're into themes, you may want to have a look at the following resources:

http://www.noobslab.com/p/themes-icons.html
http://lmelinux.net/2016/03/31/adapta-another-beautiful-gtk-theme/
http://lmelinux.net/2016/04/25/apply-adapta-dark-theme-ubuntu-unity/

If you need programming/basic development tools:

sudo apt-get install build-essential default-jdk ruby python python3 geany geany-plugins vim -y

Other Sources:
https://help.ubuntu.com/community/RestrictedFormats
http://askubuntu.com/questions/56446/how-do-i-install-the-ubuntu-restricted-extras-package

Tuesday 10 May 2016

Linked Lists

A couple of good links for revising singly and doubly linked lists:
The concepts, use, functionality, advantages and disadvantages are more important than the code when studying ADTs at an introductory level; focus on the diagrams rather than the Java (or code) implementations shown in these online resources.

Friday 29 April 2016

Control and Embedded Systems

Control Systems
An HL topic for IB Computer Science that brings many questions (especially why on earth are we doing this) is Control. The best resources for you to study and revise is this:
Positive and Negative Feedback
Recommended resources:
Manual and Automatic Control

Embedded Systems
Quite difficult to define, the best (and concise, too) article I've found so far is

Software Licensing

Among the ethical issues related to computers, IT/computer science we can find:

  • Privacy ([personal] data protection, collection, use and disposal)
  • Security (access restrictions to data, especially relevant when stored/shared on networks)
  • Licensing and copyrights
One that is easily neglected when we are in the academic context of an introduction to Computer Science is the third. Just in case it pops in your exams, here's what you need to know, in a nutshell:





Monday 14 March 2016

Static vs Non-static in Java

A really good (and tough!) distinction that everyone coding in Java needs to know: the difference between static and non-static variables in Java.

In my opinion, tutorial4us did a great job explaining it. A very good read indeed.

My understanding is that instance (non-static) variables exist in each object (instance of the class). Each object will have its own value/content for each instance variable. Think of the name in a Person class. We define the name as an attribute or property of a person, and each Person object will have its own name.

Static variables exist only inside the class where they are declared. Some call them "class variables" because they are bound to the class, not the object. They are unique and when a new object is instantiated, the object does not get its own copy of it. Rather than using the dot notation with the object (object.nnnn), you would use it with the class (Class.nnnn).

Note that this also applies to, and is also often used with methods!

Think about these example:


public class Test
{
  public static void main (String args[])
  {
    int[] numbers = {1,2,3,4,5};
    System.out.println( numbers.length ); // =5
    // length (size/number of elements) of the array object
    System.out.println( Math.PI );
    // PI is stored as a static constant inside the Math class
    // we don't need to instantiate a Math object to use PI
  }
}

To code or not to code

...For some of us, that is the question!

One of my favourite authors, V. Anton Spraul, has an interesting website about his books, programming, computer science, and other topics.

What caught my attention (this time) is the Learning How to Program: A Guide section of his web site.

I would like to recommend reading part two, "How do I know if programming is for me?" to anyone considering a CS course, diploma or degree, job, or anything that involves coding.

Below are my favourite quotes from the points he makes:

  • "A good programmer enjoys programming. I don't mean that every act of coding will bring unbridled joy, or that programming is fun in the same way that playing a favorite sport or video game is fun. But there should be a real pleasure in seeing one's program working, even if the program is a pitiable little thing that accomplishes almost nothing."
  • "Probably just about anybody could become a pretty good programmer if they work hard enough to become one. But make no mistake about it, programming is tough mental work. If, on some level, you're not enjoying the work, you're never going to be able to focus on it long enough to master it."
  • "Unfortunately, just because a person really enjoys working with computers doesn't mean he or she will enjoy programming. I guess the reverse is true, though; if you don't like technology, you probably shouldn't try to learn programming."
I couldn't have put it better myself. Thanks again, Mr. Spraul.

Thursday 3 March 2016

this Java keyword

A feature of Java that usually confuses beginners is the "this" prefix.

In a nutshell, the this keyword is used to distinguish between parameters of a method and attributes (instance variables) of a class.

The following link will lead you to a web page that does a great job contrasting and explaining this with examples:

Sunday 7 February 2016

Distribute your Java classes in a JAR file

The source of the information given in this post is http://www.skylit.com/javamethods/faqs/createjar.html
In my opinion, the simplest and quickest way to do this is using the command line.


Steps
  1. Start the Command Prompt. The easiest way is to Shift-Right Click on an empty spot in your Windows (File) Explorer. Make sure no files are selected, though. The idea is that your Windows Explorer should be in the location of your Java files.
  2. Navigate to the folder that holds your class files:
    Copy the path from Windows Explorer's address bar (more details about WE here), then type the following into the command prompt window:

    cd /d 
  3. minding the space at the end, then paste the path that you copied from Windows Explorer's address bar. Press Enter.
  4. If you haven't set your path to include JDK’s binaries (compiler and utilities, including the one that creates jar files), you need to do so by adding it to your default path (your folder may differ depending on the version of the JDK that you installed)
    path %path%;C:\Program Files\Java\jdk1.8.0_83\bin
  5. Compile your class(es):
    javac *.java
  6. Create a manifest file and your jar file (Replace IA with the relevant name to your project):
    echo Main-Class: IA > manifest.txt
    jar cvfm IA.jar manifest.txt *.class
    ---- or ----
    jar cvfe IA.jar IA *.class
  7. Test your jar:
    java -jar IA.jar
  8. Create a batch file so your end user can double click on it to run your command line application (you may also use Notepad to do this):
    copy con run.bat    (creates the file)
    java -jar IA.jar    (Press CONTROL Z and Enter to finish and save the file)
  9. Double click on run.bat to test it.

Thursday 28 January 2016

IBDP Computer Science IA

Important information about the
IBDP Computer Science Internal Assessment

Screencasting & File Requirements

Mac:
Windows:
Ensure that your screencast is about 5 minutes long, and in MP4, MOV, M4V format;
Maximum size 500 MB

Formatting of work for IBDP Computer Science IA

  • Arial font size 12 (where the language / script supports it)
  • Double-line spacing
  • Numbered pages
  • Portrait orientation (rather than landscape) – except where it is necessary to accommodate a specific item such as a graph or illustration
  • DOC, DOCX, PDF or RTF

Optimise Windows 10/11

How to optimise your Windows setup Just in case you need it. If you want a safe and conservative approach, just disable the background apps ...