Re: Plot2Kill 0.02

2010-07-18 Thread Nick Sabalausky
dsimcha dsim...@yahoo.com wrote in message 
news:i1voke$2i9...@digitalmars.com...
 I've successfully ported dflplot to gtkD and gotten it to the point where 
 it
 works in every way (except speed/memory use; gtkD is a little 
 slow/resource
 hungry) at least as well as the original DFL version.  Now that I can't 
 call
 it dflplot anymore because it supports multiple GUI libs, I'm calling it
 Plot2Kill.  The status of the DFL version hasn't changed since I 
 originally
 posted about dflplot.  Here's what works and what needs work, with respect 
 to
 the gtkD version wherever there's a difference:


I love the new name. And if it ends up being a killer app (or really a 
killer lib) for D, or for data plotting in general, then the name would be 
all the more appropriate :).

This could also be great for providing better benchmarking data (See: 
http://www.zedshaw.com/essays/programmer_stats.html ). D could use this to 
help lead the way in statistically-meaningful benchmark data.




Re: Plot2Kill 0.02

2010-07-18 Thread BLS

On 18/07/2010 22:36, dsimcha wrote:

heat maps


Sorry for my ignorance,
What are heat maps good for ?

Since I am more biz software guy, here my question.

Let's say I have this relation
A Project can have several Cost Centers.
A Cost Center can have several cost items.

I our sample . Project -P- has  say, 10 cost centers.
Cost Center no 1 takes already 60 percent.
The other cost centers (2-10) just take between 10 (blue) and 20 (green) 
percent.


-- So I want to color cost center no 1 related items in red.. . and the 
max percentage item in cost center no 2 dark red.

CC No 1 = {5,20,20,15}

Is this what a heat map is made for ?

and sorry ,  best example I am able to give atm..
bjoern


Re: Plot2Kill 0.02

2010-07-18 Thread dsimcha
== Quote from BLS (windev...@hotmail.de)'s article
 On 18/07/2010 22:36, dsimcha wrote:
  heat maps
 Sorry for my ignorance,
 What are heat maps good for ?
 Since I am more biz software guy, here my question.
 Let's say I have this relation
  A Project can have several Cost Centers.
  A Cost Center can have several cost items.
 I our sample . Project -P- has  say, 10 cost centers.
 Cost Center no 1 takes already 60 percent.
 The other cost centers (2-10) just take between 10 (blue) and 20 (green)
 percent.
 -- So I want to color cost center no 1 related items in red.. . and the
 max percentage item in cost center no 2 dark red.
 CC No 1 = {5,20,20,15}
 Is this what a heat map is made for ?
 and sorry ,  best example I am able to give atm..
 bjoern

You've pretty much got it.  Heat maps can be thought of as a possible 
counterpart
to bar graphs when you want to plot a dependent variable against two independent
variables instead of one.  The hot color is used to represent the largest 
value
of the dependent variable, the cold color is used to represent the smallest
value, and the colors are linearly blended for values in between.

There's also the case of a HeatScatter or 2-D histogram for visualizing a joint
probability distribution.  For small samples, scatter plots are usually used for
this.  However, for large samples, the amount of points on the scatter plot
becomes unwieldy, so instead you bin the data on a 2D grid and the color
represents how often joint realizations with a given pair of values occur.  For
example, the lower right figure in my demo is a HeatScatter where the Y-axis is
distributed Normal(1, 1) and the X-axis is distributed Normal(-2, 1) + Y_i.


SQLite 3.6.23.1 wrapper + connector

2010-07-18 Thread awishformore

Hello there.

I've converted the .h file of the latest SQLite version to .d and I 
thought I'd let the world know (as suggested on IRC ;). Maybe it will 
save someone some work.


I've also written a nice connector class that wraps all the C functions 
for convenient use in your application. It's very basic, but I will 
probably add more features (like automatic preparation of statements and 
automatic caching of several prepared statements) later.


For the time being both files are included in the download: 
http://nexunity.com/sqlite4d.rar


I'm pretty new to this kind of stuff, so what I did to get it to work 
was compiling the latest SQLite dll from source with dmc and then link 
the .obj file into my app ( http://nexunity.com/sqlite3.obj ).


I'm sure there is a better way like compiling it as static lib (dmc 
complained about no entry point) or having some kind of other file to 
link into your app in order for it to compile and then use the dll. I 
however couldn't figure it out and it works for me. Don't hesitate to 
teach me nonetheless.


Any kind of feedback is always appreciated.

Greetings, Max.


Re: Plot2Kill 0.02

2010-07-18 Thread BLS

On 19/07/2010 00:28, dsimcha wrote:

You've pretty much got it.


Thanks for your enlightening explanation. I think your plotting tool is 
also very valuable in standard business environments!


I was just a second too late..so sorry for answering twice and making so 
much noise.   bjoern


Re: Plot2Kill 0.02

2010-07-18 Thread dsimcha
== Quote from BLS (windev...@hotmail.de)'s article
 On 19/07/2010 00:01, BLS wrote:
  On 18/07/2010 22:36, dsimcha wrote:
  heat maps
 
  Sorry for my ignorance,
  What are heat maps good for ?
 
  Since I am more biz software guy, here my question.
 
  Let's say I have this relation
   A Project can have several Cost Centers.
   A Cost Center can have several cost items.
 
  I our sample . Project -P- has say, 10 cost centers.
  Cost Center no 1 takes already 60 percent.
  The other cost centers (2-10) just take between 10 (blue) and 20 (green)
  percent.
 
  -- So I want to color cost center no 1 related items in red.. . and the
  max percentage item in cost center no 2 dark red.
  CC No 1 = {5,20,20,15}
 
  Is this what a heat map is made for ?
 
  and sorry , best example I am able to give atm..
  bjoern
 My guess was okay, Heat maps are also made for this use case. so no need
 to answer.
 Since Tree maps are not that different from Heat maps, do you have any
 plans to implement them too ?

I didn't have any plans to implement them, as I didn't know about them until I
looked them up on Wikipedia just now.  I'll consider implementing them, but I'm
not sure if it will happen soon.

 Next, Do you have any ideas about zooming ? (zooming a plotting region) ?

This can already be done programmatically (see Figure.xlim() and Figure.ylim()),
but is not exposed yet via the default plot window GUI.  This will be exposed 
when
I decide how I want to expose it.  The most obvious answer is dragging, but the
question then becomes, how do you zoom back out?


Re: SQLite 3.6.23.1 wrapper + connector

2010-07-18 Thread dsimcha
== Quote from awishformore (awishform...@gmail.com)'s article
 Hello there.
 I've converted the .h file of the latest SQLite version to .d and I
 thought I'd let the world know (as suggested on IRC ;). Maybe it will
 save someone some work.
 I've also written a nice connector class that wraps all the C functions
 for convenient use in your application. It's very basic, but I will
 probably add more features (like automatic preparation of statements and
 automatic caching of several prepared statements) later.
 For the time being both files are included in the download:
 http://nexunity.com/sqlite4d.rar
 I'm pretty new to this kind of stuff, so what I did to get it to work
 was compiling the latest SQLite dll from source with dmc and then link
 the .obj file into my app ( http://nexunity.com/sqlite3.obj ).
 I'm sure there is a better way like compiling it as static lib (dmc
 complained about no entry point) or having some kind of other file to
 link into your app in order for it to compile and then use the dll. I
 however couldn't figure it out and it works for me. Don't hesitate to
 teach me nonetheless.
 Any kind of feedback is always appreciated.
 Greetings, Max.

Awesome.  D1, D2 or both?  I've wanted a simple database for some time now, but
been too lazy to write bindings or find one one myself, which encourages me to
roll my own ad-hoc formats instead.  Given that sqlite is in the public domain,
maybe Phobos should eventually include SQLite + a nice D-ish wrapper for it, so
that people can use it w/o creating dependency hell in their projects.


Re: Plot2Kill 0.02

2010-07-18 Thread BLS

On 19/07/2010 00:44, dsimcha wrote:

This can already be done programmatically (see Figure.xlim() and Figure.ylim()),


will have a look.


but is not exposed yet via the default plot window GUI.  This will be exposed 
when
I decide how I want to expose it.  The most obvious answer is dragging, but the
question then becomes, how do you zoom back out?


Scaling : The solution which comes immediately in mind is by using a 
scale factor. (1.0 by default)


I think the more interesting part is creating a rectangular area within 
your graph. ( I mean press left mouse button and create a rectangle) 
figure out which are the min. and max. values for each of the series, 
depending on the rectangle area. (series  == ranges, I guess)


Dragging ? Not sure what you mean.

bjoern


Re: SQLite 3.6.23.1 wrapper + connector

2010-07-18 Thread BLS

On 19/07/2010 00:57, dsimcha wrote:

  Given that sqlite is in the public domain,
maybe Phobos should eventually include SQLite + a nice D-ish wrapper for it, so
that people can use it w/o creating dependency hell in their projects.


Agreed, even a very popular and commercial multi OS RAD Tool called 
Real Basic comes bundled with SQLite.  Let's use this excellent tool 
instead of the thick openrj stuff, we had before.

-bjoern


Re: SQLite 3.6.23.1 wrapper + connector

2010-07-18 Thread awishformore

On 19/07/2010 00:57, dsimcha wrote:

== Quote from awishformore (awishform...@gmail.com)'s article

Hello there.
I've converted the .h file of the latest SQLite version to .d and I
thought I'd let the world know (as suggested on IRC ;). Maybe it will
save someone some work.
I've also written a nice connector class that wraps all the C functions
for convenient use in your application. It's very basic, but I will
probably add more features (like automatic preparation of statements and
automatic caching of several prepared statements) later.
For the time being both files are included in the download:
http://nexunity.com/sqlite4d.rar
I'm pretty new to this kind of stuff, so what I did to get it to work
was compiling the latest SQLite dll from source with dmc and then link
the .obj file into my app ( http://nexunity.com/sqlite3.obj ).
I'm sure there is a better way like compiling it as static lib (dmc
complained about no entry point) or having some kind of other file to
link into your app in order for it to compile and then use the dll. I
however couldn't figure it out and it works for me. Don't hesitate to
teach me nonetheless.
Any kind of feedback is always appreciated.
Greetings, Max.


Awesome.  D1, D2 or both?  I've wanted a simple database for some time now, but
been too lazy to write bindings or find one one myself, which encourages me to
roll my own ad-hoc formats instead.  Given that sqlite is in the public domain,
maybe Phobos should eventually include SQLite + a nice D-ish wrapper for it, so
that people can use it w/o creating dependency hell in their projects.


Hello.

Ah yeah, I guess I should have mentioned. I'm only working with D2 at 
the moment, so it is D2 right now (because of the use of string). 
However, it should be straight forward to replace all string occurrences 
with char[] to get it to work on D1. I'm pretty sure that's the only 
issue stopping it from working on D1.


Also, when using my wrapper, please note a few specifics with the bind 
method:


- to bind a zeroblob to a prepared statement, pass an int array with a 
single element with the size of the blob as value. Couldn't come up with 
a better way to make that function available through the same method.

- to bind NULL just pass null ;)
- currently, it lets you pass anything and will try to treat it as 
sqlite3_value struct reference, so be careful


Greetings, Max.


Re: SQLite 3.6.23.1 wrapper + connector

2010-07-18 Thread Ellery Newcomer

On 07/18/2010 06:22 PM, BLS wrote:

On 19/07/2010 00:57, dsimcha wrote:

Given that sqlite is in the public domain,
maybe Phobos should eventually include SQLite + a nice D-ish wrapper
for it, so
that people can use it w/o creating dependency hell in their projects.


Agreed, even a very popular and commercial multi OS RAD Tool called
Real Basic comes bundled with SQLite. Let's use this excellent tool
instead of the thick openrj stuff, we had before.
-bjoern


I thought Qt does, too.

Python definitely does, and I've actually been using it a lot lately. 
One thing I noticed when switching my code from postgresql to sqlite is 
that their respective python libraries use different parameter styles. 
Otherwise, it was completely painless.


I'd love to see sqlite distributed with D, but not before a good DB API 
specification (not to disparage awishformore's work, of course).


Re: SQLite 3.6.23.1 wrapper + connector

2010-07-18 Thread Ellery Newcomer

On 07/18/2010 05:44 PM, awishformore wrote:

Hello there.

I've converted the .h file of the latest SQLite version to .d and I
thought I'd let the world know (as suggested on IRC ;). Maybe it will
save someone some work.

I've also written a nice connector class that wraps all the C functions
for convenient use in your application. It's very basic, but I will
probably add more features (like automatic preparation of statements and
automatic caching of several prepared statements) later.

For the time being both files are included in the download:
http://nexunity.com/sqlite4d.rar



btw, would it be possible to distribute as something other than a rar? I 
wanted to have a peek at what you've done, but apparently nothing on my 
[linux] system can read that file.


Re: SQLite 3.6.23.1 wrapper + connector

2010-07-18 Thread Jonathan M Davis
On Sunday 18 July 2010 19:10:35 Ellery Newcomer wrote:
 On 07/18/2010 05:44 PM, awishformore wrote:
  Hello there.
  
  I've converted the .h file of the latest SQLite version to .d and I
  thought I'd let the world know (as suggested on IRC ;). Maybe it will
  save someone some work.
  
  I've also written a nice connector class that wraps all the C functions
  for convenient use in your application. It's very basic, but I will
  probably add more features (like automatic preparation of statements and
  automatic caching of several prepared statements) later.
  
  For the time being both files are included in the download:
  http://nexunity.com/sqlite4d.rar
 
 btw, would it be possible to distribute as something other than a rar? I
 wanted to have a peek at what you've done, but apparently nothing on my
 [linux] system can read that file.

While I hate rar, every distribution than I have used has had unrar. There's a 
decent chance that it isn't installed by default though.

- Jonathan M Davis


Re: SQLite 3.6.23.1 wrapper + connector

2010-07-18 Thread Ellery Newcomer

On 07/18/2010 09:20 PM, Jonathan M Davis wrote:

On Sunday 18 July 2010 19:10:35 Ellery Newcomer wrote:

btw, would it be possible to distribute as something other than a rar? I
wanted to have a peek at what you've done, but apparently nothing on my
[linux] system can read that file.


While I hate rar, every distribution than I have used has had unrar. There's a
decent chance that it isn't installed by default though.

- Jonathan M Davis


Hmm. I suppose I could have spent more than 2 seconds trying to open it. 
You're right on both counts.


As for the code, I'm looking at SQLiteConnector.ptrtostr. Does reserve 
really work that way? Just curious - I wouldn't know one way or the 
other, although I would probably use something more like


string ptrtostr(char* ptr, int size = 0){
 return ptr ? ptr[0 .. size].idup : null;
}


Re: SQLite 3.6.23.1 wrapper + connector

2010-07-18 Thread awishformore

On 19/07/2010 04:59, Ellery Newcomer wrote:

On 07/18/2010 09:20 PM, Jonathan M Davis wrote:

On Sunday 18 July 2010 19:10:35 Ellery Newcomer wrote:

btw, would it be possible to distribute as something other than a rar? I
wanted to have a peek at what you've done, but apparently nothing on my
[linux] system can read that file.


While I hate rar, every distribution than I have used has had unrar.
There's a
decent chance that it isn't installed by default though.

- Jonathan M Davis


Hmm. I suppose I could have spent more than 2 seconds trying to open it.
You're right on both counts.

As for the code, I'm looking at SQLiteConnector.ptrtostr. Does reserve
really work that way? Just curious - I wouldn't know one way or the
other, although I would probably use something more like

string ptrtostr(char* ptr, int size = 0){
return ptr ? ptr[0 .. size].idup : null;
}


I think an empty array/string is safer to return than null. And yes, 
reserve works that way, it will reserve the space needed for the 
(character) array to expand.


The strings are null terminated in SQLite and you won't always know the 
size; I had previously used the same method in another place of my app. 
I however also wasn't aware that you could still access pointers like 
arrays in D, so that would indeed be a better way to do it when you 
always know the size.


You could then even go as far as not iduping, but instead casting it to 
a string to avoid unnecessary allocations.


Greetings, Max.