:::: MENU ::::

Validation in Asp.Net MVC and Partial Views

Today I stumbled upon a problem where the validation for a form stopped working. The form was rendered using a partial view. I tried to google validation problems in MVC 4/5, but every solution I found wasn’t relevant for my problem. Finally I found this page and a solution to my problem. The problem was that I passed a ViewDataDictionary to my partial view and therefore the original ViewData didn’t get passed to my partial view.

Validation not working:

Workaround that works:

So if you ever come across this problem, make sure you append your value to the original ViewData dictionary and not only pass a new instance of a ViewDataDictionary.

 

 


Language specific forms in EPiServer 7

When working with Asp.Net MVC it’s pretty common to use a Html extension method called BeginForm. But if you’re using that method when working on a EPiServer 7 MVC site it’s important to remember that the method BeginForm isn’t language specific. That means if you’re having more than one language version of a specific page the rendered form tag will use the url of the default language of the page.

The solution

Luckily the solution is simple, you just need to pass the current language code as a route value. One way of doing this is to simply add the value yourself everywhere you’re rendering a form,

This suggestion was found on EPiServer world forum.

Another way is to write some new extensions methods. I think this is a more convenient solution because you don’t have to remember to manually pass the language value every time. So these are the extension methods I came up with that covers all the way we’re rendering forms.

I named the extension methods to BeginFormWithCurrentLanguage to make it obvious what they are doing.

 

 


SEO for apps, why and how!

I released my first real app for Apples iPhone about six weeks ago. When I released it I didnt know much about the app store and how to optimize my app for visibility. It soon became obvious to me that I needed some kind of tool to keep track on both my own app and also my competitors.

Is SEO for apps really needed?

For years web site owners been trying to get to the top on Google by using SEO. In todays business when almost everything happens online it’s crucial to be visible for customers on the internet. The same applies also to Apples App Store and on Google Play. If you’re app is not visible how could you expect anyone to download your app. Did you know there’s almost 1 billion apps on App Store? So is it even possible to be visible when theres already so many apps? Sure it is, you just need to optimize you app for the app store (or Google Play).

ASO, App Store Optimisation

App Store Optimisation is how you optimize various elements of your app (i.e. title, keywords, description) in order to maximise your app’s visibility in app store searches. So how do you optimize your app? No one really knows the exact algorithm Apple is using but these are the things that Apple’s using when a user searches for an app and in what order the app appears,

  • App title
  • Keywords
  • Publisher / developer name
  • Number of reviews
  • Number of downloads

Of course it’s also very important to have an appealing icon and a selling description of your app, but these thing is important for the users and not for Apple.

So how do you do it?

I’m only starting to scratch on the surface of ASO, but already I’ve noticed how ASO really affects the number of downloads and app store ranking. And in a positive way. I found a great service called SensorTower that’s really really useful when it comes to ASO. Before I started to work on optimizing my app I was ranked on place 100+ for the search term “Calorie counter”, thanks to SensorTower I managed to climb up to place 53 simply by adding a few keywords.

skarmavbild-2013-09-21-kl.-21.00.53

As you see from the screenshot, on september 18th I was ranked on place 72. On september 19th I released a new version of the app that’s mostly changed the title and the keywords. Guess what? The day after the new version was released I’ve already climbed up to place 53, simply by tweaking the title and keywords.

 

I’ve learned that one of the most important thing when it comes to ASO is to know you competitors, what keywords they’re using, how many downloads they have and so on. To collect all this information manually is virtually impossible. So I must say that one of my absolutely favorite features of SensorTower is thats it’s so easy to compare your app to your competitors apps and also how SensorTower helps you find new competitors to keep track of.

skarmavbild-2013-09-21-kl.-21.13.46

The last feature that I’ve been using a lot is the keyword optimizer, SensorTower actually helps you optimize the keywords you’re by giving you suggestions how to improve them and also suggests other keywords. You can also see the total traffic a specific keyword has, how many apps that shows up on app store when someone is searching for that particular keyword and how difficult it is to rank high on that keyword.

keywords

 

Conclusion

I’ve been using SensorTower for little over a week now and I already feel that it’s paid off! Compared to what you get I think the service is a bargain. I don’t think it matters if you’re a small indie developer or a huge app company,SensorTower is a must when it comes to ASO!

 


Problem with curly brackets in Visual Studio when using ReSharper 8 and Parallels

Today I installed the update to ReSharper 8. One thing I noticed was that I no longer could write curly brackets in visual studio. Luckily I found a solution pretty quick.

The problem was that the combination running visual studio using Parallels (from Mac OS X) and installing ReSharper. I’m not sure this applies to all keyboard layouts but for me, using a windows keyboard and swedish layout, to type curlly brackets I use the keyboard combination ‘SHIFT + Alt Gr + 8′ / ‘SHIFT + Alt Gr + 9′.

The problem

The problem is that ReSharper adds a keyboard shortcut that uses exactly the same keyboard combination, ReSharper uses that combination for something called ‘ReSharper_EnableDaemon’. If you’re curious to know more about what daemons is used for in ReSharper, I suggest you take a look at this page in JetBrains blog.

The solution

The solution is very simple,

  1. Open Tools -> Customize in Visual Studio
  2. Press Keyboard..
  3. Write ‘Resharper_EnableDaemon’ in the field ‘Show commands containing’.
  4. Select the command in the list and press the remove button.
  5. Voilà, you can type curly braces again.

The solution was found on StackOverflow.


Install EPiServer 6 R2 on Windows 8, IIS8 and SQL Server 2012

If you try to install EPiServer 6 R2 on a Windows 8 computer with IIS8 and SQL Server 2012 you will run in to some errors. 

Important update:
If you need to install EPiServer 5 also, make sure you install EPiServer in correct order, first 5, then 6 and last 7. EPiServer 5 checks OS version so you’ll need to remove that check. Follow the steps bellow.

EPiServer 6 R2

The first problem is that EPiServer doesn’t recognize IIS8, to fix this simply edit a value using RegEdit to trick EPiServer that you’re running IIS7 instead of IIS8.

  1. Open RegEdit
  2. Navigate to ‘HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\InetStp\’ (x64) otherwise ‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\’.
  3. Change the value for MajorVersion from 8 to 7.

The second thing you’ll need to fix is to add a system stored procedure that EPiServer depends on. This stored procedure was removed by Microsoft in SQL Server 2012. Luckily it’s very easy to add this stored procedure running a query in SQL Management Studio. Simply copy the text from this file and paste it in a query and execute. If everything worked as it was supposed to you should now have a stored procedure in System ‘Databases/master/Programmability/Stored Procedures’ called dbo.sp_dboption.

Now you should be able to run EPiServer 6 R2 succesfully.

I take no credit what so every for this guide, I found all information at Paul Nezhencev’s blog.

 

EPiServer 5

  1. Install Orca
  2. Edit EPiServerCMS.msi in Orca and remove the following lines ‘CA_Err_SqlServerNotInstalled’, ‘CA_Err_IIS7NotInstalled’, ‘CA_Err_NET35Sp1NotInstalled’, ‘CA_Err_NET2Sp2NotInstalled’ and ‘CA_Err_UnsupportedOSVersion’, you’ll find these lines under the table CustomAction.
  3. Do the same for EPiServerShared.msi
  4. Run EPiServerShared.msi and then EPiServerCMS.msi
  5. Now you should have EPiServer 5 R2 running on Windows 8.

This was found at Jacob Khan’s blog at EPiServer labs.


Activate Windows 8 in Parallels 8

How to activate Windows 8 running in Parallels 8 on a mac

Today I stumbled upon a problem activate Windows 8 when running inside Parallels 8 on a mac. The license key I have is legit and is not an upgrade key. But still I had some problems when I tried to activate windows. The error I got was this,

Code:
0xC004F061

Description:
The Software Licensing Service determined that this specified product key can only be used for upgrading, not for clean installations.

The solution was pretty simple but not very obvious.

 

1. Open RegEdit and navigate to HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/Setup/OOBE/

2. Change the value for MediaBootInstall from 1 to 0

3. Open a command prompt, run as administrator

4. Type “slmgr /rearm” and hit enter.

5. Reboot windows

6. Run activation guide (Type SLUI in start menu/metro view)

7. If windows is not already activated then, enter your serial number.


Update to List.Contains in RavenDB

Update to my original blog post how to perform List.Contains in RavenDB, this time for RavenDB 2.0 

In my original blog post I was showing how to make a List.Contains query in RavenDB 1.0. Now when RavenDB 2.0 is released I’ve got some more examples on how to write List.Contains queries in RavenDB.

Take a look at some tests I wrote for RavenDB 2.0,
https://github.com/ayende/ravendb/blob/master/Raven.Tests/MailingList/WhereInTests.cs

Actually it’s now even easier to write that kind of queries,

 Hopefully you find this useful!


List.Contains in RavenDB

How to perform a List.Contains query in RavenDB using Lucene. 

Let’s say you have a model and a index that looks like this,

Model:

 Index:

You then want to query RavenDB to get all users that have ‘accounts/1′ in their list of accounts (AccountIds). The obvious thing to try first should be,

But that will throw an exception ‘NotSupportedException, Contains is not supported’. So what you need to do is to make a lucene query instead, like this:

I’m not sure if this is the best way to do a “contains” query in RavenDB but at least for my purpose it works! Please let me know if you have a better way of doing this type of query in RavenDB.