Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 388 389 [390] 391 392 ... 796

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

Maklak

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5835 on: May 08, 2014, 01:58:17 am »

> continuous, large memory structures are problematic.
Yeah, memory gets fragmented over time and there may not be sth that big available, even though there is more than enough memory.
That said, AFAIK C# garbage collector can compact the heap by relocating memory chunks and changing the addresses of all references to that chunk, so it should work.

The only things I can recommend are to buy more RAM and compile for 64 bits.
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

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5836 on: May 08, 2014, 03:12:03 am »

16 GB of RAM and 64 bit compilation with optimization, still no dice. I think that there is a certain cutoff size in Bitmap() where it automatically throws an argument exception to prevent the allocation issues in the first place...

edit: Actually it randomly worked again. ._. Kinda annoying.
« Last Edit: May 08, 2014, 03:14:35 am by Skyrunner »
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 #5837 on: May 08, 2014, 07:33:57 am »

While I wouldn't discount it, I am a bit surprised that heap fragmentation would matter for even a ~1 GB allocation in a 64-bit application.  The C# / .NET memory allocator might place extra restrictions that prevent allocations like that, but using virtual addressing and a 64-bit memory range (technically something like 48-bits due to processor limitations) should allow for plenty of huge memory ranges.  I was going to suggest turning your page file back on if you had it disabled, but honestly, with 16 GB of physical memory I seriously doubt that would make any difference.

I'm not really sure what you should try at this point.  In C++ I might would suggest manually allocating your memory by allocating a very, very large memory block up front in the application (say, 3 GB) and then parceling out the memory yourself.  I think you can do some scary stuff with pointers in C# somehow, but is definitely getting outside of normal usage of the language, and is probably not going to really help.

It could also be that the data structure is reserving a lot more space than it's using.  I know the STL containers in C++ can do this, and have member functions that allow the programmer to manage that to an extent.  Maybe you can find something useful there?
Logged
Through pain, I find wisdom.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5838 on: May 08, 2014, 07:50:57 am »

Oh well, it just means that I'll have to actually make custom bezier functions instead of letting a graphics library do the work for me :(
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

Vattic

  • Bay Watcher
  • bibo ergo sum
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5839 on: May 09, 2014, 10:20:03 pm »

Oh well, it just means that I'll have to actually make custom bezier functions instead of letting a graphics library do the work for me :(
Curved rivers?
Logged
6 out of 7 dwarves aren't Happy.
How To Generate Small Islands

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5840 on: May 09, 2014, 10:53:21 pm »

Oh well, it just means that I'll have to actually make custom bezier functions instead of letting a graphics library do the work for me :(
Curved rivers?
Curved rivers.
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

Gatleos

  • Bay Watcher
  • Mournhold... City of Light... City of MAGIC!
    • View Profile
    • Someone Sig This
Re: if self.isCoder(): post() #Programming Thread
« Reply #5841 on: May 10, 2014, 09:34:58 am »

Are feelings of megalomania normal after learning regular expressions, or is it just me?
Logged
Think of it like Sim City, except with rival mayors that seek to destroy your citizens by arming legions of homeless people and sending them to attack you.
Quote from: Moonshadow101
it would be funny to see babies spontaneously combust
Gat HQ (Sigtext)
++U+U++ // ,.,.@UUUUUUUU

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5842 on: May 10, 2014, 10:06:39 am »

Are feelings of megalomania normal after learning regular expressions, or is it just me?
Neither; regular expressions are just that awesome.
Logged

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #5843 on: May 10, 2014, 06:47:55 pm »

Are feelings of megalomania normal after learning regular expressions, or is it just me?
Neither; regular expressions are just that awesome.
And despite their usefulness, I don't recall using them for any reason since learning them...
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.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5844 on: May 10, 2014, 06:50:33 pm »

Try DF raw modding. You'll have to get used to them.

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5845 on: May 10, 2014, 08:01:37 pm »

