Migrating THREE.js hexplanet demo r58 => r59 - migration

I am trying to port the great hexplanet demo to the latest THREE.js version. (I am not the author but unable to get in touch with him so far)
The demo was written on r53. Migrating it up to r58 was easy, but on r59 the following vertice/face error occurs:
screenshot
I have combed through the migration info of THREE.js and the release notes for r59 but cannot make out what the cause of this could be. The only thing that looked possibly related to me was a change in PolyhedronGeometry.
But since I am not adept at 3d geometry anymore, I hope somebody can share some insight on this.
Project folder with progress so far: link

In case anybody else wants to use the demo on a later version, here's the problem and fix:
var angle = Math.acos(v1.dot(v2));
Sometimes results in NaN, when v1 equals v2.
Inserting the following made it work on all levels on subdivision again:
if (isNaN(angle)) angle = 0;

Related

mediapipe KNIFT template matching example: using own pics doesn not work properly - how does the example actually work?

i followed the example steps to create an own android app KNIFT template matching example like the 3 dollar bill example on the mediapipe website...did anyone of you build this and know how this really works? I cant get a clear documentation.
My approach to run my own example as suggested on the mediapipe: I have three example pics in my folder (and I did all the build steps with them) that are detected and framed indeed....but not as often and not as correctly as in the dollar bill example (which works fine for me, every bill is detected and framed and labeled as expected).
Also my labeling doesnt work properly. Sometimes it does partly, sometimes it is labeled but incorrect. What does the framework do with my pics and labels and how to optimize my own example?
Any help is appreciated...
regards, fabian

How to fix JSONDecodeError?

I am new to OSMnx and followed the steps from the website (https://github.com/gboeing/osmnx-examples/blob/master/notebooks/10-building-footprints.ipynb) on how to make a "Street network + building footprints: square-mile visualizations" map.
All I did was change the location name to teutopolis and change the coordinates to the town I am trying to map out, but it kept giving me a JSONDecodeError output. I added an image of what I input and the error output that it gave me. Being new to coding, I am not sure what this all means as I tried to search for an answer but did not understand.
Any help on how to fix this problem would be greatly appreciated.
Make sure you're using the latest version of OSMnx (0.8.1 as of this writing). This issue is documented on GitHub and was fixed/released two months ago.

python vincent map does not display

I'm trying to use vincent package to visualize my data (in pandas) in jupyter notebook, but have trouble in initial attempt ,here is the code I use (copied from the http://wrobstory.github.io/2013/10/mapping-data-python.html):
import vincent
import pandas
world_topo=r'world-countries.topo.json'
geo_data = [{'name': 'countries',
'url': world_topo,
'feature': 'world-countries'}]
vis = vincent.Map(geo_data=geo_data, scale=200)
vis.to_json('vega.json')
vis.display()
After I ran the code, nothing was displayed. I checked the type of the vis:
vincent.charts.Map
I'm not sure how to proceed here, I appreciate any input on this problem.
Not sure at which point of implementation of this you are.
Assuming you just used pip to install vincent and tried the code in PY IDLE , you might be missing 2 important steps:
AFIK vincent only generates jsons to be presented using Vega via Jupyter notebook.
To render with Vega You will need to install:
1) Jupyter and dependencies
2) Vega and dependencies
I was able to do so using these instructions.
Once jupiter launched, a window opens in the browser, I had to choose 'Python3' under 'new', and put code in the prompt on that page.
Alternately you can use this online Vega renderer. Please also see Vega docs
Note that it seems that vincent is not the latest technology for that purpose, their page points to Altair
Also, I noticed that the json that is generated in 'vega.json' from the code you posted, using the original data, does not render anywhere. That's also an issue, probably happens because it uses outdated format, but I am not sure.
I have limited experience with this technology but I was able to get graphs to render, specifically this, and it is also how it looked for me.
I know that this post is old but I found your error and I thought I would answer here to help future users of vincent as it has worked beautifully for me. I am working with the anaconda version of vincent and jupyter notebook.
First, you have to initialize vincent in your notebook
import vincent
vincent.core.initialize_notebook()
and your next problem is that your URL isn't actually pointing anywhere. For the world map topography you need:
world_topo="https://raw.githubusercontent.com/wrobstory/vincent_map_data/master/world-countries.topo.json"
A decent map printed out for me with those two exceptions.

Debugging interpreter in VM when changing vm primitives

Context
As a university project we want to change the the pharo vm to use an object-table and see what happens.
We use a pharo-vm clone from github and VMMaker. Building the VM works fine.
To get started we added a primitive that returns an incremented Integer:
InterpreterPrimitives>>primitiveIntegerIncrement
"increments an integer"
self pushInteger: self popInteger + 1 .
and modified StackInterpreter class>>initializePrimitiveTable accordingly
MaxPrimitiveIndex := 576.
"... and so on ..."
(575 primitiveFail)
(576 primitiveIntegerIncrement))
And it works.
Problem
When we make changes to the VM we want to test-run already in the SmalltalkImage so we do not need to compile and see it did not work.
Something like:
StackInterpreter test: '1 inc'
And then I can debug if the primitive is wrong or an error occurs. Of course there needs to be done much more but how can I achieve this?
What we tried
category VMMaker-InterpreterSimulation class StackInterpreterSimulator. Trying the code in the comments
DoIt
^ (StackInterpreterSimulator new openOn: Smalltalk imageName) test
errors:
displayForm := 'Display has not yet been installed' asDisplayText form.
the ByteString does not understand asDisplayText
(CogVMSimulator new openOn: Smalltalk imageName) test
(InterpreterSimulator new openOn: Smalltalk imageName) test
error:
PrimitiveFailed: primitive #basicNew: in Array class failed
I also found this screen cast but it only debugs the VM from outside using gbd: http://vimeo.com/22485382#
Our project is hosted here: http://smalltalkhub.com/#!/~kirstin/PharoObjectTable
Current Status
We started implementing an object table. The lookup of attributes can go throught the object table. Full object table support and no usage of direct pointes is very tricky since pointers are expected everywhere. So we use pointers into the object table to identify when a lookup should go through the OT. We also found all object creation primitives and add new objects to the table.
How long is your project and how many people are you ? To me what you try to do is quite some work. Do you have good knowledge about low level behavior ?
To answer your question, the main problem here is that the cog simulator is not maintained in the pharo vm fork. This is because no one in the pharo crew use the simulator. We only use external debugging from gdb. In fact the pharo folks work mostly on VM plugins, the core of the VM is mainly maintained and developed by Eliot Miranda which works on Squeak. Therefore we report to him when there's a bug in the VM core.
For your project you would have to split it in at least 2 steps:
step 1: make the object table work with the stack VM
step 2: make the JIT work with your object table
Note that for step 2 I would recommend not to change the way an object access its header, therefore having a VW-like object table where you have the fixed size header on the one in the the object table, and the fields of the objects (and maybe header extensions) in the heap.
So use the StackVMSimulator and build the StackVM first. When everything will work (including context), you can think about hacking the JIT. Recently Guillermo Polito ported the Stack VM to the build process (see PharoSVMBuilder instead of PharoVMBuilder), a guy reported problems with this builder but you could hack it a bit to make it work.
Now to make the simulator work on Pharo 2.0 (which is the Pharo version of the generator image you have), you have to open the monticello browser and merge from Eliot's branch the Cog package (repo MCHttpRepository location: 'http: //source. squeak. org/VMMaker'), but not the latest Cog, the one at around the same date as the current VMMaker package of pharo-vm because the latest Cog and VMMaker of Eliot's branch are not stable.
The alternative being to start from Eliot's build image and merge things from the pharo branch. Here are infos about how to build the squeak development image (http://www.mirandabanda.org/cogblog/build-image/).
Then Eliot gave me this script once:
| cos |
cos := CogVMSimulator newWithOptions: #(Cogit SistaStackToRegisterMappingCogit).
cos desiredNumStackPages: 8.
cos openOn: 'my/favourite.image'.
cos openAsMorph; toggleTranscript; halt; run
You don't need the SistaStackToRegisterMappingCogit option. I guess some similar script with the StackVMSimulator should work.
Lastly there are some documentation about the simulator but it is only for the CogSimulator (these documentations expects you already knows how the StackSimulator works, and just give you hints about how to use it with the JIT):
http://www.mirandabanda.org/cogblog/2008/12/12/simulate-out-of-the-bochs/
and in one of the video named "Cog VM (part x)", x being from 1 to 6, Eliot shows how he uses the simulator to disassemble x86, print the stack and inspect the heap.
Another tip, ask your questions on the pharo mailing list (pharo users or pharo dev), because here no one may notice your question (fortunately someone pointed me out your question this time).
And tell on the pharo mailing list if you managed to run the simulator in Pharo 2.0, some people (as me) are very interested in it. I was planning to do it at some point.
Good luck ! Nice project anyway.
The last time I tried to use the simulator is roughly a year ago, and I did not make it work.
However, there are a few patches, which I assume never got integrated that might be of help:
https://code.google.com/p/cog/issues/detail?id=106
https://code.google.com/p/cog/issues/detail?id=107
https://code.google.com/p/cog/issues/detail?id=108
Issue 107 includes a patch for your asDisplayText issue.

How do I just SAVE a jsFiddle and not get a new version

In the documentation:
Buttons Save or Fork are always present in the UI. First one appears if no fiddle was loaded, the latter is used to create a new fiddle from the existing one.
I ONLY see SAVE when the fiddle is brand new, then RUN/update/fork. In Fx4 and Safari 5 on MAC (and Fx 4 on pc)
UPDATE: New BASE functionality does exactly what I wanted.
From the SO FAQ
Stack Overflow is for professional and
enthusiast programmers, people who
write code because they love it. We
feel the best Stack Overflow questions
have a bit of source code in them, but
if your question generally covers …
a specific programming problem
a software algorithm
software tools commonly used by programmers
matters that are unique to the programming profession
… then you’re in the right place to ask your question!
When you log into JsFiddle, you'll get a Set as Base button, which will make the revision you're working on the base version - think of it as an alias for john/7hd62/12/ -> john/7hd62/.
I ran into an issue where set as base would not save my work. The solution was to:
make a change.
Update to get a new version.
Set as Base.
Hope that helps
I always use Update to save and create a new revision.
I haven't seen the button Save... maybe it is so that we can't Save to a version, but always need to Update to a new version, so everybody can look at the same code at a certain version.
Have a look on Issue #225 in JSFiddle GitHub Repository - URL for the latest version of a fiddle such as /xxxxx/latest/:
#zalun: Please read http://doc.jsfiddle.net/basic/introduction.html#setting-base-version
Sharing a latest fiddle is not always what you wanted. Because anyone is able to save "latest" fiddle, someone would be able to change it to the content you wouldn't like to share. With setting a base version you are the person who chooses which version is shared under default "no version" URL.