Search Results

Search found 568 results on 23 pages for 'stefan mai'.

Page 15/23 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • XSLT adding elements on the same path

    - by Stefan
    Consider the following XML: <?xml version="1.0" encoding="ISO-8859-1"?> <catalog> <cd> <title>Empire Burlesque</title> <artist> <name>Bob</name> <surname>Dylan</surname> </artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> </catalog> I want to add elements to this XML using XSLT, to get the following result: <?xml version="1.0" encoding="ISO-8859-1"?> <catalog> <cd> <title>Empire Burlesque</title> <artist> <name>Bob</name> <surname>Dylan</surname> <!-- NEW --> <middlename>???</middlename> </artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> <!-- NEW --> <comment>great one</comment> </cd> <!-- NEW --> <cd> <title>Hide your heart</title> <artist> <name>Bonnie</name> <surname>Tyler</surname> </artist> <country>UK</country> <company>CBS Records</company> <price>9.90</price> <year>1988</year> </cd> </catalog> To achieve that, I wrote the following XSLT: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template name="injectXml"> <xsl:param name="whatToInject"/> <xsl:copy> <xsl:copy-of select="node() | @*"/> <xsl:copy-of select="$whatToInject"/> </xsl:copy> </xsl:template> <xsl:template match="//catalog"> <xsl:call-template name="injectXml"> <xsl:with-param name="whatToInject"> <cd> <title>Hide your heart</title> <artist> <name>Bonnie</name> <surname>Tyler</surname> </artist> <country>UK</country> <company>CBS Records</company> <price>9.90</price> <year>1988</year> </cd> </xsl:with-param> </xsl:call-template> </xsl:template> <xsl:template match="//cd[year=1985]"> <xsl:call-template name="injectXml"> <xsl:with-param name="whatToInject"> <comment>great one</comment> </xsl:with-param> </xsl:call-template> </xsl:template> <xsl:template match="//cd[year=1985]/artist"> <xsl:call-template name="injectXml"> <xsl:with-param name="whatToInject"> <middlename>???</middlename> </xsl:with-param> </xsl:call-template> </xsl:template> </xsl:stylesheet> Why it's not working? How to do it?

    Read the article

  • Unit testing a controller method?

    - by Stefan Kendall
    I have a controller method like such: def search = { def query = params.query ... render results as JSON } How do I unit test this? Specifically, how do I call search to set params.query, and how do I test the results of the method render? Is there a way to mock the render method, perhaps?

    Read the article

  • How do I solve this indexOutOfBoundsException in my server send/receive thread?

    - by Stefan Schouten
    I am creating a multiplayer game in Java with a server and multiple clients. Everything runs perfectly, until I press the Kick-button in the server to kick a client. Error at receive thread of server, after kicking the first person who joined out of three: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2 at java.util.ArrayList.rangeCheck(ArrayList.java:604) at java.util.ArrayList.get(ArrayList.java:382) > at networktest.Server$3.run(Server.java:186) at java.lang.Thread.run(Thread.java:722) The pointed line is the ois = new ObjectInputStream where I send datatype. The server kicks the first person perfectly, but removes the second one in the list too, with an error of java.lang.ClassCastException. server receive: private static Thread receive = new Thread() { @Override public void run() { ObjectInputStream ois; while (true) { for (int i = 0; i < list_sockets.size(); i++) { try { ois = new ObjectInputStream(list_sockets.get(i).getInputStream()); int receive_state = (Integer) ois.readObject(); // receive state ois = new ObjectInputStream(list_sockets.get(i).getInputStream()); byte datatype = (byte) ois.readObject(); // receive datatype if(datatype == 2){ ois = new ObjectInputStream(list_sockets.get(i).getInputStream()); ChatLine chatLine = (ChatLine) ois.readObject(); // receive ChatLine } else if (datatype == 0){ ois = new ObjectInputStream(list_sockets.get(i).getInputStream()); DataPackage dp = (DataPackage) ois.readObject(); // receive dp list_data.set(i, dp); } if (receive_state == 1) // Client Disconnected by User { disconnectClient(i); i--; } } catch (Exception ex) // Client Disconnected (Client Didn't Notify Server About Disconnecting) { System.err.println("Error @ receive:"); ex.printStackTrace(); disconnectClient(i); i--; } } try { this.sleep(3); } catch (InterruptedException ex) { Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); } } } }; user send: Thread send = new Thread() { public void run() { ObjectOutputStream oos; byte datatype = 0; while (connected){ if (socket != null){ try { DataPackage dp = new DataPackage(); dp.x = Client.player.x; dp.y = Client.player.y; dp.username = username; dp.charType = charType; dp.walking = (byte)Client.player.walking; if (Client.outputChatLine.line != null) datatype = 2; else { datatype = 0; } oos = new ObjectOutputStream(socket.getOutputStream()); oos.writeObject(Integer.valueOf(Client.this.state)); // send state oos = new ObjectOutputStream(socket.getOutputStream()); oos.writeObject(Byte.valueOf(datatype)); // send datatype if (datatype == 2) { oos.reset(); oos.writeObject(Client.outputChatLine); Client.outputChatLine = new ChatLine(); } else { oos = new ObjectOutputStream(socket.getOutputStream()); oos.writeObject(dp); } if (Client.this.state == 1) { connected = false; socket = null; JOptionPane.showMessageDialog(null, "Client Disconnected", "Info", 1); System.exit(0); } } catch (Exception ex){} } try { this.sleep(2); } catch (InterruptedException ex) { Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex); } } } }; disconnect client method: public static void disconnectClient(int index) { try { list_clients_model.removeElementAt(index); list_client_states.remove(index); list_data.remove(index); list_sockets.remove(index); } catch (Exception ex) {} } Does anyone know how to solve this?

    Read the article

  • POST with HTTPBuilder -> NullPointerException?

    - by Stefan Kendall
    I'm trying to make a simple HTTP POST request, and I have no idea why the following is failing. I tried following the examples here, and I don't see where I'm going wrong. Exception java.lang.NullPointerException at groovyx.net.http.HTTPBuilder$RequestConfigDelegate.setBody(HTTPBuilder.java:1131) ... Code def List<String> search(String query, int maxResults) { def http = new HTTPBuilder("mywebsite") http.request(POST) { uri.path = '/search/' body = [string1: "", query: "test"] requestContentType = URLENC headers.'User-Agent' = 'Mozilla/5.0 Ubuntu/8.10 Firefox/3.0.4' response.success = { resp, InputStreamReader reader -> assert resp.statusLine.statusCode == 200 String data = reader.readLines().join() println data } } [] }

    Read the article

  • Add a prefix do Django comment form

    - by Stefan Manastirliu
    I would like to add a prefix to each django comment form. I'm using multiply comment forms in the same page and depsite it's working well, i don't like having many input fields with the same id attribute like <input type="text" name="honeypot" id="id_honeypot" />. So, is there a way to tell django do add a prefix to each form instance? I know i can do it with other forms when i create a form instance in this waynewform = CustomForm(prefix="a") but using Django's comment system, this part is handled by a comment template tag {% get_comment_form for [object] as [varname] %}. Can I tell to the template tag to add a prefix?

    Read the article

  • Scala wont pattern match with java.lang.String and Case Class

    - by Stefan
    Hello fellow Scala Programmers I have been working with Scala for some month now, however I have a problem with some properly basic stuff, I am hoping you will help my out with it. case class PersonClass(name: String, age: Int) object CaseTester { def main(args:Array[String]) { val string = "hej" string match { case e:String => println(string) case PersonClass => println(string) } } } When I am doing like this I get error: pattern type is incompatible with expected type; found : object PersonClass required: java.lang.String case PersonClass = println(string) And if I then change the second line in the pattern matching to the following: case e:PersonClass => println(string) I then get the error: error: scrutinee is incompatible with pattern type; found : PersonClass required: java.lang.String case e:PersonClass = println(string) However if I change the string definition to the following it compiles fine in both cases. val string:AnyRef = "hej"

    Read the article

  • Colspan in IE7/8 not respected

    - by Stefan Kendall
    The DOM looks like this: <table> <tr> <td>a</td>...<td>g</td> </tr> <tr> <td colspan="3"> <table> ... </table> </td> </tr> <tr> <td></td>...<td></td> </tr> </table> Any idea why this wouldn't work in IE? I tried setting width:auto on the TD holding the inner table, and table-layout:fixed isn't viable because the tabular data is generated dynamically. What could be going wrong?

    Read the article

  • Write STDOUT & STDERR to a logfile, also write STDERR to screen

    - by Stefan Lasiewski
    I would like to run several commands, and capture all output to a logfile. I also want to print any errors to the screen (or optionally mail the output to someone). Here's an example. The following command will run three commands, and will write all output (STDOUT and STDERR) into a single logfile. { command1 && command2 && command3 ; } > logfile.log 2>&1 Here is what I want to do with the output of these commands: STDERR and STDOUT for all commands goes to a logfile, in case I need it later--- I usually won't look in here unless there are problems. Print STDERR to the screen (or optionally, pipe to /bin/mail), so that any error stands out and doesn't get ignored. It would be nice if the return codes were still usable, so that I could do some error handling. Maybe I want to send email if there was an error, like this: { command1 && command2 && command3 ; } logfile.log 2&1 || mailx -s "There was an error" [email protected] The problem I run into is that STDERR loses context during I/O redirection. A '2&1' will convert STDERR into STDOUT, and therefore I cannot view errors if I do 2 error.log Here are a couple juicier examples. Let's pretend that I am running some familiar build commands, but I don't want the entire build to stop just because of one error so I use the '--keep-going' flag. { ./configure && make --keep-going && make install ; } > build.log 2>&1 Or, here's a simple (And perhaps sloppy) build and deploy script, which will keep going in the event of an error. { ./configure && make --keep-going && make install && rsync -av --keep-going /foo devhost:/foo} > build-and-deploy.log 2>&1 I think what I want involves some sort of Bash I/O Redirection, but I can't figure this out.

    Read the article

  • Estimate serialization size of objects?

    - by Stefan K.
    In my thesis, I woud like to enhance messaging in a cluster. It's important to log runtime information about how big a message is (should I prefer processing local or remote). I could just find frameoworks about estimating the object memory size based on java instrumentation. I've tested classmexer, which didn't come close to the serialization size and sourceforge SizeOf. In a small testcase, SizeOf was around 10% wrong and 10x faster than serialization. (Still transient breaks the estimation completely and since e.g. ArrayList is transient but is serialized as an Array, it's not easy to patch SizeOf. But I could live with that) On the other hand, 10x faster with 10% error doesn't seem very good. Any ideas how I could do better?

    Read the article

  • My abstract class implements an interface but doesn't implement some of its methods. How do I make i

    - by Stefan Monov
    interface ICanvasTool { void Motion(Point newLocation); void Tick(); } abstract class CanvasTool_BaseDraw : ICanvasTool { protected abstract void PaintAt(Point location); public override void Motion(Point newLocation) { // implementation } } class CanvasTool_Spray : CanvasTool_BaseDraw { protected abstract void PaintAt(Point location) { // implementation } public override void Tick() { // implementation } } This doesn't compile. I could add an abstract method "Tick_Implementation" to CanvasTool_BaseDraw, then implement ICanvasTool.Tick in CanvasTool_BaseDraw with a one-liner that just calls Tick_Implementation. Is this the recommended workaround?

    Read the article

  • Reporting tool for OLAP, *not* OLTP!

    - by Stefan Moser
    I'm looking for a control that I can put on top of an already existing OLAP star schema to allow the user to define their own "queries" and generate reports. Right now I have some predefined reports built on top of the cubes, but I'd like to allow the user to define their own criteria based on the cubes that I've created. I've found lots of products that will allow you to treat a transactional table like an OLAP cube, but nothing specifically for pre-existing cubes. EDIT: Let me be clear, I know there are countless reporting tools out there that claim to report on OLAP cubes. The problem is they all assume they are looking at transactional data and try to create their own cubes. I have tables that contain tens, if not hundreds of millions of records. Most tools crash when handling this much data, the others just run incredible slowly. I don't want a tool that is targeting the business people. I want a tool that understands what a star and snowflake schema is. I want to be able to tell it what the fact tables are and what the dimension tables are, and then creates a UI on top of them. This is an easier problem to solve for the tool vendor because I am spoon feeding them the cubes. I want to rely on the fact that cubes are a standardized pattern and I want a tool that takes advantage of this fact. I want a tool that targets developers and starts with the assumption that I actually know how to manage my data, it just needs to build pretty reports for me and not crumble under the weight of my data.

    Read the article

  • iPhone: change height of UITableViewCell coming from a NIB

    - by Stefan Klumpp
    I have a UITableView of custom UITableViewCells which looks like this: [ CELL 0 [ description ] [ dynamic content type 1 ] [ dynamic content type 2 ] [ dynamic content type 3 ] ] [ CELL 1 [ description ] [ dynamic content type 1 ] [ dynamic content type 3 ] ] [ CELL 2 [ description ] [ dynamic content type 2 ] ] [ ... and so on ... ] Since the [description] part is already pretty complex I decided to use Interface Builder to design it and at add the [dynamic content] in the cellForRowAtIndexPath programmatically with [cell addSubview:...]. My problem is now, that I set a default height for my custom UITableViewCell in Interface Builder, but when I add my [dynamic content] (which might range between 0..3) I have different cells with different heights. One thing is of course to calculate the total height and change the return value in heightForRowAtIndexPath, but how do I change the height value of my actual cell (which was loaded from a nib file with a fixed height)?

    Read the article

  • Grails XOM linkageerror - SAXParserException

    - by Stefan Kendall
    Possibly related: http://stackoverflow.com/questions/2762439/grails-attempting-to-include-htppbuilder-linkage-error I'm trying to include XOM in my grails project. How do I know which dependency library I need to exclude? I'm lost here. dependencies { build('xom:xom:1.1') { excludes "xml-apis" } } Error: java.lang.LinkageError: loader constraint violation: loader (instance of <bootloader>) previously initiated loading for a different type with name "org/xml/sax/SAXParseException" at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) at java.lang.Class.getDeclaredMethods(Class.java:1791) at java.security.AccessController.doPrivileged(Native Method) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:33) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:20) at grails.util.PluginBuildSettings.getPluginInfos(PluginBuildSettings.groovy:124) at grails.util.PluginBuildSettings.getPluginInfos(PluginBuildSettings.groovy) at grails.util.PluginBuildSettings$getPluginInfos.callCurrent(Unknown Source) at grails.util.PluginBuildSettings.getPluginInfo(PluginBuildSettings.groovy:160) at grails.util.PluginBuildSettings$getPluginInfo.callCurrent(Unknown Source) at grails.util.PluginBuildSettings.getPluginInfoForSource(PluginBuildSettings.groovy:195) at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:303) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:820) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:513) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:489) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:466) at _GrailsEvents_groovy.run(_GrailsEvents_groovy:54) at _GrailsEvents_groovy$run.call(Unknown Source) at _GrailsArgParsing_groovy$run.call(Unknown Source) at _GrailsArgParsing_groovy.run(_GrailsArgParsing_groovy:29) at _GrailsArgParsing_groovy$run.call(Unknown Source) at _GrailsInit_groovy$run.call(Unknown Source) at _GrailsInit_groovy.run(_GrailsInit_groovy:38) at _GrailsInit_groovy$run.call(Unknown Source) at Help_.run(Help_.groovy:27) at Help_$run.call(Unknown Source) at gant.Gant.processTargets(Gant.groovy:494) at gant.Gant.processTargets(Gant.groovy:480)

    Read the article

  • MultiActionController no longer receiving requests?

    - by Stefan Kendall
    I was attempting to make changes to my controller, and all of a sudden, I no longer seem to receive any requests (404 when attempting to hit the servlet mapped URLs). I'm sure I've broken my web.xml or app-servlet.xml, but I just don't see where. I can access index.jsp from tomcat (http://IP/app/index.jsp), but I can't get my servlet mapping to work correctly. Help? web.xml: <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app version = "2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <servlet> <servlet-name>app</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> </servlet> <servet-mapping> <servlet-name>app</servlet-name> <url-pattern>/myRequest</url-pattern> </servet-mapping> app-servlet.xml: <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app version = "2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <servlet> <servlet-name>app</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> </servlet> <servet-mapping> <servlet-name>app</servlet-name> <url-pattern>/myRequest</url-pattern> </servet-mapping> </web-app>

    Read the article

  • How do I detect the OpenJDK in my applet (System Properties)?

    - by Stefan Kendall
    How can I determine if my client is running OpenJDK with a web plugin? I've tried java.version and the rest of the properties listed here. Running java -version from the terminal works fine, but if I went this route, java would have to be on the user's path, which I don't know if I can trust entirely. Is there any other way to see the string given by java -version programmatically, without shelling out to the command line or terminal? Right now, when I run System.getProperties().getProperty("java.version"), I get Sun Microsystems Inc.!

    Read the article

  • How do I remove sensitive files from git's history

    - by Stefan Liebenberg
    I would like to put a git project ( Rails app ) on github, but it contains certian files with sensitive data ( usernames and passwords, like /config/deploy.rb for capistrano ). I know I can add these filenames to .gitignore, but this would not remove the their history within git. I also don't want to start over again by deleting the /.git directory. Is there a way to remove all traces of a particular file in your git history?

    Read the article

  • WPF: RadialGradientBrush without gradient?

    - by stefan.at.wpf
    Hello, I want to draw some circles in another circle like this: Is there a way to tell a RadialGradientBrush not to use gradients but just fixed colors, so I can achieve this? Thanks for any hint! (I guess this could be easily done using a DrawingBrush, I'm just wondering whether this could also be done using a RadialGradientBrush)

    Read the article

  • How do I Extend Blogengine.Net to collect statistics of visitors?

    - by Stefan
    I love BlogEngine. But from what I can se it does not collect the standard information about the visitors I would like to see (referrer, browser-type and so on). When I log in as Admin I have a menu item named "Referrer". I can choose a weekday and then I'll be presented with 1 or 2 rows with "google.com 4 hits, "itmaskinen.se 6 hits" and so on, But that's not what I want to se, I want to se where my visitors come from, country, IP if possible, how many visitors and so on. If someone of you are familiar with Blogengine.Net and can point me in the right direction to where I would put my own log-code or if you know any visitor-statistic-extension that can do it for me, I would be really happy to know. I prefer an extension, because if I make changes myself to BlogEngine it may break later updates I install. Blogengine.Net is a blog software made in .Net found here: http://www.dotnetblogengine.net/ And yes, I prefer to take this question here rather then in the Blogengine.Net forum, you know why. ;) (Anyone, feel free to edit my (bad) english in this post and after that delete this sentence)

    Read the article

  • Compiling SWIG library for Ruby on Mac OS X fails

    - by Stefan Schmidt
    I tried to compile the following SWIG library for Ruby and everything went smooth until the last step. /* File : computation.c */ int add(int x, int y) { return x + y; } /* File: computation.i */ %module computation extern int add(int x, int y); $ swig -ruby computation.i $ gcc -c computation.c $ gcc -c computation_wrap.c -I/opt/local/lib/ruby/1.8/i686-darwin10 $ gcc -shared computation.o computation_wrap.o -o computation.so Undefined symbols: "_rb_str_cat", referenced from: _Ruby_Format_TypeError in computation_wrap.o "_rb_exc_new3", referenced from: _SWIG_Ruby_ExceptionType in computation_wrap.o "_rb_define_class_under", referenced from: _SWIG_Ruby_define_class in computation_wrap.o _SWIG_Ruby_define_class in computation_wrap.o [...] ld: symbol(s) not found collect2: ld returned 1 exit status My configuration: $ sw_vers ProductName: Mac OS X ProductVersion: 10.6.3 BuildVersion: 10D575 $ ruby -v ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10] $ swig -version SWIG Version 1.3.40 Compiled with /usr/bin/g++-4.2 [i386-apple-darwin10.3.0] $ gcc --version i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646)

    Read the article

  • How to write a Custom DesignerSerializer for an class used by a Activity (WF)

    - by Stefan Steinegger
    I have a type which is used in a WF activity. It should be serialized. It doesn't work out of the box, most probably because of the private setters in that type. I'm not sure if this is the correct way, but I tried to write my own serializer and declared it on my class. [DesignerSerializer( typeof(FooDesignerSerializer), // my custom serializer typeof(WorkflowMarkupSerializer))] public class Foo { public Foo(int value, string name { // ... } public int Value { get; private set; } public string Name { get; private set; } } Is this the easiest way to get it serialized? How do I write this serializer? That's what I got so far: public class FooDesignerSerializer : WorkflowMarkupSerializer { protected override string SerializeToString( WorkflowMarkupSerializationManager serializationManager, object value) { // how to create a valid / XOML-like string? } }

    Read the article

  • Problem on Windows 7 using Image.FromStream to open cmyk+alpha tiff file

    - by Stefan Andersson
    I'm having a problem running the following code om Windows 7 x86 when creating an Image from a lzw encoded cmyk + alpha TIFF file. The FromStream call throws a System.ArgumentException: Parameter is not validRunning When I run the code on Vista or Server 2008 (both x86 and x64 bit) it just works. using System; using System.Drawing; using System.Drawing.Imaging; . . . using (FileStream stream = File.OpenRead(fileName)) { using (Image image = Image.FromStream(stream, false, false)) { // Do something with the image } }

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >