Archive for January 2009
this week’s tobacco
darcs use case; cheat sheet
Central development simulated with darcs.
cd /path/to/project cd .. pushd /path/to/repository mv /path/to/project . cd project darcs init darcs add -r * darcs record -am "init" popd darcs get /path/to/repository/project cd project [develop] darcs whatsnew darcs record -am "log message" darcs push -a /path/to/repository/project
do Lisp
openoffice.org Draw; insert text as curve
Actually I’m up to design a business card for myself (due to hopefully financial reasons). One idea was to create the back page as a collection of words related to my professional experience, typeset in different sizes. For this purpose I wrote a small ooo script which inserts strings as curves into the document making me able to place and rotate them after.
Sub InsertWord (oFSize As Single, oColor As Long, oText As String)
Dim oDoc As Variant
oDoc = ThisComponent
If oDoc.SupportsService("com.sun.star.drawing.DrawingDocument") Then
Dim oPage As Object
Dim oPoint As New com.sun.star.awt.Point
Dim oSize As New com.sun.star.awt.Size
Dim oTextShape As Object
oPage = oDoc.drawPages.getByName("back")
oPoint.x = 0
oPoint.y = 0
oSize.Width = 9000
oSize.Height = 5000
oTextShape = oDoc.createInstance("com.sun.star.drawing.TextShape")
oTextShape.Size = oSize
oTextShape.Position = oPoint
oPage.add(oTextShape)
oTextShape.String = oText
oTextShape.CharWeight = com.sun.star.awt.FontWeight.BOLD
oTextShape.CharFontName = "Arial"
oTextShape.CharHeight = oFSize
oTextShape.CharColor = oColor
oDocCtrl = oDoc.getCurrentController()
oDocCtrl.select( oTextShape )
oDocFrame = oDocCtrl.getFrame()
oDispatchHelper = createUnoService( "com.sun.star.frame.DispatchHelper" )
oDispatchHelper.executeDispatch( oDocFrame, ".uno:ChangeBezier", "", 0, Array() )
End If
End Sub
Related (and probably useful) links are:
my ucw posts’ summary (till now)
- some basic concepts and links
- first attempt
- a constant page
- improved constant page (with templates)
- state machine (something that I’m proud of)
- another state machine distributed over different components
- switch from UCW to WUI
moBlog test
test post with HTC Kaiser
pad strings with lisp
(defun padder-format-string (width &key (character #\Space) (side 'left))
(format nil
"~~~D,1,0,'~C<~~A~:[~;~~;~]~~>"
width character (eq side 'right)))
(defun padder (width &key (character #\Space) (side 'left))
(let ((format-string (padder-format-string width :character character :side side)))
(lambda (str)
(format nil format-string str))))
CL-USER> (funcall (padder 10) 12) " 12" CL-USER> (funcall (padder 10 :side 'right) 12) "12 " CL-USER> (funcall (padder 10 :character #\0) 12) "0000000012" CL-USER>
For details see pages as follows:
