Re: Is there anybody who used FireBird DB?

2016-03-15 Thread Suliman via Digitalmars-d-learn
On Tuesday, 15 March 2016 at 15:01:09 UTC, Kagamin wrote: The same as you would do it in C. I do not know C :( Please explain me what i should to do with this binding

Is there anybody who used FireBird DB?

2016-03-15 Thread Suliman via Digitalmars-d-learn
For my regret I need way to work with FireBird. I have found only one driver for D https://github.com/jiorhub/fired Before I did not work with C-bindigs and D. So I can't understand how to use this files. Could anybody help and explain how to work with it?

Why file.exists of relative path on Linux always return false?

2016-02-29 Thread Suliman via Digitalmars-d-learn
I am trying to check relative path on Linux for exists. import std.stdio; import std.path; import std.file; import std.string; string mypath = "~/Documents/imgs"; void main() { if(!mypath.exists) { writeln(mypath, " do not exists"); }

Re: Am I right understand the dub.json system?

2016-02-29 Thread Suliman via Digitalmars-d-learn
On Monday, 29 February 2016 at 13:10:36 UTC, Edwin van Leeuwen wrote: On Monday, 29 February 2016 at 12:45:36 UTC, Suliman wrote: On Monday, 29 February 2016 at 12:34:02 UTC, Edwin van Leeuwen wrote: Should it be like this? http://www.everfall.com/paste/id.php?80k9jsgdx6o3 "versions":

Re: Am I right understand the dub.json system?

2016-02-29 Thread Suliman via Digitalmars-d-learn
On Monday, 29 February 2016 at 12:34:02 UTC, Edwin van Leeuwen wrote: On Monday, 29 February 2016 at 12:27:04 UTC, Suliman wrote: For example I have got app that depended on DDBC. In configuration section DDBC related on: "libs-posix": [ "sqlite3", "pq" ] Does it's mean that it will try to

Am I right understand the dub.json system?

2016-02-29 Thread Suliman via Digitalmars-d-learn
For example I have got app that depended on DDBC. In configuration section DDBC related on: "libs-posix": [ "sqlite3", "pq" ] Does it's mean that it will try to find this 2 libs in any case? Even I do not use them. If I do not need them what I should to do? Fix ~/.dub/packages/ddbc and

/usr/bin/ld: cannot find -levent_pthreads

2016-02-29 Thread Suliman via Digitalmars-d-learn
I have never tried to build my code on Linux (Ubuntu). Now I have error: /usr/bin/ld: cannot find -levent /usr/bin/ld: cannot find -levent_pthreads Where I can get this lib?

Why .length on Windows is int and on Linux is ulong?

2016-02-29 Thread Suliman via Digitalmars-d-learn
On Windows next code work fine: int len = fullimgurl.length; On Linux DMD get error that: Error: cannot implicitly convert expression (fullimgurl.length) of type ulong to int Why on every OS length have different size?

Re: How to better organize dub project to get 3 exe from same codebase?

2016-02-27 Thread Suliman via Digitalmars-d-learn
What I am doing wrong? http://img.ctrlv.in/img/16/02/27/56d1aae37b77a.png

Re: How to better organize dub project to get 3 exe from same codebase?

2016-02-25 Thread Suliman via Digitalmars-d-learn
On Thursday, 25 February 2016 at 19:09:59 UTC, Suliman wrote: Where to store shared classes? { "name": "123", "authors": [ "Suliman" ], "description": "A minimal D application.", "copyright": "Copyright © 2016, Suliman",

Re: How to better organize dub project to get 3 exe from same codebase?

2016-02-25 Thread Suliman via Digitalmars-d-learn
Where to store shared classes?

How to better organize dub project to get 3 exe from same codebase?

2016-02-25 Thread Suliman via Digitalmars-d-learn
I have got 3 small projects that have shared code base. At compile time they use few same classes. On runtime they use same config file. How to better to organize work with dub?

Re: What is the best way to stop App after exception?

2016-02-15 Thread Suliman via Digitalmars-d-learn
On Monday, 15 February 2016 at 15:17:01 UTC, tcak wrote: On Monday, 15 February 2016 at 11:38:05 UTC, Suliman wrote: I have got class Config with method parseconfig. I need terminate App if parsing of config was failed. The problem that I do not know how to do it better. void parseconfig() {

What is the best way to stop App after exception?

2016-02-15 Thread Suliman via Digitalmars-d-learn
I have got class Config with method parseconfig. I need terminate App if parsing of config was failed. The problem that I do not know how to do it better. void parseconfig() { try { //something go wrong } catch(Exception e) { writeln(e.msg); // throw any exception here } } But my

Re: why mkdir can't create tree of dirs?

2016-02-10 Thread Suliman via Digitalmars-d-learn
On Tuesday, 9 February 2016 at 23:23:10 UTC, Jonathan M Davis wrote: On Tuesday, February 09, 2016 20:20:59 Suliman via Digitalmars-d-learn wrote: It's look like that I can only create one nesting level sub folder, for example there is exists dir: D:\foo I can't create dir D:\foo\bar\baz I can

why mkdir can't create tree of dirs?

2016-02-09 Thread Suliman via Digitalmars-d-learn
It's look like that I can only create one nesting level sub folder, for example there is exists dir: D:\foo I can't create dir D:\foo\bar\baz I can only create D:\foo\bar D:\foo\bar Is it's rational limit or it is bug? Here is error when I tried to folder in folder thet do not exists. It's

Re: Proper Use of Assert and Enforce

2016-02-05 Thread Suliman via Digitalmars-d-learn
It is purely a way to make throwing an exception use a syntax similar to assert and save a line of code. if(!condition) throw new Exception(msg); becomes enforce(condition, msg); So enforce is just macros on top of: if(!condition) throw new Exception(msg); ?

Re: Proper Use of Assert and Enforce

2016-02-05 Thread Suliman via Digitalmars-d-learn
On Friday, 5 February 2016 at 08:45:00 UTC, Minas Mina wrote: On Wednesday, 14 March 2012 at 05:44:24 UTC, Chris Pons wrote: I'm new, and trying to incorporate assert and enforce into my program properly. My question revolves around, the fact that assert is only evaluated when using the

Error: no property 'select' for type 'ddbc.core.Statement'

2016-01-31 Thread Suliman via Digitalmars-d-learn
I hope that here I will get answer faster then on https://github.com/buggins/ddbc/issues/18 I am using ddbc diver for access to mysql. I need to return result of request to struct. My code is next: import std.stdio; import ddbc.all; import std.stdio; import std.conv; void main() {

How to build dfmt?

2016-01-01 Thread Suliman via Digitalmars-d-learn
https://github.com/Hackerpilot/dfmt After run build.bat nothing do not happens. How can I build it?

How to replace inside regex?

2015-12-17 Thread Suliman via Digitalmars-d-learn
I can't understand how to replace in regex. I have got next task: find all commas in strings inside quotes and replace them. foo, bar, "hello, user", baz I wrote next regexp that find part that include commas inside the quotes: auto partWithComma = matchAll(line, r); but I can't understand

Why `i` not working on foreach loop if it have byLine option

2015-12-17 Thread Suliman via Digitalmars-d-learn
Next code produce error: foreach(i, line;fileContent.byLine) Error: cannot infer argument types, expected 1 argument, not 2 Why it's do not work?

Re: How to check if result of request to DB is empty?

2015-12-12 Thread Suliman via Digitalmars-d-learn
it's seems that next block is execute even if is rs.next() is false: writeln("rs.next()-->", rs.next()); if(!rs.next()) //if user do not in DB { // is execute even if rs.next() is false writeln("Executed, but rs.nst was set to false"); } The output: rs.next()-->false Executed, but rs.nst was

Re: How to check if result of request to DB is empty?

2015-12-12 Thread Suliman via Digitalmars-d-learn
On Saturday, 12 December 2015 at 12:36:10 UTC, Suliman wrote: On Saturday, 12 December 2015 at 12:14:30 UTC, Vadim Lopatin wrote: On Saturday, 12 December 2015 at 12:06:21 UTC, Suliman wrote: On Saturday, 12 December 2015 at 11:53:51 UTC, Suliman wrote: On Saturday, 12 December 2015 at

Re: How to check if result of request to DB is empty?

2015-12-12 Thread Suliman via Digitalmars-d-learn
On Saturday, 12 December 2015 at 10:36:12 UTC, drug wrote: 12.12.2015 13:28, Suliman пишет: it's seems that next block is execute even if is rs.next() is false: writeln("rs.next()-->", rs.next()); if(!rs.next()) //if user do not in DB { // is execute even if rs.next() is false

Re: How to check if result of request to DB is empty?

2015-12-12 Thread Suliman via Digitalmars-d-learn
On Saturday, 12 December 2015 at 11:31:18 UTC, Suliman wrote: Oh sorry! I used wrong host! All ok! Yes, there was issue with host name, but it's do not solve problem. Second DB have same fields and I still getting false instead moving into while loop

Re: How to check if result of request to DB is empty?

2015-12-12 Thread Suliman via Digitalmars-d-learn
On Saturday, 12 December 2015 at 13:18:12 UTC, anonymous wrote: On 12.12.2015 08:44, Suliman wrote: string query_string = (`SELECT user, password FROM otest.myusers where user LIKE ` ~ `'%` ~ request["username"].to!string ~ `%';`); Don't piece queries together without escaping the dynamic

Re: How to check if result of request to DB is empty?

2015-12-12 Thread Suliman via Digitalmars-d-learn
On Saturday, 12 December 2015 at 12:14:30 UTC, Vadim Lopatin wrote: On Saturday, 12 December 2015 at 12:06:21 UTC, Suliman wrote: On Saturday, 12 December 2015 at 11:53:51 UTC, Suliman wrote: On Saturday, 12 December 2015 at 11:31:18 UTC, Suliman wrote: Oh sorry! I used wrong host! All ok!

Re: How to check if result of request to DB is empty?

2015-12-12 Thread Suliman via Digitalmars-d-learn
On Saturday, 12 December 2015 at 12:43:36 UTC, Suliman wrote: On Saturday, 12 December 2015 at 12:36:10 UTC, Suliman wrote: On Saturday, 12 December 2015 at 12:14:30 UTC, Vadim Lopatin wrote: On Saturday, 12 December 2015 at 12:06:21 UTC, Suliman wrote: On Saturday, 12 December 2015 at

Re: How to check if result of request to DB is empty?

2015-12-12 Thread Suliman via Digitalmars-d-learn
Oh sorry! I used wrong host! All ok!

Re: How to check if result of request to DB is empty?

2015-12-12 Thread Suliman via Digitalmars-d-learn
On Saturday, 12 December 2015 at 11:53:51 UTC, Suliman wrote: On Saturday, 12 December 2015 at 11:31:18 UTC, Suliman wrote: Oh sorry! I used wrong host! All ok! Yes, there was issue with host name, but it's do not solve problem. Second DB have same fields and I still getting false instead

How to check if result of request to DB is empty?

2015-12-11 Thread Suliman via Digitalmars-d-learn
I am using https://github.com/buggins/ddbc string query_string = (`SELECT user, password FROM otest.myusers where user LIKE ` ~ `'%` ~ request["username"].to!string ~ `%';`); auto rs = db.stmt.executeQuery(query_string); string dbpassword; string dbuser; while

Re: How to check if result of request to DB is empty?

2015-12-11 Thread Suliman via Digitalmars-d-learn
string query_string = (`SELECT user, password FROM otest.myusers where user LIKE ` ~ `'%` ~ request["username"].to!string ~ `%';`); Don't piece queries together without escaping the dynamic parts. Imagine what happens when the user enters an apostrophe in the username field. Do you mean to

Re: check variable for undefinedness

2015-12-11 Thread Suliman via Digitalmars-d-learn
if(a is null) How to check if variable "is not null" ?

How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
Vibed have method get for user session http://vibed.org/api/vibe.http.session/SessionStore I set user name for session like this: req.session.set("username", "admin"); But I can't understand how to get user name from it: abstract std.variant.VariantN!(20) get( string id, string name,

Re: How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
On Thursday, 10 December 2015 at 12:30:51 UTC, Suliman wrote: On Thursday, 10 December 2015 at 12:21:40 UTC, Adrian Matoga wrote: On Thursday, 10 December 2015 at 11:36:20 UTC, Suliman wrote: Vibed have method get for user session http://vibed.org/api/vibe.http.session/SessionStore I set

Re: How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
On Thursday, 10 December 2015 at 13:34:02 UTC, Mike Parker wrote: On Thursday, 10 December 2015 at 13:23:29 UTC, Suliman wrote: But question about why I need to get session info like: writeln("USER Session: ", req.session.get!string("username")); is still actual. When you have a template

Re: How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
On Thursday, 10 December 2015 at 12:21:40 UTC, Adrian Matoga wrote: On Thursday, 10 December 2015 at 11:36:20 UTC, Suliman wrote: Vibed have method get for user session http://vibed.org/api/vibe.http.session/SessionStore I set user name for session like this: req.session.set("username",

Re: How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
On Thursday, 10 December 2015 at 13:43:58 UTC, Suliman wrote: On Thursday, 10 December 2015 at 13:34:02 UTC, Mike Parker wrote: On Thursday, 10 December 2015 at 13:23:29 UTC, Suliman wrote: But question about why I need to get session info like: writeln("USER Session: ",

Re: How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
Oh, my issue. Right variant of setting session is: if(dbuser == "admin") // admin name hardcoded { _auth.isAuthorizated = true; req.session.set("username", "admin"); } else { req.session.set("username", dbuser); //set current username in parameter of

How to check session before access to static page?

2015-12-03 Thread Suliman via Digitalmars-d-learn
void main() { auto router = new URLRouter; router.get("/", serveStaticFiles("D:\\code\\onlineTest\\index.html")); router.get("/admin", serveStaticFiles("D:\\code\\onlineTest\\admin.html")); router.any("/foo", ); auto settings = new HTTPServerSettings; settings.port =

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Suliman via Digitalmars-d-learn
And the second question. Why I am getting next error after attempt to write to console JSON request: Error: cannot resolve type for res.writeJsonBody(T)(T data int status = HTTPStatus.OK, string content_type = "application/json; charset=UF-8", bool allow_chunked = false) void

Can't understand how to do server response with vibed

2015-11-28 Thread Suliman via Digitalmars-d-learn
Could anybody help me to understand how to complete HTTP response with vibed. I am sending POST request from AngularJS: $.post("http://127.0.0.1:8080/my;, total_result); where total_result is JSON string: [{"QID":3,"AID":3}, {"SubAID":[4]}, {"MinArea":"10","MaxArea":"90"}] Handler is look

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Suliman via Digitalmars-d-learn
On Saturday, 28 November 2015 at 18:46:05 UTC, Suliman wrote: And the second question. Why I am getting next error after attempt to write to console JSON request: Error: cannot resolve type for res.writeJsonBody(T)(T data int status = HTTPStatus.OK, string content_type = "application/json;

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Suliman via Digitalmars-d-learn
And also I can't understand difference between HTTPClientRequest and HTTPServerRequest For example if I am getting request from web-browser what I should use? And why?

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Suliman via Digitalmars-d-learn
void action(HTTPServerRequest req, HTTPServerResponse res) { } Here is function what have two call-backs. When it's get request it's work as server, when it's send response it's work like client or I have wrong logic?

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Suliman via Digitalmars-d-learn
On Saturday, 28 November 2015 at 18:57:53 UTC, anonymous wrote: On 28.11.2015 19:51, Suliman wrote: Eghm, sorry. Not req, but res, but again errr: void action(HTTPServerRequest req, HTTPServerResponse res) { writeln(req.writeJsonBody); } Error: no property 'writeJsonBody' for type

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Suliman via Digitalmars-d-learn
On Saturday, 28 November 2015 at 23:21:21 UTC, Sebastiaan Koppe wrote: On Saturday, 28 November 2015 at 19:05:59 UTC, Suliman wrote: And also I can't understand difference between HTTPClientRequest and HTTPServerRequest If the application (vibe.d) makes a request, it is the client. If the

Re: Why my app require MSVCR120.dll?

2015-11-07 Thread Suliman via Digitalmars-d-learn
On Friday, 6 November 2015 at 18:39:49 UTC, ponce wrote: On Friday, 6 November 2015 at 13:16:46 UTC, Suliman wrote: I wrote Application in D. That use next components: "colorize": ">=1.0.5", "ddbc": ">=0.2.11", "vibe-d": "~>0.7.26" On Windows 7 it's work fine. On Windows 10 (clean install)

Re: Why my app require MSVCR120.dll?

2015-11-07 Thread suliman via Digitalmars-d-learn
On Sunday, 8 November 2015 at 04:50:49 UTC, thedeemon wrote: On Saturday, 7 November 2015 at 10:03:58 UTC, Suliman wrote: I am using DMD. -m64 or -m32mscoff ? Without any keys. I use dub for building

Re: Why my app require MSVCR120.dll?

2015-11-06 Thread Suliman via Digitalmars-d-learn
On Friday, 6 November 2015 at 13:50:56 UTC, Kagamin wrote: MSVCR is a C runtime. On Linux it will depend on a C runtime too. But which part of my App depend on C runtime?

Why my app require MSVCR120.dll?

2015-11-06 Thread Suliman via Digitalmars-d-learn
I wrote Application in D. That use next components: "colorize": ">=1.0.5", "ddbc": ">=0.2.11", "vibe-d": "~>0.7.26" On Windows 7 it's work fine. On Windows 10 (clean install) it's do not start and require MSVCR120.dll And I can't understand what component is pulling this lib as dependence.

Re: Curl, how to recieve data.

2015-10-18 Thread Suliman via Digitalmars-d-learn
On Sunday, 18 October 2015 at 18:04:53 UTC, holo wrote: I'm trying to receive data from curl request my sample code looks like that: ... auto client = HTTP(endpoint ~ "?" ~ canonicalQueryString); client.method = HTTP.Method.get;

Re: Why does File.byLine() return char[] and not string

2015-10-18 Thread Suliman via Digitalmars-d-learn
On Friday, 16 October 2015 at 12:43:59 UTC, Meta wrote: On Friday, 16 October 2015 at 10:38:52 UTC, Shriramana Sharma wrote: Is there a particular reason that File.byLine() returns char[] and not string i.e. immutable(char)[]? Is it just to avoid being overly restrictive? It seems that having

Re: Why does File.byLine() return char[] and not string

2015-10-18 Thread Suliman via Digitalmars-d-learn
On Sunday, 18 October 2015 at 15:40:09 UTC, novice2 wrote: what buffer you are talking. internal buffer. where result line resides. And what is "signal"? How it's working? just the fact for programmer, that result line can be changed by other code (by phobos library code in this case).

Re: Regarding std.array.Appender

2015-10-13 Thread Suliman via Digitalmars-d-learn
On Monday, 5 March 2012 at 15:35:59 UTC, Steven Schveighoffer wrote: On Wed, 29 Feb 2012 20:25:35 -0500, bearophile wrote: Do you know why std.array.Appender defines a "put" method instead of overloading the "~=" operator? It should (in addition to put). I see

Re: Regarding std.array.Appender

2015-10-13 Thread Suliman via Digitalmars-d-learn
On Tuesday, 13 October 2015 at 13:34:02 UTC, John Colvin wrote: On Tuesday, 13 October 2015 at 13:21:54 UTC, Suliman wrote: I tried to use map! but it's look like it do not work with string, becouse I got error: Error: no property 'map' for type 'ByLine!(char, char)' I suspect you don't have

Re: Regarding std.array.Appender

2015-10-13 Thread Suliman via Digitalmars-d-learn
I tried to use map! but it's look like it do not work with string, becouse I got error: Error: no property 'map' for type 'ByLine!(char, char)'

Re: Regarding std.array.Appender

2015-10-13 Thread Suliman via Digitalmars-d-learn
something like: auto content = file.byLine.map!("start " ~ a=>a ~ " end");

Re: Regarding std.array.Appender

2015-10-13 Thread Suliman via Digitalmars-d-learn
On Tuesday, 13 October 2015 at 13:55:07 UTC, anonymous wrote: On Tuesday 13 October 2015 15:47, Suliman wrote: something like: auto content = file.byLine.map!("start " ~ a=>a ~ " end"); That's not how it works at all. Maybe stick to the examples of whatever resource you're learning from,

Re: Regarding std.array.Appender

2015-10-13 Thread Suliman via Digitalmars-d-learn
On Tuesday, 13 October 2015 at 13:51:50 UTC, anonymous wrote: On Tuesday 13 October 2015 15:42, Suliman wrote: map!(a=> a~=" +") work fine, but how to add before at same time? Use ~ instead of ~=, like so: map!(a => "+" ~ a ~ "+") Thanks!

What difference between std.typecons.Tuple and std.meta.AliasSeq

2015-09-20 Thread Suliman via Digitalmars-d-learn
Sometimes it's hard to understand the D philosophy, for example now I can't understand diffrence between std.typecons.Tuple and std.meta.AliasSeq. I know that in language like Python there is spatial data type named tuple like: tup1 = ('physics', 'chemistry', 1997, 2000); But what in D? That

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread Suliman via Digitalmars-d-learn
On Saturday, 29 August 2015 at 16:55:44 UTC, cym13 wrote: On Saturday, 29 August 2015 at 16:47:23 UTC, Laeeth Isharc wrote: Align(1) ? That should do it, thanks :) Do not forget to post code example, please, it's interesting to look at your solution...

Infinity loop with dates comparison

2015-08-11 Thread Suliman via Digitalmars-d-learn
The code look very trivial, but I am getting infinity loop like: 2014-Aug-02 2014-Aug-02 2014-Aug-02 ... 2014-Aug-02 Date startDate = Date.fromISOExtString(2014-08-01); Date currentDate = to!(Date)(Clock.currTime()-1.days); //because current day is not finished writeln(startDate);

Customization of User Defined Logger

2015-07-19 Thread Suliman via Digitalmars-d-learn
When I try co compile next code: class MyCustomLogger : Logger { this(string newName, LogLevel lv) @safe { super(newName, lv); } override void writeLogMsg(ref LogEntry payload) { // log message in my custom way } } auto logger = new MyCustomLogger();

Serialization array of structure

2015-06-13 Thread Suliman via Digitalmars-d-learn
Look like I am doing serialization wrong way: struct DBFields { Date date; string tag; int popularity; } DBFields [] dbfields; DBFields dbfield; . dbfields ~= dbfield; writeln(serializeToJson(dbfields)); As result I am getting only first string.

Re: Serialization array of structure

2015-06-13 Thread Suliman via Digitalmars-d-learn
Oh, sorry, the error was in another place.

Re: What happens when you launch a D application ?

2015-05-23 Thread Suliman via Digitalmars-d-learn
Every D program is started as if it were a C program. Why is so necessary? What about C++ and other languages? Does they have more then one main? Why it's more than one main is needed? Why D apps can't start with single main?

What happens when you launch a D application ?

2015-05-22 Thread Suliman via Digitalmars-d-learn
On SO[1] I got next answer: What happens when you launch a D application ? The entry point is a C main inside the runtime, which initialize it (the runtime), including module constructor, run the unittest (if you've compiled with -unittest), then call your main (which name is _Dmain - useful

Re: What happens when you launch a D application ?

2015-05-22 Thread Suliman via Digitalmars-d-learn
Am I right understand that that: 1. every App start from main() 2. Dmain is function that run after main is started and it's run GC, unit-tests and so on?

Re: What happens when you launch a D application ?

2015-05-22 Thread Suliman via Digitalmars-d-learn
Really hard to understand... So what what would call at first ? extern(C) int main() or int _Dmain()

Re: ddbc: MySQL/MariaDB: Access Violation

2015-05-18 Thread Suliman via Digitalmars-d-learn
still can't get it's work :(

Re: ddbc: MySQL/MariaDB: Access Violation

2015-05-18 Thread Suliman via Digitalmars-d-learn
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION; p.s. this command return my: Affected rows: 0 Do you see some stack trace on crash? No. I checked on 2 PC and it's not look like my issue, because result is totally same. If I change void main() to

better code organization?

2015-05-17 Thread Suliman via Digitalmars-d-learn
I am writing in D server and client apps. Server is base on vibed. Server and client have some common code (example working with config class). How I can prevent code duplication? I can move config code to separate module, but how to link on it? server client modules --?? it it's good? or

ddbc: MySQL/MariaDB: Access Violation

2015-05-17 Thread Suliman via Digitalmars-d-learn
I am using this driver for access to MariaDB http://code.dlang.org/packages/ddbc The problem that it's work fine when it's used from desktop App, but when I try to run it's from vibed app i get Access Violation. In my.ini I added string: bind-address = 127.0.0.1 Also I run next command:

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread Suliman via Digitalmars-d-learn
Is next example is enough to serv simple index.html page? void setupServer() { auto router = new URLRouter; // add other routes here router.get(*, serveStaticFiles(public/)); auto settings = new HTTPServerSettings; listenHTTP(settings, router); } After

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread Suliman via Digitalmars-d-learn
You're not setting a port. add: settings.port = 8080; before listenHTTP(); then it'll work. It's do not help :(

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread Suliman via Digitalmars-d-learn
shared static this() { auto router = new URLRouter; router.get(/, root); auto settings = new HTTPServerSettings; settings.port = 8080; listenHTTP(settings, router); } void root(HTTPServerRequest req, HTTPServerResponse res) { serveStaticFiles(public/); }

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Suliman via Digitalmars-d-learn
I mean that I know that template can be changes dynamically, but I thought that 99% of dynamic is javascript code...

vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Suliman via Digitalmars-d-learn
By default vibed use Diet. Maybe it's cool, but for me it's easier to write in pure HTML. What is the best way to do it?

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Suliman via Digitalmars-d-learn
You want to serve html files instead of templates, right? It should be something like Yeah, I do not see any profits with using templates right now. Explain me if I am wrong.

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Suliman via Digitalmars-d-learn
auto html = someStringActions(); res.writeBody(cast(ubyte[])html); Thanks, but how to attach to html css file? Now page is loading, but do not handle css that also placed in this folder.

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Suliman via Digitalmars-d-learn
And how people write in jade if it's impossible to preview page without compiling it's to HTML?

Re: dub: Missing package description for package at ..\memutils\

2015-05-05 Thread Suliman via Digitalmars-d-learn
Updating DUB to git version helped. Latest release version have next issue https://github.com/D-Programming-Language/dub/issues/535

dub: Missing package description for package at ..\memutils\

2015-05-05 Thread Suliman via Digitalmars-d-learn
After some days of holidays I am back to home, and run my project. After it I got very strange error: dub Error executing command run: Missing package description for package at ..\memutils\ I really do not remember that I played with memutils or so. dub.json include only next dependences:

Trouble in converting C code to D

2015-04-12 Thread Suliman via Digitalmars-d-learn
So I got GDAL binding work. And now I need to understand how to translate C code to D. Here is simple tutorial: http://www.gdal.org/gdal_tutorial.html If I right understand it's easier to take C, than C++ code example. Now I am trying to get very simple example work. My code is: string

Re: Trouble in converting C code to D

2015-04-12 Thread Suliman via Digitalmars-d-learn
Oh in gdal.d there is comment: /* * The enum CPLErr is defined in the header file cpl_error.h. I have not * for the time being included a binding to that header, but have just * imported this single symbol from it. * * Similarly, GDALProgressFunc is defined in port/cpl_progress.h

Re: Trouble in converting C code to D

2015-04-12 Thread Suliman via Digitalmars-d-learn
Jacob, thanks! double [6] adfGeoTransform; if( GDALGetGeoTransform( hDataset, adfGeoTransform.ptr ) == 0 ) { writeln(adfGeoTransform[1]); } But could you explain why if binding have next string: enum CPLErr { CE_None = 0, CE_Debug = 1, CE_Warning = 2, CE_Failure =

Re: Trouble in converting C code to D

2015-04-12 Thread Suliman via Digitalmars-d-learn
On Sunday, 12 April 2015 at 09:36:54 UTC, Stefan Koch wrote: Do have you extern(C) everywhere ? Yes, at binding file. Here is a lot of string like: extern(C) CPLErr GDALGetGeoTransform( GDALDatasetH, double* );

Re: How to interface with C++ code or dll?

2015-04-09 Thread Suliman via Digitalmars-d-learn
http://stackoverflow.com/questions/29541229/d-how-to-use-binding-to-c-lib-with-d

Re: How to generate D binding with SWIG?

2015-04-06 Thread Suliman via Digitalmars-d-learn
some time ago I tried it, but without success http://forum.dlang.org/thread/hnlrhschfgumaxzgi...@forum.dlang.org

How to generate D binding with SWIG?

2015-04-06 Thread Suliman via Digitalmars-d-learn
I am still trying to get GDAL[1] work with D. I found tool for automatic binding generation it's named SWIG[2]. I looked at gdal binding examples, and look like all of them are automatically generated with SWIG. I am not sure, but possible binding is generation by one few lines, like is

How to POST data with net.curl

2015-04-02 Thread Suliman via Digitalmars-d-learn
I have next request, that work fine with curl: curl -X POST -F upload=@wgs84_latlon.zip http://ogre.adc4gis.com/convert I wrote next code: void main() { auto binfile = cast(ubyte[]) read(`D:\Apps\curl\wgs84_latlon.zip`); auto http = HTTP(http://ogre.adc4gis.com/convert;);

Re: How to avoid code duplication?

2015-04-01 Thread Suliman via Digitalmars-d-learn
Rikki, could you explain? I did not understand where it can help me

Re: How to avoid code duplication?

2015-04-01 Thread Suliman via Digitalmars-d-learn
Maybe there is way to access of element of archive in the same way as to txt file? I looked, but it's seems that constructor accept only path to file. But I can't understand how to set path to unpacked element of archive.

How to avoid code duplication?

2015-03-31 Thread Suliman via Digitalmars-d-learn
The situation is next: I have got the function that get arrays of lognames and logfullname: void loginsert(string [] lognames, string [] logfullname) { if(logfullname[i].endsWith(txt)) { auto file = File(logfullname[i], r); foreach (line;

Re: string concatenation with %s

2015-03-30 Thread Suliman via Digitalmars-d-learn
string sss = format(foo-, bar); It should be obvious now that you forgot to escape those double quotes. Thanks! Is there any way to stay string as is. without need of it's escaping and so on? It's seems I have seen something like it in docs, but I am not sure about it...

Re: string concatenation with %s

2015-03-30 Thread Suliman via Digitalmars-d-learn
same problem. I am preparing string to next SQL request: string sss = format(SELECT * FROM test.imgs WHERE src LIKE CONCAT('%', REPLACE(CAST(CURDATE()as char), -, ), '%') OR CONCAT('%', CAST(CURDATE()as char), '%')); but I am getting next error: source\app.d(178): Error: invalid array

Re: Text UI for D?

2015-03-20 Thread Suliman via Digitalmars-d-learn
On Friday, 20 March 2015 at 10:29:45 UTC, DLearner wrote: Does D have a recommended package for this - like (n)curses for C? http://stackoverflow.com/questions/29061809/tui-text-user-interface-for-d

Re: What is the best practice of organization multi-threading ?

2015-03-16 Thread Suliman via Digitalmars-d-learn
UP

<    1   2   3   4   5   >