Search Results

Search found 327 results on 14 pages for 'instantiation'.

Page 6/14 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Using antlr and the DLR together -- AST conversion

    - by RCIX
    I have an AST generated via ANTLR, and I need to convert it to a DLR-compatible one (Expression Trees). However, it would seem that i can't use tree pattern matchers for this as expression trees need their subtrees at instantiation (which i can't get). What solution would be best for me to use?

    Read the article

  • Java Singleton Pattern

    - by Spencer
    I'm used the Singleton Design Pattern public class Singleton { private static final Singleton INSTANCE = new Singleton(); // Private constructor prevents instantiation from other classes private Singleton() {} public static Singleton getInstance() { return INSTANCE; } } My question is how do I create an object of class Singleton in another class? I've tried: Singleton singleton = new Singleton(); // error - constructor is private Singleton singleton = Singleton.getInstance(); // error - non-static method cannot be referenced from a static context What is the correct code? Thanks, Spencer

    Read the article

  • Get the file path of current application's config file

    - by dummy
    The reason I asked this question is that I wanted to create a helper class for Remoting instantiation, and wanted to pass the appropriate app.exe.config (or web.config) file path to the RemotingConfiguration.Configure method, depending on the caller. Is there a way I could get the name of the config file for both Win and Web apps without checking if the application is Web or WinForms?

    Read the article

  • Get the file path of the current app

    - by dummy
    The reason I asked this question is that I wanted to create a helper class for Remoting instantiation, and wanted to pass the appropriate app.exe.config (or web.config) file path to the RemotingConfiguration.Configure method, depending on the caller. Is there a way I could get the name of the config file for both Win and Web apps without checking if the application is Web or WinForms?

    Read the article

  • Is it possible to create static classes in PHP (like in C#)?

    - by aleemb
    I want to create a static class in PHP and have it behave like it does in C#, so Constructor is automatically called on the first call to the class No instantiation required Something of this sort... static class Hello { private static $greeting = 'Hello'; private __construct() { $greeting .= ' There!'; } public static greet(){ echo $greeting; } } Hello::greet(); // Hello There!

    Read the article

  • flex 4 - creationIndex for containers

    - by sami
    In Flex 3, we can set the following properties in a container object for deferred instantiation: creationPolicy = "queued" creationIndex = "1" (or "2" or "3" etc.) In Flex 4, for I can find the creationPolicy property but there is no creationIndex - trying to set the creationIndex throws a "deprecated" warning but there is no hint on what to use otherwise Any ideas? Thanks - Sami

    Read the article

  • Strange error in SpringMVC Application Startup

    - by Euzel Villanueva
    I'm getting a very strange stack trace when trying to load a SpringMVC application and at a lost to why this is occurring. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0': Cannot create inner bean '(inner bean)' of type [org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter] while setting bean property 'messageConverters' with key [4]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#6': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter]: Constructor threw exception; nested exception is java.lang.OutOfMemoryError: Java heap space at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:125) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:153) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127) at javax.servlet.GenericServlet.init(GenericServlet.java:160) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1133) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1087) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:996) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4834) at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5155) at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5150) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#6': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter]: Constructor threw exception; nested exception is java.lang.OutOfMemoryError: Java heap space at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270) ... 31 more Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter]: Constructor threw exception; nested exception is java.lang.OutOfMemoryError: Java heap space at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958) ... 35 more

    Read the article

  • Java ArrayList initialization

    - by Jonathan
    I am aware that you can initialize an array during instantiation as follows: String[] names = new String[] {"Ryan", "Julie", "Bob"}; Is there a way to do the same thing with an ArrayList? Or must I add the contents individually with array.add()? Thanks, Jonathan

    Read the article

  • How do I display a dynamically resized image in Kohana without saving it?

    - by Ygam
    I have an image path string stored in a database It goes like: img/uploads/imagename.jpg I have a controller: $this->image = new Image($wines->image) //this is assuming that I have a wines table with the image property $this->image->resize(60, 250, Image::AUTO) echo $this->image->render(); //the problem is nothing is rendered //Is there a better way of doing this? the image path that I am passing at the Image object //instantiation is the result of a query

    Read the article

  • Ext js - Dynamically changing content of Tab in a TabPanel

    - by 29er
    Hey, I have an (Ext JS) tab panel where the hidden tabs aren't loaded at all upon initial instantiation, (the only thing I set is the title). Upon 'activation' of a tab I want to call a method , which then instanstiates a new FormPanel/GridPanel and put this content into the tab. Can someone point me to a code example or give me tips on how to do this?? Thanks so much!

    Read the article

  • does the object creating a sub appdomain get instantiated in that sub appdomain?

    - by Eric
    does the object creating a sub appdomain get instantiated in that sub appdomain? I have an object that is in the main AppDomain and it is creating another AppDomain and it requires the calling class to be serializable and is creating an instance of the calling class in the new sub AppDomain. I'm wondering if that is how it is, or if there is a way that I can create the sub appDomain but still hold on to the original instantiation of the calling object in the main appDomain

    Read the article

  • jQuery tablesorter - loss of functionality after AJAX call

    - by Nick
    I have recently been experimenting with the tablesorter plugin for jQuery. I have successfully got it up and running in once instance, and am very impressed. However, I have tried to apply the tablesorter to a different table, only to encounter some difficulties... Basically the table causing a problem has a <ul> above it which acts as a set of tabs for the table. so if you click one of these tabs, an AJAX call is made and the table is repopulated with the rows relevant to the specific tab clicked. When the page initially loads (i.e. before a tab has been clicked) the tablesorter functionality works exactly as expected. But when a tab is clicked and the table repopulated, the functionality disappears, rendering it without the sortable feature. Even if you go back to the original tab, after clicking another, the functionality does not return - the only way to do so is a physical refresh of the page in the browser. I have seen a solution which seems similar to my problem on this site, and someone recommends using the jQuery plugin, livequery. I have tried this but to no avail :-( If someone has any suggestions I would be most appreciative. I can post code snippets if it would help (though I know the instantiation code for tablesorter is fine as it works on tables with no tabs - so it's definitely not that!) EDIT: As requested, here are some code snippets: The table being sorted is <table id="#sortableTable#">..</table>, the instantiation code for tablesorter I am using is: $(document).ready(function() { $("#sortableTable").tablesorter( { headers: //disable any headers not worthy of sorting! { 0: { sorter: false }, 5: { sorter: false } }, sortMultiSortKey: 'ctrlKey', debug:true, widgets: ['zebra'] }); }); And I tried to rig up livequery as follows: $("#sortableTable").livequery(function(){ $(this).tablesorter(); }); This has not helped though... I am not sure whether I should use the id of the table with livequery as it is the click on the <ul> I should be responding to, which is of course not part of the table itself. I have tried a number of variations in the hope that one of them will help, but to no avail :-(

    Read the article

  • Grading your programming ability?

    - by Farstucker
    I understand this is a subjective question and very likely could be closed, and although there is no right or wrong answer I do believe its a legitimate question. At what point do you no longer consider someone a beginner (ie knowledge of loops, encapsulation, instantiation), an intermediate (design patterns, reflection, delegates, interfaces) or an expert (architecture, multi-threadding). My rational for asking such a question is two-fold, first, when do I stop labeling my questions as beginner and during a job interview how should I categorize myself?

    Read the article

  • [C++] Multiple inheritance from template class

    - by Tom P.
    Hello, I'm having issues with multiple inheritance from different instantiations of the same template class. Specifically, I'm trying to do this: template <class T> class Base { public: Base() : obj(NULL) { } virtual ~Base() { if( obj != NULL ) delete obj; } template <class T> T* createBase() { obj = new T(); return obj; } protected: T* obj; }; class Something { // ... }; class SomethingElse { // ... }; class Derived : public Base<Something>, public Base<SomethingElse> { }; int main() { Derived* d = new Derived(); Something* smth1 = d->createBase<Something>(); SomethingElse* smth2 = d->createBase<SomethingElse>(); delete d; return 0; } When I try to compile the above code, I get the following errors: 1>[...](41) : error C2440: '=' : cannot convert from 'SomethingElse *' to 'Something *' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1> [...](71) : see reference to function template instantiation 'T *Base<Something>::createBase<SomethingElse>(void)' being compiled 1> with 1> [ 1> T=SomethingElse 1> ] 1>[...](43) : error C2440: 'return' : cannot convert from 'Something *' to 'SomethingElse *' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast The issue seems to be ambiguity due to member obj being inherited from both Base< Something and Base< SomethingElse , and I can work around it by disambiguating my calls to createBase: Something* smth1 = d->Base<Something>::createBase<Something>(); SomethingElse* smth2 = d->Base<SomethingElse>::createBase<SomethingElse>(); However, this solution is dreadfully impractical, syntactically speaking, and I'd prefer something more elegant. Moreover, I'm puzzled by the first error message. It seems to imply that there is an instantiation createBase< SomethingElse in Base< Something , but how is that even possible? Any information or advice regarding this issue would be much appreciated.

    Read the article

  • Efficient way to build a MySQL update query in Python

    - by ensnare
    I have a class variable called attributes which lists the instance variables I want to update in a database: attributes = ['id', 'first_name', 'last_name', 'name', 'name_url', 'email', 'password', 'password_salt', 'picture_id'] Each of the class attributes are updated upon instantiation. I would like to loop through each of the attributes and build a MySQL update query in the form of: UPDATE members SET id = self._id, first_name = self._first name ... Thanks.

    Read the article

  • How do I declare a constructor for an 'object' class type in Scala? I.e., a one time operation for the singleton.

    - by Zack
    I know that objects are treated pretty much like singletons in scala. However, I have been unable to find an elegant way to specify default behavior on initial instantiation. I can accomplish this by just putting code into the body of the object declaration but this seems overly hacky. Using an apply doesn't really work because it can be called multiple times and doesn't really make sense for this use case. Any ideas on how to do this?

    Read the article

  • Templated derived class in CRTP (Curiously Recurring Template Pattern)

    - by Butterwaffle
    Hi, I have a use of the CRTP that doesn't compile with g++ 4.2.1, perhaps because the derived class is itself a template? Does anyone know why this doesn't work or, better yet, how to make it work? Sample code and the compiler error are below. Source: foo.C #include <iostream> using namespace std; template<typename X, typename D> struct foo; template<typename X> struct bar : foo<X,bar<X> > { X evaluate() { return static_cast<X>( 5.3 ); } }; template<typename X> struct baz : foo<X,baz<X> > { X evaluate() { return static_cast<X>( "elk" ); } }; template<typename X, typename D> struct foo : D { X operator() () { return static_cast<D*>(this)->evaluate(); } }; template<typename X, typename D> void print_foo( foo<X,D> xyzzx ) { cout << "Foo is " << xyzzx() << "\n"; } int main() { bar<double> br; baz<const char*> bz; print_foo( br ); print_foo( bz ); return 0; } Compiler errors foo.C: In instantiation of ‘foo<double, bar<double> >’: foo.C:8: instantiated from ‘bar<double>’ foo.C:30: instantiated from here foo.C:18: error: invalid use of incomplete type ‘struct bar<double>’ foo.C:8: error: declaration of ‘struct bar<double>’ foo.C: In instantiation of ‘foo<const char*, baz<const char*> >’: foo.C:13: instantiated from ‘baz<const char*>’ foo.C:31: instantiated from here foo.C:18: error: invalid use of incomplete type ‘struct baz<const char*>’ foo.C:13: error: declaration of ‘struct baz<const char*>’

    Read the article

  • Custom spring bean

    - by Hari
    Hi, I want to convert some of our internal API into a spring bean that we can use in other projects. This API needs some instantiation and other logic which I want to encapsulate in this bean so that we can just put the bean into our app context with necessary propoerties alone. I remember having read an article on this somewhere in the past - but cant find it now. Any pointers to something similar will be helpful

    Read the article

  • purpose of php consutructor

    - by Bharanikumar
    Hi , Am working in the classes and object class structure , but not extream level , Just class and function , then in one place instantiation . that's it , not much big functions like __construct etc , Please tell me very simply , 1.what is th purpose of constructor ad destructor , But i know theoretical explanation school level , But i am expecting something like in real time , which situation we have to use, and is there any example for that please tell me, Regards

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >