The "mathy thing" already exists in the form of Frink by Alan Eliasen, a calculator like you have never seen before and that is bound to satisfy just about any problem you can throw at it. Look it up on Google and look at its on-line documentation: http://futureboy.us/frinkdocs/, and I think you will agree. Frink is written in Java and is already on the web, so if you are on-line you can pull in the on-line page at: http://futureboy.us/fsp/frink.fsp where Alan warns you to read the documentation before using it.
On Thu, Feb 12, 2015 at 12:09 PM, Roma Hicks <[email protected]> wrote: > Looks like simple syntax errors are tripping up your loops, invalid > comparisons and redefining a variable that is already in scope are your > major culprits. > Run you code throught http://jshint.com or http://jslint.com and you can > see your errors. > > > On Thursday, February 12, 2015 at 9:20:03 AM UTC-6, Roma Hicks wrote: >> >> Also refactor out concerns in your code. It will help you bug hunt >> faster too. For example, I would personally pull this out of SumField: >> var checkTiddler = $tw.wiki.getTiddler(storeTiddler); >> if(checkTiddler && storeField) { >> output = String(output); >> if(output != checkTiddler.getFieldString(storeField)) { >> $tw.wiki.setText(storeTiddler,storeField,storeIndex,output); >> } >> } >> This has nothing to do with summing fields and it is a rather pivotal >> point in you code where a problem like yours might be arising. Separate it >> out and you can even mock it to see if it is behaving as it should. >> >> Sorry I edited my post and it took a long time so I don't want this >> advice to be overlooked. >> >> On Thursday, February 12, 2015 at 9:09:32 AM UTC-6, Roma Hicks wrote: >>> >>> Hello Jed, I will help you look it over but one thing I would do, is >>> start refactoring some of the code. The is some bits of repeating that you >>> could pull out. For example, your SumField and SumFieldFull and nearly >>> identical. Just call SumField as need in SumFieldFull through your loop. >>> This reduces the amount of code you need to maintain and avoids any >>> mistakes you may have created while copying blocks of code. >>> >>> Because of the nature of TiddlyWiki's plugin mechanism it is rather >>> difficult to debug in browser (or at least that I have found). Sprinkle >>> your code liberally with log outputs and rebuild your plugin. With some >>> good refactoring, and strategic placement of console.log you probably can >>> narrow the problem area quickly. >>> >>> Also refactor out concerns in your code. It will help you bug hunt >>> faster too. For example, I would personally pull this out of SumField: >>> var checkTiddler = $tw.wiki.getTiddler(storeTiddler); >>> if(checkTiddler && storeField) { >>> output = String(output); >>> if(output != checkTiddler.getFieldString(storeField)) { >>> $tw.wiki.setText(storeTiddler,storeField,storeIndex,output); >>> } >>> } >>> This has nothing to do with summing fields and it is a rather pivotal >>> point in you code where a problem like yours might be arising. Separate it >>> out and you can even mock it to see if it is behaving as it should. >>> >>> >>> On Tuesday, February 10, 2015 at 10:42:47 PM UTC-6, Jed Carty wrote: >>>> >>>> I have been trying to get the math plugin I am working on set up as a >>>> daemon that listens for changes and updates its output when one of the >>>> tiddlers that has an expression in it changes. >>>> >>>> At the moment the only function is summing fields from a list of >>>> tiddlers because I am running into a problem. The process will update and >>>> works as expected when there is only one expression to evaluate, and when >>>> there are multiple expressions but neither one actually has values to sum >>>> it works as expected. The second one can be seen because you can set the >>>> default value it outputs when it doesn't have any valid input. >>>> >>>> The problem is that once at least one has valid inputs only one >>>> expression will update. I had assumed that this was because the first >>>> tiddler would write its output and force a refresh that prevented the >>>> daemon from finishing the update for the other expressions, but I can't >>>> find any place where that would happen when only the inputs to the second >>>> expression are changing. >>>> >>>> I have been trying to figure this out for a while without any success, >>>> any ideas? >>>> >>>> The code is on git hub: https://github.com/inmysocks/ >>>> TW5-MathyThing/blob/master/sumfield-daemon.js >>>> >>>> and an example wiki showing what happens is here: >>>> http://ooktech.com/jed/ExampleWikis/MathyThing/ >>>> >>>> The operation takes the list of tiddlers from the filter in the filter >>>> input field and sums the values in the field given in the sum field input >>>> and stores those values in the store field of the store tiddler. The result >>>> is also displayed in the expression tiddler. >>>> >>>> In the example only Expression 1 will update regardless of the changes >>>> to the inputs to Expression 2. >>>> >>>> Sorry if I didn't explain this well, I am very frustrated right now. >>>> Any help would be greatly appreciated. >>>> >>> -- > You received this message because you are subscribed to the Google Groups > "TiddlyWikiDev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/tiddlywikidev. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/tiddlywikidev. For more options, visit https://groups.google.com/d/optout.
