Programmer’s Notepad


15
Oct 08

Wombat Preset

Matt sent me a Programmer’s Notepad preset for a colour scheme that he uses across all of his editors, known as Wombat:

Programmers Notepad

I like it a lot, perhaps even more than the Zenburn scheme that’s shipping with 0.9 right now. Wombat will be included with the next release, but if you need it now then you can get it here:

Download the Wombat Preset for Programmer’s Notepad

Simply expand the zip and drop the xml file in your PN\presets directory. Then select Wombat from Tools|Options|Styles and press the Load button. Thanks Matt!

Do you have some colours of your own that you think other people would like? Save your preset and send it to me or post it in the forums!


13
Oct 08

Programmer’s Notepad 2 0.9.853

Turbo Pascal Preset  Read only, browser and open files 

Mark All

Today I released a new 0.9 build, here are the highlights:

  1. Create file backups when saving (option, defaulting to off)
  2. Updated some of the images in Find dialog and main UI, read only indicator now uses a tab image instead of text
  3. Extension configuration now stored in user settings directory, meaning this works on Vista without an admin prompt
  4. You can now choose to poll for updates of testing releases (like this one)
  5. Uncomment now works for multiple line-comment lines at once
  6. New keyboard shortcuts for line comments (if you haven’t customised your shortcuts, you’ll get Ctrl-, and Ctrl-. as defaults)
  7. Fixed a crash when going to the Advanced options page
  8. Added a new Turbo preset for Turbo Pascal lovers
  9. Improved the ZenBurn preset
  10. Default scheme font on Vista is now Consolas, still Lucida Console on XP and below

All that, and just since mid-September when .840 was released. If you missed that one, you missed all this:

  1. Allow opening workspace files
  2. Restore editor windows when jumping to a line or tag
  3. Improve regular expressions support (Xpressive now working just fine)
  4. Works on Win2k again
  5. Don’t hold directories open after selecting files
  6. Support explorer context menus in Browser, Open Files and Projects items
  7. Added Mark All (you can’t configure the colors yet, but that’s coming!)
  8. Find in all Project Files
  9. Find next across all open files

You didn’t think I’d been slacking did you?! There have also been lots of behind-the-scenes changes to improve stability and the quality of the code. Not too much more to go now before a new stable release is born. Then onwards with the push to 2.1.

You can download the latest bits here:

0.9.853 Installer

0.9.853 Portable

I’ve also updated PyPN to support Python 2.6 as well as 2.5 and 2.4:

PyPN 0.9.853 for Python 2.4

PyPN 0.9.853 for Python 2.5

PyPN 0.9.853 for Python 2.6


1
Oct 08

And We’re Back!

During my lunch hour today I rebuilt the VM that hosts pnotepad.org and untidy.net. It had been very unreliable over the last few weeks/months and it finally got to the point where it was easier to take the hit and rebuild rather than continuing to nurse it back to life.

Fortunately a good backup plan and the offloading of mail services to Google Apps last year meant that this was relatively painless. It was made even easier by the excellent facilities provided by my virtual machine host Bytemark. They made it a matter of a simple menu selection to have my VM rebuilt with a debian base image, LAMP stack ready to go. Recommended.

As far as I can tell all of the sites are up and working, the one thing remaining for me to check is that mail is still functional. I’ll get to that this evening.

I now need to keep an eye on load and stability with the new install and check that everything is as it should be. This time I made a point of creating a local VM for use when testing configuration changes and web site changes so keeping the server working properly should be easier.


12
Sep 08

Hansel-link, so that’s where the traffic came from

I was out last night, and noticed when I got back that for a brief while the pnotepad.org server had stopped responding. I didn’t really look into it but this morning it all became clear as I read my feeds in Google Reader. Scott Hanselman has a great review of the use of WTL in Chrome (Google’s new browser) in his latest Weekly Source Code.

He linked to an old article I wrote way back when on the Joys of WTL. Fun to see my own words quoted back at me on Scott’s blog! WTL is still the UI framework used for Programmer’s Notepad 2 and in the most part has served very well.

