svn add_new + svn remove_missing

I once saw a nice solution which would prompt you with the results of new/missing, but i could not find it again…

So for a quick solution i added 2 new aliases:
1: add all new files
2: remove all missing files

#~/.bashrc
alias svn_add_new="svn st | egrep '^\?[ ]+' | sed -e 's|^?[ ]*||' | xargs -i svn add '{}'"
alias svn_rm_missing="svn st | egrep '^\![ ]+' | sed -e 's|^![ ]*||' | xargs -i svn rm '{}'"

Happy committing!

source and also useful: svnapply

another goodie: alias remove_svn_folders=”find -name ‘.svn’ -type d -print | xargs rm -rf {}”

Tests should be Documentation with Examples

Since no one wants to write the documentation, the simplest solution would be to let everyone write documentation, without noticing…

Normal documentation:

An Organisation is a firm or school that has an 
address(required) and can have users as members.

Pragmatig documentation with examples:

Organisation:
- requires an address
  organisation.address
- can have users as members
  organisation.members << User

Test:

describe Organisation do
  it "requires an address" do
    @organisation.should_not be_valid?
    @organisation.address = Address.new
    @organisation.should be_valid
  end

  it "can have users as members" do
    @organisation.should be_valid
    @organisation.members << User.new
    @organisation.should be_valid
  end
end
#before :each omitted

With the help of some spec -f or agiledox magic, we can extract:

An Organisation:
- requires an address
- can have users as members

looks familliar ?

I prefer this kind of testing, since it does not generate so many 3-liners(2(do/end)+1) nor uses “it should” all the time, which makes it look more documentation-ish.

DISCLAIMER: This way of writing tests is not RSpec-pure in that it does not use ‘it should’ and has more than on assertion (should) per example.

My new Programming Font

I left Courier new behind quiet a while ago since you cannot distinquish 0OilI. On my way to my new favorite there have been a lot of disappointments, namely Annonymous(just not readable at 14px..), Lucia Sans Console(messes up the indentation).

Im using 16px fonts at the moment, which helps me to focus on one part of the program and spares me to get close to the monitor, to check the spelling.

There are a lot of programming fonts out there, even with screenshots, some rather strange. But most lack the ability to display nicely at 14/16px size.

After throwing away Lucia Console i went on my final search and settled with Bitstream Vera.

16px looks rather lager compared to this 10px lines, but if your got enought resolution, its no problem.

Bitstream Vera programming font

Whats my Coverage? (C0 C1 C2 C3 + Path)

100% coverage sounds great, but is it c0, c1, c2, c3 or path coverage ? If you do not know, here is the answer:

  • C0 = every instruction
  • C1 = every branch if(i==1) a; even if there is no actual instruction in the i!=1 path it needs 2 tests
    1. i == 1
    2. i != 1
  • C2 + C3 ~= is every condition inside an ‘if’ is once true and once false (personally, i could not care less…)
  • C4: Path-coverage = every possible path was taken, if(a) x else b; if(c) y requires 4 tests
    1. a true c true
    2. a true c false
    3. a false c true
    4. a false c false

Try to aim for ~95% C0 and ~70% C1. C2 and C3 in my opinion add no value(except that they cover more paths) and C4 is often not possible, since a loop can have infinite paths (go through 1,2,3,4… times).

Why WordPress sucks

  • & sometimes get converted to & and then i have to recheck the code block
  • &nbsp; gets removed when switching to visual mode
  • no feedburner support
  • Images just get replaced by others, i had a RCov screenshot and one from jqUnit, now on the Frontpage of ajaxian you can see this: (hope i can fix it later…)

Ajaxian

  • the thumbnail still looks fine…

Thumbnail

  • they cant even get the date right, it is not that old 🙂
  • i cannot replace the file, and i could overwrite it, as long as i am in the same month (delete, then upload an image with the same name), but when i do that, the old image reappears…
  • using inline style and code with square brackets results in normalquotes beeing rendered as slanted/italic quotes, rendering the code un-pasteable

Seems to me, they are missing a lot of automated testing….

If someone can recommend me another hasslefree Blog provider, with images and statistics and maybe some nice code highlighting, drop a comment 😉