Sunday 25 January 2015

Crud Operation in AngularJS With Bootstrap


In My Previous Article I explored about How to setup angularjs in Visual Studio and also Explored concepts of What , why and when To use AngularJS . In this article I am going to do CRUD Operation in AngularJS . CRUD operations means Insert , view , Update and Delete Data In Database . CRUD operations are most important thing that you must practice to create Applications either simple or complex in AngularJS or in any other Language or Technology . I am giving a simple code and easy sample that you can use to Perform CRUD operations in AngularJS using .NET technology 

Download the Sample Code from Link Below .

Download Code



How to setup/Run this sample 


1. First Download the code 
2. Then Open Web.config file and update the connection string to your sqlserver connection string by first making database in you sql server .
3. You need to Deal with CODE First Data migration Commands you can see these command in  link below :-

Data Migration


Snapshots

View Data From Database AngularJS

Insert Data In Database AngularJS

Delete Data from Database AngularJS

Update Data From Database AngularJS

Why we should use AngularJS

What is AngularJS

Why Its Called AngularJS

Why To Use AngularJS

When To Use AngularJS

So , Today i started to explore the top-most question that always stuck our mind when we start with new technology . Like i already know my stuff then when i started with angular these above are basic questions that stuck my mind that what is angularjs and why i should use it and when  .

Today briefly I am going to give answers to these questions -

What is AngularJS ?

AngularJS is a javascript framework developed by Google's Employees . What so special about angularjs is it is client side . what all you need is Javascript and any programming language of your own choice to start with AngularJS that makes angular best . Like in my case I am Asp.net C# developer so I use my all logic like database connectivity in c# and all bindings are done by Angularjs and Let me tell you it is so fast in case of Searching and other type of operations required in Applications developement this is because everything in here is through javascript which is client side It has all inbuilt functions for different type of work that make it suitable for web development .

Why Its Called AngularJS ?

Now foremost question is why its called AngularJS this is because its main Namespace is ng and that sounds like Angular and JS is used with it that's why its called AngularJS .

Why To Use AngularJS

5 Main Points Why we should use AngularJS -

  1. Angular Provides Data-Binding:- binding is the coolest concept in AngularJS. It's a fascinating real-time concept. Just like desktop application, mobile apps user also wishes to witness swift changes in the UI. So AngularJS’ two-way data binding handles the synchronization between the DOM and the model, and vice versa. As a result, the UI changes based on other input components are very much smooth without any extra effort on the part of the developer
  2. Angular Enables Single Page Apps :- Single Page Applications are becoming more popular for a good reason. They fill a very specific need. More functionality is being moved to the web, and the browser is finally realizing its potential as a distributed computing node. By design, SPA applications are far more responsive (even though some of that is perception). They can provide an experience that feels almost like a native app in the web. By rendering on the client they cut down load on the server as well as reduce network traffic – instead of sending a full page of markup, you can send a payload of data and turn it into markup at the client. Of course, Angular doesn't force you into building a SPA app, it only provides plenty of built-in support
  3.  Angular Provides Dependency Injection :- AngularJS has a built-in dependency injection subsystem useful for developers as it makes application development easier including testing. Dependency Injection (DI) allows users to ask for dependencies, rather than having to go and look for them or make them on their own .

    for example, “Hey I need X’, and the DI is responsible for creating and providing it for you. If user wants to gain access to core AngularJS services, all they need to do is add service as a parameter. AngularJS will detect that users need that service and will provide it instantly.
  4.  AngularJS Directives :- Directives can create custom HTML tags that serve as new and custom widgets.Directives achieve this by allowing users to invent their own HTML elements. Putting DOM manipulation code into the directives makes it easy for the users to separate them out of MVC app and leaves MVC to update the view with new data, but how the view will behave is certainly up to directives
  5. AngularJS requires less coding :- The data-binding feature allows developers to stop providing data manually into the view. Filters allow you to manipulate the data on the view level without changing your controllers. As a result, developers need to write very little code to achieve the task, which is a great deal for the developers

     When To Use AngularJS ?

    AngularJS is a very good SPA framework. If we want to create a SPA application, then AngularJS is a good option for it.“SPA” refers to Single Page Application. A Single Page Application is one in which we have a shell page and we can load multiple views into that. So a traditional app, as you know you typically blink and load everything again.
    It’s not very efficient on the bandwidth, especially in the mobile world. In a SPA, we can load the initial content upfront and then the different views or the small kind of mini web pages can be loaded on the fly and embedded into the shell.

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

Setting up Angularjs in Visual Studio Express

AngularJS is a unique framework that without doubt will shape the web development space in the years to come . AngularJS is a recent addition to the client-side MVC frameworks list, yet it has
managed to attract a lot of attention, mostly due to its innovative templating system, ease of  development, and very solid engineering practices

In Simple Words I would say AngularJs is Awesome that anything else .

AngularJS is a relatively new actor on the client-side MVC frameworks scene; its 1.0 version was released only in June 2012. In reality, the work on this framework started in 2009 as a personal project of Miško Hevery, a Google employee. The initial idea turned out to be so good that, at the time of writing, the project was offiially backed by Google Inc., and there is a whole team at Google working full-time on the framework.

AngularJS is an open source project hosted on GitHub (https://github.com/angular/angular.js) and licensed by Google, Inc. under the terms of the MIT licens



Setting Up Angularjs in Visual Studio

1. First Open Visual Studio then Click on Tools Menu
2. Then Under Tools Menu click on Extension and Updates
3. It shows Extension and Updates Window . Now in Search Box at Top right side Typein AngularJS and Hit Enter .
4. Now you will be shown the result as below screenshot -

Add caption

 5. Now click on Install button to Install Angular js in visual studio .
 6. If any of Nuget packages are missing then these will be dependencies for angular that will automatically installed . as shown in screenshot below -


7. Now to check AngualarJS is installed click on File menu then click on New then click on Project
Now  under Templates -> Web category you can see AngularJS installed as shown in screenshot below -


Now AngularJS is ready in Visual Studio .


 




Friday 9 January 2015

Add To Cart Disappeared Nopcommerce

If somehow you Add To Cart Button Disappeared From Nopcommerce then you can try following solutions of Fix to get Add To Cart Button Back In Nopcommerce

Solution 1 - Add To Cart Disappeared Nopcommerce


  1. Login To AdminPanel of Nopcommerce 
  2. Click on Catalog 
  3. Then click on Product
  4.  Then click on Bulk Edit Products and Edit a Product 
  5. Then In Product info Tab scroll down and see Disable buy button check box and Uncheck that checkbox its done

Add To Cart Disappeared Nopcommerce
Add To Cart Disappeared Nopcommerce


Solution 2 -Add To Cart Disappeared Nopcommerce


second thing you need to check is whether you have any item in stock or if your all items are sold or in Product Info page while adding product you have entered 0 for stock quanity then it may remove Add To Cart Button 

In this case check low stock activity combo box in Product info page as shown in image below 

Add To Cart Disappeared Nopcommerce
Add To Cart Disappeared Nopcommerce


Nopcommerce Tutorial


Internship Day

 I started my work with Adding Products to Nopcommerce Site to view it to Rohit sir , I explored online products to select some to add it to Nopcommerce Site . I have seen some cool features while going through this procedure I liked Nopcommerce it is flexible and rich of good features that must be available in E-Commerce Solution

 Adding Products To Nopcommerce


Login to admin Panel
Click on Category then click on Products
In submenu then click on Mange Products
Then Manage Products Page opens
Now click on Add New

see image below for reference


Now at that page fill all products details that you require to fill . Some of important terms for product details will be given by me further in this article .

Add New Manufacturer Nopcommerce

 

For this Click on Catalog menu and then click on Manufacturers when that page opens click on Add new and fill necessary details to Add New Manufacturer

and while adding a new product you can go to Manufacturer tab and select the manufacturer you added

Add New Category Nopcommerce


For this Click on Catalog menu and then click on Categories when that page opens click on Add new and fill necessary details to Add New Manufacturer

and while adding a new product you can go to Category specification tab and select the manufacturer you added

 Add Product Picture Nopcommerce


while adding product you can go to Picture Tab on Add New Product Page and then click on Browse or select picture button to upload picture of product you can also set sort order of all pictures by numbering them like 0,1,2,3 .....

Add Shipping Details Nopcommerce


While adding product you can go to Product info tab and scroll down and you can see shipping details there . you can select Free shipping for no charges to client or you can add shipping Cost to customer for this product and you will also add height, weight or product there

Adding Old And New Price  Nopcommerce


While adding product to nopcommerce you can add Old price of product and new price old price will be strikethrough that denotes previous price of that product

Adding Special Price To Product Nopcommerce


Here you can add special price to product like we can say this is discounted or festival offer price of product and you can also specify time and date along with it

Show Stock Availability and Stock Quantity Nopcommerce


while adding product at Product Info page you can see two check boxes for Show Stock availability and Show Stock Quantity if you checked them it will show their quantity to Customer when Customer view the product at Online Store

Call Price Feature Nopcommerce


This is very awesome feature . This feature does not tell the cost of product to customer but allows the customer to bid or call what price customer wants to pay for the product


ERROR : Add To Cart Not Showing

Then i faced an error with each product there is add to cart button that adds product to cart to buy it but when add new products to my ecommerce solution due my some mistakes it disappeared Check out here for solution





Wednesday 7 January 2015

Uncaught TypeError-undefined is not a function



Uncaught TypeError: undefined is not a functionUncaught TypeError: undefined is not a function in datepicker






This error takes my 2 hours today I was developing an asp.net application and I never gone through this error before First time i got this error and it shuffles me for two big hours

You will get number of solutions over forums
But sorry to say all these are workaround to get rid-off that error
very less tried to explain why this error came and what is meaning of this error .

Today after spending my 2 hours on this simple error i decided to write something about solution to this error

CAUSE OF ERROR :Uncaught TypeError: undefined is not a function


This error clearly means this is some function that is undefined in the class from which we are accessing it

Like in my case this error was coming at this line :-

$( "#datepicker" ).datepicker();
or
jquery( "#datepicker" ).datepicker();

The main reason behind this error is Jquery Multiple versions calling . If you are using jquery and you have refrenced multiple versions of jquery like Jquery1.10.2 and Jquery 2.0.1 in same file then mostly this error will come at runtime at that page .

The reason behind why it says Undefined TypeError because when multiple versions of jquery are called on same page then we are having two jquery script running and they are like -

1.  Jquery1_10_2
2.  Jquery2_0_1

and we are using only jquery or a '$' dollar symbol there and when browser is unable to find Jquery there then how can it find datepicker function or any other function that you are using at that time . This is main cause of error

Solution of Error : 

Uncaught TypeError: undefined is not a function

So let's talk about solutions to this error . I tried my best at 1:00 AM at Night to find solution to this error and then share it with my blog readers

Now we need to tell browser that we need to use specific version of juery only if we are using multiple versions of jquery on same page

Otherwise simple solution would be to remove the second refrenced version of jquery if possible

so in order to tell broser that we are using specific version of jquery we need to make some changes to our code

Like in my case i am using following code to put jquery datepicker on my website and i am using
jquery1_11_0 version of jquery
So here is my code i have replaced '$' or jquery with jquery1_11_0 and that's it the problem is solved

CODE -
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>

<script type="text/javascript">
    var jQuery_1_11_0 = $.noConflict(true);
    jQuery_1_11_0(document).ready(function () {
        jQuery_1_11_0('#datepicker').datepicker();

    })
</script>

Friday 2 January 2015

Nopcommerce Developer Guide


Internship - Day 1


Today was first day of my internship Period of 6 months . I am very happy to start my internship with Abax Technologies . Abax technologies is a recognized IT company Situated in Noida . It deals with Desktop , web and Mobile application development and providing solutions to market .

Mr. Rohit Jain is CEO of Company and I am doing Internship under their guidance .

Now came to work -- On 2nd January - 8:23 am Rohit Sir posted my first task on skype . My first task was first to learn more about Nopcommerce , Its Architecture , Plugin development , Module Development , Theme development and widget development .

First i need to download the source code for Nopcommerce form Nopcommerce office webiste then using that source code to compile it , set up its database then run a demo site in nopcommerce .

After setup the demo site for nopcommerce it started exploring its source code architecture and learn more about it from its developer's documentation

I have previously done a ecommerce website in Nopcommerce but at that time i used Nopcommerce 1.9 version that was asp.net version of nopcommerce Now i am going to use Nopcommerce 3.2 and this version is really cool . It is MVC version of nopcommerce using Linq queries instead of using sql and using Razor view engines and more flexibility . Actually I liked this version .

Important Links that i have studied and explored today -

Link for Nopcommerce Developer's Documentation
Nopcommerce Developer Documentation



Nopcommerce uses code first approach for each and every development component in nopcommerce so i decided to first give a look at code first approach to revise my concepts about codefirst approach

Code First Approach Documentation MVC


After Reading about code first approach of Nopcommerce I reached a Nerd Dinner app that is MVC app that uses code first approch for MVC application development
Nerd Dinner MVC App with Code First Approach

So that was it for the day i learned number of things today

Today I have explored following Modules -


1. Nopcommerce Installation v3.20 (mvc)
2. Explored Nopcommerce Developers Documentation
3. Exploring Nopcommerce Architecture
4. Explored Nopcommerce Theme CUstomization and Creating Own Theme
5. Exploring Plugin Development Documentation
     -- Created simple hello world Plugin

Next I will explore create plugins with database access and various nopcommerce inbuilt modules

Monday 29 December 2014

Jan Creater of Whatsapp

From Welfare to WhatsApp

Jan ( co-founder whatsapp) , who turns 38 this year, was just a teenager when he emigrated to the U.S. from a small village outside Kiev, Ukraine. Life in rural Kiev, a city that is currently rife with political tension and mass protests, was not easy. Jan's home had no hot water, and his parents refused to use the phone, which was tapped by the government. Once in the U.S., he taught himself computer networking by reading manuals bought from a used bookstore.
In 1997, he met his future WhatsApp cofounder, Brian, who convinced Jan to join Yahoo! even though he was still in college. Jan became an infrastructure engineer at Yahoo! and dropped out of San Jose State University. The two still describe themselves as "two guys who spent combined 20 years doing geeky stuff at Yahoo! Inc. before starting WhatsApp Inc." on the company's About page.
The Forbes piece includes a photo of Jan signing the billion-dollar Facebook deal on the doors of his old welfare office in Mountain View, Calif.—a perfect full-circle summation of his rags-to-riches journey.

whatsapp



A Company With A Unique Vision




WhatsApp had a completely refreshing outlook on messaging between smartphones. Privacy was Jan's priority, first and foremost. The service has remained largely the same since 2009, with just a few more bells and whistles in its latest incarnation.
A user does not have to submit information like his or her name, gender, address, or age—just a phone number. No fancy username is required for WhatsApp; users log in with a 10-digit number. WhatsApp borrowed elements from instant messaging like status updates and "read" receipts (long before iMessage incorporated that feature).
Jan was interested in disrupting the way cell phone carriers nickeled-and-dimed customers for text messaging, which was especially useful for those looking to connect with loved ones overseas. The app quickly built a following in Europe and other international communities. By early 2011, WhatsApp was an App Store superstar, reaching the top 20, and has remained in the top 10 free apps ever since.

story of creater of whatsapp



REJECTED BY FACEBOOK
REJECTED BY TWITTER
CREATED WHATsAPP

Brian Acton ....A Person that is Vice President of Engineering At Yahoo . Left the job then Applied for Facebook Rejected there then started working on world's best messaging app


A FAILURE NOT A DEFEAT

This Amazing pic above tells you everything . The person in the pic is 'BRIAN ACTON' The Creater of WhatsApp ( The Best cross-platform Mobile Messaging App ) .

It is the destiny that a person that applied for job in Facebook is rejected in 2009 and The same person with his team and with an awesome Idea Sold WhatsApp To Facebook for jaw-dropping deal of $19 billion

It clearly states Intelligence can never be stopped . IF you can think then that's all that you need to have .......




So from the pic all is clerified . Yes two months before Rejection from Facebook , Brian Acton The Creater of WhatsApp was Rejected from Twitter . That means Failures and Failures don't mean Defeat .

But the app's success did not come at a small price. Founders Jan Koum and Brian Acton are no strangers to failure, and their incredible journey speaks volumes about the value of tenacity and vision. Today, Jan and Brian's app is now the most valuable messaging platform on the planet

Also Read -
whatsapp -- A Company With A Unique Vision

Jan - Creater of Whatsapp

Don't Forget to Subscribe and Share Us.

Thursday 25 December 2014

Microsoft HTTP/API port 80 is actually used


Microsoft HTTP/API 2.0 Using Port 80,
WAMP - Your port 80 is actually used , change port number in wamp


After Installation of Wamp you may suffer from an Error that says that Your Port 80 is actually used , change port number in wamp
I decided to sit and give a search on this error to finally find and share an optimal solution to this error . This error may come if you have already Installed IIS Server on your windows Computer .
you may see one of these Errors :

 "Microsoft HTTP/API 2.0" Using Port 80

 WAMP - Your port 80 is actually used 

Steps For Optimal Solution to this Error -


1.  Updating/configuring httpd.conf file
2.  Updating/configuring wampmanager.tpl file
3.  Updating/configuring testport.php file
4.  Updating/configuring testportForInstall.php file
5.  Checking http.exe Application

 Updating/configuring httpd.conf file

httpd.conf file is http configuration file for apache server . All apache configuration in wamp are stored in this file . This file contains the information regarding which port and server is to connect for making connection to Server .

As this error states the port 80 is already used so follow the steps below to change the port that apache is using currently

Steps For Change Apache Port Number In WAMP

  • Click on Wamp Icon on quick Launch Bar 
  • In popup Menu click on Apache and then in further menu click on httpd.conf
  • It will open httpd.conf file in your editor like you can use Notepad
  • Now Press Ctrl + f and find for lines given below :


#Listen 12.34.56.78:80
Listen 0.0.0.0:80
Listen [::0]:80

ServerName localhost:8080
  • Now Replace these lines with given below :

#Listen 12.34.56.78:8484
Listen 0.0.0.0:84
Listen [::0]:84

ServerName localhost:8484
  • Now it's done . Press Ctrl +s  to save all changes and close the httpd.conf file
  • Now again click on wamp icon in Quick Launch Bar and click On Restart All Services 

Updating/configuring wampmanager.tpl file

1. In order to find wampmanager.tpl file you need to go to following location .Like we have installed wamp in C drive then your wampmanager.tpl file location will be c:\wamp\wampmanager.tpl
2. Now open wampmanager.tpl file and press ctrl + f and find for 'testPort84' without quotes
3. Then replace -
testPort80 with atestPort84
4. Press ctrl + s to save changes and Close the File .

Updating/configuring testport.php file

Now we need to make changes to testport.php file . This file tests for whether the port 80 is available to install the apache service to that port . 

This file checks the socket port 80 for installation of apache service . use the simple steps below to configure testport.php file 

1. I will give you simple way to configure it Just open the file testport.php . File location will be available at C:\wamp\scripts\testport.php . Just open the file and replace all the test with text given below -

<?php
$fp = @fsockopen("127.0.0.1", 84, $errno, $errstr, 1);
   $out = "GET / HTTP/1.1\r\n";
   $out .= "Host: 127.0.0.1\r\n";
   $out .= "Connection: Close\r\n\r\n";
if ($fp)
{
    echo  'Your port 84 is actually used by :';
   fwrite($fp, $out);
   while (!feof($fp)) 
   {
        $line = fgets($fp, 128);
        if (ereg('Server: ',$line))
        {
           
            echo $line;
            $gotInfo = 1;
        }  
        }
    fclose($fp);
    if ($gotInfo != 1)
        echo 'Information not available (might be Skype).';
}
else
{
    echo 'Your port 84 is not actually used.';
}
echo 'Press Enter to exit...';
trim(fgets(STDIN));
?> 

 Updating/configuring testportForInstall.php file

Now we need to make changes to testportForInstall.php file . This file tests for whether the port 80 is available to install the apache service to that port . 

This file checks the socket port 80 for installation of apache service . use the simple steps below to configure testportForInstall.php file 

1. I will give you simple way to configure it Just open the file testport.php . File location will be available at C:\wamp\scripts\testportForInstall.php . Just open the file and replace all the test with text given below -

<?php
$fp = @fsockopen("127.0.0.1", 84, $errno, $errstr, 1);
   $out = "GET / HTTP/1.1\r\n";
   $out .= "Host: 127.0.0.1\r\n";
   $out .= "Connection: Close\r\n\r\n";
if ($fp)
{
           echo  'Your port 84 is actually used by :

';
   fwrite($fp, $out);
   while (!feof($fp)) 
   {
        $line = fgets($fp, 128);
        if (ereg('Server: ',$line))
        {
            echo $line;
            $gotInfo = 1;
        }
    
    }
    fclose($fp);
    if ($gotInfo != 1)
        echo 'Information not available (might be Skype).';
    echo '
Cannot install the Apache service, please stop this application and try again.

Press Enter to exit...';
trim(fgets(STDIN));
}
else
{
    echo 'Your port 84 is available, Install will proceed.';
    echo '

Press Enter to continue...';
    trim(fgets(STDIN));
}
?> 

Checking http.exe Application

you can find httpd.exe file at location - C:\wamp\bin\apache\apache2.4.9\bin\httpd.exe , if C is installed at C drive .

Double click on file it will open for a slight small amout of time and show you any error in first line if exist otherwise everything will be fine . If error exist then try to ensure you have done previous steps completely . As these are the final possible steps that may solve this problem


Tuesday 23 December 2014

Pass Data between Activity in Android


Hello Friends ,

Today I got one message from a person to tell him how to pass data between android activities So, I am going to give a simple way for how we can transfer data or how we can pass data across activities in android . In android we use activity for  each layout code .

I am using Mono Android for this article but that will similar functions in Dalvik android that is used with java based android applications .

Here are simple Steps How to Pass data between Activities in Android Using Csharp -

  1. Open Visual Studio . Click on File --> New Project -->
  2. Now choose Mono For Android and click on Android Application . Now Simple Android application will be created
  3. This project will create a single activity named MainActivity (MainActivity.cs), which contains a button.
  4. Add a second New activity class named Activity2 to the project. by right click on Solution Name and click on New then click on Android Activity leave the name as default and click on Ok  This class must inherit from Android.App.Activity .
  5. right click on layout folder inside Resource folder then click new and choose Android Layout give it a name and leave as default and click ok .
  6. In the button.Click handler in MainActivity.cs , create an intent for Activity2 , and add data to the intent by calling PutExtra and this data given in Put Extra will be transfered to Activity2 . Add the Code Below for that :-
 button.Click += delegate {
               // button.Text = string.Format("{0} clicks!", count++);
                var activity2 = new Intent(this, typeof(Activity2));
                activity2.PutExtra("MyData", "Data from Activity1");
                StartActivity(activity2);
            };
      
      7. Now Open you layout.xm file in Resource --> layout folder ( layout folder under resource folder ) . Add code below to it for Adding button under <linearlayout> tag :-

        <Button
        android:id="@+id/MyButton"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/Hello" />    string text = Intent.GetStringExtra

    8. Now add code below to Newly added Activity - activity2.cs under Activiy.Oncreate Method :-
            ("MyData") ?? "Data not available";
            string text1 = Intent.GetStringExtra("MyData");
            Button button = FindViewById<Button>(Resource.Id.MyButton);
            button.Text = text;

       9. Now Run the app by pressing F5 and see the output in emulator as below -
Pass Data between Activity in android 
10. Now click on button saying "Hello World,Click Me!" Now you will see New Avtivity Activity2 as below that contain the text that we have passed from activity Activity1

Pass Data between Activity in android