Er. alokpandey's Blog

Get Started SageFrame

Posted in ASP.NET (C# & VB), C#, HTML and XHTML, J-Query by Alok Kumar Pandey on April 25, 2012

On using SageFrame for your web development, you can, not only gain benefits of a CMS that is easy to use, but also an ability to create your own custom applications. Similarly, you can use applications and modules developed by other users. SageFrame’s plug and play modular architecture enables you to plug a desired module into your system and acquire the required feature instantly.


eCommerce platform

Posted in ASP.NET (C# & VB), C#, HTML and XHTML, J-Query by Alok Kumar Pandey on December 16, 2011

A new open source “Flexible and easy eCommerce platform” offers a complete ecommerce solution that allows you to run your fully functional online store in minutes.

AspxCommerce is easy to learn, use and comes enhanced with abundant features for web designers, developers and merchants alike. Merchants can enjoy complete flexibility and control over the look, content and functionality of their online store, AspxCommerce is available on ColePlex

Download AspxCommerce
for features visit demo link
to know much more please visit



“Programming Quotes”

Posted in ASP.NET (C# & VB), C#, HTML and XHTML, J-Query, JavaScript, LINQ, PLINQ, SEO, SilverLight, VB, WCF by Alok Kumar Pandey on February 15, 2011
  1. If debugging is the process of removing software bugs, then programming must be the process of putting them in. –  Edsger Dijkstra

  3. The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.  – Tom Cargill

  5. “There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies.”-  C.A.R. Hoare

  7. Measuring programming progress by lines of code is like measuring aircraft building progress by weight. – Bill Gates

  9. “Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” – Martin Golding

  11. “The trouble with programmers is that you can never tell what a programmer is doing until it’s too late.” – Seymour Cray

  13. Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. – Rick Cook

  15. “Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris.” – Larry Wall

  17. “Sometimes it pays to stay in bed on Monday, rather than spending the rest of the week debugging Monday’s code.” – Christopher Thompson

  19. Walking on water and developing software from a specification are easy if both are frozen. –Edward V Berard


How CRUD Is Your Design?

Posted in ASP.NET (C# & VB), C#, HTML and XHTML, J-Query, JavaScript, LINQ, PLINQ, SEO, SilverLight, VB, WCF by Alok Kumar Pandey on February 9, 2011

If you’re a software developer or know one well, the acronym CRUD — Create, Read, Update and Delete — is burned into your vocabulary. These are some of the foundational elements of good software development, and each provides ways to keep your audience engaged.

When you take any one of these elements away from your users, there’s a good chance you’ll diminish the value of their experience. Here’s why.


When your audience isn’t allowed or doesn’t know how to contribute, they become passive bystanders. Your website or application no longer provides an interaction or dialogue and it probably won’t lead to a meaningful user experience.

The more you treat your audience as equals, the better. If you’re a news community like Newsvine, invite your users to create news. If you’re a information community like Wikipedia, invite your audience to create information. If you sell products like Amazon, make ratings and reviews an important part of the interface.


Confidence erodes when people can’t see data they’ve added to a website or application. They scratch their heads, wondering: Did it work? Did I do it right?

When uncertainty creeps in, people tend to blame themselves or the tool they’re using. Both scenarios are problematic, so show users where their data goes and how they can get back to it in the future.


“There are just some things you can’t take back.” This philosophy applies in the real world, but it should be avoided in a website or application.

People get nervous when they think an error they’ve made will become a permanent part of the system. So be liberal with your editing tools, and don’t hide them behind drop-downs, roll-overs or tool-tips.


People don’t like screwing up, especially in public. The ability to remove data will bring a serious dose of confidence to anyone creating content within a system. If you show them they can’t make a mistake, they’ll be much more likely to participate and give even more data.

CRUD As A Measure Of Control

There are scenarios where CRUD isn’t relevant: activity streams, automated recommendations, etc. These types of content can be interesting, exciting and even addictive, but be careful not to let them take over your website or application. Once your audience’s threshold of perceived control is lost, they’ll loose interest and move on.

So… How do you keep your audience engaged? How do you encourage them to participate? Remember, the amount of data that can be created, read, updated or deleted on your website is directly related to how in-control your audience will feel.

Leave a comment below to discuss how CRUD can make our designs more effective.


10 ways to show you’re a programming rockstar

Posted in ASP.NET (C# & VB), C#, HTML and XHTML, J-Query, JavaScript, LINQ, PLINQ, SEO, SilverLight, Uncategorized, VB, WCF by Alok Kumar Pandey on January 27, 2011

It seems nowadays that programmers are a dime a dozen, but how do you pick the best programmers from the rest of the crowd.

It’s not just about coding (although that is a big factor). It’s about building your skill set over the years and nurturing them so you can stand out from the programming “collective.”

What characteristics makes them stand out? Are they easy to get along with? How long have they been programming? Are they teaching you things you never knew were possible? Here’s how to find out if you are a programming rock stars!

  1. Master your language and tools. Whether it’s Visual Studio, Eclipse, or even Aptana, your programming tools should be second nature to you when developing that next web application. Just like a plumber or carpenter, if you don’t have the proper tools, you won’t get the job done right.
  2. Enhance your tools and environment. With that said, even though you’ve mastered your tools, always strive to find ways to enhance your environment. This may include plug-ins to Visual Studio or Eclipse or a code generation tool that works along side your environment. If you’re not looking for better ways to enhance your productivity, you may be working yourself into an early grave.
  3. Research new technologies. While your primary language may do everything you need, make time to research your craft and experiment with new frameworks that wrap around your existing technologies. For example, while programming in web forms with C#, I heard about a new framework from Microsoft called MVC. Since I’ve started working with MVC, I’ve been programming in MVC for more than 2 years now and I haven’t looked back or regretted my decision since.
  4. Leverage your existing code you wrote. Programmers who write code and then immediately disregard it are missing out on the most exceptional tip on this list: start building your library of routines and techniques. If you are in a corporate environment, yes, you will have a corporate library to pull from for your projects. If you are an individual programmer, yes, you will have your own collection of routines or libraries that you can use in your “outside” projects. As the object-oriented saying goes, the routines are reusable.
  5. Automate like crazy. If you’ve been around the programming block for a while, you know that there are always quicker ways to accomplish certain tasks. It’s now getting to the point in this industry where if someone asks you for a web site, you can build one relatively quick. Then they start asking for features. It’s the features part that makes the difference and slows you down.
  6. Perform proper analysis. New developers always shoot first (start coding) and ask questions later. Take the time to analyze the project and ask as many questions as you can. The more questions you ask upfront, the better your ability to complete a more thorough and clear design of your application.
  7. Perform Unit Testing. Along with preceding your coding with proper analysis, always finish your coding by performing unit tests. This not only tests the quality of your code but will also let you know when your system fails on regression testing. Unit Testing should be the “checks and balances” of your programming.
  8. Extend your reach. Most developers keep to their code and that’s all they do. Break out of your comfort zone and read up on usability studies, how to document your code better, and/or using better design techniques. Expanding your skills into other areas will do three things: 1. Make you more visible to other people; 2. Make you more valuable to others because of your thirst for knowledge; and 3. Provide you with more opportunities than just programming.
  9. Communicate effectively. This is in regards to project management, coding, documentation, and impromptu meetings. If you can’t explain an extremely awesome cool coding technique to your peers or communicate why a particular feature shouldn’t be in the project to a project manager because of a time constraint, you may need to work on your verbal skills instead of your coding skills.
  10. Make time to assist others. You will seem as a definite team player by taking the time to help a fellow programmer in need. Help them understand a new concept or technique that is unclear to them and they will be grateful for the help and see you as a definite resource and go to guy.

As you can see, there are a lot of factors to take into account when deciding who is a programming rock star and how they will be perceived by other team members or by clients.

Come to think of it, you could even use some of these factors for general interview questions.

Did I miss any factors? What skills or characteristics do you think makes a programming rock star?


11 tips for better code

Posted in ASP.NET (C# & VB), C#, HTML and XHTML, J-Query, JavaScript, LINQ, PLINQ, SilverLight, VB, WCF by Alok Kumar Pandey on December 22, 2010

11 tips for better code

There are several reasons why you should write clean and readable code. Most importantly, every code is written once, but read many times over and over. When you come back to your code next day, you have to read it. When you show your code to someone else, he has to read it. Thus by spending little more time with writing, you save A LOT of time when reading it again.Lets see some of the basic rules
1- keep methods short2- never ever ever reuse a variable for different purpose3- use self-descriptive variable and method names4- define variables as close as possible to the place of their usage5- no magic numbers6- be friend with your language7- don’t fight the convention8- watch out for premature optimization9- always refactor the code after you test it10- don’t get sucked into overengineering11- learn new things by prototyping

Now, let’s look up at each point in more detail
1. Keep methods shortEven though many people obey this rule, it is still very important. Method should always fit on the screen. When you have to scroll, it takes away your concentration and you can’t see whole context. Optimal length is 5-20 lines, depending on the situation. Of course getters/setters are usually one-line methods, but they’re more like accessors than actual methods.
2. Never ever ever reuse a variable for different purposeOne variable should be used only for one purpose.  By making variable constant (const in C++, final in Java), you also help the compiler with optimization and make your code scream This variable is not going to change, which makes the code a lot more readable.
3. Use self-descriptive variable and method namesAnyone should be able to understand your code by just looking at it. You should almost never use abbreviations, except for the most idiomatic ones likesrc – sourcepos – positionprev – previousIf you think writing descriptive names is not worth the time, just comparen, ns, nsisdwith numTeamMembers, seatCount, numSeatsInStadium
4. Define variables as close as possible to the place of their first usage
While building a house, you don’t want your hammer to be on the other side of the yard. Instead, you keep your tools as close as possible. The same applies to foo = 3;int bar = 5;// bunch of code that use “bar”// but doesn’t care about “foo”// …
baz(foo);This could be easily refactored toint bar = 5;// bunch of code that use “bar”// but doesn’t care about “foo”// …
int foo = 3;baz(foo);This becomes a real issue when the code between declaration and first usage is very long (more than one screen). It is much harder to keep the context in your mind, when you have to scroll a lot to find out what given variable is.
5. No magic numbers
Whenever you compare something against constant value, it should be defined as constant. There is nothing worse than debugging your teammate’s code with things likeil < 4384What about this instead?inputLength < MAX_INPUT_LENGTH
6. Be friend with your language
Learning new language is always fun, you can learn to do things in new cool way. There is one big downside of being pro in one language while learning other one though. Say you’re Java developer trying to learn Ruby. You should learn how to do things the Ruby way, instead of trying to apply your skill in doing things the same way you’d do them in Java.You need to write 5 times “Hello world!”. In Java, you would do something like.for (int i = 0; i < 5; i++) {  System.out.println(“Hello world!”);}In Ruby, you might be tempted to writefor i in (0..5)  puts “Hello world!”endWhich seems OK, but there is a much better way
5.times { puts “Hello world!” }
7. Don’t fight the convention
Many languages have many different conventions. In general, people most probably know is Code Conventions for Java. Lets look at some of those conventions.method names should always begin with lower-case letter, followed by CamelCase (veryLongVariableName)class names should always be in CamelCaseconstant names should be all in upper case with underscores (MY_CONSTANT)open brace should be on the same line as if condition
Breaking any of conventions should have a valid reason, never do it just because you don’t like it. If you decide to change some convention inside your team, that’s OK, but you might have problem when sharing code with other not so enlightened programmers.8. Watch out for premature optimizationPremature optimization is root of all evil, at least that’s what TV said … First thing you should care about is to write understandable code. It doesn’t have to be fast the first time you write it.All optimization is premature unless the program is slow. If you want to optimize something, at first you need to find out where the problem is. Thats why we have profilers.Trying to optimize something without finding source of the problem always ends up in breaking something, or at least your code may turn out to be unreadable. If you think that something is slow, don’t just blindly start rewriting the code, find a proof first.Don’t solve problems that don’t exist.
9. Always refactor the code after you test it
Nothing is perfect. Even though you might think you’re writing a perfect code, try looking at it few months later. You will probably fell like “wtf is that?”.Good way to improve the quality of your code is to refactor it after you test it. By testing I mean assuring that it works, which can be done either automatically or manually.First of all, you need your code to work. Don’t write it perfect the first time, just make it work. Then refactor it to make it perfect. For those of you that  know something about Test Driven Development, this might seem very familiar. The key here is to get used to the whole refactoring thing. If you’re using powerful IDE like IntelliJ IDEA, your life will be a lot easier while refactoring.
After you try refactoring, you will probably make a mistake and break something. That’s why it is good to write automated tests. Any time you refactor, you can just run all test suites and see exactly what went wrong.10. Don’t get sucked into overengineeringWhen I first read about design patterns, I thought I found The Holy Grail. It all seems to be thought out, working perfectly and making design easy to understand, because you can just say “I used an observer pattern”, instead of explaining it all.So where is the problem? Because it all looks so natural and easy, you start using design patterns for everything. Why not make this class singleton? And what about creating another factory?Then instead of writing simple 80 line script, you end up with 10 class + 15 interface monster with bunch of generics and annotations, where 97% of the code doesn’t do anything.Design patterns are very useful tool to simplify the design, which doesn’t mean using them everywhere you can. You should use them, but don’t abuse them.
11. Learn new things by prototyping
Programming is all about learning new things. When you learn new library or language, you suddenly have the urge to throw away all old code and rewrite it from scratch. There are lots of reasons why you don’t want to do that.Adding a new library or framework to existing application is a similar problem. Say you’re writing a javascript web application, and in the middle of everything, you discover jQuery. Now you have sudden urge to throw away all your javascript and write it in jQuery, even though you haven’t used it yet.The best way to go is to first create a lot of simple things with jQuery, where you will learn all the stuff you need in your application. You need AJAX? Try it on simple example outside the project and after you fully understand it, throw it away and move into production.

While developing any web site, one should keep some points in mind

Posted in ASP.NET (C# & VB), C#, HTML and XHTML, J-Query, JavaScript, LINQ, PLINQ, SilverLight, VB by Alok Kumar Pandey on November 9, 2010

1) Set debug=false under compilation as follows:

<compilation default Language=”c#” debug=”false”>

2) Use Server.Transfer instead of Response.Redirect.

3) Always check Page.IsValid when using Validator Controls

4) Use Foreach loop instead of For loop for String Iteration.

5) Use Client-Side Validation. (but not all the time you have to validate even on the server side)

6) Check “Page.IsPostBack”. To avoid repetition code execution.

7) GIF and PNG are similar, but PNG typically produces a lower file size. (True, but some browsers not supporting PNG format)

