Using Conary to install ghostscript

So I was fighting trying to get ghostscript to install on my rpath media wiki appliance. Now I know nothing about Conary so this was a bit over my head but I eventually got it. But don’t trust any of this you have been warned.

What I needed to do was to update my /etc/conaryrc so

vi /etc/conaryrc

and add conary.rpath.com@rpl:2 after the installLabelPath mediawiki.rpath.org@wm:mediawiki-1.x

I think what this does is allow it to resolve its dependencies?

So then run the command

conary updtae ghostscript –resolve

And that looked to have done the trick.

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’

How to mirror output to control two computers (or more) with a single mouse and keyboard

I was looking into this for testing software upgrades (mainly qlikview documents) but it seems that the gaming ‘scene’ has brought a lot of really useful tools for this.

What finally worked out the best for me was some software called multibox.

http://code.google.com/p/multibox/

I at first couldn’t figure out how to use it, ah the joys of undocumented software. But finally I ran into a few posts that clarified the process. What I missed was needing to run a client on both machines and a server on one… pretty obvious!

From here http://wemultibox.com/forums/showthread.php?t=11

Multibox is a software KVM with bundled multiplexer.

Quote:
This program is similar to other programs such as Synergy which allows you to use a single mouse and keyboard to control multiple computers. The advantage of multibox over the alternatives is that it uses relative keyboard/mouse movements (which means it works well with games) and it allows for keyboard and mouse broadcasting.
Keyboard and mouse broadcasting means that when you move the mouse your cursor will move on all connected computers and when you press a key on your keyboard that key will effectively be pressed on ll connected computers. This is particularly useful if you are trying to play multiple characters in a computer game at the same time, though it can also be useful in other scenarios such as presentations.

Initial Setup:
Its use is relatively straightforward. Open up a MultiBox client on each PC, and one single MultiBox server on the “main” PC. When finished, your “main” PC should be running both client and server, and all other PCs will be running the client.

Setting up the clients…
In the client window, accessible through clicking the horizontal lined icon in the taskbar, input the network name of your server machine, and make sure the port range is consistent. Repeat this step for all machines.

Setting up the server…
In the server window, accessible through clicking the smiley face icon in the taskbar, you will see a grid of dropdown menus along with a status textbox. In each dropdown menu you will find the names of each client connected to the server. Place the names of your clients in textboxes as you’d like — the mouse will move between adjacent screens so it’s usually best to lay out the grid just like the monitors are laid out in real life. If you find you do not have a large enough grid to fit your layout, adjust the “layout” section in the server window.

Setting up the broadcast toggles…
To utilize the key multiplexing broadcast feature, select the “key” button next to Keyboard and Mouse. This will allow you to adjust the on/off toggle for your keyboard and mouse multiplexer. Many people prefer buttons like “~” or “Pause Break”. If you’d like to make specific changes to the broadcastable keys, another button will help you configure them.

I also messed around with a modified version of synergy… but it only did keyboard broadcasting and I wanted mouse as well.

http://www.dual-boxing.com/wiki/index.php/Synergy

So now I have the joy of controlling multiple computers, in synch, using one mouse and keyboard.

PS. Another intersting remote/software testing tool is

http://www.vncrobot.com/docs/examples/index.html

sun.net.www.protocol.http.NTLMAuthentication.setHeaders Can’t get a java program to talk through a squid proxy

Uncaught error fetching image:
java.lang.NullPointerException
at sun.net.www.protocol.http.NTLMAuthentication.setHeaders(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.doTunneling(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at sun.awt.image.URLImageSource.getDecoder(Unknown Source)
at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
at sun.awt.image.ImageFetcher.run(Unknown Source)
java.lang.RuntimeException: java.lang.NullPointerException
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at sun.net.www.protocol.http.NTLMAuthentication.setHeaders(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.doTunneling(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

As per this post http://www.mail-archive.com/squid-users@squid-cache.org/msg49361.html

added the following to
squid.conf

    acl Java browser Java/1.4 Java/1.5 Java/1.6
    http_access allow Java 

FYI
Henrik Nordstrom wrote:
> It's a workaround, allowing Java clients access without the need to
> authenticateto the proxy.

which means that whoever will put "Java/1.4" into browser's user
identification string, will be allowed to use proxy without authentication