Re: Java Coin Flip Program Programming Software Development by jassonadder … flip == 'Heads': self.heads += 1 else: self.tails += 1 print("\nResults:") print("Total Heads:&…quot;, self.heads) print("Total Tails:", self.tails) # Main program try: flips = int(… Re: Coin Flip (Python Newbie) Programming Software Development by jassonadder …(coin_heads) + " were heads and " + str(coin_tails) + " were tails.") This version should now properly flip a coin 100… times and track how many heads and tails you get. Also, if you're using Python 3 (which… Multiple MySQL connections + transactions Programming Databases by Dani … my code, and I'm trying to make heads or tails as to whether this will work. From within my PHP… Re: Multiple MySQL connections + transactions Programming Databases by Dani A slightly related question: Is it okay to use PHP's `mysqli::select_db()` function to switch databases in the middle of a transaction? This is what got me into trouble in the first place, when I started a transaction, performed some writes, switched databases, and then wrote to that second database, and then switched back, and performed some … Re: Multiple MySQL connections + transactions Programming Databases by Salem https://www.php.net/manual/en/mysqli.select-db.php I think the key word in all of this is "default". You can probably do what you want, but you have to refer to each DB by it's own handle. Using `select_db` is fine, if you only have one DB and you want to be lazy about referring to it. So you make it the default DB. But as … Re: Multiple MySQL connections + transactions Programming Databases by Reverend Jim As far as I know you can connect to more than one database at a time but you require a separate connection object for each one. Since queries go through the connection object you can't run a query on more than one db at a time. It seems to me that transactions are also connection based so you would have to manually roll back a transaction on A if … Re: Multiple MySQL connections + transactions Programming Databases by Dani I am already using multiple MySQL connections throughout the project, as well as select_db() in some other places. My question specifically revolved around if anyone can explain why select_db() implicitly committed the transaction, and then when done again to return back to the initial database, it did a rollback instead of commit. Re: Multiple MySQL connections + transactions Programming Databases by Reverend Jim In that case I can't suggest anything. I've never had to update multiple databases for any of the systems I set up. Re: Multiple MySQL connections + transactions Programming Databases by toneewa You're not suppose to switch databases with a connection mid-transaction. It's by design to rollback because it considers it a change to the session context. XA Transactions can be done if you use the InnoDB storage engine. Create separate PDO connections for each database. I wonder what kind of results you get with autocommit, serializable … Re: Multiple MySQL connections + transactions Programming Databases by Dani > If the databases are on the same server and use InnoDB, you can use fully qualified table names, and write to multiple databases on a single connection. That's what I ultimately started doing instead! Thank you so much for a definitive answer to my question. TAILS The Amnesic Incognito Live System Hardware and Software Linux and Unix by elptuxman Have downloaded and burned TAILS both as a DVD and a booting USB stick. Other … Heads and Tails Game Programming Software Development by aree …random_integer; cout << "THE GAME OF HEAD OR TAILS" << endl; cout << "&… a++) { cout << "Call it, Heads or Tails?" << endl; cout << "h… for heads t for tails" << endl; cin >> guess;… Re: Heads and Tails Game Programming Software Development by daviddoria … no_of_plays; a++) { cout << "Call it, Heads or Tails?" << endl; cout << "h for… randomCoin; if (random_integer == 1) { cout << "coin was tails" << endl; randomCoin = 't'; } if (random_integer == 0) { … Max Consecutive Heads/Tails Programming Software Development by anandarose … the result of each flip whether it's heads or tails. I have all of that done i can't figure… step which is to display the maximum consecutive heads and tails that appear in the results from the coin toss'. Here… I have so far: [code] '10/11/2006 'Heads or tails program INPUT "How many times do you want to… Re: Max Consecutive Heads/Tails Programming Software Development by Yankie Dave …' Show Tail LET tcount = tcount + 1 ' and increase tails counter ' Now we make sure we have a value in…we check if it's a run of Heads or tails, if num = 1 then if consec > … is: " ;maxhcount PRINT "The maximum number of consecutive tails for " ; flipq; " coin flips is: "… Coin Toss Simulation, getting all Tails and one Heads Programming Software Development by Rickenbacker360 … between 0 and 1 and they represent the heads and tails respectively. If it's heads print H if it's… tails print T. [code] [COLOR=black]#include<iostream>[/COLOR] [… when I run the program it always gives me all Tails and one head. So if you have any ideas as… To create a game of Heads or Tails against the computer. Programming Software Development by turbomen …. Write a program that asks the user for Heads or Tails, then simulates a toss of a coin and then tells… coming out as zero Ask the user for Heads or Tails INPUT guess Generate a random number less than 2 call… Re: Max Consecutive Heads/Tails Programming Software Development by anandarose … appreciated. Ananda [inlinecode] 'Ananda Bennett '10/11/2006 'Heads or tails program INPUT "How many times do you want to… is: " ;maxhcount PRINT "The maximum number of consecutive tails for " ; flipq; " coin flips is: " ;maxtcounta [/inlinecode… Help Programming a heads or tails game in python Programming Software Development by ITGeEk2020 … the game to ask the user to choose heads or tails, then a coin flips and chooses either one randomly. If… Re: Help Programming a heads or tails game in python Programming Software Development by vegaseat … rn for k in range(16): print rn.choice(['heads', 'tails']) [/code] Re: TAILS The Amnesic Incognito Live System Hardware and Software Linux and Unix by rubberman Sorry, but I'm not familiar with this distribution. Taking a bootable USB stick is not a bad idea. It should work fine in foreign internet cafes, but until you try you won't know for sure. Before you boot the thumb drive, do check with the cafe proprietors as to whether they can let you do this. There may be local/national regulations that will put… Re: TAILS The Amnesic Incognito Live System Hardware and Software Linux and Unix by cereal Aside note: when you go to an internet cafe here in Italy, bring an ID document with you: the operator has to register each user, this is requested by our legislation. For this reason, you cannot use your own laptop, nor your usb distribution: because in these cases the user has the power to fake the mac address, can scan the lan... and can make it… Re: heads or tails Programming Software Development by Aia If I am making heads or tails of what you're saying what you want it is called permutation. There's lots of algorithms out there for it. Use you favorite search engine. Re: Heads and Tails Game Programming Software Development by aree Thank you! you even made it better then what I originally planning to do!! thanks! Re: Max Consecutive Heads/Tails Programming Software Development by Salem This forum is for C and C++. What you've posted seems to be visual basic. Re: Max Consecutive Heads/Tails Programming Software Development by WaltP I agree. Are they really teaching LET for VB? Or is this another version of BASIC? Maybe best in [B]Legacy and Other Languages[/B] [code] DO WHILE count < flipq LET num=INT(RND(0)*2)+1 IF num = 1 THEN PRINT "T" 'LET count = count + 1 [COLOR=red]' put this before the IF[/COLOR] 'LET tcount = … Re: Max Consecutive Heads/Tails Programming Software Development by anandarose [QUOTE=WaltP;269637]I agree. Are they really teaching LET for VB? Or is this another version of BASIC? Maybe best in [B]Legacy and Other Languages[/B] .[/QUOTE]The software is called Liberty Basic. [url]Www.libertybasic.com[/url] Re: Max Consecutive Heads/Tails Programming Software Development by anandarose [QUOTE=WaltP;269637] [code] DO WHILE count < flipq LET num=INT(RND(0)*2)+1 IF num = 1 THEN PRINT "T" 'LET count = count + 1 [COLOR=red]' put this before the IF[/COLOR] 'LET tcount = tcount + 1 [COLOR=red]' uncomment this and duplicate it for heads[/COLOR] 'LET maxtcount = tcount… Re: Max Consecutive Heads/Tails Programming Software Development by anandarose THANK YOU SO MUCH FOR YOUR HELP! :cheesy: :mrgreen: :) :!: :confused: :lol: :p Re: Coin Toss Simulation, getting all Tails and one Heads Programming Software Development by John A Consider initializing your random number generator at the beginning of your program: [code]#include <ctime> srand(time(0));[/code] Your logic is totally weird here: [code] [COLOR=black]toss--;[/COLOR] [COLOR=black] counter++;[/COLOR] [COLOR=black] toss = rand() % 1;[/COLOR][/code] It's useless to deincrement toss when it gets assigned…