8) Use the AppOffline.htm when updating binaries

9) Turn off Tracing unless until required. (by default it’s off, use on the pages where it’s required)

<trace enabled=”false” requestLimit=”10″ pageOutput=”false” traceMode=”SortByTime” localOnly=”true”/>

10) Precompiled pages and disable AutoEventWireup; setting the AutoEventWireup attribute to false in the Machine.config file.

11) Turn off Session State, if not required.

<sessionstate timeout=”20″ cookieless=”false” mode=”Off” stateconnectionstring=”tcpip=″ sqlconnectionstring=”data source=;Trusted_Connection=no”>

12) Select the Release mode before making the final Build for your application.

This option is available in the Top Frame just under the Window Menu option. By default, the Mode is Debug

13) Disable ViewState when not required.


14) Avoid frequent round trips to the Database.

15) Use Caching to improve the performance of your application.

16) Validate all Input received from the Users.

17) Use Finally Method to kill resources. (But not in the case of using)

18) The String and Stringbuilder Magic.

It is nice to use Stringbuilder instead of String when string are Amended. Strings occupy different memory location in every time of amended where stringbuilder use single memory location

19) Never use object value directly; first get object value in local variable and then use. It takes more time then variable reading.

20) Avoid Exceptions: Use If condition (if it is check proper condition)

21) Code optimization:  Avoid using code like x = x +1; it is always better to use x+=1.

22) Data Access Techniques: DataReaders provide a fast and efficient method of data retrieval. DataReader is much faster than DataSets as far as performance is concerned

23) Before doing a bulky ASP code processing, you can check to make sure Response.IsClientConnected.

24) As always, avoid session variables because each ASP page runs in a different thread and session calls will be serialized one by one. So, this will slow down the application. Instead of session variables you can use the QueryString collection or hidden variables in the form which holds the values.

25) Enabling buffering will improve the performance, like

<% response.buffer=true %>

Then use:

<% response.flush=true %>

26) Use Repeater control instead of DataGrid , DataList, Because It is efficient, customizable, and programmable.

27) Data listing is more time consume when large data are retrieve from database.

Paging will display only particular data but take load of all data.

Fetch only data that is needed for current page.

28) Avoid Inline JavaScript and CSS

29) Use single css file instead of multiple css file.

Try your best to combine all your CSS based classes into a single .css file as lot of .css files will cause a large amount of requests, regardless of the file sizes.

.css files are normally cached by browsers, so a single and heavy .css file doesn’t cause a long wait on each page request.

Inline .css classes could make HTML heavy, so again: go ahead with a single.css file.

30) Reduce cookie size

