Search Results

Search found 234 results on 10 pages for 'allan deamon'.

Page 4/10 | < Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >

  • Usabe of Python 3 super()

    - by deamon
    I wonder when to use what flavour of Python 3 super(). Help on class super in module builtins: class super(object) | super() -> same as super(__class__, <first argument>) | super(type) -> unbound super object | super(type, obj) -> bound super object; requires isinstance(obj, type) | super(type, type2) -> bound super object; requires issubclass(type2, type) Until now I've used super() only without arguments and it worked as expected (by a Java developer). Questions: What does "bound" mean in this context? What is the difference between bound and unbound super object? When to use super(type, obj) and when super(type, type2)? Would it be better to name the super class like in Mother.__init__(...)?

    Read the article

  • Usage of Python 3 super()

    - by deamon
    I wonder when to use what flavour of Python 3 super(). Help on class super in module builtins: class super(object) | super() -> same as super(__class__, <first argument>) | super(type) -> unbound super object | super(type, obj) -> bound super object; requires isinstance(obj, type) | super(type, type2) -> bound super object; requires issubclass(type2, type) Until now I've used super() only without arguments and it worked as expected (by a Java developer). Questions: What does "bound" mean in this context? What is the difference between bound and unbound super object? When to use super(type, obj) and when super(type, type2)? Would it be better to name the super class like in Mother.__init__(...)?

    Read the article

  • Mutable class as a child of an immutable class

    - by deamon
    I want to have immutable Java objects like this (strongly simplyfied): class Immutable { protected String name; public Immutable(String name) { this.name = name; } public String getName() { return name; } } In some cases the object should not only be readable but mutable, so I could add mutability through inheritance: public class Mutable extends Immutable { public Mutable(String name) { super(name); } public void setName(String name) { super.name = name; } } While this is technically fine, I wonder if it conforms with OOP and inheritance that mutable is also of type immutable. I want to avoid the OOP crime to throw UnsupportedOperationException for immutable object, like the Java collections API does. What do you think? Any other ideas?

    Read the article

  • Incremental hot deployment on Tomcat with Maven and NetBeans

    - by deamon
    I'm using NetBeans 6.8, Tomcat 6, and Maven 2.2 and want to see changes in my code immediately in the browser (showing http://localhost:8080) after saving the file. The tomcat-maven-plugin has the following configuration: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> <version>1.0-beta-1</version> </plugin> Following to the output it should perform in-place deployment. What can I do to see changes in my Java code immediately in the browser?

    Read the article

  • How to get roles with JSR 196 authentification in GlassFish?

    - by deamon
    I want to use a custom authentication module conforming to JSR 196 in GlassFish 3. The interface javax.security.auth.message.ServerAuth has the method: AuthStatus validateRequest( MessageInfo messageInfo, javax.security.auth.Subject clientSubject, javax.security.auth.Subject serviceSubject ) AuthStatus can be one of several constants like FAILURE or SUCCESS. The question is: How can I get the roles from a "role datebase" with JSR 196? Example: The server receives a request with a SSO token (CAS token for example), checks whether the token is valid, populates the remote user object with roles fetches from a database via JDBC or from REST service via http. Is the role fetching in the scope of JSR 196? How could that be implemented? Do I have to use JSR 196 together with JSR 115 to use custom authentication and a custom role source?

    Read the article

  • Convert JSON query parameters to objects with JAX-RS

    - by deamon
    I have a JAX-RS resource, which gets its paramaters as a JSON string like this: http://some.test/aresource?query={"paramA":"value1", "paramB":"value2"} The reason to use JSON here, is that the query object can be quite complex in real use cases. I'd like to convert the JSON string to a Java object, dto in the example: @GET @Produces("text/plain") public String getIt(@QueryParam("query") DataTransferObject dto ) { ... } Does JAX-RS support such a conversion from JSON passed as a query param to Java objects?

    Read the article

  • Form input validation with JAX-RS

    - by deamon
    I want to use JAX-RS REST services as a back-end for a web application used directly by humans with browsers. Since humans make mistakes from time to time I want to validate the form input and redisplay the form with validation message, if something wrong was entered. By default JAX-RS sends a 400 or 404 status code if not all or wrong values were send. Say for example the user entered a "xyz" in the form field "count": @POST public void create(@FormParam("count") int count) { ... } JAX-RS could not convert "xyz" to int and returns "400 Bad Request". How can I tell the user that he entered an illegal value into the field "count"? Is there something more convenient than using Strings everywhere and perform conversation by hand?

    Read the article

  • add methods in subclasses within the super class constructor

    - by deamon
    I want to add methods (more specifically: method aliases) automatically to Python subclasses. If the subclass defines a method named 'get' I want to add a method alias 'GET' to the dictionary of the subclass. To not repeat myself I'd like to define this modifation routine in the base class. But if I check in the base class init method, there is no such method, since it is defined in the subclass. It will become more clear with some source code: class Base: def __init__(self): if hasattr(self, "get"): setattr(self, "GET", self.get) class Sub(Base): def get(): pass print(dir(Sub)) Output: ['__doc__', '__init__', '__module__', 'get'] It should also contain 'GET'. Is there a way to do it within the base class?

    Read the article

  • Recycle a project name?

    - by deamon
    I want to start an open source project, but my favourite project name was already used for a framework with the same goal. This project was never popular, had only two active days with commits at Google Code and is dead since four years. In other words: the project is irrelevant but the name is in use at Google Code and ohloh (the same dead project). The .org domain would be available. Would it be ok to reuse this project name?

    Read the article

  • What version numbering scheme to use?

    - by deamon
    I'm looking for a version numbering scheme that expresses the extent of change, especially compatiblity. Apache APR, for example, use the well known version numbering scheme <major>.<minor>.<patch> example: 4.5.11 Maven suggests a similar but more detailed schema: <major>.<minor>.<patch>-<qualifier>-<build number> example: 4.5.11-RC1-3732 Where is the Maven versioning scheme defined? Are there conventions for qualifier and build number? Probably it is a bad idea to use maven but not to follow the Maven version scheme ... What other version numbering schemes do you know? What scheme would you prefer and why?

    Read the article

  • Java EE without Application Server

    - by deamon
    Since EJB 3 we have embeddable EJB containers, JPA implementations can be used without an application server, there is Weld for contexts and dependency injection and so on. Since on many systems is only Tomcat available, I wonder, if Java EE could be used without an application server but with a Servlet container like Tomcat. What would I have to do to set up an Java environment? What drawbacks do you see?

    Read the article

  • How to integrate Guice 2 into Wicket?

    - by deamon
    I want to use Guice 2 with Wicket 1.4. There is a "wicket-guice" package, which uses Guice 1. Can someone give me an example how to configure Wicket to use Guice 2 for injection (with Maven). As you can see blow, I've found a solution, but I wonder, if it would be better to use Guice Servlets and register the whole Wicket Application as a ServletFilter with Guice. But I think this would conflict with wickets object creation strategy.

    Read the article

  • Is JAX-RS suitable as a MVC framework?

    - by deamon
    JAX-RS has some MVC support, but I wonder if JAX-RS is really a good choice to build web application for human use. If a user enters wrong or incomplete information in a form, it should be displayed again like with Grails or Wicket. Is there a comfortable way to do this with JAX-RS? As far as I know the URI mapping doesn't work correctly, if not all required parameters are given or there are type conversion problems (with Date for example). Is that correct? Is there support for internationalized templates?

    Read the article

  • method names with fluent interface

    - by deamon
    I have a Permissions class with methods in fluent style like this: somePermissions.setRead(true).setWrite(false).setExecute(true) The question is, whether I should name these methods set{Property} or only {property}. The latter would look like this: somePermissions.read(true).write(false).execute(true) If I look at these methods separately I would expect that read reads something, but on the other hand it is closer to the intention to have something like named paramaters like in Scala: Permission(read=true, write=false, execute=true)

    Read the article

  • What could be the Java successor Oracle wants to invest in?

    - by deamon
    I've read that Oracle wants to invest into another language than Java: "On the other hand, Oracle has been particularly supportive of alternative JVM languages. Adam Messinger ( http://www.linkedin.com/in/adammessinger ) was pretty blunt at the JVM Languages Summit this year about Java the language reaching it's logical end and how Oracle is looking for a 'higher level' language to 'put significant investment into.'" But what language could be the one Oracle wants to invest in? Is there another candidate than Scala?

    Read the article

  • Recycling a project name?

    - by deamon
    I want to start an open source project, but my favourite project name was already used for a framework with the same goal. This project was never popular, had only two active days with commits at Google Code and is dead since then. With other words: the project is irrelevant but the name is in use at Google Code and ohloh (the same dead project). The .org domain is available. Would it be ok to reuse this project name?

    Read the article

  • Overwrite HTTP method with JAX-RS

    - by deamon
    Today's browsers (or HTML < 5) only support HTTP GET and POST, but to communicate RESTful one need PUT and DELETE too. If the workaround should not be to use Ajax, something like a hidden form field is required to overwrite the actual HTTP method. Rails uses the following trick: <input name="_method" type="hidden" value="put" /> Is there a possibility to do something similar with JAX-RS?

    Read the article

  • Change Projection in OpenLayers Map

    - by deamon
    I want to set "EPSG:4326" as the projection of an OpenLayers map, but when I try it, I always get "EPSG:900913". function init() { var options = { projection: new OpenLayers.Projection("EPSG:4326") // ignored }; map = new OpenLayers.Map('map', options); var layer = new OpenLayers.Layer.OSM.Osmarender("Osmarender"); map.addLayer(layer); ... alert(map.getProjection()); // returns "EPSG:900913" ... } How can I set the Projection to EPSG:4326?

    Read the article

  • Incremental build with NetBeans and Maven for jetty hot deployment

    - by deamon
    After my unsuccessful attempt to run Tomcat with hot deployment from NetBeans with Maven, I've tried jetty. The jetty-maven-plugin doc gave me an important hint: The plugin will automatically ensure the classes are rebuilt and up-to-date before deployment. If you change the source of a class and your IDE automatically compiles it in the background, the plug-in will pick up the changed class. If I look at $myproject/target/classes/... in the projects directory, I can see that NetBeans doesn't compile and refresh the class file on saving. I need to build the project explicitly to update the file and than jetty picks up the change. (The plug-in param "scanIntervalSeconds" is set to 1.) How can I tell NetBeans to compile on save and update the class file so that jetty can pick up the change?

    Read the article

  • Why are action based web frameworks predominant?

    - by deamon
    Most web frameworks are still using the traditional action based MVC model. A controller recieves the request, calls the model and delegates rendering to a template. That is what Rails, Grails, Struts, Spring MVC ... are doing. The other category, the component based frameworks like Wicket, Tapestry, JSF, or ASP.Net Web Forms have become more popular over the last years, but my perception is that the traditional action based approach is far more popular. And even ASP .Net Web Forms has become a sibling name ASP .Net Web MVC. I think the kind of applications built with both types of frameworks is overlapping very much, so the question is: Why are action based frameworks so predominant?

    Read the article

  • Instance variables vs. class variables in Python

    - by deamon
    I have Python classes, of which I need only one instance at runtime, so it would be sufficient to have the attributes only once per class and not per instance. If there would be more than one instance (what won't happen), all instance should have the same configuration. I wonder which of the following options would be better or more "idiomatic" Python. Class variables: MyController(Controller): path = "something/" childs = [AController, BController] def action(request): pass Instance ariables: MyController(Controller): def __init__(self): self.path = "something/" self.childs = [AController, BController] def action(self, request): pass

    Read the article

  • How to setup Eclipselink with JPA?

    - by deamon
    The Eclipselink documentation says that I need the following entries in my pom.xml to get it with Maven: <dependencies> <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>eclipselink</artifactId> <version>2.0.0</version> <scope>compile</scope> ... </dependency> <dependencies> ... <repositories> <repository> <id>EclipseLink Repo</id> <url>http://www.eclipse.org/downloads/download.php?r=1&amp;nf=1&amp;file=/rt/eclipselink/maven.repo</url> </repository> ... </repositories> But when I try to use @Entity annotation NetBeans tells me, that the class cannot be found. And indeed: there is no Entity class in the javax.persistence package from Eclipselink. How do I have to setup Eclipselink with Maven?

    Read the article

  • How to check function parameters in Go

    - by deamon
    Guava Preconditions allows to check method parameters in Java easily. public void doUsefulThings(Something s, int x, int position) { checkNotNull(s); checkArgument(x >= 0, "Argument was %s but expected nonnegative", x); checkElementIndex(position, someList.size()); // ... } These check methods raise exceptions if the conditions are not met. Go has no exceptions but indicates errors with return values. So I wonder how an idiomatic Go version of the above code would look like.

    Read the article

  • Workaround for abstract attributes in Java

    - by deamon
    In Scala I would write an abstract class with an abstract attribute path: abstract class Base { val path: String } class Sub extends Base { override val path = "/demo/" } Java doesn't know abstract attributes and I wonder what would be the best way to work around this limitation. My ideas: a) constructor parameter abstract class Base { protected String path; protected Base(String path) { this.path = path; } } class Sub extends Base { public Sub() { super("/demo/"); } } b) abstract method abstract class Base { // could be an interface too abstract String getPath(); } class Sub extends Base { public String getPath() { return "/demo/"; } } Which one do you like better? Other ideas? I tend to use the constructor since the path value should not be computed at runtime.

    Read the article

  • Maven dependency for Servlet 3.0 API?

    - by deamon
    How can I tell Maven 2 to load the Servlet 3.0 API? I tried: <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>3.0</version> <scope>provided</scope> </dependency> I use http://repository.jboss.com/maven2/ but what repository would be correct? Addendum: It works with a dependency for the entire Java EE 6 API and the following settings: <repository> <id>java.net</id> <url>http://download.java.net/maven/2</url> </repository> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> I'd prefer to only add the Servlet API as dependency, but "Brabster" may be right that separate dependencies have been replaced by Java EE 6 Profiles. Is there a source that confirms this assumption?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >