I've been trying to create a Drupal 7 install profile, but it seems that certain modules use different case for the name verified by install_verify_requirements() and the actual module install directory (which mostly affects unix/linux installs), here is an example:
# myprofile.info
name = myprofile
description = Some name for my profile
core 7.x
; Core
dependencies[] = block
dependencies[] = color
dependencies[] = comment
dependencies[] = contextual
dependencies[] = dashboard
dependencies[] = help
dependencies[] = image
dependencies[] = list
dependencies[] = menu
dependencies[] = number
dependencies[] = options
dependencies[] = path
dependencies[] = taxonomy
dependencies[] = dblog
dependencies[] = search
dependencies[] = shortcut
dependencies[] = toolbar
dependencies[] = overlay
dependencies[] = field_ui
dependencies[] = file
dependencies[] = rdf
; Contrib
dependencies[] = ctools
dependencies[] = features
dependencies[] = pathauto
dependencies[] = views
dependencies[] = entitycache
dependencies[] = storage_api
And
# myprofile.make
core = 7.x
api = 2
projects[drupal][type] = core
; Contrib Modules
projects[] = ctools
projects[] = features
projects[] = pathauto
projects[] = views
projects[] = entitycache
projects[] = storage_api
When you run:
drush make profiles/myprofile/myprofile.info
all projects are downloaded without a problem into profiles/myprofile/modules, but as soon as you try to
drush site-install
you get an error reporting that the Storage_api module was not found. You comment out the storage_api and everything works as expected.
Any clues about how to set the module install path from storage_api to Storage_api, so the install_verify_requirements() function actually finds what should find ? Or any way of just forcing a lowercase check for this ?
Thanks in advance !
The problem is that actually the storage_api, does not contain anything called storage_api. Instead, the myprofile.info file should rather include
dependencies[] = storage
dependencies[] = storage_core_bridge
dependencies[] = storage_audit
dependencies[] = storage_audit_test
instead of dependencies[] = storage_api
In general, it is smart to do :
$ find ./modules/module -name "*.install" to find actually the configurable dependencies[].
Related
I have a hugo project setup based on this theme and have the below project structure.
content
learning
aws
index.md
how-we-use
index.md
Inside the aws > index.md file, I want to have a link which opens up how-we-use > index.md. I tried below (and a lot other things), but every time I click it, it give me 404.
Tried below in aws > index.md.
- [How we use AWS](./how-we-use)
- [How we use AWS](/how-we-use)
- [How we use AWS](/learning/aws/how-we-use)
Below is my how-we-use > index.md
+++
title = "How we use AWS"
aliases = "/learning/aws/how-we-use/"
+++
Hi There
Also, tried changing this alias to /how-we-use/ and /how-we-use but still doesn't work.
config.toml
baseurl = "https://welcome-page"
title = "welcome"
theme = "hugo-universal-theme"
themesDir = "./themes"
languageCode = "en-us"
uglyURLs = false
# Site language. Available translations in the theme's `/i18n` directory.
defaultContentLanguage = "en"
# Define the number of posts per page
paginate = 10
# not pluralize title pages by default
pluralizelisttitles = false
[[menu.main]]
name = "Learnings"
identifier = "menu.learnings"
url = "/img/learnings.png"
weight = 4
[[menu.main]]
name = "Learnings"
identifier = "section.learnings"
url = ""
weight = 1
parent = "menu.learnings"
post = 1
[[menu.main]]
name = "AWS"
identifier = "learning.aws"
url = "/aws"
weight = 1
parent = "section.learnings"
How to get this cross reference to work ?
p.s - if I change the name of the files to _index.md, then no content is displayed and I just see the title getting displayed but nothing else.
md link format []() could be used with full link [](https://...) or with anchor [](#anchor), but you need relative link and hugo has another syntax for it: []({{< ref "" >}})
According to Hugo documentation index.md can be reference either by its path or by its containing folder without the ending /. _index.md can be referenced only by its containing folder.
So try it:
[How we use AWS]({{< ref "/how-we-use" >}})
It works with my ananke theme. But you could try also:
[How we use AWS]({{< ref "/how-we-use/index" >}})
[How we use AWS]({{< ref "/learning/aws/how-we-use" >}})
[How we use AWS]({{< ref "/learning/aws/how-we-use/index" >}})
I would like to instantiate the project.toml that's build in in a Pluto notebook with the native package manager. How do I read it from the notebook?
Say, I have a notebook, e.g.,
nb_source = "https://raw.githubusercontent.com/fonsp/Pluto.jl/main/sample/Interactivity.jl"
How can I create a temporary environment, and get the packages for the project of this notebook? In particular, how do I complete the following code?
cd(mktempdir())
import Pkg; Pkg.activate(".")
import Pluto, Pkg
nb = download(nb_source, ".")
### Some code using Pluto's build in package manager
### to read the Project.toml from nb --> nb_project_toml
cp(nb_project_toml, "./Project.toml", force=true)
Pkg.instantiate(".")
So, first of all, the notebook you are looking at is a Pluto 0.17.0 notebook, which does not have the internal package manager. I think it was added in Pluto 0.19.0.
This is what the very last few cells look like in a notebook using the internal pluto packages:
# ╔═╡ 00000000-0000-0000-0000-000000000001
PLUTO_PROJECT_TOML_CONTENTS = """
[deps]
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
[compat]
Plots = "~1.32.0"
PlutoUI = "~0.7.40"
PyCall = "~1.94.1"
"""
# ╔═╡ 00000000-0000-0000-0000-000000000002
PLUTO_MANIFEST_TOML_CONTENTS = """
# This file is machine-generated - editing it directly is not advised
julia_version = "1.8.0"
...
so you could add something like:
import(nb)
write("./Project.toml", PLUTO_PROJECT_TOML_CONTENTS)
This has the drawback of running all the code in your notebook, which might take a while.
Alternatively, you could read the notebook file until you find the # ╔═╡ 00000000-0000-0000-0000-000000000001 line and then either parse the following string yourself or eval everything after that (something like eval(Meta.parse(string_stuff_after_comment)) should do it...)
I hope that helps a little bit.
The Pluto.load_notebook_nobackup() reads the information of a notebook. This gives a dictionary of deps in the field .nbpkg_ctx.env.project.deps
import Pluto, Pkg
Pkg.activate(;temp=true)
nb_source = "https://raw.githubusercontent.com/fonsp/Pluto.jl/main/sample/PlutoUI.jl.jl"
nb = download(nb_source)
nb_info = Pluto.load_notebook_nobackup(nb)
deps = nb_info.nbpkg_ctx.env.project.deps
Pkg.add([Pkg.PackageSpec(name=p, uuid=u) for (p, u) in deps])
I'm trying to use LDAP to authenticate against the company Active Directory. ADExplorer shows me that the directory is set up in the manner:
Active Directory Explorer
-- MyCompany.com
+- DC=MyCompany, DC=com
+- OU=Domain Controllers
+- OU=MyCompany Locations
+- OU=BR
+- OU=CA
+- OU=DE
|+- OU=Munich
|+- OU=MyTown
||+- OU=Users & Computers
|||+- OU=Users
||||+- CN=Firstname1 Lastname1
||||+- CN=Firstname2 Lastname2
When I select a particular user, myself for example, I see the AD path is in the form below.
OU=Users,OU=Users & Computers,OU=MyTown,OU=DE,OU=MyCompany
Locations,DC=MyCompany,DC=com
I set up the LDAP options in my application's config.php as follows:
$ldap_base_dn_ar[0]['attribute_name'] = 'ou';
$ldap_base_dn_ar[0]['attribute_value'] = 'Users';
$ldap_base_dn_ar[1]['attribute_name'] = 'ou';
$ldap_base_dn_ar[1]['attribute_value'] = 'Users & Computers';
$ldap_base_dn_ar[2]['attribute_name'] = 'ou';
$ldap_base_dn_ar[2]['attribute_value'] = 'MyTown';
$ldap_base_dn_ar[3]['attribute_name'] = 'ou';
$ldap_base_dn_ar[3]['attribute_value'] = 'DE';
$ldap_base_dn_ar[4]['attribute_name'] = 'ou';
$ldap_base_dn_ar[4]['attribute_value'] = 'MyCompany Locations';
$ldap_base_dn_ar[5]['attribute_name'] = 'dc';
$ldap_base_dn_ar[5]['attribute_value'] = 'MyCompany';
$ldap_base_dn_ar[6]['attribute_name'] = 'dc';
$ldap_base_dn_ar[6]['attribute_value'] = 'com';
This works but I suspect that it will only work for users in MyTown and country.
How would I change this to allow LDAP authentication from any town in any country?
From Gabriel Luci's comments:
You say "I suspect" - have you test that? Maybe it already works the way you want.
I don't have a foreign login at the moment. I'll get one set up or get someone to test it.
But you should only have to specify OU=MyCompany Locations since everything is under that.
$ldap_base_dn_ar[0]['attribute_name'] = 'ou';
$ldap_base_dn_ar[0]['attribute_value'] = 'MyCompany Locations';
$ldap_base_dn_ar[1]['attribute_name'] = 'dc';
$ldap_base_dn_ar[1]['attribute_value'] = 'MyCompany';
$ldap_base_dn_ar[2]['attribute_name'] = 'dc';
$ldap_base_dn_ar[2]['attribute_value'] = 'com';
If I cut the LDAP options down as shown above authentication fails.
I'm running Hugo and editing my pages using Notepad++. I'd like to embed some code similar to the page here.
My Hugo version is
Hugo Static Site Generator v0.55.6-A5D4C82D windows/amd64 BuildDate: 2019-05-18T07:57:00Z
My config.toml file is below. As you can see, I've added the pygments options to the top of the page:
pygmentsCodefences = true
pygmentsStyle = "autumn"
baseurl = "https://blakeshurtz.netlify.com/"
title = "Blake Shurtz"
theme = "hugo-creative-portfolio-theme"
languageCode = "en-us"
# Enable comments by entering your Disqus shortname
disqusShortname = ""
# Enable Google Analytics by entering your tracking code
googleAnalytics = ""
[params]
# Style options: default (pink), blue, green, pink, red, sea, violet
# Use custom.css for your custom styling
style = "default"
description = "Describe your website"
copyright = "©2019 Blake Shurtz"
sidebarAbout = [
"I am a research statistician who enjoys building models and apps.",
"Originally from the Bay Area, currently based in central CA."
]
# Contact page
# Since this template is static, the contact form uses www.formspree.io as a
# proxy. The form makes a POST request to their servers to send the actual
# email. Visitors can send up to a 1000 emails each month for free.
#
# What you need to do for the setup?
#
# - set your email address under 'email' below
# - upload the generated site to your server
# - send a dummy email yourself to confirm your account
# - click the confirm link in the email from www.formspree.io
# - you're done. Happy mailing!
email = "you#yoursite.com"
# Optional Matomo analytics (formerly piwik)
# [params.analytics.matomo]
# URL = "https://stats.example.com"
# ID = "42"
# # Track all subdomains with "*.example.com" (Optional)
# domain = "www.example.com"
# # Optional integrity check hash
# hash = ""
# Nav links in the side bar
[[params.navlinks]]
name = "Home"
url = "portfolio/"
home = true
[[params.navlinks]]
name = "About"
url = "about/"
[[params.navlinks]]
name = "Get in touch"
url = "contact/"
[params.social]
stackoverflow = "https://stats.stackexchange.com/users/206673/blake-shurtz"
twitter = "https://twitter.com/blakeobeans"
email = "blakeobeans#gmail.com"
linkedin = "https://www.linkedin.com/in/blakeshurtz/"
github = "https://github.com/blakeobeans"
Can someone give me an example of what I need to write in my text editor in order to include the code?
Thanks!
I'm assuming you mean using markdown syntax to format text as code.
Surround your code with three backticks at the beginning and at the end.
```python (or whatever language)
code here
```
As Ambrose Leung's answer mentions, you can include code blocks in markdown by wrapping them in 3 backticks:
```language
some code here
```
To get syntax highlighting, you can use Chroma, which is built into Hugo. Just add these lines to the top of your config.toml file (don't let the names confuse you, they say pygments but are for chroma):
pygmentsCodefences = true
pygmentsStyle = "pygments"
You can set the pygmentsStyle value to any of the styles from the style gallery.
My question is similar to the question of janpeter. I study the ebook by Tiller and try to simulate the example 'Architecture Driven Approach' with OpenModelica and JModelica. I tried the minimal example 'BaseSystem' in OpenModelica and it works fine. But with JModelica version 1.14 I get errors in the compiling process and my script fail. My python script is:
import matplotlib.pyplot as plt
from pymodelica import compile_fmu
from pyfmi import load_fmu
# Variables: modelName, modelFile, extraLibPath
modelName = 'BaseSystem'
modelFile = 'BaseSystem.mo'
extraLibPath = 'C:\Users\Tom\Desktop\Tiller2015a\ModelicaByExample\Architectures'
compilerOption = {'extra_lib_dirs':[extraLibPath]}
# Compile model
fmuName = compile_fmu( modelName, modelFile, compiler_options=compilerOption)
# Load model
model = load_fmu( fmuName)
# Simulate model
res = model.simulate( start_time=0.0, final_time=5.0)
# Extract interesting values
res_w = res['sensor.w']
res_y = res['setpoint.y']
tSim = res['time']
# Visualize results
fig = plt.figure(1)
ax1 = fig.add_subplot(111)
ax2 = ax1.twinx()
ax1.plot(tSim, res_w, 'g-')
ax2.plot(tSim, res_y, 'b-')
ax1.set_xlabel('t (s)')
ax1.set_ylabel('w (???)', color='g')
ax2.set_ylabel('y (???)', color='b')
plt.title('BaseSystem')
plt.legend()
plt.grid(True)
plt.show()
My problem is how to compile and simulate a model that is part of a package?
I am not a jModelica user, but I think I see some confusion in your script. You wrote:
modelName = 'BaseSystem'
modelFile = 'BaseSystem.mo'
extraLibPath = 'C:\Users\Tom\Desktop\Tiller2015a\ModelicaByExample\Architectures'
But that implies (to me) that the compiler should open the package stored at C:\Users\Tom\Desktop\Tiller2015a\ModelicaByExample\Architectures. But the top-level package is ModelicaByExample and the model you want is Architectures.BaseSystem. So I think something like this is probably more appropriate:
modelName = 'Architectures.BaseSystem'
modelFile = 'package.mo'
extraLibPath = 'C:\Users\Tom\Desktop\Tiller2015a\ModelicaByExample'
The essential point here is that you should be opening ModelicaByExample (specifically, the package.mo file in the ModelicaByExample directory). That opens the ModelicaByExample package. You need to open this package because it is the top-level package. You can't load just a sub-package (which is what it looked like you were trying to do). Then, once you've got ModelicaByExample loaded, you can ask the compiler to specifically compile Architectures.BaseSystem.
I suspect OpenModelica was "helping" you by opening the top-level package anyway, even if you were asking it to open the sub-package.
But again, I don't know jModelica very well and I have definitely not tested any of these suggestions.
Thank you Michael Tiller. With your support I found the solution.
First, the modelName has to be full qualified. Second, as you mentioned, the extraLibPath should end at the top-level directory of the library ModelicaByExample. But then I got errors, that JModelica couldn't find components or declarations which are part of the Modelica Standard Library (MSL).
So I added the modelicaLibPath to the MSL, but the error messages remained the same. After many attempts, I launched the command line with administrator privileges and any errors were gone.
Here is the executable python script: BaseSystem.py
### Attention!
# The script and/or the command line must be
# started with administrator privileges
import matplotlib.pyplot as plt
from pymodelica import compile_fmu
from pyfmi import load_fmu
# Variables: modelName, modelFile, extraLibPath
modelName = 'Architectures.SensorComparison.Examples.BaseSystem'
modelFile = ''
extraLibPath = 'C:\Users\Tom\Desktop\Tiller2015a\ModelicaByExample'
modelicaLibPath = 'C:\OpenModelica1.9.2\lib\omlibrary\Modelica 3.2.1'
compileToPath = 'C:\Users\Tom\Desktop\Tiller2015a'
# Set the compiler options
compilerOptions = {'extra_lib_dirs':[modelicaLibPath, extraLibPath]}
# Compile model
fmuName = compile_fmu( modelName, modelFile, compiler_options=compilerOptions, compile_to=compileToPath)
# Load model
model = load_fmu( fmuName)
# Simulate model
res = model.simulate( start_time=0.0, final_time=5.0)
# Extract interesting values
res_w = res['sensor.w']
res_y = res['setpoint.y']
tSim = res['time']
# Visualize results
fig = plt.figure(1)
ax1 = fig.add_subplot(111)
ax2 = ax1.twinx()
ax1.plot(tSim, res_w, 'g-')
ax2.plot(tSim, res_y, 'b-')
ax1.set_xlabel('t (s)')
ax1.set_ylabel('sensor.w (rad/s)', color='g')
ax2.set_ylabel('setpoint.y (rad/s)', color='b')
plt.title('BaseSystem')
plt.legend()
plt.grid(True)
plt.show()