descriptor

web.xml and relative paths

in web.xml i set my welcome file to a jsp within web.xml <welcome-file>WEB-INF/index.jsp</welcome-file> inside index.jsp i then forward on to a servlet <% response.sendRedirect(response.encodeRedirectURL("myServlet/")); %> however the application tries to find the servlet at the following path applicationName/WEB-INF/myServlet ...

Why do managed attributes just work for class attributes and not for instance attributes in python?

To illustrate the question check the following code: class MyDescriptor(object): def __get__(self, obj, type=None): print "get", self, obj, type return self._v def __set__(self, obj, value): self._v = value print "set", self, obj, value return None class SomeClass1(object): m = MyDescriptor() class SomeClass2...

Portable way to pass file descriptor between different processes

On most UNIX systems passing an open file between processes can be easily done for child/parent processes by fork(); however I need to share a fd "after" the child was already forked. I've found some webpages telling me that sendmsg() may work for arbitary processes; but that seems very OS dependent and complex. The portlisten seems lik...

Simulating file descriptor in user space

I would like to implement a socket-like object in user space. There's an important requirement that it should be pollable (i.e. it's state should be queryable via select or poll call). Is there a platform neutral way of implementing such an object? I'm aware that on Linux there's eventfd which kind of suits the needs except that there'...

Netbeans problem: Can't add application descriptor, getting null pointer exceptions

When I try to add to the application descriptor in a Netbeans mobile project by clicking on 'Add' in the 'Application Descriptor' panel in the projecct config window nothing happens, netbeans gives a red button on the bottom right indicating an error, clicking on that reveals this: java.lang.NullPointerException at org.netbeans.modu...

Why does declaring a descriptor class in the __init__ function break the descriptor functionality?

In class B below I wanted the __set__ function in class A to be called whenever you assign a value to B().a . Instead, setting a value to B().a overwrites B().a with the value. Class C assigning to C().a works correctly, but I wanted to have a separate instance of A for each user class, i.e. I don't want changing 'a' in one instance of C...

Difference between using __init__ and setting a class variable

I'm trying to learn descriptors, and I'm confused by objects behaviour - in the two examples below, as I understood __init__ they should work the same. Can someone unconfuse me, or point me to a resource that explains this? import math class poweroftwo(object): """any time this is set with an int, turns it's value to a tuple of the ...

python attribute lookup without any descriptor magic?

I've started to use the python descriptor protocol more extensively in the code I've been writing. Typically, the default python lookup magic is what I want to happen, but sometimes I'm finding I want to get the descriptor object itself instead the results of its __get__ method. Wanting to know the type of the descriptor, or access stat...

question on changing file descriptor number in c...

Hi all...my question is how would I change the program below so that it takes a file descriptor number on the command line rather than a file name? Any help would be greatly appreciated. Thank You. include "csapp.h" int main (int argc, char **argv) { struct stat stat; char *type, *readok; /* $end statcheck */ if (a...

Use a Descriptor (EDIT: Not a single decorator) for multiple attributes?

Hi, Python 2.5.4. Fairly new to Python, brand new to decorators as of last night. If I have a class with multiple boolean attributes: class Foo(object): _bool1 = True _bool2 = True _bool3 = True #et cetera def __init__(): self._bool1 = True self._bool2 = False self._bool3 = True #et ...

Maven assembly plugin: run only one descriptor

I have a project which has several custom descriptors written for the assembly plugin. Is there a way to run only one of those descriptors at a time instead of the whole bunch? I tried using the descriptors switch as documented here, passing in the full path to the one descriptor that I wanted to run, but instead it's running all of the ...

Blank installNotifyURI in OMA Download Descriptors

People can download content (music, images) for their mobile from my server. Im trying to use the installNotifyURI-tag of the download descriptors specified by OMA, to be able to find out if the download has been successful. When the user has downloaded the item I do get a POST to the url I specified in the installNotifyURI-tag. <i...

Extending appengine's db.Property with caching

I'm looking to implement a property class for appengine, very similar to the existing db.ReferenceProperty. I am implementing my own version because I want some other default return values. My question is, how do I make the property remember its returned value, so that the datastore query is only performed the first time the property is ...

Maven assembly - Error reading assemblies

I have defined a personalized jar-with-dependencies assembly descriptor. However, when I execute it with mvn assembly:assembly, I get : ... [INFO] META-INF/ already added, skipping [INFO] META-INF/MANIFEST.MF already added, skipping [INFO] javax/ already added, skipping [INFO] META-INF/ already added, skipping [INFO] META-INF/MANIFEST.M...

add a decorate function to a class

I have a decorated function (simplified version): class Memoize: def __init__(self, function): self.function = function self.memoized = {} def __call__(self, *args, **kwds): hash = args try: return self.memoized[hash] except KeyError: self.memoized[hash] = self.func...

How to create decorator for lazy initialization of a property

I want to create a decorator that works like a property, only it calls the decorated function only once, and on subsequent calls always return the result of the first call. An example: def SomeClass(object): @LazilyInitializedProperty def foo(self): print "Now initializing" return 5 >>> x = SomeClass() >>> x.foo...

Is there a need for file descriptor control program/syscall ?

I am currently thinking of implementing a syscall in some BSD flavours in order to close a given file descriptor. The file descriptor would be defined as a pair of PID and file descriptor number. It will be useful in order to test/debug a program or others strange purposes. I think that I will do it anyway, you know, for learning purpo...

State of preexisting connections when using file descriptor passing?

I'm playing around with a webserver, using a unix socket and sendmsg / recvmsg to pass the socket file descriptor to a new server process without losing any requests. While testing it with ab I found that client connections would linger, and apachebench (ab) would show the error: "apr_poll: The timeout specified has expired (70007)". I ...

how to generate deployment descriptor using ejbGen for weblogic?

Hello there, I was reading the tutorial on this page: http://edocs.bea.com/docs/cd/E13222_01/wls/docs81/medrec_tutorials/ejbgen.html#858279 And I have the following file BankAccountEJB.java import javax.ejb.CreateException; import javax.ejb.EntityBean; import javax.ejb.EntityContext; public abstract class BankAccountEJB implements En...

file descriptor leak in java program : too many open files

Hi, I have a program which suffer from file descriptor increasing. I see when I execute the command ls -l /proc/5969/fd where 5969 is the pid of the java program the number of file descriptor continuously increasing. but I am unable to open one of those files decriptors to see what file remains open : here is an example of the listing :...