We are evaluating IoC containers for C# projects, and both Unity and Castle.Windsor are standing out. One thing that I like about Unity (NInject and StructureMap also do this) is that types where it is obvious how to construct them do not have to be registered with the IoC Container.
Is there way to do this in Castle.Windsor? Am I being fair to Castle.Windsor to say that it does not do this? Is there a design reason to deliberately not do this, or is it an oversight, or just not seen as important or useful?
I am aware of container.Register(AllTypes... in Windsor but that's not quite the same thing. It's not entirely automatic, and it's very broad.
To illustrate the point, here are two NUnit tests doing the same thing via Unity and Castle.Windsor. The Castle.Windsor one fails. :
namespace SimpleIocDemo
{
using NUnit.Framework;
using Castle.Windsor;
using Microsoft.Practices.Unity;
public interface ISomeService
{
string DoSomething();
}
public class ServiceImplementation : ISomeService
{
public string DoSomething()
{
return "Hello";
}
}
public class RootObject
{
public ISomeService SomeService { get; private set; }
public RootObject(ISomeService service)
{
SomeService = service;
}
}
[TestFixture]
public class IocTests
{
[Test]
public void UnityResolveTest()
{
UnityContainer container = new UnityContainer();
container.RegisterType<ISomeService, ServiceImplementation>();
// Root object needs no registration in Unity
RootObject rootObject = container.Resolve<RootObject>();
Assert.AreEqual("Hello", rootObject.SomeService.DoSomething());
}
[Test]
public void WindsorResolveTest()
{
WindsorContainer container = new WindsorContainer();
container.AddComponent<ISomeService, ServiceImplementation>();
// fails with exception "Castle.MicroKernel.ComponentNotFoundException:
// No component for supporting the service SimpleIocDemo.RootObject was found"
// I could add
// container.AddComponent<RootObject>();
// but that approach does not scale
RootObject rootObject = container.Resolve<RootObject>();
Assert.AreEqual("Hello", rootObject.SomeService.DoSomething());
}
}
}
Please note this is not a question about online/hosted SVN services.
I am working on a home based, solo developer, project that now has commercial significance and it is time to think about remote source code backup. There is no need for file level check in/out, all I need is once a day or once a week directory level snapshot to remote storage. Automatic encryption would be a bonus to protect my IP.
What I have in mind is some sort of GUI interface app that will squirt a source code snapshot off to an Amazon S3 bucket on an automatic schedule.
(My development PC runs on MS Windows.)
I've setup a git repository one a remote server. Now I'm trying to checkout from it with:
git fetch ssh://[email protected]/~username/workfolder/
but I get an error:
fatal: Not a git repository
What am I doing wrong? Could it be the server does not support Git+SSH?
When I commit changes with Emacs' built-in VCS interface (I use it with Bazaar) it commits only one file - that's open in current buffer.
So when I press C-c v v, enter message and C-c C-c, it does something like
bzr commit -m "my message" file/open/in.buffer
instead of
bzr commit -m "my message"
How to commit all changes with Emacs?
I need to be able to load web pages from different sites within a page on my site. I am using C# .NET and master pages. Within the content page, I want to be able to load an arbitrary page and display it without any of the browser controls appearing - just the page content.
How can I query those of the labels in ClearCase with cleartool that have a specific attribute.
I can list the labels with
lstype -kind lbtype
but I'd like to get only those that have an attribute called TestAttr.
I have a git repo. It has been forked several times and many independent commits are made on top of it. Everything normal, like what happens in many github hosted projects.
Now, what exact workflow should I follow, if I want to see all that commits individually and apply the ones I like.
The workflow I followed, which is not the optimal is to create a branch of the name github-username and merge the changes into my master and undo any changes in the commit I dont need manually (there are not many, so it worked).
What I want is the ability to see all commits from different forks individually and cherry pick and apply them on top of my master.
What is the workflow to follow for that? And what gui (gitk?) enables me to see all different individual commits.
I realize that merge should be a primary part of the workflow and not cherry-pick as it creates a different commit (from git's point of view). Even rebasing other's changes on top of mine might not preserve the history on the graph to indicate that it is his commits I have rebased. So then, How do I ignore just a few commits from a lot of them?
I think github should have a "apply this commit on top of my master" thing in their graph after each commit node; so I can just pull it, after doing all that.
Hi folks,
I'm trying to wire up a simple ASP.NET MVC2 controller class to my own LoggingService.
Code compiles fine, but I get the following runtime error :-
{"StructureMap Exception Code: 202
No Default Instance defined for PluginFamily System.Type, mscorlib,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"}
what the? mscorlib ????
Here's some sample code of my wiring up ..
protected void Application_Start()
{
MvcHandler.DisableMvcResponseHeader = true;
BootstrapStructureMap();
ControllerBuilder.Current.SetControllerFactory(
new StructureMapControllerFactory());
RegisterRoutes(RouteTable.Routes);
}
private static void BootstrapStructureMap()
{
ObjectFactory.Initialize(x =>
x.For<ILoggingService>().Use<Log4NetLoggingService>());
}
and finally the controller, simplified for this question ...
public class SearchController : Controller
{
private readonly ILoggingService _log { get; set; }
public SearchController(ILoggingService loggingService) :
base(loggingService)
{
// Error checking removed for brevity.
_log = loggingService;
_log.Tag = "SearchController";
}
...
}
and the structuremap factory (main method), also way simplified for this question...
protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
{
IController result = null;
if (controllerType != null)
{
try
{
result = ObjectFactory.GetInstance(controllerType) as Controller;
}
catch (Exception exception)
{
if (exception is StructureMapException)
{
Debug.WriteLine(ObjectFactory.WhatDoIHave());
}
}
}
}
hmm. I just don't get it.
StructureMap version 2.6.1.0
ASP.NET MVC 2.
Any ideas?
I want to run scheduled nightly exports of my database code into my SVN source.
It's easy to schedule automated check-in's into svn from a folder, but scheduling the export from SQL in SQL Management Studio is
Right click target database, choose Tasks Generate Scripts.
Follow the wizard and presto you've got scripts in a folder.
Is it possible to extract a single script that the wizard generates, and stuff that into a stored proc which I can run nightly?
Ideas?
Hi,
we want to use Unity for IOC.
All i've seen is the implementation that there is one global static service which holds a reference to the Unity container, which registers all interface/class combinations and every class asks that object: give me an implementation for Ithis or IThat.
Frequently i see a response that this pattern is not good because it leads to a dependency from ALL classes to this service.
But what i don't see often, is: what is the alternative way?
Michel
Title says it. What's the best tool for viewing and editing a merge in Git? I'd like to get a 3-way merge view, with "mine", "theirs" and "output" in separate panels.
Also, instructions for invoking said tool would be great. (I still haven't figure out how to start kdiff3 in such a way that it doesn't give me an error)
edit: My OS is Ubuntu.
I know that in Visual SourceSafe you can go in and drill down to the history of an individual file and then drill down to an individual check-in and apply a comment to the check-in that way but that's tedious and time consuming - if you have a lot of files that were checked in at the same time and you want the same comment to apply to all of them this will take forever.
I use the tool VSSReporter to generate reports of checkins and other stuff from VSS, but it cannot edit anything, only report on them.
Are there any tools which will let you go back and retroactively apply comments to check-ins in an efficient and easy manner?
Yesterday I was reading some articles in this site while I stumbled on an article about this two new IoC tools. Which one should I learn first? Is there some specification about which one should be used when?
We are having havoc with our project at work, because our VCS is doing some awful merging when we move information across files.
The scenario is thus:
You have lots of files that, say, contain information about terms from a dictionary, so you have a file for each letter of the alphabet.
Users entering terms blindly follow the dictionary order, so they will put an entry like "kick the bucket" under B if that is where the dictionary happened to list it (or it might have been listed under both B, bucket and K, kick).
Later, other users move the terms to their correct files. Lots of work is being done on the dictionary terms all the time.
e.g. User A may have taken the B file and elaborated on the "kick the bucket" entry. User B took the B and K files, and moved the "kick the bucket" entry to the K file. Whichever order they end up getting committed in, the VCS will probably lose entries and not "figure out" that an entry has been moved.
(These entries are later automatically converted to an SQL database. But they are kept in a "human friendly" form for working on them, with lots of comments, examples etc. So it is not acceptable to say "make your users enter SQL directly".)
It is so bad that we have taken to almost manually merging these kinds of files now, because we can't trust our VCS. :(
So what is the solution? I would love to hear that there is a VCS that could cope with this. Or a better merge algorithm? Or otherwise, maybe someone can suggest a better workflow or file arrangement to try and avoid this problem?
bzr push defaults to the first target you pushed to. If I now want to push to a different location, but don't want to manually enter it every time, how do I change the default?
I am currently maintaining a Mercurial repository of the project I am working on.
The rest of the team, however, doesn't.
There is a "good" (unversioned) copy of the code base that I can access by SSH. What I would like to do is be able to do something like an hg pull from that good copy into my master repository whenever it gets updated.
As far as I can tell, there's no obvious way to do this, as hg pull requires you have a source hg repository.
I suppose I could use a utility like rsync to update my repository, then commit, but I was wondering:
Is there was an easier/less contrived way to do this?
I keep searching, but cannot find a clear and simple explanation on how to include one XCode project, along with all of it's sub-classes into another project. I routinely see stuff like that in sample projects that I download off the web, but do not know how to do this myself.
Within XCode, along with .h and .m files, and folders, there's a whole new project, starting with a blue xcode project icon, that is expandable to contain everything within the project.
Please, can someone explain to me step by step what do I need to do to add one XCode project into another one? I've seen a ton of one liners like "header search paths", but that does not tell me much.
UPDATE: After re-reading the documentation, I realized that the project to include must be dragged ONTO the BLUE project icon of the parent project. Regular sources can be dragged anywhere, but a project must be dragged onto a project.
Thank you!
I've got multiple SVN repositories of different projects which I would like to search for the same search term / regex, but without checking out or updating each project and doing the search manually on each of them.
I'd like to know if it is possible to search the file contents in multiple SVN repositories for some search term (or regex).
Hello. Does anyone know how to remove the "click" sound you get when navigating to another page, when using a WebBrowser on a WinForm? I would have thought they would have included an option to choose weither you want it enabled, but they didn't. Thanks for the help!
I have the oddest problem (but aren't all programming problems odd?). I have a winform that contains a webbrowser object that opens a website that has flash on it. This winform is running on a touchscreen computer (I can't find the brand or model number).
Here is what I know:
flash objects embeded in a website that is accessed via the webbrowser object in my winform do not function properly
said flash objects only react to the first 'click' on them. So the website opens and if I hit a button, that button works but nothing afterward works within the flash object works. If my first 'click' misses a button, nothing works there after.
trying to 'click' an flash button gives the same response as just hovering over the button
This isn't a problem with the touch part of the touch screen as using a mouse also gives the same not working right response
this isn't a problem with the web page as I can open up explorer on the same computer and navigate the webpage just fine from there
The program also works 100% right on my personal computer so it shouldn't be the program's fault
if it's not the touch screen fault and not the program's fault, I can't blame anything right now.
the EXACT same program worked 100% on our old touch screen (which was having other problems so we had to get rid of it).
Oh, also, surfing just a 'normal' webpage in a webbrowser in the winform works just fine.
Recently I developed a performance tester console application, with no UI, with the help of a IoC containter (Castle-Windsor-Microkernel). This library enabled me to let the user choose which test(s) to run, simply by changing the configuration file.
Have I realized what IoC containers are about? I'm not sure. Even Joel said here on SO that IoC are difficult to understand.
From my example, what do you conclude? Am I using IoC container for exactly what they were designed for? Or I am just using one of its secondary features?
I have a file in a project that is in a bitkeeper repository. I checked in a file but I haven't committed the change to create a changeset. How can I undo the checkin?
If I had a changeset I could undo the commit with:
bk undo -r<rev>
But in this case I can't commit and undo the changeset because I have other checked-in files that I don't want to touch.
I am looking for tips for someone who has done a migration before.
Also, any kind of benchmark about the migration will be very appreciated! (ex. how much time takes the migration tool to migrate a 1 gb data?)
Thanks in advance!