theKindOfMe

April 1, 2010

Getting a PropertyInfo from a PropertyDescriptor in .NET

Filed under: Uncategorized — Tags: , , — yasi8h @ 5:57 am
PropertyDescriptor pd;
PropertyInfo pi;

//when pd is actually pointing to some real Property Descriptor object
pi = pd.ComponentType.GetProperty(pd.Name);
Advertisements

January 31, 2010

Notes on setting up devise (authentication solution for rails)

Filed under: Uncategorized — Tags: , , — yasi8h @ 4:38 pm

From Devise’s project page:

Devise is a flexible authentication solution for Rails based on Warden. It:

  • Is Rack based;
  • Is a complete MVC solution based on Rails engines;
  • Allows you to have multiple roles (or models/scopes) signed in at the same time;
  • Is based on a modularity concept: use just what you really need.

I was playing around with devise trying to get it set-up in my app, came through some configuration errors on my part, thought of noting them down for future reference.

NoMethodErrors and NameErrors

  • if you are getting NoMethodErrors for methods such as user_signed_in?, current_user, user_session, admin_signed_in? in your ActiveViews, check your routes.rb file for correct “map.devise_for :”  statements. If you have users and a admin in your system and Users and Admin models in your models. You should have something like this:
    map.devise_for :users, :admin
    
  • If you are getting NameErrors like “undefined local variable or method `edit_user_path' for #….” (could be for new_admin_session_path…etc anything to do with session path) Then check whether you have mapped your controllers correctly on your routes.rb. If you are having a UsersController and a AdminController your routes.rb can have some lines like:
    map.resource :user
    map.resources :admins
    

July 10, 2009

Ever got a exception like “_COMPlusExceptionCode = x” in .net?

Filed under: Uncategorized — Tags: , , — yasi8h @ 6:05 am

In Short:

if you ever get a exception like “_COMPlusExceptionCode = x” in a .net application while you are debugging it in visual studio, look at the following screenshots.

Long Story:

While working on a asp mvc project i got a exception when the EF was trying to save some changes to the db. so i examined the exception object via visual studio’s visual aids. it said _COMPlusExceptionCode = -532459699 ! now what is that?

complusexception while debugging in visual studio

complusexception while debugging in visual studio

after some googling… i felt a bit lost. but by accident i came across the following error message in the same application, in the same line no, for the same exception. a usual ‘exception icon’ or whatever you call it.

a exception icon displayed in visual studio

a exception icon displayed in visual studio

now when i click on that…

visual studio exception infomation dialog been displayed for a update exception

visual studio exception infomation dialog been displayed for a update exception

viola! there is my exception. it seems that visual studio decodes these COM Plus Exception Codes to meaningful exceptions. but at times its easy to miss this way of viewing the exception.

Create a free website or blog at WordPress.com.