[julia-users] Jupyter notebook extensions

2015-10-19 Thread Daniel Høegh
Hello everyone
I found https://github.com/ipython-contrib/IPython-notebook-extensions, 
which allows you to install some very useful extensions for the Jupyter 
notebook. One of the extension allows for copy pasting cells across 
notebooks and picture into a notebook. I thought I would share the 
knowledge and the installation script I used to install the notebook 
extensions. The installation script do only work if the python distribution 
is Anaconda/Miniconda

using PyCall
if PyCall.conda
using Conda
conda = Conda.conda
else
conda = "conda"
end
dir = mktempdir()
cd(dir) do
run(`git clone 
https://github.com/ipython-contrib/IPython-notebook-extensions`)
run(`$conda install conda-build`)
run(`$conda build IPython-notebook-extensions`)
run(`$conda install --use-local nbextensions`)
end
rm(dir, recursive=true)

After installation go to http://localhost:/nbextensions and activate 
the extensions you like.


Re: [julia-users] Interpolation based on sorted but a priori unknown grid (code review?)

2015-03-23 Thread Daniel Høegh
I know https://github.com/kbarbary/Dierckx.jl can interpolate unstructured data 
into a grid.

[julia-users] Re: debugging "Kernel died" in IJulia

2015-03-26 Thread Daniel Høegh
This looks like issue: https://github.com/JuliaLang/IJulia.jl/issues/286

[julia-users] Re: debugging "Kernel died" in IJulia

2015-03-27 Thread Daniel Høegh
Unfortunately upgrading to 0.3.7 do not solve the problem on my computer:(

[julia-users] Re: debugging "Kernel died" in IJulia

2015-03-29 Thread Daniel Høegh
I installed 0.3.7 removed 0.3.6 and did a Pkg.build("IJulia") in 0.3.7

[julia-users] Re: debugging "Kernel died" in IJulia

2015-03-29 Thread Daniel Høegh
Thank you Big Stone, I removed 0.3.7, Ipython, .julia/0.3 and the .ipython 
folder in my home folder and the installed from fresh and it works:)

Re: [julia-users] Re: GPU-ODE

2015-04-04 Thread Daniel Høegh
To complile it in sysimg you need to use the script in: 
https://github.com/JuliaLang/julia/blob/master/contrib/build_executable.jl I 
have only used it for building a small application.

[julia-users] Precompilation of PyCall and Color reduce PyPlot load time.

2015-04-09 Thread Daniel Høegh
I thought I would share my success with all of you. By making a userimg.jl 
in the julia folder containing the following and building the sysimg with 
the command bellow, the load time of of PyPlot's can be reduced by a factor 
of 3.
>julia -e "tic(); using PyPlot; toc()"
INFO: Loading help data...
elapsed time: 21.096362371 seconds
With custom userimg.jl
>julia -e "tic(); using PyPlot; toc()"
INFO: Loading help data...
elapsed time: 7.611489099 seconds

My userimg.jl contains the following:

## userimg.jl
require("PyCall")
require("Color")
Command for building the sysimg
bin\julia.exe share\julia\build_sysimg.jl --force C:\your_path_here\Julia-
0.3.7\lib\julia\sys native userimg.jl

If `require("PyPlot")` is added to the userimg.jl the sysimg is not usable.

If any of you have ideas for further reducing the load time of PyPlot it 
would be greatly appreciated.


[julia-users] Re: Precompilation of PyCall and Color reduce PyPlot load time.

2015-04-11 Thread Daniel Høegh
If I add 'PyCall.pyinitialize()' after the 'require("PyCall")' then I get the 
following error.
```
error during bootstrap: LoadError(at "sysimg.jl" line 286: LoadError(at 
"C:\Users\Hoegh\Julia-0.3.7_test\share\julia\base\userimg.
jl" line 2: ErrorException("could not load module python: The specified module 
could not be found.
")))
ERROR: failed process: Process(`'C:\Users\Hoegh\Julia-0.3.7_test\bin\julia' -C 
native --build 'C:\Users\Hoegh\Julia-0.3.7_test\lib
\julia\sys0' sysimg.jl`, ProcessExited(1)) [1]
 in error at error.jl:22 (repeats 2 times)
while loading C:\Users\Hoegh\Julia-0.3.7_test\share\julia\build_sysimg.jl, in 
expression starting on line 167
```

[julia-users] Re: julia to excel using libxl

2015-04-15 Thread Daniel Høegh
https://github.com/davidanthoff/ExcelReaders.jl is a wraps of the xlrd Python 
package.

[julia-users] Re: .jl to .exe

2015-04-20 Thread Daniel Høegh
In 0.4 you can use this script: 
https://github.com/JuliaLang/julia/blob/master/contrib/build_executable.jl. It 
compiles the functions in the script to the sysimg and makes an exe file that 
calls a main function.

[julia-users] Error: expected Function, got Int64

2015-05-18 Thread Daniel Høegh
Have you tried to restart the REPL, because I see no problems in running:
function fib_sum_2(x,y,z)
sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)
end
julia> fib_sum_2(3,5,999)
233168


[julia-users] Help to ccall

2015-06-03 Thread Daniel Høegh
Hi I hope someone could help me to understand why my code errors. I am trying 
to wrap this http://pcre.org/current/doc/html/pcre2_substitute.html function 
from the pcre2 library. I am working on latest master as it comes with pcre2. 
My wrap look like:

function my_replace(s::AbstractString, pat::Regex, rep_in)
offset=0
subject = bytestring(s)
rep = bytestring(rep_in)
buffer = Array(UInt8, 256)
re = pat.regex
rc = ccall((:pcre2_substitute_8, Base.PCRE.PCRE_LIB), Cint,
   (Ptr{Void}, Ptr{UInt8}, Csize_t, Csize_t, Cuint, Ptr{Void}, 
Ptr{Void}, Ptr{UInt8}, Csize_t, Ptr{UInt8}, Csize_t),
re, subject, sizeof(subject), offset, pat.match_options, 
pat.match_data,
Base.PCRE.MATCH_CONTEXT, rep, sizeof(rep), buffer, 
sizeof(buffer))

bytestring(pointer(buffer))
end

julia> my_replace("ads10as", r"a(\d+)", "\$1")

Please submit a bug report with steps to reproduce this fault, and any error 
messages that follow (in their entirety). Tha
Exception: EXCEPTION_ACCESS_VIOLATION at 0x65811787 -- pcre2_substitute_8 at  
(unknown line)
pcre2_substitute_8 at C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libpcre2-8.DLL 
(unknown line)
my_replace at none:7
jl_apply_generic at C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libjulia.dll 
(unknown line)
jl_interpret_toplevel_expr at 
C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libjulia.dll (unknown line)
jl_interpret_toplevel_thunk_with at 
C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libjulia.dll (unknown line)
jl_eval_with_compiler_p at 
C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libjulia.dll (unknown line)
jl_toplevel_eval_in at C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libjulia.dll 
(unknown line)
eval_user_input at REPL.jl:62
jlcall_eval_user_input_1356 at  (unknown line)
jl_apply_generic at C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libjulia.dll 
(unknown line)
anonymous at task.jl:91
jl_unprotect_stack at C:\Users\Hoegh\Julia-0.4.0-dev-03-06\bin\libjulia.dll 
(unknown line)


Re: [julia-users] Help to ccall

2015-06-03 Thread Daniel Høegh
Awesome thank you so much, I had missed that the last argument should be a 
pointer to the length and not the length. The working version is:

function my_replace(s::AbstractString, pat::Regex, rep_in)
offset=0
Base.compile(pat)
subject = bytestring(s)
rep = bytestring(rep_in)
buffer = Array(UInt8, 256*2)
re = pat.regex
length = Ref{Csize_t}(sizeof(buffer))
rc = ccall((:pcre2_substitute_8, Base.PCRE.PCRE_LIB), Cint,
   (Ptr{Void}, Ptr{UInt8}, Csize_t, Csize_t, Cuint, Ptr{Void}, 
Ptr{Void}, Ptr{UInt8}, Csize_t, Ptr{UInt8}, Ref{Csize_t}),
re, subject, sizeof(subject), offset, pat.match_options, 
pat.match_data,
Base.PCRE.MATCH_CONTEXT, rep, sizeof(rep), buffer, length)
println(rc)
bytestring(pointer(buffer))
end
my_replace("adsa10as", r"a(\d+)", " \$1 ")

I will probably make a pull to add this functionality to base, if i can get it 
wrapped up nicely.

[julia-users] Re: How to deploy Julia

2015-06-14 Thread Daniel Høegh
You can build an binary executable with this script: 
https://github.com/JuliaLang/julia/blob/master/contrib/build_executable.jl. It 
compiles the scripts main function into Julia's sysimg. I have used it myself 
to distribute a small program.

[julia-users] Runtime inference of a function's return type

2015-06-23 Thread Daniel Høegh
You can use Julia's type inference as: 

Base.return_types(max,(Int, Float64))

But remember if the function contains any global non-constant variables the 
function will most likely return any.

[julia-users] pyinitialize() fails with "Error: could not load module python: no error"

2015-07-07 Thread Daniel Høegh
The main problem is how python xy registers the python installation. I switched 
from the python xy to the anaconda python distribution a year ago to get python 
working with julia and I have had no problems since.

[julia-users] Re: Error precompiling on Windows 64 (julia 0.4.0 and 0.4.6)

2016-07-22 Thread Daniel Høegh
You could try to run Julia with the `--inline=no` flag to see if you get more 
debug information.

[julia-users] Goto code

2016-07-31 Thread Daniel Høegh
Hi the goto needs to be defined within a function. The following works as 
intended

julia> function test()
h=-1

   @label p

   h+=1

   if h<3
   @goto p
   end

   println("Done")
   end
test (generic function with 1 method)

julia> test()
Done

[julia-users] memory allocation in matrix operations

2016-09-02 Thread Daniel Høegh
For your information the foo3 function do not give the correct answer, it 
simply assign the norm of each column to all rows in the column. Hence foo4 is 
the fastest and give the correct result as foo3 do not perform the same amount 
of calculations.

[julia-users] Could not spawn `start /min python -c "print('test')"`

2014-08-26 Thread Daniel Høegh
Hi julia-users,

This is a Windows specific question,
I would like to excute the following:
run(`start /min Ipython`)
It should open a program in minimized state and the proces does not hang 
until the program closes. But I get this error:

could not spawn `start /min Ipython`: no such file or directory (ENOENT)
while loading In[44], in expression starting on line 1
 in _jl_spawn at process.jl:217
 in spawn at process.jl:348

It works in Command Prompt, Python and other programs with a system 
interface in my case ANSYS.

Is this a bug?



Re: [julia-users] Could not spawn `start /min python -c "print('test')"`

2014-08-26 Thread Daniel Høegh
It just feel very unintuitive from a user perspective that it doesn't work as 
in Python, prompt and other programs. Do you then know how to circumvent that 
start doesn't exist / how to get the same effects?


Re: [julia-users] Could not spawn `start /min python -c "print('test')"`

2014-08-27 Thread Daniel Høegh
Thanks Jacob:)


[julia-users] Re: LibCURL does not build...

2014-09-04 Thread Daniel Høegh
I have the exact same problem with LibCURL. I am running Julia 0.3 on 
Windows.

Den onsdag den 3. september 2014 21.21.04 UTC+2 skrev Kevin W Li:
>
> This happened when I Pkg.add("IJulia") from a new Julia 0.3:
>
>
> julia> Pkg.add("IJulia")
> INFO: Installing IJulia v0.1.15
> INFO: Installing JSON v0.3.7
> INFO: Installing REPLCompletions v0.0.3
> INFO: Installing ZMQ v0.1.13
> INFO: Building LibCURL
> ===[ ERROR: LibCURL 
> ]===
>
> None of the selected providers can install dependency libcurl-4.
> Use BinDeps.debug(package_name) to see available providers
> while loading C:\Users\t-wenlli\.julia\v0.3\LibCURL\deps\build.jl, in 
> expression starting on line 13
>
> 
> INFO: Building WinRPM
> INFO: Downloading 
> http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_13.1//repodata/repomd.xml
> INFO: Downloading 
> http://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_13.1//repodata/repomd.xml
> INFO: Building Nettle
> ===[ ERROR: Nettle 
> ]
>
> None of the selected providers can install dependency nettle.
> Use BinDeps.debug(package_name) to see available providers
> while loading C:\Users\t-wenlli\.julia\v0.3\Nettle\deps\build.jl, in 
> expression starting on line 35
>
> 
> INFO: Building ZMQ
> INFO: Building IJulia
> Found IPython version 2.1.0 ... ok.
> Creating julia profile in IPython...
> (Existing KernelManager.kernel_cmd setting in ipython_config.py is 
> untouched.)
> (Existing IPythonWidget.execute_on_complete_input setting in 
> ipython_qtconsole_config.py is untouched.)
> (Existing FrontendWidget.lexer_class setting in 
> ipython_qtconsole_config.py is untouched.)
> (Existing NotebookApp.port setting in ipython_notebook_config.py is 
> untouched.)
> (Existing ipynblogo.png file untouched.)
> (Existing ipynblogo.svg file untouched.)
> (Existing favicon.ico file untouched.)
> (Existing custom.js file untouched.)
> (Existing julia.js file untouched.)
> [ BUILD ERRORS 
> ]
>
> WARNING: LibCURL and Nettle had build errors.
>  - packages with build errors remain installed in 
> C:\Users\t-wenlli\.julia\v0.3
>  - build a package and all its dependencies with `Pkg.build(pkg)`
>  - build a single package by running its `deps/build.jl` script
>
> 
> INFO: Package database updated
>
>
> There seems to be no problem with downloading so it's different to many 
> other problems with were to do with internet connectivity...
>
> I haven't been able to find a solution to this, so any help would be very 
> much appreciated. Thanks!
>
> Kevin
>


[julia-users] Profile.print() dies

2014-09-16 Thread Daniel Høegh
This is a known issue on windows it is fixed on the master and is coming as in 
0.3.1. See issue https://github.com/JuliaLang/julia/issues/8350


[julia-users] Julia 0.3.1 error when installing IJulia

2014-09-26 Thread Daniel Høegh
I have updated Julia to 0.3.1 to get rid of the error regarding profiling. When 
I tried to install IJulia
I encountered an error see the log. I think it is an error in BinDeps but I am 
not sure, can anybody help me?
```
julia> Pkg.add("IJulia")
INFO: Cloning cache of BinDeps from git://github.com/JuliaLang/BinDeps.jl.git
INFO: Cloning cache of HTTPClient from git://github.com/JuliaWeb/HTTPClient.jl.g
it
INFO: Cloning cache of IJulia from git://github.com/JuliaLang/IJulia.jl.git
INFO: Cloning cache of JSON from git://github.com/JuliaLang/JSON.jl.git
INFO: Cloning cache of LibCURL from git://github.com/JuliaWeb/LibCURL.jl.git
INFO: Cloning cache of LibExpat from git://github.com/amitmurthy/LibExpat.jl.git

INFO: Cloning cache of Nettle from git://github.com/staticfloat/Nettle.jl.git
INFO: Cloning cache of REPLCompletions from git://github.com/Keno/REPLCompletion
s.jl.git
INFO: Cloning cache of SHA from git://github.com/staticfloat/SHA.jl.git
INFO: Cloning cache of URIParser from git://github.com/JuliaWeb/URIParser.jl.git

INFO: Cloning cache of URLParse from git://github.com/tanmaykm/URLParse.jl.git
INFO: Cloning cache of WinRPM from git://github.com/JuliaLang/WinRPM.jl.git
INFO: Cloning cache of ZMQ from git://github.com/JuliaLang/ZMQ.jl.git
INFO: Cloning cache of Zlib from git://github.com/dcjones/Zlib.jl.git
INFO: Installing BinDeps v0.3.5
INFO: Installing HTTPClient v0.1.4
INFO: Installing IJulia v0.1.15
INFO: Installing JSON v0.3.8
INFO: Installing LibCURL v0.1.4
INFO: Installing LibExpat v0.0.4
INFO: Installing Nettle v0.1.6
INFO: Installing REPLCompletions v0.0.3
INFO: Installing SHA v0.0.3
INFO: Installing URIParser v0.0.3
INFO: Installing URLParse v0.0.0
INFO: Installing WinRPM v0.1.2
INFO: Installing ZMQ v0.1.13
INFO: Installing Zlib v0.1.7
INFO: Building WinRPM
WARNING: The URLParse.jl package has been deprecated in favour of JuliaWeb/URIPa
rser.jl
https://github.com/JuliaWeb/URIParser.jl
As of Julia 0.4 this package will no longer be installable
through `Pkg.add`. Please convert your code accordingly.
WARNING: skipping repodata/repomd.xml, not in cache -- call WinRPM.update() to d
ownload
WARNING: skipping repodata/repomd.xml, not in cache -- call WinRPM.update() to d
ownload
INFO: Downloading http://download.opensuse.org/repositories/windows:/mingw:/win3
2/openSUSE_13.1//repodata/repomd.xml
INFO: Downloading http://download.opensuse.org/repositories/windows:/mingw:/win3
2/openSUSE_13.1//repodata/ad33f4a5b71009783361067934a560478eeda01c17d4887aad6e91
de3777a0c0-primary.xml.gz
WARNING: encounted invalid data while parsing repomd
===[ ERROR: WinRPM ]


"ErrorException(\"Error parsing document : 0\"), not well-formed (invalid token)
, 1, 1, 1"
while loading C:\Users\Hoegh\.julia\v0.3\WinRPM\deps\build.jl, in expression sta
rting on line 2



INFO: Building LibCURL
INFO: Updating WinRPM package list
INFO: Downloading http://download.opensuse.org/repositories/windows:/mingw:/win3
2/openSUSE_13.1//repodata/repomd.xml
WARNING: encounted invalid data while parsing repomd
===[ ERROR: LibCURL ]===


"ErrorException(\"Error parsing document : 0\"), not well-formed (invalid token)
, 1, 1, 1"
while loading C:\Users\Hoegh\.julia\v0.3\LibCURL\deps\build.jl, in expression st
arting on line 14



INFO: Building Nettle
INFO: Updating WinRPM package list
INFO: Downloading http://download.opensuse.org/repositories/windows:/mingw:/win3
2/openSUSE_13.1//repodata/repomd.xml
WARNING: encounted invalid data while parsing repomd
===[ ERROR: Nettle ]


"ErrorException(\"Error parsing document : 0\"), not well-formed (invalid token)
, 1, 1, 1"
while loading C:\Users\Hoegh\.julia\v0.3\Nettle\deps\build.jl, in expression sta
rting on line 38



INFO: Building ZMQ
INFO: Attempting to Create directory C:\Users\Hoegh\.julia\v0.3\ZMQ\deps\downloa
ds
INFO: Downloading file http://s3.amazonaws.com/julialang/bin/winnt/extras/libzmq
-3.3-x64.zip
  % Total% Received % Xferd  Average Speed   TimeTime Time  Current
 Dload  Upload   Total   SpentLeft  Speed
100  100k  100  100k0 0   153k  0 --:--:-- --:--:-- --:--:--  153k
INFO: Done downloading file http://s3.amazonaws.com/julialang/bin/winnt/extras/l
ibzmq-3.3-x64.zip
INFO: Attempting to Create directory C:\Users\Hoegh\.julia\v0.3\ZMQ
INFO: Directory C:\Users\Hoegh\.julia\v0.3\ZMQ already created
INFO: Attempting to Create directory C:\Users\Hoegh\.julia\v0.3\ZMQ\deps\usr

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Processing archive: C:\Users\Hoegh\.julia\v0.3\ZMQ\deps\downloads\libzmq-3.3-x64

[julia-users] Julia 0.3.1 error when installing IJulia

2014-09-26 Thread Daniel Høegh
My versioninfo is:

julia> versioninfo()
Julia Version 0.3.1
Commit c03f413* (2014-09-21 21:30 UTC)
Platform Info:
  System: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-2630QM CPU @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3


[julia-users] Re: Julia LightTable and path to file

2014-10-06 Thread Daniel Høegh

You can circumvent the problem by inserting this in the top of a 
script/file:
cd(dirname(@__FILE__))



Den søndag den 5. oktober 2014 22.18.55 UTC+2 skrev will ship:
>
> Using readcsv("filename.csv") to get data into an array. 
> This works with iJulia if the files are in the same directory.
> As soon I try the same in LightTable and Juno :: it pops up with errors. 
> I am currently getting round this by specifying the full path, but don't 
> wish to in the future, as it will mean that the code is not portable to 
> another machine.
>
> Am I doing something wrong and is there a way to just have the short path 
> to what I consider the working directory where all the files are?
>
> Thanks in advance
>
> Will
>
>

Re: [julia-users] Re: Not fun

2014-10-06 Thread Daniel Høegh
Would it not make sense to define replace for Int's and ranges like this?
replace(s::String, index::Int, r) = string(s[1:index-1]) * string(r) * 
string(s[index+1:end])
replace(s::String, range::UnitRange{Int}, r) = string(s[1:first(range)-1]) * 
string(r) * string(s[last(range)+1:end])


Re: [julia-users] Re: Not fun

2014-10-06 Thread Daniel Høegh
I know it's slow but is it considered dangerous then please enlighten me. Can 
it not be acceptable to some extend to sacrifice speed to simplicity, people 
will do this trick or maybe worse things.


[julia-users] "using HDF5, JLD" fails suddenly

2014-10-11 Thread Daniel Høegh
It is probably due to this merged pull-request.
https://github.com/JuliaLang/julia/pull/8521

When you are using 0.4 you should not expect that packages is working.


[julia-users] "using HDF5, JLD" fails suddenly

2014-10-11 Thread Daniel Høegh
I think if you update to a new nightly it will work because the library has 
changed to conform to the pull-request.


[julia-users] Re: "using HDF5, JLD" fails suddenly

2014-10-11 Thread Daniel Høegh
Sorry for being unclear. I can see you Julia Dev version is build on the 29 
September, if you download a new build from today's master and install it I 
think it might solve the problem.


[julia-users] change ticklabels in colorbar in PyPlot

2014-10-13 Thread Daniel Høegh
You just need to make sure the ticks you would like is within the range:
using PyPlot 
data = pi*rand(10, 10)
imshow(data,vmin=0, vmax=pi)
cbar = colorbar(ticks=[0, pi])


[julia-users] change ticklabels in colorbar in PyPlot

2014-10-13 Thread Daniel Høegh
I just did the exact same as the example then i got it working and then changed 
it to you example.

using PyPlot 

fig, ax = subplots()
data = pi*rand(10, 10)
cax = ax[:imshow](data,vmin=0, vmax=pi)
cbar = fig[:colorbar](cax, ticks=[0, pi])
cbar[:ax][:set_yticklabels]([ "0", "\$\\pi\$"])


[julia-users] join(("1"," ")) removes the space in the end

2014-10-22 Thread Daniel Høegh


Hi is there a way to concatenate turple of strings that if the last string 
is a space that does not remove it?

join(("1"," "))=="1 "

 


Re: [julia-users] join(("1"," ")) removes the space in the end

2014-10-22 Thread Daniel Høegh


Sorry my mistake I should probably stop programing for to night:)
Den onsdag den 22. oktober 2014 20.07.39 UTC+2 skrev John Myles White:
>
> I suspect Daniel may have thought that join adds "joining" spaces by 
> default: 
>
> julia> length(join(("1"," "))) 
> 2 
>
> julia> length(join(("1"," "), " ")) 
> 3 
>
>  -- John 
>
> On Oct 22, 2014, at 11:05 AM, Stefan Karpinski  > wrote: 
>
> > The space shouldn't be and isn't removed: 
> > 
> > julia> join(("1"," ")) 
> > "1 " 
> > 
> > This seems like something that would not be different in any version of 
> Julia. 
> > 
> > On Wed, Oct 22, 2014 at 2:00 PM, Daniel Høegh  > wrote: 
> > Hi is there a way to concatenate turple of strings that if the last 
> string is a space that does not remove it? 
> > join(("1"," "))=="1 " 
> >   
> > 
> > 
>
>

[julia-users] Re: Multiple Plots with Winston

2014-11-05 Thread Daniel Høegh
When you use labels they should be escaped properly:

xlabel("\$\\sigma\$ [MPa]")
or
xlabel(L"$\sigma$ [MPa]")


[julia-users] Performance confusions on matrix extractions in loops, and memory allocations

2014-11-09 Thread Daniel Høegh
I think the reason why it is slow is due to indexing is making a copy of your 
data and not passed by reference as in python. This behavior is going to change 
in 0.4 where subarrays is introduced then the data is not copied.

You could try it by.
@time v=mat[:,1]; w=mat[:,2]
This should take long time and allocate a lot of memory. 


[julia-users] Re: Performance confusions on matrix extractions in loops, and memory allocations

2014-11-09 Thread Daniel Høegh
I have made a minimum test case:
a=rand(1,2)
function newsum(a)
for i in 1:100
sum(a[:,1])+sum(a[:,2])
end
end
function newsum(a1,a2)
for i in 1:100
sum(a1)+sum(a2)
end
end
@time newsum(a)
@time newsum(a[:,1],a[:,2])
elapsed time: 0.073095574 seconds (17709844 bytes allocated, 23.23% gc time)
elapsed time: 0.006946504 seconds (244796 bytes allocated)

I suggest that a[:,1] is making a copy of the data in the a matrix this is done 
in each iteration of the first function, but in the second function this is 
done only once when the function is called like: newsum(a[:,1],a[:,2]).


Re: [julia-users] example for ccall use and fortran

2014-11-15 Thread Daniel Høegh
I had a problem about this some time ago and I abandoned it because I could not 
get it working and then this discussion actually helped solving the problem 
today.
I have opened an issue on it on Github see 
https://github.com/JuliaLang/julia/issues/9022


[julia-users] Efficiency of julia compiler on a simple program (from a julia newbie)

2014-11-22 Thread Daniel Høegh
By wrapping it in a function as:
function test()
tic()
n = 1
x = 0.234
for i = 1:n
x = max(x*x, 1.0-x*x)
end
println(x)
print("Done.")
toc()
end
test() #jit compilation occurs
test() # timing 0.284217675 s

On my machine the original took 26.96566 s

[julia-users] How to generate subplots with 2D and 3D plots?

2014-11-23 Thread Daniel Høegh
This works:
ax = fig[:add_subplot](2,1,1, projection = "3d")
xgrid = repmat(x',n,1)
ygrid = repmat(y,1,n)
ax[:plot_surface](xgrid, ygrid, z, rstride=2,edgecolors="k", cstride=2, 
cmap=ColorMap("gray"), alpha=0.8, linewidth=0.25)
xlabel("X")
ylabel("Y")
subplot(212) 
ax = fig[:add_subplot](2,1,2)
cp = ax[:contour](xgrid, ygrid, z, colors="black", linewidth=2.0)
ax[:clabel](cp, inline=1, fontsize=10)
xlabel("X")
ylabel("Y")

My greatest source of good examples is always: 
http://matplotlib.org/gallery.html, and there is a good gist that shows how to 
use PyPlot in julia: https://gist.github.com/gizmaa/7214002

[julia-users] Re: Meshgrid in Julia: a working example and possible alternatives

2014-11-25 Thread Daniel Høegh
Here is my solution, there is one problem that i do not understand and hope 
another can explain. When col=20 W is filled with NaN + NaN*im but for col=10 
it work like matlab, I think it is because of overflow.
using PyPlot
col = 10;
m = 400;
cx = -.6;
cy = 0;
l = 1.5;
x = linspace(cx-l,cx + l,m);
y = linspace(cy-l,cy + l,m);
X = repmat(x,1,m)
Y = repmat(y,1,m)'
Z = zeros(m,m);
C = X + im * Y;
W = zeros(Z)
for k = 1:col;
Z = Z.*Z+C
W = exp(-abs(Z));
println(Z[100,100])
end


pcolor(W,cmap=ColorMap("copper"))

By changing the calculation to happen with BigFloats it works. 
Z = zeros(BigFloat, m,m);
pcolor(float64(W),cmap=ColorMap("copper"))

[julia-users] Re: Julia and Microsoft Visual Studio

2014-11-28 Thread Daniel Høegh
I think Julia would benefit from having a MIT licensed scientific IDE written 
in Julia similar to the Spyder project in python. But in short term we maybe 
could leverage the Spyder project, I have hacked a crude implementation of a 
Julia terminal into the Spyder enviroment using the existing Ipython terminal 
see: 
https://bitbucket.org/spyder-ide/spyderlib/pull-request/71/julia-console-for-spyder/diff.
 If anyone would like to continue the work it would be awesome, for the time 
being I don't have time.

[julia-users] Re: Julia and Microsoft Visual Studio

2014-11-28 Thread Daniel Høegh
I think Julia would benefit from having a MIT licensed scientific IDE written 
in Julia similar to the Spyder project in python. But in short term we maybe 
could leverage the Spyder project, I have hacked a crude implementation of a 
Julia terminal into the Spyder enviroment using the existing Ipython terminal 
see: 
https://bitbucket.org/spyder-ide/spyderlib/pull-request/71/julia-console-for-spyder/diff.
 If anyone would like to continue the work it would be awesome, for the time 
being I don't have time.

[julia-users] Re: Julia and Microsoft Visual Studio

2014-11-28 Thread Daniel Høegh
Spyder is a Matlab like IDE with variableexplore, syntax checker, linter, 
debugger and profiler. It's ships with many Python distribution that focus on 
scientific use including WinPython PythonXY and Anaconda. I miss many of the 
features/helpful tools in an IDE. I am sure they will come to Julia with time.

[julia-users] Re: Julia and Microsoft Visual Studio

2014-11-28 Thread Daniel Høegh
Hi Uwe
It's my pull-request but I have not worked on it for a while.

[julia-users] removing function completely?

2014-11-29 Thread Daniel Høegh
Just restart the terminal.

[julia-users] How to remove from Dict separately 1st and 2nd column?

2014-11-30 Thread Daniel Høegh
You need keys and value, they return iterators so call collect on them return a 
vector
a=["a"=>1, "b"=>2]
collect(keys(a))
collect(values(a))

[julia-users] QRPackedQ not properly transposed

2014-12-03 Thread Daniel Høegh
It has been discussed in:https://github.com/JuliaLang/julia/pull/9170

[julia-users] Re: Plot3D with Julia + PyPlot

2014-12-03 Thread Daniel Høegh
I have found a good notebook in https://gist.github.com/gizmaa/7214002

Re: [julia-users] Re: Simple Finite Difference Methods

2014-12-03 Thread Daniel Høegh
   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.3 (2014-11-23 20:19 UTC)
 _/ |\__'_|_|_|\__'_|  |
|__/   |  x86_64-w64-mingw32

julia> Profile.init()
(100,0.001)

julia>

[julia-users] serialize a dictionary gives an error

2014-12-10 Thread Daniel Høegh
I have a dictionary that like:
Dict{ASCIIString,Array{Array{Float64,2},1}} with 83 entries:
It is generated by reading 350 mb of dlm files. I would like to save so it is 
faster reloadable, currently it takes 60s to load from the dlm files. I have 
tried to serialize to save the data.

open("test.bin","w") do file
serialize(file,data_bolt)
end
data_new = deserialize(open("test.bin"))

`convert` has no method matching convert(::Type{Int64...}, ::Int64)
while loading In[22], in expression starting on line 2

 in convert at base.jl:13
 in convert at base.jl:21
 in deserialize at serialize.jl:447
But when I try to deserialize I get an error. Do I do something wrong?
I have tried both MAT and HDF5 and they do not seem to have a convenient way of 
saving my data structure. I hope some of you guys can help, thanks in advance. 

Best regards Daniel Høegh


[julia-users] Re: serialize a dictionary gives an error

2014-12-10 Thread Daniel Høegh
Yes it works when I remove the 0.4 syntax:)
But when you put using PyPlot in the top it does not work:( It's the 
"convertalypse." at https://github.com/JuliaLang/julia/issues/8631

Re: [julia-users] Re: serialize a dictionary gives an error

2014-12-10 Thread Daniel Høegh
Thanks Tim it works.
I really hope someone catch the root of the "convertalypse" soon:)


[julia-users] How save Dict{Any,Int64} ?

2014-12-11 Thread Daniel Høegh
You can serialize it see 
https://groups.google.com/forum/m/?fromgroups#!topic/julia-users/zN7OmKwnG40

Re: [julia-users] Installing packages system-wide

2015-01-09 Thread Daniel Høegh
I have made a pull-request on it. See 
https://github.com/JuliaLang/julia/pull/9699

[julia-users] Speed of Julia when a function is passed as an argument, and a different, but much faster coding.

2015-01-11 Thread Daniel Høegh
I have cooked up a minimum test case of you code that displays the problem. If 
you have the following  

function test1(f, n)
for i=1:n
f(i)
end
end
function test2(n)
for i=1:n
g(i)
end
end
function test3(f, n)
for i=1:n
invoke(f, (Int,), i)
end
end
g(i) = i

test1(g,10)
@time test1(g,10_000_000)
test2(10)
@time test2(10_000_000)
test3(g,10)
@time test3(g,10_000_000)
The output will be:
elapsed time: 0.38846745 seconds (320032108 bytes allocated, 35.61% gc time)
elapsed time: 1.259e-6 seconds (80 bytes allocated)
elapsed time: 0.814524146 seconds (319983728 bytes allocated, 17.09% gc time)

I think it's because the compiler cannot inline the function call to g in the 
loop of test1, due to at next run of test1 f can have changed. this causes it 
to do a function lookup at each loop step. I think this 
https://github.com/JuliaLang/julia/pull/9642 will enhance this property at 
least for test3.

Re: [julia-users] Speed of Julia when a function is passed as an argument, and a different, but much faster coding.

2015-01-11 Thread Daniel Høegh
I should probably be mentioned in 
http://docs.julialang.org/en/latest/manual/performance-tips/. It's also the 
reason for:
f(i) = i
@time map(f, rand(1))
@time [f(i) for i in rand(1)]

where map is very slow compared to the array comprehension.

[julia-users] Re: Error: zeros(UTF8String, 5)

2015-01-16 Thread Daniel Høegh
You can do it with an array comprehension like: ["" for i=1:5]

[julia-users] Re: module PyPlot won't initialize on julia 0.3.5

2015-01-25 Thread Daniel Høegh
If you by "graphics in iJulia" mean the plot opens in its own window, like in 
matlab/python. If you execute `pygui(true)` and then plot something then the 
plot will open in a window.

[julia-users] Startup slow time when built with userimg.jl

2015-02-08 Thread Daniel Høegh
This is also discussed here: https://github.com/stevengj/PyCall.jl/issues/113

[julia-users] Re: line numbers in Jupyter

2015-11-03 Thread Daniel Høegh
Hi

Select the block then press Esc and then hit l-key. You can see all 
shortcuts under Help/Keyboard Shortcuts

Den tirsdag den 3. november 2015 kl. 10.09.50 UTC+1 skrev 2n:
>
>
>
> Is there a way to display line numbers in the code cells in Jupyter 
> notebooks?
>


[julia-users] Re: PyPlot not working on 0.4.0

2015-11-05 Thread Daniel Høegh
This has also been seen https://github.com/stevengj/PyCall.jl/issues/209 
which is actually an upstream problem with the Continuum Analytics conda 
package manager, 
see https://github.com/conda/conda/issues/1753#issuecomment-153550914. I 
can fix it locally by:

using Conda
Conda.add("matplotlib=1.4.0")
Conda.add("pyqt=4.10")


Den torsdag den 5. november 2015 kl. 20.21.16 UTC+1 skrev jda:
>
> I have two windows computers that I am trying to get working.  On one of 
> them a couple of un/re-installations fixed the problem.  But the second 
> computer is still not working.  Here is my session on a fresh install on 
> the second computer:
>
>_
>_   _ _(_)_ |  A fresh approach to technical computing
>   (_) | (_) (_)|  Documentation: http://docs.julialang.org
>_ _   _| |_  __ _   |  Type "?help" for help.
>   | | | | | | |/ _` |  |
>   | | |_| | | | (_| |  |  Version 0.4.0 (2015-10-08 06:20 UTC)
>  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
> |__/   |  x86_64-w64-mingw32
>
> julia> versioninfo()
> Julia Version 0.4.0
> Commit 0ff703b* (2015-10-08 06:20 UTC)
> Platform Info:
>   System: Windows (x86_64-w64-mingw32)
>   CPU: Intel(R) Core(TM)2 Duo CPU E8400  @ 3.00GHz
>   WORD_SIZE: 64
>   BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Penryn)
>   LAPACK: libopenblas64_
>   LIBM: libopenlibm
>   LLVM: libLLVM-3.3
>
> julia> Pkg.add("PyCall")
> INFO: Cloning cache of BinDeps from git://
> github.com/JuliaLang/BinDeps.jl.git
> INFO: Cloning cache of Compat from git://
> github.com/JuliaLang/Compat.jl.git
> INFO: Cloning cache of Conda from git://github.com/Luthaf/Conda.jl.git
> INFO: Cloning cache of Dates from git://github.com/quinnj/Dates.jl.git
> INFO: Cloning cache of JSON from git://github.com/JuliaLang/JSON.jl.git
> INFO: Cloning cache of PyCall from git://github.com/stevengj/PyCall.jl.git
> INFO: Cloning cache of SHA from git://github.com/staticfloat/SHA.jl.git
> INFO: Cloning cache of URIParser from git://
> github.com/JuliaWeb/URIParser.jl.git
>
> INFO: Installing BinDeps v0.3.19
> INFO: Installing Compat v0.7.7
> INFO: Installing Conda v0.1.8
> INFO: Installing Dates v0.4.4
> INFO: Installing JSON v0.5.0
> INFO: Installing PyCall v1.1.2
> INFO: Installing SHA v0.1.2
> INFO: Installing URIParser v0.1.1
> INFO: Building PyCall
> INFO: Precompiling module Compat...
> INFO: Precompiling module Conda...
> INFO: No system-wide Python was found; got the following error:
> could not spawn `python -c "import distutils.sysconfig; 
> print(distutils.sysconfi
> g.get_config_var('VERSION'))"`: no such file or directory (ENOENT)
> using the Python distribution in the Conda package
> INFO: Downloading miniconda installer ...
> INFO: Installing miniconda ...
> Fetching package metadata: 
> Solving package specifications: .
> Package plan for installation in environment C:\Users\user\.julia\v0.4\Con
> da\deps\usr:
>
> The following packages will be downloaded:
>
> package|build
> ---|-
> msvc_runtime-1.0.1 |vc9_0 1.1 MB
> conda-env-2.4.4|   py27_0  64 KB
> numpy-1.10.1   |   py27_023.6 MB
> pyyaml-3.11|   py27_2 167 KB
> requests-2.8.1 |   py27_0 609 KB
> setuptools-18.4|   py27_0 647 KB
> wheel-0.26.0   |   py27_1 116 KB
> conda-3.18.3   |   py27_0 218 KB
> pip-7.1.2  |   py27_0 1.4 MB
> 
>Total:28.0 MB
>
> The following NEW packages will be INSTALLED:
>
> msvc_runtime: 1.0.1-vc9_0   [vc9]
> numpy:1.10.1-py27_0
> pip:  7.1.2-py27_0
> setuptools:   18.4-py27_0
> wheel:0.26.0-py27_1
>
> The following packages will be UPDATED:
>
> conda:3.9.1-py27_0 --> 3.18.3-py27_0
> conda-env:2.1.3-py27_0 --> 2.4.4-py27_0
> pyyaml:   3.11-py27_0  --> 3.11-py27_2
> requests: 2.5.3-py27_0 --> 2.8.1-py27_0
>
> Fetching packages ...
> msvc_runtime-1 100% |###| Time: 0:00:00   2.95 
> MB/s
> conda-env-2.4. 100% |###| Time: 0:00:00   2.03 
> MB/s
> numpy-1.10.1-p 100% |###| Time: 0:00:03   7.28 
> MB/s
> pyyaml-3.11-py 100% |###| Time: 0:00:00   2.76 
> MB/s
> requests-2.8.1 100% |###| Time: 0:00:00   4.99 
> MB/s
> setuptools-18. 100% |###| Time: 0:00:00   4.70 
> MB/s
> wheel-0.26.0-p 100% |###| Time: 0:00:00   2.54 
> MB/s
> conda-3.18.3-p 100% |###| Time: 0:00:00 

[julia-users] Re: build_executable.jl fails in OSX yosemite

2015-11-16 Thread Daniel Høegh
Thank you for the fix Tom. I have made a PR to master to fix this see, 
https://github.com/JuliaLang/julia/pull/14018. I have started a new repository 
for build_executable to fix it and keep it up to date. It would be nice if you 
could verify that the branch in 
https://github.com/dhoegh/BuildExecutable.jl/pull/2 build successfully on OSX. 
I have a plan to merge it soon, everything seems to work on Travis with your 
fix of build_sysimg.jl

Re: [julia-users] ANN CustomREPLComepletions - custom string completions in function arguments (HDF5, NetCDF...)

2016-02-18 Thread Daniel Høegh
Yes it does, it uses type inference to determine the return type of a function 
call. This way the determination of the argument type is effect free. You could 
maybe hook your package into the logic in REPLCompletion.jl in base.

Re: [julia-users] Error with PyPlot

2016-03-13 Thread Daniel Høegh
Hi Xavier Gandibleux

The problem is you are using a very old version of Julia (0.2.1 released in 
2014-02-11). In Julia terms this version is ancient. I presume you installed 
Julia by apt-get. The easiest way to get the latest stable release is to go to 
http://julialang.org/downloads/ and download the Generic Linux binaries.

[julia-users] spawn detach process windows

2016-03-13 Thread Daniel Høegh
Hi

I am trying to open a process that should outlive the parrent process. 
According to the documentation the detach function should enable this. But if i 
run:
julia>p=spawn(detach(`julia -e "using IJulia; IJulia.notebook()"`))
It starts a notebook server but when i close the Julia terminal where i 
executed the spawn command the notebook server dies. Is it a bug, or do i do 
something wrong?

Best regards Daniel

[julia-users] spawn detach process windows

2016-03-13 Thread Daniel Høegh
Using the detach keyword do not work. The server do still close when the REPL 
is closed. To simplify it more running 
julia>spawn(detach(`julia -e "while true end"`))
Spawn a new process stuck in a infinite loop. This process is killed when the 
REPL is closed on Windows. It do not get killed on linux.