maxicube 0 Light Poster

It is because of this:

glutIdleFunc(display);

display() is being called continuously, since you have registered it as the idle callback. The window does move. The problem is there are too many idle calls. Give some delay, that will work.

PS: Its not a good idea to register the display as the idle callback itself. In your case, this could be a better approach:

void idleCallback(void)
{
    glutPostRedisplay();
    // delay would be required.
}

or you can perhaps you can have look at THIS as well.

This was it, add a sleep/delay there. cant believe it was that simple, thanks.

maxicube 0 Light Poster

It would seem to work at school :|
Same code...

maxicube 0 Light Poster

Yea, all permissions are enabled for it. not sure why that would stop input.

maxicube 0 Light Poster

Hey there, was wondering if anyone else has this issue.
I've checked to see if it was my drivers, but no.

the GL window wont move, it won't accept any inputs at all.
but it shows everything else.

I've tried everything in my memory bank.. and still nothing.
this is including rewriting the program, and implementing SDL as an input handler.


this is my cleaned out code (still wont accept anything) but still runs.

HALP!

#include <GL/glew.h>
#include <GL/glut.h> 
#include <iostream>

using namespace std;

bool* keyStates = new bool[256]; 

GLuint LoadTexture(char *TexName);



void keyOperations (void) {
	if (keyStates['w']) { 
		cout << "RAWR W WAS PRESSED" << endl;
	}
	if (keyStates['s']) {
		cout << "RAWR S WAS PRESSED" << endl;
	}
}

void display (void) {
	keyOperations();
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
	glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);

	glLoadIdentity(); 

	glTranslatef(0.0f, 0.0f, -5.0f);

	glFlush();
}

void reshape (int width, int height) {
	glViewport(0, 0, (GLsizei)width, (GLsizei)height); 
	glMatrixMode(GL_PROJECTION); 
	glLoadIdentity(); 

	gluPerspective(60, (GLfloat)width / (GLfloat)height, 1.0, 100.0);

	glMatrixMode(GL_MODELVIEW);
}

void keyPressed (unsigned char key, int x, int y) {
	keyStates[key] = true; 
	cout << key;
}

void keyUp (unsigned char key, int x, int y) {
	keyStates[key] = false; 
}

int main (int argc, char **argv) {
	glutInit(&argc, argv);
	glutInitDisplayMode (GLUT_SINGLE);
	glutInitWindowSize (500, 500); 
	glutInitWindowPosition (100, 100); 
	glutCreateWindow ("OGL");
	glutDisplayFunc(display);

	glutIdleFunc(display); 

	glutReshapeFunc(reshape);

	glutKeyboardFunc(keyPressed); 
	glutKeyboardUpFunc(keyUp);
	
	glEnable (GL_DEPTH_TEST);
	
	for (int i = 0; i < 256; i++)
	keyStates[i] = false;

	glutMainLoop();
}
maxicube 0 Light Poster
#include<iostream>
#include<Windows.h>

using namespace std;

int main()
{
	for(int i=0; i<255; i++)
	{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), i);
	cout << "supppppppppppp " << i << endl;
	}
	system("pause");

}
maxicube 0 Light Poster

oh hey guys, i got this little issue where i can read from the database. but i cannot write to it..

here be my full code. live site at http://downloadavirus.net

<?php
  $params = $_SERVER['QUERY_STRING'];
  $url = $_POST["url"];
  
  $username = "--------";
  $password = "--------";
  $database = "--------";
  mysql_connect(localhost, $username, $password);
  @mysql_select_db($database) or die("Unable to select database");
  
  
  
  
  
  
  
  if ($params == "") {
      if ($url == "") {
          echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<title>Download A Virus | URL Redirection</title>
<style type=\"text/css\">
<!--
body {
  background-image: url(bg.png);
}
body,td,th {
  font-family: Arial, Helvetica, sans-serif;
  color: #FFF;
  font-size: 24px;
}

-->
</style></head>

<body>
<div style=\"position:absolute; left:50%; top:50%; margin-left:-335px; margin-top:-204px; background:url(window.png); height:408px; width:671px;\">
<div style=\"position:absolute; left:50%; top:50%; margin-top:-70px; width:547px; margin-left:-273px; text-align: center; vertical-align:middle\">
  <p><span style=\"font-size:xx-large; font-weight:600\">Download A Virus</span><br />
    <span style=\"font-size:small; color:#CCC\">url redirection</span>
    <br />
  </p>
  <p><form method=\"post\">
    <label>
      <input name=\"url\" type=\"text\" id=\"url\" size=\"50\" />
    </label>
    <label>
      <br />
      <input type=\"submit\" name=\"button\" id=\"button\" value=\"GO\" />
    </label></form>
  </p>
</div>
</div>


</body>
</html>";
      } else {
          mysql_query("INSERT INTO main VALUES NULL, '$url')");
          
          $result = mysql_query("SELECT * FROM main");
          $num = mysql_numrows($result);
          
          
          echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<title>Download A Virus | URL Redirection</title>
<style type=\"text/css\">
<!--
body {
  background-image: url(bg.png);
}
body,td,th {
  font-family: Arial, Helvetica, sans-serif;
  color: #FFF;
  font-size: 24px;
-->
</style></head>

<body>
<div style=\"position:absolute; left:50%; top:50%; margin-left:-335px; margin-top:-204px; background:url(window.png); height:408px; width:671px;\">
<div …
maxicube 0 Light Poster

after cleaning your code.

<?php
$file = fopen('clients.txt','r');
$ip = $_SERVER['REMORE_ADDR'];
$fp = fopen('client.txt','a');

for ($i=0; $i<count($file); $i++)
{
	$out = fgetcsv($file,1000,'|');
	if ($out[0]!=$ip)
	{
		fwrite($fp,$out);
	}
fclose($fp);
fclose($file);
}
?>

it spits out "ArrayArray" into client.txt

maxicube 0 Light Poster

*sigh* silly me - just woke up
ok, now thats out of the way.
all that returns in the client.txt (not clients.txt)
is the number 0.

maxicube 0 Light Poster

GAH!
tried doing that, to no avail.

new code:

<?php

$file = fopen('clients.txt',r);
$ip = $_SERVER['REMOTE_ADDR'];

$fp = fopen('client.txt','a')
for ($i=0; $i<count($file); $i++) 
{
	list ($field1, $field2, $field3, $field4) = split ('\|', $i);
	if ($field1!=$ip) 
	{ 
		fwrite($fp,$i."\n"); 
	}
} 
fclose($fp); 
?>7

new error

Parse error: syntax error, unexpected T_FOR in *snip*/test.php on line 7
maxicube 0 Light Poster

Hey. i was wondering howto delete a single line from a FFD

on the server that i currently have, it is not possible to use a mySQL database and I'd rather keep it a FDD

I have tried too no avail.

Here is my current code

<?php

$file = fopen('clients.txt','r');
$id = $_REQUEST['id'];

for ($i=0; $i<count($file); $i++) 
{
	list ($field1, $field2, $field3, $field4) = split ('\|', $i);
	if ($field1!=$id) 
	{ 
		$data .= $field1.'|'.$field2.'|'.$field3.'|'.$field4."\n"; 
	}
} 
fclose($file);
$fp = fopen('clients.txt','w');
fwrite($fp,$data);
fclose($fp); 
?>

and my friend suggested putting it all in a table, and deleting the line, and overwriting the file.
no idea of how to do this....

Oh, my database is kinda like this.

23453|maxicube|admin|305
23454|fish|user|28

Also, if i run that.
this is all that returns on clients.txt

0|||

thanks for your help - Maxicube :D

maxicube 0 Light Poster

mmm, i found a site with an example.
but i realised request.KeepAlive was default to true
so i just set it to false and it seemed to love me.

maxicube 0 Light Poster

Thanks for the reply. Umm I'm guessing just run the connect bit once. And put request.keepalive = true; in and make the close connection only happen once. I'll try this when I wake up.
Again. Thanks for your time.
Btw. I'm a bitof a newbie at c#. Only started the other day :D

maxicube 0 Light Poster

So your just saying. Either keep the connection open.
Or put a thread.sleep(1000) in between each upload?

maxicube 0 Light Poster

urmm, hey guys.
im getting a 503 error on my program i'm making.
It's used to backup multiple files to a online ftp server.

and on the 5th file
it gets it on this line...

Stream requestStream = request.GetRequestStream();

heres my code (for the upload)...

public void upload(string pathtofile, string file)
        {
            FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://ftp.example.com/" + file);
            request.Method = WebRequestMethods.Ftp.UploadFile;
            request.Credentials = new NetworkCredential("username", "password");
            byte[] fileContents = File.ReadAllBytes(pathtofile + "\\" + file);

            Stream requestStream = request.GetRequestStream();
            requestStream.Write(fileContents, 0, fileContents.Length);
            requestStream.Close();

            FtpWebResponse response = (FtpWebResponse)request.GetResponse();
            response.Close();
        }

and that's used with multiple commands like: upload("c:\\", "file.mdb")

is there any way of fixing this? thanks - maxicube

maxicube 0 Light Poster

ehh, this is a wierd one...
only a small fraction of my css is working when i put it in a external sheet.
works perfectly in internal/embedded css.
here's my css code:

body,td,th {
	background-image: url(images/bg.png);
	background-color: #828281;
	font-family: Arial, Helvetica, sans-serif;
}

#top {
	width:851px;
	height:201px;
}

#middle {
	background-image:url(images/middle.png);
	width:791px;
	padding-left:30px;
	padding-right:30px;
}

#bottom {
	background-image:url(images/bottom.png);
	width:851px;
	height:45px;
}

#all {
	position:absolute;
	width:851px;
	left:50%;
	margin-left:-425.5px;
	top:50px;
}

#ad {
	background-image:url(ads/ad1.jpg);
	position:absolute;
	width:811px;
	height:102px;
	left:20px;
	top:98px;
}

.high
{
	position:absolute;
	background-image:url(images/highlight.png);
	width:66px;
	height:31px;
}

and my html if you want it..

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Leading Edge Computers - Sale</title>
<link rel="stylesheet" type="text/css" href="css/main.css" />


</head>

<body>
<div id="all">
<div id="top"><img src="images/top.png" border="0" usemap="#Map">
</div>
<div id="middle">
  <p><h2>Content</h2></p>
Content Content Content</div>
<div id="bottom"></div>
<div id="ad"></div>
<div class="high" style="visibility:visible; left:20px; top:66px;"></div>
<div class="high" style="visibility:hidden; left:87px; top:66px;"></div>
<div class="high" style="visibility:hidden; left:153px; top:66px;"></div>
<div class="high" style="visibility:hidden; left:220px; top:66px;"></div>
<div class="high" style="visibility:hidden; left:288px; top:66px;"></div>
<div class="high" style="visibility:hidden; left:354px; top:66px;"></div>
<div class="high" style="visibility:hidden; left:422px; top:66px;"></div>
<div class="high" style="visibility:hidden; left:488px; top:66px;"></div>
</div>

<map name="Map" id="Map">
<area shape="rect" coords="20,66,87,98" href="index.html" />
<area shape="rect" coords="87,66,153,97" href="location.html"/>
<area shape="rect" coords="153,66,220,97" href="contact.html" />
<area shape="rect" coords="220,66,288,97" href="about.html" />
<area shape="rect" coords="288,66,354,97" href="promotions.html" />
<area shape="rect" coords="354,66,422,97" href="services.html" />
<area shape="rect" coords="422,66,488,97" href="links.html" />
<area shape="rect" coords="488,66,572,97" href="store.html" />
<area shape="rect" coords="19,15,314,64" href="index.html" />
</map>

</body>
</html>
maxicube 0 Light Poster

so if 0 is randoms starting number, you add 15 so... 15 is the minimum number

maxicube 0 Light Poster

if random is used like random(high number)
why not do random(number)+15

maxicube 0 Light Poster

ooh, sqrt(4)=4^(1/2)=2
might help :D

where sqrt = Square root
^ = to the power of

oh, hang on...
no to the pwr of...

well if 4x4x4 = 4^3 = 64
and then 4^1/2 = .... urrgh - im screwed.

maxicube 0 Light Poster

You need to remove all of your extras and repeats in your head, you have a bunch of stuff you dont need try this.

I would also strongly recommend that you use a css style sheet for this to clean it up and for future usability in design.

thanks for the cleanup. and i worked it out.
for every

<div style='positi....

it needed to be a " instead of a ' (also at the end)

maxicube 0 Light Poster

still being annoying....
any other ideas?

maxicube 0 Light Poster

I dunno how to fix this.
All i get in FireFox is the text. In IE i get all the div tags and graphics and everything.

here's my code, thx for the help :D

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang="en" lang="en">
<head>

<meta http-equiv="Content-Style-Type" content="text/html; charset=utf-8; text/css" />
<title>Maxi-Studios.info | Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><style type="text/css">
<!--
body,td,th {
	font-family: Arial, Helvetica, sans-serif;
}
-->
</style></head>


<body style='margin: 0px; height: 100%; background:url(bg2.png)'>
<div style="position: fixed; z-index: -10; top: 100%; left: 100%; width:200px; height:20px; margin-top:-20px; margin-left:-200px; line-height:20px; text-align:right; color:white;">© Maxicube 2009</div>
<div style='position: fixed; top: 100%; left: 100%; width:88px; height:31px; margin-top:-51px; margin-left:-88px; background:url(http://www.w3.org/Icons/valid-xhtml10-blue); z-index: -10;' onclick="window.location.href='http://validator.w3.org/check?uri=referer;"></div>

<div style='position: fixed; top: 0; left: 0; width: 100%; height: 50%; background:url(bg1.png); z-index: 1;'></div>
<div style='position: fixed; top: 50%; left: 0; width:100%; height:2px; background-color:black;'></div>
<div style='position: fixed; top: 50%; left: 50%; width:433px; height:32px; margin-top:-31px; margin-left:-432px; background:url(logo.png); z-index:3;'></div>

<div style='position: fixed; top: 50%; left: 50%; width:108px; height:25px; margin-top:0px; margin-left:-432px; border:2px black solid; background-color:#b4b4b4; text-align:center; line-height:25px' onclick="window.location.href='index.html'">Home</div>

<div style='position: fixed; top: 50%; left: 50%; width:108px; height:25px; margin-top:0px; margin-left:-324px; border:2px black solid; background-color:#b4b4b4; text-align:center; line-height:25px' onclick="window.location.href='folio.html'">Folio</div>

<div style='position: fixed; top: 50%; left: 50%; width:108px; height:25px; margin-top:0px; margin-left:-216px; border:2px black solid; background-color:#b4b4b4; text-align:center; line-height:25px' onclick="window.location.href='about.html'">About Me</div>

<div style='position: fixed; top: 50%; left: 50%; width:108px; height:25px; margin-top:0px; margin-left:-108px; border:2px black solid; background-color:#b4b4b4; text-align:center; line-height:25px' onclick="window.location.href='upload.html'">Upload</div>





<div style='position: fixed; top: 50%; left: 50%; width:400px; height:400px; background-color:#999; margin-top:-200px; border:2px black solid; z-index:2; …
maxicube 0 Light Poster

other way round.
twitter --> blog

maxicube 0 Light Poster

hey all, been a while since I've been on here.
I was wondering how I could make an rss reader for twitter, and make it so that it displays the content of my 'twit' and nothing else (like time/date ect.)

Thx in advance, Maxicube

maxicube 0 Light Poster

heh, nice work sir, i tink ill post this as solved. +rep

maxicube 0 Light Poster

umm, ill give u my table here:
http://phxscape.servegame.com/testing/birthdays_display_records.php
and this is how its used:
http://www.tm-forum.com/viewtopic.php?t=1767

thanks for replying, umm, seeing im not realy uptoscratch with javascript, how would i do that? *sigh*

example looks nice :D

maxicube 0 Light Poster

anybody got any suggestions?

maxicube 0 Light Poster

Heyy, need some help here.

ok, I've got my script here right.

<html>
<head><title>Display Records</title>
<style type="text/css">
td {font-family: tahoma, arial, verdana; font-size: 10pt }
</style>


</head>
<body>
<?php
$db="aseco121";
$link = mysql_connect('127.0.0.1: 3306', 'root', '******');
if (! $link)
die(mysql_error());
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
$result = mysql_query( "SELECT * FROM players ORDER BY Login" )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "There are $num_rows records.<P>";

print "<table width=200 border=1>\n";
while ($get_info = mysql_fetch_row($result)){ 
print "<tr>\n";
foreach ($get_info as $field) 
print "\t<td>$field</td>\n";
print "</tr>\n";
}
print "</table>\n";
mysql_close($link);
?>
<br>

</body>
</html>

and it comes out with my tables okay?
bieing:
+----+--------+-------------------------+
| 76 | .enjo. | $i$0f0N$000R$ff0G |
+----+--------+-------------------------+
---- table goes on -----

and this '$i' thing is like trackmania font coosing
so $i$0f0N$000R$ff0G would turn out to be NRG (green N, Black R, Yellow G)

note that thier are tonnes of combonations i dont want to write each on out. so how would i get to remove the $ format codes and replace them with things that work in html/php?

so instead of '$F00MAXICUBE' i want MAXICUBE

colour table: http://tutorials.tm-creative.org/general_formattingtext_colours/index.php

maxicube 0 Light Poster

heh. didnt help me that much :/ but dad had some code for me

HKEY hKey;
	DWORD buffersize = 1024;
	char* hldsloc = new char[buffersize];
	RegOpenKeyEx (HKEY_CURRENT_USER,
	"Software\\Valve\\HLServer",NULL,KEY_READ,&hKey);
	RegQueryValueEx(hKey,"InstallPath",NULL,NULL,(LPBYTE) hldsloc,&buffersize);
	RegCloseKey (hKey);
maxicube 0 Light Poster

how would I get the install directory of another program, the registry perhaps? (using HLDS as my directory to be found) (GET HLDS HERE!)

i fond the key which might be useful. (how would i open it?

[HKEY_CURRENT_USER\Software\Valve\HLServer]
"InstallPath"="C:\\hlds"
"Full Name"="Half-Life Dedicated Server"
"Region"="5"
maxicube 0 Light Poster

no probs dude, it works fantastically well +rep

maxicube 0 Light Poster

oh well its at the end, so it distracts you from other work to press ok, (like an ad)
and that sample didnt realy compile for me (im using code::blocks)

C:\Users\Maxicube\Desktop\c++\winsock\main.cpp||In function `void textcolor(int, int, int)':|
C:\Users\Maxicube\Desktop\c++\winsock\main.cpp|34|warning: left-hand operand of comma has no effect|
C:\Users\Maxicube\Desktop\c++\winsock\main.cpp|34|warning: right-hand operand of comma has no effect|
C:\Users\Maxicube\Desktop\c++\winsock\main.cpp|34|warning: right-hand operand of comma has no effect|
C:\Users\Maxicube\Desktop\c++\winsock\main.cpp|34|warning: right-hand operand of comma has no effect|
C:\Users\Maxicube\Desktop\c++\winsock\main.cpp|34|warning: right-hand operand of comma has no effect|
C:\Users\Maxicube\Desktop\c++\winsock\main.cpp|35|warning: right-hand operand of comma has no effect|
||=== Build finished: 0 errors, 6 warnings ===|

well it did compile but...
this is all that pops up:

40%sIn color
40%s
Process returned 0 (0x0)   execution time : 0.047 s
Press any key to continue.

-- EDIT i should look further down the page next time --- SOLVED!!!!

maxicube 0 Light Poster

OK, I'm making a backup application and once the backup is complete, I want it to flash
FINISHED!!!! - in different colours - any help at all would be appreciated, thanks - MaxICube