Search Results

Search found 102 results on 5 pages for 'brigham andersen'.

Page 3/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • Which web containers install themselves well as a Windows service?

    - by Thorbjørn Ravn Andersen
    We have had a web application product for several years, and used Tomcat to deploy it under Windows as it registers itself as a Windows service so it starts and stops automatically. We may now happen to need more JEE facilitites than is provided by Tomcat (we are very tempted by the JEE 6 things in the container) so the question is which Open Source JEE containers works well as Windows services. Since Glassfish is the only JEE 6 implementation right now, it would be nice if it works well, but I'd like to hear experiences and not just what I can read from brochures. If not, what else do people use? EDIT: This goes for web containers too, and not just JEE containers. We will probably keep the necessary stack included until we find the right container and it gets JEE6 support. EDIT: I want this to work as distributed. I'm not interested in manually hacking wrappers etc., but want the installation process to handle the creation and removal of the service.

    Read the article

  • Python 3 with the range function

    - by Leif Andersen
    I can type in the following code in the terminal, and it works: for i in range(5): print(i) And it will print: 0 1 2 3 4 as expected. However, I tried to write a script that does a similar thing: print(current_chunk.data) read_chunk(file, current_chunk) numVerts, numFaces, numEdges = current_chunk.data print(current_chunk.data) print(numVerts) for vertex in range(numVerts): print("Hello World") current_chunk.data is gained from the following method: def read_chunk(file, chunk): line = file.readline() while line.startswith('#'): line = file.readline() chunk.data = line.split() The output for this is: ['OFF'] ['490', '518', '0'] 490 Traceback (most recent call last): File "/home/leif/src/install/linux2/.blender/scripts/io/import_scene_off.py", line 88, in execute load_off(self.properties.path, context) File "/home/leif/src/install/linux2/.blender/scripts/io/import_scene_off.py", line 68, in load_off for vertex in range(numVerts): TypeError: 'str' object cannot be interpreted as an integer So, why isn't it spitting out Hello World 490 times? Or is the 490 being thought of as a string? I opened the file like this: def load_off(filename, context): file = open(filename, 'r')

    Read the article

  • Function parameter types in Python

    - by Leif Andersen
    Unless I'm mistaken, creating a function in python works like this def my_func(param1, param2): /*stuff*/ However, you don't actually give the types of those parameters. Also, if I remember, python is a strongly typed language, as such, it seams like python shouldn't let you pass in a parameter of a different type then the function creator expected. However, how does python know that the user of the function is passing in the proper types? Or will the program just die if it's the wrong type, assuming the function actually uses the parameter? Or do you have to specify the type/I'm missing something? Thank you.

    Read the article

  • Simulating pass by reference for an array reference (i.e. a reference to a reference) in Java

    - by Leif Andersen
    I was wondering, in java, is it possible to in anyway, simulate pass by reference for an array? Yes, I know the language doesn't support it, but is there anyway I can do it. Say, for example, I want to create a method that reverses the order of all the elements in an array. (I know that this code snippet isn't the best example, as there is a better algorithms to do this, but this is a good example of the type of thing I want to do for more complex problems). Currently, I need to make a class like this: public static void reverse(Object[] arr) { Object[] tmpArr = new Object[arr.length]; count = arr.length - 1; for(Object i : arr) tmpArr[count--] = i; // I would like to do arr = tmpArr, but that will only make the shallow // reference tmpArr, I would like to actually change the pointer they passed in // Not just the values in the array, so I have to do this: count = arr.length - 1; for(Object i : tmpArr) arr[count--] = i; return; } Yes, I know that I could just swap the values until I get to the middle, and it would be much more efficient, but for other, more complex purposes, is there anyway that I can manipulate the actual pointer? Again, thank you.

    Read the article

  • Simulating pass by reference for an array in Java

    - by Leif Andersen
    I was wondering, in java, is it possible to in anyway, simulate pass by reference for an array? Yes, I know the language doesn't support it, but is there anyway I can do it. Say, for example, I want to create a method that reverses the order of all the elements in an array. (I know that this code snippet isn't the best example, as there is a better algorithms to do this, but this is a good example of the type of thing I want to do for more complex problems). Currently, I need to make a class like this: public static void reverse(Object[] arr) { Object[] tmpArr = new Object[arr.length]; count = arr.length - 1; for(Object i : arr) tmpArr[count--] = i; // I would like to do arr = tmpArr, but that will only make the shallow // reference tmpArr, I would like to actually change the pointer they passed in // Not just the values in the array, so I have to do this: count = arr.length - 1; for(Object i : tmpArr) arr[count--] = i; return; } Yes, I know that I could just swap the values until I get to the middle, and it would be much more efficient, but for other, more complex purposes, is there anyway that I can manipulate the actual pointer? Again, thank you.

    Read the article

  • CGRect in C code

    - by Leif Andersen
    A simple google search for: CGRect + C or CGRect in C brings back only Apple, iPhone, and Objective-C websites. However, I remember hearing that Core Graphics was part of C at my university. Did I hear incorrectly, or is CGRect something that I can use in C, or even C++ as it's Object oriented?

    Read the article

  • Purpose of dereferencing a pointer as a parameter in C.

    - by Leif Andersen
    I recently came along this line of code: CustomData_em_free_block(&em->vdata, &eve->data); And I thought, isn't: a->b just syntactic sugar for: (*a).b With that in mind, this line could be re-written as: CustomData_em_free_block(&(*em).vdata, &(*eve).data); If that's the case, what is the point of passing in &(*a), as a parameter, and not just a? It seems like the pointer equivalent of -(-a) is being passed in in, is there any logic for this? Thank you.

    Read the article

  • Socksifying a Java ServerSocket - how to approach

    - by Thorbjørn Ravn Andersen
    I would like to have a Java program running on network A have a ServerSocket living on another network B through a proxy. I have played with a SOCKS5 proxy (which works) but it appears that all the proxy facilities in Java only work with client connections, not with ServerSockets (no constructor taking a Proxy argument). Asking Google gives much hay and few needles. What is the approach I should take to get this running? If a specific client is better than a generic SOCKS or web proxy then fine, but it needs to be Java (that leaves sshd out). Target JVM is preferrably Java 5, and then Java 6.

    Read the article

  • A methology that allows for a single Java code base covering many different versions?

    - by Thorbjørn Ravn Andersen
    I work in a small shop where we have a LOT of legacy Cobol code and where a methology has been adopted to allow us to minimize forking and branching as much as possible. For a given release we have three levels: CORE - bottom layer, this code is common to all releases GROUP - optional code common to several customers. CUSTOMER - optional code specific for a single customer. When a program is needed, it is first searched for in CUSTOMER, then in GROUP and finally in CORE. A given application for us invokes many programs which all are looked for in this sequence (think exe files and PATH under Windows). We also have Java programs interacting with this legacy code, and as the core-group-customer lookup mehchanism does not lend it self easily to Java it has tended to grow in a CVS branch for each customer, requiring much too much maintainance. The Java part and the backend part tend to be developed in parallel. I have been assigned to figure out a way to make the two worlds meet. Essentially we want a Java enviornment which allows us to have a single code base with sources for each release, where we easily can select a group and a customer and work with the application as it goes for that customer, and then easily switch to another codeset and THAT customer. I was thinking of perhaps a scenario with an Eclipse project for each core, customer, and group and then use Project Sets to select those we need for a given scenario. The problem I cannot get my head about, is how we would create robust code in the CORE projects which will work regardless of which group and customer is selected. A Factory class which knows which sub class of a passed Class object to invoke instead of each and every new? Others must have had similar code base management problems. Anybody with experiences to share? EDIT: The conclusion to this problem above has been that CVS needs to be replaced with a source code management system better suited for dealing with many branches concurrently and the migration of source from one component to the other while keeping history. Inspired by the recent migration by slf4j and logback we are currently looking at git as it handles branches very well. We've considered subversion and mercurial too but git appears to be better for single location, multibranched projects. I've asked about Perforce in another question, but my personal inclination is towards open source solutions for something as crucial as this. EDIT: After some more pondering, we've found that our actual pain point is that we use branches in CVS, and that branches in CVS are the easiest to work with if you branch ALL files! The revised conclusion is that we can do this with CVS alone, by switching to a forest of java projects, each corresponding to one of the levels above, and use the Eclipse build paths to tie them together so each CUSTOMER version pulls in the appropriate GROUP and CORE project. We still want to switch to a better versioning system but this is so important a decision so we want to delay it as much as possible. EDIT: I now have a proof-of-concept implementation of the CORE-GROUP-CUSTOMER concept using Google Guice 2.0 - the @ImplementedBy tag is just what we need. I wonder what everybody else does? Using if's all over the place? EDIT: Now I also need this functionality for web applications. Guice was until the JSR-330 is in place. Anybody with versioning experience? EDIT: JSR-330/299 is now in place with the JEE6 reference implementation Weld based on JBoss Seam and I have reimplemented the proof-of-concept with Weld and can see that if we use @Alternative along with ... in beans.xml we can get the behaviour we desire. I.e. provide a new implementation for a given functionality in CORE without changing a bit in the CORE jars. Initial reading up on the Servlet 3.0 specification indicates that it may support the same functionality for web application resources (not code). We will now do initial testing on the real application.

    Read the article

  • How to emulate "-lib foo.jar" from _within_ build.xml

    - by Thorbjørn Ravn Andersen
    By specifying "-lib foo.jar" to ant I get the behaviour that the classes in foo.jar is added to the ant classloader and are available for various tasks taking a class name argument. I'd like to be able to specify the same behaviour but only from inside build.xml (so we can do this on a vanilla ant). For taskdefs we have functioning code looking like: <taskdef resource="net/sf/antcontrib/antlib.xml" description="for/foreach tasks"> <classpath> <pathelement location="${active.workspace}/ant-contrib-1.X/lib/ant-contrib.jar" /> </classpath> </taskdef> where the definition is completely provided from the ant-contrib.jar listed. What is the equivalent mechanism for the "global" ant classpath? (I have thought out that this is the way to get <javac> use ecj-3.5.jar to compile with on a JRE - http://stackoverflow.com/questions/2364006/specifying-the-eclipse-compiler-completely-from-within-build-xml - in a way compatible with ant 1.7. Better suggestions are welcome :) EDIT: It appears that the about-to-be-released version 1.0 of ant4eclipse includes ecj. This does not answer the question, but may solve my basic problem.

    Read the article

  • Ruby - encrypted_strings

    - by Tom Andersen
    A bit of a Ruby newbie here - should be an easy question: I want to use the encrypted_strings gem to create a password encrypted string: (from http://rdoc.info/projects/pluginaweek/encrypted_strings) Question is: Everything works fine, but how come I don't need the password to decrypt the string? Say I want to store the string somewhere for a while,like the session. Is the password also stored with it? (which would seem very strange?). And no, I'm not planning on using 'secret-key' or any similar hack as a password. I am planning on dynamically generating a class variable @@password using a uuid, which I don't store other than in memory, and can change from one running of the program to the next. Symmetric: >> password = 'shhhh' => "shhhh" >> crypted_password = password.encrypt(:symmetric, :password => 'secret_key') => "qSg8vOo6QfU=\n" >> crypted_password.class => String >> crypted_password == 'shhhh' => true >> password = crypted_password.decrypt => "shhhh"

    Read the article

  • Application lifecycle and onCreate method in the the android sdk

    - by Leif Andersen
    I slapped together a simple test application that has a button, and makes a noise when the user clicks on it. Here are it's method: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button b = (Button)findViewById(R.id.easy); b.setOnClickListener(this); } public void onClick(View v) { MediaPlayer mp = MediaPlayer.create(this, R.raw.easy); mp.start(); while(true) { if (!mp.isPlaying()) { mp.release(); break; } } } My question is, why is onCreate acting like it's in a while loop? I can click on the button whenever, and it makes the sound. I might think it was just a property of listeners, but the Button object wasn't a member variable. I thought that Android would just go through onCreate onse, and proceed onto the next lifecycle method. Also, I know that my current way of seeing if the sound is playing is crap...I'll get to that later. :) Thank you.

    Read the article

  • Good Hash Function for Strings

    - by Leif Andersen
    I'm trying to think up a good hash function for strings. And I was thinking it might be a good idea to sum up the unicode values for the first five characters in the string (assuming it has five, otherwise stop where it ends). Would that be a good idea, or is it a bad one? I am doing this in Java, but I wouldn't imagine that would make much of a difference.

    Read the article

  • How to convert a printer driver to a stand-alone console application which can generate a printer fi

    - by Thorbjørn Ravn Andersen
    I have a situation where the only way to generate a certain datafile is to print it manually to FILE: under Windows and save it in a file for further processing. I would really like to have a small stand-alone program which embeds this binary printer driver so I can run it from a batch file and have it generate that binary file for me, as we can then fully automate the "save file in Visio, 'print' it and upload it to the final destination and trigger a remote test". Is this possible with a suitable Windows SDK? I am a Java programmer, so I do not know Visual Studio and the possibilities with MSDN - yet! - but I'd appreciate pointers. EDIT: I have the installation files for that printer driver, both 32 and 64 bit. Older versions may include a 16 bit driver. EDIT: The "print to FILE:" functionality is just what was recommended by the documentation. I have played a little bit with using the LPR-protocol to see what it can do. I'd still prefer the "invoke small binary" approach.

    Read the article

  • Operator Overloading in C

    - by Leif Andersen
    In C++, I can change the operator on a specific class by doing something like this: MyClass::operator==/*Or some other operator such as =, >, etc.*/(Const MyClass rhs) { /* Do Stuff*/; } But with there being no classes (built in by default) in C. So, how could I do operator overloading for just general functions? For example, if I remember correctly, importing stdlib.h gives you the - operator, which is just syntactic sugar for (*strcut_name).struct_element. So how can I do this in C? Thank you.

    Read the article

  • Dependency Injection with @Inject in Weld (JSR-299 RI). How is the corresponding @Produces found?

    - by Thorbjørn Ravn Andersen
    I have played with the JSR-299 Reference Implementation "Weld" with the purpose of using it in a stand-alone application, and I have had a look at the documentation, and marveled at the magic. My question is how the producer of a given object to be @Inject'ed is found? Either the java compiler produces hints for annotations which is easily found by the classloader, or the complete classpath must be traversed loading all classes to see what they do which sounds highly inefficient to me, or it is a completely different approach. What is the trick?

    Read the article

  • Internet Explorer and onMouseOver/onMouseOut

    - by Thorbjørn Reimann-Andersen
    Hi all, I have tried looking a similar question on here but couldnt find one so here it comes: I have this html (ignore the "+whatever+@", its in a codebehind file so im putting some variables that im getting from there): <div id='ReferenceContainer"+UniqueID+@"' style='background-color:"+BackcolourOFF+@"; width:"+CompWidth+@"; height:"+CompHeight+@";'> <div id='Reference"+UniqueID+@"' style='width:"+CompWidth+@"; height:"+CompHeight+@"; '> <div id='RefTextContainer"+UniqueID+@"' style='float:left; width:"+CompWidth+@"; height:"+CompHeight+@"; ' > <div id='RefTitleCon' style='margin-top:"+RefTitleMargin+@"px; color:"+RefTitleColor+@"; z-index:-1;' ><p><b>"+RefTitle+@"</b></p> </div> <div id='RefTextCon'><p>"+RefText+@"</p></div> </div> <div id='RefPicContainer"+UniqueID+@"' style='float:right;'> <img id='RefImg"+UniqueID+@"first' class='first' name='RefImg"+UniqueID+@"' src=" + StartImg + @" style='position:absolute;' ></img> <img id='RefImg"+UniqueID+@"second' class='second' name='RefImg"+UniqueID+@"' src=" + AltImg + @" style='display:none;' ></img> </div> </div> <div id='ScriptContainer"+UniqueID+@"' style='width:"+CompWidth+@"; height:"+CompHeight+@"; position:relative; top:-"+CompHeight+@"px; left:0px;' onMouseOver='ChangeBackcolourON"+UniqueID+@"()' onMouseOut='ChangeBackcolourOFF"+UniqueID+@"()'></div> </div> Now in firefox, everything works just perfect. The div "ScriptContainer" sits in front of the whole thing and when the mouse enters or leaves the functions work exactly as they should. But IE8 places the text in front of everything and then the functions do not work as i would like them to. "ChangeBackcolourOFF" gets called every time the mouse enters the text, which sits in front of everything and "ChangeBackcolourON" gets called every time the mouse enters the "Scriptcontainer" from the text. So i either need to figure out how to force the text to be placed behind the "Scriptcontainer" or some other solutions. I appreciate you answers

    Read the article

  • Recommendations of a high volume log event viewer in a Java enviroment

    - by Thorbjørn Ravn Andersen
    I am in a situation where I would like to accept a LOT of log events controlled by me - notably the logging agent I am preparing for slf4j - and then analyze them interactively. I am not as such interested in a facility that presents formatted log files, but one that can accept log events as objects and allow me to sort and display on e.g. threads and timelines etc. Chainsaw could maybe be an option but is currently not compatible with logback which I use for technical reasons. Is there any project with stand alone viewers or embedded in an IDE which would be suitable for this kind of log handling. I am aware that I am approaching what might be suitable for a profiler, so if there is a profiler projekt suitable for this kind of data acquisition and display where I can feed the event pipe, I would like to hear about it). Thanks for all feedback Update 2009-03-19: I have found that there is not a log viewer which allows me to see what I would like (a visual display of events with coordinates determined by day and time, etc), so I have decided to create a very terse XML format derived from the log4j XMLLayout adapted to be as readable as possible while still being valid XML-snippets, and then use the Microsoft LogParser to extract the information I need for postprocessing in other tools.

    Read the article

  • Creating a list of integers in XML for android.

    - by Leif Andersen
    I would like to create a list of Integers in the /res folder of an android project. However, I want those integers to point resources in /res/raw. So for example, I would like something like this: <?xml version="1.0" encoding="utf-8"?> <resources> <integer-array name="built_in_sounds"> <item>@raw/sound</item> </integer-array> </resources> But id doesn't look like I can do that, is there any way to do this? Or should I just create the list in a java class? Thank you

    Read the article

  • Any way of working with Eclipse WTP that does not mean redeploying the _WHOLE_ application when a J

    - by Thorbjørn Ravn Andersen
    I have migrated a Web Application from MyEclipse to Eclipse WTP, and I am now in the middle of the first major upgrade to the code base and web pages after the migration, and it is frankly driving me mad that saving a JSP page causes a redeployment of the WHOLE application, as it takes time and that my backend connection does not survive the serialization-deserialization of the session object (which is non-trivial to fix). In addition to that the JSP-editor is insanely slow so I frequently have to pause to let the editor catch up to be certain where my edits go in a small JSP using JavaServer Faces. Disabling validation did not help. The Eclipse Dynamic Web Project depends on several library eclipse projects so I cannot just tell e.g. Jetty to use the WebRoot folder, as several dependencies are then missing from the classpath. The question is: Is there a way of working - ANY way of working - with the Eclipse WTP system that does NOT imply redeploying everything every time any file is saved? I can use Tomcat 5.5 or Jetty 6 as servers.

    Read the article

  • Java WebStart: <property ...> ignored when using <extension>?

    - by Thorbjørn Ravn Andersen
    I have a problem modernizing a Java WebStart application under Java 6 u 13 (the latest at this moment) We desire to use the new mechanism to have several master configuration files each with their own configuration , which then "include" another jnlp file which is autogenerated to ensure that the jar list is accurate. After quite a bit of poking I have made it work, except for the fact that the properties defined in the master file is not available to the program when Main is invoked. The master JNLP looks like (anonymized): <jnlp> <information> <title>...</title> <vendor>...</vendor> <description>...</description> <description kind="short">...</description> <homepage href="http://....jnlp"/> <icon href="http://....gif"/> <!-- <offline-allowed/> --> </information> <security> <all-permissions/> </security> <resources> <j2se version="1.6+"/> <extension href="http://...extension.jnlp" /> <property name="server.name" value="SERVER"/> </resources> <application-desc main-class="Main"/> </jnlp> and the extension.jnlp looks like: <!-- Generated automatically. Do not edit! --> <jnlp> <information> <title>extension built 2009-04-22 12:39:58 CEST</title> <vendor>...</vendor> </information> <security><all-permissions/></security> <resources> <jar href="A.jar" /> <jar href="B.jar" /> <jar href="logback-classic-0.9.14.jar" /> <jar href="logback-core-0.9.14.jar" /> <jar href="slf4j-api-1.5.6.jar" /> </resources> <component-desc /> </jnlp> I have tried putting the proprty in the extension.jnlp too. Did not help. The JVM is reused and not relaunched according to the log in the Java Plugin Console. Any suggestions?

    Read the article

  • Best XML format for log events in terms of tool support for data mining and visualization?

    - by Thorbjørn Ravn Andersen
    We want to be able to create log files from our Java application which is suited for later processing by tools to help investigate bugs and gather performance statistics. Currently we use the traditional "log stuff which may or may not be flattened into text form and appended to a log file", but this works the best for small amounts of information read by a human. After careful consideration the best bet has been to store the log events as XML snippets in text files (which is then treated like any other log file), and then download them to the machine with the appropriate tool for post processing. I'd like to use as widely supported an XML format as possible, and right now I am in the "research-then-make-decision" phase. I'd appreciate any help both in terms of XML format and tools and I'd be happy to write glue code to get what I need. What I've found so far: log4j XML format: Supported by chainsaw and Vigilog. Lilith XML format: Supported by Lilith Uninvestigated tools: Microsoft Log Parser: Apparently supports XML. OS X log viewer: plus there is a lot of tools on http://www.loganalysis.org/sections/parsing/generic-log-parsers/ Any suggestions?

    Read the article

  • Using ASP.NET session state with Silverlight (PRISM)

    - by Jon Andersen
    Hi, The scenario: I have a PRISM application developed in Silverlight (4), and I'm using a ASP.NET server side application to host several web-services (which, in turn, accesses WCF-services, but that's not really important here). The Silverlight application must be able to call the web services cross-domain (meaning that the web services isn't necessarily on the same server hosting the silverlight application). The Silverlight application consists of several modules, each accessing the ASP.NET web-services. I do not have much experience with Silverlight and PRISM, but as far as I can see, this is not a very unusual scenario... The problem: My challange is, that when 2 different modules access the web-services, I get 2 new sessions on the web-server. I would have thought that since both modules live on the same HTML-page (and then also in the same browser session), they would get the same session on the web-server...? I have tried to make the web-service Proxy-client globally available in the container (using Unity), by registering an instance (using Container.RegisterInstance), and then getting this instance whenever a module needs to make a web-service call (using Container.Resolve), but this doesn't seem to help. However, any calls made within the same module always gets the same session on the server. Can anyone see what I'm missing here...? Thanks! Jon

    Read the article

  • Parameters with braces in python

    - by Leif Andersen
    If you look at the following line of python code: bpy.ops.object.particle_system_add({"object":bpy.data.objects[2]}) you see that in the parameters there is something enclosed in braces. Can anyone tell me what the braces are for (generically anyway)? I haven't really seen this type of syntax in python and I can't find any documentation on it. Any help is greatly appreciated. Thank you.

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >