On 01-Jan-12 3:27 AM, Jacob Carlborg wrote:
On 2011-12-31 00:50, Joel Christensen wrote:
I've got an Mac with OSX. But I have a few problems with using it with D.
1. I haven't got any media programming going.
Could you please elaborate. Derelict is a library that contains bindings
for OpenGL
I've got an Mac with OSX. But I have a few problems with using it with D.
1. I haven't got any media programming going.
2. The readln (etc) isn't much good, same problem as Linux. It can only
add characters and remove characters from the end.
I don't care to learn xml at this stage. I just want to use it on that
Bible file.
On 19-Oct-11 8:03 PM, Bernard Helyer wrote:
I think I want to stick with the current std xml library for now.
Thanks Adam. :-) It seems to be working now, with the stuff you gave me.
I was thinking of making a text file from it that my programs can load
from. avoiding the xml file, so they load faster. But I think I'll have
my program(s) use the xml file each time they're run, in the mean time.
I've got xml text of a Bible version. I want to get the text in the
following format:
class Bible {
Book[] bs;
}
class Book {
Chapter[] cs;
}
class Chapter {
Verse[] vs;
}
class Verse {
string v;
}
Here's a part of the xml file:
?xml version=1.0 encoding=ISO-8859-1?
bible
b
I think I want to stick with the current std xml library for now.
I think the books example is too different for me to work for what I want.
Hi,
I have a program that uses the old time stuff before the module
std.datetime. I have a DateTime object, but I can't seem to set its
properties to the current time.
Some thing like:
DateTime dateTime;
dateTime = getCurrentDateTime();
-JoelCNZ
http://d-programming-language.org/intro-to-datetime.html
Thanks Jonathan, that helped I think, (haven't read it all, though). But
I've got errors with some of the date times not being able to change
them with int's values.
task.d(44): Error: function std.datetime.DateTime.month () const is
I mean, I can't copy text from my program to the clipboard.
- Joelcnz
On 12-Sep-11 3:50 PM, Joel Christensen wrote:
Thanks Jimmy. Your example worked. Or though I haven't managed to get
the other way to work.
[code]
import std.stdio;
//import core.stdc.string;
import std.c.string;
import
Thanks so much Jimmy. You put in a bit of effort. :-)
I just added this code to my general library:
extern(Windows) {
bool OpenClipboard(void*);
void* GetClipboardData(uint);
void* SetClipboardData(uint, void*);
bool EmptyClipboard();
bool CloseClipboard();
void*
Hi,
I've got a text program I'm working on. It has game like print. But I
want to be able to copy to the clip board and paste from it in my
program etc. I'm using Windows 7. I have used a bit of Ubuntu in the past.
- Joelcnz
:
Well, it doesn't matter what you've used in the past :-)
Take a look:
http://msdn.microsoft.com/en-us/library/ms907128.aspx
On Sun, Sep 11, 2011 at 5:29 PM, Joel Christensen joel...@gmail.com
mailto:joel...@gmail.com wrote:
Hi,
I've got a text program I'm working on. It has game like print
So how would I got about doing it in D?
On 12-Sep-11 1:52 PM, Vladimir Panteleev wrote:
On Mon, 12 Sep 2011 04:39:52 +0300, Joel Christensen joel...@gmail.com
wrote:
I'm not sure I would be able to get Windows CE Clipboard stuff working
for me.
Search engines often return Windows CE results
Thanks Jimmy. Your example worked. Or though I haven't managed to get
the other way to work.
[code]
import std.stdio;
//import core.stdc.string;
import std.c.string;
import std.string;
import std.conv;
extern(Windows) {
bool OpenClipboard(void*);
void* GetClipboardData(uint);
void*
Hi,
In the std.string document at toStringz it has this note:
Important Note: When passing a char* to a C function, and the C function
keeps it around for any reason, make sure that you keep a reference to
it in your D code. Otherwise, it may go away during a garbage collection
cycle and
On 10-Sep-11 3:09 PM, Jonathan M Davis wrote:
Jonathan M Davis
Ok, now I have a better idea with char pointers. And the std.conv.to
worked too. Thanks.
- Joelcnz
Also I can't compile programs like this any more:
\D\dmd2\windows\bin\dmd file1 file2 etc.
I've been using Geany (a light IDE), now I have to use the terminal to
compile my programs (also clicking on a batch file), before I could
compile with the hit of a key.
Actually I fix my problem in my
On 08-Sep-11 9:05 PM, Johannes Pfau wrote:
cast(string delegate(string))
Thanks Johannes, that's better than my way. :-)
- Joelcnz
Hi,
Has anyone had much experience with multiple subtyping.
//Org: based on page 232 (6.13.1) in The D Programming Language book
//#save(); without storeShape does not work
import std.stdio;
class Shape {
void shape() {
writeln( Shape );
}
}
class DataBase {
On 26-Aug-11 10:20 AM, Timon Gehr wrote:
On 08/26/2011 12:19 AM, Timon Gehr wrote:
On 08/25/2011 11:34 PM, bellinom wrote:
whoops, this is better:
auto arr=to!(int[])(split(strip!(readln(;
Or,
auto arr2=to!(int[])( readln.strip.split );
Got rid of the second ! too (does not work with
On 15-Aug-11 5:21 PM, Joel Christensen wrote:
On 15-Aug-11 2:55 PM, Jonathan M Davis wrote:
On Sunday, August 14, 2011 20:50:03 Joel Christensen wrote:
Hi,
This program loops through a string until it finds a number and gives
the position of it.
The first assert works, but not the second one
Ok, this is a good one I think.
import std.string, std.algorithm, std.functional;
bool isANum( dchar chr ) {
return inPattern( chr, digits ~ `+-.` );
}
void main() {
auto input = `abc123`;
auto indexEnd = -1;
indexEnd = count!( not!isANum )( input );
assert( indexEnd
On 16-Aug-11 10:22 AM, Jonathan M Davis wrote:
On Monday, August 15, 2011 14:28 Jonathan M Davis wrote:
On Monday, August 15, 2011 02:25 Joel Christensen wrote:
Ok, this is a good one I think.
import std.string, std.algorithm, std.functional;
bool isANum( dchar chr ) {
return inPattern( chr
Hi,
This program loops through a string until it finds a number and gives
the position of it.
The first assert works, but not the second one.
import std.algorithm;
void main() {
static bool isNumber( char input, char dummy ) {
if ( ( input = '0' input = '9' ) ||
On 14-Aug-11 10:44 PM, Jonathan M Davis wrote:
On Sunday, August 14, 2011 03:23:39 Jonathan M Davis wrote:
On Sunday, August 14, 2011 20:50:03 Joel Christensen wrote:
Hi,
This program loops through a string until it finds a number and gives
the position of it.
The first assert works
On 15-Aug-11 2:55 PM, Jonathan M Davis wrote:
On Sunday, August 14, 2011 20:50:03 Joel Christensen wrote:
Hi,
This program loops through a string until it finds a number and gives
the position of it.
The first assert works, but not the second one.
import std.algorithm;
void main
value it being set to at the method definition (could with 'ref
auto xpos( int value ) { ... return m_xpos; }' :-/). And having two
methods, one for getter and one for setter, you can't do stuff like
'xpos++;'
- Joel Christensen
What use is the property thing?
class Test {
private int m_value;
@property ref int value() { return m_value; }
}
void main() {
auto test = new Test;
test.value += 1;
}
Or this:
import std.stdio: writeln;
import std.conv: to;
class Test {
private string
Ok, I get you. A whole int*, not one byte of the int* data.
- Joel
On 01-Jul-11 6:07 AM, Ali Çehreli wrote:
On Fri, 01 Jul 2011 05:28:56 +1200, Joel Christensen wrote:
Shouldn't file.rawWrite((i)[0..1]); have [0..4]? Or am I missing some
thing?
[0..1] follows the regular slicing syntax
Yes, portability, I hadn't thought of that.
Shouldn't file.rawWrite((i)[0..1]); have [0..4]? Or am I missing some
thing?
- Joel
On 30-Jun-11 7:53 PM, Ali Çehreli wrote:
On Thu, 30 Jun 2011 15:52:59 +1200, Joel Christensen wrote:
I'm thinking more about handling binary files. With the C
, Joel Christensen wrote:
I want to save and load levels for my game. The std.stream module
doesn't have much examples.
Here is my code:
void saveLevel( string fileName ) {
auto bfile = new std.stream.File;
int ver = 1;
string verStr = version:;
with( bfile
With the char[], I can't use spaces in it the way I've got it here,
(like if I tried using a phrase):
void saveLevel( string fileName ) {
int ver = 1;
auto house = two.dup;
double rnum = 3.0;
{
auto fout = File( fileName, wb); // open for
file and it's a text file. So in
that case I would use read line to have spaces in strings, though what
if I wanted to have new line character(s) in the one string. I still
want to work with binary files.
On 30-Jun-11 2:23 AM, Ali Çehreli wrote:
On Wed, 29 Jun 2011 19:55:38 +1200, Joel
I want to save and load levels for my game. The std.stream module
doesn't have much examples.
Here is my code:
void saveLevel( string fileName ) {
auto bfile = new std.stream.File;
int ver = 1;
string verStr = version:;
with( bfile ) {
scope(
Yeah, it works now. Thanks David :-)
I have actually used type o = cast(type)variable; But had
forgotten about it. Though the super part of what you said is more subtle.
I've got a GUI (GtkD) and a game library (DAllegro5) going. But I'm
thinking a physics library would be wanted.
I had a go at making Blaze work with D2.0. I got it to compile and had
things fall down the screen with it, but the original it hasn't been
updated for 2 years, I think. Blaze is
Ok, I was just making sure. I guess you would surely know about that.
I actually made a program that used date and time before your library.
Not nice. I guess I should go and revisit it. I use the program of mine
too, it boots with Windows.
Well, then I'd better make sure that I get my most recent updates to
std.datetime in soon.
- Jonathan M Davis
Does your library take into account that there's no year 0?
On 15/03/2011 1:57 a.m., Steven Schveighoffer wrote:
On Fri, 11 Mar 2011 18:57:32 -0500, Spacen Jasset
spacenjas...@yahoo.co.uk wrote:
On 10/03/2011 12:18, Steven Schveighoffer wrote:
On Wed, 09 Mar 2011 18:19:55 -0500, Joel Christensen joel...@gmail.com
wrote:
This is on Windows 7. Using
This is on Windows 7. Using a def file to stop the terminal window
coming up.
win.def
EXETYPE NT
SUBSYSTEM WINDOWS
bug.d
import std.stdio;
import std.string;
void main() {
auto f = File( z.txt, w );
scope( exit )
f.close;
string foo = bar;
On 10-Mar-11 1:04 PM, spir wrote:
On 03/10/2011 12:19 AM, Joel Christensen wrote:
This is on Windows 7. Using a def file to stop the terminal window
coming up.
win.def
EXETYPE NT
SUBSYSTEM WINDOWS
bug.d
import std.stdio;
import std.string;
void main() {
auto f = File( z.txt, w );
scope( exit
Thanks, Chapman :-), I followed your instructions and they worked.
I got it working with the DAllegro (Allegro 4.2) game library as well!
I noticed in windows with D you can use .res (eg. dmd main.d smile.res)
files for icons any way. but how do you make icon .res files?
On 27-Feb-11 12:56 AM, J Chapman wrote:
== Quote from Joel Christensen (joel...@gmail.com)'s article
I noticed in windows with D you can use .res (eg. dmd main.d smile.res)
files for icons any way. but how do you make icon .res files?
With a resource compiler. Digital Mars supplies one
On 27-Feb-11 11:24 AM, Joel Christensen wrote:
On 27-Feb-11 12:56 AM, J Chapman wrote:
== Quote from Joel Christensen (joel...@gmail.com)'s article
I noticed in windows with D you can use .res (eg. dmd main.d smile.res)
files for icons any way. but how do you make icon .res files
On 19-Feb-11 6:53 PM, Jesse Phillips wrote:
Joel Christensen Wrote:
I'm using some one else's bindings to a C library.
The problem seems to be limited to D2 programs.
Error as follows:
An exception was thrown while finalizing an instance of class jec2.bmp.Bmp
I also get other errors
I'm using some one else's bindings to a C library.
The problem seems to be limited to D2 programs.
Error as follows:
An exception was thrown while finalizing an instance of class jec2.bmp.Bmp
I also get other errors at program exit.
Thanks for any help. :-)
I'm using a wrapper (or what ever it's called ) that I made on top of
DAllegro binding of the C library Allegro).
But I get this error when exiting a DAllegro program with my JEC2
library. It's a long standing problem I've had. I think it's my JEC2
library that makes it fail.
An exception
What about my edited version:
import std.stdio;
uint rotl_d(uint value,ubyte rotation){
return (valuerotation) | (value(value.sizeof*8 - rotation));
}
uint rotl_asm(uint value,ubyte rotation){
asm{
mov EAX, value; // get first argument
mov CL , rotation; // how many
Looks like there's no problem to me, except with the code.
char[] foo()
{
char[2] res = 1 ;
res[1] = ;; // should be res[1] = ';';
return res;
}
I don't think you can have an incomplete mixin.
Thanks for the long winded reply Jonathan.
I don't know how to avoid using my own linked list, I have next/prev in
each class (Ball, Lazer and Mine ) in the list.
Thanks bearophile, I had a bit of a look at that site.
My game is simple so just maybe the easiest way is the way to go, though
That's called intrusive linked list, and I find using it quite viable:
zero-allocation O(1) add/removal is a very strong characteristics.
They are very useful especially for lock-free algorithms.
That's for the info Denis. I got the idea from a friend who is
interested in how to make games.
Thanks for your reply Jonathan. Yes, I heard about stream being
replaced, but since my code with binary files isn't very much, I can
just redo it if I have to. I think I'll continue using std.c.file for
the time being.
I should learn about ranges.
I tried std.stdio already.
It's been been
Thanks again for the reply Jonathan. I'm using doublely linked list I
made for a game where ships and there lazer bolts are in the same list.
Without linked list I couldn't do things like create a lazer bolt or
remove one while trans-versing the linked list. I had to use my own
linked list,
I am looking for use cases of singly|doubly linked lists, I (nearly) never need
them in my code. Few questions:
1) What's a typical (or average) length of your list?
Thanks for your interest bearophile.
I haven't used linked list much more than just trying them out. And my
game is at its
I normally use D's built in dynamic arrays. but it doesn't work with
adding and removing with the foreach loop (like removing an object from
the list while still going through the list).
I'm using D2.049. I have a program in which I want to be able to get the
current time as one number, also be able to change the hour and stuff
then convert it back to one number. I'm saving just the one number to file.
Thanks in advance. :-)
I've tried that module.
I was putting:
long dt = UTCtoLocalTime(getUTCtime - (msPerDay / 2));
Then when daylight savings came it was wrong, (computer was right mind).
long datetime = UTCtoLocalTime(getUTCtime);
It is 1 hour and half a day out. It was the right hour till daylight
savings. I
Thanks for the replies Jonathan M Davis and Yao G. :-)
Good to hear it's being worked on. I've other programs that are done
with D1.0 that are all right.
I'm using Windows, would like it to work on Linux too though.
I think I'll use year month etc. separately instead of just having a big
Thanks Jonathan. My plan is to use the C version, and not use the big
time_t number. I'm actually using std.c.stdio module too, for binary
files, I probably should use std.stream or some thing.
Thanks for the fix up Philippe.
Just a little note. Where it says 'DynMethod m', you can put 'auto m',
but I'm wondering is it some times clearer to have the class name even
though 'auto' works.
, or Windows's piping?
--
Aug 17
Jesse Phillips jessekphillips+D gmail.com
In my experience Windows hasn't gotten piping right. And it has been
known to
have bugs, this might be related:
http://stackoverflow.com/questions/466801/python-piping-on-windows-why-does-this-not-work
Aug 18
Joel Christensen
I've typed this example program in, but it doesn't compile. I looked up
the The D programming language errata but it wasn't listed. I'm using
DMD v2.048.
/**
Date: Aug 20, 2010
This was copied from TDPL book pages 386 - 387
*/
module dynamicmethods;
import std.stdio;
import
Any one interested in doing D versions of this program?
http://www.rubyquiz.com/quiz14.html
Tomek Sowiński wrote:
An extract from java.util.Formatter docs:
// Explicit argument indices may be used to re-order output.
formatter.format(%4$2s %3$2s %2$2s %1$2s, a, b, c, d)
// - d c b a
How do I achieve this with std.format? The ddocs only say that variadic
arguments are consumed in
Sam Hu wrote:
How can I reach something like below code:
int a=1;
int b=2;
int c=(int a,int b){
return a+b;}
writefln(Result:%d,c);
Thanks in advance.
int a=1;
int b=2;
int add(int a,int b) {
return a+b;
}
int c=add(a,b);
writefln(Result:%d,c);
Nested functions are cool. :-)
Now I get the error using coffimplib.exe 'Error: missing archive signature'.
grauzone wrote:
Joel Christensen wrote:
FMOD sound (record and play) is off D Programming web site.
http://wiki.dprogramming.com/FMod/HomePage
I followed instructions from the web site. But one instruction said to
use 'coffimplib.exe' but I couldn't see where it is to download it,
and one
Do you have something in the Error Log (Window - Show View - Error
Log)? How is your project configured? Do you have phobos or Tango in the
include path?
My Eclipse doesn't have a thing called Error Log. I can't see more than
'D Build Path' to configure.
I've been testing with Tangos
To be safe, whenever converting to int, always add a small epsilon. I
think you can use float.epsilon, but I don't have any experience with
whether that is always reasonable.
-Steve
Thanks every one for the replies.
I still have problems. How do I use epsilon? 'real' helps in my example
Moritz Warning wrote:
On Wed, 28 Oct 2009 14:37:22 +1300, Joel Christensen wrote:
FMOD sound (record and play) is off D Programming web site.
http://wiki.dprogramming.com/FMod/HomePage
I followed instructions from the web site. But one instruction said to
use 'coffimplib.exe' but I couldn't
FMOD sound (record and play) is off D Programming web site.
http://wiki.dprogramming.com/FMod/HomePage
I followed instructions from the web site. But one instruction said to
use 'coffimplib.exe' but I couldn't see where it is to download it, and
one link wasn't found (Dr.Dobb).
Jarrett Billingsley wrote:
On Mon, Sep 7, 2009 at 6:44 AM, Joel Christensenjoel...@gmail.com wrote:
div0 wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Joel Christensen wrote:
I noticed you can get DMD bundled with various libraries. I found you
had to login to another web site
I noticed you can get DMD bundled with various libraries. I found you
had to login to another web site, but the registery page has 3 must fill
in textbox's that are crazy.
For 2 dim array I like auto a=new char[][](40,25); so that
a[39][24]='B'; 'B' is at the bottom right of the 2D array.
Joel Christensen wrote:
See previous post.
I get this error with dmd 1.045. The _errno seems to be with the
DAllegro (http://www.dsource.org/projects/dallegro) library. And the 42
one to do with some thing of mine.
OPTLINK (R) for Win32 Release 8.00.1
Copyright (C) Digital Mars 1989-2004 All rights reserved.
78 matches
Mail list logo