Sunday, March 9, 2014

Publishing to NSF via git

(This is another of those safe-keeping posts aimed at backing up some information that I find useful. I got the information from here, but I never know if/when that page will go away.)

I use NearlyFreeSpeech.net for my domain and web hosting. I use git for storing my repositories and managing my own codebases. Both are handy and affordable. This post explains how to set up an NFS site with git so that I can publish changes to my website quickly and easily via a command line push command. (It is worth noting that any configuration that is specific to the web server, whether localhost or your public facing site,  should be in a separate config file that does not get updated by git. In other words, put all of your client-side configuration data into a separate file and list that file in your .gitignore file.)

So here it goes:

  1. SSH into your NFS account from the command line:

    ssh USERNAME@ssh.phx.nearlyfreespeech.net
  2. Run the following commands within the folder where you want your git repo files to end up. (If you are just updating a subdirectory and not your top level folder, then cd into the appropriate directory before doing the following:

    mkdir .git cd .git git init --bare cd hooks touch post-receive pico post-receive
  3. Add the following line to the file you opened in pico. Again, if you are in a sub-directory, you will need to indicate that in the followling line by extending the path beyond the public folder:
    GIT_WORK_TREE=/home/public git checkout -f
  4. Save and exit the file, then run the following to set appropriate permissions on the file:

    chmod +x post-receive
  5. You can now exit out of your SSH session. Back in your local repo git folder run the following to set up a new remote for this repo. 'website' is an arbitrary remote name which you could set to whatever you want:

    git remote add website ssh://USERNAME@ssh.phx.nearlyfreespeech.net/home/public/.git
  6. Now you are all set up. When you are ready to publish your files to NFS, simply do a push as if to github, but push instead to the website:
    git push website master

That's all there is to it.  Piece of cake.




Friday, November 16, 2012

Apache and mod_jk on Mountain Lion

(I haven't been using this space for anything else lately, so I may as well save some handy stuff relating to development and computer stuff (and anything else, really).)

I upgraded to Mountain Lion tonight, and upon doing so I found the ability to start and stop the apache server had been moved out of the preferences. So another tool on the command line.

sudo apachectl start
sudo apachectl stop
sudo apachectl restart

 My apache server starts automatically, for whatever reason, but those are the commands to do so manually. Additionally, since I found that some of the configuration settings in apache before break the current, the following was useful to troubleshoot why apache wouldn't start correcty: 

sudo apachectl -t

That will start the server but spit out any errors that are thrown.

The next hurdle was mod_jk, the connector that passes calls from apache to tomcat where applicable. I have found that whenever I change OS X versions, the mod_kj connector needs to be re-built. Copying across won't suffice, either. So I got the latest connector source files from here: http://tomcat.apache.org/download-connectors.cgi

Then I updated my XCode in the Apple App Store. XCode has the compile tools you will need. There was a "gotcha" in this part, though. For some reason, the XCode tools are not in the place they are expected, so I had to run the following to link the tools to the correct place:

sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain
(source: http://apple.stackexchange.com/questions/58186/how-to-compile-mod-wsgi-mod-fastcgi-etc-on-mountain-lion-by-fixing-apxserror)

For me that got rid of the problems I came across when running the following to build and install mod_jk: 
cd native
./configure CFLAGS='-arch x86_64' APXSLDFLAGS='-arch x86_64' --with-apxs=/usr/sbin/apxs
make
sudo make install
(source: http://www.bartbusschots.ie/blog/?p=1347)

So that got my java web stuff back working again. I will probably find more issues to contend with from installing Mountain Lion. But the iMessage for mac is suppose to be cool and I expect it to be useful. Worth it?

(More Info: Once I did get things (seemingly) working, I did find that my tomcat was acting up. Every time I loaded a page for the first time, tomcat would no longer respond. So I could browse among pages I had loaded recently just fine (albeit slowly), but if I went to load a new page, then things would freeze up. No logs or any other clue as to why. I ended up replacing my tomcat with a new version (7.0.32) and things started working again as I expected. No telling why all this happened, and I just don't have the time (nor really the inclination) to track down why. I'm just glad to be moving again.)

Monday, April 18, 2011

Tax Day

This year I had to pay taxes. By disclosing that, I am not saying that I usually don't have to pay, but this year I owed money at the end of the year so that instead of receiving a second-quarter bonus, I had to give up some 2011 money to pay for 2010. It wasn't horrible, only inconvenient.

Some people would say that I'm doing it wrong by either not having enough withdrawn from my paychecks (which may be true) or by paying taxes at all (instead of finding loopholes in the tax code). I can't really say that I agree. While I do believe that there is a lot of unfairness in the tax code, I do feel a degree of responsibility to paying my share of the tax burden. So I try not to complain about the amount taken out of my paycheck or having to pay a chunk at the end of the year.

What I do have a problem with, however, is how my tax money is spent. I guess that is what all of the uproar is about in Washington (D.C.) lately with spending bill talks and budget crises and such. A useful tool provided by the white house for seeing an overview of where your tax money goes can be found here. At the top of the list (for income tax, anyway) is military spending. That is just above health care. So essentially the largest chunk of my income tax dollars are going to fight wars in other countries. Those tax dollars are killing innocent people and making the oil men richer and re-enforcing an ever more imperialistic US government. I'm not a fan.

Another thing I am not really understanding is that I pay a medicare tax and I pay healthcare in my income tax. Why are these separate? I don't have a problem paying to help the overall health costs of the nation, but this seems like a political thing, keeping them separate. (It's not lost on me that together, my combined "healthcare tax" is a good bit higher than the military tax, but I prefer a tax that helps people more than one that kills people.) I wonder how many schools could see considerable improvement for each scud missile fired into "non-war" no-fly zones.

A topic that isn't all that unrelated to this is one of objectivism. I have not been shy about two seemingly incongruent points of view I hold onto. I tend to be both liberal in my views while also holding a strong appreciation of many of the precepts put forth by objectivism (as represented most recognizably by Ayn Rand in her writings such as Atlas Shrugged and Fountainhead). What it comes down to for me is that while objectivism really works for my logical and autonomous side (and models some of the ideals I try to live for), I don't believe it could ever work nor is it good for real human society. I believe that compassion is a worthwhile virtue and that while the system could use an overhaul in practice, welfare is not something that should be left by the wayside. The term "entitlements", in negative reference to welfare, originates from a point of view that celebrates elitism and pays no regard for the common man, who is really all of us. I appreciate the opportunities I have and have had, and I appreciate living in a system that allows me to excel and live comfortably if I choose to work for it, but I also believe that every working person deserves a living wage, and in our free market system, many of the services that we enjoy do not pay this living wage. And that's where welfare and "entitlements" come in.

So how can objectivism play into a liberal society? By way of constraints that keep the system going. I don't have a problem with wall street bankers making billion dollar bonuses, but I do think they need to be taxed very heavily to even things out. With their wins, someone else has lost (and in most cases, it was many someone elses). When banks (or others) lose, they should be allowed to lose (like the rest of us). Afterall, the individuals involved do have the same safety net of welfare that we all have. My point is that there is value in some regulation and that people have an obligation to pay into keeping the system going. (It is obvious from the last years' bailouts and the playing to the financial industry that free markets don't really exist anyway. I think it's time to call a spade a spade.) I think the reason that most conservative republicans vote and argue the way they do (to protect the rich and the rich lifestyle) is because they really do think that eventually they will achieve that wealth, and so they don't want to ruin it for themselves. Delusional.

All of this is to say that I do think that many of the intentions of the US government are where they should be. How they are exercised are not. We are spread way too thin in trying to be everything to everyone in the world. I am not advocating an isolationist policy, but that's not even an argument in this day of global markets and open communication. What I am advocating is that we bring our troops home, shrink the military and the military spending in a huge way. We should spend the money we have in improving our internal systems and government efficiencies. We should do a better job of implementing our welfare systems so that we help more of our people that really need it. If once we have trimmed down and improved the government systems we find that we need more taxpayer money to fund the government, then we concentrate first on making sure everyone is paying their share in the grand scheme of things.

This all sounds good (to me) but getting there would be a monumental task. We currently have a democratic president who I sometimes think is actually a conservative republican in disguise. (The biggest winners in the healthcare law that was passed, for instance, appear to be the existing healthcare companies, who are already cleaning us out - remember the health care expenditures mentioned above?) We have republicans who are fighting welfare entitlements but take home major payouts in their own version of entitlements. In all of the discussions to make a budget, there has been no serious consideration of shrinking the military and in fact we have a new front to protect in Libya. The primary goal of the parties is to fight each other, not improve the lives of the people. And we are paying for that bickering. If we wanted things to stay the same, we could do away with most of our elected officials, but as it is, we want improvements. None of the party lines make sense, either. Conservatives want to take away a woman's right to an abortion, but they also want small government (supposedly) that leaves people alone to do what they want (except have abortions). Democrats want extensive social services but are also advocating tax cuts (I think this could actually work if they did away with much of the military - but no mention of that). It's all about posturing and getting someone into office so that they can do it all over again for another 4 years.

In this day I think that taxes and a big government are necessary. In a perfect world, this wouldn't be so, but we will never have a perfect world. The tax money needs to stay here and the government needs to do the job that our tax dollars are paying for.

Wednesday, November 24, 2010

Belgium

Today I leave for Belgium with my lady. We are visiting good friends who moved back to Brussels after a few years here in Nashville.

I am ready for eight days of hanging out with our friends, but in a new (to us) place. Eight days of exploring cities older than any in the US. Eight days on not having to drive in a country traditionally known to have the best beer in the world. Eight days that are completely different from my normal days.

There may be updates posted here. We'll see. My intentions are good, but Belgium is supposedly great. Belgium and the experiences may just win out.

Cheers.

Wednesday, October 6, 2010

50k accomplished.

My last post stated my entry into a 50k trail run near Chattanooga, and now I report that I did in fact finish that run. Following is an account of how the training and the race itself went down.

I signed up to run this race for two main reasons. One, I have always been intrigued by the concept of ultra-marathons and ultra-endurance events in general. The intrigue is in understanding how my body reacts under the conditions and just how much i would be willing to push myself. The other reason I signed up was simply to motivate myself to get back into shape.

Immediately after signing up for the race, I started a (less than vigorous) training regimen. I started running every other day. I started by running around 35-40 minutes per day on that schedule. Over the course of a few weeks, I worked up to running about an hour per day and would occasionally run two days in a row. Getting started running again took some time and discomfort, but eventually I got to a point where running was comfortable again. The training was good and mostly consistent for a couple months, and I tested myself in late September by running a 9-mile race here in Nashville at Percy Warner Park. The course was hilly, which was good for the test, but it was also mostly on the street, which was bad for my joints. Considering how much my joints hurt after that, I started to fear the 50k some. After recovering from that race, I had 3-4 weeks of training remaining before the big race, and really only 1-2 weeks where it was worthwhile to do anything. I had lofty goals to work in some long runs and such, but all I mustered were a bunch of hour-long runs and even managed to take 4-5 days off from running a couple of different times. And then it was time to taper. From what, you ask, well... I didn't taper so much as just feel justified in not getting out there and running more.

In a nutshell, I didn't train so much as just make sure that I could run a moderate distance without it hurting too badly. The longest run I had done prior to the race, ever, was about 1 hour, 40 minutes. Though I had dreamed of doing well in the 50k and running strong, my approach had switched to the time-honored approach I have had with most athletic endeavors in the last few years, I went in just hoping to survive but not worrying too much about how it would end up. I didn't feel like i had anything to prove. So my preparations on the last night also mimicked most of my other endurance event-eves, I was at the Terminal Brewhouse in Chattanooga enjoying some pre-event libations. (And boy, their libations are pretty phenomenal).

Race morning wasn't too early for me. I got up and ate my chorizo and egg burrito and downed some more gatorade to combat the beer from the previous night. Then we were off to the race. I didn't even pretend to warmup; with 50k to run, there was plenty of time to get the body warmed up for the long haul. I waited with almost 850 other runners (500 50k runners, 350 11 mile runners) in the morning coolness for them to start the race. They made some announcements, which I couldn't hear, and then the people in front of me started moving forward. So I followed.

The first half mile was on the road. Everyone around me (and I think all but the front elite) were very chilled and just moseying along in a huge group. When we hit the trail there was a bit of a bottleneck as people fell into line on a trail almost wide enough for two people. The first couple of miles was a slow jog in a line without much placement movement and with a lot of chatter. One thing I noticed and was surprised about, though, was that many people were walking all of the hills.. already. I was figuring out pretty early that an ultra-marathon is a different type of race than any I had run before.

After 2-3 miles, things started spreading out pretty well and I found myself running mostly alone at my own pace. At about mile 4, we started down a narrow singletrack trail and things started to get more interesting. The first stretch of trail was wide, well traveled, and had supplemental gravel on it. The next 23 miles or so would be singletrack, rarely level, and rocky. It was beautiful trail and terrain, and early on in the race, I appreciated it.

The next 7-8 miles were fun. I ran with a few different people, and I ran alone for a lot of it. There were a couple rest stops, and some interesting terrain. Then the pain started. Somewhere around the 11 or 12 mile point, I started to feel pain in my knees and my feet. It was pain from the impact of running beyond what my joints and connective tissues were used to. Soon after the pain started, I took a couple of advil and put my headphones on. Within 20 minutes, I was feeling pretty good again and kept running. (I should note that after a few miles, I had adopted the strategy that so many others used and had started walking up many of the hills. Essentially, I would run until I started to feel like i was having to expend additional energy to keep going, and then I would walk, usually briskly, up the hill until it was comfortable to run again. I also would walk whenever I would eat or drink along the trail.) The good feelings lasted another 4-5 miles, after which I started to hurt again, but not as badly as before.

Somewhere around mile 18 or so, I came to the rock garden. This is a stretch of "trail" that is maybe a half mile and consists of almost entirely jumping from rock to rock. There was no running, there was only trying to stay on the path and not hurt myself while trying to negotiate the different rock surfaces in my tired state. It was fun, but would have been more fun had I not just run 18 miles. It was around this point, and a little before the rock garden, actually, that I started to consider bailing on the race at the 19 mile point. Melanie would be there and it was the logical point where most people who quit ended up calling it a day. My rationale was that I was tired of hurting, I didn't have anything to prove and at the pace I was going, I was on about an 8 hour pace to finish, which was longer than I cared to be out there. But then I got to the mile 19 rest stop, sat down, refilled my food stores, and decided that I felt great! So I kept going.

It was maybe a half mile later that the real pain started. Somewhere close to mile 20, I started getting a shooting pain in my right foot that went from my heel up into my ankle. This made it really painful to walk, much less try to run on that foot. I had thoughts of turning around since it was less than a mile back to the last stop and it was about 5 miles to the next stop... but I just kept moving forward. I tried to run when I could, but I ended up shuffling and walking almost all the way to the next stop. Again I considered stopping, and if Melanie had been there, I probably would have quit then, but she wasn't, so I didn't. I took more advil, fueled up again, and continued on what they said was 10k to the finish.

I continued to shuffle and walk over a couple big hills to come to the last stop, which would also be where we got back on the smoother doubletrack trail, and had only 3-4 miles left. With that little distance left and the shooting pains dulling a little, I managed to do a little running on the remaining trail segments. Then a half mile on the road and I shuffled into the finish. 8 hours and 44 minutes is a long time to be out there running/walking and eating energy foods. It messed up my digestive system and my feet and legs were sore for days. But I got through it and now have the experience and know-how behind me. I never hit the "wall" that others talk about for marathon runners. My eating and hydration and fitness were fine, but my legs suffered.

One of the big motivators for me to keep going through the pain and such was that if I finished, I wouldn't ever have to feel like I needed to come back to do it again. But already only 4 days out, I can't say I feel the same about it. If I ever run something like that again, it will certainly only be if I am better prepared, but it is certainly an experience I appreciate and will possibly choose to do again. But not for a good long while.