## Search found 435 matches

Wed Jan 13, 2010 5:13 pm UTC
Forum: Computer Science
Topic: Rant: Java's Type System
Replies: 56
Views: 12218

### Re: Rant: Java's Type System

Personally, I think the best way to do it would be to demote implicit lossy primitive casting from an error to a warning, and have integer division produce a float. That way, when you do something like: int pi=22/7 It divides 22 by 7, produces a float, then casts it to int for the assignment. You g...
Wed Jan 13, 2010 6:40 am UTC
Forum: Computer Science
Topic: Rant: Java's Type System
Replies: 56
Views: 12218

### Re: Rant: Java's Type System

This criticism is misdirected. The underlying problem has almost nothing to do with type systems, but rather with naming. Specifically, the complaint arises from the fact that Java provides both integer division and ordinary division under the same name (considering operator symbols to be a type of ...
Fri Jan 08, 2010 8:42 am UTC
Forum: Science
Topic: Will you weigh less on a scale if you exhale?
Replies: 33
Views: 20196

### Re: Will you weigh less on a scale if you exhale?

Interesting point! According to Wikipedia: the atmosphere is about 21% oxygen, about 5% of the air we breathe out is CO2 (which was O2 when we breathed it in), we breathe in about 500mL in a normal breathe, and an average adult breathes 12-20 times per minute. Now, applying the Ideal Gas Law at STP...
Thu Dec 17, 2009 5:11 am UTC
Forum: Mathematics
Topic: Completeness and correctness of sequent calculus
Replies: 4
Views: 1313

### Re: Completeness and correctness of sequent calculus

You can't derive a contradiction. I see no reason to spoil your professor's explanation, but if you've spent a day trying to derive a contradiction, you may want to step back and think about your initial reasoning.
Wed Dec 02, 2009 9:20 am UTC
Forum: Mathematics
Topic: I think I proved Fermat's Last Theorem
Replies: 44
Views: 7265

### I think I proved every integer greater than 1 is prime

Definition: P(n) is the predicate "n is composite". Theorem Z: ((Exists n>1) P(n)) => ((Exists n>1, n is prime) P(n)) Lemma 1: ((Forall a>1,b>1) (P(a*b) => (P(a) or P(b)))) Proof of lemma 1: It is true almost by definition that ((Forall a>1, b>1) P(a*b)), so it is certainly a true proposit...
Sat Nov 14, 2009 3:22 am UTC
Forum: Coding
Topic: Exponents in C++
Replies: 24
Views: 8337

### Re: Exponents in C++

cogman wrote:jareds, a straight out a*a*a*a is going to be slower then other methods.

I said that a compiler is not actually likely to transform (a*a*a*a) to (t=a*a,t*t), which is true. I said the transformation is fine. This does not constitute saying that (a*a*a*a) is the best way to compute a^4.
Fri Nov 13, 2009 7:01 am UTC
Forum: Coding
Topic: Exponents in C++
Replies: 24
Views: 8337

### Re: Exponents in C++

I don't know about specific C/C++ implementations, but in general a pow(base, exponent) is more efficient for integer powers than multiplying it out. This is because implementations of such functions apply certain tricks (algorithms). For example: b = a*a*a*a = a^4 requires three multiplications. A...
Sat Oct 10, 2009 5:37 am UTC
Forum: Computer Science
Topic: Halting problem
Replies: 10
Views: 1952

### Re: Halting problem

Can someone proof if the odd-halting problem is solvable then the general halting problem is solvable? "Odd-halting problem" is a problem your instructor or TA came up with specifically for your homework assignment . Indeed, that's the only Google hit for the term. However, this is obviou...
Fri Aug 28, 2009 7:54 am UTC
Forum: Coding
Topic: Making Old X App 64-bit Safe
Replies: 7
Views: 753

### Re: Making Old X App 64-bit Safe

Casting between pointers and any integer type is pure pure evil in any case and any programmer who does it should quit and never touch a computer again. There are no legitimate reasons, ever. Write a routine that allocates a 128-byte buffer aligned to a 16-byte boundary; you may assume that a char ...
Fri Aug 21, 2009 5:01 pm UTC
Forum: Coding
Topic: Safety
Replies: 15
Views: 1490

### Re: Safety

I haven't looked at the Safety download, but are you aware of Iota and Jot , Zot , and Lazy K ? In Jot, every string of the characters "0" and "1" is a valid program. One could create a similar syntax where every string of ASCII characters is a valid program in obvious ways. Zot ...
Fri Aug 21, 2009 7:12 am UTC
Forum: News & Articles
Topic: Insurance company claims woman was negligent in her own rape
Replies: 100
Views: 12813

### Re: Insurance company claims woman was negligent in her own rape

Nonetheless, it's not a counterexample. I could walk up and say "hi" to a convicted serial killer, fully aware of this person being so, but I'm still not negligent if he shoots me. To me, your hypothetical victim sounds less likely to be negligent than mine, so I'm not sure what your poin...
Fri Aug 21, 2009 3:41 am UTC
Forum: News & Articles
Topic: Insurance company claims woman was negligent in her own rape
Replies: 100
Views: 12813

### Re: Insurance company claims woman was negligent in her own rape

Unfortunately I have to reply due to the absurd implication that that example was supposed to be analogous to this particular incident. This thread is about "that particular incident", not "in a hypothetical situation where we can fudge all sorts of variables". Are you saying yo...
Fri Aug 21, 2009 3:10 am UTC
Forum: News & Articles
Topic: Insurance company claims woman was negligent in her own rape
Replies: 100
Views: 12813

### Re: Insurance company claims woman was negligent in her own rape

Certainly, certainly. My sincerest apologies. I wasn't deliberately criticizing your interpretation of the issue. After rereading your post, I can see that the quotation wasn't relevant to my point. I noticed that particular phrase and tried to use it in a way that would clarify what I meant. Thank...
Thu Aug 20, 2009 4:14 pm UTC
Forum: News & Articles
Topic: Insurance company claims woman was negligent in her own rape
Replies: 100
Views: 12813

### Re: Insurance company claims woman was negligent in her own rape

If a hotel manager hires a night-time parking garage attendant to work alone, knowing he is a convicted rapist, that is indisputably negligent. If a woman asks her neighbor, who lives alone, if she can crash on his couch while her house is being fumigated, knowing he is a convicted rapist , is this...
Fri Aug 14, 2009 4:34 pm UTC
Forum: News & Articles
Topic: Insurance company claims woman was negligent in her own rape
Replies: 100
Views: 12813

### Re: Stamford Marriott claims woman was negligent in her own rape

SO, those of you who think that she has no business suing the hotel- it's not the hotel's responsibility to maintain a reasonably safe premises? I mean, if they want anyone ever to stay there? I would never use a hotel at which I did not feel safe walking from my room to my car. I feel like, if the...
Fri Aug 14, 2009 5:20 am UTC
Forum: News & Articles
Topic: Insurance company claims woman was negligent in her own rape
Replies: 100
Views: 12813

### Re: Stamford Marriott claims woman was negligent in her own rape

Unless I'm missing something, none of the witnesses subpoenaed knew anything about the attack. Therefore, the hotel must be wanting to use them as character references or to testify that this woman did not in fact use appropriate caution. Which, actually, is completely fucking irrelevant, as she sh...
Tue Aug 11, 2009 4:03 pm UTC
Forum: Computer Science
Topic: Encrypted open WiFi-idea
Replies: 4
Views: 1190

### Re: Encrypted open WiFi-idea

1. In practice, you use one round of public-key cryptography to exchange a private key for a block cipher (e.g., for AES). 2. This is vulnerable to man-in-the-middle attack. For example, Eve walks into a coffee shop providing wifi on channel 1. She blasts a bunch of static on channel 1, and broadcas...
Tue May 19, 2009 7:51 am UTC
Forum: Computer Science
Topic: Wolfram|Alpha
Replies: 77
Views: 10425

### Re: Wolfram|Alpha

This is sort of funny/weird. It seems to have no idea what's happening here. http://www71.wolframalpha.com/input/?i=World+consumption First it thinks that I'm talking about tuberculosis. Then it goes off to say that 100% of people die of tuberculosis. "Consumption" is another name for tub...
Tue Feb 03, 2009 5:32 pm UTC
Topic: 0538: "Security"
Replies: 145
Views: 37602

### Re: "Security" discussion

I consider myself somewhat tech savvy, and with a math major I at least have a ballpark notion of most mathematical concepts, yet something is still bugging me. What is the point of 256, 512, 1024, etc. encryption when the password used to unlock said encryption is only 20 (and likely fewer) charac...
Mon Dec 22, 2008 8:30 am UTC
Forum: Computer Science
Topic: Can a TURING MACHINE Simulate a Brain?
Replies: 111
Views: 31607

### Re: Can a TURING MACHINE Simulate a Brain?

Descartes was right to come up with the concept of a p-zombie (though he didn't call it as such). Imagine mechanical computers like the Pascaline of his time progressed to the point that they were like mythical golden-tongued Greek androids capable of anything. Would you consider them persons? I wo...
Wed Dec 17, 2008 4:17 pm UTC
Forum: Computer Science
Topic: Busy Beaver and Computability
Replies: 13
Views: 4171

### Re: Busy Beaver and Computability

Yakk is right. Giving an algorithm A that requires X to compute B, does not prove or show that X is required to compute B, even if you assert that you can't imagine how you could compute B without X. This is mathematics; what you can or can't imagine doesn't constitute a proof. This may be hard to s...
Sat Dec 13, 2008 11:16 pm UTC
Forum: Computer Science
Topic: Some thoughts on MD5 and quantum computers
Replies: 6
Views: 1776

### Re: Some thoughts on MD5 and quantum computers

Also, quantum computers cannot invert an arbitrary function in logarithmic time in the number of possible inputs, but rather O(sqrt(n)) time (see Grover's algorithm). A 500MB file is in reality 4194304000 bits. So, with a quantum computer perhaps it will take you time proportional to 2^2097152000 ra...
Thu Dec 11, 2008 11:09 am UTC
Forum: Computer Science
Topic: People on irc are more ignorant than I thought
Replies: 18
Views: 2562

### Re: People on irc are more ignorant than I thought

Instead of the way things are done, you could instead store a number as a mantissa, decimal exponent and sign bit. As a result 0.7 would be equal to 111 * 10^(-1). You'd convert the mantissa to decimal before applying the exponent in this case. If things were done this way a finite-length decimal n...
Tue Nov 25, 2008 7:55 pm UTC
Forum: Computer Science
Topic: lets 3 color the graph
Replies: 12
Views: 2763

### Re: lets 3 color the graph

Hint 2: If, as I said, you don't add edges between vertices from the original graph, you must add vertices.
Spoiler:
The total number of new vertices you need is fixed, and it is 3. This is not a conincidence.

Then you can add edges to make the representation of the partial coloring.
Tue Nov 25, 2008 5:36 am UTC
Forum: Computer Science
Topic: lets 3 color the graph
Replies: 12
Views: 2763

### Re: lets 3 color the graph

I'm not a fan of posting solutions to homework, as opposed to hints, but I at least have to tell you: I have an algorithm to find the 3-coloring if it exists, but it has no relationship to what Rysto posted. I don't mean to be rude to Rysto, but I don't want the forum to actively mislead you. In fac...
Fri May 16, 2008 2:58 pm UTC
Topic: 0424: "Security Holes"
Replies: 88
Views: 33104

### Re: "Security Holes" discussion

RSA doesn't do anything that though, does it? A secure RSA key used on an insecure machine would still be OK after patching, though, correct? Yes, the key is fine. RSA is always used in practice with random padding, but weaknesses in the padding would not allow your key to be determined. In the cas...
Fri May 16, 2008 2:34 pm UTC
Topic: 0424: "Security Holes"
Replies: 88
Views: 33104

### Re: "Security Holes" discussion

If you had imported and use your (DSA) private key on a vulnerable version, then you're just as affected. In fact, it's worse as unlike a weak key that were generated on a vulnerable version, there's no way to test whether that key is affected other than the enduser own knowledge of where they have...
Thu Apr 03, 2008 3:02 am UTC
Forum: Coding
Topic: Mastermind AI
Replies: 60
Views: 8024

### Re: Mastermind AI

MindTheGap wrote:Thank you. I understand it now.

One question though:
Say you guess 0123 and get back (1,2) and have an array full of the numbers who also would give back (1,2). Which one would you guess for the next guess?

Picking one at random works fine.
Thu Apr 03, 2008 3:01 am UTC
Forum: Coding
Topic: Mastermind AI
Replies: 60
Views: 8024

### Re: Mastermind AI

cool, as a simulation or are you putting it on hardware? Writing it for hardware (a DE2 board); ideally, we'll just plug in a monitor and keyboard, and you can play against the board. Set the recond show, however, that I hate VHDL and wish I could code this project in C or something. How cool, I al...
Mon Mar 31, 2008 8:35 am UTC
Topic: 0403: "Convincing pickup line"
Replies: 100
Views: 34752

### Re: "Convincing pickup line" Discussion

Not to be nit-picky, but the graph in the comic is not a symmetric graph, it isn't even regular. Since when is reflection no longer a valid form of symmetry? Since we're talking about a symmetric graph . Edited to add: The relevant point of course is not whether the graph is symmetric, but whether ...
Sun Mar 23, 2008 3:28 am UTC
Topic: 0399: "Travelling Salesman Problem"
Replies: 115
Views: 29126

### Re: "Travelling Salesman Problem" Discussion

Whoosh. The joke is that it is in fact easy to factor large prime numbers, in constant-time even. That was a widely mocked quote with the same error.
I otherwise agree with you.
Sat Mar 22, 2008 8:25 pm UTC
Topic: 0399: "Travelling Salesman Problem"
Replies: 115
Views: 29126

### Re: "Travelling Salesman Problem" Discussion

As another sidenote (I think touched on elsewhere): If anyone were able to actually find a polynomial time algorithm, and release it widely to the world, there would be a scrambling period where all encryption schemes fall apart. Most modern encryption (RSA and others) is based on the assumption th...
Fri Mar 14, 2008 8:43 am UTC
Forum: Coding
Topic: Worst (Best?) Hacks
Replies: 50
Views: 7739

### Re: Worst (Best?) Hacks

What compiler do you work on?

I work for an embedded software development company. We have our own toolchain, including cross-compilers for the various architectures we support.
Fri Mar 14, 2008 4:47 am UTC
Forum: Coding
Topic: Worst (Best?) Hacks
Replies: 50
Views: 7739

### Re: Worst (Best?) Hacks

Not too terrible, but I thought it was pretty neat at the time: *reinterpret_cast<unsigned long*>(base) = *reinterpret_cast<unsigned long*>(derived); (Where base is an instance of class Base with virtual function Foo, derived is an instance of class Derived that derives from Base with a redefinitio...
Wed Jan 03, 2007 5:05 pm UTC