When I started poking around, I found that Google+ uses Google’s “Rich Snippet” system. Google has released a Rich Snippet Testing Tool. The tool is great, and it helps you tweak your HTML so you get the correct snippet content.
…Except in my case, where the tool just reported “Could not fetch web page.”. Not helpful. Why a better error descriptor isn’t given, I don’t know.
This article will explain how I got to the bottom of the problem (despite Google’s useless error messages) and how you can look for similar issues.
When I realized I was getting intentionally vague responses from the Google tools, I posted to Google’s Webmaster Central forums, but didn’t get a useful answer.
After a few days of thinking about it, I got the idea to try my website on the W3 HTML validator site.
The validator gave me a new error. I lost the actual text, but it said it could not understand Content-Encoding ‘none’. Finally, we’re getting somewhere.
I started doing research into why Wordpress might be sending the wrong Content-Encoding, but didn’t find anything. So I logged onto my website, and grepped for ‘Content-Encoding’. Nothing really exciting jumped out at me.
But, while I was logged in, I noticed some suspicious PHP files. And then I noticed at the top of wp-config.php a line of PHP that started like this: eval(base64_decode("aWYoZnV
.
Oh… that’s a sure sign I’ve been hacked. So I followed the instructions here, and removed the hacked code and suspicious PHP files.
Then I went to the validator, and sure enough, the Content-Encoding had changed, so it was able to actually run the validator. So I tried the Rich Snippet Testing Tool, and sure enough, now it works too! Which means Google+ shares work again!
So, the bottom line is, if you are having trouble with sharing your website on Google+, check your Content-Encoding, and make sure you haven’t been hacked.
]]>When I started poking around, I found that Google+ uses Google’s “Rich Snippet” system. Google has released a Rich Snippet Testing Tool. The tool is great, and it helps you tweak your HTML so you get the correct snippet content.
…Except in my case, where the tool just reported “Could not fetch web page.”. Not helpful. Why a better error descriptor isn’t given, I don’t know.
This article will explain how I got to the bottom of the problem (despite Google’s useless error messages) and how you can look for similar issues.
]]>This is a fantastic, well built, sturdy and light bag. It is also extremely comfortable to wear, most of the time. If your gear all fits within the backpack, you’ll love it and be thrilled with it.
Unfortunately for me, I have a thing about camera bags, and I’m extremely picky. When I bought the UL-222, I was hoping it would be a larger, more professional replacement for my National Geographic NG 5162 (Earth Explorer Medium) bag: Something flexible and efficient I could back professional camera gear in, as well as enough personal stuff for a multi-day trip.
Unfortunately, for my purposes the bag is pretty compromised…
I mention the National Geographic bag because I suspect Kata makes it. It is a fantastic bag although I had to modify it to make my 15” MacBook fit, and it isn’t quite deep enough to hold a professional SLR safely.
Here are my specific issues on the Bumblebee UL-222:
I wish the top compartment, instead of being s small rounded hatch, was an adjustable-sized drawstring-and-hood like the NG bag, or like a hiking backpack. This would allow the bag to store more stuff when needed and collapse down when not.
The tripod attachment options are terrible. When in the centered, location, the tripod extends beyond the bottom of the bag, making it impossible to stand the bag up, and you need to leave the zippered pouch open strap the tripod top in, which just seems odd. When on the side, the tripod doesn’t extend past the bottom, but the upper strap distorts the top of the bag and the entire tripod blocks the only place for a water-bottle. On the NG 5162, I was able to use the accessory straps on the bottom or side of the backpack to attach a tripod without any of these issues.
The bag lacks decent strorage compartments for water bottles. The NG 5162 has two large, pullout, velcro-stabilized places for water bottles, and they work great. The UL-222 has one elastic compartment, it is too small and short for any reasonable sized bottle (ie, 750ml or larger).
The bag has no good places for attachments or accessories. I was hoping like the NG 5162 there would be strap attachments at the bottom to strap a duffle bag or sleeping bag to.
The aluminum frame is awesome, and does a great job keeping the pack off my back, but the hip belt is too flimsy to use to support much of the weight of the bag, which can be pretty heavy when fully loaded with a camera, equipment, and a laptop. I sort of wish the bag came in a few frame sizes, the way a hiking backpack does, with a better hip-stabilizer strap.
I find myself planning to jury-rig something to attach a simple crush bag to the EPH attachment points at the bottom of the bag so I can carry some more personal gear, but I noticed the EPH attachments are only in the back, so to keep the additional bag strapped in, I’ll need to use the tripod-holder loops on the front flap of the bag, meaning I’ll need to release the attachment just to open the bag, which is annoying.
The bag is extremely well thought out, which is why all these little things add up to such a frustrating experience. If you can live within the design of the bag, and don’t need to carry water or can fit it inside the bag (near your camera?) you will really enjoy this bag. It does hold a ton of camera gear safely and it is the most comfortable camera bag I’ve ever worn.
]]>This is a fantastic, well built, sturdy and light bag. It is also extremely comfortable to wear, most of the time. If your gear all fits within the backpack, you’ll love it and be thrilled with it.
Unfortunately for me, I have a thing about camera bags, and I’m extremely picky. When I bought the UL-222, I was hoping it would be a larger, more professional replacement for my National Geographic NG 5162 (Earth Explorer Medium) bag: Something flexible and efficient I could back professional camera gear in, as well as enough personal stuff for a multi-day trip.
Unfortunately, for my purposes the bag is pretty compromised…
]]>
Many people have commented that my Snow Leopard build works fine, but according to this thread there is a new project called OSXFUSE that picks up where MacFuse left off. The project incorporates the source code below and already supports OS X Lion natively. The project is just getting started, but a beta binary release is promised in the next few days.
I would recommend waiting for OSXFUSE.
You can find more information at the project homepage (not online yet) or find the source code on github.
]]>When doing code reviews, I often come across components which utilize static mutable objects. Typically these are static Maps and other Collections.
If you are using the ‘static’ keyword without the ‘final’ keyword, this should be a signal to carefully consider your design. Even the presence of a ‘final’ is not a free pass, since a mutable static final object can be just as dangerous.
I would estimate somewhere around 85% of the time I see a ‘static’ without a ‘final’, it is WRONG. Often, I will find strange workarounds to mask or hide these problems.
Please don’t create static mutables. Especially Collections. In general, Collections should be initialized when their containing object is initialized and should be designed so that they are reset or forgotten about when their containing object is forgotten.
Using statics can create very subtle bugs which will cause sustaining engineers days of pain. I know, because I’ve both created and hunted these bugs.
If you would like more details, please read on…
There are many issues with statics:
Code that relies on static objects can’t be easily unit tested, and statics can’t be easily mocked.
If you use statics, it is not possible to swap the implementation of the class out in order to test higher level components. For example, imagine a static CustomerDAO that returns Customer objects it loads from the database. Now I have a class CustomerFilter, that needs to access some Customer objects. If CustomerDAO is static, I can’t write a test for CustomerFilter without first initializing my database and populating useful information.
And database population and initialization takes a long time. And in my experience, your DB initialization framework will change over time, meaning data will morph, and tests may break. IE, imagine Customer 1 used to be a VIP, but the DB initialization framework changed, and now Customer 1 is no longer VIP, but your test was hard-coded to load Customer 1…
A better approach is to instantiate a CustomerDAO, and pass it into the CustomerFilter when it is constructed. (An even better approach would be to use Spring or another Inversion of Control framework.
Once you do this, you can quickly mock or stub out an alternate DAO in your CustomerFilterTest, allowing you to have more control over the test,
Without the static DAO, the test will be faster (no db initialization) and more reliable (because it won’t fail when the db initialization code changes). For example, in this case ensuring Customer 1 is and always will be a VIP, as far as the test is concerned.
Statics cause a real problem when running suites of unit tests together (for example, with your Continuous Integration server). Imagine a static map of network Socket objects that remains open from one test to another. The first test might open a Socket on port 8080, but you forgot to clear out the Map when the test gets torn down. Now when a second test launches, it is likely to crash when it tries to create a new Socket for port 8080, since the port is still occupied.
This is an over-generalized example, but in large systems, this problem happens ALL THE TIME. People don’t think of unit tests starting and stopping their software repeatedly in the same JVM, but it is a good test of your software design, and if you have aspirations towards high availability, it is something you need to be aware of.
These problems often arise with framework objects, for example, your DB access, caching, messaging, and logging layers. If you are using J2EE or some best of breed frameworks, they probably manage a lot of this for you, but if like me you are dealing with a legacy system, you might have a lot of custom frameworks to access these layers.
If the system configuration that applies to these framework components changes between unit tests, and the unit test framework doesn’t tear down and rebuild the components, these changes can’t take effect, and when a test relies on those changes, they will fail.
Even non-framework components are subject to this problem. Imagine a static map called OpenOrders. You write one test that creates a few open orders, and checks to make sure they are all in the right state, then the test ends. Another developer writes a second test which puts the orders it needs into the OpenOrders map, then asserts the number of orders is accurate. Run individually, these tests would both pass, but when run together in a suite, they will fail.
Worse, failure might be based on the order in which the tests were run.
In this case, by avoiding statics, you avoid the risk of persisting data across test instances, ensuring better test reliability.
If you work in high availability environment, or anywhere that threads might be started and stopped, the same concern mentioned above with unit test suites can apply when your code is running on production as well.
When dealing with threads, rather than using a static object to store data, it is better to use an object initialized during the thread’s startup phase. This way, each time the thread is started, a new instance of the object (with a potentially new configuration) is created, and you avoid data from one instance of the thread bleeding through to the next instance.
When a thread dies, a static object doesn’t get reset or garbage collected. Imagine you have a thread called “EmailCustomers”, and when it starts it populates a static String collection with a list of email addresses, then begins emailing each of the addresses. Lets say the thread is interrupted or canceled somehow, so your high availability framework restarts the thread. Then when the thread starts up, it reloads the list of customers. But because the collection is static, it might retain the list of email addresses from the previous collection. Now some customers might get duplicate emails.
The use of “static final” is effectively the Java equivalent of a C #define, although there are technical implementation differences. A C/C++ #define is swapped out of the code by the pre-processor, before compilation. A Java “static final” will end up memory resident on the stack. In that way, it is more similar to a “static const” variable in C++ than it is to a #define.
I hope this helps explain a few basic reasons why statics are problematic up. If you are using a modern Java framework like J2EE or Spring, etc, you may not encounter many of these situations, but if you are working with a large body of legacy code, they can become much more frequent.
]]>When doing code reviews, I o]]>
In one of the electronic markets, I found a small booth selling harddrives, and we asked what the price for a 250gb model would be. Whatever the price was, it wasn’t unreasonable. The harddrive came in a nice shrink wrapped box labeled “SAMSUNG” in the traditional Samsung white-and-blue color scheme. I wish I had thought to take a picture of it. I have no doubt the box was authentic.
Inside the box was a black harddrive case with gold trim, labeled “Samsung”. I suspected something was up right away because gold trim doesn’t seem to fit Samsung’s “style”, and the case was held together with 8 tiny screws. Most retail external harddrives are held together with screwless, snap-together designs and look much trendier than this basic case.
Worse, when I plugged the harddrive into the computer, it registered as a Hitachi model. Why would Samsung source harddrives from Hitachi when I know they make their own units? Since the harddrive worked, and I hadn’t paid too-too much for it, I didn’t really mind.
Later, I decided I would swap the Hitachi harddrive from this case into a better one I happen to have. Not only is the drive a Hitachi model, its refurbished!
[caption id=”attachment_291” align=”aligncenter” width=”300” caption=”Shanzai!”][/caption]
Lesson learned: Never buy a harddrive in China.
]]>[caption id=”attachment_284” align=”aligncenter” width=”1280” caption=”The new Kro's Nest has custom mame arcade cabinets with a rotating schedule of games.”][/caption]
]]>Because I’m into motorsports, and I’d like to get a donor-cycle, I’ve also been spending a fair amount of time on the forums at mychinamoto.com.
Also, I found a Linux Users Group here in Beijing, and even a Hackerspace! My lack of Chinese might be an obstacle at the Hackerspace, but if I have some time I’ll go check it out.
]]>I’ve got to apologize for the cultural insensitivity, because I know its inappropriate, but I find the name of this restaurant really, really funny.
I admit it, I really like junior-high level humor. “Your mom” jokes and penile humor never get old. Which is pretty amazing, considering the prevalence of surnames in China which happen to coincide with humorously euphemistic English words for male genitalia. You would think China would serve as a 1.3 billion person strong form of exposure therapy for me, but so far it hasn’t been very effective.
]]>Except on rare “Blue Sky Days”, the sky pretty much always has that white hazy look to it.
]]>No photos today since I didn’t get out much.
I think the stress of traveling is making me sick, I’m not feeling too well.
]]>Jet lag has me waking up really early. Also, Chinese mattresses are rock hard, which seems odd but I guess its normal here, The mattress in the old apartment was the same. We need to find a memory foam mattress cover because its pretty rough sleeping on this thing.
In the morning we went to the PSB (Public Safety Bureau) to register. All visitors to China who are not staying in hotels or other official locations must register with the local PSB within 24 hours of arrival, regardless of how long they are staying. It was pretty painless though.
We was running late, so rather than going back home, I got parked at a cafe for a few hours where I was able to get some work done on wifi. On the way there we walked past a shop with a painting of Obama with a rabbit:
Still waking up early… the bed is still rock hard…
We went to the supermarket today, which always an experience. Highlights included a live, large turtle in the seafood section, and oddly enough in the bread section there was a package labeled “Fish Hamburg” and a matching one called “Pork Hamburg”. I didn’t get photos, but I’ll try to next time.
In the evening we went to a neighborhood restaurant specializing in Peking Duck. A whole duck plus fixings and a vegetable side cost 99 rmb, or almost exactly $15. I am worried we won’t be able to afford eating out so lavishly on a regular basis.
Still waking up early… the bed is still rock hard…
I’m trying to figure out the work schedule. If I get online at 8 or 9, my co-workers are often still online and I can chat with them and email back and forth, sometimes as late as noon or 1 pm (midnight in Boston). If I work during the day, I can get a lot of work done, but never go outside. Sharon gets home early, so spending the evening working kind of sucks, but I need to be online from at least 10-11, depending on how meetings go.
I think the best thing will be to get in the habit of working from 10-5, taking a few hours off, then getting back online at 10 pm for an hour or so. That will leave 5 hours free in the early evening.
… haven’t been outside today yet…
]]>Jet lag has me waking up really early. Also, Chinese mattresses are rock hard, which seems odd but I guess its normal here, The mattress in the old apartment was the same. We need to find a memory foam mattress cover because its pretty rough sleeping on this thing.
In the morning we went to the PSB (Public Safety Bureau) to register. All visitors to China who are not staying in hotels or other official locations must register with the local PSB within 24 hours of arrival, regardless of how long they are staying. It was pretty painless though.
We was running late, so rather than going back home, I got parked at a cafe for a few hours where I was able to get some work done on wifi. On the way there we walked past a shop with a painting of Obama with a rabbit:
]]>The trip over went smoothly, but was grueling since I had to change once in Detroit and once in Tokyo. I had never been to either airport, and both were clean and nice. The Detroit airport has an indoor tram system which is pretty cool.
I left at 9 am on Sunday and arrived at 10 pm on Monday. If you subtract the 13 hour time difference this works out to about 24 hours of pure travel, most of which was spent inside one plane or another. I got an external USB battery pack for my phone and loaded its MicroSD card with 4 movies. This worked great and lasted for about 3/4 of the flight over the Pacific.
For those who are into such things, I saw a bunch of Totoro in a Japanese gift shop at the airport:
]]>According to wikipedia, it can actually mean a variety of things, including self sufficient urban agriculture, and government programs to get people to move into houses in the city.
All of these definitions seem in general to be positive, heroic actions, which is why it is a shame that I read on the EFF website about a trademark dispute with the Dervaes Institute about this phrase.
The Institute has managed to trademark this term, despite its common use in many settings for quite some time, and then used take-down notices on Facebook and other sites to prevent other people from using this term.
Considering how widespread and common the term is, this seems completely ridiculous. For example, see this books:
Today is the Urban Homesteaders Day of Action, to protest the Dervaes Institute’s attempt to commandeer this phrase.
]]>I also hate all the fan boys who think the virtual reality cyberpunk thing is so original. If you want to be cyberpunk, go read William Gibson’s Neuromancer which invented the genre 8 years before Snow Crash was written.
Don’t get me wrong though, I don’t hate Stephenson. Although Snow Crash did put me off his books for more than a decade, I am just now wrapping up The Diamond Age. And I love it, for all the reasons I hated Snow Crash.
Unlike the earlier book, The Diamond Age (which is only 3 years younger) is original, the characters have depth, and the pace doesn’t make the reader feel like they are watching a cheap action movie. And although Hackworth is a bit of an obvious joke, the character names are all reasonably believable.
The Diamond Age has broken my aversion to Stephenson’s novels, and I look forward to reading more of them. As long as Hiro Protagonist doesn’t make an appearance.
]]>For me, the solution was to use Apertures “Rebuild Library” option, which seems to have fixed the problem.
To do this, follow these steps…
First Backup your Library!!!
Ok, now that you’ve done that, hold the Option and Command keys down when starting Aperture. You should see a dialog box like this:
First run the “Repair Permissions” option, since it can’t hurt. You will need an administrator password to your computer, but the actual repair is pretty painless.
Once that is done, quit Aperture and restart, again holding down the Option and Command keys.
This time, choose “Repair Database”. This option is less dangerous than the “Rebuild Database” option. In my case, Aperture immediately detected that there were problems that could only be repaired with the “Rebuild” option, so I allowed it to do the rebuild.
Once the Rebuild was done, which only took a few minutes, everything worked great, and Aperture has been happy every since.
]]>For me, the solution was to use Apertures “Rebuild Library” option, which seems to have fixed the problem.
To do this, follow these steps…
]]>If you would like to be able to use MacFUSE on 64-bit Snow Leopard, you may have noticed a lot of mis-information on the net. In short, all of the latest official MacFUSE releases, including both 2.0.3 and the 2.1.7 beta are not compatible with 64-bit Snow Leopard. My understanding is that these releases will work with 64-bit Leopard, or with 32 bit Snow Leopard, but I cannot confirm this.
This article describes the current situation, and provides usable binary and source packages to download.
A company called Tuxera has made the necessary modifications to MacFUSE, and has published the source code as an un-official beta they call 2.1.9. As of write now, the best source of information for this build can be found at this MacFUSE Google Groups thread:
Unofficial MacFUSE 2.1.7 release for Mac OS X 10.6 (32/64-bit)
If you trust me and would just like a working version of MacFUSE to install, you can download an image I compiled myself: macfuse-core-10.5-2.1.9.zip.
You can download the original source code directly from Tuxera or from my local mirror.
You will obviously need XCode installed to compile MacFUSE. Once you have downloaded the source, open a terminal and run the following commands:
Downloads $ cd macfuse-rebel-2.1.9
macfuse-rebel-2.1.9 $ cd core/
core $ ./macfuse_buildtool.sh -t smalldist
It generates a directory in the /tmp directory called “macfuse-core-10.5-2.1.9”. Inside this directory is a .pkg file called “MacFUSE Core.pkg”. Just double click this file to install, and MacFUSE will be installed. Then, once installed, you can install TrueCrypt or whatever Fuse implementation you need, and it should work fine.
I make no claims about how stable this code is, and I have no idea about anything in the MacFUSE internals, so please report any problems you have with this version of the code to the MacFUSE Google Group.
]]>If you would like to be able to use MacFUSE on 64-bit Snow Leopard, you may have noticed a lot of mis-information on the net. In short, all of the latest official MacFUSE releases, including both 2.0.3 and the 2.1.7 beta are not compatible with 64-bit Snow Leopard. My understanding is that these releases will work with 64-bit Leopard, or with 32 bit Snow Leopard, but I cannot confirm this.
This article describes the current situation, and provides usable binary and source packages to download.
]]>Anyway, here is the situation:
You’ve got the “Not enough space for Music DB, please free 30 mb“ message on your Sansa Clip.
You have a Mac
Read on for the fix.
Here is the fix:
Open Disk Utility
Click on the Sansa Clip listing on the left
When this is complete, you can eject the disk if needed, and your clip should be back to normal.
I found that by default the formatting process doesn’t use the ‘Master Boot Record’ partition table system, so even though I had formatted the disk repeatedly, it wasn’t working correctly till I manually specified to use an MBR.
]]>Anyway, here is the situation:
You’ve got the “Not enough space for Music DB, please free 30 mb“ message on your Sansa Clip.
You have a Mac
Read on for the fix.
]]>This requires a bit of hacking, but its not too terrible.
Start by opening your ‘Terminal’ program. You can find it in /Applications/Utilities/Terminal
At the command prompt, type this (all on one line):
sudo nano /Library/LaunchDaemons/com.crashplan.engine.plist
Find these two lines:
<string>-Dapp=CrashPlanService</string>
<string>-Xmn10m</string>
And insert a line so that it now looks like this:
<string>-Dapp=CrashPlanService</string>
<string>-d32</string>
<string>-Xmn10m</string>
Optional: A little further down the file, you will see this line:
<string>-Xmx512m</string>
You can change that line to be:
<string>-Xmx150m</string>
This will restrict CrashPlan to AT MOST 150 mb of ram. According to CrashPlan tech support this is perfectly safe (and you could go even lower if aren’t backing up 120gb like I am), but you might need to monitor CrashPlan for out-of-memory errors and such. If you see errors, just change that 150 back to a 512, and everything should be fine.
Now save the file and exit by pressing “Control-O”, Enter, then “Control-X”.
You are almost done.
The last step is to reload and relaunch CrashPlan with these commands:
sudo launchctl unload /Library/LaunchDaemons/com.crashplan.engine.plist
sudo launchctl load /Library/LaunchDaemons/com.crashplan.engine.plist
Now CrashPlan should be using much less memory.
Update: I neglected to point out HOW to check how much memory Crashplan is using. You can use Activity Monitor to do this, you can find it at /Applications/Utilities/Activity Monitor. Look for a process called ‘java’, started by ‘root’. There might be more than one ‘java’, so you might have to do some digging to figure out which one is Crashplan. I can’t find a specific way in Activity Monitor to check this, but one hint is to close any applications you have running and see if other ‘java’ instances go away. In my case, I normally just have the ‘Crashplan’ java running.
]]>This requires a bit of hacking, but its not too terrible.
]]>