October 2012 | Coding Cluster - using asp.net, c#, mvc 4, iphone, php, ios, javascript, in asp.net mvc 3 & more
 

Offline storage using Indexeddb / browsers to support IndexedDb

Monday

What is IndexedDB?
                   An IndexedDB is basically a persistent data store in the browser — a database on the client side(offline storage). Like regular relational databases, it maintains indexes over the records it stores and developers use the IndexedDB JavaScript API to locate records by key or by looking up an index.

IndexedDB API is a specification for an index database which exists in the browser. The IndexedDB is made of records holding simple values and hierarchical objects. Each of the records consists of a key path and a corresponding value which can be a simple type like string or date and more advance types like JavaScript objects and arrays. It can include indexes for faster retrieval of records and can store large amount of objects.

Which browsers (chrome/opera/firefox/IE...) to support IndexedDb?

Preliminary support for Indexed DB is included by Firefox (since version 4), Google Chrome (since version 11), and by the Internet Explorer 10 Consumer Preview and Metro style apps.
Safari, Chrome 4 and Opera support an alternate mechanism for client-side database storage called Web SQL Database.

Summary of browsers with full support.

Chrome: Version 11 onward

Opera: No current or planned support

Firefox: Version 4 onward

For good measure, IE: Version 10 onward

Compatibility table for support of IndexedDB in desktop and mobile browsers.

http://caniuse.com/indexeddb


If you new to indexedDB concept you must know about the following concepts,

WHAT IS INDEXEDDB?

WHY INDEXEDDB?

How to Opening the database in indexedDB?

INDEXEDDB - Creating an object store

ADDING DATA TO AN OBJECT STORE Adding data to an object store

QUERYING THE DATA IN A STORE.

RENDERING DATA FROM AN OBJECT STORE

DELETING DATA FROM A TABLE

for all above questions html5rocks have the solution with live demo


Fading / Blinking rounded corner button only with pure css(without image)

Wednesday

Css only Rounded corners Opacity Gradient buttons:
                                        This is the source code for, No JavaScript, No Images, No Flash - CSS Only! Blinking round corner button.

source code for css only rounded corner fade button

<html><head>
<style>
nav a#blink {
padding: 10px 10px;
margin-right: 10px;
margin-bottom: 5px;
border-radius:20px;
display: inline-block;
color: #421f00;
background-color:#e6a560;
background: -moz-linear-gradient(
top,
#e6a560 0%,
#ca6609);
background: -o-linear-gradient(
top,
#e6a560 0%,
#ca6609);
background: -webkit-gradient(
linear, left top, left bottom, 
from(#e6a560),
to(#ca6609));
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e6a560', endColorstr='#ca6609');
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border: 1px solid #ffd5ab;
-moz-box-shadow:
0px 1px 3px rgba(000,000,000,0.5),
inset 0px 0px 2px rgba(66,31,0,0.7);
-webkit-box-shadow:
0px 1px 3px rgba(000,000,000,0.5),
inset 0px 0px 2px rgba(66,31,0,0.7);
text-shadow:
0px -1px 0px rgba(171,87,13,0.4),
0px 1px 0px rgba(255,255,255,0.3); 
opacity:0.7;
-webkit-animation-name: buttonPulse;
-webkit-animation-duration: 4s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
}

@-webkit-keyframes buttonPulse { 
0% { opacity: 0.5 }

50% { opacity: 1 }

100% { opacity: 0.5 }
} 
</style>
</head>
<body>
<nav role="navigation">
<a href="http://codingcluster.blogspot.in/2012/10/fadeblinking-rounded-corner-button-only.html" id="blink">Hay Look at my skin</a>
</nav>
</body>
</html>

Demo:

MVC 3: Bind View page with more than two model classes

Friday

ASP.NET MVC 3: How to call two model class in to a single view(.cshtml)
                                             This is the sample code for load two  model class in to a single view in asp.net mvc 3. To do this you just create a composite class with both objects as its properties:

In Model
public class MoviePersonModel
{
public MvcContrib.Pagination.IPagination<MvcContrib.Samples.UI.Models.Person> Person{ get; set; }
public MvcContrib.Pagination.IPagination<MvcContrib.Samples.UI.Models.Movie> Movie{ get; set; }
}

initialize the class and apply to view.

In View
@model urNamespace.MoviePersonModel

//and access its properties: @Model.PersonModel

Please share this post with your friends. If it's useful to you. Thanks!.

ASP.NET MVC: Action Names & NonAction method (ambiguous between error the action methods)

Tuesday

MVC Case Sensitivity & Action Names & NonAction Attribute
                                                  In MVC URLs not being case sensitive. For example if you have the request “Home/About” this goes to HomeController and About action, as well as hOmE/AbOUT is going to the same controller and same action method.

Suppose if you have two about action methods in the same controller with different cases such as:

public class HomeController:Controller{
    public ViewResult About()    {
        return View();
   }
    public ViewResult aBOut()
    {
        return View();
    }
}

You will get "ambiguous between the action methods ".
when I call action method About using following url http://your applicationname/Index/ABOUT I got this server error



This means, The framework doesn't determine which "about" function to call, and throws the exception telling that the call is ambiguous. To fix this problem is to change the action name. If for some reason you don’t want to change the action name, and one of these function is not an action, then you can decorate this non action method with NonAction attribute. 

Example:

[NonAction]
public ActionResult aBOut()
{
   return View();
}
Please share this post with your friends. If it's useful to you. Thanks!.

ASP.NET MVC 4: Error during serialization or deserialization using the JSON / Changing maxJsonLength property in web.config

JSON serialization error [maxJsonLength property.]
                 In my previous project I need to retrieve ticket from Web service.When I request the web service it return a ticket as JSON format.Some time I need to retrieve more than 10 lacks ticket per requet.In that time I got the following error.

Error:
Exception information:
Exception type: InvalidOperationException
Exception message: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.


Solution:
To solve this issue We need to set Maximum allowed length of json response in Web.config file 
The MaxJsonLength property cannot be unlimited, is an integer property that defaults to 102400 (100k).

You can set the MaxJsonLength property on your web.config like 

<configuration> 
   <system.web.extensions>
       <scripting>
           <webServices>
               <jsonSerialization maxJsonLength="50000000"/>
           </webServices>
       </scripting>
   </system.web.extensions>
</configuration> 
Please share this post with your friends. If it's useful to you. Thanks!.

 
 
 

RECENT POSTS

Boost

 
Blogger Widgets