« first day (1899 days earlier)      last day (2586 days later) » 

12:10 AM
Interfacing DIY Arduino Photogate Timer
 
 
5 hours later…
4:52 AM
@MichaelHale That is my current solution.But I have to input "" and click that "Yes" button every time..
@Szabolcs When our all Nootbook's window is minimum,Can we persistently make the Palette float?
 
 
4 hours later…
8:36 AM
Does someone know if I can change the selection color in
ListPicker[{a, c}, {a, b, c, d}]
 
 
1 hour later…
9:49 AM
@yode This has to do with the fact that there are multiple formats on the clipboard simultaneously. In this case the wrong format gets chosen for pasting. I do not know how to control the format of the paste.
 
 
2 hours later…
11:45 AM
Hmm
A small problem:
I've mapped the unit sphere with coordinates of right angle (0 to 360) and declination (-180 to 180) in degrees.
I've defined several polygons going across the sphere with these coordinates describing their vertices.
Now, I need to somehow figure out whether or not a given point (in these coordinates) is contained in a given one of these polygons.
Anyone here have any idea how I'd go about doing this using Mathematica?
 
12:42 PM
@yode The problem with TablePaste and Excel seems to be because Excel places the data on the clipboard in several formats, and Mathematica chooses the wrong one. I don't think I can fix this. A quick workaround is to paste the text into a plain tex editor (like Notepad) and re-copy it. Of course, if you have to do this, you might as well just paste it into a Mathematica string and import from there.
 
1:09 PM
@Szabolcs "Excel places the data on the clipboard in several formats" is your subjective judge or your have found something?
@Szabolcs I think since we can use this method paste a list into Mathematica,that string must can be get.But I just don't know how to do.
And If we can call .NET,actually I can do it like:
I think the string is processed(deleting space) by function ClipboardNotebook or NotebookGet in Mathematica
Otherwise I cannot understand why this method can do it.
Unfortunately the method base on .NET cannot expand to other platform.So I don't very like it..
 
1:52 PM
@yode I can see it in the clipboard viewer on Mac. On Windows the clipboard viewer is even better and it should show you.
But last time I used the clipborad viewer on Windows, it was on XP. I don't know how to access it in modern windows.
 
What is clipboard viewer?
Oh,maybe you mean a software here
It is in my Windows 10.
 
2:36 PM
@Szabolcs @yode Here is a clipboard toy to play with, if anyone is interested:
Needs["JLink`"]

ShowJavaClipboard[] :=
  JavaBlock @ Module[{toolkit, clipboard, flavors}
  , LoadJavaClass["java.awt.Toolkit"]
  ; toolkit = java`awt`Toolkit`getDefaultToolkit[]
  ; clipboard = toolkit @ getSystemClipboard[]
  ; flavors = clipboard @ getAvailableDataFlavors[]
  ; Grid[
      { #@getHumanPresentableName[]
      , OpenerView[
          { #@getMimeType[]
          , clipboard@getData[#] /. v:Except[Null, _?JavaObjectQ] :> Style[v@toString[], Italic]
          }
        ]
      } &/@ flavors
 
2:53 PM
@WReach Thank you! It is exactly what I was hoping for. Not knowing much Java, I always have to spend a lot of time to be able to put these J/Link solutions together.
 
@Szabolcs You are welcome. In a similar vein:
7
A: How to "Copy as Unicode" from a Notebook?

WReachHere is a function that copies a Unicode string to the clipboard using JLink: Needs["JLink`"]; InstallJava[]; LoadJavaClass["java.awt.Toolkit", AllowShortContext -> False]; uniclip[s_String] := JavaBlock[ java`awt`Toolkit`getDefaultToolkit[]@getSystemClipboard[]@setContents[#, #]& @ ...

 
3:06 PM
@WReach Well,I just want to know why one can have a good grip on Mathemtica,.NET and JAVA simultaneously,how hard he should be..:) Thanks.
 
3:22 PM
:) The following function will fetch the string on the clipboard (if and only if the clipboard contains a string):
Needs["JLink`"];
InstallJava[];
LoadJavaClass["java.awt.Toolkit", AllowShortContext -> False];
LoadJavaClass["java.awt.datatransfer.DataFlavor", AllowShortContext -> False];

getClipboardString[]:=
  JavaBlock @ Module[{clipboard, flavor}
  , clipboard = java`awt`Toolkit`getDefaultToolkit[] @ getSystemClipboard[]
  ; flavor = java`awt`datatransfer`DataFlavor`stringFlavor
  ; If[clipboard@isDataFlavorAvailable[flavor], clipboard @ getData[flavor], $Failed]
  ]
 
@WReach Can I expect a IMAGE version?I have a solution,but it work on .NET here,which can not use in other platform
 
@yode Sorry, I don't have code for getting an image from the clipboard handy. I'm about to go into a meeting, so I can't whip one up at the moment. I'm sure that if you post a question about it someone will give you an answer before I get out of my meeting :)
 
@WReach That is a good "sure".I hope so.And thanks for your string version very much.:)
 
4:23 PM
@LegionMammal978 This is a very nice question, but has nothing much to do with Mathematica.
The problem you are facing here is the geometry on a sphere, you know?
You can search the internet to get some ideas but maybe it's better to think about it yourself for a start.
On the plane, you can use the winding number to decide if a point is inside a polygon. I'm not sure something similar exists on the sphere.
What you can do is the following. Imagine you have a polygon {p1,p2,p3,..} than of course each pair {p1,p2}, {p2,p3}, ... is a line on the sphere.
If you start cutting your sphere at p1 to p2 and don't stop at p2 but cut all the way around until you meet p1 again, you'll see that each distinct pair of points will cut your sphere into two halfs.
Now, assuming you would do this in reality with scissors, then you could check if the point you want to test is on the left side of your scissor (polygon points go counter clockwise around the polygon).
If you do this for each point pair pn, pn+1 and can answer this question with yes, then your point should be inside the polygon of your sphere.
This works even for the strange Polygon[{p1,p2}].
In the 2d plane it is not possible to have a polygon with only two points, on the sphere it is.
Now the tricky part is, how you make this two point check if you have your two angles, but this problem is simple enough to investigate further.
 
 
4 hours later…
8:14 PM
@Szabolcs sorry for the delayed response. You discovered something really weird. My guess: alignment issues. This is really important for vectorized operations (I mean using vector CPU instructions). Alignment needs to be to a 16-byte boundary for best performance. Can be that Mathematica just allocates the arrays without much consideration for alignment. Unfortunately, it will be really hard to test this.
 
@OleksandrR. That's what Daniel said too.
 
8:28 PM
@Szabolcs oh yes, so I see
well at least he might be in a position to test it
 
8:46 PM
@Szabolcs the performance penalty for unaligned access is highly dependent on the CPU. For Itanium unaligned access could be hundreds or even thousands of times slower. For x86 they try to eliminate the disparity for more and more complex operations with each new CPU design. Yours is a new CPU so I would assume the operation is based on AVX2, which requires 32-byte alignment (due to 256-bit execution units). OSes/C runtimes got wise to the need for 16-byte alignment already, but maybe not 32
 
9:00 PM
@halirutan The problem is, my polygon is not convex
Because if I interpret what you're saying correctly, your method would test if the point was in the intersection of the sphere caps
Which would work for convex polygons, but not necessarily for non-convex ones
 
9:17 PM
@OleksandrR. And maybe clang on Mac (where the issue is present) doesn't align as well as gcc does on Linux. It's strange that because of this problem, this operation is fast inside of VirtualBox on Linux than when running natively on OS X (even though I only assigned 2 cores out of 8 to VBox).
 

« first day (1899 days earlier)      last day (2586 days later) »