Neo4j export whole database to JSON_LINES, ARRAY_JSON, JSON or JSON_ID_AS_KEYS - arrays

I tried to use an APOC procedure from here to export the DB using the following:
CALL apoc.export.json.all("all.json",{useTypes:true})
I can successfuly export to JSONL. However, I am not able to change the JSON format to other available formats such as JSON_LINES, ARRAY_JSON, JSON or JSON_ID_AS_KEYS. According to the documentation the following should work but it does not:
CALL apoc.export.json.all("all.json",{config:{jsonFormat:'ARRAY_JSON'}})
The result of above procedure is in JSONL but not ARRAY_JSON.
I have also tried the solution here but did not succeed.
Cheers,
A

This is working now in neo4j versions 4.2.x with APOC version 4.2.0.2: https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/4.2.0.2/apoc-4.2.0.2-all.jar
The syntax is simpler. Notice the config is a dictionary rather than a nested dictionary. See my sample below.
OLD: CALL apoc.export.json.all("all.json",{config:{jsonFormat:'ARRAY_JSON'}})
NEW: CALL apoc.export.json.all("all.json", {jsonFormat: 'ARRAY_JSON'})
Result:
(type is array of dictionaries)

The solution for my question was changing the APOC.jar file with the latest release from here. I have had to update the syntax as well.
CALL apoc.export.json.all("all.json", {jsonFormat: 'ARRAY_JSON'})
You can open the plugin folder using the tree dots by the blue open button and chose Open Folder -> Plugins. Copy and paste the path showed into your file manager if it doesn't open.
In the plugin folder, you can see your APOC version on the apoc file name.

Related

Typo3 Transform DB bodytext to frontend html

I try to import an old typo3 v4 into v10 and I'm using external_importer extension for the job. On the flow I would like to download the internal files like PDF and relink in bodytext.
The idea would be to transform the saved content to real html and evaluate the hyperlinks if are containing relative PDF links and in case trigger the download and rebuild the link to the file.
How would I proceed in this case?
I tried the following
$parseObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ContentObjectRenderer::class);
$html = $parseObj->stdWrap_HTMLparser($htmlStr, []);
DebugUtility::debug($html);
but the hyperlink steel remains as <link http://someurl.com>
I had a similar problem. If the solution is the same with mine, you are halfway there. You are missing the reference. Meaning, how should TYPO3 process the text. Here is what worked for me.
TYPO3 render full t3:// links from bodytext in utility files
First, use the parseFunc and not the stdWrap_HTMLparser. Then use this reference: lib.parseFunc. At the end you should have something like that:
$parseFuncTSPath = 'lib.parseFunc';
$html = $parseObj->parseFunc($htmlStr, [], '< ' . $parseFuncTSPath);
DebugUtility::debug($html);
And since you are using TYPO3 10, i would recommend to use DI (Dependency Injection). You can basically copy paste the code from the linked SO answer i pasted.
Best regards

What is the correct usage of the mixin classs for TCL language?

Im attempting to update an old version of the selenium-tcl package to work with the new W3C WebDriver (or Selenium 4.0).
Original packages uses a few mixins for the webdriver class.
So I modeled what I saw and created a mixin file named mixin_action_chains.tcl [1] which has a mixin class called Mixin_Action_Chains.
Whenever I attempt to use it I get the error:
% package require selenium
::selenium::Mixin_Action_Chains does not refer to an object
Im not sure why I've modeled it pretty much exactly as I have seen in the other files such as mixin_for_scrolling.tcl [2]* file. What am I missing.
Here is the entire GitHub Repo
Im not sure what else must be done for TclOO. Any thoughts.
Thanks
Im not sure what else must be done for TclOO. Any thoughts.
Update
pkgIndex.tcl: The placement of the mixin-defining script mixin_action_chains.tcl is wrong, it comes after the mixin has already been required in the previously sourced script webdriver.tcl, like entering directly:
% oo::class create C {
mixin ::not::defined
}
::not::defined does not refer to an object
You need to change the order of source command calls in the package ifneeded script.
For the records
Still, in the original version, there were unbalanced curly braces and brackets in your script, which broke sourcing of the file for me:
https://github.com/SavSanta/w3cselenium-tcl/pull/1

Difficulty with filename and filemime when using Migrate module

I am using the Drupal 7 Migrate module to create a series of nodes from JPG and EPS files. I can get them to import just fine. But I notice that when I am done importing them if I look at the nodes it creates, none of the attached filefield and thumbnail files contain filename information.
Upon inspecting the file_managed table I see that both the filename and filemime fields are empty for ONLY the files that I attached via the migrate module. This also creates an issue with downloading the files.
Now I think the problem has to do with the fact that I am using "file_link" instead of "file_copy" as the file operation I specify. The problem is I am importing around 2TB (thats Terabytes) of image files. We had to put in a special request with Rackspace just to get access to that much disk space on our server. So I can't go around copying from one directory to the next because of space issues. So "file_link" seems like the obvious choice.
Now you probably want to see how I am doing this exactly, so here is the code snippet:
$jpg_arguments = MigrateFileFieldHandler::arguments(NULL,
'file_link', FILE_EXISTS_RENAME, 'en', array('source_field' => 'jpg_name'),
array('source_field' => 'jpg_filename'), array('source_field' => 'jpg_filename'));
$this->addFieldMapping('field_image', 'jpg_uri')
->arguments($jpg_arguments);
As you can see I am specifying no base path (just like the beer.inc example file does). I have set file_link, the language, and the source fields for the description, title, and alt.
It is able to generate thumbnails from the JPGs. But still missing those columns of data in the db table. I traced through the functions the best I could but I don't see what is causing this. I tried running the uri in the table through the functions that generate the filename and the filemime and they output just fine. It is like something is removing just those segments of data.
Does anyone have any idea what this could be? I am using the Drupal 7 Migrate module version 2.2. It is running on Drupal 7.8.
Thanks,
Patrick
Ok, so I have found the answer to yet another question of mine. This is actually an issue with the migrate module itself. The issue is documented here. I will be repealing this bounty (as soon as I figure out how).

Cakephp excel report using XLS helper gives an warning message in windows and displays entire xml structure in open office

I'm using cakephp XLS helper to generate Excel report in my project.
But the generated file is giving warning message in windows system as below.
Similarly the same file displays the entire xml mark-up in open-office on linux as below.
Part of the view file code is as below.
$xls->setHeader('Report_'.date('Y_m_d'));
$xls->addXmlHeader();
$xls->setWorkSheetName('Enrollment Report');
//1st row for columns name
$xls->openRow();
$xls->writeString('ID');
$xls->writeString('Zipcode');
My Client wants a proper excel report with-out any warnings in windows.
Please suggest me any excel helper for cakephp which will generate proper excel file on all the platform and different application.
Your problem is that you are using a helper that puts your data in xml format. Excel can read XML and HTML but with a warning. You should use the one that Ivo suggested in the comments. LINK
This helper really makes an xls valid format, that complys with open office and office. Also, this helper relies on PHPExcel class that is constantly updated here so your code will be easy to upgrade if needed.
Remember to follow instructions given in the helper page.
I've tried a lot of this xls helper for cakephp, but neither one work as expected, either outdated or create xml o html tables or didn't work at all, haven't tried this one though... still creating a helper using PHPExcel shouldn't give you much trouble, you may use this tutorial as a how to base to modify the helper.
I think you need to set the mime-type. This has happened to me in the past and it was when the mime-type of an older excel helper was set to an out-dated value.
The code from the linked (by Ivo) helper has the following:
function _output($title) {
header("Content-type: application/vnd.ms-excel");
header('Content-Disposition: attachment;filename="'.$title.'.xls"');
header('Cache-Control: max-age=0');
$objWriter = new PHPExcel_Writer_Excel5($this->xls);
$objWriter->setTempDir(TMP);
$objWriter->save('php://output');
}
I would make sure you are:
a) using the newest helper (http://bakery.cakephp.org/articles/melgior/2010/01/26/simple-excel-spreadsheet-helper)
b) that the mime-type is actually set.
c) that that specific mime-type is accurate.

Jackrabbit XPath Issue

I'm relatively new to Jackrabbit. In our application we never turned on SearchIndex section within repository.xml (so as workspace.xml) files because we always go directly to a given document using the JCR UUID reference. We are using Jackrabbit v2.2.1 and Oracle as the repository. Now our requirements are getting expanded as we would like to use the document metadata feature to store contextual info about a document so that we can use the metadata to retrieve a selected set of documents.
As the first step, I added the default SearchIndex section in workspace.xml file and restarted the JCR.
I saw a bunch of lines like this in my log file - then I saw it created the index folder under workspace area.
2011-07-05 15:04:01.724 INFO [WebContainer : 0] MultiIndex.java:1204 indexing... /vfs:metaData/21ee130e-978e-415f-bfd1-7aa03d91608c/vfs:attributes (3500)
I have the folder structure like this. When I create a document in JCR, I specify the metadata info as part of the document which is by a complex XSD type with tags like docType, uploadedBy, contextValue, etc.
/ (root)
/MyApp (sub-folder)
/documents/ (sub-folder)
/document-1.pdf (file)
/document-2.pdf (file)
/accounts/ (sub-folder)
/account.txt (file)
etc...
The following XPath expression works.
//jcr:root/vfs:metaData//*[vfs:attributes/vfs:docType='TAX_DOCS']
If I give wrong value, for example instead of 'TAX_DOCS', 'TAX', it returns no documents as expected which is great. This proves that the metadata is correctly stored as expected and it is used in the filter process correctly.
The problem with this query is that it starts searching from the root folder but I want to search from /MyApp/documents sub-folder only. So I tried this:
//jcr:root/MyApp/documents//vfs:metaData//*[vfs:attributes/vfs:docType='TAX_DOCS']
It returns nothing. Then I tried this too but no success.
//jcr:root/MyApp/documents//*[vfs:metaData/vfs:attributes/vfs:docType='TAX_DOCS']
So what am I doing wrong? Is anything in workspace.xml configuration that we need to set or missing?
Any help is appreciated.
Thanks, Jack
Drop the double slashed from anything but the last path component and use the # notation for the attribute value, resulting in:
/jcr:root/MyApp/documents//*[vfs:attributes/#vfs:docType='TAX_DOCS']
The // construct looks for the whole subtree instead of just the immediate children like / does. The JCR specification only requires implementations to support the // construct as the last step of the XPath query.

Resources