Rebuilding Spotlight’s Index on OS X (Manually)

Got problems rebuilding the Spotlight index on OS X or all you’re getting is an empty list with no files found? Here’s how I reindexed my system using just the Terminal and no special software – turns out there was one small thing that had gotten in the way.

After doing a number of disk clean up and optimizations, I found myself in the circumstance of OS X’s spotlight returning no results. Whether I searched for a keyword in Mail, or by Spotlight using Command-Space, I got no results backs – just an empty list for my troubles.

It turns out there’s a neat utility out there called Rebuild Spotlight Index 2.7 that does all the grunt work for you. Problem is, it didn’t work for me.

What’s going on is actually fairly trivial, and it’s possible to simply do everything via the command line.

The metadata utilities need to run as root, so to see what your drive is up to, you’d enter something like: sudo mdutil -s /

This shows the status on the root volume.

To turn indexing on for a volume, you enter: sudo mdutil -i on /

And, to force Spotlight to rebuild its index, you simply erase the master copy of the metadata stores on the volume like this: sudo mdutil -E /

However, while I did all this, Spotlight was still not building the indexed for me.

Here’s how I solved it, using just the Terminal.
First, I wanted to see the schema file, so I printed it out using to the standard input using: sudo mdimport -X

At the bottom of the schema listing, I say a reference to a schemaLocation, and took a shot in the dark that perhaps that Spotlight’s index rebuilding needed to check data against its schema before it would start. To do that, it might need network access, if not back to the local machine.

And, for good measure, I went to check the date/timestamp on the Spotlight directory using: sudo ls -la /.Spotlight*

While most of the files had the timestamp of when I tried to delete the index, not all the files had the current date and time. Additionally, the file sizes were not growing, a good indication the index was not being rebuilt.

Thinking to myself, “what could be causing network traffic, even internally, not to be working”, I realized that I had just rebooted and PeerGuardian2 was currently active and blocking traffic. This is a great tool for blocking malware and unwanted network visitors, but occasionally it gets in the way. So, I turned it off.

Then, I did the following commands to ensure indexing was on, the spotlight metastore was really gone, and that I wanted it rebuilt:
sudo mdutil -i on /
rm -rf /.Spotlight*
sudo mdutil -E /

The moment I did the last command, this time the system sprung to life, the directory /.Spotlight-V100 was created, and the files inside it were growing quickly. Spotlight on the toolbar showed a progress bar, indicating the system would be done indexing in a bit. The big difference? I turned off the network traffic blocker for a moment.

The Safeway to Apologize

True story — how to abuse a nosy florist.

Recently we went to Colorado to visit my sister who was having her second baby. Our job was to babysit her 21 month old, while she did the hard work at the hospital.

They were very kind in lending us their hybrid van and a baby seat, which allowed us to trek around town without being stuck in the comfort of a custom built home, trapped on mountain with spontaneously visiting wildlife, surrounded by nature and vast scenic panoramic views.

My dad sent an email asking if we could pick up a box of nice chocolate, so that when my sister got home from the hospital, she’d have something to enjoy. Sure, we could do that. Perfect excuse to ride into town.

So, we put the toddler in the van and drove to Safeway.

Now in Colorado, it’s dry. Very dry. So you have to drink a lot of water to stay hydrated. As such, my wife sent me on a mission to get the chocolate, while she hunted down the facilities.

So, I pushed the baby over to the candy aisle, then the cooking aisle, then the checkout counters, …no boxed chocolate to be found.

Then it hit me: try the florist.

As I got near the section, the toddler went nuts as we passed the stuffed animals. However, as we got closer, it was quite clear his real interest was in the balloons. And, since we already had a four foot mylar balloon tied to the shopping cart, I figured I’d head right to the service desk where I abruptly startled a woman cutting flowers that didn’t see me coming.

“Excuse me.”

“Wha?! Oh, yes. May I help you?”

“I hope so. I’m looking for boxed chocolates.”

“Did you try the candy aisle? We sell flowers, here.”

“Yes, I tried that, but no boxed sets. So I thought I’d have better luck here.”

“Why would you say that?”

“Because this is the general ‘apology’ section, is it not?”

She pondered for a moment what I was getting at, and then the image of chocolates and flowers together hit her. “Oooooh!” she smiled, “What exactly are you apologizing for?”

I couldn’t help myself. It was evil. It was wrong.

I looked at the toddler, then back at her, and said: “I thought it was your turn to use the contraceptive.”

…she personally led me to the most expensive boxed chocolates at the front of the store.

iPee

Did I just have the first recorded iDream, because there was an iPhone in it… I wonder how AT&T is gonna charge this conversation. (Read on to see the conversation, which was just as strange.)

True story.

I was standing at a urinal when my iPhone rings. Now, normally I don’t answer the phone while in a restroom, but I was curious as to who was calling me as I haven’t made the number widely public yet. A huge green banner said it was my wife.

It was at that moment I woke up.

Or, more accurately, half-way woke up.

It was the middle of the night, I was under the covers, and when I turned my head, I could clearly see my wife sound asleep, and beyond her, my iPhone sitting in the charger, dark.

Yet, still half asleep, I could still ‘hear’ my iPhone ringing in my dream. Curious now as to what would happen, I decided as an experiment to answer it. I closed my eyes and instantly I was back in the dream in front of the urinal holding the phone.

I touched the answer button, lifted the phone to my face, and crystal clear I heard my wife say, very annoyed at me: “Clearly, you aren’t getting the symbolism here.” And then she abruptly hung up on me.

So, I put the iPhone in my pocket, woke up, and made my way to the rest room.

[Is this the first recorded iDream?]

Dell Inspiron E1505 Mouse Pointer Problem

The cursor on a new Dell Inspiron E1505 laptop with an ATI Mobility Radeon X1400 graphics card running XP Home looks like a vertical bar, not a pointer. Here’s the fix.

Today’s tip comes from John Cook, who reports that upon purchasing a new Dell Inspiron E1505 laptop with an ATI Mobility Radeon X1400 graphics card running Windows XP Home Edition Service Pack 2 (build 2600) and using the “Synaptics PS/2 Port Pointing Device” as a mouse, the cursor appears as a vertical bar.

Unfortunately, there’s nothing on the Internet that tells how to correct the problem.

SOLUTION: The problem is with the hardware acceleration.

Right click the desktop, choose properties, go to the Settings tab, click Advanced, choose the Troubleshoot tab, and slide the slider one notch to the left. Click Ok, then OK.

Hibernate: No Persistance Provider

While working through a code sample in Java Persistence with Hibernate, I ran into a problem where Hibernate was reporting No Persistence Provider. Solved the problem, and it wasn’t moving the persistence.xml file as you’d normally find on the web as the solution.

I’ve been spending a lot of time with Hibernate, an ORM persistence manager.

After ripping Pro Hibernate 3 a new one with a scathing review, I finally have concluded that the best book on Hibernate is Java Persistence with Hibernate, which is revised edition of Hibernate In Action, though you’ll still need to reference the ERRATA for Java Persistence with Hibernate on occasion.

In the middle of page 76 it was time to go build my sample application, and all I got was a strange message that said: javax.persistence.PersistenceException: No Persistence provider for EntityManager named helloworld


Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named helloworld
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)

Most of the discussions on the Web lead to the conclusion that the file persistence.xml is missing, or if it isn’t, it hasn’t been placed in the META-INF directory. In my case it was present, it was in the right place, and it was correct. What gives? Seems other people were having this problem as well.

The Solution
Thanks to a szermierz‘s entry on the introductory page An Introduction to Java Persistence for Client-Side Developers, which is actually a great article itself, it got me to question what libraries I had in my classpath, and whether or not that list was complete.

Turns out there was one file he listed that I didn’t have: hibernate-entitymanager.jar.

Looks important, eh?


I easily found a copy in the Hibernate Extensions at HibernateExt\tools\lib\testlibs.
There was also a copy in the Hibernate Tools at HibernateTools-3.2.0b9a\plugins\org.hibernate.exlipse_3.2.0.beta9a\lib\annotations.

Once I placed a copy in there, things worked great. So it’s not just the property file, but the .jar file that needs it.

Conversation at Borders

Overheard the weirdest conversation at Borders.

I’m in the Art section of Borders, and I walk in on a conversation that’s just starting between some guy who’s failing miserably at hitting on a college girl…

Guy: “You look like you’re angry.”

Girl: “You can tell I’m not angry, because I’m not sketching.”

“You sketch when you’re angry?”

“Yeah. If I’m mad at somebody, I draw a picture of them on a bus heading to hell.”

“Hell?”

“Sometimes Ohio.”

(pregnant pause) “Have you ever thought that might be a serious sign of a repressed mental illness?”

“Maybe. But, I really hate Ohio.”

Mouse Trails Slow Graphics on XP!

Using Microsoft’s Mouse Visualizations, such as mouse trails or show location, well if you’re using a modern system with hardware acceleration, you’re doing so at a very high performance cost. Read on to see why this option should be off.

Today’s trick will give you an astounding performance boost, while at the same time make you just shake your fist at Microsoft.

First of all, to start with, let me say that my Dell Precision 470 (2.8Ghz Dual CPU with hyperthreading on) and 2GB of RAM running XP Pro is …slow. I mean the kind of slow where clicking the Start button takes several seconds to draw the rectangle for the menu.

I have a dual monitor system. I’m using a Dell 2005FPW via DVI at 1680×1050 60Hz as my primary monitor and a Dell 1907FP via analog SVGA/XGA at 1280×1024 60Hz as my secondary. Both are driven by an ATI FireGL V3100 using the latest drivers from ATI’s site for XP Professional, and hardware acceleration is set to full.

I first noticed the severity of the problem when using iTunes 7.3.1.3’s music visualizer. Here’s how playing a simple CD turned into a fantastic diagnostic tool.

With the iTunes visualizer running on the primary monitor, I noticed that when I put the mouse on the secondary monitor the visualizer ran at full speed and was completely fluid. When I put the mouse on the primary screen, even when I wasn’t moving it, the frame rate dropped to about two frames every second (music, however, played fine).

Task Manager, after a violent killing spree, showed a minimal number of processes and services, idle times in the high 90%s, and no interesting page or interrupt activity — but the behavior continued. Opening additional applications didn’t affect performance, as long as the mouse was on the secondary screen.

When I showed this behavior to a friend of mine, Brian Busch, he suggested I turn off mouse trails. And, to humor him, I did. Instantly my system sprung to life and the problem was gone.

That’s when it struck us. Windows XP’s mouse pointer options don’t use hardware acceleration. And to confirm it, I pressed the CTRL button, which showed the location of my mouse. As the little target was drawn around the cursor, the frame rate dropped. When Microsoft’s little visibility animation ended, the system resumed at full speed.

Why was mouse trails on? Because Dell still hasn’t fixed the jumping mouse problem. But I don’t love them enough to kill my system’s responsiveness. Laptop users, beware.

Performance Recommendation: Go to Settings / Control Panel / Mouse, select the Point Options tab, and in the Visibility section uncheck ‘Display Pointer Trails’, ‘Hide pointer while typing, as well as ‘Show location of pointer when I press the CTRL key’ and press OK.