homework

PHP: Display comma after each element except the last. Using 'for' statement and no 'implode/explode'

I have this simple for loop to echo an array: for ($i = 0; $i < count($director); $i++) { echo '<a href="person.php?id='.$director[$i]["id"].'">'.$director[$i]["name"].'</a>'; } The problem here is that when more than one element is in the array then I get everything echoed without any space between. I want to separate each element...

Counting duplicates (not necessarily removing) in an array in O(n)

Hello :) This is for an assignment, and is in psuedo-code. I need to find how many integers in an array are unique, nothing else, but it has to be in O(n), preferably without hashing. Thanks! ...

Object reference case study

When person 1 become partner with person 3, person 2 should no longer have person 1 as partner and person 4 should no longer have person 3 as partner. How should I solve this? public class Person { private String name; private Person partner; public Person(String name){ this.name = name; } public void setP...

Video Reconstruction

How does reconstruction using video compare to using standard reconstruction using still images? What similarities and differences are there. Finally what can and cannot be reconstructed using standard stereo methods? ...

Spinning a circle in J2ME using a Canvas.

Hello all! I have a problem where I need to make a multi-colored wheel spin using a Canvas in J2ME. What I need to do is have the user increase the speed of the spin or slow the spin of the wheel. I have it mostly worked out (I think) but can't think of a way for the wheel to spin without causing my cellphone to crash. Here is what I hav...

How can I make my counter look less fake?

I'm using this bit of code to display the number of users on a site. My customer is complaining it looks fake. Any suggestions? var visitors = 187584; var updateVisitors = function() { visitors++; var vs = visitors.toString(), i = Math.floor(vs.length / 3), l = ...

Help with simple frame, and graphics in Java

For hw, I'm trying to create a "CustomButton" that has a frame and in that frame, I draw two triangles, and a square over it. It's supposed to give the user the effect of a button press once it is depressed. So for starters, I am trying to set up the beginning graphics, drawing two triangles, and a square. The problem I have is althou...

Returning new object, overwrite the existing one in Java

Note: This is an assignment. Hi, Ok I have this method that will create a supposedly union of 2 sets. i mport java.io.*; class Set { public int numberOfElements; public String[] setElements; public int maxNumberOfElements; // constructor for our Set class public Set(int numberOfE, int setE, ...

insertion sort for pdp-11

I'm studying pdp-11 and assembly, I'm very interested, is it possible to find insertion sort on assembly for pdp-11, thanks in advance for everyone, if yes where? ...

term frequency calculation

hi..i m in a doubt... i need to calculate term frequency of term in a document... what i did is simply just " counted the no of times that term appears in that document"...if that term appeared say 138 times i took the tf value as 138....m i doing right..?? as i read somewhere that termfrequency (tf)= term count/ no of words in the docu...

remove repeated vaules _stack&array

I want to write a program to implement an array-based stack, which accept integer numbers entered by the user.the program will then identify any occurrences of a given value from user and remove the repeated values from the stack,(using Java programming language). I just need your help of writing (removing values method) e.g. input:6 2 ...

why do we have to send the const " type " reference instead of just the types name to the constructor

i m trying to make a simple program ( & yes , it is a homework ) that can generate Dates , & like most of normal people : i made my Class attributes private , i tried to send the same type that i m working on to the constructor but the complier have not accept it , i did some research & i found out that in cases like that people generou...

Where should I initialize variables for an OO Recursive Descent Parse Tree?

I'd like to preface this by stating that this is for a class, so please don't solve this for me. One of my labs for my cse class is creating an interpreter for a BNF that was provided. I understand most of the concepts, but I'm trying to build up my tree and I'm unsure where to initialize values. I've tried in both the constructor, and ...

Fibonacci in C works great with 1 - 18 but 19 does nothing at all...

Yeah right... we are forced to programm some good old C at our university... ;) So here's my problem: We got the assignment to program a little program that show a fibonacci sequence from 1 to n 1 to 18 works great. But from 19 the program does nothing at all and just exit as it's done. I can not find the error... so please give me a hi...

How to change Matlab program for solving equation with finite element method?

I don't know is this question more related to mathematics or programming and I'm absolute newbie in Matlab. Program FEM_50 applies the finite element method to Laplace's equation -Uxx(x, y) - Uyy(x, y) = F(x, y) in Omega. How to change it to apply FEM to equation -Uxx(x, y) - Uyy(x, y) + U(x, y) = F(x, y)? At this page: http://sc.fsu.edu...

How can I plot image data in Perl on Windows?

I would like to plot some image binary data on a grayscale matrix-like graph with custom values on axes. I'm using Perl on a Windows machine but I can't fine the right module to do this. I'm already using GD::Graph to plot other type of data but it seems unsuitable for this specific task. ...

What are the most difficult aspects of project management in Software Engineering?

I have been asked to provide a brief summary of the what the most difficult aspects of being a project manager of a software engineering project. However, I have no experience of this as I'm still at University and have no "hands on" experience of project management. I was hoping that someone on SO would be able to provide some insight...

Reading a variable messes it up?!?!

We have the following line of code: printf("%d\n", toc->runlist.next); printf("%d\n", toc->runlist.next); These are the definitions: typedef struct thread_overview_control{ int id[NR_UTHREADS]; list_t runlist; int active_counter; int main_thread; int need_resched; } thread_overview_control; thread_overview_cont...

How to have variables with dynamic data types in Java?

Hi, I need to have a UserProfile class that it's just that, a user profile. This user profile has some vital user data of course, but it also needs to have lists of messages sent from the user friends. I need to save these messages in LinkedList, ArrayList, HashMap and TreeMap. But only one at a time and not duplicate the message for e...

cache-coherence MOESI protocol

processor A owns a cache line which is shared with processor B. what happens when B tries to write to that line? also, if it was 'invalid' instead of 'shared' would it make any difference? thank you. ...