Pengin

0

votes
0

answer
4

views

What is the names of controls seen in MS-Office Task Pane?

I'm thinking of developing my own Excel addin with VTSO or native COM addin. Does anyone know what is the names of controls seen in task panes in MS-Office, like seen in attachment? I thought it is CMFCTasksPane, but it turns out different.
Pengin
1

votes
2

answer
1.7k

views

Scala state monad in for comprehension

I'm studying Michael Pilquist's excellent state monad lecture here. I get stuck at 54 min with two questions. If ofs is an Option[FollowerStats], what is the ? operator? I can't find a ternary operator on Option in Scala 2.10.2 How does the last generator put an updated cache (with hit or miss inc...
Pengin
2

votes
1

answer
526

views

Spark on NUMA systems

I'm considering Apache Spark for data analysis. In the past I've experienced Java/Scala slowdowns on 4-socket servers due to NUMA architecture and objects being local to a single node. The solution was to start a separate pinned JVM for each NUMA node and have them talk to each other using Akka. H...
Pengin
5

votes
7

answer
3.6k

views

Condor, Sun Grid Engine, or something else?

I'm trying to work out whether we should try out Condor or Sun Grid Engine at work (or possibly something else). We often have lots of unused WinXp workstations. The hope is that we could use wake-on-LAN, run all our jobs, and then shut down automatically. We'd mainly be running Matlab, Java or Py...
Pengin
5

votes
1

answer
255

views

Scala return type when extending collection

If I write class Things extends scala.collection.immutable.HashSet[Int] new Things + 5 Then the result is res0: scala.collection.immutable.HashSet[Int] = Set(5) What do I need to do for the result to be of type Things? I suspect the answer might be here, but am struggling to understand what's going...
Pengin
5

votes
1

answer
9.5k

views

Scala and Mockito with traits

I had a simple class that naturally divided into two parts, so I refactored as class Refactored extends PartOne with PartTwo Then the unit tests started failing. Below is an attempt to recreate the problem. The functionality of all three examples is the same, but the third test fails with a NullPoin...
Pengin
5

votes
5

answer
768

views

How to build/test Scala without IDE dependence?

I'm well into learning Scala now and enjoying it very much; I hope to start future projects in it, rather than Java. What I'm enjoying less is the (relatively) poor IDE support. I've found both IDEA and Eclipse with the Scala Plugin (including nightly builds) to be a bit unreliable or difficult to...
Pengin
20

votes
2

answer
12.9k

views

How to call functions in the original page(tab) in Chrome Extensions

I'm now making a Chrome Extension. I want to call JS functions that are defined in the original page (tab), from Chrome Extension. It doesn't matter whether background.html or Content_Script calls them. For example: Original page (tab) Original Page function greeting(){ alert("Ohayou!"); // some oth...
Pengin
6

votes
5

answer
1.6k

views

Extending Scala collections: One based Array index exercise

As an exercise, I'd like to extend the Scala Array collection to my own OneBasedArray (does what you'd expect, indexing starts from 1). Since this is an immutable collection, I'd like to have it return the correct type when calling filter/map etc. I've read the resources here, here and here, but am...
Pengin
1

votes
3

answer
419

views

geom_density with alpha vector

I'd like to plot several distributions with geom_density, and have all but one of them faded out. How can I do this, as the following doesn't change the alpha as expected. require("ggplot2") data = rbind( data.frame(generation=1, samples=rnorm(90)), data.frame(generation=2, samples=rnorm(100)), dat...
Pengin
11

votes
2

answer
4.7k

views

ggplot2 legend for stat_summary

How can I create a legend informing that the red cross is the mean? ggplot(results, aes(x=factor, y=proportionPositive)) + geom_boxplot() + stat_summary(fun.data = "mean_cl_normal", colour = "red", shape=4)
Pengin
12

votes
2

answer
8.7k

views

ggplot2 axis transformation by constant factor

In a ggplot2 density plot (geom_density) I have the following y-axis labels 0.000 0.005 0.010 0.015 0.020 What is the correct way to change them to something like 0 5 10 15 20 possibly with the automatic adding of "10^3 x density" to the label. In the past I've just multiplied my data and manually...
Pengin
5

votes
6

answer
1.1k

views

Scala, make my loop more functional

I'm trying to reduce the extent to which I write Scala (2.8) like Java. Here's a simplification of a problem I came across. Can you suggest improvements on my solutions that are "more functional"? Transform the map val inputMap = mutable.LinkedHashMap(1->'a',2->'a',3->'b',4->'z',5->'c') by discard...
Pengin
3

votes
2

answer
1.2k

views

Install R packages from binary in Ubuntu Lucid

I've installed R in Ubuntu Lucid with the command sudo aptitude install r-base When I try to "install.packages" it seems to download source and then spend ages compiling it. How can I get it to just download and install the binaries, like I'm used to on Windows? Is there any need to compile the p...
Pengin
4

votes
1

answer
1.1k

views

Short term Akka deployment on multiple nodes

I'm writing a distributed research application with Akka using a simple master and multiple worker topology, with the aim of deploying to an internal cluster of nodes or within a corporate cloud. (When Akka 2.1 becomes available I'll look into using clustering support) My question: What is the simp...
Pengin
2

