Forum: C++ Apr 29th, 2009 |
| Replies: 3 Views: 696 I think it would be more useful if one could pass the string into a method and have it return the number of question-marks found (as an unsigned int, or in extraordinary cases an unsigned long int). |
Forum: C++ Nov 22nd, 2008 |
| Replies: 3 Views: 462 There is hope!
Use fmod to resolve the modulus between two doubles
#include <iostream>
using std::cin;
using std::cout; |
Forum: Java Nov 22nd, 2008 |
| Replies: 7 Views: 968 Unfortunately, the implementation of ArrayList<T> looks [something] like this--
//... necessary imports
public class ArrayList<T> extends List<T> implements Collection<T>, Serializable{
... |
Forum: C++ Nov 20th, 2008 |
| Replies: 2 Views: 314 That means you are literally treating something that isn't an lValue as an lValue.
For example if a method doesn't return a reference to something, its possible that attempting to treat the method... |
Forum: Java Nov 12th, 2008 |
| Replies: 8 Views: 808 Chances are likely that your Instructor wishes for both your getArms and getLegs methods to return an array of Limbs--
Arm[] getArms(){
return arms;
} |
Forum: Geeks' Lounge Nov 11th, 2008 |
| Replies: 40 Views: 4,584 Since Christmas is coming up, I suppose I'll revive this thread =)
And Christmas is nice! I always get what I want...
...a day off =P
-Alex |
Forum: Java Nov 3rd, 2008 |
| Replies: 10 Views: 5,247 Solves simple string-based expressions.
Currently only supports integers, but can easily be expanded to support float-types. |
Forum: Java Nov 1st, 2008 |
| Replies: 19 Views: 1,281 This should be an easy project, until you have to create a command for executing an applet instead of a standalone application.
Also executing packaged-classes might be a bit tricky.
It will... |
Forum: C++ Oct 22nd, 2008 |
| Replies: 7 Views: 519 That's one way of doing it, but you could also use eager-inclusion.
// file.h
#ifndef MYHEADER_H
#define MYHEADER_H
/*Declaractions*/
#include "file.cpp" |
Forum: Java Oct 22nd, 2008 |
| Replies: 12 Views: 1,797 It may be possible that Java won't support an image-type in future releases and therefore not provide Serialization support for it but that depends on what it is.
I remember getting warning... |
Forum: Geeks' Lounge Oct 22nd, 2008 |
| Replies: 23 Views: 1,640 Programming is my passion =)
I want to die typing at the keyboard trying to solve problems and improve my ability of insight =)
I want my life to be absorbed by programming, because I used to... |
Forum: Java Oct 16th, 2008 |
| Replies: 8 Views: 647 It might do you some good to learn RMI from the book Head First Java or get a brief overview by reading Head First Design Patterns. Both books are good and provide more information about programming... |
Forum: Java Oct 14th, 2008 |
| Replies: 3 Views: 3,767 This managed to work for me--
import java.util.*;
public class TestClass1{
static String seatLayout = null;
static String fn = null;
public static void main(String... args){ |
Forum: Java Oct 14th, 2008 |
| Replies: 11 Views: 1,385 You could use a State Machine, or State Pattern based on how many times an object has been encountered, or the State of an object can depend on the type of object it encounters...
It may simplify... |
Forum: IT Professionals' Lounge Oct 13th, 2008 |
| Replies: 7 Views: 1,311 Yes, another person who is entertained, and not aggravated, by programming! =)
Always keep that perspective, no matter how hard it is to learn something! You'll find programming very fulfilling! =) |
Forum: Java Oct 2nd, 2008 |
| Replies: 0 Views: 447 I typically don't post anything unless I have a question or comment... but I am still trying to understand Serialization for Network-Applications and I ran into a brick wall (repeatedly) during a... |
Forum: Java Sep 24th, 2008 |
| Replies: 4 Views: 506 I marked the Thread daemon as a good practice. Unfortunately it makes the example hard to see, the way the code is currently written. Consider this example instead--
import javax.swing.*;
... |
Forum: Java Sep 24th, 2008 |
| Replies: 1 Views: 3,688 There are a number of issues with the above code.
First of all, when declaring a variable (like menu), you should initialize it on the spot... even if it is a null initialization.
Secondly, you... |
Forum: Java Sep 22nd, 2008 |
| Replies: 5 Views: 596 Remive the semi-colon by your while-statement and you should be in business =) |
Forum: C++ Sep 16th, 2008 |
| Replies: 17 Views: 1,543 Split the lines up into words and place the words for a corresponding line into a vector.
For example, vector<string> a has elements "I", "believe", "in", "you" and vector<string> b has elements... |
Forum: C++ Sep 16th, 2008 |
| Replies: 17 Views: 1,543 Oddly enough I was working away at a tokenizer. I think that my snippet (http://www.daniweb.com/code/snippet954.html) might be helpful, but maybe not if this is an assignment.
If it is an... |
Forum: Java Sep 16th, 2008 |
| Replies: 10 Views: 1,014 Here's yet another example, though probably overkill--
import java.util.concurrent.*;
import java.net.*;
public class ConcurrentExample{
public final ExecutorService es;
private Future... |
Forum: Java Sep 7th, 2008 |
| Replies: 1 Views: 406 There needs to be some kind of simple commonality between classes.
An interface allows for many benefits via the implementation of the Object Model and how objects communicate with each other,... |
Forum: C++ Aug 31st, 2008 |
| Replies: 12 Views: 1,753 I'm not exactly sure how your professor wants this done, but...
Personally what I'd do is make a topic for each game of Boggle and implement a dictionary of words then map out specific words to a... |
Forum: Geeks' Lounge Aug 30th, 2008 |
| Replies: 55 Views: 4,853 Here's an idea...
Instead of buying Vista, wait until 2011 for Windows 7 (http://en.wikipedia.org/wiki/Windows_7)
I'd rather wait 3-5 years for a new OS than invest in one that will become... |
Forum: Java Aug 27th, 2008 |
| Replies: 4 Views: 1,013 An interface is a static context template that classes can implement. The methods within the interface have no body and must be of public access.
In addition, interfaces can also contain... |
Forum: C++ Aug 25th, 2008 |
| Replies: 9 Views: 711 You know, I tried to make up for my dumb response earlier by developing a meta-program for this algorithm to see if it would speed it up some.
I spent the last 2.5 hours doing tests on the std... |
Forum: Java Aug 25th, 2008 |
| Replies: 11 Views: 950 This worked for me--
import javax.sound.sampled.*;
public class test_sound {
private class MyThread extends Thread{
int seconds = 1, sampleRate = 8000; |
Forum: Java Aug 24th, 2008 |
| Replies: 6 Views: 646 Why not store the current time in a data type (like a long) when the key is pressed and when the key is released subtract the new time from the old time?
Here's an example--
public class... |
Forum: Java Aug 22nd, 2008 |
| Replies: 8 Views: 1,692 I suppose you're using a GCanvas, or most likely the GraphicsProgram from the acm.program package?
You could have GCanvases pre-painted with components and when you advance a level, simply set the... |
Forum: IT Professionals' Lounge Aug 22nd, 2008 |
| Replies: 9 Views: 1,334 It still amazes me that you've become as good as you are at such a young age =)
It'll be awhile before I can catch up to you in C++ and Assembly. Until then, I must study more! XP
Edit:... |
Forum: C++ Aug 22nd, 2008 |
| Replies: 8 Views: 2,016 Ok one big thing to note, before anything else--
vector<vector<double>>
-- is not a portable statement because >> may (depending on the compiler) be analyzed as the right bitshifting... |
Forum: Java Aug 20th, 2008 |
| Replies: 3 Views: 480 I can already see you using the Bridge and/or Strategy pattern from the specs.
You'll also most likely end up using the Observer pattern.
Try not to be distracted by the specs too much. Break... |
Forum: IT Professionals' Lounge Aug 17th, 2008 |
| Replies: 12 Views: 2,169 I like williamhelmswort's mouse-hook snippet. It always makes random amusement when I use it on somebody elses computer and watch them struggle to move the mouse XD |
Forum: C++ Aug 14th, 2008 |
| Replies: 4 Views: 549 Show us what you've come up with on your own.
We help you, we don't code for you @_@ |
Forum: Java Aug 1st, 2008 |
| Replies: 9 Views: 1,913 This is the error I'm getting when trying to load this using FireFox (after 3 attempts)
Java Plug-in 1.6.0_07
Using JRE version 1.6.0_07 Java HotSpot(TM) Client VM
User home directory =... |
Forum: Java Jul 31st, 2008 |
| Replies: 11 Views: 950 First and foremost I'd like to say that I'm damn impressed!
If I remember correctly, using switch/case statements yields much faster selection than if-else statements.
I don't think that's the... |
Forum: Java Jul 28th, 2008 |
| Replies: 40 Views: 3,545 There are a few ways we can do this.
In my opinion, the best way to do this is create a class that accepts these kind of values and stores them in appropriate data types (the types listed in each... |
Forum: Java Jul 25th, 2008 |
| Replies: 4 Views: 2,723 I found some links that rendered Images to .gifs, which seemed useless at first but then I looked into the Image class and all of the "helper" classes for its methods.
I think I'll try to look... |
Forum: Java Jul 24th, 2008 |
| Replies: 8 Views: 969 Here's a Generic extension of your max-value finder where anything that implements Comparable can be compared--
public class Manip{
public static void main(String... args){
... |