;;Insert the BOM at the start of a file for UTF (defun insert-BOM() (interactive) (goto-char (point-min)) (ucs-insert (string-to-number "FEFF" 16)) )
Wednesday, 25 November 2009
Inserting the BOM into a file
Friday, 30 October 2009
My first SSG blog post
Wednesday, 21 October 2009
Why didn't I follow the checklist!?!
Thursday, 15 October 2009
Serverside's new Blog
Friday, 11 September 2009
My First Context Free Upload
Wednesday, 12 August 2009
Emacs 23 - impressions
- The horizontal split when a new buffer is created for something like a *compile*
- The unicode support is much better, I no longer get the unicode "dot" at the start of a file saved by someone with Visual Studio.
- M-x butterfly - this is the sort of stuff that I love about Emacs, is it a hard core editor, yes, but it also wants to have fun!
Wednesday, 29 July 2009
Friday, 3 July 2009
Firefox 3.5
cd /usr/ports/www/firefox35 make config make pkg_delete firefox-3.0.11,4 make installI am guessing it was the fact that I needed to uninstall firefox3 before installing firefox35 was stopping portinstall from working. Also it turned out that I needed to load the sem module too, as per the pkg-message (I should really start reading them).
Monday, 29 June 2009
CouchDB
Wednesday, 10 June 2009
The 3 ways to stop gnome automounting
- As of Gnome 2.22 Nautilus is responsible for doing the auto-mounting so the first solution is to turn off all auto-mounting completely in nautilus. We can do this by setting the configuration
/apps/nautilus/preferences/media_automount
to false. You can do this with the configuration editor or from the shell withgconftool-2 -s --type bool /apps/nautilus/preferences/media_automount false
The problem with this solution is that it will stop Nautilus from auto-mounting anything. - The next option is to make HAL ignore the slices so they are not exposed to Nautilus. The way to do this is to create a fdi file that will tell HAL what to do. You can list the hal properties of everything on you system with lshal in my case the key is block.device and we can use the contains_ncase to find the slices we want to ignore.
<?xml version="1.0" encoding="UTF-8"?> <deviceinfo version="0.2"> <device> <match key="block.device" contains_ncase="/dev/ufsid/"> <merge key="info.ignore" type="bool">true</merge> </match> </device> </deviceinfo>
This works, but again it seems to be a bit of over kill. - The last solution is to set your fstab file to set the noauto option. This is the most simple. Just make sure to us the glabel name for the slice
Sunday, 17 May 2009
Python Decorators
Friday, 15 May 2009
Stack Overflow flair
Tuesday, 5 May 2009
Upgrading to FreeBSD 7.2
- freebsd-update upgrade -r 7.2-RELEASE
- freebsd-update install
- shutdown -r now
- freebsd-update install
- shutdown -r now
Monday, 27 April 2009
Using pygame to develop with context free
import pygame, sys, threading, time, os pygame.init() def setupScreen(width, height): screen = pygame.display.set_mode( (width,height) ) pygame.display.flip() return screen def waitForKeyStroke(): runProgram = True while runProgram: event = pygame.event.wait() if event.type == pygame.QUIT or event.type == pygame.KEYDOWN: runProgram = False def displayImage( screen, path ): px = pygame.image.load(path) screen.blit(px, px.get_rect()) pygame.display.flip() return px class updator(object): def __init__(self, screen, cfdgPath, imagePath): self.running = True self.screen = screen self.cfdgPath = cfdgPath self.imagePath = imagePath self.updatePeriod = 1 def updateScreen(self): while self.running: f = os.popen('cfdg %s %s' % (self.cfdgPath, self.imagePath)) txt = f.read() if f.close(): print txt displayImage(self.screen,self.imagePath) time.sleep(self.updatePeriod) def mainLoop(screen, cfdgPath, imagePath): u = updator(screen,cfdgPath,imagePath) t = threading.Thread(target=u.updateScreen) t.start() waitForKeyStroke() u.running = False t.join(10) if __name__ == "__main__": "Usage cfdgviewer.py
Wednesday, 15 April 2009
Emacs - Copying a whole line without killing it
;Create a COPY line function (defun copy-total-line () "Copy the whole line that the cursor is on" (interactive) ;We want to return to where we started (save-excursion ;Jump to the start of the line (beginning-of-line) ;Store the start of the line (let* ((startpos (point))) ;Move to the end of the line (end-of-line) ;Add it all to the kill ring as M-w would (kill-ring-save startpos (point) ) ) ) ) ;Bind it to M-k (cause I never use kill sentence) (define-key global-map "\M-k" 'copy-total-line)On further searching the Emacs wiki has some other functions to do this, but this way I learned some lisp!
Context Free Art
Thursday, 26 March 2009
Star tracker v0.2 release
Thursday, 19 March 2009
Using openssl to test https sites
Here is an example of use:
openssl s_client -connect www.google.com:443Which yelds:
CONNECTED(00000003) depth=1 /C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA verify error:num=20:unable to get local issuer certificate verify return:0 --- Certificate chain 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com i:/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA 1 s:/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA i:/C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority --- Server certificate -----BEGIN CERTIFICATE----- MIIDITCCAoqgAwIBAgIQPI06ZO4Y3RtzC6GS7viYGzANBgkqhkiG9w0BAQUFADBM MQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkg THRkLjEWMBQGA1UEAxMNVGhhd3RlIFNHQyBDQTAeFw0wODA1MDIxNzAyNTVaFw0w OTA1MDIxNzAyNTVaMGgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh MRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRMwEQYDVQQKEwpHb29nbGUgSW5jMRcw FQYDVQQDEw53d3cuZ29vZ2xlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC gYEAmxntXaVWr0lm23n9whx4Tk8RpYqs4pTu4+JLwAMlp5nMZeHslK6u8KeZvBDX 7YcwR81Q+a/T0/QLjUeKLuLOU5uRmX8eXPkb1umTZ+NK+M/EjAxo0ZdURw4KJDCn gpSu3q4/v7oUxviykI42reHQvhaas15yOEnadKE//9KHge0CAwEAAaOB5zCB5DAo BgNVHSUEITAfBggrBgEFBQcDAQYIKwYBBQUHAwIGCWCGSAGG+EIEATA2BgNVHR8E LzAtMCugKaAnhiVodHRwOi8vY3JsLnRoYXd0ZS5jb20vVGhhd3RlU0dDQ0EuY3Js MHIGCCsGAQUFBwEBBGYwZDAiBggrBgEFBQcwAYYWaHR0cDovL29jc3AudGhhd3Rl LmNvbTA+BggrBgEFBQcwAoYyaHR0cDovL3d3dy50aGF3dGUuY29tL3JlcG9zaXRv cnkvVGhhd3RlX1NHQ19DQS5jcnQwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQUF AAOBgQAxCmyinulUGRZomZHWQ8trtMxszLD78e6BvwArb1ASxq8CKjbBKN7FTFYg bfU9QrkYgSCy3Vdd674yhFBFUW7N5C4qOIifUu0o//yNV7WtZK5NDg7ZPay4/mZM FY9EUvp8PATtfzdhBP7V6bmwnv6lEWnJY9ZGgW8A2HIvgjdEwQ== -----END CERTIFICATE----- subject=/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com issuer=/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA --- No client certificate CA names sent --- SSL handshake has read 1765 bytes and written 322 bytes --- New, TLSv1/SSLv3, Cipher is RC4-SHA Server public key is 1024 bit Compression: NONE Expansion: NONE SSL-Session: Protocol : TLSv1 Cipher : RC4-SHA Session-ID: xxx Session-ID-ctx: Master-Key: xxx Key-Arg : None Start Time: 1237496532 Timeout : 300 (sec) Verify return code: 20 (unable to get local issuer certificate) ---
Wednesday, 11 March 2009
Absolute FreeBSD 2nd edition
loader_logo="beastieIts this sort of useless fact that I love, and while maybe not as important as some other configuration options, I now know that there is a loader.conf and what it does. Chapter 4 - Read this before you break something else! (Backup and Recovery) I was ready to skip this chapter, when my eyes fell upon the section on Revision Control for config files. This is something I have been wondering how to do this properly for a while now, so I stopped skimming and read on. Once again this section was straight forward and explains both the whys and the hows. No more thinking "I should really have this under version control" for me :)
Sunday, 1 March 2009
Star Tracker v 0.1 Live
Tuesday, 24 February 2009
Changing the length of comments for C mode
- M-x customize-variable fill-column
- Set the value and "Save for Future Sessions"
Wednesday, 4 February 2009
Book Reviews
Wednesday, 28 January 2009
A very cool idea
Friday, 23 January 2009
Name on Patent
Monday, 19 January 2009
New Books
Wednesday, 14 January 2009
Sunday, 11 January 2009
.emacs
Wednesday, 7 January 2009
Running CherryPy behind Apache
There are a couple of options on to run CherryPy behind Apache. I have chosen to go for mod_python as the mod_rewrite runs the CherryPy server at the same time (from what I can tell) and it seems to be a little silly to run two servers at once.
It all comes down to the Apache config (which goes in /usr/local/etc/apache22/Includes/cherrypy.conf on my laptop) once you have mod_python installed and in your base Apache config
The actual configuration file for CherryPy takes the following form: <Location "/"> PythonPath "sys.path+['<path to any python modules required>']" SetHandler python-program PythonHandler cherrypy._cpmodpy::handler PythonOption cherrypy.setup <python module to run>::<function in module to run> PythonDebug On </Location>
so on my system with a basic app:
<Location "/"> PythonPath "sys.path+['/usr/local/www/cherrypy/']" SetHandler python-program PythonHandler cherrypy._cpmodpy::handler PythonOption cherrypy.setup myapp::serverless PythonDebug On </Location>
My references: The CherryPy wiki on the subject Mod_Python docs Now just to write some code that actually makes use of it all :)