IIS7 + MVC5 403 = Forbidden ?

If you’re banging your head against the wall because your MVC5 application does not run on IIS 7, I have the solution for you.

First, let’s quickly go through some basic stuff that you probably read 10x times already, but still usefull to understand if this problem affects you or not.

You got your application deployed, the application pool is set to 4.0 .NET Framework and you didn’t touch the directory privileges (honestly, you don’t need to change folder permissions unless you’re handling files from your code, trust me!) but still you get a 403 error stating that either you don’t have permissions or the server is not set to list the contents of a directory.

The solution, is simple, just open a command promt window and type this:

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

More information on aspnet_regiis.

Photography and Video Class – The End.

About 2 months ago, I wrote about a photography and video class. It was my intention to write about them weekly and turn those posts into some sort of a summary that would form a mini dossier for this class.

But I didn’t had the time.

And it went too fast. Yes.

But it was nice. I learned a few things (a lot less than what I had imagined, but whatever).

Now, I’m only talking about the Photography part of this formation because, the video part was just ridiculous! I wouldn’t recommend those lessons to anyone in all honesty.

Operation is not valid due to the current state of the object.

After deploying one of my applications a user reported this error. This is the type of error I personally hate because the Exception Message is not clear to what object is it referring to.

Anyways, nothing that a quick search on Google couldn’t help. Turns out, there’s a limit for input objects in forms defined in ASP.NET since December 2011 Microsoft security patch to prevent malicious code through injection. To change this limit you have to edit your web.config file and add the following code inside your <configuration> tag.

        <add key="aspnet:MaxHttpCollectionKeys" value="your_value_here" />

Save your file and restart your IIS.

Photography and Video Class – Lesson #1

So today I had my very first class. We went through the very basics of taking a picture.

imageThe process of taking a picture is always split in three moments. Visualize, understand and learning the environment, that will be the first. You shouldn’t be trigger happy and shoot a bunch of picture hoping one will come out perfect or as you idealized it. You have to get involved with your surroundings and learn from it. See what happens, how everything moves. The second one is composition, best angle, best framing. Finally, comes the technical part where you work with light and exposure.

We went through a selection of photos the teacher (Duarte Neves, if you’re interested) chose, discussed and analyzed them. How they were taken, light position, composition etc. The concepts of light and contrast were also explained and he gave us some pratical examples for better understanding.

All in all it was a blast! Can’t wait for the next lessons!

The worst part of it all is the fact that its 11.54pm and I’m on the train home writing this.

Rant of the month

Because the “a picture is worth a thousand words” cliché sometimes just doesn’t cut it and the dictionary itself is rather incomplete to come up with a faithful description of whatever travels through the axons of the human brain, I leave this space _______ open to enter whatever word best describes one of the most disgusting, aggressive and pissed off moments I have ever had. (it will come up, eventually)

(pun intented, ha ha!)

GoDaddy apology: Are You Serious?

Listen, my website is crap. I know that. I do not sell goods or offer any kind of service other than the occasional “waste your time reading my posts”. That being sad (intentional typo here), the damage made was small (more like none) compared to big websites.

From a marketing and customer care perspective, whether I am a big website or not, is meaningless when we are talking about a failure of delivering service which I (the client) am paying for. So I wonder, who was the genious inside GoDaddy that thought sending an email with a 30% discount code for (and here’s the catch!) new purchases or renewals is a decent way to apologize for your service outage?

We are not guests anymore.

Today I read that Google is testing its latest feature for searches: Gmail results. Meaning that if you type something like “eBay great deals” you will get your eBay emails in the search results. Personally, I don’t see much use for it I mean, if I wanted to search through my emails I’d go directly to my gmail. I’ve been using it for years and it always worked flawlessly, so why would I need another place to search for my emails?

Social Networks
Social Networks

The thing is, this is another step from big companies that already own a considerable share of our data to merge our personal data with the rest of the web. (calm down, mail search does not turn your emails public, only you can see them.) Two weeks ago YouTube (owned by Google) started to ask its users to start using their real names in an attempt to decrease the amount of troll comments on videos by linking your YouTube account to your Google+ profile.

Slowly, your real life persona is invading the digital world and you don’t really notice it. The demand just comes to you in a very, let’s call it, natural way. You add your information because it’s actually fashion to have a Facebook profile, a Twitter account, Instagram, etc. – if you don’t have one of these then eventually someone will ask you “What planet are you from?”.

Now let’s gather everything up and what do these websites know about us? They know what you like, what you do, where you are from, where you live, which college you graduated on, who your friends are, where you usually go and who usually goes with you, how old are you, what you do for a living, where you work and ultimately – because most people do have their photo on their profile – they know who YOU are. There is no place on earth gathering so much information about someone like these websites do – unless you are a terrorist and FBI has eyes on you.

Google even knows what websites you usually visit since it tracks you – through the adds they serve on websites, AdSense & AdWords – so they can provide you with more accurate advertisements.

This might sound a little conspiracy-ish, specially if you are one of those people that spend countless hours on social networks, but there was a time when we were just another person walking around the park and nobody knew us, today, as soon as you hit that “Go” button, you put a big sign over your head with a considerable chunk of data about you.

DataGridView and CellFormatting Performance

I recently came across a problem on one of my applications which was causing a huge slow down on its performance.

Just to give you an idea, the application I’m talking about has a DataGridView that takes 80% of the screen which lists a lot of data extracted from a Database. It allows users to use a bunch of different filters to narrow down the results they see on the grid, and they can manipulate the data on it through a context menu strip.
About three weeks ago, a user mailed me saying that lately he was having a hard time using the application because every now and then the window would show blank spots as if the controls had vanished. Long story short, after digging a bit into the problem I realized the issue was directly related to the DataGridView component I had on the window. I am handling the CellFormatting event in order to change row background colors along with a bunch of other things and it is SLOW. So slow that if you have a considerable amount of formatting being done on each row, you can actually see it being painted/redrawn.

So the solution is simple, make use of Double Buffering. It basically renders all graphics to memory prior to show them, rather than rendering them directly to screen thus making the process extremely slow. Now, there is no DoubleBuffered option on the DataGridView component (it is protected) so to work this around, you either make an extension of it OR you change it via Reflection. I prefer the last option, so this is what I have made:

 BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
 new object[] { true });

I added this piece of code to the Form_Load event and the CellFormatting performance issue was gone.

If you're looking for useless, you found it!