Search found 277 matches

by thedufer
Mon Aug 20, 2012 10:59 pm UTC
Forum: Coding
Topic: Python list reference mapping
Replies: 4
Views: 3659

Re: Python list reference mapping

If you're looking for something quick and easy, you can wrap each element in a list as so: >>> a = [[1],[2],[3],[4]] >>> b = [[5],[6],[7],[8]] >>> c = a + b >>> c [[1],[2],[3],[4],[5],[6],[7],[8]] >>> c[2][0] = "Hello" >>> c [[1],[2],["Hello"],[4],[5],[6],[7],[8]] >>> a [[1],[2],...
by thedufer
Thu Feb 09, 2012 7:03 pm UTC
Forum: Coding
Topic: Help writing a webpage download program
Replies: 7
Views: 2172

Re: Help writing a webpage download program

Also, instead of the delay and the endlessly looping program, you might want to make a script that just runs a single pass (download, compare to previous, save if different), and schedule it to run every N minutes via cron . This. You really don't want to have a program that needs to be running all...
by thedufer
Thu Oct 27, 2011 2:36 pm UTC
Forum: Coding
Topic: This JavaScript is driving me -mad-.
Replies: 8
Views: 2214

Re: This JavaScript is driving me -mad-.

Alternatively, if you're in Chrome there's a fantastic Javascript console built in. Go to [wrench]->Tools->JavaScript Console (command-option-J on OS X).
by thedufer
Tue Oct 25, 2011 5:11 am UTC
Forum: Coding
Topic: Project Euler issue
Replies: 21
Views: 3504

Re: Project Euler issue

Quick note on python. This:
kuruma wrote:

Code: Select all

def end_fib(n):
    return int(str(fib(n))[len(str(fib(n)))-9:])
is exactly why negative indexing is allowed. This:

Code: Select all

def end_fib(n):
    return int(str(fib(n))[-9:])
should give you exactly the same thing.
by thedufer
Mon Oct 24, 2011 3:57 pm UTC
Forum: Coding
Topic: Project Euler issue
Replies: 21
Views: 3504

Re: Project Euler issue

To start off, you're calling fib a minimum of 3 times on each num. Also, your fib should not use a list. You only need to remember the two most recent values. Actually, fib should probably be recursive and cache values. Otherwise, you're calculating fib(12000) for every fib call, and for higher numb...
by thedufer
Mon Oct 24, 2011 12:23 am UTC
Forum: Mathematics
Topic: Integration Question. Revision, so homework, I suppose.
Replies: 24
Views: 2778

Re: Integration Question. Revision, so homework, I suppose.

For part iv, I would suggest plotting f(0), f(2), f(4), f(6). While the interval (4,6) will be easy to do, with what information you have, the interval (0,4) will be rough estimation besides the points x=0,2,4.
by thedufer
Sat Oct 22, 2011 4:21 pm UTC
Forum: Mathematics
Topic: Integration Question. Revision, so homework, I suppose.
Replies: 24
Views: 2778

Re: Integration Question. Revision, so homework, I suppose.

Edit: If f(x)=\int_{0}^{x}g(x)\, dx isn't rendering for you (its not for me...), it means f(x) equals the integral from 0 to x of g(x)dx. The imath is rendering properly, it's just that for whatever reason it doesn't report the width correctly when you have small figures like integr...
by thedufer
Sat Oct 22, 2011 4:08 pm UTC
Forum: Mathematics
Topic: Integration Question. Revision, so homework, I suppose.
Replies: 24
Views: 2778

Re: Integration Question. Revision, so homework, I suppose.

Hold up. Is the maximum at f(x) = 0? Well, one of the possible maxima? Yes, it is a possible maxima. No, it is not the actual maxima. IIRC, your options for maxima are places where f'(x)=0 and endpoints (and points of discontinuity, maybe? but there aren't any of those here). Perhaps you can list t...
by thedufer
Fri Oct 21, 2011 3:35 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0967: Prairie
Replies: 117
Views: 29815

Re: 0967: Prairie

The comic itself refers to Quantum Dynamics, and in particular, the idea of a wave function collapse. According to this, all particles (and macroscopic objects, though you will never notice it) behave as waves until they are 'observed'. At that point the wave collapses into a single point, the loca...
by thedufer
Sun Oct 16, 2011 7:00 pm UTC
Forum: Coding
Topic: Is this hard to read?
Replies: 15
Views: 3649

Re: Is this hard to read?

A good general guideline is to not comment a single line of code. Comments should be used to describe a large chunk of code, but if a single line needs a comment, it actually needs to be rewritten so that the comment is no longer necessary. Also, and this may be a personal style thing, I would put s...
by thedufer
Mon Oct 10, 2011 9:27 pm UTC
Forum: Mathematics
Topic: 0^-1
Replies: 20
Views: 3136

Re: 0^-1

arbiteroftruth wrote:I disagree. Similar logic would say that if 0 is a real number, then 0 needs a multiplicative inverse.


Nope. In a field, every element except the additive identity needs a multiplicative inverse. We can let 0 be special because it is special, being the inverse.
by thedufer
Sat Oct 08, 2011 5:55 am UTC
Forum: Mathematics
Topic: 0^-1
Replies: 20
Views: 3136

Re: 0^-1

Of course as was pointed out above we often times would rather use 0^0=1, which then necessitates that 0^{-1} is not a real number in which case the OP can define it to be whatever they want, so long as they realize that if they want to tack that new element onto R and then "do" things wi...
by thedufer
Fri Oct 07, 2011 6:02 am UTC
Forum: Logic Puzzles
Topic: A very interesting Mathematical Paradox
Replies: 387
Views: 158053

Re: A very interesting Mathematical Paradox

you get [0,1), which has fewer points than [0,1]. Wait, this is also no good. Both of these sets contain an uncountably infinite number of points. You ought to take a class on set theory; it'd be good for you. Specifically, order([0,1)) = order([0,1]) even though [0,1) is a strict subset of [0,1]. ...
by thedufer
Wed Oct 05, 2011 3:40 am UTC
Forum: Science
Topic: Wait, can free will exist?
Replies: 247
Views: 27762

Re: Wait, can free will exist?

You can believe nonsense if you want but we can't pretend that it's got the support of physics. I didn't make this one up . The many-worlds theory is a possible interpretation of the wave function collapse in quantum mechanics. The consciousness part of it is just a thought experiment, if a fairly ...
by thedufer
Wed Oct 05, 2011 3:07 am UTC
Forum: Religious Wars
Topic: I hate math notation!
Replies: 57
Views: 22884

Re: I hate math notation!

One thing I would change if I had the power would be to do away with the symbol π, and use a single symbol to represent the ratio between a circle's circumference and its radius . (The number we call 2π.) For this post let me use ❖. That way when you are learning trigonometry in radians, a quarter ...
by thedufer
Wed Oct 05, 2011 2:17 am UTC
Forum: Science
Topic: Wait, can free will exist?
Replies: 247
Views: 27762

Re: Wait, can free will exist?

So Xanthir, one relevant question, is the determinism/randomness really a dilemma or is there a third option that we hadn't even counted upon? I can't think of anything so I'm inclined to say no, but I also didn't think there was any possible alternative to determinism until I learned about quantum...
by thedufer
Wed Oct 05, 2011 2:05 am UTC
Forum: Science
Topic: Does randomness exist ?
Replies: 48
Views: 7152

Re: Does randomness exist ?

where can I get such a string? thats difficult. apparently there are some numerical process which empirically produce "random" strings to a high degree of test-ability (like some chaotic functions if im not mistaken). Putting random in quotes is completely appropriate - the best we can ge...
by thedufer
Tue Oct 04, 2011 9:44 pm UTC
Forum: Coding
Topic: Node.js
Replies: 8
Views: 4373

Re: Node.js

I used Node.js at my internship this summer, and its perfect for single-page webapps. Since you serve very little HTML, you do most of your work building JSON objects, which is easy when you are sending data between client and server javascript. You only have to model your data once - client and ser...
by thedufer
Tue Oct 04, 2011 9:33 pm UTC
Forum: Mathematics
Topic: Mathematical Induction
Replies: 47
Views: 6486

Re: Mathematical Induction

Given a set S, if both of the following are true: 1) S contains the number 1. 2) If S contains the positive integer x then S contains x+1. Then S contains all the positive integers. That is the entirety of mathematical induction. Careful here; that's weak induction. Calling that the entirety of ind...
by thedufer
Thu Sep 29, 2011 5:05 pm UTC
Forum: Religious Wars
Topic: Is Java is a bad language for beginners?
Replies: 234
Views: 134424

Re: Is Java is a bad language for beginners?

I have to agree with the Python supporters as well. There's a big difference from a one-line file producing output, and the overhead of your initial class in Java just to get things compiling. The added advantage of being able to mess around with things and see what works in the interactive interpre...
by thedufer
Sat Aug 13, 2011 4:26 pm UTC
Forum: Coding
Topic: Finding A Coding Job w/ Programming Puzzles
Replies: 2
Views: 1519

Re: Finding A Coding Job w/ Programming Puzzles

Interview Street is a startup that has some programming challenges and allows a number of companies looking for coders to see the results.
by thedufer
Fri Jun 24, 2011 4:30 am UTC
Forum: Coding
Topic: Java and Python
Replies: 16
Views: 6007

Re: Java and Python

I strongly agree with the fundamental thrust of your argument, but anonymous inner classes essentially give you a slightly-limited way of defining anonymous closures, albeit with an atrocious syntax. (It's limited because you can't capture non-final locals.) I thought I remembered a way of doing so...
by thedufer
Fri Jun 24, 2011 4:02 am UTC
Forum: Coding
Topic: Java and Python
Replies: 16
Views: 6007

Re: Java and Python

If you use Java, everyone will make fun of you and call you stupid. Actually java became a decent language after the last few jdk releases and many enterprise systems started to used java years ago. The VM turned out to be pretty fast. That wasn't the problem. I would actually argue against learnin...
by thedufer
Mon Jun 20, 2011 4:44 am UTC
Forum: Coding
Topic: Coding in Python (Simple probably stupid) help needed.
Replies: 5
Views: 1266

Re: Coding in Python (Simple probably stupid) help needed.

None of the keywords in python are capitalized. By convention, only class names are capitalized in python[1].
by thedufer
Fri Jun 10, 2011 6:19 am UTC
Forum: Coding
Topic: Couple of Python Questions
Replies: 7
Views: 1522

Re: Couple of Python Questions

Also, if there I do not exactly comprehend the use of "__main__" or "__init__" expressions, any attempts at simple pointers would be extremely welcome. I didn't see a good answer to this, so hear goes: These two things, although similar in appearance, are very different. When yo...
by thedufer
Fri May 06, 2011 5:19 pm UTC
Forum: Coding
Topic: Building an ALU
Replies: 11
Views: 3245

Re: Building an ALU

Having built a (simple) processor (in a logic gate simulator), I have a few suggestions: -The zero x/y bits seem unnecessary. I think it'd be much easier to simply pass in a constant 0. -Selecting the operation with 2 control bits may be necessary. Add/and could be expanded to add/and/xor/or. Edit: ...
by thedufer
Mon May 02, 2011 4:29 am UTC
Forum: Coding
Topic: Need help with creating a script
Replies: 11
Views: 1788

Re: Need help with creating a script

I disagree that a cron job is the best way; I think better would be to have one process running in the background, either with a timer interrupt scheduled or just sleeping for 10 sec or something at a time checking if 5 minutes has passed each time it wakes up. Isn't this what cron is, basically? U...
by thedufer
Sat Apr 30, 2011 3:53 am UTC
Forum: Coding
Topic: Finding references for writing a virtual machine (eg, JVM)
Replies: 4
Views: 1570

Re: Finding references for writing a virtual machine (eg, JV

It might be useful to learn how a processor works at the dataflow level. I don't know a lot about virtual machines, but I take it they're modeled on real machines to some degree. At the very least, glance at a simple instruction set, such as MIPS , to get a basic idea about what instructions you'll ...
by thedufer
Fri Apr 29, 2011 3:28 am UTC
Forum: Your art and links
Topic: My attempt at an HTML5 game
Replies: 8
Views: 4254

Re: My attempt at an HTML5 game

I think it'd be better if you turned more quickly My physics engine breaks down at the relative speeds of turning vs. movement. I may tune it slightly, but I'd suggest upgrading your ship. Bigger engines seem like the best thing to go for first. and if there was a starfield in the background to sho...
by thedufer
Fri Apr 15, 2011 5:43 pm UTC
Forum: Your art and links
Topic: My attempt at an HTML5 game
Replies: 8
Views: 4254

Re: My attempt at an HTML5 game

Works great in IE9, but you should add a DOCTYPE: http://www.w3schools.com/html5/tag_doctype.asp Done. Thanks for the tip. Also, if you didn't already know about it, you should definitely enter this game into the HTML5 contest* "Dev Unplugged": http://www.beautyoftheweb.com/dev/unplugged ...
by thedufer
Fri Apr 15, 2011 1:47 pm UTC
Forum: Your art and links
Topic: My attempt at an HTML5 game
Replies: 8
Views: 4254

Re: My attempt at an HTML5 game

I'm getting "Uncaught TypeError: Cannot call method 'move' of undefined" when I leave the garage after adding a couple rear-thrust engines. You must have grabbed it while I was actively developing. I don't think that one lasted too long. I'm working on getting a real server set up so the ...
by thedufer
Wed Apr 13, 2011 8:21 pm UTC
Forum: Mathematics
Topic: Random Integer
Replies: 18
Views: 2831

Re: Random Integer

And neither is there one on [0, 1]. Huh? That would mean there's no such thing as a continuous uniform distribution, which I'm pretty sure is not true. No, he's definitely right on this one. I'm fairly certain that if there was a continuous uniform distribution, you'd be able to map that to a unifo...
by thedufer
Wed Apr 13, 2011 5:53 pm UTC
Forum: Coding
Topic: Macro Ethics
Replies: 17
Views: 2978

Re: Macro Ethics

I believe defining variables in macros is considered a bad idea. It causes all sorts of problems with readability if you use a variable that's never visibly defined.
by thedufer
Wed Apr 13, 2011 1:40 am UTC
Forum: School
Topic: Accusation of fraud advice. (university belgium)
Replies: 20
Views: 3182

Re: Accusation of fraud advice. (university belgium)

I have a class for which we turn in assignments by leaving them in our home folder with read rights to users in our group. We're required to sign it with a personal private key (and leave our public key in our home directory) and then encrypt it with the grader's public key. Sounds like you need som...
by thedufer
Tue Apr 12, 2011 5:43 am UTC
Forum: Your art and links
Topic: My attempt at an HTML5 game
Replies: 8
Views: 4254

My attempt at an HTML5 game

Here's a game I've been working on for the past few months. Its written entirely in HTML/javascript. It is entirely dependent on HTML5, so a new-ish browser is required (recent versions of Chrome/Firefox). Also, if you happen to run IE9, let me know what happens. I rarely have access to a computer w...
by thedufer
Fri Apr 08, 2011 5:27 am UTC
Forum: Coding
Topic: Probabilistic selection from an array (Java)
Replies: 8
Views: 2061

Re: Probabilistic selection from an array (Java)

"Weighted random selection" turned out to be great keywords for Google -- I turned up a bunch of stuff. A lot of the suggestions I found were based on calculating the CDF, which poses a minor problem for me; in my program, a perfect fitness score is 0.0, which means the fittest members of...
by thedufer
Tue Apr 05, 2011 5:20 am UTC
Forum: Coding
Topic: Noob Question: How to make an equation look simpler
Replies: 18
Views: 2942

Re: Noob Question: How to make a equation look simpler

yóur university is silly I dont think you can condense it further though, unless Python evaluates stuff weirdly and lets you do (n*=3)++ (I doubt it, and good-souled people will recoil from that in horror ilke vāmpires from a crucifix) If by recoil you mean watch syntax errors fly by. The ++ operat...
by thedufer
Tue Mar 15, 2011 8:44 pm UTC
Forum: Coding
Topic: Chrome, version 10
Replies: 12
Views: 1942

Re: Chrome, version 10

Chrome 10.0.648.133 on Ubuntu 10.04. I get 100/100 and smooth rendering, but flipping between tabs reveals that the output is a few pixels shorter than the reference...how important is that? It says pixel for pixel.
by thedufer
Sun Feb 13, 2011 3:31 am UTC
Forum: Coding
Topic: Style Question
Replies: 18
Views: 2342

Re: Style Question

Yeah, more or less. I find that JSON is better overall, since the five datatypes it's suited for encoding (bools, numbers, strings, lists, maps) are all you need most of the time. Plus the syntax is simpler - doing XML completely right is much harder than most people think, though of course most of...
by thedufer
Sun Jan 30, 2011 4:25 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2033376

Re: Coding: Fleeting Thoughts

Talent exists, and it helps, but it's not the most important part of programming. Experience counts for a lot more. However, I'd say the most important trait in programming, and any other profession, is that you love what you do. I'm going to be the bad guy and disagree with a lot of this. Experien...

Go to advanced search