Search found 1812 matches

by Cosmologicon
Tue Jan 29, 2013 3:55 pm UTC
Forum: Coding
Topic: Coding: Hacks and Snippets
Replies: 434
Views: 776180

Re: Coding: Hacks and Snippets

While your example is not super practical, it is pretty handy to know that you can use other characters than /, especially if what you're replacing is slashes. I like pipes, they look like separators:

Code: Select all

s|\\|/|
is a bit easier to read than

Code: Select all

s/\\/\//
by Cosmologicon
Fri Nov 09, 2012 7:47 pm UTC
Forum: Logic Puzzles
Topic: A Monkey and a Typewriter
Replies: 66
Views: 23230

Re: A Monkey and a Typewriter

No, none of those are the intended answer. Leaving out blatantly important information (like that the train to B actually goes to A, or that the random distribution is something really weird) would be a pretty cheap trick, and that's not the case here. There's a normal, reasonable answer, that could...
by Cosmologicon
Sat Jul 21, 2012 6:43 pm UTC
Forum: Mathematics
Topic: "Oh no! We forgot how to say... math... stuff!"
Replies: 294
Views: 87652

Re: "Oh no! We forgot how to say... math... stuff!"

the recursion formula looks cleaner [compare Γ(n+1)=n*Γ(n) to (n+1)!=(n+1)*n!]. I can't speak to the overall question of Gamma vs Pi, but I don't like this. I don't want a formula for (n+1)!, I want a formula for n!, which is how it's usually defined . So the comparison you should be making is Γ(n)...
by Cosmologicon
Sun May 27, 2012 10:34 pm UTC
Forum: Mathematics
Topic: "Oh no! We forgot how to say... math... stuff!"
Replies: 294
Views: 87652

Re: "Oh no! We forgot how to say... math... stuff!"

It should be columns X rows in order to obey cartesian coordinates. ...With your way, it'd be a m x n matrix times a l x m matrix gives a l x n matrix, which seems kind of yucky to me.... and we have to put the k's on the outside and flip the i and j and ewww. So the choice of specifying rows first...
by Cosmologicon
Fri Apr 27, 2012 6:53 pm UTC
Forum: Coding
Topic: Programs that print their own source code
Replies: 100
Views: 24551

Re: Programs that print their own source code

We still doing this? Here's my python one-liner:

Code: Select all

print (u"*3)[46:-9].replace(chr(117),chr(117)+chr(34)) print (u"*3)[46:-9].replace(chr(117),chr(117)+chr(34))
by Cosmologicon
Wed Dec 07, 2011 10:18 pm UTC
Forum: Coding
Topic: The "IT DOESN'T WORK!" thread
Replies: 1958
Views: 513020

Re: The "IT DOESN'T WORK!" thread

Here's some of the code: def buttonSword(): global weaponDamage global weaponAmmo weaponDamage = 5 text.insert(END, "You have chosen a sword.\n") text.insert(END, "It can do up to " + str(weaponDamage) + " points of damage.\n") text.insert(END, "To change your wea...
by Cosmologicon
Wed Dec 07, 2011 10:16 pm UTC
Forum: Coding
Topic: The "IT DOESN'T WORK!" thread
Replies: 1958
Views: 513020

Re: The "IT DOESN'T WORK!" thread

The third example was what I was aiming for, just with.. well, mistakes in. The first way is the way I'd do it myself, but for some reason I've recently become very into qualifying imports in every language I'm using.. Let's be clear, the first and third examples are not quite doing the same thing....
by Cosmologicon
Wed Dec 07, 2011 10:00 pm UTC
Forum: Coding
Topic: The "IT DOESN'T WORK!" thread
Replies: 1958
Views: 513020

Re: The "IT DOESN'T WORK!" thread

If you're trying to access a global variable (let's say x), you'll need to include the line "global x" inside the function definition before you can change it. I believe you can read them without this call. I haven't used this with variables from another module, but based on what Evan's s...
by Cosmologicon
Mon Dec 05, 2011 7:55 pm UTC
Forum: Coding
Topic: The "IT DOESN'T WORK!" thread
Replies: 1958
Views: 513020

Re: The "IT DOESN'T WORK!" thread

Python doesn't have true global variables, only module-level variables. "Globals" defined in one module aren't visible in another. If module m defines a "global" v (just with something like v=10 outside of a function), then other modules that import m can refer to it via m.v , b...
by Cosmologicon
Fri Nov 04, 2011 1:37 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0973: "MTV Generation"
Replies: 101
Views: 21765

