homework

why only my first x forks make the job (gcc)

before you ask... this is from my study guide. From my perspective this is almost done but I can't put it working in the way I want. the exercise is: given an string fork X times and print one character per child until the the string finish. this is the code and compiles: #include <stdio.h> #include <unistd.h> #include <stdlib.h> #inc...

Java Getter and Setter Method

What are getter methods and setter methods in Java? What is their technical term in Java? ...

printf executing .exe files in cygwin

so i had an assignment requiring me to 'break' a piece of vulnerable code. snippet: int main(int argc, char **argv) { /*...*/ while(i < argc-1) { switch(argv[i][0]-48) { case 1: SmashHeap(argc,argv); break; /*...*/ case 8: PrintfVulnerability(argv[++i]); break; default: printf("%s ...

AS3 Quiz - How do I move to the next question?

Hello, using various tutorials I created the next quiz in AS3. It's dynamic and I use an important function to set up the entire thing, and a counter to manage the quiz and arrays. After picking an answer you click on a check button and then on a "Next" button. I'm getting no errors, however for some reason calling the setup() function ...

Select max age C#

Greetings, I created a list that contains a collection of objects that have this properties: X, Y, Z I want to find out which object in the collection has the greatest Z I tried to use the Max() function but I don't understand how it's used... How can I accomplish this Thanks in advance ...

How to parallelize threads in C pthreads

I have N threads and they have to do job on shared data. I am using following structure: int main(){ pthread_create(..., func, ...); } void *func(void *id){ lock; do_job; unlock; } My problem is that threads seem to work sequentially. How to actually make them parallel? ...

Write a method to sort characters of two different strings and than sort an array of those strings ?

Hi, Basic idea is to sort the strings and compare signature of strings, where signature is the alphabetically sorted string. What would be the efficient algorithm to do so ? Thanks. ...

Lisp: Get Last Element of each list

Hi guys! help please..say i have a list ((3 4 5) (d e f) (h i j) (5 5 5 5)) ) how can i get the last element of each list in such a way that the output would look like this (5 f j 5). Thanks in advance! ...

Development of iPhone application in linux

I have to develop an iPhone application that is able to transfer real time data from a server to an iPhone. Some real time data examples are: cricket scores, stocks, etc. We have been told to develop our project in Linux using Objective C. As I'm completely new to this field, could anyone give me any ideas about how to start the pro...

Dynamic programming problems

I'm looking for some pointers about a dynamic programming problem. I cannot find any relevant information about how to solve this kind of problem. The only kind of problem I know how to solve using dynamic programming is when I have two sequences and create a matrix of those sequences. But I don't see how I can apply that to the followin...

Best way to create word stream in C#

I'd like to be able to write something like the following. Can someone show me how to write a clean WordReader class in C#. (a word is [a-zA-Z]+) public List<string> GetSpecialWords(string text) { string word; List<string> specialWords = new List<string>(); using (WordReader wr = new WordReader(text)) ...

Design an algorithm to find all pairs of integers within an array which sum to a specified value ?

Hi, Design an algorithm to find all pairs of integers within an array which sum to a specified value ? It was not an assignment question. I had tried this problem using Hash table to store entry for sum of array elements but it is not the efficient solution and so want to know what are thoughts of other stackoverflow readers on it. T...

Get first and last atom of a list and append them

Hi guys help please...Say i have this list '((c d) (4 6) (m n) (z z)) how can i group the first and last element of each inner list and append it at the end so that my output would be something like this. (c 4 m z z n 6 d) Any help will be greatly appreciated..Thanks in advance! ...

How to have a C program respond to a letter and spit out something else?

Hey guys, I can't seem to get this program to compile. I keep getting the error: 'Ammonia' undeclared 'Carbon_Monoxide' undeclared and so on. Am I using the right function with switch? /*This program will report the content of a compressed-gas cylinder based on the first letter of the cylinder's color.*/ #include <stdio.h> int mai...

Returning C string from a function

Hi, I am trying to return a C String from a function but its not working. Here is my code. char myFunction() { return "My String"; } and then in main i am calling it like this. int main() { printf("%s",myFunction()); } I have also tried some other ways on myFunction but they are not working. E.g; char myFunction() { ...

Converting binary to decimal JAVA

whats a way to convert a binary string to a decimal integer without using Integer.parseInt ?? ...

Unable to understand Trigger statement

Hi all, can anybody explain me the below code for trigger?Please note that the above code was written by one of my class mate and I cannot understand anything in it. I am not able to understand it. Also if there is any other way to accomplish the same task then please let me know. CREATE trigger [dbo].[trg_InsertInBookIssuedDetails] ...

Recursive Palindrome Test with java

I have the following homework assignment: I need to create a program that recursively tests in a word or phrase is a palindrome. Here is the prompt: A palindrome is "a word, line, verse, number, sentence, etc., reading the same backward as forward, as Madam, I'm Adam or Poor Dan is in a droop." (dictionary.com) When evaluating palin...

Translate vector by matrix

I have a 4*4 matrix and a 3d vector. I need to translate my vector by the matrix. Not too much crazy maths notation please because i dont understand it. An example in something close to java would be fab! Thanks ...

multithreading with java swing for a simple 2d animation

hello , my final goal for this application is to animate several items in the same JPanel at a different speed using a thread for each item.the first part is done however the items move at the same speed and i have no idea on how to fix this problem. package javagamestutos; import java.awt.Color; import java.awt.Graphics; import java...