Be a Supporter!

Programming Regs Lounge

  • 429,006 Views
  • 16,837 Replies
New Topic Respond to this Topic
WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge 2012-07-02 15:52:46 Reply

At 7/2/12 03:45 PM, kiwi-kiwi wrote:
At 7/2/12 03:33 PM, WizMystery wrote:
Nothing is inheriting from World and World is only inheriting from Base which is a pure virtual class (with a virtual destructor), so it's impossible that something else is calling World's destructor.
Not world, the monsters

Ah...

The monsters actually have nothing in their destructors anywhere along their inheritance line (which consists merely of an abstract Object class and then ExampleObject, which IS the monster in this case). I put virtual there just to be doubly sure, though.

After a few tests it does seem to be leveling off at around 9.7k. I've written in the bitmap functionality so I'll try loading larger bitmaps to see what's going on.

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge 2012-07-02 15:58:20 Reply

At 7/2/12 03:52 PM, WizMystery wrote: After a few tests it does seem to be leveling off at around 9.7k. I've written in the bitmap functionality so I'll try loading larger bitmaps to see what's going on.

Oh crap now the rendering seems to be really laggy...

NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Programming Regs Lounge 2012-07-02 17:18:21 Reply

At 7/2/12 03:16 PM, SeeD419 wrote: Hey guys, I've been working on a Newgrounds portal monitoring application in Java. Not sure if any of you would be interested in collaborating on it, bringing new ideas to it, or possibly cleaning up my god awful code - but I figured I'd share. An alpha build is available here.

I really like your signature image.

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge 2012-07-03 20:34:39 Reply

More questions about C++:

Question 1:

Let's say I had a vector of vectors:

std::vector<std::vector<int> > VECTOR;

If I were to run the following code:

while(!VECTOR.empty())
    VECTOR.pop_back();

Would this automatically delete all the members inside the "inner" vector?

Question 2:

Is there a way to assign a function pointer to run a more specific line of code? IE:

void Function(short int x)
{
    std::cout<<x<<std::endl;
}

int main()
{
   void(*ptr)(short int);
   ptr = Function;
   ptr(3);
}

How would I get ptr to always pass 3 into Function without having to specify 3 every time it was to run?

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-07-03 21:11:35 Reply

At 7/3/12 08:34 PM, WizMystery wrote: Question 1:
Let's say I had a vector of vectors:
...
Would this automatically delete all the members inside the "inner" vector?

It will call the destructor of every vector, which will call the destructor of ever element inside of it.
However, if the nested vector (i.e. the vector inside the vector) were to dynamically allocate memory then a memory leak will be created.

Here's an example:

#include <iostream>
#include <vector>

struct MyClass
{
    // Pretend this is a class that does something useful
    int id;
    char* name;
    float foo;
    double bar;
};

int main()
{
    std::vector<std::vector<MyClass*>> vec;

    vec.push_back(std::vector<MyClass*>());

    vec[0].push_back(new MyClass);
    vec[0].push_back(new MyClass);
    vec[0].push_back(new MyClass);

    vec.pop_back();

    return 0;
}

The three allocated MyClass objects will not be deallocated; this script causes a memory leak.
As well, the destructors of the three elements will not be called.

However, take this code for example:

#include <iostream>
#include <vector>

struct Poop
{
    ~Poop(){
        std::cout << "~Poop()" << std::endl;
    }
};

int main()
{
    std::vector<std::vector<Poop>> vec(1);

    std::cout << "Adding..." << std::endl;

    // Add three elements; will call Poop's destructor three times
    vec[0].push_back(Poop());
    vec[0].push_back(Poop());
    vec[0].push_back(Poop());

    std::cout << std::endl << "Removing..." << std::endl;

    // Will call each element in vec[0]'s destructor
    // So ~Poop() three times
    vec.pop_back();

    return 0;
}

Run it on Ideone here: http://ideone.com/RMPne

You will get the output:

Adding...
~Poop()
~Poop()
~Poop()
~Poop()
~Poop()
~Poop()

