Tuesday, October 16, 2007

Restoring Word 95 files on Windows 95 after crash

Some of us are still using Windows 95. (Probably none of "us", as I doubt any of those systems is able to surf the net ;-) Mostly on machines that need it ... as nothing newer runs. And, of course, for these systems, there is only Word 95 and companions. Also, these machines still have floppy drives. Not to forget -- most of the users of these systems are a bit digitally ... challenged. Now, there is a user who thought saving files on a floppy disk would save them ... in case of a system/harddisk crash. Not as a backup, but for working on the file. Well. As saving on a floppy takes some time, it's usually not done that often. And computers crash. So, we have an hours old file on a floppy, a rebooted system, and an old version of office that may or may not have auto-recovery files. And if it has those, where are they stored, if not in the working directory? Which is a floppy. 3/4 of an hour telephoning later, the file was found in c:\windows as "Sicherungskopie von ...". Rename it to .doc, and open it ... there it is. Wait ... first, we need to explain, still via telephone, how to make windows show the extension ... otherwise, you can't change its extension. Well, I should just send the bill for nearly an hours work ... probably the same as a new old computer for the user ;-)

Tuesday, October 09, 2007

Avr32 Studio and .d files

Has been some time since I wrote this, so it's high time for publishing it ...!
There seems to be a problem with the Atmel AVR32 studio. It is based on eclipse, to develop C/C++ software for the embedded AVR32 chips.
The following error message is (often) given, when a project is recompiled:
make -k all
src/main.d:1: *** multiple target patterns. Stop.
Build complete for project aixC-BoxFirmware
This usually happens when the previous build was not successful, b/c one ore more files could not be compiled.
The reason seems to be the following line in the automatically generated Debug/src/*.d files:
src/main.d src/main.o: ../src/main.cpp ...
It seems, make is not really able to cope with the multiple main.d main.o: statement ...?
The .d files are responsible for checking all file dependencies, i.e., which files need to be recompiled if one header has been changed.
After a clean, which deletes *.d, a full build works.
avr32-linux-gcc is called with the parameters
-MMD -MP -MF"src/main.d" -MT"src/main.d"
which means:
Generated src/main.d (-MF) with the target src/main.d (-MT), for all user include files, and compile the source (-MMD), and generate phony targets for depended files (-MP).
So, theoretically, only
src/main.d: ...
should appear in the src/main.d file ...
Workarounds:
1. Delete all .d files before recompiling
not nice ... looses all dependency information
2. Fix the generated .d files
The following, a bit obscure sed command can be run inside Project/Debug to fix the .d files.
find . -name '*.d'|xargs sed -ie 's#\.d src/[^/]\+/[^ /\.]\+\.o:#.d:#g'
// do I need .d or .o?
The real problem seems to be s.th. else ... the makefile itself (src/subdir.mk) has a rule for building src/main.o from src/main.cpp, and the .d file contains another rule ... strange version of make ...?
The real problem is the inclusion of C:/home/Projekte/Avr32/aix-AVR32-libs/libserial-0.5.2/src/
which gives the other ":" that raises the error ...
1. use a relative path
2. use make 3.80 ...
This error is usually encountered in other situations:
1. a file name contains spaces (windows makes, mostly)
2. a file name contains : (windows again ;-)
http://sunsite.ualberta.ca/Documentation/Gnu/make-3.79/html_chapter/make_16.html
http://sunsite.ualberta.ca/Documentation/Gnu/make-3.79/html_chapter/make_4.html#SEC40
Have fun,
Sebastian
See also
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=315323
You've run into one of our known issues:
Bug #5452
Referencing external folders in managed make projects when using GNU make 3.81 causes build failures. This is caused by GNU make no longer supporting Windows-style path names. GNU make 3.80 works as expected.
The known issues are described in the release notes, which are available on atmel.com. They are also included in the AVR32 Studio Help.
Note that the release notes were not available on the website until quite recently, and the links in the Welcome page appear to be buggy, so I'm not blaming you for not reading them. This will be addressed for the 1.0 release.
Run the cygwin setup.exe and try to downgrade Make to 3.80, that should help.

Saturday, September 01, 2007

Exporting hi-resolution images from OpenOffice.org Draw

I can't use OpenOffice.org at work, so I try to use it for private stuff, as far as possible. Sometimes, though, I start wondering why ... In the my current version of OpenOffice Draw (2.0.4, updated to 2.2.1, still the same ), it is impossible to export an image in a different resolution than 96dpi. Unless one uses workarounds like eps+ghostscript, pdf, or a macro. I loaded an foto from my camera, 2272x1704 (4 MP), added some numbers and lines, and exported it into jpg, png etc. ... and got 1016x762. With different jpeg compression qualities, of course, but no different sizes. Joe pointed me to the OO QA tracker, issue 4499; a short summary:

  • the problem is known since May 2002
  • it was closed due to a misunderstanding of the problem in July 2002
  • reopened shortly after (OO 1.0)
  • since then, reasons for not fixing it have been given ... main problem: all filters need to be extended with the same functionality, thus, an extension to all the export dialogs needs to be requested, designed and implemented
  • last post, "No promises but I try to do something for 2.3 here"
(I just wonder why the export dialog is part of the filter, and not of the common export handling code.) Thanks to bryancole and jbarwick, there is one workaround: Take the following macro code, add it to OpenOffice, and run it ... It exports the current page (with white borders) or the current selection into a given .jpg file, with manual setting of resolution and quality. Maybe someone has a lot of time on his/her hands and wants to write a dialog that does the same? Sub ExportCurrentPageOrSelection REM Filter dependent filter properties Dim aFilterData (7) As New com.sun.star.beans.PropertyValue Dim sFileUrl As String ' set the width and height you want aFilterData(0).Name = "PixelWidth" aFilterData(0).Value = 1704 aFilterData(1).Name = "PixelHeight" aFilterData(1).Value = 2272 ' no real idea what the logical width/height does ... and what units it is in? ' original was 140 and 98.89 ... aFilterData(2).Name ="LogicalWidth" aFilterData(2).Value = 1704 aFilterData(3).Name ="LogicalHeight" aFilterData(3).Value = 2272 ' jpeg quality aFilterData(4).Name ="Quality" aFilterData(4).Value = 85 aFilterData(5).Name = "ColorMode" aFilterData(5).Value = 0 aFilterData(6).Name = "ExportMode" aFilterData(6).Value = 1 ' resolution, for use when loading in another image application aFilterData(7).Name = "Resolution" aFilterData(7).Value = 600 ' the place to put it ... file:///C:/temp/image.jpg should work for Windooze sFileUrl = "file:///home/meself/export-1.jpg" REM A smart person would force this to be a Draw or Impress document xDoc = ThisComponent xView = xDoc.currentController xSelection = xView.selection If isEmpty( xSelection ) Then xObj = xView.currentPage Else xObj = xSelection End If Export( xObj, sFileUrl, aFilterData() ) End Sub Sub Export( xObject, sFileUrl As String, aFilterData ) Dim xExporter xExporter = createUnoService( "com.sun.star.drawing.GraphicExportFilter" ) xExporter.SetSourceDocument( xObject ) Dim aArgs (2) As New com.sun.star.beans.PropertyValue Dim aURL As New com.sun.star.util.URL aURL.complete = sFileUrl aArgs(0).Name = "MediaType" aArgs(0).Value = "image/jpeg" aArgs(1).Name = "URL" aArgs(1).Value = aURL aArgs(2).Name = "FilterData" aArgs(2).Value = aFilterData xExporter.filter( aArgs() ) End Sub Note: OpenOffice.org 2.3.0 is out now (Sept 17th, 2007), yet this problem is unchanged.