Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

FUCKING JAVA

Name: Anonymous 2010-03-31 21:23

Now, I have to write a crossword solver using Java for an AI class - no problem, right?
...until you factor in FUCKING JAVA.

First, I created an arraylist of constraint objects - now there are only 16 of them on the example I'm running, and it just holds something like four integers. Then I get OUT OF HEAP MEMORY or some gay shit error like that, after swearing at the automatic garbage collection and calling it manually I saw that it didn't help, and then I thought I shouldn't have used a faggy arraylist in the first place - so I make an array.

I use a set of 36 to ensure it fits but I get an out of bounds index error
huh
I increase array size to 90
same error
reduce to 17
same error

WHAT THE FUCK

JAVA SHOULD DIE IN A FUCKING FIRE

Name: Anonymous 2010-03-31 21:26

Read SICP.

Name: Anonymous 2010-03-31 21:28

In before: complete Common LISP or Scheme implementation of the said solver

Name: Anonymous 2010-03-31 21:31

Sounds like you deserve each other.

Name: Anonymous 2010-03-31 21:32

OP is shit Java programmer. We have yet to determine whether that is a good or a bad thing.

Name: Anonymous 2010-03-31 21:33

>>3
would I be even bothering with java if I had a choice of programming languages?

>>2
I did in my first year

Name: Anonymous 2010-04-01 0:23

Increasing the array size will not help with an ArrayIndexOutOfBoundsException.  You have to trace the problem to the loop or statement that causes the array's index to exceed the length of the array.  Seriously, this problem already exists in other languages and you should have no excuse for this ignorance.

As for your heap troubles, you're on your own.  As a last resort, increase the amount of memory the JVM has access to at run time with "java -Xms[min] -Xmx[max] [class file]"

Name: Anonymous 2010-04-01 0:37

>>7
Alright, I've looked into it a bit
If I comment out object creation,

1[1] = 2[0]
ITER: 0
1[3] = 3[0]
ITER: 1
1[5] = 4[0]
ITER: 2
2[3] = 5[1]
ITER: 3
2[2] = 7[0]
ITER: 4
3[3] = 5[3]
ITER: 5
3[2] = 7[2]
ITER: 6
3[4] = 10[1]
ITER: 7
4[3] = 5[5]
ITER: 8
4[2] = 7[4]
ITER: 9
4[4] = 10[3]
ITER: 10
5[4] = 8[1]
ITER: 11
5[2] = 9[1]
ITER: 12
6[2] = 9[3]
ITER: 13
7[3] = 8[0]
ITER: 14
7[1] = 9[0]
ITER: 15

--

it stops at 16 elements, like it should.
But if I uncomment
newconst[count] = new Constraint(i,(k=yc[i]),j,(xc[i]-xc[j]));

it repeats finding the same place even though the data structure isn't used anywhere at all. If I take off the array, and just create the object, I see that it runs infinitely.

Now, tell me one logical way of how creating a data structure inside a loop should influence its inner workings...

Name: Anonymous 2010-04-01 0:44

OH GOD FUCKING DAMN IT

I WROTE AN = INSTEAD OF -
HOW IS THAT A FUCKING VALID THING EVEN

THAT WAS THE WHOLE THING
FUCK

I CAN'T BELIEVE THE SHEER STUPIDITY

Name: Anonymous 2010-04-01 1:21

>>9
Because, pseudocode:
Object obj = null;
while((obj = queue.getObj()) != null)
{
   // Do something with obj
}
// No (more) obj

Name: Anonymous 2010-04-01 3:38

>>10
That is handy but discouraged and ultimately destructive.

Name: Anonymous 2010-04-01 7:51

>>11
Why and how is that?

Name: Anonymous 2010-04-01 8:39

>>1
Um guy? The algorithm is going to be the same in Java as in anything else. Just stop bitching and do it.

Name: Anonymous 2010-04-01 10:36

calls for a classic read-the-fucking-manual,-faggot.

Name: Anonymous 2010-04-01 12:59

>>11
In a multithreaded program, you mean?

Name: Anonymous 2010-04-01 13:27

>>15
Yes, you should just use synchronized as a good java citizer. In this case:

synchronized while ((c = source.getObject()) != null) {
    /**
    *
    * Do stuff here
    **/
}

Name: Anonymous 2010-04-02 4:01

Stop using ArrayLists. They take up way too much memory. Try allocating a shit ton for a regular array instead.
ArrayLists cause Heap overflows very easily.

Name: Anonymous 2010-04-02 5:24

>>17
Your opinion seems suspect, my friend.

Name: Anonymous 2010-04-02 6:01

If you want something simple, CL or Python, although I personally prefer Python because of ideologies that are more common to me.
Java is pretty horrible, and even if labeled as an MS-fanboy, the .NET framework is pretty solid running one, and the only problem I have with it is the memory usage, and that you can only run your code (reliably) on Microsoft platforms. Which is only the majority of computer users but hey.

Currently I'm working on a C++ project utilizing some of our own libraries and a certain cross-platform multimedia API, and believe me the language has driven me and my colleagues (all the 3 of them) nuts.
Yes we know operator overloading, template shitprogramming and all the other things that were supposed to help us programmers with C but were executed poorly within the language with general hacks. Need for forward declarations in certain cases, general stupidity of most build-softwares and the almost absolute need for your C++ program to allocate every fucking thing with new, which you can override with custom allocators but fuck.

I'm drunk right now, and a little high, and typing on my friend's computer but yeah.
Happy day for everyone out here in this Desolate Den.

And yeah I know about D but... well I don't know why I didn't bother with it for much longer, perhaps the little things about the language (well actually the standard library) that seemed little off to me. And that it was a bitch to setup on Windows, which I use for coding whenever I'm visiting my relatives.

Well this was a whole load of post of nothing.

Name: Anonymous 2010-04-02 6:26

You can emulate OOP in C and it's a whole lot more satisfying than in a designated OOP language.

Name: Anonymous 2010-04-02 9:12

Name: Anonymous 2010-04-02 9:37

>>21
he looks young there *fap*fap*fap*

Name: Anonymous 2010-04-02 11:06

Now, I have to write a crossword solver using C for an AI class - no problem, right?
...until you factor in FUCKING C.

First, I created a linkedlist of constraint objects - now there are only 16 of them on the example I'm running, and it just holds something like four integers. Then I get SEGMENTATION FAULT or some gay shit error like that, after swearing at free() and removing it  I saw that it didn't help, and then I thought I shouldn't have used a faggy linkedlist in the first place - so I make an array.

I use a set of 36 to ensure it fits but I get a segmentation fault
huh
I increase array size to 90
same error
reduce to 17
same error

WHAT THE FUCK

C SHOULD DIE IN A FUCKING FIRE

Name: Anonymous 2010-04-02 11:20

>>23
Just use a debugger.

C SHOULD DIE IN A FUCKING FIRE
I agree.

Name: Anonymous 2010-04-02 11:22

>>24
Really? Even though there's nothing in-your-face or offensive about it? It's just... nice. It does what you tell it to and it's fast.

Name: not >>24 2010-04-02 11:27

>>25
C's fine, but humans tend to be less fine. We tend to forget various details when we have to keep a lot of information in your head. which sometimes leading to subtle bugs. While C is excellent for low-level tasks, I think for high-level ones, languages which let you build abstraction on top of abstraction, while hiding everything else neatly underneath(after you've tested and make sure it all works) are more suitable as they let you just think at the problem at hand and you can take care of low-level details once, and then just forget about them, instead of having to keep them in mind at each step.

Name: Anonymous 2010-04-02 14:19

>>26
Or you could learn to write proper abstractions, and do so in C.

Name: Anonymous 2010-04-02 14:54

>>27
You can do so in most languages, just in some it takes more work to do the same thing.

Name: Anonymous 2010-04-02 15:56

>>28
You can do so in any TC language. The myth is that it somehow takes longer.

If you are building abstractions properly then your first order of business is to start with the correct abstraction so that (among other things) it does not take longer. If you fail in this or if writing the abstraction is the bulk of your work you're just not doing it properly.

Name: Anonymous 2010-04-02 20:02

>>29
If a certain language feature would save you a lot of time when implementing some abstraction, then it does mean that in that certain language, certain classes of problems are easier to solve.

Of course, if the language is turing complete, you can make a compiler or interpreter for any language you choose and you won't be constrained by anything in that way, but that doesn't mean the language is suitable for writing the application entirely in it.

Here's a rather extreme example:
Would you rather code in Brainfuck, or would you rather make a ``insert your favorite language''->..->brainfuck compiler, and then code in your favorite language?

That example is a bit extreme, but no one can claim that C has all the features you'd want for any kind of high-level coding. If you're involving another compiler/interpreter here to elevate your language to something better, than you're no longer programming in pure C, but that's what abstraction is about - it's also about extending one's language. There's no language which is perfect for any problem, but the more extensible it is, the easier it is to extend the language to a domain more closer to your problem (which is one way to abstract), and eventually solve your problem.

Name: Anonymous 2010-04-02 20:20

>>29
Brainfuck is TC, your argument is invalid.

Name: Anonymous 2010-04-02 20:27

>>31
How about you re-read my argument.
The discussion is about the difficulty of creating certain kinds of abstractions in some languages. Of course you can always make a compiler/interpreter and change the language at will in that way, but if you do that, you might as well be using another language.

Name: Anonymous 2010-04-02 20:55

>>30
Obviously I would rather code in C. But the 'extreme example' you anticipate is exactly what I'm on about. The 'extreme' part is important -- writing a C compiler in brainfuck solves the general problem of implementing another programming language and in that sense the abstraction, as I've put up, is not excessive.

