Today is my first day in this chat room and I have seen "cbg" at many places. Can someone please tell what does that mean? :/ The results that I got on Google are: :P
CBG Cannabigerol CBG Cinema Buying Group CBG Capillary Blood Glucose CBG Carrier Battle Group
And I am sure you guys are not discussing about medical terms over here ;)
@AndrasDeak: In fact it is my first time in any of the chat room. I was even not knowing that such rooms exist :( @BhargavRao: I am just curious, what are the consequences of breaking any of the rule of chat room?
@MoinuddinQuadri For a first offence we normally just explain what you've done wrong. But when someone repeatedly breaks the room rules we consider that disrespectful behaviour and the Room Owners (people whose names are in italics) will respond as they see fit.
also, @Moinuddin, since you're new to SO chat: 1. you can edit/delete your messages up to 2 minutes after posting; 2. you can reply to specific messages, like I did in my previous 2 messages; 3. if you post multiline code, ctrl+k will make it a code block that preserves indentation; 4. read the "faq" and "help" links in the lower right corner
Chat Room rules are mostly common sense & respectful behaviour. OTOH, a room may have rules that may seem arbitrary, and those rules need to be respected too. If any of our rules seem a bit weird, rest assured that they're there for a reason, but we're happy to explain the rationale if you're curious.
@BhargavRao @PM2Ring @AndrasDeak: Reading the rule book now. Don't want to unknowingly break the rule and kicked-out from here. I have zipped my hands for sometime :P
@AndrasDeak Yup. Everything mentioned there was common sense. And I don't think I would have ever broken them. But it is noce to know I am on right path ;)
> There seemed to be no reason why everyone couldn’t just use the same prime, and, in fact, many applications tend to use standardized or hard-coded primes.
ah, the age-old bottom line of security vulnerabilities
@IsabelCariod In a real program you'd have a function performing a useful task instead of dummy_task. But to explain the benefits of threading we just use dummy_task to waste some time in order to illustrate how threading works. Otherwise, the author of that code would have to make up some task that takes time to run, and that would distract from the main purpose of the demonstration.
@AndrasDeak well, for me at least this is some sort of good news -- I always had the theory, that intel and/or amd are installing backdoors in their processors. which means. it doesn't really matter how hard an algorithm tries to generate randoms, if that random is only pseudo one (a very good one ofc)
@PeterVaro The NSA doesn't have a monopoly on smart crypto people. And it's (generally) not that hard to test if a random number generator is as random as it's claimed to be: there are standard stats tests for that sort of thing.
have to make a cipher for social studies, so i'm writing a program so it can be encrypted without any work on my part. it's giving a few errors, though, would anyone mind looking at it?
If a "random" number comes out of an algorithm then it's pseudo-random. But for crypto purposes we make sure that our PRNG have a nice big period, and we seed them with enough entropy to ensure that their outputs are sufficiently unpredictable. OTOH, it gets a little tricky when you make restrictions on the range of the PRNG, eg when you want random primes.
@heather Well, as Andras said, it's pseudo-random. However, you can influence how random it is. By default, Python uses the Mersenne Twister PRNG, which is rather good, and much better than the simple Linear Congruential PRNGs that were standard a few decades ago. However, you can tell the random module to use other randomness sources. Take a look at the docs for class SystemRandom in the random module docs.
@PeterVaro os.urandom() is pretty good on typical systems because it gathers entropy from unpredictable hardware events, including timing info from input events. When you look at timestamps on key and mouse input events at microsecond (or better) resolution, you get a fair amount of entropy in the low order bits.
Also, we don't use "raw" entropy, we use a process called "whitening" to turn the raw entropy into a random bitstream with a "spectrum" approaching white noise. FWIW, one of the oldest known whitening algorithms was invented / discovered by Neumann János Lajos aka John von Neumann. :)
Exactly. :) Look, I'm not saying that what you're suggesting is impossible. Just that it'd be really hard to do it (IMHO) with any degree of success without it being detectable by people in the crypto community who go looking for that sort of thing. Of course, I'm not a crypto expert, so don't take my word for it. Do a search on the Crypto & Security Stack Exchange sites: the topic of various kinds of backdoors has been discussed there numerous times.
@JakeStokes Strings are immutable in Python. So when you want to "change" a string you need to create a new one instead. So the str.replacemethod can't change its argument. Instead it returns a new string that has the output you specify.
@Jake BTW, string is a bad choice for a variablename because it's the name of a standard module. In the early days of Python string used to contain all the string manipulation functions. But in modern Python they're now methods of the str type. So these days string mostly contains a bunch of useful string constants.
@PM2Ring, it only contains lower case letters, but I'd like it to not care whether the input letters compared against the list are lower or upper case, because I'm manipulating the index.
you know, i think i'm just going to input messages that are all lower case.
@KevinMGranger I often use s for a "throwaway" name that only exists over 2 or 3 lines. Otherwise, I try to use a more meaningful name. And let's face it, neither str nor string are particularly meaningful when it comes to naming a specific string (rather than a type or general string module). ;)
My main side project is implementing a network protocol, so I work with a lot of "throwaway" variables that refer to types. I guess I'm an exception :P
@heather I'll try to keep this simple. Your coding process turns each letter into a location number from 1 to 26. If you multiply location by either of the factors of 26 (2 or 13) and reduce the answer to the 1 to 26 range then you get collisions. Eg, 2*2 = 4 and 2 * 15 - 26 = 4. So when you try to decrypt the message you can't tell if that 4 was originally a 2 or a 15.
BTW, instead of doing while location > 26: location = location-26 you can do location = location % 26, or more compactly, location %= 26. The % operator is called "modulus".
@heather Modular arithmetic is a fascinating branch of number theory. The basics are pretty easy to understand. And the more advanced stuff can be used to make some of the most powerful forms of encryption currently known.
I really have to go. It's almost 3AM in my time zone & I've got a busy day of playing music tomorrow. Rhubarb!
But before I go... That location %= 26 won't do exactly the same as your loop because your location values run from 1 to 26. But it's simpler to make them run from 0 to 25, and then % will do what I said before. :)
Not many people are here. If you have a question you can post it and if anyone passing through can/wants to answer, they will. I'm in and out a lot, so don't know how useful I'll be
http://stackoverflow.com/questions/4131123/finding-the-most-frequent-character-in-a-string here how do i count total no. of frequent characters found ?
What is it about that answer that is giving you difficulty? It seems to have a few ways to do this in Python, including the most common way to do it, using Counter from the collections module.
Hey guys, got a short question.. Can you explain to me why my regexpression doesnt work? I need to use python 2.7.5... This is my expression: pattern = re.compile('\d{4};[a-zA-ZäöüÄÖÜß. -]+;.+') Im reading a csv file, till the first ;, there must be 4 digits, till the 2nd ; there must be letters from a-Z, umlauts and . or " " or . , then after the 2nd ; there can be any sign...
Now my problem: In the second "part" it doesnt accept umlauts like äöü or ß. In the third "part" where i dont specify the umlauts, its no problem when they occur... i didnt find any helpul answer yet..
@PeterVaro I don't think the measures are very good. For example, it usually takes more lines to write something in java than it does in python. So by one axis (number of lines changed on github) it will make java seem more "popular"
and I only looked at a few, which were linked here
when my original solution went overboard with memory I thought that the only viable approach was with generators (rather than trying to reduce the memory footprint of my existing approach)
so now the only thing that is stored in a list is the separator bit sequence which I couldn't mathematically figure out in 15 minutes so I just stored it
so far my solutions have run fast enough that I haven't worried about efficiency. My slowest was prior to this Day 5 one was about 10 secs, including unit tests.
Day 5 runs about 1:40 total with 43s for unit tests. So just less than 1 min for both solutions.
This problem will be the end of me. Can someone spot why when planet_Orbit(MERCURY) is not commented out JUPITER orbits, but when it is, JUPITER does not orbit and simply stays in the center of the screen without any shading?