Todd Smith-Salter

Random ramblings and musings of a father, web developer, Grande Prairian, and man of faith.

Apr 8, 2013

File Upload Error - exceeds MaxRequestLen

As you may know, web hosts limit file upload sizes via the [php.ini}(http://www.php.net/manual/en/ini.list.php) file. It's fairly simple to change the directives in said file to increase the maximum file upload size.

The site I'm working on for GP Church of Christ gives the church content administrator the ability to upload sermon audio files. Being that most sermons are 30+ minutes, the mp3 audio files tend to be larger than 20 MB.

After a few attempted uploads, we were getting this weird error in the server log: mod_fcgid: HTTP request length 16777353 (so far) exceeds MaxRequestLen (16777216). The WordPress uploader showed an HTTP Error dialog, but no elaborate description of the issue.

After a couple days of digging, experimenting, failing all over the place, I came upon this article, which explains perfectly how to overcome this problem.

But let's step back for a minute and examine what really is the problem. My server, is using the FastCGI module for PHP support, rather than Apache. The php.ini file still has directives that govern the ability to do actions like uploading files. In addition to those php.ini directives, there are two locations that govern the FastCGI module and it's upload limits.

  1. The FastCGI global config file, probably at /etc/httpd/conf.d/fcgid.conf.
  2. A domain specific FastCGI config file at /var/www/vhosts/your_domain_name_here/conf/last_httpd_ip_default.include.

Vim into both those files and ensure that the following lines are there and have a value, any value.

<IfModule mod_fcgid.c>
FcgidMaxRequestLen 1073741824
</IfModule>

As above, I've got mine set to the default of 1 GB (1 GB = 1073741824 bytes).

Apparently, fcgid settings are also in your virtual hosts file at /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php. Find the same IfModule mod_fcgid.c element and make the same change.

Next, let's reconfigure your domain with Plesk:

/usr/local/psa/admin/bin/httpdmng --reconfigure-domain yourdomain.com

Lastly, restart PSA and Apache:

service httpd restart
service psa restart

Now, you should be good to go! Try uploading a large file under 1 GB.

Sources

Mar 13, 2013

Web Software Versioning

I started working on the new, but yet unreleased, version of Candidio.com a few months ago and one thing that I look back and regret, is that we had not software versioning established. With over 500 commits to our Master repository, its a bit of a nightmare to look at our history and pull out any logical milestones to reference.

Going forward, we're going to establish some conventions that make sense for us as a team. The first is entrenching ourselves in a good Git workflow that makes sense and reduces the amount cruddy commit message to nil (hopefully). After a bit of Stack Overflow research, I've come to this awesome article by Rein Henrichs, A Git Workflow for Agile Teams — I wish I had seen this 9 months ago.

Also crucial to this is ensuring our commit messages are not too verbose, yet descriptive enough to encapsulate everything in the commit that changed. I then ran into this article, A note about Git commit messages, which elaborates on what makes a well formed commit message — just some plain ol' common sense is needed.

Finally, establishing a convention for version numbering is crucial. For Candidio, we've taken on this scheme:

[major].[minor].[release].[build]

Major increments when code is committed to the develop repository that can be considered a "major" product update, or code that once in production, there is no going back. This update is not backwards-compatible.

Minor increments when one or more feature is added or undergoes a workflow refactoring. Reset this to 0 when incrementing Major.

Release increments every time we hit a development milestone and release the product, event internally (e.g. to staging). This is especially important for communication in the organization. For us, anytime we push an update to the staging server is our key to increment. Reset this to 0 when incrementing Major or Minor.

Generating a Build Number. We use Git for version control, so there is no monotonically increasing numbers like'v123' or the equivalent to go with each commit, like SVN. We run git describe on a commit to get a human-readable name. When running this command, Git gives the name of the nearest tag with the number of commits on top of that tag and a partial SHA-1 value of the commit you're describing. This way, we can export a snapshot or build and name it something understandable to people.

Sources

Oct 11, 2012

Coffee: Appetite Suppressor and Addictor

I have stopped drinking coffee for about 36 hours now and I can tell you from that short amount of time that I am addicted. Yesterday morning, my first without the beautiful brew, I was craving a steaming from the get go. Maybe it was because my body knew I had made this monumental decision so the chemicals were firing to try to make me reverse course.

The first 24 hours was an experience in perseverance. I was tired. I was edgy with my kids. And I was hungry! I can't believe how much I had to eat to stay functional, which can't be healthy.

Now I'm on day 2. I just finished my lunch and immediately fell asleep on the office couch for a short spell. After my cat nap, I took a jaunt over to 7-Eleven to pick up a Slurpee® and Nibs. I am really hoping my body quickly adjusts, but I might need to but a few packs of gum to tide me over until that day.

Sep 14, 2012

Education and Technology

In the vein of my last post, my brother has been doing some research on the merging of technology and the classroom. Where are we going? How are we going to get there? He sent me over a couple links that I thought were worth sharing.

Sep 9, 2012

Take Captive Every Thought in a Culture of Distraction

Take captive every thought to make it obedient to Christ. - 2 Corinthians 10:5

"This is your life and it's ending one minute at a time" - Narrator, Fight Club by Chuck Palahniuk

I want to go back and revisit something I talked about a couple of years ago, but with a slightly different angle.

The Culture of Distraction is prevalent in the society of now. We are constantly and consistently barraged with interruptions into our patterns of thought and consciousness. Unfortunately, very few of us have the self-discipline to manage our intake of disruptive technology.

Most of the first world is wired in to 140 character short stream messaging, or something of that sort, and is becoming less adept at contemplative thinking. What are the social implications for communities and individuals when we obfuscate ourselves behind a layer of social media and faceless interpersonal messaging? Worse yet, what are we hiding or running away from?

A lack of self-discipline, not curbing our human nature to be distracted, encourages habits that just don't mesh with what we're taught in the Bible. Why do we allow ourselves to be distracted, not taking every though captive? Is it because we have no self-discipline? Is it because we are running from something? Or are those two reasons intrinsically tied together, working to create a beast inside of us all, disenfranchised from the reality of the world around us? The hurts that we all carry, can, and probably are a contributing factor in our reasoning to let these types of habits continue; an escape from the past that haunts us.

Joe Kraus is a Partner at Google Ventures. His primary areas of focus are mobile, gaming, and local services. So this guy is involved in the tech industry, probably working out of Silicon Valley, possibly in Google's main office in Santa Clara, California, pretty close to San Jose. He is likely immersed in technology and other disruptive technology throughout his working day.

Joe has a talk about creating a culture of distraction, which I'd like to show you now, but be mindful and thinking critically while watching, that as followers of Christ, how does this link up with our calling to "take captive every thought".

He makes some really valid points:

  • our phones are gap fillers. They train us not to think for ourselves.
  • Attention is a muscle. The more you train it to always be quickly changing thoughts, the more fragmented your thinking will become.
  • Multi-tasking? Not really, more like fast switching of our attention. We're not computers. You're 10 IQ points dumber when "multi-tasking" and 40% slower. The more you do it, the worse you get.
  • we're wired for distraction, but rather than help future generations fight the imbalance, we cultivate it by throwing devices in their laps with little restrictions.
  • We're radically overtraining part of our brain.

Paul Graham, one of the founders of Y Combinator, a tech startup seed accelerator or incubator, as they're commonly known, tells us in a post on his blog titled The Acceleration of Addictions,

"People commonly use the word 'procrastination' to describe what they do on the Internet. It seems to me too mild to describe what's happening as merely not-doing-work. We don't call it procrastination when someone gets drunk instead of working."

What excuses are we making for using the internet, phones, technology, or other addictive and disruption patterns, so that we don't have to deal with the real issues in our lives? There are so many ways and excuses that we can gloss over our use of our devices, "I need it for work", "I need to be available at all times", but having the ability to shut those distractions off is what will allow us to build our skills in introspective thinking. We need to train our brains to focus on Christ in a very fluent and changing and increasingly digital world.

You may think that choosing a life where you make decisions to put tech away or drastically limit its use, to be archaic or even bring undue attention or ridicule. Graham also says in this same blog post,

"You can probably take it as a rule of thumb from now on that if people don't think you're weird, you're living badly."

I think there's a lot of truth in that statement. Isn't being a Christian making the choice to "be in the world, but not of the world"? Doesn't that apply here? Everyone is different, so we all need to come to grips with what's best for each of us, but we also need to remember that no man or woman is an island, so seek counsel.

What are we really losing? Kraus states that manners is one, creativity and insight are another. I can relate to his observation of only being able to really think in long form is in the shower. For long, I've realized that the shower is the place where I do my best thinking, but up to now, I hadn't put the pieces together.

What can we do, as Christians, to bring ourselves back to a healthier place personally? Joe Kraus' idea of Sunday's with no technology seems to have a fairly valid place for me. I have the habit of pulling out my phone and getting lost in a different world. Forcing that break on myself is kind of like a diet cheat day; you mess with what your brain is usually being disruptively fed, so that it get's a bit of a reset for the rest of the week.

Practicing mindfulness by going on a daily tech-free 15-20 minute walk sounds like a great time to pray for each other.

What about dedicating daily time to read your Bible? I was listening a podcast with Matt Mullenweg, the co-founder of WordPress, the most popular content management system on the web today. WordPress runs over 14% of websites on the internet. He talked a bit about the Culture of Distraction, and how he personally takes the time daily, some specific actions to get his mind engaged and thinking in long shifts, rather than short bursts that social media like Twitter or Facebook encourages. Specifically, before he gets out of bed in the morning, he reads something. The interesting thing is that he knows that if he checks his Twitter account first thing, he has set his brain to think in short bursts of attention for the rest of the day. Rather, he will read an lengthy article on Instapaper, which gets his brain engaged to stay focused on tasks longer term than for 30 seconds at a time.

Let's parlay that back to us. What could we read first thing in the morning to get our minds focused on Christ and the Holy Spirit for the rest of the day? Why not make it your goal to read the Bible first thing every morning? If your excuse is, "I don't have time", let's remove that excuse. Mullenweg said that he does some form of exercise as soon as he steps out of bed, even if it's just two push-ups. Who doesn't have time for two push-ups, really? In that case, who doesn't have time for two verses? We're stoping ourselves before we even get to the starting line.

I gotta admit, I find reading my Bible in length, especially hard. Research has found that less than 5% of smokers who quit cold turkey succeed in breaking their addiction. Start small. If you are literally starting a a place where you're not reading your Bible at all, read a couple verses a day for a week. Read four a day the next week. Read a chapter a day the week after. Two the week after that. Take it wherever you feel called to go with it. Just do something to get your mind in the right frame for the day.

We haven't even discussed the most important part yet. We are called to be led by the spirit, and as spiritual beings, praying unceasingly. Part of a healthy prayer life is disciplining ourselves to take the short moments we have throughout the day to pray. How can we do that when we use our filler devices?

So, in my opinion, this is where we need to start. At the same time as we're training ourselves to have more self-discipline, we need to be removing as many obstacles and stumbling blocks from our path as possible. I note that many of you won't struggle with these distractions, that you've been able to maintain some level of discipline over yourself and haven't been caught up in the Culture of Distraction. Keep calm and carry on. For the rest, if you figure out that your reason for being distracted is because the reality of life and the cards you've been dealt is too hard, don't. Stop now. Choose to hurt, because without it, your healing will come that much slower. A life feeling emotion is far better than rolling through life as a tumbleweed, being blown whatever direction the wind takes you.

My challenge to you, is to evaluate what you let distract you from the calling of the Spirit on your everyday life. Then take action! Don't just think about it, but maybe you sense that taking a break from being "plugged in" for one day a week is the thing for you. Don't let yourself get distracted from reality, from the people right in front of you. Maybe spending 20-30 minutes walking in solitude before you really start your day is what hits the mark. Whatever it is for you, do something, anything. Make a choice and stick with it. Make some new good habits. And remember 2 Corinthians 10:5,

"Take captive every thought to make it obedient to Christ."

Update: A good article titled Connectivity is Killing Us was posted to The Industry on August 31, which is extremely relevant.

Further Reading & Notes

Jun 19, 2012

Install and manage WordPress with Git #

Good tutorial on using WordPress with Git, especially if you want to update the WordPress core files using Git.

Jun 18, 2012

A Git Workflow for Media Temple (dv)

Update: I've not had a whole lot of success getting this particular setup to work. If anyone can provide some pointers, especially getting the file system to update on post-update, add it in the comments.

For awhile now, I've struggled to develop a good method for pushing changes to my Media Temple (dv) server. Up until now, I've been using SSH to login to the server and git pull changes from a Github repository. While I like the concept of using Github as an intermediary between the local, staging, and production sites, it can get cumbersome.

There is one solution that Jeffrey Way presented using Github Service Hooks that may work for some.

For those who want to push to the (dv) server directly, here's a decent method that should work.

Disclaimer: I'm providing this method as a courtesy. This method may not work for you, or may even bork your server. Be aware that it is not my responsibility to support you if you attempt to follow this guide.

Some of this is taken directly from the Media Temple Knowledgebase.

Create a Local Repository

On your personal computer, make a directory and create repository.

mkdir example && cd example
git init

Now create a meaningless test file that we will commit to the local repository, or create your default project file base.

touch .gitignore
git add .git ignore
git commit -m "just adding test gitignore file"

Now we create a "bare" clone of this repo and upload it to the server.

cd ..
git clone --bare example example.git

Now upload the bare repository to your (dv) using scp. Note that you'll need Root Access enabled in the AccountCenter.

scp -r example.git root@example.com:/var/www/vhosts/example.com/sitename/example.git

Log into your (dv) to complete the setup using SSH:

ssh root@example.com
cd /var/www/vhosts/example.com/sitename/example.git
git --bare update-server-info
cd hooks
mv post-update.sample post-update
chmod a+x post-update

Your repository should now be configured!

Using your repository

Pulling

New users should be able to clone your repository directly from the (dv) using HTTP with the following command:

git clone http://example.com/example.git

Pushing

Now that we have a working repository both locally and on the (dv), we can start using Git to "push" new content. If you've added new local content, using the following comment to add the repository on the (dv) server as a shortcut.

git remote add dv ssh://root@example.com/var/www/vhosts/centerdrive.ca/sitename/example.git

Now you can simply push using the command:

git push dv master

Resources

Jun 15, 2012

My thoughs on Sass vs LESS

Does it really matter which of Sass or LESS you choose? Just pick one and build something because you won't know if a CSS Preprocessor can help you improve your workflow until you try.

My experience has been starting with LESS. I built a personal project, then a production project, with what I'd call limited success.

I'm about to start a new project for a large organization and I've decided to use Sass. This is my short list of why I'm using Sass over LESS:

  • Debugging. Using most of the Sass compiling tools, you can have the output file list the line numbers and file of the original declaration. I found LESS hard to debug once I hit 2k lines of the compiled file.
  • Control Directives. I'm not sure why if, for, and while statements are excluded from LESS, but I'd like these functions available for use if I want them.
  • @extend. I like the ability to not have one declaration declared over and over in a compiled CSS file. One thing I've seen, especially in [Twitter Bootstrap](Twitter Bootstrap), is the repeating of declarations at compile time.
  • It's how my mind works. I consider myself 30% designer and 70% developer. LESS appears to be more geared towards developery types, while LESS to designers. LESS is to the point, while Sass is a more rounded CSS extension.
Apr 18, 2012

Useful Git Commands

I've been finding myself searching for a few useful Git commands lately that you'd think I'd know of by heart, but, you know, it hasn't happened for whatever reason. Here's a list of commands I keep going back to.

Clone a only specific branch

git clone -b <branch> <remote_repo>

Get a local working copy of a remote branch

git branch -a
git checkout -b branchname origin/branchname

Stage deleted files for commit

git add -u

Untrack files without deleting them

echo "*.config">>.gitignore
git rm --cached "*.config"
git add .
git commit -m "Ignoring and deleting config files."
git push origin
Apr 13, 2012

2012 Alberta Election Resources

Where do I vote?

Help me decide who to vote for!

Latest Poll Results

Parties, Leaders, Platforms

Wildrose Party of Alberta - Danielle Smith

  • View the Wildrose Pledge on Scribd
  • Balanced Budget and Savings Act. Careful spending, saving for the future, and living within our means. Invest half of our surpluses in the Heritage Fund over the next 20 years and grow it to $200 billion.
  • Family Pack. Help families by making life more affordable through tax deductions for children under 18, ban all manadatory school fees in public, Catholic, and public charter schools, $500 tax credit for fees spent on children's sports, arts, and cultural activities.
  • Alberta Energy Dividend. Send 20% of provincial surpluses generated by oil and gas revenues directly to Albertans.
  • Patient Wait Time Guarantee. Provide alternative independent facilities for Albertans on wait list longer than the Canadian Wait Time Alliance benchmarks, and have it paid by Alberta Health Insurance. Add capacity to the health system by allowing for a mix of public and independent delivery.
  • Accountability Act. Allow MLAs a free vote on every proposed law and give voters the right to recall MLAs who put the interests of themselves or their party over the interests of their constituents. Fixed provincial and Senate election dates. Roll back the 30% increase in Cabinet Ministers salary. Prohibit MLAs from setting their own salaries in the future. Make it easier for citizens to access government documents and information.

PC Alberta - Alison Redford

  • Alberta By Design PC Election Platform
  • Secure Alberta's Economic Future. Make strategic investments in education, human capital and infrastructure to strengthen Alberta, growing our knowledge-inspired economy, and improving Alberta's competitiveness in the global marketplace.
  • Advance World-leading Resource Stewardship. Develop our natural resources responsibility to protect our environment and grow our markets.
  • Invest in Families and Communities. Support wellness, families and communities as an investment in Albertans and Alberta's future.

Alberta Party - Glenn Taylor

  • We can dream bigger - Alberta Party 2012 Election Platform
  • Rethink Healthcare. Better healthcare needs a better strategy. We must focus on long-term outcomes rather than short-term costs and shift the system from treatment to prevention. We must make transparency a core value of the system so that we can get the information we need to make the system stronger.
  • Respect our Students. Stable, predictable, long term funding. We will prioritize funding for primary and post-secondary educatino so that our students can excel in a competitive world.
  • Reimagine our Democracy. Ask, seek and implement solutions to the difficult questions. Develop policy with meaningful citizen engagement and transform the role of MLAs to ensure that they are connected to their constituents.
  • Reinvigorate our Economy. Make it easier to start and grow a business, both within and outside of the resource industry. Ensure that smart regulation fosters growth and protects our environment.
  • Reinvest in our Communities Maintain investments that strengthen the fabric of our communities by providing stable and predictable funding for our municipalities and social services.

Liberal - Raj Sherman

  • Alberta Liberal Platform
  • Guarantee for Health Care Delivery. Greatly expanded home care and seniors care. The creation of access to safe, quality preschool. Getting serious on foreign credentials.
  • Ending School Fees. Provincial school lunch program.
  • Eliminating University Tuition. Forgiving student debt for graduates who stay and work in Alberta. Increased funding for the arts, culture and spors. Carbon levy and green transportation fund. Municipal charters for Calgary and Edmonton.
  • Direct Funding of Neighbourhood Associations. Reducing the number of MLAs.
  • Instant Run-off Voting. Free votes in the legislature.

NDP - Brian Mason

  • NDP Platform Booklet
  • Quality Public Health Care. Guarantee fully public healthcare. Continuum of care so seniors can live in dignity in their own homes as long as possible, and when they can't, be sure of quality long-term care.
  • Delivering Affordable Electricity. Regulate electricity rates so that we have stable prices that are as low as possible. Remove cabinet power to approve utility projects - examine all projects through full public hearings.
  • Education for Success. Childcare system:Introduce a childcare system that moves towards a maximum daily cost of $25 per child, with a $9 per day cap for after school care; and increase the number of spaces available. Elementary and Secondary Schools: Reduce G1-9 class sizes as per the recommendation of the Learning Commission. Voluntary full day kindergarten. Targeted school lunch program for elementary. Adequate funding of special needs students and English as a second language. Revise funding formula for schools to ensure vital schools in mature neighbourhoods are not closed. Post Secondary: freeze tuition fees. Remove all non-instructional fees. Reduce tuition by 10% in Fall 2012. Forgive up to $1000 per year in student loans until paid off for those who graduate and are living in Alberta.
  • Protect the Environment. End Carbon Capture and Sequestration Fund's handouts to the oil industry. Interest-free loans to help Albertan's retro-fit homes for energy efficiency and revise building codes. Stop expansion of water markets. Science-based deadlines for clean-up of existing tailings ponds, costed to the companies. Create Renewable Development Fund, to support activities to make Alberta a leader in energy efficiency. More...
  • Oil Sands Prosperity. Develop a differential royalty system on bitumen and upgraded products that encourages value added in Alberta. Require all new oilsands developments to have plans for upgrading in Alberta.

News Media Election Sites

Articles

April 18, 2012

April 14, 2012

The Basic Political Spectrum

These terms are very broad and are meant to serve as only an outline of historically understood political positions on a single axis.

Left Centre Right
Social conditions need to change as quickly as possible Change of social conditions should take place, but at a cautious pace. The present system should be maintained. Change only when absolutely necessary and do it slowly and carefully.
Society is not bound by tradition Tradition is important, but change must be accepted if it is the will of the majority. Traditions must be respected. They provide society with stability and security.
Government has a moral obligation to take care of needy persons directly. There are many different approaches to caring for the needy. Government should not interfere in the lives of individuals (government provides a helping hand, not a handout). Private charity and self-reliance are better.
Everyone should have equality of condition Everyone should have equality of opportunity and condition. Everyone should have equal opportunity.
The rights of the individuals have the highest priority. Law and order is important, but the rights of the individual come first. Law and order have the highest priority.
The government should own key industries, banks, transportation facilities and natural resources. Some form of government management of the economy is necessary. Business and industry should be kept in the hands of private individuals.
Left is generally associated with being socialist. Centre is generally associated with being liberal. Right is generally associated with being conservative.

Student Vote Resource