« first day (857 days earlier)      last day (3624 days later) » 

2:12 AM
@Gabriel Some of them are ;-) (not me)
 
@halirutan to run some given code on each new subkernel: see mathematica.stackexchange.com/a/7117
 
 
3 hours later…
4:54 AM
@Kuba Block[{x = HoldForm@x}, x]
 
 
2 hours later…
7:16 AM
@RolfMertig sure, but this does not tell us anything about validity of the code :)
only that the syntax parser is not perfect :)
 
8:16 AM
The OP in this question copied code from a Wolfram Demonstration and then put it on here. Is this OK with WRI's copyright? It seems like taking code that is under copyright and then putting it under a license that says it belongs to Stackexchange would not be OK.
 
@Pickett I think asking him would be a good idea ;) Good morning Anon :)
 
@Kuba Good morning to you :) I don't think the OP has a clue. And he probably doesn't care... his request is so specific I have to wonder if it's not homework.
"I'm a beginner and I cannot start learning until someone has showed me how to make a zoomable Koch's snowflake" that is a very specific requirement for someone who is learning :P
 
@Pickett quite tough homework for a beginner too :) It's rather "oh, this looks great, I;ve got MMA available in university, should be doable... by someone else."
 
@Kuba yes lol
 
:p
 
8:44 AM
Does anyone have experience using Intel's Xeon Phi and Mathematica ?
 
9:31 AM
I've faced strange behaviour:

1
2
3

is evaluating to

3
2
1

Out[_] has proper indices but it is strange and remains after kernel restert. New notebook works well fortunately.
AbsoluteOptions of both notebooks are the same...
 
 
2 hours later…
11:32 AM
@rasher mie o mie - comment made me laugh :-)
 
 
6 hours later…
5:40 PM
Do batch operations with SQLInsert only work with numeric data? I'm inserting 1000 strings one at a time and 100 at a time and both ways take 30 seconds. I'll try constructing the query manually.
 
6:00 PM
Anyone around? @MichaelHale? :)
 
Alo
 
@Rojo got 2 min? :)
 
@Kuba Yeah
 
Please try this code:

DynamicModule[{pt = {{0, 0}}},
Column[{
Dynamic[
locatorpane =
LocatorPane[Dynamic[pt],
Graphics[{Gray, Disk[]}, ImageSize -> 200]]
],
Dynamic@pt
}]
]

Button["Print", Print@Rasterize@locatorpane]

it works like it should, then delete the row with `Dynamic@pt` and try again.
Why LocatorPane does not trigger Dynamic to update? Also with TrackedSymbols:>{pt} within Dynamic[locatorpane=...` it fails.
I mean why it does not trigger assignment.
 
@Kuba Let's see
When I remove the row, what should happen? (or not happen?
 
6:14 PM
@Rojo IMO it should print current image of locator pane but it prints the initial one.
because assignment od locatorpane is inside dynamic.
but without part of cell with Dynamic@pt the assignment is not updated
 
@Kuba But it doesn't reaaaally work for the first case either
Wait
@Kuba Let's go one step at a time
 
ok
the code I've posted
 
You are assigning locatorpane to be some function of Dynamic[pt]
Dynamic doesn't evaluate
so, locatorpane isn't really changing its value, doesn't matter if inside a Dynamic
 
no
@Rojo I don't. The assignment is in Dynamic: Dynamic[ locatorpane = Locator[...
 
@Kuba go on with the ..., hehe
 
6:17 PM
so I'm assigning it whenever this Dynamic is updated,
or, am I not?
 
@Kuba but you are assigning LocatorPane[Dynamic[pt]...
 
:P
 
and Dynamic[pt] will always be Dynamic[pt], no matter the value of pt
 
ok, so?
 
@Kuba so, locatorpane will always be LocatorPane[Dynamic[pt],...]
It's position is not save in locatorpane, but in pt
which is out of scope of the button that rasterizes
 
6:20 PM
but the code which I've posted works, why?
 
@Kuba It's one of those things that work but that aren't guaranteed to
and won't always work, and the Futz would forbid you to use
It has to do with how the kernel saves the front end variables, blabla, noone really knows
 
hmm
 
@Kuba I'd suggest you/we find neat ways out ;)
 
So I have to put the button inside the scoping construt of pt?
 
@Kuba That's a possibility
Another one is having a global (like locatorpane) save the position of the locator, or the locator at that position (no dynamic)
 
6:25 PM
@Rojo so again, if you want to do something more you have to avoid Manipulate, LocatorPane etc and create your gui from scratch? :)
 
@Kuba well, depends on what. Manipulate can do lots of stuff. But I never learned half of them :P
 
@Rojo my different approach was:

DynamicModule[{pt = {{0, 0}}},
 LocatorPane[Dynamic[pt], Graphics[{Gray, Disk[]}, ImageSize -> 200]]]

Button["Print",
 Print@Rasterize@
   ToExpression@First@NotebookRead@Experimental`PreviousCell[]]
 
Blergh
Haha
 
but it seem to work only by accident, as above.
 
Yes,b ecause
you are still outside the scope
but perhaps you could use that approach with Setting
somehow
 
6:28 PM
I know but I thought brute force will be enough :P
Setting will give me only values of pt
 
But once you have the values, you got rid of the main problem
 
but it's one of the :good: ways indeed
 
Perhaps what you did should work I couldn't tell you without trynig and thinking
Hummm, give me a second, I want to try something
 
Sure
 
@Kuba I'm just checking something. If you are willing to use your brute force, you could simplify it quite a bit
 
6:36 PM
@Rojo The problem is that as soon as you add custom Appearance option to LocatorPane it does not show locators in printed cell :)
 
@Kuba What I mean is
if you are willing to read the state from the cell expression
you don't need any variables or dynamics
Let's see
LocatorPane[{0, 0}, Graphics[{Gray, Disk[]}, ImageSize -> 200]]

Button["Print",
Print@Rasterize@
ToExpression@First@NotebookRead@Experimental`PreviousCell[]]
I'm just saying that I think your brute force approach doesn't make sense with dynamic. You can just have the state in the cell expression, if you don't need anything else to autoupdate
 
@Rojo Let's assume it is only a toy example and it is needed.
 
@Kuba The simplest, I think, is to just keep your state in a variable (just the point, not the locator), and have everything that needs that variable to be in scope
You can do that either by making pt global
by putting the button inside the dynamic module
 
@Rojo ok. this makes sense.
 
by making pt belong to the notebook (TaggingRules)
 
6:41 PM
thank you
 
or by creating the extra cell dynamically and inheriting the scope
No problem
 
that's a pity that things that should not work work
I probably have more bad habits
 
Yes, it's confusing
 
@Rojo feel free to answer this guy: mathematica.stackexchange.com/questions/48462/… :)
 
@Kuba Hehe, I'm not watching the questions much lately
 
6:44 PM
@Rojo yes, I've seen, why?
 
@Kuba Not sure, lost the habit. Or perhaps when I watch I don't find many interesting ones
and perhaps I am not as willing to make an effort to build nice answers, to things that many other people can answer
 
many of high rep users don't lately. the standards are decreasing...
 
@Kuba My rep has been almost constant these last several months
One day I'll wake up and I'll be in 999th place
 
@Rojo I don't think so, folks thoughts seem to be similar to yours sooner these days
I mean, they are leaving as 95% of topics are basic stuff.
 
@Kuba Probably your brute force approach does make sense in his question
 
7:00 PM
@Rojo maybe, but it's wrong too:

DynamicModule[{pt = {{0, 0}}},
LocatorPane[Dynamic[pt], Graphics[{Gray, Disk[]}, ImageSize -> 200],
Appearance -> Graphics@Disk[{0, 0}, Scaled@.01]]]

Button["Print",
Print@Rasterize@
ToExpression@First@NotebookRead@Experimental`PreviousCell[]]
try this.
 
@Kuba So that's what you meant with Appearance ruining it
 
@Rojo yep.
 
Weird
Buggy
 
@Kuba Sorry, back now. Went for a walk. Seems you narrowed it down though.
 
@MichaelHale Hello
(brb)
 
7:07 PM
@MichaelHale let's say that thanks to Rojo I know what to do but I don't know when some other idea fails. So as usual.
 
Ah
I tried using the wiki traffic server again last night, and it was getting bogged down again (up to 5 seconds per article traffic request). So I finally am working on downloading all of the traffic logs and making my own traffic database.
But my initial attempt took more than an hour to process an hour of traffic data, so that won't work.
 
(back)
@Kuba It seems like a bug that it doesn't turn it back into expression properly
You could try rasterize the whole cell as boxes
Button["Print",
Print@Rasterize@NotebookRead@Experimental`PreviousCell[]]
 
@Rojo oh, I've though that my procedure is too long :P see that's why you guys should participate more, to avoid me posting crap answers
 
@Kuba Hehe
I would make it Method->"Queued" in case it takes long
 
@Rojo no I won't unless you can explain :P
 
7:17 PM
@Kuba Default method is preemptive
 
yes
 
so, it blocks the front end, and I think it will timeout
I usually, unless necessary, use queued unless I have a good reason to want it to run during other evaluations
 
@Rojo no no, too long I mean there were reduntant ToExpression@First@
 
@Kuba Hehe. I think if it was me I would make it queued anyway
WREAaaaaaach
 
@Rojo :) Hi, Rojo!
 
7:26 PM
Atlanta 96's olympic song just came to mind
Olympic and world cup songs back then used to be nicer
@WReach Hi :)
What's up
 
@Rojo Not too much. Just been grazing for interesting questions. Fewer seem to catch my eye these days. What's up with you?
 
@WReach We just talked about that with Kuba.
I'm ok. Not in a very productive mood today
I've finally got started with Linux, long due. I'm a 5 year old linux user
What else
I'll be playing soccer tomorrow night and it's cold. I wish I don't die
I still suck with Linux, but I had a happy moment when I had a terminal with one tab in R, another one in MMA, another one in Octave, another one in Python
all coloured differently, hehe. I clearly don't need much to be happy
 
@Rojo Now that's multi-tasking. You need to add a Julia window to the mix...
 
@WReach Three steps at a time, not four. I still baarely know R and python, and shell scripting. I fear that adding more would begin to be confusing :)
@WReach Since you are grazing for interesting questions, one just came to mind. Perhaps I know the answer but it didn't occur yet.
How do you enqueue something for evaluation?
from a preemptive evaluation, say a button
 
@Rojo Nothing leaps to mind. Hmmm...
 
7:36 PM
Say a button has some quick preprocessing that has to be done immediately, and then the bulk of the work can be done later. Button["Do", With[{preproc=f[]},enqueue[g[preproc]]]
 
@Rojo would this work?
enqueue[expr_] := FrontEnd`AsynchronousDynamicEvaluate[expr, 0]
 
@WReach Looks good, let's see
@WReach It seems like it doesn't work
Running FrontEnd`AsynchronousDynamicEvaluate[Pause[3], 0] doesn't return immediately. If run from a button it blocks for 3 secs, etc
 
@Rojo Too bad. The name came up when I just now spelunked for names related to evaluation. I found its definition in GetFEKernelInit.tr.
You could always used a plain ordinary AsynchronousTask I suppose.
 
@WReach True, I forgot about them
 
@Rojo Particularly if you are running X I find the MMA frontend to be a really nice sandbox for shell tasks. Just food for thought :)
 
7:51 PM
@mfvonh Feed my thoughts anytime :)
I never used asyncronous tasks
I'm shocked, I thought I had played with almost all areas of documented functionality
 
I meant ScheduledTasks.
 
@WReach But I think those are preemptive
Another useful feature would be to be able to "enqueue for evaluation in a subsession". Or at least as an intermediate method for buttons or dynamic. Method->"QueuedButHurry"
 
@Rojo I'm trying to figure out a way to push an invisible button or similar control with method-queued.
 
@WReach Haha, big hacks. An invisible notebook with DynamicNotebookEvaluation with SyncEval->False?
 
@Rojo Something like that. Of a dynamic wrapper with a trigger.
 
8:05 PM
I am joining your attempts
@WReach But even if these approaches worked, we could only communicate between the preemptive and the queued evaluations by some variable, right?
 
@Rojo Yes, probably a dynamic module variable.
 
8:22 PM
@WReach
SetAttributes[enqueue, HoldFirst];
enqueue[code_] := Module[{nbo},
nbo = CreateDocument[
Dynamic[code, SingleEvaluation -> True,
SynchronousUpdating -> False], "WindowOpacity" -> 0];
NotebookClose[nbo];
SetSelectedNotebook@EvaluationNotebook[];
]
But, best case scenario, it need MMA not to be minimized
which is not a problem most of the times
 
@Rojo That looks good -- nice hacking.
 
@WReach Thanks, your idea. Visible->False didn't update
 
@Rojo Yes. I see the window title bar blinks briefly while the "worker notebook" has focus.
 
@WReach Yes. And it's annoying to use it in a ScheduledTask, because of that loss of focus, and because it won't work if minimized. But it's a partial successs
Thanks
runInSubsession will wait for another time
 
8:39 PM
@Rojo This mostly works, but exhibits similar visual artifacts:
DynamicModule[{t = 1, go = False}
, Column @
  { Dynamic @ Row @
     { Dynamic[t = 3 - t; {"tick", "tock"}[[t]]]
     , Dynamic[
         If[go, Pause[5]; Print@"slow"; go = False]; ""
       , SynchronousUpdating -> False
       ]
     }
  , Button["Go!", Print@"fast"; go = True]
  }
]
 
8:53 PM
Some new functionality usage:
http://community.wolfram.com/groups/-/m/t/239130
Chicago Loop: Godzilla of Energy Consumption
 
@WReach Yep. Mostly works
 
9:27 PM
Ok, got it from 30 seconds to 0.7 seconds with manual query construction.
SQLExecute[db,
     "INSERT INTO articles (title) VALUES " <>
      StringJoin@
       Riffle["('" <>
           StringReplace[
            If[StringLength@# > 256,
             StringTake[#, 256], #], {"'" -> "''", "\\" -> "\\\\"}] <>
            "')" & /@ #, ","]] & /@
   Partition[data2, 100, 100, {1, 1}, {}]; // AbsoluteTiming
 
10:23 PM
If I have a complex expression with a few custom symbols repeated many times, is MMA doing something to optimize memory or are those symbols being repeated over and over?
 
@mfvonh A symbol itself is not expensive in memory and I guess it is internally only a pointer, but you need to store the structure of your expression.
@mfvonh You can make your own tests by using ByteCount which gives you the number of bytes used to store an expression.
 
@halirutan Thanks. Yeah they look like pointers to me
Table[word, {100000}] // ByteCount (* 800080 *)
Table[True, {100000}] // ByteCount (* 800080 *)
Table[0, {100000}] // ByteCount (* 800144 *)
Sorry I am not used to shirt+enter for linebreak hah
shift ++messagecount
 
10:39 PM
@mfvonh But Shift+Enter should work here.
 
10-4
 
@mfvonh I'm a bit puzzled why ByteCount[f] gives 0 here. The other things make sense:
A symbol is 8 byte here (64bit machine)
A function call is 40 bytes (where 8 bytes are used for the Head) plus the memory of the arguments.
 
@halirutan I noticed that too.
What do you mean when you say a symbol is 8 bytes? How are you measuring that (if not ByteCount[f])?
 
@mfvonh So for a+b which is Plus[a,b] we have 40 bytes for the function call where 8 bytes are used for the head Plus and 8 bytes for a and 8 bytes for b.
 
ah
you were right about pointers (obviously in retrospect lol)
Maybe it doesn't count the string it stores in the symbol table
Which is part of what I was wondering: whether the length mattered
 
10:48 PM
@mfvonh You instantly see that since function calls are more expensive, when you have nested expressions, they are larger:
Nest[f, a, 10] // ByteCount€
f[a, a, a, a, a, a, a, a, a, a] // ByteCount
Both expressions have the same number of symbols, but the first one is 4 times larger
 
But I assume that's the tree data, not necessarily the symbol, right?
 
@mfvonh With tree data you mean function call, right?
Like f[a,b].
 
Yeah. Is that the correct way to describe it if it's not defined as a function? (Not trying to quibble at all)
 
@mfvonh It's the other way around: You can represent or display code as a tree where nodes are function calls.
@mfvonh Basically, Mathematica code consists only of function calls and atoms like symbols, numbers or strings.
 
@halirutan So all expressions are just something like linked lists?
 
10:59 PM
@mfvonh A linked list is always a linear sequence. Every element points to it's next element. f[a,b] has 2 links. One to a and one to b. That's why you can represent it as a tree.
 
@halirutan Thanks now I understand your point earlier. That distinction is particularly helpful as I'm just using these symbols temporarily to tag information during pattern matching, so a pretty structure is not necessary. It seems like I can gain some efficiency by appending symbols to expressions rather than wrapping expressions with them.
 
@mfvonh Your expressions get really that large that you run into trouble?
 
@halirutan I'm experimenting with representing annotated text as expressions on pretty large chunks of data (I need it to scale to a few GB of text at a time if it is to be useful). I'm hoping to be able to wrap individual words (and everything bigger) and tag them with symbolic annotations but I have a poor sense of what the cost will be in terms of memory and computation.
 
11:16 PM
@mfvonh Did you know that Mathematica already uses this?
 
@halirutan No but it sounds like I need to
 
@mfvonh Let's say you write text in a notebook and format it like the following snipped:
 
Oh you mean like styles and the like. Yes I understand that system pretty well.
 
If you press now Ctrl+Shift+E you see the cell expression which is exactly what you discribed:
Cell[TextData[{
 "I' ",
 StyleBox["m",
  FontWeight->"Bold"],
 " ",
 StyleBox["experimenting",
  FontWeight->"Bold",
  FontColor->RGBColor[0, 0, 1]],
 " ",
 StyleBox["with",
  FontSlant->"Italic"]
}], "Text"
 
Heyyyyy you've got to hiiiide your love awaaay
 
11:19 PM
Yeah exactly. I am interested in duplicating that exactly, just as efficiently as possible since I assumed the cost would add up for very large volumes of text.
For semantic information rather than style
The default stylesheet has certain styles flagged with something like "NaturalLanguage" (e.g. the Text style). I thought that's what you were referring to at first.
 
Christ you know it aint eaa syyy. You know how had it can be e e eee
 
@mfvonh Maybe I'm mistaken here, but I guess you can make a rough estimate of the memory you will need. Do you know how many annotations you need?
@Rojo You are drunken, right? I would like a rum-cola.
 
@halirutan Just finger-singing
I could have opened a text editor, but I wanted to share it with you
 
@Rojo Ahh, that's nice of you :-)
 
:)
 
11:30 PM
@halirutan I'm guessing on the order of 10^9 or ^10
 
@mfvonh OK, let me give you some hints:
 
Table is evidently not the way to test the limits of my computer's memory
All ears :)
 
@mfvonh First of all, it seems a string always needs at least 40 bytes here, no matter whether it is "a" or "aaaaaaa". Therefore, while a very long string is very memory efficient, you will run into problems when you need to annotate single words, because then they always need at least 40 bytes.
So while you only need 48 bytes for the string "1234567890", you will need 400 bytes if you have 10 separate strings "1", "2", ..
 
Makes sense
So it seems like a separate table with annotations and stringpositions is the way to go
or possibly embedding some info in the string itself
 
@mfvonh No, not really. You need two numbers to define position and length of the annotation.
Two integers need 32 bytes :-)
@mfvonh Let me say something about the annotation itself:
Let's use a very simple example
lstr = ToString /@ Range[4]
annotated = Nest[Partition[#, 2] &, List /@ lstr, 1];
TreeForm[annotated]
Here, the head List is considered to be an annotation of your choice. It doesn't matter whether the head is List or Red
When I see this right, you can calculate the memory usage in the following way. A function-call uses 40 bytes plus 8 bytes for every argument. The strings need at least 40 bytes. If you are lucky and the text-parts you annotate are longer, then you will require not really more memory than the original string needed.
Sorry, again:
For the example above we have 7 annotations with 2 arguments for 3 annotations and 1 argument for the bottom 4 annotations makes 7*40+3*2*8+4*8 and 4*40 for the strings
@mfvonh Makes 520 bytes which is exactly the number I get when I use ByteCount[annotated]
@mfvonh So if you have n annotations which are non-nested and with longer strings, then you will need about n*(40+8) bytes more then your initial text.
@mfvonh For your 10^10 annotations, this gives 10^10*48/2^30. = 450GB of memory.
 
11:59 PM
@halirutan which is a lot :)
 

« first day (857 days earlier)      last day (3624 days later) »