Welcome Guest.   Make a donation to an author on the site October 30, 2014, 01:14:50 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Your Support Funds this Site: View the Supporter Yearbook.
   
  Forum Home Thread Marks Chat! Downloads Search Login Register  
  Show Posts
      View this member's profile 
      donate to someone Donate to this member 
Pages: [1] 2 3 4 5 6 Next
1  Other Software / Developer's Corner / [CSS] Problem with div height on: June 15, 2011, 01:05:31 AM
I got this picture here: http://imageshack.us/phot.../my-images/17/probmb.png/

What I need to do is to make that blue bordered div stretch in height so it fills the cyan bordered area, depending how long the red bordered area is.

So if there's lots of text in the red bordered area, the cyan-area will get a lot longer and therefore the blue area must stretch so it reaches the bottom of the wide area.

Lol do you get me  huh

The blue bordered area should be kind of 'anchored' into the bottom of the big white area so it stretches.
2  Other Software / Developer's Corner / [JS] How to make this loop? on: March 30, 2011, 08:29:18 AM
Formatted for Javascript with the GeSHI Syntax Highlighter [copy or print]
  1. $(document).ready(function(){
  2.  
  3.   var modTime = 0;
  4. setInterval(function(){
  5.  $.post("ChatClient.php", {"file":"chat.cht", "time":modTime}, function(rst) {
  6.    if (rst.time != modTime) {
  7.      modTime = rst.time;
  8. window.location.reload();
  9. else {
  10.  
  11. }
  12.    }
  13.  });
  14. }, 1000);
  15. });

So that is my code, and I need to make it do the whole check again on the else-statemen.
This is supposed to check a file modification time and if it's changed - it should reload the page and if it's not changed, it should just keep checking infinitely again until it is.
It works nice, if I remove the else-statement but then it refreshes every seconds - no matter if the file is modified or not.

I tried this by myself:

Formatted for Javascript with the GeSHI Syntax Highlighter [copy or print]
  1. $(document).ready(function(){
  2. loopIt();
  3. function loopIt() {
  4.   var modTime = 0;
  5. setInterval(function(){
  6.  $.post("ChatClient.php", {"file":"chat.cht", "time":modTime}, function(rst) {
  7.    if (rst.time != modTime) {
  8.      modTime = rst.time;
  9. window.location.reload();
  10. else {
  11. loopIt();
  12. }
  13.    }
  14.  });
  15. }, 1000);
  16. }
  17. });
3  Other Software / Developer's Corner / Re: [PHP] str_replace - is this even possible? on: March 29, 2011, 10:35:10 AM
The <|/p> and <|p> tags somehow come from joining these two together:

$Firstpart[$rand] . $SecondPart[$rand];
4  Other Software / Developer's Corner / Re: [PHP] str_replace - is this even possible? on: March 28, 2011, 11:03:24 AM
Still weird tho ... I can print ie. CHESSBOARD as much as I want and it always puts <|/p><|p> after the word.  huh
5  Other Software / Developer's Corner / Re: [PHP] str_replace - is this even possible? on: March 28, 2011, 10:31:57 AM
Since I got your attention already, I'll ask if anyone knows, if it is possible in anyway for random <|p> and <|/p> -tags to get insterted into my code.
ALSO, str_replace wont find em either.

This is the output, don't mind about the contents  embarassed


Formatted for Text with the GeSHI Syntax Highlighter [copy or print]
  1. <p>[18.26.23] - Rotation was <font color = 'orange'><b>225</b></font> degrees, done by <b>127.0.0.1</b>, who says: '<b>HIGHWAY|||</p><p>|||-CHESS BOARD|||</p><p>|||</b>'


I've highlighted the tags with '|||'s, which cause problem and I assure you, that I've gone trought EVERY FILE RELATED trying to find where those tags pop-up.
I've tried using find in text-editor, I've tried to strip and trim them and no I don't know what to do anymore...

This is just my foolish theory but ... might it be possible, since 'HIGHWAY' and 'CHESSBOARD' are obtained from text-file,
that they somehow contain invisible tags or something after them? Like HIGHWAY<|/p><|p> ?

