Advertisements

I’ve been busy, recent projects

I haven’t been posting lately because I’ve been busy 🙂 I really like to document what I’m working on though and frequently use this blog as a personal KB. Anways, I won’t go in huge detail but these are a few things I’ve been messing with.

Barcode detection from scan\faxed images using the amazing zxing http://code.google.com/p/zxing/

There is a port to .net so I used it like this

Imports com.google.zxing

Try

Dim img As New Bitmap(“c:\barcode2.jpg”)

Dim bufimg As com.google.zxing.client.j2se.BufferedImageMonochromeBitmapSource

bufimg = New client.j2se.BufferedImageMonochromeBitmapSource(img, False)

Dim myreader As New oned.Code39Reader

Dim res As com.google.zxing.Result = myreader.decode(bufimg)

tb1.Text = res.getText()

Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try

(This was for detecting a 3of9 barcode)

Now that works for detecting one but I wanted to detect all of the barcodes on the page. What I ended up doing was slicing the image into a 1000 or so slices and trying to detect a barcode in each. This isn’t the most elegant solution but I can get nearly 100% barcode detection of even really very hard to read barcodes.

I’ve also been wanting to write for ever on the super awesome OS project openfiler. This project really impresses me! http://www.openfiler.com/

If you have an ESX box this is a must have. We were always running out of space on our antiquated SAN (we are getting a new one hopefully soon) but in the meantime Slap in an openfiler SAN and you have virtually unlimited capacity. We mainly use it for hosting some of our craplications as well as test\dev systems. But this sucker is rock solid and I am contiunally amazed at it! Oh yeah it handles vmotion awesomely! If I were to install it again I might use one of rpaths installers. I wish I had enough time to mess around and enable replication! I wish it was easier and built in with a GUI! If someone were awesome they would make a disk1 and disk2 install of openfiler that would set up the replication for me! Anyways I can dream.

Also as far as vmware goes, I finally ran into the storage motion plugin! That sucker is great!

http://sourceforge.net/projects/vip-svmotion/

Trust me you want it!

Also vwire makes a nice tool for checking your vmotion configuration http://www.vwire.com/

Speaking of rpath, I recently installed their excellent version of mediawiki (the wiki that runs wikipedia) http://wiki.rpath.com/wiki/Appliance:MediaWiki_Appliance

This was I must say an awesome way to install mediawiki. First thing I did was donwload the ESX version

From here http://www.rpath.org/project/mediawiki/release?id=6286

Then, I copied those files over to the opefiler SAN! that thing is so awesome! using WinSCP

Then I added the virtual machine to the inventory by going to the configuration tab, storage, and then selecting my SAN, right clicking on it Browse Datastore, open the folder and then right click on the mediawiki-1.0-x86_64.vmx file.

I had to remove the NIC and then reinstall it in order to allow Vmotion.

Then I followed these instructions to expand the size of the virtual appliance.

http://wiki.rpath.com/wiki/Appliance:MediaWiki_Appliance

I uploaded a new logo and then edited /srv/mediawiki/LocalSettings.php to

inclue$wgLogo = “http://MyWiki/wiki/images/e/e8/MyLogo.png”;

Next I had to get email to work.

I added this to the LocalSettings.php

$wgSMTP = array(
‘host’ => “10.1.1.1”,
‘IDHost’ => “mailserver”,
‘port’ => 25,
‘auth’ => false,
‘username’ => “”,
‘password’ => “”
);

I also ran

pear update-channels
pear install --alldeps Mail

As spoken about in this post http://mwusers.com/forums/showthread.php?t=6665

Oh, to thumbnails to work I needed to

conary update ImageMagick –install-label conary.rpath.com@rpl:2 –resolve

as spoken about in this post https://issues.rpath.com/browse/BUGS-36

Then the really fun part was getting the ldap authentication to work!

Download from

http://www.mediawiki.org/wiki/Extension:LDAP_Authentication#Current_version

This post http://www.milow.net/public/techblog/setting-up-mediawiki-with-active-directory.html

and this post http://www.ericsantiago.com/eric_santiago/mediawiki/ where helpful

http://ryandlane.com/wprdl/2009/03/23/using-the-ldap-authentication-plugin-for-mediawiki-the-basics-part-1/

but finally after reading the documentaiton I went with

require_once( “$IP/extensions/LdapAuthentication.php” );
$wgAuth = new LdapAuthenticationPlugin();
$wgLDAPDomainNames = array( “nffc.local” );
$wgLDAPUseLocal = true;
$wgLDAPServerNames = array(“nffc.local”=>”myserver.nffc.local”);
$wgLDAPEncryptionType = array(“nffc.local”=>”clear”);
$wgLDAPProxyAgent = array(“nffc.local”=>”cn=hp scanner,ou=service accounts,ou=national users,dc=nffc,dc=local”);
$wgLDAPProxyAgentPassword = array(“nffc.local”=>”mypassword”);
$wgLDAPSearchAttributes = array(“nffc.local”=>”samaccountname”);
$wgLDAPBaseDNs = array(“nffc.local”=>”OU=National Users,DC=nffc,DC=local”);
$wgLDAPPreferences = array(‘nffc.local’=>array( “email”=>”mail”,”realname”=>”cn”,”nickname”=>”samccountName”));
$wgLDAPAddLDAPUsers = false;
$wgLDAPUpdateLDAP = false;
$wgLDAPMailPassword = false;
$wgGroupPermissions[‘*’][‘edit’] = false;
$wgShowIPinHeader = false;

Ok, once ldap was working then I started installing extensions.

The FCKeditor is a really nice extension. Get it from

http://www.mediawiki.org/wiki/Extension:FCKeditor_(Official)

To turn on font coloring make sure to

To enable buttons to change font color in the toolbar, do the following:

  • open fckeditor_config.js file (located inside of extensions/fckeditor directory)
  • uncomment two buttons:
    ['TextColor','BGColor'],
  • save the file, clear your browsers cache
  • done!

A2: If you can’t see the third toolbar (for example with the text color buttons) you have to add this line below of the require_once command in the LocalSettings.php:

 $wgFCKEditorToolbarSet   = "Wiki";

I also installed the ImageMap Extension with

require_once(“$IP/extensions/ImageMap/ImageMap.php”);

in the LocalSettings.php from http://www.mediawiki.org/wiki/Extension:ImageMap

I wanted this so I could create a thumbnail for a PDF and then click on it to load the PDF itself.

This is how to make a thumbnail of a pdf http://blog.prashanthellina.com/2008/02/03/create-pdf-thumbnails-using-imagemagick-on-linux/ you will need to install ImageMagick and then GhostScript

So now a user can upload the pdf thumbnail and then use the imagemap to link to the pdf.

I don’t know why mediawiki doesn’t have a builtin PDF thumbnail! This would be so nice!

I also added the google maps extension.

So then I wanted to get really fancy. I wanted to setup a bunch of stub articles from our ERP and populate them into our wiki.

So the first trick is using the excellent Altova Mapforce to pull out the data and then format it into flat text files for pywikipedia pagefrom file http://meta.wikimedia.org/wiki/Pagefromfile.py

The format is like this

xxxx
'''PageName'''
Text here

yyyy
xxxx
'''AnotherPageName'''
Another text
yyyy

It was pretty difficult to get the bot to login though. After reading a bunch I managed to get a working family file. The hard part was getting it to work with LDAP.

Here is mine

# -*- coding: utf-8  -*-

import family

# The official ABC Wiki.

class Family(family.Family):

def __init__(self):

family.Family.__init__(self)

self.name          = ‘WikiNational’
self.langs         = { ‘en’:         ‘WikiNational’, }
self.namespaces[4] = { ‘_default’:  u’WikiNational’,       }
self.namespaces[5] = { ‘_default’:  u’WikiNational Talk’,  }
self.ldapDomain        = ‘nffc.local’

def version(self, code):
return “1.6.1”

def path(self, code):
return ‘/wiki/index.php’

And my user-config.py ismylang = ‘en’
family = ‘WikiNational’
usernames[‘WikiNational’][‘en’] = u’runaservice’

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: