Search This Blog

Thursday, March 24, 2011

USB 3.0 and SATA 3.0 specifications

I know these next two items are not directly related to Java, but . . . . these two items are directly related to Java and the way computers integrate with peripherals.  We shall call this the Immutable Law #34 of USB and SATA.  Besides, this is my blog, I am a tech-head and I can post whatever the hell I want on my blog.
  
"USB 3.0

The USB 3.0 Promoter Group announced on 17 November 2008, that version 3.0 of the specification had been completed and had made the transition to the USB Implementers Forum (USB-IF), the managing body of USB specification.  This move effectively opened the specification to hardware developers for implementation in future products.  The first USB 3.0 consumer products were announced and shipped by Buffalo Technology in November 2009
while the first certified USB 3.0 consumer products were announced 5 January 2010, at the Las Vegas Consumer Electronics Show (CES), including two motherboards by ASUSGigabyte Technology.[74][75] Manufacturers of USB 3.0 host controllers includes, but are not limited to, Renesas/NEC Electronics, Fresco Logic, Asmedia, Etron, VIA Labs and Texas Instruments. As of November 2010, Renesas is the only company to have passed USB-IF certification, although motherboards for Intel's Sandy Bridge processors have been seen with Asmedia and Etron host controllers. On October 28, 2010 Hewlett-Packard released the HP Envy 17 3D featuring a Renesas USB 3.0 Host Controller several months before some of their competitors. AMD is working with Renesas to add its USB 3.0 implementation into its chipsets for its 2011 platforms. At CES2011 Toshiba unveiled a laptop called "Toshiba Qosmio X500" that included USB 3.0 and Bluetooth 3.0, and a new series of Sony VAIO laptops that will include USB 3.0.

Features

A new feature is the "SuperSpeed" bus, which provides a fourth transfer mode at 5.0 Gbit/s. The raw throughput is 4 Gbit/s, and the specification considers it reasonable to achieve 3.2 Gbit/s (0.4 GB/s or 400 MB/s), or more, after protocol overhead.  When operating in SuperSpeed mode, full-duplex signaling occurs over two differential pairs separate from the non-SuperSpeed differential pair. This results in USB 3.0 cables containing two wires for power and ground, two wires for non-SuperSpeed data, and four wires for SuperSpeed data, and a shield that was not required in previous specifications.

To accommodate the additional pins for SuperSpeed mode, the physical form factors for USB 3.0 plugs and receptacles have been modified from those used in previous versions. Standard-A cables have extended heads where the SuperSpeed connectors extend beyond and slightly above the legacy connectors. Similarly, the Standard-A receptacle is deeper to accept these new connectors. On the other end, the SuperSpeed Standard-B connectors are placed on top of the existing form factor. A legacy standard A-to-B cable will work as designed and will never contact any of the SuperSpeed connectors, ensuring backward compatibility. SuperSpeed standard A plugs will fit legacy A receptacles, but SuperSpeed standard B plugs will not fit into legacy standard B receptacles, so a new cable can be used to connect a new device to an old host, but not to connect a new host to an old device; for that, a legacy standard A-to-B cable will be required.

SuperSpeed establishes a communications pipe between the host and each device, in a host-directed protocol. In contrast, USB 2.0 broadcasts packet traffic to all devices.  USB 3.0 extends the bulk transfer type in SuperSpeed with Streams. This extension allows a host and device to create and transfer multiple streams of data through a single bulk pipe.

New power management features include support of idle, sleep and suspend states, as well as link-, device-, and function-level power management.

The bus power spec has been increased so that a unit load is 150 mA (+50% over minimum using USB 2.0). An unconfigured device can still draw only one unit load, but a configured device can draw up to six unit loads (900 mA, an 80% increase over USB 2.0 at a registered maximum of 500 mA). Minimum device operating voltage is dropped from 4.4 V to 4 V.

USB 3.0 does not define cable assembly lengths, except that it can be of any length as long as it meets all the requirements defined in the specification. Although electronicdesign.com estimated cables will be limited to 3 m at SuperSpeed, cables which support SuperSpeed are already available up to 5 m in length.

The technology is similar to a single channel ("1×") of PCI Express 2.0 (5 Gbit/s). It uses 8B/10B encoding, linear feedback shift register (LFSR) scrambling for data and spread spectrum. It forces receivers to use low frequency periodic signaling (LFPS), dynamic equalization, and training sequences to ensure fast signal locking."


---------------------------------------------------------------------------------------------------------------------------------

"SATA revision 3.0 (SATA 6 Gbit/s)



Serial ATA International Organization presented the draft specification of SATA 6 Gbit/s physical layer in July 2008, and ratified its physical layer specification on August 18, 2008.  The full 3.0 standard was released on May 27, 2009.  It provides peak throughput of about 600 MB/s (Megabytes per second) including the protocol overhead (10b/8b coding with 8 bits to one byte). While even the fastest conventional hard disk drives can barely saturate the original SATA 1.5 Gbit/s bandwidth, Solid-State Drives have already saturated SATA 3 Gbit/s with 285/275 MB/s max read/write speed and 250 MB/s sustained with the Sandforce 1200 and 1500 controller. However SandForce SSD controllers scheduled for release in 2011 have delivered 500 MB/s read/write rates, and ten channels of fast flash can reach well over 500 MB/s with new ONFI drives – a move from SATA 3 Gbit/s to SATA 6 Gbit/s allows such devices to work at their full speed. Full performance from Crucial's C300 SSD similarly require SATA 3.0. As for standard hard disks, the reads from their built-in DRAM cache will end up faster across the new interface.  SATA 6 Gbit/s hard drives and motherboards are now shipping from several suppliers.

The new specification contains the following changes:
6 Gbit/s for scalable performance when used with SSDs
Continued compatibility with SAS, including SAS 6 Gbit/s. "A SAS domain may support attachment to and control of unmodified SATA devices connected directly into the SAS domain using the Serial ATA Tunneled Protocol (STP)" from the SATA_Revision_3_0_Gold specification.
Isochronous Native Command Queuing (NCQ) streaming command to enable isochronous quality of service data transfers for streaming digital content applications.
An NCQ Management feature that helps optimize performance by enabling host processing and management of outstanding NCQ commands.
Improved power management capabilities.
A small low insertion force (LIF) connector for more compact 1.8-inch storage devices.
A connector designed to accommodate 7 mm optical disk drives for thinner and lighter notebooks.
Alignment with the INCITS ATA8-ACS standard.

In general, the enhancements are aimed at improving quality of service for video streaming and high-priority interrupts. In addition, the standard continues to support distances up to a meter. The new speeds may require higher power consumption for supporting chips, factors that new process technologies and power management techniques are expected to mitigate. The new specification can use existing SATA cables and connectors, although some OEMs are expected to upgrade host connectors for the higher speeds.  Also, the new standard is backwards compatible with SATA 3 Gbit/s."

Collections, Java Collections Framework, Arrays

I have a question regarding Collections as part of the Java Collections Framework.

"A collection — sometimes called a container — is simply an object that groups multiple elements into a single unit. Collections are used to store, retrieve, manipulate, and communicate aggregate data."

"A collections framework is a unified architecture for representing and manipulating collections. All collections frameworks contain the following:
  • Interfaces: These are abstract data types that represent collections. Interfaces allow collections to be manipulated independently of the details of their representation. In object-oriented languages, interfaces generally form a hierarchy.
  • Implementations: These are the concrete implementations of the collection interfaces. In essence, they are reusable data structures.
  • Algorithms: These are the methods that perform useful computations, such as searching and sorting, on objects that implement collection interfaces. The algorithms are said to be polymorphic: that is, the same method can be used on many different implementations of the appropriate collection interface. In essence, algorithms are reusable functionality."
 "An Iterator is an object that enables you to traverse through a collection and to remove elements from the collection selectively, if desired. You get an Iterator for a collection by calling its iterator method. The following is the Iterator interface.


public interface Iterator<E> {
    boolean hasNext();
    E next();
    void remove(); //optional
}
"
 
My question is this:  public interface Iterator<E>
 
"Public" is the access modifier.
 "interface" is the declaration of the return data type.
"Iterator" is the name of the interface.
"<E>" is the argument passed to the Iterator interface.
 
WHAT IS E???  Is it a generic argument that allows for generalization 
of the Iterator, or that anything may be passed to the Iterator method?
 
Or does <E> represent an index, or element of the Iterator collection???
 
Or both??? 

Tuesday, March 22, 2011

Software Agitation - Agitar Eclipse Plug-In

This sounds like an interesting plug-in to help test large projects.

"‘Software Agitation’ refers to the process of exercising your code by automatically creating dynamic test cases, synthesizing sets of variable input data against such test cases, and analyzing the results.
‘Agitation’ provides a unique interactive understanding of code behavior as a Developer writes or modifies Java classes or methods.
"

To review the PDF:

http://viewer.media.bitpipe.com/1136574296_249/1299792761_137/Agitation_personalCoderReviewer.pdf

Tuesday, March 8, 2011

Thursday, March 3, 2011

Java Tutorials

Since the HighPatriarch(Patriarch = Cameron McKenzie){} will not get me copies of his books, I have had to revert to:

http://download.oracle.com/javase/tutorial/java/index.html

It is a good source and reference guide.

Monday, February 28, 2011

Logical Programming Template, where to begin

I now have some of the basic and fundamental concepts behind me.  I also have some basic syntax, semantics and pragmatics behind me.  I believe my confusion is in not having a template "in my mind" of how and where to start after the problem domain has been defined.  I have come up with a basic template that I will try and use as a guide for the next little bit.  Cam, feel free to revise and add opinions.

1)  Create object classes
           
         --  Initialze and declare object properties
         --  Create methods that define properties of that object

2)  Create the main method

         --  Define objects and their arguments
         --  Create instance(s) of a method(multiple methods)
         --  Pass instance(s) to the method(s)

3)  Create method(s)

         --  Perform data conditioning
         --  return control back to calling method

Almost time for MySQL

Almost time to practice the small amount of training I have had with MySQL database. It also ties in a Java front end to call and manipulate the database from Java. Check it out . . . .
http://technicalfacilitation.com/learnwiki/index.php/Mysql

Saturday, February 26, 2011

Assignment

Cameron said... Here's an assignment for you. This is important to do, because it will really hit where you're getting frustrated - working with methods, both creating them and passing values to them. Give it a try!

I didn't compile the code in the examples, so you might want to make sure I haven't missed a semi-colon or anything. Regardless, the objective remains the same: create the methods that I've asked for, and write some code that invokes the methods by passing in the appropriate objects! This will be eye-opening for you.

****************************

Let's look at three core shapes: Circle, Point and Rectangle.

Here's how we create them:

Circle drum = new Circle(2);

Circle life = new Circle(10);

Point ed = new Point(0,0);

Point pelee = new Point(5,5);

Rectangle r1 = new Rectangle(2,3);

Rectangle r2 = new Rectangle(5,4);


If I wanted to just print out the area of a Circle, I could create a method like this:

public class PracticeMethods {
public void printCircleArea(Circle c) {
System.out.println("The area of the circle you passed me is: " + c.getArea();
}
}

To run this code, I could write a class like this:

public class PMRunner {

public static void main(String args[]) {
Circle drum = new Circle(2);
PracticeMethods pm = new PracticeMethods(); //create an instance
pm.printCircleArea(drum); //pass an instance of a Circle to the method.
}

}

When the PMRunner executes, it will print out: The area of the circle you passed me is: 6

So, here you see how to code a class that has a method that takes an argument. (The PracticeMethods class)

And you also see how to create an instance of a class, and call one of the instance methods, while also passing in an argument of the proper type.

Question: Why does the printCircleArea return void and not a String? Doesn't the method return a String?

In the PracticeMethods class, create the following methods:

compareCircleToCircle - it takes two circles as arguments. It returns true or false depending on whether the two circles have the same area.

comparePointToCircle - it is passed in a Point and a Circle. It prints out how much bigger the area of the circle is than the area of the point.

compareCircleToSquare - it is passed in a Circle and a Square. It returns a String that says "The circle is bigger than the square" or "The square is bigger than the circle" or "The circle and square are the same size."

compareSquareToSquare - it is passed in two Squares, and returns a boolean value indicating if the first square is bigger than the second. It also returns the difference in the sizes of the two squares.

Monday, February 21, 2011

Primitive Data Types

Did Chapter 6 of:


SCJA—Sun Certified Java Associate Certification Study Guide for Java 5, Java2EE and J2ME Technology form ExamScam.com

this morning.  I created an ExamField Java project in Eclipse to run ExamField. This way I could compile, run and debug scenarios in real time.  I learned a couple of things.  The primitive data type CHAR must go inside single quotes.
 
------------------------------------------------------------------------------------------
public class TestFieldChar {

    public static void main(String[] args) {
        char singleCharacter = 'a';
        System.out.println("Test Field");
        System.out.print(singleCharacter);

    }

}

OUTPUT:

Test Field
a

 ---------------------------------------------------------------------------------------

I thought that there may be an issue when compiling the output from the following example for BYTE:

CODE:

 public class TestFieldByte {

    public static void main(String[] args) {
        byte b = 12;
        System.out.println("Test Field");
        System.out.print(b * b);

    }

}


OUTPUT:

Test Field
144

I presumed that the compiler would flag the output and go out of scope, as the maximum value for BYTE is 127.  12 * 12 is 144 and out of scope for BYTE data types.  In this case, all was well.  However, if you had a variable of type byte assigned to the output of b * b, you would go out of scope.

byte result = b * b, then result would be out of scope as it has been declared data type byte. 

-----------------------------------------------------------------------------------

BOOLEAN data types have no quotes, single quotes or bracketing when assigning.  Only possible values are true and false.

CODE:

public class TestFieldBoolean {

    public static void main(String[] args) {
        boolean condition = true;
        System.out.println("Test Field");
        System.out.print(condition);

    }

}

OUTPUT:

Test Field
true

------------------------------------------------------------------------------------

Saturday, February 19, 2011

New Project - Online Exam, Logic Diagram

Cam and I have taken some time out the last couple of days to chart the logic diagram for the online exam we are about to program and publish.  I have had some differences of opinion in the logic flow and, as Cam stated, there is more than one way to code the program.  I am trying to pay attention and grasp and understand his logic flow, which in itself is pretty easy.  Towards the end, Cam's experience became apparent with the addition of certain classes to help organize this flow for multiplicity reasons later on.  I will try and get a good copy, scan it and publish it here . . .

Wednesday, February 16, 2011

Java EE SDK, GlassFish Server and Eclipse IDE for EE

Just finished downloading the EE SDK (which contains the GlassFish Server) and Eclipse IDE for EE.  Cam showed me how to create an HTML and Java logic page, host it to a local server, create some tables in HTML and use Java to create buttons and a dialogue box. 

Awesome stuff, I feel I am one step further to grasping classes, methods, constructors, creating instances of such and passing data.  I believe something has clicked in my linear programmed head regarding objects NOT being variables or confusing objects with being a part of Java syntax.  An object is an object!  A tangible, manipulative thing which has methods that are used to describe that object, using variables and parameters.  Classes are ways to organize and sort these objects.

It took my awhile to get this, Cam had stated that I was doing well with the "hard" concepts, but missing out on this easy, essential and important concept of Java.
    

Sunday, February 13, 2011

Next assignment - space shuttle course alteration. JJ, Plot a line using two points

Master Jedi has asked I build a new class to plot a line using the classes we have been building regarding points, lines, rectangles, squares and triangles.  Hint - you need two sets of double parameters.  x1, x2 (starting point of line) and y1, y2 (ending point of line). 

Saturday, February 12, 2011

Specialization, abstraction, aggregation and inheritance

Tough night.

I believe my head is in the right place regarding concepts, but syntax and nomenclature have been huge pitfalls.  I am getting confused with when and where to initialize and declare primitive data types.  Let me stew on things for a day before I give the Larry Gutt special definitions of specialization, abstraction, aggregation and inheritance.  I have a 'feel' for the definitions, but need to visualize and piece them together with the concepts being taught.

Wednesday, February 9, 2011

Mock SCJA test

I took a mock SCJA cert test for fun this morning at Java Ranch.

http://www.coderanch.com/how-to/java/ScjpMockTests

I have literally no theory or reading behind me yet.  I scored 18 out of 36 over three sets of twelve.  Some of my corrects, I am sure, were guesses.  There are many questions on classes.  I have to concentrate my learning there in my own time. 

Tuesday, February 8, 2011

Constructor Methods

Tonight's training was a couple of hours of being introduced to Constructor Methods, in particular, pertaining to Squares, Rectangles and returning the area's of each (we were sending the variables for length and width).

Very clean.  Very cool.

Looping

Have some interesting things happening while looping through my RPS program to achieve a program run count of 100.  Trying to figure it out without asking for help or looking online.  I had also based an equation on total count but have rem'ed it out to concentrate on the loop.

Here's my code (excuse pragmatics, I am concentrating on concepts and debugging, not readability.)


import java.util.*;

public class AdvancedRPSLoopCounter {

