A Power Personal Computer -- Built from Scratch - Computer Essay Example

A Power Personal Computer — Built from Scratch

Scenario:
My undergraduate studies in Computer Science needs a PC intended for maximizing potentials in computer networks
Limitations:
£500 budget and efficient use of open source
Components Needed:
Hardware:
Cost: < £494.68 (minus the assembling job for the pc)
Ø  Case

Need

essay sample on "A Power Personal Computer — Built from Scratch"

? - A Power Personal Computer -- Built from Scratch introduction.? We will write a cheap essay sample on "A Power Personal Computer — Built from Scratch" specifically for you for only $12.90/page

More Computer, information Essay Topics.

–          Required to hold all your components together

–          Sigma Gaming LaVie Mid-Tower Case w/window
Ø  Processor

–          Brain of the computer

–          (Sckt775)Intel® Core™ 2 Duo E8400 CPU @ 3.0GHz 1333FSB 6MB L2 ***Overclockable XXX*** Cache 64-bit

Ø  Motherboard

–          Connects your processor, memory, and all your expansion cards together to assemble a PC

–          (Sckt775)Intel® Core™ 2 Duo E8400 CPU @ 3.0GHz 1333FSB 6MB L2 ***Overclockable XXX*** Cache 64-bit

Ø  Memory

–          Stores volatile data

–          (Req.DDR2 MainBoard)2GB (2x1GB) PC6400 DDR2/800 Dual Channel Memory (Corsair Value Select or Major Brand)

Ø  Monitor

–          Visual display unit

–          19” Wide TFT Active Matrix LCD Display Monitor

Ø  Hard Drive

–          Stores all data including Operating System, applications, user files, and documents

–          Single Hard Drive (320GB SATA-II 3.0Gb/s 16MB Cache 7200RPM HDD)

Ø  Optical Drive

–          Needed to install applications

–          Sony Dual Format 20X DVD±R/±RW + CD-R/RW Drive Dual Layer(Silver Color)

Ø  Sound Card

–          Sounds requirement

–          Sony Dual Format 20X DVD±R/±RW + CD-R/RW Drive Dual Layer(Silver Color)

Ø  Keyboard

–          Text Inputs

–          Logitech PS/2 Keyboard (Black)

Ø  Mouse

–          Pointing device

–          Logitech Optical PS2 Mouse (Black)
Software
Cost: CDs and download cost of Ubuntu  JeOS and Open Office
Ø  Operating System

–          Host for application programs

–          Ubuntu JeOS

Ø  Office Suite

–          Bundle of programs to handle word processing, spreadsheets, database management, etc.

–          Open Office

Word Length Frequency Analyzer in Java

Introduction (taken from the overview)
The field of text analysis makes use of many different tools in order to extract information about written works. One of these methods is word length frequency, which is used to assess patterns in writing (for example, one author might prefer to use short, “snappy” words, whilst another might prefer longer words). Such information can be useful in helping to identify (or rule out) the author of an anonymous piece of work or it can also be used to improve the “flow” or readability of text. In its simplest form, frequency analysis calculates the number of words of length 1, 2, 3, …, n, where n is the length of the longest word. For example, analysing the sentence “I am a man” would produce the output “2, 1, 1”.

Description of the Java Program
I am required to produce an applet that will request a filename from the user, read in text from the file, perform the frequency analysis and present the results in some form. I may either simply print the frequencies as text (for a passing mark), or as a histogram (for higher marks).

Illustration

Had I the heavens’ embroidered cloths,
Enwrought with golden and silver light,
The blue and the dim and the dark cloths
Of night and light and the half-light,

I would spread the cloths under your feet:
But I, being poor, have only my dreams;
I have spread my dreams under your feet;
Tread softly because you tread on my dreams.

Sample Results
A “high-scoring” (i.e first class) output would be:

Length Frequency

1 3

2 6

3 15

4 8

5 11

6 9

7 4

8 1

9 1

10 0

11 2
whereas a second class output would draw a more basic histogram (perhaps using bars rather than columns), and a passing output would be:

Length Frequency
1 4
2 5
3 15
4 12
5 10
6 11
7 1
8 1
9 1
10 0
11 1

Codes for the Different Parts of the Program
Open File Dialog Box

import java.applet.*;

import java.awt.*;                // Imports Button, Canvas, TextArea, TextField

import java.awt.event.*;    // Imports ActionEvent, ActionListener

import java.io.*;

import java.net.MalformedURLException;

import java.net.URL;

import java.lang.Object;

import java.util.*;

/** This program demonstrates the use of the

  * Canvas component for drawing.

 **/

 public class CanvasApplet extends Applet

                           implements ActionListener

{

MyCanvas histogramCanvas;

 TextField filenameTextField  = new TextField(10);

 Button go = new Button(“GO!”);

 TextArea  answers = new TextArea(“Please upload an available file”,5,60, TextArea.SCROLLBARS_VERTICAL_ONLY);

 StringBuffer buffer;

  /** Create an interface with a canvas, TextArea, TextField, button and some visual additions.**/

  public void init () {

                // Use a borderlayout to control where

                 // the components go.

                 setLayout (new BorderLayout ());

Panel p = new Panel();

 setLayout (new BorderLayout ());

                 // Create an instance of myCanvas

                 histogramCanvas = new MyCanvas ();

                 p.add(“North”, createCanvasLine(Color.orange));

                 p.add (“North”, histogramCanvas);

                 p.add (“South”, answers);

 // Set the canvas to a fixed size.

                histogramCanvas.setSize (450,250);

                // Make a button and use this applet

                 // as it’s listener

                go.addActionListener (this);

                setLayout (new BorderLayout ());

                p.add(“South”, createCanvasLine(Color.orange));

                p.add(“South”, new Label(“Type in filename:”));

                 p.add(“South”, filenameTextField);

                p.add(“South”, go);

                 add(p);

  } //init

  public Canvas createCanvasLine(Color c){

                Canvas line = new Canvas( );

                 line.setSize(10000,1);

                 line.setBackground(c);

                 return line;

  }

  /** Each button click will redraw the canvas. **/

  public void actionPerformed  (ActionEvent e) {

                String line;

                URL url = null;

                Vector v = new Vector();

                String filename = filenameTextField.getText();

                answers.setText(“”);

                /**** File Reader Part ****/

                /**** Frequency Analyzer ****/

}

File Reader
try{

 try {

                               url = new URL (getCodeBase(), filename);

 }

                catch (MalformedURLException ex){

                                System.out.println(“Malformed URL “);

                                stop();

                }

 try {

                               InputStream in=CanvasApplet.class.getResourceAsStream(filename);

                               BufferedReader buinst = new BufferedReader(new InputStreamReader(in));

                               buffer = new StringBuffer();

                               answers.append(“\nText Uploaded________________________________________________”);

                               while ((line = buinst.readLine()) != null) {

                                               answers.append(“\n”+line);

                                               StringTokenizer st = new StringTokenizer(line, ” -“); //with deleted “ -“

                                               while(st.hasMoreTokens()){

                                                               String s = st.nextToken();

                                                               v.add(s.replaceAll(“\\p{Punct}”, “”).length());  //with deleted punctuations

                                               }

                               }

                               in.close();

                               answers.append(“\n\nFrequency Analysis___________________________________________”);

                }

                catch (IOException ex){

                                answers.append(“File Read Error”);

                }

                histogramCanvas.setValidFile(true);

 }catch(Exception error){

                answers.setText(“Please upload an available file”);

 }

Frequency Analyzer
int [] arr = new int[v.size()];

for(int i=0; i<v.size(); i++){

                arr[i] = Integer.parseInt(v.elementAt(i).toString());

}

double highestNoOfLetters = 0;

for(int i=0; i<arr.length; i++){

                if(arr[i]>highestNoOfLetters) highestNoOfLetters=arr[i];

}

int[] bins = new int[(int)highestNoOfLetters+1];

for(int i=1; i<bins.length; i++){

                bins[i]=0;

                for(int j=0; j<arr.length; j++){

                               if(arr[j]==i) bins[i]++;

                }

}

double highestFrequency = 0;

 for(int i=1; i<bins.length; i++){

                if(bins[i]>highestFrequency) highestFrequency=bins[i];

                answers.append(“\n”+i+” “+bins[i]);

 }

 histogramCanvas.storeData(highestFrequency, highestNoOfLetters, bins);

 histogramCanvas.repaint();

Histogram Renderer
public void paint (Graphics mycanvas) {

 if(hasValidFile){

                Color[] color = {Color.black, Color.blue, Color.cyan, Color.darkGray, Color.gray, Color.green,

Color.lightGray, Color.magenta, Color.orange, Color.pink, Color.red, Color.yellow};

                //double w = 450/highestNoOfLetters;                //TO BE USED IF COLUMNS ARE USED

                double h = 250/highestNoOfLetters;                    //PUT INTO COMMENT IF COLUMNS ARE USED

                for(int i=1; i<bins.length; i++){

                //double x = w*(i-1);                                                //TO BE USED IF COLUMNS ARE USED

                //double h = bins[i]*(235/highestFrequency);   //TO BE USED IF COLUMNS ARE USED

                //double y = 235-h;                                                 //TO BE USED IF COLUMNS ARE USED

                double y = h*(i-1);                                                //PUT INTO COMMENT IF COLUMNS ARE USED

                double w = 430/highestFrequency*bins[i];    //PUT INTO COMMENT IF COLUMNS ARE USED

                mycanvas.setColor(Color.black);

                //mycanvas.drawString(“”+bins[i], (int)x, (int)y+14);   //TO BE USED IF COLUMNS ARE USED

                mycanvas.drawString(“”+bins[i], (int)w, (int)y+14);     //PUT INTO COMMENT IF COLUMNS ARE USED

                mycanvas.setColor(color[i%color.length]);

                //mycanvas.fillRect((int)x,(int)y+15,(int)w,(int)h);       //TO BE USED IF COLUMNS ARE USED

                mycanvas.fillRect(0,(int)y,(int)w,(int)h);                        //PUT INTO COMMENT IF COLUMNS ARE USED

                }

                }else{

                               Font titleFont = new Font(“Helvetica”, Font.BOLD,  16);

                               mycanvas.setFont(titleFont);

                               mycanvas.drawString(“Text Frequency Analyzer in Java 1.6 Applet”, 10, 230);

                }

  }

Sketch of the Applet Layout

Print Screens of the Parts of the Program
Histogram Renderer

Main Function is to display the histogram basing on the Frequency analysis done in the input file.

But it also serves as holder of the Program’s title at its launch.

Console
It prompts the user to enter a valid filename at the start. It also displays the Text Uploaded and the Frequency Analysis Raw Results.

Open File Dialog Box
It asks the user to enter a valid filename in the given text field and then press the button GO to perform Text Frequency Analysis.

Software Used
Java Development Kit 6.1 for Windows
JCreator IDE
Microsoft Office Windows Vista Ultimate

How did I come up with the Program
It took me a while to conceptualize what would my Text Frequency Analyzer will look like and how it will function. With the help of several sites that part by part give me an idea how I would code the project, I had finally come up with a fully functional Text Frequency Analyzer that can render a histogram.

1. Analyze the Problem
The specifications should be first clear enough for me first, so that the program I would make conforms into it. The specifications emphasized that my Text Frequency analyzer should request a filename from the user, read in text from the file, perform the frequency analysis and present the results in some form.

2. Gather some data
To help me with doing the project, I had opted to browse the net if there are pre-made programs that render histograms. I had been able to get some but no one is exactly the same program that conforms to the Text Frequency Analyzer’s Specifications. Thus I need to adopt the algorithm used in those histogram renderers and then come up with my own program.

            One missing capability in those histogram renderers I got is the “Open File Dialog Box”. Thus I look for other programs that have this capability.

3. Test the available data
I need to test if the sample programs I had got from the internet would actually help me. Some of the programs only give partial methods to render a histogram thus making it not totally usable for me. One of the programs that concerns with the rendering of income brackets basing on an array of incomes of different persons gave me a hint how I would render my program’s histogram. Its histogram is only composed of two colors, one for the actual representation of data in columns, and one for the background.

3. Coding Proper
I started with a program that repaints a canvas every time it clicks a button. Getting a help from a separate program, I supplied the code for the opening of a file.  Then lastly, I applied the algorithm used in a program for rendering histograms. I added some modifications like the color change for the different entries in the histogram.

Evaluation
1. What was the task?

The task is to create a program for Text Frequency Analysis with the following capability:

Prompts the user to input a valid name of a text file.
Read the file input.
Perform frequency analysis of the lengths of words in the file.
Render the analysis in a histogram.

2. What did you create?
In my opinion, I had come up with a program that conforms to all of its required specifications. In addition, I had been able to make its user interface look fairly enough so that the user would enjoy performing such analysis.

3. Why and how you did it?
The Text Frequency Analysis is part of the requirement in my subject Computer Platforms. I had been able to come with one such program through the help of the available resources in the internet together with the Java API.

4. What did I learnt and gained from doing the Java assignment?
The Java Assignment tested my ability on how I would use the available resources I may add all up so that I could make my own program. It is nice that my instructor had come up with an idea to give us this tough Java programming assignment. I had learned how to create something new from two or more different things such as programs and then supply them with some additions so that it would look better and quite impressive. I had first tried to make one of my own without using such resources but it took me a while to think that I would not progress if I would only rely to my basic knowledge in Java I had acquired from my classes. Upon searching the internet that there are programs and tutorials on how I would create my programming assignment, I had one by one done each of the requirements in the programs set of specifications. It is amazing that almost all of the data I need is in the internet and the only thing I need to do is to interpret them into usable information for the making of the program. The different stages I had gone through starting from searching how could I render a histogram, how could I refresh the canvas every time a click a button, how could I read a file, how could I parse and extract text length’s frequency, and lastly how could I make the results the same as the one specified by my instructor, all of them are quite challenging but I had been able to surpass them all.

            Some of the new things I had learned that is quite worth saying are the use of regular expressions, drawing something on mathematical formulas, the use of data structure Vector, and finally, the use of an array of colors to make my program quite fairly looking enough. The use of regular expressions made me able to disregard the punctuations when I conduct the word length frequency analysis. I thought that I would just be contented with the advice that to make my program simple, just include the all of the punctuations in the text analysis. But when I browse the Java API, specifically for the Spring’s set of methods, I had thought that maybe the replaceAll function could be the answer to the problem. Upon reading the arguments needed for the replaceAll, I had noticed something new for me, which is the regex, short for regular expressions. Then I click its link, and I was brought into the page wherein I could found out how I could disregard punctuations with just a simple one line command, which is the v.add (s.replaceAll(“\\p{Punct}”, “”).length()); On drawing the text analysis into a histogram, it is also the aid of available resources that I had been able to come up with this particular specification. I had used one open source code in the internet that is used for bracketing data from an array of incomes. It made me have an idea how I could transfer the data I had with the text frequency analysis. The use of a data structure like Vector made me able to store those data after reading the text file line by line then parsing it word by word through the StringTokenizer class. Then in the myCanvas class I had created mathematical formulas so that the histogram to be displayed would maximize the available canvas size. After that stage, I thought that the use of an array of colors would create a more elegant look to my program.

5. What did you enjoy from doing the Java assignment?
I enjoy most of the time the testing of my program after I had applied a color scheme to the histogram renderer. But before that, it is the searching of usable data that took me a great challenge but quite enjoyable because it seems like I need to solve a maze or puzzle with the use of directions I need to read but find first from the full-featured World Wide Web.

6. What did you found difficult from the assignment?
The most difficult in my opinion in doing the assignment is the documentation part. For me that is accustomed to work with all coding first, I find it very difficult for me to explain how did I come up with a solution I had long enough discover. But I tried to recall as much as I can. My tendency in coding, I think is because of my eagerness to finish the coding process, besides of its being enjoyable.

6. What did you find easy from the assignment?
I think none is easy in the assignment, all are quite challenging. But if I need to rank them, I may choose the using of the Java API as the least challenging. I really commend the creators of Java API on the way they had linked each of the methods one programmer might use in developing software. The information in the Java API is easy to understand especially the Spring API.

6. What could you have done better and what improvements could you have made to the Java assignment?
In the start of my program, you will notice that the title, Text Frequency Analyzer in Java 1.6 Applet, would only show up after a matter of seconds. This is because that the program tries to perform a text analysis even that there is still no text file selected. I had tried not to use the try-catch constructs and rather use if-else with help of some Boolean expressions, but still it does not work and sometimes it rather generates errors. I may suggest therefore, that if I may be given more time, I may think of an algorithm on how I could make my program faster. Though the text frequency analysis is fast enough for my given sample files, I think that would not be the same case for files with voluminous text. But I think, in general, my program suffices the specifications and it just needs some modifications and improvements.

References

 Gamer Infinity 620. (n.d.) Retrieved July 25, 2008 from http://www.cyberpowersystem.co.uk/system/gamer_infinity_620/#configurator_top

Build your own pc. (2008) Retrieved July 25, 2008 from http://www.buildeasypc.com/

A Histogram of financila results. (n.d.) Retrieved July 25, 2008 from http://www.wellho.net/resources/ex.php4?item=j802/magpie.java

How to Write a Simple Applet. (n.d.). Retrieved July 25, 2008 from http://www.cs.colorado.edu/~main/applets/Simple.html

 

Haven't found the Essay You Want?

Get your custom essay sample

For Only $13/page