homework

how to use hashMap with JTable

i have a hashMap which i would like its data to be viewed in a JTable how ever i am having trouble getting the hashMap amount of columns and rows and the data to be displayed.i have a hashmap which takes a accountID as the key and a object of students in which each students have their data like name,id, age, etc.however referring to the ...

character device driver

The read() and write() callback functions in our ‘cmosram.c’ device-driver only transfer a single byte of data for each time called, so it takes 128 system-calls to read all of the RTC storage-locations! Can you improve this driver’s efficiency, by modifying its read() and write() functions, so they’ll transfer as many valid bytes as th...

IN clause on multiple columns using AND , JOIN

Which of the following queries are correct SELECT ID, STATUS, ITEM_TYPE,CREATED_TIME,UPDATED_TIME WHERE STATUS IN('OPEN','UPDATED') AND ITEM_TYPE IN ('ITEM1','ITEM2') AND CREATED_TIME BETWEEN 'XX' AND 'YY' AND UPDATED_TIME BETWEEN 'XX' AND 'ZZ' SELECT ID, STATUS, ITEM_TYPE,CREATED_TIME,UPDATED_TIME WHERE STA...

How do I see the output of my code using Visual C++ 2008?

I wrote some very simple code since I'm just starting C++ and I want to get warmed up with the syntax and compiler before our binary tree assignment. #include <iostream> using namespace std; int main(){ cout << "Hello"; return 0; } The only output I'm receiving is: 1> Build started: Project: First-BinaryTree, Configuration: Debug...

how to use scanner in foreachloop to store the input from commandline into array

Below is my code: I have defined a Student class that has last name, first name and score and get and set methods for the same as below. In main I create an array of student objects. The array has to get its element value from command line. I do not know how to use scanner in a foreach loop to store the input from the commandline into ...

Thread Synchronization - How to execute threads alternatively

I have been trying to solve a problem involving thread communication using wait() and notify(). Basically i have 2 threads T1 and T2 and i want them to be executed in the following order T1 , T2, T1, T2 ..... How can i achieve that? Actual Problem: There are 2 threads T1 - which prints odd numbers (say 1 - 100) and T2 - which prints ev...

Checking for end of string in a switch statement, c++

I'm writing a program to basically check if a number is a type float, double, or long double for an assignment using switch statements and a state machine. I am stepping through my program, and it gets all the way to the end except doesn't seem to recognize the string terminator '\0'. So I was wondering if that portion of my code is co...

What is the "biggest" negative number on a 4-bit machine?

Or, what is the range of numbers that can be represented on a 4-bit machine using 2s-complement? ...

How to create a biased number generator using a pair of six sided dice

What is the most efficient way to use a pair of six sided dice to generate a random number in [1, 4] unevenly: it should produce 1 in 40% of the time, 2 in 30%, 3 in 20%, and 4 in 10%. Please justify the correctness of the method and give an algorithm. Dice could be of different colors. Note: the only random number generators availa...

TreeView, Access DB & Windows Form (C#)

hello friends I am in trouble, i have a school project in which I have to use tree view control to display fullname from DB in the following form. suppose A is super memebr & under A there are others, and under other there could be other memeber and so on. its like chain system which will show referred member in hierarchical view. Than...

Algorithm for finding all cycles in a directed graph on C++ using Adjacency matrix

Given graph adjacency matrix (for ex. g[][]), graph is directed. Needs find count of all graph cycles (if exists) and print them. I tried to wrote this algorithm in Java, sometimes it works correctly. If graph has complex cycles, algorithm return crazy cycles. Please, look at my code and help to resolve this problem public static final...

Creating a GUI Calculator in python similar to MS Calculator

I need to write a code that runs similar to normal calculators in such a way that it displays the first number I type in, when i press the operand, the entry widget still displays the first number, but when i press the numbers for my second number, the first one gets replaced. I'm not to the point in writing the whole code yet, but I'm s...

Haskell: Parsing escape characters in single quotes

I'm currently making a scanner for a basic compiler I'm writing in Haskell. One of the requirements is that any character enclosed in single quotes (') is translated into a character literal token (type T_Char), and this includes escape sequences such as '\n' and '\t'. I've defined this part of the scanner function which works okay for m...

Storing data effectively

hi everyone, maybe i'm having stupid question as always, but somehow i can't google out how should I store variables so it's effective. Our teacher on c++ just by the way droped something about how could size of the stored data type affect the speed of storing it (like searching for closest sufficient continuous block of memory) and I w...

Project Ideas for course

I am going to start my Software Engineering course this semester. So I need a good project plan for it. Will have 3-4 months to complete the project. I am planning to develope a Remote Desktop Client or an Email client like gmail or yahoo. If anybody has any ideas please let me know. ...

XML DTD - Defining attributes as numbers and requiring #PCDATA

I realize Schema is the way to go, but this is an assignment. If I wanted to require an attribute on some element to be a float/number, is that possible? The only thing I know to do is to define it as CDATA - is there some predefined ENTITY ? I don't think I should pull in any other DTD, so if it's that complex, it's incorrect for the...

homework on scheme

how to design a function content which inputs a single list of atoms lat and which returns the content of lat.Thus the content of '(a b c a b c d d) is '(a b c d). ...

How do you avoid an invalid search space in a genetic algorithm?

I am developing a GA for a school project and I've noticed that upon evaluating my functions for fitness, an individual is equivalent to its inverse. For example, the set (1, 1, -1, 1) is equivalent to (-1, -1, 1, -1). To shrink my search space and reach a solution more efficiently, how can I avoid my crossovers from searching in thi...

What is total frequency count and running time (Big-O notation)?

I have the following code snippet: 1. for (i = 1; i < n; i++) 2. for (j = 1; j < i*i; j++) 3. if(j % i == 0) 4. for(k = 0; k < j;k++) 5. sum++; What is total frequency count and running time (Big-Oh notation)? Frequency count examine a piece code and predict the number of instructions to be executed (e.g...

In java, how to check if a string contains a substring , ( ignoring the case ) ?

I have two Strings: str1 and str2. How to check if str2 is contained within str1, ignoring case? ...