Search Results

Search found 18 results on 1 pages for 'mikera'.

Page 1/1 | 1 

  • Essential management tools for a small/medium software development shop

    - by mikera
    I've recently started work with an organisation that is rapidly expanding and is recruiting or growing several development teams (including two web-based products and a data warehouse/BI team). They are basically working to agile methodologies but haven't formalised a standard way of working yet. Despite the fact that it is early days, I've been surprised by the lack of tools being used to manage the development processes (e.g. no issue tracker, no tool to manage the product backlog etc.) Although it's not my primary responsibility, I'd like to help them out with some recommendations on the most important tools they should get in place. What are the 3-5 top priority tools to establish for management of a good development shop? Why are they necessary? How do they improve the software development process, and how do I justify them to my bosses?

    Read the article

  • Generating tileable terrain using Perlin Noise [duplicate]

    - by terrorcell
    This question already has an answer here: How do you generate tileable Perlin noise? 9 answers I'm having trouble figuring out the solution to this particular algorithm. I'm using the Perlin Noise implementation from: https://code.google.com/p/mikeralib/source/browse/trunk/Mikera/src/main/java/mikera/math/PerlinNoise.java Here's what I have so far: for (Chunk chunk : chunks) { PerlinNoise noise = new PerlinNoise(); for (int y = 0; y < CHUNK_SIZE_HEIGHT; ++y) { for (int x = 0; x < CHUNK_SIZE_WIDTH; ++x) { int index = get1DIndex(y, CHUNK_SIZE_WIDTH, x); float val = 0; for (int i = 2; i <= 32; i *= i) { double n = noise.tileableNoise2(i * x / (float)CHUNK_SIZE_WIDTH, i * y / (float)CHUNK_SIZE_HEIGHT, CHUNK_SIZE_WIDTH, CHUNK_SIZE_HEIGHT); val += n / i; } // chunk tile at [index] gets set to the colour 'val' } } } Which produces something like this: Each chunk is made up of CHUNK_SIZE number of tiles, and each tile has a TILE_SIZE_WIDTH/HEIGHT. I think it has something to do with the inner-most for loop and the x/y co-ords given to the noise function, but I could be wrong. Solved: PerlinNoise noise = new PerlinNoise(); for (Chunk chunk : chunks) { for (int y = 0; y < CHUNK_SIZE_HEIGHT; ++y) { for (int x = 0; x < CHUNK_SIZE_WIDTH; ++x) { int index = get1DIndex(y, CHUNK_SIZE_WIDTH, x); float val = 0; float xx = x * TILE_SIZE_WIDTH + chunk.x; float yy = y * TILE_SIZE_HEIGHT + chunk.h; int w = CHUNK_SIZE_WIDTH * TILE_SIZE_WIDTH; int h = CHUNK_SIZE_HEIGHT * TILE_SIZE_HEIGHT; for (int i = 2; i <= 32; i *= i) { double n = noise.tileableNoise2(i * xx / (float)w, i * yy / (float)h, w, h); val += n / i; } // chunk tile at [index] gets set to the colour 'val' } } }

    Read the article

  • Standalone server setup for compute capacity

    - by mikera
    I'm developing an application for my company that will require a lot of compute capacity (running some very big mathematical calculations), and looking for some form of server setup to do this. For various reasons, we want to run this on-site in our office rather than hosting it externally. It's been a while since I last had to set up my own servers so I thought I would tap into the collective wisdom of serverfault! My broad requirements are: Budget $30-50k, with an aim to get as much compute capacity as possible for that budget 64-bit servers suitable to run Ubuntu Linux + Java Some relatively standalone rack that can be installed in secure office space Fast/low latency network connections between the servers, but don't really care about connectivity to the outside world Storage capacity shared between the servers - they don't necessarily need their own storage providing they can be booted from a common image Downtime can be tolerated (since the calculations are run in batch mode) The software itself is fault-tolerant, so there is no need for extra resiliency in the server setup (cheap replaceable commodity parts will be fine in general) Given these requirements what kind of setup would you recommend and why?

    Read the article

  • Using a javax.servlet.Filter with Compojure

    - by mikera
    I'm trying to build a simple web site using Clojure / Compojure and want to feed apply a servlet filter to the request / response (i.e. a standard javax.servlet.Filter instance). e.g. if the current source code is: (defroutes my-app (GET "/*" (html [:h1 "Hello Foo!!"])) ) I would like to add a filter like this: (defroutes my-app (GET "/*" (FILTER my-filter-name (html [:h1 "Hello Foo!!"]))) ) Where my-filter-name is some arbitrary instance of javax.servlet.Filter. Any idea how to do this effectively and elegantly?

    Read the article

  • Overriding equals, hashCode and toString in a Clojure deftype

    - by mikera
    I'm trying to create a new type in Clojure using deftype to implement a two dimensional (x,y) coordinate, which implements a "Location" protocol. I'd also like to have this implement the standard Java equals, hashCode and toString methods. My initial attempt is: (defprotocol Location (get-x [p]) (get-y [p]) (add [p q])) (deftype Point [#^Integer x #^Integer y] Location (get-x [p] x) (get-y [p] y) (add [p q] (let [x2 (get-x q) y2 (get-y q)] (Point. (+ x x2) (+ y y2)))) Object (toString [self] (str "(" x "," y ")")) (hashCode [self] (unchecked-add x (Integer/rotateRight y 16))) (equals [self b] (and (XXXinstanceofXXX Location b) (= x (get-x b)) (= y (get-y b))))) However the equals method still needs some way of working out if the b parameter implements the Location protocol. What is the right approach? Am I on the right track?

    Read the article

  • Optimizing processing and management of large Java data arrays

    - by mikera
    I'm writing some pretty CPU-intensive, concurrent numerical code that will process large amounts of data stored in Java arrays (e.g. lots of double[100000]s). Some of the algorithms might run millions of times over several days so getting maximum steady-state performance is a high priority. In essence, each algorithm is a Java object that has an method API something like: public double[] runMyAlgorithm(double[] inputData); or alternatively a reference could be passed to the array to store the output data: public runMyAlgorithm(double[] inputData, double[] outputData); Given this requirement, I'm trying to determine the optimal strategy for allocating / managing array space. Frequently the algorithms will need large amounts of temporary storage space. They will also take large arrays as input and create large arrays as output. Among the options I am considering are: Always allocate new arrays as local variables whenever they are needed (e.g. new double[100000]). Probably the simplest approach, but will produce a lot of garbage. Pre-allocate temporary arrays and store them as final fields in the algorithm object - big downside would be that this would mean that only one thread could run the algorithm at any one time. Keep pre-allocated temporary arrays in ThreadLocal storage, so that a thread can use a fixed amount of temporary array space whenever it needs it. ThreadLocal would be required since multiple threads will be running the same algorithm simultaneously. Pass around lots of arrays as parameters (including the temporary arrays for the algorithm to use). Not good since it will make the algorithm API extremely ugly if the caller has to be responsible for providing temporary array space.... Allocate extremely large arrays (e.g. double[10000000]) but also provide the algorithm with offsets into the array so that different threads will use a different area of the array independently. Will obviously require some code to manage the offsets and allocation of the array ranges. Any thoughts on which approach would be best (and why)?

    Read the article

  • Using type hints in Clojure for Java return values

    - by mikera
    I'm working on some Java / Clojure interoperability and came across a reflection warning for the following code: (defn load-image [resource-name] (javax.imageio.ImageIO/read (.getResource (class javax.imageio.ImageIO) resource-name))) => Reflection warning, clojure/repl.clj:37 - reference to field read can't be resolved. I'm surprised at this because getResource always returns a URL and I would therefore expect the compiler to use the appropriate static method in javax.imageio.ImageIO/read. The code works fine BTW so it is clearly finding the right method at run time. So two questions: Why is this returning a reflection warning? What type hint do I need to fix this?

    Read the article

  • Controlling symbol generation in Clojure macros

    - by mikera
    I'm trying (as a self-learning exercise) to create a Clojure macro that will generate code to apply a function to a sequence of integers and sum the result, e.g. f(0) + f(1) + f(2) + f(3) This is my attempt: (defmacro testsum [func n] `(fn [x#] (+ ~@( map (fn [i] `(~func x#)) (range n))))) However something seems to go wrong with the x# gensym and I end up with two different versions of x and hence the function doesn't work: (macroexpand '(testsum inc 3)) gives: (fn* ([x__809__auto__] (clojure.core/+ (inc x__808__auto__) (inc x__808__auto__) (inc x__808__auto__)))) This is pretty much exactly what I want apart from the different 809 and 808 versions of x..... What am I doing wrong? I thought that the auto gensym was meant to create a single unique symbol for exactly this kind of purpose? Is there a better way of doing this?

    Read the article

  • Idiomatic approach for structuring Clojure source code

    - by mikera
    I'm interested in how people structure their Clojure source code. Being used to Java, I'm pretty familiar with the paradigm of one class per source code file, bundling all the data and method definitions with appropriate comments and annotations etc. However Clojure offers a lot more flexibility, and I'm not sure how I should structure my project (likely to end up as a medium sized app, maybe 5,000 lines with three or four distinct subsystems) In particular I'm wrestling with: What guidelines should I use to determine whether code should be in a single namespace vs. separated out into different namespaces? Should each protocol/datatype have it's own namespace + source file with associated set of functions? When should I require vs. use other namespaces?

    Read the article

  • Ref to map vs. map to refs vs. multiple refs

    - by mikera
    I'm working on a GUI application in Swing+Clojure that requires various mutable pieces of data (e.g. scroll position, user data, filename, selected tool options etc.). I can see at least three different ways of handling this set of data: Create a ref to a map of all the data: (def data (ref { :filename "filename.xml" :scroll [0 0] })) Create a map of refs to the individual data elements: (def datamap { :filename (ref "filename.xml") :scroll (ref [0 0]) })) Create a separate ref for each in the namespace: (def scroll (ref [0 0])) (def filename (ref "filename.xml")) Note: This data will be accessed concurrently, e.g. by background processing threads or the Swing event handling thread. However there probably isn't a need for consistent transactional updates of multiple elements. What would be your recommended approach and why?

    Read the article

  • Strange behaviour of keywords within macros in Clojure

    - by mikera
    I'm a little confused by how keyword accesses seem to behave in Clojure when they are evaluated at macro expansion time. The following works as I expect: (def m {:a 1}) (:a m) => 1 However the same keyword access doesn't seem to work within a macro: (def m {:a 1}) (defmacro get-a [x] (:a x)) (get-a m) => nil Any idea what is going on here?

    Read the article

  • Dynamically generating high performance functions in clojure

    - by mikera
    I'm trying to use Clojure to dynamically generate functions that can be applied to large volumes of data - i.e. a requirement is that the functions be compiled to bytecode in order to execute fast, but their specification is not known until run time. e.g. suppose I specify functions with a simple DSL like: (def my-spec [:add [:multiply 2 :param0] 3]) I would like to create a function compile-spec such that: (compile-spec my-spec) Would return a compiled function of one parameter x that returns 2x+3. What is the best way to do this in Clojure?

    Read the article

  • Updating an atom with a single value

    - by mikera
    I have a number of atoms in my code where a common requirement is to update them to a new value, regardless of the current value. I therefore find myself writing something like this: (swap! atom-name (fn [_] (identity new-value))) This works but seems pretty ugly and presumably incurs a performance penalty for constructing the anonymous closure. Is there a better way?

    Read the article

  • Adding fields to a proxied class in Clojure

    - by mikera
    I'm using "proxy" to extend various Swing classes in a Clojure GUI application, generally with code that looks something like: (def ^JPanel mypanel (proxy [JPanel] [] (paintComponent [#^Graphics g] (.drawImage g background-image 0 0 nil)))) This works well but I can't figure out how to add additional fields to the newly extended class, for example making the background-image a field that could be subsequently updated. This would be pretty easy and common practice in Java. Is there a good way to do this in Clojure? Or is there another preferred method to achieve the same effect?

    Read the article

  • JUnit unable to find tests in Eclipse

    - by mikera
    I have a strange issue with JUnit 4 tests in Eclipse 3.5 that I couldn't solve - any hints gratefully received! Initially: I had a test suite working properly, with 100+ tests all configured with JUnit 4 annotations. I'd run these typically by right clicking on my source folder and selecting "Run as JUnit test". All worked perfectly. Now: When I try to run the test messages all I get is an error "No tests found with test runner 'JUnit 4'". Any idea what is happening? I simply can't work out what could have changed to make this fail. My guess is that it is some configuration issue based on the build path or class path?

    Read the article

  • Type hinting for functions in Clojure

    - by mikera
    I'm trying to resolve a reflection warning in Clojure that seems to result from the lack of type inference on function return values that are normal Java objects. Trivial example code that demonstrates the issue: (set! *warn-on-reflection* true) (defn foo [#^Integer x] (+ 3 x)) (.equals (foo 2) (foo 2)) => Reflection warning, NO_SOURCE_PATH:10 - call to equals can't be resolved. true What is the best way to solve this? Can this be done with type hints?

    Read the article

  • Extending a Java Swing class in Clojure

    - by mikera
    I'm trying to extend a Java Swing component in Clojure, i.e. I want to extend a javax.swing.JComponent and add some custom methods implemented in pure Clojure in addition to all the standard inherited methods. I've tried using "proxy" which works great if I just want a single instance (in the same way as an anonymous inner class). However I'd really like a named class so that I can generate an arbitrary number of instances. What's the recommended way of doing this?

    Read the article

1