« first day (831 days earlier)      last day (3663 days later) » 

4:31 AM
@Kuba In v8 I'm seeing a message because the Select returns {} and then once the documentation is opened, subsequent F1s behave normally. The notes section starts in its usual closed state.
 
 
2 hours later…
6:05 AM
@MichaelHale Hi, Are you still there?
 
I am. Trying typing with controller from couch on TV. What's up?
 
@MichaelHale :) Please open a new notebook + any help page and tell me what gives: ("DocumentType" /. NotebookInformation[#]) & /@ Notebooks[]
 
{"Notebook", "Help", "Notebook"}
 
@MichaelHale and `Select[Notebooks[], (("DocumentType" /. NotebookInformation[#]) ===
"Help") &]` gives `{}`?
 
{
NotebookObject[
FrontEndObject[
LinkObject["a2b_shm", 1, 1]], 14]}
Only gave {} on first with no doc page open.
 
6:21 AM
@MichaelHale Forgive me for spam but please try: (but first close the docs)

Documentation`HelpLookup["Plot"];
   test =
    Select[Notebooks[], (("DocumentType" /. NotebookInformation[#]) ===
          "Help") &][[1]];
 
Part::partw: "Part 1 of {} does not exist" then opens doc.
I don't mind. Watching movie Ive seen before.
 
@MichaelHale That sucks, evaluation order is not my strong side. I have to test it myself and find someone with v8.
 
6:49 AM
I'd only know to use Pause for this situation.
 
@MichaelHale I guess it will not work but please try and tell me, I may be mistaken :)
 
I tried before I told you. It works, but I don't know if that's clean enough for your purposes.
 
7:04 AM
@MichaelHale I'm not sure if it is :/
Have to think about this, anyway, many thanks for help :)
 
No problem.
 
zab
Greetings all
 
@zab Hi
 
zab
@Kuba, hello!! Thanks for all the help recently!!
:-)
but I still need to sort out this button issue
still a bit stuck.
It's a small thing:
 
No problem :)
 
zab
7:13 AM
Button["Run", function[] // Print ] works
but when I press the button again, it creates a duplicate,
I'd like to have the same cell updated with the new answer
Possible?
 
@zab quick fix
Button["Run", NotebookDelete@Experimental`NextCell[];
function[DateString[]] // Print]
 
zab
@Kuba, Oooo! I try it now.
@Kuba, what is this @Experimental` ? I can't find any help on it from ?Experimental
 
@zab It's undocumented but it's not a must here. It's just faster than SelectionMove[.... You have to look for a topics here that contain it, for example: mathematica.stackexchange.com/a/41722/5478 . Experimental is a context so you may want to try Names["Experimental`*"]
 
zab
It doesn't seem to work for my function. My function makes a dynamic plot, and when I press the button, it produces a duplicate plot in a new cell.
OK, back.
 
8:06 AM
@sektor you like wavelets, please take a look at mathematica.stackexchange.com/q/22422/5478
@zab I can't halp you without the code, could you prepare a minimal working example that my way can't handle?
 
zab
8:18 AM
@Kuba, it is working now. :-/ It seems Mathematica Linux version has a lot of bugs.
 
@zab oK ;) be careful to not deleted the next cell if there is any other
 
8:31 AM
@Kuba I have a solution, just last night I was again looking at it :D
@Kuba Great timing :D !
 
@Sektor :p great :)
 
9:08 AM
@MichaelHale OK, I've posted your suggestion mathematica.stackexchange.com/a/46894/5478 it's better than nothing :)
 
10:05 AM
Pause seems fine for that. Maybe on a slow/busy computer the first time a doc page is loaded it might take more than a second, but generally it should work. I do think the OP is exaggerating the impact of that design decision on his workflow. Nice work though.
 
 
7 hours later…
5:17 PM
What is the simplest / easiest / most efficient way to set the diagonal of a matrix to zero (or to a certain set of values)? I need to do this often and it still seems there should be an easier solution than the things I'm doing ...
Do[a[[i, i]] = 0, {i, Length[a]}] <- don't like it because it's procedural and changes the variable (instead ofg just returning a result)
a (1-IdentityMatrix@Length[a]) <- memory hungry, makes a big identity matrix for no reason
a - DiagonalMatrix@Diagonal[a] <- same as above
a - DiagonalMatrix@SparseArray@Diagonal[a] <- not sure if still memory hungry, but it's getting overly complicated at this point
 
 
1 hour later…
6:24 PM
@Szabolcs I don't know about speed or memory measures, but ReplacePart[mat,{i_,i_}-> 0] might work
 
6:37 PM
@chuy Nice, thanks! :-)
I do wonder if it test every possible index pair to select the ones that match {i_, i_}. But it's nice and concise.
 
6:48 PM
 
Hi @Szabolcs! How about this:
 
@Szabolcs It doesn't look linear.
 
Function[mat,
 Module[{len = Length[mat], rotated},
  rotated = MapThread[RotateLeft, {mat, Range[0, len - 1]}];
  rotated[[All, 1]] = 0;
  MapThread[RotateRight, {rotated, Range[0, len - 1]}]]]
 
a = Table[RandomReal[1, {b, b}], {b, 1, 60000, 1000}];
First@AbsoluteTiming[ReplacePart[#, {i_, i_} -> 0]] & /@ a // ListPlot
Not sure if it's from pattern matching, copying, or both though.
 
@MichaelHale I think, this is inherent in ReplacePart
 
6:54 PM
here's another way MapAt[#*0 &, mat, Array[{#, #} &, Length[mat]]]
 
7:08 PM
@chuy Better, but I guess any non-destructive version of this will be quadratic unless the matrix rows are represented as linked lists, which you wouldn't want for most purposes.
Oops, the first code I posted should be to 6000 not 60,000.
 
7:23 PM
hey all
 
Hi Vitaliy
 
@Szabolcs hey friendly soul ;)
in the editor - buttons list and list numbered - shouldn't they work on a few lines ?
 
@VitaliyKaurov in the SE editor? Which buttons?
 
list and list numbered
 
Oh, I see. You're right, they don't ...
 
7:27 PM
they work only per line
a bit silly considering typing "- " is so much faster
the only advantage they would have is not typing any "*" at all , selecting many lines - and clicking the button
well i am probably nitpicking
 
I think I've never used those buttons. I always type * or numbers. I use bold, italic, code and quote a lot though (mostly through keyboard shortcuts).
@LeonidShifrin Looks good. :-) FInally I decided to just write it once and put it in a package where I keep some small functions I use often. The a - DiagonalMatrix@SparseArray@Diagonal[a] version seems faster and more memory efficient for large packed arrays. I should probably write a Compile solution for large packaged arrays.
This should be closed as the duplicate of the link I gave, not as a duplicate of "Common pitfalls..."
 
7:42 PM
@LeonidShifrin Ah, nice. @Szabolcs Yeah, I'd go with Compile for this if you're doing it a lot.
 
@Szabolcs Re: compile - yep, makes sense.
 
@Szabolcs right, you got my close vote
 
 
1 hour later…
8:52 PM
@VitaliyKaurov @Szabolcs Those are good when you start typing, not after you have a list as separate lines (because at that point, it's not clear if it is a list or a paragraph or a list of paragraphs). Press the button, you get 1. List item, start typing and then Shift + Enter, you get 2. List item :)
 
9:13 PM
@rm-rf I never knew that Shift-Enter gave me 2.
 
 
2 hours later…
11:35 PM
@rm-rf thanks - very handy ;)
 

« first day (831 days earlier)      last day (3663 days later) »