Showing posts with label agra software companies. Show all posts
Showing posts with label agra software companies. Show all posts

Tuesday, September 22, 2015

MVC-Tutorial

Add 2 numbers in MVC
Download the sample project from the link below:
http://demos.essentialsolve.com/demos/Files/MVC/DemoCal.rar

- Create a new project in Visual Studio.

- Name the project as "MVCDemoCalc".

- Click Ok.
- In the next screen, select "Internet Application" in Project Template and Razor as View Engine. Click Ok.

- A new project opens. You will see 3 folders in the Solution Explorer named as View, Controller and Model as shown below.

- Create a New class named as MathCalc in the Model folder. Define a method named as Sum to add the 2 numbers.
public class MathCal
    {
        [DisplayName("Value1")]
        public double Value1 { get; set; }
        [DisplayName("Value2")]
        public double Value2 { get; set; }
        public double Sum(double v1, double v2)
        {
            return v1+v2;
        } 

    }

- Create a controller "MathCalController" in Controller folder.


- This class uses the MathCal class object. Below is the code:
  public class MathCalController : Controller
    {
        //
        // GET: /MathCal/         
        public ActionResult Index(MathCal objMathCal)
        {
            ViewBag.Results = objMathCal.Sum(objMathCal.Value1, objMathCal.Value2);
            return View(objMathCal);
        }

    }

- Compile the project to generate classes.
- Right click the ActionResult to generate the detail view.


- Give View Name as 'Index'. View Enginer as Razor. Select the checkbox 'Create a strongly typed view'. Selec the model class 'MathCal'. Choose Scaffold Template as Details. Click select. Below is the modified code of Index.cshtml:

@model MVCDemoCalc.Models.MathCal

@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
</head>
<body>
    using (@Html.BeginForm())
    {
    <fieldset>
        <legend>MathCal</legend>

        <div class="display-label">
            @Html.DisplayNameFor(model => model.Value1)
            @Html.EditorFor(model => model.Value1)
        </div>

        <div class="display-label">
            @Html.DisplayNameFor(model => model.Value2)
            @Html.EditorFor(model => model.Value2)
        </div>

        <div class="display-label">
            @Html.Label("Result")
            @ViewBag.Results
        </div>
    </fieldset>
    <p>
        <input type="submit" value="Add" />
    </p>
    }
</body>

</html>

- Open RoutConfig.cs file located in App_Start folder. Change the default startup page as below:
public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "MathCal", action = "Index", id = UrlParameter.Optional }
            );

        }

- Run the program and check the output. Here below is the ouput:

Saturday, June 6, 2015

Multi-Threading

MULTITHREADING

Multithreading allows an application to divide tasks such that they work independently of each other to make the most efficient use of the processor and the user’s time. Threading is not always the right choice for all applications as they sometimes slows down the processing speed of the application.

Thread

Every application runs with at least one thread. A thread is nothing more than a process. On the computer, a thread is a process moving through time. The process performs sets of sequential steps, each step executing a line of code. The steps are sequential and take a given amount of time. The time it takes to complete a series of steps is the sum of the time it takes to perform each programming step.

Multithreading applications

For a long time, most programming applications were single threaded. That means there was only thread in the entire application. You could never do computation A until completing computation B. A multithreaded application allows you to run several threads, each thread running in its own process. So theoretically you can run computation A in one thread, and at the same time Computation B in another thread. At the same time you could run computation C, D in their own threads. Hence computation A, B, C and D would run concurrently. Theoretically, if all four computations took about the same time, you could finish you program in a quarter of the time it takes to run a single thread. 

ThreadStart() and Thread() class

using System.Threading;
public class dummy
{
public static void prt()
{
System.Console.WriteLine("Hi");
}
}
public class thread
{
public static void Main()
{
ThreadStart ts = new ThreadStart(dummy.prt);
Thread t = new Thread(ts);
System.Console.WriteLine("Before Start");
t.Start();
}
}

Start() method

using System.Threading;
public class dummy
{
public void prt()
{
System.Console.WriteLine("Hi");
}
}
public class thread
{
public static void Main()
{
dummy obj = new dummy();
Thread t = new Thread (new ThreadStart(obj.prt));
t.Start();
}
}

2 threads running

using System.Threading;
public class dummy
{
public void prt()
{
for (int i=0; i<=3; i++) { System.Console.WriteLine(i + " "); } } public void disp() { for(int i= 0; i<=3; i++) { System.Console.WriteLine(i + "..."); } } } public class thread { public static void Main() { dummy obj = new dummy(); Thread t = new Thread (new ThreadStart(obj.prt)); Thread t1 = new Thread(new ThreadStart(obj.prt)); t.Start(); t1.Start(); } }

Sleep() method

using System.Threading;
public class dummy
{
public void prt()
{
for (int i=0; i<=3; i++) { System.Console.WriteLine(i + " "); Thread.Sleep(500); } } public void disp() { for(int i= 0; i<=3; i++) { System.Console.WriteLine(i + "..."); Thread.Sleep(500); } } } public class thread { public static void Main() { dummy obj = new dummy(); Thread t = new Thread (new ThreadStart(obj.prt)); Thread t1 = new Thread(new ThreadStart(obj.prt)); t.Start(); t1.Start(); } }

Name property

using System.Threading;
public class dummy
{
public void prt()
{
for (int i=0; i<=3; i++) { Thread t2 = Thread.CurrentThread; System.Console.WriteLine(i + "," + t2.Name + " "); Thread.Sleep(500); } } } public class thread { public static void Main() { dummy obj = new dummy(); Thread t = new Thread (new ThreadStart(obj.prt)); Thread t1 = new Thread(new ThreadStart(obj.prt)); t.Name = "One"; t1.Name = "Two"; t.Start(); t1.Start(); } }

Abort(), IsAlive() methods

using System.Threading;
public class dummy
{
public void prt()
{
System.Console.WriteLine("Hi!");
Thread.Sleep(10);
}
}
public class thread
{
public static void Main()
{
dummy obj = new dummy();
Thread t = new Thread (new ThreadStart(obj.prt));
System.Console.WriteLine(t.IsAlive);
t.Start();
System.Console.WriteLine(t.IsAlive);
t.Abort();
System.Console.WriteLine(t.IsAlive);
}
}

Running a thread till it is alive

Example 1
using System.Threading;
public class dummy
{
public void prt()
{
System.Console.WriteLine("Hi!");
}
}
public class thread
{
public static void Main()
{
dummy obj = new dummy();
Thread t = new Thread (new ThreadStart(obj.prt));
t.Start();
while (!t.IsAlive)
System.Console.WriteLine("Hi");
}
}
Example 2
using System.Threading;
public class dummy
{
public void prt()
{
for (int i=0; i<=3; i++) System.Console.WriteLine("Hi!" + i + " "); } } public class thread { public static void Main() { dummy obj = new dummy(); Thread t = new Thread (new ThreadStart(obj.prt)); t.Start(); System.Console.WriteLine("Over"); } }

Thread: Start(), Join()

Example 1
using System.Threading;
public class dummy
{
public void prt()
{
for (int i=0; i<=3; i++) System.Console.WriteLine("Hi!" + i + " "); } } public class thread { public static void Main() { dummy obj = new dummy(); Thread t = new Thread (new ThreadStart(obj.prt)); t.Start(); t.Join(); System.Console.WriteLine("Over"); } }
Example 2
using System.Threading;
public class dummy
{
public void prt()
{
for ( ; ; ) ;
}
}
public class thread
{
public static void Main()
{
dummy obj = new dummy();
Thread t = new Thread (new ThreadStart(obj.prt));
t.Start();
bool b = t.Join(10000);
System.Console.WriteLine("Over " + b) ;
}
}
Example 3
using System.Threading;
public class dummy
{
public void prt()
{
System.Console.WriteLine("function running");
}
}
public class thread
{
public static void Main()
{
dummy obj = new dummy();
Thread t = new Thread (new ThreadStart(obj.prt));
t.Start();
Thread.Sleep(200);
t.Abort();
System.Console.WriteLine("Over ") ;
Thread.Sleep(200);
try
{
t.Start();
}
catch(ThreadStateException e)
{
System.Console.WriteLine("In Exception " + e);
}
}
}

ApartmentState

using System.Threading;
public class dummy
{
public void prt()
{
System.Console.WriteLine("function running");
}
}
public class thread
{
public static void Main()
{
dummy obj = new dummy();
Thread t = new Thread (new ThreadStart(obj.prt));
System.Console.WriteLine(t.ApartmentState);
t.ApartmentState = ApartmentState.STA;
t.Start();
System.Console.WriteLine(t.ApartmentState);
}
}

IsBackground property

using System.Threading;
public class dummy
{
public void prt()
{
System.Console.WriteLine( "prt() " + Thread.CurrentThread.IsBackground);
}
}
public class thread
{
public static void Main()
{
dummy obj = new dummy();
Thread t = new Thread (new ThreadStart(obj.prt));
System.Console.WriteLine("Main " + Thread.CurrentThread.IsBackground);
t.Start();
}
}

Creating a background thread

using System.Threading;
public class dummy
{
public void prt()
{
for(int i=0; i<=100; i++) { System.Console.WriteLine( "prt() " + i); Thread.Sleep(100); } } } public class thread { public static void Main() { dummy obj = new dummy(); Thread t = new Thread (new ThreadStart(obj.prt)); System.Console.WriteLine("Main " + Thread.CurrentThread.IsBackground); t.IsBackground = true; t.Start(); Thread.Sleep(100); } }

ThreadPriority enum

Example 1
using System.Threading;
public class dummy
{
public void prt()
{
for(int i=0; i<=10; i++) { System.Console.WriteLine(i + " "); Thread.Sleep(100); } } public void display() { for(int i=0; i<=10; i++) { System.Console.WriteLine(i + "..."); Thread.Sleep(100); } } } public class thread { public static void Main() { dummy obj = new dummy(); Thread t = new Thread (new ThreadStart(obj.prt)); Thread t1 = new Thread(new ThreadStart(obj.display)); System.Console.WriteLine(t.Priority); t.Priority = ThreadPriority.Highest; t1.Priority = ThreadPriority.Lowest; t.Start(); t1.Start(); } }
Example 2
using System.Threading;
public class dummy
{
public void prt()
{
try
{
System.Console.WriteLine("in prt()");
for(; ; );
}
catch (System.Exception e)
{
System.Console.WriteLine("In abc Exception " + e.ToString());
}
finally
{
System.Console.WriteLine("in abc Finally");
}
}
}

public class thread
{
public static void Main()
{
dummy obj = new dummy();
Thread t = new Thread (new ThreadStart(obj.prt));
t.Start();
Thread.Sleep(10);
t.Abort();
}
}
Example 3: 

using System.Threading;
public class dummy
{
public void prt()
{
try
{
System.Console.WriteLine("in prt()");
for(; ; );
}
catch (System.Exception e)
{
System.Console.WriteLine("In abc Exception " + e.ToString());
}
finally
{
System.Console.WriteLine("in abc Finally");
}
}
}
public class thread
{
public static void Main()
{
dummy obj = new dummy();
Thread t = new Thread (new ThreadStart(obj.prt));
t.Abort();
t.Start();
}
}

Suspend(), Resume() methods using System.Threading;

public class dummy
{
public void prt()
{
for(int i=1; i<=10; i++) { System.Console.Write(i + " "); Thread.Sleep(100); } } } public class thread { public static void Main() { dummy obj = new dummy(); Thread t = new Thread (new ThreadStart(obj.prt)); t.Start(); Thread.Sleep(10); t.Suspend(); System.Console.WriteLine("\n After Suspend"); Thread.Sleep(10); System.Console.WriteLine("Before Resume"); t.Resume(); } }

