How I downgraded libxml to 2.8.0

In my wortsammler gem I am using Nokigiri 1.5.9 for xml processing. After performing a ‚sudo port upgrade outdated‚, I faced a the message along with a subsequent segmentation fault.

WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.0

I found the solution: here: In particular, i did

Bernhards-MacBook-Pro:tmp beweiche$svn co -r 97423 http://svn.macports.org/repository/macports/trunk/dports/textproc/libxml2
A    libxml2/Portfile
Ausgecheckt, Revision 97423.
Bernhards-MacBook-Pro:tmp beweiche$ cd libxml2
Bernhards-MacBook-Pro:libxml2 beweiche$ sudo port install 

Bernhards-MacBook-Pro:tmp beweiche$ sudo port activate libxml2 @2.8.0
Password:
--->  Computing dependencies for libxml2
--->  Deactivating libxml2 @2.9.0_0
--->  Cleaning libxml2
--->  Activating libxml2 @2.8.0_0
--->  Cleaning libxml2

Bernhards-MacBook-Pro:tmp beweiche$port installed libxml2
The following ports are currently installed:
  libxml2 @2.7.8_0
  libxml2 @2.8.0_0 (active)
  libxml2 @2.9.0_0

after this, everything worked fine again.

Conclusion: Software gets rotten. It is very hard to anticipate the consequence of an update. On the other hand there is no real alternative to keeping the system up to date. The only way out is strategic testing. Therefore, I no longer want to hack scripts without a test suite.

Noch kein Kommentar

open a predefined VPN connection on Mac using ruby

Amazing, it seems that there is no simple way to open a predefined VPN connection with a terminal command. So after asking the search engine of my choice I found some applescript stuff to do this.

I have wrapped it in ruby such that I can use it now from my rake files.

class VpnOnMac

  def self.open(service)
    cmd=[]
    cmd < < "osascript <<-EOF"
    cmd << "tell application \"System Events\""
    cmd << "        tell current location of network preferences"
    cmd << "                set VPN to service \"#{service}\" -- your VPN name here"
    cmd << "                if exists VPN then connect VPN"
    cmd << "                repeat while (current configuration of VPN is not connected)"
    cmd << "                    delay 1"
    cmd << "                end repeat"
    cmd << "        end tell"
    cmd << "end tell"
    cmd << "EOF"

    cmd=cmd.join("\n")

    system(cmd)
  end


  def self.close(service)
    cmd=[]
    cmd << "osascript <<-EOF"
    cmd << "tell application \"System Events\""
    cmd << "        tell current location of network preferences"
    cmd << "                set VPN to service \"#{service}\" -- your VPN name here"
    cmd << "                if exists VPN then disconnect VPN"
    cmd << "        end tell"
    cmd << "end tell"
    cmd << "EOF"

    cmd=cmd.join("\n")

    system(cmd)
  end

end

with this, you can open your service e.g. by

VpnOnMac::open("my Vpn")

Noch kein Kommentar