Search Results

Search found 8200 results on 328 pages for 'context'.

Page 22/328 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • Why does XPath.selectNodes(context) always use the whole document in JDOM

    - by Simeon
    Hi, I'm trying to run the same query on several different contexts, but I always get the same result. This is an example xml: <root> <p> <r> <t>text</t> </r> </p> <t>text2</t> </root> So this is what I'm doing: final XPath xpath = XPath.newInstance("//t"); List<Element> result = xpath.selectNodes(thisIsThePelement); // and I've debuged it, it really is the <p> element And I always get both <t> elements in the result list. I need just the <t> inside the <p> I'm passing to the XPath object. Any ideas would be of great help, thanks.

    Read the article

  • PHP: prevent invocation of method X from from context != Y

    - by sunwukung
    This is a tricky one. I am "emulating" ZF Bootstrapping (surface appearance). Don't ask me why, call it academic interest. So I have a Bootstrap Abstract with a method "run" that iterates over itself to locate any methods prefixed with "init". The application looks for a user defined class which extends this class, in which the user can define any number of methods in this way. However, I want to prevent the user from being able to execute the "run" command of it's parent class, while still exposing the same command for the client code. Anyone got any thoughts/advice/guidance? regards SWK

    Read the article

  • Getting the name of a child class in the parent class (static context)

    - by Benoit Myard
    Hi everybody, I'm building an ORM library with reuse and simplicity in mind; everything goes fine except that I got stuck by a stupid inheritance limitation. Please consider the code below: class BaseModel { /* * Return an instance of a Model from the database. */ static public function get (/* varargs */) { // 1. Notice we want an instance of User $class = get_class(parent); // value: bool(false) $class = get_class(self); // value: bool(false) $class = get_class(); // value: string(9) "BaseModel" $class = __CLASS__; // value: string(9) "BaseModel" // 2. Query the database with id $row = get_row_from_db_as_array(func_get_args()); // 3. Return the filled instance $obj = new $class(); $obj->data = $row; return $obj; } } class User extends BaseModel { protected $table = 'users'; protected $fields = array('id', 'name'); protected $primary_keys = array('id'); } class Section extends BaseModel { // [...] } $my_user = User::get(3); $my_user->name = 'Jean'; $other_user = User::get(24); $other_user->name = 'Paul'; $my_user->save(); $other_user->save(); $my_section = Section::get('apropos'); $my_section->delete(); Obviously, this is not the behavior I was expecting (although the actual behavior also makes sense).. So my question is if you guys know of a mean to get, in the parent class, the name of child class.

    Read the article

  • LINQ Data Context Not Showing Methods

    - by CccTrash
    For some reason my DataContext is not showing all the normal methods like SubmitChanges() etc in the intellisense. It also won't compile if I type in db.SubmitChanges(); Any idea what I'm doing wrong? Normally I don't have this issue, I have several other projects that work fine... Image of what I'm talking about:

    Read the article

  • Stateful beans and Stateless beans in Spring context

    - by umesh awasthi
    Hi All, i am reading spring through its official documentation and at one place i came to a line that use prototype scope for for all statefull beans while singleton for stateless beans. i know there is something as statefull as well stateless beans in EJB but this is not what they have mentioned in the documents. Can any one explain me what exact this means of statefull as well stateless beans in Spring Thanks in advance

    Read the article

  • Getting Path (context root) to the Application in Restlet

    - by Chad Gorshing
    I am needing to get the application root within a Restlet resource class (it extends ServerResource). My end goal is trying to return a full explicit path to another Resource. I am currently using getRequest().getResourceRef().getPath() and this almost gets me what I need. This does not return the full URL (like http://example.com/app), it returns to me /resourceName. So two problems I'm having with that, one is it is missing the schema (the http or https part) and server name, the other is it does not return where the application has been mounted to. So given a person resource at 'http://dev.example.com/app_name/person', I would like to find a way to get back 'http://dev.example.com/app_name'. I am using Restlet 2.0 RC3 and deploying it to GAE.

    Read the article

  • Dynamic context menu items

    - by Willem
    I am using Eclipse RCP to build desktop app. When the user invokes a popup menu I'd like to add some items to the menu. Something like a list of "suggested actions" to take for a problem. The pop-up is is on a table and it already has commands on it. What is the right way to implement this?

    Read the article

  • Restricting Directory access from web application context

    - by Yogi
    i have a web application which stores users file in directory which is under webroot directory.. Suppose web application is under 'fileupload' and all files are getting stored in 'xyz' folder under 'fileupload' so now if user points to url say like www.xyzpqr.com/fileupload/xyz/abc.doc, he gets that file. How do i restirct this from happening.. i have thought of putting xyz folder in WeB-inf folder but as my application is very big i have to made changes at too many places.. so is there any way so that without moving the folder to web-inf (restricted folders) i can achieve wat i want..

    Read the article

  • Object equality in context of hibernate / webapp

    - by bert
    How do you handle object equality for java objects managed by hibernate? In the 'hibernate in action' book they say that one should favor business keys over surrogate keys. Most of the time, i do not have a business key. Think of addresses mapped to a person. The addresses are keeped in a Set and displayed in a Wicket RefreshingView (with a ReuseIfEquals strategy). I could either use the surrogate id or use all fields in the equals() and hashCode() functions. The problem is that those fields change during the lifetime ob the object. Either because the user entered some data or the id changes due to JPA merge() being called inside the OSIV (Open Session in View) filter. My understanding of the equals() and hashCode() contract is that those should not change during the lifetime of an object. What i have tried so far: equals() based on hashCode() which uses the database id (or super.hashCode() if id is null). Problem: new addresses start with an null id but get an id when attached to a person and this person gets merged() (re-attached) in the osiv-filter. lazy compute the hashcode when hashCode() is first called and make that hashcode @Transitional. Does not work, as merge() returns a new object and the hashcode does not get copied over. What i would need is an ID that gets assigned during object creation I think. What would be my options here? I don't want to introduce some additional persistent property. Is there a way to explicitly tell JPA to assign an ID to an object? Regards

    Read the article

  • ...may not be used in this context...while serialization

    - by phenevo
    Hi, I've webservice and WebMethod [webMethod] public object GetObjects(Cars[] cars) { return Translator.ToObjects(Facade.GetObjects(cars); } public static object GetObjects(Cars cars) { List<Car> cars =new List<Country(...fillingcollection) return cars.ToArray(), } public static object ToObjects(object collection) { if(collection is Car[]) { return ConvertModelCarsToContractCars(collection), } public ModelCar[] ConvertModelCarsToContractCars(Cars[] collection) { ...there is rewriting pool... } And I get exception at side of client: There was an error generating the XML document. I'm using this function to check collection which I would send to the client and it works, doesn't return exceptions: public static void SerializeContainer(object obj) { try { // Make sure even the construsctor runs inside a // try-catch block XmlSerializer ser = new XmlSerializer(typeof(object)); TextWriter w = new StreamWriter(@"c:\list.xml"); ser.Serialize(w, obj); w.Close(); } catch (Exception ex) { DumpException(ex); } } Interesting is when collection has only One element [webmethod] works fine, but when is more it brokes

    Read the article

  • context.Scale() with non-aspect ratio preserving parameters screws effective lineWith

    - by rrenaud
    I am trying to apply some natural transformations whereby the x axis is remapped to some very small domain, like from 0 to 1, whereas y is remapped to some small, but substantially larger domain, like 0 to 30. This way, drawing code can be nice and clean and only care about the model space. However, if I apply a scale, then lines are also scaled, which means that horizontal lines become extremely fat relative to vertical ones. Here is some sample code. When natural_height is much less than natural_height, the picture doesn't look as intended. I want the picture to look like this, which is what happens with a scale that preserves aspect ratio. rftgstats.c om/canvas_good.png However, with a non-aspect ratio preserving scale, the results look like this. rftgstats.c om/canvas_bad.png <html><head><title>Busted example</title></head> <body> <canvas id=example height=300 width=300> <script> var canvas = document.getElementById('example'); var ctx = canvas.getContext('2d'); var natural_width = 10; var natural_height = 50; ctx.scale(canvas.width / natural_width, canvas.height / natural_height); var numLines = 20; ctx.beginPath(); for (var i = 0; i < numLines; ++i) { ctx.moveTo(natural_width / 2, natural_height / 2); var angle = 2 * Math.PI * i / numLines; // yay for screen size independent draw calls. ctx.lineTo(natural_width / 2 + natural_width * Math.cos(angle), natural_height / 2 + natural_height * Math.sin(angle)); } ctx.stroke(); ctx.closePath(); </script> </body> </html>

    Read the article

  • Change right-click context menu options in VS2008

    - by Mark Ursino
    When I right-click in my class library, I get some quick options to create things, like an Item from the popup list (New Item...), a User Control, etc. E.g. Now in my web app project, I'd like to be able to get the User Control listed in the right-click menu just like Component and Class, so I don't have to click New Item... then choose it from there. Is there a way to do this in the configuration? I can't seem to figure it out in VS.

    Read the article

  • Losing context from JQuery post with ASP.Net MVC

    - by Dan
    I have a JQuery dialog box on a page that calls something like this: $.post("/MyController/MyAction", { myKey: key} //... And this successfully gets here: [HttpPost] public ActionResult MyAction(int myKey) { //do some stuff return RedirectToAction("AnotherAction"); } The problem is that the RedirectToAction has no effect on the webbrowser. I am guessing this is because the JQuery post is kinda on a different 'tread' so it doesn't know where to send the response? How do I get the browser to load the new response?

    Read the article

  • .NET - Retrieve attribute from controller context?

    - by ropstah
    I have a controller insert action: <AcceptVerbs(HttpVerbs.Post)> _ Function InsertObject(<Bind(Exclude:="Id")> <ModelBinder(GetType(CustomModelBinder))> ByVal object As SomeObject) As ActionResult End Function And i have a CustomModelBinder class with a BindModel implementation: Public Function BindModel( _ ByVal controllerContext As System.Web.Mvc.ControllerContext, _ ByVal bindingContext As System.Web.Mvc.ModelBindingContext) As Object Implements System.Web.Mvc.IModelBinder.BindModel For Each s In HttpContext.Current.Request.Form.Keys HttpContext.Current.Response.Write(s & ": " & HttpContext.Current.Request.Form(s) & "<br />") Next HttpContext.Current.Response.End() End Function As you can see I have a controllerContext and a ModelBindingContext available. How do I get the: <Bind(Exclude:="Id")> part inside the BindModel implementation?

    Read the article

  • What are the tradeoffs involved in referencing Context in a library?

    - by C. Ross
    Context is one of the core classes of Android, and many functions it contains are useful in Android library projects, particularly accessing configuration. What are the trade offs involved in accessing the Context in a library, either by injection or by subclassing Application in the library, and subclassing that in the application. Does this make the application brittle or introduce inappropriate coupling?

    Read the article

  • Access VBA question: Change the query being referenced by a function, depending on context

    - by Tara Amatista
    I have a custom function in Access2007 that hinges on grabbing data out of a specific query. It opens Outlook, creates a new email and populates the fields with specific addresses and data taken from the query ("DecisionEmail"). Now I want to make a different query ("RequestEmail") and have it populate the email with that data. So all I have to do is change this line: Set MailList = db.OpenRecordset("DecisionEmail") and that's where I get stumped. This is my desired result: If the user is on Form_Decision and clicks the button "Send email", "DecisionEmail" will get plugged into the function and that data will appear in the email. If the user on Form_SendRequest and clicks the button "Send email", "RequestEmail" will instead get plugged in. The reason that these are different queries is because they contain very different information that is smudged about in different ways. However, since it's just one little thing that needs to change in the function code, I don't think a brand new function is a good idea. My last resort would be to make a brand new function and use the Conditions field in the Macro interface to choose between them, but I have a feeling there's a more elegant solution possible. I have a vague notion of setting the query names as variables and using an If statement but I just don't have the mental vocabulary for thinking through this.

    Read the article

  • Minimizing Java Thread Context Switching Overhead

    - by binil
    I have a Java application running on Sun 1.6 32-bit VM/Solaris 10 (x86)/Nahelem 8-core(2 threads per core). A specific usecase in the application is to respond to some external message. In my performance test environment, when I prepare and send the response in the same thread that receives the external input, I get about 50 us advantage than when I hand off the message to a separate thread to send the response. I use a ThreadPoolExecutor with a SynchronousQueue to do the handoff. In your experience what is the acceptable delay between scheduling a task to a thread pool and it getting picked up for execution? What ideas had worked for you in the past to try improve this?

    Read the article

  • [Using $this when not in object context in] php error

    - by JasonS
    I have solved this problem, I just need to know what to do. I get the above error because I just realised that the class is being run as class::function($values) instead of class-function($values). Does anyone know how to convert this function to instantiate the class then run the function with values? private function _load($values=null) { define('LOADED_CONTROLLER', $this->controller); define('LOADED_FUNCTION', $this->function); $function = $this->function; $controller = new $this->controller; ($values == null) ? $controller->$function() : call_user_func_array(array($this->controller, $function), $values); }

    Read the article

  • Merge XML files with configurable rules (context: Maven POMs, Java)

    - by Patrick Bergner
    Hi, I'm currently writing some kind of a Maven POM preprocessor that assembles a POM for a project from multiple input files (basically a template and a module specific file). The files are hierarchically ordered (template = most general, module specific = least general). The problem is now to merge these files into a single POM file. Long story short or if you're not familiar with Maven: a POM looks like this (shortened): <project> <modelVersion>4.0.0</modelVersion> <dependencies> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-core</artifactId> </dependency> </dependencies> </project> Basically the merger shall replace all values of the more general file with the values of the more specific file (i.e. singletons, e.g. the <modelVersion> above) but there are certain elements where the merger shall add the more certain element to a parent (i.e. collections, e.g. <dependency> elements shall always be added to the <dependencies> element and no <dependency> element shall be replaced by another). A more detailed example with definition of desired output: File A: <project> <modelVersion>A</modelVersion> <dependencies> <dependency> <groupId>groupIdA</groupId> <artifactId>artifactIdA</artifactId> </dependency> </dependencies> </project> File B: <project> <modelVersion>B</modelVersion> <dependencies> <dependency> <groupId>groupIdB</groupId> <artifactId>artifactIdB</artifactId> </dependency> </dependencies> </project> Desired output: <project> <modelVersion>B</modelVersion> <dependencies> <dependency> <groupId>groupIdA</groupId> <artifactId>artifactIdA</artifactId> </dependency> <dependency> <groupId>groupIdB</groupId> <artifactId>artifactIdB</artifactId> </dependency> </dependencies> </project> The set of collection type elements are known and should be configurable (preferably via a set of XPath expressions). A Java based solution is appreciated. What looked most promising so far was the tool mentioned here but the MERGE action produces something like <dependency> <groupId>groupIdAgroupIdB</groupId> <artifactId>artifactIdAartifactIdB</artifactId> </dependency> when merging, which is not what I need. Any ideas? Thanks for your help!

    Read the article

  • jQuery Running a function in a context and adding to a variable

    - by Mark
    For this question I'm going to give a simplified example of what I want to do, and the function I want to learn to write. var collection = ''; <div id='container'> <span>1</span> <span>2</span> <span>3</span> </div> What I want to do this, for every span in the div, take its text, add it to the collection. So ideally it would look like: $('#container').addtoCollection(collection); The method would be something like: $(this).find('span').each(function () { collection = collection + $(this).text(); }). Where the first this would equal #container. So in the end you can do: console.log(collection); and get: 123 How do I write the function that does this? Thanks!

    Read the article

  • JAVA: Can't get context parameters in Filter

    - by DaTval
    Hello, I have a filter and parameters in web.xml web.xml is like this: <filter> <description> </description> <display-name>AllClassFilter</display-name> <filter-name>AllClassFilter</filter-name> <filter-class>com.datval.homework.AllClassFilter</filter-class> <init-param> <param-name>DB_URL</param-name> <param-value>jdbc:derby:C:/Users/admin/workspace/homework03/homework/databases/StudentsDB;create=true</param-value> </init-param> <init-param> <param-name>DB_DIALECT</param-name> <param-value>org.hibernate.dialect.DerbyDialect</param-value> </init-param> <init-param> <param-name>DB_DRIVER</param-name> <param-value>org.apache.derby.jdbc.EmbeddedDriver</param-value> </init-param> </filter> mapping is working well. But I can't get this parameters in my filter. public void init(FilterConfig config) throws ServletException { // TODO Auto-generated method stub debugMessage = config.getInitParameter("debugMessage"); ctx = config.getServletContext(); } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { // TODO Auto-generated method stub // place your code here ctx.log("Start - " + debugMessage); String myDbUrl = ctx.getInitParameter("DB_URL"); String DB_DIALECT = ctx.getInitParameter("DB_DIALECT"); String DB_DRIVER = ctx.getInitParameter("DB_DRIVER"); Map<String,String> pr = new HashMap<String,String>(); pr.put("hibernate.connection.url", myDbUrl); pr.put("hibernate.dialect", DB_DIALECT); pr.put("hibernate.connection.driver_class", DB_DRIVER); EntityManagerFactory emf = Persistence.createEntityManagerFactory("students",pr); EntityManager em = emf.createEntityManager(); request.setAttribute("em", em); chain.doFilter(request, response); em.close(); ctx.log("end - " + debugMessage); } I have checked and myDbUrl is null. What I'm doing wrong? Any idea? Sorry about code, I will change it later :)

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >