Search found 820 matches

by 0xBADFEED
Wed Mar 03, 2010 3:10 pm UTC
Forum: Coding
Topic: Is Java that bad?
Replies: 114
Views: 19121

Re: Is Java that bad?

Congratulations, you have torn down one of the fundamentals of Java with a single statement. "Is Java that bad?", indeed... How do you think it should work? What would C++ do? From what I understand, C++ would continue destroying the object, and the pointer you put in the cache would be i...
by 0xBADFEED
Sun Feb 28, 2010 8:17 pm UTC
Forum: Coding
Topic: Iterators in Python
Replies: 9
Views: 1114

Re: Iterators in Python

I don't know exactly what you're using these lists for but if you're using them to maintain connection information about nodes in a graph you might find a more specialized data structure performs better. For instance, something like a disjoint-set datastructure with path-compression may give you som...
by 0xBADFEED
Sun Feb 28, 2010 3:30 pm UTC
Forum: Coding
Topic: Iterators in Python
Replies: 9
Views: 1114

Re: Iterators in Python

If it's a tight loop he may have to sacrifice pythonic for speed. Yeah, it's hard to give any kind of solution without knowing the context of the code (tight loop?, size of lists, etc.). I was kind of assuming lists of 100+ elements. Although if it's a tight loop and he's worried about speed the be...
by 0xBADFEED
Sun Feb 28, 2010 2:51 pm UTC
Forum: Coding
Topic: Iterators in Python
Replies: 9
Views: 1114

Re: Iterators in Python

Honestly, the Pythonic way to do this is common = set(a) & set(b) Assuming you don't care about keeping duplicate elements or maintaining the ordering of the elements in the common set. If you do care about ordering and multiplicity of elements then, as RoadieRich suggested, you can just do: sb ...
by 0xBADFEED
Sat Feb 27, 2010 3:38 pm UTC
Forum: Coding
Topic: Shared Libraries / DLL's... wuuuuuuuuuuuuuuuuuut?
Replies: 9
Views: 1394

Re: Shared Libraries / DLL's... wuuuuuuuuuuuuuuuuuut?

Thanks for that. Now what about functions that load a shared library at runtime? Basically in Windows there are two main API calls for working with implicit linking at runtime, LoadLibrary and GetProcAddress. LoadLibrary loads the DLL into the current process and GetProcAddress allows you to get th...
by 0xBADFEED
Sat Feb 27, 2010 2:04 am UTC
Forum: Coding
Topic: Shared Libraries / DLL's... wuuuuuuuuuuuuuuuuuut?
Replies: 9
Views: 1394

Re: Shared Libraries / DLL's... wuuuuuuuuuuuuuuuuuut?

Import library, that's a static library that is produced with a DLL right? When you compile some code as a shared library two files are produced, the shared library (.dll/.so) and the import library (.lib/.a). The shared library contains the actual functional code. The import library just contains ...
by 0xBADFEED
Fri Feb 26, 2010 1:27 pm UTC
Forum: The Help Desk
Topic: Seeking complex graph visualisation program
Replies: 7
Views: 1522

Re: Seeking complex graph visualisation program

Have you looked at yEd? I haven't used it in a long time but I remember it being pretty decent.
by 0xBADFEED
Fri Feb 26, 2010 2:57 am UTC
Forum: Coding
Topic: Shared Libraries / DLL's... wuuuuuuuuuuuuuuuuuut?
Replies: 9
Views: 1394

Re: Shared Libraries / DLL's... wuuuuuuuuuuuuuuuuuut?

DLL stands for dynamic linked library, which means the compiler does nothing. You have to use a function call, but it varies from OS to OS. You're right, but this is somewhat misleading. If you want to dynamically load a dll without linking to it at link-time this is true (e.g. using LoadLibrary on...
by 0xBADFEED
Fri Feb 26, 2010 12:31 am UTC
Forum: Coding
Topic: Shared Libraries / DLL's... wuuuuuuuuuuuuuuuuuut?
Replies: 9
Views: 1394

Re: Shared Libraries / DLL's... wuuuuuuuuuuuuuuuuuut?

It's hard to diagnose without more information. "They just don't link" isn't very informative. A few things you could check: Make sure you're linking to the import library (the .lib/.a files) for the shared libraries and not the shared library itself. Make sure the path containing the impo...
by 0xBADFEED
Sat Feb 20, 2010 11:56 pm UTC
Forum: Coding
Topic: Coding: Hacks and Snippets
Replies: 434
Views: 784422

Re: Coding: Hacks and Snippets

The new auto has been useful since gcc 4.4 (using -std=c++0x), and it won't be taken out of the standard, so I use it now. Yeah I know, but I tend to use VC8 so no love for me on the 0x front. If I recall correctly, the static/dynamic/const/reinterpret_cast notation was deliberately made explicit a...
by 0xBADFEED
Sat Feb 20, 2010 7:04 pm UTC
Forum: Coding
Topic: Coding: Hacks and Snippets
Replies: 434
Views: 784422

Re: Coding: Hacks and Snippets

C++0x : auto *object = dynamic_cast<SomeObjectType*>(anotherObject); Yeah, I'm aware of the 'auto' declaration for C++0x and you're dead-on that's basically what I was going for. I was more wondering if there were any existing implementations (for current standard C++) of this pattern. It's so simp...
by 0xBADFEED
Sat Feb 20, 2010 4:32 pm UTC
Forum: Coding
Topic: Coding: Hacks and Snippets
Replies: 434
Views: 784422

Re: Coding: Hacks and Snippets

Ok, so I was just thinking the other day how ugly casting is in C++ and the ridiculous redundancy of things like: SomeObjectType* object = dynamic_cast<SomeObjectType*>(anotherObject); So I made this little utility function to alleviate the redundancy and use the automatic C++ type deduction to fill...
by 0xBADFEED
Wed Feb 17, 2010 1:35 am UTC
Forum: Religious Wars
Topic: Can a machine be conscious?
Replies: 162
Views: 29909

Re: Can a machine be conscious?

Which begs the question, of the possible lay definitions, which particular one do you now claim is typical of all lay people. And how do you arrive at this without simply being arrogant. When you get all indignant with someone and try to start a semantics battle over some imaginary slight to your i...
by 0xBADFEED
Sun Feb 14, 2010 4:34 pm UTC
Forum: Coding
Topic: Java GUI suggestions
Replies: 9
Views: 1415

Re: Java GUI suggestions

binary search trees, hash maps and arrays didn’t change in this time, gui libraries did. Please give some examples of how GUI libraries have fundamentally changed in this time period. The Swing API is much like every other modern UI toolkit I've ever used. Have you used Swing? make a big qt applica...
by 0xBADFEED
Sun Feb 14, 2010 2:11 pm UTC
Forum: Coding
Topic: Java GUI suggestions
Replies: 9
Views: 1415

Re: Java GUI suggestions

It looks like Java2D is the closest to what I'm looking for. I don't need as polished a look as Swing gives, and I'm more interested in working with direct mouse pointer locations than abstract classes like the buttons and menus from Swing. I don't think you understand how Swing/AWT/Java2D fit toge...
by 0xBADFEED
Sat Feb 13, 2010 1:14 am UTC
Forum: Coding
Topic: Java GUI suggestions
Replies: 9
Views: 1415

Re: Java GUI suggestions

don’t use java for guis, it’s not what that language was made for. qt and c++, gtk+ and c or one of these with python, ruby, … It's certainly part of what the language was made for. If it's not "what the language was made for" then I'm confused as to why they went through the herculean ef...
by 0xBADFEED
Wed Feb 10, 2010 3:42 pm UTC
Forum: Coding
Topic: C++ Inheritance Type Safety
Replies: 15
Views: 1801

Re: C++ Inheritance Type Safety

Hey, I'm trying to implement a "type safety" style system. In essence, I'm would like to implement this feature such that, class A { operator B*(); }; class B : A {}; A* a = new B(); B* b = a; The reason this doesn't work is that you've defined the implicit conversion on type A . What you...
by 0xBADFEED
Thu Feb 04, 2010 2:08 pm UTC
Forum: Coding
Topic: Scanner and Parser Generators for C++
Replies: 5
Views: 1105

Re: Scanner and Parser Generators for C++

What about using something like gcc-xml. It uses gcc's C++ front-end to parse C++ source files and then generates an XML representation of the parse tree. Then you can just read in the XML and operate on the already-parsed structure. I've never used it personally but I have to imagine it's much easi...
by 0xBADFEED
Wed Feb 03, 2010 3:11 am UTC
Forum: Coding
Topic: Have you written a game?
Replies: 58
Views: 6055

Re: Have you written a game?

However, your solution doesn't work either. I was actually assuming 'a' and 'b' were floats in which case it handles the division correctly in something like C++. A midpoint calculation returning an 'int' doesn't really make much sense. In any case my point wasn't to illustrate a robust midpoint ca...
by 0xBADFEED
Tue Feb 02, 2010 9:40 pm UTC
Forum: Coding
Topic: Have you written a game?
Replies: 58
Views: 6055

Re: Have you written a game?

Really? I've always heard "naive solution" used to refer to the simplest correct solution to a problem with a more effective but also more complicated solution(s). As in, the naive solution to integer knapsack would be iterating through every possible subset of items and comparing their v...
by 0xBADFEED
Tue Feb 02, 2010 2:26 pm UTC
Forum: Coding
Topic: Have you written a game?
Replies: 58
Views: 6055

Re: Have you written a game?

You're confusing naive parallelism with bad parallelism. I don't want to drag this out much farther because it's already horribly off-topic. You're using the word "naive" in a way that is somewhat inconsistent with its typical usage in computing that was causing me some confusion. When pe...
by 0xBADFEED
Mon Feb 01, 2010 12:50 am UTC
Forum: Coding
Topic: Is Java that bad?
Replies: 114
Views: 19121

Re: Is Java that bad?

It's also a bit of "Java really rubs my intuitions about good languages the wrong way. Wouldn't the world be a better place had this scourge work of mediocrity never been inflicted upon us created?" I don't know about that. What took its place could have been a billion times worse. Imagin...
by 0xBADFEED
Sun Jan 31, 2010 9:29 pm UTC
Forum: Coding
Topic: Is Java that bad?
Replies: 114
Views: 19121

Re: Is Java that bad?

No. Java isn't that bad. Most developers don't like it. It has probably the smallest feature set of any widely used modern language. It's very boring as far as languages go. There are very few tricks that let you demonstrate to everyone how clever you are. Stylistically and syntactically it's very p...
by 0xBADFEED
Sun Jan 31, 2010 1:42 pm UTC
Forum: Coding
Topic: Have you written a game?
Replies: 58
Views: 6055

Re: Have you written a game?

Absolutely true, I've made a shortcut there. I meant to say "a properly used naive parallelization is better than any assembly". For example, if an algorithm's main work is done in a huge for loop with no dependencies, a "naive" way to parallelize it would be to just slap #pragm...
by 0xBADFEED
Sat Jan 30, 2010 10:45 pm UTC
Forum: Coding
Topic: Have you written a game?
Replies: 58
Views: 6055

Re: Have you written a game?

_Big_Mac_ wrote:No amount of assembly hacks will be faster than even naive parallelisation.

Certainly not true. Naive parallelization can easily be slower than naive serial code.
by 0xBADFEED
Sat Jan 30, 2010 4:40 am UTC
Forum: Coding
Topic: Revert Iostream to previous settings in C++?
Replies: 7
Views: 746

Re: Revert Iostream to previous settings in C++?

What's wrong with streamsize initial = out.precision(); out << setprecision(whatever); .... out << setprecision(initial); I'm not aware of any single object that bundles up all the formatting parameters of an iostream that allows you to save/restore them, but it would be fairly easy to make if you w...
by 0xBADFEED
Sun Jan 24, 2010 3:32 pm UTC
Forum: Religious Wars
Topic: Best paradigm
Replies: 16
Views: 3593

Re: Best paradigm

Mutable variables are also hard and easy to get wrong. For example, what does this do? Cplusplus = C++; print(Cplusplus >= C); It deceives the untrained reader. "Cplusplus" is simply a misnamed variable, as it actually holds the old value of C. Using shorthand notation, as well as inappro...
by 0xBADFEED
Tue Dec 22, 2009 4:02 pm UTC
Forum: Religious Wars
Topic: Is Java is a bad language for beginners?
Replies: 234
Views: 133262

Re: Is Java is a bad language for beginners?

The worst thing about design patterns as they're practiced today is how they cloud the mind. There's nothing about design patterns that cloud the mind. If anything they clarify many instances of problems that come up in OO languages that, previously, had been very wishy-washy vague ideas. It's just...
by 0xBADFEED
Tue Dec 22, 2009 3:21 pm UTC
Forum: Computer Science
Topic: Which problem has the highest computational complexity?
Replies: 25
Views: 3356

Re: Which problem has the highest computational complexity?

achan1058 wrote:You still need to spit out the prime, no?

Sure, it's technically O(b) for a b-bit prime. But that ruins the joke. :roll:
Comedic necessity often trumps technical correctness. Let it go.
by 0xBADFEED
Tue Dec 22, 2009 2:11 pm UTC
Forum: Computer Science
Topic: Which problem has the highest computational complexity?
Replies: 25
Views: 3356

Re: Which problem has the highest computational complexity?

Integer factorization is expected to be outside P. Anyway, intuition seems to say that O(1) is not feasible since that might imply precomputing the factorizations, but since the integers are countably infinite, this cannot be done (the TM's tape is infinite, but the initialization of the tape is no...
by 0xBADFEED
Mon Dec 21, 2009 4:03 pm UTC
Forum: Computer Science
Topic: Which problem has the highest computational complexity?
Replies: 25
Views: 3356

Re: Which problem has the highest computational complexity?

A linear constant O(n) for adding two n-digit numbers together, for example, would have an infinite complexity as n tends to infinity. No. An O(n) algorithm for adding n-digit numbers will always have linear complexity, no matter the value of n . That's the whole point of complexity classes. "...
by 0xBADFEED
Sat Dec 19, 2009 6:50 pm UTC
Forum: Religious Wars
Topic: Is Java is a bad language for beginners?
Replies: 234
Views: 133262

Re: Is Java is a bad language for beginners?

If a beginner starts with Java, they should move on before their mine is poisoned by design patterns. I don't think there's anything inherently wrong with design patterns. In fact, knowing design patterns, understanding the problems they solve, and understanding why some of them are unnecessary in ...
by 0xBADFEED
Sat Dec 19, 2009 3:37 pm UTC
Forum: Coding
Topic: C or C++ for Linux coding?
Replies: 36
Views: 3978

Re: C or C++ for Linux coding?

MSVC doesn't actually support development in C. The compiler implements a vaguely C-like language, but it's not really close to the language defined in ISO C99. I don't do enough C++ coding to comment on the state of C++ in MSVC, but I'm told that the story is somewhat better. Starting with VS2005 ...
by 0xBADFEED
Thu Dec 17, 2009 3:17 pm UTC
Forum: Religious Wars
Topic: Can a machine be conscious?
Replies: 162
Views: 29909

Re: Can a machine be conscious?

My guess is that by simulating organic processes, we'll end up with simulated intelligence, simulated emotions, simulated self-awareness. And I think that after five minutes of conversation with this simulated life form, you'd be able to tell that something was fundamentally "off." My bas...
by 0xBADFEED
Wed Dec 16, 2009 5:26 pm UTC
Forum: Computer Science
Topic: Books for the Computer Scientist
Replies: 3
Views: 1004

Re: Books for the Computer Scientist

Have you read GEB?
by 0xBADFEED
Wed Dec 16, 2009 2:59 pm UTC
Forum: Computer Science
Topic: Remote Game Idea
Replies: 22
Views: 3425

Re: Remote Game Idea

with under 100ms latency looks slow to a user, anything faster looks fast. I can get a ping response to Google in 19ms. So, let's say, that most of the time, we can get to a server in 20ms. 20 ms seems incredibly optimistic/unrealistic for an "average latency". That seems more like a best...
by 0xBADFEED
Mon Dec 14, 2009 4:00 pm UTC
Forum: Coding
Topic: [C++] Empty struct has sizeof != 0 when in another struct
Replies: 4
Views: 1027

Re: [C++] Empty struct has sizeof != 0 when in another struct

Here's a tip to keep your code more readable and modularized. When you have a bunch of specializations that are basically the same, put the implementation in a class/struct by itself and have the specialization inherit the implementation. For instance, you've got basically the same hasher repeated e...
by 0xBADFEED
Sun Dec 13, 2009 2:23 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2009931

Re: Coding: Fleeting Thoughts

When GTK calls a function in gtk_main() that has been cast to a g_callback, it uses the emitter of the signal that that triggered the callback as the first parameter. I learned this the hard way when I tried printing a string and ended up getting a pointer. Ah, ok it's a callback hook. Seeing thing...
by 0xBADFEED
Sun Dec 13, 2009 1:34 am UTC
Forum: Religious Wars
Topic: Is Java is a bad language for beginners?
Replies: 234
Views: 133262

Re: Why Java is a bad language for beginners

BlueNight wrote:2. Conceptual overhead. It's the only language that will run on this "ideal machine" emulator.

I'm not sure what you mean. There are tons of languages that will run on the JVM.
by 0xBADFEED
Sun Dec 13, 2009 1:28 am UTC
Forum: Coding
Topic: UI Programming
Replies: 55
Views: 6772

Re: UI Programming

I think Qt has an XML description for GUIs as well, but I have always just used Qt Creator. Yes Qt has an xml format for describing ui's. That's actually what the ui builder generates. Then the uic process translates the xml file to C++ code to be included in the application. This is how most ui bu...

Go to advanced search