The deal with abstractions is that, as you say, different languages have different abstractions in their immediate grasp. Many of these are language features, many are library features (and in some cases this distinction is greatly artificial.) Procedural languages (especially the assemblers) tend to come from the point of view of operating a machine--which is in fact the case. Functional and other types begin to depart from this, but few of them do so convincingly in my opinion.

Unless you want to use a Perl, there's always a massive area that requires you to write abstractions. The size of the abstraction you have to write is rarely very large compared to the problem you will solve with it, unless you think you need to implement a full C compiler because you're not really a brainfuck programmer at all. That isn't the proper abstraction for one, and if you're not good with the language in question replacing the one you do with it, just because it has more to say explicitly about the problem (preconceptions and all!) is just about the worst idea you could really come up with.

So to restate, every good programmer who is good with C knows that switching to any other language because C is 'dangerous' or 'takes too long' to code in is complete bullshit. Same goes for just about everything else out there, including brainfuck.

>>31
lurkmoar

Name: Anonymous 2010-04-02 21:23

>>33
I assumed you were trolling before, but now I see you've just never actually written anything bigger than factorial. How delightful.

Name: Anonymous 2010-04-02 21:27

>>33
C is 'dangerous'
Don't think I've said this, altough C does open you up to the potential of making certain errors. This isn't neither bad or good, it's just what you ask for when you use C, and it's usually exactly what you want(managing pointers and memory yourself).
'takes too long'
I've found this to be in practice true. Writing one tool took me some 10 hours to write an debug in C, while writing it in a high-level language only took 2 hours to write and debug. The source code size was also about 4 times less. This is just a matter of picking the right tool for the job. I don't regret writing the C version as it's very slim and fast, but it was my mistake for using C to do an inheretely high-level task, and I could have finished my program 8 hours earlier had I chosen a different language. It's just about the tradeoffs one has to make.
Same goes for just about everything else out there, including brainfuck.
A practical example out of my daily life:
I sometimes use an embedded language that comes with one tool to automatize certain complex tasks. The language is highly inadequate, slow and painful to use for complex tasks. It even lacks basic procedural abstraction (it's basic-like, but not quite). If the tool provided a more suitable language, development time could be decreased by an order of magnitude. Of course, I can technically do anything in the language, and it does seem to contain at least minimal elements needed for Turing Completeness. However, what I do in practice when I get fed up with it, is just call external code written in C or other languages as the embedded language has a way of calling external code. The point I tried to make here is that a language which is unfit for the job will only make your work harder and take longer, providing you're actually coding in the original language, without implementing a new language on top of it. (In defense of that embedded language: it's actually reasonable and easy to use it for certain simple task that you would do in that tool, and for that it's a fine language, but as complexity increases, it does not scale at all.)

Name: Anonymous 2010-04-02 23:13

>>34
Another short ignorant assertion. You're >>31 aren't you?

>>35
C is 'dangerous'
I didn't mean to say this was your position. It was implied earlier. I don't know whether you made that post or now. Regardless, it's a common argument.

A practical example out of my daily life:
I'm not going to belittle you for being anecdotal (which seems to be the trend), but there are problems with your anecdote. First, you say it seems to be TC, which--lets suppose it is--tells me that you haven't exactly mastered its use. Second, you are still using the 'extreme example' previously discussed, going from no abstraction to implementing another language entirely. This is a really big clue that my first guess is dead-on.

Calling out to C is a good idea. It's efficient and you are, presumably, a proficient C programmer. If you need a lot of stuff--heavy lifting--chances are your embedded language would not be up to the task in a reasonable manner, maybe you'd eat too much RAM or CPU.

It's no secret that I overstated my position. Standard libraries and tools to help with abstractions--the ones that do help--can play a role here. But the truth is the only times I get fed up with a language that I know well are the times when I can't efficiently produce an well-performing result with the language, which is why I used C in my examples. It has roughly maximal portability and efficiency--and very close to maximal when either aspect is taken individually. But I don't ever ditch another language for C just because C has some native feature that the other would need to abstract. If I've chosen that language in the first place it is because the bit of legwork I can avoid by using it doesn't come at a severe cost to efficiency or some other area of design. I could have gone the other way and preferred the other language by default and the argument would be the same, but in the end I like building abstractions out of machination so I'm pretty comfortable.

Name: Anonymous 2010-04-03 11:45

I spread the flaps of my anus and fly this thread to the top of the page.

Name: Anonymous 2010-04-03 15:04

>>37
I wish you wouldn't do that.

Name: Anonymous 2013-04-23 13:13

I AM A C++
SON OF A BITCH JAVA
GC IS PIG
DO YOU WANT A WRITE ONCE?
DO YOU WANT A RUN ANYWHERE?
JAR IS PIG DISGUSTING
JAMES ARTHUR GOSLING IS A MURDER
FUCKING JVM

Name: Anonymous 2013-04-23 14:01



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-23 14:12



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-23 14:25



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-23 14:40



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Don't change these.
Name: Email:
Entire Thread Thread List