HTML Generation using neo4jrestclient - html

So I was using the neo4jrestclient, and I noticed that in the class of QuerySequece, there's a .to_html()function (https://github.com/versae/neo4j-rest-client/blob/master/neo4jrestclient/query.py)
However, when I try using it I get the 'Unable to display the graph or the table' error.
I haven't found a working example of it. I was wondering if anyone has gotten this working.
Much thanks appreciated.

The function .to_html() is a function that IPython uses in order to render rich content inside Notebooks. When running inside a Notebook, neo4jrestclient asks for extra information to the Neo4j server, so it can draw the actual graph returned. Therefore, if you try to run a query inside an IPython Notebook, a D3 graph should be rendered automatically.
from neo4jrestclient.client import GraphDatabase, Node, Relationship
gdb = GraphDatabase(url="http://localhost:7474")
gdb.query("MATCH (me)-[r]-() RETURN me, r LIMIT 10")
A running example can be seen in this gist. Although it's still a work in progress. I think that I could add an option to populate the needed fields in case you wanted to use the .to_html() outside the IPython Notebook. All you need to do is to make neo4jrestclient believe that it's running inside of one by modifying the function neo4jrestclient.utils.in_ipnb() making it to always return True. Let me know if you would use that feature and I will add it.
On the other hand, I am developing ipython-cypher, to have a better integration of IPython, Pandas, NetworkX, and matplotlib with Neo4j, but it's still in alpha.
Update: Now you can add data_contents=True to return the extra data.
results = gdb.query(query, data_contents=True)
Data will be in results.rows and results.graph.

Related

PlotlyJS.jl "savehtml" not defined

I need to share an interactive plot made using the PlotlyJS package in Julia. According to the documentation of the package PlotlyJS.jl, I need to use the "savehtml" function and set "js" argument to ":embed" in order to view it offline (screenshot attached). However, I got an error "UndefVarError: savehtml not defined". Can anyone tell me what may cause this problem?
FYI, the "savefig" function can save the plot into an HTML but the HTML cannot be viewed on other machines.
It is also acceptable if there is another way to save an HTML plot that can be assessed from other machines. The interactive plot is generated by PlotlyJS.jl.
Thanks very much in advance.
This creates a standalone file that can be used on other machines.
However, those other machines need to have access to the internet:
p = PlotlyJS.Plot(sin.(1:0.1:10))
open("f.html","w") do f
PlotlyJS.PlotlyBase.to_html(f, p; include_plotlyjs="cdn", full_html=true)
end
I just checked that this is as far as you can do as of today (version v0.8.18) as there is a bug in the source code of PlotlyBase.

How to output a .pvd or xdmf file from FiPy

From the example documentation, there is the following section:
FiPy doesn’t plot or output anything unless you tell it to:
if __name__ == "__main__":
viewer = Viewer(vars=(phi,), datamin=0., datamax=1.)
I understand that the current configuration would result in an opening of a viewer using the matplotlib or Mayavi viewers. However, I would like to be able to export a .pvd or .xdmf file for consolidating the simulation.
Thanks for your help!
FiPy presently has no such capability, although I've experimented a bit with XDMF and multi-timestep Gmsh MSH files, but need to find time to get back to it. You can save individual data snapshots with the VTKViewer classes, but not time series.
vw = fp.VTKCellViewer(vars=(phi, psi))
vw.plot(filename="myFile.vtk")
If there are particular thinks you'd like to see, please update issue #132.

Scan an area of a web page's source code for changes while reporting it?

