Month: April 2013

Windows Phone became soo easy !! :) :)

Windows Phone 8

(I have downloaded the above image from http://betanews.com/wp-content/uploads/2012/09/ATIV-S-Product-Image-Front-5-600×399.jpeg, if anybody has issue with it please mail me to freemind.nitesh@gmail.com)

Hi Guys I am so sorry that I have not shown up since long time, but as I am here lets get a quick review on what all things are we going to learn and understand !!

Module 1: Windows Phone 8 Overview

CONCEPTS

• Application Platform Overview for Windows Phone
• Installing Windows Phone Developer Tools
• The Silverlight framework for Windows Phone
• Getting Oriented
• Introduction to Touch
• Sensors and Services
• Application Architecture

Module 2 : Windows Phone 8 Developer Tools

CONCEPTS

• Installing Windows Phone Emulator 8
• Windows Phone Developer Tools consist of Visual Studio IDE that includes a toolbox containing phone controls
• Phone-based designer skin, and project templates specific for phone application development
• Windows Phone Emulator that you can use to deploy, debug, and test your applications

Module 3: Basic Fundamental Concepts for Windows Phone 8 

CONCEPTS

  • Introduction Concepts that are fundamental to Windows Phone application development
  • Key fundamental Windows Phone concepts
    • Execution Model for Windows Phone
    • Frame and page navigation for Windows Phone
    • Launchers and Choosers for Windows Phone
    • Isolated Storage for Windows Phone
    • Themes for Windows Phone
    • Hardware specifications for Windows Phone
    • Web and data services for Windows Phone

Module 4 : Class Library Reference Windows Phone 8

CONCEPTS

  • Provide with the Library References that are present for Windows Phone
  • Purpose of including those references in the application

Module 5 : Getting Started with Windows Phone 8 Development

CONCEPTS

  • Provides step-by-step information for Developing Windows Phone 7 Applications
  • Learn about the Windows Phone Application Platform
  • Creating the first Windows Phone Application

Module 6 : Design Resources for Windows Phone 8  

CONCEPTS

  • Design principles that should observed when developing applications for Windows Phone
  • UI Design and Interaction Guide
  • Expression Blend for Windows Phone, design templates, and a visual explanation of the Windows Phone design system
  • Design Template for Windows Phone 8

Module 7 : Testing the application

CONCEPTS

  • What is testing ?
  • Guidance through testing process of the application
  • Testing of the application

Module 8 : Publishing Application on Windows Marketplace

CONCEPTS

  • Basics of Windows Phone Marketplace
  • Significance of Marketplace
  • Functions of  Windows Phone Marketplace
  • Guiding through the steps of publishing the application on Windows Phone Marketplace

I will try and cover each module one by one and if possible also will give you the some “Hands On” and “Demos”, lets see how things fall in place.

If you have any queries regarding anything please feel free to comment on or ask. 🙂 I am always there to help 

Will see you guys soon with a major content.

Thanks 🙂

Take care and have safe health.

Advertisements

Introduction to Application Packaging Standard (APS)

Application Packaging Standard gives a medium to package your Software-as-a-service (Saas) application. I got a nice experience of working with such packages and thought it would be good to blog it out!

First off, I would like to create a scenario where you have a web application, which can be deployed to a panel which will be handling your application. So, in such scenario, the package, when deployed, will be working as per your requirement.

In my case, I used Parallels Plesk Panel to achieve the purpose. I had to download it from the website, and install it on my local machine so that I was able to install the packages that I am going to develop.

In my case, I was more than curious to have my IIS-based application on the Plesk panel, so I installed the Plesk panel with ASP.NET support as well as SQL Server Database support.

Having created a scenario for installing and deploying the APS package, we will go through a short but important explanation of APS package.

An APS package is basically a simple compressed package, with an extension .app.zip. It is important to note that creating a mere compressed package will not work; it should follow some standards which are provided at the APS website.

Introduction to APS Specification

It provides a set of rules to be followed by a package in order that the package will be APS compliant. I will just borrow some material from APS website as an illustration to the things I am going to explain.

Following figure from the APS specification page clearly illustrates the package contents.

Img

I will go into details of each entity.

APP-META.xml

This file is responsible for keeping a track of following elements.

Application Information
  • General information: application name, version, change log, etc.
  • Vendor information: name, website, etc.
  • Packager information: characteristics of package manufacturer. It also includes a very important field, called package uri, which must be kept unique as far as each version/release of the application is concerned.
  • It also includes summary, category & description of the application and screenshots for the application.

These things are covered under application information element.

Services
  • Each application offers some service to its users. These services are specified in the services element.
  • There can be a license agreement, settings for service instance, control elements to be added to the user interface included in the services element.
  • Settings for service instance can also be included in the services element.

The APP-META.xml file follows simple xml schema architecture for the structure.

APP-LIST.xml

This particular file is responsible for keeping a track of all the files and folders present in the package. More importantly, this file also conveys useful information about each file in the package as far as hash value, size of the file is concerned. This is very important so as to track the changes in each file as various packages can be issued for any given application.

Scripts

This folder involves all the scripts which are necessary for an application package to work.

The important and very first file responsible for overall installation and functioning of the package is configure file. This file is included in the scripts folder, which is thereby invoked at the time of installation.

You can also insert the SQL scripts in the folder as declared in the configure file. I will be taking your through a detailed package creation tutorial, where you will actually get an exposure so as to how to create a package which is APS complaint, more or that later.

In the end, for a proper functioning of your package, the steps or the scripts are invoked by using files in this folder.

Images

This folder takes care of the branding of the package.

All the icons and screenshots are packed in this folder. Icons, particularly for an application, which are visible on the panel where you will be uploading the apps, are redirected from this folder.

The icons of packager, vendors are also present in this particular folder.

Htdocs

This is very crucial and important folder of the package, where you will put all your application files.

Particularly speaking, considering an example of a simple IIS-hosted web application, the published files are kept here in the folder.

This was all about a short and simple description about how the APS packages are and how they exist.

In the proceeding posts, I will take you through the environment for APS packages in detail.

Before putting down your first Step in development.

Hi People there are some prerequisites before we directly jump into the development of Windows Phone. Following are some prerequisites that will enable you and make it more simple to develop the app on Windows Phone

  1. .Net
  2. C#
  3. Silverlight
  4. OOPS Concepts

Going ahead you will be able to understand and build on the Windows Phone apps :

  1. Getting Started: The app platform, setting up tools and creating the first app.
  2. Developer Tools: The Visual Studio IDE and Windows Phone Emulator.
  3. Design Resources: Application bar icons, UI design principles, Expression Blend, and the design system.
  4. Fundamental Concepts: What you need to know before you begin creating your first application.
  5. Application Features and Common Development Tasks –Tasks that are common for all Windows Phone applications, and not related to specific features.
  6. Marketplace Publishing and getting paid– How to publish your app on App Hub and get paid for your work.

 

Will keep you posted people … :) :)