Re: 0973: "MTV Generation"

The real question is, how many of XKCD's core audience thinks of the "MTV generation" as referring to kids? That phrase has hardly been used in the past ten years. If you're under the age of 25, WHG's reaction isn't going to be a GOOMHR moment -- your reaction is going to be "huh?&qu...
by Cosmologicon
Tue Aug 30, 2011 12:49 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0944: "Hurricane Names"
Replies: 101
Views: 23437

Re: 0944: "Hurricane Names"

Cantor Diagonalization is used to show that would be impossible to define the location/name of an uncountable number of hurricanes. There is obviously no flaw in the argument itself, although it contradicts the physical definition of hurricane, whatever it is. See, I do not know what a hurricane is...
by Cosmologicon
Mon Aug 29, 2011 4:48 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0944: "Hurricane Names"
Replies: 101
Views: 23437

Re: 0944: "Hurricane Names"

See, I don't agree with the conclusion in the tool tip. Cantor diagonalization ensured that they would always have a new number for the next hurricane. Just reorder (one iteration of bogosort should do) the currently assigned numbers and diagonalize again. Implicit in your statement is the assumpti...
by Cosmologicon
Fri Aug 19, 2011 5:01 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9862
Views: 1762481

Re: Coding: Fleeting Thoughts

There are tons of example interview questions on the web. I would use those to look for gaps in your knowledge. I think the five areas in five essential phone-screen questions are a pretty good starting point. They are: coding, object-oriented design, scripting and regular expressions, data structur...
by Cosmologicon
Thu Aug 18, 2011 3:04 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0936: "Password Strength"
Replies: 893
Views: 284792

Re: 0936: "Password Strength"

