Daily Archives

Articles indexed Tuesday May 18 2010

Page 24/121 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • DI and Singleton Pattern in one implementation

    - by Tony
    I want to refactor some code using the Windsor IOC/DI framework, but my issue is that I have some Singleton classes and Factory pattern classes and I am not sure that one can implement a Singleton or Factory using DI. Has anyone any ideas if that is possible and how?

    Read the article

  • Asp.net Crawler Webresponse Operation Timed out.

    - by Leon
    Hi I have built a simple threadpool based web crawler within my web application. Its job is to crawl its own application space and build a Lucene index of every valid web page and their meta content. Here's the problem. When I run the crawler from a debug server instance of Visual Studio Express, and provide the starting instance as the IIS url, it works fine. However, when I do not provide the IIS instance and it takes its own url to start the crawl process(ie. crawling its own domain space), I get hit by operation timed out exception on the Webresponse statement. Could someone please guide me into what I should or should not be doing here? Here is my code for fetching the page. It is executed in the multithreaded environment. private static string GetWebText(string url) { string htmlText = ""; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.UserAgent = "My Crawler"; using (WebResponse response = request.GetResponse()) { using (Stream stream = response.GetResponseStream()) { using (StreamReader reader = new StreamReader(stream)) { htmlText = reader.ReadToEnd(); } } } return htmlText; } And the following is my stacktrace: at System.Net.HttpWebRequest.GetResponse() at CSharpCrawler.Crawler.GetWebText(String url) in c:\myAppDev\myApp\site\App_Code\CrawlerLibs\Crawler.cs:line 366 at CSharpCrawler.Crawler.CrawlPage(String url, List1 threadCityList) in c:\myAppDev\myApp\site\App_Code\CrawlerLibs\Crawler.cs:line 105 at CSharpCrawler.Crawler.CrawlSiteBuildIndex(String hostUrl, String urlToBeginSearchFrom, List1 threadCityList) in c:\myAppDev\myApp\site\App_Code\CrawlerLibs\Crawler.cs:line 89 at crawler_Default.threadedCrawlSiteBuildIndex(Object threadedCrawlerObj) in c:\myAppDev\myApp\site\crawler\Default.aspx.cs:line 108 at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() Thanks and cheers, Leon.

    Read the article

  • Cleanest way to run/debug python programs in windows

    - by YGA
    Python for Windows by default comes with IDLE, which is the barest-bones IDE I've ever encountered. For editing files, I'll stick to emacs, thank you very much. However, I want to run programs in some other shell than the crappy windows command prompt, which can't be widened to more than 80 characters. IDLE lets me run programs in it if I open the file, then hit F5 (to go Run- Run Module). I would rather like to just "run" the command, rather than going through the rigmarole of closing the emacs file, loading the IDLE file, etc. A scan of google and the IDLE docs doesn't seem to give much help about using IDLE's shell but not it's IDE. Any advice from the stack overflow guys? Ideally I'd either like advice on running programs using IDLE's shell advice on other ways to run python programs in windows outside of IDLE or "cmd". Thanks, /YGA

    Read the article

  • Go with Native or using phonegap ?

    - by knightrider
    Hello, I was about to develop iphone app and I want suggestion from the expert since I am totally newbie in it. I have one classified website which is written in php and mysql. What I want to create is Iphone app which can view those classifieds. There will be no complicated function at first version. It will be have different categories and query and display according to the category. And if there's new classified ad, they will get push notification. What I want to know is, what should i go with ? Native or using phonegap ? Is phonegap supports push notification ? Is native app can just get the results through mysql ? or do i need to change it to sql lite ? Any speed different between native and phone gap ? Any advantages and disadvantages ? Thanks.

    Read the article

  • ASP.NET MVC & Windsor.Castle: working with HttpContext-dependent services

    - by Igor Brejc
    I have several dependency injection services which are dependent on stuff like HTTP context. Right now I'm configuring them as singletons the Windsor container in the Application_Start handler, which is obviously a problem for such services. What is the best way to handle this? I'm considering making them transient and then releasing them after each HTTP request. But what is the best way/place to inject the HTTP context into them? Controller factory or somewhere else?

    Read the article

  • MVC 2 Beta DefaultControllerFactory with Areas

    - by stoto
    Why default factory WON'T return full name of the controllers (with namespaces)? I'm using Service Locator and autofac. using System.Web.Mvc; using Microsoft.Practices.ServiceLocation; namespace Application.Core.MVC { public override IController CreateController(System.Web.Routing.RequestContext requestContext, string **controllerName**) { return ServiceLocator.Current.GetInstance<IController>(controllerName); } } I had two home controllers (one under area Blog) http://localhost/Home http://localhost/Blog/Home controllerName return only "Home" without full qualified name for both in above code. This creates a problem when I try to regiser controllers' names for dependency injection. Here is how I register controllers right now according to this situation. Even this brings up the pages without exception. But When I access http://localhost/Home, both controllers invoked regardlessly. foreach (var tp in currentAssemblyControllersTypes) builder.Register(tp).FactoryScoped().Named(tp.Name.Replace("Controller", "")); Anyone can help?Thanks.

    Read the article

  • Unity IOC, AOP & Interface Interception

    - by krisg
    I've been playing around with Unity to do some AOP stuff, setting up via IOC like: ioc.RegisterType<ICustomerService, CustomerService>() .Configure<Interception>().SetInterceptorFor<ICustomerService>(new InterfaceInterceptor()); ... and then having an ICallHandler on the ICustomerService interface's methods. For teh time being i want to just get the method called, the class it's in, and the namespace for that class. So... inside the... public IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext) ...method of the ICallHandler, i can access the method name via input.MethodBase.Name... if i use input.MethodBase.DeclaringType.Name i get the interface ICustomerService... BUT... how would i go about getting the implementing class "CustomerService" rather than the interface? I've been told to use input.Target.. but that just returns "DynamicModule.ns.Wrapped_ICustomerService_4f2242e5e00640ab84e4bc9e05ba0a13" Any help on this folks?

    Read the article

  • iPhone: Remove annotation from MKMapView which is in another view

    - by Nic Hubbard
    I have two views. The first is a MKMapView with some annotations. Clicking a UIButton pushes a second view on the stack. This has a UITableView with a list of annotations which correspond to the map annotations. So, when you click the delete button, how can I call my MKMapView which is in another view, so that I can remove the annotation. My MKMapView is declared in my app delegate, as well as my current class. I am trying to use the following, but it is not working: RideAppDelegate *appDelegate = (RideAppDelegate *)[[UIApplication sharedApplication] delegate]; Annotation *ano; CLLocationCoordinate2D anoPoint; anoPoint.latitude = [[eventToDelete valueForKey:@"latitude"] doubleValue]; anoPoint.longitude = [[eventToDelete valueForKey:@"longitude"] doubleValue]; ano = [[[Annotation alloc] init] autorelease]; ano.coordinate = anoPoint; [appDelegate.ridesMap removeAnnotation: ano]; [appDelegate release]; I must be trying to access the MKMapView of my other view incorrectly?

    Read the article

  • Key Tips in WPF

    - by Brad Leach
    Office 2007 and the Ribbon introduced the concept of "Key Tips". In short, every single command in the Ribbon receives a letter which you can press to activate that command. ... The letters are indicated by small "KeyTips" which indicate the letter to press to activate the control. KeyTips are displayed using the Alt key, so using them feels similar to how menu navigation works in Windows. (Source: http://blogs.msdn.com/jensenh/archive/2006/04/12/574930.aspx) An example of the Key Tips can be shown as follows. In this diagram, the use has pressed the ALT key, and is awaiting further input. Are there any WPF Open Source examples of "Key Tips"? How would you go about implementing something like this feature in a generic way (i.e. not requiring a Ribbon)? How would you implement this using a MVVM pattern (given that ICommand does not support InputBindings). Note: ActiPro have implemented this feature in their implementation of a Ribbon, but they have not released source code.

    Read the article

  • Injecting Subsonic SimpleRepository class to controller

    - by ryudice
    Hi, I'm tryingot get started with IoC, I have an MVC project in which is use subsonic, I'm trying to inject subsonic simplerepository to my controllers but I'm getting this error: StructureMap Exception Code: 205 Missing requested Instance property "connectionStringName" for InstanceKey "60b735fb-0a7f-4eb4-be04-635f6f32233d" Here is my registry class: public class RepositoryRegistry : Registry { protected override void configure() { ForRequestedType<IRepository>().TheDefault.Is.OfConcreteType(typeof(SimpleRepository)); } } And here is my controller factory: public class StoreControllerFactory: DefaultControllerFactory { protected override IController GetControllerInstance(Type controllerType) { IController result = null; if (controllerType!=null) { result = ObjectFactory.GetInstance(controllerType) as Controller; } return result; } } And this is how I configure StructureMap: protected void Application_Start() { RegisterRoutes(RouteTable.Routes); ObjectFactory.Initialize(x=> { x.AddRegistry(new RepositoryRegistry()); }); ControllerBuilder.Current.SetControllerFactory(new StoreControllerFactory()); var sparkSettings = new SparkSettings().SetDebug(true).AddNamespace("System.Web.Mvc.Html"); ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new SparkViewFactory(sparkSettings)); } Any help would be appreciated! Thanks!

    Read the article

  • Unity Configuration and Same Assembly

    - by tyndall
    I'm currently getting an error trying to resolve my IDataAccess class. The value of the property 'type' cannot be parsed. The error is: Could not load file or assembly 'TestProject' or one of its dependencies. The system cannot find the file specified. (C:\Source\TestIoC\src\TestIoC\TestProject\bin\Debug\TestProject.vshost.exe.config line 14) This is inside a WPF Application project. What is the correct syntax to refer to the Assembly you are currently in? is there a way to do this? I know in a larger solution I would be pulling Types from seperate assemblies so this might not be an issue. But what is the right way to do this for a small self-contained test project. Note: I'm only interested in doing the XML config at this time, not the C# (in code) config. UPDATE: see all comments My XML config: <configuration> <configSections> <section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration" /> </configSections> <unity> <typeAliases> <!-- Lifetime manager types --> <typeAlias alias="singleton" type="Microsoft.Practices.Unity.ContainerControlledLifetimeManager, Microsoft.Practices.Unity" /> <typeAlias alias="external" type="Microsoft.Practices.Unity.ExternallyControlledLifetimeManager, Microsoft.Practices.Unity" /> <typeAlias alias="IDataAccess" type="TestProject.IDataAccess, TestProject" /> <typeAlias alias="DataAccess" type="TestProject.DataAccess, TestProject" /> </typeAliases> <containers> <container name="Services"> <types> <type type="IDataAccess" mapTo="DataAccess" /> </types> </container> </containers> </unity> </configuration>

    Read the article

  • Getting fill color inside the itemrenderer in Adobe Flex

    - by Anoop
    Hi All, I am writing a custom item renderer to render a column series in my application. Its a stacked chart and i want to use the same item renderer for both the column series. The color for each series in the stack is different and am setting that in the 'fill' property of the two series. My doubt is how can i get the color specified in the fill property of the column series from the item renderer. if this works then i can very well use the same renderer for both series. Thanks in advance, Anoop

    Read the article

  • Detecting operating system or computer name through a Java servlet

    - by Ankur
    I have a Java web app that I develop on a Windows machine and will deploy on a Unix machine. There are some file path settings and permissions details that differ on the two (and there is nothing I can do to change this). Is there some way of detecting which machine the app is sitting on (it's only one of two), either by detecting the operating system or the computer's name so I can then using the appropriate settings.

    Read the article

  • How to not pass around the container when using IoC in Winforms

    - by L2Type
    I'm new to the world of IoC and having a problem with implementing it in a Winforms application. I have an extremely basic application Winform application that uses MVC, it is one controller that does all the work and a working dialog (obviously with a controller). So I load all my classes in to my IoC container in program.cs and create the main form controller using the container. But this is where I am having problems, I only want to create the working dialog controller when it's used and inside a using statement. At first I passed in the container but I've read this is bad practice and more over the container is a static and I want to unit test this class. So how do you create classes in a unit test friendly way without passing in the container, I was considering the abstract factory pattern but that alone would solve my problem without using the IoC. I'm not using any famous framework, I borrowed a basic one from this blog post http://www.kenegozi.com/Blog/2008/01/17/its-my-turn-to-build-an-ioc-container-in-15-minutes-and-33-lines.aspx How do I do this with IoC? Is this the wrong use for IoC?

    Read the article

  • Unity view Registered Types during debug

    - by Jon Archway
    Possibly a stupid question, but during debug I simply want to see the types that have been registered with my Unity container. I have tried going through the container in the watch window, but can't seem to find what I am looking for? I am expecting there to be a list of registered types somewhere? Thanks in advance

    Read the article

  • Streaming video

    - by Bakhtiyor
    Dear all. During more than 2months I have a problem watching streaming video in my laptop only from my user account. If I log in with another user account I can easily watch streaming video without any problems, but with mine no streaming video :( I have windows 7 OS. What can cause this problem? Thank you all.

    Read the article

  • Agile Tour 2010 : Lancement de l'édition 2010 avec l'appel à candidature d'organisateurs locaux. Vot

    Bonjour, La troisième édition de l'Agile Tour se prépare pour le troisième trimestre (septembre / octobre). 1ère étape : la définition des villes étapes. L'an passé il y avait un total de 18 villes dont 11 en France, Luxembourg, Genève, et 3 aux Canada. Cette année, le Brésil fait son apparition et quelques villes françaises sont d'ores et déjà identifiées. Les organisateurs ont lancé l'appel à candidature de villes. Citation:

    Read the article

  • Using Robot Framework for ATDD

    - by ratkok
    I would like to hear other people's experience with using Robot Framework for automated acceptance testing. What are its major strengths and weaknesses as well as any comparison with other frameworks (mainly Fitness and Selenium)? The code that will be tested is real-time, legacy code, mainly in C++.

    Read the article

  • What's wrong with this SQL query?

    - by ThinkingInBits
    I have two tables: photographs, and photograph_tags. Photograph_tags contains a column called photograph_id (id in photographs). You can have many tags for one photograph. I have a photograph row related to three tags: boy, stream, and water. However, running the following query returns 0 rows SELECT p.* FROM photographs p, photograph_tags c WHERE c.photograph_id = p.id AND (c.value IN ('dog', 'water', 'stream')) GROUP BY p.id HAVING COUNT( p.id )=3 Is something wrong with this query?

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >