Regarding DConf 2014

2014-06-15 Thread Hugo Florentino via Digitalmars-d-learn
Hi, Would it be possible to have for Dconf 2014 something similar to what was made available for DConf 2013 (meaning links to the videos and slides)? Regards, Hugo

Decoding HTML escape sequences

2014-05-12 Thread Hugo Florentino via Digitalmars-d-learn
Hi, I have some documents where some strings appears in HTML escape sequences in one of these forms: \x3C\x53\x43\x52\x49\x50\x54\x20\x4C\x41\x4E\x47\x55\x41\x47\x45\x3D\x22\x4A\x61\x76\x61\x53\x63\x72\x69\x70\x74\x22\x3e %3C%53%43%52%49%50%54%20%4C%41%4E%47%55%41%47%45%3D%22%4A%61%76%61%53%63%

list in spam blacklist? [OT]

2014-04-04 Thread Hugo Florentino
Hi, IP 173.45.241.208 (slice-1.puremagic.com) seems to be blacklisted in zen.spamhaus.org Please check for a possible misuse of the server, or in case of a false positive report to spamhaus.org Regards, Hugo

linking against libmilter

2014-03-10 Thread Hugo Florentino
Hi, Does anyone have an example of linking against libmilter? The milter applications I have seen are a little overweight for my taste, I just want to check email headers. I sure would like to take advante of the fast regexp of D rather than buildin my own solution in C (which I don't master).

Re: Parsing and splitting textfile

2014-02-24 Thread Hugo Florentino
On Mon, 24 Feb 2014 19:08:16 + (UTC), Justin Whear wrote: Specifically std.regex.splitter[1] creates a lazy range over the input. You can couple this with lazy file reading (e.g. `File("mailbox").byChunk (1024).joiner`). Would something like this work? (I cannot test it right now) aut

Re: Parsing and splitting textfile

2014-02-24 Thread Hugo Florentino
On Mon, 24 Feb 2014 19:08:16 + (UTC), Justin Whear wrote: Specifically std.regex.splitter[1] creates a lazy range over the input. You can couple this with lazy file reading (e.g. `File("mailbox").byChunk (1024).joiner`). Interesting, thanks.

Re: Parsing and splitting textfile

2014-02-24 Thread Hugo Florentino
On Mon, 24 Feb 2014 14:00:09 -0500, Steven Schveighoffer wrote: std.regex I should have explained myself better. I have already used regular expressions a couple of times. My doubt here is how parse the file progressively, not loading it completely into memory. If this can be done solely wi

Parsing and splitting textfile

2014-02-24 Thread Hugo Florentino
Hello, Can you point me to an efficient way to parse a text file and split it by certain expression (for example, `\n\nFrom\ .+@.+$`), copying what has already been read to a separate file, and so on till the end of the file? I am trying to implement a mailbox to maildir format conversion a

Re: errors with filesystem operations

2014-01-20 Thread Hugo Florentino
Update: the combination of both your suggestions worked: if (exists(BlankDirToDelete)) { try rmdir(`\\?\` ~ BlankDirToDelete); catch (FileException e) writeln(e.msg); } Thanks! Now I just have to find out why the block of the file extensions is failing.

Re: errors with filesystem operations

2014-01-20 Thread Hugo Florentino
On Sat, 18 Jan 2014 11:51:48 +, Kagamin wrote: remove uses DeleteFile, but MSDN says To remove an empty directory, use the RemoveDirectory function. so remove probably won't work on directories. You are correct, so I made a few test using rmdir() with a blank for directory name and now I

Re: errors with filesystem operations

2014-01-20 Thread Hugo Florentino
On Sat, 18 Jan 2014 11:33:16 +, Kagamin wrote: On Friday, 17 January 2014 at 12:52:09 UTC, Hugo Florentino wrote: On Fri, 17 Jan 2014 07:07:35 +, Kagamin wrote: Does it fail for that one directory only or for any directory? Interesting question. I would have to do more tests with odd

Re: errors with filesystem operations

2014-01-17 Thread Hugo Florentino
On Fri, 17 Jan 2014 13:10:00 +, Kagamin wrote: I only noticed that rename uses MOVEFILE_REPLACE_EXISTING flag, which can't be used with directories. Are you sure remove fails too? If rename throws, remove is not called in your code. Well, as a matter of fact I did try to use remove directly

Re: errors with filesystem operations

2014-01-17 Thread Hugo Florentino
On Fri, 17 Jan 2014 07:07:35 +, Kagamin wrote: Does it fail for that one directory only or for any directory? Interesting question. I would have to do more tests with odd names, but apparently both remove() and rename() have problems with directories with a blank name. Curiously, moving f

Re: errors with filesystem operations

2014-01-16 Thread Hugo Florentino
On Thu, 16 Jan 2014 15:41:06 +, Kagamin wrote: Probably because you use ansi api: if filename contains non-english character, there could be a problem. A filesystem support is primarily for storing files, attributes can be safely ignored. Hmm... that may be true for Linux filesystems, but

Re: errors with filesystem operations

2014-01-15 Thread Hugo Florentino
On Wed, 15 Jan 2014 13:41:50 +0100, Jacob Carlborg wrote: ... On Linux, hidden files are all files where the filename starts with a dot. To make it visible you need to rename the file. As far as I know, Linux doesn't have any form of system attribute. I am aware of this. However, FAT32 and NTFS

errors with filesystem operations

2014-01-15 Thread Hugo Florentino
Hi, I am trying to make a little application to revert the effect of some viruses on USB memories, and running it from Windows encountered some exceptions that IMHO should not have happened. Maybe I am missing something. Can you please check the commented blocks for errors? Also, is there a

importing modules from a function

2013-12-28 Thread Hugo Florentino
Hi, A moment ago I was reading a reply to one of my posts, and noticed Artur Skawina did this: void main(string argv[]) { import std.string; ... I didn't know D allowed importing modules from a function. Now, my question is: what is the advantage of this over importing the regular way?

Re: inotify and recursion

2013-12-27 Thread Hugo Florentino
On Fri, 27 Dec 2013 12:56:25 +, Gary Willoughby wrote: On Friday, 27 December 2013 at 03:39:58 UTC, Hugo Florentino wrote: BTW, it it a requirement to use malloc, and if so, when would I need to free the memory allocated by it? I use a static ubyte array. I've been using inotify qu

Re: inotify and recursion

2013-12-26 Thread Hugo Florentino
On Fri, 27 Dec 2013 03:23:00 +, David Eagen wrote: Here is a first attempt. I'm sure there are much better ways to do this but this should at least get you going in the right direction. ... Thanks! BTW, it it a requirement to use malloc, and if so, when would I need to free the memory all

inotify and recursion

2013-12-26 Thread Hugo Florentino
Hi, By any chance has anyone linked against libnotify so as to monitor certain changes in a directory and subdirectories, and act according to event? I am thinking in combining this with fossil [1] to automatically document changes in /etc My main concern is that (if I undestand it correctly

Re: how to detect OS architecture?

2013-12-19 Thread Hugo Florentino
On Thu, 19 Dec 2013 10:53:12 -0800, Ali Çehreli wrote: On 12/18/2013 05:50 AM, Hugo Florentino wrote: BTW, how could I benchmark the performance of both solutions (lets say for a few thousand runs) to see if one is more efficient than the other? There is std.datetime.benchmark: http

Re: Wrong output of quotes in Windows (encoding?)

2013-12-19 Thread Hugo Florentino
On Thu, 19 Dec 2013 19:38:20 +, Simon wrote: Call: SetConsoleOutputCP(65001); Works for me on win7 64bit. Not sure how far back it's supported though. Interesting, thanks.

Re: Wrong output of quotes in Windows (encoding?)

2013-12-18 Thread Hugo Florentino
On Wed, 18 Dec 2013 10:05:49 -0800, Ali Çehreli wrote: On 12/18/2013 05:32 AM, Hugo Florentino wrote: output is incorrect in Windows (even with unicode-supporting fonts). Is the code page also set to UTF-8? I think you must issue the command 'chcp 65001'. I have changed your

Re: how to detect OS architecture?

2013-12-18 Thread Hugo Florentino
On Wed, 18 Dec 2013 13:16:35 -, Regan Heath wrote: IsWow64Process returns (in the output parameter) if the 32 bit application is running in WOW64. WOW64 *only* exists on a 64 bit OS. So, if true this tells you you're on a 64 bit OS. You don't need an additional call to GetNativeSystemI

Re: how to detect OS architecture?

2013-12-18 Thread Hugo Florentino
On Wed, 18 Dec 2013 13:20:45 -, Regan Heath wrote: On Wed, 18 Dec 2013 04:22:23 -, Hugo Florentino wrote: On Tue, 17 Dec 2013 15:13:18 +0100, Gary Willoughby wrote: Make sure you handle if users have a 32bit OS installed on a 64bit PC. As a matter of fact that was the actual

Wrong output of quotes in Windows (encoding?)

2013-12-18 Thread Hugo Florentino
Hi, A short while ago I had minor difficulties escaping quotes, and noticed (I don't remember where) a simple function by a D user which I have now tried to enhance. The problem is that output is incorrect in Windows (even with unicode-supporting fonts). I tried to use transcode but could not

Re: how to detect OS architecture?

2013-12-17 Thread Hugo Florentino
On Tue, 17 Dec 2013 13:21:30 -, Regan Heath wrote: Is GetNativeSystemInfo your other solution? On the MSDN page for GetNativeSystemInfo it recommends using IsWow64Process to detect if you're running under WOW64, at which point you would then call GetNativeSystemInfo. I am not sure what Get

Re: how to detect OS architecture?

2013-12-17 Thread Hugo Florentino
On Tue, 17 Dec 2013 15:13:18 +0100, Gary Willoughby wrote: Make sure you handle if users have a 32bit OS installed on a 64bit PC. As a matter of fact that was the actual configuration in the system I wrote the app. I am now with a friend with the same configuration, and it also seems to be w

Re: how to detect OS architecture?

2013-12-16 Thread Hugo Florentino
On Mon, 16 Dec 2013 20:23:00 +0100, Jacob Carlborg wrote: On 2013-12-16 17:46, Marco Leise wrote: Hehe, I guess the whole purpose of the launcher is to run in 32-bit and detect at runtime if the 64-bit main executable can be run or the 32-bit version must be used. The only advantage of that i

Re: how to detect OS architecture?

2013-12-16 Thread Hugo Florentino
On Mon, 16 Dec 2013 17:04:18 -, Regan Heath wrote: ... Compile the launcher as 32bit, and use this global boolean "isWow64": ... Thanks, it's nice to have another option. What do you guys think are the possible advantages/disadvantages of either solution?

Re: how to detect OS architecture?

2013-12-16 Thread Hugo Florentino
GetNativeSystemInfo worked. Thanks! The code ended being like this (it seems to be working both in x86 and x86_64): import std.file: exists, getcwd; import std.path: buildPath, dirName; import std.string: format, toStringz; import core.sys.windows.windows; enum X86 = 0; enum AMD64 = 9; immu

Re: how to detect OS architecture?

2013-12-16 Thread Hugo Florentino
On Mon, 16 Dec 2013 12:59:52 +0100, John Colvin wrote: On Monday, 16 December 2013 at 11:56:07 UTC, Hugo Florentino wrote: On Mon, 16 Dec 2013 12:40:17 +0100, MrSmith wrote: I think this is what he want http://dlang.org/phobos/core_cpuid.html#.isX86_64 Thanks, that's precisely what I n

Re: how to detect OS architecture?

2013-12-16 Thread Hugo Florentino
On Mon, 16 Dec 2013 12:40:17 +0100, MrSmith wrote: version(Windows) { // Windows code goes here } else { // Other OS code goes here } More here: http://dlang.org/version.html I think he wants determine at runtime what architecture x86 or x64 processor supprots and launch appropriate

Re: regarding spawnProcess and parameters in Windows

2013-12-16 Thread Hugo Florentino
On Mon, 16 Dec 2013 05:15:24 -0500, Hugo Florentino wrote: Now, suppose I have two versions of the application (myapp32.exe and myapp64.exe), and I want my launcher to launch either, based on the architecture it detected from the OS being run on. What could I do in this case, which is actually

how to detect OS architecture?

2013-12-16 Thread Hugo Florentino
Hi, I am writing a launcher to make a Windows application portable, but since this application supports both x86 and x86_64, I would like to detect the architecture of the OS my launcher is being run on, in order to launch the proper executable. How can I do this? Regards, Hugo

Re: regarding spawnProcess and parameters in Windows

2013-12-16 Thread Hugo Florentino
On Mon, 16 Dec 2013 18:59:52 +0900, Mike Parker wrote: On 12/16/2013 6:33 PM, Hugo Florentino wrote: ... Why does the console window appear and how can I prevent this? This is how Windows works. There are a couple of ways to eliminate the console. One is to use WinMain instead of main. That

Re: regarding spawnProcess and parameters in Windows

2013-12-16 Thread Hugo Florentino
On Mon, 16 Dec 2013 04:33:53 -0500, Hugo Florentino wrote: ... Why does the console window appear and how can I prevent this? I forgot to mention that I tried using "int main ()" and even "void main()" and removing returns, but the console window keeps appearing, whic

Re: regarding spawnProcess and parameters in Windows

2013-12-16 Thread Hugo Florentino
On Mon, 16 Dec 2013 02:04:10 +0100, Danny Arends wrote: ... So I think this should work: spawnProcess([appexe,format("/INI=%s",appini)], ["",""],Config.suppressConsole); Hmm... that did not work either, it complained that the parameter was not correct. Actually, the syntax I was using should

regarding spawnProcess and parameters in Windows

2013-12-15 Thread Hugo Florentino
Hello, I am trying to do a small launcher for a Windows application which (in order to be portable) requires a specific parameter, and I am getting this error when I try to run it in Windows 7 SP1: "std.process.ProcessException@std\process.d(518): Failed to spawn new process (Access denied.)

Re: regarding Latin1 to UTF8 encoding

2013-12-08 Thread Hugo Florentino
On Mon, 09 Dec 2013 04:19:51 +0100, Adam D. Ruppe wrote: On Monday, 9 December 2013 at 03:07:58 UTC, Hugo Florentino wrote: Is there a way to detect the encoding prior to typecasting/loading the file? UTF-8 can be detected fairly reliably, but not much luck for other encodings. A Windows-1258

Re: regarding Latin1 to UTF8 encoding

2013-12-08 Thread Hugo Florentino
On Mon, 09 Dec 2013 03:44:19 +0100, Adam D. Ruppe wrote: On Monday, 9 December 2013 at 02:40:29 UTC, Hugo Florentino wrote: auto input = readText("myfile.htm"); Don't use readText if it isn't utf-8; readtext assumes it is utf 8. I've never actually used std.encoding

regarding Latin1 to UTF8 encoding

2013-12-08 Thread Hugo Florentino
Hi, I am having some problems trygin to pass regular expressions to a webpage encoded in Latin1. I have unsuccessfully tried to convert it to UTF8 before passing the regular expression. Initially I tried to do something like this: auto input = readText("myfile.htm"); auto output = replace(in

Re: regading detection of stdin

2013-12-07 Thread Hugo Florentino
On Sat, 07 Dec 2013 21:33:56 +0100, Adam D. Ruppe wrote: Sounds like what you need is to see if stdin is a tty. import core.sys.posix.unistd; // has isatty() void main() { import std.stdio; writeln(isatty(0)); // 0 is stdin, so this will show 1 if keyboard or 0 if pope } In

Re: Digitalmars-d-learn Digest, Vol 95, Issue 30

2013-12-07 Thread Hugo Florentino
On Sat, 07 Dec 2013 23:03:10 +0100 Chris Cain wrote: On Friday, 6 December 2013 at 00:24:22 UTC, Hugo Florentino wrote: Hi, I was trying to do something like this (using dmd.2.064.2 both from Windows and Linux), but if nothing is passed from stdin and no parameter is provided, the application

Re: regading detection of stdin

2013-12-07 Thread Hugo Florentino
On Fri, 06 Dec 2013 06:42:01 +0100, Jesse Phillips" wrote: On Friday, 6 December 2013 at 02:41:28 UTC, Hugo Florentino wrote: I see... so the "problem" simply was that function readln was expecting user input. In that case, this is not what I intended. I want the application

Re: regading detection of stdin

2013-12-05 Thread Hugo Florentino
On Fri, 06 Dec 2013 01:26:28 +0100, Adam D. Ruppe wrote: On Friday, 6 December 2013 at 00:24:22 UTC, Hugo Florentino wrote: if nothing is passed from stdin and no parameter is provided, the application freezes: Does it freeze or just wait for you to press enter on the keyboard? I see

regading detection of stdin

2013-12-05 Thread Hugo Florentino
Hi, I was trying to do something like this (using dmd.2.064.2 both from Windows and Linux), but if nothing is passed from stdin and no parameter is provided, the application freezes: import std.stdio, std.file: readText; int main(string[] args) { string s; switch (args.length) { case