Class A needs to cause "Some Activity" to happen (in addition to other
things that Class A does).
Class A may or may not have a default implementation of Some Activity.
Class B is able to do Some Activity.
At runtime, a reference to an instance of Class B is passed to Class A
(perhaps via Setter, or to the constructor of Class A).
Class A causes Some Activity to happen by calling a method of its Class B
reference.
In the future (or even immediately), we need for an alternative
implementation of Some Activity, so we create Class C.
We can then pass a reference [to a Class C instance] to Class A, which then
initiates Some Activity on the Class C instance.
In the above account, Class B and Class C both implement an interface or
derive from a common abstract base class -- and Class A knows only about
that interface, and initiates Some Activity as a method of that interface or
base class.
The most important benefit of the above arrangement (dependency injection)
is that we can extend the application specifically to perform alternative
implementations of Some Activity by adding a new class and updating the
application configuration (so that Class A can be passed a reference to the
new class), without modifying Class A in any way. In other words, Class A is
open for extension, but closed for modification, and dependency injection is
one way to achieve that objective.
Your comments are appreciated, as I'm wanting some verification or
clarification of my understanding of dependency injection.
I'm beginning to level my resources, but I first want to know which tasks
have overallocated resources assigned to them so I can decide what priority
level to give them before leveling the project.
I first tried to set a filter for task overallocations, but that doesn't
help since only overallocations for the individual task show up (in my case
none, because, although during any given day there may be three tasks
assigned to Bob totalling 24 hours-- a definite overallocation-- each
individual task is not overallocated at 8 hours).
I also tried to filter for resource overallocations but that didn't help
since 1) it only works on resource views and, 2) it simply highlights the
resources which are overallocated without giving you a list of the tasks
which are creating the overallocations.
Finally I tried messing around with a custom filter but wasn't able to find
the right combination of fields and values to give the desired results.
If anyone has any suggestions I would really appreciate it.
I'm designing an application in C#. One of the files in my application
is "server.exe". This assembly listens for inbound connections and handles
various incoming requests. I want to give the user of my application the
option to allow server.exe to execute and handle requests even after the
user has logged off.
My plan is to ask the user "Would you like this service to continue
running after you log off?". If the user answers yes, I want to install
"server.exe" as a service. I've done this successfully in a manual way using
the 'installutil' .NET helper application, but my application will need to
do this in an automated way.
How can I accomplish this? Shall I shell out to a command prompt and
execute installutil against server.exe? Does the user need to be an
administrator of his machine? Can I be 100% certain that if the user has the
.NET framework installed that 'installutil' will be installed as well? If
so, how do I find it? Is there some sort of macro (i.e. %DOTNET_FOLDER% for
example) that will allow me to easily determine the dotnet folder where
'installutil' resides?
Is there any way to get server.exe to execute after a user has logged
off *other* than using a service? I'd appreciate any suggestions.
Can someone tell me how I can view the contents of a collection when in
debug mode?
For example, I working with a dataset and when the app stops at a breakpoint
I'd like to see what is actually in the Tables collection of the dataset. I
add a watch on my dataset variable and expand the Tables object. It just
keeps showing me the following: Count, IsReadOnly, Is Synchronized, Item and
SyncRoot. Expand SyncRoot and you're at the beginning of a big old
recursion.
So if I want to see what's in row x of table y for example, I have to create
a variable in my code representing that row in that table and add a watch
for THAT variable. I have to believe that there is an easier, more dynamic,
way for me to inspect the content of this during debugging.
We use several user controls and derived custom controls. Some of
which actually hit the database at design time to show data (such as
filling a list box, etc...)
Our c# client server app uses the .NET Isolated storage libraries for
storing connection string and other info about the application. The
problem is that the Isolated storage bombs at design time (when you
try and view a control that hits the database at design time).
The workaround we have in place is the Isolated storage check is in a
try / catch. If it fails, we load a hard-coded xml file with the same
settings at a specified path that never changes... which defeats the
whole purpose of Isolated Storage.
This isn't a huge issue cuz it only happens at design time and we have
a (hackish) workaround, but I was wondering if anyone has had this
problem and/or knows why it would be happening?
err.raise inside catch?I would like to use err.raise(x) within a catch block to send an exception
back to the calling function or cain of functions. Is this ok to do? I know
if i dont use try catch fail in the child function that it will send an
exception to the calling function but i want to have error handling in all
chain functions.
At the minute we have the lovely choice of not destroying our controls and
having a major memory leak, or we destroy the controls, and find ourselves
unable to close the form.
I have a MS Project 2003 document which is comprised of several phases with
subtasks under each phase. Is there a way that I can print out a specific
phase and its subtasks? I know I can do a task range filter and print that
but I wasn't sure if there was a better way. I would appreciate any helpful
hints on this.
generate xml from sample xmlhi,
i need to generate an xml files of some data in my database ...
i've an xml sample of the result xml nad i've to create a xml
with the same structure ...
which it is the better and faster way?
Can i retrieve a schema from the sample.xml and then write an
xml based on this schema ?
Might i use Dataset.readxmlschema , Dataset.readxml and
Dataset.writexmlschema , Dataset.writexml ???
tnx in advance
andrew
I have a MS Project 2000 and I have two questions (may be for beginners :-)
- How to enter a recurrent task that happens regularly?
- On the Gantt chart , can we see the summary recurrent task as a line that
includes milestones showed inside it (meaning the repeated tasks showed as
milestones inside the line that represents the recurrent summary task) ?
Stored Proc results in DataGridViewI'm trying to get the results of a stored proc (with no input parameters)
into a datagridview. I'm able to get the results into a messagebox but i'm
nor sure how to get them into a DataGridView
Using cn As New SqlConnection(strConn)
Try
cn.Open()
Catch ex As Exception
MessageBox.Show("Connect Attempt Failed")
MessageBox.Show(ex.Message.ToString)
End Try
Dim cmd As New SqlCommand("sp_TestBilly", cn)
cmd.CommandType = CommandType.StoredProcedure
Dim rdr As SqlDataReader
rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection)