homework

More optimized solution, find number of substrings in a string. Using C.

Hi All, So, I have a task to find number of substrings in given string. I can't use any C libraries for doing this task. stringExist can only have 2 strings as a parameters. My solution is working, but I have a feeling that there should be a more elegant way to do this task. Solution 1: as it turns out, it doesn't work correctly #incl...

Looping distance between two points, and q for quit

This is my situation: i need the code to run in a loop, over and over again asking the same question(s) to the user, until the user types a "q" for any point to terminate/exit the loop, thus exiting the program. The problem is that i tried to used a do-while/while loop, and those loops executes only if the conditions comes out to be t...

Java, multiple threads with only one executing at a time

I am working on an assignment and have to create two classes, one represents a person, and the other representing a bridge. Only one person can be "crossing" the bridge at any one time, but there could be people waiting to cross I easily implemented this with multi-threading allowing for multiple people to cross at once, but I am having...

Filling 4 variable in a struct type and using malloc

I need to write a simple program that ask the user to insert 4 double type variable in a struct variable data. struct Data { double a; double b; double c; double average; }; struct Data *ptr_name; int i; First, ask user the size: printf("Please enter the size:"); scanf("%d", &size); Then, use ...

How to write header files for Devices

I am new to Embedded Programming, taking courses on it. And working with ATSTK600. I am looking for some help on "how to write header files for Devices". Well, to be specific, what are the standard to be followed while writing header files like naming a register, etc (how to create .h & include, that I know). Recently, I got an assignm...

Prolog loops and conditional statements?

Is there anything in Prolog that works like a for loop and if then condition? ...

I need this in my Biology class ... using MATLAB!

I'm trying to monitor the average temperature in a fabrication every hour to ensure quality control. How can I write a script that looks at the temperature inside the plant as a function of time, and outputs the times when the temperature drops below 10 degrees Celsius and when the temperature is above 80 degrees Celsius. My script sho...

rotating the tires in a car (open gl)

Based on the answer i got for the same question earlier, i changed my code, as per the homework i had to use glmultmatrix. But this is not working. Here is the code, what i am doing is that i translate the center of tire to the center of car, rotate the tire, and then translate back. But it is not placing back the tire where it should be...

Linux' Application

Application of Linux...? ...

C++ program crashes

I've this assignment to implement strcmp function. Sometimes it runs okay but other times it crashes. Please help me. #include <iostream> using namespace std; int mystrcmp(const char *s1, const char *s2); int main() { cout<<mystrcmp("A","A")<<endl; cout<<mystrcmp("B","A")<<endl; cout<<mystrcmp("A","B")<<endl; cout...

Accessing a class after removing from a queue

----What I'm doing---- So I have an assignment that takes an input of characters then calculates the capital gain for the string using a queue. I'm stripping the input data then putting it into an arraylist that I then queue. I'm suppose to then dequeue the data to calculate the the capital gain. ----The problem---- The problem I'm ha...

Binding the combobox in C# desktop application

Hi there, I am working on a project for my college where I need to bind data from database into the combobox. I need to store the roll no / enrollment no in the "value" field of combobox and name of the student in the "text" property of the combobox. How can I do that?>??? Please reply ASAP.... ...

does these code has memory leakage??

static private ArrayList seriesColors = new ArrayList(); public Audiogram(int widthParm, int heightParm) throws Exception { super(widthParm, heightParm); seriesColors.add(new Color( 0, 0, 255)); // Set the default settings to an industrial audiogram setType(INDUSTRIAL_AUDI...

Database Normailization

Convert tables into 1st, 2nd, and 3rd normal form CustomerID(FirstName,LastName,BillingAddress,PhoneNumber,EmailAddress) ...

Mootools .get('text') not working as expected

Update: This works in firefox, but does not work on chrome 6, still investigating. I'm taking an internet programming class and learning various javascript frameworks. I'm working on a mootools problem, and the .get('text') method does not appear to be working as expected on responseXML. Here's the responseXML: <?xml version="1.0" en...

How to derive desired sequence from a string using standard java api?

I need to get parts of a string in a particular format. Tried everything from split, substring to pattern and matcher. but everytime it fails with one of the requirements. Suppose str = (((abc) shdj (def) iueexs (ghi)) mkek ONE(tree23) bjm (twooo(bug OR bag)) mvnj THR-EE(<*>$##)) And terms wanted are : "Hard Coded Term1":abc "Hard C...

Help with images and arrays

I have an assignment for school call Poker game. I have to deal a random card of five using HTML. I also need to have an array to deal the cards. My main question is can you have images in an array and if so how can it be done? I tried this method: $my_array = array(img src="2Spade.gif", img src="2Club.gif") but this is incorrect! Ca...

How can I get my Perl regex not to use special characters from an interpolated variable?

Possible Duplicate: How can I escape meta-characters when I interpolate a variable in Perl's match operator? I am using the following regex to search for a string $word in the bigger string $referenceLine as follows : $wordRefMatchCount =()= $referenceLine =~ /(?=\b$word\b)/g The problem happens when my $word substring cont...

Array of strings overwriting each other?

I am making a function that turns a list of words into an array to be used by other functions, but somehow I'm overwriting previous words. I check the memory address' and they seem different, but when I recheck once I'm done importing the words, they are all the same. static char **array; //takes the name of a data file and reads it in...

I have a nested list in which I need to compare values...

I have a list of lists composed of tuples representing blocks of military times: [[(1405, 1525)],[(1405,1455),(1605,1655)],[(1505,1555),(1405,1455),(1305,1355)]] I have a function to compare the times of two tuples: def doesOverlap(tuple1, tuple2): #tuples each represent times for courses #the 0 index for each tuple is a start...