Showing posts with label Writing Wiki Wednesday. Show all posts
Showing posts with label Writing Wiki Wednesday. Show all posts

Wednesday, February 11, 2009

Writing Wiki Wednesday: Word Count



One thing important to all writers is word count. This is how we get paid, this is the measure of our productivity, this is the demon monkey upon our backs.

I've mentioned before a few times that I use a Personal Wiki to track my writing. Mine is based on Mediawiki running on the MoWeS Software from CHSoftware. I like the wiki because it allows me all the freedom of a word processor, plus the linkability of a wiki. I can track, organize and access all my notes and story ideas very easily. This week I give you another hack to improve your Writing Wiki.

I write stories in sections, generally no more than 4000 words a section, this keeps the wiki pages from getting too big. There are ways around size limits on wiki pages. Also I think ignoring the size limits actually has little consequence for a predominately text page, other than slow loading times. So for me each section is analogous to a chapter. At the top of each section, on the web page, is a little tab counting how many words on that page. Pretty handy.

More Below...


I really have this post over at Demented Kitty to thank for this trick. (And she thanks Kishore Asokan)

This is a simple way to get a word count off of wiki pages. Let's be clear, it's crude and will count almost everything on the page. If you really need a precise word count, just cut and paste into a word processor document, but this will give you a good indicator of where you are.

I had to make some changes to the code/instructions to get it to work on my wiki, this is due to some changes in the Mediawiki software since Demented Kitty's post. My version of Mediawiki is 1.13.1 - I've looked at the Monobook skin file for 1.13.3 and I think this should work.


MediaWiki Word Count Tab


Here's how:

1. This requires a Mediawiki software based Wiki 1.13.1 or later - tested against 1.13.1

2. To put this into your Monobook Skin, open: skins/MonoBook.php

3. Look for this big comment and block of code:


# We don't want to give the watch tab an accesskey if the
# page is being edited, because that conflicts with the
# accesskey on the watch checkbox. We also don't want to
# give the edit tab an accesskey, because that's fairly su-
# perfluous and conflicts with an accesskey (Ctrl-E) often
# used for editing in Safari.
if( in_array( $action, array( 'edit', 'submit' ) )
&& in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
echo $skin->tooltip( "ca-$key" );
} else {
echo $skin->tooltipAndAccesskey( "ca-$key" );
}
echo '>'.htmlspecialchars($tab['text']).'</a></li>';
} ?>



4. Paste the code from below the snip after the } ?> characters at the end of that section and before the next lines of:
  </ul>
</div>


------------------------------snip----------------------------



// Getting the total words count

global $wgUser, $wgArticle, $db;

//check if its an article

if($wgArticle && !$_GET['action']) {

$c=$wgArticle->getContent();

$stripped= strip_tags($c);

$exploded=explode(" ", $stripped);

//you can print this variable anywhere you want

$totalwords=count($exploded);

}

?>
<li><font color="red">&nbsp;
<?php echo $totalwords ;
?> words &nbsp;
</font></li>


-----------------------snip------------------------------

5. Save the skins/MonoBook.php file and upload it to your server.

When you finish, there should be a word count tab at the top of every article page. Some special pages will show the word count tab as well.




...Read Complete Post...

Wednesday, January 21, 2009

Writing Wiki Wednesday: wikEd



So you want to build a Writing Wiki? You may have seen my previous post on the matter:
'Bricked Laptops and Data Backup'. There I discuss the value of the Writing Wiki and why I started one.
To sum:
The entire setup fits on a USB drive, is portable, and designed to be run through any web browser, thanks to the Modular Webserver System, MoWeS for short, from CH Software.
You can track anything you write and link it all together using Wikilinks. Wikilinks and wikitext are the code that determines how a wikipage (or article) will appear. Wikitext is analogous to HTML only much simpler to write, and sometimes much more powerful. Mediawiki Software is built on a database, this allows for dynamic generation of pages based on the content of that database.
More Below...

One example of that would be the Category tag for content, and the ability for content to be associated with multiple categories. Some of my categories are: Ideas, Research, Story, Work In Progress, Submitted, etc. To include an article in a specific category just put [[Category:Story]] *change 'Story' to any Category name - into the wiki page's code. I actually use Templates with pretty graphics that automagically put my documents into the right category, but that's for another day. In the meantime Categories are the easiest way to keep track of Wiki Pages as you create them. Each Category will have it's own page that tracks all articles associated with it, this page is dynamically generated everytime you go to it, and always up to date. I find categories very useful for quick access to documents.

To get started go to the CH Software page and follow their instructions, make sure to select the Mediawiki software and related packages. This can all be done with the free version of their software. CH Software has also packaged other interesting software (Moodle, Taskfreak, Joomla, Wordpress...) if you want to play around.

Now that you have your Writing Wiki, what do you do with it? Well lets start on tweaking it to make it more suitable for writing in. That's right, writing in. I don't open up a word processor to compose a new story or note. Instead I log on to my writing wiki and create a new page within it.

* If you have never used a wiki before I would suggest that you check out some of the excellent documentation on Wikimedia. In fact a great first project may be to build your own "Help Pages" within your wiki. I started that way, and as I make changes or add new functions to my wiki I create/update my help pages.


If you have edited any documents on your wiki by now you will have noticed the simple editing interface offered by the Mediawiki Software. What no 'find and replace'? How do I make a 'bulleted list'? Don't worry, there are ways to do pretty much anything in your wiki that you can do in a normal word processor. The first step is to get some more buttons to make editing easier.

Install WikEd, an externsion developed by Wikipedia User Cacycle. On the Installation Instructions Page there is a Section detailing how to install the full program onto your local wiki. This is the best way to install wikEd if you are like me and don't always write where you have an internet connection. The disadvantage is that once in a while you may have to update the wikEd software to keep up with bug fixes and features. How often is up too you as long as it works ;).

Now you have access to features like:

# Wikicode syntax highlighting
# Pasting, import, & conversion of formatted text from Word Processors and web pages
# Regular expression search and replace
# Edit preview and show changes on the same page without reloading
# Fullscreen editing mode
# Single-click fixing of common mistakes
# History for summary, search, and replace fields
# Jump to selected heading
# Type-ahead find
# Support for many languages
# Improved diff display
# Follow links and wiki-links (ctrl-click)

Missing, of course, is Spellcheck. There has been a lot of debate on how to implement something like spellcheck on a wiki. I personally sidestep the whole issue by putting the spellcheck in my browser. I run Firefox with the "Check my spelling as I type" option selected (Under Tools->Options->Advanced->General). I've also installed the Canadian English Dictionary add-on because I like 'u'. (not much of a joke I know)



...Read Complete Post...

Thursday, January 15, 2009

Bricked Laptops and Data Backup



So I consider myself an above average user of computers. I've grown up with them and worked in the industry doing some pretty advanced stuff. That's why I scoffed this morning when my wife said the laptop isn't powering on. Then I spent some time on it myself and the machine actually wouldn't turn on. It was dead, nothing more than a brick. After removing the battery, and unplugging it (on the theory that 'sleep' had become 'coma'), it still wouldn't turn on. At this point I considered smashing the laptop.

I should mention that I may have a rage issue early in the morning before coffee and of course the chronic pain doesn't help. After dealing with my personal issues I turned my attention back to the laptop. There are tricks and tactics that can be tried on a bricked machine, and I tried them. I also attempted to sacrifice one of my cats but they were too quick for me. So I settled on burning some incense and herbs and whispering sweet nothings into the built in mic.

My laptop eventually came back to the land of the living and I've addressed the bios and software issue that caused this. However this whole experience validates a project I started to prevent this kind of incident from wiping out my various files of stories and notes. Last year I created a Writing Wiki for myself. "What is a 'Writing Wiki'?" you ask. Well let me tell you my friend, (or frenemy, or neutral bystander), it's freedom. I built my wiki on the standard Mediawiki Software, the same software that powers Wikipedia. Only instead of my wiki being an encyclopedia, it's a collection of my work in writing.
More Below...

Wiki software is built on a database. Through the use of links and small snippets of code(wikitext) you can build and do pretty much anything a standard word processor can do: spell check, word count, publish to PDF and more. The more being the exciting part. I go to my wiki in my web browser and there is a webpage that keeps track of all the stories and ideas I'm working on. I can create project pages that link to my rough copies, my outlines, character notes and even responses from submissions. Built into the wiki engine is revision tracking, which adds another layer to editing. This means you can bring back that paragraph that you deleted last month, without looking for an old save of the file. I search my wiki much like any website, allowing me to quickly find something that I wrote quite a while ago, without having to remember filenames or folder locations. As well I have pages that track Writing Markets or contain Research that I've collected off the web or elsewhere.

I used Modular Webserver System, MoWeS for short, from CH Software to power my wiki. Using their software allows me to run the whole thing from a USB stick. Yes a USB stick, and when my laptop bricked this morning I had no worries about lost files, because I can plug that USB stick into pretty much any computer and voilà. I also backup the files from that USB stick onto the hard drive of my desktop, adding a layer of redundancy if I lose the stick.

I've done a number of things to set up my writing wiki by adding my own code to the pages or through the use of the many Extensions for MediaWiki. It's the kind of thing that organically grows to accommodate your needs as you work with it and play with it. To get started on building your own writing wiki check out MoWeS, it's free and comes with a reasonably up to date version of MediaWiki. A USB stick of 250mb is plenty of space to setup your wiki and play.

...Read Complete Post...