This error message seems to be very common in an ASP.Net application. Most of the time it is caused by databinding at the wrong time during a postback. Usually it can be solved by wrapping a call to DataBind() with an "if (!IsPostBack)" as in the following:
if (!IsPostBack)
{
myList.DataBind();
}
However, sometimes you may need to bind during a postback. As in my case, I had a DataList nested inside of a repeater. I also had a button inside of each element of the DataList that needed to fire, so I needed to attach an ItemCommand event to each DataList inside the repeater on postback. Therefore, I couldn't use the normal solution to this problem.
The reason the error occured was when somebody would click the Button too quickly. In other words, the page needed to finish loading before allowing the user to click the button. I came across the following blog posting that solved the issue for me:
http://forums.asp.net/t/1144649.aspx
It's easy -- it's just a server control you plop down on the page. What it does is asks the user to wait until the page finishes loading before clicking on anything.
I hope someone else finds this useful.
Wednesday, March 19, 2008
Wednesday, February 6, 2008
Adding a Network Printer to All Users
Usually if you add a network printer under one user on Windows XP, you have to add the same printer on the other user accounts on the same computer. Here is how you can permanently add a network printer that is visible to all users logging into that computer:
rundll32 printui.dll,PrintUIEntry /ga /c\\[Local Computer Name] /n\\[Network Computer name]\[Shared Printer Name].
Then, you need to restart the printer spooler service by doing the following:
1. Go to Control Panel --> Administrative Tools --> Services
2. Locate "Print Spooler" and right-click it.
3. Click Restart
The new printer should now show up in Control Panel-->Printers and Faxes.
I hope somebody else finds this useful.
rundll32 printui.dll,PrintUIEntry /ga /c\\[Local Computer Name] /n\\[Network Computer name]\[Shared Printer Name].
Then, you need to restart the printer spooler service by doing the following:
1. Go to Control Panel --> Administrative Tools --> Services
2. Locate "Print Spooler" and right-click it.
3. Click Restart
The new printer should now show up in Control Panel-->Printers and Faxes.
I hope somebody else finds this useful.
Labels:
All Users,
Network Printer,
Shared Printer,
Windows XP
Saturday, February 2, 2008
Reflection and Medium Trust
Up to today I thought if you host a website in a Medium Trust environment for .NET, reflection is basically turned off or not allowed. It was rather frustrating to not be able to use some of the nice abilities that reflection provides because the website is hosted in a Medium Trust environment. However, reflection IS still allowed, but whatever you are looking for has to be marked as public. For example, I had a class that looked something like the following:
internal class MyClass
{
private bool _someProperty;
public bool SomeProperty
{
get { return _someProperty; }
set { _someProperty = value; }
}
}
Because the class is marked "internal", it is not accessible using reflection in a Medium Trust environment. Just by changing "internal" to "public", I was able to query the classes properties using reflection:
public class MyClass
{
...
}
I hope someone else finds this useful.
internal class MyClass
{
private bool _someProperty;
public bool SomeProperty
{
get { return _someProperty; }
set { _someProperty = value; }
}
}
Because the class is marked "internal", it is not accessible using reflection in a Medium Trust environment. Just by changing "internal" to "public", I was able to query the classes properties using reflection:
public class MyClass
{
...
}
I hope someone else finds this useful.
Friday, February 1, 2008
User Defined Function Error
I wanted to post this so that I won't forget how to fix it and also in case somebody else runs into the same issue.
In SQL Server 2005, I had a function that returned all records from a certain table:
SELECT * FROM Employees;
Best practices would be to not return all fields, but I don't care. I got the error:
View or function 'dbo.FunctionName' has more column names specified than columns defined.
I simply had to rebuild the function and all was well.
UPDATE: Sometimes this error is a lot harder to catch! Instead of getting the error, it was just shifting all the columns and so the values returning from the function were in the wrong columns! I think I better start specifying fields explicitly.
In SQL Server 2005, I had a function that returned all records from a certain table:
SELECT * FROM Employees;
Best practices would be to not return all fields, but I don't care. I got the error:
View or function 'dbo.FunctionName' has more column names specified than columns defined.
I simply had to rebuild the function and all was well.
UPDATE: Sometimes this error is a lot harder to catch! Instead of getting the error, it was just shifting all the columns and so the values returning from the function were in the wrong columns! I think I better start specifying fields explicitly.
Tuesday, January 22, 2008
Going After Your Dreams
I want to continue the discussion of the Early Adopter vs. Lagger concept. One of the areas this concept applies to is in our dreams or goals in life. I think many of us have a desire to excel, to contribute to the world, to make a difference and to have our contributions have a positive effect on society. We want to be the best at what we do. We have a dream of who we want to become. Unfortunately, other people don't always seem to have that same vision. Some people think you should have a different vision, or their vision. There are others who doubt and say things like, "you would have had to start when you're young. You'll never be able to catch up." Have you ever heard that before? I think that's absurd quite frankly. I think that we are just as capable when we are older of picking up a talent or learning a new skill. Now, part of the reasoning for comments like those is the fact that as you get older you have a lot more responsibilities and obligations. You supposedly have less time. I consider myself a busy guy. I have a lot going on. I have a wife, two small children with one coming in a week or so. I have work, church responsibilities, etc. But what I have realized is we always have time, the problem is in how we use or prioritize our time. Maybe I've digressed a little bit. The point I wanted to make, though, is it is never too late to go after dreams. True, maybe if we procrastinate we may miss opportunities, but another one will come. Jump on and run with it when it does. How does this relate to the Early Adopter vs. Lagger discussion? The thing you have to realize when you start going after a dream is there is almost certainly going to be some late majority or laggers in your life that don't quite catch the same vision. At least, not yet. What should happen, is you take criticisms and doubts into account, and do your research. But if it is still a viable and a realistic dream, you should go for it. Or at least you start in the path that leads you there. In fact, that's a key point. You're not going to reach your dream tomorrow. Maybe not in the next few months or even years. But, if you are diligent and stay focused and keep working hard, you will eventually arrive at your final destination. What prompted this post was something I was reading in the Book of Mormon. In 1st Nephi 17, Nephi is commanded by the Lord to build a boat so that he can cross the Pacific Ocean and arrive in the now American Continent. His brothers thought that was a ridiculous idea. Nephi had never built a boat, how was he going to all of a sudden know how to build a boat, especially one that would actually make it across the great waters and land safely on the other side. It seemed absurd to his brothers. To make a long story short, they do complete the boat and safely made it across the ocean and started a civilization in the Americas. Nephi succeeded, despite his brothers trying to bring him down. His brothers were definitely laggers. So I say go for it. If you have a dream, you want to acheive something, go for it. Do what it takes. You will find that those missed tv shows and other distractions didn't matter anyway. You need to work hard. As my wife pointed out, "You can't reach your dreams by dreaming." You'll feel better for having accomplished something, and perhaps you could be in a better position to make a difference to the world.
Labels:
adoption curve,
Book of Mormon,
dreams,
early adopter,
early majority,
goals,
lagger,
late majority,
Nephi,
priorities,
vision
Monday, January 14, 2008
Early Adopter? or Lagger?
Adoption Curve
It has been shown that the general public tends to adopt a new technology, idea, or trend at different rates. Some will jump on it right away, while others tend to resist adopting for as long as they can. In the middle of these two extremes are the majority of the people. They call this the adoption curve. For those unfamiliar with the term, the adoption curve is in the form of a bell curve.
Early Adopters
At the very beginning of the curve, you have the early adopters. These are the people that will be the first ones that will buy a new technology and use it. They were the first ones using the Internet, cell phones, and iPods.
Early Majority
Following the early adopters on the rising slope of the bell curve come the early majority. After a technology is proven to be useful or "cool", there's a massive wave of people that adopt it. When I was attending college, all of a sudden everybody had huge headphones listening to their Discman CD players. Then all of a sudden everybody started wearing the headphones that wrapped around the ears and went in back of the head. Then all of a sudden everybody had a cell phone and were talking on their cell phones nonstop in between classes. Then all of a sudden everybody had an iPod with the little ear bud headphones. Remember Tomagachi? Or how about the latest Webkinz craze? Maybe I stressed that point too much, but that's an example of the early majority group of people. They tend to adopt a new product or technology because it's popular--everybody is doing it.
Late Majority
After the early adopters, on the downhill slope of the bell curve is a group called the late majority. These people tend to wait out for technology or trend to prove itself before adopting. They may like the idea of the technology, but are a little more careful about what technologies they adopt. Sometimes it may be simply for the fact that there is a war between competing technologies, and these people want to wait it out and see who the winner is, before they spend the money. The example I'm thinking about is the Bluray Disc vs. HD DVD format war.
Laggers
This is the final tail end of the adoption curve. These people fight tooth and nail before adopting a technology. These are like the older generation who would rather do things on paper than use a computer. Even if a technology proves to be useful, they still are slow to adopt, and when they do, it is usually out of necessity than anything else.
What Am I?
I have been trying to determine where I am at in the adoption curve. It seems that for certain things, like computers and business ideas, I tend to be an early adopter. If money wasn't an issue, I would probably be an early adopter with all the new techie toys and software that come out. However, I tend to fight against trends. I am not one to adopt a trend just because, or simply because everyone is doing it. An example is with cell phones. I got a cell phone for the first time not too long ago. Is it convenient? Yes. Is it useful? Yes. I love having a cell phone. But I didn't want one for the longest time, partly because of the trends that I saw. Everybody was doing it. So I guess I am an early adopter for certain things, and other things I am more of a late majority or lagger.
I'm curious to know where other people see themselves fit in the adoption curve. Does it depend on what it is they are adopting? What factors prevent somebody from adopting a new idea or technology as quickly as the early adopters or early majority? What about software in particular; do you tend to adopt new software ideas quickly, or wait until the bugs are worked out and it has proven to be useful?
Just some things to think about.
It has been shown that the general public tends to adopt a new technology, idea, or trend at different rates. Some will jump on it right away, while others tend to resist adopting for as long as they can. In the middle of these two extremes are the majority of the people. They call this the adoption curve. For those unfamiliar with the term, the adoption curve is in the form of a bell curve.
Early Adopters
At the very beginning of the curve, you have the early adopters. These are the people that will be the first ones that will buy a new technology and use it. They were the first ones using the Internet, cell phones, and iPods.
Early Majority
Following the early adopters on the rising slope of the bell curve come the early majority. After a technology is proven to be useful or "cool", there's a massive wave of people that adopt it. When I was attending college, all of a sudden everybody had huge headphones listening to their Discman CD players. Then all of a sudden everybody started wearing the headphones that wrapped around the ears and went in back of the head. Then all of a sudden everybody had a cell phone and were talking on their cell phones nonstop in between classes. Then all of a sudden everybody had an iPod with the little ear bud headphones. Remember Tomagachi? Or how about the latest Webkinz craze? Maybe I stressed that point too much, but that's an example of the early majority group of people. They tend to adopt a new product or technology because it's popular--everybody is doing it.
Late Majority
After the early adopters, on the downhill slope of the bell curve is a group called the late majority. These people tend to wait out for technology or trend to prove itself before adopting. They may like the idea of the technology, but are a little more careful about what technologies they adopt. Sometimes it may be simply for the fact that there is a war between competing technologies, and these people want to wait it out and see who the winner is, before they spend the money. The example I'm thinking about is the Bluray Disc vs. HD DVD format war.
Laggers
This is the final tail end of the adoption curve. These people fight tooth and nail before adopting a technology. These are like the older generation who would rather do things on paper than use a computer. Even if a technology proves to be useful, they still are slow to adopt, and when they do, it is usually out of necessity than anything else.
What Am I?
I have been trying to determine where I am at in the adoption curve. It seems that for certain things, like computers and business ideas, I tend to be an early adopter. If money wasn't an issue, I would probably be an early adopter with all the new techie toys and software that come out. However, I tend to fight against trends. I am not one to adopt a trend just because, or simply because everyone is doing it. An example is with cell phones. I got a cell phone for the first time not too long ago. Is it convenient? Yes. Is it useful? Yes. I love having a cell phone. But I didn't want one for the longest time, partly because of the trends that I saw. Everybody was doing it. So I guess I am an early adopter for certain things, and other things I am more of a late majority or lagger.
I'm curious to know where other people see themselves fit in the adoption curve. Does it depend on what it is they are adopting? What factors prevent somebody from adopting a new idea or technology as quickly as the early adopters or early majority? What about software in particular; do you tend to adopt new software ideas quickly, or wait until the bugs are worked out and it has proven to be useful?
Just some things to think about.
Subscribe to:
Posts (Atom)