Speeding up `using Distributions` in Julia - julia

On my machine, with the development version of Julia, the command import Distributions takes 6.6 seconds. Is there a way to make this faster? Is static precompilation going to be part of Julia 0.4?
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.4.0-dev+4603 (2015-05-02 18:25 UTC)
_/ |\__'_|_|_|\__'_| | Commit 803193e* (17 days old master)
|__/ | x86_64-unknown-linux-gnu
julia> tic(); import Distributions; toc()
elapsed time: 6.62282982 seconds
6.62282982

Static precompilation might happen for Julia 0.4, not 100% clear yet if it'll make it in.
If you'd like to do it somewhat manually by baking it into your "system image", check out the handy package SystemImageBuilder.jl.

Related

Failing to start grakn

I'm trying to start grakn but it fails :
grakn server start
====================================================================================================
________ _____ _______ __ __ __ __ _______ _______ _____ _______
| __ || _ \ | _ || | / /| \ | | | _ || _ || _ \ | ____|
| | |__|| | | | | | | || | / / | \ | | | | |__|| | | || | | | | |
| | ____ | |_| / | |_| || |/ / | \| | | | | | | || |_| / | |____
| ||_ || _ \ | _ || _ \ | _ | | | __ | | | || _ \ | ____|
| |__| || | \ \ | | | || | \ \ | | \ | | |_| || |_| || | \ \ | |____
|________||__| \__\|__| |__||__| \__\|__| \__| |_______||_______||__| \__\|_______|
THE KNOWLEDGE GRAPH
====================================================================================================
Version: 1.8.3
Starting Storage....FAILED!
Unable to start Storage.
Process exited with code '1': 'Unrecognized VM option 'CrashOnOutOfMemoryError'
Did you mean 'OnOutOfMemoryError=<value>'?
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
'
An error has occurred during boot-up. Please run 'grakn server status' or check the logs located under the 'logs' directory.
Process exited with code '1': 'Unrecognized VM option 'CrashOnOutOfMemoryError'
Did you mean 'OnOutOfMemoryError=<value>'?
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
'
The most likely cause of this error is that you have an incompatible Java version installed.
You can check the Java version by running java -version in a terminal window.
Grakn 1.8 requires at least version 1.8.0_92 of Java to run.
See also https://github.com/graknlabs/grakn/issues/5267 for more discussion on this topic.

Julia: unintended extension of base functions

I have the following, incomplete Julia code:
mutable struct Env
end
function step(env, action:UInt32)
return ones(8), 1.0, true, Dict()
end
function reset(env)
return ones(8)
end
When I try to use it, I get the following errors:
LoadError: error in method definition: function Base.step must be
explicitly imported to be extended
LoadError: error in method definition: function Base.reset must be
explicitly imported to be extended
I don't know what Base.step and Base.reset are, and I don't want to extend them.
Is there some way for me to keep these function names without extending the base functions? If I do just extend the base functions with my completely unrelated methods, are there going to be problems?
I really do not want to change the names of my functions because I want to keep them in line with the OpenAI Gym API.
Define them inside a module like this
module Gym
mutable struct Env
end
function step(env, action::UInt32)
return ones(8), 1.0, true, Dict()
end
function reset(env)
return ones(8)
end
end
Then you can call them directly as step and reset inside the module. Outside the module you have to qualify them like this: Gym.step and Gym.reset.
Additionally - note that you get this problem only after you introduce step and reset in Main module before trying to extend them (e.g. by calling or referencing them). So when starting a clean Julia session this will work:
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.0.2 (2018-11-08)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> step(x) = x
step (generic function with 1 method)
but this will fail:
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.0.2 (2018-11-08)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> step
step (generic function with 4 methods)
julia> step(x) = x
ERROR: error in method definition: function Base.step must be explicitly imported to be extended

How do you access the conv function in Julia 1.0.0

This question on stackoverflow uses Julia 0.6.1, as shown here:
The convolution function in Julia has the following behaviour:
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: https://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.6.1 (2017-10-24 22:15 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu
julia> conv([1,2,NaN],[1])
3-element Array{Float64,1}:
NaN
NaN
NaN
The same thing in Julia 1.0.0 produces the following Error output:
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.0.0 (2018-08-08)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> conv([1,2,NaN],[1])
ERROR: UndefVarError: conv not defined
Stacktrace:
[1] top-level scope at none:0
How does one access the conv function in Julia 1.0.0?
The convolution function has been moved to the package DSP.jl which stands for Digital Signal Processing.
It is generally recommended to use Julia v0.7 when trying to port pre v0.7 code to Julia v1.0. In fact, this is the only reason v0.7 exists.
When calling conv in v0.7 you get all the information you need:
julia> conv(rand(10))
ERROR: conv has been moved to the package DSP.jl.
Run `Pkg.add("DSP")` to install it, restart Julia,
and then run `using DSP` to load it.
In case you'd want to avoid running v0.7 on you machine just to find out where something has been moved to, you can also search for the old function's name in deprecated.jl. Searching for conv we find:
for f in [:conv, :conv2, :deconv, :filt, :filt!, :xcorr]
#eval Base.#deprecate_moved $f "DSP"
end
Although source code, I believe #deprecate_moved "DSP" is understandable.

WebStorm: New AngularCli Project: Error: directory should match format "path"

When I try to create a new Angular Cli project:
receive this message (in Run window) after a few seconds after executing ng new angularcli --dir=. command by IDE:
"C:\Program Files\nodejs\node.exe" C:\Users\I\AppData\Roaming\npm\node_modules\#angular\cli\bin\ng new angularcli --dir=.
Error: Schematic input does not validate against the Schema: {"directory":".","name":"angularcli","skipGit":false,"style":"css","version":"1.7.3","commit":{"message":"chore: initial commit from #angular/cli\n\n _ _ ____ _ ___\n / \\ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|\n / △ \\ | '_ \\ / _\\` | | | | |/ _\\` | '__| | | | | | |\n / ___ \\| | | | (_| | |_| | | (_| | | | |___| |___ | |\n/_/ \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_| \\____|_____|___|\n |___/\n","name":"Angular CLI","email":"angular-cli#angular.io"},"path":"app","sourceDir":"src","inlineStyle":false,"inlineTemplate":false,"routing":false,"prefix":"app","skipTests":false,"skipInstall":false,"linkCli":false,"minimal":false,"serviceWorker":false}
Errors:
.directory should match format "path"
Schematic input does not validate against the Schema: {"directory":".","name":"angularcli","skipGit":false,"style":"css","version":"1.7.3","commit":{"message":"chore: initial commit from #angular/cli\n\n _ _ ____ _ ___\n / \\ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|\n / △ \\ | '_ \\ / _\\` | | | | |/ _\\` | '__| | | | | | |\n / ___ \\| | | | (_| | |_| | | (_| | | | |___| |___ | |\n/_/ \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_| \\____|_____|___|\n |___/\n","name":"Angular CLI","email":"angular-cli#angular.io"},"path":"app","sourceDir":"src","inlineStyle":false,"inlineTemplate":false,"routing":false,"prefix":"app","skipTests":false,"skipInstall":false,"linkCli":false,"minimal":false,"serviceWorker":false}
Errors:
.directory should match format "path"
Done
Similarly on Mac:
It seems to be relevant to this part of the command: --dir=.. But I don't know why and how to correct it!
(I know that I can create a new project via command line independently and then open it in WebStorm, but don't want this for some reasons.)
it's a known cli 1.7.x issue - https://github.com/angular/angular-cli/issues/9655; unfortunately we have been unable to fix it on our end so far... We are working with Angular team on this, please follow WEB-31291 for updates.
As a workaround, you can try creating new angular app in terminal using ng new <project_name> and then opening the generated project folder in WebStorm
Do not include project name special characters. for example this is wrong: www_testProject.
This is correct: wwwTestProject
I have this issue, But I got a solution which is works for me is:
New project names must start with a letter, and must contain only alphanumeric characters or dashes. When adding a dash the segment after the dash must also start with a letter.
Invalid- new_something
Valid- new-something
According to my last test, there is no problem. I upgraded my tools (Angular CLI v7.1.4 and WebStorm v2018.3.2):

docker - multiple projects on one Dockerfile and docker-compose.yml

I'm starting with Docker and in my opinion is great! Now I'm looking solution for this organization:
Now I have this structure:
Applications
| +--app1
| | +--node_modules
| | +--package.json
| | +--...
| +--app2
| | +--node_modules
| | +--package.json
| | +--...
| ....
| docker-compose.app1.yml
| docker-compose.app2.yml
| ....
| Dockerfile //my personalized image for all projects
But I want reach this:
Applications
| +--app1
| | +--node_modules //empty in host
| | +--package.json
| | +--docker-compose.app1.yml //override compose
| | +--...
| +--app2
| | +--node_modules //empty in host
| | +--package.json
| | +--...
| ....
| +--node_modules //global node_modules folder (linked to projects)
| docker-compose.yml //principal compose
| Dockerfile //my personalized image for all projects
I thinking too about create one global "server" and link all projects on VHosts but how I'll get access to each of project?
You are looking for docker-comopose extends. Thas permits you override previus configurations.
web:
extends: file: common-services.yml
service: webapp
See full documentation in : https://docs.docker.com/compose/extends/#extending-services

Resources