Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 344 345 [346] 347 348 ... 796

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

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5175 on: November 03, 2013, 03:11:49 pm »

You need to change this:
Code: [Select]
priorityQueue[] patients= new priorityQueue[prioritynumber];to this:
Code: [Select]
priorityQueue patients= new priorityQueue(prioritynumber);
Logged

Lightningfalcon

  • Bay Watcher
  • Target locked. Firing main cannon.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5176 on: November 03, 2013, 03:39:38 pm »

Thank you.  I was trying to solve that for a while.   Now time to build the rest of the program.   
Logged
Interdum feror cupidine partium magnarum circo vincendarum
W-we just... wanted our...
Actually most of the people here explicitly wanted chaos and tragedy. So. Uh.

quinnr

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5177 on: November 07, 2013, 07:42:40 pm »

So, I am going to a sort of event thing on Saturday that involves finding a team of four people, and then creating a Web App of any kind in 24 hours (no sleep!). The only problem is that all the programming that I have done before has all been not in web development. I know basic HTML and CSS, and I learned PHP, but that was about 5-6 years ago and I don't really remember any of it. I have all of tomorrow to learn as much about developing web applications as I can. Does anyone have any tips on where to start?
Logged
To exist or not exist, that is the query. For whether it is more optimal of the CPU to endure the viruses and spam of outragous fortune, or to something something something.

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #5178 on: November 07, 2013, 08:40:34 pm »

Well for client-side it's either Javascript or something that compiles to Javascript, for Server-side quick stuff nowadays I'd recommend Javascript. You can do a lot very quickly using Node.js as a server-side Javascript platform. It's build on Google's V8 and uses Javascript to script creating servers. Did I mention Javascript yet?

This is probably too much for tomorrow, but not a fan of Javascript? I'm not either. But Javascript has basically become the ASM of the web. It's not a particularly good ASM, but somehow there's a sizeable market of compilers to it and even new languages being created specifically to compile to Javascript. Typescript is Microsoft's attempt to add static typing to the language (and I much prefer static to dynamic languages), Coffeescript and LiveScript are both attempts to create a more python-esque language that removes a lot of Javascript's boilerplate...

Heck, for "needlessly complex" there's even Emscripten that can compile C++ to Javascript! With support for turning either SDL 1.2 or OpenGL ES 2 into WebGL calls! And that can literally allow for 3D games with fairly impressive graphics, for a browser game at least... It's starting to get crazy what can be done in a web browser nowadays...

As an aside, this is pretty cool: Koding. It's a "Cloud Development Environment". They basically spin up a linux VM for you, open a Javascript-based terminal for that VM, and let you do whatever. When you leave the terminal, they shut down the VM but if you have an account keep the data. The VM they open runs a web-server, so you can use it for websites or for writing more traditional programs.

There's also a non-terminal editor that can access files on the VM, which is based off the same web-based editor as Cloud9 and allows for things like multiple people to edit files and chat. Which is probably useful...personally for Linux coding I just use VIM with a craptonne of plugins, but I'm crazy and isolated like that at the moment.

I find it useful for developing when away from a powerful PC, I use it with my Chromebook to still be able to program. You can even create a guest terminal for free without creating an account, which just spins up a temporary VM for you by going here.

The monetization model seems to be mostly based around "1 free VM, 1 free GB of storage on that VM" and if you want more you pay. All in all I think it's pretty cool. If anybody wants to sign up for it, I have a referral link (because I'm being a whore for more storage space) https://koding.com/R/morleydev
« Last Edit: November 07, 2013, 09:00:26 pm by MorleyDev »
Logged

dreadmullet

  • Bay Watcher
  • Inadequate Comedian
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5179 on: November 07, 2013, 10:23:06 pm »

C++ lambdas are Fun: http://pastie.org/private/6tnfogha8l9ajcpuspx0dw

It took many hours of debugging to realise what was happening in my program. I ended up using gdb's memory breakpoint command, 'watch'. A pointer to the 'this' pointer is passed to the lambda, and that pointer was being messed with when the lambda went out of scope.

