Search found 435 matches

by jareds
Thu May 09, 2013 6:56 am UTC
Forum: Coding
Topic: So I just had a "magic"/"more magic" moment today.
Replies: 14
Views: 22769

Re: So I just had a "magic"/"more magic" moment today.

If you're willing to use crazy bash features, you can do this: #!/bin/bash python -u <(cat <<'EOF' line = raw_input('> ') while line != '': print line.upper() line = raw_input('> ') EOF ) The bash docs call this feature "process substitution". <(stuff) will create a named pipe, run stuff w...
by jareds
Mon May 06, 2013 3:10 am UTC
Forum: Computer Science
Topic: Halting problem on specific machines
Replies: 3
Views: 5651

Re: Halting problem on specific machines

"Enter a loop" is pretty vague. Anyway, having a loop structure is not particularly important to whether it is easy to figure out whether a Turing machine halts. Sorry, I specifically meant that the machine enters a state that will provably repeat endlessly, e.g. transisitioning into a bl...
by jareds
Sun May 05, 2013 2:04 am UTC
Forum: Computer Science
Topic: Halting problem on specific machines
Replies: 3
Views: 5651

Re: Halting problem on specific machines

"Enter a loop" is pretty vague. Anyway, having a loop structure is not particularly important to whether it is easy to figure out whether a Turing machine halts. Consider the general structure: x = 0 while True: if f(x): HALT x = x+1 It might be very obvious that the program halts or doesn...
by jareds
Sat Apr 13, 2013 5:00 am UTC
Forum: Computer Science
Topic: How to wrap my head around bitwise logic
Replies: 5
Views: 6193

Re: How to wrap my head around bitwise logic

For the next step we need to know that b^(b+1) is always one less than a power of two, i.e. it is a number with only ones in its binary representation. What the expression above does to that number is x^(x>>1), which knocks out all but the most significant bit. Another simple way to do the same thi...
by jareds
Tue Apr 02, 2013 5:36 am UTC
Forum: Computer Science
Topic: Pumping Lemma and Regular languages - Is this proof correct?
Replies: 10
Views: 7902

Re: Pumping Lemma and Regular languages - Is this proof corr

So close, and yet... Sorry, I don't want to be mean. Just read what you wrote, and ask yourself, "does such k exist, yes or no?" Bleh. Logic fail. Just take k = product of all positive integers <= p. RIGHT? :cry: Pretty much. Actually, you want k = p + p!, because you will be starting wit...
by jareds
Tue Apr 02, 2013 4:44 am UTC
Forum: Computer Science
Topic: Pumping Lemma and Regular languages - Is this proof correct?
Replies: 10
Views: 7902

Re: Pumping Lemma and Regular languages - Is this proof corr

Close, but remember, "k" is under our control - we get to pick how big it is, since it's chosen in the "There exists some string longer than p in the language" part of the plan. So, the question is... can we pick a value of k such that none of the options for |y| can be used to ...
by jareds
Wed Mar 20, 2013 5:11 am UTC
Forum: News & Articles
Topic: Cyprus Bailout: Wealth Tax, Bank Runs on the Horizon
Replies: 111
Views: 12293

Re: Cyprus Bailout: Wealth Tax, Bank Runs on the Horizon

It makes sense. After all, taxing people's property always results in a mad sell-off of all the homes and businesses affected. And of course, when you place a tax on sales, sales stop. There are several important differenes here. 1. The other taxes you bring up are very broad, so there is not much ...
by jareds
Wed Mar 20, 2013 3:03 am UTC
Forum: News & Articles
Topic: Cyprus Bailout: Wealth Tax, Bank Runs on the Horizon
Replies: 111
Views: 12293

Re: Cyprus Bailout: Wealth Tax, Bank Runs on the Horizon

The point of being a deficit hawk is that you want to cut the deficit. Raising new revenue is one of two ways you can do that. The pathological hatred of taxation and outlandish fantasies of the economic horrors that follow therefrom ("Gutting our banking systems") is one way to identify ...
by jareds
Sat Mar 02, 2013 9:31 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034862

Re: Coding: Fleeting Thoughts

The Linux write() syscall takes a start pointer and a count, not a start pointer and an end pointer. Not executing that... You know that doesn't actually matter, right? How does the difference between a length and an end pointer not matter? It appears to work if stdout is a pty, apparently because ...
by jareds
Sat Mar 02, 2013 5:35 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034862

Re: Coding: Fleeting Thoughts

The Linux write() syscall takes a start pointer and a count, not a start pointer and an end pointer. Not executing that...
by jareds
Tue Feb 26, 2013 5:42 am UTC
Forum: Coding
Topic: Implementing a Linked List in the Heap
Replies: 19
Views: 21475

Re: Implementing a Linked List in the Heap

There is/was a Scheme implementation that did all first-generation allocation on the C stack. Convert to continuation-passing style so you never return; allocate everything on the stack; and when it overflows or hits a limit you do a copying GC, longjmp() back to the beginning, and keep going... Not...
by jareds
Mon Feb 18, 2013 10:35 pm UTC
Forum: Coding
Topic: The "IT DOESN'T WORK!" thread
Replies: 1963
Views: 572234

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

The documentation for INVOKE says: If an argument passed by INVOKE is smaller than the type specified in the PROTO statement, MASM does a type conversion. It widens the argument in the PROTO statement to match that in the INVOKE statement (for example, SBYTE to SWORD). These types of conversions use...
by jareds
Sun Feb 10, 2013 2:35 am UTC
Forum: News & Articles
Topic: In other news... (humorous news items)
Replies: 15205
Views: 2712139

Re: In other news... (humorous news items, etc)

How come solar is so small in the USA? You guys are so ideally situated for solar. And it's not just a general dislike for non-fossil fuels, since solar scores particularly poorly even compared to other renewable sources. Wind energy (onshore) is still cheaper than solar energy. So, while we have v...
by jareds
Mon Jan 28, 2013 8:05 am UTC
Forum: Computer Science
Topic: What would you do with an infinitely fast computer?
Replies: 818
Views: 228465

Re: What would you do with an infinitely fast computer?

Speaking of infinitely fast computers, could you do a high-level program that could fake infinite-fastness (like Haskell's infinite lists) and additionally able to detect (and refuse to run) halting problems if there exist any? You can make a program that takes a program and correctly says either &...
by jareds
Mon Jan 28, 2013 5:49 am UTC
Forum: Coding
Topic: Viewing the machine code associated with x86 assembly
Replies: 6
Views: 4325

Re: Viewing the machine code associated with x86 assembly

Sure. I guess I should say that it isn't so much that you seem confused, but rather that what you're doing seems odd. When you say what you're trying to accomplish, people can suggest different approaches. I might have been using the wrong terminology, but essentially I was trying to find the hex eq...
by jareds
Sun Jan 27, 2013 6:13 am UTC
Forum: Coding
Topic: Viewing the machine code associated with x86 assembly
Replies: 6
Views: 4325

Re: Viewing the machine code associated with x86 assembly

For the first thing, viewing the assembly together with the machine code as ASCII hex, this is a standard feature of an assembler, called a "listing". For example, GNU as supports this via -a : $ cat foo.s .text foo: pushl %ebp # look, a comment movl %esp, %ebp leave ret $ as -o foo.o -a=f...
by jareds
Thu Jan 24, 2013 5:54 am UTC
Forum: Coding
Topic: C++ - #include <cstdio> and <stdio.h> in the SAME FILE?
Replies: 4
Views: 6641

Re: C++ - #include <cstdio> and <stdio.h> in the SAME FILE?

Problem is, the C++03 and C++11 standards are rather ambiguous. It seems there are some differences between cstring and string.h other than the namespaces issue - and I can't tell whether, for instance, the bit which states The function signature strchr(const char*, int) shall be replaced by the tw...
by jareds
Wed Jan 16, 2013 1:20 am UTC
Forum: News & Articles
Topic: In other news... (humorous news items)
Replies: 15205
Views: 2712139

Re: In other news... (humorous news items, etc)

Texas man pretends to be gunman to test high school's security . He has been arrested and faces felony charges for making terrorist threats. So...how would the school have passed his test? Perhaps it would have been good enough if, on hearing his claim to be a gunman, the greeter had pulled a pisto...
by jareds
Sun Dec 16, 2012 12:08 am UTC
Forum: News & Articles
Topic: Shooting at CT Elementary School
Replies: 540
Views: 56531

Re: 27 dead in Shooting at CT Elementary School

You're unfairly snipping my argument into two parts and replying to this part separately in such a way that ignores my overall point. No, I don't think so. Identifying one specific way your argument fails is not "sniping." (BTW, "snipping" is an actual English word. It's a synon...
by jareds
Sat Dec 15, 2012 7:23 pm UTC
Forum: News & Articles
Topic: Shooting at CT Elementary School
Replies: 540
Views: 56531

Re: 27 dead in Shooting at CT Elementary School

Brace's statement is that there is no good reason for autism to be a disqualifying condition, not that there is a good reason for autism not to be a disqualifying condition. It's a negative statement and there should be no expectation of evidence for it. I don't follow your argument. True, you can'...
by jareds
Sat Dec 15, 2012 6:12 am UTC
Forum: News & Articles
Topic: Shooting at CT Elementary School
Replies: 540
Views: 56531

Re: 27 dead in Shooting at CT Elementary School

That's the opposite of how citations work. You should be the one to cite something for the proposition that autistic people are dangerous No, I'm pretty sure the person who makes the assertion is the one with an obligation to provide evidence. Perhaps there is no reason to restrict gun ownership to...
by jareds
Sat Dec 15, 2012 1:18 am UTC
Forum: News & Articles
Topic: Shooting at CT Elementary School
Replies: 540
Views: 56531

Re: 27 dead in Shooting at CT Elementary School

As mentioned earlier in the thread, the shooter was autistic. He was reportedly diagnosed with an unspecified personality disorder as well. There's not a good reason either of these things should be disqualifying conditions. Citation needed. It appears we have some anecdotal evidence that they shou...
by jareds
Sun Dec 09, 2012 5:59 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034862

Re: Coding: Fleeting Thoughts

Btw, why do you need a type cast (if that's what it is) on the array of function pointers? Is that needed to let you use "array literal" notation with function pointers? (I didn't realise you could even do that.) The ability to use a compound literal (array or struct), other than as an in...
by jareds
Sat Dec 08, 2012 1:20 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034862

Re: Coding: Fleeting Thoughts

Regarding Xanthir's quicksort, I suspect it's worse than randomized quicksort as a theoretical randomized algorithm. Certainly it is if it deals with values equal to the pivot in one of the following ways: they all go after the pivot, they all go before the pivot, or they are all excluded from subse...
by jareds
Thu Dec 06, 2012 11:35 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034862

Re: Coding: Fleeting Thoughts

"Expected running time" for randomized algorithms does in fact map to "average case running time" for randomized algorithms. This is absolutely false. If a randomized algorithm has "killer random bits" for its running time but not "killer inputs", then its &q...
by jareds
Thu Dec 06, 2012 3:44 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034862

Re: Coding: Fleeting Thoughts

Julian, your mistake is applying your understanding of deterministic algorithms in a very procrustean way to randomized algorithms: insisting that your definitions, which come from a study of deterministic algorithms but do not appear to reflect much study of randomized algorithms, are the only vali...
by jareds
Tue Nov 27, 2012 7:00 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034862

Re: Coding: Fleeting Thoughts

(If anyone can tell me why the bind expression won't compile, please do.) You should use _1 instead of _2. If f=bind(g, value, _N), then _N refers to the Nth argument of f, not of g. The order of the arguments to g is determined by their order in the call to bind. E.g., the distinction between &quo...
by jareds
Tue Nov 27, 2012 1:00 am UTC
Forum: Coding
Topic: Pascal language (pointer) problem
Replies: 4
Views: 1671

Re: Pascal language (pointer) problem

Oh, sorry, pass by reference actually does work very much like "pass by address". I believe your problem is only that you're not mentally applying pass-by-address properly when the parameter type is already a pointer. If you prefer, you can take my explanation and replace "reference&q...
by jareds
Mon Nov 26, 2012 5:58 pm UTC
Forum: Coding
Topic: Pascal language (pointer) problem
Replies: 4
Views: 1671

Re: Pascal language (pointer) problem

CodeWarrior has a good debugger, right? Debugging is an important skill, and this would be a nice small example to practice on, particularly since this will still fail with a two-element list. In this case, you can even check that every statement is doing what you expect. m_next is not acting as a v...
by jareds
Thu Nov 22, 2012 8:09 am UTC
Forum: News & Articles
Topic: 2012 U.S. Presidential Election
Replies: 1637
Views: 177280

Re: 2012 U.S. Presidential Election

Support for Puerto Rican statehood if Puerto Ricans vote for it has been in the Republic Party platform since since at least 2000 , and probably longer, since it was actually the favored option of Reagan . The universal mandate and cap-and-trade were also long-term Republican solutions until the De...
by jareds
Wed Nov 21, 2012 11:11 pm UTC
Forum: News & Articles
Topic: 2012 U.S. Presidential Election
Replies: 1637
Views: 177280

Re: 2012 U.S. Presidential Election

Yeah, Congressional approval for a perpetually Democratic state that doesn't recognize the primacy of English is just going to be a formality. :roll: When Puerto Rico decides they want to become a state, they'll be next in line behind the District of Columbia. Support for Puerto Rican statehood if ...
by jareds
Wed Nov 21, 2012 9:07 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034862

Re: Coding: Fleeting Thoughts

A few weeks ago, a friend asked for an efficient way to do division by ten on unsigned 16 bit numbers on a CPU that has no divide or multiply instructions. The code below was the best I could cook up, but I was wondering if there's an even more efficient algorithm than this; I'm not very happy abou...
by jareds
Wed Nov 21, 2012 2:27 am UTC
Forum: News & Articles
Topic: Hostess Closing Down after Strike (Twinkies No More?)
Replies: 75
Views: 13781

Re: Hostess Closing Down after Strike (Twinkies No More?)

Here's an opinion piece blaming the Teamsters, not the bakers' union, on the grounds that Hostess actually had efficient baking operations but inefficient distribution. Of course, I have no knowledge of Hostess operations, but at least now we've blamed everyone possible: 1. Bakers 2. Teamsters 3. Ma...
by jareds
Tue Nov 20, 2012 4:57 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034862

Re: Coding: Fleeting Thoughts

Dividing by 10 in base 2 is easy. Just manipulate 1/8 - 1/10, and find the recursive relationship 1/10 = 1/8 - 1/4 x 1/10 From that you easily get a series of addition/subtractions and bit-shifts that will equate division by 10. Isn't there some trick where you can multiply by some constant? I don'...
by jareds
Fri Nov 16, 2012 1:55 am UTC
Forum: Coding
Topic: Language Love/Hate
Replies: 80
Views: 19840

Re: Language Love/Hate

The Comeau experiment was also with C++, regardless of what the ComeauTest.c file name suggests. :-) (Though Intel CC, which also uses the EDG front end, only reports a warning.) I'm not familiar with the internals of Comeau's thing, but I assume it passes --strict to the front end when "Compi...
by jareds
Mon Nov 12, 2012 2:38 pm UTC
Forum: Computer Science
Topic: NP =? Co-NP question
Replies: 6
Views: 8503

Re: NP =? Co-NP question

That's certainly true. But the goal of the construction is to simulate the machine and flip its actual output, not the output of each individual path. I suppose determining the output of an arbitrary polynomial-time NTM can't be done in polynomial time even with an NTM, which goes back to my origin...
by jareds
Thu Nov 08, 2012 2:02 am UTC
Forum: News & Articles
Topic: 2012 U.S. Presidential Election
Replies: 1637
Views: 177280

Re: 2012 U.S. Presidential Election

I know this is an aside (but it didn't seem worthy of a thread in its own right) but why is the presedential transistion period so long. I'm not saying my country has it right (new government in the day after an election normally) and obviously it isn't going to happen now but it just seems strange...
by jareds
Wed Nov 07, 2012 12:10 am UTC
Forum: News & Articles
Topic: Stat anomaly points to country-wide election fraud
Replies: 60
Views: 11543

Re: Stat anomaly points to country-wide election fraud

Only if one fails miserably at reading comprehension. That section does nothing to try and make that confusion. In fact, the meaning is quite clear. I didn't say it was impossible to interpret as technically correct. I said it was misleading. "Milwaukee County used ES&S electronic voting m...
by jareds
Sun Nov 04, 2012 8:15 pm UTC
Forum: News & Articles
Topic: Stat anomaly points to country-wide election fraud
Replies: 60
Views: 11543

Re: Stat anomaly points to country-wide election fraud

Another article for those who are interested: http://www.opednews.com/articles/1/Part-II--Rigged-Elections-by-Michael-Collins-121031-324.html This is approaching willfully misleading (but Hanlon's razor, etc.): Milwaukee County, on the other hand, used ES&S electronic voting machines and an ES&...
by jareds
Fri Nov 02, 2012 7:52 am UTC
Forum: Computer Science
Topic: What would you do with an infinitely fast computer?
Replies: 818
Views: 228465

Re: What would you do with an infinitely fast computer?

Just to summarize a bit of information from that spin-off, we spent a lot of time discussing a well-defined model of transfinite computing that was not really uncountable computing. (The model allowed for running any transfinite ordinal number of steps, but it would provably either halt or get into ...

Go to advanced search