31) Compress CSS, JavaScript and Images

Online compressors are available; to compress file please refers following web and Replace your file content with optimize code. for CSS compression . For JS Compression

32 .Use Cache appropriately

i. Page output caching:

<%@ OutputCache Duration=”3600″ VaryByParam=”none” %>

ii. Page fragment caching:

Write a Page output caching code into each User Control

iii. Data caching:

32) Don’t make the member variables public or proteted, try to keep private and use public/protected as properties.

33) Use strString=string.Empty instead of strString=”” . [And perhaps instead of strString=null also (?)]

34) Make your page files as light as possible. That is try to avoid unnecessary markups, e.g. use div elements instead of tables.

35) Write static messages in div and make it visible when necessary. This is faster than letting server set Text property of your label or div.

36) Retrieve data from database at once, if possible. Don’t add up to database trip as far as possible. For this, combine the datafields from different tables and select them.

47) Use short ID name for WebControl.


SQL SERVER – 2005 T-SQL Paging Query Technique Comparison (OVER and ROW_NUMBER()) – CTE vs. Derived Table

Posted in ASP.NET (C# & VB), C#, HTML and XHTML, J-Query, LINQ, SEO, SilverLight by Alok Kumar Pandey on October 7, 2010

SQL SERVER – T-SQL Paging Query Technique Comparison – SQL 2000 vs SQL 2005. The main question was is this can be done using CTE? Absolutely! What about Performance? It is same! Please refer above mentioned article for history of paging.


SQL 2005 Paging Method Using Derived Table
USE AdventureWorks
SET @StartRow = 120
SET @EndRow = 140
SELECT FirstName, LastName, EmailAddress
SELECT PC.FirstName, PC.LastName, PC.EmailAddress,
ORDER BY PC.FirstName, PC.LastName,PC.ContactID) AS RowNumber
FROM Person.Contact PC) PersonContact
WHERE RowNumber > @StartRow
AND RowNumber < @EndRow
ORDER BY FirstName, LastName, EmailAddress

