WordPress 3.9 – PHP Fatal error: Allowed memory size of XXX bytes exhausted

More WordPress 3.9 system administration issues.  Kept getting errors from WordPress once a couple of plugins were installed that looked like this:

PHP Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 30720 bytes) in /var/www/wp-content/themes/x/framework/functions/global/admin/sidebars.php on line 166

According to Editing wp-config, the minimum memory required for WordPress 3.9 is 64mb.  You can do this by editing the php.ini file and increasing:

And then restarting Apache or Nginx.  Enjoy!

 

Continue reading

WordPress 3.9 Update plugin shows FTP connection screen

While working on a new wordpress install for a person in my group, I came across a problem when trying to upgrade plugins from within wordpress itself.  It kept showing an “FTP connection” screen.  Putting in valid ftp credentials for that server would fail with “Unable to connect” errors.  WTF?

It turns out there’s a magical wordpress config setting that you can add to wp-config.php:

This forces wordpress to use another method of updating plugins besides FTP ( I don’t really know what method it uses at this point, should research that.)

Continue reading

How to define an application pool user for your website directory in IIS

I wind up needing this like once a month and can never remember. Here’s how:

And here’s the relevant stackoverflow pages for more information:

http://stackoverflow.com/questions/7334216/iis7-permissions-overview-applicationpoolidentity

http://serverfault.com/questions/81165/how-to-assign-permissions-to-applicationpoolidentity-account

Continue reading

tail -f equivalent on Windows

As a longtime Linux guy, I always find myself looking for similar equivalents in the Windows space when I’m doing work over there. I tend to look a lot at the end of log files from my applications to see what’s happening. In Linux you can do something like:

This shows you the last few lines of “logfile” interactively. Meaning, that it will sit there and wait until “logfile” is appended to and it will then show you those lines. It’s great for monitoring something sticky deep inside an application if you don’t have tests you can generate and run.

An equivalent to “tail -f” on Windows is to use PowerShell with this command:

Another nicety in PowerShell “Get-Content” is that you can pipe the output to a search to only show the logfile lines that contain a specific string:

Happy tailing and Get-Contenting!

Continue reading

EntityType has no key defined. Define the key for this EntityType

While running “Add-Migration” I kept receiving the following error in a new ASP.NET C# project using Entity Framework.

Ebs.Job.Models.JobListing: : EntityType ‘JobListing’ has no key defined. Define the key for this EntityType. JobListings: EntityType: EntitySet ‘JobListings’ is based on type ‘JobListing’ that has no keys defined.

The code in question was the following:

The answer is that as of 6/12/2014, Entity Framework does not support unsigned integers. Once I changed the UInt32 to Int32, everything worked great.

Continue reading

Commit your local git branch changes first, then checkout another branch

One of the things people get confused about is the branching in Git, specifically, the local branching. If you make a local branch, make code changes and then commit those changes to the local branch, you are free to switch to another branch and Git will automagically manage your files for you. From the git book:

Git resets your working directory to look like the snapshot of the commit that the branch you check out points to.

But it’s very easy to make a mistake here. If you don’t commit the changes in your new branch and instead check out another branch, those changes will be there too. I’ve seen this cause confusion with developers. So if you make a local branch off your “develop” line:

and make some changes to files, you have to commit those changes to “NewBranch” or you’ll still see them as modified files if you switch back to the “develop” or “master” branches. Now if you commit those changes to NewBranch line first, then checkout “develop,” you won’t see them as modified, and the files will instead be in their state from the “develop” branch.

Happy Local Branching!

Continue reading

ASP.Net Razor Syntax for using a variable in html or html attribute

Because I always forget how to do this, here’s a quick note on the Razor syntax in an html variable. For a integer variable named: imgWidth that has a value of 214 you can put it in an html attribute like this:

and it will render like this:

I know I know. The css gurus will be lambasting me that I put inline styles in this example. So sue me. Sometimes inline styles are necessary.

Continue reading

Whoever says Google has poor support is wrong

I use a few of the Google tools available. When it comes time for my monthly backups of my web stuff, I use Google Takeout. Google Takeout creates a backup of all your Google stuff and creates one big zip file of it that you can download to your machine.

I had some trouble with it today, it wasn’t generating my download file so I sent an email to their support team. I got an email back in about five minutes:

Hi Rich,

Thanks for your mail. We’re currently working on this issue, we hope to have it resolved by next week. Sorry for the inconvenience,

–The Takeout team

So I’ll try again next week and see if its working as expected. But overall not bad support for what is essentially a suite of free tools.

UPDATE 11/30/2013:

Another Googler got back to me and said to try again, and sure enough it worked just fine. Problem solved. Thanks Google. Now get back to keeping the NSA from spying on my appetizer recipes in Google Docs.

Continue reading

Visual Studio using old app.config value or setting

Once in a blue moon, I will run into a problem with Visual Studio 2012 where the App.config for a console application is getting cached somewhere and there’s no way to release it. So the App.config is stuck with old values which aren’t correct for the application today. It’s happened maybe twice this year to me.

The App.config in my solution shows the correct values. The one that’s been put in the output directories for Debug and Release both look good, but my quick little console application is pulling ghost values from an App.config from last week. I’ve tried building, rebuilding, and finally, all to no avail.

The only thing I could think of to fix this ( which did work ) was:

  • Copying the contents of the App.config file from within Visual Studio
  • then delete the file from within Visual Studio
  • Then re-add the config file
  • Then paste in the contents.
  • Rebuild and run.

I’m going to chalk this one up to ghosts in the machine.

Continue reading

Amazon Kindle, Expired Credit Card and Gift Card Balance issue

Ran into a weird problem with the Amazon Kindle in our household. They don’t let you purchase a new book when you have an expired credit card in your one-click setup, even if you have a gift card balance on the account. We couldn’t figure it out on the Kindle, so I had to login to Amazon, delete the expired credit card, and then the purchase went through with no problem via the gift card. It’s funny because with so many of these devices today, when you actually have to break out the computer and go to a website, it feels jarring and old-fashioned.

Continue reading