ControlPlane is a fork of MarcoPolo project that I’m officially releasing today. You can learn more about ControlPlane at http://controlplane.dustinrue.com/
Category Archives: Computing
Announcing ControlPlane, context sensitive computing for OS X
OS X Lion and netatalk
I recently upgraded to Mac OS X Lion (10.7) and found that I couldn’t connect to my netatalk server anymore. Thanks to this blog post I was able to get Lion connected to my Linux based AFP server.
Today, March 31, 2011 is World Backup Day
http://www.worldbackupday.net/
As good a day as any to start backing up your data or check that your backups are working.
Alarmingly out of touch
“Today you can see tablets and pads and other things that are starting to live in the space in between (a PC and a smartphone),” Mundie said. “Personally, I don’t know whether that space will be a persistent one or not.”
Sorry Mr. Mundie, but I think you have your head in the sand on this one and I suppose I can understand why. The tablet isn’t situated between the PC and the smartphone, it is replacing the PC. This surely scares the hell of you.
“Last year, Jobs compared the PC market to the U.S. automobile industry, noting that most vehicles in America at first were trucks, because they were driven by farmers. But as cars became more popular with the growth of cities, and features like power steering and automatic transmission were added, the truck came to represent a smaller number of vehicles on the road. “PCs are going to be like trucks,” he said.
Microsoft Chief Executive Steve Ballmer later fired back with a different spin on Jobs’ analogy: “There may be a reason they call them Mack Trucks,” Ballmer said, referring to Apple’s Mac line of computers. “But Windows machines are not going to be trucks.”"
Apparently Ballmer took offense to Jobs stating that “PCs are going to be like trucks” and completely miss that what Jobs meant was that PCs would become much more of a utility device. A lot of people buy trucks because they have a heavy job to do.
Of course, Ballmer’s response is to attempt to put Windows everywhere even if it means allowing the market to pass them by.
On Apple replacing samba with their own
A lot of people think Apple is replacing samba with their own version because of the GPLv3 and patents. I’m not so sure that is the case and I think this comment is more on the mark
The reason is that binaries in /System are signed with Apple’s keys, which the haven’t made public. As far as I know this is also disallowed by GPLv3.
Of course it might also be that Apple isn’t satisfied with the progress of samba.
Using Puppet to manage your infrastructure
Great post on how to use puppet to manage your infrastructure. This is something I need to get back to looking at and implementing.
Did Steve Jobs bend the truth? Yes and no, but mostly no
Seth Weintraub writing for CNNMoney.com wonders if Steve Jobs distorted the truth during his iPad 2 announcement. He starts by trying to examine Job’s “First dual core tablet to ship in volume” comment.
“First dual core tablet to ship in volume.” That’s funny, I tested a Dell (DELL) Streak 7, which had a dual core Nvidia Tegra 2 chip in January. They’ve been shipping ever since on T-Mobile.
In volume.
Of course, the Motorola (MMI) XOOM also has this same dual core processor and is certainly shipping in volume as well. In fact, I’ve been using an Android phone (the Atrix) with a dual core chip for weeks and it wasn’t the first to ship in volume. As for Apple (AAPL), they haven’t shipped one iPad 2 yet — iPad 2′s hit shelves on March 11.
Seth isn’t the only one to latch onto this quote and try to debunk it but what a lot of people are failing to realize is that, while others may be shipping dual-core tablets, it’s very safe for Steve Jobs to say that Apple will ship and sell a higher volume of iPad 2′s than any other dual-core tablet available today simply based on sales of the first iPad. Indeed, if previous iPad sales are any indication at all, iPad 2 is going to be a huge hit. What other tablet device can claim that today?
And to say that Apple hasn’t shipped any iPads is completely naive. Apple has a stock pile of second generation either en-route to stores or in stores already. This is very common for any product.
Seth also tries to pick apart Jobs’ “>90% market share” bullet point.
Apple would have needed to sell 3.2 million more to reach 90% of 2010′s tablet market share against just Samsung alone (in triple the time). That’s not including all of the Android-powered Nooks out there, those cheap $100 Androids you can buy at Walgreens or Amazon and even Windows-powered Tablet PCs (which are mentioned two bullet points above!). If you choose to include the Kindle, Apple may not have even reached 50% of the market.
While he might have a point about the actual market share number his supporting arguments are just ridiculous. First, the sales of “cheap $100 Androids” don’t even register, to the point where nobody is actually tracking them. Second, there is no such thing as a Windows powered Tablet PC when you consider how tablets have come to be defined because of the iPad. Nobody is selling a Windows powered tablet. And last, attempting to bring in Kindle sales simply doesn’t make sense as the Kindle is a reading device, not a general purpose tablet device. Talk about skewing data in your favor. “Pot, meet kettle.”
Seth goes on to point out hardware specs and pricing.
Perhaps Jobs could have also compared the iPad 2 to other Android tablets’ prices? Samsung’s Galaxy Tab and Dell’s Streak both now start at $499 and have better cameras, 3G radios and GPS, which seem to compete well with Apple’s $499 Wifi-only offering. Reality distorted.
Know why the Tab and the Streak both now start at $499? Because they’re not selling.
But hey the XOOM has better specs right?
But then consider that the XOOM has a much better, bigger 720P+ screen compared to the iPad’s 1024×768 job (it has less Retina™).
Where Seth wants to pick on Jobs’ use of the word “volume” saying it is subjective, so to is saying the XOOM’s screen is “much better.” The iPad’s screen is an IPS panel giving it a much wider viewing angle where as the XOOM does not. While it is true that the XOOM has a 720p display Seth, like so many other reviewers and Apple nay-sayers, fails to realize is that the iPad’s 4:3 format display makes much more sense than a 16:9 display format. By giving a tablet a 16:9 display format you’ve essentially limited the device to a horizontal layout. The iPads 4:3 format allows developers to create apps that favor either layout and still get good use from it. Remember, the iPad is a general purpose device, not just some common movie player.
The only thing Seth got right in his troll piece is that Jobs misquoted Samsung’s CEO.
When mdadm says “device busy” for no apparent reason
I just spent that last couple of hours trying to figure out why I couldn’t create a new software RAID set on my Ubuntu 10.04 system. Long story short, it turned out to be device mapper grabbing hold of the drives at boot. No amount of lsof would show that the devices were busy. The key was running dmsetup table and seeing that the drives in question were indeed “locked” by the device mapper.
This thread was the key I needed to get it all figured out – http://www.mail-archive.com/linux-raid@vger.kernel.org/msg10661.html
After issuing dmsetup remove followed by the device name shown in dmsetup table I was off and running.
Multicore Solr on Ubuntu 10.04
UPDATE: New post on getting Multicore Solr 3.4 running on Ubuntu 10.04
Been working a lot lately with the Apache Solr project.
Solr is the popular, blazing fast open source enterprise search platform from the Apache Lucene project. Its major features include powerful full-text search, hit highlighting, faceted search, dynamic clustering, database integration, and rich document (e.g., Word, PDF) handling. Solr is highly scalable, providing distributed search and index replication, and it powers the search and navigation features of many of the world’s largest internet sites.
Solr is written in Java and runs as a standalone full-text search server within a servlet container such as Tomcat. Solr uses the Lucene Java search library at its core for full-text indexing and search, and has REST-like HTTP/XML and JSON APIs that make it easy to use from virtually any programming language. Solr’s powerful external configuration allows it to be tailored to almost any type of application without Java coding, and it has an extensive plugin architecture when more advanced customization is required.
One of the features of Solr is called multicore. Multicore in the context of Solr simply means running multiple instances of Solr using the same servlet container allowing for separate configurations and indexes per core while still allowing administration through one interface. The Solr wiki defines it as:
Multiple cores let you have a single Solr instance with separate configurations and indexes, with their own config and schema for very different applications, but still have the convenience of unified administration. Individual indexes are still fairly isolated, but you can manage them as a single application, create new indexes on the fly by spinning up new SolrCores, and even make one SolrCore replace another SolrCore without ever restarting your Servlet Container.
Although I’ve setup a few instances of Solr using tomcat, I thought I’d write out just how easy it is to get Solr up and running using Ubuntu Server 10.04 as well as talk about some of the scripts I’ve written to make the process of adding, removing and reloading cores easier. This post assumes you have already installed Ubuntu server with internet access as well having a basic understanding of how to use Ubuntu and Linux in general.
Installing Solr
On your Ubuntu server, become root using ‘sudo su -’ and issue the following command:
apt-get install solr-tomcat curl -y
This will install Solr from Ubuntu’s repositories as well as install and configure Tomcat. At this point, you have a fully working Solr installation that only needs to be tweaked for your environment. Solr itself lives in three spots, /usr/share/solr, /var/lib/solr/ and /etc/solr. These directories contain the solr home director, data directory and configuration data respectively.
Enable Multicore
Enabling multicore is as simple as creating solr.xml in the /usr/share/solr directory and restarting Tomcat. Once you’ve done this, you only need to restart under certain conditions. Under normal operations, you should never need to restart Tomcat.
Using your favorite text editor create a file called solr.xml at /usr/share/solr with the following contents:
<solr persistent="true" sharedLib="lib"> <cores adminPath="/admin/cores"> </cores> </solr>
Next, you need to ensure that Tomcat is able to write out new versions of the solr.xml file. As cores are added or removed, this file is updated. The following commands ensure Tomcat has write permissions to needed directory and file
chown tomcat6.tomcat6 /usr/share/solr/solr.xml chown tomcat6.tomcat6 /usr/share/solr
That’s it. You can now issue the following command to restart Tomcat and in turn Solr:
service tomcat6 restart
Managing Cores
At this point you’re ready to start creating new cores. Before you can do so however you need create config files, directories and set permissions. In order to make this process a bit easier I created a set of scripts that do all of this for you based on a template config directory.
Create the template config directory by issuing the following command:
cp -av /etc/solr/conf /etc/solr/conftemplate
Next, edit /etc/solr/conftemplate/solrconfig.xml and find the dataDir option. Change the dataDir line from:
<dataDir>/var/lib/solr/data</dataDir>
To:
<dataDir>/var/lib/solr/data/CORENAME</dataDir>
This will ensure the scripts work correctly.
Creating a new Core
Below is the newCore script. Copy and paste it into a file and call it newCore
#!/bin/bash # creates a new Solr core if [ "$1" = "" ]; then echo -n "Name of core to create: " read name else name=$1 fi mkdir /var/lib/solr/data/$name chown tomcat6.tomcat6 /var/lib/solr/data/$name mkdir -p /etc/solr/conf/$name/conf cp -a /etc/solr/conftemplate/* /etc/solr/conf/$name/conf/ sed -i "s/CORENAME/$name/" /etc/solr/conf/$name/conf/solrconfig.xml curl "http://localhost:8080/solr/admin/cores?action=CREATE&name=$name&instanceDir=/etc/solr/conf/$name"
You can now create a new core by issuing the following command
./newCore core0
On screen you should get something similar to this if it was successful:
<?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"><int name="status">0</int><int name="QTime">352</int></lst><str name="core">core0</str><str name="saved">/usr/share/solr/solr.xml</str> </response>
If you get any other response, particularly one about permissions, go back and review this post as you’ve most likely missed something.
This script has created a new Solr core with the configuration directory set to /etc/solr/conf/core0/conf. There you can edit the schema.xml file. To view the default schema.xml file, you can visit http://localhost:8080/solr/core0/admin/. Replace localhost with the hostname or IP address of your Solr server if it is not localhost.
Next time I’ll talk about how to import documents into a core as well as how to reload a core, swap cores or remove/unload a core and merge the index between two or more cores.
Update: Here are the rest of the scripts I’ve written for Solr
Reload a Core
Save to a file called reloadCore
#!/bin/bash # reloads a Solr core if [ "$1" = "" ]; then echo -n "Name of core to reload: " read name else name=$1 fi if [ ! -d /var/lib/solr/data/$name ] || [ $name = "" ]; then echo "Core doesn't exist" exit fi curl "http://localhost:8080/solr/admin/cores?action=RELOAD&core=$name"
Swap Cores
Save to a file called swapCores
#!/bin/bash # swaps two Solr cores if [ "$2" = "" ]; then echo -n "Name of first core: " read name1 echo -n "Name of second core: " read name2 else name1=$1 name2=$2 fi if [ ! -d /var/lib/solr/data/$name ] || [ $name2 = "" ]; then echo "Core doesn't exist" exit fi curl "http://localhost:8080/solr/admin/cores?action=SWAP&core=$name1&other=$name2"
Unload/Delete a Core
Save to a file called unloadCore
#!/bin/bash clear echo "*************************************************************************" echo "*************************************************************************" echo echo " You are about to *permanently* delete a core!" echo " There is no going back" echo echo "*************************************************************************" echo "*************************************************************************" echo echo -n "Type 'delete core' to continue or control-c to bail: " read answer if [ "$answer" != "delete core" ]; then exit fi # removes a Solr core if [ "$1" = "" ]; then echo -n "Name of core to remove: " read name else name=$1 fi if [ ! -d /var/lib/solr/data/$name ] || [ $name = "" ]; then echo "Core doesn't exist" exit fi curl "http://localhost:8080/solr/admin/cores?action=UNLOAD&core=$name" sleep 5 rm -rf /var/lib/solr/data/$name rm -rf /etc/solr/conf/$name
Merge Cores
Save to a file called mergeCores
#!/bin/bash # merges two Solr cores if [ "$2" = "" ]; then echo -n "Name of first core: " read name1 echo -n "Name of second core: " read name2 else name1=$1 name2=$2 fi if [ ! -d /var/lib/solr/data/$name ] || [ $name2 = "" ]; then echo "Core doesn't exist" exit fi curl "http://localhost:8080/solr/$name1/update" --data-binary '' -H 'Content-type:text/xml; charset=utf-8' curl "http://localhost:8080/solr/$name2/update" --data-binary '' -H 'Content-type:text/xml; charset=utf-8' curl "http://localhost:8080/solr/admin/cores?action=mergeindexes&core=$name1&indexDir=/var/lib/solr/data/$name2/index" curl "http://localhost:8080/solr/$name1/update" --data-binary '' -H 'Content-type:text/xml; charset=utf-8' curl "http://localhost:8080/solr/$name2/update" --data-binary '' -H 'Content-type:text/xml; charset=utf-8'