Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread rcorre via Digitalmars-d-announce
On Tuesday, 29 September 2015 at 16:22:43 UTC, Adam D. Ruppe 
wrote:


characterencodings is only needed if you call one of the 
character conversion functions; it is a lazy local import 
inside a template.


Neat! I knew local imports were useful for keeping symbols in a 
smaller scope, but didn't think about it as a way to control 
dependencies.




Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread ponce via Digitalmars-d-announce
On Tuesday, 29 September 2015 at 16:22:43 UTC, Adam D. Ruppe 
wrote:
But, how do you express the half-dependency of 
characterencodings in a dub.json dependencies list?


optional dependencies + version tags produced by DUB in the form 
of


version (Have_packagename)
{

}


(never tried)


Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread ponce via Digitalmars-d-announce
On Tuesday, 29 September 2015 at 16:22:43 UTC, Adam D. Ruppe 
wrote:
I copy/pasted your arsd/dom.d code in a couple of projects. 
But none of them will receive updates unless I do 'm manually.


That means you don't have to put up with me randomly breaking 
your code! You don't have to wait for me to publish a bug fix. 
You aren't locked in to the way I did things and are free to 
customize it as you wish.


But this encourage to create tiny little forks everywhere. So 
everyone is getting less bugfixes: if I have my local copy, 
nothing encourages me to contribute the fix.


This is the strength of versionned dependencies:

- one master tree

- get bugfixes automatically before you are aware they even exist

- do not close the door to breaking changes in the form of a 
major version bump.


- open/closed principle for packages: if you use 
devisualization:window, the X11 package is pulled and linked 
without anymore work. This sub-dependency doesn't leak into your 
project, it's only a property of the primary dependency you used.


So I'd DUB strive to make dependencies composable, where they 
were previously a leaky abstraction. It's like calling a function 
and not having to know what it does inside.


Of course this implies there is no bad-fixes or SemVer misuse :) 
But I've found this to work reasonably well in practice.





Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread karabuta via Digitalmars-d-announce
On Tuesday, 29 September 2015 at 16:22:43 UTC, Adam D. Ruppe 
wrote:
On Tuesday, 29 September 2015 at 14:57:13 UTC, Sebastiaan Koppe 
wrote:

[...]


dub forces me to do it that way. It isn't my preference, but 
reorganizing all my files and creating twenty or thirty 
different github repos to house them is unacceptable.


[...]


That is why npm sucks, but very helpful.


Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread karabuta via Digitalmars-d-announce
On Tuesday, 29 September 2015 at 13:10:55 UTC, Adam D. Ruppe 
wrote:
On Tuesday, 29 September 2015 at 12:43:19 UTC, Daniel Kozak 
wrote:

It would be nice to have all of yours stuff on code.dlang.org.


I'm slowly working on it. Got some working just yesterday:
http://code.dlang.org/packages/arsd-official

but the repo doesn't let you show subpackages, argh. dub sucks, 
code.dlang.org sucks.



+1

When am I going to see your dub?


Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread karabuta via Digitalmars-d-announce
On Tuesday, 29 September 2015 at 12:26:58 UTC, Robert M. Münch 
wrote:

On 2015-09-29 03:53:44 +, Sebastiaan Koppe said:





Not that I'm to deep into the code nor D but would it be 
possible to write it somehow like this:


Mail email = new Mail;

email.headers = [
"Date" Clock...,
"Sender" ...
]

This would be a much more descriptive approach, which I think 
makes a lot of sense for such things. And it follows the "dont 
repeat yourself" pattern.



Nice observation




Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread Adam D. Ruppe via Digitalmars-d-announce
On Tuesday, 29 September 2015 at 14:57:13 UTC, Sebastiaan Koppe 
wrote:

Good. But why put everything in one package?


dub forces me to do it that way. It isn't my preference, but 
reorganizing all my files and creating twenty or thirty different 
github repos to house them is unacceptable.


The unit of encapsulation in D is the module. If a module does 
two wildly different and independent things, you would break it 
up. Similarly, and I think this is often neglected, if two 
modules are intertwined and one cannot work without the other, 
they are really one unit and should be merged.


The merged module will present a cleaner interface and be easier 
to maintain since it can handle its own private implementation 
without worry of exposing internals for its friend module nor 
having something change independently of it.


(I wish D would fix that bug where public and private symbols can 
conflict though. So annoying and breaks this beautiful 
encapsulation. You might notice simpledisplay.d has a function 
named toInternal for example. I'd like to name it to, but then it 
would break code that uses std.conv.to, despite that internal 
function being private! Ugh!)


