Profile

Cover photo
Harold Lee
55 followers|48,368 views
AboutPostsPhotosVideos

Stream

Harold Lee

Shared publicly  - 
 
Adding to a running chain of shell commands
A lot of the time we chain together commands so that the chain stops if any of the commands fails: command1 && command2 && command3 But what if you start command1 and you want to add the rest of the chain without cancelling command1 (which takes a long time...
1
Add a comment...

Harold Lee

Shared publicly  - 
 
Haskell sparse matrices and vectors
Install the Math.LinearAlgebra.Sparse module: cabal install sparse-lin-alg And some simple code to try it out: import Data.Ratio as R
import Math.LinearAlgebra.Sparse as S

-- you could also import Math.LinearAlgebra.Sparse.Vector as V
-- but those function...
1
Add a comment...

Harold Lee

Shared publicly  - 
 
Yesod notes
For the Yesod web framework I found that I needed to add a dependency on data-default-class to the project-name.cabal file (just below the data-default line works nicely) or else it would fail to compile the default project. Here's the error I get without t...
1
Add a comment...

Harold Lee

Shared publicly  - 
 
Flatten a list of optional values in Java 8
Java 8 sticks closer to Haskell than Scala for lists of optionals: you can't just flatMap a function that returns an Optional value and collect all of the values that were present. So I'm finding myself getting the same thing done with filter/map to unpack ...
1
Add a comment...

Harold Lee

Shared publicly  - 
 
Scala for better Android AsyncTasks
The AsyncTask class in Android is there essentially to move data to a background thread for processing and then update the UI in the main thread with the results. Because Scala supports passing around functions as parameters, we can think about the problem ...
1
Add a comment...
Have him in circles
55 people
Michael Friedman's profile photo
Claire Hotelling's profile photo
Lorena Hitchens's profile photo
Matthias Ferber's profile photo
Amankwaah Godfred's profile photo
George Hotelling's profile photo
Jim Nisbet's profile photo
Michael Ortega-Binderberger's profile photo
Eric Kowalchyk's profile photo

Harold Lee

Shared publicly  - 
 
Limiting the heap size with Haskell's cabal
First, add "GHC-Options: -rtsopts" to the .cabal file, to declare at compile/link time that runtime parameters can be passed on the command line: Executable progname
Main-Is: Main.hs
Build-Depends: haskell2010, containers, multimap, matrix, ...
1
Add a comment...

Harold Lee

Shared publicly  - 
 
Use a key to remove duplicate records
If you want to remove duplicate records based on some key field (rather than using toSet), you can use groupBy to find the duplicates and then do some kind of merge/choice to wind up with one value per group. implicit class UniqueBySupport[T](in: Iterable[T...
1
Harold Lee's profile photoBarbara A. Hotelling's profile photo
3 comments
 
Thanks. I'm trying to clean up my duplicate photos and was planning to go
through them 1 by 1. I'm also trying to learn Google+.

Love ya,
Mom
Add a comment...

Harold Lee

Shared publicly  - 
 
Find the scripting engines supported by your JVM using Scala
From a Scala REPL: import collection.JavaConverters._
new javax.script.ScriptEngineManager().getEngineFactories.asScala.map { ef => (ef.getEngineName, ef.getNames) }.toMap For me, that gives Map(AppleScriptEngine -> [AppleScriptEngine, AppleScript, OSA], Or...
1
Add a comment...

Harold Lee

Shared publicly  - 
 
When you tell EasyMock to expect the argument to equal some expected value, it uses the .equals method (check it out for yourself). SomeType something = new SomeType(...); EasyMock.expect(mock.methodN...
1
Add a comment...
People
Have him in circles
55 people
Michael Friedman's profile photo
Claire Hotelling's profile photo
Lorena Hitchens's profile photo
Matthias Ferber's profile photo
Amankwaah Godfred's profile photo
George Hotelling's profile photo
Jim Nisbet's profile photo
Michael Ortega-Binderberger's profile photo
Eric Kowalchyk's profile photo
Links
YouTube
Other profiles
Contributor to
Basic Information
Gender
Male