2011-08-25

Converting Mac/LF encoding to Latin1/LF

I'll never really get the concept behind the surfaces and default surfaces and no surfaces with recode. Anyway, this is how to convert a file with Mac encoding and LF linefeeds into Latin1 encoding and LF linefeeds:
recode mac/..l1 myfile.txt

Or convert UTF-8 to Latin1:
recode utf-8/..l1 myfile.txt


Will we ever be able to get rid of the OS dependent behavior like 'Mac text files have CR lineendings' (which is even wrong since Mac OS X)?

2011-08-22

Mac OS X Screen-Sharing: Cut-Copy-Paste

You can cut/copy/paste across to/from your screen sharing session. It just does not share the copy buffer automatically. Instead you need to transfer the copy buffer into either direction explicitly by selecting Edit -> Send copy buffer or Receive copy buffer (the actual english text might be different, you will figure it out). Doing so will not copy or paste anything in itself. You then need to paste on the target side.

For example to transfer from your host to your remote machine:

* copy on host machine
* Screen-Sharing: Edit->Send copy buffer
* paste on remote machine




2011-08-21

Enabling Screen-Sharing on Mac OS X via ssh

Recently the Nvidia graphics card in my MacBook Pro died (the well known Nvidia hardware failure problem) and I wanted to control the (otherwise running fine) machine remotely but screen sharing was not enabled on the damaged machine. Some digging with Google brought up a very easy solution. You need ssh access to the machine for this of course.


# for <= Mac OS X 10.6.2 do:
sudo sh -c "/bin/echo -n enabled > /Library/Preferences/com.apple.ScreenSharing.launchd"
# for >= Mac OS X 10.6.3 do:
sudo sh -c "/bin/echo -n enabled > /private/etc/ScreenSharing.launchd"
# for Mac OS X Lion do: (use unload to disable)
cd /System/Library/LaunchDaemons/
sudo launchctl load -w com.apple.screensharing.plist


This post contains all these hints:
http://hints.macworld.com/article.php?story=20080318190503111

I personally just tested the second variant for 10.6.8 so this is all I can confirm. The other variants were just taken from this post above to have it all in one place.

Set page margins with TextEdit

I did not find any way to set the page margins with TextEdit itself in an RTD (RTFD) document. But actually this is quite easy to do by editing the RTF file (or RTFD/TXT.rtf file) directly as ASCII (for example with emacs etc).

On the fifth line you will find this:


\paperw11900\paperh16840\margl1440\margr1440\margb360\margt360\vieww27000\viewh21300\viewkind1\viewscale125


The margl and margr are for the left and right margin, respectively (1440 = 1.0 inch = 25.4 mm). I added margt and margb for the top and bottom margin in the example above to be 360 (= 0.25 inch). These two are usually not part of an RTF which you created with TextEdit.

2011-08-16

I just stumbled across this very true summary about technical debt and how to deal with it:

http://www.nomachetejuggling.com/2011/07/22/when-to-work-on-technical-debt

In my experience technical debt always happens. One must always try to avoid it but it can never totally be avoided (for multiple reasons). The main point is: You (the one who writes and maintains the code) must deal with it in your daily normal work every day immediately and you must organize to pay it off without asking for permission or telling other people.

The sentence 'We never have enough time to pay off our technical debt' does not make sense and is wrong. Nobody will provide you with time to do this and nobody will schedule it for the future. You need to deal with it yourself. You need to factor any cleanup into the planning. Do not expect extra time to be given to you to clean up later.

The sentence 'This is so wrong, we should fix it. Let's add this to our defect database so it does not get lost.' usually means: 'I don't understand or care about technical debt so let's put this into a strange ever growing database and forget about it. It will never get done.

Defect databases most of the time help to create technical debt since they encourage people to file work items which really need to be done now for the future. They do not help to reduce technical debt. A 8x8cm piece of paper with the top issues on it you need to work on is better. You usually will not be able to deal with more debt than what fits on this piece of paper.

I always compare technical debt with a snow-pusher which has a flat pushing front. By pushing harder it can always get a bit further by pulling back and by ramming into the snow wall once more, but after some time it can only ever advance by a couple of centimeters per push. The only way is to get rid of the snow is to get rid of the snow. Pushing the snow forward for future processing is not going to work.