Search found 42 matches

by shawnhcorey
Tue May 08, 2012 12:35 pm UTC
Forum: General
Topic: Lucky Ten Thousand (TIL)
Replies: 13416
Views: 1664313

Re: Today I Learned

TIL what paracosm means.
by shawnhcorey
Sat May 05, 2012 12:43 pm UTC
Forum: Computer Science
Topic: Minimising the Number of Multiplications
Replies: 6
Views: 11180

Re: Minimising the Number of Multiplications

It seems to me that all you need do is modify the find-all-subsets routine to create, store and reuse the partial products as the subset is being generated. Not that hard. Since finding all subsets is a NP problem, this would be too.
by shawnhcorey
Wed May 02, 2012 12:25 am UTC
Forum: General
Topic: Lucky Ten Thousand (TIL)
Replies: 13416
Views: 1664313

Re: Today I Learned

That would be 130,000,000,000 galaxies of a minimum of 1,000,000,000 stars. Or 130,000,000,000,000,000,000 stars. It may just be possible that there is life elsewhere in our universe.
by shawnhcorey
Tue Apr 17, 2012 7:18 pm UTC
Forum: General
Topic: Lucky Ten Thousand (TIL)
Replies: 13416
Views: 1664313

Re: Today I Learned

I know this is a page late... but that was Epimethius, not Prometheus. Epimethius was Prometheus' much dumber brother who never thought things through. fun creation myth there too. Ah, good to know. Also it turns out it wasn't a box at all--it was a jar. Mistranslations! Wasn't it an amphora jar, t...
by shawnhcorey
Sun Apr 15, 2012 9:49 pm UTC
Forum: General
Topic: Lucky Ten Thousand (TIL)
Replies: 13416
Views: 1664313

Re: Today I Learned

Ephemeron wrote:Also, they are making a quantum internet, and a robot that can climb stairs. We're in the future, man.


Not until I get my flying car!
by shawnhcorey
Wed Apr 11, 2012 3:16 pm UTC
Forum: General
Topic: Lucky Ten Thousand (TIL)
Replies: 13416
Views: 1664313

Re: Today I Learned

emceng wrote:I recently learned that Teddy Roosevelt was pretty much a racist asshole. I'm also gradually learning that pretty much everyone is a dick.


Yeah, you can find a reason to hate anyone if you look long enough. ;)
by shawnhcorey
Sun Apr 08, 2012 1:14 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9955
Views: 1931967

Re: Coding: Fleeting Thoughts

Well, the reason they use LPstruct names is because of the strange pointer notation in C. To declare two stings in C:

Code: Select all

char *s1, *s2;


The pointer symbol, '*', needs to be entered twice. But with LP notation:

Code: Select all

LPSTRING s1, s2;
by shawnhcorey
Mon Apr 02, 2012 12:58 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9955
Views: 1931967

Re: Coding: Fleeting Thoughts

b.i.o wrote:There is a special hell waiting for people who center-align body text. Even on April 1st.


Yes, it's a round room with a wrap-around screen. Center that, you poor souls!
by shawnhcorey
Tue Mar 27, 2012 11:33 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9955
Views: 1931967

Re: Coding: Fleeting Thoughts

And it, no doubt, worked with binary real numbers rather than decimal real numbers (like a calculator). Let's face it: some of the things program-language designers did was strange.
by shawnhcorey
Tue Mar 27, 2012 1:14 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9955
Views: 1931967

Re: Coding: Fleeting Thoughts

One of its quirky features was that it used "calculator precedence" for arithmetic, ie operators were evaluated in strict left to right order with no precedence, apart from that dictated by parentheses. It was annoying at first, but you soon got used to it. HP calculators have post-fix no...
by shawnhcorey
Tue Mar 27, 2012 12:15 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9955
Views: 1931967

Re: Coding: Fleeting Thoughts

