Jump to content

Check out our Community Blogs


Member Since 15 Jul 2010
Offline Last Active Dec 22 2015 02:26 PM

#608792 Experiencing some strange problems while trying to append html code with java...

Posted by DarkLordCthulhu on 04 September 2011 - 07:59 AM

If you want to create a dropdown list, a better method would be to have a list already in the HTML code and set its display: property in the CSS to "none", then when the user clicks the appropriate button, have Javascript change display to "block". This way user data is not lost. Like so:

<style type="text/css">
	display: none;


<script type="text/javascript">
function show(){
	document.getElementById( "dropdown" ).style.display = "block".

As for diagnosing the problem with the innerHTML, I don't have enough information to help you with that. Your code looks fine from what I can tell. It may be something else that's the problem.
  • -1

#594103 Which Version

Posted by DarkLordCthulhu on 14 March 2011 - 10:08 AM

Ubuntu is good OS for beginners as it's not too challenging to use or configure. That's why I don't use it.
  • 1

#591582 How do I use pointers in C for decisions

Posted by DarkLordCthulhu on 16 February 2011 - 04:01 PM

printf("%s%s", "Hello, ", *argv[i]);

I don't understand this. argv[i] is char * type, which is what %s takes. Wouldn't *argv[i] be a char type? I know you probably know more about C than I do, so I'm wondering what is going on here.
  • 1

#591312 Here's something to exercise your number base conversion skills

Posted by DarkLordCthulhu on 14 February 2011 - 03:09 AM

This program displays decimal numbers at random and prompts for the number in hex, telling you if you got it correct. It can easily be modified to convert hex to decimal, hex to octal, etc.

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int random( int );

int main( int argc, char **argv ){
	printf( "Enter the given number in hexadecimal.\n(Values must be in lowercase)\n" );
	for(;;){  // Loops until the user enters 0 or an invalid value or sends an interrupt
		unsigned int dec = (unsigned int) random( 256 );
		unsigned int hex;
		printf( "%d: ", dec );
		scanf( "%x", &hex ); // Input hexadecimal value
		if( !hex ){
			printf( "Bye\n" );
			if( dec == hex )
				printf( "\e[32mCorrect\e[0m\n" ); // Prints in green.
				printf( "\e[31mIncorrect\e[0m\nThe correct answer is %x\n", dec );
				// Prints in red.
	return 0;

// I wrote my own random number generator function because memorizing
// srand is tedious and unnecessary.
int random( int mod ){
	int t = (int) time(NULL);
	int r = rand();
	return abs( (t*r)%mod );

  • 1

#578074 INT vs Double?

Posted by DarkLordCthulhu on 26 October 2010 - 05:39 PM

64 bits (1 for sign, 11 bits for the exponent and 52 bits for the mantissa) not 80. 80 would mess with the natural stack alignment.

Yes, I realized my mistake after I made that post and corrected it. I was thinking of long doubles, which are 80 bits. It's been a while since I did any C.
  • -1

#578043 Happy Birthday CodeCall!

Posted by DarkLordCthulhu on 26 October 2010 - 01:52 PM

I Googled "Is bash Turing-complete." and was brought here. I used to hang out at codingforums.com, but it seemed pretty dead most of the time, and I also didn't like its bias towards the web development; whenever I wanted to ask a question about C or Unix, I had to put it in the "other" category because the forums were all for HTML, Ajax, Apache, and the like.
  • 1

#572679 What's your favorite programming environment/text editor?

Posted by DarkLordCthulhu on 07 September 2010 - 05:12 AM

Since I do the vast amount of my programming in C# I use Visual Studio

So you hate Google and Apple, you live in Washington, and now you're saying you do the vast majority of your programming in .NET. Do you by any chance work for Microsoft?
  • -1

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download