Portfolio


Friday, June 17, 2011

ASP.Net AJAX Simple Paging System Using JQuery

Assalam-o-Alikum..
For the past few days I was googling to find some paging control for my ASP.net website.. I really found some cool and interesting paging controls/system but none of them were easy for a beginner like me :) So after reading so many articles and working with AJAX-Less Paging Controls, I've come up with my own Asp.Net Ajax Paging Control.. Its really simple but NOT an optimistic approach.. You guys can use it as RnD or in small websites but for Larger Sites I suppose JQuery based JSON Paging would be a better solution.

Im breaking my post in following parts

  • How Paging Works
  • Creating our PAgeing Control
  • Applying AJAX
  • Some jQuery

Friday, May 20, 2011

Fixed: Compilation error CS0433: The type exists in both

The original post is by : By Rajin Kumar

This is major and common problem faced by asp.net programmers/coders.. man its really a mind eating problem which happens due to a silly silly mistake.. :P well no more chit chat.. here's the solution and original post.

Error Message
The type TypeName1 exists in both TypeName2 and TypeName3
Problem :- When we try to compile our ASP.NET site, sometimes it throws the error message something like
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\myapp\6990
f87a\730687aa\App_Web_em-vsrux.6.cs(1698): error CS0433: The type 'ASP.leftMenu'
exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\myapp\6990f87a\730687aa\App_Web_rr7zh4b1.dll' and 'c:\WINDOWS\Microsoft.N
ET\Framework\v2.0.50727\Temporary ASP.NET Files\myapp\6990f87a\730687aa\App_Web_16rxjped.dll'

I searched it for solutions but most of the site reefers it as a known bug no apparent solution.

Microsoft solution
Two different assemblies referenced in your application contain the same namespace and type, which produces ambiguity.To resolve this error, use the alias feature of the /reference (Import Metadata) (C# Compiler Options) compiler option or do not reference one of your assemblies.This is mostly likely due to a known bug in the ASP.NET compiler involving directory level circular references

Another solution is some sites adding batch="false" and debug="false" attributes to the element in web.config. But there are warnings it may create the following problems
  • The compilation of ASP.NET pages takes longer (since some batch optimizations are disabled)
  • Code can execute slower (since some additional debug paths are enabled)
  • Scripts and images downloaded from the WebResources.axd handler are not cached

Another solution I found is changing something in the control code which referred in the error message, save and compile again. It solved the problem at times.

One solution is there goto "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files" and remove the folder named your project name(but you have to stop aspnet_wp process before deleting everything in the folder. It worked fine occasionally


Permanent solution to Compiler Error CS0433

I verified the error message. The type 'ASP.leftMenu' is a User Control(.ascx) used for menu creation for every page. In our site the same menu control created in different directories for different purposes.

On top of any menu control there is one line
<%@ Control Language="C#" ClassName="leftMenu" %>
The class name "leftMenu" is repeated in every control files. I replaced class name with unique names. It solved the problem forever.


Normally this problem occurs when more than one dll contains the same exact class reference. I can explain some condition. I have one class file in my project and later I want to modify the same file. In normal practice I rename the file to something name_old.cs and modify the orginal name.cs. But the two files will have the same exact namespace as well as class definition. We may not notice the problem. But when we try to compile or run the project, it will display error all the places where we referred the class.

You can eliminate this error by checking the same reference in more than one file.

Jazak Allah..

Saturday, May 14, 2011

A Taste of LINQ to SQL

Over the part few months, I'm using LINQ to SQL in my .Net projects.. It's one of the most attactive features I've in .NET Framework 3.5 .. Al tough the full release of LINQ to SQL is scheduled with upcoming Visual Studio Orcas; but still Visual Studio 2008 has most of its features..

Those who dont know anything about LINQ; well LINQ stands for Language Integrated Query and as the names shows LINQ is Code based language designed for data manipulation in different data structures like Lists, Array, KeyValue Pairs etc..


What is LINQ to SQL?

LINQ to SQL is an Object Relational Mapping implementation that ships in the .NET Framework "Orcas" release, and which allows you to model a relational database using .NET classes. You can then query the database using LINQ, as well as update/insert/delete data from it.

LINQ to SQL fully supports transactions, views, and stored procedures. It also provides an easy way to integrate data validation and business logic rules into your data model.

(Taken from ScottGu's Blog)


Reasons I Choose Linq to SQL

Reason number one.. LINQ is Cool :) Actually there are so many reasons for going with LINQ to SQL..

  • LINQ is quite easy to understand
  • Ddata manipulation can be done without breaking your nerves
  • SQL Injection threat is very low.. Almost negligible
  • We can use one single language through out the project both for Database Quering and internal data structures
  • and bla bla bla...


Let's Get Started

Im breaking it in following parts..

  • Creating the project
  • The LINQ to SQL Connector and Data Context
  • Whats the difference in LINQ And SQL Queries?
  • Simple Queries
  • Some Data Manipulation

Wednesday, May 11, 2011

Image Viewer BETA

Its really old post and available on PS Code since January 2010 therefore I'm not going to cover this in detail.. In short Its an Image Viewer with some additional stuff.. I have tried to fix as much bugs as i can but I know there are still bugs left.. Thanks to all those unknown people who post there experience and ideas which help me out to complete this project..

Specially i thank to creater of CButton which i used in this project. Ther'ree really amazing I hope my work will be useful for other people as well Work with it as much as you want as long as you include these lines with you code. But dont forget to send me a copy of your work on it. This project can help you in following...

1. Windos Form Controls Array with event handling
2. Browsing files and folder
3. Form Designing
4. Moving Borderless Form
5. Making Transparent Splash Screen Effect.
6. Image Processing similar to Windows Image Viewer
7. Setting Image as wallpaper etc..




Thanks For your apprecation.. Dont forget to Comment.. :)

Here is the source of this application : Image Viewer

Jazak Allah..

Thursday, May 5, 2011

EmgCV Haar Classifiers Face and Facial Parts Detection

Hello folks..
after so many days of absence; im back with another emguCV project... Its about using haar classifier or commonly known as Haar Cascades in emguCV.

Those who doesn't kn ow much about haar classifiers well Essentially it's a variation on a visual Neural Network recognizer that breaks up the image into pieces that contain a specific feature (nose, mouth, etc) to improve accuracy over a full image neural network that might be confused by the object of interest's orientation or position within the image.

To know more about haar classifiers; follow that link after all who wants to get into all these definitions and bla bla bla ... :P at least I don't.. :P lets do some practical work man..!!!

I've borken the whole project in following steps

  • emguCv
  • Set Variables
  • Haar Cascade Files
  • Capute Video

Wednesday, May 4, 2011

My Portfolio

Hey guys...
Check out my Portfolio... It includes my personal & professional project...



Jazak Allah..

Tuesday, May 3, 2011

ASP.Net 3.5 PostBackUrl and JavaScript Validation

Hey folks,
After lots and lots of search and headache.. I've found solution of this stupid problem.. :)

Actually the problem was I had two asp.net pages and I wanted to pass data of page A to page B.. I wanted to validate textbox values using JavaScript..

So what does PostBaclUrl porperty acutally do?
Well PostBaclUrl is client side cross page post back.. Which means that data never goes on server. It basically uses javascript DoPostBackWithOptions to copy contents of one page to another page.

Problem 1 : What kind of cross-page posting to use?
Well Im using here Public Property values as its easier and gives cleaner code.
In Page A create Public Property values also known as Using Virtual Path