Skip to main content

Posts

IO Lab 2

Last week we looked at how to manipulate files using a bunch of classes in Java.nio.file.   This week we will learn how to read and write text files using classes in Java.nio.file package. Create a directory called “files” in the root folder of the project. Create a text file called “source.txt” in the files folder. Create two Path object to hold the source path (“files/source.txt”) and the target path (“files/target.txt”) Create a Charset object as shown below: Charset charset = Charset.forName(“US-ASCII”); Within a try-with-resources block, create a BufferedReader object using the newBufferedReader method of the Files class passing source path and charset as parameters. In the try-with-resources block that you created before, add a BufferedWriter object using   Files.newBufferedWriter method passing target path and charset as parameter. Read using the BufferedReader’s readLine method and writ...

Swing Lab 1

Create a new java project in Intellij. File → New → Project. You should see the following dialog. Click next. Select Create project from template and click next.   In the Project name field, type SwingIntro and click finish. Extend the Main class with JFrame class. Ensure that you import javax.swing.*; public class Main extends JFrame { Modify the main method as shown below: public static void main(String[] args) {    java.awt.EventQueue. invokeLater ( new Runnable() {        @Override        public void run() {            new Main();        }    }); } In the Main class constructor add the following coding                   setVisible( true ); Run the ...

C# Assignment - HashTable, Dictionary Lab and HashSet

C# Data structure assignment - HashTable, Dictionary Lab and HashSet Question 1 In this lab, we will create a very simple HashTable a. Create a console application b. Create a new Hash table. c. Add the following key value pair to the hash table Josh", "Joshua Whitetail" "Sam", "Samantha Bernie" "Eli", "Elizabeth Spiegel" "Will", "William Johnson" "Don", "Donald Regan" d. Use foreach, to print the key and value to console window. Question 2   Write a console application that does the following: a. The main method should   take a String array (use the one given   below), and store the array's elements into a HashSet to eliminate duplicates, and finally output the number of unique strings i n the array and print the strings to the console. String [] sampleStrings = {"that", "that", "is", "is", "tha...

DB Lab 2

DB Lab 2 - Select, insert, update and delete records with Java bean In the last lab, we looked at retrieving records. In this lab we will be looking at creating data entities using JavaBean classes. Create a JavaBean class to create instances of actor. This will be a simple class called Actor with the attributes matching each field in the actor table. Actor actor_id first_name last_name last_update All getters &  setters Create another class called ActorMgr that holds the following static methods public static void getAllRecords() public static Actor getRecord(int actor_id) public static boolean insertRecord(Actor actor) public static boolean updateRecord (Actor actor) public static boolean deleteRecord (int actor_id) The Main method provides the following output: Actor Table 1 - Display all Row | 2-Get a Row | 3-Add a new row | 4-Update an existing row | 5 - Delete a row   Select an option : >2 Enter the ...

Day 4 - Big Data Systems Architecture and Components

Topics: Big Data Systems Architecture and Components  Reading List Tutorials/Documentation Apache hive SerDe -  https://cwiki.apache.org/confluence/display/Hive/SerDe How-to: Use a SerDe in Apache Hive -    http://blog.cloudera.com/blog/2012/12/how-to-use-a-serde-in-apache-hive/ Improving Query Performance Using Partitioning in Apache Hive -   http://blog.cloudera.com/blog/2014/08/improving-query-performance-using-partitioning-in-apache-hive/

Day 3 - Big Data Systems Architecture and Components

Topics: Big Data Systems Architecture and Components   Assessments due this week: Exploring hive and impala exercise  Reading List Tools  Apache Hive -  https://hive.apache.org/ Apache Impala -  https://impala.apache.org/overview.html Tutorials/Documentation Impala Guide -  https://www.cloudera.com/documentation/enterprise/5-5-x/topics/impala.html    Clourera Impala -  https://www.cloudera.com/content/dam/www/marketing/resources/whitepapers/apache-impala-incubating-analytic-database-for-apache-hadoop-technical-ebook.pdf.landing.html Hadoop & Big Data 101: The Basics -   https://www.cloudera.com/content/dam/www/marketing/resources/about-cloudera/hadoop---big-data-101--the-basics.png.landing.html Hive 'cheat sheet' for SQL users -  https://hortonworks.com/blog/hive-cheat-sheet-for-sql-users/  [ PDF ] Source:    https://www.cloudera.com/content/dam/www/marketing/resources/about-cloud...

Collection Assignment

Data Structure - Assignment 4: Linked List, Queues, and Stacks Create a SinglyLinkedList. Using the instructions given in SinglyLinkedList class exercise. In the same project, create a DoublyLinkedList. Using the instructions given in DoublyLinkedList class exercise. Modify DoublyLinkedList class to implement ICollection  Interface Modify DoublyLinkedList class to implement IEnumerable  interface Add a class called Queue that adapts the DoublyLinkedList. Add a class called Stack that adapts the DoublyLinkedList. Test and submit your solution.