homework

OpenMP: What is the difference between foo() and bar()

void foo(void) { #pragma omp parallel { #pragma omp single {fprintf(stderr, "first part\n"); } #pragma omp barrier #pragma omp single { fprintf(stderr, "second part\n"); } } } void bar (void) { #pragma omp parallel { #pragma omp sections { ...

Database Structure & Hard drive seek time confusion

Hi guys, could some one help me out trying to understand how hard drive seeking works. I have a small binary database file which read performance is absolutely essential. If I need to skip a few bytes in the file is it quicker to use seek() or to read() then discard the unwanted data. If the average seek time of a hard drive is 10ms an...

Java enum converting string to enum

Say I have an enum which is just public enum Blah { A, B , C, D } and I would like to find the enum value of a string of for example "A" which would be Blah.A. How would it be possible to do this? Is the Enum.ValueOf() the method I need? If so, how would I use this? ...

Another way to solve the Dining Philosopher problem (need a point in the right direction)

Hello, for a programming assignment I have been asked to implement a solution to the Dining Philosopher problem. I must do so in two ways: Use the wait() and notifyAll() mechanism Using an existing concurrent data structure provided in the Java API I have already complete the first implementation. Which concurrent data structure is m...

C Arrays and unbroken lists

/edit: thanks for the help so far, however I haven't got any of the solutions to take the sample input and give the sample output. My description isn't the clearest, sorry. I have an array composed of binary data. What I want to do is determine how long each unbroken segment of 1s or 0s is. Say I have this data: 0111010001110 In an ...

Excel conditional counting

This is a doubt that arose in my workplace, and it should be pretty straightforward. We have two columns of numbers, say: 1 1 1 2 2 1 2 2 And we want to get the number of rows that have equal numbers (2), without a helping column for each comparison. We can't get a working matrix operation (wich is the way we think correct). Any idea...

Javascript: What Document object property can be dynamically rendered after a Web page is rendered?

According to a school assignment, only one property of the Document object can be dynamically changed after a Web page is rendered. Is it body or cookie? ...

Where can I find the source code of the Worms game?

I am developing the game worms (in the context of a university project), and I would like to know if there is any source code out there for a simple implementation of the game or any other game that derive/resemble to worms. The game is the old fushion one (back to assembly ones if you want), so any source code is welcome. ...

Best way of Multithreading

I have a college assignment due quite soon, and I need to be able to call a C++ dll that takes a long time (possibly infinte, it relies on user input)to execute. Im calling this through VB. My VB GUI freezes up when this happens, and I would like to keep the GUI responsive, so that the user can stop this possibly infinte loop. Can anyo...

How can I get a list of files in a directory using C or C++?

How can I determine the list of files in a directory from inside my C or C++ code? I'm not allowed to execute the 'ls' command and parse the results from within my program. ...

RMI and exceptions

I am new to using RMI and I am relatively new to using exceptions. I want to be able to throw an exception over RMI (is this possible?) I have a simple server which serves up students and I have delete method which if the student doesn't exist I want to throw a custom exception of StudentNotFoundException which extends RemoteException...

How can I count the unique numbers in an array without rearranging the array elements?

I am having trouble counting the unique values in an array, and I need to do so without rearranging the array elements. How can I accomplish this? ...

WordNet code for NLP

hi there Is there any code available to demonstrate Natural language processing using Wordnet? My problem statment is "Develop a Query answering system . It takes query string as input. Search for the revelent answer from the document which is the user is reading. Its a desktop application the document is already saved. Desired output i...

C# Graph Traversal

This algorithm does a great job of traversing the nodes in a graph. Dictionary<Node, bool> visited = new Dictionary<Node, bool>(); Queue<Node> worklist = new Queue<Node>(); visited.Add(this, false); worklist.Enqueue(this); while (worklist.Count != 0) { Node node = worklist.Dequeue(); foreach (Node neighbor in node.Neighbors...

java interface extends questions

For my assignment I have to implement an RMI server which will a front end for two other RMI services. So I decided a logical thing to do would be to have the interface for this implement the interfaces for the other two services. public interface FrontEndServer extends Remote, BookServer, StudentServer { // Block empty so far } ...

C preprocessors

How can I write a program in C which removes all the defined values defined by the user using #define name value? Throughout the program should we replace the name, value? Does anyone have any examples of this? ...

Why is my Panel's repaint not being called?

I've got a problem which I just can't seem to get around involving a small animation. For a project we are designing a J9 application to run on a PDA (DELL Axim X51). The problematic code (shown below) is when a mouse click is detected to run a small animation in a nested panel. If the animation is run independently of the mouse click, i...

How to reference an external library in an Ant build and general Ant help?

Hi, We have an ant build script for a project we're developing for a PDA. In eclipse we have a load of referenced libraries and I know how to get them to work when we run the jar on the PDA because we have a .lnk file where you can add the external libraries simply by adding the following: 512#"\J9\PPRO11\bin\j9.exe" -jcl:ppro11 -cp "...

Scoping problem in Ada

I got this problem wrong on my homework, and I can't figure out why: procedure Main is X: Integer; procedure Sub1 is X: Integer; begin - of Sub1 Put(X); end; - of Sub1 procedure Sub2 is X: Integer; begin - of Sub2 X:=5; Sub1 end; - of Sub2 begin -of ...

Python function: Find Change from purchase amount

I'm looking for the most efficient way to figure out a change amount (Quarters, dimes, nickels, and pennies) from a purchase amount. The purchase amount must be less than $1, and the change is from one dollar. I need to know how many quarters, dimes, nickels, and pennies someone would get back. Would it be best to set up a dictionary? ...