6  Other Software / Developer's Corner / Re: [PHP] str_replace - is this even possible? on: March 28, 2011, 06:46:32 AM
Oh my god, it works perfectly! THAAAANKS!
I was worried that nobody wouldn't make any sense of what I want to achieve  Grin

Now, to reverse that back ... Im going to seek for function which switches the key-table's keys with values like so:

OLD:

Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. $cryptkey = array('0' => 286, '1' => 949, '2' => 695);

NEW:

Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. $cryptkey = array('286' => 0, '949' => 1, '695' => 2);

Edit: array_flip seems to do the work.
7  Other Software / Developer's Corner / [PHP] str_replace - is this even possible? on: March 28, 2011, 05:15:58 AM
Hi again.
I'd like to make simple crypter by myself, this is what I've done so far:

Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. //This is the key-table for crypter.
  2. $cryptkey = array('0' => 286, '1' => 949, '2' => 695, '3' => 348, '4' => 438, '5' => 977,
  3. '6' => 320, '7' => 418, '8' => 970, '9' => 482, '[' => 466, ']' => 770, '.' => 569,
  4. ' ' => 242, '-' => 166, 'A' => 583, 'B' => 575,  'C' => 247,  'D' => 564, 'E' => 192,
  5. 'F' => 513,  'G' => 653,  'H' => 605,  'I' => 450,  'J' => 404,  'K' => 831,  'L' => 315,  'M' => 953,
  6.  'N' => 439,  'O' => 266,  'P' => 231,  'Q' => 633,  'R' => 881,  'S' => 113,  'T' => 935,  'U' => 559,
  7.   'V' => 318,  'W' => 927,  'X' => 906,  'Y' => 463,  'Z' => 184, 'a' => 263,  'b' => 453,  'c' => 208,
  8.   'd' => 591,  'e' => 511, 'f' => 343,  'g' => 969,  'h' => 415,  'i' => 420,  'j' => 175,  'k' => 410,
  9.   'l' => 295,  'm' => 265, 'n' => 877,  'o' => 200,  'p' => 837,  'q' => 913,  'r' => 515,  's' => 262,
  10.   't' => 524,  'u' => 874, 'v' => 525,  'w' => 700,  'x' => 670,  'y' => 918,  'z' => 290, '<' => 331,
  11.   '>' => 533, "'" => 425, ',' => 101, ':' => 495, '$' => 114, '\\' => 268, '/' => 721, '=' => 454);
  12. //Don't mind about some fails in the table ... solving them later.
  13.  
  14. //This is the string we're going to crypt.
  15. $notcrypted1 = "[$curdate] - Rotation was <font color = '$color'><b>$rotation</b></font> degrees, done by <b>$ip</b>, who says: ''<b>$msg</b>''\r\n";
  16.  
  17. //Splitting the string here. (is this even needed?)
  18. $split1 = str_split($notcrypted1);
  19.  
  20. //And this is the problem area
  21. foreach ($split1 as $char) {
  22. foreach ($cryptkey as $char2 => $key2) {
  23. $crypted1 = str_replace($char, $key2, $notcrypted1);
  24. }
  25. }
  26.  
  27. //Im using this PHP.net's example
  28.  
  29. // Provides: Hll Wrld f PHP
  30. $vowels = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U");
  31. $onlyconsonants = str_replace($vowels, "", "Hello World of PHP");

So basically, it is supposed to replace the characters in the $notcrypted1 with the key-table's corresponding int value.
But the problem is, that I'd like to know if there's any way to tell the program to switch the character it is going trought with the key-table's corresponding int value ... And like without doing 3000 if's.

Since it can replace the vowels with blank in the example - is it possible to switch the characters with the ints in my code?
My brains are jamming with this one ... I know it will not work like this and I even know why it isn't working - I just can't find a way to solve it ...


I wouldn't want to do it like so:

Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. foreach ($split1 as $char) {
  2. foreach ($cryptkey as $char2 => $key2) {
  3. if ($char == "A") {
  4. $crypted1 = str_replace($char, "A", $notcrypted1);
  5. }
  6. }

8  Other Software / Developer's Corner / Re: [PHP] Confused with functions on: February 06, 2011, 05:41:18 AM
Yeah ... there's sometimes just too much questions I need answer for.
I'll go check the nearest library!
9  Other Software / Developer's Corner / [PHP] Confused with functions on: February 05, 2011, 05:18:24 PM
This has nothing to do with the thread I made few minutes ago.

Anyways ... I need help with these thing related to PHP-functions:

- How do I set what the function needs to work?

Like ...

Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. function countNumbers() {
  2. echo ($x + $y);
  3. }

Now, how do I declare, that the function I made needs parameters $x and $y to count like so:
countNumber(1, 2);


Second question is, can function return multiple values, like with a loop?

Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. function countNumbers() {
  2. $rtnval = $x + $y;
  3.  
  4. for ($i = 0; $i <= 5; $i++) {
  5. return $rtnval;
  6. }
  7. }


Third is, can I use function directly to output something like so:

Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. echo countNumbers();

or

Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. $numbers = countNumbers();
  2. echo Numbers;
10  Other Software / Developer's Corner / Re: [PHP] 'Dynamic variable name' ? on: February 05, 2011, 05:00:57 PM
Thanks!
It's working now as so:
(Btw, any 'better' way to thank like reputation + etc. ?)
Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. $i = 0;
  2. $openMap = fopen("map/map_1-1.txt", "r");
  3. while (!feof($openMap)) {
  4. $line = fgets($openMap);
  5. $map[$i] = str_split($line);
  6. $i++;
  7. }
  8. fclose($openMap);
  9.  
  10. for ($row = 0; $row <= 13; $row++)
  11. {
  12.    for ($col = 0; $col <= 13; $col++)
  13.    {
  14. if ($map[$row][$col] == 'X') {
  15. echo "<img src = 'img/wall/X.jpg'/>";}
  16. elseif ($map[$row][$col] == 'G') {
  17. echo "<img src = 'img/terrain/G.jpg'/>";}
  18.    }
  19. }
11  Other Software / Developer's Corner / Re: [PHP] 'Dynamin variable name' ? on: February 05, 2011, 04:17:14 PM
What do you mean?
Aren't I using arrays when splitting the lines to an array?
12  Other Software / Developer's Corner / Re: [PHP] 'Dynamin variable name' ? on: February 05, 2011, 04:10:09 PM
Whaat?

I want to get every line of the text-file.
Then spilt those lines to arrays called map1, map2, map3 ... where each character of the line is one cell of an array.
But how do I name the $map differently after every loop?

like $map$i or somrthing?
13  Other Software / Developer's Corner / [PHP] 'Dynamic variable name' ? on: February 05, 2011, 03:53:27 PM
This is something I've managed to do so far:
Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. function generateMap {
  2. $i = 0;
  3. $openMap = fopen("map/map_1-1.txt", "r");
  4. while (!feof($openMap)) {
  5. $line = fgets($openMap, 1024);
  6. $map = str_split($line);

The problem is, that I want to name the array $map like $map$i  or $map + $i...
So that it's like $map1 = blah, $map2 = blah, $map3 = blah ...

Do you get me?
How do I do that?
14  Other Software / Developer's Corner / Re: [ActionScript 3/Adobe Flash] Play a sound when user clicks button? on: January 19, 2011, 02:23:11 PM
Oh ... I also have background-music playing from the start ... I'd like it to stop when I say so.

Tried this one:

Formatted for ActionScript with the GeSHI Syntax Highlighter [copy or print]
  1. var bgMusic:bgMsc= new bgMsc();
  2. bgMusic.stop();

Also this:

Formatted for ActionScript with the GeSHI Syntax Highlighter [copy or print]
  1. var bgMusic:bgMsc= new bgMsc();
  2. bgMsc.stop();

Error is this:

TypeError: Error #1006: stop is not a function.
   at Untitled_fla::MainTimeline/frame96()


Isn't this similar (this is playsound-function when someone click the twitter-button)?:

Formatted for ActionScript with the GeSHI Syntax Highlighter [copy or print]
  1. function sound_play (e:MouseEvent):void {
  2. snd.play();
  3. }

15  Other Software / Developer's Corner / Re: [ActionScript 3/Adobe Flash] Play a sound when user clicks button? on: January 19, 2011, 02:08:15 PM
Aha!
It was hidden under Advanced > Something > Something tongue



Got it to work just right - Thanks so much for help!

- RedPillow
16  Other Software / Developer's Corner / Re: [ActionScript 3] Play a sound when user clicks button? on: January 19, 2011, 01:34:46 PM
You might be right ... someone said this:

Quote
sound works just as movieclips, create a sound in the .fla, use the linkage dialog in teh library and set Class to: "MySound1"
then use it with:

var snd:MySound1= new MySound1();
snd.play();

should work..


But since Im new with flash I have no idea how to "create a sound in the .fla, use the linkage dialog in teh library and set Class to: "MySound1"".
(Incase it's important ... Im making a basic starting-sequence for a flash-game/animation like "Game by: blahahah" and there's a button which links to my twitter but I want it to make *click* -sound when clicked)
17  Other Software / Developer's Corner / [ActionScript 3/Adobe Flash] Play a sound when user clicks button? on: January 19, 2011, 01:22:36 PM
I found something like this:

Formatted for ActionScript with the GeSHI Syntax Highlighter [copy or print]
  1. var snd:MySound1= new MySound1();
  2.  
  3. soundbutton_MC.addEventListener (MouseEvent.CLICK, soundbutton_Handler);
  4.  
  5. function soundbutton_Handler (e:MouseEvent):void {
  6. snd.play();
  7. }

I have the sound-effect in my Adobe Flash's library ... where should I put it and how to make the script know to play that one?
18  Other Software / Developer's Corner / Re: Rock physics math-thing [PHP] on: January 19, 2011, 06:03:18 AM
But the exercise told me that formula  huh
My teacher has messed these up before though ... any idea how to actually do this thing then?

Edit: Oh ... I'll try the t^2 one.

Am I right when I think, that the printout should be something like this:


Rock's height is 10 when 1-seconds has passed.
Rock's height is 20 when 2-seconds has passed.
Rock's height is 30 when 3-seconds has passed.
Rock's height is 40 when 4-seconds has passed.
Rock's height is 30 when 5-seconds has passed.
Rock's height is 20 when 6-seconds has passed.
Rock's height is 10 when 7-seconds has passed.
Rock's height is 0 when 8-seconds has passed.

19  Other Software / Developer's Corner / Rock physics math-thing [PHP] on: January 19, 2011, 05:52:28 AM
Yes, this is part of a homework which I've tried to do 2 days now...
I tried to translate it as good as I can


"if rock is thrown directly up from the ground with starting speed of 20 meters/second, rock's height s (meters) after t (seconds) can be count with this formula:
s = -5t2 + 20t

Make a program, which counts and prints rock's height on each second."

I've tried this with different changes but none of them have worked so far:

Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. $time = 1;
  2. $height = 1;
  3.  
  4. while ($height > 0) {
  5. $height = ((-5*$time*2)+(20*$time));
  6. $time++;
  7. echo "Rock's height is " . $height . " when " . $aika . " -seconds has passed.<br />";
  8. }

And this prints out infinite lines of this:

Rock's height is 10 when -seconds has passed.
Rock's height is 20 when -seconds has passed.
Rock's height is 30 when -seconds has passed.
Rock's height is 40 when -seconds has passed.
Rock's height is 50 when -seconds has passed.
Rock's height is 60 when -seconds has passed.
Rock's height is 70 when -seconds has passed.
Rock's height is 80 when -seconds has passed.
Rock's height is 90 when -seconds has passed.
Rock's height is 100 when -seconds has passed.

It goes on and on.


So ... what am I doing wrong / not getting?

-RedPillow
20  Other Software / Developer's Corner / [PHP] Variables in array to int ? on: December 09, 2010, 12:19:31 AM
I got this IF - FOREACH - THING here (I know that's a bit stupidly done ... adding "," to $num and removing it ...
My excuse is, that Im just a poor student with goal to someday become good at this kind of stuff and currently I don't care if there's something done stupidly ... cause if I ever try to fix that, it will not work):

Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. if (isset($_GET["num"])) { foreach
  2. ($_GET["num"] as $arvo) $num = $num . $arvo . ",";
  3. $numchk[] = $num;}
  4. $numchktostring = $numchk[0];
  5. $num2 = explode(",", $numchktostring);
  6.  
  7. unset($num2[7]);
  8. $validchk = count($num2);

Now, it somewhy gives me output like this (By var_dumping $num2):
Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. array(7) { [0]=>  string(1) "1" [1]=>  string(1) "2" [2]=>  string(1) "3" [3]=>  string(1) "4" [4]=>  string(1) "5" [5]=>  string(1) "6" [6]=>  string(1) "7" }

As you can see, every single key is a string.
My guestion is plain simple; how to make those strings int?

I have this example-snippet here, but how do I use it to array? (loop preferred):
Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1.     $str = "10";
  2.      $num = (int)$str;

-- EDIT --

This seems to turn the variables to int, but it loses the avlue given to them before:

Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. $i = 0;
  2. $a = 0;
  3. While ($i < 7) {
  4. $num2[$a] = (int)$num2[$a];
  5. $i++;
  6. $a++;
  7. }

var_dump($num2) outputs now:
Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. array(7) { [0]=>  int(1) [1]=>  int(2) [2]=>  int(3) [3]=>  int(4) [4]=>  int(5) [5]=>  int(6) [6]=>  int(7) }
21  Other Software / Developer's Corner / Re: What is wrong with this php-snippet? on: December 08, 2010, 03:28:02 AM
_______
SOLVED

My html-side was messed-up really bad ...
I didn't even have a value for each option.

-- But hey, thanks a lot for your time and help !!
22  Other Software / Developer's Corner / Re: What is wrong with this php-snippet? on: December 08, 2010, 03:17:16 AM
Writing to file didn't work so well ... it only wrote the last option selected in the listbox to the file.

But here's a code from some php-site they used for multiple selections:

Formatted for HTML with the GeSHI Syntax Highlighter [copy or print]
  1. <form method=post action=''>
  2. <select name='color[]' size=4 multiple>
  3. <option value='blue'>Blue</option>
  4. <option value='green'>Green</option>
  5. <option value='red'>Red</option>
  6. <option value='yellow'>Yelllow</option>
  7. <option value='' selected>Select a Color </option>
  8. <option value='white'>White</option>
  9. <input type=submit></form>

///// collecting form data /////

Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. @$color= $_POST['color'];
  2. if( is_array($color)){
  3. while (list ($key, $val) = each ($color)) {
  4. echo "$val <br>";
  5. }
  6. }//else{echo "not array";}


I fail to see what this snippet does differently ... maybe you can?
23  Other Software / Developer's Corner / Re: What is wrong with this php-snippet? on: December 08, 2010, 02:49:04 AM
Thanks, your explode-function works!
Though there is still a tiny problem..
With this, it only prints the last selected option in the listbox ie.

Option 1 -selected-
Option 2
Option 3 -selected-

output --> Only option 3

Btw, the value $_POST gets is not an array ... and it should be I guess since you can choose multiple options from the listbox.

Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. $vehicles="";
  2. if (isset($_POST["vehicle"]))
  3. {$vehicles = "You chose:<br />";
  4. $arrex = explode(" ", $_POST["vehicle"]);
  5. foreach($arrex as $value)
  6. {$vehicles = $vehicles . $value . "<br />";}
  7. print $vehicles;}
24  Other Software / Developer's Corner / What is wrong with this php-snippet? on: December 08, 2010, 01:51:31 AM
Here, it comes up with this error "Invalid argument supplied for foreach() in J:\Xampp\xampp\htdocs\forms-1\next.php  on line 28
I read somewhere that the variable it's checking isn't array ... it gets the $_POST vehicle from listbox with multiple selections.

Formatted for PHP with the GeSHI Syntax Highlighter [copy or print]
  1. $vehicles=""; //line25
  2. if (isset($_POST["vehicle"])) //line26
  3. {$vehicles = "You chose: <br />"; //line27
  4. foreach ($_POST["vehicle"] as $value) //line28
  5. {$vehicles = $vehicles. $value . "<br />";} //line29
  6. print $vehicles;} //line230
25  Main Area and Open Discussion / General Software Discussion / Windows 7, weird picture on: July 04, 2010, 04:15:56 AM
I've got 64bit Windows 7.
Now, I go this picture and a part of it is edited.

The problem is, that you have those preview-icons for your pictures and this certain edited picture shows how it was originally, but when I open the picture, it shows the edited version.
How can this be possible?

Also, since I've got this problem, is it possible to get that preview-picture as big as the edited one?
Pages: [1] 2 3 4 5 6 Next
DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 1.555s | Server load: 0.1 ]