rblog

I’m back!

Years after the last post rblog is now up and running again. The look and feel is not totally in place, and still missing some features (like search). But:

  • B2Evolution is no longer maintained so that engine could no longer be used
  • Data has been migrated from B2 to WordPress
  • I have developed a new theme custom made for my blog replicating the evopress skin I used on B2.

New features will be added, and most importantly – the datagap from 2018 to 2026 will over time be filled.

Blog down, now up again

My blog had issues today, turned out that my hosting provider had upgraded PHP and that my blog did apparantly not support that version. But I could downgrade the version for my domain on the fly via the admin console. So I did, and voila, all fine again.

Python – gzip has no attribute open

Did try the following

import gzip
f = gzip.open('myfile.gz','rb')

But then got the error

AttributeError: 'module' object has no attribute 'open'

What I really should have done was to read the whole error stack

Traceback (most recent call last):
  File "gzip.py", line 1, in module
    import gzip
  File "d:\test-py\gzip.py", line 13, in 
    fileHandler = gzip.open(pathToGzFile)
AttributeError: 'module' object has no attribute 'open'module

While testing I had named my file

gzip.py

causing Python to believe that I meant “import the script I am testing”. Renamed the file to testgzip.py and it all works fine (name can be whatever, but do not name the file the same as a module you are importing)

During this I found a nice way to pretty print (pprint) the attributes of a module/object in Python, see StackOverflow

Blog upgraded to latest version

It has been a while since the last time I did upgrade my blog engine, so it was really needed now. I did struggle trying to find the guidelines for the manual upgrade. Actually, I did not find them, so I decided to try out the automatic upgrade for the first time. And I must say I’m impressed, the whole process took about 2 minutes, upgrading from 6.5.x to now latest stable. Actually, I did now remember that I have tried out the automatic option the last time, but then it did actually fail due to me being a bit to impatient. Things must have been improved a lot since the last time since there was no way I could interrupt things now. So – B2Evolution is still best!

PhantomJS and 0kb PDF-files

Have spent the past few days troubleshooting an issue with PhantomJS. While veryfing in development and test all was fine, the application running on WebSphere did produce PDF’s like a charm. But when we moved to stage that did not work. The strange thing was that all tests we did from command line was fine, but the application kept on producing 0kb files – the logs told us. Not empty files, empty PDF’s produced by PhantomJS will be 5kb, so this was another issue. So, a new version of the application was deployed which did not delete from the temp folder, .js and .html file was found, but no still no PDF.

I did from previous problems know that a 0kb file on Windows is not always a real file, more a pointer to a file that was there before. And after hours of work with no progress, other than improved logging and good test suites (but not that good since they did not test what caused the error), it turned out to be a .css import in the HTML causing the error. The import statement should be environment aware, but it turned out that it was referring to the development environment. This worked out fine in test since there was no firewall blocking the endpoint, but in stage it was. HTML-files with the import statement pointing to a blocked endpoint caused PhantomJS to produce nothing. Even if the code
console.log(prettyTime() + " [INFO] Now create pdf")
page.render(output, {format: 'pdf'});
console.log(prettyTime() + " [INFO] PDF has now been created")

did not throw any error. While writing this post I did search for page.render and error handling and found this post https://github.com/amir20/phantomjs-node/issues/290 Must admit that I do not understand what

I have changed this behavior to make it more clear. You can do catch() from promise.

really means. I will forward it to the developers. Anyhow, html-file with this error causes PhantomJS to produce nothing without any error. If we removed the import, all fine.

Svn:externals to the rescue

For years I have had this folder structure in SVN related to Splunk

|
|_apps
| |_my-config
|
|_deployment-apps
| |_my-config

Whenever doing changes in my-config under apps I have had to manually copy the changes to deployment\my-config. But today I realized that I have had it, so Google to the rescue. The solution was to use

svn:externals

. So what I did was

  1. SVN deleted the folder deployment-apps\my-config
  2. Updated the folder deployment-apps, added the property svn:externals my-config https://mysvnserver/svn/myrepo/trunk/apps/my-config

Simple as that, and then when you do svn status you will see that deployment-apps\my-config has an X which indicates that is is external

svn status
X deployment-apps\my-config

Performing status on external item at 'deployment-apps\my-config':

My code is on git-hub

Years ago I created a Java program that exports the post from my blog and creates a PDF of the content. I used to have it on Google Code, but is has been taken down a long time ago. Finally I found time to store it elsewhere, now on Github https://github.com/rhellem/b2evolution-to-pdf

Not surprisingly since I am just about to finish the two day intensive GIT traning https://www.praqma.com/training/git-mastering/