Mutex

When two or more threads need to access a shared resource at the same time, the system needs to be in synchronization mechanism to ensure that only one thread at a time uses the resource. Mutex is a synchronization primitive that grants exclusive access to the shared resource to only one thread. If a thread acquires a mutex, the second thread that wants to acquire that mutex is suspended until the first thread releases the mutex. using System;
using System.Threading;
class Test
{
private static Mutex mut = new Mutex();
private const int numIterations = 1;
private const int numThreads = 3;
static void Main()
{
for (int i = 0; i < numThreads; i++) { Thread myThread = new Thread(new ThreadStart(MyThreadProc)); myThread.Name = String.Format("Thread{0}", i + 1); myThread.Start(); } } private static void MyThreadProc() { for (int i = 0; i < numIterations; i++) { UseResource(); } } private static void UseResource() { mut.WaitOne(); Console.WriteLine("{0} has entered the protected area",Thread.CurrentThread.Name); Thread.Sleep(500); Console.WriteLine("{0} is leaving the protected area\r\n",Thread.CurrentThread.Name); mut.ReleaseMutex(); } }

Mutex - Infinite wait

using System.Threading;
public class thread
{
static Mutex m;
public static void Main()
{
m = new Mutex(true, "aptech");
thread obj = new thread();
Thread t = new Thread(new ThreadStart(thread.prt));
t.Start();
}
public static void prt()
{
System.Console.WriteLine("thread start");
m.WaitOne();
System.Console.WriteLine("thread end");
}
}
Mutexes using System.Threading;
public class thread
{
static Mutex m;
public static void Main()
{
m = new Mutex(false, "aptech");
thread obj = new thread();
System.Console.WriteLine("thread start");
m.WaitOne();
System.Console.WriteLine("thread end");
}
}

Locking

using System;
using System.Threading;
class threadSafety
{
public static object Compute = new object();
public static int ValOne, ValTwo;
static void Divide()
{
ValOne = 45;
ValTwo = 8;
lock (Compute)
{
if (ValOne != 0)
Console.WriteLine(ValOne / ValTwo);
ValTwo = 0;
}
}
public static void Main()
{
Divide();
}
}

Friday, October 3, 2014

Desktop Application Development

Our advance dedicated team consolidate Desktop Applications with web applications for effective offline operations without using web browser.


Desktop Application is the key of technology. Companies works on bespoke Desktop Application for continuous and handy business framework and configurations. In past years, we have successfully worked on desktop application development which has given us significant experience.
Many years of experience in Desktop Application development has given us vast knowledge. We have revealed best industry levels and implementations in these years. We have developed operative, functional, easy to use, manageable and high yielding rich user interfaces by utilizing our industry expertise, specialized experience and UI design expertise which help clients with refined implementation, better production and likely user settings. End users are able to maintain organizations day to day activity successfully. Integrating Desktop Applications with web technologies, databases and Operating Systems helps effectual data connections, apparent content integration and dynamic offline activities. We help clients to grow in competitive market, fulfill detailed and separate business needs and gain benefits. We upgrade applications at times depending on the organization needs and market changing trends. Data security, safety from illegal, wrongful, unwanted and unapproved access is our main concern in the Desktop Application development. Desktop Applications have many advantages like users can work offline anytime. The response time and the user experience is must faster as compared to other applications. No server hosting is needed for desktop applications.

Other services we offer

Thursday, October 2, 2014

saas-cloud

We are proficient in developing services that runs on Cloud, an optimum software option for companies as any device from varied geographical locations can access data to work on.


SaaS, Software-as-a-Service is a service, provided by various Application Service Providers to the companies. SaaS is used to work as a Service in applications on Internet without any need of installing/maintaining the software on personal systems. The core idea of SaaS is centralized computing where people spread over geographical locations can connect to work at any time from any device. It’s an applicable and manageable software option for organizations now a days. SaaS allows data to be accessed from any location, on any device with appropriate Internet connection. To use the software running on SaaS, no license is needed. Purchasing software or software license is managed by the companies who run their software on SaaS.
SaaS is a web-based software hosted on cloud that runs on-demand on SaaS provider servers. Independent users and companies both can perform their tasks. End users uses applications like Google, Twitter, Facebook as services, which are the example of SaaS. With SaaS, you can rent a software on monthly basis with data saved on cloud. There is no need to purchase the software and install it on individual machine.
SaaS systems are loaded with good customization features. From database modification, addition and management to UI look and feel, everything can be customized as per the requirements. Business process and logics can also be turned on or off.

Security Measures In SaaS

Security is the most important aspect of any organization. Online banking, accounting systems, payroll systems running on SaaS are good examples where SaaS follows stringent security, backups and maintenance.

SaaS Characteristics


  • No hardware cost is needed
  • No setup cost is required
  • Automatic updates
  • Only pay for your usage
  • Device compatibility
  • Access from any location
  • Multitenant Architecture
  • Easy Customization
  • Better Access
  • Excellent customization

  • Benefits of SaaS


  • Scalability
  • Data security
  • Software are used as Service which any device having Internet connection can access.
  • SaS systems can be customized as per the company requirements. There are expert professionals who are trained in modifying SaaS programs to felicitous business needs.

  • Cloud Computing

    Cloud computing is combination of SaaS and PaaS (hardware Platform as a Service). Its an Internet based computing where computing resources are shared among various devices. Significant workloads are handled by the interconnected computers on cloud instead of stand-alone computers that runs the applications.

    EssentialSolve SaaS/Cloud Services

    We develop services that runs on cloud to help enterprise flawlessly. We focus on accuracy and attention to detail and coordinate group projects and complex timelines.

    Wednesday, May 14, 2014

    When making calls to a DB from an application when and why would you use stored procedures, and when and why would you create the SQL script on the fly within the application

    Stored Procedures: One of the most beneficial reasons to use stored procedures is the added layer of security that can be placed on the database from the calling applications. If the user account created for the application or web site is configured with EXECUTE permissions only then the underlying tables cannot be accessed directly by the user account. This helps prevent hacking directly into the database tables. The risk of a hacker using the user account to run a stored procedure that has been written is far safer than having the user account have full insert, update and delete authority on the tables directly.
    Another advantage to using stored procedures, especially in medium to large scale web sites or applications, is the data functionality is separated from the application making it easier to manage, document, and maintain. For example, if an application updates the customer table in ten different places, there can be a single stored procedure and a standard procedure call from the application for this functionality. If a change needs to be made to the way a customer record is managed, then the SQL statements only need to be changed in one place, in the database layer. In most cases, the application is not affected unless the procedure call requires modification. Changing the procedure call is also easier, because a standard call is already in place. Managing the data in the data layer avoids having to keep track of embedded SQL calls that may be different in each place, whenever a change is required.
    Stored procedures provide improved performance because fewer calls need to be sent to the database. For example, if a stored procedure has four SQL statements in the code, then there only needs to be a single call to the database instead of four calls for each individual SQL statement. Of course there is always a tradeoff. There is an increased workload on the server side that needs to be taken into account.
    Another advantage to using stored procedures allows for multiple client applications written in any language and running on any platform to have consistent database routines. Each application uses the same procedures and simply has to embed a standard procedure call for the language in the calling program.
    SQL Script on the fly: In some applications having hard coded SQL statements is not appealing, because of the dynamic nature of the queries being issued against the database server. Because of this sometimes there is a need to dynamically create a SQL statement on the fly and then run that command. This can be done quite simply from the application perspective where the statement is built on the fly whether you are using ASP.NET.
    When we need to solve a tricky database problem, the ability to generate SQL statements is a powerful tool. A dynamic SQL statement is constructed at execution time, for which different conditions generate different SQL statements.