How do you import 'process' in Meteor? - meteor

Meteor currently advises to import everything. Like import Meteor from 'meteor/meteor';.
So if I want to do something like console.log(process.env.MONGO_URL), what should I import?
Bonus question: I can't find the documentation for process, where is it?

process is a global object (so no need for import) and only available on the server. It is part of the node environment.
See https://nodejs.org/docs/latest-v8.x/api/process.html

Related

SSR project with VUE 3, express and usevue/head

So I have a project on vue 3, in with was requested to add metadata(og, and twitter), so has been a long week, due I never had to work with something like that before, and it seems there are only 2 options available as I can see, so I have chose to work with usevue/head plugin, however the SSR part was not clear in the documentation, assuming that you already know. So after a long research, testing, and watching tutorials, I found how to, the component rendering to head was the easy part and is done(in my main project not in this repository, because my project I still don't have the ssr part and it's what I'm trying to figure out).
However for the SSR I created a empty project(check repository here) where I just want to run the server together with the plugin example code from the documentation, however now I'm facing 2 issues:
For some reason the css coming from the components is not being "compile" by the server.
More important, when importing the usevue/head plugin into the project I got an error: "UnhandledPromiseRejectionWarning: ReferenceError: useHead is not defined"
I suppose is because now I have 2 "main" js files, one for the server, and one for the client side, so I'm guessing that I need to import somehow the plugin to the main.server one as well, which currently looks like that:
import App from './App.vue'
export default App;
While my client side one looks like:
import { createApp } from 'vue'
import App from './App.vue'
import { createHead } from '#vueuse/head'
const head = createHead();
createApp(App).use(head).mount('#app');
If I am guessing correctly, the question is, how do you include in general a third party plugin in a server side file, not to mention the router?
Thank you in advance for your help. Also if you can recommend something else, also is very welcome.

Alfresco data export and import

we have to export alfresco data and import into another repository, and not necessarily backup/restore process. we are aiming for script which can be run and extract data on some conditions, set of files, with all its metedata.
i have got below link, which talks about same, but it is old , and things cant be done like versions of the file, condition based extract.
https://www.ibm.com/developerworks/cn/xml/x-cmis2/index.html
i would like to know any approaches available for extract and import of the alfresco data into other repositories..
There is nothing out-of-the-box that will do this. The replication sub-system is not suitable for frequent replication of more than a small handful of nodes.
So, you will have to write a custom solution or look at third-party solutions that can do this. Simflofy is one example. Another example is the Parashift Alfstream module.
If you would like to develop this yourself, I suggest you do something like:
Write code to export one or more files to the file system. This should be storage that is shared between the source and all target repositories.
Alongside each file, write a "manifest" file that descries the file's metadata, including custom properties and property values. You should use the same format that the Bulk File System Import Tool expects when doing an import.
Add a message to a queue that describes where the exported data is sitting and where it needs to be imported.
In the target repository, write a listener that is subscribe to the queue.
When the listener gets a message it can initiate a Bulk File System Import in the target system. The BFSIT will import the files and set the metadata as described in the manifest file you generated in Step 2.
Optionally, the target system can place another message on the queue acknowledging that the import has been performed, which the source repo can then pick up to complete the task.
Some people have been successful using Apache Camel for this, but it is not strictly necessary.

Meteor: Do import statements matter when importing meteor packages?

So I've created an empty Meteor app. One of the files, server/main.js , looks like this:
import { Meteor } from 'meteor/meteor';
Meteor.startup(() => {
// code to run on server at startup
console.log('hello from the server');
});
I've tried commenting out the import statement above and the code still runs. So, are import statements, when importing meteor globals, only so it's more easy to see where the variable comes from? Does it make any difference, behaviorally, if I include that import statement or not?
The short answer: yes... and no.
From the Meteor Guide on importing Meteor globals: (emphasis mine)
For backwards compatibility Meteor 1.3 still provides Meteor’s global namespacing for the Meteor core package as well as for other Meteor packages you include in your application. You can also still directly call functions such as Meteor.publish, as in previous versions of Meteor, without first importing them. However, it is recommended best practice that you first load all the Meteor “pseudo-globals” using the import { Name } from 'meteor/package' syntax before using them. For instance:
import { Meteor } from 'meteor/meteor';
import { EJSON } from 'meteor/ejson';
It is, as they say, a best practice, as you saw that removing the import did not break your code. However, as you mentioned, there are some benefits:
You can tell which globals are being used within the file at a glance
Some IDEs can accurately link back to the exported objects in source files.
Those are the two I can think of off hand I find valuable in my every-day work with Meteor.

import com.google.android.gms.ads.reward cannot be resolved

I am trying to deploy in my App the RewardedVideoAd of Admob, but when I put the import of the library I get this error:
import com.google.android.gms.ads.reward cannot be resolved
Someone knows why this happen?
It took 5 days to get it. I did receive no answer from here... but thinking in all those people that will face this problem in the future, I want to say my solution, and this is: create a complete new project from a .metada from 0, and import the new version of google play service lib (very easy to get here in stackOverflow) , import it. If you have a facebook project, remove it, and import from 0 as well. When you have finished to import all your libraries, create a new project, the yours, and copy, file per file, everything. This will work for sure.

'Insufficient privileges' on plone python script

I have this python script designed to rebuild the catalog for a particular content type, however when I visit it's url in the browser I get 'insufficient privileges' even when logged in as admin. How can I run something like this?
import plone.api
catalog = plone.api.portal.get_tool(name='portal_catalog') for brain in catalog(portal_type='Resource'):
obj = brain.getObject()
catalog.catalog_object(obj)
You don't need plone.api for this. Thus remove plone.api import and do:
catalog = context.portal_catalog
ScriptPython is restricted Python, that means that you can not import every Python module you want. That could the reason that you can't use plone.api in ScriptPython. But you can import getToolByName in that Script and get tools like the portal_catalog with it.
from Products.CMFCore.utils import getToolByName
catalog = getToolByName('portal_catalog')
If create your script in filesystem, you ca run.
bin/instace run your_script
But in your case, you don't need import plone.api
Plone in ZMI have many restrictions for import something.
See more informations about portal_catalog in official plone site
Documentation Query

Resources