Oh mama mia! I did it!
http://www.everfall.com/paste/id.php?a5pp73ns1e4k
auto seismodownload = new seismoDownload(emsc_csem, this);
then:
auto mysql = new MySQL(parseconfig,eqs);
So could anybody show me better way? As I said I did not fully
understand how use global class instance...
I looked at my code and it's seems that I can create instance of
MySQL in main.
void main()
{
auto parseconfig = new parseConfig();
auto mysql = new MySQL(parseconfig, seismodownload);
}
In parseConfig I am creation instance of seismoDownload:
class parseConfig
{
if
What I am doing wrong?
http://www.everfall.com/paste/id.php?iwh4qdcqv6zi
Well, there's no `parseconfig` there. Do you expect the
`parseconfig` from line 30 or line 193 to be available in line
170?
From line 30.
In line 193 I am get in instance of class instance of parseconfig
to be able
I need to pass some config to ddbc driver. When I use static
const all work ok.
static const string PGSQL_UNITTEST_HOST = localhost;
static const intPGSQL_UNITTEST_PORT = 5432;
static const string PGSQL_UNITTEST_USER = postgres;
static const string PGSQL_UNITTEST_PASSWORD = Infinity8;
But why variant:
static const int PGSQL_UNITTEST_PORT = 5432;
do not require of implicit convert to!short() at connection
string?
Vadim, could you check your email. I Have do not related with
DLAGGUI question.
Walter, can be documentation moved to wiki? I think a lot of
valanter will help with it's improving and adding more samples.
The reading and understanding it's sometime is bug pain,
especially with programmers, who come to D from Python and other
simple languages.
Adam, I trying to build simple app:
import std.stdio;
import postgres;
import database;
void main() {
auto db = new PostgreSql(dbname = test2);
foreach(line; db.query(SELECT * FROM customer)) {
writeln(line[0], line[customer_id]);
}
}
and getting next
It's not related with D topic, but maybe it would be interesting
for some programmers.
Could anybody explain would it hard to create port DMD to
HelenOS, and what needed for it?
http://www.helenos.org/node/139
image to play http://www.qemu-advent-calendar.org/#day-20
Helen OS do not have Posix-compatibility.
Vadim, could you add in file path in browsing window ability to
click on any needed segment of path and move to it level.
I mean system like does in Windows 7 in when you can move to
D:\code\foo\bar\baz, and after click on foo move to D:\code\foo\
reddit:
http://www.reddit.com/r/programming/comments/2qaxvs/gbaid_a_gameboy_advance_emulator_in_d/
github: https://github.com/DDoS/GBAiD
Matheus.
Cool! And what you can say about D after Java? What do you
liked\disliked?
Could anybody provide any simple examples of usage DerelictPQ. I
do not have experience of C, and I can't understand how to use
this driver.
I need just basics like connect, select and insert.
http://code.dlang.org/packages/derelict-pq
thanks!
I have done next:
string connString = psql -h localhost -p 5432 -U postgres -d
testdb;
package PGconn* conn;
@property bool nonBlocking(){ return PQisnonblocking(conn) == 1;
}
this(parseConfig parseconfig)
{
void connect()
{
On Wednesday, 24 December 2014 at 14:08:53 UTC, Adam D. Ruppe
wrote:
I haven't used the derelict version but I have used the C
library itself and wrapped it briefly in my postgres.d here:
https://github.com/adamdruppe/arsd/blob/master/postgres.d
Thanks! But few questions:
1. how to build it
DerelictPQ is only a binding to libpq. The only difference is
the
DerelictPQ.load method. Just follow the libpq documentation.
http://www.postgresql.org/docs/9.1/static/libpq.html
Actually, Derelict binds to version 9.3, so the proper link
should be
The problem with 31 string.
http://www.everfall.com/paste/id.php?jgsdz7mdbrnm
If I uncomment it, and server response is return 404 code I code
at runtime throw exception with text:
Can't parse config: HTTP request returned status code 404
I thought that checkLinkCode is throw any king
Oh sorry I understood where problem.
Look like binding have some issues.
I am getting next error, after inducing:
import gumbo.node, gumbo.parse;
to my App
Compiling using dmd...
Linking...
OPTLINK (R) for Win32 Release 8.00.15
Copyright (C) Digital Mars 1989-2013 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
There is also a branch named `develop` which at least compiles,
maybe it is usable.
how to add to dub this branch?
On Sunday, 14 December 2014 at 13:33:27 UTC, Suliman wrote:
There is also a branch named `develop` which at least
compiles, maybe it is usable.
how to add to dub this branch?
Compiling using dmd...
Linking...
OPTLINK (R) for Win32 Release 8.00.15
Copyright (C) Digital Mars 1989-2013 All
If I right understand scope is not good for checking if one of
function is fail.
For example:
string dbpass = config.getKey(dbpass);
string dbpass = config.getKey(dbpass);
string dbhost = config.getKey(dbhost);
string dbport = config.getKey(dbport);
if I will try to add scope(failure)
I reread docs and understood that scope not for such case.
Next code is do what I need:
try
{
string dbname = config.getKey(dbname);
string dbpass = config.getKey(dbpass);
string dbhost = config.getKey(dbhost);
string dbport = config.getKey(dbport);
}
catch
On the code.dlang.org I found SQLLite driver
https://github.com/biozic/d2sqlite3
Look like it's not ready for Windows:
pragma(msg, \nWARNING !!!\nDevelopped for POSIX systems
only.\nNot tested on Windows.\n);
I tried to add import to my project and I got next errors:
Yes I used 2.0.65, but after updating compiler the situation did
not resolved...
http://www.everfall.com/paste/id.php?apd0bfs5z4eg
I am trying to start with http://code.dlang.org/packages/dpq2
But I can't understand where I should to get pq.lib and where I
should to place it. In the Program Files I did not find such
file...
string dbname = config.getKey(dbname1);
scope(failure) writeln(look like dbname is missing);
I am using dini and trying to throw exception if value can't be
extract from config. If I am wrap it's in try-сефср block it's
work or. But in this situation scope block do not execute and I
see only
connect() sends a CONNECT request to the server, as defined
by HTTP [1]. This method is only used when you're working with
proxies and the like. What you most likely want, however, is a
GET request. Use get() for that.
So what is the best way to check status server response (400, 404
etc)
Big thanks Ali!
Only the small last question:
why:
string link = dlang.org;
writeln(connect(link));
cause crash:
std.net.curl.CurlException@C:\DMD\dmd2\windows\bin\..\..\src\phobos\std\net\curl
.d(779): HTTP request returned status code 400
0x00404263
My guess is that you have to use HTTPS for CONNECT and that you
have to have credentials for it. (?)
Ali
dlang.org should work on HTTP, but not HTTPS.
Also I do not think that when I connect to HTTPS I should have
any credentials. It's mostly like issue with curl...
Could anybody explain why there is opinion that stack is fast and
the heap is slow. All of them are located in the same memory. So
the access time should be equal.
I can't understand why I am getting exception on next code:
void downloadFile()
{
foreach(link; links)
{
try
{
writeln(connect(link));
}
Am I right understand all exception are derived from
assertThrown
http://dlang.org/phobos/std_exception.html
So msg in catch(Exception msg) is from function
assertThrown?
Could you show me example of how to handle type of exception?
Full function look like this:
auto parseConfig()
{
auto config = Ini.Parse(getcwd ~ \\ ~ config.ini);
string txtlinks = getcwd ~ \\ ~ config.getKey(input_links);
if(!exists(txtlinks))
{
writeln(Can't find input file with list of links.);
auto parseConfig()
{
auto lines = File(txtlinks, r).byLine;
return lines;
}
Error: cannot return non-void from void function
I can't understand the reasons of the error;
Can I return auto from function?
I try to compile simple example:
import std.net.curl;
void main()
{
download(ftp.digitalmars.com/sieve.ds,
D:\\Project\\2014\\txt_downloader\\img\\1.foo);
}
but I am getting error:
function app.download (string[] links) is not callableusing
argument types (string, string)
Look like it was missed installation or so. I installed new copy
of dmd and error gone away.
The downloading still do not work. Work only:
get(dlang.org);
ah, that's it! as spec says, D determines function return value
from
the first 'return' statement it seen. in your case this is
`return;`,
so function return type is determined to be `void`.
if you doing `auto` functions, try to arrange your code so the
first
`return` returning the actual
Running .\txtdownloader.exe
std.stream.OpenException@std\stream.d(50): Cannot open or create
file 'D:\Projec
t\2014\txt_downloader\img\1.foo'
0x0041BA59 in void std.stream.File.open(immutable(char)[],
std.stream.FileMode)
0x00404B75 in void
Is there any way to detect where collision was occurred?
Oh! It's work! I forgot to change path on my home PC!
On Thursday, 27 November 2014 at 17:39:10 UTC, Suliman wrote:
Is there any way to detect where collision was occurred?
It's look like collision was with method name.
Sometimes it's path string may do not have tail slash of the path
Compare:
string path = C:\\folder\\name
string path = C:\\folder\\name\\
in case if I need to append file name to path to get full path I
can get error like:
path ~= foo.txt
C:\\folder\\namefoo.txt
instead of
see std.path, it contains alot of useful things.
I looked there, but found only buildNormalizedPath, but it's not
for such situation...
take a second look then. ;-) you'll find `buildPath()` here too.
Not better:
string foo = D:/code/txtDownloader;
writeln(foo);
foo = foo.buildPath;
foo ~= config.txt;
writeln(foo);
Running .\txtdownloader.exe
D:/code/txtDownloader
Could you quote for me part of docs where it's written? I really
can't understand about what you are taking.
thanks! I understood!
This is an issue with your version of dub with a buggy url
encoding method. Download the latest at code.dlang.org
http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/22266/
Is there any way to set separator? For example I want use '/' or
':'?
And could anybody explain me how the cast is work. How to
understand which types to which may be casted?
I can't understand why foreach loop produce every line by line,
while it's fuctional analog print lines on one string:
foreach(f; file.byLine())
{
writeln(f);
}
auto file = File(foo.txt,r);
file
.byLine()
.writeln;
file content:
-
first sring
second string
-
Thanks! But is there any way to do it with std.algorithm?
Can be skipOver used for it?
In dco source code I have found:
void ShowUsage()
{
writeln(
dco build tool ~ strVersion ~
written by FrankLIKE.
Usage:
dco [switches...] files...
for example: dco
or: dco app.d
build for dfl2: dco
}
I do not see here any \n. Why this code is output all one by
line, and not in single
I am playing with dco. And it's look very helpful for tiny
projects.
I can't understand is it's possible to add to dco.ini Jpath?
I am talking about something like:
dflags=-JD:\code\d\App1\source\
but when I am trying to compile code with dco it's can't find
import.
I looked at source code
I understand it.
I expect what concatenation symbol will stay new line in new line
and not append it's to current:
writeln(
first string
second ~
string
);
I expect:
first string
second
string
but not:
first stringsecondstring
I can't understand how to get date in format -MM-dd from
Clock.currTime
auto time = Clock.currTime;
And what next? Could anybody give any examples?
You need to check if remote file exist of server and only after
it download шею
Also add scope or try catch block to your code.
I have got few questions about DFL2.
1: What is dco and in which situation I should prefer it's to dub?
2: Old DFL had easy to use GUI Builder. Does dfl2 have such tool?
- Added general support for single-file compilation mode, as
well as
separate compile/link mode for GDC.
I do not see any mentions about this key at docs. Can I add it to
dub.json?
You are right, after updating Debian to 7.7 dub was installed
successfully
As of a few hours ago DDMD has gone green in the autotester on
the main platforms.
https://auto-tester.puremagic.com/?projectid=10
I do not see DDMD here. Is it was moved to another location?
I did 2 steps from http://d-apt.sourceforge.net/
$ sudo wget
http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list
-O /etc/apt/sources.list.d/d-apt.list
$ sudo apt-get update sudo apt-get -y --allow-unauthenticated
install --reinstall d-apt-keyring sudo apt-get update
And now
root@66898:~# apt-get install multiarch-support
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package multiarch-support is not available, but is referred to by
another packag
e.
This may mean that the package is missing, has been obsoleted, or
is only
If you haven't found the problem yet, please post:
1. what is the architecture of your machine? $ lscpu
2. what is the debian version? $ lsb_release -a
root@66898:~# lscpu
Architecture: x86_64
CPU op-mode(s):32-bit, 64-bit
CPU(s):4
Vendor ID:
dmd a.d b.d
Otherwise you can also use ddmd and let it find the module
dependencies by itself.
Am I right understand that if I will put all needed files at src
folder and name main file App.d dub will add all needed files to
App.d ?
I can't understand how to use UFCS with instance of class:
void main()
{
string name = Suliman;
userName username = new userName(name);
/// How to use UFCS here?
userName.name.sayHello();
///
}
class userName
{
string name;
this(string name)
{
this.name = name;
}
Thanks!
Ali Çehreli, could you add this mention and possible the example
to your book?
I know that a lot of people are using for programming tools like
Sublime. I am one of them. But if for very simple code it's ok,
how to write hard code?
Do you often need debugger when you are writing code? For which
tasks debugger are more needed for you?
We have to look at the documentation of the function. In this
case the possibilities are FileException and UTFException.
http://dlang.org/phobos/std_file.html#.readText
However, judging by their names, they are both descendants of
Exception, so what you are doing will catch either of them.
void openFile(string fname, string current_folder)
{
auto file = readText(current_folder ~ fname);
scope(failure)
{
writeln(failure);
}
// writeln(file);
}
if file name do not exists, I want to rise scope exception. But
it's do not rise,
I can't understand what I am missing. Try-catch block also do not
handle exception:
void main()
{
string fname = app.d1; //file name with error
string current_folder = (getcwd() ~\\);
writeln(current_folder);
openFile(fname, current_folder);
}
void
Am I right understand that keyword Exception is handle
universal type of exceptions?
catch (Exception)
{
writeln(inner);
}
But in my example with try block can I change it's to something
more informative?
Replace that with something like writeln(caught) and you will
see that it is indeed caught. :) Printing the exception mimicks
the default behavior and you (and I) think that the exception
is not caught. :)
that's work, but I can not understand where I can to look at
exception level. If I
I found build tool named dco.
Could you explain were it can be helpful?
Thanks! In which cases tuples can be helpful?
Few questions.
1. In examples tuples are created with keyword auto. Can I create
them with another keyword. Or auto mean structure of data, that
have not standard type like (int or string)?
2. How ti expend tuple? I tried to do:
auto imglist = tuple(aaa);
imglist.expand[sss];
Is it's possible to create single language that cover desktop and
web? Like D+Dart?
I ask becouse I can't understand why it's need 2 language if they
are very simmiler and it's can be 1 language instead 2.
I know that there is way to write all on JS. But I can't
understand what the reason that there are no single language that
can work on web and as native language.
It is possible, but you need to design the language within the
constraints of javascript:
1. single threaded (or worker threads)
2. 53 bits integers, 26 bits for multiplies.
4. weird fixed size heaps (ArrayView)
5. if garbage collection then it has to be javascript style
6. no tricks:
No! I mean not translation to js. I mean theoretical ability of
creation new programming language that can work every where!
What IDE/EDITOR do you use for D? What plugins if you use Vim?
Sublime + DCD only!
Unfortunately that library has no dub package.
But you can include it in your project.
See info here http://code.dlang.org/package-format
I can't understand how to set in dub that I need to to include in
compilation process other files... Could you help me?
Where I can find compatibility with D online regexp constructor?
I found only https://github.com/Bystroushaak/DHTMLParser
But I can't get it work:
C:\Users\Dima\Downloads\DHTMLParser-master\DHTMLParser-masterdmd
find_links.d
OPTLINK (R) for Win32 Release 8.00.15
Copyright (C) Digital Mars 1989-2013 All rights reserved.
You need to pass a library to compiler as well (all its files
or .lib/.a file) if it is compiled as static library
You can try
dmd find_links.d dhtmlparser.d quote_escaper.d
C:\Users\Dima\Downloads\DHTMLParser-master\DHTMLParser-masterdmd
find_links.d quote_escaper.d
OPTLINK (R) for
On Saturday, 25 October 2014 at 19:51:48 UTC, Suliman wrote:
You need to pass a library to compiler as well (all its files
or .lib/.a file) if it is compiled as static library
You can try
dmd find_links.d dhtmlparser.d quote_escaper.d
How I can build such App with DUB?
import std.stdio;
import std.conv;
import std.string;
import std.net.curl;
void main()
{
string content = get(d-lang.appspot.com/testUrl2);
}
Error: cannot implicitly convert expression (get(d-lang.appsp
ot.com/testUrl2, AutoProtocol())) of type char[] to string
code from:
Solution
http://forum.dlang.org/thread/bgkklxwbhrqdhveth...@forum.dlang.org#post-l639dt:24vlj:241:40digitalmars.com
Am I right understand that it's bug in doc?
I am planing to buy ARM-Board. I would use it for internet
browsing and whant to know would it's possible to develop D apps
on it?
I had read that LDC have limited support of ARM. wiki said that
it can compile hello-world apps. But it it not enough.
What about DMD. Is there any progress of
I want output C or maybe even Cool ...
What's benefits this would give?
What is the best way to remove file name from full path?
string path = thisExePath()
string path = thisExePath()
Seems like dirName in std.path is a good candidate ;)
http://dlang.org/phobos/std_path.html#.dirName
You'll find many other path manipulation functions there.
Thanks! But if I want to strip it, how I can cut it?
I can't understand how to use strip? For example I would like to
cut just extension.
path = path.stripRight(exe);
Error: no overload matches for stripRight(C)(C[] str) if
string getFileName()
{
//чтобы было проще обрабатываемый файл будем хранить рядом с
бинариком
string filename = chomp(readln());
string path = getcwd();
writeln((path ~ \\ ~ filename));
if (exists(path ~ \\ ~ filename))
return (path ~ \\ ~
I thought that new version of DUB will bring SDL instead json ...
On Monday, 22 September 2014 at 10:34:29 UTC, Sönke Ludwig wrote:
Am 22.09.2014 12:26, schrieb Suliman:
I thought that new version of DUB will bring SDL instead json
...
That's planned for 1.0.0 (or a possible intermediate release).
The major reason for this release is to get the new version
Is it's proper name DUB analog of CMake and other build tools
from C world?
Already 1 hour I am looking at example from
http://ddili.org/ders/d.en/concurrency.html and my modification
of it, and can't understand what's difference? Why it's output
only:
1
3
and then do not do nothing!
import std.stdio;
import std.concurrency;
import core.thread;
void main()
{
701 - 800 of 848 matches
Mail list logo