Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 435 436 [437] 438 439 ... 796

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

Arx

  • Bay Watcher
  • Iron within, iron without.
    • View Profile
    • Art!
Re: if self.isCoder(): post() #Programming Thread
« Reply #6540 on: November 06, 2014, 01:00:44 pm »

Very feasible, at least if you have steady hands.
I'd go about it by buying some male jumper cables and some female ones to act as your pins and sockets, and then a micro->normal SD adapter and a normal->micro adapter. Solder male jumpers onto micro->normal, and females onto normal->micro, and then stick them together inside fancy plastic boxes however you like.
Logged

I am on Discord as Arx#2415.
Hail to the mind of man! / Fire in the sky
I've been waiting for you / On this day we die.

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6541 on: November 06, 2014, 02:26:26 pm »

Yeah I'd like to try this too. "about the same" would be my guess. If something doesn't work natively in C++ you can often just make a new operator for it that does the job in the same number of lines.

Personally, I think C++ scales better to really complex stuff than quick and dirty scripting languages do. The full blown typing system in C++ allows that - it's that comprehensive for a reason. Python and co are great if you want to prototype something really quick. But if you want a really complex simulation that will be easy to maintain in the long run, go for C++.

Upon reflection, I think you're probably right.  Developing with Python is definitely faster, but I think you could probably do it in about the same amount of code.  C++ probably has a little more overhead with the class definitions, but the meat of it is probably comparable.  If I can find time to archive it all together I might stick it up so someone with too much free time and interest can try taking a crack at a C++ version.  Of course, there's the ever present issue of the code not being particularly pretty or well organized... compounded by my inexperience with Python.

The biggest reason I'm using Python instead of C++ for this right now at least is the fact that while getting some packages is difficult, there are lots of really nice ones that do make development much faster.  The natural language processing library is a good example, and I'm not aware of any comparable library that's free for C++.  Of course, I'm probably going to discover that NLP isn't a great match for use in text game input, but I'll cross that bridge when I get to it.
Logged
Through pain, I find wisdom.

Sergius

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6542 on: November 06, 2014, 05:25:40 pm »

Very feasible, at least if you have steady hands.
I'd go about it by buying some male jumper cables and some female ones to act as your pins and sockets, and then a micro->normal SD adapter and a normal->micro adapter. Solder male jumpers onto micro->normal, and females onto normal->micro, and then stick them together inside fancy plastic boxes however you like.

I suppose I could skip thenormal->micro part and could just use micro SD cards.

The jumper cable part sounds like it could work but wouldn't inserting the cartridges be really hard? I'm thinking the pins should be all huge like the cartridges of old so you can just jam it into place. So a printed board with pins on it (and whatever prototypers use for the female part).

Something like this:
Spoiler (click to show/hide)
No idea where to get blank ones like that for free tho. Well, it was mostly a thought experiment :P

EDIT: Ah, I know, if I were so inclined to actually make this, I would get some "Pixels Past" Atari 2600 homebrew printed boards, cannibalize the cartridge slot of an old 2600 console, and built this... thing (actually I was thinking turning old casette tapes into cartridges and put music in them, and use the Pi as a media player, hehehe)
« Last Edit: November 06, 2014, 05:42:01 pm by Sergius »
Logged

hops

  • Bay Watcher
  • Secretary of Antifa
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6543 on: November 07, 2014, 03:47:29 am »

...Python's import system is complicated? Compared to what?

Seriously, try using "import antigravity" sometime.
* Objective import complication

huehuehuehue
Logged
she/her. (Pronouns vary over time.) The artist formerly known as Objective/Cinder.

One True Polycule with flame99 <3

Avatar by makowka

Gentlefish

  • Bay Watcher
  • [PREFSTRING: balloon-like qualities]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6544 on: November 07, 2014, 09:05:08 am »

Wow I hate piping, I can't seem to get it to work at all for my c-based shell.

Why is it so hard to get input redirected to output?

BlindKitty

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6545 on: November 07, 2014, 04:19:27 pm »

I'm looking for advice you people.

I mean, I've been programming in C# so far, and liked it pretty much. But I have moved to a web-based project, at least for some time, it seems. I tried PHP to do what I'm trying to do, but I found that it is about as bad as most people seem to think it is, and started looking for something else. I was trying to find something myself, but the information I'm looking for seem to be somewhat hard to find (maybe I just don't know the terms?), so I decided to try and ask here, maybe you will be able to point me in the right direction.

