Re: Mysql-native - full database backup

2017-01-05 Thread Geert via Digitalmars-d-learn

On Thursday, 5 January 2017 at 21:47:55 UTC, Daniel Kozák wrote:
Geert via Digitalmars-d-learn 
<digitalmars-d-learn@puremagic.com> napsal Čt, led 5, 2017 v 
3∶13 :

[...]


[...]


Nice function. Thanks!


Mysql-native - full database backup

2017-01-02 Thread Geert via Digitalmars-d-learn

Hi!

How can i create a full database backup using mysql-native for D?

https://github.com/mysql-d/mysql-native


Thanks!


Re: Forum for new programmers in spanish.

2016-09-19 Thread Geert via Digitalmars-d-learn

On Monday, 19 September 2016 at 10:10:18 UTC, Seb wrote:


I don't speak Spanish, but I do like your idea of bringing D to 
more people :)

Two ideas:

1) You could help to translate the DLang Tour to Spanish:

https://tour.dlang.org
https://github.com/dlang-tour/spanish

2) StackOverflow has an excellent PageRank and thus many 
communities are moving there discussions over as it helps to 
increase their visibility and searchability. I don't know how 
good the spanish StackOverflow is, but it might be easier than 
maintaining a forum yourself?



Thanks Seb. I'll look at the DLang Tour.

On the other hand, i think a forum will be better, not only to 
help, but also to keep D programmers closer and expectant for 
news. Although, you are right, StackOverflow would be better to 
increase searchability and easier than maintaining a forum. I'll 
keep that in mind before taking a decision. Thanks!


Forum for new programmers in spanish.

2016-09-19 Thread Geert via Digitalmars-d-learn

Hi all!

I'm a PHP programmer, and i've been searching for new languages 
to learn. I think D it's the best of the newest languages, due 
its good documentation, clean sintaxis (or less verbose), and the 
applications developed in D run fast. I've read a D application 
could run as fast as one devoloped in C++ if it's well optimized 
(this is what interests me most).


I think D has a good community wich is constantly growing. But i 
have not found good resources of it in my native language: 
spanish. It is for this reason that i was thinking on developing 
a D spanish forum in my own server, to help new programmers who 
don't speak english. I think a divided community takes longer to 
reach a target, and that is not my intention. I would like anyone 
who speaks english stays and make contributions here.



What do you think about it?


Re: Embed glade file into a binary

2016-09-17 Thread Geert via Digitalmars-d-learn
On Saturday, 17 September 2016 at 19:07:33 UTC, Lodovico Giaretta 
wrote:


addFromFile expects the *name* of the file. Because you already 
have the *contents* of the file, you should change method. 
Maybe addFromString is the correct one, but I'm not sure.



"g.addFromString(fileContent);"

It works now. Thanks Lodovico and llmp!


Re: Embed glade file into a binary

2016-09-17 Thread Geert via Digitalmars-d-learn

On Saturday, 17 September 2016 at 18:36:52 UTC, llmp wrote:

On Saturday, 17 September 2016 at 18:18:37 UTC, Geert wrote:
I've compiled a small application, and it runs when i execute 
it at the same directory where is the glade file.


Is there a way to embed a glade file into a binary?


enum fileContent = import(file);

fileContent is a static array of ubyte.
the compiler must know the path to "file" via -J"dir/subdir"




Thanks!
I've just tried that, but i get an error message with the xml 
file content, and this at the end:


// More XML here...

True
True
True
  
  
True
True
2
  

  
  
True
True
6
  

  

  

': File name too long

// End of message.




This is part of the application code:

public import gtk.Main;
import gtk.TreeIter, gtk.TreeModel, gtk.TreeModelIF;
import std.concurrency, core.thread, std.math, std.parallelism;
import modelo, extra;

enum fileContent = import("vista.glade");

// More code here ...


class Vista{
private:
Window window;
string gladefile = "vista.glade";
Modelo obj_model = new Modelo();

public:
Button btn_exit;
Button btn_format;
ComboBoxList cbo_list;
Switch swi_bnivel;
Label lbl_info;
Entry txt_et;
int test_val = 3;

//this(){ } // constructor

void init_ui(){
Builder g = new Builder();
g.addFromFile(fileContent);

window = cast(Window)g.getObject("Win_01");
}

// More code here ...
}

// Compile command:
// ldc -w -disable-linker-strip-dead -deps=txt_deps.txt  main.d 
extra.d vista.d modelo.d X.d Xlib.d 
-J="/home/directory_glade_file_path/" -L-lX11 `pkg-config 
--cflags --libs gtkd-3`




Embed glade file into a binary

2016-09-17 Thread Geert via Digitalmars-d-learn
I've compiled a small application, and it runs when i execute it 
at the same directory where is the glade file.


Is there a way to embed a glade file into a binary?


Re: Mysql-native with LAMPP

2016-09-12 Thread Geert via Digitalmars-d-learn
On Monday, 12 September 2016 at 15:02:50 UTC, Martin Krejcirik 
wrote:

# netstat -npl | grep mysql

unix  2  [ ACC ] STREAM LISTENING 239449   
6293/mysqld  /opt/lampp/var/mysql/mysql.sock


Mysql defaults to unix socket, you need to add 
bind-address=127.0.0.1 to my.cnf [mysqld] section.


That didn't work, but thanks anyway.

Now is working. I had to comment "skip-networking":

# The MySQL server
[mysqld]
user = mysql
port=3306
socket  = /opt/lampp/var/mysql/mysql.sock
skip-external-locking
#bind-address=127.0.0.1


# Don't listen on a TCP/IP port at all. This can be a security 
enhancement,
# if all processes that need to connect to mysqld run on the same 
host.
# All interaction with mysqld must be made via Unix sockets or 
named pipes.
# Note that using this option without enabling named pipes on 
Windows

# (via the "enable-named-pipe" option) will render mysqld useless!
#
#commented in by xampp security

#skip-networking


Re: Mysql-native with LAMPP

2016-09-12 Thread Geert via Digitalmars-d-learn

On Monday, 12 September 2016 at 14:00:18 UTC, Daniel Kozak wrote:
And are you sure it is using tcp4 socket on port 3306? You can 
use netstat -tlnp  to see if is running on tcpv4 3306





I get nothing with TCP option, only when i run this command:

# netstat -npl | grep mysql

unix  2  [ ACC ] STREAM LISTENING 239449   
6293/mysqld  /opt/lampp/var/mysql/mysql.sock




Re: Mysql-native with LAMPP

2016-09-12 Thread Geert via Digitalmars-d-learn

On Monday, 12 September 2016 at 09:59:30 UTC, wobbles wrote:

On Monday, 12 September 2016 at 05:31:46 UTC, Geert wrote:

Hi all!

I tried the client driver for MySQL/MariaDB "mysql-native".

https://github.com/mysql-d/mysql-native

Everything works well with an individually installed version 
of MySql. But I would like to know if there is a way to make D 
programms work with LAMPP/XAMPP. I'm getting this error 
message while executing the program:


host=localhost;port=3306;user=root;pwd=MY_testPa550;db=testdb
Failed: 
std.socket.SocketOSException@/build/ldc/src/ldc/runtime/phobos/std/socket.d(2822): Unable to connect socket: Connection refused


You're sure mysql is running?


Yes, it's running. I started it with LAMPP, and i can access to 
the database through phpMyAdmin.


Mysql-native with LAMPP

2016-09-11 Thread Geert via Digitalmars-d-learn

Hi all!

I tried the client driver for MySQL/MariaDB "mysql-native".

https://github.com/mysql-d/mysql-native

Everything works well with an individually installed version of 
MySql. But I would like to know if there is a way to make D 
programms work with LAMPP/XAMPP. I'm getting this error message 
while executing the program:


host=localhost;port=3306;user=root;pwd=MY_testPa550;db=testdb
Failed: 
std.socket.SocketOSException@/build/ldc/src/ldc/runtime/phobos/std/socket.d(2822): Unable to connect socket: Connection refused




Re: Error while compiling and linking modules (mysql)

2016-09-11 Thread Geert via Digitalmars-d-learn

On Sunday, 11 September 2016 at 21:43:12 UTC, Geert wrote:

Hi!


I'm using a mysql wrapper (i don't even know how to use it yet) 
that i got from github:


https://github.com/adamdruppe/arsd


When i try to compile the code i get an error message:

Error: module mysql is in file 'mysql.d' which cannot be read


This is the folder structure i have:

/home/test/main.d
/home/test/arsd/mysql.d
/home/test/arsd/database.d

And the compile command:
ldc  main.d mysql.d database.d -I/home/test/arsd/


The main file contains a few lines just to test:

module compiling_test;
import arsd.mysql;
import arsd.database;