google for "password manifesto" (can't post links yet). - Users should be able to temporarily or permanently disable accounts, removing all passwords from the remote server's database. whether that's because the user rarely comments, or because the user is paranoid, or because the user ga...
by Cosmologicon
Wed Aug 17, 2011 5:27 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9862
Views: 1762481

Re: Coding: Fleeting Thoughts

Try the Google Webfonts Directory if you want a bunch of free fonts to use on the web. I browsed through the first 100 or so fonts that came up and I didn't see a single one that rendered the → symbol. It showed up as a gray x. Is there some way to filter on fonts that support symbols like that? Or...
by Cosmologicon
Thu Aug 11, 2011 7:37 pm UTC
Forum: Coding
Topic: Feedback on my programming tutorial
Replies: 13
Views: 2260

Re: Feedback on my programming tutorial

Thanks again, all! Sorry for the wall of text, but I don't want to ignore the feedback! Does bc have any way to output text, manipulate text, or read from a file? Because if all it does is numbers, your target audience may have just changed to mathematicians who are beginning programmers. This is an...
by Cosmologicon
Thu Aug 11, 2011 1:53 am UTC
Forum: Individual XKCD Comic Threads
Topic: 0936: "Password Strength"
Replies: 893
Views: 284792

Re: 0936: "Password Strength"

You know, you kind of sound like a bully. Fine, I don't know how to calculate the number of bits of entropy. But now I'm going to learn. And now, one of the methods, to give you an idea: Three words. A digit of arbitrary length, put at any of the locations between the words (including the beginning...
by Cosmologicon
Wed Aug 10, 2011 10:24 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0936: "Password Strength"
Replies: 893
Views: 284792

Re: 0936: "Password Strength"

A co-worker has created an xkcd-compliant password generator: http://slid3r.com/passGen Enjoy. Not bad, but it kind of defeats the purpose if it uses words that are difficult to memorize (I got "composites vagaries oakum renovator"). Can it have an option to use a common/short word list? ...
by Cosmologicon
Wed Aug 10, 2011 9:51 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0936: "Password Strength"
Replies: 893
Views: 284792

Re: 0936: "Password Strength"

Anonymously Famous wrote:
If you really know what you're doing, not telling anyone your method is probably fine.

Then that's what I'll do.

Ah great, how many bits of entropy does your method give you?
by Cosmologicon
Wed Aug 10, 2011 8:42 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0936: "Password Strength"
Replies: 893
Views: 284792

Re: 0936: "Password Strength"

This is what I do when it comes to choosing my passwords (and be warned, it's really brilliant): I don't tell people the method(s) I use to choose my passwords. Ah.... security through obscurity. In short, no, it's not brilliant. Have you ever heard anyone who knows about security sugge...
by Cosmologicon
Wed Aug 10, 2011 7:02 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0936: "Password Strength"
Replies: 893
Views: 284792

Re: 0936: "Password Strength"

People in that post go on to clarify that that's only true if Facebook (or wherever) is hacked, the hacker is able to download the password file, *and* Facebook is using really bad password security. Also, as someone points out, making it 5 words instead of 4 would make kyz's claim no longer true. I...
by Cosmologicon
Wed Aug 10, 2011 3:32 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0936: "Password Strength"
Replies: 893
Views: 284792

Re: 0936: "Password Strength"

Wow, lots of good information in this thread, but I'm amazed at how many people don't understand password strength. The comic does it exactly right. Basically, the more possible passwords your password-generating algorithm can generate (assuming it generates them all with equal probability), the bet...
by Cosmologicon
Sun Aug 07, 2011 11:23 pm UTC
Forum: Coding
Topic: Feedback on my programming tutorial
Replies: 13
Views: 2260

Re: Feedback on my programming tutorial

Awesome, thanks for the feedback everyone! I really appreciate it! :) I probably should have anticipated that my language selection would be contentious. To be clear, python is my favorite language and I use it all the time, but I think that bc is more appropriate for this project, for the reasons g...
by Cosmologicon
Sat Aug 06, 2011 3:33 pm UTC
Forum: Coding
Topic: Feedback on my programming tutorial
Replies: 13
Views: 2260

Feedback on my programming tutorial

Hey I'm starting a teach-yourself-programming blog. I've written three lessons so far. I've got a lot more planned, but I figure I should stop and ask for feedback. I'm doing this because I've had three friends now who wanted to know what programming is about. I looked for programming tutorials onli...
by Cosmologicon
Fri Jul 22, 2011 11:11 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0918: "Google+"
Replies: 158
Views: 45820

Re: 0918: "Google+"

The idea behind disallowing pseudonyms seems to be cut down on harassing behavior. There's a sizable body of research now that suggests that people are far more likely to engage in harassing, trollish, and negative behavior if they're anonymous. I know some people don't care about that, but some peo...
by Cosmologicon
Mon Jul 11, 2011 9:43 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0923: "Strunk and White"
Replies: 94
Views: 23282

Re: 0923: "Strunk and White"

Yeah thanks, I read his comment. The fact is that Strunk & White in no way claim that those sentences use the passive voice. In the comment, Pullum comes up with an explanation of how he inferred that they did in fact suggest it. His logic is (IMHO) really shaky, especially where he suggests th...
by Cosmologicon
Mon Jul 11, 2011 9:12 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0923: "Strunk and White"
Replies: 94
Views: 23282

Re: 0923: "Strunk and White"

After reading Pullum's article, I thought surely I would have noticed if Strunk and White had misidentified a sentence as using the passive voice. It was going to drive me crazy until I could get home to check my copy. I'm glad your link explains that Pullum had just misread that section. Now I can...
by Cosmologicon
Mon Jul 11, 2011 4:08 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0923: "Strunk and White"
Replies: 94
Views: 23282

Re: 0923: "Strunk and White"

And a good refutation of Pullum's article refuting Stunk and White is here: http://mleddy.blogspot.com/2009/04/pullum-on-strunk-and-white.html Ah thanks for posting that. After reading Pullum's article, I thought surely I would have noticed if Strunk and White had misidentified a sentence as using ...
by Cosmologicon
Fri Jul 08, 2011 9:17 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0922: "Fight Club"
Replies: 124
Views: 22846

Re: 0922: "Fight Club"

Ooh, I really enjoy films with twist endings! Even if they're pretty bad movies otherwise! Here's the list of films with twist endings* we have so far, with my additions in italics: Fight Club, Sixth Sense, The Usual Suspects, Lucky Number Slevin, De grønne slagtere, Donnie Darko, Memento, The Book ...
by Cosmologicon
Fri Jul 08, 2011 3:16 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0922: "Fight Club"
Replies: 124
Views: 22846

Re: 0922: "Fight Club"

So, Randall, I’m really disappointed that a person with your intellect employs in ignorance. And on that level.I found that there are two kinds of people: • The passive beta ones, who gave up on even having a opinion and individuality of their own, who work for… • The active alpha ones, who rule th...
by Cosmologicon
Fri Jul 08, 2011 2:47 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0922: "Fight Club"
Replies: 124
Views: 22846

Re: 0922: "Fight Club"

I LIKE FIGHT CLUB BECAUSE IT DID NOT MAKE ME THINK. THE MOVIE IS EASY TO FOLLOW BECAUSE THERE IS ONLY THREE CHARACTERS.... OR MAYBE TWO I LOST COUNT. ALSO THEY REPEATED THE FIRST RULE BECAUSE I MISSED IT. I LIKE MOVIES THAT SHOW ONLY ONE SIDE OF AN ARGUMENT. THANK YOU FIGHT CLUB FOR NOT CHALLENGING ...
by Cosmologicon
Fri Jul 08, 2011 2:12 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9862
Views: 1762481

Re: Coding: Fleeting Thoughts

Yeah yeah I know, but they can have my overloaded modulo operator when they pry it from my cold, dead hands.

...which they probably will at some point.
by Cosmologicon
Thu Jul 07, 2011 8:42 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9862
Views: 1762481

Re: Coding: Fleeting Thoughts

Eeeeh, that's not terrible, but I think you're going overboard on the joins. Python does still let you do good, old-fashioned concatenation, you know. Here's how I might do it: def foo_bar_info2():    foo_information = 'Foos:' + ' '.join('(%s, %s)' % item for item in foos.items()) + '\n'    bar_info...
by Cosmologicon
Wed Jul 06, 2011 6:03 pm UTC
Forum: Coding
Topic: Command line challenges
Replies: 37
Views: 5281

Re: Command line challenges

Ah very nice. You used a lot of the same tricks as I did, but I think mine is even more of a horrible mess. rev isbn.txt | cat -n | cut -c6,8- | rev | fold -w1 | cat -nE | cut -c6- | fold -w1 | cat -E | paste -sd"* + " | tr "$\t" " " | fold -w120 | cut -b-115 | xargs -L...
by Cosmologicon
Wed Jun 29, 2011 9:13 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0918: "Google+"
Replies: 158
Views: 45820

Re: 0918: "Google+"

Come on, you really think that's true? Do you think that in the Apple and Microsoft headquarters people are relying on Google products, lest their company cease to function?
by Cosmologicon
Wed Jun 29, 2011 8:53 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0918: "Google+"
Replies: 158
Views: 45820

Re: 0918: "Google+"

Sure, some of those are great examples. I admit I forgot about Google Bookstore and Google Reader. Some are to a much more limited extent. Google Code is not an IDE (which is what I had in mind by "programming"), Fiber-Fi is in like one city, Youtube rentals is a far cry from Netflix. You ...
by Cosmologicon
Wed Jun 29, 2011 8:16 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0918: "Google+"
Replies: 158
Views: 45820

Re: 0918: "Google+"

It seems Google wants to have software/services for everything . Hell, what computer-related service isn't doable via Google programs and stuff, besides file conversion and music players? Online banking? Reading comics? Ordering books? Renting movies? Booking airline tickets? Playing video games? C...
by Cosmologicon
Wed Jun 29, 2011 4:51 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0918: "Google+"
Replies: 158
Views: 45820

Re: 0918: "Google+"

Pretty sure the first invite window is closed, so I don't think asking for an invite is going to do much good. Just FYI. Google vs Yahoo vs Bing: http://www.google.com/trends?q=google%2C+yahoo%2Cbing&ctab=0&geo=all&date=all&sort=0 Ah great.... it's good to see how many people are sea...
by Cosmologicon
Tue Jun 28, 2011 8:07 pm UTC
Forum: Coding
Topic: Command line challenges
Replies: 37
Views: 5281

Re: Command line challenges

Wow, very clever! 92 characters. Here's my simple 101-character solution, since I don't see any way to improve it by 10 characters:
Spoiler:

Code: Select all

s/M/DD/g;s/CD/+400/;s/D/+500/g;s/C/LL/g;s/XL/+40/;s/L/+50/g;s/X/VV/g;s/IV/+4/;s/V/+5/g;s/I/+1/g;s/.//
by Cosmologicon
Tue Jun 28, 2011 3:58 pm UTC
Forum: Coding
Topic: Command line challenges
Replies: 37
Views: 5281

Re: Command line challenges

Nice. Yours even does lowercase, which was not a requirement. :)

If I remove the ability to do lowercase from your first solution, I count 139 characters in the sed argument. I'm pretty sure I've got one that's 101 characters. I won't post it quite yet, though.

Go to advanced search