I'm just wondering about the behavior of config.linkVars = test(0-100).
My expectation was that all links generated with Typolink will now add the current value of the GET var - lets say &test=66 - to all links of the page. That basically works, but TYPO3 will cache the whole site for all users now even if they have this GET param or not. So every user receive all links containing &test=66 even if they dont have the GET param in their or URL or another value of this GET var.
I though TYPO3 should generate a new cache for each possible value of the config.linkVar?
Tested with and without realUrl and with and without [FE][cHashExcludedParameters] = test in the install tool.
Different cache spaces are by default generated for each typoscript-condition.
As long as you have no specific condition no cache space is generated and all generated content is stored in one space. Independent of individual setting of test with first value of test.
as your range for test is very wide you might need to insert a big block of conditions into your TS
[globalVar GP:test = 1]
[globalVar GP:test = 2]
[globalVar GP:test = 3]
[globalVar GP:test = 4]
[globalVar GP:test = 5]
:
[globalVar GP:test = 99]
[globalVar GP:test = 100]
[global]
If you only need some single values try to define it
config.linkVars = test(0,14-16,38,66,100)
Is there maybe now a less "hackish" solution for this? That workaround only works when the values are known.
Related
I'm attempting to first train a PPOTrainer for 250 iterations on a simple environment, and then finish training it on a modified environment. (The only difference between the environments would be a change in one of the environment configuration parameters).
So far I have tried implementing the following:
ray.init()
config = ppo.DEFAULT_CONFIG.copy()
config["env_config"] = defaultconfig
trainer = ppo.PPOTrainer(config=config, env=qsd.QSDEnv)
trainer.config['env_config']['meas_quant']=1
for i in range(250):
result = trainer.train()
#attempt to change the parameter 'meas_quant' from 1 to 2
trainer.config['env_config']['meas_quant'] = 2
trainer.workers.local_worker().env.meas_quant = 2
for i in range(250):
result = trainer.train()
However, the second training still uses the initial environment configuration. Any help in figuring out how to fix this would be greatly appreciated!
I'd suggest one of two approaches
Create a new Trainer instance and restore from the first
ray.init()
env_config["meas_quant"] = 1 # Assuming env_config is set
config = {"env_config": env_config}
trainer = ppo.PPOTrainer(config=config, env=qsd.QSDEnv)
for i in range(250):
result = trainer.train()
checkpoint = trainer.save_to_object()
env_config['meas_quant'] = 2
config["env_config"] = env_config
trainer2 = ppo.PPOTrainer(config=config, env=qsd.QSDEnv)
trainer2.restore_from_object(checkpoint)
# Do whathever is needed ...
Alter the environment directly for each worker
May require modifying the environment to set the parameter you're looking to change.
# After the first training loop
trainer.workers.foreach_worker(
lambda w: w.foreach_env(lambda e: e.meas_quant = 2)
)
# Do your stuff ...
As an aside, I would avoid using DEFAULT_CONFIG.copy since it only creates a shallow copy of the dictionary, so changes to nested configuration dicts could alter the original default configuration. Plus, RLlib's Trainer already deepmerges wathever config dict you pass to it with the default configuration.
So the scenario here is that i'm trying to create a simple scope in OctoberCMS that will allow me to filter a query with the builder plugins list component. In my model I have defined the scope as such:
public function scopeFirst($query)
{
return $query->where('practice_name',1);
}
This should just constraint the query to fetch only the records where that value is 1. The Component is recognizing this scope and allowing me to choose it from the drop-down list, as indicated by my index.htm file:
[builderList]
modelClass = "vetadmin\Practicedetails\Models\Practicedetails"
scope = "scopeFirst"
displayColumn = "id"
noRecordsMessage = "No records found"
detailsPage = "-"
detailsUrlParameter = "id"
pageNumber = "{{ :page }}"
Does anybody have any ideas of what could be causing it to not apply the constraint? Currently -all- the records are being returned. The documentation isn't particularly elaborate on this and just suggests you need to define the scope in your plugins model php file (as I've done)
https://octobercms.com/docs/database/model#query-scopes
is the documentation i'm referring to.
Thanks.
Hmm this is little confusing for the larval eloquent model
I have tested your code and scope
Then I just realised that scopeFirst can be apply on modal like this $modal->first() <= this is issue its reserved method
As per my knowledge first [ref: https://laravel.com/docs/5.7/eloquent] is method to get first record from the collection/models. [ So, your scope is treated like that and ended up doing nothing ! ]
So, just change your scope name like scopeFirstPractice etc.. can solve our issue.
and just normally use
[builderList]
modelClass = "vetadmin\Practicedetails\Models\Practicedetails"
scope = "scopeFirstPractice"
It should definitely work. [ I have tested. ]
if any doubt please comment.
I encountered such a problem in the script. I have a condition but it does not work. I do not understand why I tried different meanings but did not help anything. Who can say why?
I used Typo3 6.2
[globalVar = GP:tx_store_storelocatorframe|store != 0]
Also, when the value is displayed in this way, then I get the correct result in the browser.
page.10.wrap.data = GP:tx_store_storelocatorframe|store
The reason may be that the value is of the String type ?
I recommend using the following condition/ operator. If needed, you can add an else branch to check what's going on.
[globalVar = GP:tx_store_storelocatorframe|store > 0]
...
[else]
...
[end]
Screenshot 2The one screen shot of this errorissue I am building an app using api.ai , an syllabus app which tells you the syllabus, but when I invoke it with desired parameters like branch and semester I have made each individual intent for it even then I'm getting miss answers sometimes like when asked for sem 4 and branch electronics its showing sem 3 sem 4 or of other branch . I have given sem and branch as required n given few invoking statements even then getting this. Tried even training it manually for free 30s of actions on api.ai no solution please help. Not using any web hook , context , event.
Short answer - check here for screenshots http://imgur.com/a/tVBlD
Long answer - You have two options
1) Create 3 separate custom entities for each branch type (computer science, civil, communication) which you need to attach to your branch parameter
2) Using the sys.any entity and attaching it to your branch parameter; then determining what the incoming parameter value is on a server then sending back a response through a webhook.
If you go the second route, you have to create a webhook and hardcode recognized words like 'computer science' in IF statements which check the incoming parameter (sent through JSON from API.AI). This route will be more difficult but I think you will have to travel it regardless because you will have backend architecture which you access to find and return the syllabus.
Note the second route is what I did to solve a similar issue.
You can also use regex to match an item in a list which limits the amount of hardcoding and if statements you have to do.
Python regex search example
baseurl = "http://mywebsite.com:9001/"
# Parse the document
# Build the URL + File Path and Parse the Document
url = baseurl + 'Data'
xmlLink = urllib.request.urlopen(url)
xmlData = etree.parse(xmlLink)
xmlLink.close()
# Find the number of elements to cycle through
numberOfElements = xmlData.xpath("count(//myData/data)")
numberOfElements = int(numberOfElements)
types = xmlData.xpath("//myData/data")
# Search the string
i = 0
while numberOfElements > i:
listSearch= types[i].text
match = re.search(parameter, listSearch, re.IGNORECASE)
if match is None:
i += 1
else:
# Grab the ID
elementID = types[i].get('id')
i = 0
break
An simple trick would be what i did, just have an entity saved for both branch and semester , use sys.original parameters and an common phrase for provoking each intent saves up the hard work.
I try to let typo3 generate a sitemap for all the news records. For that I tried the dd_googlesitemap_dmf extention. The dd_googlesitemap works (it creates a sitemap for all the typo3 pages - but not for extensions). I filled in the basic infos into the configuration and called the url ?eID=dd_googlesitemap&sitemap=dmf&selector=news, but all I get is a blank page (500 Internal Server Error).
The error:
mod_fcgid: stderr: PHP Fatal error: Class 'tx_ddgooglesitemap_ttnews' not found in [..]/typo3conf/ext/dd_googlesitemap_dmf/class.tx_ddgooglesitemap_dmf.php on line 43
I edited theext_typoscript_setup.txt in the extention and also tried to add the typoscript directly to the page template. Here is the version of the typoscript I use (all I changed is pidList and singlePid):
plugin.dd_googlesitemap_dmf {
# selector for your extension (same as GET selector=news)
news {
# uid is NECESSARY in the sqlSelect field
sqlMainTable = tx_news_domain_model_news
# if catList depends of column of sqlMainTable (Column name like city or country)
sqlCatColumn =
# if catList depends on sqlMMTable (Only works if uid_foreign and uid_local is in use)
sqlMMTable = tx_news_domain_model_news_category_mm
# order of the XML output
sqlOrder = tstamp DESC
# last modified timestamp column (inside of sqlMainTable)
sqlLastUpdated = tstamp
# sql column of the title
sqlTitle = title
# sql column of keywords
sqlKeywords = keywords
# frequency
frequency = 1
# typolink additionalParam (must belong to the uid of the sqlMainTable)
linkParams = tx_news_pi1[news]
# csv Pid's of the stored elements. Rootline is not checked with this setting
pidList = 66
# detail page id where the link should point at
singlePid = 103
# filter by category which is inside of the main table -> sqlCatColumn
catList =
# csv filter by mm related table -> sqlMMTable
catMMList =
# disable the language check through GLOBALS['TSFE']->sys_language_uid
disableLanguageCheck = 0
}
# sitemap eID urls for the crawler
crawler {
1 = http://beispiel.de?eID=dd_googlesitemap
# more than one sitemap
# 2 = http://beispiel.de?eID=dd_googlesitemap&more-configuration
}
}
Anyone got experience with this extention or got a good alternative?
Here the links to the ext.:
http://typo3.org/extensions/repository/view/dd_googlesitemap
http://typo3.org/extensions/repository/view/dd_googlesitemap_dmf
You can't install _dmf on a typo3 6.2 from the repo, (Dependencies <= 6.1.99), but the version on github works:
https://github.com/dohomi/dd_googlesitemap_dmf
The current version of the TYPO3 extension news provides a hook itself to generate sitemaps for news records. See https://docs.typo3.org/typo3cms/extensions/news/AdministratorManual/BestPractice/SitemapWithDdGoogleSitemap/Index.html for details
I had to downgrade dd_googlesitemap (using 1.2.0 now) to get dd_googlesitemap_dmf to work