Search Results

Search found 4034 results on 162 pages for 'ioc container'.

Page 15/162 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Hotfixing Code running inside Web Container with Groovy

    - by raoulsson
    I have a webapp running that has a bug. I know how to fix it in the sources. However I cannot redeploy the app as I would have to take it offline to do so. (At least not right now). I now want to fix the code "at runtime". Surgery on the living object, so to speak. The app is implemented in Java and is build on top of Seam. I have added a Groovy Console to the app previous to the last release. (A way to run arbitrary code at runtime) The normal way of adding behaviour to a class with Groovy would be similar to this: String.metaClass.foo= { x -> x * x } println "anything".foo(3) This code added the method foo to java.lang.String and prints 9. I can do the same thing with classes running inside my webapp container. New instances will thereafter show the same behaviour: com.my.package.SomeService.metaClass.foo= { x -> x * x } def someService = new com.my.package.SomeService() println someService.foo(3) Works as excpected. All good so far. My problem is now that the container, the web framework, Seam in this case, has already instantiated and cached the classes that I would like to manipulate (that is change their behaviour to reflect my bug fix). Ideally this code would work: com.my.package.SomeService.metaClass.foo= { x -> x * x } def x = org.jboss.seam.Component.getInstance(com.my.package.SomeService) println x.foo(3) However the instantiation of SomeService has already happened and there is no effect. Thus I need a way to make my changes "sticky". Has the groovy magic gone after my script has been run? Well, after logging out and in again, I can run this piece of code and get the expected result: def someService = new com.my.package.SomeService() println someService.foo(3) So the foo method is still around and it looks like my change has been permanent... So I guess the question that remains is how to force Seam to re-instantiate all its components and/or how to permanently make the change on all living instances...?

    Read the article

  • Go - Using a container/heap to implement a priority queue

    - by Seth Hoenig
    In the big picture, I'm trying to implement Dijkstra's algorithm using a priority queue. According to members of golang-nuts, the idiomatic way to do this in Go is to use the heap interface with a custom underlying data structure. So I have created Node.go and PQueue.go like so: //Node.go package pqueue type Node struct { row int col int myVal int sumVal int } func (n *Node) Init(r, c, mv, sv int) { n.row = r n.col = c n.myVal = mv n.sumVal = sv } func (n *Node) Equals(o *Node) bool { return n.row == o.row && n.col == o.col } And PQueue.go: // PQueue.go package pqueue import "container/vector" import "container/heap" type PQueue struct { data vector.Vector size int } func (pq *PQueue) Init() { heap.Init(pq) } func (pq *PQueue) IsEmpty() bool { return pq.size == 0 } func (pq *PQueue) Push(i interface{}) { heap.Push(pq, i) pq.size++ } func (pq *PQueue) Pop() interface{} { pq.size-- return heap.Pop(pq) } func (pq *PQueue) Len() int { return pq.size } func (pq *PQueue) Less(i, j int) bool { I := pq.data.At(i).(Node) J := pq.data.At(j).(Node) return (I.sumVal + I.myVal) < (J.sumVal + J.myVal) } func (pq *PQueue) Swap(i, j int) { temp := pq.data.At(i).(Node) pq.data.Set(i, pq.data.At(j).(Node)) pq.data.Set(j, temp) } And main.go: (the action is in SolveMatrix) // Euler 81 package main import "fmt" import "io/ioutil" import "strings" import "strconv" import "./pqueue" const MATSIZE = 5 const MATNAME = "matrix_small.txt" func main() { var matrix [MATSIZE][MATSIZE]int contents, err := ioutil.ReadFile(MATNAME) if err != nil { panic("FILE IO ERROR!") } inFileStr := string(contents) byrows := strings.Split(inFileStr, "\n", -1) for row := 0; row < MATSIZE; row++ { byrows[row] = (byrows[row])[0 : len(byrows[row])-1] bycols := strings.Split(byrows[row], ",", -1) for col := 0; col < MATSIZE; col++ { matrix[row][col], _ = strconv.Atoi(bycols[col]) } } PrintMatrix(matrix) sum, len := SolveMatrix(matrix) fmt.Printf("len: %d, sum: %d\n", len, sum) } func PrintMatrix(mat [MATSIZE][MATSIZE]int) { for r := 0; r < MATSIZE; r++ { for c := 0; c < MATSIZE; c++ { fmt.Printf("%d ", mat[r][c]) } fmt.Print("\n") } } func SolveMatrix(mat [MATSIZE][MATSIZE]int) (int, int) { var PQ pqueue.PQueue var firstNode pqueue.Node var endNode pqueue.Node msm1 := MATSIZE - 1 firstNode.Init(0, 0, mat[0][0], 0) endNode.Init(msm1, msm1, mat[msm1][msm1], 0) if PQ.IsEmpty() { // make compiler stfu about unused variable fmt.Print("empty") } PQ.Push(firstNode) // problem return 0, 0 } The problem is, upon compiling i get the error message: [~/Code/Euler/81] $ make 6g -o pqueue.6 Node.go PQueue.go 6g main.go main.go:58: implicit assignment of unexported field 'row' of pqueue.Node in function argument make: *** [all] Error 1 And commenting out the line PQ.Push(firstNode) does satisfy the compiler. But I don't understand why I'm getting the error message in the first place. Push doesn't modify the argument in any way.

    Read the article

  • STL container to pop() by priority?

    - by Pirate for Profit
    I'm writing a thread-pool for Qt as QRunnable doesn't handle event loops in new threads. Not too familiar with STL, what would be the best way to pop() something by priority? Priority should probably be a property of MyRunnable imo, but I can always give that info to an STL container when adding the runnable to the queue.

    Read the article

  • With custom binding for Masonry how would I resize the container appropriately

    - by BigDubb
    Based on the suggestion give here, and the information given here on how to make a custom bindingHandler for a forEach, I decided to attempt to write my own custom binding for a forEach and Masonry. Because the elements are added on the fly the redrawing and moving around of elements to fill the space doesn't occur. So, this functionality needed to be moved after the elements have been rendered or called after each item has been added. Here is my bindingHandler ko.bindingHandlers.masonry = { init: function (element, valueAccessor, allBindingsAccessor) { var $element = $(element), originalContent = $element.html(); $element.data("original-content", originalContent); //var msnry = new Masonry($element); return { controlsDescendantBindings: true } }, update: function (element, valueAccessor, allBindingsAccessor) { var value = ko.utils.unwrapObservable(valueAccessor()), //get the list of items items = value.items(), //get a jQuery reference to the element $element = $(element), //get the current content of the element elementContent = $element.data("original-content"); $element.html(""); var container = $element[0]; var msnry = new Masonry(container); for (var index = 0; index < items.length; index++) { (function () { //get the list of items var item = ko.utils.unwrapObservable(items[index]), $childElement = $(elementContent); ko.applyBindings(item, $childElement[0]); //add the child to the parent $element.append($childElement); msnry.appended($childElement[0]); })(); msnry.layout(); msnry.bindResize(); } } }; and the HTML implementing the handler. <div id="criteriaContainer" data-bind="masonry: { items: SearchItems.Items }"> <div class="searchCriterion control-group"> <label class="control-label" data-bind="text: Description"></label> <div class="controls"> <input type="hidden" data-bind="value: Value, select2: { minimumInputLength: 3, queryUri: SearchUri(), placeholder: Placeholder(), allowClear: true }" style="width: 450px"> </div> <p data-bind="text: Value"></p> </div> </div> When this shows up on the page It stacks all if the elements rendered via the append method right on top of each other. You can see in my bindingHandler I am calling bindResize as well as layout(), neither of which seem to be having any effect. Here's a screenshot of what it looks like in the UI.

    Read the article

  • How to generate thumbnails for less common video containers (mkv, ogm, mp4, flv, rmvb and mov) in wi

    - by fluxtendu
    So how to generate thumbnails for these containers? I know that the install of "DivX Plus Tech Preview: MKV on Windows 7" does it for MKV. But I think that only some registry changes are really necessary and I want it for other containers. If it's possible to avoiding the install of (always bloated) codecs packs it would be nice... Maybe only installing ffdshow or essential and separated codecs. (some time ago I have try reg files for vista without success...) Update: I have installed Win7codecs & tweaked a little its settings and I got almost everything I want. (I have also re-installed the relevant part of the divx plus tech preview to get something else than an all black preview for MKV) Issues that I still want to resolve: Find a cleaner & lighter method Almost all my rmvb and mov files got an all black preview (installing real media/quick time alternative doesn't help, is it the same with the officials?) With almost all containers (avi, mkv, ogm, mpg), I have (few) random files that don't get the preview. I could play them in WMP or another player and don't have found a pattern in the codecs used. All wmv, flv and mp4 have previews but I have less files in these containers. (I clear my thumbnails cache to test them) More generally I would like to understand how windows handle the containers & codecs to generate the previews. And a software that let me choose arbitrarily the pictures previewed would be convenient too

    Read the article

  • Why is the resulting file unplayable when I use FFMPEG to convert a MP4 video to ASF?

    - by Fuupoo
    I want to convert an .mp4 file to an .asf file, but I need to keep the size of the file below 150 mb (the server I need to upload the file to can only take files under 150 mb). Basically I want to recontain the .mp4 in an .asf file. The code I'm using currently is ffmpeg input.mp4 -c copy output.asf The command runs, however when I try to play the file on windows media player (I'm on windows xp) I get an error message saying "Windows media player has encountered a problem while playing the file." Anyone have any idea why this is happening? And what other ways I can accomplish this task?

    Read the article

  • Using Prism with Ninject

    - by stiank81
    Is anyone out there using the Prism framework with Ninject instead of Unity? I need some functionality Unity isn't supporting yet, and I've decided to switch the IoC container to Ninject. I'm struggling a bit with the replace though.. What I need to use from Prism is the EventAggregator and the RegionManager. I have seen this sample that actually does the replace, but this is written for an older version of Prism, and several of the classes seems to have changed etc. So I ended up all confused after looking doing some effort in trying to rewrite it. So - my question is basically: How can I replace Unity with Ninject? What are the necessary steps? Initially I assumed I could write a simple bootstrapper that creates and configures a Ninject container and uses this to resolve all other objects. I bind IEventAggregator to EventAggregator and IRegionManager to RegionManager, but it fails when creating the Shell and the RegionManager.CreateRegion is called. Problem is that it seems like I need to set a ServiceLocator somewhere as it fails on this line: IServiceLocator locator = ServiceLocator.Current; Any ideas and tips along the way?

    Read the article

  • GWT Acegi alternative

    - by DroidIn.net
    I'm starting new project. The client interface is based on GWT (and GXT) I have no say it's predetermined. However I can pick and choose as far as server side so I can have some fun and hopefully learn something new in the process. Some requirements are : Exchange with server will be through use of JSON, most if not all of UI will be generated by GWT (JS) on the client, so the client/serve exchange will be limited to data exchange as much as possible No Hibernate (it's not really supported on the proprietary db I will be connecting to). In the past projects people would use JDBC or iBATIS Some sort of IoC (I'm thinking Guice just to stick with Google) Some sort of Security framework based on LDAP. In the past we would use Spring security (Acegi) but it wasn't ideal and we had to customize it a lot So basically should I stick with tried-and-true Spring/Acegi or try something based on Guice? And what that "something" would be and how mature is it?

    Read the article

  • Error while deploying a web application in OSGI container using pax web

    - by RaulDM
    Hello I am trying to deploy a web application in a Felix container. I have all the required configuration done with my web app like the setting up of the manifest headers: Webapp-Context: Bundle-ClassPath: Bundle-Activator: Import-Package: Bundle-SymbolicName: etc The Pax bundles that I have dropped in the same container are: pax-web-service-0.6.0.jar pax-web-jsp-0.7.1.jar pax-web-extender-war-0.7.1.jar pax-logging-service-1.5.0.jar pax-logging-api-1.5.0.jar Though it had been written in the pax web site that pax-web-service is included in pax-war-extender, it seems without pax-web-service bundle, all other bundles become handicapped. I had removed the other pax bundles like pax-web-extender-whiteboard-0.7.1.jar pax-web-jetty-0.7.1.jar, as I have not seen any usefulness of those. The pax-web-jetty-0.7.1.jar even does not get start up. it has dependencies which it could not be able to resolve from any one of the bundle provided by PAX. My browser is displaying: HTTP ERROR 403 Problem accessing /adminmodule/. Reason: FORBIDDEN Powered by Jetty:// while the Console log says: [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.mortbay.jetty - REQUEST /adminmodule/ on org.mortbay.jetty.HttpConnection@1e94001 [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.ops4j.pax.web.service.internal.model.ServerModel - Matching [/adminmodule/]... [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.ops4j.pax.web.service.internal.model.ServerModel - Path [/adminmodule/] matched to {pattern=/adminmodule/.*,model=ResourceModel{id=org.ops4j.pax.web.service.internal.model.ResourceModel-2,name=,urlPatterns=[/],alias=/,servlet=ResourceServlet{context=/adminmodule,alias=/,name=},initParams={},context=ContextModel{id=org.ops4j.pax.web.service.internal.model.ContextModel-1,name=adminmodule,httpContext=org.ops4j.pax.web.extender.war.internal.WebAppWebContainerContext@11710be,contextParams={webapp.context=adminmodule}}}} [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.ops4j.pax.web.service.internal.HttpServiceContext - Handling request for [/adminmodule/] using http context [org.ops4j.pax.web.extender.war.internal.WebAppWebContainerContext@11710be] [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.mortbay.jetty - sessionManager=org.mortbay.jetty.servlet.HashSessionManager@19c6163 [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.mortbay.jetty - session=null [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.mortbay.jetty - servlet= [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.mortbay.jetty - chain=org.ops4j.pax.web.service.internal.model.FilterModel-3- [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.mortbay.jetty - servlet holder= [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.mortbay.jetty - call filter org.ops4j.pax.web.service.internal.model.FilterModel-3 [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.ops4j.pax.web.service.internal.WelcomeFilesFilter - Apply welcome files filter... [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.ops4j.pax.web.service.internal.WelcomeFilesFilter - Servlet path: / [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.ops4j.pax.web.service.internal.WelcomeFilesFilter - Path info: null [5884890@qtp-16567002-0 - /adminmodule/] INFO org.ops4j.pax.web.service.internal.HttpServiceContext - getting resource: [/adminmodule.jsp] [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.ops4j.pax.web.extender.war.internal.WebAppWebContainerContext - Searching bundle [com.cisco.zaloni.gwt.admin [1]] for resource [/adminmodule.jsp], normalized to [adminmodule.jsp] [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.ops4j.pax.web.extender.war.internal.WebAppWebContainerContext - Resource not found [5884890@qtp-16567002-0 - /adminmodule/] INFO org.ops4j.pax.web.service.internal.HttpServiceContext - found resource: null [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.mortbay.jetty - call servlet [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.ops4j.pax.web.extender.war.internal.WebAppWebContainerContext - Searching bundle [com.cisco.zaloni.gwt.admin [1]] for resource [/], normalized to [/] [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.ops4j.pax.web.extender.war.internal.WebAppWebContainerContext - Resource found as url [bundle://1.0:1/] [5884890@qtp-16567002-0 - /adminmodule/] DEBUG org.mortbay.jetty - RESPONSE /adminmodule/ 403 It is really frustrating. please help. as I am new to OSGI. Raul

    Read the article

  • Plugin Framework - can there be too many addin assemblies?

    - by spooner
    Hi, The product I'm working on needs to be built in such a way that we have a quote engine driven by a pluggable framework. We are currently thinking of using MAF, so we can leverage separation of the host and addin interfaces for versioning. However, I'm concerned that we'd have lots of assemblies, it's likely that we'd have one for each quote engine addin - of which there could be 100 going forward, we also need to support multiple versions, so there could be lots of assemblies in total. The quote engine also uses WF to drive it, which means each AppDomain for each addin will need a workflow runtime associated with it. This seems quite heavyweight, however we can unload unfrequently used addins. Does this seem like a good design? We've also looked at a single AppDomain solution using an IOC container to load addin types, but I'm concerned that we won't be able to unload any of the assemblies, given their quantity.

    Read the article

  • Passing an instantiated class to concrete class derived by Castle Windsor

    - by Tr1stan
    I have a system that I'm using to test some new architecture. I have the following setup (In MVC2 .Net - C Sharp): View < Controller < Service < Repository < DB I'm using Castle Windsor as my DI (IoC) controller, and this is working just fine in both the Service and Repo layers. However, I'm now at a point where I would like to pass an Entity Framework (DatabaseNameEntity) to the constructor to the Service, and then to the Repo, so that I have something similar to a Unit of Work pattern per request (This feels like what I'm trying to achieve anyway) - and I'm having trouble working out how this can be done using Castle Windsor. Am I going off on a silly tangent? Any pointers appreciated.

    Read the article

  • How to override the behavior of Spring @Autowired

    - by Mark
    Hi a little background: I am Using Spring 2.5, and specifically spring IOC and annotations. I am using @Autowired in my code (the Autowiring is done by type) and use @Component for exposing Classes to the Automatic wiring. The situation described bellow arose while i tried to test my code. now to the problem: Note: i use a different Spring Context for the Test environment. I have a class FOO which is @Autowired but in the test context i want to use a different class of the same type MockFoo (extends FOO) The Spring Setup of course fails do so automatically due to multiple options for the Dependency Injection of the FOO class (both FOO and MockFOO comply to the Type check) I am looking for a way to inject the test bean instead of the original bean. I expected Spring to allow using the Context configurion file to override a bean injection or to order Spring not to autowire a specific bean BUT All these option seem to exists only for the beans which were originally defined in the Spring Context Configuration file

    Read the article

  • Passing ASP.NET User by Dependency Injection

    - by UpTheCreek
    In my web application I have various components that need to access the currently authenticated user (HttpContext.User). There are two obvious ways a component can access this: 1) Accessing getting the User from HttpContext.Current 2) Passing the user around in constructors Is not ideal because it makes testing difficult and ties application components to web concerns, when they really shouldn't know about it. Is just messy and complicates everything. So I've been thinking about passing in the current user (or perhaps just the name/id) to any component that needs it using an IoC container (via dependency injection). Is anyone using this technique to supply the current ASP.NET user to parts of the application? Or, Does this sound like a sensible approach? I would like know how this has worked out for people. Thanks

    Read the article

  • Accordion "growing out" from its container - in IE7/8

    - by Richard Knop
    I think this problem is best explained by images. This is how my accordion looks: When you click on the small plus/minus icons the slides under each chapter will expand/collapse. However when the content in the accordion grows too tall, it grows out from its container. So if I click on more plus icons the accordion will look like this (not pretty): As you can see, the container is not growing taller together with the accordion and it does not look good. This problem only occurs in IE7 and IE8. It works in Firefox and Chrome. The HTML looks like this (simplified): <div id="content"> <div class="box2 rounded-corners"> <div class="chapters"> <h3><a href="/clientarea/view/archived-course/teid/133">Obsah</a></h3> <div id="accordion"> <ul> ... // accordion content - too long ... // accordion content - too long </ul> <div class="clear">&nbsp;</div> </div> <div class="clear">&nbsp;</div> </div> <div class="training-body"> ... // content to the right of the accordion </div> </div> </div> The CSS, again siplified: html, body { height: 100%; width: 100%; overflow: auto; } #content { background: white url('/images/background_middle.png') left top repeat-x; padding: 13px; min-height: 40em; height: auto !important; height: 40em; } /* this is the div with rounded corners */ #content .box2 { background: white; padding: 0 15px 15px; border: 1px solid #C5E3F8; position: relative; } /* left sidebar 98 #content div.chapters { float: left; width: 224px; } /* orange heading "OBSAH" */ #content div.chapters h3 { color: #ff6e19; text-transform: uppercase; font-size: .9em; text-align: center; padding-bottom: .5em; margin-top: 1em; margin-bottom: 0; } #content div.chapters h3 a { color: #ff6e19; } /* accordion */ #accordion { width: 226px; border-top: 1px solid #c5e3f8; } #accordion ul { padding-left: 0; margin-top: 0; margin-bottom: 0; margin-left: 0; } /* area to the right of the accordion */ #content div.training-body { float: left; padding-left: 0px; width: 748px; line-height: 1.3em; }

    Read the article

  • StructureMap 'conditional singleton' for Lucene.Net IndexReader

    - by Gareth D
    I have a threadsafe object that is expensive to create and needs to be available through my application (a Lucene.Net IndexReader). The object can become invalid, at which point I need to recreate it (IndexReader.IsCurrent is false, need a new instance using IndexReader.Reopen). I'd like to able to use an IoC container (StructureMap) to manage the creation of the object, but I can't work out if this scenario is possible. It feels like some kind of "conditional singleton" lifecycle. Does StructureMap provide such a feature? Any alternative suggestions?

    Read the article

  • Doesn't Spring really support Interface injection at all?

    - by mrCoder
    Hi I know that Spring doesn't supports Interface injection and I've read that many a times. But today as I came across an article about IOC by Martin Fowler (link), it seems using ApplicationContextAware in Spring is some what similar to the Interface injection. when ever Spring' context reference is required in our Spring bean, we'll implement ApplicationContextAware and will implement the setApplicationContext(ApplicationContext context) method, and we'll include the bean in the config file. Is not this the same as Interface injection, where where telling the Spring to inject (or), say, pass the reference of the context into this bean? Or I m missing something here? Thanks for any information! ManiKanta

    Read the article

  • Injecting all registered instances of a type

    - by James L
    I can successfully perform container.ResolveAll<IMyInterface>(), and I get back an Enumerable containing every registered IMyInterface. However, I can't find a way to have these injected into the constructor of my class. I have tried using ResolvedArrayParameter(), but this gives me an empty enumerator. Am I doing something wrong, or could this be a bug in Unity?

    Read the article

  • Using StructureMap, when a default concrete type is defined in one registry, can it be redefined in

    - by Mark Rogers
    In the project I'm working on I have a StructureMap registry for the main web project and another registry for my integration tests. During some of the tests I wire up the web project's registry, so that I can get objects out of the container for testing. In one case I want to be able to replace a default concrete type from the web registry with one in the test registry. Is this possible? How do you do it?

    Read the article

  • Can 'iterator' type just subclass 'const_iterator'?

    - by doublep
    After another question about iterators I'm having some doubts about custom containers. In my container, iterator is a subclass of const_iterator, so that I get conversion from non-const to const "for free". But is this allowed or are there any drawbacks or non-working scenarios for such a setup?

    Read the article

  • Reinject dependencies of a freshly deserialized object

    - by NathanE
    If a program has literally just deserialized an object (doesn't really matter how, but just say BinaryFormatter was used). What is a good design to use for re-injecting the dependencies of this object? Is there a common pattern for this? I suppose I would need to wrap the Deserialize() method up to act as a factory inside the container. Thanks!

    Read the article

  • Catching TransactionRolledbackLocalException in Java

    - by user271858
    I receive javax.ejb.TransactionRolledbackLocalException in Websphere 7 from the container and I wonder how is it possible to catch this exception? I have a timeout set in Websphere and get this message after this time. I run session beans. I am trying to find what SQl statement was the cause of this exception. Where can i find that?

    Read the article

  • C++ STL list vs set

    - by mokaschitta
    Hi, what of those two is faster for random insertions and deletions? I guess list, having the values as the keys as it is with sets seems to be attractive too though. Is performance similar for iterating over the whole container? Thanks!

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >