Today, we are working on to have list of code where there would be chances of NullReferenceException.
I have come across a tools which highlights the possible null reference code while actually coding it. But couldn’t find an easy way to list out such code for already existing files.
After googling for couple of hours, I find a way to get this list.
- Download the ReSharper https://www.jetbrains.com/resharper/download/
It is an awesome plugin for Visual Studio. If you don’t have a licence, it is free for 30 days trial.
- After installing, select ReSHARPER –> Inspect –> Code Issues in Solution from the Visual Studio Tool bar.
- Once the inspection is finished. You can see Code issues in Inspection Results pane.
- This will show many type of issues. Search for “possible system.nullreferenceException” and you will get the list of all possible System.NullReferenceException as shown in figure below
You can also export the search result as html or xml or text.
Happy Coding 🙂
5 years ago, a day came when you entered to a professional life from very energetic college/student life. From that day, no one was your teacher. Your failures have taught you and makes you mature day by day.
There are no friends in your team. They are your colleagues in other clear words they are your competitors – It’s a bitter truth accept it as early as you can. You might have a friend from different team and probably having same designation.
Some of you got promoted to senior level. But if you not, and you think you have done enough efforts for that and someone else promoted, don’t worry, your company is not smart enough to recognize your efforts. You must continue with your efforts because it is like Blessing in disguise (Something good that isn’t recognized at first).
Let’s start from beginning. Before joining a company, clear your mindset that in which role or in which domain you want to build your carrier. Break up your future plan into small duration plans (like in next 3/6 month, I must learn this or I must achieve this). You must have clear vision that at what position you want to see yourself or what you want to achieve in next 5 or 10 years. And your every plan should be your step towards it.
Once you reached to your 5 years of experience take a breath and look back. Look back for the mistakes which will not be allowed in next phase. Look back for the others. Have you guide/help your juniors/colleagues or you help yourself only? Have you shared your success with others? Have you shared your problems/errors/solutions with others via blog or forum or on shared platforms? Have you ever accepted your failure and not blamed others? If yes, man, you are a true professional with a golden heart of human.and if no, try these, you feel a unique kind of happiness.
WE / TEAM should be first before I. “It’s not my success, It’s TEAM’s success.” It is a TEAM which enables you to face any situation. It is a TEAM which encourage you to stand in front of any obstacles. Luckily, in every job, I got the leaders who always believe in Team work. When I was a trainee, I have read this on the desk of one of my mentors, Kiran.
So, after 5 years, what is next? I have set a milestone for every year, Have you? Set yearly milestones for your professional journey. And after achieving each milestone, analyze your journey and keep walking. Don’t forget your personal/family life. It is as important as your professional life. Enjoy the journey. Enjoy your failures because you learn something new from your each failure. Best of luck for your future journey.
To validate the text expression without using regular expression validator on your code behind (i.e. on server side- .cs), use following code:
bool validText= System.Text.RegularExpressions.Regex.IsMatch(“Your Text”, “Your Expression”)
for example, I need to validate value of Email Address text box of the submission form:
Enjoy Coding 🙂
Auto increment column is easy to use but it is very difficult to get the last value when some of the rows are deleted. For example, you have 125 rows in your table, having APPID as autoincrement field. Now, you deleted 25 records of it. Now, you need to insert a new row (obviously the APPID of this new row will be 126), but with insertion you need the new APPID number too. Following is the solution (following command will return current auto increment’s field value):
SELECT IDENT_CURRENT(‘your-table-name‘); // here this will return 125 (though you have deleted those 25 rows).
adding 1 to the result will return the next row’s AutoIncrement column’s value.
you can also use SELECT @@IDENTITY or SELECT SCOPE_IDENTITY(). But if you want to get latest value of auto increment column’s value from perticular table SELECT IDENT_CURRENT(‘tablename’) is good option.
Google Analytic provides you the functionality to track the search in your site. It is not compulsory to use Google’s search engine.
Here, it is assumed that you have entered the GA code script in your page on which you have the search box.
Follow the below steps to enable Google Analytic to track the search:
- Log in to the Google Analytic Application & Select the appropriate site from appropriate account.
- Click on the Admin option available in right-upper corner
- Click on the profile available
- Click on the Profile Setting tab.
- In Site Search Setting,
5.1 Site search Tracking: select Do track Site Search
5.2 Query parameter: this is very important part. You need to pass the query parameters, which you have used for search url. For example, if your site is http://www.abc.com and after search if you append the query string parameter searchkey=xyz then your url will be http://www.abc.com?searchkey=xyz. So, you need to enter searchkey here.
you can add upto 5 query string parameters separated by comma.
Strip query parameters out of URL : Select whether or not you want Google Analytics to strip the query parameter from your URL. Keep it unchecked.
Note that this strips only the parameters you provided, and not any other parameters in the same URL. This has the same functionality as excluding URL Query Parameters in your Main Profile: if you strip the query parameters from your Site Search Profile, you don’t have to exclude them again from your Main Profile.
6. Select whether or not you use categories, such as drop-down menus to refine a site search. Keep it unchecked.
If you select No, you are finished. Click Save Changes.
If you select Yes:
- In the Category Parameter field, enter the letters that designate an internal query category such as ‘cat, qc,’.
- Select whether or not you want Google Analytics to strip the category parameters from your URL.
Note that this strips only the parameters you provided, and not any other parameters in the same URL. This has the same functionality as excluding URL Query Parameters in your Main Profile: if you strip the category parameters from your Site Search Profile, you don’t have to exclude them again from your Main Profile.
7. Click on apply button.
You are done. But keep patience as GA may track search terms after 6 hours. (This is not the case always. You may find the search term from the next moment).
Enjoy 🙂 For more help regarding this issue, visit
You just need to use the StartDate or EndDate property to enable only future dates or past dates respectively.
in aspx page you can set this property using inline tag. You can also assing this in back-end .cs or .vb code
StartDate=”<%# System.DateTime.Now %>” in .aspx or CalendarExtender1.StartDate=System.DateTime.Now in back-end .cs or .vb file
If you are not able to access StartDate or EndDate properties. Please check your AjaxControlToolkit version. You can download the kit from here.
Happy Coding 🙂