Text from the Internet page

2013-03-27 Thread SaltySugar

How to get a piece of text from the Internet page with D code?


Re: Text from the Internet page

2013-03-27 Thread SaltySugar

On Wednesday, 27 March 2013 at 12:03:59 UTC, bearophile wrote:

SaltySugar:


How to get a piece of text from the Internet page with D code?


By lines:
http://rosettacode.org/wiki/Web_scraping#D

Whole:
http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity#D

Bye,
bearophile


Thank you, guys :)


Re: wxD - dead or alive?

2013-03-04 Thread SaltySugar

On Monday, 4 March 2013 at 13:25:22 UTC, Matthew Caron wrote:

On 03/03/2013 08:16 AM, SaltySugar wrote:

wxD - dead or alive?


I've been using it. What makes you think that it's dead?


Because It's latest release was at 2011-08-26


wxD - dead or alive?

2013-03-03 Thread SaltySugar

wxD - dead or alive?


Re: How to detect current executable file name?

2013-02-17 Thread SaltySugar

On Monday, 18 February 2013 at 03:28:59 UTC, eGust wrote:
I need to locate the directory of current executable file, but 
I can't find how to do that in Phobos. I tried 
core.runtime.Runtime.args[0], but failed. Is there a standard 
method of Phobos to do that? I only know the way of Windows 
(GetModuleFileName), but I think as a common task there should 
be a platform-independent way to get it in the standard library.


import std.stdio;

void main (string[] args)
{
writeln(args[0]);
}


Re: GtkD button size

2013-02-05 Thread SaltySugar

On Monday, 4 February 2013 at 21:55:24 UTC, Mike Wey wrote:

On 02/04/2013 03:03 PM, SaltySugar wrote:
On Sunday, 3 February 2013 at 16:07:06 UTC, Artur Skawina 
wrote:

On 02/03/13 16:53, SaltySugar wrote:
GTKD. Can someone explain me how to change button size in 
vbox, hbox?

setSizeRequest (70, 50); doesn't work. Thanks.


Try playing with an interactive gui tool, such as glade. The 
fill,

expand and
size request interactions will be immediately visible.

artur


I'm waiting other answers :)


A VBox or A HBox will always expand the Widget in the direction 
opposite of the on it's managing, if it expands the Widget in 
that direction depends on the options passed to packStart. So 
get the size request to work with those containers you'll have 
to wrap a HBox in a VBoc or visa versa.


A more convenient container would be the ButtonBox which 
doesn't expand the Button in the direction it's not managing. 
And thus properly handles the size request.


A Grid or Table might also apply depending on the complete 
layout.


I can't find any tutorials about buttonboxes. Can you write how 
to use it?


Re: GtkD button size

2013-02-05 Thread SaltySugar

On Tuesday, 5 February 2013 at 19:31:01 UTC, Mike Wey wrote:

On 02/05/2013 06:33 PM, SaltySugar wrote:
I can't find any tutorials about buttonboxes. Can you write 
how to use it?


Here is a small example:

import gtk.MainWindow;
import gtk.Button;
import gtk.Main;
import gtk.HButtonBox;

class Application : MainWindow
{
this()
{
super(GtkD App);
setDefaultSize(200, 200);

HButtonBox hBox = new HButtonBox();

Button btnLog = new Button(Login);
btnLog.setSizeRequest (70, 50);
hBox.packStart(btnLog, false, false, 3);

add(hBox);
showAll();
}
}

void main(string[] args)
{
Main.init(args);
new Application();
Main.run();
}

It looks like this:
http://i45.tinypic.com/msivb4.png


Thank you, Mike. One more question. Can I use hbox.add(btn); 
instead of hbox.packStart (btn,false,false,5);

What difference between them?
Sorry, for my bad English.


Re: GtkD button size

2013-02-04 Thread SaltySugar

On Sunday, 3 February 2013 at 16:07:06 UTC, Artur Skawina wrote:

On 02/03/13 16:53, SaltySugar wrote:
GTKD. Can someone explain me how to change button size in 
vbox, hbox? setSizeRequest (70, 50); doesn't work. Thanks.


Try playing with an interactive gui tool, such as glade. The 
fill, expand and

size request interactions will be immediately visible.

artur


I'm waiting other answers :)


Re: get random char from array

2013-02-02 Thread SaltySugar

On Saturday, 2 February 2013 at 09:59:07 UTC, bearophile wrote:

SaltySugar:


My code:


In Phobos there isn't something like random.choice() of Python. 
This code doesn't work with truly Unicode strings (better to 
use a dstring or dchar[] for that, unless you want to walk the 
string every time you want to extract a random item):



import std.stdio, std.random;

void main() {
immutable array = abcdef;
immutable rndChar = array[uniform(0, $)];
writeln(rndChar);
}


Bye,
bearophile


Thank you!


gtkD GUI design

2013-01-31 Thread SaltySugar

I want to do a GUI like this:
http://www.part.lt/img/f44e209eb2ccbc9dda2e6b11fa5c6317747.jpg

But I've got the following result:
http://www.part.lt/img/f4a238595048be7c23655b02477aabd8447.jpg

My Code:


import gtk.MainWindow;
import gtk.Label;
import gtk.Button;
import gtk.VBox;
import gtk.HBox;
import gtk.Entry;
import gtk.Main;

class Application : MainWindow
{
this()
{
super(GtkD App);
setDefaultSize(200, 200);

HBox hBox = new HBox(false, 3);
HBox hBox1 = new HBox(false, 3);
VBox vBox = new VBox(false, 5);

Button btnLog = new Button(LOGIN ---);
Label lblNick = new Label(User: );
Entry txtNick = new Entry();
Label lblPass = new Label(Password: );
Entry txtPass = new Entry();

btnLog.setSizeRequest(70, 30);
vBox.packStart(hBox, true, true, 3);
vBox.packStart(hBox1, true, true, 3);

hBox.add (lblNick);
hBox.add (txtNick);
hBox1.add (lblPass);
hBox1.add (txtPass);
vBox.add (btnLog);

add(vBox);
showAll();
}
}
void main(string[] args)
{
Main.init(args);
new Application();
Main.run();
}

Thanks.


Re: gtkD GUI design

2013-01-31 Thread SaltySugar

On Thursday, 31 January 2013 at 11:41:52 UTC, SaltySugar wrote:

On Thursday, 31 January 2013 at 11:38:42 UTC, SaltySugar wrote:

I want to do a GUI like this:
http://www.part.lt/img/f44e209eb2ccbc9dda2e6b11fa5c6317747.jpg

But I've got the following result:
http://www.part.lt/img/f4a238595048be7c23655b02477aabd8447.jpg

My Code:


import gtk.MainWindow;
import gtk.Label;
import gtk.Button;
import gtk.VBox;
import gtk.HBox;
import gtk.Entry;
import gtk.Main;

class Application : MainWindow
{
this()
{
super(GtkD App);
setDefaultSize(200, 200);

HBox hBox = new HBox(false, 3);
HBox hBox1 = new HBox(false, 3);
VBox vBox = new VBox(false, 5);

Button btnLog = new Button(LOGIN ---);
Label lblNick = new Label(User: );
Entry txtNick = new Entry();
Label lblPass = new Label(Password: );
Entry txtPass = new Entry();

btnLog.setSizeRequest(70, 30);
vBox.packStart(hBox, true, true, 3);
vBox.packStart(hBox1, true, true, 3);

hBox.add (lblNick);
hBox.add (txtNick);
hBox1.add (lblPass);
hBox1.add (txtPass);
vBox.add (btnLog);

add(vBox);
showAll();
}
}
void main(string[] args)
{
Main.init(args);
new Application();
Main.run();
}

Thanks.


Links not working.

My current:
http://www.part.lt/perziura/f4a238595048be7c23655b02477aabd8447.jpg
I want to like that:
http://www.part.lt/perziura/f44e209eb2ccbc9dda2e6b11fa5c6317667.jpg



Re: gtkD GUI design

2013-01-31 Thread SaltySugar

On Thursday, 31 January 2013 at 11:38:42 UTC, SaltySugar wrote:

I want to do a GUI like this:
http://www.part.lt/img/f44e209eb2ccbc9dda2e6b11fa5c6317747.jpg

But I've got the following result:
http://www.part.lt/img/f4a238595048be7c23655b02477aabd8447.jpg

My Code:


import gtk.MainWindow;
import gtk.Label;
import gtk.Button;
import gtk.VBox;
import gtk.HBox;
import gtk.Entry;
import gtk.Main;

class Application : MainWindow
{
this()
{
super(GtkD App);
setDefaultSize(200, 200);

HBox hBox = new HBox(false, 3);
HBox hBox1 = new HBox(false, 3);
VBox vBox = new VBox(false, 5);

Button btnLog = new Button(LOGIN ---);
Label lblNick = new Label(User: );
Entry txtNick = new Entry();
Label lblPass = new Label(Password: );
Entry txtPass = new Entry();

btnLog.setSizeRequest(70, 30);
vBox.packStart(hBox, true, true, 3);
vBox.packStart(hBox1, true, true, 3);

hBox.add (lblNick);
hBox.add (txtNick);
hBox1.add (lblPass);
hBox1.add (txtPass);
vBox.add (btnLog);

add(vBox);
showAll();
}
}
void main(string[] args)
{
Main.init(args);
new Application();
Main.run();
}

Thanks.


Links not working.

My current:
[URL=http://www.part.lt/perziura/f4a238595048be7c23655b02477aabd8447.jpg][IMG]http://www.part.lt/img/f4a238595048be7c23655b02477aabd8447.jpg[/IMG][/URL]

I want to like that:

[URL=http://www.part.lt/perziura/f44e209eb2ccbc9dda2e6b11fa5c6317667.jpg][IMG]http://www.part.lt/img/f44e209eb2ccbc9dda2e6b11fa5c6317667.jpg[/IMG][/URL]


Re: gtkD GUI design

2013-01-31 Thread SaltySugar

On Thursday, 31 January 2013 at 11:43:14 UTC, SaltySugar wrote:

On Thursday, 31 January 2013 at 11:41:52 UTC, SaltySugar wrote:

On Thursday, 31 January 2013 at 11:38:42 UTC, SaltySugar wrote:

I want to do a GUI like this:
http://www.part.lt/img/f44e209eb2ccbc9dda2e6b11fa5c6317747.jpg

But I've got the following result:
http://www.part.lt/img/f4a238595048be7c23655b02477aabd8447.jpg

My Code:


import gtk.MainWindow;
import gtk.Label;
import gtk.Button;
import gtk.VBox;
import gtk.HBox;
import gtk.Entry;
import gtk.Main;

class Application : MainWindow
{
this()
{
super(GtkD App);
setDefaultSize(200, 200);

HBox hBox = new HBox(false, 3);
HBox hBox1 = new HBox(false, 3);
VBox vBox = new VBox(false, 5);

Button btnLog = new Button(LOGIN ---);
Label lblNick = new Label(User: );
Entry txtNick = new Entry();
Label lblPass = new Label(Password: );
Entry txtPass = new Entry();

btnLog.setSizeRequest(70, 30);
vBox.packStart(hBox, true, true, 3);
vBox.packStart(hBox1, true, true, 3);

hBox.add (lblNick);
hBox.add (txtNick);
hBox1.add (lblPass);
hBox1.add (txtPass);
vBox.add (btnLog);

add(vBox);
showAll();
}
}
void main(string[] args)
{
Main.init(args);
new Application();
Main.run();
}

Thanks.


Links not working.

My current:
http://imageshack.us/photo/my-images/33/16969673.png/
I want to do like that:
http://imageshack.us/photo/my-images/831/wantedjn.png/


Re: gtkD problem

2013-01-29 Thread SaltySugar

On Tuesday, 29 January 2013 at 05:49:37 UTC, SaltySugar wrote:

On Monday, 28 January 2013 at 21:50:24 UTC, Mike Wey wrote:

On Monday, 28 January 2013 at 19:20:00 UTC, Mike Wey wrote:
There seems to be a small bug in the code so that it fails is 
the
GTK_BASEPATH doesn't end with a backslash, you can either add 
it to
the GTK_BASEPATH, or remove the GTK_BASEPATH environment 
variable

completely.


Fixed in git: 
https://github.com/gtkd-developers/GtkD/commit/7e54919287cc7810aed7af27b5371551a3abd9cd


Ok, I'll try It. So, I must to replace old gtkD with this one?


Finally, It works!!! Thank you very much, Mike :)


gtk on the other machine

2013-01-29 Thread SaltySugar
I have to run my program on the other computer. How to compile my 
program to do that?


wxD problem

2013-01-28 Thread SaltySugar
Can someone help me? I compiled WxWidgets succesfully but when I 
try to compile wxD it shows me an error:


dmc -D__DMD__ -mn -g -o+none -D -D__WXDEBUG__  -IC:\Program 
Files\WxWidgets\
include  -IC:\Program Files\WxWidgets\lib\dmc_lib\mswd -w- -I. 
-WA -DNOPCH -HP90

 -Ar -Ae-c -owx-release.obj wx-release.cpp
Error: multiple source files 'Files\WxWidgets\include' and 
'Files\WxWidgets\lib\

dmc_lib\mswd', but one obj

Help me! :(


gtkD problem

2013-01-28 Thread SaltySugar
I have one problem. I compiled gtkD ad my first program 
successfully but when I try to run my program it shows:


C:\appshello
object.Exception@..\src\gtkc\Loader.d(123): Library load failed: 
libgtk-3-0.dll


My Path variable:
C:\Program Files\PC Connectivity 
Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program 
Files\ATI 
Technologies\ATI.ACE;C:\D\dmd2\windows\bin;C:\D\dm\bin;C:\Documents 
and Settings\Tomas\Application 
Data\Dashlane\bin\Firefox_Extension\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\components;C:\Program 
Files\GTK3\bin


GTK_BASEPATH variable:

C:\Program Files\GTK3\bin

can someone help me?


Re: gtkD problem

2013-01-28 Thread SaltySugar

On Monday, 28 January 2013 at 13:15:09 UTC, Jordi Sayol wrote:

Al 28/01/13 13:43, En/na SaltySugar ha escrit:
I have one problem. I compiled gtkD ad my first program 
successfully but when I try to run my program it shows:


C:\appshello
object.Exception@..\src\gtkc\Loader.d(123): Library load 
failed: libgtk-3-0.dll


My Path variable:
C:\Program Files\PC Connectivity 
Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program 
Files\ATI 
Technologies\ATI.ACE;C:\D\dmd2\windows\bin;C:\D\dm\bin;C:\Documents 
and Settings\Tomas\Application 
Data\Dashlane\bin\Firefox_Extension\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\components;C:\Program 
Files\GTK3\bin


GTK_BASEPATH variable:

C:\Program Files\GTK3\bin

can someone help me?




Did you install Gtk+ 3 runtime libraries for Windows?

Gtk+3:
http://gtkd-packages.googlecode.com/files/gtk3-runtime_3.6.1_32-bit.exe
http://gtkd-packages.googlecode.com/files/gtk3-runtime_3.6.1_64-bit.exe

Gtk+2:
http://gtkd-packages.googlecode.com/files/gtk2-runtime_2.24.10_32-bit.exe

Regards,


I installed all in one bundle.


Re: gtkD problem

2013-01-28 Thread SaltySugar

On Monday, 28 January 2013 at 13:20:31 UTC, SaltySugar wrote:

On Monday, 28 January 2013 at 13:15:09 UTC, Jordi Sayol wrote:

Al 28/01/13 13:43, En/na SaltySugar ha escrit:
I have one problem. I compiled gtkD ad my first program 
successfully but when I try to run my program it shows:


C:\appshello
object.Exception@..\src\gtkc\Loader.d(123): Library load 
failed: libgtk-3-0.dll


My Path variable:
C:\Program Files\PC Connectivity 
Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program 
Files\ATI 
Technologies\ATI.ACE;C:\D\dmd2\windows\bin;C:\D\dm\bin;C:\Documents 
and Settings\Tomas\Application 
Data\Dashlane\bin\Firefox_Extension\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\components;C:\Program 
Files\GTK3\bin


GTK_BASEPATH variable:

C:\Program Files\GTK3\bin

can someone help me?




Did you install Gtk+ 3 runtime libraries for Windows?

Gtk+3:
http://gtkd-packages.googlecode.com/files/gtk3-runtime_3.6.1_32-bit.exe
http://gtkd-packages.googlecode.com/files/gtk3-runtime_3.6.1_64-bit.exe

Gtk+2:
http://gtkd-packages.googlecode.com/files/gtk2-runtime_2.24.10_32-bit.exe

Regards,


I installed all in one bundle.


I installed GTK+ 3 developer tools and GTK+3 runtime.


Re: gtkD problem

2013-01-28 Thread SaltySugar

On Monday, 28 January 2013 at 19:20:00 UTC, Mike Wey wrote:

On 01/28/2013 03:08 PM, SaltySugar wrote:

On Monday, 28 January 2013 at 13:20:31 UTC, SaltySugar wrote:

On Monday, 28 January 2013 at 13:15:09 UTC, Jordi Sayol wrote:

Al 28/01/13 13:43, En/na SaltySugar ha escrit:
I have one problem. I compiled gtkD ad my first program 
successfully

but when I try to run my program it shows:

C:\appshello
object.Exception@..\src\gtkc\Loader.d(123): Library load 
failed:

libgtk-3-0.dll

My Path variable:
C:\Program Files\PC Connectivity
Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
Files\ATI
Technologies\ATI.ACE;C:\D\dmd2\windows\bin;C:\D\dm\bin;C:\Documents
and Settings\Tomas\Application
Data\Dashlane\bin\Firefox_Extension\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\components;C:\Program
Files\GTK3\bin

GTK_BASEPATH variable:

C:\Program Files\GTK3\bin

can someone help me?




Did you install Gtk+ 3 runtime libraries for Windows?

Gtk+3:
http://gtkd-packages.googlecode.com/files/gtk3-runtime_3.6.1_32-bit.exe
http://gtkd-packages.googlecode.com/files/gtk3-runtime_3.6.1_64-bit.exe

Gtk+2:
http://gtkd-packages.googlecode.com/files/gtk2-runtime_2.24.10_32-bit.exe


Regards,


I installed all in one bundle.


I installed GTK+ 3 developer tools and GTK+3 runtime.



There seems to be a small bug in the code so that it fails is 
the GTK_BASEPATH doesn't end with a backslash, you can either 
add it to the GTK_BASEPATH, or remove the GTK_BASEPATH 
environment variable completely.


If that doesn't work could you tell us exactly which installer 
you used?


Libgtk-3-0.dll exists. I can find it on my system. Also I can run 
gtk3-demo.exe on C:/Program Files/GTK3/bin.I downloaded 
unofficial installer from there: www.tarnyko.net/en/?q=node/20


Also, I tried run my program with this runtime:

http://gtkd-packages.googlecode.com/files/gtk3-runtime_3.6.1_32-bit.exe


Re: gtkD problem

2013-01-28 Thread SaltySugar

On Monday, 28 January 2013 at 21:50:24 UTC, Mike Wey wrote:

On Monday, 28 January 2013 at 19:20:00 UTC, Mike Wey wrote:
There seems to be a small bug in the code so that it fails is 
the
GTK_BASEPATH doesn't end with a backslash, you can either add 
it to
the GTK_BASEPATH, or remove the GTK_BASEPATH environment 
variable

completely.


Fixed in git: 
https://github.com/gtkd-developers/GtkD/commit/7e54919287cc7810aed7af27b5371551a3abd9cd


Ok, I'll try It. So, I must to replace old gtkD with this one?