Category: Uncategorized

Things to keep in mind while designing User Interface

Hi Guys!

This is my first post so not writing anything too heavy!!!

So, we are going to see things to follow while designing webpages.

Basically the website we design need to be user friendly and easy to understand to any kind of user.
Today i am writing only about Sign Up.

On the Opening of the site that is home page of the site, try to make the sign up button more effective and more attention grabbing. Try to write FREE in bold so that gets the user attention easily. Once the user clicks on it he is all yours.

While designing a Sign Up page for any kind of site, you must keep it as simple as you can to get more customers.
On the sign Up page don’t ask the user too much of information for logging in.
keep minimum questions like

Email,
First Name,
Last Name,
& Password.

Once the User is logged in then you can ask him to update his profile with the remaining questions you want to ask.

Thanks for reading…. ūüôā

Advertisements

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())

Customizing Agile story using a custom template in JIRA

In Agile projects at times requirements are periodical and come in a specific format. The default story interface is a free flow text and do not allow customizations. Custom field’s options from JIRA enable us to achieve this task. Detailed instructions are here:
https://confluence.atlassian.com/display/JIRA/Adding+a+Custom+Field
Hence for a web application or a web page now I can add fields like:
Page Title:
Layout template: (multicolumn/single column/grid) etc..
A sub-task module further simplifies task by adding multiple pages where now each page can be specified with multiple custom fields.

My prototype development experience with Magento

Magento is an ecommerce framework vendor where we recently developed a prototype. I started off with installing Magento Community Edition from http://www.magentocommerce.com/download

Magento offers demo data as optional installation. If you are installing for first time it’s recommended to also download the demo data.

Before installing you need a Wamp or XAMP installed on your windows machine. If you install the latest version it may not be supported as yet so do check the System Requirements from http://www.magentocommerce.com/system-requirements page before copying downloaded files in your web folder. Load the sample data in magento database and point to your browser to magento web folder. Rest of the installation is straightforward and once you setup the passwords you are done.

Browse to the admin panel and there are plenty of things to configure from extensions to add-ons to third party integrations. The crux of the magento is in these configurations. Once configured the payment method and other customizations you are done! Now next step is to add modify the product catalog. Since we loaded the sample data its already there. Your first magento application is now ready.

If don’t want to do even these steps there is a easier way out to directly go for hosted solution checkout http://go.magento.com/plans/

Conclusion: eCommerce app development couldn’t get easier than this!

JMeter Introduction for beginners…

What is Jmeter?

Apache JMeter is used as a load testing tool for analyzing and measuring the performance of a variety of services of web application.

Jmeter is a java based open source software tool.

JMeter can help you to do regression testing of your application by creating test scripts for web services.

JMeter runs in two modes:

  1. GUI mode (which runs on windows)
  2. Non-GUI mode (which runs on Linux)

 

Use of Jmeter?

JMeter can be used as a unit test tool for database connections, web services, etc.

Jmeter uses to test the load and performance of the web services.

Running Jmeter in GUI mode (which runs on windows)

Installation:

1. Install Java run time in your PC
url:- http://www.java.com/en/download/index.jsp

2. download Jmeter release.
url:- http://jmeter.apache.org/download_jmeter.cgi

3. Extract in your specify folder like as C://
run the file (C://jakarta-jmeter-x.x/bin/jmeter.bin)

Start the Jmeter interface, i.e. jMeter windows batch file from bin folder.

 

How to run JMeter?

Steps to run JMeter are as follows,

  1. Start JMeter windows batch file from bin folder, it will open interface as shown in below:Image
  2. Create your first test plan by creating thread group:Image
  3. Added Thread group:Image

Here thread group consists of 3 main properties,

a. Number of threads(users): It consists of number of requests you want to run in one test plan.

b. Ramp-up period (in seconds): It tells us how long all requests takes time to run. If there are multiple requests, then all requests get run one by one.

c. Loop count: It shows count that all requests get run in how many loops.

All samplers and listeners are involved in thread group.

4. Adding sampler:Image

Samplers describes that ‚ÄúJmeter sends web requests to server and wait till response comes.‚ÄĚ

5. Sampler (e.g: Http Request):Image

In this sampler, you can add parameters to send request to server to run the service.

6. Add listener:Image

Listener, ¬†where test data and result get stored and it displays the output in different ways. Here added listener is ‚ÄúView as a tree‚ÄĚ.

7. Run the test plan with result tree:

Now Select listener and run the test plan.Image

In this listener, output gets display in detail with,

a. Sample result: Where load time, sample count get displays to you.

b. Request: What request you send to server.

c. Response data: The exact output comes from server.

8. Run the test plan with result table: Here, table shows all results in tabular form with no. of requests and average time for all requests.Image

In this way your simple test plan of a web service get executed.