Search Results

Search found 223 results on 9 pages for 'marcus oldin'.

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

  • Using Scala and StringTemplate, how do I loop through a Map

    - by Marcus Kazmierczak
    I have my environment setup nicely using Scala, StringTempalte within the Google AppEngine. I am having trouble looping through a Map and getting it to display in the template. When I assign a simple List of just Strings to the template it works using: In Scala Servlet: var photos = List[String]() //... get photo url and title ... photos = photo_url :: photos template.setAttribute("photos", photos: _*) In Template: $photos: { photo| <div><img src="$photo$_s.jpg"></div> }$ The above works. However, any attempt of creating a Map using url and title and assigning to the template gives me an error. Here is my attempt, which does not work: In Scala Servlet: var photos = List[Map[String,String]]() //... get photo url and title ... photos = Map("url" -> url, "title" -> title) :: photos template.setAttribute("photos", photos: _*) In Template: $photos: { photo| <div><img src="$photo.url$_s.jpg" title="$photo.title$"></div> }$ This gives me the following error Class scala.collection.immutable.Map$Map2 has no such attribute: title in template context Thoughts / Ideas ?

    Read the article

  • What's the best practice to "look up" Java Enums?

    - by Marcus
    We have a REST API where clients can supply parameters representing values defined on the server in Java Enums. So we can provide a descriptive error, we add this lookup method to each Enum. Seems like we're just copying code (bad). Is there a better practice? public enum MyEnum { A, B, C, D; public static MyEnum lookup(String id) { try { return MyEnum.valueOf(id); } catch (IllegalArgumentException e) { throw new RuntimeException("Invalid value for my enum blah blah: " + id); } } } Update: The default error message provided by valueOf(..) would be No enum const class a.b.c.MyEnum.BadValue. I would like to provide a more descriptive error from the API.

    Read the article

  • Windows Service doesn't start process with different credentials

    - by Marcus
    I have a Windows Service, running as a user, that should start several processes under different user credentials. I'm using the following code to start a process: Dim winProcess As New System.Diagnostics.Process With winProcess .StartInfo.Arguments = "some_args" .StartInfo.CreateNoWindow = True .StartInfo.ErrorDialog = False .StartInfo.FileName = "C:\TEMP\ProcessFromService\ProcessFromService\bin\Debug\ProcessFromService.exe" .StartInfo.UseShellExecute = False .StartInfo.WindowStyle = ProcessWindowStyle.Hidden 'Opgave WorkingDirectory kan soms tot problemen leiden, indien betreffende directory 'niet bereikbaar (rechten) is voor opgegeven gebruiker. 'Beter dus om deze niet op te geven. '.StartInfo.WorkingDirectory = My.Computer.FileSystem.SpecialDirectories.Temp .StartInfo.Domain = "" .StartInfo.UserName = "MyUserId" Dim strPassword As String = "MyPassword" Dim ssPassword As New Security.SecureString For Each chrPassword As Char In strPassword.ToCharArray ssPassword.AppendChar(chrPassword) Next .StartInfo.Password = ssPassword .Start() End With The process is correctly started when I use the same credentials as of which the Windows Service is running under. The process is not started, without any error, when I use different credentials. In other words: If the Windows Service is running as UserA then I can start a process running as UserA. If the Windows Service is running as UserB then I can not start a process running as UserA. I have created a test project in which I can reproduce this problem. If you put this project in C:\Temp then the used paths will be correct. You can download this test project here: https://dl.dropboxusercontent.com/u/5391091/ProcessFromService.zip NB: I hope this info is enough to explain it. If you need more info, please let me know and I will add it.

    Read the article

  • How to show a client-side message with Java JSF/Tobago?

    - by Marcus
    I have a web application created with JSF and Tobago. The user types some date into a sheet and clicks a button (all within one sheet-row). Now my java class checks whether the data is correct or not. In case there are some problems, I would like to show up something like a messagebox containing the errormessage. I cannot use something like JDialog, since this would happen only server side. Every user independently of his location needs to get the message. I thought about setting the error information into a databean and having my jsp show up the message after reloading. But how can I achieve this? Is there something like a tag which can be used for this? Or can I use the "confirmation" facet for this? But how would I start it without having the user to do something? Thanks in advance!

    Read the article

  • Detecting type of webserive in httpmodule

    - by Marcus
    Hi, Is there any way to detect the type of a webservice inside a httpmodule? The reason for this is that I want to do some property injection to the webservice before it's processed. I found this: http://social.msdn.microsoft.com/Forums/en/asmxandxml/thread/0e848eee-d353-4e67-b47f-89fddb600009 but that is one h..l of an ugly solution. Anyone have a nice solution?

    Read the article

  • Allow for modular development while still running in same JVM?

    - by Marcus
    Our current app runs in a single JVM. We are now splitting up the app into separate logical services where each service runs in its own JVM. The split is being done to allow a single service to be modified and deployed without impacting the entire system. This reduces the need to QA the entire system - just need to QA the interaction with the service being changed. For inter service communication we use a combination of REST, an MQ system bus, and database views. What I don't like about this: REST means we have to marshal data to/from XML DB views couple the systems together which defeats the whole concept of separate services MQ / system bus is added complexity There is inevitably some code duplication between services You have set up n JBoss server configurations, we have to do n number of deployments, n number of set up scripts, etc, etc. Is there a better way to structure an internal application to allow modular development and deployment while allowing the app to run in a single JVM (and achieving the associated benefits)?

    Read the article

  • Posting a form with anchor link at the end?

    - by Marcus
    I have a form for comments like the one below but after the form is posted I wish to navigate to http://www.myurl.com/mypage#commentform but I don't know how to do this. Instead of changing my form maybe there is a way to return a View with my model and add #commentform to my url? <div id="commentform"> <h2>Leave a comment</h2> <% using (Html.BeginForm("Comment","Post", FormMethod.Post)) %> <% { %> <div> <%=Html.EditorFor(post => post.Comment) %> <div class="editor-button"> <input type="submit" value="Comment" /> </div> </div> <% } %> </div>

    Read the article

  • How to allow for modular development while still running in same JVM?

    - by Marcus
    Our current app runs in a single JVM. We are now splitting up the app into separate logical services where each service runs in its own JVM. The split is being done to allow a single service to be modified and deployed without impacting the entire system. This reduces the need to QA the entire system - just need to QA the interaction with the service being changed. For interservice communication we use a combination of REST, an MQ system bus, and database views. What I don't like about this: REST means we have to marshal data to/from XML DB views couple the systems together which defeats the whole concept of separate services MQ / system bus is added complexity There is inevitably some code duplication between services You have set up n JBoss server configurations, we have to do n number of deployments, n number of set up scripts, etc, etc. Is there a better way to structure an internal application to allow modular development and deployment while allowing the app to run in a single JVM (and achieving the associated benefits)?

    Read the article

  • Mercurial: Diff current source vs source at point in time

    - by Marcus
    I know how to view all changes in a changeset.. But let's say you update your source, you do a pull and you get 3 new changesets. How can you compare the current state of the remote repository (with the 3 changesets checked in) vs. the current source (on your local machine)? I'd like to do this using the visual diff tool which I currently have configured (Examdiff or Kdiff3).

    Read the article

  • Java plugin framework choice

    - by Marcus
    We're trying to determine how to implement a simple plugin framework for a service we are implementing that allows different types of calculators to be "plugged-in". After reading a number of posts about Java plugin frameworks, it seems like the most common options are: OSGI "Rolling your own" plugin framework The Java Plugin Framework (JPF) The Java Simple Plugin Framework (JSPF) OSGI seems to be more than we need. "Rolling your own" is ok but it would be nice to reuse a common library. So we're down to the JPF and JSPF. JPF seems to not be in active development right now. JSPF seems very simple and really all we need. However I haven't heard much about it. I've only seen one post on StackOverflow about it. Does anyone else have any experience with JSPF? Or any other comments on this design choice? Update: There isn't necessarily a correct answer to this.. however we're going to go with Pavol's idea as we need just a really, really simple solution. Thanks EoH for the nice guide.

    Read the article

  • Representing element as boolean with JAXB?

    - by Marcus
    We have this XML: <Summary> <ValueA>xxx</ValueA> <ValueB/> </Summary> <ValueB/> will never have any attributes or inner elements. It's a boolean type element - it exists (true) or it doesn't (false). JAXB generated a Summary class with a String valueA member, which is good. But for ValueB, JAXB generated a ValueB inner class and a corresponding member: @XmlElement(name = "ValueB") protected Summary.ValueB valueB; But what I'd like is a boolean member and no inner class: @XmlElement(name = "ValueB") protected boolean valueB; How can you do this? I'm not looking to regenerate the classes, I'd like to just make the code change manually. Update: In line with the accepted answer, we created a new method returning the boolean value conditional on whether valueB == null. As we are using Hibernate, we annotated valueB with @Transient and annotated the boolean getter with Hibernate's @Column annotation.

    Read the article

  • POST with curl without sending data

    - by Marcus
    Is there a way to use curl to send a POST request without sending any data? We usually post like: curl --data @C:\mydata.txt http://1.2.3.4/myapi If you omit the --data you are doing a GET. How can you omit it and still do a POST?

    Read the article

  • Set property with reflection after Fluent Nhibernates automapping has occured?

    - by Marcus
    I have an abstract baseclass with a collection of details IList that is automapped with fnh. After it has been populated with the correct values i would like to set some properties with reflection on the my class that inherits the abstract baseclass. I have tried to accomplish this in the constructor of my abstract baseclass but obviously my Details collection is empty when the occurs so my question is, what is the recommended way of doing this?

    Read the article

  • Understanding max JVM heap size

    - by Marcus
    I've read the max heap size on 32bit Windows is ~1.5GB which is due to the fact that the JVM requires contiguous memory. Can someone explain the concept of "contiguous memory" and why you only have max 1.5GB on Windows? Secondly, what then is the max heap size on 64 bit Windows and why is this different than what's available on 32 bit?

    Read the article

  • Java Non-Blocking HTTP Server

    - by Marcus
    I have written an application using embedded Jetty that makes network calls to other services. I presume that the serving threads are idle whilst waiting for the network calls to complete. Is there any way to have a worker thread that switches between requests to perform work that can be done at the current time and then when the network calls return also handle that? A request would be returned when all work has been completed for it. I know this is a common paradigm, and I have used it for non-blocking TCP networking, but I'm unsure as to how to achieve this on a Java HTTP server whilst also waiting on external results. Any links or explanations are appreciated. Thanks

    Read the article

  • How do I shorten the repository URL using svn+ssh similar to svnserve -r?

    - by Marcus
    In the svnbook, it shows you how to shorten the URL to your repositories when using svnserve as a daemon, using -r like: svnserve -d -r /usr/local/repositories That way, you can refer to the repository you need right after the hostname in the URL without revealing any of the local path (which is /usr/local/repositories/project1): svn checkout svn://host.example.com/project1 However, now that I am switching to svn+ssh, I have the local path back in my repository URL: svn checkout svn+ssh://host.example.com/usr/local/repositories/project1 Does anyone know how to hide that local path and use a shorter URL as up above, using svn+ssh and WITHOUT using a UNIX soft link on the svn server? (you still end up with an extra string in the URL if you use a soft link...) UPDATE: The solution to this can be found in the accepted answer over on ServerFault (the green-checked answer). Yay!

    Read the article

  • Hibernate configuration - session factory scanning?

    - by Marcus
    We have this hibernate.cfg.xml file. Is there a way to tell Hibernate to just scan a directory instead of having to add an entry here for each class? <hibernate-configuration> <session-factory> <mapping class="com.abc.domain.model.A" /> <mapping class="com.abc.domain.model.B" /> <mapping class="com.abc.domain.model.C" /> <mapping class="com.abc.domain.model.D" /> <mapping class="com.abc.domain.model.E" /> </session-factory> </hibernate-configuration>

    Read the article

  • Setting application affinity in gdb

    - by Marcus Ahlberg
    Is there a simple way of setting the affinity of the application I'm debugging without locking gdb to the same core? The reason why I'm asking is that the application is running with real time priority and it needs to run on a single core. At the moment I use this command line taskset -c 3 gdbserver :1234 ./app.out but the application stops responding and freezes the gdb server, making debugging impossible. I suspect that the real time priority of the application prevents gdb from executing. If I start the application and then start gdb without affinity setting, then I can attach and debug the application without gdb freezing. Is there a simple way to start gdb and the application with different affinities? Or preferably: Is there a gdb command to set affinity of the child process?

    Read the article

  • Support-function in the GJK-algorithm.

    - by Marcus Johansson
    I am trying to implement the GJK-algorithm but I got stuck instantly. The problem is to implement the Support-function that isn't O(n^2). As it is now I'm computing the complete Minkowski difference, and then there is really no point in doing the GJK-algorithm. (or is it?) What I mean by Support-function is the function that returns the point in the Minkowski difference that is furthest away in a specified direction. I assume this shouldn't be O(n^2) as it is in my current implementation.

    Read the article

  • Open closed prinicple, problem

    - by Marcus
    Hi, I'm trying to apply OCP to a code snippet I have that in it's current state is really smelly, but I feel I'm not getting all the way to the end. Current code: public abstract class SomeObject {} public class SpecificObject1 : SomeObject {} public class SpecificObject2 : SomeObject {} // Smelly code public class Model { public void Store(SomeObject someObject) { if (someObject is SpecificObject1) {} else if (someObject is SpecificObject2) {} } } That is really ugly, my new approach looks like this: // No so smelly code public class Model { public void Store(SomeObject someObject) { throw new Expception("Not allowed!"); } public void Store(SpecificObject1 someObject) {} public void Store(SpecificObject2 someObject) {} } When a new SomeObject type comes along I must implement how that specific object is stored, this will break OCP cause I need to alter the Model-class. To move the store logic to SomeObject also feels wrong cause then I will violate SRP (?), becuase in this case the SomeObject is almost like a DTO, it's resposibility it not how to know to store itself. If a new implementation to SomeObject comes along who's store implementation is missing I will get a runtime error due to exception in Store method in Model class, it also feels like a code smell. This is because calling code will in the form of IEnumerable<SomeObject> sequence; I will not know the specific types of the sequence objects. I can't seem to grasp the OCP-concept. Anyone has any concrete examples or links that is a bit more than just some Car/Fruit example?

    Read the article

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