Posts
 
Reputation
Joined
Last Seen
Ranked #303
Strength to Increase Rep
+8
Strength to Decrease Rep
-2
100% Quality Score
Upvotes Received
26
Posts with Upvotes
20
Upvoting Members
19
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
11 Commented Posts
~55.4K People Reached
About Me

PhD student in Computer Science Education

Favorite Tags
c x 38
java x 14
c++ x 10

75 Posted Topics

Member Avatar for jozz3

The intent of C++ code is very simple, even though it doesn't compile. It simply takes the sum of the values in an array. When you understand the purpose of a program, it's much easier to port it, since you aren't blindly translating code. You really don't seem to show …

Member Avatar for Smartfitness33
0
8K
Member Avatar for mrgadgets

If you want to develop a game completely using C, the [Allegro library](http://alleg.sourceforge.net/) is a pretty comfortable choice. Other folks use engines like [SDL](http://www.libsdl.org/) and [OpenGL](http://www.opengl.org/) to power games. I find Allegro to be easier to get started with, since it's much easier to go from nothing to a graphical …

Member Avatar for DeanMSands3
0
166
Member Avatar for jbennet

Hi! I love the new site - very nice-looking. I got an issue when I tried to update my avatar - just look to the left and see. :P I'm on firefox 10.0.2 on Ubuntu LTS 10.04 with noscript disabled. I tried uploading pngs and jpgs between 50x50 and 100x100 …

Member Avatar for Airshow
0
2K
Member Avatar for IsharaComix

I've been unable to connect to the Daniweb IRC server for the past few days. Is it temporarily down? My life just doesn't feel complete unless I'm idling in there and not doing anything. :|

Member Avatar for blud
0
78
Member Avatar for caut_baia

This is an initiative I can definitely get behind. I've been idling there for over a year now, but things seem to have been picking up recently. Maybe there's hope after all. ;) /me changes his signature.

Member Avatar for royng
3
236
Member Avatar for IsharaComix

Recently, whenever I try to visit any user's profile here on DaniWeb, I get an ugly and intrusive browser dialog trying to push Flash on me. It's more than intrusive... it's very weirdly-worded. [quote] You need Adobe Flash Player 8 (or above) to view the charts. It is a free …

Member Avatar for WaltP
0
277
Member Avatar for rickster11

Your recursive method has no base cases. Even if they did, your entire program is written in tail recursion, so whenever you return to a previous point in the stack, you don't have any control there because the only time you make the recursive call is in a return statement. …

Member Avatar for pali185
0
956
Member Avatar for Dani

You know, since day one, I've tried to avoid looking at the reputation system as if it were some kind of a video game. It seems to be in bad taste and undermines the point of being part of the community. ... but this feature makes that [B][I]really[/I][/B] hard. I …

Member Avatar for peter_budo
3
675
Member Avatar for dspjm

On my system, this opens the 'nano' editor. To close out of nano, press 'Ctrl-x'. If you changed your command, then hit 'y' and Enter to save the changes. Once you exit, the command will run.

Member Avatar for dspjm
0
102
Member Avatar for jon.kiparsky

Out of your choices, I'd pick Nethack, but I've always been quite partial to [url=http://roguebasin.roguelikedevelopment.org/index.php?title=Dungeon_Crawl_Stone_Soup]Crawl[/url].

Member Avatar for Blazing Master
0
85
Member Avatar for coil

What version of Ubuntu are you using? If you're using a version that has 4.3 in the repositories, you will have a very hard time trying to upgrade it to 4.5. It might be easier to install a new version of Ubuntu than it is to upgrade the compiler.

Member Avatar for IsharaComix
0
156
Member Avatar for jaku78

So it looks like you're going out of the bounds of the array. Try to find out what the values of k and l are when the code fails. You could use the debugger, or just put a [icode]printf("%d %d\n,k,l);[/icode] before the if-statement and trace what the values are while …

Member Avatar for mitrmkar
0
147
Member Avatar for d00mhammers

OK, your function definitions are causing some errors for me. Whenever you are simply writing a function prototype, you use a semicolon. But when you are defining a function, you don't. [code] my_prototype( int a, char b ); my_function( int a ) { } [/code] After I did that, the …

Member Avatar for arnab sinha
0
319
Member Avatar for IsharaComix

Not sure where bug reports should go, so I'm posting mine in feedback. This morning when I logged in to DaniWeb, instead of getting the redirect page, I somehow obtained a 'login.php' file for the page instead. Opening the file in emacs, it contained (in this order): - A bunch …

Member Avatar for Dani
0
145
Member Avatar for florisvd

It looks like you have some code that's sitting outside of functions. For example, the switch statement that's between lines 17-30 is not contained within a function. You can't have code just sitting around like that. You've also got a function inside of another function... i2c_readbyte is inside of i2c_writebyte. …

Member Avatar for florisvd
0
2K
Member Avatar for kirennian

I remember having the same problem back when I was goofing off with OpenGL. I'm not sure how much it will help you, but I'll contribute this anyway. I wrote a brute-force method that allows me to rotate along any object's local axis, and then I can use that as …

Member Avatar for dineshguru
0
1K
Member Avatar for alc6379

Happens to me every once in a while in Firefox on Ubuntu 9.04. Sometimes it goes away and sometimes it doesn't. It doesn't mess with my typing, though. Just thought I'd throw that out there.

Member Avatar for Dani
0
187
Member Avatar for turbomen

The path to the shell that is currently running in a terminal can be found in the 'SHELL' environment variable. You can run 'echo $SHELL', which, on my machine, prints out '/bin/bash'. Is this what you're looking for?

Member Avatar for IsharaComix
0
265
Member Avatar for Castiel1631

I'm assuming that 'student_file' is an array of strings? Do these changes help at all? [icode]11. sprintf(student_file[k], student_file, "%s %s %c", last, first, middle);[/icode] [icode]16. printf("%s\n", student_file[i]);[/icode] If they don't help, can you post your declaration of 'student_file'?

Member Avatar for IsharaComix
0
140
Member Avatar for Danny_501

My knowledge of signals is rusty, but here goes nothing... I think that after a handler is executed (in this cause, 'handleSIGCHLD'), the handle is released, and the function is no longer associated with the signal. Therefore, from inside the handler, you need to call the 'signal' function at the …

Member Avatar for Danny_501
0
114
Member Avatar for mrblippy

Here's a simple pseudocode solution. [code] boolean[10] array /* Array of all false values */ int count = 5 /* Number of true values we want */ while count > 0: int k = Math.random()*10 /* Random integer from 0 to 9, inclusive */ if array[k] == false: array[k] = …

Member Avatar for mrblippy
0
1K
Member Avatar for karthiken07

Double variables just don't have that much precision. If you need numbers that are that fine-tuned, you need to look for an "arbitrary/multiple precision" library - something like GMP [url]http://gmplib.org/[/url] Hope this helps.

Member Avatar for N1GHTS
0
168
Member Avatar for novice20

It's not really Python-specific, but I would use the 'tee' command here. On *nix, the invocation of the script would be [code] python myscript.py | tee out.txt [/code] I'm sure Windows has a similar command as well. Hope this helps.

Member Avatar for novice20
0
161
Member Avatar for gunjannigam

I changed your function in the following way: [CODE] public String parsePath(String path) { String parsedString=""; String[] arr = path.split("\\\\"); System.out.println(arr.length); for(int i=0;i<arr.length-1;i++) parsedString+=arr[i]+"/"; return parsedString; } [/CODE] The first change I made was to path.split. You will probably think that this looks pretty ridiculous. This function takes a regular …

Member Avatar for JamesCherrill
0
185
Member Avatar for gunneronaspooky

Your function 'slope' should return the value of 'm' when it finishes. [code] def slope(x1, y1, x2, y2): a = (float(y2 - y1)) b = (float(x2 - x1)) m = float(a / b) return m [/code]

Member Avatar for IsharaComix
0
171
Member Avatar for stranger_on_way

What platform are you compiling this on? Some compilers have built-in stack-smashing protection that would prevent this code from working as expected. If you're using GCC, for example, try the following command: [icode]gcc -fno-stack-protector programcode.c[/icode]

Member Avatar for IsharaComix
0
77
Member Avatar for SWEngineer

[icode]A*B[/icode] means 'A times B' [icode]A**B[/icode] means 'A to the power of B' Hope that helps you out.

Member Avatar for SWEngineer
0
77
Member Avatar for Danny_501

You're getting a timeval structure back. You need to do a little formatting before you can use it. Here are some highlights from the man page... [url]http://linux.die.net/man/3/localtime[/url] [LIST] [*] tm_year is the number of years since 1900... so add 1900 to your tm_year result. [*] tm_mon is the month where …

Member Avatar for IsharaComix
0
145
Member Avatar for insanely_sane

A Python for-loop is pretty much like Java's for-each loop, where instead of going through the loop with an incrementing value each time, you go over a list of values, instead. Here's a simple example. [code] classes = ["English","Math","History","Physics"] for s in classes: print s [/code] If you prefer the …

Member Avatar for insanely_sane
0
210
Member Avatar for revsin

[CODE] file.write ( "%-10s%6d" % (item[0], item[1]) ) ^ ^ [/CODE] Worked fine for me after I put these parentheses in.

Member Avatar for revsin
0
104
Member Avatar for Ricky65

First of all, 'main' returns 'int'. Always. Secondly, when encrypting a file, you should open both the input and the output as binary files. [icode] FILE* input = fopen(input_file, "rb"); [/icode] Reading them as ASCII files is problematic, since the program is translating Windows newlines to special characters, which shouldn't …

Member Avatar for Ricky65
0
353
Member Avatar for ftl25

You were on the right track using strcmp in your second example. But you said that it wasn't returning true. Strcmp returns '0' when two strings are equal (which equates to false). It's a classic gotcha. So your second example should read: [CODE] if (strcmp(sCmdInt[0], "ReadMemory32") == 0) { // …

Member Avatar for ftl25
0
149
Member Avatar for skiabox

Short answer: Because you're leaving the elements in the array uninitialized. Long answer: Consider the following code snippet. [code] int foo[10]; int main( void ) { static int bar[10]; int gus[10]; int i; for ( i = 0; i < 10; i++ ) { printf( "%d %d %d\n", foo[i], bar[i], …

Member Avatar for newbie_learner
0
95
Member Avatar for nwhitfield

The most important step (in my opinion, of course) is to create a well-defined protocol for Client->Server communication and STICK TO IT. Sanitize all data that comes in from the client, since there are no guarantees that the player is using an 'official' client. Make sure that whatever data structure …

Member Avatar for IsharaComix
1
93
Member Avatar for DayneD89

Are you saying that you want to store all of the values in the list as individual variables? If that's the case, why is your program designed in such a way that you would need that sort of functionality? Variables are abstractions that only make any sense in the context …

Member Avatar for vegaseat
0
156
Member Avatar for InsaneOstrich

Sorry for pointing out the obvious, but according to the dump, the code is failing at one of your calls to setSelectedFile(). It seems like either file1 or file2 are null. Are you sure images 1.png and 2.png always exist in a folder called "test images" on your desktop?

Member Avatar for InsaneOstrich
0
555
Member Avatar for wrongo

Have you tried using a Map? It might be overkill for your problem, but this fits your query pretty well, and is scalable to larger cases. This will allow you to pass in a string to fetch a named object, and also stores them in a nice space too. [code] …

Member Avatar for IsharaComix
0
95
Member Avatar for rlhh

The loop [icode]for( i = 1; i == 3; i++ )[/icode] never does anything. That loop says, in English, "Start i at 1. As long as i is equal to 3, do the loop and increment i." i doesn't start out equal to three. You need the condition to be …

Member Avatar for abhimanipal
0
138
Member Avatar for sunlitdays

When you use [icode]cin >>[/icode] to save a string, it only gets the first word up to the whitespace. You need to wrap everything between lines 8 and 17 in another loop that performs the collection from standard input until you run out of characters.

Member Avatar for chiwawa10
0
240
Member Avatar for miskeen

First of all, when dealing with variables that are larger than one byte, the endianness of the machine might cause portability problems. I'm going to assume you're on an x86 little-endian machine for now. To get a specific number of bits from a variable, you first need to create a …

Member Avatar for miskeen
0
109
Member Avatar for gorbulas

You aren't showing your complete class. It looks like you may have accidentally made something global that should have been local to your auction list. Here's how I would create a class based on your specs. Does your code look something like this? [code] class AuctionList(object): def __init__(self): self.mylist = …

Member Avatar for gorbulas
0
4K
Member Avatar for Kruptein

In lines 151-154, I see you're only blitting the background over top of the paddles and the ball - not over the score. Add this before line 151: [CODE] screen.blit(background, text.get_rect().move(320,10)) [/CODE] While it's more efficient only to blit over things that are live and in play, sometimes it's worth …

Member Avatar for IsharaComix
0
284
Member Avatar for doom5

EDIT: Oops... Aia beat me while I was typing. Here's my post anyhow. Strings in C are arrays of characters, but the thing that makes it a 'string' is the fact that it ends in a null byte. [CODE] "Hello" = ['H','e','l','l','o','\0'] [/CODE] Your reversal method starts by swapping mike[0] …

Member Avatar for girishn
1
143
Member Avatar for lionaneesh

[QUOTE=jephthah;1175070] [code]#define SQR(x) (x * x)[/code] [/QUOTE] Careful now... what happens if you run SQR(3+2)? [icode](3 + 2 * 3 + 2) = 11[/icode] Every time a parameter appears in a macro, it should be surrounded by parentheses. [code] #define SQR(x) ((x)*(x)) [/code]

Member Avatar for aman rathi
-1
214
Member Avatar for blackrobe

Here's the formula I usually use for this problem. [LIST] [*]Set a variable 'numcon' to the number of connections to allow. [*]After a successful 'accept' call, decrement numcon. [*]When numcon equals zero, stop accepting new connections. [*]Continue running the server until all clients have disconnected. Alternatively, set a timer and …

Member Avatar for nezachem
0
169
Member Avatar for churni

[QUOTE=UncleLeroy;1170787] 2) "heap" is the name we use for "malloc space", so your use of the term is non-standard, and this is homework, I pity your grade. 3) There is no code that reads the file. There is a line that opens it, but no code that reads it or …

Member Avatar for IsharaComix
0
89
Member Avatar for esy928

Sounds like a job for vector math! What you want to do is figure out the unit vector that points in that direction. Then multiply that unit vector by the speed you want it to go. Here's the way I would do it. First of all, store bullet positions as …

Member Avatar for esy928
0
1K
Member Avatar for pyprog

You shouldn't be using a while loop inside of the for loop. That will just result in the same line being parsed over and over again. Look carefully, and you'll see that because line doesn't change, the condition can never change, so the loop will never end or it will …

Member Avatar for IsharaComix
0
7K
Member Avatar for ybkumar77

Look at line 53. You've created a NULL char pointer, and then right after that you try to run a strcpy saving the data to it. That won't work since compareFN isn't pointing anywhere. Since you're just taking a pointer, just save the return value. Try doing this instead. [CODE] …

Member Avatar for ybkumar77
0
1K
Member Avatar for Tango2010

You say you're doing it recursively, but it looks iterative to me. Here's a pseudocode example of what you want to do. [code] global list L; /* To store the pathnames. */ DirectoryCheck( D ): L.add_path( D ) for each subdirectory S in D: DirectoryCheck(S) [/code] So in your code, …

Member Avatar for Salem
0
665

The End.