Search found 3024 matches

by Berengal
Sun Aug 01, 2010 10:46 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9988
Views: 1998834

Re: Coding: Fleeting Thoughts

So I was compressing some 500 mb large postscript files down to about 1.5mb using winrar, which was all well and good except those large files were just intermediary files that I didn't want to store on a harddrive. When I switched to compressing from standard input, however, the compressed files ex...
by Berengal
Sat Jul 31, 2010 4:02 pm UTC
Forum: Coding
Topic: Language 'Types'
Replies: 9
Views: 2460

Re: Language 'Types'

Compiled vs interpreted languages is a false dichotomy. Compilation and interpretation is not something you do to languages, but to programs. A compiler takes a program in one language and transforms it into the same program but in a different language. An interpreter takes a program and performs th...
by Berengal
Fri Jul 30, 2010 6:22 pm UTC
Forum: Coding
Topic: A Big Ask
Replies: 34
Views: 5194

Re: A Big Ask

Haskell's arrays support arbitrary indexes (and arbitrary index types). I know there are some languages that support arbitrary start and end-points (fortran? cobol? Can't remember)
by Berengal
Fri Jul 30, 2010 6:17 pm UTC
Forum: Coding
Topic: [Unnecessarily-] Compact coding tricks
Replies: 112
Views: 17210

Re: [Unnecessarily-] Compact coding tricks

@Berengal, you're right; I did simplify that a lot but in general I don't think having a function inside a function inside a function makes for good readability. I disagree with you entirely. My favorite language is also one where all programs consist entirely of one giant expression containing fun...
by Berengal
Wed Jul 28, 2010 10:18 pm UTC
Forum: Coding
Topic: Phone screening for programmers
Replies: 18
Views: 2544

Re: Phone screening for programmers

Interviews are stressful, and stress can severely reduce mental capabilities, particularly when it comes to problem solving. People tend to fall back to simple routines and rules of thumb when stressed, which is absolutely useless when it comes to even the simplest of algorithms. Conversation and co...
by Berengal
Wed Jul 28, 2010 4:03 pm UTC
Forum: Coding
Topic: [Unnecessarily-] Compact coding tricks
Replies: 112
Views: 17210

Re: [Unnecessarily-] Compact coding tricks

The ones the coders before me have used in this project makes readability a nightmare sometimes. That last one seems perfectly readable to me. In fact, I recently threw together something similar for use in Java which almost instantly upon introduction to some of the "real-world" systems ...
by Berengal
Tue Jul 27, 2010 9:04 pm UTC
Forum: Coding
Topic: [Unnecessarily-] Compact coding tricks
Replies: 112
Views: 17210

Re: [Unnecessarily-] Compact coding tricks

Or in Haskell:

Code: Select all

[x | xs <- xss, x <- xs]

Also, obligatory:

Code: Select all

void strcopy(char *f, char *t) {
  while (*t++=*f++);
}
by Berengal
Tue Jul 27, 2010 8:57 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9988
Views: 1998834

Re: Coding: Fleeting Thoughts

Today I got to be a hero. The story of Codethulu, let me continue it: By now I've spent over a week looking at this abominable code, all the time with a (non-fictious) deadline hanging over me*. Not only is the logic incredibly convoluted, as I've previously mentioned, but I've unavoidably noticed s...
by Berengal
Mon Jul 26, 2010 10:52 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9988
Views: 1998834

Re: Coding: Fleeting Thoughts

Codethulu? It spreads its fell tentacles to everywhere. I like it. When the entire code base does this, can we call it a snake nest? Wormhole? Octopus clusterfuck? Um, dependency cancer - it's spread to all parts of the code body. Oh, and did I mention it's contagious? That's right. Intra-applicati...
by Berengal
Mon Jul 26, 2010 5:32 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9988
Views: 1998834

Re: Coding: Fleeting Thoughts

No, I mean like fetching connections to hard-coded databases all over the place.
by Berengal
Mon Jul 26, 2010 4:26 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9988
Views: 1998834

Re: Coding: Fleeting Thoughts

What do you call the opposite of dependency injection?
by Berengal
Sun Jul 25, 2010 9:15 pm UTC
Forum: Coding
Topic: How does the computer generate a random number?
Replies: 30
Views: 4612

Re: How does the computer generate a random number?

It's also worth considering that real randomness is so hard to get that there are people selling it by the gigabyte.
by Berengal
Sun Jul 25, 2010 12:24 pm UTC
Forum: Coding
Topic: How does the computer generate a random number?
Replies: 30
Views: 4612

Re: How does the computer generate a random number?

Because /dev/random blocks. Try 'cat /dev/random', see what happens, jiggle the mouse a bit, then compare with 'cat /dev/urandom'.
by Berengal
Thu Jul 22, 2010 8:24 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9988
Views: 1998834

Re: Coding: Fleeting Thoughts

Xanthir wrote:It's cargo cult to do anything for the sake of doing it, rather than for the original reason it was recommended. That's the definition of "cargo cult".
Screamingly obvious now it's coming from someone else...
by Berengal
Thu Jul 22, 2010 7:03 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9988
Views: 1998834

Re: Coding: Fleeting Thoughts

We all know that short functions/classes/modules/units of code are a good thing, but is it cargo cult to deliberately try to make them so? I've been reading some horrible code lately and I've noticed that even short parts are crap. Sometimes it's very easy to see that it's short because it was made ...
by Berengal
Thu Jul 22, 2010 4:01 pm UTC
Forum: Coding
Topic: Coding Habits
Replies: 24
Views: 3082

Re: Coding Habits

I mean code completion like Intellisense in VS. I'm fairly certain this isn't what TheChewanater was talking about, though, because it's pretty hard to be less productive with a good code-completion tool. Well, in the case of VS, not being able to navigate up or down using the arrow keys after you'...
by Berengal
Thu Jul 22, 2010 5:46 am UTC
Forum: Coding
Topic: Coding Habits
Replies: 24
Views: 3082

Re: Coding Habits

For Haskell there's Hoogle, which does that (available online, and as a local installation, searching online and local packages respectively), but I don't remember exactly how integrated into IDEs it is.
by Berengal
Mon Jul 19, 2010 6:14 am UTC
Forum: Computer Science
Topic: Your best Fibonacci algorithm?
Replies: 24
Views: 11660

Re: You're best Fibonacci algorithm?

The only piece of Haskell-magic in that code is the syntax. You could do the same in Java if you didn't mind doing arithmetic with objects and methods. The real magic lies in the CReal type, which is able to represent exactly any computable real, including irrationals.
by Berengal
Mon Jul 19, 2010 12:22 am UTC
Forum: Coding
Topic: Coding: Hacks and Snippets
Replies: 434
Views: 783671

Re: Coding: Hacks and Snippets

After watching Sorting out sorting I got inspired to write something that'd let me watch different sorting algorithms at work. After a couple of hours I've gotten to the point where the project is far from done, yet I feel like I've proven my point and thus unlikely to ever finish it. So, both in an...
by Berengal
Sun Jul 18, 2010 10:38 am UTC
Forum: Computer Science
Topic: Your best Fibonacci algorithm?
Replies: 24
Views: 11660

Re: You're best Fibonacci algorithm?

Playing around with arbitrary precision reals seems more fiddly than something like: Since we're on the topic of Haskell and arbitrary precision reals: import Data.Number.CReal phi = (1 + sqrt 5) / 2 fib n = (phi^n - (1 - phi)^n) / sqrt 5 ghci> fib 1000 :: Double 4.346655768693734e208 ghci> fib 100...
by Berengal
Sun Jul 18, 2010 10:16 am UTC
Forum: Coding
Topic: Fake Programming Language
Replies: 210
Views: 31260

Re: Fake Programming Language

But yes, being able to use a variable named "list" is actually very important to me. In general, variables and function occupy a completely different space in my head, and having to remember "hey, that's a function name, so I can't use it as an argument name" really frustrates m...
by Berengal
Sun Jul 18, 2010 10:07 am UTC
Forum: Coding
Topic: The eternal XML argument: attribute vs. element
Replies: 13
Views: 2836

Re: The eternal XML argument: attribute vs. element

Elements are the data, attributes are the meta-data. That sounds like a cute idea, but it can't work in practice. Composing elements is how you create structure in XML, while attributes have only a single structure; a name and an associated string. You can't nest attributes. This means that if you ...
by Berengal
Sat Jul 17, 2010 11:16 am UTC
Forum: Coding
Topic: Fake Programming Language
Replies: 210
Views: 31260

Re: Fake Programming Language

I just want fast first-class iterators in Lisp. Not the yucky mutating Python kind, though. My iterators go through a few layers of function evaluation, and so aren't great. The SERIES library sorta gets there, but not good enough. Perhaps what you want are the Functor, Foldable -> Traversable -> M...
by Berengal
Fri Jul 16, 2010 10:37 pm UTC
Forum: Coding
Topic: The eternal XML argument: attribute vs. element
Replies: 13
Views: 2836

Re: The eternal XML argument: attribute vs. element

It's all the same to me. Attributes are just shorthand for simple elements, and my brain helpfully abstract both into a nice mental tree-structure so I don't have to think about it. If I'm designing the schema I tend to not use any attributes at all, for consistency's sake. A rather common trend I'v...
by Berengal
Fri Jul 16, 2010 7:34 pm UTC
Forum: Coding
Topic: Fake Programming Language
Replies: 210
Views: 31260

Re: Fake Programming Language

styrofoam wrote:Back on topic, you still don't answer why it's better to tack onto the end instead of subclassing, or giving an external function.
Because of all the other code that uses the class in question, not arbitrary subclasses or functions.
by Berengal
Wed Jul 14, 2010 11:26 pm UTC
Forum: Religious Wars
Topic: Opera, Chrome, Firefox, OR?
Replies: 544
Views: 221680

Re: Opera, Chrome, Firefox, OR?

I dare anyone to beat 30px and include tabs, an address bar, and bookmarks, all with a reasonable horizontally expandable amount of space. I seem to remember... Yes, here it is, on page 7 : http://forums.xkcd.com/download/file.php?id=21163&mode=view Yes, Uzbl doesn't show the address bar, bookm...
by Berengal
Wed Jul 14, 2010 8:12 pm UTC
Forum: Religious Wars
Topic: Mac vs PC
Replies: 162
Views: 48991

Re: Mac vs PC

What are you sending that can't be opened on a mac anyway? Have some standards, don't use proprietary formats.
by Berengal
Wed Jul 14, 2010 3:16 am UTC
Forum: Coding
Topic: coworker rants
Replies: 92
Views: 14293

Re: coworker rants

STOP PUTTING PRINT STATEMENTS IN YOUR UNIT TESTS!!! edit: Holy shit. Not only is she printing stuff. She's faking the output of the unit testing suite from within her tests. I'm not a big fan of emoticons. In fact, I don't think I've ever used them on this board, or perhaps just once or twice while...
by Berengal
Mon Jul 12, 2010 10:25 pm UTC
Forum: Coding
Topic: [Java] Constructing a database
Replies: 5
Views: 810

Re: [Java] Constructing a database

Are the databases located at a central server or on the terminals themselves? Does it have a fixed schema, or can the user change it? Does it have a schema at all, or is it just a simplistic datastore (e.g. a key-value mapping, or event just a bunch of values)?
by Berengal
Wed Jul 07, 2010 3:57 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9988
Views: 1998834

Re: Coding: Fleeting Thoughts

Is there a standard way in Haskell to throw away a function's return value? I would imagine putting it in a "do" block with "return ()" after it would work, but that's hideous. I also imagine, based on my limited Haskell knowledge, that you could just write it yourself: stripFun...
by Berengal
Mon Jul 05, 2010 9:05 pm UTC
Forum: Coding
Topic: Object Oriented programming and relational databases
Replies: 9
Views: 2921

Re: Object Oriented programming and relational databases

If they're using some kind of ORM then perhaps that can be configured to fetch lazily. That way any objects they might fetch won't automatically pull in all the data at once. Instead it will only pull in some of it; could be just the ID, could be all non-object values except LOBs but it certainly wo...
by Berengal
Wed Jun 30, 2010 4:42 pm UTC
Forum: Computer Science
Topic: About solving halting problem on more general case
Replies: 128
Views: 13949

Re: About solving halting problem on more general case

Gödel's incompleteness theorem says that for a given theory T there exists a true proposition p in that theory for which there exists no proof. It doesn't say that you can't enumerate the proofs that do exist in that theory. Indeed, Gödel himself used the enumerability of proofs to prove exactly his...
by Berengal
Tue Jun 29, 2010 8:17 pm UTC
Forum: Coding
Topic: coworker rants
Replies: 92
Views: 14293

Re: coworker rants

The flowchart was more for my own benefit, and then I felt like sharing, so there.

Also, any functional programmer worth his salt would never even consider using iterator side-effects for anything. Iterators are for traversing something once.
by Berengal
Tue Jun 29, 2010 7:54 pm UTC
Forum: Coding
Topic: coworker rants
Replies: 92
Views: 14293

Re: coworker rants

Note that `map(foo, *bar) == map(foo, zip(*bar))'. I drew a flowchart (in no recognizable flowchart markup). It should be clear that the evilness is not in the map, but in the implicit zip (made explicit for your viewing pleasure) and the exploitation of the side effects of an iterator. flowchart.png
by Berengal
Tue Jun 29, 2010 7:15 pm UTC
Forum: Coding
Topic: Epic coding moments
Replies: 127
Views: 22474

Re: Epic coding moments

You can compare absolute length, but then you're comparing the languages, not skill of the golfer. It's just like how you can compare meat-space golfer A to golfer B if they play on the same course, and you can compare course A with course B if they're played by the same golfer.
by Berengal
Tue Jun 29, 2010 7:12 pm UTC
Forum: Computer Science
Topic: Open Database for Precomputed Solutions
Replies: 4
Views: 1354

Re: Open Database for Precomputed Solutions

There are some already, such as for primes. However, the trouble in general with such things is that it's very often much more economic, both in terms of money and in terms of speed, to recompute the value than to look it up in a table.
by Berengal
Tue Jun 29, 2010 6:18 am UTC
Forum: Coding
Topic: Using regex's in a natural language interface
Replies: 16
Views: 2419

Re: Using regex's in a natural language interface

Should I just use a more typical form-based interface? If you have the opportunity, prototype both interfaces and ask the client which he likes best. If you want to see which is more intuitive, don't tell them how it works, or tell them how it works, but ask them to do it again a day or two later, ...
by Berengal
Mon Jun 28, 2010 4:50 pm UTC
Forum: Coding
Topic: Using regex's in a natural language interface
Replies: 16
Views: 2419

Re: Using regex's in a natural language interface

Don't use any "natural language" interface for this. Natural language is full of structures and contexts that are either unavailable or superfluous in computer interfaces, and is optimized for speech, not keyboard or mouse (or barcode scanner) inputs. You cannot expect the user to know a f...
by Berengal
Sat Jun 26, 2010 11:08 pm UTC
Forum: Coding
Topic: Incrementing a Byte
Replies: 7
Views: 884

Re: Incrementing a Byte

I think Xanthir misunderstood you when you said "a byte that is incremented to 256 or -1" and thought you meant "when a byte is incremented, should it be set to 256 or -1?" Bytes go from 0 to 255 (or -128 to 127 if it's a signed byte.) Anyway, cells in brainfuck are traditionally...
by Berengal
Fri Jun 25, 2010 9:00 pm UTC
Forum: Coding
Topic: Fake Programming Language
Replies: 210
Views: 31260

Re: Fake Programming Language

That last bit can be turned into a real language just by moving three characters and adding a space:

Code: Select all

(printf "%d < %d\n" 10 100)

(
printf "%d - %d = %d" 10 5 (- 10 5))
  

Go to advanced search