That forms the basis of my general policy: make modules that 
stand alone and do a task as completely as necessary. I only 
split them up when there's a technical requirement and the split 
lowers overall complexity.


And, of course, when possible, I like to make those dependencies 
optional; they aren't required unless you actually use those 
specific features.




Modules in D do a pretty good job at this. They can contain most 
their own metadata, too: write ddoc inline, you can grep it for 
version options (and since D doesn't allow versions to cross 
module boundaries, it is as simple as a grep) and import 
dependencies, and you can even have some control over the linker 
with stuff like pragma(lib), showing system dependencies.



Modules also have a one-to-one correspondence to files, making 
them a natural thing to download, move around, etc. Other 
programs know how to handle files so you can version them and 
such too.



D's modules work! Why does dub reject this model?

A guy on npmjs.com goes the other extreme and he actually has a 
package 
(https://github.com/sindresorhus/negative-zero/blob/master/index.js) that consists of 1 line of code.


Disgusting. Think of all the overhead involved in that package, 
not just for the author, but now for everybody who use it... and 
everyone who uses something that uses it, and so on and so forth 
- right down to the end user!


There needs to be a balance struck between "don't repeat 
yourself" and avoiding dependencies.


It is generally considered a bad idea to do the whole system 
together at once. (though Docker and VMWare appliances and such 
do actually try to do that and have found some success in the 
market) Making changes to that means a lot of extra work that is 
easy to do wrong. (The duplication itself btw isn't a big problem 
to me, computers are good at doing the same thing over and over 
again; it is an easily automated problem, at least until 
something goes wrong.)


In code, we factor common functionality into functions that can 
be used from multiple places instead of copy/pasting the bodies 
everywhere.


It is similarly a bad idea to have a deep web of external 
dependencies. This also makes maintenance harder - where is the 
problem? Where do you make the change? How long will it take to 
get upstreamed? Do you understand what is going on anymore; will 
changing that dependency break some unrelated project somewhere 
else?


In code, we try to write our functions such that they do not use 
global variables. We like pure functions whenever we can. We like 
to use const or immutable to limit the scope of confusing 
changes. We like to use private to limit the function's interface.



Negative zero should be a constant (and probably a private one at 
that, that'd be a bizarre implementation detail to expose to an 
API user). Here, it is instead a public global mutable function 
pointer.



In the description you say "or better yet, ditch dub and do 
things the simple, reliable way of dmd *.d" How is that more 
reliable?


It works the same way every time you do it and exposes all the 
options dmd has without needing wrapper json options which may or 
may not actually be there, or documented, or keep working the 
same way next time you try.


I copy/pasted your arsd/dom.d code in a couple of projects. But 
none of them will receive updates unless I do 'm manually.


That means you don't have to put up with me randomly breaking 
your code! You don't have to wait for me to publish a bug fix. 
You aren't locked in to the way I did things and are free to 
customize it as you wish.


It is very easy to update it too, even if you do customize it 
(git will handle the conflicts, if any) - you can always do a git 
pull from me, then test and push back up to your copy (or, not 
e

Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread Sebastiaan Koppe via Digitalmars-d-announce
On Tuesday, 29 September 2015 at 13:10:55 UTC, Adam D. Ruppe 
wrote:

I'm slowly working on it. Got some working just yesterday:
http://code.dlang.org/packages/arsd-official


Good. But why put everything in one package?

A guy on npmjs.com goes the other extreme and he actually has a 
package 
(https://github.com/sindresorhus/negative-zero/blob/master/index.js) that consists of 1 line of code.


In the description you say "or better yet, ditch dub and do 
things the simple, reliable way of dmd *.d" How is that more 
reliable?


I copy/pasted your arsd/dom.d code in a couple of projects. But 
none of them will receive updates unless I do 'm manually. I 
don't see how that is more reliable.


but the repo doesn't let you show subpackages, argh. dub sucks, 
code.dlang.org sucks.


I don't understand your negative stance against dub and 
code.dlang.org. I agree that both require some fine-tuning. Some 
areas more than others. However, the idea of having a 
package-manager is a good idea. If only to serve as documentation 
on the libs you package depends on.


Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread Sebastiaan Koppe via Digitalmars-d-announce

On Tuesday, 29 September 2015 at 13:37:18 UTC, Suliman wrote:
I am asking because I had troubles with vibed 
http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/25447/


It's still vibe.d doing the smtp stuff. You might want to look 
into adam's code, or http://code.dlang.org/packages/smtp


Re: This Week in D #37 - forum tutorials and tip on using UDAs

2015-09-29 Thread Jacob Carlborg via Digitalmars-d-announce

On 2015-09-29 14:10, Adam D. Ruppe wrote:


Though, I just had an idea on how that might be simplified don't
recreate them, just alias them!



So, conceptually, you'd do something like:


template transformer(alias member) {
 static if(hasUDA!(member, thing))
 mixin(transformed_version_of_member());
 else
 alias member = member;
}
mixin staticMap!(AllMembers!impl_module, transformer);


This looks even more interesting :)

--
/Jacob Carlborg


Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread Suliman via Digitalmars-d-announce
On Tuesday, 29 September 2015 at 08:17:42 UTC, Sebastiaan Koppe 
wrote:

On Tuesday, 29 September 2015 at 06:18:32 UTC, Suliman wrote:

Does it's work with anything except localhost?
Could you add example of sending email with gmail?


It is in the settings variable. Look at 
vibe.mail.SMTPClientSettings. 
http://vibed.org/api/vibe.mail.smtp/SMTPClientSettings


In my tests I used rackspace's mail servers.

```
auto settings = new 
SMTPClientSettings("secure.emailsrvr.com",587);

settings.authType = SMTPAuthType.login;
settings.connectionType = SMTPConnectionType.startTLS;
settings.tlsValidationMode = TLSPeerValidationMode.requireCert;
settings.username = "i...@example.com";
settings.password = "123456789";
```

Replace with whatever gmail has.

The only problem I had was with `settings.tlsValidationMode`. 
It failed with the certificates so I had to set it to 
`requireCert`. But I wouldn't do that.


I am asking because I had troubles with vibed 
http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/25447/


Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread Sebastiaan Koppe via Digitalmars-d-announce

On Tuesday, 29 September 2015 at 12:43:19 UTC, Daniel Kozak wrote:

Adam D.Ruppe píše v Út 29. 09. 2015 v 12:05 +:
If you ever need something in D, ask me first there's a 
good chance I've written it!


https://github.com/adamdruppe/arsd/blob/master/email.d

there's also a good chance I haven't documented it too 
though...




Thanks, I will look at it.

I only look at code.dlang.org. It would be nice to have all of 
yours stuff on code.dlang.org.


While I use some of adam's code, it is often the last place I 
look - if I remember at all. In this case I didn't, and decided 
to write something myself.


Which is sad, since had I remembered to look in adam's repo, I 
probably wouldn't have written this library; and saved myself a 
day or two.


You really need to get your stuff out in the open adam.


Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread Adam D. Ruppe via Digitalmars-d-announce

On Tuesday, 29 September 2015 at 12:43:19 UTC, Daniel Kozak wrote:

It would be nice to have all of yours stuff on code.dlang.org.


I'm slowly working on it. Got some working just yesterday:
http://code.dlang.org/packages/arsd-official

but the repo doesn't let you show subpackages, argh. dub sucks, 
code.dlang.org sucks.


Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread Sebastiaan Koppe via Digitalmars-d-announce
On Tuesday, 29 September 2015 at 12:26:58 UTC, Robert M. Münch 
wrote:
Not that I'm to deep into the code nor D but would it be 
possible to write it somehow like this:


Mail email = new Mail;

email.headers = [
"Date" Clock...,
"Sender" ...
]

This would be a much more descriptive approach, which I think 
makes a lot of sense for such things. And it follows the "dont 
repeat yourself" pattern.


The Mail class is from vibe.d

I suppose the headers members could accept `string[string]` 
assignment.




Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread Daniel Kozak via Digitalmars-d-announce
Adam D.Ruppe píše v Út 29. 09. 2015 v 12:05 +:
> On Tuesday, 29 September 2015 at 08:54:39 UTC, Daniel Kozak wrote:
> > Wow, I need something like this 3 weeks ago, but I dont have 
> > time to implement this myself, so I end up with phpMailer. Now 
> > I can switch my little e-mailing system to Dlang. Thank you.
> 
> If you ever need something in D, ask me first there's a good 
> chance I've written it!
> 
> https://github.com/adamdruppe/arsd/blob/master/email.d
> 
> there's also a good chance I haven't documented it too 
> though...
> 
> but the way mine works is something like:
> 
> ---
> import arsd.email;
> void main() {
>  auto message = new EmailMessage();
>  message.to ~= "destructiona...@gmail.com";
>  message.from = "t...@arsdnet.net";
>  message.subject = "test";
>  message.setHtmlBody(" />test");
>  message.addAttachment("text/csv", "cool.csv", 
> "whoa,mang");
>  message.addAttachment("text/wtf", "whoa.wtf", "WTF\nMAN");
>  message.addInlineImage("amazing", "image/png", 
> "black.png",
> import("black.png"));
>  message.send();
> }
> ---
> 
> 
> The send method uses std.net.curl to do the actual sending (the 
> smtp connection information is a default argument to the method.
> 
> 
> My lib also has a function:
> 
> void email(string to, string subject, string message, string 
> from, RelayInfo mailServer = RelayInfo("smtp://localhost")) {}
> 
> 
> for sending a plain text email quickly and easily, similar to 
> PHP's mail function.

Thanks, I will look at it.

I only look at code.dlang.org. It would be nice to have all of yours
stuff on code.dlang.org.






Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread Robert M. Münch via Digitalmars-d-announce

On 2015-09-29 03:53:44 +, Sebastiaan Koppe said:


This library[1] allows you to send multi-part emails with attachments.

```
Mail email = new Mail;
email.headers["Date"] = Clock.currTime().toRFC822DateTimeString();
email.headers["Sender"] = "Domain.com Contact Form ";
email.headers["From"] = "\"Example\" ";
email.headers["To"] = "\"Bas\" ";
email.headers["Subject"] = "My subject";
import std.stdio : File;
email.setContent(
 mailMixed(
 mailRelated(
 mailAlternative(
 
mailHtml("asdfasdfasdf"),

 mailText("asdfasdfasdf")
 )
 ),
 mailAttachment(File("test.png","rb"),"image/png","image.png"),
 mailAttachment(cast(immutable(ubyte[]))"You are an 
idiot!","plain/text","text.txt")

 )
);
sendMail(settings, email);


Not that I'm to deep into the code nor D but would it be possible to 
write it somehow like this:


Mail email = new Mail;

email.headers = [
"Date" Clock...,
"Sender" ...
]

This would be a much more descriptive approach, which I think makes a 
lot of sense for such things. And it follows the "dont repeat yourself" 
pattern.


--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



Re: This Week in D #37 - forum tutorials and tip on using UDAs

2015-09-29 Thread Adam D. Ruppe via Digitalmars-d-announce
On Tuesday, 29 September 2015 at 07:09:35 UTC, Jacob Carlborg 
wrote:
This looks pretty cool. Unfortunately the original code needs 
to be contained inside a template :( .


Yeah. You could put it in a module too (my original plan was to 
write about "module mything_impl; code here" and "module mything; 
mixin magic_from_mything_impl;" but there's a bit more difficulty 
with that and forwarding all members you don't want to transform.


Though, I just had an idea on how that might be simplified 
don't recreate them, just alias them!




So, conceptually, you'd do something like:


template transformer(alias member) {
static if(hasUDA!(member, thing))
mixin(transformed_version_of_member());
else
alias member = member;
}
mixin staticMap!(AllMembers!impl_module, transformer);



So you bring in the original thing via alias in much the same way 
I brought it in via template mixin, then do the rest basically 
the same.



That *should* work and not even be all that much more code. Then 
you don't need to wrap anymore. Though it does still need to be 
in a separate something, whether input module or struct, from the 
output.


Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread Adam D. Ruppe via Digitalmars-d-announce

On Tuesday, 29 September 2015 at 08:54:39 UTC, Daniel Kozak wrote:
Wow, I need something like this 3 weeks ago, but I dont have 
time to implement this myself, so I end up with phpMailer. Now 
I can switch my little e-mailing system to Dlang. Thank you.


If you ever need something in D, ask me first there's a good 
chance I've written it!


https://github.com/adamdruppe/arsd/blob/master/email.d

there's also a good chance I haven't documented it too 
though...


but the way mine works is something like:

---
import arsd.email;
void main() {
auto message = new EmailMessage();
message.to ~= "destructiona...@gmail.com";
message.from = "t...@arsdnet.net";
message.subject = "test";
message.setHtmlBody("/>test");
message.addAttachment("text/csv", "cool.csv", 
"whoa,mang");

message.addAttachment("text/wtf", "whoa.wtf", "WTF\nMAN");
message.addInlineImage("amazing", "image/png", 
"black.png",

import("black.png"));
message.send();
}
---


The send method uses std.net.curl to do the actual sending (the 
smtp connection information is a default argument to the method.



My lib also has a function:

void email(string to, string subject, string message, string 
from, RelayInfo mailServer = RelayInfo("smtp://localhost")) {}



for sending a plain text email quickly and easily, similar to 
PHP's mail function.


Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread Adam D. Ruppe via Digitalmars-d-announce
On Tuesday, 29 September 2015 at 09:05:09 UTC, Sebastiaan Koppe 
wrote:

That why we want stuff besides text in our emails.


Attachments do pictures better than html bodies though.


Re: New blog about D

2015-09-29 Thread Chris via Digitalmars-d-announce

On Tuesday, 29 September 2015 at 04:19:58 UTC, Mike Parker wrote:

On Monday, 28 September 2015 at 14:26:35 UTC, Chris wrote:




I really don't like blog posts that have overly broad titles 
when the subject matter is technical. I think the title should 
be as specific as possible so that I know if it's something I 
care about. If I see a general title about game development 
that refers to something that only touches a specific aspect of 
it, one that I'm not interested in, I'll just feel like I've 
wasted my time. Moreover, when I am doing a search for 
something specific, the blog title is often all I pay attention 
to as I can the search results. A more specific title helps out 
a lot.


It depends on what the blogger in question wants. If s/he wants 
to draw attention to D in general and give examples of how D is 
useful to solve certain problems (e.g. with templates, mixins 
etc), then the title should be more general. The next article 
might be about processing big data in D - then it should have 
"big data" in the title/tag/keywords and not just something that 
refers to one specific aspect of big data handling. The point is 
that if people see D being associated with various aspects of 
programming (games, big data), it gets them interested in D in 
general.


If, however, the blogger only wants to talk about D to people who 
already use D, then s/he might as well be more specific.


Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread Sebastiaan Koppe via Digitalmars-d-announce
On Tuesday, 29 September 2015 at 07:24:48 UTC, Russel Winder 
wrote:
This code looks so similar to the equivalent in Python, it is 
great. Does it need Vibe underneath it though to work, or is 
this a package that can sit separately and just use sockets to 
connect to the SMTP server as with Python?


It only depends on vibe's Mail class.

The only function that interacts with the Mail class is this one:

```
void setContent(MailPart)(Mail email, MailPart part)
if (isMailPart!MailPart)
{
foreach(key, value; part.headers)
email.headers[key] = value;

import std.conv : text;
email.bodyText = part.content.text;
}
```

Which is rather trivial to port.

Having said that, I have no need to build my own SMTP client. 
Vibe does a good job. And there is also a more stand-alone 
project on code.dlang.org which I forgot the name of.



Though I would rather there was no HTML in any email!


From 
http://www.networkworld.com/article/2199390/uc-voip/the-mime-guys--how-two-internet-gurus-changed-e-mail-forever.html?page=3


```
While Freed was concerned about the problems occurring when 
content moved from one e-mail system to another, "I wanted to be 
able to send pictures and videos and stuff like that in e-mail," 
Borenstein says. "And by the way, when people would ask me, 'Why 
do you care so much about putting media into e-mail?' I always 
said because someday I'm going to have grandchildren and I want 
to get pictures of them by e-mail. And people's reaction was to 
laugh and laugh."


Borenstein started receiving pictures of his twin grandchildren 
via e-mail in 2009

```

That why we want stuff besides text in our emails.


Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread Daniel Kozak via Digitalmars-d-announce
Sebastiaan Koppe píše v Út 29. 09. 2015 v 03:53 +:
> This library[1] allows you to send multi-part emails with 
> attachments.
> 
> ```
> Mail email = new Mail;
> email.headers["Date"] = Clock.currTime().toRFC822DateTimeString();
> email.headers["Sender"] = "Domain.com Contact Form ";
> email.headers["From"] = "\"Example\" ";
> email.headers["To"] = "\"Bas\" ";
> email.headers["Subject"] = "My subject";
> import std.stdio : File;
> email.setContent(
>  mailMixed(
>  mailRelated(
>  mailAlternative(
>  
> mailHtml("asdfasdfasdf"),
>  mailText("asdfasdfasdf")
>  )
>  ),
>  
> mailAttachment(File("test.png","rb"),"image/png","image.png"),
>  mailAttachment(cast(immutable(ubyte[]))"You are an 
> idiot!","plain/text","text.txt")
>  )
> );
> sendMail(settings, email);
> ```
> 
> [1] http://code.dlang.org/packages/vibemail

Wow, I need something like this 3 weeks ago, but I dont have time to
implement this myself, so I end up with phpMailer. Now I can switch my
little e-mailing system to Dlang. Thank you.


Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread Sebastiaan Koppe via Digitalmars-d-announce

On Tuesday, 29 September 2015 at 06:18:32 UTC, Suliman wrote:

Does it's work with anything except localhost?
Could you add example of sending email with gmail?


It is in the settings variable. Look at 
vibe.mail.SMTPClientSettings. 
http://vibed.org/api/vibe.mail.smtp/SMTPClientSettings


In my tests I used rackspace's mail servers.

```
auto settings = new 
SMTPClientSettings("secure.emailsrvr.com",587);

settings.authType = SMTPAuthType.login;
settings.connectionType = SMTPConnectionType.startTLS;
settings.tlsValidationMode = TLSPeerValidationMode.requireCert;
settings.username = "i...@example.com";
settings.password = "123456789";
```

Replace with whatever gmail has.

The only problem I had was with `settings.tlsValidationMode`. It 
failed with the certificates so I had to set it to `requireCert`. 
But I wouldn't do that.


Re: Go 1.5

2015-09-29 Thread Ola Fosheim Grøstad via Digitalmars-d-announce

On Sunday, 27 September 2015 at 16:54:52 UTC, Martin Nowak wrote:

On 09/24/2015 03:49 AM, Ola Fosheim Grøstad wrote:
I haven't read the paper, but how does this solve collecting 
things like strings, or other "leaf types" when you use 
separate compilation units?


We'd use runtime typeinfo.


But doesn't that imply a full scan when you are scanning for 
common types that live on leaf nodes in the graph?


The easy thing to do is to use GC locally (like for a fiber) 
and use
move semantics for moving objects from one locality to the 
other

(between fibers).


Though it's challenging to efficiently manage all the GC 
structures for a small scope. Doing this per thread is a proven 
technology (see 
https://trello.com/c/K7HrSnwo/28-thread-cache-for-gc).


That's a good start, but hardware threads range from 1-32 threads 
on current CPUs, so it is likely to affect modelling more than 
doing it on an actor/fiber level. If you could group N actors on 
a single GC heap you could run a simulation across many threads 
and then collect inbetween.


Btw, C++ appears to get the semi-stackless co-routines (no state 
on stack when yielding), which also appears to be the model used 
in Pony-lang. D really should consider a move in that direction 
combined with it's GC strategy.




Re: Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

2015-09-29 Thread Russel Winder via Digitalmars-d-announce
On Tue, 2015-09-29 at 03:53 +, Sebastiaan Koppe via Digitalmars-d
-announce wrote:
> This library[1] allows you to send multi-part emails with 
> attachments.

This code looks so similar to the equivalent in Python, it is great.
Does it need Vibe underneath it though to work, or is this a package
that can sit separately and just use sockets to connect to the SMTP
server as with Python?

Though I would rather there was no HTML in any email!

> ```
> Mail email = new Mail;
> email.headers["Date"] = Clock.currTime().toRFC822DateTimeString();
> email.headers["Sender"] = "Domain.com Contact Form ";
> email.headers["From"] = "\"Example\" ";
> email.headers["To"] = "\"Bas\" ";
> email.headers["Subject"] = "My subject";
> import std.stdio : File;
> email.setContent(
>  mailMixed(
>  mailRelated(
>  mailAlternative(
>  
> mailHtml("asdfasdfasdf"),
>  mailText("asdfasdfasdf")
>  )
>  ),
>  
> mailAttachment(File("test.png","rb"),"image/png","image.png"),
>  mailAttachment(cast(immutable(ubyte[]))"You are an 
> idiot!","plain/text","text.txt")
>  )
> );
> sendMail(settings, email);
> ```
> 
> [1] http://code.dlang.org/packages/vibemail
-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder



signature.asc
Description: This is a digitally signed message part


Re: This Week in D #37 - forum tutorials and tip on using UDAs

2015-09-29 Thread Jacob Carlborg via Digitalmars-d-announce

On 2015-09-28 15:03, Adam D. Ruppe wrote:


The tip here is one I've been talking about on irc a little and decided
to write up this time. Using a mixin template to hold the source code of
a thing to be transformed is something I think is kinda cool though
I haven't actually used it in a real project yet. (Actually, I've barely
used UDAs in the real world at all yet. I was so excited for them when
they were new, but it took so long to materialize that I found other
ways to do my stuff and now haven't transitioned!)


This looks pretty cool. Unfortunately the original code needs to be 
contained inside a template :( .


--
/Jacob Carlborg