Saturday, November 17, 2012

Solve The You don't have permission to access / on this server. Error On Apache

I am going to keep this short and simple.
When installing Wordpress on an Apache server, you may get a 403 error. Specifically, you might get this error when you try to access your site after an install.

You don't have permission to access / on this server.

This is so simple to solve. You simply have to enable script permissions on the serve. If you are on a host like Godaddy, this means that you go to the folder, select permissions and make sure the folder has Read and Execute permission for web users and Read, Write and Execute permissions for the Owner.

Simple right?

Smooches,

Kila Morton

Saturday, September 22, 2012

How To Reset Your Brother HL-2240 After Toner Refill And How To Get Rid Of The Toner Light On The Brother HL-2240 When You Have Toner In The Machine

Printer companies want to make money. There is nothing wrong with that. I think ALL of us want to make money. However, there is a problem when a printer company is trying to take YOUR money when you don't want to part with it. Brother makes excellent small office laser printers. They make other larger office printers, but their small office laser printers are extremely easy to maintain and they last a very long time. The one issue they have is that Brother cartridges are ridiculously expensive. I say they are ridiculously expensive because, in my case, they cost more than I paid for the printer! I REFUSE to buy a cartridge that cost more than I paid for the printer! The only problem is that if you refill the toner cartridge that came with the printer (which you can do forever by the way - without replacing any gears or anything crazy like that), the toner light will stay on and you still won't be able to print. Well I have a solution for that!

I am going to show you how to reset your Brother HL-2240 when the toner light comes on. This will allow you to use generic toner cartridges without jumping through crazy hoops and it will allow you to simply refill the Brother cartridge your printer came with over and over again. You don't need reset gear that some companies sell and you CERTAINLY DO NOT need to buy expensive cartridges that Brother sells. I love Brother, but I don't love spending more than the cost of the printer when I need more toner. That is money better spent at the shoe store :-).

If you need toner refills, click on one of the links in the sidebar to find what you are looking for.

Here we go. Here is how you reset the toner light on your Brother HL 2240:

1. Turn your Brother HL-2240 off

2. Open the front cover of the printer

3. Press and hold Go and turn power on. Do not let the button go.

4. When all 3 lights light up, release the Go button.

5. Press the Go button twice (You will see the Ready light blink green every time you press the Go button)

6. All of the lights will light up

7. With all of the lights on, press and release the Go button 5 times  (You will see the Ready light blink green every time you press the Go button)

8. The Error light will start blinking (Don't be alarmed. This is expected.)

9. Close door and wait. The printer will cycle through and make the sound it makes when you initially cut it on. After that sound stops, your green Ready light will be on and solid.

10. You are now ready to print.

So there you go! Support the Brother corporation because they make fantastic printers! Go out and purchase a Brother HL-2240 printer - they are great -, BUT keep your hard earned money in your pocket when it comes to refilling your toner. Buy your toner off of eBay and refill the Brother cartridge that came with the printer. You will save yourself a TON of money over the long haul.

UPDATE - 7/3/2013  - BHL2 MAINTENANCE MODE                                                          
If you are having an issue in addition to the Toner reset problem, have mistakenly placed your printer into maintenance mode by pressing the Go button an incorrect number of times or you are encountering another problem, you can try resetting the printer to the factory default settings.

To perform a factory reset on your Brother HL-2240, you can  follow these instructions:
  1. Check that the front cover of the printer is closed.
  2. Turn OFF the power switch on the right side of the printer.
  3. Press and hold the GO button, and keep holding it down, as you turn on the power switch.
  4. Keep the GO button pressed down until all the LEDs light up and the Ready LED turns off. Release the GO button. Make sure that all the LEDs turn off.
  5. Press the GO button 10 times. The Ready LED will flash while the printer is reset. After the printer is reset the Ready LED will be lit.

Smooches,
Kila Morton


Problem:
The toner light on your Brother HL-2240 is on.
You need to reset your Brother HL-2240.

Solution:
Follow the steps listed above.

Seeing the BHL2 Maintenance Mode message?
Reset your printer using the steps outlined above and THEN follow the instructions to reset your toner cartridge.

Monday, August 6, 2012

How To Solve Type 'ASP._Page__ViewStart_cshtml' does not inherit from 'System.Web.WebPages.StartPage'

OK. So you are using Asp.Net MVC 3 or 4 (or maybe even 2). You have created several Areas in your project and you have decided to move your _ViewStart.cshtml file to your root directory so you are adhering to the DRY principal and all of your Views in the main area of your site AND in your Areas will use it. You add the file to the root and you are really happy with yourself. There is just one problem. After you run your beautiful project, you get a nice big yellow screen complete with the following message -


Type 'ASP._Page__ViewStart_cshtml' does not inherit from 'System.Web.WebPages.StartPage'.

Great! Now what? The solution to this issue is simple. When you create an Area in an MVC application, the following information is automatically added to your web.config.

 
<configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
  </configSections>

  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>  

 

However, when you move that _ViewStart.cshtml file to the main area of your site, your main web.config does NOT have those areas in there already. You have to add them! Once you add those items to your web.config, you will be good to go. Add those sections, rebuild your project and now your Area Views and your main Views will all use the _Viewstart.cshtml file.


Problem:
You moved your _ViewStart.cshtml file to the root of your site and got the following error:

Type 'ASP._Page__ViewStart_cshtml' does not inherit from 'System.Web.WebPages.StartPage'.

Solution:
Add the following to your web.config file and recompile your application.

  <configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
  </configSections>

  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>

 

That's it!

Smooches,

Kila Morton

Thursday, May 24, 2012

Solved: Azure Problem - There was no endpoint listening at that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details

OK. This little problem almost gave me a heart attack today. Thankfully, I have a strong heart.

Today I went to do an Azure deployment using Visual Studio. I have done this many times, so I anticipated my deployment going without a hitch. Boy was I wrong. You see earlier on in the day, I had a strange thing happen to me. Fiddler, which I love, crashed on my computer. I didn't think much of it at the time. However, it came back to haunt me in unexpected ways. Anyway, I tried to do the Azure deployment and I got a nice, fat error -



Error      1              Could not get the Windows Azure storage account settings for 'dc2assetsemea' needed to configure an application module. Please check your network connection and verify that the account exists. Details: There was no endpoint listening at https://blah/blah/blah/keysthat could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.                

What? What in the world was THAT about! I have NEVER seen that error before. Now let me preface the rest of this post with this - I was in a time crunch and I needed this build up and running like John Edwards and Tiger Woods need image makeovers! I tried to use Cloud Xplorer to load some UI files and guess what? Nada! OMG! I had to take a deep breath and start digging. I couldn't find much of anything for a solution on this issue using my friend Google and Microsoft didn't have anything either. I came across an obscure entry by someone on Stack Overflow who asked about Fiddler. That got me thinking about the crash I had earlier in the day. I started researching Fiddler. Well, it turns out that Fiddler can and does screw a lot of things up if it crashes before it has a chance to run its process to reset your proxy settings. You could go from sailing on the Internet to not being able to get on at all. In my case, I could still get on the Internet using Firefox, but not IE. 

I went to my Internet settings to see what was there - Control Panel / Internet Options / Connections / Lan Settings. Well, well, well. There was NOTHING checked. Fiddler had fiddled me! I changed the proxy settings to Auto Detect and then I was back in business! WhooHoo! Yeah! So there you have it. When Fiddler hands you lemons, make a 4 course meal and then change your Internet Settings back to Auto Detect (or whatever they were) so you can get on with it!

Smooches,

Kila Morton

PROBLEM:

When using Visual Studio to deploy you get the following error -
Error      1              Could not get the Windows Azure storage account settings for 'dc2assetsemea' needed to configure an application module. Please check your network connection and verify that the account exists. Details: There was no endpoint listening at https://blah/blah/blah/keysthat could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.    

SETTING:

Reset your Internet connection proxy settings.
On a Windows machine, go to Control Panel / Internet Options / Connections tab / Lan Settings and change the proxy to Auto Detect. Save everything and try your deployment again.

Friday, May 18, 2012

Solved "The cast to value type 'Int32' failed because the materialized value is null. Either the result type's generic parameter or the query must use a nullable type" When Using LINQ

I love LINQ! Do you know that about me? Actually, I REALLY LOVE LINQ! It is so useful for so many different queries. It really eliminates the need to have query code outside of your application sitting in a database. Of course, you have to make sure that your queries are generating good SQL, but it is really useful and a beautiful tool. With that said, you can run into moments when LINQ generates errors that don't offer immediate information on how to solve them. One of my queries generated an error. The fix was extremely simple so I thought I would include it here for anyone that has the same error.


When you are trying to use an aggregation (i.e. sum, max, min, etc), you might come across this issue. The issue is that you might have a time when you have no records in your database. Therefore, something like a sum would return null. What is a programmer to do? Ooh I know, I know! Use DefaultIfEmpty(0)!


There you have it! Problem solved! Now say some nice things about me in the comments....or not.


Smooches,


Kila Morton


*******************************************************************************


PROBLEM:


When using a LINQ query, you get the following error -
The cast to value type 'Int32' failed because the materialized value is null. Either the result type's generic parameter or the query must use a nullable type


Example bad query -

var iAddToValue = (from prod in db.Lists.Where(x => x.AccountId == list.AccountId)
                                     select prod.DisplayOrder)
                                     .Max() + 1;





SOLUTION
Add a DefaultIfEmpty(0) to your query.


Example good query -

var iAddToValue = (from prod in db.Lists.Where(x => x.AccountId == list.AccountId)
                                     select prod.DisplayOrder).DefaultIfEmpty(0)
                                     .Max() + 1;

Sunday, May 13, 2012

The "Default Membership Provider could not be found." Error Solved!

I recently decided to create new membership providers for all of my new projects. I wanted new providers that all used Entity Framework. I decided to do this after looking around and finding a couple of custom Entity Framework providers that were OK, but were either incomplete, too convoluted or did things in ways that I considered unnecessary.

My providers initially worked perfectly. The system created my database tables for me using my DbContext and added my Application name to my Applications table using code I created that was supposed to run the first time the application hit the Home Controller. However, after creating my beautiful new providers and navigating to the Registration page, I came across an error:

"Default Membership Provider could not be found."

This error was strange for a couple of reasons. First, I was using my new providers in an ASP.Net MVC application to test it. All of my tables were created perfectly in the database, so I knew that my custom provider was being hit. I could also see that the Initialize event was being hit when I debugged. Second, the error wasn't raised the first time I used one of the processes in the provider. Instead, it was raised the first time I went to the Register page which uses the default ASP.Net MVC account/Register controller. Hmmm....interesting. I looked at the configuration settings in the web.config.

My configuration for my  new providers started with this -


<membership>
      <providers>
        <clear/>
        <remove name="AspNetSqlMembershipProvider"/>


And therein lies the problem. It seems like we should clear out all of the provider information first. However, that is unnecessary. We don't need to clear out the providers and remove the default providers. I thought we did because the configuration settings for all ASP.Net applications include that clear tag. So if the default ones include it, I thought I had to do the same. Wrong! When you roll your own providers, you need to remove that clear tag and you don't need to add a remove tag! I removed the tag and everything started working. Now when I come across something that is solved in such a simple way, I get suspicious. Removing that tag seemed to simple so I did a search to see what other people were doing.

You will see a few things when you do a search for the error -
"Default Membership Provider could not be found."  
  1. You will see people tell you that you need to clear all providers. This is wrong. You don't have to do this. 
  2. You will see people tell you that you need to clear all providers and specifically remove the default provider. This is wrong. You don't have to do this. 
  3. You will see people tell you that you need to add a defaultProvider tag to YOUR provider configuration code. this is also wrong and you don't need to do this.  
  4. You will see people tell you that you need to add your assembly name to the type attribute in YOUR provider configuration. This is also unnecessary and you don't need to do this. (i.e. they will tell you to do something like this type="YourNamespace.YourProfileProviderClassnameGoesHere", "YourAssemblyName"> which is totally unnecessary)
  5. You will see people tell you to do ALL of these things and that is also wrong and you don't need to do this!
You don't need to do ANY Of those things! No one tried to just remove the clear tag. My simple solution was the best solution in this situation. The clear tag clears out all of the provider information which isn't necessary at all. Removing that should solve your problem IF your Initialize event IS being hit - which you can tell if you debug your provider. Here is an example of my configuration tag for my custom providers. Feel free to copy them and use them for your custom providers.


<membership defaultProvider="CoreMembershipProvider">
      <providers>
        <add connectionStringName="ApplicationServices"
             tablePrefix="Core_"
             passwordFormat="Encrypted"
             enablePasswordRetrieval="false"
             enablePasswordReset="true"
             requiresUniqueEmail="true"
             requiresQuestionAndAnswer="false"
             maxInvalidPasswordAttempts="3"
             minRequiredPasswordLength="6"
             minRequiredNonalphanumericCharacters="0"
             passwordAttemptWindow="10"
             applicationName="TestApp"
             name="
YourMembershipProviderClassnameGoesHere"
             type="
YourNamespace.YourMembershipProviderClassnameGoesHere" />
      </providers>
    </membership>
    <profile>
      <providers>
             name="YourProfileProviderClassnameGoesHere"
             type="
YourNamespace.YourProfileProviderClassnameGoesHere" />
             connectionStringName="ApplicationServices"
             tablePrefix="Core_"
             applicationName="TestApp" />
      </providers>
    </profile>
    <roleManager enabled="true"
                 defaultProvider="CoreRoleProvider">
      <providers>
        <add connectionStringName="ApplicationServices"
             tablePrefix="Core_"
             applicationName="TestApp"
             name="YourRoleProviderClassnameGoesHere"
             type="
YourNamespace.YourRoleProviderClassnameGoesHere" />
      </providers>
    </roleManager>

   


That is it! You don't need to add extra things or jump through extra hoops. Just remove the clear tag or the clear and remove tag and you will be all set! You will be "providing your provider" in no time! ("Providing your provider" - I crack myself up!)


Smooches!
Kila Morton


********************************************************************




PROBLEM:


After creating custom providers, you get the following error when you try to use them.


"Default Membership Provider could not be found."




SOLUTION:


Remove the tag and the tag if you are using them. Also make sure you don't have items in your provider configuration that are in this list. You don't need any of them.



  1. Remove the tag
  2. Remove the tag 
  3. Remove the attribute from your provider tag.
  4. Remove the assembly name from your type tag - if you added it. Your type tag should look like  this type="YourNamespace.YourProviderClassnameGoesHere".



Recompile your project and run it.
You should be good to go!


Here are the configuration settings I use for my provider.



<membership defaultProvider="CoreMembershipProvider">
      <providers>
        <add connectionStringName="ApplicationServices"
             tablePrefix="Core_"
             passwordFormat="Encrypted"
             enablePasswordRetrieval="false"
             enablePasswordReset="true"
             requiresUniqueEmail="true"
             requiresQuestionAndAnswer="false"
             maxInvalidPasswordAttempts="3"
             minRequiredPasswordLength="6"
             minRequiredNonalphanumericCharacters="0"
             passwordAttemptWindow="10"
             applicationName="TestApp"
             name="
YourMembershipProviderClassnameGoesHere"
             type="
YourNamespace.YourMembershipProviderClassnameGoesHere" />
      </providers>
    </membership>
    <profile>
      <providers>
             name="YourProfileProviderClassnameGoesHere"
             type="
YourNamespace.YourProfileProviderClassnameGoesHere" />
             connectionStringName="ApplicationServices"
             tablePrefix="Core_"
             applicationName="TestApp" />
      </providers>
    </profile>
    <roleManager enabled="true"
                 defaultProvider="CoreRoleProvider">
      <providers>
        <add connectionStringName="ApplicationServices"
             tablePrefix="Core_"
             applicationName="TestApp"
             name="YourRoleProviderClassnameGoesHere"
             type="
YourNamespace.YourRoleProviderClassnameGoesHere" />
      </providers>
    </roleManager>
   

PLEASE NOTE - I have a custom field in my provider for the table prefix. REMOVE THIS unless you have the same thing in your provider!

Tuesday, February 21, 2012

How To Add Trusted Sites In Google Chrome

Recently, someone asked me how to add trusted sites to Google Chrome. Since the process isn't as clearly indicated in Chrome as it is in Internet Explorer, I thought I would blog about it.

  1. In Google Chrome, click on the little wrench in the right hand side of the browser to get to the main menu.
  2. Click on Options
  3. Click on Under the Hood located on the left-hand menu
  4. Scroll down to Network and click on Change proxy settings...
  5. A familiar menu will pop up. Click on the Security tab.
  6. Click on Trusted Sites, which is identified by the green check mark, and then click on the Sites button that comes up
  7. Type in the name of your trusted site
  8. Click the Add button
  9. Click the Close button
  10. Click the OK button

Wasn't that simple??? LOL.....


UPDATE: [October 17, 2012]
I first published this in February 2012. It was the process at that time. I should have labelled it with the version information. Here is the latest process :

Applies To Version : Google Chrome Version 22.0.1229.94 m

  1. In Google Chrome, click on the little icon with 3 lines on the far right hand side of the address bar.
  2. Click on Settings
  3. Click on Show Advanced Settings
  4. Click on  Change proxy settings
  5. A familiar menu will pop up. Click on the Security tab.
  6. Click on Trusted Sites, which is identified by the green check mark, and then click on the Sites button that comes up
  7. Type in the name of your trusted site
  8. Click the Add button
  9. Click the Close button
  10. Click the OK button



Smooches!

Kila Morton