Re: Basically want to make a macro script

2014-11-12 Thread ketmar via Digitalmars-d-learn
On Wed, 12 Nov 2014 04:56:39 +
Casey via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:

D has nothing to do with your task, WinAPI does. and you'll need alot
of expirience in reverse engineering, 'cause f... punkbuster shits it's
pants almost for anything. it's a rootkit, and very badly written one.
what you have to do is to fight with rootkit, making it think that it
is still functional. so learn assembler, x86 archtecture, winapi,
windows driver development, nt kernel internals and so on.

and don't even dream that it will be portable.


signature.asc
Description: PGP signature


Easy way to monitor gc activity?

2014-11-12 Thread Tofu Ninja via Digitalmars-d-learn

Basicly what the title said.

What is an easy way to monitor gc activity?
I am finding it hard to know when and where the gc is running and 
how much.


Preferably I would like a way to do it in app so I can make 
adjustments based on gc load.


Also I would prefer to not have to recompile the runtime if I can 
avoid it.


-Tofu


Re: Easy way to monitor gc activity?

2014-11-12 Thread thedeemon via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 10:43:32 UTC, Tofu Ninja wrote:

What is an easy way to monitor gc activity?


Here's mine:
https://bitbucket.org/infognition/dstuff/src/
A little module that allows you to track all GC allocations.


Re: Russian translation of the range term?

2014-11-12 Thread thedeemon via Digitalmars-d-learn

On Tuesday, 11 November 2014 at 11:50:18 UTC, Ivan Kazmenko wrote:

Hi!

I'm unsure what is the Russian equivalent for the term range, 
as in D range, the generalization of a pair of iterators.


I think последовательность (sequence) is the most appropriate, 
because the defining characteristic of an input range (most 
common one) is ability to provide data sequentially. Also, afaik, 
some languages like F# and Clojure use this term (often shortened 
to 'seq') for the same thing that D calls ranges.




Re: Russian translation of the range term?

2014-11-12 Thread ketmar via Digitalmars-d-learn
On Wed, 12 Nov 2014 11:38:50 +
thedeemon via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:

 some languages like F# and Clojure use this term (often shortened 
 to 'seq')
послед. rotfl.


signature.asc
Description: PGP signature


Re: Destructor/Finalizer Guarantees

2014-11-12 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 22:31:17 UTC, Maxime 
Chevalier-Boisvert wrote:
I've made it so they unregister themselves in their destructor. 
... However, this only works if I can assume that the GC will 
first call the destructor on an object, then free the object, 
that this is done in a predictable order.


This order is not really predictable now. In general in 
destructor you can't access anything outside the object's value 
typed fields. Any reference may point to a dead object at this 
moment, any external or global object may be destroyed already.


Re: Destructor/Finalizer Guarantees

2014-11-12 Thread thedeemon via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 04:06:11 UTC, Algo wrote:


Could this work?

class VM {
static List[VM*] _gcRootLists;
List* gcRootList;
~this() {
_gcRootLists.remove(this);


No. Hash-table operations may try to allocate or free memory 
which is not allowed during a GC cycle where the destructors are 
called. It will just cause InvalidMemoryOperationError and the 
program will exit abnormally.




Crash on Windows with core.stdc.stdlib.free()

2014-11-12 Thread Chris via Digitalmars-d-learn

The following causes the DLL to crash on Windows:

Input: immutable(short)* data (immutable because in separate 
thread).

// Later
core.stdc.stdlib.free(cast(short *)data);

(short* data is provided by the C library, where the memory is 
allocated)


On Linux it works fine and never crashes, in the Windows DLL it 
randomly causes an access violation in memory (both read and 
write). Note that it doesn't crash immediately, it goes on for a 
while, but sooner or later it crashes. If I comment out this 
line, everything works fine. However, if I don't free the memory, 
I'll have a memory leak. Any hints/advice/guesses?


Re: Crash on Windows with core.stdc.stdlib.free()

2014-11-12 Thread ketmar via Digitalmars-d-learn
On Wed, 12 Nov 2014 12:40:30 +
Chris via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:

 The following causes the DLL to crash on Windows:
 
 Input: immutable(short)* data (immutable because in separate 
 thread).
 // Later
 core.stdc.stdlib.free(cast(short *)data);
 
 (short* data is provided by the C library, where the memory is 
 allocated)
 
 On Linux it works fine and never crashes, in the Windows DLL it 
 randomly causes an access violation in memory (both read and 
 write). Note that it doesn't crash immediately, it goes on for a 
 while, but sooner or later it crashes. If I comment out this 
 line, everything works fine. However, if I don't free the memory, 
 I'll have a memory leak. Any hints/advice/guesses?
seems that you are using two different allocators here. one is that
comes with DLL and other that comes with D. i bet they either using
different runtimes, or C runtime is doesn't know about another C
runtime in DLL.

on GNU/Linux there is only one runtime (most of the time), so there
is no problem with different allocators.


signature.asc
Description: PGP signature


Re: Crash on Windows with core.stdc.stdlib.free()

2014-11-12 Thread ketmar via Digitalmars-d-learn
On Wed, 12 Nov 2014 12:40:30 +
Chris via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:

 The following causes the DLL to crash on Windows:
 
 Input: immutable(short)* data (immutable because in separate 
 thread).
 // Later
 core.stdc.stdlib.free(cast(short *)data);
 
 (short* data is provided by the C library, where the memory is 
 allocated)
 
 On Linux it works fine and never crashes, in the Windows DLL it 
 randomly causes an access violation in memory (both read and 
 write). Note that it doesn't crash immediately, it goes on for a 
 while, but sooner or later it crashes. If I comment out this 
 line, everything works fine. However, if I don't free the memory, 
 I'll have a memory leak. Any hints/advice/guesses?
p.s. i mean different C runtimes.


signature.asc
Description: PGP signature


Re: alias overloaded function template

2014-11-12 Thread Lemonfiend via Digitalmars-d-learn
The problem is not the alias. The error message is about using 
the same identifier for two different things:


C:\...\temp_0186F968.d(13,1): Error: declaration foo(T)(T t, 
int i) is already defined.
I'm not sure what is giving you that particular error. Without 
the alias it compiles and runs fine for me.


When I wrap them individually in the template statement, it gives:
---
src\app.d(24): Error: template app.foo cannot deduce function 
from argument types !()(int), candidates are:

src\app.d(40):app.foo(T)
src\app.d(45):app.foo(T)
---

When I wrap them together, I can indeed alias it, thanks!


What you seem to forget is that the declarations:
-
void foo(T)(T t) {}
void foo(T)(T t, int i) {}
-
are actually a two **Eponymous template** with the same name:
-
template foo(T){
void foo(T t) {}
}
template foo(T){
void foo(T t, int i) {}
}
-

Yes I had forgotten, assuming I ever knew :)


Re: Easy way to monitor gc activity?

2014-11-12 Thread Tofu Ninja via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 11:29:01 UTC, thedeemon wrote:
On Wednesday, 12 November 2014 at 10:43:32 UTC, Tofu Ninja 
wrote:

What is an easy way to monitor gc activity?


Here's mine:
https://bitbucket.org/infognition/dstuff/src/
A little module that allows you to track all GC allocations.


This is exactly what I needed... you... are... awesome
Thanks man

-Tofu


Can't install dub on Debian

2014-11-12 Thread Suliman via Digitalmars-d-learn

I did 2 steps from http://d-apt.sourceforge.net/

$ sudo wget 
http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list 
-O /etc/apt/sources.list.d/d-apt.list


$ sudo apt-get update  sudo apt-get -y --allow-unauthenticated 
install --reinstall d-apt-keyring  sudo apt-get update


And now when I am trying to install dub I am getting next message:

root@66898:/# apt-get install dub
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 dub : Depends: dmd-bin but it is not going to be installed or
dmd but it is not installable
   PreDepends: multiarch-support but it is not installable
E: Broken packages


Re: Crash on Windows with core.stdc.stdlib.free()

2014-11-12 Thread Chris via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 12:58:19 UTC, ketmar via 
Digitalmars-d-learn wrote:

On Wed, 12 Nov 2014 12:40:30 +
Chris via Digitalmars-d-learn 
digitalmars-d-learn@puremagic.com wrote:



The following causes the DLL to crash on Windows:

Input: immutable(short)* data (immutable because in separate 
thread).

// Later
core.stdc.stdlib.free(cast(short *)data);

(short* data is provided by the C library, where the memory is 
allocated)


On Linux it works fine and never crashes, in the Windows DLL 
it randomly causes an access violation in memory (both read 
and write). Note that it doesn't crash immediately, it goes on 
for a while, but sooner or later it crashes. If I comment out 
this line, everything works fine. However, if I don't free the 
memory, I'll have a memory leak. Any hints/advice/guesses?
seems that you are using two different allocators here. one is 
that
comes with DLL and other that comes with D. i bet they either 
using

different runtimes, or C runtime is doesn't know about another C
runtime in DLL.

on GNU/Linux there is only one runtime (most of the time), so 
there

is no problem with different allocators.


That makes a lot of sense. Hm. How can I work around this problem 
then? What's involved are a C-dll and a D-dll that uses the C-dll 
and is loaded into a Python program. To complicate things further 
short* data is passed to C by D. short* data is then allocated 
and populated in C.




Re: Crash on Windows with core.stdc.stdlib.free()

2014-11-12 Thread ketmar via Digitalmars-d-learn
On Wed, 12 Nov 2014 14:11:35 +
Chris via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:

 On Wednesday, 12 November 2014 at 12:58:19 UTC, ketmar via 
 Digitalmars-d-learn wrote:
  On Wed, 12 Nov 2014 12:40:30 +
  Chris via Digitalmars-d-learn 
  digitalmars-d-learn@puremagic.com wrote:
 
  The following causes the DLL to crash on Windows:
  
  Input: immutable(short)* data (immutable because in separate 
  thread).
  // Later
  core.stdc.stdlib.free(cast(short *)data);
  
  (short* data is provided by the C library, where the memory is 
  allocated)
  
  On Linux it works fine and never crashes, in the Windows DLL 
  it randomly causes an access violation in memory (both read 
  and write). Note that it doesn't crash immediately, it goes on 
  for a while, but sooner or later it crashes. If I comment out 
  this line, everything works fine. However, if I don't free the 
  memory, I'll have a memory leak. Any hints/advice/guesses?
  seems that you are using two different allocators here. one is 
  that
  comes with DLL and other that comes with D. i bet they either 
  using
  different runtimes, or C runtime is doesn't know about another C
  runtime in DLL.
 
  on GNU/Linux there is only one runtime (most of the time), so 
  there
  is no problem with different allocators.
 
 That makes a lot of sense. Hm. How can I work around this problem 
 then? What's involved are a C-dll and a D-dll that uses the C-dll 
 and is loaded into a Python program. To complicate things further 
 short* data is passed to C by D. short* data is then allocated 
 and populated in C.
if you can extend C DLL, just add wrapper for `free()` there. so you
will not call `free()` from D, but call C DLL function which will free
the memory. it's a good practice anyway, 'cause it's recommended to
free memory in the same library where you allocated it.


signature.asc
Description: PGP signature


Re: Destructor/Finalizer Guarantees

2014-11-12 Thread Kagamin via Digitalmars-d-learn
With GC you usually have two destructors: one for managed 
resources and one for unmanaged resources. Destructor for managed 
resources should be run on live objects as soon as you don't need 
the resource, it calls unmanaged destructor too. Unmanaged 
destructor (finalizer) is called by GC during garbage collection 
and frees unmanaged resources (not managed by GC). Since they are 
not managed by GC, you decide, how they are disposed. Though 
calling finalizer during collection is a last resort for resource 
management, unmanaged destructor should be normally called from 
managed destructor.


Re: Destructor/Finalizer Guarantees

2014-11-12 Thread eles via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 14:36:19 UTC, Kagamin wrote:

With GC you usually have two destructors:


Which is why this approach is so cumbersome. At least, in non-GC 
you only have just one kind of destructor.


Re: Crash on Windows with core.stdc.stdlib.free()

2014-11-12 Thread Chris via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 14:26:15 UTC, ketmar via 
Digitalmars-d-learn wrote:

On Wed, 12 Nov 2014 14:11:35 +
Chris via Digitalmars-d-learn 
digitalmars-d-learn@puremagic.com wrote:


On Wednesday, 12 November 2014 at 12:58:19 UTC, ketmar via 
Digitalmars-d-learn wrote:

 On Wed, 12 Nov 2014 12:40:30 +
 Chris via Digitalmars-d-learn 
 digitalmars-d-learn@puremagic.com wrote:


 The following causes the DLL to crash on Windows:
 
 Input: immutable(short)* data (immutable because in 
 separate thread).

 // Later
 core.stdc.stdlib.free(cast(short *)data);
 
 (short* data is provided by the C library, where the memory 
 is allocated)
 
 On Linux it works fine and never crashes, in the Windows 
 DLL it randomly causes an access violation in memory (both 
 read and write). Note that it doesn't crash immediately, it 
 goes on for a while, but sooner or later it crashes. If I 
 comment out this line, everything works fine. However, if I 
 don't free the memory, I'll have a memory leak. Any 
 hints/advice/guesses?
 seems that you are using two different allocators here. one 
 is that
 comes with DLL and other that comes with D. i bet they 
 either using
 different runtimes, or C runtime is doesn't know about 
 another C

 runtime in DLL.

 on GNU/Linux there is only one runtime (most of the time), 
 so there

 is no problem with different allocators.

That makes a lot of sense. Hm. How can I work around this 
problem then? What's involved are a C-dll and a D-dll that 
uses the C-dll and is loaded into a Python program. To 
complicate things further short* data is passed to C by D. 
short* data is then allocated and populated in C.
if you can extend C DLL, just add wrapper for `free()` there. 
so you
will not call `free()` from D, but call C DLL function which 
will free
the memory. it's a good practice anyway, 'cause it's 
recommended to

free memory in the same library where you allocated it.


I initially had an implementation that did exactly that (I 
usually do that), but for some reason it didn't work properly in 
this particular case and caused all sorts of undefined behavior. 
But I'll have a look at it again.


Re: Can't install dub on Debian

2014-11-12 Thread Andre Kostur via Digitalmars-d-learn

On 2014-11-12, 5:39 AM, Suliman wrote:

I did 2 steps from http://d-apt.sourceforge.net/



[snip]


The following packages have unmet dependencies:
  dub : Depends: dmd-bin but it is not going to be installed or
 dmd but it is not installable
PreDepends: multiarch-support but it is not installable
E: Broken packages


OK, what does it complain about if you try to apt-get install 
multiarch-support ?


Re: Destructor/Finalizer Guarantees

2014-11-12 Thread Kagamin via Digitalmars-d-learn
It can work with only managed destructor - that's how it's 
usually done. Finalizer only guards against slow resource leak 
when you forget to free them.


Re: Destructor/Finalizer Guarantees

2014-11-12 Thread Kagamin via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 14:42:38 UTC, eles wrote:
Which is why this approach is so cumbersome. At least, in 
non-GC you only have just one kind of destructor.


It's not necessarily very cumbersome. Standard library usually 
provides necessary integration: 
http://blogs.msdn.com/b/bclteam/archive/2005/03/16/396900.aspx


Re: Crash on Windows with core.stdc.stdlib.free()

2014-11-12 Thread Chris via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 14:42:34 UTC, Chris wrote:

On Wednesday, 12 November 2014 at 14:26:15 UTC, ketmar via
if you can extend C DLL, just add wrapper for `free()` there. 
so you
will not call `free()` from D, but call C DLL function which 
will free
the memory. it's a good practice anyway, 'cause it's 
recommended to

free memory in the same library where you allocated it.


I initially had an implementation that did exactly that (I 
usually do that), but for some reason it didn't work properly 
in this particular case and caused all sorts of undefined 
behavior. But I'll have a look at it again.


I've changed the code so that the memory is freed in C. Although 
it works better it crashes too every now and then


(WindowsError : exception : access violation writing 0x0310A1B4)

Will look into it.



Re: Crash on Windows with core.stdc.stdlib.free()

2014-11-12 Thread ketmar via Digitalmars-d-learn
On Wed, 12 Nov 2014 16:03:08 +
Chris via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:

 On Wednesday, 12 November 2014 at 14:42:34 UTC, Chris wrote:
  On Wednesday, 12 November 2014 at 14:26:15 UTC, ketmar via
  if you can extend C DLL, just add wrapper for `free()` there. 
  so you
  will not call `free()` from D, but call C DLL function which 
  will free
  the memory. it's a good practice anyway, 'cause it's 
  recommended to
  free memory in the same library where you allocated it.
 
  I initially had an implementation that did exactly that (I 
  usually do that), but for some reason it didn't work properly 
  in this particular case and caused all sorts of undefined 
  behavior. But I'll have a look at it again.
 
 I've changed the code so that the memory is freed in C. Although 
 it works better it crashes too every now and then
 
 (WindowsError : exception : access violation writing 0x0310A1B4)
 
 Will look into it.
this also can happen due to allocators conflict somehow. or due to
other code which stores the pointer somewhere and then accesses the
memory. i think that it will be hard to trace without debugger.


signature.asc
Description: PGP signature


Re: Can't install dub on Debian

2014-11-12 Thread Suliman via Digitalmars-d-learn

root@66898:~# apt-get install multiarch-support
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package multiarch-support is not available, but is referred to by 
another packag

e.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'multiarch-support' has no installation candidate


Re: insertInPlace differences between compilers

2014-11-12 Thread John McFarlane via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 00:31:31 UTC, Jesse Phillips 
wrote:
On Tuesday, 11 November 2014 at 20:53:51 UTC, John McFarlane 
wrote:
I'm trying to write a struct template that uses 
`insertInPlace`. However, it doesn't work with certain 
template type / compiler combinations. Consider the following:


   import std.range;
   struct S { const int c; }
   S[] a;
   insertInPlace(a, 0, S());

With DMD64 D Compiler v2.066.1, I get the following error:
/usr/include/dmd/phobos/std/array.d(1013): Error: cannot 
modify struct dest[i] S with immutable members
/usr/include/dmd/phobos/std/array.d(1079): Error: template 
instance std.array.copyBackwards!(S) error instantiating
./d/my_source_file.d(12345):instantiated from here: 
insertInPlace!(S, S)


I believe DMD is correct here and here is why:

While the function is called insert the operation is actually 
an assignment. DMD initializes all arrays elements to the 
default value so your array position 0 actually contains an S 
already. This means the operation is equivalent to


auto b = S();
b = S();

Since S is a value type you're actually making a modification 
'c' as stored in 'b'. The compiler is unable to prove that 
there is no other reference to that same memory location 
(though in this case the variable is on the stack and the 
modification is local so such knowledge may be possible).


That makes sense. In the case that `c` is a class, do you think 
I'd have any luck if I made it immutable?


In the short term, could anybody suggest a `static if` 
expression to determine whether I can copy the type to the 
satisfaction of `copyBackwards`? I tried isMutable but that 
didn't seem to work.


Thanks, John


You probably want std.traits.isAssignable

pragma(msg, isAssignable!(S, S)); // False

That's exactly what I was looking for. Thank you.


Re: Basically want to make a macro script

2014-11-12 Thread Israel via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 04:56:40 UTC, Casey wrote:

also, you came to the right place. PB is extremely paranoid and
even more so about autohokey, so if you program your own native
macro, its not very likely it will catch it.


Re: Basically want to make a macro script

2014-11-12 Thread Israel via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 08:02:06 UTC, ketmar via
Digitalmars-d-learn wrote:

On Wed, 12 Nov 2014 04:56:39 +
Casey via Digitalmars-d-learn 
digitalmars-d-learn@puremagic.com wrote:


D has nothing to do with your task, WinAPI does. and you'll 
need alot
of expirience in reverse engineering, 'cause f... punkbuster 
shits it's
pants almost for anything. it's a rootkit, and very badly 
written one.
what you have to do is to fight with rootkit, making it think 
that it
is still functional. so learn assembler, x86 archtecture, 
winapi,

windows driver development, nt kernel internals and so on.

and don't even dream that it will be portable.


That isnt entirely true. Ive made macros in C# for APB:R with
punkbuster, albeit an older version and they worked just fine.

If you want to go that way you will need InputSimulator from
codeplex.

For D i cant help as i dont know any library that allows you to
take control over mouse and keyboard. In fact i think ill give
this a go at some point.


Re: Russian translation of the range term?

2014-11-12 Thread Chris Williams via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 11:38:52 UTC, thedeemon wrote:
On Tuesday, 11 November 2014 at 11:50:18 UTC, Ivan Kazmenko 
wrote:

Hi!

I'm unsure what is the Russian equivalent for the term 
range, as in D range, the generalization of a pair of 
iterators.


I think последовательность (sequence) is the most 
appropriate, because the defining characteristic of an input 
range (most common one) is ability to provide data 
sequentially. Also, afaik, some languages like F# and Clojure 
use this term (often shortened to 'seq') for the same thing 
that D calls ranges.


While sequence makes more sense for how std.range thinks of 
ranges, I think the history of the term is closer to how we use 
slices. So another (English) alternative to try might be a 
view. It's a fairly common term in SQL databases, so presumably 
there's a translation for it in Russian.


Re: Basically want to make a macro script

2014-11-12 Thread Casey via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 08:02:06 UTC, ketmar via 
Digitalmars-d-learn wrote:

On Wed, 12 Nov 2014 04:56:39 +
Casey via Digitalmars-d-learn 
digitalmars-d-learn@puremagic.com wrote:


D has nothing to do with your task, WinAPI does. and you'll 
need alot
of expirience in reverse engineering, 'cause f... punkbuster 
shits it's
pants almost for anything. it's a rootkit, and very badly 
written one.
what you have to do is to fight with rootkit, making it think 
that it
is still functional. so learn assembler, x86 archtecture, 
winapi,

windows driver development, nt kernel internals and so on.

and don't even dream that it will be portable.


I don't need to do this I'm pretty sure... I just need to write 
something that will send the chat messages as described in my 
first post.  I don't need to rootkit PunkBuster, it's not trying 
to ban programs that send chat messages  It's simply trying 
to ban macro programs like AutoHotKey.  AHK can be used to make 
no recoil scripts, so they added an option so that server owners 
can choose to kick those players /if they want to/.


Again, I'm writing a simple program to send chat messages at a 
lowish level once a hotkey/keybind has been pressed.  All it 
needs is to add a delay in between the chat key presses (Like 
*chat key* down, then 1 ms later, chat key up)(Forgot to mention 
that last night), typing my actual message as quickly as 
possible, then to send the message.


In other words, it needs to recignise my keybind, press the chat 
button down, then up with a small delay in between, send my 
message and press enter.


PB nor any other program should find this as a cheating program.  
It's not a cheat at all.  It's not a mod, hack, nor advantage 
that others can't do.  It's not unfair, it's not too good, it's 
just something simple that I'm trying to make work.  It doesn't 
need a GUI, it just needs what I've described above.  No 
rootkits, nothing like that afaik.  If it's not a hack/cheat, PB 
isn't going to look at it like it is one (hopefully).


Thank you for your interest and reply.


Re: Basically want to make a macro script

2014-11-12 Thread Casey via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 19:29:26 UTC, Israel wrote:

On Wednesday, 12 November 2014 at 04:56:40 UTC, Casey wrote:

also, you came to the right place. PB is extremely paranoid and
even more so about autohokey, so if you program your own native
macro, its not very likely it will catch it.


I didn't see your replies at first... Thanks for your interest.

If D isn't the right language, I can go with something else like 
C++ or python.  It's just got to have something that can send low 
level chat messages, or emulate actual keyboard presses so that I 
won't have issues with other games.   (/NOT/ C# simply because 
Micro$oft makes it and I try to avoid their stuff as much as 
possible).


