When Mac OS X Emacs Displays Unicode Symbols Too Wide

Was I going crazy, or was Emacs displaying certain text too wide?

Symptoms

Most the problems I observed was when using emacs ansi-term, but they can happen anywhere the Emacs Mac OS X application is displaying Unicode characters.

Oddly wide  dashes (em dashes is the publishing terminology).

Emacs Window Showing Wide Dash

Too Wide Em-Dash Amongst Monospaced Text

Lines wrapping, output Unexpectedly Wrapping Beyond the Bottom of the Emacs Windows, and Black Boxes

Screen shot of Emacs Lines Wrapping When They Shouldn't

Lines Wrapping When They Shouldn’t

Root Cause

It took me a long time to figure out:

  1. That I wasn’t going crazy.
  2. The root cause.

To make a long story short, I had stumbled across Emacs Bug 11450 – Fallback Font Used Even When Available in Primary Font which can be translated as: “fancy characters don’t display correctly using the Mac OS X Emacs application.”

Solution

The solution boils down to adding this snippet to your emacs init file (aka .emacs file):


(when (eq window-system 'ns)
(set-default-font "Monaco")
(set-fontset-font "fontset-default" 'symbol "Monaco")))

Note: You may want to choose a different default font other than Monaco.

How to Make Thunderbird Chat Work with Most XMPP/Jabber Accounts

I really like how Thunderbird 15.0 has build in support for populate chat services like Google Talk, Twitter, and XMPP (aka Jabber).

What I don’t like is that Thunderbird’s support for these is minimal, and when things don’t work it is almost impossible to figure out why.

Here are two issues I ran into and their solution.

Jabber/XMPP Accounts seems stuck on “Connecting”

Before you assume that you ran to the issues I did, try port 5223 rather than port 5222. Port 5223 is the old school “secure” port for XMPP/Jabber. The more modern way is that port 5222 is used, but the server then negotiates a secure connection.

For me the root cause turned out to be a special feature in how XMPP looks up servers. If a company doesn’t want to open a port on their main server (for example bigcompany.com) they can add a special internet name lookup (DNS Record) saying “my jabber server is really over on the other server). These kind of records are called DNS SRV records.

Most XMPP clients do this for you automatically, but Thunderbird 15.0 doesn’t do this, fortunately, you can do the same look up yourself and then tell Thunderbird to user the other server instead.

How to Lookup the Actual XMPP Server for an Account

Instead of running command line tools, some helpful souls haven put together online tools to find your XMPP server, so that’s what we’ll us:

  1. Open your web browser to https://kingant.net/check_xmpp_dns/.
  2. In the text field under Check DNS SRV records for XMPP, enter the part of your XMPP/Jabber account that happens after the @.
  3. Click on the Check button.

  4. If the results say “ERROR”, then the problem you are having is not due to the SRV record feature, but something else.
  5. In the Client records for section of the results, locate the Target column, and copy the value immediately under it.
  6. Go back to Thunderbird, choose Tools->Account Settings…”, click on your XMPP account in the left hand ride, and then paste into the Server field.
  7. Click on OK to close the preferences window.

How to Fix when You Connect and then are Immediately Disconnected from the XMPP Server

Once I had done the previous steps to fix server lookup, I immediately found that my account was immediately disconnected.

After verifying the username and password, I did some investigation and determined that my XMPP/Jabber server has an “invalid” SSL certificate. You may be wondering how a server might have an invalid certificate? The answer is that valid certificates cost money and require a unique internet address for the server. If you are using a free service from a small company, or even an internal server, odds are good that they won’t be springing for an officially signed SSL certificate any time soon.

All is not lost though, you can tell Thunderbird that you trust the server, and that Thunderbird should also.

Here’s how:

  1. In Thunderbird open the Preferences windows.
  2. Click on the Advanced tab.
  3. Click on the Certificates section.
  4. Click on View Certificates.
  5. Click on the Servers tab.
  6. Click on Add Exception….
  7. In the Location: field, delete https:// and enter the server name you looked up the SRV section above. If you got an ERROR when looking up the SRV record, enter the part of your XMPP/Jabber account that happens after the @.
  8. After the server name enter :5222. Be sure and include the colon (:).
  9. Click on Get Certificate
  10. Make sure Permanently Store this Exception is checked.
  11. Click on Confirm this Exception.
  12. Click on OK.

Good Luck

With any luck you will now be able able to connect to your Jabber/XMPP server.

Please suggest improvements to these directions in the comments.

How to fix MacPort’s version of w3m from crashing on Mac OS X 10.7 Lion

I like to use w3m command to display HTML content in emails under emacs.

I recently noticed some w3m instability after I upgraded to Mac OS X 10.7 Lion:

$ w3m http://www.nytimes.com/
Segmentation fault: 11

Mac OS X also offered a helpful message of w3m quit unexpectedly and offered up a Problem Report that looked like this:

Process:         w3m [835]
Path:            /opt/local/bin/w3m
Identifier:      w3m
Version:         ??? (???)
Code Type:       X86-64 (Native)
Parent Process:  bash [3425]

Date/Time:       2012-06-23 22:07:41.760 -0500
OS Version:      Mac OS X 10.7.4 (11E53)
Report Version:  9
Sleep/Wake UUID: 622A3F05-8259-4DF2-82F6-3CACB28E7F3D

Interval Since Last Report:          210793 sec
Crashes Since Last Report:           2
Per-App Crashes Since Last Report:   1
Anonymous UUID:                      FCCF1BD2-936E-4A92-A3C1-D6C071E5132D

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000008

VM Regions Near 0x8:
--> 
    __TEXT                 0000000109832000-00000001098b7000 [  532K] r-x/rwx SM=COW  /opt/local/bin/w3m

Application Specific Information:
objc[835]: garbage collection is OFF

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   w3m                           	0x000000010989027b pushValue + 75
1   w3m                           	0x000000010984ad7b flushline + 2523
2   w3m                           	0x000000010984f40b HTMLtagproc1 + 2875
3   w3m                           	0x0000000109852b54 HTMLlineproc0 + 1876
4   w3m                           	0x00000001098564b2 loadHTMLstream + 1954
5   w3m                           	0x00000001098495f6 loadHTMLBuffer + 182
6   w3m                           	0x000000010984444a loadSomething + 26
7   w3m                           	0x0000000109847f48 loadGeneralFile + 6296
8   w3m                           	0x00000001098342e6 main + 4838
9   w3m                           	0x0000000109832ed4 start + 52

The above is pretty annoying, and after many Web Searches I found MacPort Ticket 30710.

Which explains that the current MacPorts version of boehmgc package isn’t Lion compatible.

Fortunately, the solution explained in the MacPorts ticket is simple, instead of the boehmgc package, use the newer boehmgc-devel package instead.

To make the switch I ran the following commands:

$ sudo port deactivate w3m boehmgc
--->  No broken files found.

$ sudo port install boehmgc-devel w3m 
...
--->  No broken files found.

And now w3m works well under Mac OS X 10.7 Lion.

How to Make Emacs SSL Work on Mac OS X

If you find yourself on Mac OS X having problems getting SSL working for Emacs under Mac OS X, you might try installing GnuTLS and telling emacs to use that instead.

Why would you need this? In my case I was just trying to get Wanderlust (the best email client for emacs in my opinion) to connect to server that only support an SSL connection.

To Install GnuTLS

In general I recommend the MacPorts package as way to install GnuTLS (and many other useful packages).

Once you have MacPorts installed, you can then install GnuTLS with this command:

sudo port install gnutls

Tell Emacs to use GnuTLS

After that it is simply a matter of telling emacs you want to use GnuTLS by adding something like this to your .emacs:

(setq ssl-program-name "gnutls-cli"
      ssl-program-arguments '("--insecure" "-p" service host)
      ssl-certificate-verification-policy 1)

Odds are excellent it will work with the above setting, but that carries a security risk that someone might be “spoofing” the far end of the connection, but you wouldn’t know about it. For security reasons, you should therefore removed the "--insecure" part, but if you are dealing with self signed certificates that is certainly the lazy way out.

Workaround for dansguardian and iTunes 9.1

The recent iTunes 9.1 update from Apple came with a bug that breaks compatibility with the Dansguardian web content filter and results in an Can’t Connect to the iTunes Store error message from iTunes.

What is happening is that iTunes requests a URL with a dot after the hostname:

http://ax.init.itunes.apple.com./

And dansguardian rejects it as a malformed URL (since it is).

You can test it by typing:

http://apple.com./

into a browser (note the period/dot after com).

If you get a Dansguardian Malformed URL page and running iTunes 9.1, it is very likely your problem.

In any event, here is a quick and dirty source code workaround to sidestep the issue: iTunes.patch.

Note that this workaround only helps a system administrator/IT type who can rebuild dansguardian from source and install it into your production environment.

I tried to take an approach where Dansguardian would see the URL internally as the non-dotted version so that URL regex’s would not be thrown off, but it is possible that my patch breaks some host or URL matching/filtering within Dansguardian (content filtering should be unaffected).

WARNING: Use the above patch at your own risk.

Book Review: The Copper Scroll

The Copper Scroll: A Novel The Copper Scroll: A Novel by Joel C. Rosenberg


My review

rating: 4 of 5 stars
The Copper Scroll is the latest installment of the Last Jihad series by of fiction thrillers by Joel C. Rosenberg.

Joel Rosenberg first came to national attention by writing the first book in the series, The Last Jihad, about a terrorist attach by hijacking an airliner and flying a kamikaze attack against the United States. Not to impressive unless you realize the book was written nine months prior to 9/11.

Not unlike author Dan Brown, Joel Rosenberg writes from a foundation of research and fact that lend an authenticity to the story.

Rosenberg starts with the mystery of a copper scroll which was found amongst the Dead Sea scrolls more than half a century ago. Unlike most of the Dead Sea scrolls this scroll lists location of treasure which would be worth over a billion dollars today. Sounds made-up doesn’t it? Oddly enough this part of the story is pure fact.

Newly discovered secrets about the Copper Scroll unleash a series of events that engulf current and former CIA operatives, leaders of the United States, Israel, and Iraq in a race to unlock the secret.

Although this is the fourth book in the series, it was the first one I have read. I found that that the book stands well by itself.

As a work of fiction it was a well constructed, very enjoyable story with good characters.

On a second level, although the style is similar to that of Dan Brown, the moral of this story couldn’t be more different. While I have found Dan Brown to be an engaging writer, his message seems to consistently be “you can’t trust religious faith”.

As a Jewish Christian, Joel Rosenberg’s message of “there is something to authentic Christianity” comes through loud and clear. As a Christian I really enjoyed this aspect of the story.

On a third level, I was intrigued by the author’s unique ability to project events into the future, in this case mixing the Copper Scroll with prophecy from the Bible.

Note: The author has written a non-fiction book, Epicenter, which deals with with the Biblical Prophecy aspect in more detail.

I would recommend this book to anyone who enjoys a Dan Brown style book or political thriller.

View all my reviews.

Google Reader’s dirty little secret? You can’t tell when your subscriptions are broken.

Google reader is probably the best all around feed reader there is. Its easy-to-use interface works from just about any device and it makes keeping tracks of many websites a “one stop shopping” experience.

Imagine my surprise when I decided to try out an competing feed reader only to discover a number of my subscriptions had been broken for a long time, and Google Reader never bothered to alert me.

This is a huge issue; Google Reader’s only job is to reliably deliver updates from the websites you choose, and it doesn’t tell you when it fails? The equivalent would be sending emails and not getting “bounce” messages back if the message couldn’t be delivered.

Why were my subscriptions broken? After I subscribed, some of the websites had upgrades that changed the address of the subscription. Then when Google Reader tried to retrieve updates the requests failed and Google Reader was silent. I never knew my subscriptions weren’t being delivered.

This reminds me of the whole Seinfeld “What is a reservation?” routine:

The workaround is to use the Google Reader Trends functionality and and look under the Inactive Tab under Subscription Trends heading. If you have a subscription that hasn’t been updated in more than a few days it probably broken.

You have been warned.

Allen, Texas (and your community) Needs to Get Around to Roundabouts

On July 10 an Allen motorist suffered a possibly fatal accident at US 75 and McDermott. An accident which possibly could have been prevented.
How could it have been prevented? Because if a different intersection design had been used there is a 90 percent lower chance the accident would not have been fatal.

The safer intersection design is known as a “Modern Roundabout”.

The Arizona DOT website list the following benefits of modern roundabouts:

  • 90 percent reduction in fatal crashes
  • 75 percent reduction in injury crashes
  • 30-40 percent reduction in pedestrian crashes
  • 10 percent reduction in bicycle crashes
  • 30-50 percent increase in traffic capacity thereby enhancing traffic flow

This isn’t your father’s traffic circle

Roundabouts, or traffic circles, have come a long way since they were last in vogue here in Texas. Improved intersection design techniques have eliminated the many of the issues which lead to their decline in popularity.

The modern roundabout incorporates features that helps reduce entry speed which helps to provide smooth and steady traffic flow along with the ability to have traffic smoothly flowing from all directions at the same time.

Safety

Within the roundabout itself, traffic flows in only one circular direction and at a low rate of speed, almost always less than 25 mph. Collisions, when they do occur, tend to be minor fender benders.

Compare this to a traffic light, where is the flow is “sliced and diced” with traffic moving at a high rate of speed from only one or two directions at a time. All drivers must split their attention between the lights and the actions of other drivers.
Collisions at a traffic light intersection, when they occur, can involve two otherwise law abiding drivers traveling at the speed limit going in opposite directions. The force and energy involved can easily be fatal.

Efficiency

With gas hovering at around $4 a gallon, suddenly efficiency is on everyone’s mind. Any “hypermiler”, those individuals who will go to great lengths to squeeze every mile out of a gallon of gas, will tell you that stopping, idling, and starting are the enemies of high gas mileage.

A stoplight, particularly at a busy intersection, may cause a number of stops, idles, and starts for every driver. A roundabout, on the other hand, allows traffic to continue to flow smoothly, although at a possibly slower pace.

A roundabout also provides a 30-50 percent increase in intersection throughput. Saving time and money for every driver that uses the intersection, and even saving money for the taxpayers who don’t use the intersection, since the same lanes with more traffic flow means less money is spent widening roads.

Change

I am well aware that a roundabout isn’t a practical solution for every intersection, but I have a very hard time believing that in all of Allen a lightly traveled intersection by the public library is the only one that makes sense.

My children go to Boyd Elementary which is located at the corner of Jupiter and Bethany — one of the more busy intersections in Allen. The road that goes by my home, White Oak, is used as a shortcut by many drivers due to the morning back-up on Bethany.

I would love for my children, and everyone else’s, to have a 30-40 percent lower chance of being hit by a car on the way to or from school. I would love to enter an intersection with a 90 percent lower chance of getting killed crossing it, and I would love for the city to take a long hard look at why the only roundabout in town is at a lightly trafficked intersection.

Stewardship Testimony

Each year my church, Round Grove United Church, has a stewardship program where member’s of the congregation speak for a few minutes on the meaningfulness of the church and how giving has been meaningful. This year I was asked, and this was my testimony.

Round Grove’s yearly stewardship campaign focuses on the need of the giver to give.

Christ said in Matthew 7:16-20, “You will know them by their fruits. Do men gather grapes from thorn bushes or figs from thistles? Even so, every good tree bears good fruit, but a bad tree bears bad fruit. A good tree cannot bear bad fruit, nor can a bad tree bear good fruit. Every tree that does not bear good fruit is cut down and thrown into the fire. Therefore by their fruits you will know them.”

Jesus was saying that Christians, all Christians, are the good trees — must be the good trees. And if we are the good trees we cannot help but bear good fruit.

As I look over this congregation, I see mentors who have showed me, showed all of us ways of bearing the good fruit here at Round Grove:

My wife Trish – who demonstrated the joy of teaching Sunday School over a decade ago when I hung around at the beginning of her Sunday School to “help out a little”. Now I have been teaching here at Round Grove for over ten years.

Grady Quick, my friend who has showed me how to deal with difficult situations with perspective and humor.

Past and current members of the Board of Trustees and the Deacons, whom I have heard some call “do nothing”, but who painstakingly set priorities and did more with far fewer resources than most people will ever know.

Our own Pastor Wells, who has demonstrated personal sacrifice time and time again. I will never forget several years ago when he offered to defer his own salary when Round Grove was low on cash. I will never forget.

Those who show up every week — in very hot robes as I discovered a few weeks ago — and shared their gift of Music with the congregation.

Those families whose example of years of selfless service has amazed me: the Lennerts, the Littrells, the Howells, the Murphys, and many more.

Bud Keil, who showed up at church last week, not even missing one Sunday after a heart attack. Amazing.

So much good being done here at our Church. So much more than I have time to mention (I promised Byron to limit myself to 3 minutes…sorry Byron).

I think this “good fruit” was what attracted my wife Trish and I to Round Grove many years ago. We joined because we felt the welcoming Christian Fellowship that Round Grove offers.

We have continued to be a part of the Round Grove family because we wanted to help in serving God by working side by side with you, our brothers and sisters, to build things up, and to be built up ourselves, in a world that seems to celebrate tearing down, negativity, and hurting others.

1st John 3:11-18 says “This is how we know what love is: Jesus Christ laid down his life for us. And we ought to lay down our lives for our brothers. If anyone has material possessions and sees his brother in need but has no pity on him, how can the love of God be in him? Dear children, let us not love with words or tongue but with actions and in truth.”

I’d be a hypocrite if I left you thinking that I feel I measure up to these words…I don’t. But I do know that I love you all here at Round Grove and I am awed and inspired by you. You have challenged me to strive harder by the example of your dedication and loving service.

It is humbling, yet a privilege, honor, and blessing to be a part of this congregation.

Champion What Makes You Unique

The last couple of weeks have been crazy, a vistor down our chimney (squirrel claws, not Santa Claus), half our tree snapping off in the front yard, a trip to the ER, and having to look for new employment due to my job being cancelled. But, you can learn a lot from a plumber…

The Timline

  • 9:00am — “Twas the the day before Thanksgiving, and to the neighbors bathrooms we did roam, for no water was draining in the in-laws home” — and a clogged up house before thanksgiving is a serious matter.
  • 10:00am — My brother-in-law, Larry, and I tried to unclog it with a 40 foot drain cleaner “snake”. No luck.
  • 11:00am — A plumber was called that morning and said “We’ll be there by 4 this afternoon”.
  • 5:30pm — no plumber. A phone call reassured us that the plumber would be there.
  • 6:30pm — through a valiant effort by my mother-in-law, we have a great Thanksgiving meal (yes, on Wednesday — when 3 families are involved things get complicated).
  • 7:30pm — still no plumber. A phone call told use that “they should have called you and let you know that the plumber wasn’t coming”. Grrrrrr.
  • 7:31pm — panic sets in. What are the odds of a plumber coming the evening before Thanksgiving?
  • 7:33pm — Not too bad apparently. One says he’ll be there in 15-20 minutes
  • 7:50pm — Plumber arrives.
  • 8:45pm — Drain clog which turns out to be 100 feet down the sewer line is fixed. There is much rejoicing.

The Rest of the Story

Pretty boring story, except for the plumber that showed up. I’ll let his phone book ad do the describing: Image of one armed plumber phone book ad

His van had similar artwork including what may be my favorite slogan ever: We Single Handedly Beat the Competition

 

The Moral

Too often we try to hide what makes us unique because we don’t want be seen as different. What Mr. Merryman can teach is that we are different, and even if we don’t want to, we will stand out. By being up front about his unique appearance, Mr. Merryman ensures that we won’t forget about him and in doing so removes both surprises and obstacles.

But we can’t win just by being different. We are still being judged by the job we do; by emphasizing what makes us unique we challenge ourselves to excellence. No one wants to be remembered for a job poorly done.

So, as I embark upon my new job search, I hope I have learned the lesson of the one handed plumber well.

Breaking up with Singleton

Have you ever secretly come to really dislike someone?

 

At first you think they’re great. You might even want to get closer. Then, after spending time with them, you realize they are a little obnoxious. Then, bit by bit, you start avoiding them whenever you can.

Finally, the day comes, when a friend quietly whispers “You know, I can’t stand that person”.

Reaction: Relief

Suddenly you realize you’re not crazy, it isn’t you. It’s them. Really.

Well that day has come for me and the Singleton design pattern. In Steve Yegge’s Singleton Considered Stupid I found a friend to confirm my now near hatred for the so called singleton design pattern.

Singleton and I used to be close. When I first started seeing, and, I’ll admit it, using singleton I quickly began feeling a growing unease. I found myself callously using singleton to allocate an instance, and then never speaking to singleton or the instance again.

Then things went from bad to worse. Once I started testing singleton I noticed how self centered singleton was. How could someone insist that they always be “the only one”?

Finally I started cheating; using backhanded methods to use and discard whole series of singletons. I even always took care to keep each one ignorant of the other. I told myself it was just for “unit testing”, but I knew better.

Now I realize I can’t live like this. It’s over.

Now I will only be design patterns who don’t have to be the center of universe. No more cheating, no more lying.

I hope I never see another singleton again.

A Gentle Introduction to using RSS

I know many people who have never tried RSS, so here is my attempt at a gentle introduction…

The problem: Too Many Places

Too many website to keep an eye on.

If you are like most people, the internet is both a blessing and a curse. A blessing because of the wealth of data available, a curse because it is easy to waste valuable time and get nothing in return.

For example, if you have a single website you love, maybe you check it several times a day. Easily done.

Sometimes you check a website and there is a new article worth reading, but sometimes there is nothing new. A few minutes wasted.

But what if you have three site you love…then it starts to get tedious, you go to one site for the weather, a second for news, a third for your hobby, a fourth for your grandchildren’s school.

The solution: Just one place

What if, instead, you could check one place and see updates appear from any of the sites you are interested in? Then instead of checking three places, or five, or ten, you could check only one but still get the information you want.

This concept is called “RSS aggregation” (RSS is a a kind of a file format — you probably already know what aggregation is).

But no matter what you call it: RSS is a way to know when new articles appear.

Nothing special about it really.

RSS contains the following information:

  • Links to the most recent articles on the site
  • Titles, descriptions, and other details of the articles and the website

How it works

The good news is that you never have to edit or save an RSS file, that is the job of the website, they keep their RSS file updated with the list of the latest articles. All you have to do is tell your RSS client software (more on that later) to do the website checking for you. You do this telling your RSS software the web address (URL) to the RSS file on the website you want to keep tabs on.

The RSS software then checks the website at regular intervals (usually every hour) so you don’t have to.

How to spot an RSS link

What RSS practical, is that most sites now supply RSS. This trick is knowing that is is there.

RSS files come in several “flavors” among them various versions of RSS and Atom. The term XML is also sometimes used to indicate an RSS or Atom feed (technically speaking XML is a much more generic term that also includes a huge number of other things).

So to make a long story short, look for links or icons on web pages labeled like the following:

  • Atom

RSS Client Software

There are many many choices and this article will not cover any specific choice.

Regardless of the RSS software you choose, they all do the same thing: give you the ability to get your updates at one place instead of many.

There are two broad categories: websites and applications.

RSS Client Website

This type of website collects feeds and displays them. The checking happens from the remote website, and the remote website keeps up to date even if you computer is off or disconnected from the internet.

Pros:

  • Accessible from any computer on the internet.
  • No installation needed.

Cons:

  • If you have intranet (not accessible from the internet) RSS feeds, this software will not be able to access it.
  • You must be connected to the internet to even read the headlines.

RSS Client Application

This is software you download, install, and run on your computer like any other application.

RSS Clients that run on your computer

This software runs on your computer and is usually installed as a stand alone application or may even be available as part of your web browser.

Pros:

  • Can read headlines and sometimes even the articles themselves while disconnected from the internet.
  • Can access intranet RSS feeds.

Cons:

  • Runs only on the computer(s) you installed on.

Getting Started

The best way to start is to try one of the many RSS Clients. A list is available at blogspace.

If the above list seems overwhelming, the Google Reader as a good place to starting getting familiar with an RSS Client.

For your first feed, try mine at http://rmore.net/planet/rmore/rss10.xml.