I’d also downloaded the Chromium code to go spelunking into their WTL use having read the excellent post from Peter Krumins’ blog on Code Reuse in Chrome.

Interestingly Google include the WTL code in their distribution, this was something I’d been thinking about doing for PN to reduce the number of steps needed for people to build PN. It would also help with the fact that PN 2.0.9 needs changes currently only available in the WTL Subversion depot.


28
Jul 08

Software Tracking

While playing around with new search engine Cuil I stumbled across a software tracking website I hadn’t seen before: Wakoopa

Sign up for Wakoopa, install a small piece of software and they will track your software use and build up an online profile showing this information. In return they’ll recommend software for you and let you know about new versions. Seems interesting, and you can see a bunch of users of Wakoopa also like Programmer’s Notepad: Programmer’s Notepad on Wakoopa. When I looked, 101 users had clocked up more than 370 hours of usage, across Mexico, Norway, Iran and the Netherlands (amongst many more). Hello international users!

Using Wakoopa reminded me of Ohloh – an open source software tracker. Ohloh concentrates on tracking contributions to open source software, and analyses the source code and commit history for open source projects to build up interesting metrics on each project. Some interesting statistics from the Ohloh Programmer’s Notepad page:

162,795 C++ Code Lines (with a further 29,856 lines of comment)
79,622 C Code Lines (with a further 12,076 lines of comment)

The ratio of comment to code for Programmer’s Notepad 2 is 15.5%, and was only 9.6% for version 1 – clearly I’m getting better behaved in my old age. Statistics are also provided for each developer, and I can see that my Median Commit Rate is 10 commits per month changing 2,200 lines of code – that’s a lot of code for an evenings and weekends project. Of course some of my commits are code contributed by others – don’t want to take all the credit!

You can click the button below to add your support for Programmer’s Notepad at Ohloh:


3
Jun 08

Line Movement Commands with PyPN

A bug on Google Code asked for an alternative to the built-in Transpose Lines command in Programmer’s Notepad, allowing a single command to move the current line up or down, allowing repeated use to shift a line through the current document.

To look at implementing this, I started with a python script – it’s so much quicker than writing C++ code to add these commands and going through compile/test for every change.

Here’s how to add these commands as a couple of scripts (which of course can have keyboard shortcuts):

import pn, scintilla, pypn.glue

@script("Move Line Up", "Text")
def MoveLineUp():
	s = scintilla.Scintilla(pn.CurrentDoc())
	l = s.LineFromPosition(s.CurrentPos)
	if (l == 0):
		return

	s.BeginUndoAction()
	s.LineTranspose()
	s.LineUp()
	s.EndUndoAction()

@script("Move Line Down", "Text")
def MoveLineDown():
	s = scintilla.Scintilla(pn.CurrentDoc())
	l = s.LineFromPosition(s.CurrentPos)
	if (l == (s.LineCount-1)):
		return

	s.BeginUndoAction()
	s.LineDown()
	s.LineTranspose()
	s.EndUndoAction()

Drop this in a file in your scripts directory to use it (remember you need PyPN installed), or wait for the next version of PN which has these commands built in.


28
May 08

Implementing Notepad’s .LOG Feature with PyPN

Notepad has a little-known feature where if you start a file with .LOG then every time the file is loaded the current date and time will be appended to the end of the file – allowing you to use a simple text file as a sort of diary.

A feature request came in for this and, pending a decision on whether to support it directly in Programmer’s Notepad, I decided to show how it could be implemented using the latest PyPN bits:

Updated: Fixed a couple of minor bugs thanks to Jeff Rivett:

import scintilla, pn, pypn.glue, time

oldDocLoad = pypn.glue.onDocLoad

def docLoad(doc):
    """ docLoad handler to implement notepad .LOG functionality"""

    # Get the edit component:
    s = scintilla.Scintilla(doc)

    # Get the first line:
    lineLength = s.LineLength(0)
    text = s.GetText(0, lineLength)

    # If we have .LOG then add a blank line and then the date and time
    if text.startswith(".LOG"):
        timestr = "\r\n\r\n" + time.asctime(time.localtime()) + "\r\n"
        s.AppendText(len(timestr), timestr)

        # Jump to the end of the document
        s.DocumentEnd()

    oldDocLoad(doc)

