SLeepdepD

Programming

Code Snippet Wiki: MultiBoilerplate

by on Jan.30, 2011, under Programming, Technology

Just found a good solution to get around my problem of having to enter duplicate text every time I create a new snippet entry.  The MultiBoilerplate extension allows you to define different templates and then provides a drop-down to load them:

To set it up I downloaded the extension and added the following to my LocalSettings.php:

require_once( "$IP/extensions/MultiBoilerplate/MultiBoilerplate.php" );

I created the wiki page “MediaWiki:Multiboilerplate” and added the following:

* Code, VBA | Template:CodeVBA/Preload
* Code, SQL | Template:CodeSQL/Preload

This page uses the syntax “* Name | Template”.

I then created the two template pages defined above.  Here’s the VBA one:

== Description ==

== Code ==

<sh lang="vb">

</sh>

[[<noinclude>:</noinclude>Category:Code, VBA]]

Wrapping “<noinclude></noinclude>” around the colon in the catagory label will prevent this template from being included in the “Code, VBA” category, but won’t propagate the colon when the template is loaded in a snippet.

3 Comments :, , more...

Code Snippet Wiki

by on Jan.29, 2011, under Programming, Technology

I’ve started using MoWeS with MediaWiki for a code snippet repository.

It’s not an ideal solution, for instance I have to install an extension and enter duplicate text every time I create a new snippet entry.  It does have everything I was looking for in a solution however:

  1. Easily searchable.
  2. Allows tags or categories.
  3. Support versioning of snippets.

Here’s the initial setup I did:

Extensions

Download the SyntaxHighlight_GeSHi extension.

mysql\my.ini

Add the following under “[mysqld]“:

ft_min_word_len=3

This allows full-text searching on words 3 characters or more.  The MySQL default is 4.

www\mediawiki\LocalSettings.php

Add the following to the end of the file:

# Use "Vector" skin
$wgDefaultSkin = 'vector';

# Restrict anonymous editing
$wgGroupPermissions['*']['edit'] = false;

# Use "suggest" feature in search box
$wgEnableMWSuggest = true;

# Extensions
# SyntaxHighlight_GeSHi
require_once("$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php");

Here’s a screen shot of an entry:

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
2 Comments :, , , more...

Extension talk:SyntaxHighlight GeSHi – MediaWiki

by on Dec.02, 2010, under Programming, Technology

Alternative Hook To “syntaxhighlight”

I’m using Mediawiki and this extension for a code snippet repository and it’s working great. I am finding typing “syntaxhighlight” all the time to be a little cumbersome, so I added the following to the “SyntaxHighlight_GeSHi.php” in the “efSyntaxHighlight_GeSHiSetup” function:

$parser->setHook( 'sh', array( 'SyntaxHighlight_GeSHi', 'parserHook' ) );

Now I can just use “sh” in addition to “syntaxhighlight”.

via Extension talk:SyntaxHighlight GeSHi – MediaWiki.

Leave a Comment :, , , more...


Microsoft Access: “Make-Table Query” Force Memo Fields

by on Oct.05, 2010, under Programming

Unfortunately it looks like there isn’t a way to force Access to make a table with Memo data type fields instead of Text.  A functional work around is:

  1. Run the Make-Table query
  2. Edit the table in Design View
  3. Change the Text field to Memo
  4. Change the Make-Table query to an Append query
  5. Create a Delete query
  6. Run the new Append query
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
    2 Comments : more...

    Tek-Tips: Please bury the hatchet!

    by on Mar.09, 2009, under Programming

    My e-mail to Tek-Tips:

    I believe my account was banned over 3 years ago related to activities coming from my last company’s IP address. I’ve never gotten a response to this issue, but it’s been awhile since I’ve e-mailed requesting to have my account re-enabled, so I just thought I’d try again.  Thanks.

    Leave a Comment : more...


    I Wanna Write a Program

    by on Dec.11, 2008, under Programming

    During my two-week unpaid forced vacation, I want to write an application or create a website but don’t know what programming language to do it in or what I want it to do…any ideas?

    Leave a Comment : more...