Jquery split() with IE8 issue

Jquery split() with html tags and browser

 I am working on HTML 4.0 + HTML 5 with jquery. I have a scenario as follow,

I want to create a list using ul, li structure from following string

String:

data =”

Lorem Ipsum is simply dummy text of the printing and typesetting industry.

<ul>

       <li>Test content 1</li>

       <li>Test content 2</li>

       <li>Test content 3</li>

</ul>

Lorem Ipsum is simply dummy text of the printing and typesetting industry. ”

so I need to create a structure at runtime from above string as follow,

Strucuture:

<ul>

       <li><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p></li>

       <li>Test content 1</li>

       <li>Test content 2</li>

       <li>Test content 3</li>

       <li><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p></li> </ul>

So I need to group non-tag data in ul, li list inside the paragraph tag <p></p> and remaining

data which is already inside the <li></li> structure as it is.

So I have create the function as follow,

 // Convience function for creating new jQuery objects
        function $tag(tag, id, css, style) {
            var element = document.createElement(tag);
            if (id) { element.id = id; }
            if (css) { element.setAttribute("class", css); }
            if (style) { element.setAttribute("style", style); }
            return $(element);
        }

code:
var ul_strucure = $tag("ul", false, false, false);

var temp = $tag("div", false, false, false).append(data);

