Search the web
Sign In
New User? Sign Up
taffydb · TaffyDB Support and User Group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Messages 1 - 30 of 226   Newest  |  < Newer  |  Older >  |  Oldest
Messages: Show Message Summaries   (Group by Topic) Sort by Date v  
#30 From: "berg.matt" <berg.matt@...>
Date: Wed Jun 18, 2008 3:19 pm
Subject: orderBy with nulls
berg.matt
Offline Offline
Send Email Send Email
 
I have a column in my TAFFY DB that has a bunch of string date values
such as "2008-07-01", "2008-08-01", etc.  Using the orderBy, those
values sort fine.  The problem I see is that I also have null values
in that column, which don't seem to do any kind of sort.  Preferably I
would like these sort at the top for "asc" and bottom for "desc".
Think this is possible?

#29 From: "tacoman_cool" <ian@...>
Date: Thu Jun 12, 2008 3:22 pm
Subject: Re: Row Ids
tacoman_cool
Offline Offline
Send Email Send Email
 
Matt,

Yes, first is the preferred method for accessing one record. On paper
it will be a little slower than array[arrayIndex] since it is designed
to take an object for a search, an array of many indexes, or a single
index. But you'd need to run it many thousands of times before you
noticed. get()[arrayIndex] is going to be slower because it builds a
new array with all the record objects to return. For the most part
get() is best used when building a new TAFFY collection off of an
existing collection.

Ian

--- In taffydb@yahoogroups.com, "berg.matt" <berg.matt@...> wrote:
>
> Thanks Marty and Ian for your help.  I think including the index in
> the forEach is exactly what I was looking for, but if I am looping
> through the whole collection, keeping track of the index isn't too big
> of a deal for now.
>
> Ian, I know you showed the use of myCollection.first(index).  Is this
> the fastest way to retrieve a row (basically the same as
> array[arrayIndex])?
>
> Matt
>
> --- In taffydb@yahoogroups.com, "madcitymm" <marty@> wrote:
> >
> > Hi Ian,
> > Returning the index in the foreach will be a great addition.  In my
> > application the foreach is always traversing a subset of the db and
> > having the index would be handy.
> > Marty
> >
>

#28 From: "berg.matt" <berg.matt@...>
Date: Thu Jun 12, 2008 6:27 am
Subject: Re: Row Ids
berg.matt
Offline Offline
Send Email Send Email
 
Thanks Marty and Ian for your help.  I think including the index in
the forEach is exactly what I was looking for, but if I am looping
through the whole collection, keeping track of the index isn't too big
of a deal for now.

Ian, I know you showed the use of myCollection.first(index).  Is this
the fastest way to retrieve a row (basically the same as
array[arrayIndex])?

Matt

--- In taffydb@yahoogroups.com, "madcitymm" <marty@...> wrote:
>
> Hi Ian,
> Returning the index in the foreach will be a great addition.  In my
> application the foreach is always traversing a subset of the db and
> having the index would be handy.
> Marty
>

#27 From: "madcitymm" <marty@...>
Date: Wed Jun 11, 2008 1:57 pm
Subject: Re: Row Ids
madcitymm
Offline Offline
Send Email Send Email
 
Hi Ian,
Returning the index in the foreach will be a great addition.  In my
application the foreach is always traversing a subset of the db and
having the index would be handy.
Marty

#26 From: "tacoman_cool" <ian@...>
Date: Wed Jun 11, 2008 3:30 am
Subject: Re: Row Ids
tacoman_cool
Offline Offline
Send Email Send Email
 
Hey Matt,

Marty may have already answered your question but I thought I'd throw
in my two cents. With the next version of Taffy I'm adding in some
better support for indexes. This includes a change to forEach where
two arguments will be passed in to your function: record,index. In
this way you'll be able to use forEach and easily keep track of the
index number. The next version shouldn't be too far out (working
through bugs now) but right now you have to hack it.

Assume the document contains <ul id="mylist"></ul>

Here is an option:

var x = 0;
var ml = document.getElementById("mylist");
myCollection.forEach(function(r){
       var row = document.createElement("li");
       row.appendChild(document.createTextNode(r.name));
       row.index = x;
       row.onclick = function(){
	  	 alert(myCollection.first(this.index).name)
	   };
       ml.appendChild(row);
       x++;
});

Hope that helps,

Ian


--- In taffydb@yahoogroups.com, "berg.matt" <berg.matt@...> wrote:
>
> I have been curious about what you recommend as far as using Taffy
> when it relates to Row/Index ids.
>
> Here is example of what I would like to do.
>
> Output all of my Taffy Data into row(li) elements, keeping track of
> the Taffy array index on each row.  And then access each Taffy row by
> using the array index.
>
> How do I access the Taffy array index.  And what is the best method of
> retrieving the Taffy row using the index?
>
> Thanks.
>
> Matt
>

#25 From: "madcitymm" <marty@...>
Date: Wed Jun 11, 2008 2:27 am
Subject: Re: Row Ids
madcitymm
Offline Offline
Send Email Send Email
 
Hi Matt,
I faced the same issue. With a bit of help from Ian, here's what
worked for me:  I'll have my taffy driven site  up in the next couple
of days and will post the link so others can see it in action. My
driving force was to make a cascaded vehicle search work without
going back to the server.

function js_Test()
{ var trows = new TAFFY([
       { make:"Ford",
         model:"Escort",
         color:"Silver"},
       { make:"Hyundai",
         model:"Sonata",
         color:"Red"}
       ]);

   var trowidx;   // list of indexes of objects in trows
   var qry={};
   qry["make"]={notequal:""};  // retrieve all records because make is
never empty
   // use find to retreive all elements
   trowidx = trows.find(qry);

   // list the indexes
   for (var i = 0; i < trowidx.length; i++)
   { alert("trow index = " + trowidx[i]);}

   // if you also need to extract other information than the index
while populating
   // the li then use the foreach.  The trowidx at the end of the
function is used
   // when find returns a subset of trows.
   var veh;
   var models="";
   trows.forEach
   ( function (Lst)
     { models += Lst.model + " ";
     }
     ,trowidx
   );
   alert("all models are: " + models);

   // use this to retreive a single element from the taffy object with
   // the index
   var indx = 1;  //the index to the taffy object
   veh = trows.get()[indx];
   var themakeis = veh.make;  //Hyundai
   var thecoloris = veh.color;  //Red
   alert("make and color are:" + themakeis + ", " + thecoloris);
}

#24 From: "berg.matt" <berg.matt@...>
Date: Wed Jun 11, 2008 12:27 am
Subject: Row Ids
berg.matt
Offline Offline
Send Email Send Email
 
I have been curious about what you recommend as far as using Taffy
when it relates to Row/Index ids.

Here is example of what I would like to do.

Output all of my Taffy Data into row(li) elements, keeping track of
the Taffy array index on each row.  And then access each Taffy row by
using the array index.

How do I access the Taffy array index.  And what is the best method of
retrieving the Taffy row using the index?

Thanks.

Matt

#23 From: "berg.matt" <berg.matt@...>
Date: Wed Jun 11, 2008 12:18 am
Subject: Re: Should Indexes be added to Taffy DB?
berg.matt
Offline Offline
Send Email Send Email
 
I would also vote for NO on indexes.  I think keeping it lightweight
is one of the real nice features of Taffy.  Though you could possibly
add extensions to TaffyDb, for users who need the extra processing.

--- In taffydb@yahoogroups.com, "madcitymm" <marty@...> wrote:
>
> --- In taffydb@yahoogroups.com, "tacoman_cool" <ian@> wrote:
> >
> > Hi everyone,
> >
> > I've spent some time over the last couple of weeks trying to test and
> > add indexes into Taffy DB. ...........
>
> Hi Ian,
> I'm new to Taffy, but what attracted me to it was that is a small but
> powerful application and it is not intended to be a real SQL type
> replacement, but for  use in web pages, which by definition(at least
> mine) should be keep small.  So, my vote on indexes is no.
> Thanks
> Marty
>

#22 From: "tacoman_cool" <ian@...>
Date: Thu Jun 5, 2008 9:38 pm
Subject: Nice write up on Taffy DB
tacoman_cool
Offline Offline
Send Email Send Email
 
This guy gets it:

http://www.ajaxwith.com/Taffy-DB-for-Faster-Data-Processing.html

Nothing useful, but just a good description of what Taffy DB is and
why it exits.

#21 From: "tacoman_cool" <ian@...>
Date: Wed Jun 4, 2008 4:48 am
Subject: Re: Data Retrieval
tacoman_cool
Offline Offline
Send Email Send Email
 
Hey Marty,

You've got a couple of options. By passing in an array to forEach it
will call your function for each entry in that array. You can also
pass in an object which will be handled the same way find is handled.

So collection.forEach(someFunc,collection.find({name:"Ian"}));

is the same as collection.forEach(someFunc,{name:"Ian"});

But I don't think that is what you are asking. I think you may be
looking for get(). Or perhaps first.

So collection.get({name:"Ian"}) will return an array that contains
every record (object) where name is Ian. You can use this to create
another taffy or loop over how ever you want. Are you certain that
only one record will be matched? first() and last() return just the
object instead of the array.

So alert(collection.get()[0].name) is the same as
alert(collection.first());

Does that help?

Ian

--- In taffydb@yahoogroups.com, "madcitymm" <marty@...> wrote:
>
> After executing a find, I have my list of indexes.  How do I use those
> indexes to extract the contents?  Seems silly, but there is only one
> example, the foreach, that does this, but then I have to scan the
> entire record set looking for the indexes.
> TIA
> Marty
>

#20 From: "madcitymm" <marty@...>
Date: Wed Jun 4, 2008 4:13 am
Subject: Data Retrieval
madcitymm
Offline Offline
Send Email Send Email
 
After executing a find, I have my list of indexes.  How do I use those
indexes to extract the contents?  Seems silly, but there is only one
example, the foreach, that does this, but then I have to scan the
entire record set looking for the indexes.
TIA
Marty

#19 From: "madcitymm" <marty@...>
Date: Mon Jun 2, 2008 10:07 pm
Subject: Re: Should Indexes be added to Taffy DB?
madcitymm
Offline Offline
Send Email Send Email
 
--- In taffydb@yahoogroups.com, "tacoman_cool" <ian@...> wrote:
>
> Hi everyone,
>
> I've spent some time over the last couple of weeks trying to test and
> add indexes into Taffy DB. ...........

Hi Ian,
I'm new to Taffy, but what attracted me to it was that is a small but
powerful application and it is not intended to be a real SQL type
replacement, but for  use in web pages, which by definition(at least
mine) should be keep small.  So, my vote on indexes is no.
Thanks
Marty

#18 From: "tacoman_cool" <ian@...>
Date: Mon Jun 2, 2008 7:19 pm
Subject: Should Indexes be added to Taffy DB?
tacoman_cool
Offline Offline
Send Email Send Email
 
Hi everyone,

I've spent some time over the last couple of weeks trying to test and
add indexes into Taffy DB. JavaScript is not designed for this type of
optimization so it has required a lot of brute force experimentation.
The results have been mixed.

Under a normal TaffyDB database it takes about 1500 milliseconds to
load 10,000 records via JavaScript. With a unique ID column it takes
around 200 milliseconds to retrieve a single record with a known ID.
If you add an index you can find that single record in 8-20
milliseconds. That is a huge improvement.

The index works by creating blocks of records and assembling meta data
about the column you want to search on. It knows the highest and
lowest value within that block of records (256 by default) and so it
can check each block to see if the record you are searching for may be
contained within it. So instead of looking at 10,000 records Taffy DB
only has to look at 256 to find the record in question.

So what's the problem?

The problem is speed of creation and maintenance of the index over
time. Creating the index takes about a 1000 milliseconds on 10,000
records. Given the improved speed of record lookup it is easy to
recoup that speed in a faster application.

Inserts also take virtually no time to handle.

Updates? Well they aren't bad but it will double or triple the amount
of time it will take to run updates.

Removes? Horrible. Because the block records have to change it is more
or less faster to rebuild the index from scratch than update it. Which
means removing a single record could take a second.

OrderBy? Also requires a complete rebuild of the index.

So the basic question I have, is this worth the file size? If you only
have 1000 records in your database the index really what improve your
speed noticeably. If you had one or two very large collections that
you do ID style lookups on then I think we could see an improvement.
But that isn't a typically use case of Taffy DB.

Thoughts? How would you want to use indexes? I hate to roll back all
the work but after a lot of testing it becomes virtually impossible to
maintain the index on a often updated collection, at which point it is
faster to just do full table scans.

Ian

#17 From: "tacoman_cool" <ian@...>
Date: Thu May 8, 2008 4:07 pm
Subject: TaffyDB seen in the wild
tacoman_cool
Offline Offline
Send Email Send Email
 
TaffyDB is in use on CinemaNow (http://www.cinemanow.com/) on their My
Movies page. Pretty cool to see another high traffic site start using it.

#16 From: "tacoman_cool" <ian@...>
Date: Thu May 8, 2008 3:43 pm
Subject: Re: Queries on Sub-objects.
tacoman_cool
Offline Offline
Send Email Send Email
 
Hi kioopi,

You're write. There isn't a way to do that currently. I've been
thinking along those lines though and came up with the idea of some
kind of "has" syntax.

It would work something like this:

// See if there is a city variable
collection.find(address:{has:"city"});

// Match on the city variable
collection.find(address:{has:{"city":"paris"}});

One issue with this solution is that you can still only go one level
lower. However Taffy DB isn't really designed as a way to query object
data as it is a way to query tabular data.

Any thoughts on this?

For right now about the only way you could do this would be to use
forEach and create a custom function. I didn't test this could but it
should work:

// add custom findByCity function
people.findByCity = function (SearchCity)
{
	 var cityMatches = [];
	 // Lookup based on argument city and march cityFound column
	 people.forEach(function(r) {
		 if (r.address.city == SearchCity) {
			 r.cityFound = true;
		 } else {
			 r.cityFound = false;
		 }
		 return r;
	 });
	 // search on city found column
	 cityMatches = people.find({cityFound:true});
	 // reset cityFound column
	 people.update({cityFound:false});
	 // return city found
	 return cityMatches;
};

// do a lookup using find and new function
people.find({somedata:"10"},people.findByCity("Paris"));

Ian

--- In taffydb@yahoogroups.com, kioopi <no_reply@...> wrote:
>
> Hi All,
>
> TaffyDB is amazing, but i have a problem that seems not to be possible
> in Taffy. I would like to do "relational"-queries on subobjects.  An
> example:
>
> i have Objects with subobjects encaosulating adresses  like this in a
> TaffyDB:
>
> {
>    somedata : '123456',
>    adress : {
>       city : 'paris',
>       zipcode : '15'
>    }
> }
>
> now i would like to get objects based on values of the adress-objects.
>
> var results = taffydb.get( {somdata:{start:'12'},
> adress:{city:'paris',zipcode:'15'}});
>
> returns the entry, but when i change the values of adress in the query,
> for example removing the city or even trying to select several zipcodes,
> like this { adress: {zipcode : [13,14,15]}} i get no results at all.
>
> I guess this is because only object-equality is checked and the
> sub-object in the query is not recursivley parsed by Taffy.
>
> Any ideas about this? Is this somehow possible with taffy?
>
> Thanks in advance for your time.
>
> Cheers
> kioopi
>

#15 From: kioopi
Date: Thu May 8, 2008 2:04 pm
Subject: Queries on Sub-objects.
kioopi
Offline Offline
 
Hi All,

TaffyDB is amazing, but i have a problem that seems not to be possible
in Taffy. I would like to do "relational"-queries on subobjects.  An
example:

i have Objects with subobjects encaosulating adresses  like this in a
TaffyDB:

{
    somedata : '123456',
    adress : {
       city : 'paris',
       zipcode : '15'
    }
}

now i would like to get objects based on values of the adress-objects.

var results = taffydb.get( {somdata:{start:'12'},
adress:{city:'paris',zipcode:'15'}});

returns the entry, but when i change the values of adress in the query,
for example removing the city or even trying to select several zipcodes,
like this { adress: {zipcode : [13,14,15]}} i get no results at all.

I guess this is because only object-equality is checked and the
sub-object in the query is not recursivley parsed by Taffy.

Any ideas about this? Is this somehow possible with taffy?

Thanks in advance for your time.

Cheers
kioopi

#14 From: wyzewoman99
Date: Sat May 3, 2008 7:10 pm
Subject: Re: New Example Weekly Schedule App
wyzewoman99
Offline Offline
 
--- In taffydb@yahoogroups.com, "tacoman_cool" <ian@...> wrote:
>
> You can view source to see the code. It is all inline JavaScript and
> there are some comments to show how it works.
>
> The DOM API I'm using is the 16 line Hyperscript example. It makes it
> really easy to write out code to the interface inline by creating
> functions for each tag (span(),div(), etc).
>
> Hyperscript:
> http://elzr.com/posts/hyperscript
>
> Beyond that it is just event handlers and calls to the four Taffy
> Collections.
>
> --- In taffydb@yahoogroups.com, wyzewoman99 <no_reply@> wrote:
> >
> > --- In taffydb@yahoogroups.com, "tacoman_cool" <ian@> wrote:
> > >
> > > I added a new example application to show how to use TaffyDB in the
> > > real world. I hope to add more of these in the future so let me know
> > > what you are looking for.
> > >
> > > Ian
> > >
> > > http://taffydb.com/example_schedule.cfm
> > >
> >
> > This looks neat!  Any chance you'd be willing to post the code so I
> can see how you've made
> > it?
> >
> > (Apologies if you've seen this message twice before... I keep
> posting it and it keeps not
> > showing up...)
> >
> > Thanks!
> >
>

Oh, thanks.  I had tried view source but apparently didn't scroll down far
enough!

Kendra

#13 From: "tacoman_cool" <ian@...>
Date: Sat May 3, 2008 7:09 pm
Subject: Re: New Example Weekly Schedule App
tacoman_cool
Offline Offline
Send Email Send Email
 
You can view source to see the code. It is all inline JavaScript and
there are some comments to show how it works.

The DOM API I'm using is the 16 line Hyperscript example. It makes it
really easy to write out code to the interface inline by creating
functions for each tag (span(),div(), etc).

Hyperscript:
http://elzr.com/posts/hyperscript

Beyond that it is just event handlers and calls to the four Taffy
Collections.

--- In taffydb@yahoogroups.com, wyzewoman99 <no_reply@...> wrote:
>
> --- In taffydb@yahoogroups.com, "tacoman_cool" <ian@> wrote:
> >
> > I added a new example application to show how to use TaffyDB in the
> > real world. I hope to add more of these in the future so let me know
> > what you are looking for.
> >
> > Ian
> >
> > http://taffydb.com/example_schedule.cfm
> >
>
> This looks neat!  Any chance you'd be willing to post the code so I
can see how you've made
> it?
>
> (Apologies if you've seen this message twice before... I keep
posting it and it keeps not
> showing up...)
>
> Thanks!
>

#12 From: wyzewoman99
Date: Sat May 3, 2008 1:18 pm
Subject: Re: New Example Weekly Schedule App
wyzewoman99
Offline Offline
 
--- In taffydb@yahoogroups.com, "tacoman_cool" <ian@...> wrote:
>
> I added a new example application to show how to use TaffyDB in the
> real world. I hope to add more of these in the future so let me know
> what you are looking for.
>
> Ian
>
> http://taffydb.com/example_schedule.cfm
>

This looks neat!  Any chance you'd be willing to post the code so I can see how
you've made
it?

(Apologies if you've seen this message twice before... I keep posting it and it
keeps not
showing up...)

Thanks!

#11 From: "tacoman_cool" <ian@...>
Date: Wed Apr 30, 2008 8:19 pm
Subject: Re: Find: Empty array
tacoman_cool
Offline Offline
Send Email Send Email
 
Matt,

Yeah, I thought about doing that. I guess I was afraid it would add to
much complication. My theory was that if someone needed to do it they
could also change the number inline. If they wanted greater than or
equal to 5 they would need to do greaterthan:4 and the like. Not a
perfect solution but it saves code.

Ian

--- In taffydb@yahoogroups.com, "berg.matt" <berg.matt@...> wrote:
>
> Ian,
>
> Thanks for the prompt response.  It works perfectly.
>
> Not to be the only one to keep requesting things, but a greater than
> or equal might be a nice addition as well.  Though I suppose you could
> just use a combination of equal and greaterthan.  Just a thought.
>
> Thanks,
>
> Matt
>
>
> --- In taffydb@yahoogroups.com, "tacoman_cool" <ian@> wrote:
> >
> > Hey Matt,
> >
> > I dropped another release that I think will address your issue.
> > Download the latest on taffydb.com
> >
> > There should now be a couple of ways of finding an empty array
> > depending on what you want to do.
> >
> > Using length:
> > collection.find({arrayCol:{length:0}});
> > collection.find({arrayCol:{length:{lt:10}}});
> >
> > Using isSameArray:
> > collection.find({arrayCol:{isSameArray:[]}});
> >
> > I'll be updating the getting started article with more details
> > sometime today. Let me know if you have any questions or run into any
> > bugs.
> >
> > Ian
> >
> > --- In taffydb@yahoogroups.com, "berg.matt" <berg.matt@> wrote:
> > >
> > > Ian,
> > >
> > > Adding the ability to find by length sounds like the perfect
solution,
> > > especially if it is flexible for both arrays and strings.
> > >
> > > What you have envisioned would work nicely for me.
> > >
> > > Matt
> > > http://www.vitalist.com
> > >
> > > --- In taffydb@yahoogroups.com, "tacoman_cool" <ian@> wrote:
> > > >
> > > > Hi Matt,
> > > >
> > > > You know, I don't think you can do that natively....but it may
be a
> > > > good thing to add. One thing you can do currently is create a new
> > > > column with forEach to contain the length of the array (see
> example at
> > > > end of email). Only issue is that the forEach will have to be run
> > > > anytime you update the array in order to keep it current.
> > > >
> > > > I think I could patch Taffy to support what you are trying to do
> > > > though. Here is the syntax I envision:
> > > >
> > > > collection.find({arrayColumn:{length:0}});
> > > >
> > > > or for a greater than check:
> > > >
> > > > collection.find({arrayColumn:{length:{gt:25}}})
> > > >
> > > > Thoughts of this before I try and implement it? It would work for
> > > > strings as well.
> > > >
> > > > Ian
> > > >
> > > >
> > > > // forEach to create a new column with array length
> > > >
> > > > var emptyArrayTest = new TAFFY([{orange:[],box:"first"},
> > > > {orange:["12 oranges"],box:"second"}]);
> > > >
> > > > alert(emptyArrayTest.length);
> > > >
> > > > emptyArrayTest.forEach(function(r) {
> > > >  r.orangeLength = r.orange.length
> > > >  return r});
> > > >
> > > > alert(emptyArrayTest.first({orangeLength:0}).box);
> > > >
> > > > --- In taffydb@yahoogroups.com, "berg.matt" <berg.matt@> wrote:
> > > > >
> > > > > I know that you have the "contains" option, but what about
finding
> > > > > records with an empty array?  I have tried a few options that
> don't
> > > > > seem to work.
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Matt
> > > > >
> > > >
> > >
> >
>

#10 From: "berg.matt" <berg.matt@...>
Date: Wed Apr 30, 2008 7:18 pm
Subject: Re: Find: Empty array
berg.matt
Offline Offline
Send Email Send Email
 
Ian,

Thanks for the prompt response.  It works perfectly.

Not to be the only one to keep requesting things, but a greater than
or equal might be a nice addition as well.  Though I suppose you could
just use a combination of equal and greaterthan.  Just a thought.

Thanks,

Matt


--- In taffydb@yahoogroups.com, "tacoman_cool" <ian@...> wrote:
>
> Hey Matt,
>
> I dropped another release that I think will address your issue.
> Download the latest on taffydb.com
>
> There should now be a couple of ways of finding an empty array
> depending on what you want to do.
>
> Using length:
> collection.find({arrayCol:{length:0}});
> collection.find({arrayCol:{length:{lt:10}}});
>
> Using isSameArray:
> collection.find({arrayCol:{isSameArray:[]}});
>
> I'll be updating the getting started article with more details
> sometime today. Let me know if you have any questions or run into any
> bugs.
>
> Ian
>
> --- In taffydb@yahoogroups.com, "berg.matt" <berg.matt@> wrote:
> >
> > Ian,
> >
> > Adding the ability to find by length sounds like the perfect solution,
> > especially if it is flexible for both arrays and strings.
> >
> > What you have envisioned would work nicely for me.
> >
> > Matt
> > http://www.vitalist.com
> >
> > --- In taffydb@yahoogroups.com, "tacoman_cool" <ian@> wrote:
> > >
> > > Hi Matt,
> > >
> > > You know, I don't think you can do that natively....but it may be a
> > > good thing to add. One thing you can do currently is create a new
> > > column with forEach to contain the length of the array (see
example at
> > > end of email). Only issue is that the forEach will have to be run
> > > anytime you update the array in order to keep it current.
> > >
> > > I think I could patch Taffy to support what you are trying to do
> > > though. Here is the syntax I envision:
> > >
> > > collection.find({arrayColumn:{length:0}});
> > >
> > > or for a greater than check:
> > >
> > > collection.find({arrayColumn:{length:{gt:25}}})
> > >
> > > Thoughts of this before I try and implement it? It would work for
> > > strings as well.
> > >
> > > Ian
> > >
> > >
> > > // forEach to create a new column with array length
> > >
> > > var emptyArrayTest = new TAFFY([{orange:[],box:"first"},
> > > {orange:["12 oranges"],box:"second"}]);
> > >
> > > alert(emptyArrayTest.length);
> > >
> > > emptyArrayTest.forEach(function(r) {
> > >  r.orangeLength = r.orange.length
> > >  return r});
> > >
> > > alert(emptyArrayTest.first({orangeLength:0}).box);
> > >
> > > --- In taffydb@yahoogroups.com, "berg.matt" <berg.matt@> wrote:
> > > >
> > > > I know that you have the "contains" option, but what about finding
> > > > records with an empty array?  I have tried a few options that
don't
> > > > seem to work.
> > > >
> > > > Thanks,
> > > >
> > > > Matt
> > > >
> > >
> >
>

#9 From: "Don Smith" <donwsmith@...>
Date: Wed Apr 30, 2008 5:09 pm
Subject: Re: Re: Find: Empty array
donwsmith@...
Send Email Send Email
 
That is awesome. While I didn't request this, it is a welcome addition. Thanks for your prompt attention to this deficiency.

-Don

On Wed, Apr 30, 2008 at 9:44 AM, tacoman_cool <ian@...> wrote:

Hey Matt,

I dropped another release that I think will address your issue.
Download the latest on taffydb.com

There should now be a couple of ways of finding an empty array
depending on what you want to do.

Using length:
collection.find({arrayCol:{length:0}});
collection.find({arrayCol:{length:{lt:10}}});

Using isSameArray:
collection.find({arrayCol:{isSameArray:[]}});

I'll be updating the getting started article with more details
sometime today. Let me know if you have any questions or run into any
bugs.

Ian



--- In taffydb@yahoogroups.com, "berg.matt" <berg.matt@...> wrote:
>
> Ian,
>
> Adding the ability to find by length sounds like the perfect solution,
> especially if it is flexible for both arrays and strings.
>
> What you have envisioned would work nicely for me.
>
> Matt
> http://www.vitalist.com
>
> --- In taffydb@yahoogroups.com, "tacoman_cool" <ian@> wrote:
> >
> > Hi Matt,
> >
> > You know, I don't think you can do that natively....but it may be a
> > good thing to add. One thing you can do currently is create a new
> > column with forEach to contain the length of the array (see example at
> > end of email). Only issue is that the forEach will have to be run
> > anytime you update the array in order to keep it current.
> >
> > I think I could patch Taffy to support what you are trying to do
> > though. Here is the syntax I envision:
> >
> > collection.find({arrayColumn:{length:0}});
> >
> > or for a greater than check:
> >
> > collection.find({arrayColumn:{length:{gt:25}}})
> >
> > Thoughts of this before I try and implement it? It would work for
> > strings as well.
> >
> > Ian
> >
> >
> > // forEach to create a new column with array length
> >
> > var emptyArrayTest = new TAFFY([{orange:[],box:"first"},
> > {orange:["12 oranges"],box:"second"}]);
> >
> > alert(emptyArrayTest.length);
> >
> > emptyArrayTest.forEach(function(r) {
> > r.orangeLength = r.orange.length
> > return r});
> >
> > alert(emptyArrayTest.first({orangeLength:0}).box);
> >
> > --- In taffydb@yahoogroups.com, "berg.matt" <berg.matt@> wrote:
> > >
> > > I know that you have the "contains" option, but what about finding
> > > records with an empty array? I have tried a few options that don't
> > > seem to work.
> > >
> > > Thanks,
> > >
> > > Matt
> > >
> >
>



#8 From: "tacoman_cool" <ian@...>
Date: Wed Apr 30, 2008 4:44 pm
Subject: Re: Find: Empty array
tacoman_cool
Offline Offline
Send Email Send Email
 
Hey Matt,

I dropped another release that I think will address your issue.
Download the latest on taffydb.com

There should now be a couple of ways of finding an empty array
depending on what you want to do.

Using length:
collection.find({arrayCol:{length:0}});
collection.find({arrayCol:{length:{lt:10}}});

Using isSameArray:
collection.find({arrayCol:{isSameArray:[]}});

I'll be updating the getting started article with more details
sometime today. Let me know if you have any questions or run into any
bugs.

Ian

--- In taffydb@yahoogroups.com, "berg.matt" <berg.matt@...> wrote:
>
> Ian,
>
> Adding the ability to find by length sounds like the perfect solution,
> especially if it is flexible for both arrays and strings.
>
> What you have envisioned would work nicely for me.
>
> Matt
> http://www.vitalist.com
>
> --- In taffydb@yahoogroups.com, "tacoman_cool" <ian@> wrote:
> >
> > Hi Matt,
> >
> > You know, I don't think you can do that natively....but it may be a
> > good thing to add. One thing you can do currently is create a new
> > column with forEach to contain the length of the array (see example at
> > end of email). Only issue is that the forEach will have to be run
> > anytime you update the array in order to keep it current.
> >
> > I think I could patch Taffy to support what you are trying to do
> > though. Here is the syntax I envision:
> >
> > collection.find({arrayColumn:{length:0}});
> >
> > or for a greater than check:
> >
> > collection.find({arrayColumn:{length:{gt:25}}})
> >
> > Thoughts of this before I try and implement it? It would work for
> > strings as well.
> >
> > Ian
> >
> >
> > // forEach to create a new column with array length
> >
> > var emptyArrayTest = new TAFFY([{orange:[],box:"first"},
> > {orange:["12 oranges"],box:"second"}]);
> >
> > alert(emptyArrayTest.length);
> >
> > emptyArrayTest.forEach(function(r) {
> >  r.orangeLength = r.orange.length
> >  return r});
> >
> > alert(emptyArrayTest.first({orangeLength:0}).box);
> >
> > --- In taffydb@yahoogroups.com, "berg.matt" <berg.matt@> wrote:
> > >
> > > I know that you have the "contains" option, but what about finding
> > > records with an empty array?  I have tried a few options that don't
> > > seem to work.
> > >
> > > Thanks,
> > >
> > > Matt
> > >
> >
>

#7 From: "berg.matt" <berg.matt@...>
Date: Tue Apr 29, 2008 3:08 pm
Subject: Re: Find: Empty array
berg.matt
Offline Offline
Send Email Send Email
 
Ian,

Adding the ability to find by length sounds like the perfect solution,
especially if it is flexible for both arrays and strings.

What you have envisioned would work nicely for me.

Matt
http://www.vitalist.com

--- In taffydb@yahoogroups.com, "tacoman_cool" <ian@...> wrote:
>
> Hi Matt,
>
> You know, I don't think you can do that natively....but it may be a
> good thing to add. One thing you can do currently is create a new
> column with forEach to contain the length of the array (see example at
> end of email). Only issue is that the forEach will have to be run
> anytime you update the array in order to keep it current.
>
> I think I could patch Taffy to support what you are trying to do
> though. Here is the syntax I envision:
>
> collection.find({arrayColumn:{length:0}});
>
> or for a greater than check:
>
> collection.find({arrayColumn:{length:{gt:25}}})
>
> Thoughts of this before I try and implement it? It would work for
> strings as well.
>
> Ian
>
>
> // forEach to create a new column with array length
>
> var emptyArrayTest = new TAFFY([{orange:[],box:"first"},
> {orange:["12 oranges"],box:"second"}]);
>
> alert(emptyArrayTest.length);
>
> emptyArrayTest.forEach(function(r) {
>  r.orangeLength = r.orange.length
>  return r});
>
> alert(emptyArrayTest.first({orangeLength:0}).box);
>
> --- In taffydb@yahoogroups.com, "berg.matt" <berg.matt@> wrote:
> >
> > I know that you have the "contains" option, but what about finding
> > records with an empty array?  I have tried a few options that don't
> > seem to work.
> >
> > Thanks,
> >
> > Matt
> >
>

#6 From: "tacoman_cool" <ian@...>
Date: Tue Apr 29, 2008 2:50 pm
Subject: Re: Find: Empty array
tacoman_cool
Offline Offline
Send Email Send Email
 
Hi Matt,

You know, I don't think you can do that natively....but it may be a
good thing to add. One thing you can do currently is create a new
column with forEach to contain the length of the array (see example at
end of email). Only issue is that the forEach will have to be run
anytime you update the array in order to keep it current.

I think I could patch Taffy to support what you are trying to do
though. Here is the syntax I envision:

collection.find({arrayColumn:{length:0}});

or for a greater than check:

collection.find({arrayColumn:{length:{gt:25}}})

Thoughts of this before I try and implement it? It would work for
strings as well.

Ian


// forEach to create a new column with array length

var emptyArrayTest = new TAFFY([{orange:[],box:"first"},
{orange:["12 oranges"],box:"second"}]);

alert(emptyArrayTest.length);

emptyArrayTest.forEach(function(r) {
	 r.orangeLength = r.orange.length
	 return r});

alert(emptyArrayTest.first({orangeLength:0}).box);

--- In taffydb@yahoogroups.com, "berg.matt" <berg.matt@...> wrote:
>
> I know that you have the "contains" option, but what about finding
> records with an empty array?  I have tried a few options that don't
> seem to work.
>
> Thanks,
>
> Matt
>

#5 From: "berg.matt" <berg.matt@...>
Date: Tue Apr 29, 2008 2:10 pm
Subject: Find: Empty array
berg.matt
Offline Offline
Send Email Send Email
 
I know that you have the "contains" option, but what about finding
records with an empty array?  I have tried a few options that don't
seem to work.

Thanks,

Matt

#4 From: "tacoman_cool" <ian@...>
Date: Mon Apr 28, 2008 8:44 pm
Subject: Version 1.3 is here
tacoman_cool
Offline Offline
Send Email Send Email
 
Version 1.3 is out. A minor bug fix together with a large drop in code
size. Take a look and download it at:

http://taffydb.com

#3 From: "tacoman_cool" <ian@...>
Date: Sun Apr 27, 2008 5:28 pm
Subject: New Example Weekly Schedule App
tacoman_cool
Offline Offline
Send Email Send Email
 
I added a new example application to show how to use TaffyDB in the
real world. I hope to add more of these in the future so let me know
what you are looking for.

Ian

http://taffydb.com/example_schedule.cfm

#2 From: "tacoman_cool" <ian@...>
Date: Sun Apr 27, 2008 5:17 pm
Subject: Re: Flexible queries
tacoman_cool
Offline Offline
Send Email Send Email
 
I think I understand what you are trying to do and you don't need to
use Eval for it.

This should work:

var year = 2006;
var city = "New York";

var rsltSet = data.get({year:year, city:city});

Alternatively you could also create the filter object outside of the
get call if that makes it easier:

var qry = {};
if (year > 0) {
qry["year"] = year;
}
if (city.length > 0)
{
qry["city"] = city;
}

var rsltSet = data.get(qry);

Hope that helps.

Ian


--- In taffydb@yahoogroups.com, "anodari" <anodari@...> wrote:
>
> Hi!
>
> Taffy DB is a great piece of software!
>
> I'm testing to use it in a CDRom project against a database with about
> 15k records.
>
> There are some simple method I could use optional parameters in a query?
>
> Explaining:
> Suppose I have 2 independent optional parameters to filter: Year and
> City. I want to filter only those the user has filled.
>
> It worked using eval:
>    qry = "rsltSet = data.get({year:'" + year + "', city:'" + city +
"'})";
>    eval(qry);
>
> But that looks ugly.
>
> Some suggestions?
>
> thank you.
>
> Antonio
>

#1 From: "anodari" <anodari@...>
Date: Sun Apr 27, 2008 2:30 pm
Subject: Flexible queries
anodari
Offline Offline
Send Email Send Email
 
Hi!

Taffy DB is a great piece of software!

I'm testing to use it in a CDRom project against a database with about
15k records.

There are some simple method I could use optional parameters in a query?

Explaining:
Suppose I have 2 independent optional parameters to filter: Year and
City. I want to filter only those the user has filled.

It worked using eval:
    qry = "rsltSet = data.get({year:'" + year + "', city:'" + city + "'})";
    eval(qry);

But that looks ugly.

Some suggestions?

thank you.

Antonio

Messages 1 - 30 of 226   Newest  |  < Newer  |  Older >  |  Oldest
Advanced
Add to My Yahoo!      XML What's This?

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help