I lost the entire blog today with a carelessly placed argument to
‘rm -rf’. Ironically I was trying to delete some old backups of
this blog. It turned out I deleted everything.

Most of it was restored from backup. Some few pictures are still
missing though.

I am an Emacs weenie. I really can’t get much work done without emacs. I
have tried other things.

* vi/vim – I can use it and I try to learn a new command every once in a
while
* Textmate – mkay. But I like Emacs. Plus Emacs is free.
* Visual Slick Edit – The parts that are like Emacs are nice. Emacs is
free.
* Netbeans – Almost can be configured to work like Emacs.
* Eclipse – No. I. Just. Can’t. Do. It. Very. Sorry.

So I am making this post from Emacs. Carbon Emacs 22.1 on Mac OS X.
Using weblogger mode. It turned out to be easy. The hard part was
figuring out what the “endpoint URL” was supposed to be
(/blog/xmlrpc.php for this Wordpress blog). And enabling the Markdown
plugin. Yeah, that was tricky — had to click a checkbox.

See ya later lame textarea edit box and lame wordpress markup style. We
hardly knew ye.

Some quotes from things I have recently found insightful or helpful.

The state of marriage is one that requires more virtue and constancy than any other. It is a perpetual exercise of mortification. From this thyme plant, in spite of the bitter nature of its juice, you may be able to draw and make the honey of a holy life. — Francis de Sales

Marriage is the operation by which a woman’s vanity and a man’s egotism are extracted without anesthetic. — Helen Rowland

Marriage is the greatest test in teh world…but now I welcome the test instead of dreading it. It is much more than a test of sweetness of temper, as people sometimes think; it is a test of the whole character and affects every action. — T.S. Eliot

One of the best wedding gifts God gave you was a full-length mirror called your spouse. Had there been a card attached, it would have said "Here’s to helping you discover what you’re really like!" — Gary and Betsy Ricucci

If you want to make sure of keeping it intact, you must give your heart to no one, not even to an animal. Wrap it carefully round with hobbies and little luxuries; avoid all entanglements; lock it up safe in the casket or coffin of your selfishness. But in that casket–safe, dark, motionless, airless– it will change. It will not be broken; it will become unbreakable, impenetrable, irredeemable. — C.S. Lewis

Christian marriage presumes a certain degree of self-disclosure…This reality can be terrifying to contemplate. Dating is largely a dance in which you always try to put your best face forward–hardly a good preparation for the inevitable self-disclosure implied in marriage. In fact, I wouldn’t be surprised if many marriages end in divorce largely because one or both partners are running from their own revealed weaknesses as much as they are running from something they can’t tolerate in their spouse. — Gary Thomas, Sacred Marriage

A man who says "I’ve never loved you" is a man who is saying essentially this: "I’ve never acted like a Christian." — Gary Thomas, ibid.

Husbands, love your wives, even as Christ also loved the church, and gave himself for it. — God, The Bible, Ephesians 5:25

We are starting to use thrift and needed an ant build recipe. Here’s what we came up with. It works good and the only thing that looks like an abstraction leakage to me is that I needed to know the package, the java namespace, for the resultant generated thrift code and the name of one of the thrift generated files. The primary goal was to eliminate running the thrift generator when the generated code is newer than the .thrift files. There isn’t a one to one mapping between .thrift files and generated output so if any of the generated stuff is newer than any of the thrift then it all gets recreated.

I also didn’t want to have to copy the thrift output to someplace else, so a javac target was added to just treat the “gen-java” thrift output as a new source directory for direct java compilation. The normal ant target to compile the java code can now just depend on “thrift-gen”.

This quote is from a lovely little volume by John Urquhart titled The Wonders of Prophecy, or, What Are We To Believe?. The book is not dated, but seems to be from the early 1900’s.

There are few truths which have not had to run the guantlet of controversy: and those truths are our possession today solely because there happened to be men who, while they loved peace, would not part with conviction though the holding to it meant war. Science as well as faith has had its martyrs. They were brave enough to leave the beaten track in search of truth; and, when they found it, they were not to be frightened from their possession by the chorus of doubt and condemnation with which they were assailed. That man will do little in the world who can be terrified by clamour, or who surrenders convictions because all are not agreed as to their truth. The manly man feels that, in such differences, there is a call to inquire and to make his own decision. The rest, though it pains one to say it, are no great loss. The wind that sweeps across the threshing-floor takes only the chaff away; or, if it take with it too the light, withered, heartless, grain, the wheat that is left clean and sound is all the worthier of the garner.

Seems applicable to a lot of the goings on in the intelligent-design community, the vitriolic spewage from the new militant atheists, and lots of other current events at the intersection of true religion with the public square, true religion and science, true and false religion, and most people’s seeming apathetic lack of conviction and clear individual thinking on or about anything.

I learned about the need for homochirality in amino acids that can be used as the building blocks of life from A.E. Wilder-Smith. Dr. John Lennox also mentions it a little bit in God’s Undertaker: Has Science Buried God

Here then is Casey Luskin interviewing Dr. Charles Garner who has been heavily involved in chrality research for 25 years. He speaks pretty candidly about OOL and homochirality issues – really fascinating stuff, about 13 minutes long, courtesy of the Discovery Institute.

You won’t read about this stuff in your high-school biology text books. Miller-Urey is in there, of course, but no mention of the racemic amino acids that were produced and their complete and utter unsuitability for life. We know from direct experience that some high-school biology teachers who spout on and on about Miller-Urey, upon being questioned about chirality and what Miller-Urey really shows or doesn’t show, claim never to have even heard of chirality!! Highest ranked high-school in the state. You can’t make this stuff up.

Google suggest offers up the following options for “Why are Christians so…”.

Google Suggest

Do you notice any common thread in those suggestions? I don’t really know that much about how Google Suggest works. Do these suggestions reflect what people are searching for? What people are finding useful? Just what is out there on the intarwebs? Or some weighted probabilistic combination of those? Dunno. Something to think about though.

Marvel not, my brethren, if the world hate you. – 1 John 3:13

We visited Williamsburg, Jamestown and Yorktown. It was very nice and although everybody didn’t enjoy everything we did, everyone enjoyed something.

wolf_lodge
Some people enjoyed the Great Wolf Lodge, others not so much. Can you guess which ones are in which group?

The Williamsburg Green

The Williamsburg Green


Not too crowded on the day we were there, although the weather was just about perfect. I think there is a ghost wandering around on the green though.

lgs_with_bonnets
Funny hats were worn by several in our party.

Buford and Billy O.

Buford and Billy O.


Buford learned about Billy O. a.k.a. William III of Orange in History class.

Solitary confinement

Solitary confinement


We brought everyone home with us, but just so you know, we didn’t have to.

Powhatans

Powhatans


We found out that we would not have made very good Powhatan Indians – too soft around the middle.

Cool tools and lots of wood shavings.

Cool tools and lots of wood shavings.


That was worth seeing.

Afterward we had a nice visit to the Carlisle Avenue Gospel Chapel in Richmond, Virginia and a nice lunch afterwards.

JNA is surely deserving of all the praise it has been getting. It’s being used on some pretty high profile projects like JRuby with great success. After having done JNI the hard way, the painful, tortuous, despicable, bang-head-on-keyboard-while-wondering-if-ReleaseStringUTFChars-applies-here and why-the-jvm-is-segfaulting-again way, well I have a deep appreciation for JNA.

Still who wants to go write a bunch of useless Java interfaces for stuff that already exists in built into the native library itself? Not me. So that’s where Jython and JRuby come in.

This week I needed Jython/Python access to some native modules, namely ssdeep for fuzzy hashing. There’s already a pretty nice solution for connecting pure python to native libraries — you can either use swig or pyrex. The pyrex piece for ssdeep has been mostly written here. Needed to add the fuzzy_hash_buf method into that mix but it was nice and easy. From inside pure python with ssdeepmodule.so (via pyrex) and libfuzzy.so (from ssdeep) (or .dylib for Mac or .dll on Windows) sitting there on your LD_LIBRARY_PATH, you get to do this coolness:

  from ssdeep import ssdeep
  import sys, os
  f = open("/bin/ls","rb")
  data = f.read()
  f.close()
  ss = ssdeep()
  fuzzy_hash = ss.fuzzy_hash_buf(data)

Pretty nice you have to admit. But from my pure java p2p data-driven workflow framework, I really wanted to do this from Jython to keep from having to start the interpreter up in a subprocess over and over. Pyrex extensions do not work in Jython. Makes perfect sense. M’kay. I could write a whole bunch of lame JNi code to hook libfuzzy.so in there. Or I could use JNA and write some non-dry interface in java and figure out all the details of the types and so forth. Or … I could just push all that code down into the python module that I’m going to call.

from com.sun.jna import NativeLibrary, Function, Memory
import sys,os

class ssdeep:
    fuzlib = None
    hash_func = None
    FUZZY_HASH_SIZE = 116

    def __init__(self):
        self.fuzlib = NativeLibrary.getInstance('fuzzy')
        self.hash_func = fuzlib.getFunction('fuzzy_hash_buf')
        pass

    def hash_data(self,data):
        ptr = Memory(self.FUZZY_HASH_SIZE)
        i = self.hash_func.invokeInt([data,len(data),ptr])
        return ptr.getString(0,False)

With a class and method conveniently named exactly the same as the pyrex module I can make it all flexible enough to work either way:

try:
   # try the pyrex extension module
   from ssdeep import ssdeep
except ImportError:
   try:
     # try the jna wrapper when in jython
     from ssdeepjna import ssdeep
    except ImportError:
      # write tmp files and just exec the dumb thing

Which is all pretty nice I think. Not too many worries about creating interfaces or other crazy things. Seems very efficient, a little extra packaging and we are good to go.

Well there was one problem in getting different values from the hashes when the data was binary. Turns out the JNA layer needs to be told how to convert data with -Djna.encoding=8859_1 on the JVM command line. Since I usually run with -Dfile.encoding=UTF-8 and in a UTF-8 locale, this made all the difference.

If that is inconvenient or you want to encode things differently only sometimes, the extra steps in the python layer would be something like

  from java.lang import String
  def wrap_hash_buf(self,data):
    javastr = String(data,"8859_1")
    jbytes = javastr.getBytes("8859_1")
    return hash_buf(jbytes)

The same type of thing would work just as well from JRuby.

Welcome to the sweet spot. Code on, baby!

Project of the day was to revive an old SVN repo project and get some changes made.
I no longer have all of the mod-svn+apache stuff working and didn’t want to work on that.
I did have an “svnadmin dump” of the old SVN repo though. The project name is emissary.

  1. cd /tmp; svnadmin load emissary < emissary.dump
  2. cd ~/projects; git svn clone file:///tmp/emissary -t tags -b branches -T trunk emissary
  3. cd emissary; ant all test
  4. Converted branches to tags, Removed some obsolete branches, using git branch -r -d
  5. add “github” stanza to .git/config, and create the empty repo on github.com
  6. git push github
  7. git push –tags github

Double plus un-bad.

That’s what I wish I had done, anyway. Turns out git saved the bacon in more ways
than one. Initially I didn’t read the man page for “git-svn” far enough to get
the tags, trunk and branches. Started hacking on my shiny new git repo and did
a half-day’s work, committed, pushed to github, then realized I didn’t have any
of the historical tag info from svn. Bummer.

Here’s what I did at that point.

  1. git svn dcommit
  2. remove and recreate the git repo using the proper clone command
  3. verify all work still in place — yes it is!
  4. remove and recreat the github repo

Thanks, git.

« Previous PageNext Page »