Monday, June 01, 2020

Sympathy

Our book group is reading the "The Plague" by Albert Camus, and I found myself looking at past reviews of the book. In 1948, Stephen Spender wrote "Its sympathy saves this novel from being mere noble pamphleteering and raises it to the level of art."

In the face of today's many crises, I would urge that sympathy on us all. As in the quarantined plague city of Oran we are are trapped here in this world, in this life, for the moment at least. We can despair, we can lash out, or we can set to work to make things better.

Watching the news last night was heartbreaking. I can only begin to imagine the pain and rage African-Americans feel at the loss of yet one more. Likewise I can only begin to imagine the fear that the Boston police felt as thing were thrown at them and crowds lined up against them.

Whatever sides you feel tempted to take in the coming days, I can only urge you to spare a moment to imagine the plight of the other and hold up their humanity. We still have to set to work and make the world a better place. But as much as possible we should be fighting the plague, and not each other.

Saturday, May 30, 2020

What was given to me...

I don't like to crow about having gone to MIT. I am the beneficiary of so much that was given to me, and I firmly believe that people should be valued by the heart and mind they bring to the table today, not the paper on their wall from yesterday.

But I have been attending alumni days and I am so proud of what I see. The MIT motto is 'mens et manus', (Latin for 'mind and hand') and I am so moved by the ways the MIT community is working to translate thinking and the scientific method to physical action in the world to make lives better.

On the one hand, I have never felt more of that community -- because that is what I truly believe. On other, time to roll up my sleeves...

Sunday, May 11, 2008

Eclipse Tutorial Video: Starting a PHP Project from Subversion

This video will show you how to use a subversion repository to create a PHP project in Eclipse. I'll be using the subversive plugin, but the process is essentially the same if you are using subclipse.



Before you complete the steps in the lesson on your own, you will need to install the eclipse plugins for PHP Development and a Subversion Team Provider, either Subversive or Subclipse.

The first step is to define the repository. We'll configure eclipse for the groux project at https://groux.svn.sourceforge.net/svnroot/groux. We'll switch our perspective to "SVN Repository Exploring" so we'll have the necessary panels open to start. We could also show the required views from another perspective with "Window -> Show View."

To start, we define the repository by selecting the icon with the green plus sign in the top right of the "SVN Repositories" panel. In the resulting dialog, enter the repository URL. If we had write access to the repository, we'd probably need to provide our user name and password as well, but for this demonstration we'll skip that.

When you click finish, Eclipse will validate your connection. In this case, anonymous access is OK. The first time I set this up, I needed to accept the sourceforge SSL certificate, but since I elected to trust it always, we don't see that dialog this time. You'll want "trust always" or you'll be continually interrupted by questions about the certificate.

Once we have defined the repository, we have the option to browse through it to understand its layout. To create the project, we'll switch to the "Resource" perspective. You can do this from "Open Perspective" in the "Window" menu, but we'll just take the little shortcut in the top right of the Eclipse window.

In the "Project Explorer" panel, get a context menu (right-click or control-click) and select "New -> other..." Pick "Projects from SVN from the "SVN" folder. Use the repository we just configured, and select the resource you are interested in--in this case groux. Click "Finish" to end the repository selection and begin defining the project.

We'll use the "New Project Wizard" to create the project. Under the "PHP" folder, select "PHP Project," click "Next," enter a project name, and "Finish". Eclipse will offer to take you into a PHP perspective and start building the workspace. In another lesson, we'll take a look at some of the things that are available to you in the PHP project.

And that's all there is to it.

Saturday, May 10, 2008

Using Redmine with the Mylyn Eclipse Plugin

This video will show you how to use the Mylyn plugin to connect your Eclipse IDE to a set of open issues on Redmine.



I'll assume you've already installed Mylyn in Eclipse. Start by selecting the "Window" menu and then "Show View." Click "Other..." at the bottom of the sub-menu and scroll down the dialog. Open the Mylyn folder, and select "Task Repositories."

In the new panel this creates, a context menu (right-click or control-click on most systems) will give you the option to "Add [a] Task Repository"--choose "Generic web-based access."

At this point, refer to the Redmine wiki for more details. Enter your server name in the first field--here I'll use Redmine, but your should enter your own server. Give the server a label, and provide a username and password.

Then, under "Additional Settings," open the "Advanced Configuration" dialog. The "Task URL" will be used to look up specific issues by adding the issue number. We can also define a URL to create new issues. The "Query Request URL" will return a list of open issues, and we'll use the "Query Pattern" to filter out the issue numbers and descriptions. And, of course, we need to provide a login URL, which is submitted as a POST request for Redmine.

Click "Finish" and we're done creating the repository.

Often, it's easiest to create a task query at this point, and Eclipse gives you that option. We could scroll further down on the Redmine wiki and copy the parameters that will filter the tickets down to just our own. But in this case I have no active tickets on redmine, so I won't do that.

Finish the query definition, and Mylyn will fetch a list of tasks from Redmine. To see those tasks in Eclipse, go back to "Show View" in the "Window" menu, select "other..." and choose "Task List." The task list has a nice hover state to get basic information on the tasks, and you can double-click to get more details. You can enter personal planning information, add comments and manipulate the ticket via the internal web browser, and you can establish a Mylyn context for the task. We'll cover Mylyn contexts in a separate lesson.

And that's all there is to it.

Related:
  • Redmine is a project management web application written in Ruby on Rails
  • Eclipse is an Integrated Development Environment written in Java that runs on Windows, Mac, and Unix
  • Mylyn is a plugin for Eclipse that allows developers to associate a small set of files with each of their tasks, hiding those files that are not related to the work.

Sunday, October 01, 2006

PostgerSQL Index Scan for UTF8 Text

Using Index Scan for Text in Postgresql



While implementing the backend database for the Infoplease Distance Calculator, we found that Postgresql text fields used sequential scans instead of index scans. This was maddening -- I've frequently used indexed text data in Postgresql, and functional indexes of text are not that rare either. After a bit of poking around, I did find the problem. As usual, the documentation was quite plain. But it did not turn up quickly in any of the searches I did. I kept searching for things like:

postgresql text sequential scan
postgresql text force index scan
postgresql index text


But it took a long time for me to find stuff that wasn't about making sure the like operator was specified with the wildcard at the end of the string, or creating functional indexes on lower(text). Finally, I found the relevent note on the postgresql docs. In order to do the character-by-character incremental search of the index, the collation order needs to be well defined, and it is not with UTF. In our case, the database is SQL_ASCII, but that's not enough: the DBMS was initialized with UTF-8 (initdb) using the standard Fedora postgresql init scripts.

Fortunately, there is a workaround:

CREATE INDEX loc_name ON loc (lower(name) text_pattern_ops);

instead of

CREATE INDEX loc_name ON loc (lower(name));

To illustrate:

<br />db=# CREATE INDEX loc_name ON loc (lower(name));<br />CREATE INDEX<br />db=# EXPLAIN SELECT name FROM loc WHERE lower(name) LIKE lower('Empire State Building');<br /><br />                                      QUERY PLAN                              <br />-----------------------------------------------------------------------------------------<br />Seq Scan on loc (cost=0.00..19389.57 rows=3339 width=45)<br />  Filter: (lower(name) ~~ 'empire state building'::text)<br />(2 rows)<br /><br />db=# EXPLAIN SELECT name FROM loc WHERE lower(name) = lower('Empire State Building');<br /><br />                                           QUERY PLAN                         <br />--------------------------------------------------------------------------------------------------<br />Bitmap Heap Scan on loc (cost=29.08..4540.32 rows=3339 width=45)<br />  Recheck Cond: (lower(name) = 'empire state building'::text)<br />  ->  Bitmap Index Scan on loc_name  (cost=0.00..29.08 rows=3339 width=0)<br />        Index Cond: (lower(name) = 'empire state building'::text)<br />(4 rows)<br /></pre></blockquote><br /><br /><br />So that's our problem, "LIKE" forces a sequential scan, but "=" does not. So we need to fix it with a better index.<br /><br /><br /><blockquote><pre><br />db=# CREATE INDEX loc_name_tpo ON name (lower(name) text_pattern_ops);<br />CREATE INDEX<br />geobase=# EXPLAIN SELECT name FROM loc WHERE lower(name) LIKE lower('Empire State%');<br />                                                      QUERY PLAN                                                      <br />------------------------------------------------------------------------------------------------------------------------<br />Index Scan using loc_name_tpo on loc  (cost=0.00..4.01 rows=1 width=45)<br />  Index Cond: ((lower(name) ~>=~ 'empire state'::text) AND (lower(name) ~<~ 'empire statf'::text))    Filter: (lower(name) ~~ 'empire state%'::text) (3 rows) </pre></blockquote><br /><br /><br />To save the space of a second index, you can drop the first one with no ops code, but be careful, once you drop that you must use "LIKE" and not "="<br /><br /><br /><blockquote><pre><br />db=# DROP INDEX loc_name;<br />DROP INDEX<br />db=# EXPLAIN SELECT name FROM loc WHERE lower(name) = lower('Empire State Building');<br /><br />                                      QUERY PLAN                              <br />----------------------------------------------------------------------------------------<br />Seq Scan on loc (cost=0.00..19389.57 rows=3339 width=45)<br />  Filter: (lower(name) = 'empire state building'::text)<br />(2 rows)<br />



The alternative is to reinitdb in the C locale - which would mean dumping and reloading every DBMS we run. I'm not really up for that task, so I'm sticking with this for now, unless there substantial reasons to undertake that effort. I tend to think it would be better if Fedora used the C locale to init the DBMS, but for now I'll live with what I've got.

Saturday, September 30, 2006

Infoplease Distance Calculator

Distance Calculator



Infoplease has published a new distance calulator, which includes over 7.5 million location names worldwide. And to eliminate the guesswork associated with a static entry form, the application uses AJAX-based type-as-you-go inputs.

The coolest part has got to be the size of the data set, though. In addition to cities, towns, and other populated places, you can enter mountain peaks, lakes, and so on. For U.S. locations, the level of detail gets down to things like the Boston Massacre Marker, in Boston, Massachusetts.

Along with distances, the results include latitude and longitude of both points. However, there is also a separate latitude/longitude finder that uses the same data set.

Thursday, May 18, 2006

Linux iTunes Server on Fedora Core 5

Linux iTunes Server - Fedora Core 5



There are 2 components to an iTunes server on Fedora Core 5: the iTunes server daemon and the zeroconf (or bonjour, or rendezvous) multicast.

For the iTunes server, I used mt-daapd (http://www.mt-daapd.org/). I downloaded the standard SRPM from sourceforge and made a minor edit to the configure command in the spec:

./configure --prefix=$RPM_BUILD_ROOT/usr --enable-howl --with-howl-includes=/usr
/include/avahi-compat-howl

With that change, the rpm compiled cleanly, and hooked into the FC5 zeroconf multicast system, avahi.

To configure avahi, you need to add an xml fragment to /etc/avahi/services/ - it should look something like this:





Basement Tunes

_daap._tcp
3689





(man avahi.service for more info)

The file gets placed in /etc/avahi/services/ and must have an extension of ".service"

Once you do this, and start the avahi-daemon and mt-daapd services, and "Basement Tunes" will show up on your iTunes sidebar.

Keep in mind that the mDNS multicast will not typically pass through a router, and everything should work fine.