this is one heck of a confusing question to ask so here it goes. Firstly, I'm not asking you to write me any code I just need help going in the right direction for what I'm trying to achieve here. Basically the task is this, I want to scan a select area of a web page's source code for changes and if something does change, I want to report it somewhere (like a console or something). However, I do not want just a notification of change, I also want what the change is/was. I've been looking into things like jsoup but I am still struggling to even find out what this is called.
Any pointers would be insanely appreciated. Thanks, Optimistic.
Here are some steps assuming this is from a node.js project:
Get the URL for the specific script file you're looking for a change in.
Using the request() module, fetch that URL.
Break the data up into lines (probably using .split()).
Find the specific line you are looking for either by counting line numbers of by searching for some representative text in that line.
Using some sort of search in that line (perhaps a regex), find the current value of the exact item in that line you are looking for.
Save the current value.
Then, at some future time, repeat this whole process and compare what you find to the previous value.
If this is being done from a browser instead of node.js, then use an Ajax call to retrieve the file. If the file is on another domain from your web page and that domain does not permit cross-origin requests, then you cannot solve this problem in an automated fashion from a browser in your own web page.
Here is how I would do it with Jsoup:
Document doc = Jsoup.connect(url).get();
String scriptCssQuery = "script"; // Tune this CSS query to find THE script you need.
Element script = doc.select(scriptCssQuery).first();
if (script != null) {
String scriptLines = script.html();
// Store the changing line somewhere and compare it to its previous value...
}

Exporting Oracle APEX regions with DBMS_LOB

I'm interested in exporting the contents of a page generated by Oracle-APEX to an external file while preserving as much formatting as possible. Eventually, I'd like to export it to either a .doc, .xls., or .pdf format. For now, I'm testing with a .doc file.
Currently, I'm attempting to do this by creating a PL/SQL anonymous block "Process" that executes when an "Export" button is pressed. Based off an example I found online, if I use the following code in the process, I can output one of the items in my page to a .doc file:
DECLARE
test_blob BLOB;
BEGIN
dbms_lob.createtemporary(test_blob, FALSE);
dbms_lob.open(test_blob, dbms_lob.lob_readwrite);
DBMS_LOB.APPEND(test_blob, UTL_RAW.CAST_TO_RAW(:P4016_ITEM_NAME));
OWA_UTIL.mime_header('application/doc', FALSE);
HTP.p('Content-Length: ' || DBMS_LOB.getlength(test_blob));
htp.p('Content-Disposition: attachment; filename= "text.doc"');
OWA_UTIL.http_header_close;
WPG_DOCLOAD.download_file(test_blob);
dbms_lob.close(test_blob);
END;
However, I would like to output some regions on my page that include tables, which are not considered items, as far as I know (I'm still very new to APEX). If I include the table name in the DMS_LOB.APPEND line, I receive an error message. Does anyone know of a simple way to reference these regions?
The only workaround I've found is to replicate the page in my exported file by enclosing the results of the SQL queries used to populate the tables in HTML based off the HTML of my APEX Page. In other words, if I wanted to italicize something, I would do the following:
...
dbms_lob.append(test_blob, UTL_RAW.CAST_TO_RAW('<html><i>'));
dbms_lob.append(test_blob, [PARSED SQL QUERY]);
dbms_lob.append(test_blob, UTL_RAW.CAST_TO_RAW('</i></html>'));
If anyone knows of a simpler way to do this, preferably involving a simple reference to my page regions, I would greatly appreciate it.
There is a way (3 ways) to get PDF - http://www.oracle.com/technetwork/developer-tools/apex/learnmore/custom-pdf-reports-1953918.pdf.
Also you can use Interactive report, it has export option. But it can be exported only in HTML by default.
It is not exactly what you ask, but you don't need to write code.

BiarEnginer.jar/Command Line Import Documentation/Usage

Anyone know where the documentation is for the properites file?
I am trying the following exportQuery:
select * form ci_infoobjects where si_kind like 'FavoritesFolder' and si_name like 't%'
It is correctly grabbing the users but, is not biaring any of the folders/reports that said user has.
Suggestions?
Ok here is what I have found out.
documentation: on the command line importe is in the bi_vip pdf provided by SAP (which I will provide a link to later).
usage: My query isn't exactly correct but, removing the si_name portion should get you th right result.
issues: It seems that the command line importer does not gracefully handler export errors. Any export error it receives the command line will kill itself.
work around: I am pretty much duplicating the ImportWizard in java at this using API BIAROutput and IException.
I will hopefully post back my source code for the command line import tool in java.