Re: Creating a file in ~/.config (ubuntu)

2012-04-13 Thread Bystroushaak
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

Re: Reading web pages

2012-01-22 Thread Bystroushaak
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ó:

Re: Reading web pages

2012-01-21 Thread Bystroushaak
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:

Re: Reading web pages

2012-01-20 Thread Bystroushaak
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

Re: Reading web pages

2012-01-20 Thread Bystroushaak
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 -

Re: Reading web pages

2012-01-20 Thread Bystroushaak
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

Re: Reading web pages

2012-01-20 Thread Bystroushaak
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

Re: Reading web pages

2012-01-20 Thread Bystroushaak
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

Re: Reading web pages

2012-01-20 Thread Bystroushaak
/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

Re: Reading web pages

2012-01-20 Thread Bystroushaak
`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

Re: Reading web pages

2012-01-20 Thread Bystroushaak
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

Re: Reading web pages

2012-01-19 Thread Bystroushaak
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

Re: MX records

2012-01-15 Thread Bystroushaak
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

2012-01-05 Thread Bystroushaak
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

2011-12-18 Thread Bystroushaak
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

2011-12-18 Thread Bystroushaak
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

Re: IDE with renaming possibility

2011-11-10 Thread Lishaak Bystroushaak
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

2011-11-04 Thread Lishaak Bystroushaak
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

Formatted date

2011-11-03 Thread Lishaak Bystroushaak
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