Where Vs Having In SQL
21-05-2012 The Having clause can only be used when you are using the group by phrase. When you are using the Group By phrase in a query, you can use the Having clause for pretty much everything you can do with the Where clause. But not vise versa. The where clause doesn't support aggregate functions so you must include any aggregate functions in the having clause. In the below example, you can place the " Department = 'Science' " in e...
What is a Permalink
2009-01-07 If you maintain or work around blogs then the word "Permalink" should be familiar to you. In early stages of the Internet all web addresses or URLs were static or permanent but as the web became more complex where large volumes of content is added daily, it became hard to handle in the usual way. The involvement of database driven systems was necessary to manage large volumes of web content. The URLs used with these systems were not hu...
The Blood Brain Barrier
2009-01-08 I wouldn't be wrong if I say the Brain is the most vital organ in the human body. As we all know brain handles most of critical operations inside our body such as keeping and managing memories, organizing our activities, keep other organs perform, and so much more. The Brain, as most of us already know, works by sending electric signals through complex meshes of neurons so the brain has to maintain a good environment around t...
ILT - How to Add a Drop Down List (ComboBox) Into an Excel Cell
21-08-2012 How to configure an Excel cell, Excel Cell Range, Excel Column or Excel Row so that each of its cells will allow a user to select a value from a drop down list (combo box) rather than typing? Steps Select the cell, range, row or column you want to display with a drop down list Select "Data Validation" from "Data Tools" Section in the "Data" Menu (refer to the screen shot below) In the dialog box, Select "List" from the ...
Importance Of Specifying Variable Length For Varchar in SQL Stored Procedures
23-05-2012 If you don’t specify a variable length for NVarchar, Varchar variables, the parser will assume the length of 1. It will not complain. Instead it will just truncate whatever you pass to the variable and use the first character. This mistake can cost you lots of time. Especially if you are working on a stored procedure with a complex SQL query. You will think you made a mistake in your stored procedure and it could be hours...
The transaction log for database is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases
09-10-2012 I got this error today for one of my test databases. Following are the steps to solve this. Step 1 The error message gives a hint to look in the log_reuse_wait_desc column in sys.databases table. So we will just do it. This gave me following result for my database. name log_reuse_wait_desc...
Six Advices to Succeed in Online Paid Surveys
2009-03-14 I have been working with many survey sites in the Internet and I have learnt a lot of lessons. I learnt some of these when I was researching about online survey sites and most of these lessons are learnt by experience. So I thought to share my knowledge with the rest of the world hoping it would help someone out there. So in this article, I will give a set of advices that I have learnt in the hard way... Rule 1 - Don't Select Survey S...
/// Stops asp.net from encoding the source HTML string.
public static IHtmlString HTMLRaw(string source)
return new HtmlString(source);
call this function whenever you want asp.net NOT to encode the string.
Note: You can use <%= and %> tags to avoid encoding as well.
StackOverFlow has become a popular site over the years. This unfortunately has given wings to their owners and senior members who beleive they have an almighty power to control anything a junior/new member says.
StackOverFlow is utilizing an interesting strategy to maintain their site at ZERO cost. They have introduced a points system according to which people with more points get the almighty power.
And the most stupid thing is that they give “MORE” points when someone “EDIT” or “CRITICIZE” someone else s comment/opinion.
This has made a massive circle of so-called “senior” guys who will find something in a relatively “junior” persons post.
Basically, if you are new to the site, your post will be “EDITED” so many times since you publish it.
Don’t get me wrong this DOES NOT mean that those senior guys give you a solution. Oh No!
All they do is “EDIT” your post!
They will find something, a spelling mistake most of the time.
They are also good at finding a similar post and then criticize your post saying it’s a “DUPLICATE”
The most funny thing is that you cannot even complaint!
Because guess who edit complaint forum? Yeah the SAME SENIOR GUYS
read more about my experience below…
It is very unprofessional to go and edit someones’s post unless they have misused the site.
Every time I submit a question, the first thing that happen is some “superior” guy delete a word or two TO GET HIS/HER NAME IN THE POST.
IT’S VERY CLEAR THAT PEOPLE DO THIS TO GET THEIR NAME EVERYWHERE.
What’s wrong with saying thanks to other professionals for spending their time to consider my matter?
The usual answer for this is that deleting “Hi” and “Thanks” makes the question “Clear”
Seriously? How can deleting most human friendly one or two words from a post and adding a comment to justify that act can make the post “clearer”???
It only makes IT pros look like “geeks” I’m sorry but not all professionals are “geeks” there are people who knows how to have a balanced life.
Perhaps if you guys stop editing others “Thanks” out may be you can have one too.
Many thanks for your time.
p.s. Now, if you can, tell me how my first “Hello” and last “thanks” lines made this post “unclear”?
I CHALLENGE SUCH “SUPERIOR” EDITORS TO RESPECT MY OPINION AND ANSWER THIS RATHER THAN DELETING (OR TOUCHING) THIS POST
Thanks again. (“You can chose to be a geek but you were born human” – a quote)
How to avoid detecting substrings, how to check for perfect substrings, avoid detecting substrings, avoid detecting substrings when checked for substrings.
Today I needed to find if a string is contained within a string.
So I used the most straight forward method (I used SQL but this works for any language)
declare @msgsToSkip varchar(max) = ‘geoLocation,statusUpdateCheck,forceClose’;
declare @msg varchar(max)= ‘statusUpdate’
if(charindex(@msg, @msgsToSkip) > 0)
print ‘not found’
Problem – as you can see, this code is written to messages with caption as either “geoLocation”, “statusUpdateCheck”, or “forcedClose”
But I also receive a message with caption “statusUpdate” this is different to “statusUpdateCheck” and must be allowed but obviously the code returns true for statusUpdate as it is a substring of statusUpdateCheck.
Simply make each word dirty by adding a character to it. It could be any character as long as you keep the code consistent. In more simple words, simply add a character to the string you are
Looking For and the string you are Searching In.
This is the fixed code
declare @msgsToSkip varchar(max) = ‘geoLocation-,statusUpdateCheck-,forceClose-’; — <– Notice that a ‘-’ is added to make each word dirty
declare @msg varchar(max)= ‘statusUpdate’
if(charindex(@msg + ‘-’, @msgsToSkip) > 0) — <- Notice the + ‘-’
print ‘not found’
This will not detect statusUpdate as statusUpdateCheck because at the checking time, the code sees statusUpdate as statusUpdate- and it is not a substring of statusUpdateCheck (note that statusUpdateCheck is now statusUpdateCheck- but it’s the ‘-’ in the statusUpdate that does the trick.)