$($(temp).children().filter("ul")).empty();

var nontag_data = "";

nontag_data = $(temp).html().split("<ul>").join("").split("</ul>").join("*<ul>*").split("*");

var ul_data = $tag("div", false, "", false).append(data["transcript_data"]).children()
              .filter("ul");

 var j = 0;

for (i = 0; i < nontag_data.length; i++) {

    if (nontag_data[i].toLowerCase() != "<ul>" && nontag_data[i]) {  

               $(ul_strucure).append($tag("li", false, false, false)

               .append($tag("p", false, false, false).html(nontag_data[i])));
        }
    else if (nontag_data[i].toLowerCase() == "<ul>" && nontag_data[i]) {

     for (k = 0; k < $(ul_data[j]).children().length; k++) {

          $(ul_strucure).append($tag("li", false, false, false)

               .html($($(ul_data[j]).children()[k]).text()));

                 }

             j = j + 1;
          }
     }

The above code is working fine in IE9, IE10, mozilla, chrome, safari

So split()  is return an array with given splitter expression.

but in IE8 I face a problem that the split method not returning the array for same above code,

After 2 days I found the solution as follow,

in IE8 inside < and >  means HTML tags and automatically convert it in to the upper case,

So I have updated the my function for browser specific as follow,

 
if ($.browser.msie && $.browser.version < 9) {
      nontag_data = $(temp).html().split("<UL>").join("").split("</UL>").join("*<UL>*")
                     .split("*");
      }
   else {
      nontag_data = $(temp).html().split("<ul>").join("").split("</ul>").join("*<ul>*")
                     .split("*");
   }

SO the small correction in code, It will work 
all browsers

Enter into Windows Phone 8

Hi everyone,

I will be uploading a series of blogs where in I will describe how Windows Phone 8 development is easy and new and attractive.

I will be guiding you through some steps which will actually help you to cover up all the Windows Phone 8 basics and help you in development in Windows Phone 8.

We will progressively move from basic steps to the advanced versions of how you can actually develop things on Windows Phone and get the application done and publish it on the Marketplace.

 

Be with me people, and believe me I am there to help you …

Using node.js to serve static html web pages

If you are a beginer for node here is the definition as per nodejs.org

It’s a platform built on chrome’s javascript runtime for easily building fast scalable network applications. Node.js uses and event driven, non-blocking IO model that makes it lightweight and efficient, perfect for data intensive real-time applications that run on distributed devices. 

I started with node hello-world app and quickly started comparing with the traditional web frameworks. Realised that to take advantage of node it should serve the basic needs of the typical internet application platform only then we can scale it to build advanced, seamless, complex and robust web applications. Hence I defined a first task to myself:  “Creating a WebServer serving static html web pages“.

Here is the brief tutorial to how to get that going: Install node from nodejs.org.

create package.json and add the following lines:

{
“name”: “static-web”
, “version”: “0.0.1”
, “private”: true
, “dependencies”: {
“requirejs”: “latest”
, “connect”: “2.7.0”
}
, “devDependencies”: {
“path”: “latest”
, “events”: “latest”
}
, “scripts”: {

}
}

run npm install on command prompt to install dependent packages. The server is created using http.createServer command and need to use the filesystem module and pass html files to the server requests. 

The code looks like:

http.createServer(function(request, response) {

var lookup = path.basename(decodeURI(request.url)) || ‘index.html’,f=’content/’ + lookup

}).listen(8000);

Once the server is configured run the following command to fire up the server

node server.js

you are done! server is up and running subsequently we can add many html files in this folders with links etc.. to server a static web server. Download complete code from github using the following command:

git clone https://github.com/uhbl92/node-static-server.git

 

Powershell Commands & Scripting

Process & Help related commands:

  1. get-process:  It returns all the process that are current running in windows.

E.g:

PS D:\Projects\Practice> get-process

Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName

——-  ——    —–      —– —–   ——     — ———–

305      29    74312      92116   256     3.19   1976 AcroRd32

236      15     5180      13156    97     0.08   4276 AcroRd32

105       9     6784       8204    40     0.06   6948 audiodg

30       5      640       2644    29            1548 conhost

30       4      608       2440    27            1660 conhost

338      14     1724       3984    52             520 csrss

445      25     2232      66576   231             596 csrss

We can add a wild card search to find a particular process information as.

PS D:\Projects\Practice> get-process note*

Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName

——-  ——    —–      —– —–   ——     — ———–

84       8     1356       6792    91     0.17   4588 notepad

  1. stop-process: It stops a particular process depending on the process id we pass to the command.

E.g: Process id of notepad is 4588 so to stop the notepad process we can do the following.

PS D:\Projects\Practice> get-process note*

Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName

——-  ——    —–      —– —–   ——     — ———–

84       8     1356       6792    91     0.17   4588 notepad

PS D:\Projects\Practice> Stop-Process -id 4588

PS D:\Projects\Practice>

  1. Using –whatif to prototype a command: In the above example we stopped the process but we never came to know what the stop-process command actually did. So here we can use the –whatif parameter to know what exactly the process is doing. Below example will illustrate the same.

PS D:\Projects\Practice> Get-Process note*

Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName

——-  ——    —–      —– —–   ——     — ———–

68       7     1244       5448    89     0.02    484 notepad

PS D:\Projects\Practice> stop-process -id 484 -WhatIf

What if: Performing operation “Stop-Process” on Target “notepad (484)”.

PS D:\Projects\Practice>

So the –Whatif parameter revealed the action performed “What if: Performing operation “Stop-Process” on Target “notepad (484)”.

  1. Confirming Commands: We can ask a user to confirm whether to execute the command or not
    with the –confirm parameter.

So as we can see from the screenshot the command is asking for confirmation from the user whether to continue execution.

  1. Working with the help option: If you want to get some help related to some commands use the “Get-Help” command. Lets see how it works with the commands we executed above say Stop-Process.

PS D:\Projects\Practice> Get-Help stop-process

NAME

Stop-Process

SYNTAX

Stop-Process [-Id] <int[]> [-PassThru] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]

Stop-Process -Name <string[]> [-PassThru] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]

Stop-Process [-InputObject] <Process[]> [-PassThru] [-Force] [-WhatIf] [Confirm]  [<CommonParameters>]

ALIASES

spps

kill

REMARKS

Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help.

— To download and install Help files for the module that includes this cmdlet, use Update-Help.

— To view the Help topic for this cmdlet online, type: “Get-Help Stop-Process -Online” or

go to http://go.microsoft.com/fwlink/?LinkID=113412.

So we can see that a detailed help is provided with all the options we can use with Stop-Process. You can also use other options with get-help given below.

  1. Get-help Stop-Process –detailed
  2. Get-help Stop-Process –full
  3. Get-help Stop-Process –examples

Can also do a wild card search to get help as:

  1. Get-help about*
  2. Get-help get*

System info & output formatting commands:

  1. Get-Childitem Cmdlet: Used to get all the files and folders in a directory as “dir” command in DOS. Eg:

PS D:\Projects\Practice> Get-ChildItem C:\

Directory: C:\

Mode                LastWriteTime     Length Name

—-                ————-     —— —-

d—-          4/9/2013   2:07 AM            inetpub

d—-          4/9/2013   1:50 AM            Intel

d—-         7/26/2012   1:03 PM            PerfLogs

d-r–          4/9/2013   2:45 AM            Program Files

d-r–          4/8/2013   5:04 PM            Program Files (x86)

d-r–          4/8/2013   4:13 PM            Users

d—-          4/9/2013  10:23 AM            Windows

-a—          4/8/2013   2:35 PM       1024 .rnd

PS D:\Projects\Practice>

  1. Formatting output with the Format-List Cmdlet: We can pipe the Format-List Cmdlet with  Get-Childitem or any other commands to format the output in more detail as per our requirement. Given example will display all display file and folder information in C drive in more depth.

PS D:\Projects\Practice> Get-ChildItem C:\ | Format-List

Directory: C:\

Name           : inetpub

CreationTime   : 4/9/2013 2:06:56 AM

LastWriteTime  : 4/9/2013 2:07:01 AM

LastAccessTime : 4/9/2013 2:07:01 AM

Name           : Intel

CreationTime   : 4/9/2013 1:50:42 AM

LastWriteTime  : 4/9/2013 1:50:42 AM

LastAccessTime : 4/9/2013 1:50:42 AM

Name           : PerfLogs

CreationTime   : 7/26/2012 1:42:58 PM

LastWriteTime  : 7/26/2012 1:03:46 PM

LastAccessTime : 7/26/2012 1:03:46 PM

Name           : Program Files

CreationTime   : 7/26/2012 11:07:58 AM

LastWriteTime  : 4/9/2013 2:45:02 AM

LastAccessTime : 4/9/2013 2:45:02 AM

Name           : Program Files (x86)

CreationTime   : 7/26/2012 11:07:58 AM

LastWriteTime  : 4/8/2013 5:04:29 PM

LastAccessTime : 4/8/2013 5:04:29 PM

Name           : Users

CreationTime   : 7/26/2012 11:07:58 AM

LastWriteTime  : 4/8/2013 4:13:39 PM

LastAccessTime : 4/8/2013 4:13:39 PM

Name           : Windows

CreationTime   : 7/26/2012 11:07:59 AM

LastWriteTime  : 4/9/2013 10:23:30 AM

LastAccessTime : 4/9/2013 10:23:30 AM

Name           : .rnd

Length         : 1024

CreationTime   : 4/8/2013 2:35:18 PM

LastWriteTime  : 4/8/2013 2:35:18 PM

LastAccessTime : 4/8/2013 2:35:18 PM

VersionInfo    : File:             C:\.rnd

InternalName:

OriginalFilename:

FileVersion:

FileDescription:

Product:

ProductVersion:

Debug:            False

Patched:          False

PreRelease:       False

PrivateBuild:     False

SpecialBuild:     False

Language:

We can also specify particular property name just to view particular properties of files and folders. Given example illustrates where we print only the name and length.

PS D:\Projects\Practice> Get-ChildItem C:\ | Format-List -Property name, length

Name : inetpub

Name : Intel

Name : PerfLogs

Name : Program Files

Name : Program Files (x86)

Name : Users

Name : Windows

Name   : .rnd

Length : 1024

Using the Format-Wide Cmdlet: We can use the Format-Wide Cmdlet in the same way we use the Format-List Cmdlet. Given Example will illustrate.

PS D:\Projects\Practice> Get-ChildItem C:\ | Format-Wide

Directory: C:\

[inetpub]                                                          [Intel]

[PerfLogs]                                                         [Program Files]

[Program Files (x86)]                                              [Users]

[Windows]                                                          .rnd

  1. New-Object Cmdlet: The use of objects in powershell helps us to do things that are not built into the Powershell. We can access comobjects using the New-Object Cmdlet. We can use following commands to access the object called as wshShell object:

$wshShell = new-object –comobject “wscript.shell”

The above line will using New-Object Cmdlet create a new instance of wscript.shell and will accolcate to variable $wshShell. Now if we want to invoke an instance of calculator by using run method we can write.

$wshShell.Run(“calc.exe”)

Below screenshot describes what actually happened when we executed the command:

To get the current windows installable directory path we can use the ExpandEnvironmentStrings() method.

PS D:\Projects\Practice> $wshShell.ExpandEnvironmentStrings(“%windir%”)

C:\Windows

To get network related information we have to use the “wscript.network” object.

PS D:\Projects\Practice> $wshNetwork = new-object -comobject “wscript.network”

We can get current username logged into system we can use the username property of wscript.network object.

PS D:\Projects\Practice> $wshNetwork.UserName

Arunava

To get Domain name we can use UserDomain property.

PS D:\Projects\Practice> $wshNetwork.UserDomain

PMTSMIT02

To get Computer name we use ComputerName property.

PS D:\Projects\Practice> $wshNetwork.ComputerName

PMTSMIT02

To display any information in popup we can use popup() method of wscript.shell object

Invoking .Net libraries and code using powershell:

PowerShell  is can invoke static methods and properties from the .Net Framework. Let’s focus on the System.DateTime class. Let’s see the different methods and properties available.

All the static member and properties will be displayed

PS D:\Projects\Practice> [System.DateTime] | gm –static

TypeName: System.DateTime

Name            MemberType Definition

—-            ———- ———-

Compare         Method     static int Compare(datetime t1, datetime t2)

DaysInMonth     Method     static int DaysInMonth(int year, int month)

Equals          Method     static bool Equals(datetime t1, datetime t2), static bool Equals(System.Object objA, System.Object objB)

FromBinary      Method     static datetime FromBinary(long dateData)

FromFileTime    Method     static datetime FromFileTime(long fileTime)

FromFileTimeUtc Method     static datetime FromFileTimeUtc(long fileTime)

FromOADate      Method     static datetime FromOADate(double d)

IsLeapYear      Method     static bool IsLeapYear(int year)

Parse           Method     static datetime Parse(string s), static datetime Parse(string s, System.IFormatProvider provider), stat…

ParseExact      Method     static datetime ParseExact(string s, string format, System.IFormatProvider provider), static datetime P…

ReferenceEquals Method     static bool ReferenceEquals(System.Object objA, System.Object objB)

SpecifyKind     Method     static datetime SpecifyKind(datetime value, System.DateTimeKind kind)

TryParse        Method     static bool TryParse(string s, [ref] datetime result), static bool TryParse(string s, System.IFormatPro…

TryParseExact   Method     static bool TryParseExact(string s, string format, System.IFormatProvider provider, System.Globalizatio…

MaxValue        Property   static datetime MaxValue {get;}

MinValue        Property   static datetime MinValue {get;}

Now             Property   datetime Now {get;}

Today           Property   datetime Today {get;}

UtcNow          Property   datetime UtcNow {get;}

Lets try and invoke a static method:

PS D:\Projects\Practice> [System.DateTime]::IsLeapYear(2009)

False

We can also create .Net objects. Let’s create a date object:

PS D:\Projects\Practice> $d = new-object System.DateTime 2009,11,11

Get the current datetime using the date object.

PS D:\Projects\Practice> $d – [System.DateTime]::now

Days              : -1245

Hours             : -18

Minutes           : -26

Seconds           : -23

Milliseconds      : -650

Ticks             : -1076343836507017

TotalDays         : -1245.76832929053

TotalHours        : -29898.4399029727

TotalMinutes      : -1793906.39417836

TotalSeconds      : -107634383.650702

TotalMilliseconds : -107634383650.702

Lets add some days to the date object.

PS D:\Projects\Practice> $d.AddDays(11)

Saturday, April 20, 2009 18:29:45 PM

Lets now create a powershell script copy and save the below line of code as test.PS1 extension.

Add-Type @”

namespace t1

{

public class Point

{

public int x;

public int y;

public Point(int x, int y) {

this.x = x;

this.y = y;

}

public override string  ToString()

{

return string.Format(“POINT({0}, {1})”, x,y);

}

public void Double()

{ x = x*2;

y = y*2;

}

}

}

“@

The command Add-Type is used to declare the type that follows in the C# code. The C# code is a simple Point class. It has a constructor, and overridden ToString method and a Double function.

Switch back to the PowerShell window and change directories to the one that holds the script and invoke the script.

PS D:\Projects\Practice> .\test.ps1

The type is now defined and be freely used. Let’s create a Point.

PS D:\Projects\Practice> $p = New-Object T1.Point 10,10

Let’s check the contents of $p.

PS D:\Projects\Practice> $p | ft –auto

x  y

–  –

10 10

Let’s invoke the Double method.

PS D:\Projects\Practice> $p.Double()

Now lets check whats the value in $p.

PS D:\Projects\Practice> $p.ToString()

POINT(20, 20)

Now lets invoke the method using the wscript.shell popup() method.

PS D:\Projects\Practice> $wshShell.Popup($p.ToString())