Including flot.time plugin in node application - node.js

Using flotjs node-modules to draw graphs, but could not as it was giving error as : Time mode requires the flot.time plugin. When checked in node_modules/flotjs directory found that flot.time.js is already present. As I need time mode in the options so this plugin is necessary. How to remove this error or get the flot.time.js imported ? Gave a try with absolute path also in the same file where import need to be done, but it did not work. How to import flot.time.js into existing project ?

Related

Getting "'__name__' not in globals" when updating custom plugins for 2.0

I have updated my check_mk from 1.6.x to 2.0.x
My custom omd-plugins got messed up and so I started to refactor them for the new 2.0 API with the help of this article.
However, when the time for testing came, I got this:
OMD[my_omd]:~$ cmk --detect-plugins=my_plugin -vI my_host.my_company.de
Error in plugin file /omd/sites/my_omd/local/share/check_mk/checks/my_plugin: "'__name__' not in globals"
I was using sym-links.
For source-control, I have a git-repo. I had put sym-links pointing from the old checks-directory back to the plugin-file in that repo. Starting through the above mentioned guide, I created a new sym-link from the new local/lib/check_mk/base/plugins/agent_based/. Adding the required .py suffix in the process. So now I have 2 sym-links pointing to one piece of code, which I had modified in-place.
Turns out: If you do not delete the plugin from the old location, you will always test the old plugin. With sym-links, you will test the new code in the old environment, giving you that error.
Notice the path in the error-message!
As for the __name__ error itself: It seems to come from doing relative imports import .something. Notice the leading dot. It means "in the same directory as this file". Somehow the old environment was not able to cope with that.

Merge schemas of custom dialog - Error conflicting definitions

I am following the steps of this page:
https://learn.microsoft.com/en-us/composer/how-to-create-custom-actions
and have reached to the part where it is required to merge the two schemas: bots and your custom one. However when running the powershell script found inside the created project template (CoreAssistant template) I have the following error:
Error conflicting definitions of HelpDialog.dialog :
C:\Users\user\source\repos\AvanadeCoreAssistant\AvanadeCoreAssistant\dialogs\imported\Microsoft.Bot.Components.HelpAndCancel\HelpDialog\HelpDialog.dialog
Microsoft.Bot.Components.HelpAndCancel:
C:\Users\user.nuget\packages\microsoft.bot.components.helpandcancel\1.1.2\exported\HelpDialog\HelpDialog.dialog
Error conflicting definitions of HelpDialog.en-us.lu.dialog :
C:\Users\user\source\repos\AvanadeCoreAssistant\AvanadeCoreAssistant\dialogs\imported\Microsoft.Bot.Components.HelpAndCancel\HelpDialog\recognizers\HelpDialog.en-us.lu.dialog
Microsoft.Bot.Components.HelpAndCancel:
C:\Users\user.nuget\packages\microsoft.bot.components.helpandcancel\1.1.2\exported\HelpDialog\recognizers\HelpDialog.en-us.lu.dialog
Error conflicting definitions of HelpDialog.lu.dialog
HelpDialog is a predefined dialog that was already present. I have installed NodeJs and #botframework-cli package because it was required from the powershell script in order to run bf dialog:merge and now it seems these two sources have some kind of conflict.
To add to other answers, changes that worked for me are as follows:
update-schema.ps1, line 11, change "!**/generated" to "!../generated" and add "!../dialogs/imported"
Also, make sure that your custom action project is INSIDE of your bot directory, it should be a folder next to the "schemas" folder for the script to find it.
Note/Edit: Having the project nested inside the bot works to get the script working, though I do not recommend it due to causing other errors. Oddly, I found it was best to move the whole custom solution up a level, next to the bot project. You may have to edit the [botName].sln file in notepad to reference the location of the project, as well as editing the bot project's project reference.
I fixed it by changing the script. I noticed the script was trying to ignore the folder imported and generated but the error message indicated it was not doing so. So I changed it from !**/generated to !../generated.
I experienced the same issue.
To fix this problem you could simply delete the corresponding dialogs in the "imported" folder. Note that this will, however, delete these dialogs in your bot, which is not optimal but should be of little concern for a sample application.

Python Selenium 4 - Firefox installAddon not working

I've upgraded to selenium 4
new_addon_path = 'D:/GOOD/Coding/uBlock.xpi'
browser1 = selenium.webdriver.Firefox(options=opts, etc....)
browser1.install_addon(new_addon_path)
Error:
selenium.common.exceptions.WebDriverException: Message: Expected absolute path: [Exception... "Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) .....
Documentation:
https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/CHANGES.md
The documentation says:
Changes to firefox.Driver .. Added installAddon(path)
A temporary profile automatically is created in C:/Users/User/AppData/Local/Temp/
I want this temporary profile, so that I can thread multiple driver sessions at once without creating and assigning new profiles manually.
This temp profile can be found using browser1.__dict__['capabilities']['moz:profile']
Fixes I have tried:
tried placing uBlock.xpi into profile folder, then calling browser1.install_addon(path to profile/extensions/uBlock.xpi)
tried placing uBlock.xpi in same folder as geckodriver.log
All paths fail, regardless of if they are relative or apsolute paths.
Documentation also says:
Changes to firefox.Options .. Added addExtensions
which does not even exist as an option in firefox.Options
Message: Expected absolute path
This error message tells you the exact problem.
install_addon() requires an absolute path, but you are passing it a relative path.
The solution is to use an absolute path.
The documentation says
The documentation you pointed to is for the JavaScript bindings, but your code is using the Python bindings. You are reading the wrong documentation.
The lads at github.com solved the issue,
browser1.install_addon('D:/GOOD/Coding/uBlock.xpi')
should look like:
browser1.install_addon(r'D:\GOOD\Coding\uBlock.xpi')
This works
I'm not sure why, since the service() function or any other python selenium functions works perfectly fine on windows with blackslashes. This path however requires this formula.

Adding Bigdata.jar or Sinbad.jar to sublime.

I need to add bigjar to sublime so that I could use import big.data.*;
Which could be found here: https://github.com/berry-cs/big-data-cse
This link directs me to download sinbad, which I did. I now have this jar file and I don't know what to do with it.
I tried opening it. I tried going to package control but I think those are pre-downloadedable packages. I tried checking the package folder, where I am then presented with a user folder which embeds a package.Control.cache folder and other package bundles file, and dragging the sinbad.jar file in there.
I am terribly confused and just want to start my homework. If you could help or just push me in the rigth direction. I due apologize if this might be copy of another question.
AuctionSystem.java:5: error: package big.data does not exist
import big.data.*;
^
1 error

After adding libraries to dymola, i can't connect it to Python via buildingspy

After i have made some libraries load directly when i open Dymola by modifying the file : "c:/program files (x86)/dymola 2016 fd01/insert/dymola.mos" , and adding those lines :
Utilities.setenv("MODELICAPATH","C:/Users/hrameh/Desktop/EnergySystems_V2-73p/ModelicaLibraries/ExternalMedia-master/Modelica/ExternalMedia 3.2.1");
openModel("C:\Users\hrameh\Desktop\EnergySystems_V2-73p\ModelicaLibraries\ExternalMedia-master\Modelica\ExternalMedia 3.2.1\package.mo");
Utilities.setenv("MODELICAPATH","C:\Users\hrameh\Desktop\EnergySystems_V2-73p\ModelicaLibraries\EnergySystems");
openModel("C:\Users\hrameh\Desktop\EnergySystems_V2-73p\ModelicaLibraries\EnergySystems\package.mo");
Utilities.setenv("MODELICAPATH","\illuin\users$\hrameh\Mes documents\Dymola");
The model works completely fine in Dymola. But, when trying to simulate the model via Python using the buildingspy library, the simulation fails. Any suggestions to help me find a solution?
I guess your problem is, that buildingspy relies on the default working directory path Dymola gets when the dymola.exe is called by buildingspy - but the openModel-commands in your dymola.mos change the working directory.
Use
openModel("<path-to-package.mo>", changeDirectory=false);
to avoid this.
Additionally, with newer Dymola versions, you must ensure that no saved startup directory is used, by selecting: Edit -> Options -> Settings -> Do not save Startup directory.
As you currently use Dymola 2016 FD01 this is not a problem for you at the moment.
Such problems can be detected by showing the Dymola window when buildingspy simulates a model. You can do this with showGUI as shown in this minimum example:
import os
from buildingspy.simulate.Simulator import Simulator
os.environ["PATH"] += os.pathsep + "C:/Program Files (x86)/Dymola 2016 FD01/bin"
s = Simulator("Modelica.Blocks.Examples.PID_Controller", "dymola")
s.showGUI(show=True)
s.simulate()
Some further hints for your example:
You do not need the Utilities.setenv()-calls to open a library. openModel is sufficient
I would not use Utilities.setenv, as this is an undocumented and apparently a very old package (creation date is from 2004). Use Modelica.Utilities.System.setEnvironmentVariable instead. This way you also don't get an extra package loaded in the package browser
Using the file /insert/dymola.mos has some disadvantages:
it is used system wide by every user, so it should not contain paths to user directories
if you install a new dymola version, you must edit the insert/dymola.mos file of this installation again
Alternatives to dymola.mos
In Dymola 2016 FD01 use the file setup.mos instead to add the openModel commands (located in C:\Users\\AppData\Roaming\Dynasim)
Newer Dymola versions don't have setup.mos anymore, but setup.dymx for the settings and startup.mos for the user commands (to open libraries, etc.)

Resources