Simple data structure in tiddlywiki - tiddlywiki5

I would like to use TW to keep track of the genealogy of some characters in a story.
I would like each character tiddler to have a couple of standard fields: father, mother, date-of-birth, sex, spouse, children
I am trying to figure out how to have some sort of form which it would create the fields automatically when I create a new character tiddler.
I found a couple of relevant tutorials but they are very outdated and in the end they confused me more.
Any help is really appreciated.

Really late, however, check out Memory Keeper, a genealogical solution, that can be used to define characters or real people. You could define events (scenes) and places (settings)—all in TiddlyWiki.
You could write your story in this too.
http://craigsturgeon.com/mk/help/mkhelp.html
An example usage:
http://craigsturgeon.com/mk/example/Churchill-Example.html

Make a characterTiddler, add those fields you said and add the characterTags Save it as $:/_newCharacter.
Then have a tiddler that is used to create new characters add a button that uses the characterTiddler as a template.
In the body of the Character Dashboard type:
//This will make a button that creates your tiddler//
<$button message="tm-new-tiddler" param="$:/_newCharacter">
New character
</$button>
//This is make a list of all tiddlers with the characterTags//
<<list-links "[!is[system]tag[characterTags]">>

Related

Delete a record by reading structure information from a binary file into an array and back into the file C++

Okay guys, first off, yes this is homework, but I do not have the required ranking to place that tag in the tag section, so I am letting you know here. Also, I am fairly new to C++, so please keep that in mind with your responses, I am trying to keep my brain from exploding already.
I have created a Customer structure that allows the user to enter a new customer record, alter an existing customer record, display a specific customer record, display all records, and delete a specific customer record, and everything must be done as a binary file. The part I am having problems with is deleting a specific customer record, the best solution I could come up with was to write all of the records except the one to be deleted into an array, and then re-write the array back into the binary file.
Well, that is what I attempted to do, and it will compile, but when I go to run the program it freezes at the part where you delete a customer record. My code is crazy-long (1114 lines), so I am just going to post the section I am having problems with.
If you guys can tell me what I am doing wrong or show me a better way to delete a record, I would very, very much appreciate it. Please -try- to keep it on the C++ for dummies level (which is what I feel like).
Now you read all the records (upto 150): Customer custRecords[150]; but save only one deleteCustomer.write(reinterpret_cast<char *>(custRecords), sizeof(newCustomer));. Look at the end of the call , sizeof(newCustomer) - it is only one record, you should multiply it by number of records that you have read into custRecords before.

How to determine if a given word or phrase from a list is within an anchor tag?

We have a ColdFusion based site that involves a large number of 'document authors' that have little or no knowledge of HTML. The 'documents' they create are comprised of HTML stored in a table in the database. They use a CKEDITOR interface. The content that they create is output into specific area of the page. The document frequently has tons of technical terms that readers may not be familiar with that we would like to have tooltips automatically show up for.
I and the other programmer want to have some code insert 'tooltip' code into the page based on a list of words in a table on our SQL server. The 'dictionary' table in our database has a unique ID, the word/phrase we will look for and a corresponding definition that would be displayed in the tooltip.
For instance, one of the word/phrases we will be looking for is 'Scrum Master'. If it occurs in the document area, we need to insert code around the words to create a tooltip. To do that, we need to see if certain conditions exist. Are the words within an anchor tag? If yes, is there already a title value for the tag (title is used to contain the info to be displayed in a tooltip)? If a title tag exists, don't do anything. If the words are not in an anchor tag, then we would put anchor tags around the words along with the title that will contain the definition.
The tooltip code we use is via jQuery (http://jqueryui.com/tooltip/). It is quick and simple to use. We just need to figure out how to use it dynamically based on our dictionary table.
Do you have any suggestions of how to go about this?
I was hoping that jSoup might have a function that I could use, but that doesn't seem to be the right technology for what I want to do, but I could be wrong and I am happy to be corrected!
We have a large number of these documents and so manually inserting and maintaining the tooltip code is just not an option.
Update you content with something like:
strOut = ReplaceList(strIn, ValueList(qryTT.find), ValueList(qryTT.replace));
Since words are delimited by spaces, the qryTT.find needs to have spaces. The replace column is going to need to include some of the original content. You are going to have to be careful with words followed by a comma or a period too.
I would cache the results because I would expect it to be memory intensive.

Keep track of all objects created using a form

Ok, this might take a bit of explanation.
I have a class called PurchaceOrder, which has a form with 18 fields. A lot of the time, there will be several PurchaceOrders with the first 12 fields being the same. To facilitate this (and remove the chance of a user making an error when trying to make the 12 fields the same every time) I have a form that allows the user to add more than one PurchaceOrder with the first 12 Fields being carried over from one entry to the next. This is all fine and good, and is working very well.
However; I need a splash page after the user is done adding all of his/her PurchaceOrders, that shows all the entries that were just made. This means I need to track the new entries that are being created, but I can't think of a way to do this. For now I'm just filtering the categories, so that the PurchaceOrders with the first 12 fields being the same as the ones just entered are displayed, but this obviously won't really work (there could be a previous entry that has those 12 fields that are the same). What I'd really like to have is a list of Primary Keys of the entries that were just created. I could then pass this information onto the view that's responsible for the confirmation landing page.
In my current view I have the following:
if form.is_valid():
entry=form.save()
My thinking was that I could then do something like:
pks = [pks, entry.id]
I don't know where I would instantiate the list. If I did it in the view, it would be whipped out every time the page was reloaded.
I'd appreciate any help.
My first thought would be to have a separate class/method/function that keeps track of the PurchaceOrder's in each form. The ID could be tied to the result through a database or array/linked list that is auto-incremented when a new PurchaceOrder is created.
As far as instantiating the list, have it instantiated when the class is first called, or have it as a separate class. After writing that, a separate class makes more sense, which is probably why I posted it that way originally.
After leaving this alone for a long time, I've finally come up with a suitable solution. What I've done is created a url conf that has a regex of (?P<match>/+)/in it. That rexeg will be used to contain an arbitrary number of primary keys separated by /. I use this to store all of the primary keys of the PurchaseOrders that have been created (that is, when I create PurchaseOrder number 15, it redirects me to /new/15, then when I create number 16, it directs me to /new/15/16/, and so on. Then when I'm ready to confirm, I'm sent to /confirm/15/16/ and I can easily access the pk's of the entries I've just created by calling pks=match.split('/'). I can then simply iterate through pks and do something for each object. I think it's an elegant solution, as long as you don't mind your user seeing the primary keys in the url.

How do I find if any names in a list of names appears in a paragraph with ColdFusion?

Assume that I have a list of employee names from a database (thousands, potentially tens-of-thousands in the near future). To make the problem simpler assume that each firstname/lastname combination is unique (a big if, but a tangent).
I also have a RSS stream of news content that pertains to the business (again, could be in the hundreds of items per day).
What I would like to do is detect if an employees name appears in the several paragraph news item and, if so, 'tag' the item with the person its talking about.
There may be more than one employee named in a single news item so breaking the loop after the first positive match isn't a possibility.
I can certainly brute force things: for every news item, loop over each and every employee name and if a regex expression returns a match, make note of it.
Is there a simpler way in ColdFusion or should I just get on with my nested loops?
Just throwing this out there as something you could do...
It sounds like you'll almost unanimously have significantly more employee names than words per post. Here's how I might handle it:
Have an always-running CF app that will pull in the feeds and onAppStart
Grab all employees from your db
Create an app-scoped look up struct with first names as keys and a struct of last names as values ( you could also add middle names sibling to last names with a 3rd tier if desired ).
So one key in the look up might be "Vanessa" with a struct with 2 keys ( "Johnson" and "Forta" ) as its value.
Then, each article you parse, just listToArray with a space as a delimiter and loop through the array doing a simple structKeyExists with each token. For matches, check the next item in the array as a last name.
I'd guess this would be much more performant processingwise than doing however many searches and also take almost no time to code and you can feed in any future sources extremely simply ( your checker takes one argument, any text on Earth ).
Interested to see what route you go and whether your experiments expose anything new about performance in CF.
Matthew, you have a tall order there, and there are really multiple parts to the challenge/solution. But just in terms of comparing a list of values to a given set of text to see if one of them occur in there, you'll find that there's no one could CF function. BEcause of that, I created a new one, findList, available at cflib:
http://cflib.org/index.cfm?event=page.udfbyid&udfid=1908
It's not perfect, nor as optimal as it could be, but it may be a useful first step or you, or give you some ideas. That said, it suited my need (determine if a given blog comment had reference to any of the blacklisted words). I show it comparing a list of URLs, but it could be any words at all. Hope that's a little helpful.
Another option worth exploring is leveraging the Solr engine that ships with CF now. It will do the string search heavy lifting for you and you can probably focus on dynamically keeping your collections up to date and optimized as new feed items come in.
Good luck!

Django create several records at a time

I want to be able to create as many records as a user wants for a database table in a single form.
For example, there will be some inputs for the data required for a record and at the end of the line a "+" button that would make a new line of inputs appear. There should be no limit to the number of lines and when the user clicks on the single submit button, all of the records would be inserted.
Thing is : I don't know how to make a new line appear dynamically, I suppose I have to use jquery for that but I'm kind of a newbie :)
And I don't know how I can iterate through all the lines dynamically added.
If someone can point to an example or something, it'd save me a lot of hair pulling !
EDIT :
By following this blog post I managed to do that. I have one last problem which is : when I try to insert several records at one time, it keeps the last one fine, but the previous ones are considered empty. It tells me that the fields are required, I fill them up and click on save and only then it saves them allright.
Maybe I'll ask a new question for this!
Start here: https://docs.djangoproject.com/en/1.3/topics/forms/modelforms/#model-formsets
I suppose I have to use jquery for that
That can also work.
And I don't know how I can iterate through all the lines dynamically added.
You'll get all the fields of the form (all of them) in your request.POST object. If you use a formset, it will largely be handled by the form's clean() and save() methods.