Re: [julia-users] Pkg.[update()/install()/build()] woes on Windows 10 64 bit

2015-09-27 Thread Evan Fields
ry for 
C:\Users\ejfie\.julia\v0.3\ArrayViews\.git/refs/tags/v0.6.3
error: unable to create directory for 
C:\Users\ejfie\.julia\v0.3\ArrayViews\.git/refs/tags/v0.6.4
ERROR: failed process: Process(`git 
'--work-tree=C:\Users\ejfie\.julia\v0.3\ArrayViews' 
'--git-dir=C:\Users\ejfie\.
julia\v0.3\ArrayViews\.git' fetch -q 
'C:\Users\ejfie\.julia\v0.3\.cache\ArrayViews' 
+refs/*:refs/remotes/cache/*`,
ProcessExited(1)) [1]
 in error at error.jl:22 (repeats 2 times)

julia>

On Saturday, September 26, 2015 at 6:23:43 PM UTC-4, Stefan Karpinski wrote:
>
> The cache is just bunch of bare clones of package repos. Since those are 
> immutable and update only, it's safe to share them between arbitrarily many 
> working copies. I don't think manual management is ever necessary unless 
> one of the bare repos gets screwed up some how.
>
> On Friday, September 25, 2015, David Anthoff <ant...@berkeley.edu 
> > wrote:
>
>> Stefan, any pointers about this design?
>>
>>  
>>
>> I sometimes delete the folder of a package and then reinstall it with 
>> Pkg.update() if something got screwed up. Do I have to manually manage what 
>> is going on in .cache in that case as well?
>>
>>  
>>
>> Thanks,
>>
>> David
>>
>>  
>>
>> *From:* julia-users@googlegroups.com [mailto:julia-users@googlegroups.com] 
>> *On Behalf Of *Tony Kelman
>> *Sent:* Friday, September 25, 2015 5:46 PM
>> *To:* julia-users <julia-users@googlegroups.com>
>> *Subject:* Re: [julia-users] Re: Pkg.[update()/install()/build()] woes 
>> on Windows 10 64 bit
>>
>>  
>>
>> What is it? A cache. Other than that, no idea what it accomplishes (aside 
>> from reading the code to find out) or why it works the way it does. It was 
>> added in 
>> https://github.com/JuliaLang/julia/commit/df7a08893e4402182ec64178ffdb3130aa228943
>>  
>> but there are no design docs on the package manager. Ask Stefan.
>>
>>  
>>
>> .cache moved to being shared between different versioned package 
>> directories on 0.4 because of 
>> https://github.com/JuliaLang/julia/pull/7361. It worked that way on unix 
>> in 0.3 as well. With better support for making directory junctions via the 
>> symlink function (which was still a pretty new feature when 0.3.0 was 
>> released), that PR made the behavior consistent on Windows as well.
>>
>>
>>
>> On Friday, September 25, 2015 at 5:10:50 PM UTC-7, David Anthoff wrote:
>>
>> What is the .cache directory actually? And why is it moved into the 
>> ~\.julia folder for 0.4?
>>
>>  
>>
>> *From:* julia...@googlegroups.com [mailto:julia...@googlegroups.com] *On 
>> Behalf Of *Tony Kelman
>> *Sent:* Friday, September 25, 2015 2:35 PM
>> *To:* julia-users <julia...@googlegroups.com>
>> *Subject:* [julia-users] Re: Pkg.[update()/install()/build()] woes on 
>> Windows 10 64 bit
>>
>>  
>>
>> Try deleting everything in C:\Users\ejfie\.julia\v0.3\.cache  - 
>> something might be corrupt there
>>
>>
>> On Friday, September 25, 2015 at 12:29:14 PM UTC-7, Evan Fields wrote:
>>
>> I've been encountering problems with packages. Here's what happened:
>>
>> · I installed Julia 0.3.11 via the 64 bit .exe on julialang.org
>>
>>- Changed the install path to C:\Julia-0.3.11 but otherwise all 
>>default options
>>
>> · On Windows 10 x64, not using Cygwin or related
>>
>>- Right after install I opened a Julia terminal window; I had the 
>>session below.
>>
>> The errors are shown in the session below. I've tried
>>
>> - Running as an administrator
>>
>> - Running git config --global url."https://".insteadOf git:// in shell 
>> mode
>>
>> - Running Pkg.init() (already initialized)
>>
>> - Trying to clone a repository in Julia/Git using the git-bash there (it 
>> worked over https)
>>
>>  
>>
>>_   _ _(_)_ |  A fresh approach to technical computing
>>
>>   (_) | (_) (_)|  Documentation: http://docs.julialang.org
>>
>>_ _   _| |_  __ _   |  Type "help()" for help.
>>
>>   | | | | | | |/ _` |  |
>>
>>   | | |_| | | | (_| |  |  Version 0.3.11 (2015-07-27 06:18 UTC)
>>
>>  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
>>
>> |__/   |  x86_64-w64-mingw32
>>
>>  
>>
>> julia> Pkg.add("Images")
>>
>> INFO: Nothing to be done
>>
>> INFO: METADATA is out-o

Re: [julia-users] Pkg.[update()/install()/build()] woes on Windows 10 64 bit

2015-09-29 Thread Evan Fields
So I deleted just ArrayViews from .julia, still got errors. Decided to 
delete the whole of .julia, did Pkg.add("Images"), and got this:

   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.11 (2015-07-27 06:18 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/   |  x86_64-w64-mingw32

julia> Pkg.add("Images")
INFO: Cloning cache of BinDeps from 
git://github.com/JuliaLang/BinDeps.jl.git
INFO: Cloning cache of ColorTypes from 
git://github.com/JuliaGraphics/ColorTypes.jl.git
INFO: Cloning cache of ColorVectorSpace from 
git://github.com/JuliaGraphics/ColorVectorSpace.jl.git
INFO: Cloning cache of Colors from 
git://github.com/JuliaGraphics/Colors.jl.git
INFO: Cloning cache of Compat from git://github.com/JuliaLang/Compat.jl.git
INFO: Cloning cache of Dates from git://github.com/quinnj/Dates.jl.git
INFO: Cloning cache of Docile from 
git://github.com/MichaelHatherly/Docile.jl.git
INFO: Cloning cache of FixedPointNumbers from 
git://github.com/JeffBezanson/FixedPointNumbers.jl.git
INFO: Cloning cache of Graphics from 
git://github.com/JuliaLang/Graphics.jl.git
INFO: Cloning cache of HttpCommon from 
git://github.com/JuliaWeb/HttpCommon.jl.git
INFO: Cloning cache of Images from git://github.com/timholy/Images.jl.git
INFO: Cloning cache of Reexport from 
git://github.com/simonster/Reexport.jl.git
INFO: Cloning cache of SHA from git://github.com/staticfloat/SHA.jl.git
INFO: Cloning cache of SIUnits from git://github.com/Keno/SIUnits.jl.git
INFO: Cloning cache of TexExtensions from 
git://github.com/Keno/TexExtensions.jl.git
INFO: Cloning cache of URIParser from 
git://github.com/JuliaWeb/URIParser.jl.git
INFO: Cloning cache of Zlib from git://github.com/dcjones/Zlib.jl.git
INFO: Installing BinDeps v0.3.18
INFO: Installing ColorTypes v0.1.6
INFO: Installing ColorVectorSpace v0.0.4
INFO: Installing Colors v0.5.4
INFO: Installing Compat v0.7.3
INFO: Installing Dates v0.3.2
INFO: Installing Docile v0.5.19
INFO: Installing FixedPointNumbers v0.0.11
INFO: Installing Graphics v0.1.0
INFO: Installing HttpCommon v0.1.2
INFO: Installing Images v0.4.48
INFO: Installing Reexport v0.0.3
INFO: Installing SHA v0.1.2
INFO: Installing SIUnits v0.0.5
INFO: Installing TexExtensions v0.0.2
INFO: Installing URIParser v0.0.7
INFO: Installing Zlib v0.1.10
INFO: Building Images
At line:1 char:3
+ --help
+   ~
Missing expression after unary operator '--'.
At line:1 char:3
+ --help
+   
Unexpected token 'help' in expression or statement.
+ CategoryInfo  : ParserError: (:) [], 
ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingExpressionAfterOperator

INFO: Installing ImageMagick library
INFO: Attempting to Create directory 
C:\Users\ejfie\.julia\v0.3\Images\deps\downloads
INFO: Attempting to Create directory 
C:\Users\ejfie\.julia\v0.3\Images\deps\usr\lib\x64
INFO: Attempting to Create directory 
C:\Users\ejfie\.julia\v0.3\Images\deps\downloads
INFO: Directory C:\Users\ejfie\.julia\v0.3\Images\deps\downloads already 
created
INFO: Downloading file 
http://www.imagemagick.org/download/binaries/ImageMagick-6.9.2-3-Q16-x64-dll.exe
  % Total% Received % Xferd  Average Speed   TimeTime Time 
 Current
 Dload  Upload   Total   SpentLeft 
 Speed
100 20.0M  100 20.0M0 0  3141k  0  0:00:06  0:00:06 --:--:-- 
4439k
INFO: Done downloading file 
http://www.imagemagick.org/download/binaries/ImageMagick-6.9.2-3-Q16-x64-dll.exe
INFO: Attempting to Create directory 
C:\Users\ejfie\.julia\v0.3\Images\deps\downloads
INFO: Directory C:\Users\ejfie\.julia\v0.3\Images\deps\downloads already 
created
INFO: Downloading file 
https://bintray.com/artifact/download/julialang/generic/innounp.exe
  % Total% Received % Xferd  Average Speed   TimeTime Time 
 Current
 Dload  Upload   Total   SpentLeft 
 Speed
  0 00 00 0  0  0 --:--:-- --:--:-- --:--:--   
  0
  0 00 00 0  0  0 --:--:--  0:00:01 --:--:--   
  0
100  592k  100  592k0 0   251k  0  0:00:02  0:00:02 --:--:-- 
 847k
INFO: Done downloading file 
https://bintray.com/artifact/download/julialang/generic/innounp.exe
INFO: Changing Directory to C:\Users\ejfie\.julia\v0.3\Images\deps\downloads
; Version detected: 5506 (Unicode)
INFO: Package database updated

julia>

But things seem to be working, at least for now.

Interesting side note: I know things aren't supposed to work this way, but 
this physical machine seems to create Julia problems. In January I had 
similar problems with installing packages that even a fresh install of 
Julia didn't solve. Since then I've formatted my hard drive and installed a 
later version of Windows, but again even a fresh 

[julia-users] Pkg.[update()/install()/build()] woes on Windows 10 64 bit

2015-09-25 Thread Evan Fields
I've been encountering problems with packages. Here's what happened:

   - I installed Julia 0.3.11 via the 64 bit .exe on julialang.org
   - Changed the install path to C:\Julia-0.3.11 but otherwise all default 
   options
   - On Windows 10 x64, not using Cygwin or related
   - Right after install I opened a Julia terminal window; I had the 
   session below.

The errors are shown in the session below. I've tried
- Running as an administrator
- Running git config --global url."https://".insteadOf git:// in shell mode
- Running Pkg.init() (already initialized)
- Trying to clone a repository in Julia/Git using the git-bash there (it 
worked over https)

   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.11 (2015-07-27 06:18 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/   |  x86_64-w64-mingw32

julia> Pkg.add("Images")
INFO: Nothing to be done
INFO: METADATA is out-of-date — you may not have the latest version of Images
INFO: Use `Pkg.update()` to get the latest versions of your packages

julia> Pkg.update()
INFO: Updating METADATA...
Checking out files: 100% (1627/1627), done.
INFO: Updating cache of Hexagons...
INFO: Updating cache of Gadfly...
INFO: Updating cache of ArrayViews...
INFO: Updating cache of Lazy...
INFO: Updating cache of ImmutableArrays...
INFO: Updating cache of Graphics...
INFO: Updating cache of StatsBase...
INFO: Updating cache of Requires...
INFO: Updating cache of MacroTools...
INFO: Updating cache of NaNMath...
INFO: Updating cache of FactCheck...
INFO: Updating cache of DataArrays...
INFO: Updating cache of Grid...
INFO: Updating cache of Loess...
INFO: Updating cache of Compat...
INFO: Updating cache of FixedPointNumbers...
INFO: Updating cache of WoodburyMatrices...
INFO: Updating cache of Compose...
INFO: Updating cache of JuliaParser...
INFO: Updating cache of Iterators...
INFO: Updating cache of JSON...
INFO: Updating cache of DataFrames...
INFO: Updating cache of GZip...
INFO: Updating cache of Reexport...
INFO: Updating cache of Showoff...
INFO: Updating cache of Distributions...
INFO: Updating cache of Optim...
INFO: Updating cache of Color...
INFO: Updating cache of SortingAlgorithms...
INFO: Updating cache of Docile...
INFO: Updating cache of Calculus...
INFO: Updating cache of PDMats...
INFO: Updating cache of DualNumbers...
INFO: Updating cache of DataStructures...
INFO: Updating cache of Jewel...
ERROR: couldn't update C:\Users\ejfie\.julia\v0.3\.cache\Hexagons using `git 
remote update`
 in wait at task.jl:284
 in wait at task.jl:194
 in wait at task.jl:48
 in sync_end at task.jl:311
 in update at pkg/entry.jl:319
 in anonymous at pkg/dir.jl:28
 in cd at file.jl:30
 in cd at pkg/dir.jl:28
 in update at pkg.jl:41

julia> using Images
ERROR: Images not properly installed. Please run Pkg.build("Images") then 
restart Julia.
 in error at error.jl:21 (repeats 2 times)
while loading C:\Users\ejfie\.julia\v0.3\Images\src\ioformats/libmagickwand.jl, 
in expression starting on line 31
while loading C:\Users\ejfie\.julia\v0.3\Images\src\Images.jl, in expression 
starting on line 38

julia> Pkg.build("Images")
INFO: Building Images
=[ ERROR: Images 
]=


type Nothing has no field match
while loading C:\Users\ejfie\.julia\v0.3\Images\deps\build.jl, in expression 
starting on line 37

===


=[ BUILD ERRORS 
]==


WARNING: Images had build errors.

 - packages with build errors remain installed in C:\Users\ejfie\.julia\v0.3
 - build the package(s) and all dependencies with `Pkg.build("Images")`
 - build a single package by running its `deps/build.jl` script

===


julia>


Hopefully I'm missing something simple here! Any suggestion?


[julia-users] Re: function! vs. function

2016-06-12 Thread Evan Fields
Apologies if this is obvious, but: appending ! to a function name doesn't 
do anything special. It is convention to "append ! to names of functions 
that modify their arguments" (from the manual, section style guide). But 
this is just a naming convention and doesn't affect how the function is 
actually computed.


[julia-users] Re: ANN: PkgSearch - a REPL utility for package discovery

2016-06-04 Thread Evan Fields
Hi, this looks great. Two comments from playing around a little bit.

1) PkgSearch.lookup fails if any of the arguments contain a space. In 
general maybe add to the documentation some notes about whitespace, case 
sensitivity, etc.?
2) The search seems to get confused between package names and the 
corresponding github respository name, which often differ by a .jl at the 
end. For example, JuMP is one of the most used Julia packages, you can find 
it on pkg.julialang.org, etc. But PkgSearch.details("JuMP") will give an 
error. PkgSearch.details("JuMP.jl") gives the readme and associated info 
from the correct git repo except labels the package unofficial.

Let me know if you want me to open issues on github, etc. Great work 
overall!


[julia-users] Re: Getting sequence of time and subset it

2016-05-30 Thread Evan Fields
I'm not 100% sure I understand your question, but let me give it a shot. 

First thing is to note why you're getting that MethodError. It's from the 
line

println(si in sdt1[i, [:BreakTime1, :BreakTime2]])

Define sdt1 as you do (I just copied into a Julia REPL) and set i = 1 to 
for the first iteration of the for loop.

Then:

julia> sdt1[i, [:BreakTime1, :BreakTime2]]
1×2 DataFrames.DataFrame
│ Row │ BreakTime1  │ BreakTime2  │
├─┼─┼─┤
│ 1   │ 2016-04-13T10:00:00 │ 2016-04-13T12:00:00 │

julia> si = 
Dates.format([sdt1[i,:StartTime]:Dates.Minute(30):sdt1[i,:EndTime]], 
"HH:MM")
WARNING: [a] concatenation is deprecated; use collect(a) instead
 in depwarn at deprecated.jl:73
 in oldstyle_vcat_warning at abstractarray.jl:29
 in vect at abstractarray.jl:32
while loading no file, in expression starting on line 0
11-element Array{Any,1}:
 "07:15"
 "07:45"
 "08:15"
 "08:45"
 "09:15"
 "09:45"
 "10:15"
 "10:45"
 "11:15"
 "11:45"
 "12:15"

julia> si in sdt1[i, [:BreakTime1, :BreakTime2]]
ERROR: MethodError: `start` has no method matching 
start(::DataFrames.DataFrame)
 in mapreduce_sc_impl at reduce.jl:194
 in in at reduce.jl:377

So si is of type Vector{Any} but happens to hold strings. sdt1[i, 
[:BreakTime1, :BreakTime2]] is a DataFrame. What does it mean to ask if a 
vector is in a DataFrame? That's what's happening in your println; the `in` 
is just an infix operator of function in.

3-element Array{Int64,1}:
 1
 2
 3

julia> 1 in x
true

julia> in(1,x)
true

julia> in(5,x)
false

I assume you get the MethodError of no method start because in(a,b) 
iterates over b, checking each element of b for equality to a. But 
DataFrames are not iterable in this way. (This part just a guess; look it 
up in the manual before telling your friends.)

Anyway, to get output as from your R snippet, you could use a loop like the 
following:

julia> for i in 1:nrow(sdt1), t in 
sdt1[:StartTime][i]:Dates.Minute(30):sdt1[:EndTime][i]
   if !(t in [sdt1[:BreakTime1][i], sdt1[:BreakTime2][i]])
   println("$i $(Dates.format(t, "HH:MM"))")
   end
   end
1 07:00
1 07:30
1 08:00
1 08:30
1 09:00
1 09:30
1 10:30
1 11:00
1 11:30
2 07:15
2 07:45
2 08:15
2 08:45
2 09:15
2 09:45
2 10:45
2 11:15
2 11:45

I hope this helps!


[julia-users] Re: Getting sequence of time and subset it

2016-06-01 Thread Evan Fields
Of course there's a way :)

You can use the isna function to check if a value is NA or not. There's 
also the dropna function which takes a DataArray as input and returns a 
regular Vector with the NA elements removed.

You could try something like the following:

firstbreakcol = 4
lastbreakcol = 5
for i in 1:nrow(sdt2), t in 
sdt2[:StartTime][i]:Dates.Minute(30):sdt2[:EndTime][i]
shouldprint = true
for j in firstbreakcol:lastbreakcol
if !isna(sdt2[i,j]) && sdt2[i,j] == t
# t is in a break column
shouldprint = false
break
end
end
if shouldprint
println(t)
end
end

It's a little verbose, true. I'm sure there's something cleaner with 
dropna, filter, etc.


[julia-users] Pkg operations hanging on Windows with Julia 0.4.6

2016-06-21 Thread Evan Fields
I upgraded from 0.4.5 to 0.4.6 today and did a little work with no issue. 
Then I ran Pkg.update() and apparently updated the cache of a few packages. 
When Pkg.update got to Conda, everything seemed to hang. After letting that 
run about 40 minutes I killed the Julia process, restarted, and tried 
Pkg.update again. The first package it tried to update was DataStreams, and 
that also hung for a while. I killed that process, started a new one, and 
Pkg.resolve() ran for a half hour without giving any output. I thought 
maybe there was a problem with Conda and I should remove and reinstall it, 
and Pkg.rm("Conda") did work, but everything else just hangs indefinitely.

I tested on my other computer (also running Windows but still on Julia 
0.4.5) and it updated all its needed packages successfully.

Thoughts? Bug worth trying to chase down or just uninstall Julia, nuke the 
.julia folder, and reinstall?

Thanks,
Evan


[julia-users] Re: JuliaCon schedule announced

2016-06-20 Thread Evan Fields
Can non-registered local Julia fans show up for the hackathon?


[julia-users] Re: ANN: JuMP 0.12 released

2016-03-08 Thread Evan Fields
Great to hear. Two minor questions which aren't clear (to me) from the 
documentation:
- Once a user defined function has been defined and registered, can it be 
incorporated into NL expressions via @defNLExpr?
- The documentation references both ForwardDiff.jl and 
ReverseDiffSparse.jl. Which is used where? What are the tradeoffs users 
should be aware of?

Semi-unrelated: two days ago I was using JuMP 0.12 and NLopt to solve what 
should have been a very simple (2 variable) nonlinear problem. When I fed 
the optimal solution as the starting values for the variables, the 
solve(model) command (or NLopt) hung indefinitely. Perturbing my starting 
point by .0001 fixed that - solve returned a solution 
instantaneously-by-human-perception. Am I doing something dumb?


[julia-users] Is there a performance penalty for defining functions inside functions?

2016-03-29 Thread Evan Fields
To keep namespaces clear and to help with code readability, I might like to 
do this:

function mainFunc()
function helper()
do stuff
return something
end

call helper() and do stuff
return something
end

That way the helper function is only visible to the function that needs it 
and when reading the code it's obvious that the helper "belongs to" the 
main function. Is there any performance penalty for doing this? Or is this 
bad practice for some reason I don't know?


[julia-users] Re: Announcing JuDE: autocomplete and jump to definition support for Atom

2016-03-21 Thread Evan Fields
Looks great - I'm excited to try this out. Does the autocomplete work in 
the console as well? I recently tried Atom flavored Juno and was super 
impressed but found the lack of console completions a major pain point. 
Will this play nicely with Juno's packages?


[julia-users] Re: Announcing JuDE: autocomplete and jump to definition support for Atom

2016-03-21 Thread Evan Fields
Looks great - I'm excited to try this out. Does the autocomplete work in 
the console as well? I recently tried Atom flavored Juno and was super 
impressed but found the lack of console completions a major pain point. 
Will this play nicely with Juno's packages?

On Sunday, March 20, 2016 at 2:58:15 PM UTC-4, James Dang wrote:
>
> Hi All, Julia has been great for me, and I wanted to give back a little. 
> LightTable and Atom are great editors, but I was really starting to miss 
> good intellisense-like autocomplete and basic navigation features like 
> jump-to-definition, especially on larger codebases. It's really quite a 
> slog to remember exactly where in which file a function was defined, or 
> what its exact arguments are. And maybe with better tooling, more people 
> will be drawn to the community. So I put a bit of work into a new package 
> for Atom that gives you that!
>
> https://atom.io/packages/jude
>
>
> 
>
>
> This is a bit different from what you get out of julia-client and 
> autocomplete-julia because it does a full syntax parsing and scope 
> resolution of your codebase without executing it in a Julia process. It 
> reparses very quickly on the fly without needing to save. And the matching 
> is precise, not fuzzy, giving you exactly what names are available in the 
> scope you are in currently. It's quite new and unpolished, but please try 
> it out and let me know what you think!
>
> Cheers,
> James
>
>

[julia-users] Re: To solve optimization problem in julia is it necessary to add any module.

2016-03-25 Thread Evan Fields
It depends on what kind of problem you'd like to solve and how you'd like 
to solve it. 

- JuMP is a modeling interface that lies between you and a dedicated 
solver. JuMP lets you easily specify your problem, sends that problem to 
the solver, and retrieves output for you. JuMP itself is not a solver.

- Packages such as Optim.jl implement some optimization algorithms in pure 
Julia and thus do not require external solvers nor packages to interact 
with them.

See juliaopt.org for an overview of the optimization packages and how they 
fit together.

Which solver is best depends on many factors: primarily what kind of 
problem you want to solve, but also whether you need features like 
callbacks, what licenses you have access to, etc. The main page of 
juliaopt.org has a chart which can help you pick a a solver (probably to be 
used with JuMP) or a pure Julia optimization package.


[julia-users] Pkg.publish() : ERROR: There are no METADATA changes to publish

2016-05-20 Thread Evan Fields
Presumably I'm doing something dumb, but I'm at a loss. I'm trying to tag 
version 0.0.2 of TravelingSalesmanHeuristics in METADATA. With my local 
machine up to date with the remote github repository, I run Pkg.update() and 
Pkg.tag("TravelingSalesmanHeuristics.j", v"0.0.2") and get no errors. 

Then I run Pkg.publish() and get the following output:

julia> Pkg.publish()
ERROR: There are no METADATA changes to publish
 in publish at pkg/entry.jl:348
 in anonymous at pkg/dir.jl:31
 in cd at file.jl:32
 in cd at pkg/dir.jl:31
 in publish at pkg.jl:61


Indeed, when I to git log -n 10 in the local copy of METADATA I see no 
commits about tagging TravelingSalesmanHeuristics. So it seems the 
Pkg.publish error is not wrong.

What am I doing wrong? Thanks!


[julia-users] Re: Pkg.publish() : ERROR: There are no METADATA changes to publish

2016-05-20 Thread Evan Fields
On further inspection I think this is because I managed to name the package 
repository TravelingSalesmanHeuristics.jl (rather than just 
TravelingSalesmanHeuristics). Indeed I just ran 
Pkg.add("TravelingSalesmanHeuristics") and now have in my .julia/v0.4 both 
TravelingSalesmanHeuristics and TravelingSalesmanHeuristics.jl

When I published v0.0.1 Pkg.publish failed (different error, can't 
remember) and I had to create the pull request manually; presumably I now 
have to do that going forward?


Re: [julia-users] Re: Pkg.publish() : ERROR: There are no METADATA changes to publish

2016-05-20 Thread Evan Fields

>
> Yes, thanks for your help. I did Pkg.add("TravelingSalesmanHeuristics") 
> and checked out master in that directory. Pkg.tag and Pkg.publish both 
> seemed to work fine.


Surely this was all an unforced error on my part but hopefully someone in 
the future will find this thread useful. Cheers! 


[julia-users] Re: ANN: AffineSpaces.jl (work in progress)

2016-05-16 Thread Evan Fields
Very cool stuff; I could see this being really useful in heuristic vehicle 
routing work I do.

By the way, in the readme should the 2d example which creates the line y = 
1 first create the x-axis (y=0) and then offset? It looks like you're using 
the second component vector [0,1].


[julia-users] Re: Working with DataFrame columns types that are Nullable

2016-07-22 Thread Evan Fields
As far as I know, DataFrames are only backed by DataArrays. (I believe 
there's current work being done to upgrade the speed and type stability of 
DataFrames, in part by using Nullables.)

It might be helpful to write a little convenience function like

f(n) = isnull(n) ? NA : get(n)

I will say I've found DataArrays to be super finicky when inferring types. 
YMMV.


[julia-users] Re: ANN: Julia 0.5.0-rc2 now available

2016-08-13 Thread Evan Fields
Thanks Tony. Two questions, one related to Uwe's question:

1) I noticed earlier that 0.5.0-rc0 starts up much faster than 0.4.6 but is 
a little slower on initial function calls. Does it load or precompile less 
of the standard library on startup? 
2) Is there / will there be a list of important changes 0.4.x -> 0.5.0 
besides the github commit log, which is useful but hard to parse if your 
general question is "how should I change my mental model of Julia programs?"


Re: [julia-users] Proposed solution for writing Enums

2016-08-23 Thread Evan Fields
@enum doesn't do what you want for enums?


[julia-users] Rescuing abandoned package

2016-09-02 Thread Evan Fields
I use the package GreatCircle  for 
great circle distance calculations. On 0.4.x it generates depwarns, and 
it's incompatible with 0.5. I've opened a pull request with the tiny 
changes needed to use the package on 0.5, but there's been no response and 
from the author's Github profile it looks like he/she is no longer 
generally active. Is there a way to rescue the package in this situation? 
(Besides perhaps forking and renaming, which leads to cluttered package 
names...)


[julia-users] Re: dependent types in julia?

2016-09-14 Thread Evan Fields
How about something like the following?

type CT{T}
ctsum::Complex{T}
ctsumsq::T
end

x = 1 + 2im

ctx = CT(x, convert(decomplexify(typeof(x)), x * conj(x))

You could also make a convenience function so you don't have to do the 
converts yourself for the second argument.
Have you seen the standard docs on parametric 
types? 
http://docs.julialang.org/en/release-0.5/manual/types/#man-parametric-types


[julia-users] Re: dependent types in julia?

2016-09-14 Thread Evan Fields
I'm not sure then, but hopefully someone here can help you out! Naively 
perhaps it feels like this makes the type inference impossible. Your 
function decomplexify always produces the same output for the same input, 
but what if you had a function that returned a different output (always of 
type DataType) based on a random number generated inside the function? Then 
using that function to annotate field types would be super hairy, right?


Re: [julia-users] ls()?

2016-09-14 Thread Evan Fields
Which can get gnarly on Windows, depending how you launched Julia. E.g. 
just launching from the Julia executable:


shell> ls
ERROR: could not spawn `ls`: no such file or directory (ENOENT)
 in _jl_spawn(::String, ::Array{String,1}, ::Ptr{Void}, ::Base.Process, 
::RawFD, ::RawFD, ::RawFD) at .\process.jl:321
 in #414 at .\process.jl:478 [inlined]
 in setup_stdio(::Base.##414#415{Cmd,Ptr{Void},Base.Process}, 
::Tuple{RawFD,RawFD,RawFD}) at .\process.jl:466
 in #spawn#413(::Nullable{Base.ProcessChain}, ::Function, ::Cmd, 
::Tuple{RawFD,RawFD,RawFD}, ::Bool, ::Bool) at .\process.jl:477
 in run(::Cmd) at .\process.jl:591
 in repl_cmd(::Cmd, ::Base.Terminals.TTYTerminal) at .\client.jl:91

julia>

(It works fine if launched from Git bash)


[julia-users] Re: PkgDev.tag issues

2016-09-24 Thread Evan Fields
I've had this problem as well so I'm eager to learn a solution. It was a 
while ago, but when this happened to me, git status in the metadata repo 
would show uncommitted changes. I think I had to reset metadata to a clean 
state, manually delete some tags in the package repository, and run the 
package commands again.


[julia-users] Julia 0.5.0-rc2 allocates 6x as much as and runs 4x slower than Julia 0.4.6

2016-08-18 Thread Evan Fields
Unfortunately I haven't been able to find a minimal reproducing example, so 
first the relevant snippet then the whole function. I have some code which 
contains the following inner loop:

for after in 1:(length(path) - 1) # can't insert after end of path
counter += 1
c = inscost(k, after)
if c < bestCost
bestCost = c
bestInsertion = (k, after)
end
end

where inscost is a one-line closure:

function inscost(k, after)
return distmat[path[after], k] + 
   distmat[k, path[after + 1]] -
   distmat[path[after], path[after + 1]]
end

Running on Julia 0.5.0-rc2 is about 4x slower than running on Julia 0.4.6, 
and it seems to be because 0.5.0 is doing way more allocations. In 
particular, using the @timev macro shows that Julia 0.5.0 does 6 pool 
allocs* per inner loop, whereas Julia 0.4.6 does only 1 pool alloc per 
inner loop. This is true whether I prefix function inscost with @inline, 
@noinline, or no decoration. On a typical function call, Julia 0.5.0 
allocates 18.6 MB, and Julia 0.4.6 allocates 3.0 MB.

If I move the body of inscost into the inner loop, Julia 0.5.0 is now 
lightning fast and allocates only 584 KB for the same function call:

for after in 1:(length(path) - 1) # can't insert after end of path
counter += 1
c = distmat[path[after], k] + 
distmat[k, path[after + 1]] -
distmat[path[after], path[after + 1]]
if c < bestCost
bestCost = c
bestInsertion = (k, after)
end
end

Any thought what's going on, how to avoid this performance penalty in 
general (manually inlining here is easy, but could be painful or hard to 
diagnose elsewhere), and whether this is worth a Github issue?

For context, here's the full function. It's a simple/naive implementation 
of the cheapest insertion heuristic for the traveling salesman problem.

function cheapest_insertion{T<:Real}(distmat::Matrix{T}, 
initpath::Vector{Int})
check_square(distmat, "Distance matrix passed to cheapest_insertion must be 
square.")
n = size(distmat, 1)
path = copy(initpath)
# collect cities to visited
visitus = setdiff(collect(1:n), initpath)
# helper for insertion cost
# tour cost change for inserting node k after the node at index after in 
the path
function inscost(k, after)
return distmat[path[after], k] + 
 distmat[k, path[after + 1]] -
 distmat[path[after], path[after + 1]]
end
while !isempty(visitus)
bestCost = Inf
bestInsertion = (-1, -1)
for k in visitus
for after in 1:(length(path) - 1) # can't insert after end of path
c = inscost(k, after)
if c < bestCost
bestCost = c
bestInsertion = (k, after)
end
end
end
# bestInsertion now holds (k, after)
# insert into path, remove from to-do list
k, after = bestInsertion
insert!(path, after + 1, k)
visitus = setdiff(visitus, k)
end
return (path, pathcost(distmat, path))
end

* confession time: I don't know what "pool allocs" is measuring or whether 
to focus on that vs. bytes allocated...


[julia-users] Re: AutoGrad port for Julia

2016-08-26 Thread Evan Fields
This looks really interesting. Can you give the high level comparison of 
how this compares to the various JuliaDiff tools and when to use one over 
the other?


[julia-users] Re: DataFrame Manipulation (like dplyr) Help

2016-08-26 Thread Evan Fields
I'm not sure if you'll find this any cleaner, but maybe something like

function summary2(df, queries...)
  d = Dict()
  for query in queries
name = query[1]
f = query[2]
col = query[3]
d[name] = f(df[col])
  end
  return d
end

Which could be used e.g.

julia> summary2(dat, ("mu_x", mean, :x), ("std_y", std, :y))
Dict{Any,Any} with 2 entries:
  "std_y" => 0.338854
  "mu_x"  => 0.438158

julia>

Admittedly this is less flexible, but perhaps more transparent. 


Re: [julia-users] Re: Return type of eye()

2016-08-29 Thread Evan Fields


On Monday, August 29, 2016 at 9:39:19 AM UTC-4, Júlio Hoffimann wrote:
>
> I'd like to understand the existence of eye() in Julia, it is still not 
> clear to me. Is it because one wants type stability when updating a matrix 
> iteratively? Is this possibly a limitation from the design of the language?
>
> -Júlio
>

I've used it for things like 
m = m + lambda*eye(m)

 


Re: [julia-users] Do threads in a threaded loop have their own scope?

2016-10-11 Thread Evan Fields
I'm unsure if "bit shared" is a technical term I should know, or if "bit 
shared" is a smartphone typo for "not shared" which would describe my 
understanding of normal loops, where it seems each iteration doesn't have 
access to loop-only variables defined in a previous iteration. :)

I guess the better question is if I want to run my f(mt::MyType) 
simulations in parallel, what's the best way to do so?


[julia-users] Do threads in a threaded loop have their own scope?

2016-10-11 Thread Evan Fields
Let's say I have a type MyType and function f(mt::MyType) which is slow and 
stochastic. I have an object y::MyType, and I'd like to compute f(y) many 
times.

If I write a loop like 
fvals = Vector{Float64}(100)
Threads.@threads for i in 1:length(fvals)
  ycopy = deepcopy(y)
  fvals[i] = f(ycopy)
end

The various loop iterations are not interfering with each other, right? 
Each has its own copy of y?


[julia-users] Re: Julia 0.5 Highlights

2016-10-12 Thread Evan Fields
Thanks for writing this up; it's helpful to see certain things highlighted 
and explained in more detail than news.md gives!