Re: cuteDoc -New DDOC theme

2011-10-29 Thread Robik
Nick Sabalausky Wrote:

 Robik szad...@gmail.com wrote in message 
 news:j8f14s$1o78$1...@digitalmars.com...
  Hi.
 
  I'd like to share with new theme for DDOC named CuteDoc. It can be
  found here: https://github.com/robik/cuteDoc .
 
  Live demo can be foudn here: http://cutedoc.dav1d.de/ . (Thanks to
  dav1d (from #d) for hosting it).
 
 
 Cute theme! (A ha! A pun!)
 
 Little suggestion: If you leave the modules and jump to already-expanded 
 in the HTML, and then use JS to flatten them upon page load, then it'll work 
 for everyone, not just those who have JS enabled. It's never good to assume 
 JS.
 
 One other issue: When both modules and jump to are expanded, the bottom 
 half of the jump to is hidden under the bottom frame of the browser window 
 and completely inaccessible, and scrolling dosn't help (And that's even when 
 I have the browser maximized). Frames have never really been considered good 
 style on the web, and floating boxes are not far off from frames. You may 
 want to consider making them non-floaty: it'll take a *lot* less work to 
 make it work right for everyone.
 
 

Thanks for cool suggestions.

About second issue, which web browser do you use?


Re: cuteDoc -New DDOC theme

2011-10-29 Thread Nick Sabalausky
Robik szad...@gmail.com wrote in message 
news:j8g8oj$qj7$1...@digitalmars.com...
 Nick Sabalausky Wrote:

 Robik szad...@gmail.com wrote in message
 news:j8f14s$1o78$1...@digitalmars.com...
  Hi.
 
  I'd like to share with new theme for DDOC named CuteDoc. It can be
  found here: https://github.com/robik/cuteDoc .
 
  Live demo can be foudn here: http://cutedoc.dav1d.de/ . (Thanks to
  dav1d (from #d) for hosting it).
 

 Cute theme! (A ha! A pun!)

 Little suggestion: If you leave the modules and jump to 
 already-expanded
 in the HTML, and then use JS to flatten them upon page load, then it'll 
 work
 for everyone, not just those who have JS enabled. It's never good to 
 assume
 JS.

 One other issue: When both modules and jump to are expanded, the 
 bottom
 half of the jump to is hidden under the bottom frame of the browser 
 window
 and completely inaccessible, and scrolling dosn't help (And that's even 
 when
 I have the browser maximized). Frames have never really been considered 
 good
 style on the web, and floating boxes are not far off from frames. You may
 want to consider making them non-floaty: it'll take a *lot* less work to
 make it work right for everyone.



 Thanks for cool suggestions.

 About second issue, which web browser do you use?

FF




Re: AI Challenge - Ants

2011-10-29 Thread Max Wolter

On 10/25/2011 1:44 PM, Trass3r wrote:

I'm working on a bot in D. I'm currently done implementing the A*
algorithm for path finding


Dump A*, D* Lite ftw ;)


Hellooo.

Correct me if I'm wrong, but in A*, I can just find a path, store it 
(let's say as a string) and find a new one if it's blocked for some reason.


As far as I could see from what I've read about Lifelong A*, D*, Focused 
D* and D* Lite, I would have to store all nodes used in the algorithm - 
so, as opposed to A*, I have to conserve the state of the entire search 
algorithm throughout ticks, for each ant.


Is the environment in this AI challenge really noisy enough to warrant 
this? Obviously, if the path needs to be re-planned almost every tick, 
D* Lite seems like a better choice to me. But if you have 100+ ants, 
that would be a lot of allocated heap memory, wouldn't it?


I really don't have a clue how the processing vs allocating should be 
weighed here performance-wise.


/Max


Xinok Sort Update

2011-10-29 Thread Xinok
I recently put some time into updating my implementation of xinok sort 
for D. Major changes include support for random-access ranges and custom 
predicates (ab). You can download the new version here:


http://sourceforge.net/projects/xinoksort/files/D%202.0/2011-10-29/xinoksort.d/download

For those that are unaware, I posted about a new sorting algorithm a few 
weeks ago. Xinok sort is a *stable* sorting algorithm with good 
performance while only requiring a small amount of constant additional 
memory.


The current stable sort in Phobos is broken and much slower, so I hope 
to contribute my algorithm to Phobos. But I'm new to this, so I'm not 
really sure of all what I need to do. I would appreciate if a few people 
could review my code and suggest any changes or improvements, as well as 
test for bugs.


Re: AI Challenge - Ants

2011-10-29 Thread Sean Kelly
If you want to cheat, there have been books published on ant colony 
optimization.  I'm sure the related papers could be dug up. 

Sent from my iPhone

On Oct 29, 2011, at 3:12 AM, Max Wolter awishform...@gmail.com wrote:

 On 10/25/2011 1:44 PM, Trass3r wrote:
 I'm working on a bot in D. I'm currently done implementing the A*
 algorithm for path finding
 
 Dump A*, D* Lite ftw ;)
 
 Hellooo.
 
 Correct me if I'm wrong, but in A*, I can just find a path, store it (let's 
 say as a string) and find a new one if it's blocked for some reason.
 
 As far as I could see from what I've read about Lifelong A*, D*, Focused D* 
 and D* Lite, I would have to store all nodes used in the algorithm - so, as 
 opposed to A*, I have to conserve the state of the entire search algorithm 
 throughout ticks, for each ant.
 
 Is the environment in this AI challenge really noisy enough to warrant this? 
 Obviously, if the path needs to be re-planned almost every tick, D* Lite 
 seems like a better choice to me. But if you have 100+ ants, that would be a 
 lot of allocated heap memory, wouldn't it?
 
 I really don't have a clue how the processing vs allocating should be weighed 
 here performance-wise.
 
 /Max


Re: AI Challenge - Ants

2011-10-29 Thread Lishaak Bystroushaak
Hi.

I don't think, that you have to use some advanced strategies and path
finding. I'm currently 261 with this simple code:
http://pastebin.com/1Nsb81rj With hill defense and ant grouping, you
could be imho easilly in first 100 without A* :)

2011/10/29 Sean Kelly s...@invisibleduck.org:
 If you want to cheat, there have been books published on ant colony 
 optimization.  I'm sure the related papers could be dug up.

 Sent from my iPhone

 On Oct 29, 2011, at 3:12 AM, Max Wolter awishform...@gmail.com wrote:

 On 10/25/2011 1:44 PM, Trass3r wrote:
 I'm working on a bot in D. I'm currently done implementing the A*
 algorithm for path finding

 Dump A*, D* Lite ftw ;)

 Hellooo.

 Correct me if I'm wrong, but in A*, I can just find a path, store it (let's 
 say as a string) and find a new one if it's blocked for some reason.

 As far as I could see from what I've read about Lifelong A*, D*, Focused D* 
 and D* Lite, I would have to store all nodes used in the algorithm - so, as 
 opposed to A*, I have to conserve the state of the entire search algorithm 
 throughout ticks, for each ant.

 Is the environment in this AI challenge really noisy enough to warrant this? 
 Obviously, if the path needs to be re-planned almost every tick, D* Lite 
 seems like a better choice to me. But if you have 100+ ants, that would be a 
 lot of allocated heap memory, wouldn't it?

 I really don't have a clue how the processing vs allocating should be 
 weighed here performance-wise.

 /Max



Re: Xinok Sort Update

2011-10-29 Thread Xinok

On 10/29/2011 5:53 PM, Timon Gehr wrote:


Looks good =). Thank you. How does this implementation of your algorithm
compare to the the unstable sort that is currently in Phobos,
performance wise?


I posted some benchmarks here. These benchmarks used the specialized 
code for arrays. There would likely be a larger gap when using ranges.

https://sourceforge.net/p/xinoksort/blog/2011/10/another-update--benchmarks/


One comment:

while(temp is null){
try temp.length = len;
catch(Exception err){ // Reduce memory usage and try again
len /= 2;
if(len = 8) continue;
else throw err;
}
}

temp.length = len cannot throw an Exception.
I think you are trying to catch an OutOfMemoryError here?


Yes I was. What should I do/use instead?


Re: Xinok Sort Update

2011-10-29 Thread Timon Gehr

On 10/30/2011 12:19 AM, Xinok wrote:

On 10/29/2011 5:53 PM, Timon Gehr wrote:


Looks good =). Thank you. How does this implementation of your algorithm
compare to the the unstable sort that is currently in Phobos,
performance wise?


I posted some benchmarks here. These benchmarks used the specialized
code for arrays. There would likely be a larger gap when using ranges.
https://sourceforge.net/p/xinoksort/blog/2011/10/another-update--benchmarks/



Ok, very nice.




One comment:

while(temp is null){
try temp.length = len;
catch(Exception err){ // Reduce memory usage and try again
len /= 2;
if(len = 8) continue;
else throw err;
}
}

temp.length = len cannot throw an Exception.
I think you are trying to catch an OutOfMemoryError here?


Yes I was. What should I do/use instead?


You could use catch(Error err) or catch(OutOfMemoryError err) or not 
catch the Error at all.


Re: Xinok Sort Update

2011-10-29 Thread Vladimir Panteleev

On Sun, 30 Oct 2011 01:56:23 +0300, Timon Gehr timon.g...@gmx.ch wrote:

You could use catch(Error err) or catch(OutOfMemoryError err) or not  
catch the Error at all.


Note that (IIRC) an OutOfMemoryError will be thrown only when:
1) There is no space on the managed heap
2) A garbage collection cycle failed to free enough memory for the  
requested allocation

3) The operating system could not allocate any more memory, even from swap.

Some operating systems (Windows) will even expand the swap file  
automatically when it nears being full.


I don't think that there's any point in doing anything sensible in an  
OutOfMemory handler.


--
Best regards,
 Vladimirmailto:vladi...@thecybershadow.net


Re: Xinok Sort Update

2011-10-29 Thread Xinok

On 10/29/2011 7:19 PM, Vladimir Panteleev wrote:

On Sun, 30 Oct 2011 01:56:23 +0300, Timon Gehr timon.g...@gmx.ch wrote:


You could use catch(Error err) or catch(OutOfMemoryError err) or not
catch the Error at all.


I'll use OutOfMemoryError. If any other error occurs, it's probably best 
to let the function fail.



Note that (IIRC) an OutOfMemoryError will be thrown only when:
1) There is no space on the managed heap
2) A garbage collection cycle failed to free enough memory for the
requested allocation
3) The operating system could not allocate any more memory, even from swap.

Some operating systems (Windows) will even expand the swap file
automatically when it nears being full.

I don't think that there's any point in doing anything sensible in an
OutOfMemory handler.



32-bit processes on Windows can only have up to 2GiB of addressable 
memory. Even if there's enough available memory, there may not be a 
large enough area of contiguous free space. I've gotten out of memory 
errors when working in D.


I handle the error because I can. My algorithm doesn't require any 
minimum amount of memory to be allocated, so I can reduce the memory 
usage for a small loss in performance.