homework

Solution for this SQL query?

Suppose you have these tables: Table Name: Salesman Fields: S_ID(Primary Key), Name Table Name: Region_1 Fields: Reg_ID(Primary Key), S_ID(Foreign Key), sales Table Name: Region_2 Fields: Reg_ID(Primary Key), S_ID(Foreign Key), sales Table Name: Region_3 Fields: Reg_ID(Primary Key), S_ID(Foreign Key), sales Table Name: Region_4 Fie...

find all combinations of elements for the given number N (sum upto N)

int array [] = {1,2,3,4,5,6,7,8,9} N = 10 1,2,3,4 = 10 2,3,5 = 10 3,7 = 10 1,4,5 = 10 1,3,6 = 10 8,2 = 10 9,1 = 10 4,6 = 10 5,2,3 = 10 ... the function should return all combinations, the array may be unsorted ...

Pointers in C with binary file

Hi All, I am reading the contents of the file using fread into an char array. But I am not sure why it is not getting printed in the output. Here is the code: void getInfo(FILE* inputFile) { char chunk[4]; int liIndex; for (liIndex = 0 ; liIndex < 4 ; liIndex++) { fread(chunk, sizeof(char), 4, inputFile); } prin...

JCE provider implementation.

Hello, I need to write a java JCE provider. I have been looking in the net for several days and I could not find solution. Could you please give me some useful informaion. Regards, ...

Thread scheduling C

#include <pthread.h> #include <stdio.h> #include <stdlib.h> #define NUM_THREADS 4 #define TCOUNT 5 #define COUNT_LIMIT 13 int done = 0; int count = 0; int thread_ids[4] = {0,1,2,3}; int thread_runtime[4] = {0,5,4,1}; pthread_mutex_t count_mutex; pthread_cond_t count_threshold_cv; void *inc_count(void *t) { ...

How do you search a document for a string in c++?

Here's my code so far: #include<iostream> #include<string> #include<fstream> using namespace std; int main() { int count = 0; string fileName; string keyWord; string word; cout << "Please make sure the document is in the same file as the program, thank you!" << endl << "Please input document name: " ; ...

Making a Linked list using Generics

Hello. I am currently working hard at a long overdue assignment. I am supposed to make a linked list using generics. Or, I have an interface called Creature that the list is supposed to sort. But how? How can the list sort creatures when the interface cant have a Creature nextCreature pointer? I know of to make a linked list using norma...

Numbers in Assembly :(

Hi folks, I'm trying to do something which I figure would be rather easy, though I'm beign proven terribly wrong. I'm probably doign something really dumb. Before I explain, here's my code: .data mynum: .int 75 format: .string "Value: %d\n" .text .globl main main: movl $0, %eax # Add the number addl $mynum,...

What's the difference between the [OptionalField] and [NonSerialized]

I came across this question on transcender: What should you apply to a field if its value is not required during deserialization? Me = [NonSerialized], ANSWER = [OptionalField] My gut reaction was NonSerialised, I have no idea why but in the space of 5 seconds thats what I thought but to my surprise, Transcender says I am wrong. OK fa...

Still failing a function, not sure why...ideas on test cases to run?

I've been trying to get this Sudoku game working, and I am still failing some of the individual functions. All together the game works, but when I run it through an "autograder", some test cases fail.. Currently I am stuck on the following function, placeValue, failing. I do have the output that I get vs. what the correct one should be, ...

Is there a way to close a Unix socket for only reading or writing?

Is there a way to only close "one end" of a TCP socket to cleanly indicate one side of a connection is done writing to the connection? (Just like you do with a pipe in every Unix pipe tutorial ever.) Or should I use some in-band solution like a sentinel value or some such? ...

Java strings and substrings

hey folks, Can someone help me with this Java problem? I want to write a method that takes two strings as arguments and returns true if each character (including space and punctuation) that appears in one string also appears in the other. Thanks ...

MIPS (or SPIM): Loading floating point numbers...

Hey hey, I am working on a little mini compiler while trying to learn some MIPS here. Here's my issue: MIPS has an instruction li (load immediate) which would work like this li $5,100 which would load 100 into register 5. However, I need to load floats into registers right now and am struggling with figuring out a way to do it...s...

Rewrite probabilities as boolean algebra

I'm given three binary random variables: X, Y, and Z. I'm also given the following: P(Z | X) P(Z | Y) P(X) P(Y) I'm then supposed to determine whether or not it is possible to find P(Z | Y, X). I've tried rewriting the solution in the form of Bayes' Theorem and have gotten nowhere. Given that these are boolean random variables, is i...

Bash and regex problem : check for tokens entered into a Coke vending machine

Hi all: Here is a "challenge question" I've got from Linux system programming lecture. Any of the following strings will give you a Coke if you kick: L = { aaaa, aab, aba, baa, bb, aaaa"a", aaaa"b", aab"a", … ab"b"a, ba"b"a, ab"bbbbbb"a, ... } The letters shown in wrapped double quotes indicate coins that would have fallen through (...

Matlab: Analysis of signal

Hi, I have a problem with this task: For free route perform frequency analysis and give parametrs of each signal component: time of beginning and ending of each component beginning and ending frequency amplitude (in time domain) in the beginning and end of each signal's component level of noise in dB Assume, that, the parametrs of e...

Problem with C function of type char pointer, can someone explain?

Can someone help me find the errors in this C function? char* f(int i) { int i; char buffer[20]; switch ( i ) { 1: strcpy( buffer, "string1"); 2: strcpy( buffer, "string2"); 3: strcpy( buffer, "string3"); default: ...

Public class DiscoLight help

Hi All, If some one can point me in the right direction for this code for my assigment I would really appreciate it. I have pasted the whole code that I need to complete but I need help with the following method public void changeColour(Circle aCircle) which is meant to allow to change the colour of the circle randomly, if 0 comes the...

Placing and removing element on array trough object

Hello, Lets assume i have 2 methods 1 that places a element on the array and one that removes it. const int Max = 10; int[] table= new int[Max]; I would like to call it up like this: s1.Place(5); // 5 0 0 0 0 0 0 0 0 0 0 s1.Place(9); // 5 9 0 0 0 0 0 0 0 0 0 s1.Remove(9); // 5 0 0 0 0 0 0 0 0 0 0 I would only like to use...

Print all ways to sum n integers so that they total a given sum.

Im trying to come up with an algorithm that will print out all possible ways to sum N integers so that they total a given value. Example. Print all ways to sum 4 integers so that they sum up to be 5. Result should be something like: 5 0 0 0 4 1 0 0 3 2 0 0 3 1 1 0 2 3 0 0 2 2 1 0 2 1 2 0 2 1 1 1 1 4 0 0 1 3 1 0 1 2 2 0 1 2...