int main(string[] args) {


return 0;
}



I was passing the wrong paths. Te correct compile command is:

ldc  main.d arsd/mysql.d arsd/database.d 
-I/home/marduk/Proyectos/gtkd/sql/arsd


Error while compiling and linking modules (mysql)

2016-09-11 Thread Geert via Digitalmars-d-learn

Hi!


I'm using a mysql wrapper (i don't even know how to use it yet) 
that i got from github:


https://github.com/adamdruppe/arsd


When i try to compile the code i get an error message:

Error: module mysql is in file 'mysql.d' which cannot be read


This is the folder structure i have:

/home/test/main.d
/home/test/arsd/mysql.d
/home/test/arsd/database.d

And the compile command:
ldc  main.d mysql.d database.d -I/home/test/arsd/


The main file contains a few lines just to test:

module compiling_test;
import arsd.mysql;
import arsd.database;


int main(string[] args) {


return 0;
}



Re: std.process spawnShell/pipeShell dont capture output of the shell

2016-09-10 Thread Geert via Digitalmars-d-learn
I'm sorry for the "necro-bumping", but I've not found the 
solution for this yet, and i'm getting a different error message 
at the execution moment:


"std.stdio.StdioException@/build/ldc/src/ldc/runtime/phobos/std/stdio.d(4066): Bad 
file descriptor"


This is my testing code:



module dd_test;

import std.stdio, core.stdc.stdlib;
import std.process, std.string;

int main(string[] args) {

string command_find = "(find /usr/share/icons/ -name a*) ";
//string command_dd = "(dd if=/dev/urandom | pv -ptrbef -i 2 
-s 2339876653 | dd of=/dev/null) 2>&1";


auto p = pipeShell(command_find, Redirect.all);

foreach(str; p.stdin.byLine){
writefln("IN: %s", str);
}

foreach(str; p.stdout.byLine){
writefln("OUT: %s", str);
}

foreach(str; p.stderr.byLine){
writefln("Error: %s", str);
}

return 0;
}



Re: [GtkD] How to connect to notify::active signal?

2016-09-08 Thread Geert via Digitalmars-d-learn

On Saturday, 4 May 2013 at 09:59:12 UTC, Mike Wey wrote:

On 05/04/2013 05:20 AM, Alexandr Druzhinin wrote:

04.05.2013 1:18, Mike Wey пишет:

On 05/03/2013 06:30 PM, Alexandr Druzhinin wrote:
I need to connect to "notify::active" signal for Switch 
widget to
process changing of its state. The guides say I shouldn't 
use onActivate
signal, but "notify:active". But I didn't find a way to do 
it. Can

somebody help with it?


Are you referring to gtk.Switch ?


yes, gtk.Switch
if I connect to activate signal by means addOnActivate nothing 
works.
Documentation says I should use "notify::active" event (it 
belongs to
ObjectG, as I understand?), but I cannot find a way to connect 
to this

signal by means of GtkD.


You can use addOnNotify it currently doesn't allow you to 
specify the property for witch you want to receive the signal 
(it probably should).


For now you could do:

Switch sw = new Switch();
sw.addOnNotify();

void notify(ParamSpec param, ObjectG obj)
{
if(param.getName() == "active")
{
//Do stuff
}
}




Hi!

I would like to share a small example of this:



module gtkd_switch;
// Compile: ldc -w  main.d  `pkg-config --cflags --libs gtkd-3`

import std.stdio;
import gtk.Builder;
import gtk.Main, gtk.Window, gtk.Switch, gtk.Widget;
import gobject.ObjectG ,gobject.ParamSpec;


void on_swt_change(ParamSpec param, ObjectG obj, Switch 
*obj_switch){

bool state = obj_switch.getActive();
writefln("Changed! %b", state);
}

void main(string[] args) {
Main.init(args);

Builder g = new Builder();
g.addFromFile("vista.glade");

// Widgets from glade file "vista.glade":
Window w = cast(Window)g.getObject("window1");
w.setDefaultSize(320, 80);
w.setTitle("Gtkd Switch addOnNotify");
Switch swt = cast(Switch)g.getObject("swt_test");

// Actions:
w.addOnHide( delegate void(Widget aux){ Main.quit(); } );
swt.addOnNotify(delegate void (ParamSpec, 
ObjectG){on_swt_change(ParamSpec, ObjectG, );}, "active");


w.showAll();
Main.run();
}