Lodahl's blog: 09/01/2009 - 10/01/2009

29 September 2009

Yet another city

Lyngby-Taarbaek switches to OpenOffice: Will prevent illegal downloading

All students and teachers in Lyngby-Taarbaek Municipality is now offered free office suite OpenOffice. It may be the same, and students are not tempted to illegal downloads of Microsoft Office, says the CIO.

Danish news (translated by Google): http://translate.google.com/translate?js=y&prev=_t&hl=da&ie=UTF-8&u=http%3A%2F%2Fwww.version2.dk%2Fartikel%2F12299-lyngby-taarbaek-skifter-til-openoffice-vil-undgaa-ulovlig-download&sl=da&tl=en&history_state0=da%7Cen%7CLyngby-Taarb%25C3%25A6k%2520skifter%2520til%2520OpenOffice%253A%2520Vil%2520undg%25C3%25A5%2520ulovlig%2520download%250A%250AAlle%2520elever%2520og%2520l%25C3%25A6rere%2520i%2520Lyngby-Taarb%25C3%25A6k%2520Kommune%2520tilbydes%2520nu%2520den%2520gratis%2520kontorpakke%2520Openoffice.%2520Den%2520kan%2520det%2520samme%252C%2520og%2520eleverne%2520fristes%2520ikke%2520til%2520ulovlig%2520download%2520af%2520Microsoft%2520Office%252C%2520lyder%2520argumentet.%2520

27 September 2009

OpenOffice.org Newsletter is out (Danish)

The Danish newsletter is published:
http://issuu.com/lodahl/docs/2009oktober?viewMode=presentation

26 September 2009

Extension help content

I have created a few extensions over the last few years. Some of them even include help content to help the users. One problem is, that the XML syntax are rather dificult to figure out. Even a simple document with a few headers and some paragraphs are rather difficult to create.

It would be rather nice if there where an export filter for xhp-files. I have head that such filter exists but I have never found it.

Expired by this article an Linux Magazine by Dimtri Popov ( http://www.linux-magazine.com/Online/Blogs/Productivity-Sauce-Dmitri-s-open-source-blend-of-productive-computing/Format-Writer-Documents-with-Any-Markup ) I decided to try to make a macro to export a document to xhp. So far I got headers, paragraphs and links. There is still some work to do because tables and pictures.

Also the macro will mess up the original document. It would be nice if it only exported the content leaving the original text untouched.

Here is the macro:


REM ***** BASIC *****

Sub HelpContent
If not ThisComponent.hasLocation Then
MsgBox ("Save document befor export", 0 ,"Export to Help content")
stop
End If


MarkupHeadingsFunc("Text body", "", "")
MarkupHeadingsFunc("Heading 1", "", "")
MarkupHeadingsFunc("Heading 2", "", "")
MarkupHeadingsFunc("Heading 3", "", "")
MarkupTextFunc("CharWeight", com.sun.star.awt.FontWeight.BOLD, "&")
MarkupURLFunc

AddText
ExportTheThing

End Sub

Function MarkupHeadingsFunc (StyleName, StartTag, EndTag)
ThisDoc=ThisComponent
ThisText=ThisDoc.Text
ParaEnum=ThisText.createEnumeration
While ParaEnum.hasmoreElements
Para=ParaEnum.nextElement
PortionEnum = Para.createEnumeration
While PortionEnum.hasMoreElements
Portion=PortionEnum.nextElement
If Portion.paraStyleName = StyleName then
Portion.String = StartTag + Portion.String + EndTag
End if
Wend
Wend
End Function

Function MarkupTextFunc(SearchAttrName, SearchAttrValue, ReplaceStr)
Dim SearchAttributes(0) As New com.sun.star.beans.PropertyValue
ThisDoc=ThisComponent
SearchAttributes(0).Name=SearchAttrName
SearchAttributes(0).Value=SearchAttrValue
ReplaceObj=ThisDoc.createReplaceDescriptor
ReplaceObj.SearchRegularExpression=true
ReplaceObj.searchStyles=false
ReplaceObj.searchAll=true
ReplaceObj.SetSearchAttributes(SearchAttributes)
ReplaceObj.SearchString=".*"
ReplaceObj.ReplaceString=ReplaceStr
ThisDoc.replaceAll(ReplaceObj)
End Function

Sub MarkupURLFunc
ThisDoc=ThisComponent
ThisText=ThisDoc.Text
ParaEnum=ThisText.createEnumeration
While ParaEnum.hasmoreElements
Para=ParaEnum.nextElement
PortionEnum=Para.createEnumeration
While PortionEnum.hasMoreElements
Portion=PortionEnum.nextElement
If Portion.HyperlinkURL <> "" then
Portion.String = "" +Portion.String + ""
End if
Wend
Wend
End Sub

function SetFileName() as String


Dim oDoc
Dim sDocURL
If (Not GlobalScope.BasicLibraries.isLibraryLoaded("Tools")) Then
GlobalScope.BasicLibraries.LoadLibrary("Tools")
End If

sDocURL = ThisComponent.getURL()
Directory = DirectoryNameoutofPath(sDocURL, "/")
File_Name = FileNameoutofPath(sDocURL, "/")
New_File_name = ConvertFromUrl(Left(File_Name, Len(File_Name)-4))


SetFileName = ""
boInitialized = false

oListener = CreateUnoListener("MyPick01_", "com.sun.star.ui.dialogs.XFilePickerListener")
oFP = CreateUnoService( "com.sun.star.ui.dialogs.FilePicker" )
With oFP
.setMultiSelectionMode(False)

.Initialize( Array(com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_SIMPLE) )
.appendFilter("Help content", "*.xhp" )
.setTitle( "Help content ..." )
.setDisplayDirectory(Directory)
.setDefaultName(New_File_Name & ".xhp")



If .execute() Then OpenFile = .Files(0)

.removeFilePickerListener(oListener)
.Dispose()
End With
SetFileName = OpenFile

If SetFileName = "" Then
Stop
End if


end function

sub AddText


Starttext= "" & CHR$(10) & "" & CHR$(10) & "" & CHR$(10) & "" & CHR$(10) & "write title here" & CHR$(10) & "write filename here" & CHR$(10) & "" & CHR$(10) & "" & CHR$(10) & "" & CHR$(10) & "" & CHR$(10) & "xxx" & CHR$(10) & "xxx; yyy" & CHR$(10) & ""

EndText = CHR$(10) & "" & CHR$(10) & "
"

Dim oText As Object
oText = ThisComponent.Text

REM Insert some simple text at the start
oText.insertString(oText.getStart(), StartText & CHR$(13), False)
REM Append a new paragraph at the end
oText.insertString(oText.getEnd(), EndText & CHR$(13), False)



end sub

sub ExportTheThing
FileName = SetFilename()


Dim args(0) as new com.sun.star.beans.PropertyValue
args(0).Name = "FilterName"
args(0).Value = "Text"
ThisComponent.storeToURL(FileName,args())


end sub

REM ***** END BASIC *****

19 September 2009

Android - part II

I got my Android phone a few days ago; a HTC Hero from my regular tele provider: Telenor. They called me the day after I ordered it and said that I could pick it up the very next day.
The first thing I did, was to upgrade the firmware. To do that I had to be connected to a PC through the sync software. That is unfortunately a Windows application? Fortunately a have a dual boot pc at my job with Windows (paid and) installed, so I could upgrade the firmware.

I think it's a very nice phone and its very easy to change settings and so on and so forth. One of the first things i did, was to disable the automatic access to mobile internet connection. That kind of stuff is quite expensive here, so I would like to have completely control over that. Getting access to Wifi was easy. I normally use different Wifi connections and they are all set up. When I enter the office, I automatically go on line. Great.

The user interface is elegant but there are place for further improvements. How is is that I an use the touch screen for everything but closing the active window? Or am I just missing something?

Perhaps I need to read the instructions once more.

To navigate between the screens are very nice and its very easy to get around and find what I need. To start an application is just a cick, but how the f%¤# do I close an application again? I found out that I could download and install an application for that. Crazy that you need to have an application to be able to close other applications. Maybe I'm just misunderstanding the concept.

I tried to install a few applications from Android Market and I would like the list of applications to show a short summary fra the description. Some of the applications has quite mysterious names. Its very easy to install and uninstall applications.

The mail application is somehow strange. When I read mail, the mail content will not show national characters properly. Honestly I thought that problems with character encoding was so old school. The Google mail application is fine.

The Google stuff is great. Everybody is very impressed when I show the Google Live Street View.

And I have even tried to talk with someone. Do any of you remember the days, where phones was devices to use for telephone conversations?

17 September 2009

Export to Freemind part III

I just uploaded a new version of the Export Freemind extension. Now you can export any document with any headings. The mindmap structure will be based on the documents outline numbering (Tools - Outline numbering).

If a level is missing (e.g. if Heading 1 - Heading 3 (no Heading 3) the missing level is replaced with a 'dummy' heading with a red color.

New version available at http://extensions.services.openoffice.org/project/Freemind

Feel free to comment and vote.

16 September 2009

The Danish Competition Authority (report in English)

The Danish Competition Authority Recommends a Continued Use of all Open Standards for Office Software in the Public Sector
http://www.ks.dk/index.php?id=28728&L=1

14 September 2009

My experience with Android - part I

I'm working together with a few other consultants on a joint project. Last week I was sitting in the office at customer and one of my co-workers said:

Hey Leif! You are always bragging about being that open source freak. Are you aware that you are the one with the less open sourced mobile?
I must admit that it was embarrassing. I - the open source freak - was using a traditional Nokia running Symbian. And he just bought a new Android phone: The HTC Hero.

I looked at it. I tried that Google application where you can look at Google Street View in 3D (if you turn around, you will automatically switch view direction). Useless gadgets off cause. Who needs that kind of overestimated rubbish.

Today I called my operator and asked about the price and conditions. She told me about I could have a similar phone (because I'm a very valued customer) for almost nothing. Okay then. Please ship it today, I said.

No no. You must go to one of our shops and buy it. Remember to change your subscription first - then you will get it for less. Thanks a lot. I'll go and buy it right away.

Off with the bus. Shift bus twice (no wonder why their phones are so cheep. Their shop is in the middle of nowhere). Okay now finally at the phone shopand I waited only 20 minutes before I could get to talk with one of the shop employees.

Okay - A business subscription - I need to call the business department - Hang on. Waited another 3 - 5 minutes.

Fine - we can change your subscription right away if you buy a new phone. YES! Thats the whole purpose of me beeing here for crying ou loud. I was getting a little irritaded. When all the computer registrations was done, he asked me what phone I would like to buy? Well I was thinking of a HTC Hero, I said.

Ohhhh. Thats ehhh - not good. have you seen the new Iphone by the way? HTC Hero is not on stock and we have no idea about hen we can get another delivery.

WHAT?

This is one of your top models. I talked to a sales woman in business department this afternoon. She send me here.

I guess you will have to wait for my evaluation until later. So far I can only look with envy towards my co-worker by the next table. I think I'll stick with Nokia for a while. At least until Telenor can get me a new phone.

Did I tell you, that I had to wait undtill the guy could undo all his registrations to my subscription?

13 September 2009

Export to Freemind Part II

I have been working to improve the export to Freemind over the last few days.

Here are the new features:

Freemind structure is changed, so that top level is from document properties. I am using Title and Subject if available. Otherwise I just use the filename.

If one or more levels are missing, I will substitute with dummy levels that will be colored red in Freemind. That is to keep the strict structure.

Help content added.

Launching the file with Freemind if possible (For Windows and Linux only). That is if I can find the Freemind program.

Added status in statusbar

Fixed bugs:
Correct encoding of filename with spaces.
Problem with "" and & in headers
Pushing the Cancel button in Save file dialog results in an error.

You can download the extension here: http://extensions.services.openoffice.org/project/Freemind

10 September 2009

Export from OpenOffice to Freemind

I just launched a new extension that exports the structure of headings in a text document to Freemind 0.8 format.




Quite nice if you need to get an overview of a large document.

Please help me test it.

http://extensions.services.openoffice.org/project/Freemind

02 September 2009

Set data free!

In the public administration we can find thousands of small pieces of data that are maintained with one or more specific purposes. What if others (public authorities or private enterprise) could benefit from these data?

Why are these data not available to the public?

Probably because of old fashioned thinking. Minds are like parachutes - they work best when they open.

The National IT- and Tele Agency has just published an analysis in the form of a list of public databases http://digitaliser.dk/ressourcer?tabContainerResources=tabDatakildeResources# . More than 800 small pieces of information. Some of them are already public available but most of them are not.

The purpose of this project is to show that the data exists and who the owner is. This way we can put a pressure on the most important owners to set the data free.

So far I have identified a few interesting databases like a WordNet (Thesaurus) database and lots of interesting GEO data. And then of cause, the list of Results of the control of seed potato - highlights for breeding control in pre-breeding base in 2006 - 2007. Okay not all data are that interesting :-)