[julia-users] confusion about Date comprehension types

2014-07-24 Thread cnbiz850
I tested 2 ways of constructing date array.  But I got two different 
types of the arrays from the two ways.  How can I make them the same?  
What is the proper Date type?  At least, I hope not to use the Any type.


--
julia dats = [date(2014, 7, ii) for ii=1:4]
4-element Array{Date{C:Calendar},1}:
 2014-07-01
 2014-07-02
 2014-07-03
 2014-07-04

--
julia dates
4-element DataArray{UTF8String,1}:
 2010/1/4
 2010/1/5
 2010/1/6
 2010/1/7

julia [date(dates[i]) for i=1:length(dates)]
4-element Array{Any,1}:
 2010-01-04
 2010-01-05
 2010-01-06
 2010-01-07



[julia-users] what is the easiest way to convert array type?

2014-07-24 Thread cnbiz850
I have an Array{Any,1}, but I want to convert to Array{String,1}. The 
only way I know is through comprehension.


julia dt
3-element Array{Any,1}:
 2010/1/4T15:00:00
 2010/1/5T15:00:00
 2010/1/6T15:00:00


julia dts = [convert(String, dt[i]) for i=1:length(dt)]
3-element Array{String,1}:
 2010/1/4T15:00:00
 2010/1/5T15:00:00
 2010/1/6T15:00:00



Re: [julia-users] Re: what is the easiest way to convert array type?

2014-07-24 Thread cnbiz850
Thanks.  Didn't know about that syntax.  Now with it, I might prefer the 
following as Array{String,1} is exactly what I want.


julia dts1 = convert(Array{String,1},dt)
3-element Array{String,1}:
 2010/1/4T15:00:00
 2010/1/5T15:00:00
 2010/1/6T15:00:00


On 2014年07月25日 10:40, Miles Lubin wrote:

How about convert(Vector{String},dt)?

On Thursday, July 24, 2014 8:39:02 PM UTC-6, K leo wrote:

I have an Array{Any,1}, but I want to convert to Array{String,1}. The
only way I know is through comprehension.

julia dt
3-element Array{Any,1}:
  2010/1/4T15:00:00
  2010/1/5T15:00:00
  2010/1/6T15:00:00


julia dts = [convert(String, dt[i]) for i=1:length(dt)]
3-element Array{String,1}:
  2010/1/4T15:00:00
  2010/1/5T15:00:00
  2010/1/6T15:00:00





[julia-users] string array concatenates with a string not working?

2014-07-24 Thread cnbiz850

julia VA
3-element Array{ASCIIString,1}:
 A
 B
 C

julia VA * T
ERROR: `*` has no method matching *(::Array{ASCIIString,1}, ::ASCIIString)



Re: [julia-users] string array concatenates with a string not working?

2014-07-24 Thread cnbiz850

Just found it works on DataArray:

julia da = DataArray([A, B, C])
3-element DataArray{ASCIIString,1}:
 A
 B
 C

julia da * T
3-element DataArray{Any,1}:
 AT
 BT
 CT

On 2014年07月25日 11:57, cnbiz850 wrote:
That sounds confusing.  You just mentioned that Vector{String} is 
semantically equivalent to Array{String, 1}.


On 2014年07月25日 11:53, John Myles White wrote:
Arrays of strings aren’t part of a vector space. There’s no reason 
you should be able to multiply them by a scalar.


  — John








[julia-users] how to insert at index?

2014-07-15 Thread cnbiz850
I did the following on a DataFrame, but got error.  What should I do 
instead?


julia df = insert!(df, 25, dfa)
ERROR: `insert!` has no method matching insert!(::DataFrame, ::Int64, 
::DataFrame)




Re: [julia-users] DataFrames.jl problem

2014-06-24 Thread cnbiz850

using the latest build and most updated packages, I don't have that problem.

  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+3863 (2014-06-24 
04:00 UTC)

 _/ |\__'_|_|_|\__'_|  |  Commit c300f5f* (0 days old master)
|__/   |  x86_64-linux-gnu
julia using DataFrames

julia



Re: [julia-users] Re: juliabloggers.com is now live!

2014-06-17 Thread cnbiz850
I use g2reader (http://www.g2reader.com) and can't subscribe to this.  
Don't know why.  It complains about:


Entered url doesn't contain valid feed or doesn't link to feed. It is
also possible feed contains no items.

On 06/17/2014 08:38 PM, Randy Zwitch wrote:
My apologies, I think the link got mangled last time. Here it is 
again: http://www.juliabloggers.com/feed/ 
http://www.juliabloggers.com/feed/


On Monday, June 16, 2014 9:18:45 PM UTC-4, K leo wrote:

Is there something wrong with the feed?

http://www.juliabloggers.com/feed/
juliabloggers.com
http://www.juliabloggers.com/feed/juliabloggers.com
Entered url doesn't contain valid feed or doesn't link to feed. It is
also possible feed contains no items.





Re: [julia-users] Re: juliabloggers.com is now live!

2014-06-16 Thread cnbiz850

Is there something wrong with the feed?

http://www.juliabloggers.com/feed/
juliabloggers.com
Entered url doesn't contain valid feed or doesn't link to feed. It is 
also possible feed contains no items.


On 06/16/2014 08:52 PM, Randy Zwitch wrote:
Nothing shady about it at all and a good reminder I need to add a 
visible RSS icon.


Here's the feed:

http://www.juliabloggers.com/feed/


On Monday, June 16, 2014 7:32:49 AM UTC-4, Tomas Lycken wrote:

Nice!

I'm missing a feature: something to help me pull this into my RSS
reader. If it feels shady to re-publish an aggregated blog like
this in RSS, at least a list of the feeds that are currently
pulled in would be nice, but ultimately I'd like to add
juliabloggers.com http://juliabloggers.com to my feedly and get
everything posted there - and if someone comes in tomorrow and
adds a new feed to the site, I get that content too.

// T

On Monday, June 16, 2014 1:17:47 PM UTC+2, Randy Zwitch wrote:

Hey everyone -

Several posts had popped up over the past few month about
creating a centralized location for Julia content. I'm proud
to announce that http://www.juliabloggers.com/
http://www.juliabloggers.com/ is now live! This is still
very much a work-in-progress, as the theme is fairly vanilla
and I need to work out some oddities with how the content is
ingested, but the concept certainly works.

If you'd like to contribute your content to Julia Bloggers,
all it takes is submitting an RSS/Atom feed via this link:

http://www.juliabloggers.com/julia-bloggers-submit-rss-feed/
http://www.juliabloggers.com/julia-bloggers-submit-rss-feed/

Once your link is imported into Julia Bloggers, that's it. The
site will regularly check your feed for new content, then post
it to Julia Bloggers once it becomes available.

To-Do:

While the current theme adds an author to each post, it is my
intention to put a larger attribution section for each post,
to make it clear the post owner and a link back to the
original blog location (similar to how R-Bloggers has it at
the end of each post).

Logo: If anyone wants to create a logo, perhaps modifying the
current Julia SVG code to read 'JuliaBloggers' or something
similar, that would be fantastic. The header needs to be
960x250 or so, but if you make it larger/higher resolution I
can deal with the sizing I need.

We've already got 3 contributors so far, and the content is
getting posted to Twitter via
https://twitter.com/juliabloggers
https://twitter.com/juliabloggers.

If there are any questions or comments, please comment here.

Thanks!
Randy






[julia-users] What to do with julia's core dumped

2014-06-15 Thread cnbiz850

$ julia
   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+3680 (2014-06-15 
00:50 UTC)

 _/ |\__'_|_|_|\__'_|  |  Commit dff05bb* (0 days old master)
|__/   |  x86_64-linux-gnu

julia include(DelDup.jl)
Segmentation fault (core dumped)
$


[julia-users] Re: What to do with julia's core dumped

2014-06-15 Thread cnbiz850
The core dump has to do with removing sys.so.  When I restored it, julia 
did not core dump, instead, it printed out errors in my code.


On 06/16/2014 07:18 AM, cnbiz850 wrote:

$ julia
   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+3680 (2014-06-15 
00:50 UTC)

 _/ |\__'_|_|_|\__'_|  |  Commit dff05bb* (0 days old master)
|__/   |  x86_64-linux-gnu

julia include(DelDup.jl)
Segmentation fault (core dumped)
$




Re: [julia-users] what is the deal with !

2014-06-14 Thread cnbiz850

Thanks for the explanation.  That cleared my misunderstanding.

I wonder how other new guys feel, but to me, the ! seemed magical: 
with it, the modified argument is passed back; without it not.  Now I 
understand it is simply a convention and does not do anything.  But 
still, the question can always remain when looking at a function's 
definition: which of the many arguments' values get modified and passed 
back?


I feel like some other languages' way of defining function arguments: it 
is clear that the argument passed by reference gets modified and passed 
back.


On 06/13/2014 04:57 PM, Tomas Lycken wrote:
Actually, the bang (!) ending of function names is just a convention - 
it doesn't make the function do anything special, or treat it any 
other way than without the bang. For example, with the definition


```
push = push!
```

you could very well do `push(a, 3)` to append `3` at the end of the 
array `a`, with precisely the same effect as if you'd done 
`push!(a,3)`. If you write a new function that mutates its arguments, 
it is conventional to use the bang regardless of if the mutated 
argument is e.g. array or some other composite type.


However, while this convention is indeed very old, there's probably 
old code lying around where it isn't used, and other new code where 
the author forgot or was too lazy to make sure all mutating function 
names ended in with a bang. And still today this convention is not 
enforced in any way: it's perfectly legal to define a new mutating 
function without a bang at the end of the name. There is, however, 
some vaguely related discussion about introducing for example notation 
for pure functions https://github.com/JuliaLang/julia/issues/414, 
that might spill over on this convention if it is included in the 
language.


// T

On Friday, June 13, 2014 4:08:17 AM UTC+2, K leo wrote:

Thanks.

It says this:
By convention, function names ending with an exclamation point (!)
modify their arguments. Some functions have both modifying (e.g.,
sort!)
and non-modifying (sort) versions.

But my experience is a little inconsistent.  I noticed that is
what it
does to array arguments, but to other arguments (like composite
types)
it seems not necessary.  Am I missing something?

Also, it is a special character.  So perhaps it is better listed
under
operators section in the documentation.

On 06/13/2014 09:58 AM, Jacob Quinn wrote:
 It's mentioned here in the Some general notes section, but if you
 have suggestions of other places it should be mentioned, I'm
sure it
 wouldn't hurt!

 http://docs.julialang.org/en/latest/stdlib/base/#introduction
http://docs.julialang.org/en/latest/stdlib/base/#introduction

 -Jacob


 On Thu, Jun 12, 2014 at 9:53 PM, cnbiz850 cnbi...@gmail.com
javascript:
 mailto:cnbi...@gmail.com javascript: wrote:

 Can't find a description.  I guess that when it is used after a
 function name it makes the modified array argument passed
back to
 the caller.  Is that right, or is that all it is used for?







[julia-users] DataFrames delete row very slow

2014-06-12 Thread cnbiz850

I use the following to delete a row:

function deleterow(df::DataFrame, row::Int)
return df[[1:row-1, row+1:end], :]
end

The time it takes to delete 1000 rows in a 22,000-row df is about 16 
seconds.


Are there more efficient ways to do it?


Re: [julia-users] Re: DataFrames delete row very slow

2014-06-12 Thread cnbiz850

Thanks very much Matt.  It takes no time now.

On 06/12/2014 10:35 PM, Matt Bauman wrote:
You're making 1000 slightly different copies of your huge dataframe by 
doing it one-by-one.  Can you do all 1000 removals at once?  Even if 
you're finding the rows to remove iteratively, simply store a list of 
the rows to remove and batch the removals all together.


Perhaps something like:

function deleterows(df::DataFrame, rows::Array{Int,1})
 return df[setdiff(1:end,rows), :]
end

On Thursday, June 12, 2014 10:27:14 AM UTC-4, K leo wrote:

I use the following to delete a row:

function deleterow(df::DataFrame, row::Int)
 return df[[1:row-1, row+1:end], :]
end

The time it takes to delete 1000 rows in a 22,000-row df is about 16
seconds.

Are there more efficient ways to do it?





[julia-users] what is the deal with !

2014-06-12 Thread cnbiz850
Can't find a description.  I guess that when it is used after a function 
name it makes the modified array argument passed back to the caller.  Is 
that right, or is that all it is used for?


Re: [julia-users] what is the deal with !

2014-06-12 Thread cnbiz850

Thanks.

It says this:
By convention, function names ending with an exclamation point (!) 
modify their arguments. Some functions have both modifying (e.g., sort!) 
and non-modifying (sort) versions.


But my experience is a little inconsistent.  I noticed that is what it 
does to array arguments, but to other arguments (like composite types) 
it seems not necessary.  Am I missing something?


Also, it is a special character.  So perhaps it is better listed under 
operators section in the documentation.


On 06/13/2014 09:58 AM, Jacob Quinn wrote:
It's mentioned here in the Some general notes section, but if you 
have suggestions of other places it should be mentioned, I'm sure it 
wouldn't hurt!


http://docs.julialang.org/en/latest/stdlib/base/#introduction

-Jacob


On Thu, Jun 12, 2014 at 9:53 PM, cnbiz850 cnbiz...@gmail.com 
mailto:cnbiz...@gmail.com wrote:


Can't find a description.  I guess that when it is used after a
function name it makes the modified array argument passed back to
the caller.  Is that right, or is that all it is used for?






Re: [julia-users] Trying to install 0.3 prerelease on Ubuntu but keep geting 0.2.1

2014-06-09 Thread cnbiz850

On 06/10/2014 06:30 AM, J Luis wrote:

Hi,

I'm trying to install 0.3 via PPA (just updated to Ubuntu 14.01 to see 
if worked better as I had other issues with 13.10) but all I get is 0.2.1.

I am on Xubuntu 14.04 and it works fine.


[julia-users] how to print out part of a row in DataFrame?

2014-06-09 Thread cnbiz850
I only got the following formatted display but not my values.  To me 
this is really not desired, does everyone prefer this?


Can I get a printout of the values just as I print out a row of an array?

julia println(df[jj, 1:20])
1x20 DataFrame
|---|--||-|
| Col # | Name | Eltype | Missing |
| 1 | x1   | Int64  | 0   |
| 2 | x2   | Int64  | 0   |
| 3 | x3   | Int64  | 0   |
| 4 | x4   | Int64  | 0   |
| 5 | x5   | Int64  | 0   |
| 6 | x6   | Int64  | 0   |
| 7 | x7   | Int64  | 0   |
| 8 | x8   | Int64  | 0   |
| 9 | x9   | Int64  | 0   |
| 10| x10  | Int64  | 0   |
| 11| x11  | Int64  | 0   |
| 12| x12  | Int64  | 0   |
| 13| x13  | Int64  | 0   |
| 14| x14  | Int64  | 0   |
| 15| x15  | Int64  | 0   |
| 16| x16  | Int64  | 0   |
| 17| x17  | Int64  | 0   |
| 18| x18  | Int64  | 0   |
| 19| x19  | Int64  | 0   |
| 20| x20  | Int64  | 0   |



Re: [julia-users] Re: how to print out part of a row in DataFrame?

2014-06-09 Thread cnbiz850

Thanks John for the update.  Do I need to do a clone to get the new change?

I think there are two issues here.  One is to display df, a row of it, 
or part of a row, like


julia df
julia df[3, 1:20]

The other is to print out (to the terminal or to a file).

On the first issue, I hope DataFrames can adopt a similar behavior of 
arrays (when the user tries to display an array that is large, julia 
prints out ... in between the data).  This is not only helpful to the 
user but is also consistent with the overall julia style.


On the second, if an entire df is to be printed to the terminal, perhaps 
it should opt to print a summary only.  If a row is to be printed, it 
should always print out the data, however many elements.


On 06/10/2014 10:43 AM, John Myles White wrote:

Yup, this is the behavior that just got removed since we’ve had so many 
complaints.

  — John

On Jun 9, 2014, at 7:42 PM, Taylor Maxwell taylor.maxw...@gmail.com wrote:


If your dataframe has 6 or more columns then it prints this summary.  If you 
index less than 6 columns it will print ok.  You can force it to spit it all 
out with showall(df) but that may not be entirely legible.   There may be other 
ways to display it.




Re: [julia-users] PSA: new ~/.julia_history format

2014-06-08 Thread cnbiz850
Since I deleted .julia_history2 yesterday, I don't have the history 
errors now.  Don't know if that was the culprit.


On 06/08/2014 08:02 AM, Stefan Karpinski wrote:

Please do let me know of it continues to be broken for you.


On Jun 7, 2014, at 6:41 PM, cnbiz850 cnbiz...@gmail.com wrote:

Perhaps it does not happen at every start.  More likely at the start of every 
new day.  I just deleted .julia_history2, restarted julia, and did not get that 
error. Will see tomorrow.



On 06/08/2014 06:30 AM, Stefan Karpinski wrote:
That's definitely a problem. Could you file an issue? Ideally, including 
example contents from a produced ~/.julia_history file.


On Sat, Jun 7, 2014 at 6:28 PM, cnbiz850 cnbiz...@gmail.com 
mailto:cnbiz...@gmail.com wrote:

Lately, every time I start up julia I got the following error.
 And every time I have to delete ~/.julia_history.  Why?

--
$ julia
   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+3512
(2014-06-05 19:22 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit e16ee44* (2 days old master)
|__/   |  x86_64-linux-gnu

ERROR: Invalid history format. If you have a ~/.julia_history file
left over from an older version of Julia, try renaming or deleting it.

 in hist_from_file at REPL.jl:277
 in setup_interface at REPL.jl:594
 in run_frontend at REPL.jl:718
 in run_repl at REPL.jl:162
 in _start at client.jl:396




Re: [julia-users] PSA: new ~/.julia_history format

2014-06-07 Thread cnbiz850
Lately, every time I start up julia I got the following error.  And 
every time I have to delete ~/.julia_history.  Why?


--
$ julia
   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+3512 (2014-06-05 
19:22 UTC)

 _/ |\__'_|_|_|\__'_|  |  Commit e16ee44* (2 days old master)
|__/   |  x86_64-linux-gnu

ERROR: Invalid history format. If you have a ~/.julia_history file left 
over from an older version of Julia, try renaming or deleting it.


 in hist_from_file at REPL.jl:277
 in setup_interface at REPL.jl:594
 in run_frontend at REPL.jl:718
 in run_repl at REPL.jl:162
 in _start at client.jl:396


Re: [julia-users] PSA: new ~/.julia_history format

2014-06-07 Thread cnbiz850
Perhaps it does not happen at every start.  More likely at the start of 
every new day.  I just deleted .julia_history2, restarted julia, and did 
not get that error. Will see tomorrow.



On 06/08/2014 06:30 AM, Stefan Karpinski wrote:
That's definitely a problem. Could you file an issue? Ideally, 
including example contents from a produced ~/.julia_history file.



On Sat, Jun 7, 2014 at 6:28 PM, cnbiz850 cnbiz...@gmail.com 
mailto:cnbiz...@gmail.com wrote:


Lately, every time I start up julia I got the following error.
 And every time I have to delete ~/.julia_history.  Why?

--
$ julia
   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+3512
(2014-06-05 19:22 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit e16ee44* (2 days old master)
|__/   |  x86_64-linux-gnu

ERROR: Invalid history format. If you have a ~/.julia_history file
left over from an older version of Julia, try renaming or deleting it.

 in hist_from_file at REPL.jl:277
 in setup_interface at REPL.jl:594
 in run_frontend at REPL.jl:718
 in run_repl at REPL.jl:162
 in _start at client.jl:396






Re: [julia-users] Re: how to use the iterator without loops?

2014-06-05 Thread cnbiz850

Thanks again for the help.

Yes, I do know the number of dimensions before the iterations start, but 
it is high, as high as 50, and is different under different situations.  
So I try to simplify code for that.


The cartesian package is interesting and I will study it.  Besides that, 
is there any other ways to achieve it?


On 06/06/2014 11:07 AM, andrew cooke wrote:
do you mean you need to iterate in multiple dimensions, but you don't 
know beforehand how many dimensions? i'm pretty sure the cartesian 
package would help in that case. 
http://julia.readthedocs.org/en/latest/devdocs/cartesian/


On Thursday, 5 June 2014 21:56:37 UTC-4, K leo wrote:

Thanks very much for the guide.

I need to iterate in multiple dimensions.  The example below is for 2
dimensions.  Could anyone help making it simpler - in ways of
recursions
perhaps?

l = [1:3]
state = zeros(Int, 2)
II = zeros(Int, 2)

state[1] = start(l)
while !done(l, state[1])
 II[1], state[1] = next(l, state[1])
 state[2] = start(l)
 while !done(l, state[2])
 II[2], state[2] = next(l, state[2])
 println(II)
 end
end





Re: [julia-users] packaging parameters for functions revisited

2014-05-30 Thread cnbiz850

Thanks very much for the summary.

It is very interesting that assignFromArray is much faster than 
indexedArray.  Can anyone explain why?


On 05/30/2014 05:42 PM, Jon Norberg wrote:
There have been several posts about this, so I tried to compile what I 
could find to compare speed and pretty coding:


http://nbviewer.ipython.org/urls/dl.dropboxusercontent.com/u/38371278/Function%20parms%20passing%20speed%20test.ipynb

Best speed is assigning values or variables inside the function
Second best is reassigning parameters from array for each parameter. 
The @pack/@unpack macro also is pretty fast and much prettier
Third best is separate parameters and global assignment (longer 
function call code if many parameters or/and just no no to use global?)
Slowest is using indexed array as parameters in function (but this is 
ugly to read) and immutable types


So I am wondering, did I miss any that improve speed/prettiness?

Best, Jon







[julia-users] 2 sessions freeze up machine

2014-05-30 Thread cnbiz850
I ran 2 julia programs each with a single CPU at the same time on a 
machine with 8 CPU's.  After sometime (while the programs are running), 
the machine freezes - no mouse or keyboard responses.  It happened a few 
time this morning.  This seems just happened to the newly built 
versions.  It was OK weeks ago.


$ julia
   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+3327 (2014-05-29 
16:25 UTC)

 _/ |\__'_|_|_|\__'_|  |  Commit aa6113e* (1 day old master)
|__/   |  x86_64-linux-gnu





Re: [julia-users] 2 sessions freeze up machine

2014-05-30 Thread cnbiz850
I should say that they are run separately at about the same time.  The 
two have no communications, but share some pieces of codes.  Just some 
simple computations going through some arrays.  Some linear algebra but 
not using OpenBLAS.


As I said, they ran OK weeks ago.  I wonder if it has to do with the 
shared libraries that julia started to use recently.


On 05/31/2014 11:43 AM, Isaiah Norton wrote:
It will be helpful to know what you are running. Linear algebra 
operations via OpenBLAS can use multiple threads.



On Fri, May 30, 2014 at 11:38 PM, cnbiz850 cnbiz...@gmail.com 
mailto:cnbiz...@gmail.com wrote:


I ran 2 julia programs each with a single CPU at the same time on
a machine with 8 CPU's.  After sometime (while the programs are
running), the machine freezes - no mouse or keyboard responses.
 It happened a few time this morning.  This seems just happened to
the newly built versions.  It was OK weeks ago.

$ julia
   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+3327
(2014-05-29 16:25 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit aa6113e* (1 day old master)
|__/   |  x86_64-linux-gnu








[julia-users] performance of multiple julia sessions degrade

2014-05-13 Thread cnbiz850
I ran 2 functions in 2 separate julia sessions, each using a single 
CPU.  I found the processes' speed reduced to nearly half.  Would anyone 
explain/confirm?


Re: [julia-users] performance of multiple julia sessions degrade

2014-05-13 Thread cnbiz850

I guess I was mistaken, sorry.

I print out time elapsed every 1 loops.  The drop of speed I noticed 
might be due to the fact that some loops are more costly than others, 
not that 2 processes slow down.


On 05/14/2014 01:17 PM, Elliot Saba wrote:
Can you be a little more specific about what happened?  Please share 
your hardware information, as well as the code you were running.



On Tue, May 13, 2014 at 8:48 PM, cnbiz850 cnbiz...@gmail.com 
mailto:cnbiz...@gmail.com wrote:


I ran 2 functions in 2 separate julia sessions, each using a
single CPU.  I found the processes' speed reduced to nearly half.
 Would anyone explain/confirm?






[julia-users] array element assignment very expensive in profile

2014-05-12 Thread cnbiz850
Profile shows the two lines in the function being very expensive. Is 
there anything inappropriate?  Any way to improve?


function NoUpdate(data::Data)
data.cum[data.i] = data.cum[data.i-1]
data.i += 1
end

type Data
cum::Array{Float32,1}
i::Int32
...
end


Re: [julia-users] array element assignment very expensive in profile

2014-05-12 Thread cnbiz850

Thanks for the response.

It is called in a loop.  The function profiled is exactly as I showed 
here.  The profile section is as follows:


6449 ...ies/Gen13.jl; GenMC13; line: 176
 4751 ...es/Tools.jl; NoUpdate; line: 224
 829  ...es/Tools.jl; NoUpdate; line: 225


On 05/12/2014 10:14 PM, Kevin Squire wrote:
There's nothing specifically wrong with those two lines, but it's a 
little hard to guess how you're using them. Are you calling the 
function once, or in a loop?  Is this version of the function 
identical to the one you profiled, or was it cut down to be minimal?


if you provide more context, it's more likely someone could help you.

Cheers, Kevin

On Monday, May 12, 2014, cnbiz850 cnbiz...@gmail.com 
mailto:cnbiz...@gmail.com wrote:


Profile shows the two lines in the function being very expensive.
Is there anything inappropriate?  Any way to improve?

function NoUpdate(data::Data)
data.cum[data.i] = data.cum[data.i-1]
data.i += 1
end

type Data
cum::Array{Float32,1}
i::Int32
...
end





Re: [julia-users] array element assignment very expensive in profile

2014-05-12 Thread cnbiz850
I am on 64bits Ubuntu.  Should I better not use type 32 (Float32, Int32 
etc.) on 64bit system?


On 05/12/2014 10:23 PM, Tim Holy wrote:

Are you on 32 bit or 64 bit? If 64, an Int32 +/- 1 generates an Int64. Why not
just declare i to be an Int?

--Tim

On Monday, May 12, 2014 09:53:50 PM cnbiz850 wrote:

Profile shows the two lines in the function being very expensive. Is
there anything inappropriate?  Any way to improve?

function NoUpdate(data::Data)
  data.cum[data.i] = data.cum[data.i-1]
  data.i += 1
end

type Data
  cum::Array{Float32,1}
  i::Int32
  ...
end




Re: [julia-users] readcsv returns Array{T, 1}

2014-05-11 Thread cnbiz850

I hope this is related.

Why isn't part of a row of Array{T, 2} of Array{T, 1}?  Consider vec1 in 
the following example.


df = readcsv(fname)
vec1 = df[3, 1:4]


Re: [julia-users] possible to forgo new in constructor

2014-05-10 Thread cnbiz850
Thanks.  This is a lot better in my mind because it gets rid of the 
trouble associated with matching the orders of the fields, which can be 
a big problem with many fields.  I wonder what you mean by constructing 
incomplete objects gratuitously is a bad idea.


On 05/11/2014 05:43 AM, Stefan Karpinski wrote:

If you want, you can write

type AA
  aa
  bb

  function AA()
this = new()
this.aa = 1
this.bb = 2
this
  end
end

But that seems like a lot more typing and constructing incomplete 
objects gratuitously is a bad idea, so I wouldn't recommend it.






[julia-users] question on performance

2014-05-10 Thread cnbiz850
I tried to use comprehension in loops but found it somehow slower. In 
the following example, the loop in first code is slower than in the 
second.  Would anyone please explain why?


===
function ffcombs()
[Int8[i1,i2] for i1 in II, i2 in II]
end

combs = ffcombs()
ii = zeros(Int8,2)
for ii in combs
...
end
==

for i1 in II, i2 in II
...
end


Re: [julia-users] getting readtable to work

2014-05-09 Thread cnbiz850

With Julia 0.3, readtable works.

On 05/10/2014 12:38 AM, Dustin Lee wrote:
I'm getting the following when trying to create a dataframe.  I'd 
appreciate some tips on how to troubleshoot this.


julia Julia Version 0.2.1
Commit e44b593905 (2014-01-30 13:47 UTC)
Platform Info:
  System: Linux (i686-linux-gnu)
  WORD_SIZE: 32
  BLAS: libopenblas (NO_LAPACK NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY)
  LAPACK: liblapack.so.3
  LIBM: libopenlibm

julia using DataFrames

julia outcomes = readtable(outcome-of-care-measures.csv)
ERROR: no method 
readtable!(ParsedCSV,IOStream,Int64,ParseOptions{ASCIIString,UTF8String})

 in readtable at /home/dlee/.julia/v0.2/DataFrames/src/io.jl:595





[julia-users] possible to forgo new in constructor

2014-05-09 Thread cnbiz850
As in the following example, new(aa,bb) is very redundant from coding 
point of view.  Since all fields are already declared and listed in the 
type definition, is it possible not to list them again with the new 
statement?  The new statement can be very troublesome when the type has 
many fields.


=
type AA
aa
bb

function AA()
aa=1
bb=2
new(aa,bb)
end
end


Re: [julia-users] possible to forgo new in constructor

2014-05-09 Thread cnbiz850
I meant having the inner constructor but having no need to write the new 
statement.  Isn't the purpose of the new statement implied by the 
constructor already?


On 05/10/2014 03:45 AM, Isaiah Norton wrote:
Yes, if no inner constructor is provided, the default constructor 
is based on fields. So

type AA
  aa::Int
  bb::Float64
end
is valid (and common).


On Fri, May 9, 2014 at 2:32 PM, cnbiz850 cnbiz...@gmail.com 
mailto:cnbiz...@gmail.com wrote:


As in the following example, new(aa,bb) is very redundant from
coding point of view.  Since all fields are already declared and
listed in the type definition, is it possible not to list them
again with the new statement?  The new statement can be very
troublesome when the type has many fields.

=
type AA
aa
bb

function AA()
aa=1
bb=2
new(aa,bb)
end
end






[julia-users] invalid redefinition of constant MyType

2014-05-08 Thread cnbiz850
I defined a composite type MyType.  But when I modified it and tried to 
rerun a code that uses it, I got error: invalid redefinition of constant 
MyType.  How can I avoid that?


[julia-users] difference between inside and outside constructors

2014-05-08 Thread cnbiz850
Would anyone explain the differences between the following two ways of 
defining a composite type?


=
type AA
aa
bb

function AA()
aa=1
bb=2
new(aa,bb)
end
end

type BB
aa
bb

end

function BB()
aa=1
bb=2
return BB(aa,bb)
end




Re: [julia-users] Question about 'dot' notation (and max/maximum)

2014-05-05 Thread cnbiz850
My question is if x + A does not make sense in any way other than x .+ 
A, then why introduce .+ at all since + means intuitively .+ and is simpler?



On 05/02/2014 09:55 PM, Hans W Borchers wrote:

julia 5 + x
WARNING: x::Number + A::Array is deprecated, use x .+ A instead.






Re: [julia-users] Rename column names in a DataFrames

2014-05-04 Thread cnbiz850
DataFrames is a package I have been battling with recently.  I must 
admit that getting a good knowledge about it is not easy, surely I hope 
that is different for other people.  But after going through a lot of 
digging - searching the web, asking questions either here or at the 
issues with the package, and looking into the source code, I found it a 
powerful package capable of many features of a spreadsheet program.


On 05/04/2014 09:08 PM, Milan Bouchet-Valat wrote:

Le dimanche 04 mai 2014 à 08:25 -0400, Harlan Harris a écrit :

Also, Andreas, the version of the docs you're looking at are extremely
old. DataFrames.jl was moved to the JuliaStats organization GitHub
account something like a year ago.

How about removing the old documentation, or at least adding a warning
there?


Regards





Re: [julia-users] What editor/environment do you use when developing in Julia?

2014-05-04 Thread cnbiz850
On Linux, gedit is great.  The julia plugin works really well, with 
auto-completion.


On 05/05/2014 02:10 AM, Aerlinger wrote:
I'm using vim for the most part but was hoping to get a feel on what 
other people are using or if there are good alternatives out there. 
I've tried Julia Studio but it still seems a little too young 
feature-wise to be usable at this point.




[julia-users] Julia Tutorials

2014-05-01 Thread cnbiz850
Just found this page with tutorials on a few packages.  The one I found 
quite helpful, even though a little old, is on DataFrames, much more 
helpful than DataFrames's original documentation.


https://github.com/JuliaLang/julia-tutorial


Re: [julia-users] Julia Tutorials

2014-05-01 Thread cnbiz850

Well, Julia is easier to understand than English for sure;-)

I just found it easier to get to know how to do what I needed to do.

I have been through the document a few times, but didn't get much sense 
on how to access rows, find duplicate rows, delete rows, and etc.  
Adding on top of the frustration, the document is somewhat dated and 
includes many examples that are deprecated.  Moreover, it does not list 
out too many available functions.



On 05/01/2014 02:14 PM, John Myles White wrote:

What makes the tutorial more helpful? The absence of English text?

  — John

On Apr 30, 2014, at 11:04 PM, cnbiz850 cnbiz...@gmail.com wrote:


Just found this page with tutorials on a few packages.  The one I found quite 
helpful, even though a little old, is on DataFrames, much more helpful than 
DataFrames's original documentation.

https://github.com/JuliaLang/julia-tutorial




Re: [julia-users] Bug or feature? Array{Number} squared gives Array{Any}

2014-04-30 Thread cnbiz850
I got a sense that Any is widely misused and mishandled in Julia.  It 
requires some cleanup. Anyone agree?


On 04/30/2014 07:41 PM, Ariel Keselman wrote:

see simplified behavior below:

https://lh4.googleusercontent.com/-buanLj1oJlU/U2DhZ4Fo2XI/HS4/xC8WkdiahEM/s1600/Capture1.PNG







[julia-users] question about DataFrames package

2014-04-30 Thread cnbiz850

My question is what is a symbol as in the following warning message?

=
julia df = DataFrame(A = 1:10, B = 2:2:20)
10x2 DataFrame
|---|||
| Row # | A  | B  |
| 1 | 1  | 2  |
| 2 | 2  | 4  |
| 3 | 3  | 6  |
| 4 | 4  | 8  |
| 5 | 5  | 10 |
| 6 | 6  | 12 |
| 7 | 7  | 14 |
| 8 | 8  | 16 |
| 9 | 9  | 18 |
| 10| 10 | 20 |

julia julia df[A]
WARNING: indexing DataFrames with strings is deprecated; use symbols instead
 in depwarn at deprecated.jl:36
 in getindex at ~/.julia/DataFrames/src/deprecated.jl:107
10-element DataArray{Int64,1}:
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10





[julia-users] Anyone created MIME type for julia files?

2014-04-28 Thread cnbiz850

Care to share?


Re: [julia-users] Re: Help me optimize Stochastic Gradient Descent of Least Squares Error

2014-04-27 Thread cnbiz850

That is a great tip, thanks.

I am having similar issues.  I had the program in a file and run it with 
include(prog.jl) at the julia prompt.  It used to take 12 seconds per 
1 loops.  Now Putting it into a function and also changed some 
variables to const, I got it down to 3 seconds per 1 loops.  Big 
improvement, but not as big as 70 - 1.5.  Perhaps due to file IO in 
some of the loops?


On 04/27/2014 02:07 PM, Elliot Saba wrote:
Hey there Freddy.  The first thing you can do to speed up your code is 
to throw it inside of a function.  Simply replacing your first line 
(which is begin) with function domytest() speeds up your code 
significantly.  I get a runtime of about 1.5 seconds from running the 
function versus ~70 seconds from running the original code.


I believe the reason behind this is because outside of a function, all 
of these variables are treated as global variables, which cannot have 
the same assumptions of type-stability that local variables can have, 
which slows down computation significantly.  See this page 
http://julia.readthedocs.org/en/latest/manual/performance-tips/ for 
more info, and other performance tips.

-E






[julia-users] help with combined for statement

2014-04-24 Thread cnbiz850

for ff[1] in factors, ff[2] in factors, ff[3] in factors, ff[4] in factors,
ff[5] in factors, ff[6] in factors, ff[7] in factors,
ff[8] in factors, ff[9] in factors

To simplify the above, I tried the following but it didn't work:

for ff[1:9] in factors

Is there a similar simple way to do?


Re: [julia-users] julia nightlies current version

2014-04-23 Thread cnbiz850
I think you are running Xubuntu Raring, which reached end of life, and 
so they stopped building nightly for that OS.  I am on Trusty and am 
getting the nightly for Saucy.


On 04/23/2014 06:26 PM, Földes László wrote:
Is the Julia nightlies update every day as it used to do around 
January/February? I don't receive updates for a long time now, and I 
want to investigate whether it is a failed Xubuntu upgrade that killed 
the Sources, or the package really don't update.


Thanks

 versioninfo()
Julia Version 0.3.0-prerelease
Platform Info:
  System: Linux (i686-linux-gnu)
  CPU: Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz
  WORD_SIZE: 32
  BLAS: libblas.so.3
  LAPACK: liblapack.so.3
  LIBM: libopenlibm





[julia-users] help with using multiple cores

2014-04-19 Thread cnbiz850
Copied the following test code from the online documentation.  When 
tried to run it, I got the errors.  Any guidance please?


==
a = randn(1000)
@parallel (+) for i=1:10
  f(a[randi(end)])
end
==

$ julia -p 4
  _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
|__/   |  x86_64-linux-gnu

julia include(ParallelTest.jl)
exception on 2: exception on 4: ERROR: ERROR: ff not defined not defined

 in  in anonymousanonymous at  at no fileno file::33

 in  in anonymousanonymous at  at multi.jlmulti.jl::12631263

 in  in anonymousanonymous at  at multi.jlmulti.jl::840840

 in  in run_work_thunkrun_work_thunk at  at multi.jlmulti.jl::613613

 in  in run_work_thunk at run_work_thunk at multi.jl:multi.jl:622622

 in  in anonymousanonymous at  at task.jltask.jl::66

ERROR: no method +(UndefVarError, UndefVarError)
 in mr_pairwise at reduce.jl:536
 in mapreduce at reduce.jl:548
 in preduce at multi.jl:1403
 in include at boot.jl:244
while loading ~/Coding/Julia/ParallelTest.jl, in expression starting on 
line 1477





[julia-users] Re: help with using multiple cores

2014-04-19 Thread cnbiz850
Sorry, the error messages must have to do with the undefined f.  It 
works with the folowing.  So I guess simply adding @parallel (+) on a 
for loop can then realize using multiple cores?


===
nheads = @parallel (+) for i=1:2
  int(randbool())
end
===

On 04/19/2014 10:32 PM, cnbiz850 wrote:
Copied the following test code from the online documentation.  When 
tried to run it, I got the errors.  Any guidance please?


==
a = randn(1000)
@parallel (+) for i=1:10
  f(a[randi(end)])
end
==

$ julia -p 4
  _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
|__/   |  x86_64-linux-gnu

julia include(ParallelTest.jl)
exception on 2: exception on 4: ERROR: ERROR: ff not defined not defined

 in  in anonymousanonymous at  at no fileno file::33

 in  in anonymousanonymous at  at multi.jlmulti.jl::12631263

 in  in anonymousanonymous at  at multi.jlmulti.jl::840840

 in  in run_work_thunkrun_work_thunk at  at multi.jlmulti.jl::613613

 in  in run_work_thunk at run_work_thunk at multi.jl:multi.jl:622622

 in  in anonymousanonymous at  at task.jltask.jl::66

ERROR: no method +(UndefVarError, UndefVarError)
 in mr_pairwise at reduce.jl:536
 in mapreduce at reduce.jl:548
 in preduce at multi.jl:1403
 in include at boot.jl:244
while loading ~/Coding/Julia/ParallelTest.jl, in expression starting 
on line 1477







[julia-users] Re: help with using multiple cores

2014-04-19 Thread cnbiz850
I also tried the following code with pmap.  It ran and seemed to run 
with 4 processes as shown with 'top'.  But using pmap with my own 
function, I don't see it run with 4 processes.  What can be wrong?


==
M = {rand(1000,1000) for i=1:10}
pmap(svd, M)
==

On 04/19/2014 10:38 PM, cnbiz850 wrote:
Sorry, the error messages must have to do with the undefined f.  It 
works with the folowing.  So I guess simply adding @parallel (+) on a 
for loop can then realize using multiple cores?


===
nheads = @parallel (+) for i=1:2
  int(randbool())
end
===

On 04/19/2014 10:32 PM, cnbiz850 wrote:
Copied the following test code from the online documentation.  When 
tried to run it, I got the errors. Any guidance please?


==
a = randn(1000)
@parallel (+) for i=1:10
  f(a[randi(end)])
end
==

$ julia -p 4
  _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
|__/   |  x86_64-linux-gnu

julia include(ParallelTest.jl)
exception on 2: exception on 4: ERROR: ERROR: ff not defined not defined

 in  in anonymousanonymous at  at no fileno file::33

 in  in anonymousanonymous at  at multi.jlmulti.jl::12631263

 in  in anonymousanonymous at  at multi.jlmulti.jl::840840

 in  in run_work_thunkrun_work_thunk at  at multi.jlmulti.jl::613613

 in  in run_work_thunk at run_work_thunk at multi.jl:multi.jl:622622

 in  in anonymousanonymous at  at task.jltask.jl::66

ERROR: no method +(UndefVarError, UndefVarError)
 in mr_pairwise at reduce.jl:536
 in mapreduce at reduce.jl:548
 in preduce at multi.jl:1403
 in include at boot.jl:244
while loading ~/Coding/Julia/ParallelTest.jl, in expression starting 
on line 1477









[julia-users] line continuation

2014-04-16 Thread cnbiz850

Searched but didn't find an answer.

Does Julia allow statement to continue on the next line?


Re: [julia-users] line continuation

2014-04-16 Thread cnbiz850

Thanks for the answer.

I tested previously this but it did not work:
if ab  bc  cd
 de  ef

But now this works:
if ab  bc  cd 
de  ef

So the  got to be on the end of the first for it to know that the line 
is not finished.



On 04/17/2014 06:25 AM, Stefan Karpinski wrote:

If the expression is incomplete, continuation is automatic. There is no 
explicit continuation syntax.


On Apr 16, 2014, at 6:01 PM, cnbiz850 cnbiz...@gmail.com wrote:

Searched but didn't find an answer.

Does Julia allow statement to continue on the next line?




Re: [julia-users] julia installation on Ubuntu

2014-04-15 Thread cnbiz850
Sounds like you have some broken packages in Ubuntu.  I would open 
Synaptic to resolve the broken packages first.



On 04/16/2014 06:17 AM, Stéphane Laurent wrote:

Hi,

I have just tried to install Julia but typing julia as a command 
line does not run anything (command not found). I have followed the 
following steps:


/ sudo add-apt-repository ppa:staticfloat/juliareleases/
/
/
/ sudo apt-get update/
/
/
/ sudo apt-get install julia/



I got a problem at the second step :

/$ sudo apt-get update/
/.../
/Hit http://www.openprinting.org lsb3.2/contrib Translation-en /
/Fetched 4,461 kB in 28s (155 kB/s) /
/Reading package lists... Done/
/W: GPG error: http://cran.rstudio.com precise/ Release: The
following signatures couldn't be verified because the public key
is not available: NO_PUBKEY 51716619E084DAB9/


and at the third step :

/$ sudo apt-get install julia/
/Reading package lists... Done/
/Building dependency tree /
/Reading state information... Done/
/Some packages could not be installed. This may mean that you have/
/requested an impossible situation or if you are using the unstable/
/distribution that some required packages have not yet been created/
/or been moved out of Incoming./
/The following information may help to resolve the situation:/
/
/
/The following packages have unmet dependencies:/
/ julia : Depends: libopenblas-base but it is not going to be
installed or/
/  libblas3 but it is not installable or/
/  libatlas3-base but it is not installable/
/ Depends: liblapack3 but it is not going to be installed or/
/  libatlas3-base but it is not installable/
/ Depends: libcholmod1.7.1 but it is not going to be
installed/
/ Depends: libumfpack5.4.0 but it is not going to be
installed/
/ Depends: libarpack2 but it is not going to be installed/
/E: Unable to correct problems, you have held broken packages./



What should I do ? Please consider I'm a newbie in Linux (I don't even 
know what sudo means, I'm only copying-pasting some instructions).




[julia-users] easy way to print elegantly

2014-04-07 Thread cnbiz850

julia println(aa,  , bb)
1.5231071779744345 33.97688693695

Is there a simple way to print
1.52 33.97

perhaps without the C format?


Re: [julia-users] easy way to print elegantly

2014-04-07 Thread cnbiz850

Thank you.

I am hoping if we could do something like this:

println(aa[1,5],  , bb[1,5])

hopefully one can access part of strings that way.

On 04/08/2014 10:05 AM, Stefan Karpinski wrote:

julia @printf(%.2f %.2f\n, aa, bb)
1.52 33.98

Note the rounding of bb.

On Mon, Apr 7, 2014 at 9:35 PM, cnbiz850 cnbiz...@gmail.com 
mailto:cnbiz...@gmail.com wrote:


julia println(aa,  , bb)
1.5231071779744345 33.97688693695

Is there a simple way to print
1.52 33.97

perhaps without the C format?






[julia-users] how to determine a variable is a number

2014-03-23 Thread cnbiz850
typeof(var) gives something too specific, like Int16, Float32, etc. Is 
there a convenient way to determine if var is a number or something else 
(string)?  I tried isreal(var), but it gives an error in case var is not 
a number.




[julia-users] Re: how to determine a variable is a number

2014-03-23 Thread cnbiz850

OK, just found this.

typeof(var) : Number

On 03/24/2014 09:20 AM, cnbiz850 wrote:
typeof(var) gives something too specific, like Int16, Float32, etc. Is 
there a convenient way to determine if var is a number or something 
else (string)?  I tried isreal(var), but it gives an error in case var 
is not a number.






Re: [julia-users] Re: how to determine a variable is a number

2014-03-23 Thread cnbiz850

Use to determine something read in from a file.

On 03/24/2014 09:30 AM, Collin Glass wrote:
Hmm.. What's your use case? I mean you could just whip up a quick 
function isnum that returns true if typeof is any of the collection of 
formats.





On Sunday, March 23, 2014 9:20:51 PM UTC-4, K leo wrote:

typeof(var) gives something too specific, like Int16, Float32,
etc. Is
there a convenient way to determine if var is a number or
something else
(string)?  I tried isreal(var), but it gives an error in case var
is not
a number.





Re: [julia-users] Simple speed test

2014-03-22 Thread cnbiz850
On Ubuntu Trusty 64bits with i7 laptop, my result as follows.  Notice 
the difference from Jason's


julia @elapsed begin
x = 0
for n = 1:1
  x += 1
end
x
  end
4.576735929

julia function g()
  x = 0
  for n = 1:1 x += 1 end
  return x
  end
g (generic function with 1 method)

julia @elapsed g()
0.105158858

On 03/23/2014 12:18 PM, Jason Merrill wrote:

This is not a small nit that John is picking:

julia @elapsed begin
 x = 0
 for n = 1:1
   x += 1
 end
 x
   end
7.333491931

julia function g()
   x = 0
   for n = 1:1 x += 1 end
   return x
   end
g (generic function with 1 method)

julia @elapsed g()
0.047755206

The second version makes you wonder what on earth PyPy is doing for a 
whole second ;-)






Re: [julia-users] Re: Not fun

2014-03-21 Thread cnbiz850
Well, from this perspective, it makes sense why those strings should not 
be mutable.


But from other perspectives, making strings immutable contradicts with 
how natural languages are used.  For instance, after I said I am a 
professor, I want to say I am a scientist, or perhaps I change my 
mind and say I am a scholar.


Perhaps the key here is that we make a distinction between string and 
word.  It is totally understandable and reasonable that words are not 
mutable.  But a string, as a sentence, should not be immutable.


On 03/21/2014 09:09 PM, Ivar Nesje wrote:
We try to be helpful, and answer the questions as asked. We also 
provide advice for improvements, if the question is likely to lead to 
a poor program.


Julia gives you as a programmer lots of power, and if you don't follow 
advice, you might end up in trouble.


If you change the internal representation of a string, you will run 
into trouble in some parts of Julia, because we assume that strings 
are immutable. If you never let other parts of Julia hold a reference 
to the string while you are manipulating it, you should be alright.


eg.
a = Dict()
b = hello
a[b] = 1
b.data[5] = 'a'

will make the value in the dictionary inaccessible.

julia a[b]
ERROR: key not found: hella
in getindex at dict.jl:586

julia a[hello]
ERROR: key not found: hello
in getindex at dict.jl:586

Ivar

kl. 13:42:23 UTC+1 fredag 21. mars 2014 skrev Andreas Lobinger følgende:

Hello colleagues,

this conversation is covering one of the most dangerous things
that you can do in SW engineering:

- How can i do X?
- This is not meant to be used. But i have a work around for you.

You can be absolutely sure that this will propagate and be the new
default way.
(I'm cleaning up other people's code at the moment, not julia, but
still...)






Re: [julia-users] Re: [First post] What IDE everyone uses?

2014-03-19 Thread cnbiz850

That doesn't seem to work.  I got the the follow:

julia-studio-julia-0.3-compatibility/bin$ ./julia-studio.sh
./julia-studio.sh: 35: exec: ./JuliaStudio: not found

On 03/19/2014 10:56 PM, Uwe Fechner wrote:

Hi,

Julia Studio for Julia 0.3beta is available here:
https://github.com/forio/julia-studio/tree/julia-0.3-compatibility

I would not use anything else.

Regards:

Uwe

On Monday, March 17, 2014 6:14:51 AM UTC+1, K leo wrote:

Hi everyone, I am new to Julia.

JuliaStudio is broken for me with the new 0.3 nightly.

But I discovered gedit is great with Julia.  It even has code
completion.

Any other good environment?





[julia-users] [First post] What IDE everyone uses?

2014-03-16 Thread cnbiz850

Hi everyone, I am new to Julia.

JuliaStudio is broken for me with the new 0.3 nightly.

But I discovered gedit is great with Julia.  It even has code completion.

Any other good environment?