Will.Whim

A weblog by Will Fitzgerald

Manager, Software Engineering, Synapsify, Bethesda, Maryland

Company: Synapsify, Inc. (www.gosynapsify.com)
Opening: Manager, Software Engineering
Location: Bethesda, Maryland
Compensation: Competitive
About Us:
Synapsify, a well funded software company located in Bethesda, Maryland, is a new way for computers to understand, rate and manage written content. Synapsify helps organizations save time, money and gain actionable insight in understanding and prioritizing the world’s written content, social conversations, and opinions. The world’s first software based on emotional intelligence, Synapsify analyzes the sound, metaphor and narrative in text to help our clients gain deeper, more actionable insights from social media, online conversations and all forms of written text. Backed by leading venture investors, if you are looking for an opportunity to put a dent in the universe, please keep reading.

Job Description:

You will join our core engineering team, where you will be responsible for architecting, designing, and developing Synapsify’s Actionable Content Ratings platform. Your mission is to integrate the best of search, text analytics, and visualizations into a revolutionary, reliable, high-performance platform available via our RESTful API and SaaS web application. You will manage the day to day development process, and will write scalable, maintainable, efficient, and elegant code. You will actively participate in cutting-edge artificial intelligence technology and research. We are a startup. This means you must play an active role in the development process and develop part of the solution themselves.You will work in a beautiful open collaborative space that screams creativity and is only a short walk from the Bethesda Metro station.

Position Requirements:

Desirable candidates should possess:

  • An excellent understanding of modern software platforms, Cloud infrastructure, Big Data, Search and Text Analysis.
  • Knowledge of Common Lisp, Clojure, AServe, AWS, RabbitMQ, Celery, and Storm a plus.
  • Experience and capable of leading teams and making sure that a collaborate team result is delivered.
  • Experience in managing software development processes, developing roadmaps, assigning engineering tasks to the team, monitoring development, testing and managing upgrade and release strategies.
  • A strong knack and talent for solving complex issues by finding simple solutions.
  • Extreme passion for learning new technologies and creating revolutionary products.
  • Excellent communication skills and not shy to express his or her opinion in finding the best solution and approach
  • At least a Bachelor’s Degree in Computer Science.
  • At least 4-6 year(s) of working experience in text analytics or search, including 2-3 years of experience in in algorithms, classifiers, rankers or other machine learning technologies

Interested candidates should email cover note/letter and resume to info@gosynapsify.com.

Scala partial functions, map, and filter

Yesterday, I was writing some code that needed to (1) go over a collection of stored database objects, conditionally convert some of these to another version of themselves, and filter out some of them. For some reason, I got myself tripped up on some very basic things, and so here are some notes for myself and perhaps for others. (There were some other things going on, for one, support website pagination, but I won’t discuss that here).

The simplest way to handle is to use filter and map on the collection. For example, let’s say we want to remove, from a collection of integers, all odd numbers, and halve all the remaining numbers if they are a multiple of 4:

scala> (1 to 12).filter{_ % 2 == 0}.map{i => if (i % 4 == 0) i/2 else i}
res43: scala.collection.immutable.IndexedSeq[Int] = Vector(2, 2, 6, 4, 10, 6)

Simple enough, of course: filter, then map, though map then filter might make sense in other cases (but of course here there is less “work” if we filter first).

Another possibility was to use partial functions, using collect. This can allow mapping and filtering to take place in the same step. In Scala’s terms, a partial function is a function from only some values of its argument. For example, if a function only applied to even Ints, then this function would be partial. This is, in effect,what we are saying the filter step does above. So we can get the same effect using collect:

scala> (1 to 12).collect{case i if i % 2 == 0 => if (i % 4 == 0) i/2 else i}
res44: scala.collection.immutable.IndexedSeq[Int] = Vector(2, 2, 6, 4, 10, 6)

It’s a tool to have in one’s toolbox, but I think the “filter, then map” is clearer code. Interestingly, the first version is even a little shorter than the second.

Patrick of Ireland

I won the Listserve lottery, and sent this story out to about 13k people today. It was a revision of something I’d written a while back.

Patrick of Ireland

Once upon a time — and listen, for although this sounds like a fable, I will try to make every word true — once upon a time there was a young boy named Patrick, a young Christian boy whose father was a deacon, and whose grandfather was a priest. Patrick, though he was raised in a Christian household did not himself know God. I imagine he was like most people, just living his life out without much concern for spiritual things.

But then something really terrible happened. Raiders attacked his parents’ villa, and Patrick was taken off to be a slave in Ireland. I suspect that his parents had plans for him to go off to the city to become an educated gentleman. Instead, he was taken off at age sixteen to become a slave. Instead of going to school, he was forced to become a shepherd.

In his loneliness and emptiness, he began to remember what he knew about God. And he started to pray the prayers he had been taught; I don’t know what prayers, but I imagine he prayed the “Our Father.” He started praying more and more — in the fields at night and during the day, even waking up before daylight to pray, praying up to, he says, 100 prayers in a day. God started to burn in him.

He was a slave until he was about twenty, and then something very spooky but real happened. He was sleeping, but he heard a voice saying he was going home soon. Soon after he heard the voice again saying that his boat was ready. He immediately fled from his slave-owner, for he recognized that this was a message directly from God. He had to travel 200 miles to get to the harbor where the ship was, in a land he did not know, among people whom he did not know.

He found the ship, and they almost didn’t take him. After the visions and after walking 200 miles, I imagine he was disappointed. He headed back to the hut where he was staying praying along the way. As he was walking and praying, one of the men shouted at him to come back; he could get a ride with them.

They traveled for three days before they landed, and then the whole group started walking — after twenty-eight days, their food ran out, and it was uninhabited. His companions were kind to have taken him in, but now they were hungry and cranky, and began to taunt him about God, asking that perennial question: If God is so great and powerful, why isn’t God helping us?

Patrick had good reason to trust that God had something other than starving in mind for them, though, and he told them boldly that they should become Christians. He also said that God was going to provide so much food that very day that they couldn’t eat any more. And so it happened: a herd of pigs came by, and I imagine they had a pretty good pork barbecue. Their attitude towards God and Patrick changed that day; in fact, they had fire and food enough for the rest of their journey.

Patrick eventually was able to return to his kinsfolk, and he was glad to return, and they were glad to have him. But Patrick had another dream: a man named Victorius bringing letters from Ireland, and in his dream he read one of the letters. The letter said it was “The Voice of the Irish,” and he could hear the voices of people he knew in Ireland begging him to return to return to the land of his slavery.

So Patrick returned to Ireland to preach. He didn’t cast out the snakes; we don’t know if he used a shamrock to teach the Trinity; the hymns attributed to him are most likely not by him. But we know he continued to face hardship. In fact, he was kidnapped at least one more time for two months. Patrick’s life was full of ups and downs, He was ashamed of his poor education (poor man, he only knew three or so languages and wrote his confession in Latin that was perhaps not up to par). He called himself a stutterer, though he preached to thousands. He felt that “poverty and failure suited him better than wealth and delight.” He certainly never got wealthy ministering to the Irish. He remained homesick, I think, to the end of his days. But he recognized the work of God through him, but he felt bound by the Spirit to remain in Ireland.

A tiny rant about ‘tr’

The tr program converts a string of characters into another string of characters, using a very simple rule system. The tr [A-Z] [a-z].  But this works for simple “ASCII” strings only. tr, at least on many systems, understands Unicode, and so the standard example fails for converting, say, Russian or Czech. But tr also understands character classes, so the standard example should be written tr [:upper:] [:lower:].

File under “boring post.”

Nearly buried in the This American Life retraction

This American Life released a retraction today about it story reporting on working conditions at Apple suppliers in China. Kudos to This American Life for spending an entire show on this.

I’m afraid that This American Life’s focus on its own errors might overshadow the truths about working conditions in China. To their credit, they spend some time trying to get at the facts.

In the final minutes, Ira Glass interviews Charles Duhigg of the New York Times, who has done his own investigation of working conditions at Apple. Duhigg makes the following claims, which I have little reason to doubt:

  • Actual labor costs are not a major component of the cost of creating Apples products; Apple products could be made in the US for roughly the same cost.
  • It is the ability to quickly and flexibly adjust its supplier chain that in the real benefit to sourcing to China (actually, I’m a bit skeptical of Duhigg’s story here — I wonder if he is exaggerating a bit — but I don’t doubt at all that China is very much more flexible than the US).
  • The biggest violations in working conditions are overwork (24 hour back-to-back shifts, 60+ hour work weeks, people pressured into working over time) and unsafe conditions (for example, flamable industrial dust).
  • Apple lacks the will to insist on better working conditions in China.
  • If consumers put pressure on Apple, Apple would insist on better working conditions. (In an interview Duhigg did with Terry Gross, he compared this to the changes that occurred at Nike suppliers).
Duhigg finished with this:

You’re not only the direct beneficiary; you are actually one of the  reasons why it exists. If you made different choices, if you demanded different conditions, if you demanded that other people enjoy the same work protections that you yourself enjoy, then, then those conditions would be different overseas.

This is worth pondering. I think it might be time to stop buying from Apple until things are vastly improved. If Apple, the leading tech producer, corrects its course, I am sure most of the the other hardware companies will follow suit.

Questions — what is Microsoft’s current record with respect to working conditions overseas? Are there hardware companies who are more ethical?

Scala filters

A random Scala note.

Today, I wanted to apply a list of filters to each item in a list, and return just those that pass each of the filters.

For example, given a range of integers, return just those that are divisible by 2 and by 3.

Let’s start by defining a boolean function divides:

def divides(d:Int,i:Int) = if (i%d==0) true else false

Note that divides(2,_:Int) defines the (partial) function for division by 2.

(divides(2,_:Int))(2) => true
(divides(2,_:Int))(3) => false

So we can create our filters so:

val filters = divides(2,_:Int) :: divides(3,_:Int) :: Nil

or

val filters = List(divides(2,_:Int),divides(3,_:Int))

Now, we can simply use Scala’s filter and forall functions to filter a range of integers:

scala> Range(1,50).filter(x => filters.forall(f => f(x)))
res45: scala.collection.immutable.IndexedSeq[Int] =
  Vector(6, 12, 18, 24, 30, 36, 42, 48)

The filters could also be defined as a Set, but by creating them as a List, one can put the less expensive filters first.

Amish forgiveness and Amish shunning

Last night, I watched the American Experience documentary on the Amish, which I thought very well done. They treated the Amish with respect, neither nostalgically nor scornfully, with beautiful camera work, well-crafted stories, and good expert commentary. Personally, I especially enjoyed hearing some Amish singing, especially O Gott Vater, which I have never heard sung.

They told the story of the 2006 Nickel Mines tragedy, in which a man shot ten Amish girls in a schoolhouse, killing five of them, and of the amazing forgiveness the Amish showed the killer (who died in the attack) and the killer’s family. They also told stories of former Amish who were placed under the ban and shunned by their Amish communities. The documentarians did not draw any connections between these two, but the stories seem to prompt the following question: how can such peace-loving, forgiving people place others under a strict ban of total non-contact?

The Amish do not need me to defend them, but I have some thoughts. The first is a historical one. When the early Anabaptists began to practice the ban, it is important to remember what the typical punishment was for those who disagreed with a community was in their day. Basically, in most communities, deep theological and civil disagreements would lead to a death sentence for the rebellious one. The Anabaptists themselves were hunted down, and thousands were cruelly murdered for their disagreement. Over against this, the Anabaptists (and the Amish is particular) came up with a non-capital punishment for disagreement: the ban. Compared to death, being shunned is a light sentence.

It is important to remember that the ban is applied only to Amish who have been baptized in the community. Adults who were never baptized as Amish Christians are not subject to the ban; only those who, having committed their lives to God and to the Amish community   through baptism are subject to shunning. Adults who grew up Amish, but decided against baptism, are not shunned — they are treated as any other member of the world.

The documentary makes a point of saying that, in the Amish view, the community is more important than the individual. God is obey as a community, not as a bunch of people who happen to believe the same thing and act in concert. One outworking of this is that the Amish act to preserve and protect and nourish the community more than their individual members. Shnning is but the most drastic example of this: it is more important to protect the community than it is to maintain family and friendship ties, no matter how tender.

Finally, the Amish also believe that shunning is the best thing for the person being shunned; a radical kind of tough love to bring the rebel back (and then, the famous Amish forgiveness should kick in). By servering all of a person’s contact with the community (where one has learned to speak, to love, where ones friends and family are),  the community hopes to instill the deep cost of  rebellion. There are few half-way steps.

As a Mennonite, I admire the consistency and faithfulness of my Anabaptist cousins, and I think about this topic a lot, in fact: how to uphold standards as the world goes to hell in a handbasket. I don’t really have the power to place people under a ban, but it’s good to be reminded that people need to accept responsibility for their actions, that the community is important, and a commitment to following Jesus is a very serious one.

God grant us wisdom to know the differences between how to treat people who fail you, who fail the church though their inidividual actions.

The Non-Chaos, or English Spelling Defended in Rhyme

Dearest creature in creation,
Study English pronunciation.
It’s more regular in its core
Than pundits, who focus on its more
Erratic ways, would have you believe.
Perhaps they simply cannot conceive
Of any system not based in Latin—
They would choose, I suppose, to flatten
All writing to “one form, one sound”
But, really, regularities abound.
Consider, how we pronounce the plural
Form of words; Imagine the neural
Work of reading “dogs” and “cats.”
Would you prefer “dogz”? That’s
Not right—that single ess for each
Is easier to read, to sound out, and to teach.
Or consider “heir/inherit”
To write “air” would be a demerit,
A signature failure, and a sign
Of a spelling system’s worse design.
Seriously, it would simply astonish,
Anyone to think that “ghoti” sounds like “fish.”
Besides, English spans such colossal ages
And latitudes, I doubt such cages
Desired by fans of regularization
Could withstand the normal mutation
Of how language really adapts.
“Wind” and “hind” have rhymed or not, perhaps,
As, over time and place, each has adopted
A short I, sometimes a long I, co-opted
By real human beings. So “after tea and cakes and ices, “
Let us “force the moment to its crisis”—
Haters, they say, are going to hate; let them snivel
I have had enough of drivel,
Go ahead, enjoy your whine,
But English spelling is basically fine.

—Will Fitzgerald, January 2012

Distribution of tweet lengths

% of English tweets by size (sample 50k)

I get a very different distribution of tweets than Isaac Hepworth — no spikes at 28. My provisional guess is that his data is a bit wonky. My data here is (only) 50k English tweets from one day in 2007.

Isaac Hepworth's distribution

2011 in review

The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.

Here’s an excerpt:

A New York City subway train holds 1,200 people. This blog was viewed about 6,000 times in 2011. If it were a NYC subway train, it would take about 5 trips to carry that many people.

Click here to see the complete report.

Follow

Get every new post delivered to your Inbox.