Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 156 157 [158] 159 160 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 902534 times)

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2355 on: May 03, 2012, 02:21:12 pm »

Why would they ask that? o_o
To test your approach.  In my experience, when you're asked a question like that, the correct response is to talk your way through your entire thought process from beginning to end, and don't stop when you've reached an answer.  Get, like, two or three.  It's a case where 'showing your work' is valid in the real world.

IE, an interviewer here wouldn't be happy with 'so they don't fall in'.  They would be more satisfied if you went to the whiteboard, scribbled a side view and an overhead view of the situation, and explained out from start to finish how you could make a square manhole cover fail.

Once you've given the obvious, you can continue to...well, it means it's easier to put back in place, since you can do it from any angle.  Maybe it's less prone to wear or warping at the corners, since there are no corners.  Possibly the weight is distributed more evenly (since it's a constant distance from the middle to any edge).  Maybe the material you're putting a hole in is more structurally sound with a hole-shape than a square-shape.

In other more programming-related news, I made a class called Ccircle.
But the codepad compiler says

  Ccircle circleA;

... doesn't work. What am I doing wrong? D:
What language, what error message?  Did you declare your class before using it?  Did you include your header?
Logged
Some things were made for one thing, for me / that one thing is the sea~
His servers are going to be powered by goat blood and moonlight.
Oh, a biomass/24 hour solar facility. How green!

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #2356 on: May 03, 2012, 02:24:07 pm »

C++. No headers involved (I was using Codepad, so .h and .cpp files were not supported.), and I declared it via:

class Ccircle {//class stuff};

It's really baffling. I think I should try it again at home with my own ide...
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

kaenneth

  • Bay Watcher
  • Catching fish
    • View Profile
    • Terrible Web Site
Re: if self.isCoder(): post() #Programming Thread
« Reply #2357 on: May 03, 2012, 02:25:40 pm »

So that when the Incredible Hulk throws them at people they are safer since they don't have pointy corners.
Logged
Quote from: Karnewarrior
Jeeze. Any time I want to be sigged I may as well just post in this thread.
Quote from: Darvi
That is an application of trigonometry that never occurred to me.
Quote from: PTTG??
I'm getting cake.
Don't tell anyone that you can see their shadows. If they hear you telling anyone, if you let them know that you know of them, they will get you.

Araph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2358 on: May 03, 2012, 05:10:27 pm »

Okay, I think that these two chunks of HTML:
Code: [Select]
<script type="text/javascript">
function box_text()
{
document.getElementById(Selection_Description).innerHTML =
'<p>Test Paragraph</p>';
}
</script>
Code: [Select]
<div id="Selection_Description" style="margin:5px; width:750px; height:300px">
</div>

<map name="CenterMap">
<area shape="circle" coords="219,50,42" alt="Button" href="ButtonTest.html" onMouseOver="box_text() onMouseOut="basic_box()">
</map>

Should make it so that when you mouse over the image map, it makes a bit of text appear in the Selection_Description box. The link from the image map works fine, but the script doesn't run properly. I think I must be making some dumb mistake, because it isn't wrong according to the tutorials I've looked at. Can anyone tell what I'm doing wrong?
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2359 on: May 03, 2012, 05:47:06 pm »

Put quotes around "Selection_Description".

Code: [Select]
<script type="text/javascript">
function box_text()
{
document.getElementById("Selection_Description").innerHTML =
'<p>Test Paragraph</p>';
}
</script>
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Araph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2360 on: May 03, 2012, 06:12:02 pm »

Derp. Now I feel unobservant. It works! Thanks for the help!
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #2361 on: May 03, 2012, 06:12:30 pm »

Javascript and HTML really need compiler-like thingies.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #2362 on: May 03, 2012, 06:26:30 pm »

Javascript and HTML really need compiler-like thingies.

http://validator.w3.org/ ?
Logged

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2363 on: May 03, 2012, 06:27:13 pm »

There are really good IDEs for them.  <3

Microsoft even has this web developer express thingamabob, though it's more aimed at AJAX.  But it's still good at what it does, and understands JQuery.

Incidentally, once you understand the basics of using Javascript to tweak your html and css elements, you should move up to JQuery.  It's the de-facto standard library for javascript web stuff.  Imagine writing a C++ program without cin/cout, or a C program without like...strlen and strcpy.  That's Javascript without JQuery.
Logged
Some things were made for one thing, for me / that one thing is the sea~
His servers are going to be powered by goat blood and moonlight.
Oh, a biomass/24 hour solar facility. How green!

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #2364 on: May 03, 2012, 06:28:48 pm »

Teehee. I don't think I'm going to ever learn Javascript or HTML >.>

Javascript and HTML really need compiler-like thingies.

http://validator.w3.org/ ?

Does that work as well as a regular compilerIDE in error checking? o_O I remember Shoruke complaining that is Javascript, if things don't work they just fizzle quietly; whereas if something is wrong in C++ the compiler complains loudly and clearly.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2365 on: May 03, 2012, 06:36:47 pm »

It'll tell you if your syntax is alright, at least.
Logged
Some things were made for one thing, for me / that one thing is the sea~
His servers are going to be powered by goat blood and moonlight.
Oh, a biomass/24 hour solar facility. How green!

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2366 on: May 03, 2012, 06:57:28 pm »

Does that work as well as a regular compilerIDE in error checking? o_O I remember Shoruke complaining that is Javascript, if things don't work they just fizzle quietly; whereas if something is wrong in C++ the compiler complains loudly and clearly.

And profusely. For a school project, I was writing a Fraction class in C++. The code, and the error messages. I haven't yet started to try to fix them yet, because one thing struck me as being odd.

I haven't used templates a lot, but I know how they work and how to use them. Or, so I thought. If I'm reading the error messages right, template specialization can't be used with templated functions in a non-templated class. Am I reading the error messages wrong, or are templates really this silly?

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2367 on: May 04, 2012, 02:36:30 am »

Imagine writing a C++ program without cin/cout, or a C program without like...strlen and strcpy.  That's Javascript without JQuery.
I never use cin, hardly use cout, and could live without strlen and strcopy. And I could live without jQuery. Mootools is actually a lot nicer to work with, even though it's the less popular choice these days.

Javascript without either one of those frameworks is pretty much useless, by the way.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #2368 on: May 04, 2012, 04:25:26 am »

I haven't used templates a lot, but I know how they work and how to use them. Or, so I thought. If I'm reading the error messages right, template specialization can't be used with templated functions in a non-templated class. Am I reading the error messages wrong, or are templates really this silly?

You can't partially specialise them. There's a reason for this: http://www.gotw.ca/publications/mill17.htm

Basically it'd mess with the overload resolution. And since you can overload template functions anyway it's not as useful as you'd think.
« Last Edit: May 04, 2012, 12:58:05 pm by MorleyDev »
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2369 on: May 04, 2012, 07:28:09 am »

Ahh, I had those functions as non-templated functions originally, but apparently my understanding of overload resolution with templated functions was pretty much completely wrong.

There's my lesson for the day. Screw school, I'm going back to bed.
Pages: 1 ... 156 157 [158] 159 160 ... 796