  public static void main(String args[]) {

      
        /* Variable declarations */      


        String player1 = null;
        String player2 = null;
        int p1win = 0;
        int p1lose = 0;
        int p2win = 0;
        int p2lose = 0;
        int tie = 0;
        String result = null;

    /* Loop one hundred times */


    for (int i=0;i<101;i++) {
  

        /* Create player 1 absolute random 0 - 2 */


        Random r1 = new Random();
        int randomInt1 = Math.abs(r1.nextInt() % 3);
  

        /* Assign player 1 variable */


      
        if(randomInt1 == 0) {
            player1="rock";
        }
        if(randomInt1 == 1) {
            player1="paper";
        }
        if(randomInt1 == 2) {
            player1="scissors";
        }



        /* Create player 2 absolute random 0 - 2 */
      


        Random r2 = new Random();
        int randomInt2 = Math.abs(r2.nextInt() % 3);


      
        /* Assign player 2 variable */



        if(randomInt2 == 0) {
            player2="rock";
        }
        if(randomInt2 == 1) {
            player2="paper";
        }
        if(randomInt2 == 2) {
            player2="scissors";
        }



        /* Tie Condition */


      

        if (player1.equals(player2)) {
            result="Tie";
            tie = tie +1;

        }  

      

        /* Win/Lose Conditions */



        if (player1.equals("rock")) {
          
            if (player2.equals("paper")) {
                result="Player 2 Wins";
                p2win = p2win +1;
            }
            if (player2.equals("scissors")) {
                result="Player 2 Loses";
                p2lose = p2lose +1;
            }
        }

  
        if (player1.equals("paper")) {
            if (player2.equals("rock")) {
                result="Player 2 Loses";
                p2lose = p2lose +1;
            }
            if (player2.equals("scissors")) {
                result="Player 2 Wins";
                p2win = p2win +1;
            }
        }

  
        if (player1.equals("scissors")) {
            if (player2.equals("rock")) {
                result="Player 2 Wins";
                p2win = p2win +1;
            }
            if (player2.equals("paper")) {
                result="Player 2 Loses";
                p2lose = p2lose +1;
            }

        }


  
        /* Print to standard output per game result, print game counter */


   
        System.out.println(result);
        System.out.println("Counter: " + i);
          System.out.println(" ");
      
      
          }



        /* Print total ties, wins and loses */

        /* p1win = i - (p2lose + tie); */
        /* p1lose = i - (p2win + tie); */

      
      
        System.out.println("\n \t Number of ties: " + tie);
        System.out.println("\n \t Player 1 Wins: " + p1win);
        System.out.println("\n \t Player 1 Loses: " + p1lose);
        System.out.println("\n \t Player 2 Wins: " + p2win);
        System.out.println("\n \t Player 2 Loses: " +p2lose);
              

    }


}

The output from my program is as follows:

Counter: 100
Number of ties: 39
Player 2 Wins: 34
Player 2 Losses: 28

Some interesting things to note.  When I go to execution start, the first line count begins at 5.  The program is only looping 96 times.

Will get back later when I figure out the solution or break and ask for help . . . .

Monday, February 7, 2011

RPS Project

I have been assigned the task of coding the RPS (Rock/Paper/Scissors) game.  As Cam stated, it ties some of the most important elements, logics and concepts of programming together. 

I am brand new at the semantics and pragmatics of Java, JSP (Java Server Page) and OOP (Object Oriented Programming), but my past experience is turning out to be a real shining star.  Many of the the concepts are the same and the if and for syntax statements are exactly the same.  I already understand variable declaration, nesting, loops and passing data.

Trying to type out as much code as possible without blasting out to Google and cutting and pasting existing code.  I am finding the whole bracketing concept quite easy to logically segregate different functions, BUT THEY ARE EVERYWHERE in the code!!!  My most prevalent compiling error so far has been parsing errors.

So, as of right now, with the help of Cam supplying concepts and syntax where needed, the first copy of a standalone version of RPS is completed, along with a loop of 3 times and a counter.  I am about to tear up the code and try and loop for a greater number of runs, randomize the user input (player 1 = server, player 2 = user) to allow for non-user input and begin keeping track of the number of wins, the number of losses and the number of ties.

The Beginning

Well, this is the start of another journey.  Cameron McKenzie, an old friend of mine from highschool, who is well established in the Java programming community and the author of a multitude of Java certification and technical source books, has taken me under his wing and started my tutelage.

I previously had experience with Basic and VBasic programming languages years ago, but the whole OOP environment has soared since the days of linear code.  I am currently being taught Java and JSP (Java Server Page).

As it happened when I was younger, I AM HOOKED yet again.  Waking up after sleeping for two hours at 1 in the morning and being incapable of not loading up my JDK and working on new tasks being setup by Cameron.

It is a very exciting time and I believe my past computer knowledge and interest have set me up for what is to come.