(I suppose it's called a closure, not a lambda.)
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #5180 on: November 08, 2013, 08:37:57 pm »

Well what you just did is like calling "delete this" in a member function. You unset something from inside itself, so any further operations on that memory space are gonna be undefined.
Logged

Maklak

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5181 on: November 09, 2013, 03:11:39 am »

Would you recommend any books or articles on software design? I find dividing things into modules and APIs more problematic than writing code. I don't care much about all this object oriented buzz and prefer structural programming, but at about 1k lines of code a "flat" architecture of global data and functions becomes hard to manage and it is better to divide things into separate modules that communicate through function calls. I'd like to improve in that area.
Logged
Quote from: Omnicega
Since you seem to criticize most things harsher than concentrated acid, I'll take that as a compliment.
On mining Organics
Military guide for FoE mod.
Research: Crossbow with axe and shield.
Dropbox referral

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5182 on: November 09, 2013, 07:15:08 am »

Hmmm, a beginner's guide to modularity? I would recommend "Introduction to Object-Oriented Programing" (any book of that title will do). Seriously, trying to modularize without using OOP is madness. Madness I say.
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5183 on: November 09, 2013, 03:52:52 pm »

I read someone once say that the best code in even non OOP languages is written in an object oriented manner anyway.  I've seen some C programs that were written this way (using structs or opaque handles with functions packaged together to operate on them), and I think there is at least a kernel of truth to it.  Nevertheless, I don't subscribe to the idea that everything should be object oriented.  I write lots of one off scripts, especially in web development, that have no use for object oriented programming.

They do tend to become messy though.  I have similar problems with modularizing and organizing code.  I bend over backwards and go out of my way to format it nicely, but if even when working in an OOP language I have difficulty separating objects into good sets.

I wish I had some books or other references to suggest.  I could stand to read some myself.  I really need to brush up on my software engineering over just programming.
Logged
Through pain, I find wisdom.

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #5184 on: November 09, 2013, 04:43:50 pm »

Best books I can recommend for writing modular code?

Test-Driven Development by Example - Kent Beck.
Refactoring: Improving The Design of Existing Code - Martin Fowler
Logged

gigaraptor487

  • Bay Watcher
  • Escaped Lunatic now civilised
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5185 on: November 09, 2013, 05:21:37 pm »

Quote
Floats are an incarnation of Satan.
Especially when carrying out bitwise operations on them.
Logged
Hehe, you thought there would be an interesting sig here

I now run a program which brings old multiplayer games back to life : click

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5186 on: November 09, 2013, 07:11:09 pm »

I will never understand test-driven development. >_>
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

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5187 on: November 09, 2013, 10:59:15 pm »

Speaking of which, I've long wanted to learn proper testing methodologies for software development.  There have been a great many times we've made code changes at work and had seemingly unrelated bits of code rot and stop working as a result.  In theory it would be easy enough to code test cases for many of those, but convincing the other developers that we need to move toward formal testing methodologies has met with lackluster response.

Sort of like moving toward source control...
Logged
Through pain, I find wisdom.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5188 on: November 10, 2013, 12:38:54 am »

I'm having a circular reference problem.

soil.h has a class SoilCell, which is a 1m x 1m plot of soil that tracks water flow within its ten layers. plant.h has a plant class BasePlant.

BasePlant includes a pointer to SoilCell, in order to call SoilCell's requestWater() which lets the BasePlant draw water from SoilCell. It's all fine and dandy except I now want SoilCell to have a list(vector) of BasePlant. How should I go about solving this? >_<
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

dreadmullet

  • Bay Watcher
  • Inadequate Comedian
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5189 on: November 10, 2013, 01:39:40 am »

In plant.h, forward declare SoilCell. In a header, you can use a class pointer or reference without including the class's header file.
Logged
Pages: 1 ... 344 345 [346] 347 348 ... 796