Alternatively, just write 1.0/2.0 (or if you're hardcoding it, 0.5) and be done with it. The problem comes when using variables: x = ( a + 0.0 ) / b; Programmers have to remember that integer division is not real division. And the more a programmer has to remember, the greater the chances of a bug....
by shawnhcorey
Tue Mar 27, 2012 12:25 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9955
Views: 1931967

Re: Coding: Fleeting Thoughts

Python 3 has 'correct' division by default, instead of integer division. Your argument is invalid as soon as Python 3 hits the main stream :) Which will be a while. Many OSes are keeping v2 since it's backward compatible with all the old Python code. We still have COBOL hanging around for the same ...
by shawnhcorey
Mon Mar 26, 2012 10:59 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9955
Views: 1931967

Re: Coding: Fleeting Thoughts

I honestly want to know though - what makes you think Perl is better than Ruby or Python? Perl is the only one that can do arithmetic right: $ python Python 2.7.2+ (default, Oct 4 2011, 20:06:09) [GCC 4.6.1] on linux2 Type "help", "copyright", "credits" or "licens...
by shawnhcorey
Mon Mar 26, 2012 10:33 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9955
Views: 1931967

Re: Coding: Fleeting Thoughts

shawnhcorey wrote: EvanED wrote: Also, I'm with people who think that in a world with today's Python, Perl serves very little purpose and wish that no new code was written in it. (Of course, I also think that about C, with partial exceptions for actual embedded systems, so take that with a grain of...
by shawnhcorey
Fri Mar 23, 2012 12:12 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9955
Views: 1931967

Re: Coding: Fleeting Thoughts

I can also imagine there are some modifiers (like /abc/b i to match "abc" but insensitively -- I don't actually know if this is how Perl does it, but I think I've seen it) which also have to be translated as well. E.g. in Python you'd have to pass some CASE_INSENSITIVE constant to the re ...
by shawnhcorey
Fri Mar 23, 2012 11:52 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9955
Views: 1931967

Re: Coding: Fleeting Thoughts

Coding, is it worth mastering Perl? I'm currently reading Mastering Regular Expressions and the author is kinda pushing Perl but I'm not sure, seems kinda antiquated. Perl's regular expressions are the most powerful around. In fact, both Python and Ruby uses Perl's regular expression engine. You sh...
by shawnhcorey
Tue Mar 20, 2012 6:21 pm UTC
Forum: Coding
Topic: My code has an English accent!
Replies: 15
Views: 5350

Re: My code has an English accent!

Steax wrote:My high school computer instructor taught us to use comic sans for all programming needs.


And what's wrong with Dingbats? Some teachers just don't keep up with the times.
by shawnhcorey
Mon Mar 19, 2012 2:53 pm UTC
Forum: Coding
Topic: Do you like documentation in code, and if so, how/when?
Replies: 44
Views: 7553

Re: Do you like documentation in code, and if so, how/when?

I always document the interfaces to my code but rarely document the code itself. TO paraphrase Fred Brooks, "Show me your code and conceal your APIs, and I shall continue to be mystified. Show me your APIs, and I won't usually need your code; it'll be obvious."
by shawnhcorey
Mon Mar 19, 2012 1:42 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9955
Views: 1931967

Re: Coding: Fleeting Thoughts

On top of that, ".." is really a construct of your shell and not of the file system (hard links allow a directory to exist in two places at once). I actually have the impression that the . and .. are real hard links to directories, and are the only exceptions that are allowed. Can't remem...
by shawnhcorey
Tue Feb 28, 2012 1:39 pm UTC
Forum: General
Topic: Lucky Ten Thousand (TIL)
Replies: 13416
Views: 1664313

Re: Today I Learned

Today I learned that privilege makes you a dick.
by shawnhcorey
Fri Feb 24, 2012 8:08 pm UTC
Forum: Computer Science
Topic: Encapsulation & Exceptions
Replies: 20
Views: 6828

Re: Encapsulation & Exceptions

Well, I worked under both MIL STD 2167 and ISO 9000 and from personal experience I can say that making documentation mandatory does not improve the code. It also doesn't improve the documentation. And yes, I was thinking of making the exception handling part of the class API, and therefore, mandatory.
by shawnhcorey
Fri Feb 24, 2012 6:08 pm UTC
Forum: Computer Science
Topic: Encapsulation & Exceptions
Replies: 20
Views: 6828

Re: Encapsulation & Exceptions

@Jplus: You're thinking that A, B, and X are all written by the same programmer at the same time. What if X is written first, a year later B, and two years after that A, all by different programmers. For A to correctly handle X's exceptions, the programmer would have to know about B's use of X. In o...
by shawnhcorey
Fri Feb 24, 2012 4:20 pm UTC
Forum: Computer Science
Topic: Encapsulation & Exceptions
Replies: 20
Views: 6828

Re: Encapsulation & Exceptions

@freakish777: The one advantage I can see to this approach is if you wanted more than one object to respond to an exception but an additional problem is that objects have to unregister with the dispatcher. Since programmers are notoriously lazy, this would almost guarantee that in a medium-sized pro...
by shawnhcorey
Fri Feb 24, 2012 3:24 pm UTC
Forum: Computer Science
Topic: Encapsulation & Exceptions
Replies: 20
Views: 6828

Re: Encapsulation & Exceptions

A concrete example: A is some program that has to process images. B is an image-processing library. X is a file-handling library. A needs to load an image, but the file doesn't exist. It says "load this image" to B, and then B says "open this file" to X. X throws a file-not-foun...
by shawnhcorey
Fri Feb 24, 2012 12:16 am UTC
Forum: Computer Science
Topic: Encapsulation & Exceptions
Replies: 20
Views: 6828

Re: Encapsulation & Exceptions

Exceptions would no longer be global; they would be part of each class API. B can't re-throw X's exceptions. The best it can do is copy all the data from X's exception into its own and throw that. If, for example, you were to rewrite B so that it no longer uses X, you would remove the exception from...
by shawnhcorey
Thu Feb 23, 2012 10:30 pm UTC
Forum: Computer Science
Topic: Encapsulation & Exceptions
Replies: 20
Views: 6828

Re: Encapsulation & Exceptions

I was thinking of getting around all those try-catches with a change in syntax:

Code: Select all

log is a File:
   mode is append,
   path is "./log.txt",
   when permission denied:
      throw permission denied,
   when could not create:
      die "cannot log actions",
by shawnhcorey
Thu Feb 23, 2012 4:47 pm UTC
Forum: Computer Science
Topic: Encapsulation & Exceptions
Replies: 20
Views: 6828

Encapsulation & Exceptions

I'm design a OO language and I was happily going along until I hit exceptions. Then I realized that most exception schemes involved violating encapsulation. For example: if the was a class A which has an object of class B which, in turn, has an object of class X. If X throws an exception, which B ig...
by shawnhcorey
Thu Feb 16, 2012 4:51 pm UTC
Forum: General
Topic: Lucky Ten Thousand (TIL)
Replies: 13416
Views: 1664313

Re: Today I Learned

TimelordSimone wrote:
Plasma Man wrote:Venomous things might be safe to eat. Poisonous things definitely aren't.

Exactly! I totally thought they were basically synonyms.


Still, I think I'll avoid both. :)
by shawnhcorey
Wed Feb 15, 2012 4:28 pm UTC
Forum: General
Topic: Lucky Ten Thousand (TIL)
Replies: 13416
Views: 1664313

Re: Today I Learned

I learned that Mutual Aid, not fierce competition, is the most prevalent force in evolution.
by shawnhcorey
Sun Jan 15, 2012 2:49 am UTC
Forum: Coding
Topic: Some good projects to familiarize yourself with a language?
Replies: 4
Views: 2499

Re: Some good projects to familiarize yourself with a langua

Project Euler offers some interesting problems. And by interesting, I mean in the Chinese proverb way; they are not easy to solve. :)
by shawnhcorey
Thu Jan 12, 2012 5:39 pm UTC
Forum: Science
Topic: Science needs a symbol
Replies: 83
Views: 12778

Re: Science needs a symbol

If science is a movement, then our education system really sucks.
by shawnhcorey
Wed Jan 11, 2012 8:21 pm UTC
Forum: Science
Topic: Miscellaneous Science Questions
Replies: 2927
Views: 693410

Re: RELATIVITY QUESTIONS! (and other common queries)

The intersection of the saddle with the planes that bisect the saddle ("planes of principle curvatures" in the diagram linked) are a hyperbola and a parabola. If you visualize these, you should be able to see how they don't "wrap around". Remember your conic sections if you need...
by shawnhcorey
Wed Jan 11, 2012 3:56 pm UTC
Forum: Science
Topic: Miscellaneous Science Questions
Replies: 2927
Views: 693410

Re: RELATIVITY QUESTIONS! (and other common queries)

2D surfaces have 4 possibilities: ⋅ ++ (positive curvature) ⋅ +- (negative curvature) ⋅ -+ (negative curvature) ⋅ -- (positive curvature) 3D surfaces have 8 possibilities: ⋅ +++ (positive curvature) ⋅ ++- (negative curvature) ⋅ +-...
by shawnhcorey
Wed Jan 11, 2012 2:10 pm UTC
Forum: Science
Topic: Miscellaneous Science Questions
Replies: 2927
Views: 693410