SQL 2005 Paging Method Using CTE
USE AdventureWorks
SET @StartRow = 120;
SET @EndRow = 140;
WITH PersonContact AS
SELECT PC.FirstName, PC.LastName, PC.EmailAddress,
ORDER BY PC.FirstName, PC.LastName,PC.ContactID) AS RowNumber
FROM Person.Contact PC)
SELECT FirstName, LastName, EmailAddress
FROM PersonContact
WHERE RowNumber > @StartRow
AND RowNumber < @EndRow
ORDER BY FirstName, LastName, EmailAddress

Following Image of Execution Plan displays that the performance for both of them is same with regarding to each other in one batch. This MAY NOT be true when there is complex query in issue. For most of the time, it is will be same.

Choosing a Project Methodology

Posted in ASP.NET (C# & VB), C#, HTML and XHTML, J-Query, JavaScript, LINQ, PLINQ, SEO, SilverLight, VB by Alok Kumar Pandey on September 1, 2010

Every Project Manager has heard of one – but who actually has one? A “Methodology” that is. Whether you’re a manager, consultant, trainer, team member or student, you need some form of methodology for implementing projects. But:

  • What is a methodology?
  • How does it help you manage projects?
  • How do you select and implement one?

Choosing a Project Methodology

A Project Methodology is simply “the steps you take to deliver a project from start to finish”. It will:

  • List the phases, activities and tasks you have to complete.
  • Describe every task in detail so you know what to do.
  • Include templates so you don’t have to start from scratch.
  • Come with practical examples to guide you.
  • Give you a project roadmap ahead.

So how do I select a suitable methodology?”

1: Define your Requirements
It’s critical that you select the right methodology for your needs. So the first step is to define what those needs are by identifying the…

  • Content you need: A Methodology includes content that tells you step-by-step, how to deliver projects. You need to identify the types of content you need. For instance, should the content list every phase, activity and task in the project life cycle? Should it apply to your industry specifically, or be more generic? Should it have particular processes which are relevant to your company?
  • Features you need: The methodology should also include features that help you manage projects. For example, you may decide that it should be customizable, able to import your existing templates, able to change the terminology and add your own branding.

2: Review Your Internal Methodologies
Every project organization has its own existing internal project methodology, whether it’s simply a set of documents, templates or forms that are used for projects. So why re-invent the wheel if you have something that works in-house? Review your existing methodology, templates and forms to determine whether they meet the requirements you’ve defined above.

3: Research External Methodologies
There are a number of methodologies available for immediate adoption in the market place, such as MPMM. Go to Google and type “Project Management Methodology” and see what’s available. Compare each methodology you find to your requirements and determine the best fit. If you find a methodology that has an 80% fit, then as long as it’s customizable then you’ll be fine. Adopting and customizing a third-party methodology can save you an enormous amount of time and energy.

4: Evaluate the Creation of a Custom Methodology
Another option is to create a methodology of your own from scratch. It’s more time consuming to build a custom methodology than customize an existing one, but it may help you create unique processes for projects if you need them.

5: Select and Implement Your Methodology
Having assessed all of your available options, you now have the information you need to make your decision. Choose the methodology which is the best fit for your organization and then implement it by:

  • Adopting and customizing the methodology
  • Training your teams in the methodology
  • Publicizing your new project methodology
  • Using your new methodology for projects
  • Improving your new methodology

Posted in ASP.NET (C# & VB), C#, HTML and XHTML, J-Query, JavaScript, LINQ, PLINQ, SEO, SilverLight, VB, WCF by Alok Kumar Pandey on August 30, 2010


Access to viewing and managing SageFrame portals is controlled by using User Accounts and web site Roles. The basic concept is that users can be permitted to view pages and modules, as well as edit pages and modules by being added to one or more web site roles (roles).



  • Administrators can create user accounts for any person, or they can enable site visitors to register themselves for a user account.
  • Once a user has an authorized user account, they can access all pages and modules that are restricted to members of the Registered Users role.
  • Once a user has an authorized user account, they can access all pages and modules that are restricted to members of the Registered Users role.
  • Individual users can be granted view and/or edit permission to page or module.
  • All users who are a member of a selected role can be granted view and/or edit permission to page or module.


First of all, we should be familiar with the roles that different types of editors play;

  • Module Editors: A Module Editor is any user who has been assigned permission to edit one or more modules.
  • Page Editors: A Page Editor is any user who has been assigned permission to edit one or more site pages. Page Editors can manage module content and module settings on all modules on their pages. They can also add child pages below their pages.
  • Administrators: An Administrator is any register user who is a member of the Administrator web site role. Administrators can manage all page and module content on the site.


  • Super User Accounts: A Super User Account member is any user who has been added to the Super User Accounts section of the Super User pages. These members’ permanent rights to manage all page and module content for the portal they are associated with.
  • Super User: The Super User can manage all pages and module contents on all the sites within the SageFrame Installation. Also the Super User has access to the Super User pages where portals can be created, where default settings for all portals can be managed, and portal specific Super User settings can be managed.

Overview of Role Based Access to Pages and Modules

Here we can know, how different roles are assigned for the access of Pages & Modules

  • Anonymous Users: These are users who are visiting the site but have not logged in to the site. These users may or may not be registered on the site. This is public access.
  • Registered Users: A Registered User of the site. Registered Users are able to manage their User Account online, and may also belong to one or more security roles.
  • Administrators: Administrators have the ability to edit all content and pages within a single site.