Two Plus Two Poker Forums Programming homework and newbie help thread
 Register FAQ Search Today's Posts Mark Forums Read TwoPlusTwo.com

 Notices The Theory of Poker Applied to No-Limit now available For those of you here in Las Vegas, The Theory of Poker Applied to No-Limit by David Sklansky is now available at Gambler’s General Store/ GAMBLER'S BOOK CLUB in downtown Las Vegas. Their address is 727 S Main St, Las Vegas, NV 89101 and their phone number is (702) 382-9903. We also have this title available in several special poker book promotions directly from Two Plus Two Publishing. For more info or to ask questions check out this thread in the books and publications forum: David Sklansky Answers Questions About The Theory of Poker Applied to No Limit.

 01-30-2015, 11:45 PM #251 catsec centurion     Join Date: Apr 2014 Location: hunting shells Posts: 178 Re: Programming homework and newbie help thread ChrisV, daveT, and adios Sorry for the delay in replying, I've been quite busy. Thank you all for the help, it is really appreciated! ChrisV, it was I that screwed up the cipher text! I decrypted the original cipher text and saw that it had information about my university that I didn't want to post, so I replaced it. I think my efforts go to show that computers > humans when it comes to encrypting messages. Cheers!
01-31-2015, 12:11 AM   #252
catsec
centurion

Join Date: Apr 2014
Location: hunting shells
Posts: 178
Re: Programming homework and newbie help thread

Quote:
 Originally Posted by daveT (to get the same result as ChrisV, you need to enter 23).

daveT,

That's interesting and strange. I don't understand why 23 is the value to successfully decrypt the cipher text instead of 3. How would I modify it to make it so a shift value of 3 successfully decrypts? I'm required to have 3 be the decrypting shift value.

Also, the assignment was originally instructed to be done in Java, and in the example my professor went over converting to ASCII in Java, but he also said we could use Python. I've tried running this code in Python3 after fixing the print syntax at the bottom and it fails with this error message. Any ideas?

Code:
```cipherText = "FRQJUDWXODWLRKVBRXKDYHGHFOBSWHGWKHPHVVDJH"
shiftValue = input("Please enter an integer shift value from 1 to 26: ")

result = ""
for char in cipherText:
result = result + chr(((ord(char) - 65 - shiftValue) % 26) + 65)
print(result)```
Quote:
 Traceback (most recent call last): File "C:\Users\IDC\Documents\Cryptography\CasesarCipher \TestFile.py", line 6, in result = result + chr(((ord(char) - 65 - shiftValue) % 26) + 65) TypeError: unsupported operand type(s) for -: 'int' and 'str'

I have no idea what this means. And as an aside, I don't even want to ask what endianness is. I'm astounded at how easy some of you make programming look. It's tough in my opinion.

 01-31-2015, 12:36 AM #253 daveT S.A.G.E. Master     Join Date: Jun 2005 Location: La La Land Posts: 23,159 Re: Programming homework and newbie help thread catsec, you should consider using a pencil and paper when you don't understand how an algorithm works. Stepping through it leads to understanding. The error you are receiving is pretty straight-forward. You are trying to subtract an integer and a string, which even Python won't let you do. Endianess isn't too mysterious. It is how the computer "reads" byte-code, reading either left-to-right or right-to-left.
 01-31-2015, 11:43 AM #254 adios Carpal \'Tunnel   Join Date: Sep 2002 Location: Russian Troll Posts: 21,497 Re: Programming homework and newbie help thread Endianness You will seldom have to be concerned about this. Perhaps when processing byte streams from an external source.
 02-05-2015, 07:44 AM #255 deleted23567 Guest   Posts: n/a Re: Programming homework and newbie help thread I have a problem in Visual Studio / C#: We're working on building a movie Collection program, and I built a window, but something was wrong with the compability between it and the other stuff we'd built, so a group member told me to delete the repo-folder (my documents/source/repo) which I did, and cloned the repository we all share in VS... However now I can't run the thing and I get this error: "Visual Studio cannot start debugging because the debug target 'C:\Users\MyName\Source\Repos\GroupName\WindowsFor mApplication1\WindowsFormsApplication1\bin\Debug\F ilmApplication.exe' is missing. Please build the Project and retry, or set the OutputPath and AssemblyName properties appropriately to Point at the correct location for the target assembly" I checked the Output path, and it's the same as for the others,\bin\debug\ Does anyone know how I can fix this, extremely irritating problem? Thanks in advance, nejo
