Random Ramblings on LabVIEW Design

Community Browser
Labels
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: OpenDocument Format

swatts
Active Participant

Hello my lovelies.

Update: Check out this tool

This article is a little bit different in that it's the beginning of a project I'm been thinking about for a little while. At the very least if I take it no further my scribblings may save someone some time.

First the why

The beauty of having open documents is that as a software developer I can make a package for disribution to my customer without worrying about licenses. This just feel much more wholesome to me. So I've looked at various options (ActiveX OpenOffice, dlls etc), but they all involve driving someone elses code. One of the reference books available is called OASIS OpenDocument Essentials and in it is this little snippet that sums up my general feeling.

When talking about storing in a propriety format rather than an open format.

Note also that your data can become inaccessible when the software vendor moves to a new internal format and stops supporting your current version. (Some people actually suggest that this is not cause for complaint since, by putting your data into the vendor’s proprietary format, the vendor has now become a co-owner of your data. This is, and I mean this in the nicest possible way, a dangerously idiotic idea.)

J. David Eisenberg

What I actually need is a way to generate a spreadsheet checklist for all the VIs in a project.

So what is the OpenDocument format.

Wikipedia sums it up thus.

The Open Document Format for Office Applications (ODF), also known as OpenDocument, is an XML-based file format for spreadsheets, charts, presentations and word processing documents. It was developed with the aim of providing an open, XML-based file format specification for office applications

Stuff I've learnt....

OD File Structure

If you save an OpenOffice or LibreOffice file it will save as an ODS (for a spreadsheet), ODT (for a word processing document) or ODP (for a presentation). These are a JAR format file, this being Java Archive or simply put a ZIPped package where some of the contents are NOT compressed. Here's one unzipped.

FileStructure.png

My first hurdle was not compressing mimetype.

Here's how I did it (using the Open G Advanced Compression VIs, doctored so that I can set the compression type)

CompressDiagram.png

The file that does all the work is content.xml and here's what I've learnt about this bad boy. The best way to describe it is to show a spreadsheet with some data and display the xml and then describe how they get there.

Spreadsheet.pngSpreadsheetxml.png

NOTE: the XML is from a spreadsheet where the columns haven't been squashed for artistic license, the xml for the one shown may therefore have more column info to describe the cell size.

After some headscratching and surprisingly little help from the internet I fathomed that it works like this....

The 3 table:table-column nodes describe the 1st column, the 2nd column with added width and then the remaining columns

We then have 13 table:table-row nodes that contain the cell information.

Of course this all looks lovely and ordered but the file really looks something like this.

<table:table table:name="Sheet1" table:style-name="ta1"><table:table-column table:style-name="co1" table:default-cell-style-name="Default"/><table:table-column table:style-name="co2" table:default-cell-style-name="Default"/><table:table-column table:style-name="co1" table:number-columns-repeated="11" table:default-cell-style-name="Default"/><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Title1</text:p></table:table-cell><table:table-cell table:number-columns-repeated="12"/></table:table-row><table:table-row table:style-name="ro2"><table:table-cell/><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>aaaaaaaaaaaaaaaaaaaaa</text:p></table:table-cell><table:table-cell table:number-columns-repeated="5"/>

So I'll be using the DOM xml parser VIs and some XPath for searching out the nodes.

XMLParserPallette.png

My plan is to make a polymorphic container type component where the polymorphic selector is the command. This will wrap the LVOOP document classes. With methods to Load, Save, Save As, Add Cell to Table, Add Array to Table, Get Cell Data, Get Cell Data Type.


If anyone is interested I'll post the code (it may be useful to use github to allow methods to be added)

Next step is to do some UML diagrams of the class structure. But that's for another day.

Lots of Love

Steve

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

Comments
FabiolaDelaCueva
Active Participant

Steve,

Another great article as usual.

If anyone is interested, I think you were using XML Notepad there to show the orderly view of the XML File.

Toolkits that I have used in the past to interpret XML files that might or might not help in this case are: JKI Easy XML and GXML

During the CLA Summit in Austin we discussed having projects hosted in GitHub where the community could collaborate. This project seems like a good opportunity for that. Let me know if you decide to go that route and I would like to give it a go.

Regards,

Fab

For an opportunity to learn from experienced developers / entrepeneurs (Steve, Joerg, and Brian amongst them):
Check out DSH Pragmatic Software Development Workshop!

DQMH Lead Architect * DQMH Trusted Advisor * Certified LabVIEW Architect * Certified LabVIEW Embedded Developer * Certified Professional Instructor * LabVIEW Champion * Code Janitor

Have you been nice to future you?
swatts
Active Participant

Thanks Fab,

XML Notepad is a really nice tool.

I need to be proved wrong on the toolkits available, I want to be able to navigate the XML tree, I didn't see tools that would help me much (as usual I didn't look very hard). The XPath route seems very handy, being able to list all the descendants of a node seems ideal here. There's also a thing called XQUERY but I'm not finding much LabVIEWesque stuff on it.

I think github would be the ideal place for this, I'm going to post the UML and think about the API design next. I think if we thrash this out prior to githubbing (if that is a suitable verb).

I kind of like the process of opening up the design process too, I presented it at CSLUG and had a pretty good reaction.

Lots of Love

Steve

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

Swinders
Member

Nice post Steve and thanks for sharing at CSLUG.

I've had a bit of a play with this before and missed the do not deflate the MIMETYPE element of the document. Interestingly MS Office does not mind if it is deflated (I used the std LabVIEW ZIP functions). Re-reading the standard document it looks like the MIMETYPE element has to also be the first file as it's used for a 'magic number' sort of file recognition thing to identify the type of file by certain values at set locations.

I'm trying to move away from a custom coded xml spreadsheet to a more flexible type of document format but we don't want MS Office installed on the server where it runs.

Would be a good side project look at.

Steve Swindley (CLA since Feb 2008)
James_McN
Active Participant

Sounds good, as someone who is trying to manage without office for the first time in a long time so I'm intrigued.

I would second Fabiola's comment about putting it on github although my preference has been bitbucket mainly from the option of using mercurial.

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
FabiolaDelaCueva
Active Participant

If there is a choice, I like bitbucket better too

For an opportunity to learn from experienced developers / entrepeneurs (Steve, Joerg, and Brian amongst them):
Check out DSH Pragmatic Software Development Workshop!

DQMH Lead Architect * DQMH Trusted Advisor * Certified LabVIEW Architect * Certified LabVIEW Embedded Developer * Certified Professional Instructor * LabVIEW Champion * Code Janitor

Have you been nice to future you?
swatts
Active Participant

I think github might be a good thing to try as an exercise, we've discussed sticking LabVIEW tools somewhere like this (here for example). The good thing about doing it as part of this blog is that there are many things to learn/report along the way. I'm favouring github for no better reason than I've just set up an account

I have a question for you geniuses tho' I've doctored ZLIB Store File_ogtk.vi from the OpenG Zip Toolkit to allow compression levels to be set, in the spirit of ignoring user lib etc do I package up my doctored zlib library as part of the whole package (protecting it's namesspace in a lvlib perhaps).....thoughts?

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

swatts
Active Participant

Democracy in action, bitbucket it is then.

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

swatts
Active Participant

Although is GitHub better for this type of project?.....discuss

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

James_McN
Active Participant

Honestly I don't know if there is any feature reason why it is or isn't. Github seems to be more popular for opensource projects, my main issue is simply that I never found a Windows client for Git that I liked (or works well with lvdiff and merge) and bitbucket was the site of choice for mercurial.  

That said I'm in the process of looking at codespaces (thanks for the tip off!) and that only supports git or svn and I don't want to go back to svn! So I'm going to have to make my peace with it at some point.

In terms of the changes to the library, this is exactly why we need to use one of these technologies! so you can push it back to the main development. I would be tempted to suggest it probably wants to sit with the package then, maybe a rename would be better to make a clear distinction?

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
JCC_(SK)
Active Participant

Hi Steve

Thank you for sharing.

Long time ago I was datamining from TestStand result XML file (In LabVIEW) and by XPath. Little bit 3W Shool studing and it was OK.

Peter

amfax

swatts
Active Participant

My thoughts exactly, change the name, list dependencies in wiki. Keeps it lightweight.

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

Christian_L
Active Participant

One drawback for BitBucket is that the free version is limited to 5 users on a project. If you can find someone to pay per user, then of course this is not an issue. 

The Systems Engineering group at NI will soon start to post some of our reference designs on GitHub for community contribution. Questions and discussion on this topic can be posted in the Reference Design Portal. 

https://decibel.ni.com/content/projects/community-collaboration 

If you have specific requests or suggestions of which current SE reference design (or other not yet implemented ideas) you would like to see as an open source project, please post them there.

authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
swatts
Active Participant

To Hell with democracy, Dictat 23466679B from the dear leadership at SSDC towers says GitHub.

Long Live the Dear Leader

Long Live the Dear Leader

Long Live the Dear Leader

Oh and you all have to have haircuts like mine (Dictat 44455667X)

Oh and I think a general Move To Position Method is a good idea.... Move To Position (Row,Column) etc etc. Don't know yet how this maps to a Text Document or Presentation but I guess it will be (Line,Word) for Text.

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

FabiolaDelaCueva
Active Participant

Pass on the haircut, sorry I don't want to get in trouble with my fans.

Apparently Bitbucket does let you have unlimited collaborators for public repositories:

https://confluence.atlassian.com/display/BITBUCKET/Plans+and+billing

But it is your project, it is your blog and you get to have your cake and eat it too and we can all benefit from learning a new tool. So I am going to rebel to (Dictat 44455667X), but OK with Dictat 23466679B

For an opportunity to learn from experienced developers / entrepeneurs (Steve, Joerg, and Brian amongst them):
Check out DSH Pragmatic Software Development Workshop!

DQMH Lead Architect * DQMH Trusted Advisor * Certified LabVIEW Architect * Certified LabVIEW Embedded Developer * Certified Professional Instructor * LabVIEW Champion * Code Janitor

Have you been nice to future you?
Christian_L
Active Participant

Fab, I found the same information this afternoon and have been testing BitBucket. It looks to be very similar to GitHub in functionality (and also supports Mercurial). Some people here really like the Atlassian Sourcetree client for BitBucket, which also works with GitHub.

As you state, every owner/manager of an open source project should pick their preferred repository and it is okay if we do not all use the same. From the SE side we will likely standardize on one or the other.

authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX