I think cars and jet planes make people lazy... but they also get us where we are going faster.
"We are men of action; lies do not become us."
I think cars and jet planes make people lazy... but they also get us where we are going faster.
"We are men of action; lies do not become us."
*sigh* everyone's a comedian :)
"We are men of action; lies do not become us."
Just curious because I may be in the running for an interview. Anyone in the community here that has worked for Disney as a software engineer? Is it a good career move? How does it compare to the atmosphere working at Microsoft?
"We are men of action; lies do not become us."
Thanks for the tip! Edit: I'm going to repost this in the Lounge, per your advice, so feel free to remove this thread.
"We are men of action; lies do not become us."
Nice :-)
"We are men of action; lies do not become us."
Just curious because I may be in the running for an interview. Anyone in the community here that has worked for Disney as a software engineer? Is it a good career move? How does it compare to the atmosphere working at Microsoft?
"We are men of action; lies do not become us."
I suspected as much :-)
"We are men of action; lies do not become us."
Hello, I have been looking into Test Driven Development lately, where the Unit Tests are designed and created first, and then production code is constructed to fulfill the unit test contracts. I am sold on the value of Unit Testing, however I am not yet convinced that true Test Driven Development offers significant return for the time spent in adjusting development practices. It would be great if some other professionals who have used TDD could share some of their experiences, good or bad, and share whether or not they found TDD to be a truly beneficial practice, with the understanding that I am asking specifically about TDD and not ordinary Unit Testing. I understand there's no magic bullet and I'm not expecting that, just looking for the best practice that makes the most sense for our development procedures.
"We are men of action; lies do not become us."
This MSDN thread appears to link to a possible solution for you: how to force the interactive user to logoff.
"We are men of action; lies do not become us."
Jonathan, I can see why my language may have been confusing. I was not meaning to imply that using the == operator would result in a NullReferenceException. My first statement was that the "Equals" method should be used to make the comparison, and I then went on to state that the static method should be preferred for strings (rather than the instance method) since using the instance method could result in a NullReferenceException while using the static method will not. Looking back at my post, however, I can see why one might think I was implying something different, which was not my intent. Regardless, thanks.
"We are men of action; lies do not become us."
Personally when performing value comparisons with strings (and many other types) I find I am far less prone to syntax errors if I make myself use the "Equals" method. With strings in particular, it is a good practice to use the static method
String.Equals(string a, string b)
as this eliminates the possibility of a null reference exception. With this in mind, the boolean in your if statement would look like this:
if (String.Equals(btnPause.Content, "Pause"))
"We are men of action; lies do not become us."
I do a lot of dynamically created JavaScript in my ASP.Net development. I use a pattern similar to this:
protected void Page_PreRender(object sender, EventArgs e)
{
/* Call your method that registers JavaScript from here. This event is called even if
* you only have a Call Back rather than a Post Back
*/
RegisterClientScript();
}
// This method contains any dynamic JavaScript that I wish to register on the page
protected void RegisterClientScript()
{
// Check first to see if the page has already had the Javascript code registered.
if (!(Page.ClientScript.IsStartupScriptRegistered("myJS"))
{
// Use a string builder to, well, build the string. This limits the number of immutable strings that are added to memory and must
// be eventually garbage collected.
StringBuilder js = new StringBuilder();
// Build the JavaScript code. Note that inside the string we are actually using single quotes - this is legal in JavaScript for strings.
// In this way you don't even have to mess with escape characters. At least not as often - there may still be occasions where you will
// need single quotes.
js.AppendLine("TargetDate = 'friday';");
js.AppendLine("BackColor = 'palegreen';");
js.AppendLine("ForeColor = 'navy';");
js.AppendLine("CountActive = true;");
js.AppendLine("CountStepper = -1;");
js.AppendLine("LeadingZero = true;");
js.AppendLine("DisplayFormat = '%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.';");
js.AppendLine("FinishMessage = 'It is finally FRIDAY!'");
/\* Call the register startup script method. This will call the above script to execute when the page renders. The first parameter is any instance of the
\* System.Type class, but usually you want to pass the type of this Page or Control. Next is the key, then the JavaScript string itself. The last boolean value
\* specifies whether or not script tags should be added to the JavaScript code. You can add them yourself or just do as I did and have the RegisterClientScript method
\* do this for you. To me this way is cleaner.
\*/
Page.ClientScript.RegisterStartupScript(this.GetType(), "myJS", js.ToString(), true);
}
}
"We are men of action; lies do not become us."
I'm not sure about the necessity of using a StateTracker to track the state of a row, but notwithstanding that, why would you need to derive the StateTracker from a generic type? Based on your post, I am guessing that you want to actually derive the StateTracker from the List that is used as the GridView data source. Assuming you could do this, it really wouldn't be an effective inheritance model because A List is a logical grouping of objects, and a StateTracker is an object created for tracking the state of something. There really is no logical inheritance relation between the two. I think it would be more effective to use a model like this: Say you have objects you are viewing in your GridView. We'll call them objects of type Widget. Now you want to populate your GridView with a data source. You're using a List<Widget> collection object as your data source. Great, except this doesn't have all the data you need. You want to track the state of the List<Widget>. So just create an overloaded class, call it WidgetCollection or something like that. This class will inherit from List<Widget> and also contain an instance of the StateTracker class (which is a base type - not derived from anything other than System.Object). This inner instance of StateTracker should be used to track the state of each WidgetCollection. Again I don't know if this would be the best solution because I don't fully know your situation, but something along these lines should meet your needs - You have a collection of objects that either tracks state on the collection level or the object level. If you are tracking on the collection level, then the collection contains a StateTracker to handle this. If you are tracking on the object level, then each Object contains a StateTracker to handle this. Hope that helps or gets you pointed in the right direction.
"We are men of action; lies do not become us."
I don't think this could work. Inheritance is handled at compile time while Generic type parameters are resolved at run time. There's no way for the compiler to know what the base class of of StateTracker<T> would be, and therefore what the functional interface to that base class would be. For example, in your default constructor you are explicitly calling the default constructor of the base class - but what if type T does not define a default constructor or the default constructor is hidden (private)? In my opinion you would be better off to create your StateTracker class to contain an element of Type T and interact with it in this manner even if C# did allow you to derive from a Generic type.
"We are men of action; lies do not become us."
Hi there, I was looking over your post and I think this is a sample of how to accomplish what you are looking for. Look this over:
using System;
using System.Collections.Generic;
public abstract class ZooAnimal
{
public abstract string Speak();
}
public class Cat : ZooAnimal
{
public override string Speak()
{
return "Meow";
}
}
public class Lion : Cat
{
public override string Speak()
{
return "Rowr!";
}
}
public class Program
{
public static void Main(params string[] args)
{
List<ZooAnimal> zooAnimals = new List<ZooAnimal>();
for (int i = 0; i < 2; i++)
zooAnimals.Add(new Cat());
for (int i = 0; i < 3; i++)
zooAnimals.Add(new Lion());
for (int i = 0; i < zooAnimals.Count; i++)
{
Lion lion = zooAnimals\[i\] as Lion;
if (lion != null)
Console.WriteLine("The lion says: " + lion.Speak());
else
{
Cat cat = zooAnimals\[i\] as Cat;
Console.WriteLine("The cat says: " + cat.Speak());
}
}
Console.Read();
}
}
See this is all just a matter of inheritance and making sure you instantiate your types correctly. In your code example you are adding two animals to the collection but trying to get out two cats. Remember - all cats are animals but not all animals are cats. To get the code you posted to work correctly, you would need to add cats to the zooAnimals collection instead of just animals. This works just fine in C# by the way - an object declared as a base type can always hold an instance of one of its derived types. To illustrate I created a three tiered inheritance example. Notice that in the above example you have ZooAnimals, Cats, and Lions. ZooAnimals is an abstract type, it exists only to serve as a base class for anything that I might consider a zoo animal. Then you have the Cat class. This is also a pretty general class - there are many types of cats, so I derived another class from Cat called Lion. Notice the hierarchy - All Lions are Cats but not all Cats are Lions (illustrated in the final for loop in the static method Main). All Cats are ZooAnimals (as far as this program is concerned at least) all ZooAnimals are not necessarily Cats. It must also follow then that since all Lions are Cats, and all Cats are ZooAnimals, then all Lions are ZooAnimals as well. Hope that
Hi, I have searched around the web and all my reference books but have yet to see an example of how this is done, or even if it can be done. Here is my dilemma: I have some old legacy apps that were written in VB6. Yay. Despite the fact that the VB6 programmers never used Object Oriented Programming of any kind... for some reason in this case they decided to nest the Procedure I need inside a class. Because of some poor programming practices that our team insists on following, I am prohibited from creating a strong reference to this COM Dll, I have to use PInvoke. So How can I use PInvoke to reference a method when it is a member of a VB6 class? The entry point is not recognized since an instance of the class would need to first be instantiated in order to access the method. Here is a sample of what my DllImport looks like:
[DllImport("SomeCOMDll", EntryPoint="aVB6Function")]
public static extern Recordset AVb6Function([MarshalAs(UnmanagedType.BStr)]
string globalIdentifier,
[MarshalAs(UnmanagedType.BStr)]
string webUser_ID,
DateTime shipDate,
[MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_BSTR)]
string[,] origDestArray,
[MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_BSTR)]
string[,] wtClsArray,
[MarshalAs(UnmanagedType.BStr)]
string mode,
[MarshalAs(UnmanagedType.BStr)]
string svcLvl,
[MarshalAs(UnmanagedType.BStr)]
string IOT,
[MarshalAs(UnmanagedType.BStr)]
string custCode,
[MarshalAs(UnmanagedType.Currency)]
decimal fuel,
[MarshalAs(UnmanagedType.Currency)]
decimal addtMarkupPct,
[MarshalAs(UnmanagedType.SafeArray, SafeAr
Hey there all, I'm just throwing this out there to see if anyone might have an idea on something to try: I have recently developed a new Web User Control. This is not my first User Control, I have built many. The control itself does not seem to have issues. I and others in my office can compile and use the control just fine. Yay. However, we have an off site developer to whom I have sent the source code for the control. I did not leave anything out, any required JavaScript, CSS, all required files were sent with the control. However, when he attempts to compile his site with the control, he is getting compiler errors that would seem to indicate that he is not running the correct Framework version. For example, it will not compile with automatic properties (that is, properties that rely on the compiler to build their implementation and add the associated fields to the class), and also rejects methods that are specific to Framework 3.5 such as the Generically typed "ToArray()" method of the Generic List class that is provided as an extension through the System.Linq namespace in .Net 3.5. I asked the developer to check his target Framework for the site. It is 3.5 I asked him to check which version of System.Core his site was referencing. It is, indeed, referencing version 3.5.0.0. I made doubly sure that the code behind file for the control contains a using statement for the System.Linq namespace, it does. The developer apparently did not have SP1 for VS2008 or .Net 3.5 installed but he has since installed the Service Pack. Has anyone else run into an issue like this or have an idea for something else to try. At this point I am prepared to redevelop the control as a Web Server Control so that I can send it to him pre-compiled, but we are being pushed for a deadline so if there is some quick fix out there I'd love to try that first. Thanks for any and all suggestions.
"We are men of action; lies do not become us."
Hi, I'm somewhat new to The Code Project. I browse the articles often but rarely ever have I posted in the message board (this might be my first). I live in Hickory, North Carolina and I am interested in participating in, or starting, a local .NET developers user group. If you live near Hickory, NC and are at all like me, then chances are you work at a relatively small IT shop with few or no peers in your field to bounce ideas off of or to vent mutual frustration over not being able to use fall through in C# switch statements. So if anyone from Hickory, NC reads this and is interested just respond back to this post and we'll talk. Even if no group ever gets started it would still be good to know some other developers in the area. Peace :cool:
"We are men of action; lies do not become us."