pypn.glue.onDocLoad = docLoad

Just drop this code in a file called dotlog.py under Programmer’s Notepad\scripts and you’ll have the .LOG functionality. This all uses the very latest 2.0.9 unstable bits and the related PyPN build.


28
May 08

Damien Guard’s Envy Code R Font Updated

Another update to Damien’s great coding font Envy Code R, now at preview 7. This time we get a bunch of hinting improvements (Damien paid big bucks for the software to do this, consider donating!) and improvements when the font is used with larger sizes. Envy Code R also contains all the box drawing characters so makes a good console font – Damien even includes a .reg file to set this up for you.

Here’s what it looks like editing some python code in Programmer’s Notepad 2.0.9 with the Murky theme:

Envy Code R - preview #7

Read more at Damien’s Blog


28
May 08

Programmer’s Notepad 2 0.9.794 Released

It’s time for a second 0.9 unstable release, bringing a number of bug fixes and new features:

  • Automatic Update Check – at launch Programmer’s Notepad checks in the background whether there is an update available and shows you a message if there is one.
  • Vista open and save dialogs are now used throughout when you’re running Vista, previous OS versions should be unaffected
  • Programmer’s Notepad is now marked as Vista-aware, meaning that reads and writes to Program Files and similar locations are no longer redirected to the Virtual Store.
  • Find in Files can now search all open files
  • PyPN update 0.9 fixes a couple of event handlers

The update check is a very commonly requested feature. The system understands the difference between stable and unstable releases so most users will only ever see stable updates.

Currently there’s no UI option to enable unstable update checks (there will be!) but you can enable them for yourself by setting this registry value (assuming you’re using a default PN install):

Key: HKEY_CURRENT_USER\Software\Echo Software\PN2\General Settings
Value (REG_DWORD): CheckForUnstableUpdates = 1

209

What else is new in the 0.9 series?

  1. File browser window
  2. Open files window
  3. New, far better regular expressions support (multiline is coming)
  4. More colour schemes (I’m currently using ZenBurn) and the base styles adapt better with the colour schemes
  5. New PyPN release with more event hooks
  6. More Vista control styling dotted around (when running on Vista!)

Downloads

Installer: http://pnotepad.googlecode.com/files/pn209794.exe
Zip: http://pnotepad.googlecode.com/files/pn209794.zip
Portable Zip: http://pnotepad.googlecode.com/files/portable-pn209794.zip
PyPN for Python 2.4: http://pnotepad.googlecode.com/files/pypn-0.9.794-py24.zip
PyPN for Python 2.5: http://pnotepad.googlecode.com/files/pypn-0.9.794-py25.zip


28
Apr 08

Online Help now using Dokuwiki

The Programmer’s Notepad Online Help was previously run using MoinMoin, a wiki engine developed using Python and one that I was fond of many years ago. As with everything else on the internet, the help website had begun to develop a lot of spam over the last couple of months, and it would seem that MoinMoin just wasn’t up to the job of helping me to fight that.

I had to resort to regularly shelling into the server to rm -rf the page directories manually, as the web UI had nothing useful for removing several days of spam. In addition, managing the user base was a massive pain. Here’s how not to implement user control UI:

  • For every user operation, require the current user to switch into the user they wish to operate on (e.g. admin has to switch to be spammer)
  • Then and only then allow disabling of the spammer account
  • Once disabled, log the current user out rather than return them to their own account

For each bad user, I had to login, switch users, disable account, and log in again. I am fairly sure that the spammers had a much easier job than me!

I stumbled across Dokuwiki while browsing, it looked much better maintained and cared for than MoinMoin, and much more feature-rich – the two features I was particularly looking for were Docbook export (provided via a plugin) and support for Akismet for spam catching. Akismet support was still not available from MoinMoin last I checked. Dokuwiki also has a much better look and feel than MoinMoin alongside including a reasonable web administration interface, and built-in support for syntax highlighting code.

The Online Help site has now been transitioned to Dokuwiki, maybe now would be a good time for you to take a look and maybe contribute!