votes
2

answer
306

views

Can Hadoop be restricted to spare CPU cycles?

Is it possible to run Hadoop so that it only uses spare CPU cycles? I.e. would it be feasible to install Hadoop on peoples work machines so that number crunching can be done when they are not using their PCs, and they wouldn't experience an obvious performance drain (whurring fans aside!). Perhaps...
Pengin
3

votes
3

answer
1.3k

views

Java Generalized Linear Model Library [closed]

I'm trying to port some R code to Java/Scala and need an equivalent of the glm function . Are there any Java/Scala libraries to solve a Generalized Linear Model with quasi-poisson errors and log link function? So far I've found: Suanshu, but can't work out how to get the hat matrix. This questio...
Pengin
4

votes
1

answer
1.3k

views

Combine Akka config with my config

I'm writing an Akka microkernel application, and would like to have it determine it's own host IP using java.net.InetAddress.getLocalHost.getHostAddress. If this call succeeds then I'd use the address for the property akka.remote.netty.hostname, but if not I'll fall back to a value in the applicati...
Pengin
3

votes
2

answer
607

views

Instance of trait throws null pointer

Why does a null pointer exception occur in the code below? object Test extends App{ trait MyTrait[A]{ self => val seq: Seq[A] val size = seq.size // null pointer here } val p = new MyTrait[Int]{ val seq = Seq(1,2,3) } } If I change the size field to lazy then it's ok.
Pengin
2

votes
2

answer
424

views

Match Error on List.collect

What's wrong with the second implementation? Works: scala> List(1,2,3).collect{ case i: Int if i % 2 == 0 => i } res1: List[Int] = List(2) Doesn't: scala> val evens = PartialFunction[Any, Int]{ | case i: Int if i % 2 == 0 => i | } evens: PartialFunction[Any,Int] = scala> List(1,2,3).collect{evens}...
Pengin
3

votes
2

answer
790

views

Using Scala to cut up a large CSV file

What's the best way to do file IO in Scala 2.8? All I want to do is cut a massive CSV file into lots of smaller ones with, say 1000 lines of data per file, and each file retaining the header.
Pengin
1

votes
2

answer
733

views

Running Eclipse Scala Plugin with previous version of Scala

The scala plugin seems to automatically download version 2.8 of Scala. I'l like to try out the Gridgain 3.0-beta, which currently only works with Scala 2.7.7. Since Gridgain 3.0-beta already provides scala-compiler-2.7.7.jar and scala-library-2.7.7.jar, is it possible to get the Eclipse Scala Plug...
Pengin
4

votes
2

answer
763

views

Java - Python shared memory communication

We have one program in Java and one in Python, and need to get them taking together in a ping-pong manner, each time exchanging an integer array of length 100,000, and taking ~ 0.1 - 1 second to do their work: Java does some work and fires an int array of length 100,000 over to ... Python, which do...
Pengin
2

votes
1

answer
176

views

Type alias for immutable collections

What is the best way to resolve the compilation error in the example below? Assume that 'm' must be of type GenMap and I do not have control over the arguments of myFun. import scala.collection.GenMap object Test { def myFun(m: Map[Int, String]) = m val m: GenMap[Int, String] = Map(1 -> "One", 2 ->...
Pengin
1

votes
4

answer
424

views

Thread safety warnings

I'm using org.apache.commons.math3.distribution.NormalDistribution in a large distributed Scala & Akka application. During debugging I found sample() was occasionally returning NaN, which propagated silently and caused threads to hang in org.apache.commons.math3.ode.nonstiff.DormandPrince853Integra...
Pengin
7

votes
1

answer
823

views

NUMA awareness of JVM

My question concerns the extent to which a JVM application can exploit the NUMA layout of a host. I have an Akka application in which actors concurrently process requests by combining incoming data with 'common' data already loaded into an immutable (Scala) object. The application scales well in t...
Pengin
6

votes
2

answer
2.4k

views

Why is sbt quitting when using fish?

I'm trying to get sbt running using the fish shell. #!/usr/local/bin/fish java -Xmx512M -jar (dirname (status -f))/sbt-launch-0.7.4.jar "$argv" When I call sbt I get the following [info] Building project MyProject 1.0 against Scala 2.8.1 [info] using MyProject with sbt 0.7.4 and Scala 2.7.7 [i...
Pengin
4

votes
2

answer
810

views

Test if actor sender was local or remote

I need to determine whether the sender of a message was one of the local or remote actors in the Akka cluster. At present the only way I've found to do this is def isLocal(sndr: ActorRef) = sndr.path.address.toString == context.system.toString What's a better way? I'm using Akka 2.3 Update: To expl...
Pengin
8

votes
2

answer
2.2k

views

Git status slow on VMWare guest but not host

I am running an Ubuntu Lucid guest inside VMWare Player on a Windows XP machine, using a shared folder. git status is slow in the VM (24 seconds) but fast on the host machine (0.06 seconds) Any idea why? More details: My repo is about 620 MB (obtained by doing du -hs . in the guest OS) I've tried...
Pengin
3

votes
1

answer
327

views

Chaining Scalaz Lens set operations

I'm trying to learn scalaz7 lenses. Is there a better way to chain set operations? case class Outer(left: Inner, right: Inner) case class Inner(top: Int, bottom: Int) val left = Lens.lensu[Outer, Inner]( (o,v) => o.copy(left = v), _.left ) val right = Lens.lensu[Outer, Inner]( (o,v) => o.copy(righ...
Pengin
8

votes
1

answer
2.5k

views

Spark forcing log4j

I have trivial spark project in Scala and would like to use logback, but spark/hadoop seems to be forcing log4j on me. This seems at odds with my understanding of the purpose of slf4j; is it not a oversight in spark/hadoop? Do I have to give up on logback and use log4j, or is there a workaround?...
Pengin
7

votes
1

answer
298

views

Run tests in broken project using SBT

When doing a serious refactor in a Java Eclipse project I will often break the build, but focus on getting one test to pass at a time. When running the tests Eclipse warns that the project cannot be compiled, but it will still run the tests it can compile. Now I'm using SBT and would like to achiev...
Pengin
5

votes
2

answer
422

views

Unexpected Scala Map type

In Scala (2.10) if I ask for a List(1.0, 2) then I get a List[Double], as expected. But... if I ask for a Map(1.0 -> 'A', 2 -> 'B') I get a Map[AnyVal, Char]. I'd like the keys to be of type Double. Asking for Map[Double, Char](1.0 -> 'A', 2 -> 'B) gives a type mismatch on '2'. This I find m...
Pengin
6

votes
1

answer
175

views

Message equivalent of dependent method types

Thanks to this post I'm getting my head around dependent method types. I have a structure similar to the following trait Environment{ type Population
Pengin
69

votes
1

answer
14.1k

views

Viewing GIT history of moved files

Despite reading lots of other posts regarding GIT and moved files I still struggle to understand how to trace the full history. Doing gitk myfile as suggested here seems to only show history until the previous move. I understand that GIT doesn't track files, only their content. So surely I should...
Pengin
2

votes
0

answer
83

views

How can I parallelize a for-loop through a C++ std::multimap using OpenMP?

I wish to iterate through all the elements in a std::multimap in parallel using OpenMP. I tried to compile the following code using g++-7 (7.2.0) and icpc (18.0.0 20170811), but both failed. Is this possible? If so, how can I parallelize a for-loop through a C++ std::multimap using OpenMP? #include...
Pengin
8

votes
1

answer
1.2k

views

Hibernate CompositeUserType for immutable object

I'm creating a CompositeUserType in hibernate to map EAST and NORTH fields to a Coordinate object. At present my Coordinate object is immutable, and I'd like to keep it that way if possible. I've written my nullSafeGet, pulling the coordinates from the ResultSet and calling the constructor: @Overr...
Pengin
2

votes
1

answer
570

views

Smart way to CMake a project using pybind11 by ExternalProject_Add

I'm writing a python module using pybind11 with CMake 3.9.4. As it is convenience, I wish to download pybind11 source files using ExternalProject_Add in my CMakeLists.txt. When I run cmake ., it does not download pybind11 source files, and throws an error. CMake Error at CMakeLists.txt:21 (add_subd...
Pengin
3

votes
1

answer
165

views

can I force Coq to print parentheses?

I'm new to Coq, working on set-theoretic proof writing. I realized that parentheses are omitted, and it makes difficult for me to read the formula. For example, 1 subgoal A, B : {set T} H : B \subset A ______________________________________(1/1) A :\: A :|: A :&: B = B But I would like Coq to print...
Pengin
2

votes
2

answer
2.9k

views

VMware Fusion and MacbookPro keyboard

I'm running Windows 7 Ultimate (retail) under VMware Fusion on a Macbook Pro. I've created a keyboard layout for the mac using Microsoft keyboard Layout Creator MSKLC. My problem is that when I type the quote or double quote character, nothing happens. Then I press it again and get the character t...
Pengin

View additional