|
Christian is correct about making an array of all of your cards, then suffling them. But, there's another method of shuffling that doesn't involve swapping cards. This alternate method is used by the secured shufflers in just about every internet poker site that's honest.
What you'll do is create an array of cards, just like Christian described. Then pick a random card in the deck (1 to 52), remove it from the deck and add it to the top of a new deck, or second array. Now, pick another random card (1 to 51), remove it and add it to the top of the new deck, and so on until you've exhausted the source deck.
You can read more about this research, and why card swapping and a 32-bit RNG can only generate about 4 billion or so decks (assuming 52 cards) out of the possible 8.0658175170943878571660636856404e+67 decks, by Googling for "How we learned to cheat internet poker".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
OK - thanks for the info. I've used code like this to do shuffle in the past ( C++ offers a random_shuffle method as standard, I wish the .NET standard library would catch up ), but I'll use your method in future.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I found the article link that I read before, here[^]. Seriously, check it out. It's very interesting.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks - it's a slow day, so I'm reading it now...
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Slow day? Oh, that's right! It's light outside where you are. It's about 10:00pm here. Just getting ready to sit down to some online Poker...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I am trying to get html source as string in javascript. I want that user requests a page from Internet Explorer and when server returns response to browser then instead of displaying html into browser there should be a javascript code which gets all returned html in to a variable as string. I then want to send this string to a web service for further processing. Web service returns html as string and then display this string in browser through javascript. I know how to call web service from javascript but getting html is a problem.
I have been trying to find a way for the last 4 weeks but no success. Please let me know if someone knows how to do that. Its too urgent!
|
|
|
|
|
though this is not the ASP or JavaScript forum but here is the solution for your problem
in the form load event create a string which you want to use in javaScript
and do this
response.write "" & vbcrlf
response.write "var x" & vbcrlf
response.write "x=" & VariableName containing HTML text & VBCRLF
response.write "" & vbcrlf
now this x variable can be accessed in JavaScript and you can do what ever you want from here onwards
|
|
|
|
|
Thanks alot for replying. I might not be clear in describing th problem. Actual problem is that i have few websites. Now i want to add a line like <script language="javascript" src="somelocation></script> in the header of every website. This script will get all the html that will be generated by the server. Instead of displaying in browser our script will hack that html. Browser will hangup and will not display anything.
For example i add script in http://www.website.com header. User types in http://www.website.com in his browser. Now when server sends html to display in browser my script should get all html and pass that html to web service.
Can we do it in javascript? Thanks again.
|
|
|
|
|
hmmm.. big problem.. well I am not sure you can do this or not. So if you find any solution do let us know about this.
best of luck
|
|
|
|
|
If only it was that simple...
What you're proposing is possible to do, but not with a simple script like that. Since the script you're proposing will not execute until the HTML you want to capture actually gets to the browser and is pre-rendered, your script will either have to retrieve the current document from the browser, or have to make a SECOND call to the server to retrieve the same page it's running on. Then you can send that to your web service, get back the altered page, then replace the current document source with the altered document source.
But, you'll end up with flickering pages in all your web sites as each page is loaded and rendered TWICE!
No, I don't have any sample code, nor do I know of any.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Could you please let me know that how can we hide current document loading. I just retrieve the response url from browser and feed it to my web service. I want that page loads in browser but does not display in browser. I tried it whole day today but unfortunately i am beginner to javascript. Any guidance will be appreciated.
Regards,
Ahmad.
|
|
|
|
|
Like I told you, the page will display, and then refresh when the javascript changes to the new page from the webservice. You cannot stop the page from rendering because the javascript doesn't start running until the page starts rendering. You can't stop it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi All
I am developing a system that will retrieve information from pastel account information, it will have to retrieve the invoice number and store it in the SQL server database so I need help on how to connect to pastel so that I can be able to get the information from pastel and from the database to pastel. The two applications have to share some sort of information. The help that is provided must be in visual basic 6.0 because that is the one I am using.
Hope you can help
Thank in advanced
|
|
|
|
|
I can't help, I don't use VB6. But I have no idea what pastel is, except a pale colour. Perhaps if you explain this, someone else can help you ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'll second that question. What on earth is "pastel"?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
it seems to be the name of his server...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Is there any VB.NET control that can help me if i want a figure or table to be inserted in the database? Which control i should use?
Actually i want to insert tables and other images from word document into my database and dont know what to do. Please help me in this regard.
Thanx in advance.
Arfan Qadir.
|
|
|
|
|
No, you need to convert these items into a format that your database can understand and write SQL to pass it in.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
NGen is the tool which helps to speed up the application.Iam using the Framework 1.1.Please tell me how to use NGen tool to speed up the application
please give the solution so that it can be implimented.
Regards,
Prashant
Prashant Pawar
|
|
|
|
|
You keep asking this, so here is a story. A couple of dudes in the 70's were writing implimentations of the game of life, and trying to be the fastest. They were both trying to optimie existing code, and one told the other he'd figured out how to double his speed. The other guy spent the night trying to optimise his code, he couldn't get more than a small speed increase. So he thought it through and rewrote it with a new algorithm ( he essentially wrote a compiler that compiled game of life ) and got a 5 x speed increase. The next day his friend told him he was mistaken.
I wrote an image processing algorithm that was pretty intense, in C#. It took 2 minutes to process an image. I converted it to C++ and it took 12 HOURS. I optimised the code, and now it takes 8 seconds.
The moral of the story is, you're not getting an answer because there is no help for you, based on what you're asking. Like I said earlier, get rid of COM+ and the network traffic ( did you really try it without COM+ ? I am astounded how quick you did that ), but the core problem is almost certainly not with vb.net, but the code you have written. Get a code coverage tool, work out the bottlenecks, and then fix them. Perhaps you hit the database too often. Perhaps you're building objects you could cache. And perhaps it's just going as fast as it can.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Let me repeat myself... again...
<yelling>
NGEN DOES NOT SPEED UP YOUR APPLICATION!
YOU CANNOT USE IT TO GET A PERFORMANCE BOOST!!!
</yelling>
You're going to have to rewrite your code to get any kind of a boost, possibly even alter the design of your application.
<i><b>RageInTheMachine9532</b></i><font size="-1">
"<i>...a pungent, ghastly, stinky piece of cheese!</i>" <b>-- The Roaming Gnome</b></font>
|
|
|
|
|
From your repeated question about the same thing, it's bloody obvious that you have no idea how the JIT compiler works.
When you start your application, only the code that is required to start is compiled by JIT. JIT compiles code on a per-method basis, and only done once per execution session. This means that when a new form is loaded, only it's startup and rendering code is compiled. If you have a button on the form, the buttons Click event and other handlers ARE NOT COMPILED! They are only compiled to machine code upon first execution. This means that your Click event handler code is only compiled when you click the button for the first time!
Here, read this[^] on Performance Considerations. It explains how alot of this stuff works. Read it, understand it, then apply this knowledge to your existing code. God forbid, you might even find and fix your own problems using this knowledge.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i created one vbcall.exe and working succes fully
and now wat i want is i have to call one another exe in the above exe(vbcall.exe) and pass values to that
can someone help me?
|
|
|
|
|
You can use process.start, and you may be able to pass values. It's not the right way to do things though. ShellExecute allows you to pass values on the command line, for sure.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
thanks for reply if posible send any example code to pass variables immediatly
|
|
|
|