Search found 209 matches

by InkL0sed
Wed Jan 27, 2010 6:41 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034734

Re: Coding: Fleeting Thoughts

Is this a safe thing to do in C? void (**func_array)(void); func_array = (void (**) (void))malloc(some_num * sizeof(void (*) (void)); Google searches only result in the syntax for an array of function pointers, but I want a dynamically allocated array. The sizeof() part makes me uneasy. It compiles,...
by InkL0sed
Wed Jan 06, 2010 4:39 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034734

Re: Coding: Fleeting Thoughts

stephentyrone wrote:
lulzfish wrote:I would add Lua's thing where:

Code: Select all

{itemOne, itemTwo, itemThree,}

is valid. (It's the last comma, it wouldn't be valid in any other language I've ever used)


Huh? Hell, that's valid in C.


The last comma? Since when?
by InkL0sed
Sat Dec 26, 2009 8:03 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034734

Re: Coding: Fleeting Thoughts

Berengal wrote:
InkL0sed wrote:I think references are stupid and shouldn't exist in the first place.
I think C++ is stupid and shouldn't exist in the first place but then again, I'm a PL elitist.


Agreed.
by InkL0sed
Fri Dec 25, 2009 8:44 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034734

Re: Coding: Fleeting Thoughts

Yes, "->" is very handy, but there's a lot of times where I forget that something is a pointer to an object, and I use ".". The "." doesn't make any sense, and it should be automatically made into a "->", but C++ whines at me that I can't treat a pointer as a...
by InkL0sed
Fri Nov 27, 2009 9:53 pm UTC
Forum: Coding
Topic: Compiler Design
Replies: 14
Views: 1516

Re: Compiler Design

I'd be interested in that, definitely.
by InkL0sed
Thu Nov 26, 2009 2:35 pm UTC
Forum: Coding
Topic: Accessing files on a USB drive in C
Replies: 9
Views: 1098

Re: Accessing files on a USB drive in C

Oh, I see. I feel stupid now.
by InkL0sed
Thu Nov 26, 2009 5:09 am UTC
Forum: Coding
Topic: Accessing files on a USB drive in C
Replies: 9
Views: 1098

Accessing files on a USB drive in C

I'm sure there must be some simple way to do this, but I don't know how and the Oracle (aka Google) doesn't seem to understand. So, how is it done? Can you just call fopen()? If so, how do you specify the path? I'm on a Mac btw, so I'm looking for a Unix-y way to do it. I also happen to be running L...
by InkL0sed
Sun Nov 08, 2009 5:40 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034734

Re: Coding: Fleeting Thoughts

Is there something wrong with liking C strings?
by InkL0sed
Thu Oct 29, 2009 5:26 pm UTC
Forum: Coding
Topic: New initiate into the grand order
Replies: 18
Views: 2734

Re: New initiate into the grand order

I've used eclipse and for the most part i think the interface is slow and unintuitive...ive heard of kdevelop and will check that out...netbeans reeks of java unfortunately, i havent had much grindtime on the new system...Im finding that there arent enough hours in the day to to work fulltime AND b...
by InkL0sed
Mon Oct 19, 2009 6:05 pm UTC
Forum: The Help Desk
Topic: Apple Developer Tools and switching laptops
Replies: 4
Views: 745

Re: Apple Developer Tools and switching laptops

I downloaded the Tools and now I can't seem to open Xcode. But I have gcc. $ gcc i686-apple-darwin10-gcc-4.2.1: no input files $ xed hello.cpp 2009-10-19 14:03:24.821 xed[690:903] Can't find app with identifier com.apple.xcode $ open -a Xcode hello.cpp The application /Developer/Applications/Xcode.a...
by InkL0sed
Sun Oct 18, 2009 5:41 pm UTC
Forum: The Help Desk
Topic: Apple Developer Tools and switching laptops
Replies: 4
Views: 745

Apple Developer Tools and switching laptops

So I just recently bought a MacBook Pro and transferred all my old files from my 2 year-old MacBook, which had the Developer Tools. I no longer have gcc on the new laptop, which I think is because the new one is 64-bit. On the other hand, Xcode still seems to work My question is thus, what do I have...
by InkL0sed
Wed Oct 14, 2009 6:48 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034734

Re: Coding: Fleeting Thoughts

The below Java code outputs "nullfoo". WTF??!?!

Code: Select all

  String s = null;
  s += "foo";
  System.out.println(s);


I need an explanation, fast.
by InkL0sed
Sat Sep 19, 2009 7:56 am UTC
Forum: Coding
Topic: Java '@' character.
Replies: 15
Views: 1515

Re: Java '@' character.

MHD wrote:Cool. I had sort of a thought that they could be used with strings, but okay.

I really think Java should have raw strings...


You mean character arrays? Cause it... does already?
by InkL0sed
Tue Sep 15, 2009 4:54 am UTC
Forum: Coding
Topic: Music while programming
Replies: 7
Views: 1101

Re: Music while programming

I listen to whatever I listen to normally. Sometimes it distracts me though, so I have to turn it off.

Right now, I have Gimme Gimme Gimme (A Man After Midnight) by ABBA stuck in my head, so I guess that's my current "programming song".
by InkL0sed
Mon Sep 14, 2009 7:03 pm UTC
Forum: Coding
Topic: Language anthropomorphisms
Replies: 36
Views: 3189

Re: Language anthropomorphisms

Brainfuck has Down Syndrome.
by InkL0sed
Mon Sep 07, 2009 8:01 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034734

Re: Coding: Fleeting Thoughts

Or you could just have a for loop... I mean, ok, foreach might be great, but a for loop is still pretty simple.
by InkL0sed
Mon Sep 07, 2009 12:49 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2034734

Re: Coding: Fleeting Thoughts

I find I often need the index for more than just indexing though...
by InkL0sed
Wed Sep 02, 2009 1:03 pm UTC
Forum: Coding
Topic: Crazy idea: Bizarro language keywords.
Replies: 8
Views: 1575

Re: Crazy idea: Bizarro language keywords.

...wow
by InkL0sed
Wed Sep 02, 2009 3:22 am UTC
Forum: Coding
Topic: Crazy idea: Bizarro language keywords.
Replies: 8
Views: 1575

Re: Crazy idea: Bizarro language keywords.

I've always wanted to write a language with keywords in Latin.

Maybe I should just write a header with macros in C. Never thought of that...
by InkL0sed
Fri Aug 28, 2009 7:36 pm UTC
Forum: Coding
Topic: BioTech mutating particles C++ help/idea
Replies: 20
Views: 2418

Re: BioTech mutating particles C++ help/idea

C++ probably has a class that acts as an array that can change length, but you should probably try to implement one for practice. In C, what you'd normally do is make a big array and keep an int holding the next index available, like this example: #include <stdio.h> #include <stdlib.h> #define MAX_A...
by InkL0sed
Sun Aug 23, 2009 8:35 pm UTC
Forum: Coding
Topic: Worst shell script you've ever written
Replies: 9
Views: 1500

Re: Worst shell script you've ever written

Carnildo wrote::(){ :|:& };:


When I was in my intro to CS class, this kid sitting next to me would not stop fork-bombing my computer. But it was worth it, cause he helped me a lot.
by InkL0sed
Sun Aug 23, 2009 8:26 pm UTC
Forum: Coding
Topic: Safety
Replies: 15
Views: 1494

Re: Safety

A few points: Most importantly: I think I may have forgotten the option for garbage collection in the makefile. Check to make sure there's the -fobjc-gc option in Makefile. If there isn't add it. Secondly: I'm on vacation with limited Internet access, so I don't have time to do this right now, but a...
by InkL0sed
Fri Aug 21, 2009 2:56 pm UTC
Forum: Coding
Topic: Safety
Replies: 15
Views: 1494

Re: Safety

There's an uncaught exception if you try to pop from an empty stack: $ echo ^ | ./safety 2009-08-21 13:28:28.006 safety[614:10b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (-1( or possibly larger)) beyond bounds (0)' 2009-08-21 ...
by InkL0sed
Thu Aug 20, 2009 4:51 am UTC
Forum: Science
Topic: Von Neumann machines and the Fermi paradox
Replies: 54
Views: 4376

Re: Von Neumann machines and the Fermi paradox

I don't think anybody's mentioned the improbably possibility that we're among the first generation of technological life in the universe. I mean, it could happen. In fact, it might not be all that unlikely. Depending on what factors you put into the Drake Equation , you can get estimates for the av...
by InkL0sed
Thu Aug 20, 2009 12:36 am UTC
Forum: Coding
Topic: You know you're a hardcore programmer when...
Replies: 23
Views: 3578

Re: You know you're a hardcore programmer when...

Slightly relevant is the time when, in my graphics class, I was pointing out an error my teacher had made in the matrix math on the board, and to tell him which number was wrong, I used array notation (it's sub-one sub-zero!). My friend thought it was funny that everyone knew exactly what I meant.
by InkL0sed
Tue Aug 18, 2009 7:57 pm UTC
Forum: Coding
Topic: Help with java.
Replies: 10
Views: 1284

Re: Help with java.

Meh, I promote a plain text editor. It's not exactly hard to compile a java program.
by InkL0sed
Mon Aug 17, 2009 8:03 pm UTC
Forum: Coding
Topic: Yet Another "Which Language?" Post
Replies: 10
Views: 1407

Re: Yet Another "Which Language?" Post

I'm teaching myself Ruby, and I'd suggest it. It's very pleasing, somehow.
by InkL0sed
Mon Aug 17, 2009 7:25 pm UTC
Forum: Coding
Topic: Accuracy and Precision in Mathematica
Replies: 7
Views: 1642

Re: Accuracy and Precision in Mathematica

stephentyrone wrote:Worrying about rounding error when using a first-order method is like Obama looking for change under the White House sofa cushions because he's concerned about the national debt.


lol, please tell me that pun was intended. It would make my day.
by InkL0sed
Mon Aug 17, 2009 7:21 pm UTC
Forum: Coding
Topic: How do I use functions/methods as first-class data in Ruby?
Replies: 4
Views: 507

Re: How do I use functions/methods as first-class data in Ruby?

Ok... but what about this? It gives me an error, which I assume is syntax... def square(x) return x*x end def cube(x) return x*x*x end def do_range(min,max,apply) r = [] (min...max).each do |element| r << apply(element) end return r end a = do_range(0,5,square)
by InkL0sed
Mon Aug 17, 2009 5:53 pm UTC
Forum: Coding
Topic: How do I use functions/methods as first-class data in Ruby?
Replies: 4
Views: 507

How do I use functions/methods as first-class data in Ruby?

I can't seem to find the answer to this with google. I have seen people discussing that Ruby can be used as a functional language, but how does one do that? For instance, how would you pass in a function/method as a parameter, or return a method?
by InkL0sed
Sun Aug 16, 2009 3:49 pm UTC
Forum: Coding
Topic: A brainf*ck interpreter in befunge
Replies: 7
Views: 1835

Re: A brainf*ck interpreter in befunge

You forgot to attach it.
by InkL0sed
Sat Aug 15, 2009 7:40 pm UTC
Forum: Coding
Topic: Safety
Replies: 15
Views: 1494

Re: Safety

It can have an infinite loop though. It's just (assuming there's something on the deselected stack) [], like brainfuck.
by InkL0sed
Sat Aug 15, 2009 5:44 pm UTC
Forum: Coding
Topic: Safety
Replies: 15
Views: 1494

Re: Safety

I'm pretty sure it's Turing-complete, since it can do anything brainfuck can do, and that's supposed to be turing-complete. Also, I've noticed a bug; backslash doesn't work. It's not really worth posting another zip for fixing, because you just need to make one change in SafetyParser.m. Near the end...
by InkL0sed
Sat Aug 15, 2009 7:08 am UTC
Forum: Coding
Topic: Java LinkedList with Superclass and Subclass
Replies: 6
Views: 2840

Re: Java LinkedList with Superclass and Subclass

Yeah, I was pretty sure it wouldn't work, but couldn't be bothered to think about why. The simplest solution would really be to just make the return type a LinkedList<TreeNode> I know, but I need it to return a list of WeightedNodes, because another method compares the weights to sort the list. At ...
by InkL0sed
Sat Aug 15, 2009 7:01 am UTC
Forum: Coding
Topic: Safety
Replies: 15
Views: 1494

Safety

I've already mentioned this in a few threads, but I'll give a full explanation here. I was playing around with generating brainfuck code by means of a genetic algorithm, and it turned out the most annoying aspect was that virtually all of the random strings I'd generate, even with only bf characters...
by InkL0sed
Sat Aug 15, 2009 6:21 am UTC
Forum: Coding
Topic: Java LinkedList with Superclass and Subclass
Replies: 6
Views: 2840

Re: Java LinkedList with Superclass and Subclass

Yeah, I was pretty sure it wouldn't work, but couldn't be bothered to think about why. The simplest solution would really be to just make the return type a LinkedList<TreeNode>
by InkL0sed
Sat Aug 15, 2009 5:36 am UTC
Forum: Coding
Topic: Java LinkedList with Superclass and Subclass
Replies: 6
Views: 2840

Re: Java LinkedList with Superclass and Subclass

Make it return a LinkedList<TreeNode> instead of a LinkedList<WeightedNode>, and just cast them when you get them later. EDIT: You might also try casting children to a LinkedList<WeightedNode> in the return return (LinkedList<WeightedNode>) children; but I doubt that would work. If it doesn't, you c...
by InkL0sed
Fri Aug 14, 2009 7:11 pm UTC
Forum: Coding
Topic: Typing code
Replies: 26
Views: 4198

Re: Typing code

That would be tiring...
by InkL0sed
Fri Aug 14, 2009 8:10 am UTC
Forum: Coding
Topic: Typing code
Replies: 26
Views: 4198

Re: Typing code

qbg wrote:Dvorak works quite well for me when typing code.


For me too. Probably for the same reason as it's better than QWERTY.

Go to advanced search