Screen Shot 2013-02-25 at 9.16.20 AMI volunteer and provide technical support for a few non-profits, one of which is the Project Management Institute San Francisco Bay Area Chapter (http://www.pmi-sfbac.org) where I serve as the VP of Operations and CGO.

One of the moves I made in my first year with them was to migrate our event calendar to Eventbrite and Meetup. One of the gaps I found with Eventbrite is that it doesn’t have a way to provide a feed of events that can be used to update an external calendar, so I embarked on a little programming effort to create one.

Most calendar programs allow you to pull external events using the iCalendar (ics) format, and Eventbrite actually has a pretty decent API to allow you to pull the events, so I decided to write a simple PHP script to allow me generate an iCalendar feed.

Screen Shot 2013-02-25 at 8.47.53 AMThis started as a simple one-off for PMI-SFBAC, but has turned into an open source project at https://code.google.com/p/eventbrite-ics/

Looking at the code, you can see it’s pretty basic, just a few PHP classes, some unit tests, Netbeans project and data.

Once the code was working, I used the iCalendar validator at http://severinghaus.org/projects/icv/ to make sure the results are good, and (at least for PMI-SFBAC) they are.

Eventually this results in a URL that I used as a feed into the All-in-One Calendar from Time.ly which lets me show events on my site’s calendar along with any other iCalendar feeds I choose to add.

Screen Shot 2013-02-25 at 8.59.20 AMTo configure the All-in-One calendar, I just go to the Events in the WordPress admin panel, and add the feed.

After I add the feed I click the “Refresh” button to make sure the events show up on my calendar immediately. The events then get updated on a periodic basis (daily by default), and should keep you up to date.

Screen Shot 2013-02-25 at 9.06.58 AMAnother use I put this feed to is to add the Eventbrite calendar to my Google Calendar.  I have a calendar feed from Meetup, and several of my friends so that I can quickly see what is going on that day.

The same basic idea for Google Calendar: you go to your Google Calendar, click the drop down on “Other Calendars” and choose “Add by URL”.

This gives you a nice view of events so that when you are scheduling things you can see what’s coming up that you might be interested in.

For those of you poor souls still using Outlook, the same feed can be used there as well see: http://office.microsoft.com/en-us/outlook-help/view-and-subscribe-to-internet-calendars-HA010167325.aspx

 

 

Enhanced by Zemanta

I got an email from my friend Athens who had just relaunched her web site at http://www.athenskconsulting.com/ but was now having problems with email.

The first thing I did was to run over to the MX Toolbox site to see what was going on with her servers. A quick look and saw that her mail servers were pointing to mail.athenskconsulting.com, which resolved back to her WordPress blog.

Before she pointed everything to her WordPress site, everything had been working. Unfortunately, the directions at http://en.support.wordpress.com/domains/map-existing-domain/ had given her some unfortunate information, that really weren’t accurate for what she was trying to do.

Her DNS and email were previously hosted at GoDaddy (along with her old web site), and all she was really trying to do was to get her company URL to point at the blog site that she’d set up on WordPress. The instructions I mentioned before give a way to accomplish that, by repointing the domain DNS servers to be the ones that WordPress provides.

The unfortunate thing about that approach is that in order for this transition to happen smoothly, you have to transfer all of your DNS records into the WordPress settings so that things like your mail server will continue to work (following the instructions at http://en.support.wordpress.com/domains/custom-dns/

Now this might be OK if you are a geek and know what MX and CName records should look like, but typing in a DNS file in the format that WordPress expects it is much more difficult than using the GoDaddy DNS control panel (which helps prevent you from making mistakes).

I got on the phone with her, and the first thing I had her do was to switch her DNS servers back to GoDaddy. This is done by going to the Domain Manager page in GoDaddy and looking for the section that says “Name Servers”.

Screen Shot 2013-01-30 at 4.10.04 PM
Clicking on the link that says “Set Nameservers” brings up a dialog that allows you to set the DNS (which had been set to the WordPress servers per the instructions mentioned previously):

Screen Shot 2013-01-30 at 4.10.23 PM

This of course fixed the mail problem (along with other URL’s), but broke her web site again (which I expected it would).

We then clicked the “Launch” link on the same Domain Manager page by looking for the section that says “DNS Manager”:

Screen Shot 2013-01-30 at 4.05.29 PM

This brings up the actual DNS zone editor that I talked about previously. Now the first thing you should do is to back up the zone records by using the import/export button on the DNS manager:

Screen Shot 2013-01-30 at 4.17.11 PM

This gives you the basic information that you might have needed if were you going to follow the instructions on the WordPress site. It creates a text version of the information of the DNS Zone records in a standard format.

But unless you really need to move off GoDaddy for some reason, you don’t want to do that. Instead, you just need to set up a wildcard CNAME record for the WordPress blog, and make sure to remove any old A records that might be pointing to the wrong place.

So for Athens, we needed to delete all of her “A” records (since she no longer has a physical server), and add a CName that looked like:

wildcard

And once DNS propogated, she was up and running again at http://www.athenskconsulting.com/

A quick trip back to the MX Toolbox site to check and her mail servers are now pointing back to GoDaddy again:

Screen Shot 2013-01-30 at 4.46.18 PM

Clicking the link that says “ns lookup” shows that the domain is now using the GoDaddy DNS servers again:

Screen Shot 2013-01-30 at 4.46.26 PM

The one other thing I do to make sure things are working is a DNS propogation check (http://www.whatsmydns.net/), which shows which servers will resolve the host and which don’t.
Screen Shot 2013-01-30 at 4.55.21 PM

All the little green checkmarks mean everything is happy all around the world, and now everybody is resolving her site properly.

So in summary: if somebody tells you to change your DNS servers, think first and see if an alias will work better …

Enhanced by Zemanta
Related Articles
dnsguide

I am a big fan of Test Driven Development (TDD) and tools like Hudson/Jenkins to automate the process of having a continuous integration build system are key.

On my current project we recently started moving things to Amazon EC2, and rather than put everything on one big server, I thought I’d follow the best practices in cloud computing and make a number of small special purpose servers to take care of the project’s needs.

We’ve had a Jenkins server running for a bit, so rather than reinventing the wheel, I figured I could copy my Jenkins configuration to a new server and get things up and running.

I fired up a new Tomcat server on Amazon Elastic Beanstalk, and loaded up the Jenkins WAR file, which quickly got me to a working Jenkins server. This project is written in PHP, so I had to install PHP after that, which meant logging in to the server and running through the whole PHP and PHPUnit setup.

Once that was done, I scp’d the Jenkins folders from the old server, edited the Tomcat startup files to include the environment variable to point Jenkins to the right place, changed a few permissions, and everything appeared to be working.

I could log in, I fired up the build, and it appeared to be running – very cool.

But that was when the flaw in the design of the PHP unit tests was exposed ….

I was watching the output of the phpunit tests, and noticed two things:

  1. The tests seemed to be taking a really long time
  2. Every test was failing

Watching the console, each time a test would fail, the little “E” would print, then a few seconds would go by and another “E” would appear. Finally after many minutes (because we have a LOT of classes to test) the error output appeared, and looked something like this for EVERY test:

And of course there were 5297 of these … I did some Google searches for the PHP_Invoker_TimeoutException which mostly pointed to issues with upgrade from one version of PHPUnit to another, but the versions on the old server and this one were the same.

So my next step was debugging an individual tests. Running the test from the command line gave me the same error, odd. But then I ran the test using php instead of the phpunit call, and found the problem: I was getting a timeout trying to open a database connection.

The issue as it turns out, is a design flaw in our code that hadn’t showed up before: all the classes invoke a database connection class that sets up the connection to the database as soon as they are loaded.

Since the Elastic Beanstalk server was in a different security group than was allowed to connect to the RDS database, it was unable to connect at all, and PHPUnit would simply timeout before the connection failed (by default phpunit sets 1 second as the acceptable for a test to run in order to catch endless loops).

Now in theory our tests shouldn’t be hitting the database (at least not for these unit tests since we don’t want them updating anything on the backend), so this problem turned out to be very fortuitous. Because the Jenkins server couldn’t reach the database, it exposed a flaw in our unit tests: we weren’t mocking all the things we needed to, so the tests were actually opening connections to the database.

With some refactoring of the test classes to mock the database access layer, the tests all succeeded. Next we’ll need to do the actual DBUnit tests for the database, and Selenium or HTTPUnit tests for all the front-end and AJAX stuff.

I needed to convert an existing Netbeans build to use Maven in order to stabilize the code and support Test Driven Development.

Generally this was a fairly simple process: just move all the source files and resources to the right folders in a new Maven project, and add the dependencies.

Everything was going swimmingly until I ran my first tests and got this really lovely set of errors that didn’t really tell me what was going on:

Now at this point I normally just do a few Google searches and find out how somebody else has solved this problem, but I really wasn’t having any luck at all finding an answer.

I did run across a couple of posts that mentioned seeing this error when using multiple persistence units in the persistence.xml.

Now my project does have a persistence unit for testing outside GlassFish (my chosen EJB container), so my first thought was to move that PU to the “right” place for my tests. So I copied the persistence.xml from src/main/resources/META-INF to the src/test/resources/META-INF and changed them so there was only one PU in each.

Well, that seemed to work for a minute, no more exception on the compile step. But now I had a new problem: I was getting an error that the PU couldn’t be found:

Tests in error:
testinsertTrackingCustomerUnFixed(com.omnistools.service.util.CompanyCustomerTrackingTest): No Persistence provider for EntityManager named ProjectTest-ejbPU
testinsertTrackingWithoutCustomerUnFixed(com.omnistools.service.util.CompanyCustomerTrackingTest): No Persistence provider for EntityManager named ProjectTest-ejbPU
testinsertTrackingCustomerFixed(com.omnistools.service.util.CompanyCustomerTrackingTest): No Persistence provider for EntityManager named ProjectTest-ejbPU
testinsertTrackingWithoutCustomerFixed(com.omnistools.service.util.CompanyCustomerTrackingTest): No Persistence provider for EntityManager named ProjectTest-ejbPU

So doing a bit of digging, it appears that the persistence.xml only gets copied once and only from the src/main/resources/META-INF folder.

I must have tried a thousand different permutations and combinations until I realized that I could have an ugly workaround that is not ideal.

The issue is that if both have the “exclude-unlisted-classes” set to true, the javac compiler tries to recreate the annotation classes during the compiler:compile and of course fails on the second PU because the classes have already been created.

So to get this to work, I set the “exclude-unlisted-classes” to false for one of the PU’s, which gets me the generated meta classes, and the tests fail (because the PU doesn’t include the required entities).

I then flip the flag back to true, and run the build again. Since the classes have already been compiled, the compile:compile doesn’t run, and the tests can succeed.

And then finally, I run across a bug report on the NetBeans site: http://netbeans.org/bugzilla/show_bug.cgi?id=183779. Now this bug talked about setting some compiler flags (in particular -proc:none which tells the compiler not to generate meta classes).

Workaround was proc:none to the javac compiler args as described here: http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html

Now my Maven build works like a charm. Both persistence units are defined in my persistence.xml, and both have the “exclude-unlisted-classes” set to false, and not only do my tests work, but the deployment is now successful as well.

After getting my new Mac Mini pretty well set up with my development tools, I started playing with Amazon AWS. When trying to connect to one of my instances using their built in tool, Firefox bailed and I was presented with a prompt asking me if I wanted to install Java:

To open “Firefox,” you need a Java SE 6 runtime. Would you like to install one now?

Now this message looked very official, and I’d seen it before when starting up something on a new Mac that required Java, but since I’d already installed the latest JDK I was thoroughly confused. I thought, “OK, maybe you didn’t install Java after all”

So I popped open a terminal and

mini:~ robweaver$ java -version
java version “1.7.0_09″
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode.

OK, so that’s not it – so I changed browsers and tried the browser check at http://javatester.org again, only to get the same results …

Ouch – so I dug around a bit, and couldn’t find anything about how to fix it. And in fact the little bit I did find only confirmed that the browser plugin was active and the right version.

So finally I decided to punt and just let it install – Clicking the button to to let it start ran a package that looked like it was installing something, and when it was done another trip to javatester.org showed that somehow the plugin had been fixed and was now giving me the right version of Java in all my browsers.

Java Version tester

The only thing I can guess is that there was something that had to be set up on first use, but it did give me a start when being asked to install Java SE 6. Fortunately, whatever it did, it didn’t muck with my JVM and I’ll just have to hope that it didn’t break anything elsewhere.

 

I’m doing some work on a project that is using PHP, and have been working on setting up some continuous integration build scripts to make sure that we have a shot at catching errors before they make their way to production.

Recently some unit tests were added for the “forgot password” code, which uses the mcryp

t libraries which are not installed by default on Mac OSX, so I was seeing this error:


So some quick Google searches, and I found a couple of blogs with “how to” install the library (links at the end of this post), and proceeded to get this done.

First step was to download the mcrypt from SourceForge at http://sourceforge.net/project/showfiles.php?group_id=87941

Once I had the file, I opened a command prompt and ran:

Next I ran configure, setting the appropriate flags for my envirionment (note – I didn’t do this for the other configures, probably would have been a good idea):

This sets up the make file, so you can run the next two commands:

Next to make the PHP library, I needed the PHP source files, so I went out and grabbed PHP 5.3.15 (since that’s the version I have when I run php -version) by going to http://us3.php.net/get/php-5.3.15.tar.bz2/from/a/mirror. Note that you can simply change the version number in that URL to get the version you need.

Once I had that I did the following:

This of course gave me an error about autoconf not being installed:

From there I installed autoconf by doing the following:

Then back to the php mcrypt folder and reran the phpize step to and finish building:

Finally an edit to the php.ini file which was simply to add the extension:

And of course a quick restart of Apache and the extension shows up and I can run my unit tests successfully.

Related posts:

http://www.coolestguyplanettech.com/how-to-install-mcrypt-for-php-on-mac-osx-lion-10-7-development-server/

http://michaelgracie.com/2011/07/21/plugging-mcrypt-into-php-on-mac-os-x-lion-10-7/

Enhanced by Zemanta

Just a quick note – I was guided toward doxygen, which is a tool that does source code documentation. It has a DMG installer, that includes an executable to run doxygen with a wizard.

But since my purpose was to run doxygen in an Ant build script, I needed to install the command line version.

I simply looked inside the application, and was able to see that the executable was in /Applications/Doxygen.app/Contents/Resources/

Adding a symbolic link to /usr/local/bin (which is in my PATH) did the trick:

Enhanced by Zemanta

I love Firebug, and I’m getting so I understand jQuery pretty well.

I often drop into the console and type in jQuery commands to figure out how to get things to happen on a page. For example, I was looking at a really long page of search results from Taleo that lists out all of my submissions for jobs at CACI. The problem is, that it shows the fully active submissions with the inactive ones, so it’s not very useful for figuring out what I need to follow up on.

 

So it occurred to me that if I could just write a couple lines of jQuery to look for the items that include “Active” in them, I could reduce this list in a way that would be meaningful for me.

So the first thing I did was go look at the page HTML to figure out whether there was something on the page I could use to separate out each row on the search page.

 

 

 

I fired up Firebug by right clicking on one of the items and choosing “Inspect in Firebug”.

 

 

 

 

 

 

 

 

 

 

This starts up Firebug (if it isn’t already showing) and took me to the part of the HTML that I was looking for:

 

 

 

 

 

 

So now I knew I needed to look for something that had a class of “iconcontentpanel” that contained the text “Active”.  I decided to outline it with a green dashed line, so my jQuery looked like:

So I flipped over to the Console in Firebug and tried running that:

 

 

 

 

 

But that gave me an error since there is no jQuery on the original page. But there’s this nifty little thing in the console that says “jQuerify”, and clicking that injects jQuery into the page:

 

 

 

 

 

 

So now that jQuery is available, running the script again gives me what I was looking for:

 

 

 

 

 

 

 

And of course I can add even more jQuery to strip out unwanted parts of the page, change format, etc, leaving me something that is more  actionable:

Enhanced by Zemanta

For ease of use, it helps to be able to treat a SharePoint document library as a file folder on your laptop, and from a team productivity perspective, it’s very valuable to have these documents stored there instead of on your local hard disk:

  1. SharePoint provides versioning and check-in/check-out capability
  2. It’s accessible from other locations than your machine
  3. Your fellow team members can see your work in progress if they need to.
  4. SharePoint is backed up, so you won’t lose anything if your PC gets run over or dies.

To start this process, the simplest thing to do is to browse to the document library (in this case the BLASS shared documents);

Because this is a SharePoint 2010 site, there is an option to open the library in Windows Explorer on the “Library” tab:

Clicking on the “Open with Explorer” button will launch Explorer on your machine. You may be prompted for your user name and password before this happens, but once you’ve logged in, you’ll see the folder:

From here you can do all the normal things that you’d expect with a local drive or mapped network drive. To make this sticky so that you don’t have to go through browsing the site every time you want to do this, you can map the drive to your computer.

Step 1: Clicking into the address bar will show you the actual URL for the library (hit ctrl-C or right click and choose copy to save it to the clipboard):

Step 2: Click on your computer icon in the Navigation pane, which will add the “Map Network Drive” to the menu:

Step 3: either click the “Map network drive” or right click and choose it from the menu:

Step 4: Click the hyperlink to connect to a web drive:


Step 5: Click next to start the wizard:

Step 6: Use “choose a custom network location” and click Next:

Step 7: Enter or paste the URL from the document library you found above and click Next:

Step 8: Give it a name you’ll recognize (defaults to the server name) and click Next

Step 9: You will be prompted with the following screen that means your web folder has been mapped:

From then on, you should be able to find it in the navigation pane of Explorer:
.