SEARCH W7R

Sunday, March 25, 2012

How to Erase Google Chrome Internet History

Cut and Dry version at bottom of post..

Clearing internet history can improve productivity by getting rid of old site visits that you distract you away from what you are concerned with currently in addition to protecting your information from other people who use your computer. For example, coworkers who use your computer may see where you have been or be able to access accounts in which you "selected" remember my password.

Also, keep in mind that each internet browser has its own history, which means if you use two internet browsers you would have to clear the two separate from one another.

Clearing Internet History For Google Chrome

1. Left-click Wrench button

2. Select "History" from the drop down menu

3. chrome://history/ opens up (Two paths for step 4: to remove specific or all items from your history)

4 (Specific). In the history window, check items that you want to get rid of.

5 (Specific) click "Remove selected items"

4 (All). In the history window click "Clear all browsing data..."


5 (All). Check off items from the following list that apply. (below  step 6(All))


6 (All). click "Clear Browsing Data" and wait a few minutes/seconds for the process to complete.


Clear browsing history
This clears site history (time, date, site)
This clears all files that have been downloaded. They are located in chrome://downloads/
This clears some data stored on your computer to speed up your connections to sites you visit often
This clears information that sites store on your computer.
This clears all saved passwords
Clears all the account, billing, phone number, and other text boxes you fill on sites.


Cut and Dry

Ctrl+H > "Clear all browsing data..." > "Clear browsing data"

Saturday, March 17, 2012

Creating a Truth Table for a Java Program

Truth tables are used to represent all the inputs/output situations of a section of code in a easily readable and time saving orientation. Here is a simple two input / one output truth table for an A AND B condition.

A very explicit example of a truth table to represent A&&B
boolA boolB (boolA&&boolB)
true true true
true false false
false true false
false false false

A more simplified version of the same thing. Usually this is written to save time.
A B (A&&B)
T T T
T F F
F T F
F F F
Other ways of writing true/false in truth tables are:   High / Low     H / L     On / Off      1 / 0      X / O 

Five Important Things to Note
  1. All combinations of the inputs, A and B are included in the A&&B truth table.
  2. The columns are all headed by the object (variable) they describe.
  3. The output is dependent on the input values.
  4. There are only two outcomes (T, F) for four different input combinations (TT, TF, FT, FF)
  5. The only values a box can exist are boolean (logic) values, true and false.
Truth tables for an AND condition are not used because most people already know the outcome of an AND condition, but in real life conditions are a lot more complex and involved. A step up from the AND truth table completed above would be a truth table with a third input variable, which I will call C. If we want to create a table of values for (A&&B)||C which in plain English just means both A and B are true and/or C is true.
Refer to Java Logical Operator Syntax if you did not know that && symbolized the AND operation, or that the || symbolized the OR operation.


A B C ((A&&B)||C)
T T T True
T T F True
T F T True
T F F False
F T T True
F T F False
F F T True
F F F False
Java Code:
if((A&&B)||C){
  //actions to occur when the condition evaluates to true
} else {
 //actions to occur when condition is false
}



Breaking Large Conditions Into Parts


Although the condition (A&&B)||C can be figured out mentally (with some practice), it is nearly impossible to do that for conditions that look like this: ((A||B) || (C&&!D)). The condition ((A||B) || (C&&!D)) is too complex to be done mentally, so we need to break the condition into parts. If you make the output (final column) a function based on two inputs, the outputs of bool1=(A||B) and bool2=(C&&!D) then the large statement can be a simple output = (bool1||bool2). The sacrifice for making the equation simplified is only an extra two columns!


 bool1 = A||B   bool2 = C&&!D   bool1 || bool2  
 1.  T T T T True False True
2. T T T F True True True
3. T T F T True False True
4. T T F F True False True
5. T F T T True False True
6. T F T F True True True
7. T F F T True False True
8. T F F F True False True
9. F T T T True False True
10. F T T F True True True
11. F T F T True False True
12. F T F F True False True
13. F F T T False False False
14. F F T F False True True
15. F F F T False False False
16. F F F F False False False


The java code that would accompany such a Truth table (TT) would look like so:
if((A||B)||(C&&!D)){
 //true cases
} else {
 //false cases
}




And To End With..
if(reader.isHappy()){
   reader.follow("W7R");
   reader.findOnYoutube("W7R");
   reader.tellFriends("Conditionals are easy!");
}

Wednesday, March 14, 2012

Auto Getters, Setters, and Constructors in Eclipse

Retro Eclipse loading screen


Eclipse IDE Shortcut: GETTERS AND SETTERS
Getters: methods that allow you to access information from a class.
Setters: methods that allow you to modify information from a class.

1. Start Eclipse > Navigate to the desired class
2. Right click the editor panel > Hover your mouse over "Source" 
3. Hover over where it says "Generate Getters and Setters..."
4. Select the the variables you wish the create a Getter or Setter for.
5. Press OK or hit Enter

Eclipse IDE Shortcut: CONSTRUCTORS
Constructors are called when an instance of a class is created (it constructs the class essentially).

1. Start Eclipse > Navigate to the desired class
2. Right click the editor panel > Hover your mouse over "Source" 
3. Hover over where it says "Generate Constructors using fields" or "Generate Constructors from superclass"
4. Select the characteristics for the constructor you are making.
5. Press OK or hit Enter.



Monday, March 12, 2012

7 Important XML Terms And Concepts

XML stands for Extensible Markup Language. 


1. Meta Language:
XML is a meta language. Meta languages are used to store information that may be accessed by multiple different platforms. XML is often used to communicate information from one application to another.

2. Extensible Markup Language (XML):
XML is similar to HTML mainly because the two are both mark up languages! (XML HTML). XML is extensible because it has no presentation semantics, unlike HTML which does have presentatin semantics. Presentation semantics describe how data has to be presented/interpreted.
HTML is a markup language which is delegated by tags, elements, attributes and structure.


3. Tags:
Tags are each angle bracketted piece of text in the XML file. So, if you saw <Dog> then you would know that that is the Dog tag (specifically the opening tag for Dog). Most tags have a opening and a closing tag. For tag <Dog> (opening) there would be a corresponding </Dog> tag.


4. Text Content: 
Describes the text found between two opening and closing tags. This may include other tags nested inside the original tag of concern but are usually angle-bracket-and-other-syntax-free.

5. Element:
In XML an element is the unit that describes a set of matching opening and closing angle tags.
<Day></Day> would be an example of an element. Day would be the name of the tag, but the pair and all its contents embedded inside it, together, would be a element.


6. Declaration Statement: 
At the beginning of XML documents it is important to have a declaration statement, because it describes the version of XML the computer will be interpreting. A declaration statement can look like this: "<?xml version="1.0" encoding="utf-8"?


7. Parent Tags:
Parent tags encloses (nests) as many or as little child tags as the creator of the XML file would like. For example, in my sample code (below) ParentTag is the parent of ChildTag1 and ChildTag2.
<ParentTag>
   <ChildTag1>someStringValueHere</ChildTag1>
   <ChildTag2>SomeOtherStringValueHere</ChildTag2>
</ParentTag>


Why use XML? 
-free
-simple
-core of web developements
-used in popular sites across the web

Friday, March 09, 2012

Java GUI Tutorial 4 - The GridLayout and a Glimpse Of Inheritance

In the last tutorial we learned about the general concept behind component orientation on the JPanel. We experimented with the default layout and the BorderLayout. Click Here for GUI Tutorial #3

In this tutorial we willl create a Graphical User Interface (GUI) with the GridLayout.

 The GridLayout
   
GridLayout is a layout manager that will divide your jpanel into as many rectangles as you tell it too. Each component you add will be fitted into the corresponding rectangle. When comparing GridLayout with the BorderLayout of the last tutorial (link to tutorial #3), you can see it has more control and will be more useful for JPanels that need to include more than 5 components
   With the GridLayout you specify the number of divisions (invisible rectangles) via the two integer parameters, rows, and columns. The row and column are both integer values to be used in order to give your window easier and agile sections where different components can be placed.



   This time, instead of putting all of our code in the main method we will use a more preferred approach to Graphical (GUI) Programming: an object-oriented programming (OOP or OOD). We will create three classes to create our GUI: Application.java, Runner.java, and BestPanel.java. We will be designing an Options Window for the popular game Tetris. 

  • Runner.java will "run" the program (start it)
  • Application.java will control the physical parts of our GUI, the JFrame and the BestPanel.
  • BestPanel.java be the location for our GUI's components which can include JButtons, JPanels (Yes, JPanels can hold other JPanels), JTextFields, JComponents, JLabels, and more.


I will begin the coding from the inside out, or in other words in small parts which will be integrated together at the end. This is often referred to as top-bottom programming


What our JPanel, BestPanel will include: +links to Oracle site



Our Mini-Project and Inheritance
We will start by creating a JavaProject called "W7RTutorials." In W7RTutorials we will create a our first class, BestPanel as so:  
class BestPanel extends JPanel{ /*code for BestPanel*/ };


The BestPanel class inherits every method JPanel has such as paintComponent(Graphics g) and repaint() and paint(). This allows us to specialize or override methods of JPanel we desire to change to our own versions of the method (methods is same as a function) inside the BestPanel class body (between curly brackets) while keeping other methods of BestPanel identical to JPanel. JPanel is now considered the super class to BestPanel. So, BestPanel looks up to JPanel for guidence like a little boy would to his father. The class that has been extended (inherited) can be called the "parent" class and the class that extended, the "child" class.


That concept is known as Inheritance, which I will definitely cover on W7R (by the time you read this there may already be posts on inheritance). Moving on..



Snippet #1: First Draft of BestPanel
/*
 * W7R.blogspot.com
 * Brian R.H.
 */
public class BestPanel extends JPanel {
    //class variables (What we want BestPanel to have control of locally)
    JLabel label1 = new JLabel("Display Options");
    JLabel label2 = new JLabel("Playing Options");
    JSlider gameSpeedSlider = new JSlider();

    //Constructor BestPanel (what executes when a instance of BestPanel is created).
    public BestPanel(){
        //Sets the layout to be GridLayout
        //3 rows and 2 columns
        this.setLayout(new GridLayout(3,2));
        this.setBackground(Color.BLUE);
        this.setForeground(Color.CYAN);

        add(label1);
        add(label2);
        add(new JLabel("1"));
        add(new JLabel("2"));
        add(new JLabel("3"));
        add(gameSpeedSlider);
        //        this.setVisible(true);
    }
}
About Snippet #1: The BestPanel constructor holds the majority of the code we will use for our small project because the BestPanel constructor is a called (executed) upon creating an instance of BestPanel which will be in our Application class. Sadly, the Application which will hold our JFrame is needed before we can run tests of the BestPanel class.



Snippet #2: The complete Application class
import javax.swing.JFrame;

//complete Application class
public class Application {
    //class variables
    JFrame frame;
    BestPanel panel;
    //Constructor for Application class
    Application(String title){
        //set up frame
        frame = new JFrame(title);
        frame.setSize(600,400);
        buildGUI();
        frame.setVisible(true);
    }
    public void buildGUI() {
        panel = new BestPanel();
        frame.add(panel);
    }
}

About Snippet #2: The Application class relies on its constructor (which will be called by the Runner class) to run the necessary code to set up the GUI. The set up includes creating an instance of BestPanel (which has been done in the buildGUI() method. The BestPanel is not completely finished as far as specifications go, but can be used to get a feel for where the program is heading. All we need is a class to run it... The Runner.java class!

public class Runner {
    public static void main(String[] args) {
        //create an instance of the Application which 
        //will start the program by itself by means of the constructor
        Application app = new Application("Tetris Options!");
    }
}
Once you have saved those 3 java class files into your workspace, you should be able to run the GUI to browse at our progress so far. You can see that the GridLayout we used organized the components of BestPanel into a specific region according to the order I added them to the panel. The order you add the components to GridLayout controls where each one is placed on the gridded BestPanel. That is an important aspect of the GridLayout class.


This main purpose for this post was to establish the idea of inheritance and how the GridLayout works. Keep a look out for Java GUI Tutorial 5 where I will have another post using GridLayout.

Wednesday, March 07, 2012

Diodes and Diode Logic


A standard diode with its cathode (negative pin) and anode (positive pin) labeled.

Introduction To Diodes

When you are first introduced to diodes they seem pointless because all you are told is that they only allow electrical current to travel through the diode in one direction, but that happens to be a pretty big deal in circuits . Diodes are the simplest semiconductor device used in electronics: not the smallest but the simplest.  And if you know more about LEDs than you do diodes, it might be nice to know that  LEDs (light emitting diodes) are a special type of diode that emits visible light.

Schematic diagram of a diode connected to an LED (light emitting diode). DC power is the same type that AA, AAA, D, ect. batteries use. Notice the similarities and differences between the diode schematic symbol versus the LED schematic symbol. Their symbols are very similar because LEDs are diodes! The side of the diode with line is the cathode (negative pin) and the other side (where the triangle is tallest) is the anode pin (positive pin).

Schematic diagram of a diode connected to an LED in the opposite direction. Diodes only allow electrical current to flow in one direction, from anode to cathode, but this diode is placed in reverse which stops any current from flowing to the negative side (Ground) of the DC power supply. Therefore the LED is not lit because it has no electrical current running through it. Similarly if you plug an LED backwards the circuit will not run correctly (might even blow up the LED), so be careful of the way you set up your diodes. Anode (positive) to Cathode (negative).

Diode Logic Implementation

Diode logic implementation is the process of creating logical functions out of combinations of diodes in series or parallel. The logic functions are made possible because diodes ability to only allow current to flow in one direction can be utilized as a switch. In this post, I will teach you the set up for diode implementation of the AND, and OR gates.


This is a diode logic circuit for an AND gate. An AND gate demands that both inputs, we can call them A and B,  are connected to positive voltage indicating a logic high. The two arrows pointing away from the LEDs (Light emitting diodes) are filled in with a color if the light is on indicating a logic high.
An AND gate can be created by placing two diodes in parallel.  Parallel diodes means that the diodes act independently of each other and meet at a common point of the greater circuit. An AND has a logic low output when either of the two inputs or both inputs are at a logic low (off/false).

*Double click for a better view! Notice that the top input is now hooked up to ground (the three line triangle symbol) which functions as a logic low (off/false) therefore the output of the AND gate is logic low (off/false).
An OR gate can be created by flipping around one of the two diodes (in parallel like the AND gate example above). The two inputs oppose each other resulting in an OR function. It looks like this!
1 Input is HIGH or true and the other is LOW (false) which is processed through the OR gate of diodes to result in a positive current (logic HIGH/true) through the logic indicating LED.

If you enjoyed this post and want more posts on diode logic or diode function, then email me at w7rdotblogspot@gmail.com and simply type "diode logic" or something and I will make it happen. Thanks.

Sunday, March 04, 2012

Importance Of Buffers To Electronics

The buffer gate does not have a dot (bubble)
 because the bubble means invert which is a property
 of invertor gates, not buffer gates.
The Magical Buffer
Buffers take 1 input, A, and output 1 output B. The logic state of the output is a copy of the logic state of the input. As an equation, its function looks like this A = B. If you think that is pointless, then you are right! However; the buffer has a greater purpose that is less obvious than the average logic gate. From now on, think of a buffer gate as a refresher. A buffer refreshes the electric current of input A by its own active supply of power (logic high) and ground (logic low).


Image from All About Circuits (allaboutcircuits.com)  
Practical Use and Application
Now, you know that buffers are used to refresh logic signals of high or low, but when would it be important to refresh logic signals? Let's say you have an AND gate (74xx08) that takes inputs, A and B, and outputs, AB, that needs to be used to create function X = ABC + ABD +ABE + ABF. There are 5 inputs, A, B, C, D, E, F, and one 1 output X which is dependent on the logic states of the 6 inputs (A,B,C,D,E,F). The output of the simple AB could be connected to 4 OR gate (74xx32) inputs because if any input, C,D,E,F are logic high along with the output of AB being high, then the final output of the function, X, would be logic high. In theory AB output could be sent to 4 individual OR gates without any change in the logic value AB, but sadly, the world is not perfect. Some of the electrical current, which is analog by nature (always changing), is lost in the 4  OR connections. Buffers would filter each of the 4 connections (outputs of AB) to strengthen the logic state. Over distance and processes, current is lost which can fall into the category of logic low. We do not want to lose our idealistic logic states. Better safe than sorry!


So, anytime you connect multiple logic inputs to the same output a buffer gate can ensure that each signal is in the logic high or low state by the time it reaches the several inputs.