homework

How to split long lines of code in c++?

I need to make sure none of the lines in my code exceeds a a certain length. Normally I separate lines where there's a comma or another suitable break. How can I separate this line into 2? cout<<"Error:This is a really long error message that exceeds the maximum permitted length.\n"; If I just press enter somewhere in the middle it ...

Understand Command Pattern in Swing

Hi I can see how Swing uses Decorator and Observer pattern. Observer: Every component(fx JButton) is a subject which can add observers(ActionListeners). When someone pushes a button it notifies all its ActionListeners by calling their actionPerformed(ActionEvent e). But how about Command Pattern? When I am making classes that implemen...

you have four numbers, how do you figure out which one is greatest?

title says it all! is there a very simple algorithm to figure out which of 4 numbers is the greatest? ...

Problem with a select SPARQL query on dbpedia

Hello, I try to get some data about a city using Sparql query on DBpedia. The problem is I can't get the query to work. Currently I do something like this: SELECT ?title,?name,?abs WHERE { ?title skos:subject <http://dbpedia.org/resource/Category:Cities%2C_towns_and_villages_in_Slovenia&gt;. ?title dbpprop:officialName ?name....

Polygon triangulation

Hey, I am working on nesting of sheet metal parts and am implementing Minkowski Sums to find No Fit Polygons for nesting. The problem is I can give only convex sets as input to the code which calculates Minkowski sums for me. Hence I need to break a concave polygon, with holes into Convex sets. I am open to triangulation also, but I am ...

MS doc SVN

hi there I;m student in CS and for this summer(with 3 of my colleagues) we have to do a SVN for MS .doc files. Do you have any idea if this kind of thing has already made before. Is an open source project already available for that? If you were in our situation, how did you start your research? btw: we have to use PHP for this projec...

Python: splitting an integer into digits

I'm writing a program which calculates the check digit of an ISBN number. I have to read the user's input (nine digits of an ISBN) into an integer variable, and then multiply the last digit by 2, the second last digit by 3 and so on. How can I "split" the integer into its constituent digits to do this? As this is a basic exercise I am no...

How many classes and packages do we have in java 6?

I would like to know the number of built in classes and packages that are available with Java 6. Please provide me the url from where this information is available. Thanks ...

Assembly 8086: Converting 8-bit binary number to its Gray number equivalent?

Problem: Write a program to convert an 8-bit binary number entered from the keyboard to the equivalent Gray code binary number, using the following the algorithm: Question: As I'm learning assembly (8086, required by class), I'm not sure how to do this? Do I convert each character (1 or 0) as I receive it from the keyboard? Or, d...

How to make Jpanel expand to the size of the JFrame?

The below code is from the book objects First With Java By Michale Kolling and David J Barnes and the following is an exercise (ex 5.49) from the book.The ex is : Improve your drawFrame method to adapt automatically to the current canvas's size.To do this you need to find out how to make use of an objectof class Dimension. In the follow...

C/C++ Identify the digits in a given number.

Hello everyone, i'm new to programming.. and i'm stuck at a problem.. I want my program to identify the separate digits in a given number, like if i input 4692, it should identify the digits and print 4 6 9 2. And yeah, without using arrays.. Thanks in advance! ...

Returning STL lists as argument

I have a function that reads lines from a log file, converts these lines to a certain class and returns a STL list of instances of this class. My question is: how should I declare this function so that the whole list is NOT copied when attributing it to the caller? Without loss of generality, assume: list<Request> requests = log_manipu...

Pseudocode check. Complete Coding Noob needs validation for assignment

I have already turned this in so you won't be helping me cheat. Just wondering if this looks right: The assignment: Input a list of employee names and salaries, and determine the mean (average) salary as well as the number of salaries above and below the mean. The Plan: Allow input of names and salaries Calculate Mean Sort values Count...

I'm new at python, building a high low game. I need some help!

Make the computer guess a number that the user chooses between 1 and 1000 in no more than 10 guesses.This assignment uses an algorithm called a binary search. After each guess, the algorithm cuts the number of possible answers to search in half. Pseudocode for the complete program is given below; your task is to turn it into a working py...

Servlet to act like a client

I need to write a simple servlet which will be the client, and it should be sending some simple strings to server written in java. However I have a problem and I don't know how to solve it. I was trying to put the code in servlet methods but it ain't working. Here is the code which works great in my standard (non servlet) java client: ht...

binary tree

If I have two binary trees, how would I check if the elements in all the nodes are equal. Any ideas on how to solve this problem? ...

big int compiler implementations?

i am building a compiler similar to c , but i want it to parse integers bigger than 2^32 . hows it possible?how has been big integers been implemented in python and ruby like languages ..!! ...

C++ allocation, construction and destruction questions

Q1. What happens first- memory allocation or constructor call for the below written statement ? int *ptr = new int(); Q2. What is the difference between following three approaches? If an object is destroyed with DELETE operator. Will destructor be called? If a destructor is called explicitly (e.g. a1.~A()) to destroy the object? Nei...

how can i list every path in a directed graph? (C#)

please just point me in the right direction or tell me what to look up to solve this: I have a "tree" object that holds "node" objects. (actually it's called a directed graph). Each node holds the fields string "name" and "list" that contains the next nodes. How can I create lists of all possible node names from the head node to the fo...

STL string comparison functor

Hi all! I have the following functor: class ComparatorClass { public: bool operator () (SimulatedDiskFile * file_1, SimulatedDiskFile * file_2) { string file_1_name = file_1->getFileName(); string file_2_name = file_2->getFileName(); cout << file_1_name << " and " << file_2_name << ": "; if (file_1_name <...