Show Changes Show Changes
Print Print
Recent Changes Recent Changes
Subscriptions Subscriptions
Lost and Found Lost and Found
Find References Find References
Rename Rename
Administration Page Administration Page
Search

History

9/12/2007 3:13:56 PM
-10.10.192.22
7/20/2007 10:42:22 PM
-10.10.192.236
List all versions List all versions

RSS feed for the TestJwd namespace

Wiki Talk Tips And Techniques
.
See_also

General

List of general tips and techniques.

How to combine two arrays

I have no clue how to do this. Does anyone want to explain how to take [1,2,3] and [11,12,13] and return [1,2,3,11,12,13]???

How to determine if a topic name exists

Compare the last modified date to the minimum value of a DateTime object. The following example function returns true if the passed in topic name exists. Example: DoesTopicExist(topic.Name)

DoesTopicExist

Commenting code

You can get around the inability to comment your code by putting comments in quotes and then forcing them to evaluate to nothing. String.Substring(0,0) equates to return zero bytes of the string.

Note that this has a flaw because the example shown returns an array with two elements in it. The first element is an empty string and the second is a link. In this case it is acceptable though because "FlexWiki" inserts the array contents and therefore the empty string is ignored.

CommentCodeExample.Item(0).Type = String
CommentCodeExample.Item(0).Length = 0
CommentCodeExample.Item(1).Type = LinkPresentation
CommentCodeExample

Getting around lack of variables

Normally, when you need to reuse the results of executing code you would put the results in a variable. WikiTalk doesn't support variables. There are several options to get around this.

Option 1 - Use the With keyword

The with keyword lets you take a result and expose it's properties and methods. For example, namespace.TopicsWith("Age") has a Count property and a Collect method. The following code:

ListTopicsWithAgePropertySlowNoWith

could be rewritten to execute the search for Age only once using the with keyword:

ListTopicsWithAgePropertyWith

Option 2 - Assign variables through function parameters

Pass the results of executing the code to a WikiTalkFunction. For example, the following code performs a search for topics with an Age property twice.

ListTopicsWithAgePropertySlow

A more efficient method would be to pass the results of finding topics with the Age property to a function. The function receives the results in a variable.

ListTopicsWithAgeProperty
ListTopicsWithAgePropertyDisplay
{TopicsWithAge |
[
"There are ",
TopicsWithAge.Count,
" topics that have an Age property.", Newline, Newline,
"The list of topics is:", Newline,
TopicsWithAge.Collect { e | [e.Name, Newline]}
]
}

Option 3 - Assign variables through inline block parameters

Pass the results of executing the code to a block that reuses the value. For example, the following code performs a search for topics with an Age property twice.

ListTopicsWithAgePropertySlow

A more efficient method would be to pass the results of finding topics with the Age property to a block. The block receives the results in a variable.

ListTopicsWithAgeProperty

If you find the order (code first, value last) awkward, you can simply define function Using this way:

Using

and then you can rewrite the above code so that it looks more naturally:

ListTopicsWithAgeProperty

Optimizing

WikiTalk is not the fastest thing in the world. This section shows different optimization techniques.

Show only what is requested

When you have a topic that has multiple sections that are generated by WikiTalk, consider using Forms to show small blocks of information as requested. For example, the Index page shows all the topics in this wiki. While the page could show every topic at once, that would be slower and harder to work with. The Index page uses forms to filter topics by first character.

I have used this on our internal Wiki have one page that displays the most recent status reports, active projects and a list of projects by project managers. Forms make it much faster because I only show what the user is interested in.

Not logged in. Log in

The wiki for all things Objective Design Solutions

This is FlexWiki, an open source wiki engine.

This site supports the new NoFollow anti-spam initiative.
Change Style

Recent Topics