Two years ago, I moved to Salt Lake City for work. After looking around a bit for a rental property close to my new work, it became clear that I would be better off trying to buy a new home than renting if I could afford to do so. At the time the interest rates and property values in Salt Lake City were very low, so monthly mortgage payments were often cheaper than rental prices.
Sitting at the Salt Lake Roasting Company after we first moved here, we found a really nice real estate agent (Jaral Ferwerda). I worked with him diligently to find a home while my lovely wife was buttoning up our home in California.
After a while, I started to find it very difficult to keep track of all the homes I was seeing. They started to blur together, and I wasn’t really able to figure out which one I liked best.
I was updating my network to use a different subnet and realized that the last time I did that, my HP printer stopped working because a lot of the network drivers set the IP address into the printer settings.
So I figured that maybe I would need to update the printer’s IP address on my Mac. I looked at the printer settings and didn’t see anything that might work.
First step is to log in to the cPanel, which is typically at some arbitrary port on your server, and log in with your admin credentials. If you go to the right URL, you’ll be prompted with something like:
Type in your user name and password, click the “Log In” button, and you’ll see the cPanel home screen. In my case I see something like:
So, just like any WP installation, the first thing you need is a database, so you look for the Database Wizard (in the Databases section):
This will bring up the Wizard which will ask you for a name. In this case I’m creating a test wordpress, so I type in “WP_test” just so I know which DB I’m using. This can really be anything, just has to be unique.
If you’re on a shared host (which I am) this name gets prepended with your admin account name (this is how the server knows which databases belong to you and keeps you from seeing other people’s database schemas).
Going to the next step, you’ll be asked to create the database users. Again this can be anything, but also needs to be unique to the schema you’re creating. At this point the database has been created, but there are no users. The user name also gets prefixed with the account on a shared host system:
You can give the user any name and password you want, you will need those along with the database name once you are ready to fire up WordPress. I believe it is possible to use the same user for multiple databases by skipping this step and manually adding them to the newly minted database later instead, but it’s probably not the most secure way to set up access.
In my particular setup, I want to attach this new WordPress to a specific host name, so the next thing I do is my Subdomains panel in order to create the directory and tell Apache where to send the users. The default behavior is for the directory to be a folder under public_html with the same name as the subdomain, so in my case “WPtest” causes a folder named /public_html/WPtest to be created:
In my case I prefer to keep them separate physically, so I remove the “public_html/” part and call the folder something more meaningful. Depending on your setup, you may also need to add this new host name to DNS, although for testing you don’t even need that (more on this later).
The next thing to do is to get the latest WordPress binary and upload it to the newly created folder, which you can do using the cPanel folder manager:
I next see a popup that asks me where I want the File Manager to start, so I pick my new subdomain:
In reality it displays all of your folders, just starts up opened to that particular one which might save you a click or two. At the top of the file manager, you’ll see the menu bar where you can choose “Upload”:
You’ll get the typical button to choose the file with, and a status bar that will tell you when the upload is complete:
Once it is uploaded, go back to the file manager and with the file selected, click the “Extract” icon, or right click on the file and choose that option:
You can actually choose to extract it somewhere other than where you uploaded it, which could be useful for creating multiple copies or updating WordPress into multiple folders:
Now this ends up creating a wordpress folder under the one where you really want it, so I do a bit of cleanup that involves moving the contents of that folder up one level. I use the File Manager’s drag and drop to move the files, and then delete the empty folders and zip as shown in this video:
After that, the rest of the configuration is a standard WordPress setup through the browser (see: http://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install)
The server was being unresponsive, and Larry Van Cantfort (the Director of Operations for PMI SFBAC) sent me this clue:
It appears that httpd has a lot of running processes and when I try to kill them I am unable to. THis is causing the server to sloooow way down. There are also error messages from mysqld with a corrupt table:
13110312:18:30[ERROR]/usr/libexec/mysqld:Table'./wordpress_2/wp_comments'ismarked ascrashed andshould be repaired
I couldn’t even get into the control panel to get things going, so the cleanest approach was to simply rebuild the server.
So I shut down the database and started to try and get it backed up so we’d at least save all the hard work of the volunteers.
So I tried to run the dump, with the following command that I got from the Parallels support site:
[root@u15893654~]# mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` -A > dumpall.sql
But that gave me the same error:
mysqldump:Got error:145:Table'./wordpress_2/wp_comments'ismarked ascrashed andshould be repaired when using LOCK TABLES
That fixed the issue, and I was able to create the “dumpall.sql”.
Once I had ALL of the tables fixed, I simply rebuilt the server and migrated it into a new database as described in the Parallels KB article mentioned above (a lot more steps to make sure the backup was good, but once it was the newly imaged server was able to run without incident).
First, if you already have a Google account (like a GMail address), you will want to log out of by clicking on your name or icon up in the upper right corner of any Google app, and then click the “Sign Out” button:
I decided I’d walk through creating a new app to replace one I’ve used for years on my iPhone that no longer appears to be maintained. The app in question is called GasBag which as near as I can tell stopped being updated in 2009 (see: http://blog.jam-code.com/).
I could just write a quick and dirty web app to store my mileage, but I figured I’d approach this as an exercise in building an iOS application with a design first approach.
At a high level, what I want is an app that easily captures my mileage, and allows me to save that information somewhere that won’t get destroyed. There are a number of features that GasBag had that I liked (for instance being able to send an email with my mileage information), and a number that it doesn’t have that would be nice (like allowing me to use it for multiple cars, or to do some data capture from a gas station receipt).
Alternatively, you can use the standard GMail settings, on the iPhone, but my favorite approach is to actually use the GMail app from Google in the App Store. The reason I like that app over the standard iOS mail app is that it is much more of a true mobile client that takes advantage of the platform.
You can do this either from your iPhone/iPad directly, or using the iTunes store on your Mac/PC.
Once you have the app installed, you need to set up your GMail accounts. Either tap “open” from the App Store page about GMail, or find the GMail icon and launch it.
On launch the app will prompt you to log into your account. For a Google Apps account, this will be the email your administrator assigned you like firstname.lastname@example.org, and the password that you’ve set up previously by going to http://gmail.com.
Launching the App the first time takes you to the login page, where you can type in your email address and password. Note that this is the same whether you are logging in to a GMail account or a Google Apps account, to Google they are just different users as far as mail goes.
Once you log in, you will be shown the inbox for that account, and be able to read your email pretty easily. To navigate the folders (like sent, draft, etc), you tap on the little icon in the upper left corner that looks like a box with stacked bars.
This will cause the folders and settings pane to slide out from the left and reveal your email structure so that you can choose. Clicking on a particular folder will display that list in the same fashion as you saw with the inbox.
Additionally from this screen, you can add other email accounts by tapping on the profile area at the top of the pane, which slides the list of accounts down and changes the direction of the panel indicator at the top of the pane.
If you’ve already done this, you will see the list of accounts, and each one will be badged with the number of unread messages. Adding a new account is as simple as tapping the large plus icon and logging in. Tapping on a profile picture will switch you to that account once you are logged in.
The little gear icon in the upper right of this corner brings up settings for you email where you can set a few things (such as vacation responder, signature, etc).
Once you log into the new account, you will again see the loading page, this time with the image from the new account’s name and profile image
The next time that you go to the account selection page, you’ll see a list of accounts with the icon for each badged with the number of unread messages showing so that you can easily see what needs your attention at the moment.
Google apps on the iPhone are a mixed bag, with some being native, and others not, so it’s also a good idea to set up the Apple “Mail, Contacts, Calendars” for synchronization of those things (which can use the Exchange push in the same way as an actual Exchange server).
First go to your settings (normally you can find this by clicking the home button on and looking for the gear icon that says “Settings”.
If you’ve previously added accounts, the “Add Account …” will appear below the existing account settings list (in my case I actually have to scroll in order to get to this button.
Tap on the add account button and you’ll be presented with the choice of types of account that you want to use. You can use GMail here, but I prefer to use Exchange simply because it pushes the information to the phone asynchronously
Once you tap on the Exchange button, you’ll get a new page that prompts you for the authentication information. This uses Microsoft’s autodiscover method to figure out how the account should be configured.
Type in the user name and password for your account here, and give it a description. Typically I use the name of the company that has the domain that I’m adding (for example PMI-SFBAC for my pmi-sfbac.org address).
Then click the “Next” button which should bring up the Domain screen. The only thing you need to make sure of is that the server ends up being m.google.com, and that you still have the right username and password. To continue, tap “Next”.
The final step is to choose what you want to be pushed to your phone. Generally the important ones are the contacts and calendars, since those are business related.
It really doesn’t hurt to have Mail turned on as well, since that keeps your inbox in the iOS Mail app up to date, but if you’re worried about your data plan, just set up the contacts and calendars, since that is the part that the GMail app won’t really be as helpful with.
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.
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.
To 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.
Another 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.
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.
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.