|


#18

Don't re-publish existing files and images

With Firedrop2, there's a three-step process to getting your new content onto the web.

  1. First, you Build your entries... which means converting them from their easy-to-read text format (with optional mark-up character formatting) into HTML.
  2. Secondly, (and optionally), you can Preview your site using a web browser to view the generated HTML files still residing on your local PC.
  3. And thirdly, you Publish the HTML files to your web server.

All is well and good when you only have a few entries in your blog, article collection or item list. The whole process takes under a minute. But what if you have hundreds of entries, as some users do? You could be waiting a while... Sad

What we need is a way to tell if entries have not changed, and thus skip Building or Publishing them. So, I've put together a way to do that. When you open a Firedrop site, a digital signature (or hash) is created. If you change an entry by even one character, the signature will change, and we'll able to tell that the entry needs to be built and published. If the entry's signature hasn't changed, then we can avoid the time and effort to build and publish it, and the whole process can speed up.

One additional detail - we also want to avoid continually re-publishing images and other files, but it's not as quick to make signatures for each of them. On the other hand, they're not as likely to be changed often. So, we can simply check to see if an image file size is the same locally and remotely, and if so, we can avoid publishing it.

This new functionality is now in SVN, and will be included in the next release of Firedrop2 if the testing goes well.

Posted by midtoad on 2006-04-16 01:40:44.
Categories: python, general, firedrop2
|


#17

Themes with Firedrop2

Firedrop2 now sports themes! There's a new Themes plugin that allows you to change the look of your website with just one click (plus a few selections)... Very Happy

In the next release, Firedrop will ship with at least templates so you can try out different looks for your website. We welcome additional contributions.

If you want to design your own, check out the latest code from Subversion and take a look at the 'themes' folder to see how it works. You need to supply a folder containing a CSS stylesheet file and a theme.ini file describing your theme. Additionally, you should have 'files', 'images' and 'templates' folders. The 'files' folder will contain any special files you require (flash?); the 'images' folder will contain any logos you might want, in addition to the stock Firedrop mini-banner, fd2minibanner.png; and the templates folder will contain, well, templates.

Inside your template folder you will need to have three subfolders, one for each type of site that Firedrop supports: articlecollection, itemlist and weblog. And inside each of these folders you'll want to place the templates required by that site type. All three require entry_template.html and page_template.html, while only Weblog does not use indexpage_template.html. In this way, the look of your site can vary from one site-type to another: maybe your weblog will have a three-column format, while your article collection will have a single-column format.

Say you fire up the Themes plugin (by clicking on the Themes button). You'll see the dialog below.

theme selection dialog

Select one of the available themes, and you'll see a description of it. Of course, a picture is worth more than the description, so just pick one and try it out!

After you select a theme and press ok, you'll see what the plugin proposes to do, as per the image below.

apply the theme

If you're ok with what will happen, say "Oui" (only if your desktop is set up to run in French Very Happy ), and the necessary files will be copied over to your site directory. If all went well, you'll get a confirmation dialog, as below.

theme ok

Note: Any pre-existing templates you had in your site directory will not be deleted, and will be saved with the extension '.bak' added to them. Better move them elsewhere if you need them, though, since if you apply the theme again, a new generation of templates will be copied in, and the next-earlier generation will be backed up, over-writing your earlier backup. Shock

Now you can proceed to Build your site, and Preview it. If you like what you see, then go ahead and Publish it, otherwise, try another theme. Before you build, it might be a good idea to use the Publish > Purge menu to clean out all of the old generated html files and ensure the new ones are written to disk.

If you have any questions, try the Firedrop users list on Sourceforge.net. If this page looks like shite with your browser, please let us which browser you are using.

Posted by midtoad on 2006-04-09 18:51:32.
Categories: python, firedrop2
|


#16

How to connect to a linux server with VNC viewer

This had been bugging me forever!

I run a home webserver on a PC running Mandiva Linux (formerly Mandrake). Occasionally I need to do maintenance on it. No problem, except it's in an awkward connection in a back corner of a room, without proper seating, and the mouse sits on a bendy storage box: uncomfortable working conditions. I would prefer to log in remotely, which would also give me the possibility of doing maintenance from, say, my office.

