Re: Creating a file in ~/.config (ubuntu)
Use std.path.expandTilde() - http://dlang.org/phobos/std_path.html#expandTilde On 13.4.2012 18:02, Minas wrote: I am trying to create a file in ~/.config My code is: [code] import std.stdio; void main() { auto f = File(~/.config/minas.txt, w); } [/code] However, an exception is thrown. std.exception.ErrnoException@std/stdio.d(288): Cannot open file `~/.config/minas.txt' in mode `w' (No such file or directory) ./test(std.stdio.File std.stdio.File.__ctor(immutable(char)[], const(char[]))+0x5c) [0x41a5ac] ./test(_Dmain+0x32) [0x41892a] ./test(extern (C) int rt.dmain2.main(int, char**).void runMain()+0x17) [0x419597] ./test(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x2a) [0x418f0e] ./test(extern (C) int rt.dmain2.main(int, char**).void runAll()+0x42) [0x4195ea] ./test(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x2a) [0x418f0e] ./test(main+0xd3) [0x418e9f] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7ff3dcb4830d] When trying to create it in the current directory(~/Deskto) it works fine. I guess it has something to do with access rights. Is there something I can do to run it with higher access priviliges? (I know that this might not have to do with D but I thought this would be a good place to ask) Thanks in advance.
Re: Reading web pages
Fixed. Bug was caused by HTTP 1.0 'HTTP 1.0 200 OK' reply. On 21.1.2012 13:14, Xan xan wrote: With png works, with pdf not: ./spider2 http://www.google.com/intl/ca/images/logos/mail_logo.png [a lot of output] $ ./spider2 http://static.arxiv.org/pdf/1109.4897.pdf [Longitud: [Excepció: std.conv.ConvException@/usr/include/d2/4.6/std/conv.d(1640): Can't convert value `HTT' of type string to type uint] 2012/1/20 Bystroushaakbystrou...@kitakitsune.org: On 20.1.2012 18:42, Xan xan wrote: Thank you very much. I should invite you to a beer ;-) Write me if you will be in prag/czech republic :) For the other hand, I get this error: [Excepció: std.conv.ConvException@/usr/include/d2/4.6/std/conv.d(1640): Can't convert value `HTT' of type string to type uint] This is very strange error, because on my computer it works well. Can you remove try..catch and post full error list and program parameters?
Re: Reading web pages
That is really strange - for me, it works with both files. Are you sure, that you can manually download that pdf file? Maybe your provider blocking your connection, or something like that. What type of compiler did you used? On 21.1.2012 13:14, Xan xan wrote: With png works, with pdf not: ./spider2 http://www.google.com/intl/ca/images/logos/mail_logo.png [a lot of output] $ ./spider2 http://static.arxiv.org/pdf/1109.4897.pdf [Longitud: [Excepció: std.conv.ConvException@/usr/include/d2/4.6/std/conv.d(1640): Can't convert value `HTT' of type string to type uint] 2012/1/20 Bystroushaakbystrou...@kitakitsune.org: On 20.1.2012 18:42, Xan xan wrote: Thank you very much. I should invite you to a beer ;-) Write me if you will be in prag/czech republic :) For the other hand, I get this error: [Excepció: std.conv.ConvException@/usr/include/d2/4.6/std/conv.d(1640): Can't convert value `HTT' of type string to type uint] This is very strange error, because on my computer it works well. Can you remove try..catch and post full error list and program parameters?
Re: Reading web pages
With dmd 2.057 on my linux machine: bystrousak:DHTTPClient,0$ dmd spider.d dhttpclient.d bystrousak:DHTTPClient,0$ ./spider http://kitakitsune.org [Contingut: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; HTML . On 20.1.2012 15:37, Xan xan wrote: I get errors: xan@gerret:~/yottium/@codi/aranya-d2.0$ gdmd-4.6 spider.d spider.o: In function `_Dmain': spider.d:(.text+0x4d): undefined reference to `_D11dhttpclient10HTTPClient7__ClassZ' spider.d:(.text+0x5a): undefined reference to `_D11dhttpclient10HTTPClient6__ctorMFZC11dhttpclient10HTTPClient' spider.o:(.data+0x24): undefined reference to `_D11dhttpclient12__ModuleInfoZ' collect2: ld returned 1 exit status with the file spider.d: //D 2.0 //gdmd-4.6fitxer = surt el fitxer amb el mateix nom i .o //Usa https://github.com/Bystroushaak/DHTTPClient import std.stdio, std.string, std.conv, std.stream; import std.socket, std.socketstream; import dhttpclient; int main(string [] args) { if (args.length 2) { writeln(Usage:); writeln( ./spider {url1,url2, ...}); return 0; } else { try { HTTPClient navegador = new HTTPClient(); foreach (a; args[1..$]) { writeln([Contingut: , navegador.get(a), ]); } } catch (Exception e) { writeln([Excepció: , e, ]); } return 0; } } What happens now? Thanks a lot, Xan. 2012/1/20 Bystroushaakbystrou...@kitakitsune.org: You can always use my module: https://github.com/Bystroushaak/DHTTPClient
Re: Reading web pages
This module is very simple, only for HTTP protocol, but there is way how to add HTTPS: public void setTcpSocketCreator(TcpSocket function(string domain, ushort port) fn) You can add lambda function which return SSL socket, which will be called for every connection. FTP is not supported - it is DHTTPCLient, not DFTPClient :) On 20.1.2012 15:24, Xan xan wrote: For the other hand, how to specify the protocol? It's not the same http://foo thanftp://foo
Re: Reading web pages
First version was buggy. I've updated code at github, so if you want to try it, pull new version (git pull). I've also added new example into examples/user_agent_change.d On 20.1.2012 16:08, Bystroushaak wrote: There are two ways: Change global variable for module: dhttpclient.DefaultHeaders = dhttpclient.IEHeaders; // or your own This will change headers for all clients. --- Change instance headers: string[string] my_headers = dhttpclient.FFHeaders; // there are more headers than just User-Agent and you have to copy it my_headers[User-Agent] = My own spider!; HTTPClient navegador = new HTTPClient(); navegador.setClientHeaders(my_headers); --- Headers are defined as: public enum string[string] FFHeaders = [ User-Agent : Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.13, Accept : text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain, Accept-Language : cs,en-us;q=0.7,en;q=0.3, Accept-Charset : utf-8, Keep-Alive : 300, Connection : keep-alive ]; /// Headers from firefox 3.6.13 on Linux public enum string[string] LFFHeaders = [ User-Agent : Mozilla/5.0 (X11; U; Linux i686; cs; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.13, Accept : text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain, Accept-Language : cs,en-us;q=0.7,en;q=0.3, Accept-Charset : utf-8, Keep-Alive : 300, Connection : keep-alive ]; Accept, Accept-Charset, Kepp-ALive and Connection are important and if you redefine it, module can stop work with some servers. On 20.1.2012 15:56, Xan xan wrote: On the other hand, I see dhttpclient identifies as Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.13 How can I change that?
Re: Reading web pages
It is unlimited, you just have to cast output to ubyte[]: std.file.write(logo3w.png, cast(ubyte[]) cl.get(http://www.google.cz/images/srpr/logo3w.png;)); On 20.1.2012 17:53, Xan xan wrote: Thank you very much, Bystroushaak. I see you limite httpclient to xml/html documents. Is there possibility of download any files (and not only html or xml). Just like: HTTPClient navegador = new HTTPClient(); auto file = navegador.download(http://www.google.com/myfile.pdf;) ? Thanks a lot, 2012/1/20 Bystroushaakbystrou...@kitakitsune.org: First version was buggy. I've updated code at github, so if you want to try it, pull new version (git pull). I've also added new example into examples/user_agent_change.d On 20.1.2012 16:08, Bystroushaak wrote: There are two ways: Change global variable for module: dhttpclient.DefaultHeaders = dhttpclient.IEHeaders; // or your own This will change headers for all clients. --- Change instance headers: string[string] my_headers = dhttpclient.FFHeaders; // there are more headers than just User-Agent and you have to copy it my_headers[User-Agent] = My own spider!; HTTPClient navegador = new HTTPClient(); navegador.setClientHeaders(my_headers); --- Headers are defined as: public enum string[string] FFHeaders = [ User-Agent : Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.13, Accept : text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain, Accept-Language : cs,en-us;q=0.7,en;q=0.3, Accept-Charset : utf-8, Keep-Alive : 300, Connection : keep-alive ]; /// Headers from firefox 3.6.13 on Linux public enum string[string] LFFHeaders = [ User-Agent : Mozilla/5.0 (X11; U; Linux i686; cs; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.13, Accept : text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain, Accept-Language : cs,en-us;q=0.7,en;q=0.3, Accept-Charset : utf-8, Keep-Alive : 300, Connection : keep-alive ]; Accept, Accept-Charset, Kepp-ALive and Connection are important and if you redefine it, module can stop work with some servers. On 20.1.2012 15:56, Xan xan wrote: On the other hand, I see dhttpclient identifies as Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.13 How can I change that?
Re: Reading web pages
If you want to know what type of file you just downloaded, look at .getResponseHeaders(): std.file.write(logo3w.png, cast(ubyte[]) cl.get(http://www.google.cz/images/srpr/logo3w.png;)); writeln(cl.getResponseHeaders()[Content-Type]); Which will print in this case: image/png Here is full example: https://github.com/Bystroushaak/DHTTPClient/blob/master/examples/download_binary_file.d On 20.1.2012 18:00, Bystroushaak wrote: It is unlimited, you just have to cast output to ubyte[]: std.file.write(logo3w.png, cast(ubyte[]) cl.get(http://www.google.cz/images/srpr/logo3w.png;)); On 20.1.2012 17:53, Xan xan wrote: Thank you very much, Bystroushaak. I see you limite httpclient to xml/html documents. Is there possibility of download any files (and not only html or xml). Just like: HTTPClient navegador = new HTTPClient(); auto file = navegador.download(http://www.google.com/myfile.pdf;) ? Thanks a lot, 2012/1/20 Bystroushaakbystrou...@kitakitsune.org: First version was buggy. I've updated code at github, so if you want to try it, pull new version (git pull). I've also added new example into examples/user_agent_change.d On 20.1.2012 16:08, Bystroushaak wrote: There are two ways: Change global variable for module: dhttpclient.DefaultHeaders = dhttpclient.IEHeaders; // or your own This will change headers for all clients. --- Change instance headers: string[string] my_headers = dhttpclient.FFHeaders; // there are more headers than just User-Agent and you have to copy it my_headers[User-Agent] = My own spider!; HTTPClient navegador = new HTTPClient(); navegador.setClientHeaders(my_headers); --- Headers are defined as: public enum string[string] FFHeaders = [ User-Agent : Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.13, Accept : text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain, Accept-Language : cs,en-us;q=0.7,en;q=0.3, Accept-Charset : utf-8, Keep-Alive : 300, Connection : keep-alive ]; /// Headers from firefox 3.6.13 on Linux public enum string[string] LFFHeaders = [ User-Agent : Mozilla/5.0 (X11; U; Linux i686; cs; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.13, Accept : text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain, Accept-Language : cs,en-us;q=0.7,en;q=0.3, Accept-Charset : utf-8, Keep-Alive : 300, Connection : keep-alive ]; Accept, Accept-Charset, Kepp-ALive and Connection are important and if you redefine it, module can stop work with some servers. On 20.1.2012 15:56, Xan xan wrote: On the other hand, I see dhttpclient identifies as Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.13 How can I change that?
Re: Reading web pages
Thats because you are trying writeln binary data, and that is impossible, because writeln IMHO checks UTF8 validity. On 20.1.2012 18:08, Xan xan wrote: Before and now, I get this error: $ ./spider http://static.arxiv.org/pdf/1109.4897.pdf [Excepció: std.conv.ConvException@/usr/include/d2/4.6/std/conv.d(1640): Can't convert value `HTT' of type string to type uint] The code: //D 2.0 //gdmd-4.6fitxer = surt el fitxer amb el mateix nom i .o //Usa https://github.com/Bystroushaak/DHTTPClient import std.stdio, std.string, std.conv, std.stream; import std.socket, std.socketstream; import dhttpclient; int main(string [] args) { if (args.length 2) { writeln(Usage:); writeln( ./spider {url1,url2, ...}); return 0; } else { try { string[string] capcalera = dhttpclient.FFHeaders; //capcalera[User-Agent] = arachnida yottiuma; HTTPClient navegador = new HTTPClient(); navegador.setClientHeaders(capcalera); foreach (a; args[1..$]) { writeln([Contingut: , cast(ubyte[]) navegador.get(a), ]); } } catch (Exception e) { writeln([Excepció: , e, ]); } return 0; } } What happens? 2012/1/20 Bystroushaakbystrou...@kitakitsune.org: It is unlimited, you just have to cast output to ubyte[]: std.file.write(logo3w.png, cast(ubyte[]) cl.get(http://www.google.cz/images/srpr/logo3w.png;));
Re: Reading web pages
rawWrite(): stdout.rawWrite(cast(ubyte[]) navegador.get(a)); On 20.1.2012 18:18, Xan xan wrote: Mmmm... I understand it. But is there any way of circumvent it? Perhaps I could write to one file, isn't? 2012/1/20 Bystroushaakbystrou...@kitakitsune.org: Thats because you are trying writeln binary data, and that is impossible, because writeln IMHO checks UTF8 validity. On 20.1.2012 18:08, Xan xan wrote: Before and now, I get this error: $ ./spider http://static.arxiv.org/pdf/1109.4897.pdf [Excepció: std.conv.ConvException@/usr/include/d2/4.6/std/conv.d(1640): Can't convert value `HTT' of type string to type uint] The code: //D 2.0 //gdmd-4.6fitxer=surt el fitxer amb el mateix nom i .o //Usa https://github.com/Bystroushaak/DHTTPClient import std.stdio, std.string, std.conv, std.stream; import std.socket, std.socketstream; import dhttpclient; int main(string [] args) { if (args.length2) { writeln(Usage:); writeln( ./spider {url1,url2, ...}); return 0; } else { try { string[string] capcalera = dhttpclient.FFHeaders; //capcalera[User-Agent] = arachnida yottiuma; HTTPClient navegador = new HTTPClient(); navegador.setClientHeaders(capcalera); foreach (a; args[1..$]) { writeln([Contingut: , cast(ubyte[]) navegador.get(a), ]); } } catch (Exception e) { writeln([Excepció: , e, ]); } return 0; } } What happens? 2012/1/20 Bystroushaakbystrou...@kitakitsune.org: It is unlimited, you just have to cast output to ubyte[]: std.file.write(logo3w.png, cast(ubyte[]) cl.get(http://www.google.cz/images/srpr/logo3w.png;));
Re: Reading web pages
On 20.1.2012 18:42, Xan xan wrote: Thank you very much. I should invite you to a beer ;-) Write me if you will be in prag/czech republic :) For the other hand, I get this error: [Excepció: std.conv.ConvException@/usr/include/d2/4.6/std/conv.d(1640): Can't convert value `HTT' of type string to type uint] This is very strange error, because on my computer it works well. Can you remove try..catch and post full error list and program parameters?
Re: Reading web pages
You can always use my module: https://github.com/Bystroushaak/DHTTPClient On 19.1.2012 20:24, Timon Gehr wrote: On 01/19/2012 04:30 PM, Xan xan wrote: Hi, I want to simply code a script to get the url as string in D 2.0. I have this code: //D 2.0 //gdmd-4.6 import std.stdio, std.string, std.conv, std.stream; import std.socket, std.socketstream; int main(string [] args) { if (args.length 2) { writeln(Usage:); writeln( ./aranya {url1,url2, ...}); return 0; } else { foreach (a; args[1..$]) { Socket sock = new TcpSocket(new InternetAddress(a, 80)); scope(exit) sock.close(); Stream ss = new SocketStream(sock); ss.writeString(GET ~ a ~ HTTP/1.1\r\n); writeln(ss); } return 0; } } but when I use it, I receive: $ ./aranya http://www.google.com std.socket.AddressException@../../../src/libphobos/std/socket.d(697): Unable to resolve host 'http://www.google.com' What fails? Thanks in advance, Xan. The protocol specification is part of the get request. ./aranaya www.google.com seems to actually connect to google. (it still does not work fully, I get back 400 Bad Request, but maybe you can figure it out)
Re: MX records
Bump with tits: (o )( o) On 5.1.2012 23:00, Bystroushaak wrote: Hi. Is there any way how to get MX records for given domain? I don't want to implement whole RFC 1034/5. I've looked at std.net.isemail, but it doesn't looks like what I need :/
MX records
Hi. Is there any way how to get MX records for given domain? I don't want to implement whole RFC 1034/5. I've looked at std.net.isemail, but it doesn't looks like what I need :/
Re: Restrict access to critical functions
Yep. Useful google dork: sandbox. On 14.12.2011 19:55, mta`chrono wrote: Maybe you should use a VM to run your restricted applications. Or have a look a chroot, dchroot or schroot, to setup such stuff. The Programming Language will not help you in this case!
Re: Download file via http
I've created HTTP client module. It's just http module, no cookies, no https, so if you need something small, try it. https://github.com/Bystroushaak/DHTTPClient On 13.12.2011 18:29, Kai Meyer wrote: I've been trying to modify the htmlget.d example for std.socketstream (http://www.d-programming-language.org/phobos/std_socketstream.html) to be able to download a file. My code ends up looking like this at the end: auto outfile = new std.stream.File(destination, FileMode.Out); outfile.copyFrom(ss, bytes_needed); I get bytes_needed from the Content-Length header. The I get the correct number of bytes from the Content-Length, bytes_needed gets the right value, but the resulting file isn't right. The file has the right number of bytes, but I appear to have an extra '0a' at the very beginning of the file, but if I do 'ss.getchar()', to get rid of it, I get an exception that there's not enough data in the stream. Here's the output from hexdump that I'm basing my analysis from. Sorry if it doesn't come through 100% formatted correctly. [kai@server _source]$ hexdump -C correct_file.exe | head 4d 5a 60 00 01 00 00 00 04 00 10 00 ff ff 00 00 |MZ`.| 0010 fe 00 00 00 12 00 00 00 40 00 00 00 00 00 00 00 |@...| 0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 || 0030 00 00 00 00 00 00 00 00 00 00 00 00 60 00 00 00 |`...| 0040 52 65 71 75 69 72 65 73 20 57 69 6e 33 32 20 20 |Requires Win32 | 0050 20 24 16 1f 33 d2 b4 09 cd 21 b8 01 4c cd 21 00 | $..3!..L.!.| 0060 50 45 00 00 4c 01 06 00 00 00 00 00 00 00 00 00 |PE..L...| 0070 00 00 00 00 e0 00 8e 81 0b 01 08 00 00 7e 28 00 |.~(.| 0080 00 02 00 00 00 00 00 00 8c d7 27 00 00 20 00 00 |..'.. ..| 0090 00 a0 28 00 00 00 40 00 00 10 00 00 00 02 00 00 |..(...@.| [kai@server _source]$ hexdump -C downloaded_file.exe | head 0a 4d 5a 60 00 01 00 00 00 04 00 10 00 ff ff 00 |.MZ`| 0010 00 fe 00 00 00 12 00 00 00 40 00 00 00 00 00 00 |.@..| 0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 || 0030 00 00 00 00 00 00 00 00 00 00 00 00 00 60 00 00 |.`..| 0040 00 52 65 71 75 69 72 65 73 20 57 69 6e 33 32 20 |.Requires Win32 | 0050 20 20 24 16 1f 33 d2 b4 09 cd 21 b8 01 4c cd 21 | $..3!..L.!| 0060 00 50 45 00 00 4c 01 06 00 00 00 00 00 00 00 00 |.PE..L..| 0070 00 00 00 00 00 e0 00 8e 81 0b 01 08 00 00 7e 28 |..~(| 0080 00 00 02 00 00 00 00 00 00 8c d7 27 00 00 20 00 |...'.. .| 0090 00 00 a0 28 00 00 00 40 00 00 10 00 00 00 02 00 |...(...@| [kai@server _source]$ hexdump -C correct_file.exe | tail 002b5c10 80 30 84 30 88 30 8c 30 90 30 94 30 98 30 9c 30 |.0.0.0.0.0.0.0.0| 002b5c20 a0 30 a4 30 a8 30 ac 30 b0 30 b4 30 b8 30 bc 30 |.0.0.0.0.0.0.0.0| 002b5c30 c0 30 c4 30 c8 30 cc 30 d0 30 d4 30 d8 30 dc 30 |.0.0.0.0.0.0.0.0| 002b5c40 f4 30 f8 30 fc 30 00 31 64 31 68 31 6c 31 70 31 |.0.0.0.1d1h1l1p1| 002b5c50 74 31 38 37 00 00 00 00 00 00 00 00 00 00 00 00 |t187| 002b5c60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 || * 002b5e00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 || 002b5e10 00 00 00 00 00 00 00 00 00 00 00 00 || 002b5e1c [kai@server _source]$ hexdump -C downloaded_file.exe | tail 002b5c10 30 80 30 84 30 88 30 8c 30 90 30 94 30 98 30 9c |0.0.0.0.0.0.0.0.| 002b5c20 30 a0 30 a4 30 a8 30 ac 30 b0 30 b4 30 b8 30 bc |0.0.0.0.0.0.0.0.| 002b5c30 30 c0 30 c4 30 c8 30 cc 30 d0 30 d4 30 d8 30 dc |0.0.0.0.0.0.0.0.| 002b5c40 30 f4 30 f8 30 fc 30 00 31 64 31 68 31 6c 31 70 |0.0.0.0.1d1h1l1p| 002b5c50 31 74 31 38 37 00 00 00 00 00 00 00 00 00 00 00 |1t187...| 002b5c60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 || * 002b5e00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 || 002b5e10 00 00 00 00 00 00 00 00 00 00 00 00 ||
Re: IDE with renaming possibility
I'm using linux too. I tried all IDEs for D, but all of them was pretty lame, so I'm using Kate/Geany. I don't find an important feature: renaming variables/functions/etc. BTW: It's called refactoring.
Re: Formatted date
Oh, ok, thanks for your answer. 2011/11/4 Jonathan M Davis jmdavisp...@gmx.com: On Thursday, November 03, 2011 16:58 Lishaak Bystroushaak wrote: Hello. Is there any way how to format date with formating strings? Something like strftime in python; http://docs.python.org/library/datetime.html#strftime-and-strptime-behavior Not currently. SysTime (and the other time point types in std.datetime) have functions for converting them to specific ISO standards but not custom formatting strings. That's in the works but hasn't been completed yet. In the meantime, you can get a time_t from a SysTime using its unixTime property and pass that to C's strftime (though be warned that it risks being an hour off on Windows, since for some bizarre reason Windows applies DST to UTC such that time_t on Windows isn't actually guaranteed to always be the number of seconds since midnight January 1st, 1970 in UTC). Another alternative is that someone ported the deprecated std.dateparse (which worked with the deprecated and very broken std.date) to use SysTime, and you can use that: https://gist.github.com/1283011 toCustomString will be added to SysTime and the other time point types in std.datetime, but its design hasn't been completed sorted out yet, let alone fully implemented, so it's in the works, but it could be a little while before it makes it into Phobos. - Jonathan M Davis
Formatted date
Hello. Is there any way how to format date with formating strings? Something like strftime in python; http://docs.python.org/library/datetime.html#strftime-and-strptime-behavior