Re: RELATIVITY QUESTIONS! (and other common queries)

Okay, positive is a sphere, and zero is flat, those two work. The one that I've never understood is negative curvature. If I follow my intuition, it tells me that making the curvature negative should just fold the universe back into a sphere, only this time one with us on the inside. But to us, it ...
by shawnhcorey
Wed Jan 11, 2012 1:46 am UTC
Forum: Computer Science
Topic: Mind Blowing Algorithms
Replies: 76
Views: 28543

Re: Mind Blowing Algorithms

letterX wrote:Why are your comments helpful?


Documentation is like sex: when it's good, it's very, very good; and when it's bad, it's still better than nothing.
-- Dick Brandon
by shawnhcorey
Tue Jan 10, 2012 1:31 pm UTC
Forum: Computer Science
Topic: Mind Blowing Algorithms
Replies: 76
Views: 28543

Re: Mind Blowing Algorithms

I'm sorry, I have to ask: can you think of a *more* obvious and straightforward way to count the number of bits in a int than the one you quoted? Because personally, I would find *that* amazing. while( a > 0 ){ /* add one if a is odd, add zero otherwise */ b += ( a & 1 ); /* divide a by 2 */ a ...
by shawnhcorey
Tue Jan 10, 2012 2:43 am UTC
Forum: Science
Topic: Science needs a symbol
Replies: 83
Views: 12778

Re: Science needs a symbol

Placing E=mc^2 as a universal symbol for science doesn't sit with me. Sure, the public recognizes it, but it takes away focus from scientists other than Einstein, I mean, all contributes to science are important, and without the previous ones we wouldn't make new. It should be something that honors...
by shawnhcorey
Mon Jan 09, 2012 9:14 pm UTC
Forum: Computer Science
Topic: Mind Blowing Algorithms
Replies: 76
Views: 28543

Re: Mind Blowing Algorithms

I'm sorry, I have to ask: can you think of a *more* obvious and straightforward way to count the number of bits in a int than the one you quoted? Because personally, I would find *that* amazing. while( a > 0 ){ /* add one if a is odd, add zero otherwise */ b += ( a & 1 ); /* divide a by 2 */ a ...
by shawnhcorey
Mon Jan 09, 2012 7:02 pm UTC
Forum: Science
Topic: Science needs a symbol
Replies: 83
Views: 12778

Re: Science needs a symbol

How about:

E = mc²

Almost everybody recognizes that.
by shawnhcorey
Mon Jan 09, 2012 3:59 pm UTC
Forum: Coding
Topic: Perl and XML parsing
Replies: 7
Views: 3271

Re: Perl and XML parsing

myrcutio wrote:What should I do?


Switch to XML::Twig. XML::Simple does not preserve the structure of an XML document; XML::Twig does.

Go to advanced search