Jump to content

[SOLVED] Ever done any continuous querying?


ridiculous

Recommended Posts

What do you mean by continuous querying, like, where it constantly queries it as long as the page is loaded?  That sounds like it would burn out your database real quick, I have a script that takes a table from my database, and gets a certain value from one row (there are about 8 values in this row) then updates another row based on what is in the first row, more specifically:

 

I have a xbox live Halo 2 clan roster on my site, it has gamertag, emblem, date joined, and role.  I want to update every members emblems periodically, I have a script that can take a gamertag, and serch that person's page on bungie.net to parse their emblem from the code, then return that emblem url. I wanted, however, to do this to every member at once, so I have to code do a while loop running through every gamertag in the row, parsing the link, setting it as a variable, then executing a query to update that row with the new emblem.  It takes about 10 seconds to get everyones emblem url, and insert it into the database.  I do this about once a week, partially becuase bungie will ban my site's IP if I do it too much, and becuase its probably pretty hard on my mysql server.

Link to comment
Share on other sites

Hmmm, well, I've had about a year and a half of "training" in Java, I didn't like it much, I wouldn't know how to do what you are trying to do, if it is for a webpage, I think you could use AJAX, if not, I'm sorry, I can't help you.

 

Unfortunately, I can't help you with AJAX either, since I know next to nothing about it, other people here do though.

Link to comment
Share on other sites

I think that Java is typically used for this kind of activity, and I'm not sure why. I can see an interface being built in either PHP, Flash, and/or Java for this kind of need.

 

Consider the architectecture of an online gambling client or an online game client where multiple players interact and share information contemporaneously.

 

That's what I'm talking about.

Link to comment
Share on other sites

Well Gmail uses AJAX, I know that for sure, Its just Javascript, but its something special, and I don't know, gmail has a chat feature in which you can instant message with someone, its AJAX based, also their entire system of mail is AJAX, it'll tell you instantly when you recieve a new email or anything like that.  I would recommend using AJAX, but since I don't know exactly what you are trying to do, I can't help specifically, sorry.

Link to comment
Share on other sites

Generally, those aren't done through databases.  They are done through sockets.  Seeing as the server doesn't really need to "store" what hand each user has in a game of poker...there is no point in a database.  Usually (notice how I do not say always, since I can't say that seeing as I am not entirely positive), the servers will use a socket connection.  The client connects to the host server.  The client clicks "bet xxx", and sends a command to the server.  The server then dispatches that command back to the other clients in the game, updating their screens.  There is no need for the server to store any data, unless the administrators wanted a log.  In which case, the server could just log the information in the database to be checked whenever...but that data doesn't need to be auto-updated.  Sadly, MySQL doesn't have a "watch" feature like the Windows FileSystem where you can just have it tell you whenever something is changed.

Link to comment
Share on other sites

That's really informative, thanks.

 

In a socket environment, what happens when a client just disconnects? Consider Yahoo! Games, for instance. If there is no database involved, where is the information about the player's hand of cards kept? Is it cached somewhere?

Link to comment
Share on other sites

Which is why I said usually.  I'm assuming Yahoo games isn't a standalone client, and you are referring to the web games.  In which case, it probably is not a socket.  As for a client disconnecting...it's simple.  When the client closes out of the program, the program just sends a quick command such as "BYE" or "QUIT" to the server.  The server then knows that the client is disconnected.  As for what would happen if a connection was lost...the server would be pinging the client and waiting for a response.  If it gets no response in 2-3 seconds, it would assume the client is disconnected.  And for the Yahoo site...which user hand are you referring to?  The current user that is playing's hand?  In which case...the hand is stored in a local variable on the client's computer (VIA JS, Flash, Shockwave, etc.).  There's no need for a database unless there is a way for the user to save their hand before disconnecting.  In which case they could also use cookies and STILL avoid databases.

Link to comment
Share on other sites

Entirely depends on what you want.

 

Flash XML Sockets:

http://www.devarticles.com/c/a/Flash/XML-Sockets-in-Flash/

 

Java Sockets:

http://www.javaworld.com/javaworld/jw-12-1996/jw-12-sockets.html

 

Since I'm assuming this is a web app, if you want sockets you're pretty much limited to Java, Flash, and Shockwave for client-side, with PHP, Perl/CGI, etc. for server-side.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.