I chose D simply because I've heard it's got a lot of potential 
and it's somewhat similar to C++, yet easyish to learn.  I'm up 
for anything, but I figured that if I went with D or C++ I'd be 
jumping right into it, so that would give me the most experience. 
 I thought this shouldn't be too hard to make, but I just can't 
find anything that does the job 'm looking for.


Re: Russian translation of the range term?

2014-11-12 Thread Jack Applegame via Digitalmars-d-learn

интервал, область



Experience report on installing dmd 2.066.1 on OSX

2014-11-12 Thread Ali Çehreli via Digitalmars-d-learn

A friend of mine installed dmd on OSX and recorded his experiences:

  http://cap-lore.com/Languages/D/Install.html

I wonder why he had to do manual work like running xattr. Is that 
expected on OSX?


Thank you,
Ali


Re: Basically want to make a macro script

2014-11-12 Thread Israel via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 19:43:49 UTC, Casey wrote:

On Wednesday, 12 November 2014 at 19:29:26 UTC, Israel wrote:

On Wednesday, 12 November 2014 at 04:56:40 UTC, Casey wrote:

also, you came to the right place. PB is extremely paranoid and
even more so about autohokey, so if you program your own native
macro, its not very likely it will catch it.


I didn't see your replies at first... Thanks for your interest.

If D isn't the right language, I can go with something else 
like C++ or python.  It's just got to have something that can 
send low level chat messages, or emulate actual keyboard 
presses so that I won't have issues with other games.   (/NOT/ 
C# simply because Micro$oft makes it and I try to avoid their 
stuff as much as possible).


I chose D simply because I've heard it's got a lot of potential 
and it's somewhat similar to C++, yet easyish to learn.  I'm up 
for anything, but I figured that if I went with D or C++ I'd be 
jumping right into it, so that would give me the most 
experience.
 I thought this shouldn't be too hard to make, but I just can't 
find anything that does the job 'm looking for.


Its not that D isnt the right language its just that it isnt
yet.
There are few libraries that allow you to take control over the
mouse and keyboard without too much hassle and reading through
documentation.

I did find this a couple days ago.
http://code.dlang.org/packages/de_window
It might be what you need but im not entirely sure if its input
simulation is across all programs.


Re: Experience report on installing dmd 2.066.1 on OSX

2014-11-12 Thread John Colvin via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 22:38:56 UTC, Ali Çehreli wrote:
A friend of mine installed dmd on OSX and recorded his 
experiences:


  http://cap-lore.com/Languages/D/Install.html

I wonder why he had to do manual work like running xattr. Is 
that expected on OSX?


Thank you,
Ali


Works for me (os x 10.10). Don't know why he'd be getting that 
problem.


Re: Basically want to make a macro script

2014-11-12 Thread Casey via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 23:35:33 UTC, Israel wrote:

On Wednesday, 12 November 2014 at 19:43:49 UTC, Casey wrote:

On Wednesday, 12 November 2014 at 19:29:26 UTC, Israel wrote:

On Wednesday, 12 November 2014 at 04:56:40 UTC, Casey wrote:

also, you came to the right place. PB is extremely paranoid 
and
even more so about autohokey, so if you program your own 
native

macro, its not very likely it will catch it.


I didn't see your replies at first... Thanks for your interest.

If D isn't the right language, I can go with something else 
like C++ or python.  It's just got to have something that can 
send low level chat messages, or emulate actual keyboard 
presses so that I won't have issues with other games.   (/NOT/ 
C# simply because Micro$oft makes it and I try to avoid their 
stuff as much as possible).


I chose D simply because I've heard it's got a lot of 
potential and it's somewhat similar to C++, yet easyish to 
learn.  I'm up for anything, but I figured that if I went with 
D or C++ I'd be jumping right into it, so that would give me 
the most experience.
I thought this shouldn't be too hard to make, but I just can't 
find anything that does the job 'm looking for.


Its not that D isnt the right language its just that it isnt
yet.
There are few libraries that allow you to take control over the
mouse and keyboard without too much hassle and reading through
documentation.

I did find this a couple days ago.
http://code.dlang.org/packages/de_window
It might be what you need but im not entirely sure if its input
simulation is across all programs.


I'll look into that, it seems as it might work.  If D would be 
too hard to get working, what would you recommend?  I would 
assume Ptyhon or C++ would be good choices, any chance you can 
recommend a forum for these or something?  It's hard to find any 
documentation on what I am looking for.


Thanks.


Re: Experience report on installing dmd 2.066.1 on OSX

2014-11-12 Thread Israel via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 23:44:43 UTC, John Colvin wrote:
On Wednesday, 12 November 2014 at 22:38:56 UTC, Ali Çehreli 
wrote:
A friend of mine installed dmd on OSX and recorded his 
experiences:


 http://cap-lore.com/Languages/D/Install.html

I wonder why he had to do manual work like running xattr. Is 
that expected on OSX?


Thank you,
Ali


Works for me (os x 10.10). Don't know why he'd be getting that 
problem.


Same here, 10.10.

Maybe his install is borked somewhere inside.


Re: Experience report on installing dmd 2.066.1 on OSX

2014-11-12 Thread Steven Schveighoffer via Digitalmars-d-learn

On 11/12/14 5:38 PM, Ali Çehreli wrote:

A friend of mine installed dmd on OSX and recorded his experiences:

   http://cap-lore.com/Languages/D/Install.html

I wonder why he had to do manual work like running xattr. Is that
expected on OSX?


Huh? I just downloaded the dmg, double clicked the pkg file, and it 
installed. I may have had to relax security to do it.


-Steve



Re: Basically want to make a macro script

2014-11-12 Thread Casey via Digitalmars-d-learn

On Thursday, 13 November 2014 at 01:35:28 UTC, Israel wrote:

On Wednesday, 12 November 2014 at 23:40:09 UTC, Casey wrote:



I'll look into that, it seems as it might work.  If D would be 
too hard to get working, what would you recommend?  I would 
assume Ptyhon or C++ would be good choices, any chance you can 
recommend a forum for these or something?  It's hard to find 
any documentation on what I am looking for.


Thanks.


I tried to test out that de_window library but it doesnt work 
out

of the box.

The guy who created it though does post in this forum so maybe 
if

he magically finds this thread he can help you and me out.


That would be nice.  I'll see if there's a way to PM him about 
it.  Do you have any other programming language recommendations 
in case this doesn't work out?


Re: Basically want to make a macro script

2014-11-12 Thread Israel via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 23:40:09 UTC, Casey wrote:



I'll look into that, it seems as it might work.  If D would be 
too hard to get working, what would you recommend?  I would 
assume Ptyhon or C++ would be good choices, any chance you can 
recommend a forum for these or something?  It's hard to find 
any documentation on what I am looking for.


Thanks.


I tried to test out that de_window library but it doesnt work out
of the box.

The guy who created it though does post in this forum so maybe if
he magically finds this thread he can help you and me out.


Re: Memory usage of dmd

2014-11-12 Thread olivier henley via Digitalmars-d-learn

All this is very interesting.

Thx for the scripts, thx for pointing systemd.

We need to document that stuff somewhere... more indexable.




Re: Can't install dub on Debian

2014-11-12 Thread olivier henley via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 16:19:23 UTC, Suliman wrote:

root@66898:~# apt-get install multiarch-support
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package multiarch-support is not available, but is referred to 
by another packag

e.
This may mean that the package is missing, has been obsoleted, 
or

is only available from another source

E: Package 'multiarch-support' has no installation candidate


If you haven't found the problem yet, please post:

1. what is the architecture of your machine? $ lscpu
2. what is the debian version? $ lsb_release -a



Re: Basically want to make a macro script

2014-11-12 Thread Rikki Cattermole via Digitalmars-d-learn

On 13/11/2014 2:37 p.m., Casey wrote:

On Thursday, 13 November 2014 at 01:35:28 UTC, Israel wrote:

On Wednesday, 12 November 2014 at 23:40:09 UTC, Casey wrote:



I'll look into that, it seems as it might work.  If D would be too
hard to get working, what would you recommend?  I would assume Ptyhon
or C++ would be good choices, any chance you can recommend a forum
for these or something?  It's hard to find any documentation on what
I am looking for.

Thanks.


I tried to test out that de_window library but it doesnt work out
of the box.

The guy who created it though does post in this forum so maybe if
he magically finds this thread he can help you and me out.


That would be nice.  I'll see if there's a way to PM him about it.  Do
you have any other programming language recommendations in case this
doesn't work out?


Sorry that functionality of de_window is out of scope of it. So of 
course, it won't work for what you want, it just creates a window and a 
context cross platform with input for that window.


The functionality you are wanting is possible against winapi and x11 
fairly easily. Its just low level. Although X11 is a little easier as it 
can be done via a program on cli.

Unfortunately c/c++ will help you as much as D will in these cases.
If you run into trouble with those api's we can help you. But you will 
need help, these are topics that aren't recommended for a newbie.


I'm not quite sure how to receive key presses from other windows. Maybe 
Mike Parker (aldracon) has some ideas.


Re: Basically want to make a macro script

2014-11-12 Thread Israel via Digitalmars-d-learn

On Thursday, 13 November 2014 at 02:00:11 UTC, Rikki Cattermole
wrote:

On 13/11/2014 2:37 p.m., Casey wrote:

On Thursday, 13 November 2014 at 01:35:28 UTC, Israel wrote:

On Wednesday, 12 November 2014 at 23:40:09 UTC, Casey wrote:



I'll look into that, it seems as it might work.  If D would 
be too
hard to get working, what would you recommend?  I would 
assume Ptyhon
or C++ would be good choices, any chance you can recommend a 
forum
for these or something?  It's hard to find any documentation 
on what

I am looking for.

Thanks.


I tried to test out that de_window library but it doesnt work 
out

of the box.

The guy who created it though does post in this forum so 
maybe if

he magically finds this thread he can help you and me out.


That would be nice.  I'll see if there's a way to PM him about 
it.  Do
you have any other programming language recommendations in 
case this

doesn't work out?


Sorry that functionality of de_window is out of scope of it. So 
of course, it won't work for what you want, it just creates a 
window and a context cross platform with input for that window.


The functionality you are wanting is possible against winapi 
and x11 fairly easily. Its just low level. Although X11 is a 
little easier as it can be done via a program on cli.
Unfortunately c/c++ will help you as much as D will in these 
cases.
If you run into trouble with those api's we can help you. But 
you will need help, these are topics that aren't recommended 
for a newbie.


I'm not quite sure how to receive key presses from other 
windows. Maybe Mike Parker (aldracon) has some ideas.


Do you have plans for making win32 bindings for the sendkeys?

Im interested in this too. Id like to do it with D but ive only
ever been able to accomplish this task with C# and InputSimulator.


Re: insertInPlace differences between compilers

2014-11-12 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 19:25:49 UTC, John McFarlane 
wrote:
That makes sense. In the case that `c` is a class, do you 
think I'd have any luck if I made it immutable?
The quick answer is that it doesn't help. DMD still doesn't 
like me using insertInPlace. This is a little disappointing as 
immutable is supposed to avoid the need for copying. Then 
again, I guess that's a compiler - not language - level 
affordance. Thanks again.


Consider this code:
void main() {
import std.range;
class C { string name; this(string n) { name = n; }}
struct S { C c; }

S a = S(new C(a));
S b = S(new C(b));

auto pC = b.c;
b = a;

assert(pC.name == a);
assert(b.c.name == a);
}

I have removed the compiler guarantee of not modifying c. What 
you'll notice here is that I've taken a pointer to a memory 
location in your struct after assigning to the struct that memory 
location has been modified to reflect the new class object.


Had the compiler allowed this with the immutable c, by not 
performing a copy, then the assert would have failed which makes 
no sense as you wanted to store 'a' in that memory location.


Re: Basically want to make a macro script

2014-11-12 Thread Rikki Cattermole via Digitalmars-d-learn

On 13/11/2014 3:45 p.m., Israel wrote:

On Thursday, 13 November 2014 at 02:00:11 UTC, Rikki Cattermole
wrote:

On 13/11/2014 2:37 p.m., Casey wrote:

On Thursday, 13 November 2014 at 01:35:28 UTC, Israel wrote:

On Wednesday, 12 November 2014 at 23:40:09 UTC, Casey wrote:



I'll look into that, it seems as it might work.  If D would be too
hard to get working, what would you recommend?  I would assume Ptyhon
or C++ would be good choices, any chance you can recommend a forum
for these or something?  It's hard to find any documentation on what
I am looking for.

Thanks.


I tried to test out that de_window library but it doesnt work out
of the box.

The guy who created it though does post in this forum so maybe if
he magically finds this thread he can help you and me out.


That would be nice.  I'll see if there's a way to PM him about it.  Do
you have any other programming language recommendations in case this
doesn't work out?


Sorry that functionality of de_window is out of scope of it. So of
course, it won't work for what you want, it just creates a window and
a context cross platform with input for that window.

The functionality you are wanting is possible against winapi and x11
fairly easily. Its just low level. Although X11 is a little easier as
it can be done via a program on cli.
Unfortunately c/c++ will help you as much as D will in these cases.
If you run into trouble with those api's we can help you. But you will
need help, these are topics that aren't recommended for a newbie.

I'm not quite sure how to receive key presses from other windows.
Maybe Mike Parker (aldracon) has some ideas.


Do you have plans for making win32 bindings for the sendkeys?

Im interested in this too. Id like to do it with D but ive only
ever been able to accomplish this task with C# and InputSimulator.


At this point in time, I have no plans for such a library. However if 
somebody wishes to implement under the devisualization org, I'm happy to 
help.


Re: Basically want to make a macro script

2014-11-12 Thread Adam D. Ruppe via Digitalmars-d-learn

On Thursday, 13 November 2014 at 02:45:34 UTC, Israel wrote:

Do you have plans for making win32 bindings for the sendkeys?


I'm pretty sure it just calls this function:
http://msdn.microsoft.com/en-us/library/ms646310%28v=vs.85%29.aspx

with appropriate input prepared.


As to listen to keyboard input, I'm again pretty sure you just 
need to call this function:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms646309%28v=vs.85%29.aspx

It needs a window and event loop to receive the message, but 
that's not rocket science either, my simpledisplay.d can do it or 
it isn't really hard to just do with the low level calls.



I'm not sure about how to do it on X11 off the top of my head, 
but there's functions to add event messages and listen to input 
from multiple windows, or you could open the /dev/input for the 
keyboard too if root. I've looked into this before and found a 
few options, but don't remember the details right now.



I don't want to give a sample program without testing it, and I'm 
on my Linux box right now, but if you don't have something by 
tomorrow I'll play for a while when i'm on my laptop.


Re: passing duck-typed objects and retaining full type information

2014-11-12 Thread Jesse Phillips via Digitalmars-d-learn

On Tuesday, 11 November 2014 at 19:23:39 UTC, Adam Taylor wrote:
Now what i want to do is pass some such container object to 
an interface function:


interface MyInterface
{
void filterCollisions(S)(S collisionCandidates)
if(canRemoveFromContainer!S)
}


You can't. This is one of the major restrictions of the template 
approach. Generics in C# allow for this, which I believe is 
reliant its JIT compiler.



Once you introduce the need for a vTable (which interfaces do) it 
is no longer possible to require implementation of a phantom 
function. Templates don't exist until their use, so it is not 
possible to require an entry in the vTable when the number of 
possible combinations is infinite.


Get full class name at compile time - Not yet implemented

2014-11-12 Thread Andre via Digitalmars-d-learn

Hi,

I currently have some issues to get the full class name at 
compile time by the variable which might point to null.
With .stringof I get the class name without the module. It seems 
typeid(typeof())

is the solution, but DMD throws the error:

source\app.d(10): Error: typeid(app.A).name is not yet 
implemented at compile t

ime

Do I have any other possibilities?

Kind regards
André

module app;

class A {};

void main()
{
A a;

pragma(msg, typeof(a).stringof); // A
pragma(msg, typeid(typeof(a)).name); // Should print app.A
}


Re: Get full class name at compile time - Not yet implemented

2014-11-12 Thread Rikki Cattermole via Digitalmars-d-learn

On 13/11/2014 6:22 p.m., Andre wrote:

Hi,

I currently have some issues to get the full class name at compile time
by the variable which might point to null.
With .stringof I get the class name without the module. It seems
typeid(typeof())
is the solution, but DMD throws the error:

source\app.d(10): Error: typeid(app.A).name is not yet implemented at
compile t
ime

Do I have any other possibilities?

Kind regards
André

module app;

class A {};

void main()
{
 A a;

 pragma(msg, typeof(a).stringof); // A
 pragma(msg, typeid(typeof(a)).name); // Should print app.A
}


http://dlang.org/phobos/std_traits.html#fullyQualifiedName


Re: Experience report on installing dmd 2.066.1 on OSX

2014-11-12 Thread Joakim via Digitalmars-d-learn

On Wednesday, 12 November 2014 at 22:38:56 UTC, Ali Çehreli wrote:
A friend of mine installed dmd on OSX and recorded his 
experiences:


  http://cap-lore.com/Languages/D/Install.html

I wonder why he had to do manual work like running xattr. Is 
that expected on OSX?


Looks like they're now requiring that apps be signed with the 
developer's account, which I'm guessing the dmd dmg isn't:


http://stackoverflow.com/questions/24176378/why-my-dmg-is-not-getting-opened-without-asking-security-popup


Re: Get full class name at compile time - Not yet implemented

2014-11-12 Thread Andre via Digitalmars-d-learn

perfekt, thanks a lot.

Kind regards
André

On Thursday, 13 November 2014 at 05:37:26 UTC, Rikki Cattermole 
wrote:

On 13/11/2014 6:22 p.m., Andre wrote:

http://dlang.org/phobos/std_traits.html#fullyQualifiedName




Re: Basically want to make a macro script

2014-11-12 Thread Casey via Digitalmars-d-learn

On Thursday, 13 November 2014 at 02:58:02 UTC, Rikki Cattermole
wrote:

On 13/11/2014 3:45 p.m., Israel wrote:

On Thursday, 13 November 2014 at 02:00:11 UTC, Rikki Cattermole
wrote:

On 13/11/2014 2:37 p.m., Casey wrote:

On Thursday, 13 November 2014 at 01:35:28 UTC, Israel wrote:

On Wednesday, 12 November 2014 at 23:40:09 UTC, Casey wrote:



I'll look into that, it seems as it might work.  If D 
would be too
hard to get working, what would you recommend?  I would 
assume Ptyhon
or C++ would be good choices, any chance you can recommend 
a forum
for these or something?  It's hard to find any 
documentation on what

I am looking for.

Thanks.


I tried to test out that de_window library but it doesnt 
work out

of the box.

The guy who created it though does post in this forum so 
maybe if

he magically finds this thread he can help you and me out.


That would be nice.  I'll see if there's a way to PM him 
about it.  Do
you have any other programming language recommendations in 
case this

doesn't work out?


Sorry that functionality of de_window is out of scope of it. 
So of
course, it won't work for what you want, it just creates a 
window and

a context cross platform with input for that window.

The functionality you are wanting is possible against winapi 
and x11
fairly easily. Its just low level. Although X11 is a little 
easier as

it can be done via a program on cli.
Unfortunately c/c++ will help you as much as D will in these 
cases.
If you run into trouble with those api's we can help you. But 
you will
need help, these are topics that aren't recommended for a 
newbie.


I'm not quite sure how to receive key presses from other 
windows.

Maybe Mike Parker (aldracon) has some ideas.


Do you have plans for making win32 bindings for the sendkeys?

Im interested in this too. Id like to do it with D but ive only
ever been able to accomplish this task with C# and 
InputSimulator.


At this point in time, I have no plans for such a library. 
However if somebody wishes to implement under the 
devisualization org, I'm happy to help.




It's great to have you two joining in on this thread!  I'm
excited to see how helpful you have all been, it's really
encouraging me to learn more about this.  Two of you guys have
noted that D and C++ might not be the right languages for my
purposes.  If they won't work for it, could you make some other
suggestions?  I'd really prefer to make it work in D, but if it's
not worth the trouble I'm more than happy to switch to something
simpler.  Thanks for your dedication all!


Re: Can't install dub on Debian

2014-11-12 Thread Suliman via Digitalmars-d-learn

If you haven't found the problem yet, please post:

1. what is the architecture of your machine? $ lscpu
2. what is the debian version? $ lsb_release -a


root@66898:~# lscpu
Architecture:  x86_64
CPU op-mode(s):32-bit, 64-bit
CPU(s):4
Vendor ID: GenuineIntel
CPU family:6
Model: 45
Stepping:  7
CPU MHz:   623.437
Virtualization:VT-x
root@66898:~#
root@66898:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:Debian GNU/Linux 6.0.9 (squeeze)
Release:6.0.9
Codename:   squeeze
root@66898:~#


Debian image from vps.me


Re: Basically want to make a macro script

2014-11-12 Thread Rikki Cattermole via Digitalmars-d-learn

On 13/11/2014 7:18 p.m., Casey wrote:

On Thursday, 13 November 2014 at 02:58:02 UTC, Rikki Cattermole
wrote:

On 13/11/2014 3:45 p.m., Israel wrote:

On Thursday, 13 November 2014 at 02:00:11 UTC, Rikki Cattermole
wrote:

On 13/11/2014 2:37 p.m., Casey wrote:

On Thursday, 13 November 2014 at 01:35:28 UTC, Israel wrote:

On Wednesday, 12 November 2014 at 23:40:09 UTC, Casey wrote:



I'll look into that, it seems as it might work.  If D would be too
hard to get working, what would you recommend?  I would assume
Ptyhon
or C++ would be good choices, any chance you can recommend a forum
for these or something?  It's hard to find any documentation on what
I am looking for.

Thanks.


I tried to test out that de_window library but it doesnt work out
of the box.

The guy who created it though does post in this forum so maybe if
he magically finds this thread he can help you and me out.


That would be nice.  I'll see if there's a way to PM him about it.  Do
you have any other programming language recommendations in case this
doesn't work out?


Sorry that functionality of de_window is out of scope of it. So of
course, it won't work for what you want, it just creates a window and
a context cross platform with input for that window.

The functionality you are wanting is possible against winapi and x11
fairly easily. Its just low level. Although X11 is a little easier as
it can be done via a program on cli.
Unfortunately c/c++ will help you as much as D will in these cases.
If you run into trouble with those api's we can help you. But you will
need help, these are topics that aren't recommended for a newbie.

I'm not quite sure how to receive key presses from other windows.
Maybe Mike Parker (aldracon) has some ideas.


Do you have plans for making win32 bindings for the sendkeys?

Im interested in this too. Id like to do it with D but ive only
ever been able to accomplish this task with C# and InputSimulator.


At this point in time, I have no plans for such a library. However if
somebody wishes to implement under the devisualization org, I'm happy
to help.




It's great to have you two joining in on this thread!  I'm
excited to see how helpful you have all been, it's really
encouraging me to learn more about this.  Two of you guys have
noted that D and C++ might not be the right languages for my
purposes.  If they won't work for it, could you make some other
suggestions?  I'd really prefer to make it work in D, but if it's
not worth the trouble I'm more than happy to switch to something
simpler.  Thanks for your dedication all!


D shouldn't be the limiting factor here. Neither would c/c++.
At the end of the day you need to interface with the low level apis such 
as WinAPI. It might be directly with your own event loops ext. Or it 
could be indirectly via a wrapper library.


I did find this [0]. I don't know what state its in for 
compilating/running ext. But it might give you a good starting point.


[0] https://github.com/pythoneer/XInputSimulator