02-05-2015, 07:51 AM   #256
deleted23567
Guest

Posts: n/a
Re: Programming homework and newbie help thread

Quote:
 Originally Posted by nejo I have a problem in Visual Studio / C#: We're working on building a movie Collection program, and I built a window, but something was wrong with the compability between it and the other stuff we'd built, so a group member told me to delete the repo-folder (my documents/source/repo) which I did, and cloned the repository we all share in VS... However now I can't run the thing and I get this error: "Visual Studio cannot start debugging because the debug target 'C:\Users\MyName\Source\Repos\GroupName\WindowsFor mApplication1\WindowsFormsApplication1\bin\Debug\F ilmApplication.exe' is missing. Please build the Project and retry, or set the OutputPath and AssemblyName properties appropriately to Point at the correct location for the target assembly" I checked the Output path, and it's the same as for the others,\bin\debug\ Does anyone know how I can fix this, extremely irritating problem? Thanks in advance, nejo
Solved. The problem was that there was an error in the code, and that prevented the program from running and creating an .exe-file. I just put /* */ around the problem-code and was able to run the program.

 02-05-2015, 08:24 AM #257 catsec centurion     Join Date: Apr 2014 Location: hunting shells Posts: 178 Re: Programming homework and newbie help thread Hi all, I think I just realized something and wanted to make sure I was correct. Am I correct in that a python program cannot possibly be closed source, as it is not compiled? Like for languages that must be compiled, when they are compiled into binary executable, you cannot read the source code without reverse engineering, and so such programs can be closed source if the producers choose to not publish the source code. This is not the case with python, so you cannot close source a python program. Am I correct?
 02-05-2015, 09:02 AM #258 ChrisV Carpal \'Tunnel     Join Date: Jul 2004 Location: Adelaide, Australia Posts: 40,283 Re: Programming homework and newbie help thread No. For instance, a python program can be executed via a webservice.
 02-05-2015, 02:25 PM #259 Mr.mmmKay Drugs are bad...     Join Date: May 2011 Location: Treat your womenfolk with care Posts: 16,216 Re: Programming homework and newbie help thread and there are packages which can turn your code into an executable binary
 02-05-2015, 10:22 PM #260 daveT S.A.G.E. Master     Join Date: Jun 2005 Location: La La Land Posts: 23,159 Re: Programming homework and newbie help thread You can compile python to .pyc files, which certainly aren't human readable.
 02-06-2015, 01:55 AM #261 catsec centurion     Join Date: Apr 2014 Location: hunting shells Posts: 178 Re: Programming homework and newbie help thread Rats! Even though I knew those things, I failed to consider them. Thanks all!
 02-06-2015, 12:27 PM #262 Alobar Born Ready     Join Date: Nov 2003 Location: 3rd turtle from the bottom Posts: 41,296 Re: Programming homework and newbie help thread I thought you could decompile most languages back to their original code? At least in the case of Java and Python, which is why on android for instance (which is written in java) your code is run through a program that obfuscates it, which while not making it impossible to get the original code, makes it harder. I also thought Python was supposed to be relatively easy to reverse engineer? Is that not correct, or am I totally misunderstanding what you guys mean
 02-06-2015, 11:15 PM #263 daveT S.A.G.E. Master     Join Date: Jun 2005 Location: La La Land Posts: 23,159 Re: Programming homework and newbie help thread A .jar file is really a .zip file. You can "decompile" a .jar file using 7zip, which gives you clean source and folder tree back. It seems kind of a given that if you can compile to something, you can decompile. first hit for "decompile python" http://stackoverflow.com/questions/8...python-2-7-pyc
02-07-2015, 01:19 AM   #264
Carpal \'Tunnel

Join Date: Sep 2002
Location: Russian Troll
Posts: 21,497
Re: Programming homework and newbie help thread

Quote:
 Originally Posted by daveT A .jar file is really a .zip file. You can "decompile" a .jar file using 7zip, which gives you clean source and folder tree back. It seems kind of a given that if you can compile to something, you can decompile. first hit for "decompile python" http://stackoverflow.com/questions/8...python-2-7-pyc
I have my doubts about optimized C and C++ code.

 02-08-2015, 12:15 PM #265 sthief09 Josh.   Join Date: Feb 2004 Posts: 20,654 Re: Programming homework and newbie help thread highly recommend going through this if anyone is interested in data analysis/manipulation: https://www.youtube.com/watch?v=w26x-z-BdWQ
02-11-2015, 06:01 AM   #266
TheHoss
journeyman

Join Date: Jul 2005
Posts: 313
Re: Programming homework and newbie help thread

following a quick guide to get acquainted with Powershell, and for some reason i can't get the "less" and "more" commands to work (using Windows 7).

i save a text file (ex13.txt) to C:\Users\Myname\temp\

type "less ex13.txt" but get the error

Quote:
 The term 'less' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelli ng of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:5 + less <<<< ex13.txt + CategoryInfo : ObjectNotFound: (less:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
well, idk what that's all about :S i tried it both as empty text file and with some words although i think that shouldn't matter.

02-11-2015, 09:34 AM   #267
Carpal \'Tunnel

Join Date: Sep 2002
Location: Russian Troll
Posts: 21,497
Re: Programming homework and newbie help thread

Quote:
 Originally Posted by TheHoss following a quick guide to get acquainted with Powershell, and for some reason i can't get the "less" and "more" commands to work (using Windows 7). i save a text file (ex13.txt) to C:\Users\Myname\temp\ type "less ex13.txt" but get the error well, idk what that's all about :S i tried it both as empty text file and with some words although i think that shouldn't matter.
Not a Powershell expert. Looked at your guide and it appears that it lists Unix commands that are implemented with Powershell aliases. I'm guessing that less doesn't have a Powershell alias.

 02-11-2015, 12:00 PM #268 Alobar Born Ready     Join Date: Nov 2003 Location: 3rd turtle from the bottom Posts: 41,296 Re: Programming homework and newbie help thread less and more work in powershell. That said I have no idea why you are getting that error.
 02-11-2015, 03:01 PM #269 CyberShark93 veteran     Join Date: Dec 2013 Location: strangling the golden goose Posts: 3,226 Re: Programming homework and newbie help thread hi, i'm supposed to do this in python a).Write a function that takes input a,b,c and finds the solution to a^x=b(mod c) b). use the function u wrote in part a to solve 34091202317940^x = 46461034929471 (mod 61704897745301) i tried just doing it iteratively by simply doing accumulator*a n times until accumulator = b(mod c) then returning n, however this function overflows for part b, since the numbers are just too big, so i was wondering is there a smarter way to do this?(perhaps some theorem that i need to use?)
02-11-2015, 09:19 PM   #270
Carpal \'Tunnel

Join Date: Sep 2002
Location: Russian Troll
Posts: 21,497
Re: Programming homework and newbie help thread

Quote:
 Originally Posted by CyberShark93 hi, i'm supposed to do this in python a).Write a function that takes input a,b,c and finds the solution to a^x=b(mod c) b). use the function u wrote in part a to solve 34091202317940^x = 46461034929471 (mod 61704897745301) i tried just doing it iteratively by simply doing accumulator*a n times until accumulator = b(mod c) then returning n, however this function overflows for part b, since the numbers are just too big, so i was wondering is there a smarter way to do this?(perhaps some theorem that i need to use?)
I assume you are Python 2.7. The number is greater than 32 bits. Not an expert on Python, just a guess. If so start from there.

02-11-2015, 09:39 PM   #271
CyberShark93
veteran

Join Date: Dec 2013
Location: strangling the golden goose
Posts: 3,226
Re: Programming homework and newbie help thread

Quote:
 Originally Posted by adios I assume you are Python 2.7. The number is greater than 32 bits. Not an expert on Python, just a guess. If so start from there.
i managed to solve the overflow problem, but i found out that doing it iteratively is simply too slow for large inputs, i was wondering if there is a way where i can be clever and skip over a lot of cases where i don't need to test?

02-11-2015, 10:08 PM   #272
econophile
Carpal \'Tunnel

Join Date: Jul 2005
Location: (X'X)^(-1)X'Y
Posts: 11,319
Re: Programming homework and newbie help thread

Quote:
 Originally Posted by CyberShark93 hi, i'm supposed to do this in python a).Write a function that takes input a,b,c and finds the solution to a^x=b(mod c) b). use the function u wrote in part a to solve 34091202317940^x = 46461034929471 (mod 61704897745301) i tried just doing it iteratively by simply doing accumulator*a n times until accumulator = b(mod c) then returning n, however this function overflows for part b, since the numbers are just too big, so i was wondering is there a smarter way to do this?(perhaps some theorem that i need to use?)
have you tried taking logs of both sides?

02-11-2015, 10:39 PM   #273
CyberShark93
veteran

Join Date: Dec 2013
Location: strangling the golden goose
Posts: 3,226
Re: Programming homework and newbie help thread

Quote:
 Originally Posted by econophile have you tried taking logs of both sides?
i think we require integer solutions to the congruence a^x = b (mod c)
taking log will give us the solution to a^x=b, however x is not necessarily an integer in that case

 02-11-2015, 10:44 PM #274 Alobar Born Ready     Join Date: Nov 2003 Location: 3rd turtle from the bottom Posts: 41,296 Re: Programming homework and newbie help thread I think I remember a project euler problem like this, sadly Id learn how to do something like this and now I completely forget all the number theory stuff I learned to do them
02-12-2015, 12:35 AM   #275
daveT
S.A.G.E. Master

Join Date: Jun 2005
Location: La La Land
Posts: 23,159
Re: Programming homework and newbie help thread

Quote:
 Originally Posted by CyberShark93 i managed to solve the overflow problem, but i found out that doing it iteratively is simply too slow for large inputs, i was wondering if there is a way where i can be clever and skip over a lot of cases where i don't need to test?
You could probably use successive approximation.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Links to Popular Forums     News, Views, and Gossip     Beginners Questions     Marketplace & Staking     Casino & Cardroom Poker     Internet Poker     NL Strategy Forums     Poker Goals & Challenges     Las Vegas Lifestyle     Sporting Events     Other Other Topics Two Plus Two     About the Forums     Two Plus Two Magazine Forum     The Best of Two Plus Two Marketplace & Staking     Commercial Marketplace     General Marketplace     Staking - Offering Stakes     Staking         Staking - Offering Stakes         Staking - Seeking Stakes         Staking - Selling Shares - Online         Staking - Selling Shares - Live         Staking Rails         Transaction Feedback & Disputes     Transaction Feedback & Disputes Coaching & Training     Coaching Advice     Cash Game Poker Coach Listings     Tournament/SNG Poker Coach Listings Poker News & Discussion     News, Views, and Gossip     Poker Goals & Challenges     Poker Beats, Brags, and Variance     That's What She Said!     Poker Legislation & PPA Discussion hosted by Rich Muny     Twitch - Watch and Discuss Live Online Poker     Televised Poker General Poker Strategy     Beginners Questions     Books and Publications     Poker Tells/Behavior, hosted by: Zachary Elwood     Poker Theory     Psychology No Limit Hold'em Strategy     Medium-High Stakes PL/NL     Micro-Small Stakes PL/NL     Medium-High Stakes Full Ring     Micro-Small Stakes Full Ring     Heads Up NL     Live Low-stakes NL Limit Texas Hold'em Strategy     Mid-High Stakes Limit     Micro-Small Stakes Limit Tournament Poker Strategy     STT Strategy     Heads Up SNG and Spin and Gos     Mid-High Stakes MTT     Small Stakes MTT     MTT Community     Tournament Events Other Poker Strategy     High Stakes PL Omaha     Small Stakes PL Omaha     Omaha/8     Stud     Draw and Other Poker Live Poker     Casino & Cardroom Poker         Venues & Communities         Regional Communities     Venues & Communities     Tournament Events         WPT.com     Home Poker     Cash Strategy     Tournament Strategy Internet Poker     Internet Poker         Global Poker         MPN – Microgaming Poker Network         BetOnline.ag Online Poker     Commercial Software     Software         Commercial Software         Free Software General Gambling     Backgammon Forum hosted by Bill Robertie.     Probability     Sports Betting     Other Gambling Games 2+2 Communities     Other Other Topics         OOTV         Game of Thrones     The Lounge: Discussion+Review     EDF     Las Vegas Lifestyle     BBV4Life         omg omg omg     House of Blogs Sports and Games     Sporting Events         Single-Team Season Threads         Fantasy Sports     Fantasy Sports         Sporting Events     Wrestling     Golf     Chess and Other Board Games     Video Games         League of Legends         Hearthstone     Puzzles and Other Games Other Topics     Politics and Society     Playground: Well Named Loves Social Science     History     Business, Finance, and Investing     Science, Math, and Philosophy     Religion, God, and Theology     Travel     Health and Fitness     Laughs or Links!     Computer Technical Help     Programming

All times are GMT -4. The time now is 01:59 AM.

 Contact Us - Two Plus Two Publishing LLC - Privacy Statement - Top