Regular expressions come up all the time for me with web development, for many different reasons.  The most recent example would be a bit unrelated though: adjusting a JavaScript 'compiler' script I wrote to package our in house JavaScript library.  I had to add in something like C preprocessor commands, such as 'INCLUDE file.js'.  Regular expressions make it so easy to grab file.js out of that.

Of course, regular expressiosn are also some of the more maddening things I've had to work with.  Case in point: Apache .htaccess rewrite rules.  The problem is kind of compounded by the fact that you're potentially upsetting a web server with only minimal ability to give you feedback if you get it wrong, but I really hate writing rewrite rules that rely on regular expressions.

There's a saying about regular expressions.  "If you've got a problem, and solve it with regular expressions, now you've got two problems."  It's true pretty often.  :)
Logged
Through pain, I find wisdom.

Maklak

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5846 on: May 11, 2014, 03:10:53 am »

Regexps come up pretty often in text processing, like reading DF RAWs or something to do with the web or what have you. Another common application is searching text files for expressions. Plus you can do things like re-format phone numbers, hacky xml processing and so on.

Regexes are one of great strengths of scripting languages, like Perl, Python, Ruby, Lua, etc.

They can get quite arcane and messy pretty quick and a good syntax-highlighting and brace-matching text editor can only help so far, so they can get unpleasant.

There is a book called "Mastering Regular Expressions" and I've heard it's good, but haven't read it yet.

Anyway, I think it is OK to feel good because you know regexps :)


Now my question is about users more than programming. I wrote some scripts to make a subset of RAWs into tables and wrote manuals for that. The surprisingly problematic parts come down to things like:
Code: [Select]
To do this, execute it with these parameters:
$ perl -w ../armour.pl --bbcode --sort=LAYER *.txt > ../armour_bb.txt

To which the users respond with:
1) I'm afraid to use the console.
2) I don't have perl.
3) When I write "$ ..." the console says it's an error, but it works without it. 
4) My console doesn't understand the *, but it works after I fed it a list of files manually. 

These things keep coming up, despite me writing that:
1) Like any power tool, it is only dangerous when misused. Watch where you're re-directing that standard output and you'll be OK.
2) A bunch of install links.
3) What? The "$" is just the prompt sign, that means more or less "write the things after this in the console". This convention is used by so many tutorials and howtos that I'm surprised you know how to use a console, but not to omit the dollar.
4) Usually a case of putting the whole command in quotes or pointing to the wrong directory.

Number 3 is especially weird. Is there some other convention for this that I'm not aware of? Or maybe something to put in the manual to make users less frustrated and me less confused about it?
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

Sheb

  • Bay Watcher
  • You Are An Avatar
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5847 on: May 11, 2014, 03:24:13 am »

Actually I wasn't aware of this convention until right now.
Logged

Quote from: Paul-Henry Spaak
Europe consists only of small countries, some of which know it and some of which don’t yet.

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5848 on: May 11, 2014, 03:25:02 am »

Windows console doesn't have the dollar, it may be that.
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.

da_nang

  • Bay Watcher
  • Argonian Overlord
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5849 on: May 11, 2014, 03:37:11 am »

Is there a particular need to point out the $ when writing out what to type into the console?
Most of the console related commands I've seen on webpages are usually typed without the initial $ (or > in Windows).

For instance, random code pulled out of the Bash manual:
Code: [Select]
echo -n "Enter the name of an animal: "
read ANIMAL
echo -n "The $ANIMAL has "
case $ANIMAL in
  horse | dog | cat) echo -n "four";;
  man | kangaroo ) echo -n "two";;
  *) echo -n "an unknown number of";;
esac
echo " legs."
« Last Edit: May 11, 2014, 03:42:21 am by da_nang »
Logged
"Deliver yesterday, code today, think tomorrow."
Ceterum censeo Unionem Europaeam esse delendam.
Future supplanter of humanity.
Pages: 1 ... 388 389 [390] 391 392 ... 796