Forum Posts

oosandlibraries
Dec 26, 2020
In Practical
Lets discuss three different structures and a property in programming. Firstly: class. A class is always the highest level structure in any file. All other structures and properties have to be within a class. As a separate point, classes can be found in other classes as well, but again, only classes can be the highest level in a file. The level of a structure is indicated by its indentation, see. There are three levels in the above image. First where there is zero space indentation. Second where there are four spaces of indentation. And where there are eight spaces of indentation. Anyway. The next structure is Function. Again, in the above example, there is a function. The next structure is a constructor. We already talked about the structure, class. Constructors are used when instantiation occurs. When a class is instantiated, a constructor is called,(even if the programmer haven't implemented any, in which case a default constructor is called). A constructor takes the inputs that makes this instance unique. A constructor typically saves the inputs as variables, also performs whatever else is associated with the initialization of this object. After the instantiation is complete, the constructor becomes irrelevant. All instances of a class become only accessible through its functions. An example of a class with a constructor is found below. You can observe that above the function, there is a constructor. There are two differences in-between a constructor and a function. A constructor does not declare a return value, from this it also follows that it does not return anything. The name of a constructor is the name of the class it is in. These two are the differences between how to setup a function and a constructor. Now, the work part of the constructor is not implemented. To implement it, we must discuss the fourth matter in this tutorial, the property: variables. A variable is a storage area. The value it stores can be modified and what it stores can be accessed anytime. In the following example, a variable is created and the value of "inNumber" is assigned to the variable, now accessible across the class, including in all functions. There are several misconceptions here that needs to be address, not now. We will write code now. Btw, ignore the constructor, you don't need to write it, It was just created for demonstration. Now, run the virtual machine, open the Object-Orientation folder and open a terminal here. Using vim, create a new file here, call it "Bike.java". Now, develop the skeletal structure of Bike. I want the class to support addressing the number of wheels this bike has. We have talked about one way of addressing the value of this number. Implement it. Well done. Now. Open Main.java. Place two slashes before the word System. It should turn blue. Now, compile Main.java. Now run Main.java. You will notice that the "Hello world!" message is no longer present. Placing two slashes at the start of a line, makes the compiler ignore that line. This allows creation of notes for a programmer to read, but also the "delete" of a set of lines, while being easy to recover. Now, type the following Bike bike = new Bike(2); The part of the left of the equal sign is the creation of a variable. The type of the variable is Bike. The name of the variable is bike. On the right side of the equal sign is the instantiation of a class. The word new is the command to instantiate. The word Bike is the class being instantiated. What follows is the set of inputs the constructor will require. And that is the end of the instantiation. Your Main.java file should look like this. Compile and run this code. Again, the terminal should not display anything. Now, create a function in bike, with the name, toString. It takes no inputs, but outputs "String" Its return statement should look like this. return String.valueOf(numberOfWheels); Your Bike class should look like this. toString is part of a standard. toString is the expected name of a function whose purpose is to return a text, representing the object. Now, return to the Main class. On the third line, in the main function, type the command to display something in the terminal. Now, add the input, required for the command. The input is the name of the Bike variable and the name of the function in the Bike class, returning a text representation of the Object. These two, the variable name and the function name needs to be separated by a dot. Finally, sometime in this tutorial I refer to a function by its name, but ignore the curved brackets that function names are followed by. When you use a function, you always need to include those brackets. Now, I ask you to compile and run this program. The end result should be this. Well done.
Programming 101 - Part 4 content media
0
0
11
oosandlibraries
Dec 26, 2020
In Education
This post aims to direct people who want to start the course. The course starts with "Programming 101 - Part 1", found under the Practical subcategory of Education. Related Posts are linked as the course progresses. Not all educational posts are linked into the course. Feel free to explore. The course is free, with the exception of the source code used during the course. Source code/programs are side content that act as examples of what is being discussed. Across the course there are links to relevant source code. If you like the course, feel free to support it by purchasing the side content. Enjoy.
0
0
1
oosandlibraries
Dec 26, 2020
In Concepts
Singular - Plural - Other#1 - Description Watt Watts Wattage Total work electricity does, calculated as Voltage X Amperage. Volt Volts Voltage One of two properties of electricity's power. Amp Amps Amperage One of two properties of electricity's power. Resistance Resistances The measurement of how much electricity is lost when moving (not used?) through a given material. Alternating Alternating AC Description of electricity as one of two types. Current Currents AC electricity constantly fluctuates and changes direction. (not used?) Direct Direct DC Description of electricity as one of two types. Current Currents DC electricity is stuck at a specific voltage. No higher, no lower. (not used?) Object N/A O.O. A concept describing the function of different parts as a set of -Orientation inputs, work and outputs. class classes N/A Describes templates in programming. Object Objects N/A The word is also used in the term: Object-orientation. Describing a part which has a set of inputs, performs a work with those inputs and generates outputs. Also describes copies/instances of templates, filled with unique information. Also is the name of the root class in Java.
0
0
4
oosandlibraries
Dec 25, 2020
In Concepts
Here we will discuss object orientation. If you haven't already gone through our tutorial on object orientation, please do. This tutorial will explain how it applies to programming specifically. Now. Object orientation has three general applications in programming. Lets discuss from least relevant to most relevant. First there is the concept of abstraction and abstract layer (generation), creating a pyramid of terms. Thinking of a program as such a pyramid, gives you the ability to create what is called the skeleton. The skeleton is the creation of all the classes, all the inputs and outputs, but leaving the work part of each "Object" blank. This is because this is the initial state of development, the design stage. The skeleton allows for a visualization of the design and therefore allows some testing of the design's validity. After the skeleton is complete and deemed appropriate, your only job is to implement the work each object will perform. Once that is done, you have completed the production of the software application you were developing, so. The pipeline of writing a software can be described as simply as the thinking and development of the pyramid of abstract layers, starting with the top layer, containing a single block which is the name of your application. The coding of a skeleton, based on the pyramid of abstract layers. Visually verifying that the skeleton as a whole, addresses what the program needs to do. Implementing the work part of each part of the skeleton. Profit. While technically this first explanation is more about thinking and breaking things down, I hope you see its relevance in leading to objects, that is parts with properties of input, work and output and therefore the development of this pyramid of abstract ideas is proven a vital part of object orientation. The second example is functions. The following is an example of a function. public int sum(int inNumberOne,int inNumberTwo) { return inNumberOne + inNumberTwo; } It has two input. It's work is to add the two inputs together. It's output is the sum of the two inputs. Now, given the simplicity of the function you may wonder, whats the point. For one most functions will be far more complicated. Object orientation enables structure in the encapsulation of the work, hidden behind it's name "sum" unless you specifically look into it. This eases the amount of complexity the programmer has to deal with. Another benefit is abstraction. A function called "isThisAPerson" or "areTheseTwoInLove" is possible. It is possible to start with simple functions like the the sum function above and with a complicated, but structured set of functions, reach a point where meaningful functions can be created, functions that can understand reality as we do. public boolean isThisAPerson(Image inPerson) { return false; } public boolean areTheseTwoInLove(Image inPersonOne,Image inPersonTwo) { return false; } So, a question. Are these two functions implemented? No. Lets discuss what each word is in the "sum" function. The word public declares the function to be accessible from outside the class it is declared in. Some functions, while ease the class's internal operation, they are not meant to be used in anyway by another class. And then there are functions whose sole purpose is to be accessible from outside the class they are declared in, as a form of utility. The following word describes what the function returns. If this word is void then nothing is returned. If it is anything else, a dedicated return statement has to be present in the function, otherwise it will not compile. The word used is int. This is one of Java's word for number. Therefore the function sum, returns a number to wherever it is called, almost as a substitute to the function name present where it is called. What follows is the name of the function, this is up to you. What follows is the declaration of inputs. That is, what they are (int in this case) and what the name of each is. The number of them is unchanging, every time you call this function, you will need to provide exactly the same number of inputs, one int for each of the two inputs. Next comes the word return. When the program reaches this statement, it exits the function, taking with it whatever is part of the command (in java a command always needs to end with the character ";"). In this case the two inputs are part of the command. There is a plus sign in-between them. This plus sign given the context of the two numbers, will perform the expected purpose, adds them together. So what is returned is indeed X where X is: inNumberOne + inNumberTwo = X So we reach the third definition of object orientation. Templates and instances of a template. Now, those are absolutely not the correct terms, they are instead synonyms of the correct terms respectively...sort of. Lets take a hypothetical scenario. Both you and your child suffers from a disability. So you go to centrelink's website. You download the centrelink disability form from here. A PDF document. https://www.servicesaustralia.gov.au/individuals/forms/sa466 This is the form. https://www.servicesaustralia.gov.au/sites/default/files/sa466-2006en-f.pdf It is now on your computer. Since you want an application for disability aid for both yourself and your child. You print two copies of this document. Then fill one out based on your name, condition,contact details and one based on your child's name,condition,contact details. So. The PDF on your computer is the template. The two copies you print out are instances of this template. Lets analyze this, as it exactly describes object orientation (the third definition)! The template was designed to represent disability claim. Disability claim. But almost all disability claims are different. How can an unchangeable form,a template represent disability claim? The answer is that the template only represents what is same across all disability claims. As many instances can be created of this template as needed. Supporting the differentiating of each instance as necessary. Each instance of the template is personalized. So, what did we learn. The Disability claim template, defines the disability form as much as it can be expected to be identical across different instances and the rest of the definition will be defined when each instance is created. So, drum roll pls. A class is a template and and Object is an instance. ... .... ....... Cool. More definitions to address. OK, while what I said is true, there are several things to address. There is the concept of object orientation. There are three examples that are provided for it in this tutorial. The third is divided into two parts, finally described as class and object. A class is a programming term, you as a programmer will create classes. Objects are instances of different classes you designed. OK, all of this is true, but java also has this class called Object. .... ....... So, there is this third? Third dimension we will briefly address. For a certain kind of compatibility, all classes "extend" from a single class. This class is called "Object". This in't a big deal, you probably wouldn't have found it out anytime soon, but this class exists and adds to the ambiguity of the word object. So that is that, you can ignore the Object class (what an abomination). I conclude this tutorial by saying, a class is a programming template and an object is an instance of that programming template. A class contains everything expected to be the same across all objects of this class. But the objects, made from this class will contain the variations, that could not be represented by the singular. Also, object orientation: input, work, output, It describes classes and objects equally... Specifically with classes and objects, a class is a template and an object is an instance of that template.
0
0
3
oosandlibraries
Dec 25, 2020
In Practical
The terminal will have different commands available for it based on which operative system you are using. In this tutorial, we will learn about the Ubuntu terminal. A terminal has a variable/property. It is a directory in other words a folder it is pointing to. You can change which folder it is pointing to. From this perspective commands can be divided into two categories. Commands with inputs of directory that are absolute. Commands with inputs of directory that are relative. When you provide absolute directory as input, it is irrelevant where the terminal's directory is pointing to. When you provide a directory that on its own doesn't exist, it is treated as a relative path. The terminal will append the directory you provided to the current value of its directory. {Terminal's directory}/{Directory you provided} This does not have to mean that the directory exist. It also does not have to mean that you intended the terminal to do that. It is possible you misspelled the directory, no matter the terminal will perform the above append operation anyway and in this specific scenario will likely fail to find an existing directory. Nevertheless, the terminal's internal storage of a directory is there so everything there can be accessed by simply providing it's name, as opposed to the full directory. We did this in part 3 of Programming 101. It may have seemed to you self evident that vim will save "Main.java" in the "Object-Orientation" folder, but in reality, vim merely appended that name: "Main,java" to the directory, stored in the terminal. {Terminal's directory}/{Directory you provided (in this case "Main.java")} You can change directory by typing the following. cd {Name of file/folder within terminal's directory to be appended to terminal's directory} You can go up in the folder hierarchy by typing the following cd .. You can see the folders and files, found in the terminal's directory by typing ls So those are some of the basics. The terminal has a dedicated variable for a directory and you can navigate it, whereby doing anything in the directory it is currently pointing to is easier.
0
0
4
oosandlibraries
Dec 25, 2020
In Theory
So, why is knowing the relationship between voltage, amperage and wattage important? Lets take ebay as an example. Most electrical products have limited specification information provided. Also, it is random which two of the three information above, they provide. Which two you need to know in order to determine of the part is what you need, isn't. If they only provide one of the three, you can't piece that together. Don't buy from that seller. If they provide any two of the three categories above, you can calculate the third. This gives you complete freedom when it comes to identifying what parts you need! So we talked about voltage, amperage and wattage. Lets briefly talk about resistance. Where as voltage and amperage are properties of a kind of energy (in the physics sense of the word), electrical resistance is a property matter. Basically anything you can hold. Every material bronze, silicon, gold have different electrical resistance. Again, voltage and amperage are properties of electricity. Resistance is a property of matter. Different elements have different electrical resistance. There are several differences to address based on the resistance of a material. Firstly, electricity prefers to travel through low resistance material. Ideally it never crosses through high resistance material. These materials, high resistance materials are there for the deliberate purpose of assuring electricity cannot escape from where it is intended to travel. The exception is when the wattage of the electrical current becomes high enough to overcome the resistance of the insulating material (another term for high resistance material). Other than preventing electricity to travel trough it, high resistance materials also turn electricity that travel trough it into heat much quicker than low resistance materials. So, heat. Electricity, slowly but constantly turns into heat (and other type of energy, such as light). Based on the electrical resistance of the material, electricity turns into heat much quicker. The higher the resistance of the material the faster the process of electricity turning into heat is. The lower the resistance of the material the slower the process of electricity turning into heat is. Typically, when buying parts, resistance is irrelevant. Know voltage and amperage, the rest is irrelevant. The following image is of a power supply (they come in all shapes and sizes). It outputs 5 Voltage at 2 amperage. It has a USB port. It is a phone charger basically. What do you think, which side of it is the "input" side and which is the "output" side? I won't provide the answer. Power supplies have two purposes. To turn the AC current from the wall into dc current, and to produce a specific voltage. As electricity directly from the grid is always ac and most devices require dc to function, a power supply is always required in-between the power grid and the device using electricity. Here are a few pictures of different power supplies.
Electrical Basics - Part 2 content media
0
0
4
oosandlibraries
Dec 24, 2020
In Theory
There is Voltage, there is amperage and there is resistance. We won't be talking about resistance. Voltage and amperage are the two components of measuring the intensity of electricity. When compared to a flowing river, voltage is likened to the pressure of the water as it moves down the river and amperage is likened to the quantity of water that is moving down the river every second. Now then. Voltage and amperage. They are both important. First of, lets address Watts. Wattage is voltage multiplied by amperage. If you have 240 volts and 10 amperage, coming from the wall, you have 240 X 10 = 2400 watts available from the power point. If the USB ports of your machine are still USB 2.0, each has 5 volts coming out of it, at half an amperage. Therefore the total wattage of a USB 2.0 port is 5 X 0.5 = 2.5 watts. If you are provided the voltage and amperage, you can calculate the total wattage by multiplying the two. If you are given the voltage and the wattage, you can calculate the amperage by dividing wattage by voltage. If you are given the amperage and the wattage, you can find the voltage by dividing the wattage by the amperage. There are different contexts in which these pieces of information are relevant. For example, given a 5 volt 1 amperage battery, the context is, how much electricity, this battery/object outputs, yes outputs. In case of a USB 2.0 port. Being 5 volt, 0.5 amp, it provides that electricity to a device connected to it. Both of the cases above are identical in context. The specific voltage and amperage is given to the device connected to it. Our next example is a motor, an electric motor. It requires 24 voltage and 10 amperage. The Context is different. The motor does not provide 24 voltage and 10 amperage to a connected device. The specific voltage and amperage is taken from the device connected to it. It requires 24 voltage and 10 amperage from the connected device (battery or power supply). The two context for the voltage and amperage specification are, it is an output (as it is in the first two examples) or it is an input (as it is the case in the last example). In this, we divide devices into devices that provide electricity and devices that require electricity. Devices that require electricity, have limited tolerance for variability of the voltage they receive. The above electric motor requires 24 voltage. A source of electricity needs to be 24 voltage. No less, no more. (What limited tolerance means varies from one device to another.) Devices that require electricity, can work with any amount of amperage they receive, as long as it is above or equal to the amount required. The above electrical motor requires 10 amperage. A source of electricity needs to provide at least 10 amperage. If it provides 100 amperage, that will not negatively impact the electric motor. If it provides 1000 amperage, that will not negatively affect the electric motor. If it provides a billion amperage, that will not negatively affect the electric motor. Amperage of the device providing the electricity has to be equal or greater than the electric motor requires. More than what is required will have no positive or negative effect. So. When buying a power supply, you need to look for one that has the same voltage output and the same or larger amperage output. Plug the power supply in the wall. Plug the electric motor into the power supply and your motor will be spinning.
Electrical basics - Part 1 content media
0
0
12
oosandlibraries
Dec 24, 2020
In Concepts
Object Orientation... one of the fundamental concepts an engineer must understand, but rather one of the fundamental tools an engineer must have, be that a software, mechanization or any other type of engineer. There are many ways of describing O.O. First things first, the simplest explanation is, that an object is input, work and output. So why is this phenomenal. This is phenomenal because it is the language that enables engineering. So lets address a few things. Typically objects are sub components of something useful. So we have a set of objects, therefore a set of inputs,work and outputs that make up that which is useful. The result resembles a pyramid. This then can be repeated for each object, whereby a third layer develops of the objects that were making up the objects that make up the useful...thing. Take something complicated, such as a fighter jet. Now lets apply object orientation to it. There is the fighter jet (actually a reconnaissance jet, but no big deal). So lets begin. Layer 1. Fighter jet: Layer 2. Cockpit,Jet Engine,fuel tank, fuselage Layer 3 Window, chair,electronics, supersonic inlet Compression area,Ignition area,Generator, Left fuel tank, right fuel tank, pump, solid body, flaps, control surfaces. So we reached layer three, by now you should begin to grasp this aspect of Object Orientation. The top layer is to be the final product, as of yet not produced. To create each consecutive layer down, take all the objects from the previous layer, divide each up into sub-objects. Now you have created another layer. This layer creation is repeated until everything is simple enough to be designed and manufactured. While there are many other aspects to object orientation, I do recommend you practice this one, if for no other reason then it is clearly defined already. Lets briefly look at those parts. I want the plane to be able to throttle the engine's speed from the cockpit. So, I need to know what type of input the jet engine takes. Now the set of inputs the jet engine takes include jet fuel, it probably also needs electricity, so that is two inputs, but the input I am looking for is speed control, in other words information input. We will do two things. We will evaluate the differences and the similarities in-between 'Electricity' and 'Information Input' and we will explore other object orientated drawings of the jet engine. So, Electricity input and Information Input are identical because they are both electricity, entering the circuit board of the jet engine. In every other way they are different. The purpose of the Electricity input is to power the circuit board and any other electrical device required directly for the functioning of the jet engine. The purpose of the Information input, otherwise called electrical signal is to tell the engine what to do. High thrust, low thrust, Vector here, Vector there. So the Joystick, otherwise called the control column, generates an (electrical) output, where the output is the representation of the position the control column is in. This output is an input for the central computer, the output from the control column, rather than being a representation of what position the control surfaces should be in, is a representation of the maneuver that the pilot wants the plane to perform. The difference is crucial. In WW2, planes were designed whereby the position and therefore the output of the control column, described the position the pilot wanted the control surfaces to be in, rather than the maneuver the pilot wanted the plane to perform. The difference in outcomes is born mostly out of where the wind is coming from and how strong it is. Keeping the control column at position x, differences in the maneuver of the plane can be observed based on how much wind hits the plane. This is no longer true today. Planes today, provide the control column's output to the central computer. This central computer also takes the input of how much wind is hitting the plane and the direction it is coming from. The work the computer will perform is feed the two inputs it receives, the position the control column is in and the strength and direction of the wind, hitting the plane, into an algorithm (With two variables). This algorithm was designed to generate the output the correct position each control surface should be in, for the specific maneuver to be performed. So, assuming the control column remains in the same position, but the direction and strength of the wind changes, this will have no effect on the maneuver of the plane, because the position the control surfaces, will change to counteract the wind. So we have a control column, we have a central computer and we have a set of control surfaces. Note again, what is common with all of these inputs??? They are all technically electricity. And they are different in every other possible way. Electricity is expected to have a static voltage and amperage The two inputs above it are expected to vary in-between two voltages, making the two voltages zero and one respectively Electricity input is several magnitudes larger in how much electricity it delivers to the computer then the other two inputs. And finally the control surfaces. The following is an image with all three objects, hooked into each other. The object responsible for telling us the strength and direction of the wind is missing as there is no physical space for it to be represented. Same for the electricity generator object. What you see is the connection of three objects. It is also called a pipeline. It only shows a single control surface. Obviously in reality the aircraft has much more than that. It is a point that this drawing does not need to have more than one control surface displayed for it to convey information. Note: work remains completely unaddressed. Only inputs and outputs are addressed. Now the definition of work splits into two categories. First is relates to the creation or modification of the object. The second is the description of what it does, therefore it is the simple understanding of what the object does. First one, how the object works, that is everything needed to know to manufacture the object. The second one, the description of what an object does. This could be a simple description or the purpose of the application. The first one is relevant if you want to create an object like it, or modify its function. The second definition of work has the great advantage of not requiring any technical knowledge on how to design or manufacture the object, in order to make full use of it. Lets take the example of a laptop. It is made up of a power supply,case,touch pad,keyboard,usb port,hdmi port,charging port,screen, motherboard,processor,hard drive,RAM,graphics card. First of, yes the power supply is technically not part of the laptop but is crucial for its functioning, therefore it is a part of this list. Now then, a question we ask for each of the objects in layer 2. Do we need to break it down for layer 3? So what is this question? The question is this, can we buy an appropriate layer 2 part or since we can't, buy the components of the layer 2 part and put them together to form the layer 2 part.These components are the layer 3 representation of the layer 2 part. Lets look at some of these layer 3 components of a power supply. First off a power supply fulfills two purposes. First it converts electricity from AC to DC. Second, it converts the voltage from say 240 Volts, to the voltage the lap top requires. For more information on electricity, please read up on the following link. https://www.utilitarian-software.com/forum/concepts/electrical-basics
Object Orientation - Part 1 content media
0
0
6
oosandlibraries
Dec 24, 2020
In Practical
Well done for making it this far. Now that our Ubuntu environment has been setup, we can start writing java code, compiling java code and running java applications. Start your virtual machine. On the Desktop create a new folder, name it "Projects". Open it, create a new folder called "Object-Orientation" Open it. Now then. My right click menu lacks the option to create a new file. This is one of the few times when 'vim' comes in useful. Vim is a text editor, a very basic text editor. Right click in the folder and select "open in terminal" Note ctrl+alt+T does not open the terminal in the folder, but right clicking in the folder and clicking "Open in terminal" will. The difference is observable in the blue text in the terminal. Type the following: vim Press enter. Your terminal will look something like this. type the following: ":w Main.java" The ":" makes vim treat what follows as a command. The "w" stands for write and the "Main.java" is the name we want the file to have. Once you typed the text, press enter, your screen should look like this. If you wish to use vim to code, visit the following tutorial. Link not yet provided But I recommend that a more sophisticated text editor be used. In the terminal, type ":q" Press enter. Your screen should look like this. Double click on "Main.java", you should see the following. Now then. Coding. We are going to define a class. We want it to be accessible, so the first word is public The compiler needs to know that this is a class. So the second word is class. Now the name of the class can be whatever you want it to be, except it has to match the file name. Since I already named this file "Main", the third word of this file is Main. Then on the next line add an opening curly brackets. On the next line, add a closing curly brackets Your screen should look like this. Open the terminal, type the following javac Main.java Press enter. Save the file. If there are no typos in your file, this should execute. Now, what we have here is technically correct but is not meaningful. We are going to add a function. In-between the two curly brackets add four spaces, then the word public then static then void then main then an opening round bracket, then closing round bracket. Your Screen should look like this. In-between the two curly brackets type the following String args[] Your screen should look like this. On a new line add an opening curly bracket. On a new line again, add a closing curly bracket. Move up a line, press enter, Now there is a single line in-between the opening bracket and the closing bracket of the main function, you may also notice that the indentation is at the same point as the two curly brackets are. Press space 4 times. Now we are ready to implement the work the main function needs to do. In-between the main function's two brackets type the following. System.out.println("Hello World!"); Your screen should look like this. Return to the terminal. Type the following, then press enter. javac Main.java So, what is javac command anyway? It is a command to take a source code file and generate the binaries from it. What you write into the text editor is human readable. That is good for humans, but computers cannot interpret it. It needs to be turned into a different format, a format computers can understand. The command javac does that. Now then, type the following command into the terminal and press enter. java Main So... we discussed already what javac does. The Java command on the other hand runs a binary file. We have gone full circle. I taught you how to install Virtual box, how to install an operative system, how to install java on it, how to write a basic program, how to compile it and how to run it. The course doesn't end here, but I wish to commemorate the enormous leaps that you have gone through in this educational material. So, in-between the line of the terminal where you typed "java main" and where you can type now, there should be a line saying "Hello world!". Well done. In the code, every line other than "System.out.println("Hello world!");" serves only structural purposes. But that line is an actual command and its job is to display something in the terminal it is running from. What it displays is the one input it takes, that is the one input the println() function takes. This gets complicated so I won't get into it yet. Lets move on with this tutorial.
Programming 101 - Part 3 content media
0
0
9
oosandlibraries
Dec 23, 2020
In Practical
In the previous part, we have downloaded a virtualization software and an Image file containing Ubuntu operative system, we than installed the Virtualization software and on it an instance of Ubuntu. In this part, we will be installing software onto ubuntu. Now then. If you have logged into Ubuntu, the first time, you should see a slide show, skip it. Then the following window will appear in about a minute. This window is asking if you want to update, but we don't want to update. We don't need anything it has to offer. If you haven't automatically accepted the download already, click on settings... the following window will appear. Select the automatically check for updates combo box and select never, provide your password then click close. The settings should be automatically saved. If you accepted the download already, click the button with the nine squares on it, found in the bottom left corner of the window, then type into the search bar update, the first option should be 'Software updates' Click it, this should bring up the same window, now follow the above instructions to disable auto updates, Note: If you have already updated, this could be a source of errors later on. If you have already updated Ubuntu, for now follow these instructions. If later on you find unexplained errors, reinstall Ubuntu and make sure to disable updates. Now then, lets make sure we can copy in between the host and guess operative systems. The exchanging of file and the exchanging of text(clipboard) requires two separate implementations. First, make sure NOT to enable 'Devices->Shared Clip Board' and 'Devices->Drag and Drop'. These two are supposed to be in the disabled state. Now, press ctrl+alt+t at the same time, your window should look something like this. We opened the Terminal. The terminal predates any modern understanding of an operative system. The terminal originates from when graphics where not a thing in operative systems yet. People had to type commands to do anything. The terminal is a more powerful tool than the Graphical User Interface. Now then. Type the following into the terminal: apt-get install make gcc linux-headers-$(uname -r) Press enter. you should see the following error message: E: Unable to acquire the dpkg frontend lock (...), are you root? Good. You typed the command correctly. Now then, we need this command to run. It currently doesn't run because you haven't provided it with the permission needed to run. Some commands only have permission to run if the command 'sudo' precedes it. Type 'sudo', then space, then the above command, now it should prompt you for your password. Note that this prompt recognizes not just English characters as part of the password, but also arrows and other keyboard characters not typically visible, so make sure you only press the characters associated with your password. Press enter. You should see the following. You are asked a yes or no question, do you want to install gcc. Type 'y' then press enter. In a few minutes the installation should finish. Mine looked like this. Now close the terminal. Click on Devices in the Menu tab then click on 'insert guest additions cd image'. A popup window should appear. Click Run. Your password will be requested, provide it, then a command line will appear, which will install clipboard capability. A terminal window will appear, let it install clipboard capability. You will know it has finished when the last line reads 'Press return to close this window...'. Press enter. Now close the virtual box. When prompted, select 'Power off the machine.' Click OK Start the virtual machine again. In the menu tab, select devices. Hover over shared clipboard Select bidirectional. Now lets test this feature. On the host machine, open a text file, type a sentence, select it then copy it. Now open the virtual machine. Click on the nine box application at the bottom left side of the screen. Type text, select text editor. Now paste the copied text. For me, the above instructions worked. No troubleshooting is provided for this. I ask you read through the above sections to make sure you followed it. We installed the clipboard for text, but not file sharing. File sharing needs to be separately installed. First,create a new folder in a location where you know it won't be moved. This folder will be made aware to the virtual machine. Navigate to 'Devices->Shared Folders->Shared Folders Settings...' click it. There is a small, blue and green button close to the top right corner of the window called, 'Add share' Click it. Navigate to a folder you want to share. Click select folder. Back on the 'Add share' window, tick 'Auto-mount' and 'Make permanent' then click OK. On the 'Java - Settings' window click OK. Now, open a new Terminal window. Type the following command. replace &USER with $(your user name) Press enter. sudo adduser $USER vboxsf The above code may fail. That is allright. Now type the following code. replace USER with (your user name) Press enter. sudo usermod -a -G vboxsf USER This one should not fail. Now restart the virtual machine. Click on the 'files' application on the left side of the screen. On the left side of the window, there should be a button with the name 'sf_your_folder's_name'. Click it. This should open that folder, proving you can share files in-between the host and the guest. Note: you cannot edit/save files directly into this folder. You must copy a file, from this shared folder to the guest's Desktop. Note: no troubleshooting is available for sharing the folder. Now then, lets readjust the V.O.S.'s size. The shortcuts right-ctrl +L,F and C allows you to switch between them without the menu tab. In the Virtual box window select View and select scaled mode. Now, maximize the Virtual Box window, it should look like this. The resolution of the operative system is lackluster. Right click on the Desktop and select display settings. Then click on the combo-box of Resolution and select the resolution of your monitor (or just anything larger then what is currently displayed). Here is the end result Now then, lets enable clipboard cooperation. The following file is a bash file. Download it. Place it into the Virtual Machine's Desktop. Well done. Right click on it and select 'open with another application' Select text editor. Now you should see the following. Each line is a command for the Terminal. Close this window and right click the Desktop. Select 'Open in Terminal' Now a terminal window will appear. Type the following then press enter. ./start.sh Each line of code in the file will execute, one by one. most lines prompt the user for a y/n to install a specific program. When a prompt appears, press 'y'. The first two lines add the option of right clicking 'Open a terminal here.' This version of the operatives system already does that, so these are irrelevant. jre stands for 'java runtime environment', It allows you to run java applications. jdk stands for 'java development kit', It allows you to compile java code into java application. build-essential among other things allows the two above functions to be installed for the C language. vim is a terminal based text editor, we won't be using it much, but you may need to use it in your career. In the terminal, type the following, then press enter. java -version You should get a version number for java runtime environment. Now repeat with the following javac -version My screen looks like this. Those two keyword, java and javac will be used regularly during our programming practice. Well done. The Ubuntu environment setup is complete.
Programming 101 - Part 2 content media
0
0
5
oosandlibraries
Dec 22, 2020
In Practical
So. You want to be a programmer. Well, I hereby hand you the badge of honorary-programmer-recruit....here is the binary badge (011010010011010101001010110101010) and make you take the programmer's pledge. Say after me. "I, the recruit, hereby pledge to use my programming skills wisely." ... "To serve the public." "And to 'Dos' attack people on league of legends, only on Mondays." Well done recruit. Now then let us start with your training. First off, everyone uses different operative systems (for example: Windows 7,8,10, IOS or Ubuntu) This course uses the Ubuntu operative system. It installs the java programming language on Ubuntu, it uses Ubuntu software to write java code. This is simple. Nevertheless, people use different operative systems making it so I would have to explain and troubleshoot for three different platforms at least. In comes Virtual box. Virtual box is a software, enabling people to install an operative system on their computer, on top of the currently running operative system. Therefore I will only need to troubleshoot for one environment. Originally Vm-ware was the application that I wanted to use for this course, but only 'Vm-ware workstation' Version 12 is free to use, requiring only an email address. While 'Vm-ware player' is free to use, but they both suffer from the following problem. Vm-ware corporation prohibits the redistribution of their software. Therefore we will be using Virtual box instead of Vm-ware. Before we can get started, lets address a few things. Disclaimer: I, Barnabas Madai, in no way am responsible for any damage caused to your devices due to this course. Hardware specifications: To begin assessing if your computer's specifications are sufficient, first open the Task Manager. This section only applies to windows users as the Task Manager is a Windows exclusive application. If you are running OSX, you are on your own in finding your specifications. These include the amount of RAM and core/thread count. To open the Task Manager, tap Ctrl, alt and delete keys simultaneously. Select 'Start Task Manager'. The following window will appear. Maximize its size. We are interested in the performance tab. Select the Performance tab. It should look approximately like this. You need at least 4 GB of RAM to run a virtual operative system. Four Gigabyte is enough, but I wouldn't try running a virtual operative system on any less. If you have more than 4 GB of ram you wont just run the V. operative system, you will run it without any performance issues. BTW if you were to run a V.O.S on less than 4 GB ram, the worst case scenario is your computer shutting down and even that scenario is unlikely. You can check the amount of ram at the bottom of the tab. "Physical Memory (MB)" Mine is 16268. I must divide that number by 1000 to get to Gigabyte. Therefore I have a little more than 16 GB RAM. You should check how much ram you have. The processor needs to have at least 2 cores. The V.O.S will require a dedicated core and the host operative system will need at least one as well. On the performance tab of the task manager, count the number of charts the "CPU usage History" is divided into. That is the number of cores you have. If you see more than one charts in the 'CPU Usage History' panel, you have more than one core and therefore can run a V.O.S. 40 GB of free space on the hard drive the operative system will be installed on. If you run windows 7, open your start menu and type 'computer'. If you run windows 10, open up the start menu and type 'This PC'. Select the first option. The first option should be a display of all hard drives you have available. It should look approximately like this. Here you can check if you have a hard drive that has at least 40GB free space. Now then, if you meet all the requirements, download Virtual Box. https://www.virtualbox.org/wiki/Downloads If you have a windows machine, download 'Windows hosts'. If you have an apple laptop, download the 'OS X hosts'. Now then, lets install the virtualization software. Open your download folder and double click on the virtual box software. It will ask you if you are sure you want to install this, click yes. On the following window, click yes. Here you can select the directory you want to install virtual box into. When done click next. click next. The installation should begin, once it finishes, click finish. If Virtual box haven't started yet, double click on the shortcut placed on the desktop. You should see the following window. Now then, to install an operative system, we will need an "image" of an operative system, Ubuntu. This course uses Ubuntu, in this course all troubleshooting will relate to Ubuntu, so it is crucial that Ubuntu is installed. Here is the download link: https://ubuntu.com/download/desktop The website should look like this: Download the Ubuntu version, on top of the list. Once the download has finished, bring up Virtual Box and click on new. Provide a name for your virtual machine (doesn't matter what it is). Doesn't matter where the machine folder is as long as you can find it if you need to and it is on the hard drive with at least 40GB free space. Type should be Linux. Version should be Ubuntu (64-bit) Then click next. On this window, you can specify how much RAM you want the OS to have. This is measured in Mega Bytes instead of Giga Bytes. I recommend allowing half of your available RAM to the virtual machine. Once you have selected the correct amount, click next. On this window, make sure to select 'create a virtual hard disk now', then click create. Here you can select which kind of V. hard drive you want. Select VDI, then click next. On the next screen select fixed size, then click next. On this window, set the size of the V.H.D. to 30GB, therefore if you have 40GB available on your H.D. the Virtual machine gets 30 of them and your operative system can continue to function without issue. Once the installation finishes, the following window will appear. Click start. Note: if starting the operative system doesn't work, attempt "Problem #1" trouble shooting option, at the bottom of this part. On the following window, Virtual Box is looking for the image of Ubuntu that we downloaded earlier. Click on the folder icon, to the right of the combo box then click on add, then navigate to where the downloaded Ubuntu image is, then select it. Choose it in the optical disk selector menu, then click choose. Now click start. The installation will begin. During the installation you will be prompted to select the language, select english, then click install Ubuntu. Select keyboard layout. Disable Download updates automatically. Now click continue. Select 'erase disk and install ubuntu'. Then click 'install now' On the following popup window, click continue, (again, this will install on the virtual hard drive created, it will not affect the host operative system). Select region, then click continue. On the following window, add a name, computer name, user name and password, then click continue. Now the installation should begin to download the files from the Ubuntu image and install Ubuntu onto the virtual hard drive. Once installation is complete, click the restart now button. Well done, you have successfully installed your first virtual operative system. Upon restart it should look like this. Login. Well done. You can close the Virtual Box window anytime. It will ask you if you want to freeze the V.O.S. as it is, whereby upon starting it again, it is restored to the same state as it was in, or you can shut it down, select shut down. Do remember how to do this, as it is a sought after skill in the IT industry. Well done, we are done for this lesson. Trouble Shooting: Problem #1: Virtual Machine shows popup error message, refuses to start. OK, this is a bit new for me, as I mostly used Vm-ware in the past, not Virtual Box (BTW, while 'Wm- ware workstation' is not free, Vm-ware Player is, if you want to smoother experience I recommend you download and try out Vm-ware player at a later date. For now, use Virtual Box). The specific error looks like this: While there are many interpretations as to what is wrong, I can tell you the step by step description of what I have done to fix it. First thing to note is that upon starting virtual box, a message came up saying, there are updates available. I decided not to upgrade. The above error occurred after that popup window. I have opened the File menu-tab and selected the 'Check for updates...' option. First I was greeted by a popup that Virtual Box is up-to-date, then by another, telling me my Virtual Box application is not up- to-date and do I want to upgrade to the latest version... Well better confusing than non-functional. Anyway, I accepted the update. Once it finished installing I restarted the host operative system (the computer). This solved the problem. So, my conclusion is, Virtual Box is one of those weird programs which for once an update is out, it will literally not allow you to use your virtual machines until you update. "Sigh"
Programming 101 - Part 1 content media
0
0
8
oosandlibraries
Dec 22, 2020
In Theory
So. The reason (almost) all files have approximately the same number of zeroes is because most unique states found within a set of bits belong to the ratios that are the closest to being equal. It is interesting to note that in the separation of an area by fence, the largest area is attainable only when all four sides of the fence have the same length. In other words if the fence is rectangular, given 4 meters of fencing, the largest area within the fence is achieved if all sides have 1 meters of fencing. All other distribution of fencing have inferior area. Air molecules always want to be as far away from each other as possible, distributing themselves at equal distance. Heat as well distributes itself whereby all matter contains the same amount of heat. These three are interesting parallels with the ratio distribution in part 1. Naturally, everything is heading toward equal distribution. So. Information theory. To describe information theory we must talk about File compression and decompression algorithms. File compression algorithm is to change the value of the bits within the file/bit-set, and to reduce the number of bits that are used to represent it. Therefore the File compression algorithm alters the value of bits and reduces the number of bits required to store the file. Now, a software, graphic, word document requires specific structure within the file for it to interpret the data correctly. Compression results in that structure being destroyed, therefore the software application cannot be started in a compressed form, the graphics cannot be displayed in the compressed form and the word document cannot be displayed in the compressed form. A decompression algorithm recovers the original value of the bits and also the original size of the file/bit-set, (which is another way of saying, it recovers the file completely). The file be that a software, graphics, word document, can now be interpreted by its respective application, but the size has grown back to its original size. This is a short summary of file compression/decompression algorithms. As you may guess, the file decompression algorithm is the mirror opposite of the file compression algorithm, it simply undoes what the file compression algorithm has done. Now. Each File compression algorithm has a File decompression algorithm associated with it. So, I will keep it simple and unless it is explicitly necessary I will be talking about both under the term: File compression algorithm. So, whats the concept behind file compression algorithm? The concept requires two different definitions of space. The first simply, is the number of bits we are talking about (and therefore the total number of unique states within that bit set). The second is a specific percentage of the states within that bit-set. So. #1. A bit-set of 8 bits. #2. 50% Now then, the number of unique states within a bit-set is given by: 2^S where 'S' is the number of bits. Given the size of our bit-set, 8 the total number of unique states within that bit-set is given by 2^8. 2^8 = 256. Fun fact, go back to part one, count the total number of unique states across 0-8 ones in the bit-set of 8 bits. The number you will end up with is 256. So, back to file compression. Definition #1 given as 8 bits. From this we can deduce that the space in question has 256 unique states. Definition #2 given as 50%. In combination with the above definition, from this we can deduce that the space in question has 128 unique states. 128 is half of 256, it is also the total number of unique states within a bit-set of 7 bits. Simply put, each extra bit added to a bit-set doubles the total unique states within that bit-set. From this it follows that each bit removed from a bit-set halves the total number of unique states within the bit-set. So. We have two definition of spaces, the combination of these two definition shall be called a space complex. We will need two space complexes to describe File compression. They are represented in function form. SC(8,50) and SC(7,100). So what can we do, given these parameters. We can take all the possibilities, addressed by the space on the right and place them into the space on the left. The compression algorithm has to keep a record as to which states are placed inside the smaller space. Mundane, isn't it? But, we saved a single bit from being written onto the hard drive and we took a 50% chance of crashing our file compression software. The thing is, if you write this file compression algorithm and just throw any random 8 bit file at it, there is a 50% chance that the file will contain one of the 128 unique states that are represented by the compression algorithm and therefore can be compressed, but there is also a 128 unique states that are not represented by the compression algorithm. It is a law of file compression that, for it to successfully compress a file, it can only do so given that the file is in one of the small percentage of unique states, the file compression algorithm was designed to represent and therefore compress. What happens when this isn't the case varies from file compression algorithm to file compression algorithm. Some immediately terminate themselves, some try and run the risk of termination simply because they broke the fundamental rules which they must function in. Some display a notification,saying the file cannot be compressed, from our perspective these three outcomes are identical. Other file compression algorithm lose the actual value of the bit and others again provide a compressed file, larger than the original file, whereby the decompression algorithm, as its description above suggests, recovers the original state of the bits and the original size of the bit-set. Given a failed compression, where the compressed file is larger than the original, the decompressing fulfills the role of the compressor. The file will never be smaller than in its original state, but during decompression it will at least shrink from the bloated, compressed file to its original state. There are two categories a file compression algorithm is measured by. Infinite/finite and lossy/lossless. Can it compress infinitely and is it guaranteed to recover the original file, both in length and value of its bits (zero or one). It is impossible to write an algorithm that fulfills both conditions. J-PEG or JPEG is a file format, also a compression algorithm that damages the file in the process of compressing it, this is unrecoverable damage. This damage has (very) minimal effect on picture quality relative to the amount of bits saved by it. JPEG can also be scaled as to how much it should compress an image, in other words, how much damage to the quality of the image is tolerable and therefore how small can the file size get. In this case damage to the file, that is a lack of integrity in recovering the bits is a feature, not a bug. JPEG is an example of an infinite and lossy file compression algorithm. Next to JPEG is PNG file format. Also used to represent image data (images). Also supports compression. Unlike JPEG, PNG's file compression in not-lossy. PNG also supports the alpha channel, which does not deal with what the color of a pixel is, instead to what degree is this pixel transparent. A file compression algorithm, based on the image above is easy to design, but that is not why it is used here, it is used here to describe the fundamental concept of file compression. Almost all file compression algorithms you will find are more complex in implementation and explanation then the example above. Nevertheless, all of them come back to the concept described above. Select a subset of a "large" space, find a smaller space in which all of the states within the selected subset, will fit into. Write a file compression algorithm, which for one, maps all states selected from the large space, to the "small" space. You are done.
Information Theory - Part 2 content media
0
0
7
oosandlibraries
Dec 22, 2020
In Theory
Did you ever wonder, why all files have approximately the same number of zeroes and ones? Lets elaborate this statistical reality. We shall look at combination, that is the mathematical definition of combination. Combination deals with the total size of a set and the size of a subset. Then the total number of unique places the subset can take within the set is calculated. This then becomes the output of the combination algorithm. For example the 'set' can be eight chairs and the subset can be three people where, each person is to occupy no less and no more than one seat. Therefore there is exactly three seats being sat on and five seats that are empty. Combination deals with the total number of seating that can be done given the three people and eight chairs whereby each seating is (at least slightly) different in which seats are taken. Also...again, different seats being sat on makes a different seating, two people swapping seats is not considered a different seating. The algorithm to be used to calculate this is : 'C(n,r)' stands for 'Combination(n,r)' where n is the 'set' and r is the 'subset'. Learn to read functions again, 'C(n,r)' is a declaration of a function. Given we are talking about Combination, you should try to automatically associate the C in 'C(n,r)' with Combination. You are familiar with numbers but probably not familiar with 'letters as numbers' otherwise called variables. Variables are numbers but what their value is can vary. The reason for this will be explored later. Suffice it to say, when you look at 'C(n,r)' the C supposed to be a representation of Combination. Combination requires two inputs to calculate the total number of unique seating. Those two are 'n' and 'r'. Note that such declaration of a function does not contain its implementation, merely what it does and what input it takes. In the above image 'C(n,r)' is presented as equivalent to 'n!/(r!(n-r!))'. 'C(n,r)' again, is a meaningful description in that the C represents Combination, but this meaningful description does not include the implementation. 'n!/(r!(n-r!))' is the implementation. The n and r simply to be understood as whatever n and r is in 'C(n,r)' given a specific calculation, such as C(8,3) the algorithm specifically looks like this: 8!/(3!(8-3!)), yes. So. we learned about numbers, such as 8 and 3. We learned about brackets such as () which describes the order of calculation where calculating the most nested brackets is done first. We learned about variables. So on the top level of an algorithm, both numbers and variables can exist where numbers represent parts of the algorithm that are static and variables where the numbers may be different from one use of the algorithm to another. The bottom of two levels, all variables received a number, whereby the calculation could actually be done. These two levels exist for all algorithms including variables. We learned about different representations of functions. Now then. Information theory, that is, lets answer the question, why all bit-sets have approximately the same number of zeroes and ones. Quickly, we had the example above of 8 chairs and lets say 3 people each sitting on one chair. C(8,3) in other words. But for finding out why all files have aproximately the same number of zeroes and ones, chairs and people are a bad example. We will use the correct terminology. The variable n will be called the number of bits and the variable r will be called the number of ones. Again, just like from the number of chairs and the number of people therefore the number of chairs currently sat on, we could deduce the number of seats that have no one sitting on it, from the knowledge of the number of bits and the number of those bits whose value is one, we can deduct the number of bits with value zero. Now the, the finale. if all different states of an 8 bit bit-set are divided based on the number of ones it contains, 4 ones gets the largest number of unique states. This is followed by a tie by 3 ones and 5 ones. Note this is a law. You could go from 8 bit bit-set to 1MB or in other words: 8,000,000 bit-set, the 'r' value containing the largest number of unique states is 4,000,000 followed by a tie at 3,999,999 and 4,00,001. So what am I saying. I present it as a theory that when writing a software, creating graphics or typing a document, the bits that make up the software and the bits that make up the graphics and the bits that make up the document have equal chance of representing their respective file by each state within the bit-set. SO. Given the fact #1 that the more equal the ratio of zeroes and ones is within a bit-set, the larger the number of unique states that are contained within that ratio. And theory #1 that whatever the file being represented, the chance of representation across all states within the bit-set is the same, ratio of zeroes and ones closer to each other will be more likely to be the ones representing the file. Ratios of zeroes and ones are close to each is another way of saying, the file has approximately the same number of zeroes and ones, therefore the above elaboration explains why this is so.
Information Theory - Part 1 content media
0
0
9
oosandlibraries
Nov 18, 2020
In Welcome to the Forum
This website aims to be a go-to location for street coders, software engineers and end users of software equally. This site will gather free to use software from all over the internet and be a source of distribution. This site will contain a set of libraries and software applications for purchase. This site will also contain documentation of our software and educational videos about programming aimed especially towards people new to the field. As this is a new site, we have limited number of libraries,software or even people around. I hope you find the time you invest into this site to be worthwhile.
0
0
1
oosandlibraries
Nov 16, 2020
In General
Discussions about the products: freewares, libraries and softwares. Basic rules: minimum respect and courtesy towards the next person.
0
0
5
oosandlibraries
Nov 16, 2020
In Welcome to the Forum
Hello. Welcome to OOS.andlibraries. Here we discuss all things software. Feel free to introduce yourself.
0
0
2
oosandlibraries
Nov 16, 2020
In Welcome to the Forum
Unrelated section. Feel free to discuss anything.
0
0
2
 

oosandlibraries

Admin
More actions