The app has a few requirements, and I have a few more as a coder. The app will generally work separately for each user, so some form of threaded execution is in order; one thread for each user, preferably keeping it alive as long as the browser tab is open. It will use a rather large cache of immutable data, so it needs to be able to access the same data from every thread. There will be some logic on the server side, so there will be non-trivial computational load, and also non-trivial amount of db operations, but mostly small ones. The db in question would probably be PostgreSQL, but I can live with MongoDB (or even MySQL, if necessary, but I would rather avoid it). I would personally prefer to have some form of rather small framework to put my code in, but I can do without any; I really don't like huge MVC frameworks, which are strongly opinionated and not really flexible (hello, Ruby on Rails; you seem great, just not for me). I would love if it was easy to debug, because debugging PHP is... bad. And well, that's pretty much it. Oh, one more thing: it would be really good if I had a chance to deploy it on some free server for starters, due to monetary constrains.

I was looking at node.js, but it seems that it would be really difficult to share a large cache of immutable data between workers, and generally the real-time focus of node doesn't feel like best fit here. Vert.x seems to have similar problem, although I might be even more wrong about this. Does anybody know anything more about it? I was trying to wrap my mind around Ruby on Rails, but is actually seems like an overkill everywhere where I don't need it, and lacking everywhere else. ASP.NET seems rather large, too, and there are close to zero free hostings that offer it as an option, which is why I didn't look very deep into it, too. PHP frameworks are, well, PHP, and I really don't like it. Although from what I understand, memcached would give me at least cache I'm looking for. I was also trying to look into Python, but I was running a little out of steam at that point, and I decided that asking here might be a better idea...
Logged
My little roguelike craft-centered game thread. Check it out.

GENERATION 10: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6546 on: November 07, 2014, 04:55:22 pm »

I'm not really at home with webapps, but you could try CherryPy.
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6547 on: November 07, 2014, 05:31:00 pm »

I'm not sure why Node.js would be particularly difficult to share data with.  You can pretty easily keep the data as a global and inject references to it into each client connection as it's opened on the server.  If anything I think JavaScript makes it too easy to share global data.  Having said that, JavaScript has just as many problems as PHP does as a language, and while I think Node.js does use multiple threads to make socket I/O non blocking, I don't think there's any way to do direct multithreading in it.  You'd have to use multiple processes and that makes sharing global data a good bit more complicated.  Do you expect to need that much computational power, or do you only want to make sure that it's non blocking and running in a single process?

What format are you storing your data in?  The database or some other file on the file system?  If the latter, you might be able to get away with opening the file with each process and just seeking to the locations of interest rather than loading the entire thing in memory.  Depends on the format.
Logged
Through pain, I find wisdom.

eerr

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6548 on: November 07, 2014, 09:33:48 pm »

In csharp, the only way I can get sounds to play is by specifying the full path-
any of the other ways I have tried, all I get is an error message sound instead.

Does anyone know what the problem is?
Logged

Zanzetkuken The Great

  • Bay Watcher
  • The Wizard Dragon
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6549 on: November 07, 2014, 09:58:59 pm »

Why the hell is this refusing to display?

Quote
header {
   background-image: url("images/back.png");
   background-position: right top;
   background-repeat: no-repeat;
   background-size: contain;
   background-color: white;
}


section{
   background-image: url("images/corner.png");
   background-position: bottom left;
   background-repeat: no-repeat;
   background:
   linear-gradient(90deg, rgba(170, 90, 27, 0.7), rgba(16, 77, 61, 0.4) 2%, rgba(255,255,255,0.4) 5%), 
   linear-gradient(0deg, rgba(170, 90, 27, 0.7), rgba(16, 77, 61, 0.4) 2%, rgba(255,255,255,0.4) 5%);
   background:
   -webkit-linear-gradient(90deg, rgba(170, 90, 27, 0.7), rgba(16, 77, 61, 0.4) 2%, rgba(255,255,255,0.4) 5%), 
   -webkit-linear-gradient(0deg, rgba(170, 90, 27, 0.7), rgba(16, 77, 61, 0.4) 2%, rgba(255,255,255,0.4) 5%);
   background:
   -o-linear-gradient(90deg, rgba(170, 90, 27, 0.7), rgba(16, 77, 61, 0.4) 2%, rgba(255,255,255,0.4) 5%), 
   -o-linear-gradient(0deg, rgba(170, 90, 27, 0.7), rgba(16, 77, 61, 0.4) 2%, rgba(255,255,255,0.4) 5%);
   background:
   -moz-linear-gradient(90deg, rgba(170, 90, 27, 0.7), rgba(16, 77, 61, 0.4) 2%, rgba(255,255,255,0.4) 5%),
   -moz-linear-gradient(0deg, rgba(170, 90, 27, 0.7), rgba(16, 77, 61, 0.4) 2%, rgba(255,255,255,0.4) 5%);
}
« Last Edit: November 07, 2014, 10:51:40 pm by Zanzetkuken The Great »
Logged
Quote from: Eric Blank
It's Zanzetkuken The Great. He's a goddamn wizard-dragon. He will make it so, and it will forever be.
Quote from: 2016 Election IRC
<DozebomLolumzalis> you filthy god-damn ninja wizard dragon

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #6550 on: November 07, 2014, 10:31:44 pm »

