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
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?
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");
}
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":
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
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
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?
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?
What I am doing wrong?
http://img.ctrlv.in/img/16/02/27/56d1aae37b77a.png
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",
Where to store shared classes?
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?
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()
{
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
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
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
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);
?
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
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()
{
https://github.com/Hackerpilot/dfmt
After run build.bat nothing do not happens. How can I build it?
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
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?
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
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
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
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
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
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!
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
Oh sorry! I used wrong host! All ok!
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
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
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
if(a is null)
How to check if variable "is not null" ?
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,
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
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
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",
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: ",
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
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 =
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
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
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;
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?
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?
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
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
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)
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
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?
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.
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;
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
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).
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
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
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)'
something like: auto content = file.byLine.map!("start " ~ a=>a ~
" end");
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,
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!
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
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...
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);
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();
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.
Oh, sorry, the error was in another place.
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?
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
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?
Really hard to understand...
So what what would call at first ?
extern(C) int main()
or
int _Dmain()
still can't get it's work :(
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
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
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:
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
You're not setting a port.
add:
settings.port = 8080;
before listenHTTP();
then it'll work.
It's do not help :(
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/);
}
I mean that I know that template can be changes dynamically, but
I thought that 99% of dynamic is javascript code...
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?
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.
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.
And how people write in jade if it's impossible to preview page
without compiling it's to HTML?
Updating DUB to git version helped. Latest release version have
next issue
https://github.com/D-Programming-Language/dub/issues/535
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:
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
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
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 =
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* );
http://stackoverflow.com/questions/29541229/d-how-to-use-binding-to-c-lib-with-d
some time ago I tried it, but without success
http://forum.dlang.org/thread/hnlrhschfgumaxzgi...@forum.dlang.org
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
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;);
Rikki, could you explain? I did not understand where it can help
me
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.
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;
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...
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
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
UP
201 - 300 of 439 matches
Mail list logo