Tuesday, February 25, 2014

Codeproject: MVC 5 New Features

Codeproject: MVC 5 New Features

highlights from http://www.codeproject.com/Articles/728216/ASP-NET-MVC-5-New-Features

Find out about   Attribute based routing,, 

blah blah blah....

Attribute based routing in MVC 5


This is where attribute based routing comes in. Using attribute based routing we can define the route in the same place where action method is defined. Following is an example of a route defined using the Route attribute. As you can see the route is directly attached to the action method.
  [Route("Products/Electronics/{id}")]
       public ActionResult GetElectronicItems(string id)
       {
           ViewBag.Id = id;
            return View();
       }     
To enable attribute based routing we need to add the following in the RouteConfig file.
 public static void RegisterRoutes(RouteCollection routes)
        {
            routes.MapMvcAttributeRoutes();
        }  
So now we have attached the Route attribute to our action method our action method will be able to handle the requests which matches the URL pattern defined by the Route attribute.


....

Filter's in MVC

Filters in MVC provide us with an elegant way to implement cross cutting concerns.Cross cutting concerns is the functionality that is used across our application in different layers.Common example of such functionality includes caching ,exception handling and logging.

Cross cutting concerns should be centralized in one location instead of being scattered and duplicated across the entire application.This makes updating such functionality very easy as it is centralized in one location. Filters provide this advantage as they are used to implement cross cutting concerns using a common logic that can be applied to different action methods and controllers.Filters are implemented as classes that contains code that is executed either before the action method is executed or after the action method executes. We can create global or controller filters in MVC 4.Global filters are filters that are applied to all the action methods in the application while controller filters apply to all the action methods in the controller. We can create a global filter by creating a class and registering it as a global filter...

ASP.NET IDENTITY 

Some of the main features of ASP.NET Identity are 
  • It can be used by any ASP.NET framework such as ASP.NET MVC and WebForms.
  • We can easily add third party party authentication providers like google , facebook 
  • We have control of the persistence storage.So we can now store the credentials not only in 
  • the SQL Server database but can also use other persistence  storages like Azure and NoSQL databases. 

Using third party authentication providers the task of authenticating the users can be delegated to a third party site such as google. There are numerous sites that supports openID protocol such as google. With MVC 5 we can use it as part of a newly created project  .....



you can thank this fellow:

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Ashish__Shukla
Technical Lead 
India India
I have a keen interest in technology and software development.I have worked in C#,ASP.NET WebForms,MVC,HTML5 and SQL Server.I try to keep myself updated and learn and implement new technologies.
Please vote if you like my article ,also I would appreciate your suggestions.
Please use the following for more information code-compiled

Friday, February 14, 2014

Android - How To Get Screen Size

Android - How To Get Screen Size

from http://stackoverflow.com/questions/2485697/getting-the-size-of-the-window-without-title-notification-bars

15down voteaccepted
Use View.MeasureSpec.getSize method in onMeasure override.
    @Override
protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)
{
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    int width = MeasureSpec.getSize(widthMeasureSpec);
    int height = MeasureSpec.getSize(heightMeasureSpec);
    ...
}
share|improve this answer
 
Evgeny's answer led me here, which answered the rest of my questions developer.android.com/guide/topics/ui/custom-components.html –  Stanley.Goldman Sep 10 '10 at 0:09
add comment

To accomplish this in my app, I had to find a View's dimensions within the main Activity. It looked something like this:
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    gestureScanner = new GestureDetector(this);   //Object for handling gestures.

    mvView = new MyView(this);  //MyView is class that extends View.
    setContentView(myView);
}

@Override
public void onShowPress(MotionEvent e) {

    //Returns the size of the entire window, including status bar and title.
    DisplayMetrics dm = new DisplayMetrics();
    this.getWindowManager().getDefaultDisplay().getMetrics(dm);

    //Try to find the dimension of the view without the status/title bars.
    int iViewHeight = mvMountain.getHeight();
    int iViewWidth = mvMountain.getWidth();


    Toast toast = Toast.makeText(this," View:" + iViewWidth + ","+iViewHeight + " Window: " + dm.widthPixels + " by " + dm.heightPixels, 2);
    toast.show();
}
share|improve this answer
add comment

I have a tutorial on my blog that give you the ability to save your screen size on launch, You can read it here: http://evgeni-shafran.blogspot.com/2011/01/android-screen-size-problem.html
Basicly you need to overide an onMeasure method of the first layout that hold you full screen, and get the width and height from there
share|improve this answer
add comment

have a look at getwidth() and getheight() maybe? that should give you the size of the screen. though, I don't know If it takes the bars or not. But I don't think so...
share|improve this answer
1  
Which getWidth/getHeight methods are you talking about? I might not have been clear enough in the question, sorry. I'm developing for Android, not BlackBerry, so Screen.getWidth() isn't what I'm looking for. –  Victor Mar 22 '10 at 1:02
 
getwidth does not apply to the screen but to a view or layout. (I understood you were on android as you tagged your question so ;)) So if you put for instance a Relative layout with attributes fill_parent for its width and height and do getwidth and getheight in your code, I think it should give you satifaction –  Sephy Mar 22 '10 at 7:44
add comment

in the first onDraw, call getWidth, getHeight. these will not be valid before then.
if you are not using a custom view/layout then you can instead call getWidth/getHeight during the first onWindowFocusChanged

Thursday, February 13, 2014

How To Quit Android Application - You Don't

  1. How To Quit Android Application - You Don't

  2. How to quit android application programmatically - Stack Overflow

    stackoverflow.com/.../how-to-quit-android-application-...
    Stack Overflow
    Jun 13, 2011 - Is it good way to quit the app in Android? ... There are so many posts already here. stackoverflow.com/search?q=how+to+exit+an+android+app  ...
  3. android - Quitting an application - is that frowned upon? - Stack ...

    stackoverflow.com/.../quitting-an-application-is-that-fro...
    Stack Overflow
    Jan 3, 2010 - No matter what you dodo not put a "quit" or "exitapplication button. It is useless with Android's application model. This is also contrary to how  ...
  4. How to exit or quit android application? - Stack Overflow

    stackoverflow.com/.../how-to-exit-or-quit-android-appl...
    Stack Overflow
    Apr 3, 2011 - I have created an sample application for android and tested it in my htcandroid mobile. I want to know how to exit the applicationcan anyoneQu

Meaning of Java @Override

Meaning of Java @Override

found here: http://stackoverflow.com/questions/4736212/meaning-of-android-override

@Override is a Java annotation. It tells the compiler that the following method overrides a method of itssuperclass. For instance, say you implement a Person class.
public class Person {
   public final String firstName;
   public final String lastName;

   //some methods

   @Override public boolean equals(Object other) {
      ...
   }
}
The person class has an equals() method. The equals method is already defined in Person's superclassObject. Therefore the above implementation of equals() is a redefinition of equals() for Persons. That is to say, Person overrides equals().
It is legal to override methods without explicitly annotating it. So what is the @Override annotation good for? What if you accidentally tried to override equals() that way:
public boolean equals(Person other) {
   ...
}
The above case has a bug. You meant to override equals() but you didn't. Why? because the real equals() gets an Object as a parameter and your equals() gets a Person as a parameter. The compiler is not going to tell you about the bug because the compiler doesn't know you wanted to override. As far as the compiler can tell, you actually meant to overload equals(). But if you tried to override equals using the @Override annotation:
@Override public boolean equals(Person other) {
   ...
}
Now the compiler knows that you have an error. You wanted to override but you didn't. So the reason to use the @Override annotation is to explicitly declare method overriding

Wednesday, February 12, 2014

Minnesota Minneapolis Rochester Software Computer Jobs

Minnesota Tech Computer Jobs

Employers