I dunno, you should show us the HTML, too, instead of tossing out a dirty section of css :I
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

BlindKitty

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6551 on: November 08, 2014, 05:20:24 am »

I'm not sure why Node.js would be particularly difficult to share data with.  You can pretty easily keep the data as a global and inject references to it into each client connection as it's opened on the server.  If anything I think JavaScript makes it too easy to share global data.  Having said that, JavaScript has just as many problems as PHP does as a language, and while I think Node.js does use multiple threads to make socket I/O non blocking, I don't think there's any way to do direct multithreading in it.  You'd have to use multiple processes and that makes sharing global data a good bit more complicated.  Do you expect to need that much computational power, or do you only want to make sure that it's non blocking and running in a single process?

What format are you storing your data in?  The database or some other file on the file system?  If the latter, you might be able to get away with opening the file with each process and just seeking to the locations of interest rather than loading the entire thing in memory.  Depends on the format.

Well, generally the problem is that somebody saw that it is too easy to share global status in JS, and it was all but blocked by the single-process/multi-thread solutions for node.js (I'm thinking here mostly about thread-a-gogo, or TAGG, which allows one to create a thread pool and use those threads without managing each one; but only thing they are allowed to share with the main process and themselves are strings, which are immutable, and one can't even use .frozen to share...). I'm pretty sure each connection will do just fine with one thread, but there are a few CPU-intensive tasks that might choke node.js single process if there are multiple connections. I general it seems that anything taking more than a fraction of millisecond is not advisable in main loop of node. And yeah, JS isn't all that good as a language, too... Maybe I'm more fond of it because I used it less than PHP? :P

I'm having a data that is, effectively, a collection of objects (kinda tree-like, with objects within objects, too) mixed with some rather large arrays of ints, that reference some of those objects. Which leads me to a conclusion that PostgreSQL is the best choice, since I have both relations and objects mixed. I suppose I could try reading the objects from a huge JSON file, and keep the db only for arrays (those are mutable, BTW, so they have to be read every time anyway), but I'm not really sure if it would help.

I'm not really at home with webapps, but you could try CherryPy.

This seems interesting. I'm currently digging about more on it (and Ruby's equivalent, as I really dislike the meaningful whitespace in Python). :)

Thank you both very much!
Logged
My little roguelike craft-centered game thread. Check it out.

GENERATION 10: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #6552 on: November 08, 2014, 06:40:09 am »

Quote
meaningful whitespace in Python
???

Python's whitespace is fairly meaningless. Unless that's what you meant, then okay.
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

Arx

  • Bay Watcher
  • Iron within, iron without.
    • View Profile
    • Art!
Re: if self.isCoder(): post() #Programming Thread
« Reply #6553 on: November 08, 2014, 06:44:51 am »

What? Whitespace very meaningful in Python.

The difference between

Code: [Select]
def printWords():
print "helloWorld"

printWords()

and

Code: [Select]
def printWords():
    print "helloWorld"

printWords()

is that only the latter works.
Logged

I am on Discord as Arx#2415.
Hail to the mind of man! / Fire in the sky
I've been waiting for you / On this day we die.

BlindKitty

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6554 on: November 08, 2014, 06:50:02 am »

What? Whitespace very meaningful in Python.

The difference between

Code: [Select]
def printWords():
print "helloWorld"

printWords()

and

Code: [Select]
def printWords():
    print "helloWorld"

printWords()

is that only the latter works.

That's what I meant. Well, not all whitespace is meaningful, but indentation is, and you can't mix tabs with spaces, and I find syntax with brackets or keywords so, so much more readable and sensible. Especially if I have a project that is more than one file large, as it will surely mean that at one point in time I will screw something, for example when moving code from one file to another. It is not a deal-breaker, but I can't really understand how somebody could have thought that it is a good idea.
Logged
My little roguelike craft-centered game thread. Check it out.

GENERATION 10: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.
Pages: 1 ... 435 436 [437] 438 439 ... 796