Posts

Insert Data using Jquery in ASP.NET Mvc2

Its simple single form page which includes -  Fullname -  Age -  Save Button On Save button click , you will get message using JQUERY in ASP.NET MVC2 Models :   [Serializable ] public class UserModels {   public string Name { get ; set ; }          public int Age { get ; set ; }   public string message { get ; set ; } } Controller : public ActionResult Index() {     return View(); } [HttpPost ] public ActionResult Save( UserModels inputModel) {     string message = string .Format( "Created user '{0}' in the system." , inputModel.Name);     return Json( new UserModels { message = message }); } Views :   <asp : Content ID ="Content2" ContentPlaceHolderID ="MainContent" runat ="server"> < script type ="text/javascript">           ...

Split string in group of n number (Ex : Group of 3)

Today , I needed one solution for spliting string in group of 3 String as "A c1Imghsd345dsda " My program is static void Main( string [] args) { IEnumerable < string > result = Split( "Ac1Imghsd345dsda" , 3); } static IEnumerable < string > Split( string str, int groupSize) { return Enumerable .Range(0, str.Length / groupSize) .Select(i => str.Substring(i * groupSize, groupSize)); } I get an output strings in group of 3 as Enumerable form Here no to need to convert in toCharArray then FOR Loop.. Simply do as shows....  
Dear friends , Over the 1 year or so I have gone from primarily developing applications using .NET/C# and ASP.NET MVC for web development. It’s been an amazing experience, but it can take some time to get used to a new language and platform. I have found the more languages I learn, the easier it gets to pick up new ones. Many of the core concepts are the same, it’s just a matter of learning the peculiarities of each language/platform (unless you’re learning learning a whole new paradigm, like a functional language). One thing I find useful when learning a new language is to try and relate certain features back to a language I know and understand. Of course, it’s important to learn the correct conventions for a new language, but that usually happens over time. For the purpose of this post, I’m going to create a create category on Blog for C#/ASP.net beginners and other post ( Erros solutions category ) on same blog. Adjust it :) :) Thanks & regards, Nihar Kul...

Exception Handling in Java

An exception is a problem that arises during the execution of a program. An exception can occur for many different reasons, including the following: A user has entered invalid data. A file that needs to be opened cannot be found. A network connection has been lost in the middle of communications or the JVM has run out of memory. To understand how exception handling works in Java, you need to understand the three categories of exceptions: Checked exceptions: A checked exception is an exception that is typically a user error or a problem that cannot be foreseen by the programmer. For example, if a file is to be opened, but the file cannot be found, an exception occurs. These exceptions cannot simply be ignored at the time of compilation. Runtime exceptions: A runtime exception is an exception that occurs that probably could have been avoided by the programmer. As opposed to checked exceptions, runtime exceptions are ignored at the time of compilation. Errors: These are not ...

Hashtable in C#

  Hi frnds, you couldn't believe about hashtable concept in c#.   I don't know ,how would I missed it. But its very helpful while searching for generic collections related techniques. I just viewed it , but never used it before.   So I am sharing some ways to use it at your place.     Members of hastable :     Key :-  Unique value which can be number or character   Value :- Value you want to store on particular key     The example adds 15 distinct integer keys, with one string value each, to the Hashtable object.   using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; namespace HashTableDemos {     class Program     {         static void Main(string[] args)         {       ...

out and ref keywords in C#

As we already studied about  CALL BY REFERENCE  in C of our academic period. In call by reference , we passed the address of that variable's value to method. But due to point died in C# , we used REF  keywords in C#. REF :    Ref parameters are changed at the calling site. They are passed as references, not values. This means you can assign the parameter in the called method and have it also be assigned at the calling site. There is a big difference between ref and out parameters at the language level. Before you can pass a ref parameter, you must assign it to a value. This is for the purpose of definite assignment analysis. You don't need to assign an out parameter before passing it to a method. The compiler allows this. Sample program for understanding :     public static void Main( string [] args) {         int val = 1; Method (r ef   val); Connsole .WriteLine...

Defining values while creating sql table

Image
Hi friends  , This post and technique very new to me !! It reduce lot of repeated work while using SQL queries with other technologies like (C#,Java,Perl etc) Basically post refers to CREATE TABLE command of SQL Example : Guess that , you want to calculate percentage of total marks ,get to particular students and store it table. For that process , we need to create columns as id,fname,lname,totalMarks,Percentage etc. Then we go for code ,we calculate from insert or select query or others. I am trying through SQL Server 2008 R2... Create table of  sample student table :   create table SampleTable (       id int identity ( 1 , 1 ),       fname nvarchar ( 50 ),       lname nvarchar ( 50 ),       totalMarks float ,     passFlag as case when   totalMarks > = 50 then 'Pass' else 'Fail' end persisted ) Inse...