Search Results

Search found 1303 results on 53 pages for 'injection'.

Page 40/53 | < Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >

  • ASP.NET MVC ViewModelBuilder Suggestions

    - by Marco
    For anything but trival view models, I use a view model builder that handles the responsibility of generating the view model object. Right now, I use constructor injection of the builders into my controllers but this smells a little since the builder is really dependent upon which action method is being executed. I have two ideas in mind. The first one would involve a custom ActioFilter allowing me to decorate each action method with the appropriate builder to use. The second would be to add an override of the View method that is open to accepting a generic. This is what my code currently looks like. Note, the builder get injected via the ctor. [HttpGet, ImportModelStateFromTempData, Compress] public ActionResult MyAccount() { return View(accountBuilder.Build()); } Here is what option one would look like: [HttpGet, ImportModelStateFromTempData, Compress, ViewModelBuilder(typeof(IMyAccountViewModelBuilder)] public ActionResult MyAccount() { return View(accountBuilder.Build()); } Or option two: [HttpGet, ImportModelStateFromTempData, Compress] public ActionResult MyAccount() { return View<IMyAccountViewModelBuilder>(); } Any thoughts or suggestions would be great!

    Read the article

  • Using ELMAH and URLRewritingNet Together

    - by Chris Laythorpe
    I have ELMAH setup on my production server and it has done a fantastic job of letting me know about any niggles - as well as any creative SQL injection! I've decided to introduce URl Rewriting and went for http://www.urlrewriting.net/ in the end. It was nice and easy to setup and it's doing exactly what I want with the customer-facing site. The problem is ELMAH. Because I've set the urlrewritingnet node in my config like so: <urlrewritingnet rewriteOnlyVirtualUrls="true" contextItemsPrefix="QueryString" defaultPage = "default.aspx" defaultProvider="RegEx" xmlns="http://www.urlrewriting.net/schemas/config/2006/07" > ...ELMAH likes to do this to it's axd links; http://www.mydomain.com/elmah.axd/stylesheet/default.aspx Does anyone have any idea how to either a) stop the re-writer following the .axd; or b) add rules to the re-writer to get ELMAH to work Any ideas? I'm happy to hack about with the httpHandlers...

    Read the article

  • Tools to test softwares against any attacks for programmers ?

    - by berkay
    in these days, i'm interested in software security. As i'm reading papers i see that there are many attacks and researchers are trying to invent new methods for softwares to get more secure systems. this question can be a general including all types of attacks.There are many experienced programmers in SO, i just want to learn what are using to check your code against these attacks ? Is there any tools you use or you don't care ? For example i heard about,static,dynamic code analysis, fuzz testing. SQL injection attacks Cross Site Scripting Bufferoverflow attacks Logic errors Any kind of Malwares Covert Channels ... ... thanks

    Read the article

  • IoC and Design Time

    - by benPearce
    I have a WPF application which I am using to learn MVVM and IoC. The problem is that the Model used by one of the Views expects to pull one of its dependancies in the constructor from an IoC container. When working on this View in the Visual Studio designer it cannot show the design because an exception is being raised in the model. Is there a way around this? Am I pulling my dependancies in the wrong place in code or is there a way I can pass in constructed dependancies, perhaps through Constructor injection. At present the IoC container is setup in code in App.xaml.cs. The IoC container is a roll-your-own taken from this article on MSDN - http://msdn.microsoft.com/en-us/magazine/cc337885.aspx

    Read the article

  • Tomcat6 MySql JDBC Datasource configuration

    - by Bob
    Hi, I've always used Spring's dependency injection to get datasource objects and use them in my DAOs, but now, I have to write an app without that. With Spring I can write something like this: <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://127.0.0.1/app?characterEncoding=UTF-8" /> <property name="username" value="u" /> <property name="password" value="p" /> </bean> But how can I use datasource in my DAOs without Spring or anything? I'm using servlets and JSPs only. Performance is very important factor. Thanks in advance!

    Read the article

  • Ant target for compile-time code instrumentation with Spring aspects

    - by alecswan
    I have developed a web application using Netbeans 6.7 and Ant. The webapp works, but I would like to refactor the code to use @Configurable Spring annotation for cleaner dependency injection. I was able to get load-time weaving (LTW) of Spring aspects to work intermittently (see http://forum.springsource.org/showthread.php?t=86904). At this point I would like to use compile-time weaving with my tool set. Could anybody provide an Ant target that I can use to weave Spring aspects at compile time? An extra credit will be given to anybody who explains how to configure Netbeans to execute the new Ant target right after code compilation. Thanks.

    Read the article

  • How to make a structure map powered viewengine in asp.net mvc

    - by Andrew Bullock
    My views extend a base view class ive made: public class BaseView : ViewPage At the moment im calling ObjectFactory.GetInstance inside this class' constructor to get some interface implementations but id like to use structuremap to inject them as constructor arguments. Im using a structuremapcontrollerfactory to create my controllers, but how can i do the same for views? I know i can implement a custom ViewEngine, but using reflector to look at the mvc default viewengine and its dependencies, it seems to go on and on and i'd rather not have to re-implement stuff thats already there. Has anyone got a cunning idea how to solve this? I know i could make things easier with setter instead of constructor injection but id rather avoid that if possible.

    Read the article

  • How do you unit test web page authorization using ASP.NET MVC?

    - by Kevin Pang
    Let's say you have a profile page that can only be accessed by the owner of that profile. This profile page is located at: User/Profile/{userID} Now, I imagine in order to prevent access to this page by other users, you could structure your UserController class's Profile function to check the current session's identity: HttpContext.Current.User.Identity.Name If the id matches the one in the url, then you proceed. Otherwise you redirect to some sort of error page. My question is how do you unit test something like this? I'm guessing that you need to use some sort of dependency injection instead of the HttpContext in the controller to do the check on, but I am unclear what the best way to do that is. Any advice would be helpful.

    Read the article

  • How to get hold of the current NHibernate.Cfg.Configuration instance.

    - by Sandor Drieënhuizen
    My C# project has repositories that are instantiated using dependency injection. One of the repository methods needs access to the NHibernate.Cfg.Configuration instance (to generate the database schema) that was returned when initializing NHibernate. I cannot pass the configuration to the repository however, because that would break the persistence ignorance principle -- I really don't want to expose any implementation details through the repository interface. So what I'm looking for is a way of getting hold of the current NHibernate.Cfg.Configuration instance from within my repository. I have no trouble getting hold of the current session, it's just the configuration that I cannot get hold of.

    Read the article

  • can I override/redefine "global" Javascript functions, like confirm() and alert()?

    - by EndangeringSpecies
    I want to do some browser automation, and those pesky confirm/alert boxes are a real pain. Disabling javascript completely in this case is not an option, unfortunately. Well, so I was wondering, can I just change the definition of those methods as seen by my browser's javascript interpreter to basically do nothing and return true? Note that I do know about redefining them in the Javascript code directly, e.g. putting in function alert(message) { return true; } but AFAIK this is not a viable approach for this situation because when doing browser automation I have to work with other people's Javascript. Moreover, my program actually begins manipulating these websites already after the page has fully loaded into the browser, so I cannot just first automatically rewrite the javascript and then load the page. Well, so I was wondering if I could instead just "permanently" modify the way alert/confirm are implemented and executed in my browser. Sort of like the equivalent of dll injection and so forth in the realm of windows apps.

    Read the article

  • Useful Eclipse Java Code Templates

    - by Jon
    You can create various Java code templates in Eclipse via the Window->Preferences->Java -> Editor -> Templates e.g. sysout is expanded to: System.out.println(${word_selection}${});${cursor} You can activate this by typing sysout followed by CTRL+SPACE What useful Java code templates do you currently use? Include the name and description of it and why it's awesome. There's an open bounty on this for an original/novel use of a template rather than a built-in existing feature. Create Log4J logger Get swt color from display Syncexec - Eclipse Framework Singleton Pattern/Enum Singleton Generation Readfile Const Traceout Format String Comment Code Review String format Try Finally Lock Message Format i18n and log Equalsbuilder Hashcodebuilder Spring Object Injection Create FileOutputStream

    Read the article

  • ASP.NET MVC 3 - What features do you want to see?

    - by user299592
    I know a bunch of people that are really enjoying the improvements that ASP.NET MVC 2 made over the first release. I have just started to migrate our MVC 1 project over and so far areas has totally cleaned up the subfolder mess we had in our large scale application. As I dive deeper into all the improvements and changes that were made I still keep thinking to myself man it would be nice if they had x in this release. For isntance, I would love it if they had some sort of dependency injection built in instead of having to use third party solutions. My real question is now that ASP.NET MVC 2 is out in the wild, what features do want/wish the team had implemented and hope they will implement for ASP.NET MVC 3?

    Read the article

  • conversion of a varchar to a smalldatetime results in an out-of-range value

    - by michael
    The code: strSql = "insert into table2 (transactiondate) values ('" & transactiondate & "')" seems to be giving me the runtime error: The conversion of a varchar data type to a smalldatetime data type resulted in an out-of-range value In the code, strSql is a String object and transactiondate is a Date object. In the SQL database however, transactiondate is a smalldatetime object. I've tried changing the smalldatetime to a datetime (in the database) and I've tried transactiondate.toString() but with no success. How can this be fixed? Note: I know about the dangers of inline SQL. I am looking for a quick fix solution here and not a discussion about SQL injection.

    Read the article

  • Chrome plugin removal

    - by kambamsu
    Hi, I'm writing an NPAPI plugin. In every webpage that the browser goes to, I inject my plugin with an object tag. Something like: <object id="myplugin" type="plugin-mime-type" > In some pages where i dont want it, after injection i remove it by finding the element using the id and doing a document.removeChild. From my logging i found that in firefox and opera, doing this automatically calls the plugin destroy method NPP_Destroy (NPAPI). But in chrome, it doesnt seem to call it. Is there any special way that i should remove a plugin in chrome that i am missing?? Any help would be appreciated. Thanks

    Read the article

  • JBoss Seam: components injected into POJOs, but not Session Beans

    - by purecharger
    I have a Seam component that handles login, with the name "authenticator": @Name("authenticator") public class AuthenticatorAction implements Authenticator { @PersistenceContext private EntityManager em; @In(required=false) @Out(required=false, scope = SESSION) private User user; public boolean authenticate(){ ... } } This works just fine, Seam injects the EntityManager instance. However, as soon as I add the @Stateless annotation, none of the injection happens! In this case, the EntityManager instance is null upon entry to the authenticate() method. Another interesting note is that with a separate stateful session bean I have, the Logger instance in that class is only injected if I make it static. If i have it non-static, it is not injected. Thats fine for the logger, but for stateless session beans like that, I obviously can't have static member variables for these components. I'm confused because this authenticator is exactly how it is in the Seam booking example: a stateless session bean with a private member variable being injected. Any ideas?

    Read the article

  • Getting started with modern software architecture and design using a book

    - by bitbonk
    I am a rather oldschool developer with some basic knowledge of software design principles and a good background on classic (gof) design patterns. While I continue my life as such I see lots of strange buzzwords emerge: Aspectoriented Design, Componentoriented Design, Domain Driven Design, Domain Specific Languages, Serviceoriented (SOA) Design, Test Driven Design, Extreme Programming, Agile Development, Continuous Integration, Dependency Injection, Software Factories ... Is there good book around that I can take with me on a roadtrip while it is taking me on a trip through all (most) of the above, delivering an 10,000 foot view on modern software archiceture and desing principles and approaches.

    Read the article

  • How to make Spring accept fluent (non-void) setters?

    - by Chris
    Hi, I have an API which I am turning into an internal DSL. As such, most methods in my PoJos return a reference to this so that I can chain methods together declaratively as such (syntactic sugar). myComponent .setID("MyId") .setProperty("One") .setProperty2("Two") .setAssociation(anotherComponent) .execute(); My API does not depend on Spring but I wish to make it 'Spring-Friendly' by being PoJo friendly with zero argument constructors, getters and setters. The problem is that Spring seems to not detect my setter methods when I have a non-void return type. The return type of this is very convenient when chaining together my commands so I don't want to destroy my programmatic API just be to compatible with Spring injection. Is there a setting in Spring to allow me to use non-void setters? Chris

    Read the article

  • PHP: PDOStatement simple MySQL Select doesn't work.

    - by Alan
    Hi I have the following PHP code doing a very simple select into a table. $statement = $db->prepare("SELECT * FROM account WHERE fbid = :fbid"); $statement->bindParam(":fbid",$uid, PDO::PARAM_STR,45); $out = $statement->execute(); $row = $statement->fetch(); $out is true (success) yet $row is null. If I modify the code as follows: $statement = $db->prepare("SELECT * FROM account WHERE fbid = $uid"); $out = $statement->execute(); $row = $statement->fetch(); $row contains the record I'm expecting. I'm at a loss. I'm using the PDO::prepare(), bindParams() etc to protect against SQL Injection (maybe I'm mistaken on that). Please halp.

    Read the article

  • Classloader problems Tomcat 6 javagent

    - by alecswan
    I am using Salve Dependency Injection library that instruments the byte code of the web application. I specified -javaagent in Tomcat VM options and pointed it to the Salve agent jar. The agent jar gets loaded, but then it throws a java.lang.NoClassDefFoundError unable to find classes that are in other Salve jars which are located in WEB-INF/lib folder of my web app. I can solve this problem by putting those JARs in Tomcat/endorsed folder. However, some of those jars depend on third-party libraries, such as Spring and servlet-api.jar. Therefore, I am forced to put all these dependencies in Tomcat/endorsed as well. Could anybody suggest a better way for handling dependencies of a Tomcat javaagent? Thanks.

    Read the article

  • How to make Spring accept non-void setters?

    - by Chris
    Hi, I have an API which I am turning into an internal DSL. As such, most methods in my PoJos return a reference to this so that I can chain methods together declaratively as such (syntactic sugar). myComponent .setID("MyId") .setProperty("One","1") .setProperty("Two","2") .setAssociation(anotherComponent) .execute(); My API does not depend on Spring but I wish to make it 'Spring-Friendly' by being PoJo friendly with zero argument constructors, getters and setters. The problem is that Spring seems to not detect my setter methods when I have a non-void return type. The return type of this is very convenient when chaining together my commands so I don't want to destroy my programmatic API just be to compatible with Spring injection. Is there a setting in Spring to allow me to use non-void setters? Chris

    Read the article

  • How Can I Learn about Interfaces

    - by BDotA
    I am using C# and I know what are the interfaces and how syntatically use them,etc. but what I have not learned yet is that when I am tasked to write a project, create a component,... How should I learn better about interfaces so when I want to do something I be able to Think about using them in my design...or for example I want to learn about dependency injection or even using mocking objects for testing, these are all related to good understanding of interfaces and know when and how to use them ... Can you plase provide me some good advice, reading,... then can help me with that?

    Read the article

  • Best way to encrypt certain fiels in SQL Server 2008?

    - by Josh
    I'm writing a .net web app that will read and write information to a SQL 2008 backend database. Some of this information will be highly confidential in nature so I want to encrypt certain data elements. I dont want to use TDE or any full-database encryption for performance reasons. My main concern is protecting this sensitive data as a last resort against a SQL injection or even a database server compromise. My question is what is the best way to do this to preserve performance? Is it faster to use the SQL2008 encryption functions such as EncryptByKey, or would it be faster to encrypt and decrypt the data in the .NET web app itself using a symmetric key stored in the secure web.config and store the encrypted values in the DB?

    Read the article

  • Is there a production ready web application framework in Python?

    - by peperg
    I heard lots of good opinions about Python language. They say it's mature, expressive etc... Are there any production-ready web application frameworks in Python. By "production ready" I mean : supports objective-relational mapping with caching and declarative desciption (like JPA, Hibernate etc..) controls oriented user interface support - no HTML templates but something like JSF (RichFaces, Icefaces) or GWT, Vaadin, ZK component decomposition and dependency injection (like EJB or Spring) unit and integration testing good IDE support clustering, modularity etc (like Terracota, OSGi etc..) there are successful applications written in it by companies like IBM, Oracle etc (I mean real business applications not Twitter) could have commercial support Is it possible at all in Python world ? Or only choices are : use Python and write everything from the bottom (too expensice) stick to JEE buy .NET stack

    Read the article

  • Using Session Bean provided data on JSF welcome page

    - by takachgeza
    I use JSF managed beans calling EJB methods that are provide data from database. I want to use some data already on the welcome page of the application. What is the best solution for it? EJBs are injected into JSF managed beans and it looks like the injection is done after executing the constructor. So I am not able to call EJB methods in the constructor. The normal place for EJB call is in the JSF action methods but how to call such a method prior to loding the first page of the application? A possible solution would be to call the EJB method conditionally in a getter that is used on the welcome page, for example: public List getProductList(){ if (this.productList == null) this.productList = myEJB.getProductList(); return this.productList; } Is there any better solution? For example, in some config file?

    Read the article

  • piece of php code for prevent hacking.

    - by artmania
    Hi friends, I have a php file at my site, and I connect to db, get some records and list them in same file. mysql_connect("localhost", "blabla", "blabla") or die(mysql_error()); mysql_select_db("blabla") or die(mysql_error()); $blabla1 = mysql_query("SELECT * FROM gallery WHERE id_cat=1"); $blabla2 = mysql_query("SELECT * FROM gallery WHERE id_cat=2"); $blabla3 = mysql_query("SELECT * FROM gallery WHERE id_cat=3"); So, is there anything I need to do for security? :/ like sql-injection or anything else. there is nothing going to url. it is just www.blabla.com/gallery.php appreciate advises!!! thanks a lot!

    Read the article

< Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >