Is there a way to save the rendered node locations obtained by the layout algorithm? - vis.js

When I open the saved HTML network file, it takes quite some time to load my network of a few thousand nodes. Would it be possible to save the node locations to avoid running the network layout algorithm whenever I open the file?

This is more of a manual solution, but it should work:
Render Graph in Browser => F12 Console
network.storePositions();
console.log(JSON.stringify(data.nodes.get()))
Copy output to clipboard
Edit html file/ cp html to version_static.html
Comment out loadbar div
Comment out loadbar js/css (optional)
Set physics options to false
"physics": {
"enabled": false,
"repulsion": {
goto nodes = and copy output from 1) to the vis.DataSet array
Save and done!
(Happy to collaborate on some sort of automation for this)

Related

firebase doesn't showing realtime data inserting and not able to remove data [duplicate]

Read-only & non-realtime mode activated to improve browser performance
Message pops up in my project and I'm unable to delete the nodes as well
Also I read this https://groups.google.com/forum/#!topic/firebase-talk/qLxZCI8i47s
Which states :
If you have a lot of nodes in your Firebase (say thousands), we need to create a new element for each node and modern browsers simply have limitations of how many DOM elements you can add to a page
It says:
To resolve this problem, don't load your Firebase Dashboard at the root of your Firebase, but instead load it lower down in the hierarchy
I do not get what it means
How do I get back to my Realtime Dashboard?
If you want to delete a high level node when this is activated, I recommend doing this.
Open up a text editor and type in { }. Save this file as "blankJSON.json".
Go to high level node you want deleted and select it, once it opens up and shows you all the nodes that need to be removed, select the three bars at the top right and select "Import JSON", (It would be safe to first "Export JSON" If you don't have backups, in case you make a mistake here). Import the JSON file we created earlier titled "blankJSON".
This will delete all of the data inside.
Once again, I highly suggest you make a backup before doing this, It's extremely easy to make a backup and also it is much easier than you would think to upload this blankJSON to the wrong node and then erasing a bunch of important data.
When it detects that it's downloading too many nodes from your database, the Firebase Console stops using real-time mode and switches to read-only mode. In this mode it requires less work from the browser, so it is more likely that the browser will stay performant.
To get back to realtime mode, you have to go to a location that has fewer nodes. So say that you start loading the database at the root, that means that "pseudo address bar" at the top of the data tree will say:
https://<your-project>.firebaseio.com/
And then will show the list of items. Now click on the URL in that pseudo address bar and change it to:
https://<your-project>.firebaseio.com/<one-of-your-keys>
And hit enter. The data tree will reload with just the node from one-of-your-keys and down and will likely switch to realtime mode again.
Every node key in firebase is a link, you can open a sub-node in a new tab and then edit that sub-node and its children.
Right click on a sub-node you want to edit or delete
Select open link in a new tab
Edit the sub-node in the new tab
1) Click on the Node you want to mass delete
2) Import an empty .json file (just containing curly braces, {} )
3) The node value will be set to null, in other words it is deleted or rather overridden with an empty node!
What you can do is to have an OnClickListener and call the remove value method to your DatabaseReference, like this:
mCart.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
mDatabaseReference.removeValue();
}
});
I have the same problem... I'm a bit surprised because I though Firebase could easily scale to support huge amount of data (example million users, etc.).
I have a node with 80000 sub-nodes (each object has his own push-id) and I cannot delete or perform any action on it because the real-time doesn't work in Firebase console.
I think the only way to udate or delete the data it's to do it via JAVA code :(
Multiple times trying to load the specific keys can be tiresome. There is a python library that could do this for you easily.
http://ozgur.github.io/python-firebase/
I needed to delete a lot of keys and this helped me do that in one go.
What I do is export the entire tree, edit/add the node I want using an editor, then import the JSON and overwrite the previous node/tree. Problem solved! Risky though 😁

Problems with Graphhopper application

I am trying to make an map with Graphhopper but after I choose and load the map completely on the screen, there are some problems, you can see in the pictures below:
When the map loaded
When I hold tap on the screen for routing
Why did this happen? and how to fix it?
Hard to figure out without logs, but i encountered a similar problem recently.
If you're in the same situation as i was :
This means that your berlin-gh folder does not contain the data relative to the EncodingManager your are trying to use.
First it is important to know which kind of EncodingManager you are using, they can be either of the following :
"foot","car","bike","bike2",etc...
Now let's say you want to get the foot path from one point to another on your map, then you must be building somewhere in your code your graph request :
GHRequest yourRequest(latitudeStart, longitudeStart, latitudeEnd, longitudeEnd);
yourRequest.setVehicle(EncodingManager.FOOT); // or .CAR, .LOL (lol)
These data are constructed by the graphhopper.sh script when you import the map of your choice :
edit the config.properties file inside the graphhopper folder
Vehicles #####
Possible options: car,foot,bike,bike2,mtb,racingbike,motorcycle (comma separated)
bike2 takes elevation data into account (like up-hill is slower than down-hill)
and requires enabling graph.elevation.provider below
graph.flagEncoders=foot
^ Put here your comma separated list of vehicle you want to support
now delete any folder created by graphhopper with previous attempts of import (otherwise the command below will fail)
then launch graphhopper.sh import "your map path"
At this point it should have created the (let's say) berlin-gh folder with the support for the vehicle you chose.
Put this folder in your application (wherever you load it) and now you can configure your graphrequest to load paths for the encodingmanager of your choice.
Hope i'm clear enough.

PDF Access Issues When Saving Files in FileMaker

When I run scripts that save layouts as PDFs in FileMaker Pro v11, the PDFs are not accessible to my colleagues. Adobe opens and tells the user that there was an error and Access was Denied. Is there a way to alter settings, either in FileMaker or Adobe that will allow myself and my colleagues to save records as PDFs in FileMaker so that we will all have access to them?
As a side note, we can Print, choose Adobe as the printer and then save that way with no problem, however the point of the scripts is to make the whole process streamlined to the click of a button. When we use the Print script step so that Adobe is automatically chosen, we still run into the issue of having to manually save, making the 'print' scipt step a non-solution.
Here is the portion of the code that saves the PDF:
Save Records as PDF [ File Name: “$folder/$filename”; Current record ]
[ Document - Compatibility: Acrobat 7 and later ]
[ Pages - Number Pages From: 1; Include: All pages ]
[ Security - Printing: High Resolution; Editing: Any except extracting pages; Enable copying; Enable Screen Reader ]
[ Initial View - Show: Page Only; Page Layout: Single Page; Magnification: 100% ]
[ Restore; No dialog ]
According to the docs, Save Records as PDF:
Note: In order to save records as a PDF file, your privilege set must include Allow printing, or you must select Run script with full access privileges in the Edit Script dialog box.
That is,
Change the users privelege to allow printing:
Manage > Security > Privileges Sets (and for each set you can check Allow Printing).
Check "Run the script with full-access privileges" in the edit script page.
I would note, sometimes you may not want users to be able to print everything, and you may not want to run the entire script with full access privileges, so I will offer a third solution:
3. Call a sub-script whose sole purpose is to save as PDF,
check its "Run script with full access privileges" box.

InDesign CS5 Script: How can you display a directory?

I have a script that:
creates a new folder
scans an InDesign document for images
formats the images and copies them to the new folder
When the script is done doing all of this I want it to bring to focus the new folder directory (in Windows).
As of now I am displaying the folder-path in an alert window, but I would rather it open the directory (if it isn't already) so the user can see the new files.
I wish I could just call one of these:
myNewFolder.bringToFront() : works only on program focus, i.e. -- BridgeTalk.bringToFront("photoshop")
myNewFolder.open() : seems to apply only to file I/O operations
myNewFolder.show() : seems to apply only to the Window object
...but none of these work.
EDIT: new ActiveXObject("Scripting.FileSystemObject") does not work either...
You have to use the execute method.
myFolder.execute();

Converting RTF to PDF from System

I've createad a rule to transform any file to PDF and copy this one to another folder.
So i can add a file named: "test.rtf" and then the rule create a test.pdf into folder "PDF"..
Till here its ok. If i add a file through alfresco (add content button) it works perfectly...
By the way, on the system that i've developed when i try to add a file then i get my file .rtf correctly in the folder, but the pdf file converted and copied goes without any content...
If i send a rtf file with a table with 10 rows and into the rows i right "testing" then the pdf created goes with the table, and with 10 empty rows...
Someone knows the reason for that?
Im not sure, but maybe when i send the file by the system alfresco starts to convert and copy before completing to create the rtf... someone already got some problem like this one?
The problem you're getting in is that Alfresco first creates an empty file with all the meta-data and then updates the file with the associated content.
So you can do 2 things:
1: create a rule which is triggered on update, instead on create/inbound
2: create a rule which triggers a Javascript file, which will do the transformation and will check on the content size.
Hence it's better to create a rule which checks the content on size.
Create a JavaScript file in Data Dictionary/Scripts.
Check the JavaScript API
Something like this:
if (document != null && document.size > 0){
document.transformDocument("application/rtf");
}

Resources