Removing...
~Poop()
~Poop()
~Poop()

You can ignore the destructors after "Adding...".
The elements after "Removing..." are the important ones; they're the ones called after vec.pop_back() is called.

At 7/3/12 08:34 PM, WizMystery wrote: Is there a way to assign a function pointer to run a more specific line of code?

You can't do that.
I won't go into the details as this post on StackOverflow explains it better than I could.

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge 2012-07-03 21:29:32 Reply

At 7/3/12 09:11 PM, Diki wrote: The three allocated MyClass objects will not be deallocated; this script causes a memory leak.
As well, the destructors of the three elements will not be called.

Let's say I'm not inserting objects, but just variables. Does the same thing happen?

Either way each inner vector will be of a different size for what I'm doing, so it's possible to do it the hard way (with nesting), right?

You can't do that.
I won't go into the details as this post on StackOverflow explains it better than I could.

Ah, damn.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-07-03 21:36:54 Reply

At 7/3/12 09:29 PM, WizMystery wrote: Let's say I'm not inserting objects, but just variables. Does the same thing happen?

This question doesn't really make sense.
Do you mean base types such as an int or bool? If so: the same rules apply to them (though they don't have destructors).

If not, what do you mean by "variables not objects"?

At 7/3/12 09:29 PM, WizMystery wrote: Either way each inner vector will be of a different size for what I'm doing, so it's possible to do it the hard way (with nesting), right?

The sizes of the vectors doesn't matter; the destructors will always be called so long as the elements are not pointers or references.
I'm not sure what you're referring to by "the hard way" though.

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge 2012-07-03 21:45:51 Reply

At 7/3/12 09:36 PM, Diki wrote:
At 7/3/12 09:29 PM, WizMystery wrote: Let's say I'm not inserting objects, but just variables. Does the same thing happen?
This question doesn't really make sense.
Do you mean base types such as an int or bool? If so: the same rules apply to them (though they don't have destructors).

If not, what do you mean by "variables not objects"?

Yes, I meant types such as int or bool.

The sizes of the vectors doesn't matter; the destructors will always be called so long as the elements are not pointers or references.
I'm not sure what you're referring to by "the hard way" though.

Wait, so are you saying that as long as the inner vector members (variables/class objects) are not dynamically allocated, they will be deleted? Or are you speaking of the inner vectors themselves?

As for the "hard way" meant like:

while(!VECTOR.empty())
{
    while(!VECTOR.back().empty())
    {
        VECTOR.back().pop_back();
    }
}
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-07-03 22:13:38 Reply

At 7/3/12 09:45 PM, WizMystery wrote: Wait, so are you saying that as long as the inner vector members (variables/class objects) are not dynamically allocated, they will be deleted?

I think you're confusing the delete operator with destructors.
The delete operator only free dynamically allocated memory and then calls a destructor.

So, this is what I am saying:

If you create a vector of a vector of a custom class, and you push back 10 vectors each containing 17 elements of your custom class, then 170 destructors of your custom class will be called.
Even if you do not call pop_back() they will be called when your application ends.

Basically the answer to your question is "yes".

Play around with two-dimensional vectors (that's what a vector of a vector is called) and output to the console when objects are destructed. It really helps you understand what is happening to your objects when you use the standard library.

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge 2012-07-03 22:22:57 Reply

At 7/3/12 10:13 PM, Diki wrote: Basically the answer to your question is "yes".

I see. I was just confused because vectors are also dynamically allocated.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-07-03 22:30:49 Reply

At 7/3/12 10:22 PM, WizMystery wrote: I see. I was just confused because vectors are also dynamically allocated.

They are, but they also handle construction/destruction of elements.
You can think of the vector destructor as something like this:

template <class Ty>
vector<Ty>::~vector()
{
    while (this->empty() == false) {
        this->back().~Ty();
        this->pop_back();
    }
}

Note: this code in no way reflects what the vector destructor actually looks like.

When it gets destructed it ensures that all of its elements are destructed as well.
So that means if a vector contains a vector, it destructs that vector, which then destructs all of its elements.

But, remember, that only works on objects allocated on the stack.
This article does a good job of explaining the stack vs the heap.

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge 2012-07-03 23:10:34 Reply

At 7/3/12 10:30 PM, Diki wrote: This article does a good job of explaining the stack vs the heap.

Read. Everything makes quite a bit more sense now.

Thanks for the help!

NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Programming Regs Lounge 2012-07-05 03:28:50 Reply

My hypothalamus is fucked. I can't balance sleeping with night. In other words, I usually sleep from 3pm to 11pm. Maybe it's because it's hot like in the freaking oven right here. Summer really kicked in in croatia

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge 2012-07-05 12:41:58 Reply

RANDOM CRASHES UGH

Okay, this has happened twice already.

I'm working along, writing a program. I test it after every block of code that I write. I get to a point where the program starts to crash. I get rid of the last block of code that I wrote, thinking that's what caused the problem - all of a sudden nothing works. All the code that was working before suddenly doesn't work at all. I put in various cout statements to see where the problem is, and it seems like there is no point where the problem persists. If the program fails to reach a point, I remove that code, only to find out it can't reach another point that was working just fine before.

What the hell is going on? I'm writing in three threads and I've checked every single one of them and it's the same issue. This doesn't make any sense at all. My initial guess is a stack overflow, but that doesn't explain why everything was working before.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-07-05 12:53:56 Reply

What does "not work" mean? Is it failing to compile? Is it crashing because of an error, or an unhandled exception?

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge 2012-07-05 13:17:23 Reply

At 7/5/12 12:53 PM, Diki wrote: What does "not work" mean? Is it failing to compile? Is it crashing because of an error, or an unhandled exception?

It's compiling and then crashing ("program" is not responding) almost immediately. I haven't put in any exception blocks, but there's no randomization anywhere and the program runs the same every time (save the difference in threading speeds). The only things that really need exception blocks are the allegro initialization statements, and I already put return statements to check for their failure and that isn't the problem.

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge 2012-07-05 13:40:25 Reply

At 7/5/12 01:17 PM, WizMystery wrote:
At 7/5/12 12:53 PM, Diki wrote: What does "not work" mean? Is it failing to compile? Is it crashing because of an error, or an unhandled exception?
It's compiling and then crashing ("program" is not responding) almost immediately. I haven't put in any exception blocks, but there's no randomization anywhere and the program runs the same every time (save the difference in threading speeds). The only things that really need exception blocks are the allegro initialization statements, and I already put return statements to check for their failure and that isn't the problem.

Oh shit, I think it actually was a stack overflow. My main.cpp is 600 lines at the moment (had some issues with render functions being used inside classes, had to move a bunch of stuff into main).

I have this huge array of function pointers. When I removed them the problem went away... the functions themselves are all empty at the moment, does that have anything to do with it? If it was a stack overflow, how do I send all of this to the heap without putting it inside a class?

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge 2012-07-05 14:50:41 Reply

At 7/5/12 01:40 PM, WizMystery wrote: Oh shit, I think it actually was a stack overflow. My main.cpp is 600 lines at the moment (had some issues with render functions being used inside classes, had to move a bunch of stuff into main).

I have this huge array of function pointers. When I removed them the problem went away... the functions themselves are all empty at the moment, does that have anything to do with it? If it was a stack overflow, how do I send all of this to the heap without putting it inside a class?

Okay, so I moved the function pointers and functions inside a class that I dynamically allocated and it's still causing a problem. The second I remove the code setting where the function pointers point to, everything works perfectly. I can't find the problem anywhere... have I overstepped a bound or something?

Here's the code (PF is now a vector instead of an array):

PF.resize(DRAW_RIBBON);
    PF[DRAW_BITMAP] = &PHYSICS::ANALYZE_DRAW_BITMAP;
    PF[DRAW_TINTED_BITMAP] = &PHYSICS::ANALYZE_DRAW_TINTED_BITMAP;
    PF[DRAW_BITMAP_REGION] = &PHYSICS::ANALYZE_DRAW_BITMAP_REGION;
    PF[DRAW_TINTED_BITMAP_REGION] = &PHYSICS::ANALYZE_DRAW_TINTED_BITMAP_REGION;
    PF[DRAW_PIXEL] = &PHYSICS::ANALYZE_DRAW_PIXEL;
    PF[DRAW_ROTATED_BITMAP] = &PHYSICS::ANALYZE_DRAW_ROTATED_BITMAP;
    PF[DRAW_TINTED_ROTATED_BITMAP] = &PHYSICS::ANALYZE_DRAW_TINTED_ROTATED_BITMAP;
    PF[DRAW_SCALED_ROTATED_BITMAP] = &PHYSICS::ANALYZE_DRAW_SCALED_ROTATED_BITMAP;
    PF[DRAW_TINTED_SCALED_ROTATED_BITMAP] = &PHYSICS::ANALYZE_DRAW_TINTED_SCALED_ROTATED_BITMAP;
    PF[DRAW_SCALED_BITMAP] = &PHYSICS::ANALYZE_DRAW_SCALED_BITMAP;
    PF[DRAW_TINTED_SCALED_BITMAP] = &PHYSICS::ANALYZE_DRAW_TINTED_SCALED_BITMAP;
    PF[DRAW_LINE] = &PHYSICS::ANALYZE_DRAW_LINE;
    PF[DRAW_TRIANGLE] = &PHYSICS::ANALYZE_DRAW_TRIANGLE;
    PF[DRAW_FILLED_TRIANGLE] = &PHYSICS::ANALYZE_DRAW_FILLED_TRIANGLE;
    PF[DRAW_RECTANGLE] = &PHYSICS::ANALYZE_DRAW_RECTANGLE;
    PF[DRAW_FILLED_RECTANGLE] = &PHYSICS::ANALYZE_DRAW_FILLED_RECTANGLE;
    PF[DRAW_ROUNDED_RECTANGLE] = &PHYSICS::ANALYZE_DRAW_ROUNDED_RECTANGLE;
    PF[DRAW_FILLED_ROUNDED_RECTANGLE] = &PHYSICS::ANALYZE_DRAW_FILLED_ROUNDED_RECTANGLE;
    PF[DRAW_ELLIPSE] = &PHYSICS::ANALYZE_DRAW_ELLIPSE;
    PF[DRAW_FILLED_ELLIPSE] = &PHYSICS::ANALYZE_DRAW_FILLED_ELLIPSE;
    PF[DRAW_CIRCLE] = &PHYSICS::ANALYZE_DRAW_CIRCLE;
    PF[DRAW_FILLED_CIRCLE] = &PHYSICS::ANALYZE_DRAW_FILLED_CIRCLE;
    PF[DRAW_ARC] = &PHYSICS::ANALYZE_DRAW_ARC;
    PF[DRAW_SPLINE] = &PHYSICS::ANALYZE_DRAW_SPLINE;
    PF[DRAW_RIBBON] = &PHYSICS::ANALYZE_DRAW_RIBBON;

Where DRAW_RIBBON is the last member in this enum:

private:
        enum RENDER_FUNCTION{DRAW_BITMAP, DRAW_TINTED_BITMAP, DRAW_BITMAP_REGION,           
        DRAW_TINTED_BITMAP_REGION, DRAW_PIXEL, DRAW_ROTATED_BITMAP, DRAW_TINTED_ROTATED_BITMAP, 
        DRAW_SCALED_ROTATED_BITMAP,
        DRAW_TINTED_SCALED_ROTATED_BITMAP, DRAW_SCALED_BITMAP, DRAW_TINTED_SCALED_BITMAP, DRAW_LINE,     
        DRAW_TRIANGLE, DRAW_FILLED_TRIANGLE, DRAW_RECTANGLE,
        DRAW_FILLED_RECTANGLE, DRAW_ROUNDED_RECTANGLE, DRAW_FILLED_ROUNDED_RECTANGLE, DRAW_ELLIPSE,     
        DRAW_FILLED_ELLIPSE, DRAW_CIRCLE, DRAW_FILLED_CIRCLE,
        DRAW_ARC, DRAW_SPLINE, DRAW_RIBBON};
WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge 2012-07-05 14:53:57 Reply

At 7/5/12 02:50 PM, WizMystery wrote: ...have I overstepped a bound or something?

OH DUH... I made the vector one size too small. Problem solved.

This took me hours to figure out. Aint that great?
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-07-09 15:41:32 Reply

I spent the weekend learning Ruby, and now I realise why so many people love this language.
At first I wasn't totally sold on its syntax, but after learning/understanding it, I'm starting to dig it; this is what a Fibonacci number generator could look like in Ruby:

def fib n
    out = []
    n.times do |i|
        out << if out.length == 1 then 1 else out[i-1].to_i + out[i-2].to_i end
    end
    return out
end

#Output: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
fib 10

It's a lot like Python: very concise and readable.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-07-09 15:55:00 Reply

At 7/5/12 02:53 PM, WizMystery wrote:
This took me hours to figure out. Aint that great?

Yeah that's the trouble with writing C++; debugging is a pain in the ass.
I once spent like 20 minutes debugging code only to find I forgot to type a semi-colon. Sometimes the errors in C++ aren't very helpful (depending on your knowledge of C++ and its errors). Take the following for example:

template <class Ty>
class Foo {
private:
    typedef Ty prv_Ty;
public:
    Ty name;
    Foo(Ty name) : name(name) {}
    Ty getthing() const:
};

template <class Ty>
Foo<Ty>::getthing() const
{
    return name;
}

int main()
{
    Foo<int> f(42);
    return 0;
}

If you attempt to compile that you will get these errors:

Error	1	error C2590: 'getthing' : only a constructor can have a base/member initializer list (8)
Error	2	error C2533: 'Foo<Ty>' : constructors not allowed a return type	(8)
Error	3	error C2583: 'Foo<Ty>::Foo' : 'const' 'this' pointer is illegal for constructors/destructors (8)
Error	4	error C2760: syntax error : expected '{' not '}' (9)
Error	5	fatal error C1004: unexpected end-of-file found (9)

All that is caused because on line 8 const: is supposed to be const;, and that is only a 21 line script; the errors get a lot more hairy for larger projects.

kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to Programming Regs Lounge 2012-07-10 16:07:33 Reply

Longer update here.
It's been a while now since I quit my job as a game designer and while I enjoy the freedom and free time, there's still a part of me that misses the AAA atmosphere.
But life goes on and I got a better job at a smaller company where not only will I be working for a better salary, but also on some very challenging C++ stuff, so everything went better than expected.

Other than that I still have two weeks of vacation until I start and while finishing college will take most of the first one, I wanted to try my hand at making a game for my own pleasure again during the second week, so I'll be participating in this very interesting competition called the liberated pixel cup.
Everything will be publically viewable on my soon to be github account, so if you guys feel like making fun of (and/or praise XD) my coding practices I'll be posting a link sometime in the future.

And that's about it.

WizMystery
WizMystery
  • Member since: Feb. 3, 2009
  • Offline.
Forum Stats
Member
Level 11
Musician
Response to Programming Regs Lounge 2012-07-11 17:26:13 Reply

At 7/9/12 03:55 PM, Diki wrote: All that is caused because on line 8 const: is supposed to be const;, and that is only a 21 line script; the errors get a lot more hairy for larger projects.

Yeah, I've learned how much of a pain debuggers themselves are.

Thegluestickman
Thegluestickman
  • Member since: Mar. 16, 2007
  • Offline.
Forum Stats
Member
Level 13
Game Developer
Response to Programming Regs Lounge 2012-07-11 17:56:59 Reply

So I had a question and I thought this would be the best place to ask it.

How exactly do hardware and software interact?

I understand as far as software goes, the compiler transforms written code into binary, assembly or bytecode (I think) that a machine can understand. The part I don't understand is, say for example I built a piece of hardware and wanted to run a program on it, how would this work? Does the program need to be written in assembly for the hardware to know what's happening? I don't think you could just compile C or C++ and run it on the hardware.


To protect the world from devastation.
kidd25 is the best Newgrounder ever.

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-07-11 18:29:38 Reply

I am by no means a professional or an expert on the subject, but I'll offer my input; when I was in high-school I took a Computer Engineering course where I built a robot car that ran on Turing, and also built a hand-held device that acted as a security alarm in a similar class, so I know a little bit about this.

When hardware is built it is, obviously, built on a breadboard of some sort. That allows the device to create a number of different "signals"; these signals are just different frequencies of electricity. Some sort of a logical chip, such as a processor, is used to interpret what these different frequencies represent.
Follow this pattern to ridiculous complexity and you have common hardware devices.

Basically it all comes down to interpreting different frequencies of electricity.

As for how all this is done: I'm not really sure, because, like I said, I'm by no means an expert. I'd really only be able to speculate that part, so I won't.

At 7/11/12 05:56 PM, Thegluestickman wrote: I don't think you could just compile C or C++ and run it on the hardware.

Well, there isn't anything preventing that per se; it would just be incredibly impractical, so that's why it, generally speaking, doesn't happen.

Thegluestickman
Thegluestickman
  • Member since: Mar. 16, 2007
  • Offline.
Forum Stats
Member
Level 13
Game Developer
Response to Programming Regs Lounge 2012-07-11 18:54:34 Reply

At 7/11/12 06:29 PM, Diki wrote: When hardware is built it is, obviously, built on a breadboard of some sort. That allows the device to create a number of different "signals"; these signals are just different frequencies of electricity. Some sort of a logical chip, such as a processor, is used to interpret what these different frequencies represent.
Follow this pattern to ridiculous complexity and you have common hardware devices.

Basically it all comes down to interpreting different frequencies of electricity.

As for how all this is done: I'm not really sure, because, like I said, I'm by no means an expert. I'd really only be able to speculate that part, so I won't.

At 7/11/12 05:56 PM, Thegluestickman wrote: I don't think you could just compile C or C++ and run it on the hardware.
Well, there isn't anything preventing that per se; it would just be incredibly impractical, so that's why it, generally speaking, doesn't happen.

Thanks Diki for the great post.

To clarify, the program generates the frequencies? I remember something from my computer science class about Fetch, Execute and Decode preformed by the CPU; so does the CPU fetch commands from the kernel? Is the kernel written in assembly or a different language? I think understand basically, man computers are a huge achievement in Human history.


To protect the world from devastation.
kidd25 is the best Newgrounder ever.

BBS Signature
NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Programming Regs Lounge 2012-07-11 21:10:34 Reply

lol @ google

Basically, Chrome warned me about 3 errors in my code. look where the errors are located at

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-07-11 21:33:30 Reply

The first two messages are warnings, not errors; they look like you're using an incorrect MIME type to display some sort of media.
As for the "Unsafe Javascript" error that looks like you're using a Google API to access another URL in an unsafe manner.

Basically, to me, given the vague information you've given, it looks like you're just misusing Google's tools.

In fact, Occam's Razor says this is your fault:
Do you think you caused this?
Or do you think that Google's developers, some of the brightest, skilled, and experienced web developers in the world, caused this?

Not trying to insult you, but, you didn't post the code the caused the error. Do you seriously expect someone to believe that Google fucked up and you didn't?

NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Programming Regs Lounge 2012-07-12 10:34:37 Reply

At 7/11/12 09:33 PM, Diki wrote: Not trying to insult you, but, you didn't post the code the caused the error. Do you seriously expect someone to believe that Google fucked up and you didn't?

As a thank you for proving me being an idiot (I am one, obviously), I give this link, as I read you're into Ruby now.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-07-12 10:41:42 Reply

Well that's pretty neat, but I'm like some old grandpa when it comes to social networking: I don't get it, need it, or want it (I don't have any social networking accounts).
So I definitely won't be looking into this/ever using it. :)

That project has some very well written code though, which isn't surprising given that it's Ruby.