The easist way to connect to the webserver is via ssh. No problem, just run sshd and configure it for access. I've being doing that for years. (Hint: disable root access via SSH, and also set up an obscure user-ID for your ssh so that hackers can't do a dictionary attack on your usual, visible, username).

Anyway, I wanted to have a graphical login. If I were trying to log in from another linux box, I could export my X desktop, but I'm using Windows. So the preferred way to log in is via VNC. No problem, just set up and run vncserver, then connect via vncviewer, right? Not so fast...

My webserver sits behind a firewall. First I had to set up port forwarding, which was in itself a bit tricky because I have 3 separate machines to connect to. They can't all connect via the usual ports 5800 and 5900. So I set up discrete ranges for each workstation. So far so good, except that I chose ports 6000-6150 for the Linux box. When I tried to connect via HTTP, Firefox refused to send the request, saying that port 6000 was outside the permitted range. In the end, I moved things around so that my Linux box would connect via ports in the normal range.

With Mandriva, you can start the VNC server simply by typing

service vncserver start

but this will start it on the default port of 5900 unless you first take another step. So, create a file called /etc/sysconfig/vncservers and in it put:

VNCSERVERS=1:stewart

Now when you start vncserver, it will use display 1, i.e. port 5901. Make sure you set up your firewall/router to forward that port to your server.

The next step was key. I created a bash script on my workstation from where I want to connect to the remote linux box. You don't need a script; you can just type at the command line, but it will be easier to remember this way. My script file, called vnctunnel.sh, has these contents:

#/! /bin/bash
/usr/bin/ssh -f -L 25901:192.168.1.77:5901 stewart@192.168.1.77 sleep 20

What this does is allow you to open a VNC viewer to your local workstation on port 25901, then ssh will forward that connection to the remote workstation on port 5901. Start the script, and ensure you make the VNC viewer connection within 20 seconds. Once you terminate your VNC session, the ssh connection will also terminate within 20 seconds.

One other thing: if you want to actually be able to do something with the remote session, make sure you don't start it in read-only mode! Rolling Eyes

Lots of more detailed explanations are available.

Posted by midtoad on 2006-03-05 17:47:42.
Categories: admin, linux
|


#15

Modifying open-source software

Let's say you use Microsoft Word and there's a feature missing that you would like. What are your choices?

Now let's say you use open-source software, maybe a Python editor like SPE, and you notice that a desired feature is missing. What are your choices?

Okay, so maybe the last alternative requires some programming expertise. But at least you have a choice !

For some time now, I've been missing a feature in SPE: "Save a Copy". Different from "Save" and "Save As", this feature enables to take a snapshot of a file and save it under a different name, but then continue to work on the original. It's very handy for software files: you make a copy just before starting to work on a new feature that may break your existing code.

Implementing this feature was relatively straightforward: I looked in the code to find the menu item for File > Save, then created a File > Save a Copy entry. I then found the code for the Save As menu item, and copied it and saved it as a Save a Copy function. Then, I made a couple of edits to the function (or method, if you prefer). First off, I invoked the save method so that your current working file is saved. Then, I made use of the Save As method to get the name and location of the file that you want to save to. Finally, I simply copied the existing file to the new filename.

Doing all of this took a little over an hour - on an application I had never seen before. I made changes to 4 different files. To wrap it up, I submitted the change as a patch to the developer so that it can be included in his next release.

This, to me, reflects the power and the beauty of open-source software.

For the coders out there, here are the patches, generated by running diff on the original and modified versions of the files.

diff _spe_old/Child.py _spe/Child.py
12c12
< import codecs, compiler, inspect, os, sys, re, thread, time, types
---
> import codecs, compiler, inspect, os, sys, re, shutil, thread, time, types

391c395,412
<
---
>
>     def saveCopy(self):
>         """firstly save the current file, then make a copy of it"""
>         self.save(self.fileName)
>         defaultDir      = os.path.dirname(self.fileName)
>         dlg             = wx.FileDialog(self, "Save a Copy - www.stani.be",
>             defaultDir  = defaultDir,
>             wildcard    = info.WILDCARD,
>             style       = wx.SAVE|wx.OVERWRITE_PROMPT|wx.CHANGE_DIR)
>         if dlg.ShowModal() == wx.ID_OK:
>             path        = dlg.GetPaths()[0]
>             try:
>                 shutil.copyfile(self.fileName, path)
>             except IOError:
>                 self.parentPanel.messageError("Sorry, I was unable to copy %s to %s" % (
>                     self.fileName, path))
>         dlg.Destroy()
>

diff _spe_old/Menu.py _spe/Menu.py
277a278,281
>     def menu_save_copy(self, event=None):
>         """File > Save a Copy..."""
>         self.app.childActive.saveCopy()
>

diff _spe_old/Menu.wxg _spe/Menu.wxg
28a29,33
>                     <label>Save a&amp;Copy...\tCtrl+Alt+S</label>
>                     <id>SAVECOPY</id>
>                     <handler>menu_save_copy</handler>
>                 </item>
>                 <item>

diff _spe_old/wxgMenu.py _spe/wxgMenu.py
13a14,15
>
> SAVECOPY,

46c48
< [wx.NewId() for x in range(81)]
---
> [wx.NewId() for x in range(82)]

253a256
>         self.file.Append(SAVECOPY, _("Save a &Copy..."), "", wx.ITEM_NORMAL)

389a393
>         self.Bind(wx.EVT_MENU, self.menu_save_copy, id=SAVECOPY)

498a503,505
>     def menu_save_copy(self, event): # wxGlade: Bar.<event_handler>
>         event.Skip()

Posted by midtoad on 2006-02-28 14:35:10.
Categories: linux, general
|


#13

Test Markdown post

BIG HEADLINE!

How about some bold text, italic text, underline text and a footnote? 1

How about some Python code?

a = string.join('a', 'b', 'c')

A code block would be good to see:

a = string.join('a', 'b', 'c')
b = string.join('a', 'b', 'c')

c = string.join('a', 'b', 'c')

And also some list elements:

What is more important?

  1. love
  2. money
  3. health

  1. Footnotes are a way to provide more detail.

Posted by midtoad on 2006-02-26 16:05:47.
Categories: firedrop2
|


#12

Firedrop2 runs on Mandriva Linux

@

FIREDROP2 RUNS ON MANDRAKE LINUX

Firedrop2 runs on Mandriva (formerly Mandrake) Linux! I had a bit of a challenge getting wxpython installed (download the binaries from wxpython.org, and use rpm --nodeps if wxpython tells you it needs a long laundry-list of other items installed - you don't need them to run Firedrop2).

The look of the Firedrop2 GUI is a little different on Linux than on Mac OS X and on Windows, but the functionality is the same, and the widgets all work as they're supposed to.

This means that Firedrop2 will run on virtually any operating system; if you have MovPy on a USB stick, you can plug it into virtually any PC with a USB slot, and be able to edit your blog!

Posted by midtoad on 2006-02-24 23:55:45.
Categories: firedrop2
|


#11

Test Plaintext post

@
BIG HEADLINE!


How about some *bold text*, /italic text/, _underline text_?

How about some code?

+----------------------------------+
|  a = string.join('a', 'b', 'c')  |
+----------------------------------+

and how about a multi-line code block?

+----------------------------------------+
|      a = string.join('a', 'b', 'c')    |
|      a = string.join('a', 'b', 'c')    |
|      a = string.join('a', 'b', 'c')    |
+----------------------------------------+

And also some list elements:

- item 1
- item 2

What is more important?

+ love
+ money
+ health

Posted by midtoad on 2006-02-21 16:50:35.
Categories: firedrop2
|


#10

Test HTML post

@

BIG HEADLINE!

How about some bold text, italic text, underline text? How about some code? a = string.join('a', 'b', 'c') and how about a code block?
a = string.join('a', 'b', 'c')
a = string.join('a', 'b', 'c')
And also some list elements: What is more important?
  1. love
  2. money
  3. health

Posted by midtoad on 2006-02-16 18:25:44.
Categories: firedrop2
|


#9

Test Sextile post

Big headline!

Let's look at some bold text, italic text, underline text.

How about some code?

a = string.join('a', 'b', 'c')

And also some list elements:

What is more important?

  1. love
  2. money
  3. health

Posted by midtoad on 2006-02-16 11:41:59.
Categories: firedrop2
|


#8

Test Textile post

BIG HEADLINE!

How about some bold text, italic text, underline text?

How about some code?

a = string.join(‘a’, ‘b’, ‘c’)

And also some list elements:

What is more important?

  1. love
  2. money
  3. health

Posted by midtoad on 2006-02-16 01:46:41.
Categories: firedrop2
|


#7

Test ReST post

Big headline

Let's look at some bold text, italic text, underline text.

Firedrop is available at Voidspace.org.uk ..

How about some code?

a = string.join('a','b','c')

And also some list elements:

What is more important?

  1. love
  2. money
  3. health

Posted by midtoad on 2006-02-16 01:37:18.
Categories: firedrop2
|


#6

We're stylin' now!

I got tired of looking at bare white pages on this new blog, so I dug out one of my old CSS stylesheets and started editing it. Umpteen revisions later, I have something a little more reasonable-looking. Or not? What do you think?

For you to be able to comment on this, I’ll need to set up a commenting system. That’ll come shortly. See post no. 19.

Posted by midtoad on 2006-02-11 23:46:31.
Categories: firedrop2
|


#5

Firedrop runs on Mac OS X!

I’ve got Firedrop2 running on Mac OS X! This makes the application truly portable, since with only minor tweaking, it will run on Windows, Mac OS X, and Linux systems. Here’s what it looks like:

To get it running on Mac OS X, here are the steps I undertook:

Since you are reading this, I was successful in publishing my entry using the Mac OS X version of the app. BUT, there are a few bugs to be overcome:

Posted by midtoad on 2006-02-10 22:27:26.
Categories: firedrop2
|


#4

Disappearing text with Firedrop

I completed code changes on Firedrop to allow the build.ini file to be read and written using ConfigObj, which like Firedrop itself is written by Fuzzyman. I also added functionality to have the app open a default site; naturally, the user can then edit this folder once the app opens. All is well with the app – sometimes.

When I took my USB key containing MovPy and Firedrop to my office, and ran it there (under WinXP, same as at home), the text doesn’t appear the first time any dialog is opened. It is only after I run any function that displays a file-system directory that the dialogs display their text. Strange!

Posted by midtoad on 2006-02-10 00:23:41.
Categories: firedrop2
|


#3

Hacking on Firedrop2

I’ve started poking around in the Firedrop code to see if there is anything I could work on. One of the first things I noticed was the the build.ini file was being read by a home-grown method, and written back in a similar way. But the MovPy distribution that I’m using for Firedrop includes the ConfigObj toolkit created by Fuzzyman. Why not use that instead?

I made the necessary changes to the code. The method to read the .ini file dropped from 13 lines to 3 lines!

Posted by midtoad on 2006-02-07 12:38:02.
Categories: firedrop2
|


#2

Second post with Firedrop

I got some issues worked out with Firedrop2 and have successfully made a first post with it. I’m composing this post off-line, on an installation of Firedrop2 on a USB memory stick that I have handy. What this means is that I can carry the stick around with me and compose blog entries anywhere I go that has access to a computer.

Once I’ve composed a blog entry, I click one button and it’s copied up to my web server and posted there.

Still to come – work on a graphical design for the pages.

Posted by midtoad on 2006-02-07 00:35:03.
Categories: firedrop2
|


#1

First post with Firedrop2

This is the first post in my new blog, created with the Firedrop2 offline blogging tool.

You can create entries using:

Title Col 1 Col 2
table are also with
entries possible this blog

You can also have some python code in your blog:

if 1: print “Hello, world!”

Headlines of various sizes are possible with Textile:

An HTML first-level heading

An HTML second-level heading

An HTML third-level heading

An HTML fourth-level heading

An HTML fifth-level heading
An HTML sixth-level heading

Tricky! we had to define a new blog2 user whose ‘home directory’ was in fact in the apache webtree.

Smilies

Smile Rolling Eyes

Posted by midtoad on 2006-02-06 20:57:24.
Categories: firedrop2
|