How to set an Orchard CMS module to be home page with code

This will work for Orchard CMS Version 1.8.

  • Create a new module
  • Create a Routes.cs file in the module
  • Set the RouteDescriptor priority to something high like 99
  • Set the new route url to be an empty string

Here’s some example code for Routes.cs

Continue reading

TL-WA850RE has no internet access

TL;DR – Get the firmware update for the TL-WA850RE at http://www.tp-link.us/support/download/?model=TL-WA850RE&version=V1, unzip it and run the update from within the TPLink setup page.  This solves most problems.  The other handy thing is to change the SSID of this range extender by adding a “2” to the name of your original SSID.

I’ve got a TV that’s just out of range from my wifi router.  Yes, I know, I should get off my lazy butt and just run cat6 thru my whole place.  But in the meantime, I purchased a TP-LINK TL-WA850RE 300Mbps Universal Wi-Fi Range Extender.

I plugged it in and did a manual setup.  I could get devices to connect to it but it took a long time.  Once connected, each device had no internet access whatsoever.  Bummer.  I tried some different configurations of it but the thing that worked the best was just going to the TPLink download site and grabbing the latest firmware.  The firmware on my newly purchased device was like 2 years old.  I’m not sure why they ship it like that.

Once I updated to the latest firmware in the web-based tool for the TPLINK, it still didn’t work as smoothly as I would have liked.  The final two settings I did were under “DHCP” where I set a static IP to be one IP up from my wifi router.  I also tweaked the SSID put out from the TPLINK to have a “2” at the end of my original wifi SSID.

Once I did those three things, the wifi range extender worked to perfection.  I have a great fast signal far away from the wifi router.  It’s fast enough to stream Netflix adequately.

Continue reading

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