Month: May 2013

Silverlight Framework for Windows Phone 8

New Windows Phone 8

 

 

(I have downloaded the above image from http://i.i.com.com/cnwk.1d/i/tim/2012/08/29/SamsungAtivS_side_610x455.png, if anybody has issue with it please mail me to freemind.nitesh@gmail.com)

Hello again people. Lets discuss how Silverlight helps us in development in the Windows Phone apps.

Basically I will tell you what exactly is Silverlight and for what is it used for.

  1. Silverlight is cross browser, cross platform implementation of .Net framework that helps in the developing and designing of the applications.
  2. Silverlight helps in designing rich user interface and Rich Interactive Applications(RIA) for web, desktops and now for Windows Phone too.
  3. Silverlight uses Application Extensible Markup Language (XAML) for ease of UI development. It helps in designing of UI controls like buttons, controls, layout, graphics  while using managed code or dynamic languages for application logic.
  4. WPF and XAML. Silverlight includes a subset of the Windows Presentation Foundation (WPF) technology, which greatly extends the elements in the browser for creating UI. Silverlight lets you create immersive graphics, animation, media, and other rich client features, extending browser-based UI beyond what is available with HTML alone. XAML provides a declarative markup syntax for creating elements. For more information, see Layout, Input, and PrintingGraphics, Animation, and Media, and Controls.
  5. The Windows Phone OS is the one which is mainly designed for the touch firs wet citizen interactive with the user. So as a developer you need to really take good care of the UI designs.
  6. For the integration on this UI designs we make extensive use of Silverlight.

This is why we make use of Silverlight in Windows Phone platform.

As we proceed in that I will show you how we use Silverlight or make use of Silverlight in the Windows Phone application.

Take care and have good health :)

Advertisements

CRUD using Node.js,Express.js,MongoDB

I try to explain CRUD operation Using Node.js ,Express.js and MongoDB

Installing Node.js

Go to http://nodejs.org, and click the Install button.
Run the installer that you just downloaded. When the installer completes, a message indicates that Node was installed at C:/program file/node/bin/node and npm was installed at C:/program file/node/bin/npm.
3.open editor save as app.js

var http = require(‘http’);

http.createServer(function (request, responce) {
responce.writeHead(200, { ‘Context-Type’: ‘text/plain’ });
responce.end(‘Hello World \n’);
}).listen(8080);
console.log(‘Server is running on port no 8080’);

4.Open command line.

eg. path>node app.js

5. in cmd console print like this Server is running on port no 8080

6.Open browser type in url – http://localhost:8080

7.Hello World print in browse window.

8. install express package like path>npm install express

9.modify app.js
var express = require(‘express’),

var app = express();

app.configure(function(){
app.use(express.logger(‘dev’));
app.use(express.bodyParser());
});

app.listen(8080);

console.log(‘Server is running on port 8080…’);

10.Now that Express is installed application running, we can stub a basic REST API for the CRUD application

11.Open app.js and replace its content as follows:

var express = require(‘express’),

products = require(‘./routes/products’);

var app = express();
app.configure(function(){
app.use(express.static(__dirname + ‘/View’));
app.use(express.logger(‘dev’));
app.use(express.bodyParser());
});

app.get(‘/’, function(req, res){
res.sendfile(__dirname + ‘/index.html’);
});
app.get(‘/products/:PName’, products.findByName);
app.post(‘/products/:PName/:Type/:Description’,products.addProduct);
app.put(‘/products/:PName/:Type/:Description’, products.updateProduct);
app.delete(‘/products/:PName’, products.deleteProduct);

app.listen(8080);
console.log(‘Server is running on port 8080…’);

12. create product modules in route directory /route/product.js

In product.js we will perfrom CRUD operation.

Install MongoDB.

1.To install MongoDB on your specific platform, refer to the MongoDB QuickStart. Here are some quick steps to install MongoDB on a window:
Open a terminal window and type the following command to download the latest release:
curl http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.2.0.tgz > ~/Downloads/mongo.tgz

Note: You may need to adjust the version number. 2.2.0 is the latest production version at the time of this writing.

Extract the files from the mongo.tgz archive:
cd ~/Downloads
tar -zxvf mongo.tgz

Move the mongo folder to /usr/local (or another folder according to your personal preferences):
sudo mv -n mongodb-osx-x86_64-2.2.0/ /usr/local/

(Optional) Create a symbolic link to make it easier to access:
sudo ln -s /usr/local/mongodb-osx-x86_64-2.2.0 /usr/local/mongodb

Create a folder for MongoDB’s data and set the appropriate permissions:
sudo mkdir -p /data/db
sudo chown `id -u` /data/db

Start mongodb
cd /usr/local/mongodb
./bin/mongod

You can also open the MongoDB Interactive Shell in another terminal window to interact with your database using a command line interface.
cd /usr/local/mongodb
./bin/mongo

Refer to the MondoDB doc.

To provide the data access logic for each route, modify Product.js as follows

var express = require(‘express’);
var mongo = require(‘mongodb’);
var Server = mongo.Server,
Db = mongo.Db,
BSON = mongo.BSONPure;

var server = new Server(‘localhost’, 27017, { auto_reconnect: true });
db = new Db(‘productsDB’, server);

//Open Connection
db.open(function (err, db) {
if (!err) {
console.log(“Connected to ‘productsDB’ database”);
db.collection(‘products’, { strict: true }, function (err, collection) {
if (err) {
console.log(“The ‘productsDB’ collection doesn’t exist. Creating it with sample data…”);
// populateDB();
}
});
}

Write all CRUD operation in Product.js.

exports.findByName = function (req, res) {
var PName = req.params.name;
db.collection(‘products’, function (err, collection) {
collection.find({ “PName”: PName }).toArray(function (err, names) {
res.header(“Content-Type:”, “application/json”);
res.send(JSON.stringify(names));
}); // End Collection.find()
}); //End db.collection()
}; //End findByName

exports.addProduct = function (req, res) {
var product = req.body;
db.collection(‘products’, function (err, collection) {
collection.insert(product, { safe: true }, function (err, result) {
if (err) {
res.send({ ‘error’: ‘An error has occurred’ });
} else {
console.log(‘Success: ‘ + JSON.stringify(result[0]));
res.send(“Successfully Add product”);
console.log(“Add Record”);
}
});
});
}

exports.updateProduct = function (req, res) {
var product = req.body;
db.collection(‘products’, function (err, collection) {
collection.update({ PName: req.params.PName }, { PName: req.params.PName, Type: req.params.Type, Description: req.params.Description });
console.log(“Record is Update”);
res.send(req.body);
});
}

exports.deleteProduct = function (req, res) {
var PName = req.params.PName;
console.log(‘Deleting product: ‘ + PName);
db.collection(‘products’, function (err, collection) {
collection.remove({ PName: PName });
res.send(req.body);
});
}

});

Enjoy…..

About MVC4

Hello Everyone,

I want to share some ideas about MVC4. This is useful for all kind of beginners who wanted to get started with MVC4. I learned all these things & really it’s a nice experienced for me. It is useful in future also. I just explain you following things about MVC4 in short.

  • Introduction
  • Basic Concepts
  • How MVC works?
  • Advantages
  • Features & so on…….

Introduction:

ASP.NET MVC 4 (Model View Controller) is open source. It helps to reduce the complexity of the web application by dividing an application into three layers, Model, View and Controller.

Steps for creating MVC4 application in visual studio 2010/1012:

  • First Select New Project from the Start page or you can use the menu and select File -> New Project.

MVC

  • You can create applications using C# or VB as the programming language. Select C# and then select ASP.NET MVC 4 Web Application.

MVC1

  • Give a name to your project and then click OK.
  • Select Internet Application & Leave Razor as the default view engine & click OK.

MVC2

Basic Concepts:

  • View Engines are used for designing. It is responsible for rendering the HTML from your views to the browser. The types of four view engines are as fallows:
  1. ASPX (C#)
  2. Razor (CSHTML)
  3. NHaml
  4. Spark
  • Name of different return types of controller action method are:
  1. View Result
  2. JavaScriptResult
  3. RedirectResult
  4. ContentResult
  5. JsonResult
  6. EmptyResult
  • The three segments of default route, that is present in ASP.NET MVC application are:
  1. Controller Name
  2. Action Method Name
  3. Parameter that is passed through action method
  • MVC File Structure & File Naming Standards:

It uses a standard directory structure and file naming standards. There must be 3 directories each for model, view and Controller. Expect from these 3 directories, there must have a Global.asax file in root folder, and a web.config.

  • Root
  • Controller
  • Controller CS files
  • Models
  • Model CS files
  • Views
  • View aspx/ascx files
  • Global.asax
  • Web.config

Framework:

The pictorial representation of MVC framework is as follows:

MVC3

An MVC application consists of Model, View and Controller.

  1. Model: It consists of the method definations, data access logic and Business Objects.
  2. View: A view is used for user interface.
  3. Controller: It call views. It consists of the main application flow logic.

Advantages:

The main advantages of ASP.net MVC are:

  1. Enables the full control over the rendered HTML.
  2. Provides clean separation of concerns.
  3. Enables Test Driven Development.
  4. Easy integration with JavaScript frameworks.
  5. No ViewState and PostBack events

New Features in MVC4:

  • ASP.NET Web API

-It consists following features:

  • Modern HTTP programming model
  • Full support for routes
  • Model binding and validation
  • Improved testability
  • Code-based configuration
  • Create custom help and test pages
  • Link generation
  • Refreshed and modernized default project templates
  • New mobile project template
  • Many new features to support mobile apps
  • Enhanced support for asynchronous methods

If you know more about this then please share.

Thank you…..

Installing Windows Phone Developer Tools

New Windows Phone

(I have downloaded the above image from http://regmedia.co.uk/2012/11/06/nokia_lumia_920_windows_phone_8_1.jpg, if anybody has issue with it please mail me to freemind.nitesh@gmail.com)

Hello people, today I will be telling you what tools you need for the Windows Phone development and what tools you need to install.

  1. First and foremost you need to get acquainted with the Visual Studios 2012 and get a closer look at it before you start developing any apps on Windows Phone.
  2. First tool you need to install is a Windows 8/ Pro OS on your machine.
  3. As you go ahead please make sure that you have a machine with Hyper V capability as Windows Phone 8 Emulator runs on the virtual machine as Hyper V.
  4. Going ahead you also install Visual Studio 2012 on your machine. You can find the Visual Studio 2012 setup here.
  5. After the installation of Visual Studios 2012 we need to take it ahead to Windows Phone environment. Also you will need to install the Windows Phone SDK, you will find it here .
  6. Generally the SDK will self configure with the system you are using, but there can be issues regarding this.
  7. The issues can be as follows, make sure that you sort them out manually.
    1. You will have to enable the Hyper V option which is present in BIOS so that it can be used by the emulator. Also make sure that you are in local Hyper-V Administrators group.
    2. Make sure that you have DirectX 11.0 and Driver Model WDDM 1.2 . You can check them by going in DxDiag.
  8. Generally these are some of the issues that may occur and you can overcome them by the description given above.

Yes guys I guess this is the thing that you will need to meet and requirements that you need to fulfill to start with the development in Windows Phone.

If you have any queries and any question please make sure that you ask me … I am always ready to help you …

Have a nice day and keep good health :)

SharePoint 2013 Contribution for Education

SharePoint 2013 provides lots of new features one of them is Solution for Educational institutions needs for a collaborative and educational environment.It Provides features such as .

  1. Academic documents, likely books, articles etc.
  2. Communities, a new grouping mechanism, ‘parent’ of courses.
  3. Courses, academic documents, assignments, and lessons.
  4. Assignments, including assigning assignments to individual students
  5. Events, possibly real-time lectures and assignment deadlines.
  6. Meetings, including recording of online meetings and meeting schedules
  7. Quizzes.

Today, here we will see the installation process for SharePoint 2013 for Education using SharePoint 2013 Enterprise RTM. While provisioning the SharePoint for Education services, the following prerequisites are required:

Prerequisite  :-

  • Web Application:
  1. A site collection at the root that the user running the cmdlet is a Site Collection Administrator of.
  2. Self-Service Site Creation is turned on for the Web Application.Service Applications.
  • Service Applications:
  1. Managed Metadata Service Application, including Full Control over the Service Application under Administrators.  The Managed Metadata Service Proxy must have all 4 check boxes checked in the Properties, including This service application is the default storage location for column specific term sets” and “Consumes content types from the Content Type Gallery at ”.  Services
  2. User Profile Service Application, .
  3. A Session State Service.
  4. A Search Service
  5. A configured User Profile Synchronization connection to Active Directory.
  • Site Collections:
  1. A MySite host.

Installation:-

Run the following command from SharePoint Management Shell.

PS C:\Users\spfarm> Install-SPEduSites -WebApplication http://spserver2013  -MySiteHost http://spserver2013/sites/mysite -SearchCenter http://spserver2013/sites/search

This process may take some time as it will be creating multiple sites, activating features, and so forth.

Activating Feature: EduAdminPages to central Admin Site
Activating Feature: EduAdminLinks to central Admin Web
Creating: /sites/global Site Collection
Attempting to create site: http://spserver2013:80/sites/global
Activating Feature: EduShared to Institution Site
Activating Feature: EduInstitutionSiteCollection to Institution Site
Creating: /sites/admin Site Collection
Attempting to create site: http://spserver2013:80/sites/admin
Activating Feature: EduInstitutionAdmin to Admin Site
Creating: /sites/studygroup Site Collection
Attempting to create site: http://spserver2013:80/sites/studygroup
Activating Feature: Ratings to Study Group Site
Activating Feature: EduShared to Study Group Site
Activating Feature: EduCommunitySiteId to Study Group Site
Activating Feature: EduEduSearchDisplayTemplates to Study Group Site
Activating Feature: SearchWebPartFeature to Study Group Site
Activating Feature: SearchTemplatesandResources to Study Group Site
Finished Activating Fetures for Study Group Site
Creating: /sites/academiclibrary Site Collection
Attempting to create site: http://spserver2013:80/sites/academiclibrary
Activating Feature: DocMarketPlaceSampleData to Academic Library Site
Adding Academic Library Site to promoted sites view
Ensure current user has user profile
Successfully added Academic Library Site to promoted sites view
Added “All-Authenticated-Users” security group to “Site Visitors” group in Acade
mic Library
Activating Feature: EduShared to My Site Host
Activating Feature: EduDashBoard to My Site Host
Activating Feature: EduMySiteHost to My Site Host
Activating Feature: EduSearchDisplayTemplates to My Site Host
Activating Feature: EduEduSearchDisplayTemplates to Search Center Site
PS C:\Users\spfarm>

This completes the installation process for Education sites. now go to Central Admin — >General Settings, new options are added to Central Administration:
ceb

From the Academic Library, an author can publish documents relevant to the scope of the Host-Based Site Collection or Web Application.  Documents are uploaded, tagged, etc:

2

After a document is published, it allows users to rate the document.

1

From the Central Administration — > Manage Class and groups, Study Groups and Classes can be created.  For example, to create a Class, click Education in the ribbon and select the appropriate option.  Here is an example of Class creation:

3

4

You can see your classes from here.

5

Click on your class then you can manage  Class Calender,Schedule Materials discussion etc from here only.

6

Classes, Memberships, and Users appear to be created via the one Timer Job installed by the Education functionality, Education Bulk Operation.  By default, this runs every 5 minutes.

Microsoft included a Data Import and Export functionality from the Administration site.  From here, you can update user, class, and membership information.  The type of operation (add, update, delete) as well as type of entity (user, class, membership) appears to be validated based on the format of the header row of the CSV.

On the Results and Reports page, we can see I got the last one right!  You’ll also note that you can upload the same file name and SharePoint will automatically generate a new name for it if an existing file is already present.

After creating the Class Teacher can create the Assignment or quiz for student. quiz option comes under assignments type. so just drop-down the assignment type and select the quiz.

its Done  …… 🙂 🙂 🙂

Setting up Eclipse IDE for APS Packaging

To get started with APS packaging, you will need following things:

• Eclipse IDE : To develop/create packages
• Parallels Plesk Panel: To test the package at the local instance for functionalities
• APS Certification System subscription: To judge the certification level of package created.

In this particular post, I will take you through the process of installing Eclipse and use it for debugging.

Download Eclipse IDE

You can download Eclipse from the URL:

http://www.zend.com/en/community/pdt/downloads

On the page that gets displayed,

Eclipse_Download

Download Zend Eclipse PDT.

This is the most efficient and well equipped Eclipse IDE that you can use for APS packaging.

Create the APS environment in Eclipse

Once you are done downloading Eclipse, extract and open Eclipse.

Click on Help menu, select Install New Software…

APS_Ecl2

In the “Work With” location bar, enter following URL.

http://www.apsstandard.org/r/doc/sdk/eclipse-plugin

It will eventually display the APS Plug in to install. Check select APS.

Complete the wizard to install the APS Plug in.

Create separate perspective for APS

From the Window Menu, select open perspective. Click Other…

Select APS from the list.

APS_Ecl3

You will be presented with APS perspective.

Here you can start your APS packaging.

Creating your simple APS package using template

To get started with APS packaging, let us create a sample package using a template.

Make sure you are in the APS perspective.

From New menu, select new Project…

You will be presented with a wizard.

APS_Ecl4

Select APS Project, click Next.

On the next screen, give the project a name. From the available radio buttons, select New Project from Template.

From the templates, select Sample_Package_with_License-1.2.1.app

Click Finish so that you are presented with the newly created package.

Start debugging the scripts

For the scripts to be debugged, you need to use the APS Player feature.

Click on the APS player from the Run menu. It will start a new session, where you have to enter the environment variables necessary for the application to run.

That is all for now, will be back with more in APS packaging. This is very crucial article as far as development is concerned, so feel free to ask any questions!  🙂

Application Platform Overview for Windows Phone 8

New Windows Phone 8 ...

(I have downloaded the above image from http://www.ishopping.pk/product_images/r/697/nokia-lumia-white__71613.jpg, if anybody has issue with it please mail me to freemind.nitesh@gmail.com)

Hello guys I hope you have been enjoying your life. Now lets get down to some serious business 😉 just kidding….

There is no serious in Windows Phone. Everything goes fluently and smoothly around. 🙂

Lets start with the Windows Phone application life cycle :

Now basically in the application life cycle there are 9 steps that we need to be considered or rather we can call them as events that we need to put some light on.

  1. Launch Event
  2. Running
  3. OnNavigatedFrom Method
  4. Deactivated Event
  5. Dormant
  6. Tombstoned
  7. Activated Event
  8. The OnNavigatedTo Method
  9. The Closing Event

Now before I explain any further let me show you some life cycle diagram that I have taken from Microsoft site.

Application Life Cycle

(I have downloaded the above image from Microsoft Site, if anybody has issue with it please mail me to freemind.nitesh@gmail.com)

As you can see all the stages that I have mentioned above are in the diagram too. Let me tell you one thing, if you know how the application flows from start till end you will be able to understand all the Windows Phone very easily and quickly.

Lets go through each stage one by one and lets get it explained:

The Launch Event:  Now as the name suggests this event launches the new instance (instance means running the application from the start, that is having a fresh start of the app) of the application. The application can be launched by selecting from the list of application or if you have a tile of the app on the home screen or from a notification that appears on the screen, which will directly take you to the app home screen. As I have mentioned that the app should look fresh and new. There should not be any reference from the previously run of the app.When you run the app the Launch event gets raised. As the launching of the app is totally dependent on this event, and as we are here to give the perfect User experience, definitely we will not be doing any heave coding here that is in the handler of this event. Whatever you want to have the heavy loading that should be done in a background thread.

Running: Well as the name says, this event is called when the app launches. Until and unless the user moves ahead or goes behind this event keeps running.Windows Phone apps shouldn’t provide a mechanism for the user to quit or exit. There is another scenario where the running stage stops, that is when the phones lock screen has been engaged. Although this can also be skipped if you have handled the application ideal detection, now in short I will try and explain the application ideal detection, this has been introduced so that the power consumption of the app can be controlled and we can make the app most power efficient. For more details follow this.

The OnNavigatedFrom: Now this method is called whenever the user navigated from a page to nay other page. This may happen in the app or outside the app, that is within your app or when the user navigates away from the app. The important point here is you should store the information or you should save the page state as when the user returns to the app again and the page is no longer in the memory. In this there is one more property called as NavigationMode property which will determine weather you page is a backward navigation or not, if it is then you should not save the state as the next visit it will recreate itself.

The Deactivated Event: This event is called when the user moves forward from the application, and this can be done either by pressing the start button on the phone or by opening another application. This event is also called when you have  a chooser in place where, to get more information about it press here. Also is called if the device lock screen is enabled, unless application idle detection is disabled. Ideally speaking you should save all the data in the handler of this event so when ever you return, the data is not lost. The app is provided with the State object. It is a dictionary where you can store the app state information.

Dormant: After the deactivated state the operating system will try and put the app in the dormant state. Now the beauty of this state is that, the application processing and the threads will be stopped, that is there will be no processing done for the app but still the app remains intact in the memory. The best thing is that of the app is reactivated from this state it does not need to re-establish the state as it is all preserved 🙂 🙂 ….. Isn’t this amazing one !! . But now if the user gets on opening new apps and there is not enough memory to run the app then the operating system will push the dormant state apps in the  Tombstoned state to free the memory.

Tombstoned: Now this state is really interesting one, in this state the app is terminated, its just that the operating system will save the information of the navigation state and the dictionaries that were populated during the deactivated event. The tombstoning information is saved  for five apps. If the user navigates back to the tombstoned application it will take that preserved information to restore state.

The Activated Event: The activated event is called when the app returns from the Dormant or Tombstoned state. You can check that in  IsApplicationInstancePreserved property where you will see if its returning from the Dormant state or Tombstoned state. If its true its Dormant, and false then Tombstoned. Again as stated above that we have to give the best User Experience so we should not do any resource intensive tasks (loading from isolated storage or a network resource) in the activated event as it will consume time for resuming the app. instead have a background thread that will do all when the app resumes.

The OnNavigatedTo Method: This method is called when the user navigates to the page. This includes when the user first launches the app or in between the app pages. This is used to check whether the page is the new instance or the one returned from Dormant or Tombstoned state. If its not a new instance naturally the page state does not need to be restored, but it is a new one then you should use the state dictionary to restore the state of the page UI.

The Closing Event: This event is called when the user navigated backward from the main/home page of the app. This time the app is terminated and no state is saved. In this event handler you should save the persistent data that you will need through out the instances of the app. The operating system gives a limited amount of 10 secs to complete all the navigation page events, as the time exceeds the app terminates.

So guys I guess you understood all the things that I have explained in the above article. Really guys if you have not understood anything out of it, please let me know so that I can help you understand it. Anything at all.

I will keep you posted more and more.

Have a happy life and keep good health … 🙂 🙂 🙂