AIML Condition Issue - conditional-statements

I'm trying to make this code work. It should work, since this was given to me by my teacher, however, it doesn't and I'm not sure why. It seems that, even though I seem to have the condition correct, it won't perform the actions under the condition for the "NO LO SE" value. Thanks in advance!
<?xml version="1.0" encoding="UTF-8"?>
<aiml version="2.0">
<!-- Reglas paises, las modificaremos con LEARN -->
<category>
<pattern>Cual es la capital de <set>pais</set></pattern>
<template>La capital de <star/> es <map name="capital"><star/></map>.</template>
</category>
<category>
<pattern>Cual es la capital de *</pattern>
<template>No lo se</template>
</category>
<!-- Regla 17 de aprendizaje -->
<category>
<pattern>la capital de * es *</pattern>
<template>
<think>
<set var="cap"><srai>CUAL ES LA CAPITAL DE <star/></srai></set>
</think>
<condition var="cap">
<li value="NO LO SE">
<learn>
<category>
<pattern>CUAL ES LA CAPITAL DE <eval><star/></eval></pattern>
<template>
La capital de <eval><star/></eval> es <eval><star index="2"/></eval>
</template>
</category>
</learn>
Recordare que la capital de <star/> es <star index="2"/>
</li>
<li>
Ya lo sabia.
</li>
</condition>
</template>
</category>
<!-- Fin paises -->
</aiml>

Related

Scraping LinkedIn company name, location and followers from HTML script

I'm able to scrape the company's name, location. Using the code below. But I'm facing difficulty to scrape the number of followers
Here is the HTML script for reference.
<div class="block mt2">
<div>
<h1 class="ember-view t-24 t-black t-bold full-width" id="ember28" title="Pacific Retail Capital Partners">
<span dir="ltr">Pacific Retail Capital Partners</span>
</h1>
<p class="org-top-card-summary__tagline t-16 t-black">
Our decades of experience and innovative strategies are transforming retail-led centers into high-performing properties.
</p>
<!-- -->
<div class="org-top-card-summary-info-list t-14 t-black--light">
<div class="org-top-card-summary-info-list__info-item">
Leasing Non-residential Real Estate
</div>
<!-- -->
<div class="inline-block">
<div class="org-top-card-summary-info-list__info-item">
El Segundo, CA
</div>
<!-- -->
<div class="org-top-card-summary-info-list__info-item">
4,047 followers
</div>
</div>
</div>
</div>
</div>
Scrapping company's name was easy and direct
info_div = soup.find('div', {'class' : 'block mt2'})
#print(info_div)
info_name = info_div.find_all('h1')
company_name = info_name[0].get_text().strip()
print(company_name, type(company_name),len(company_name))
Company location was accessed using this.
info_block = info_div.find_all('div', {'class' : 'inline-block'})
info_loc = info_block[0].find('div', {'class' : 'org-top-card-summary-info-list__info-item'}).get_text().strip()
print(info_loc)
How can I scrape/access second element i.e. 4047 followers ?
You can use the contains operator within the CSS selector, in this case we're searching for followers in a div with the specified class name:
followers_div = soup.select_one('.org-top-card-summary-info-list__info-item:contains(followers)')
This returns:
<div class="org-top-card-summary-info-list__info-item">
4,047 followers
</div>

SPA router link show two pages

I am new with svelte and npm. I am triying to do my first app. I executed npx degit... npm install and npm install svete-spa-router --save.
My page is ok, but when I do click on ref link, my current page is still showed and under it show the page of the link. What am I doing wrong?.
Next my routes.js code:
import Inicio from './componentes/Inicio.svelte'
import Login from './componentes/Login.svelte'
import Registro from './componentes/Registro.svelte'
import Nosotros from './componentes/Nosotros.svelte'
import Blog from './componentes/Blog1.svelte'
import ErrorRuta from './componentes/ErrorRuta.svelte'
const routes = {
'/':Inicio,
'/Login':Login,
'/Registro':Registro,
'/Nosotros':Nosotros,
'/Blog':Blog,
'*':ErrorRuta
}
export default routes
Next my App.svelte code:
<script>
import Router from 'svelte-spa-router'
import {link} from 'svelte-spa-router'
import routes from './routes'
</script>
<header class="site-header inicio">
<div class="contenedor contenido-header">
<div class="barra">
<a href="/" use:link>
<img class="cabecera" src="./img/Logo.jpg" alt="Logotipo">
</a>
<nav id="navegacion" class="navegacion">
<a href="/Login" use:link>Login</a>
<a href="/Registro" use:link>Registro</a>
<a href="/Nosotros" use:link>Nosotros</a>
<a href="/Blog" use:link>Blog</a>
</nav>
</div>
</div>
</header>
<main class="contenedor seccion">
<h2 class="font-weight300 centrar-texto">Servicios ofrecidos</h2>
<div class="contenedor-anuncios">
<div class="anuncio">
<img class="centrada" src="img/finanzas.jpg" alt="Imagen finanzas">
<div class="contenido-anuncio">
<h3 class="centrado">Robot EA ZigZag coberturas</h3>
<br/>
<p>Es importante contar con nociones básicas de trading y de MetaTrader 4 para operarlo. El robot EA ZigZag Coberturas se basa en el indicador ZigZag y cruce de medias para determinar la apertura de posiciones en el par de divisas en que se encuentre trabajando. Cuando la operación llega a un cierto nivel de Stop Loss, el robot activa coberturas y las administra, de tal forma que no haya pérdida, o la pérdida sea mínima.</p>
<br/>
<p>El objetivo del robot EA ZigZag coberturas, es proteger el capital, principalmente, de las variaciones drásticas y manipulaciones del mercado.</p>
<br/>
<p>Como todo robot, es imperativo que siempre se encuentre en línea y operando, para poder cumplir su propósito.</p>
Descargar
</div>
</div>
<div class="anuncio">
<img class="centrada" src="img/finanzas2.jpg" alt="Imagen finanzas2">
<div class="contenido-anuncio">
<h3 class="centrado">Servicios</h3>
<br/>
<p>Únete a nuestro canal de Telegram para compartir ideas de Trading.</p>
<br/>
<p>Participa en nuestro Blog para discutir estrategias que puedan ayudar a todos a alcanzar mejores resultados en el Trading.</p>
<br/>
<p>Participar no es gratis. El costo es que, de tus ganancias, destines un porcentaje (que tu decidas) a algún horfanato, asilo de ancianos (el que tu decidas).</p>
Ir al Blog
</div>
</div>
</div>
</main>
<Router {routes} />
<footer class="blue page-footer">
<div class="footer-copyright">
<div class="container">
© 2021 Copyright
</div>
</div>
</footer>
Problem solved.
App.svelte only should to have next code:
import Router from 'svelte-spa-router'
import routes from './routes'
<Router {routes} />

Invalid argument supplied for foreach() (View: C:\xampp\htdocs\COMPLIANCE-FAQ\resources\views\askQuestions\show.blade.php)

I use laravel and my project has a back part and a front on the back side all works but on the front side I find it difficult to make information accessible with this functionality. my controller is as follows:
public function show(AskQuestion $ask_questions, Respone $respone)
{
$ask_questions = AskQuestion::with(['email', 'objet_question', 'text_question', 'respone'])
->whereId($ask_questions)
->first();
//$ask_questions->timestamps = false;
//$ask_questions->views_count++;
//$ask_questions->save();
return view('askQuestions.show', compact('ask_questions'));
}
here my layoutcomposer.php
public function compose(View $view)
{
/*bind the asked question to view*/
$view->with('latestQuestions', AskQuestion::orderBy('id', 'desc')->take(10)->get());
/*binding the response to the view*/
$view->with('latestRespones', Respone::orderBy('id', 'desc')->take(10)->get());
/************/
$view->with('popularArticles', Article::orderBy('views_count', 'desc')->take(6)->get());
$view->with('latestArticles', Article::orderBy('id', 'desc')->take(6)->get());
$view->with('popularTags', Tag::withCount('articles')->orderBy('articles_count', 'desc')->take(20)->get());
$view->with('footerCategories', Category::take(6)->get());
}
here my show.blade.php
<div class="card">
<div class="card-header alert alert-primary">
{{-- $ask_questions->id --}}
</div>
<div class="card-body">
<hr>
<marquee>
<strong><p>Veuillez noter votre degré de satisfaction une fois que vous aurez la réponse à votre question svp!</p></strong>
</marquee>
<p>&nbsp</p>
<div class="fat-content-small padding-left-10">
<ul>
#foreach ($ask_questions as $ask_question)
<li>
<a href="{{ route('askQuestions.show', [$ask_question->id, $ask_question->email, $ask_question->text_question]) }}">
<i class="fa fa-file-text-o"></i> {{ $ask_question->objet_question }}
</a>
</li>
#endforeach
</ul>
</div>
And with all these bugs I had to use a view compose but nothing bugs persist there I do not know what to do I really need help please

How to use KendoDatePicker within x-kendo-template in .NET Core

I have a popup editor template working for when I want to add/edit a row in my Kendo grid and it is bound to the model's properties. The issue is that I am unable to get Kendo widgets (e.g. datepicker or dropdownlist) to generate inside the kendo-template (primarily wanting to use taghelpers). Nor have I been able to use jQuery to convert inputs into kendo widgets on $(document).ready(). How can I do this?
My grid:
<kendo-grid name="accountsGrid" height="500" on-detail-init="onDetailInit">
<datasource type="DataSourceTagHelperType.Ajax" page-size="10">
<transport>
<read url="?handler=Accounts&id=#Model.Id" data="getAntiForgeryKeyValue" type="POST" />
<create url="?handler=CreateAccount&id=#Model.Id" data="getAntiForgeryKeyValue" type="POST" />
<update url="?handler=EditAccount&id=#Model.Id" data="getAntiForgeryKeyValue" type="POST" />
</transport>
<schema>
<model id="AccountId">
<fields>
<field name="LastUpdateDate" type="Date"></field>
</fields>
</model>
</schema>
</datasource>
<columns>
<column field="Id" hidden="true" />
<column field="AccountName"
title="Account Name"
header-html-attributes='HeaderHtmlAttribute(title:"Account Name")' />
<column field="LastUpdateDate"
title="Last Updated"
format="{0:MMMM dd, yyyy}"
header-html-attributes='HeaderHtmlAttribute(title:"Last Updated")' />
<column title="Actions"
header-html-attributes='HeaderHtmlAttribute(title:"Actions")'
html-attributes='new Dictionary<string, object> {["class"] = "center-cell" }'>
<commands>
<column-command name="edit" />
</commands>
</column>
</columns>
<toolbar>
<toolbar-button name="create" template="getTelerikButton('Add')" />
</toolbar>
<editable mode="popup" template-id="accountEditorTemplate" />
<pageable button-count="5" refresh="true" page-sizes="new int[] { 5, 10, 20 }">
</pageable>
<scrollable enabled="true" />
My Editor Template:
<script id="accountEditorTemplate" type="text/x-kendo-template">
<div class="row editor-padding">
#*Account Details*#
<div class="col-md-6 col-xs-12">
<h5 class="editorTemplateHeader">Account Details</h5>
<div class="k-edit-label">
<label for="AccountName">Account Name</label>
</div>
<div class="k-edit-field">
<input required type="text" class="k-input k-textbox" name="AccountName" validationmessage="Account Name is required" maxlength="8" />
</div>
<div class="k-edit-label">
<label for="Description">Description</label>
</div>
<div class="k-edit-field">
<input type="text" class="k-input k-textbox" name="Description" maxlength="100" />
</div>
<div class="k-edit-label">
<label for="ExpirationDate">Expiration Date</label>
</div>
<div class="k-edit-field">
#*I would like to do this, but nothing appears*#
<kendo-datepicker name="ExpirationDate"></kendo-datepicker>
</div>
</div>
</div>
I resolved the problem. It involved using data- syntax. Below is the solution:
<div class="k-edit-field">
<input required type="text"
name="ExpirationDate"
data-type="date"
data-bind="value:ExpirationDate"
data-role="datepicker"
validationmessage="Expiration Date is required" />
</div>

Can't access the Velocity ProjectManager in an admin configuration form for a JIRA plugin

I build an admin configuration form for an existing JIRA plugin based on Atlassian's own admin configuration form tutorial.
By now the template appears when clicking the configure button, except one problem: I can't access the Velocity ProjectManager class. When explicitly testing it by simply writing $projectManager into the Velocity template, the string itself appears on the website instead of being resolved as a variable. How can I resolve it as a variable?
Here are some shortened versions of the code files 'admin.vm' and 'atlassian-plugin.xml':
admin.vm
<html>
<head>
<title>$i18n.getText("com.example.jira.PluginConfiguration.head")</title>
<meta content="admin_plugins_menu/upm_section" name="admin.active.section">
<meta content="upm-admin-link" name="admin.active.tab">
<meta name="decorator" content="atl.admin">
<meta name="application-base-url" content="$applicationProperties.getBaseUrl()">
$webResourceManager.requireResource("com.example.jira:resources")
</head>
<body id="jira" class="page-type-admin ">
<form name="PluginConfigurationForm" action="/secure/PluginConfiguration.jspa" method="post" style="padding: 0; margin: 0;">
<input type="hidden" name="atl_token" value="${atl_token}" class="aui">
<div>
<h2 class="aui top-label">$i18n.getText('com.example.jira.PluginConfiguration.title')</h2>
</div>
<div class="hidden">
<input name="id" type="hidden" value="${action.id}"> <input
name="returnUrl" type="hidden" value="$!{action.returnUrl}">
</div>
$projectManager
<div class="buttons-container form-footer">
<div class="buttons">
<input accesskey="s" class="button" id="PluginConfiguration-submit"
name="PluginConfiguration" title="Press Ctrl+Alt+s to submit this form"
type="submit" value="$i18n.getText('com.example.jira.PluginConfiguration.input.button.save')">
<a accesskey="`" class="cancel" href="/plugins/servlet/upm"
id="PluginConfiguration-cancel" title="Press Ctrl+Alt+` to cancel">$i18n.getText('com.example.jira.PluginConfiguration.input.button.cancel')</a>
</div>
</div>
</form>
</body>
</html>
atlassian-plugin.xml
<atlassian-plugin key="${project.groupId}.${project.artifactId}"
name="${project.artifactId}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}" />
<param name="plugin-icon">img/Project_Logo.png</param>
<param name="plugin-logo">img/Project_Logo.png</param>
<param name="configure.url"><![CDATA[/plugins/servlet/ConfigurePlugin/admin]]></param>
</plugin-info>
<resource type="i18n" name="i18n_PluginConfiguration" location="com.example.jira/PluginConfiguration" />
<component-import key="pluginScheduler">
<description>SAL Scheduler</description>
<interface>com.atlassian.sal.api.scheduling.PluginScheduler
</interface>
</component-import>
<component-import key="pluginSettingsFactory"
interface="com.atlassian.sal.api.pluginsettings.PluginSettingsFactory" />
<component-import key="transactionTemplate"
interface="com.atlassian.sal.api.transaction.TransactionTemplate" />
<component-import key="userManager"
interface="com.atlassian.sal.api.user.UserManager" />
<component-import key="loginUriProvider"
interface="com.atlassian.sal.api.auth.LoginUriProvider" />
<component-import key="renderer"
interface="com.atlassian.templaterenderer.velocity.one.six.VelocityTemplateRenderer" />
<component-import key="applicationProperties"
interface="com.atlassian.sal.api.ApplicationProperties" />
<servlet key="admin-servlet"
class="${project.groupId}.PluginConfigurationServlet">
<url-pattern>/ConfigurePlugin/admin</url-pattern>
</servlet>
<rest key="rest"
path="/project-admin"
version="1.0">
<description>Provides REST resources for the admin UI.</description>
</rest>
<template-context-item key="applicationPropertiesContextItem"
component-ref="applicationProperties" context-key="applicationProperties"
name="Application Properties Context Item" />
<web-section key="ProjectAdminMenu" name="Project Admin Section"
location="admin_plugins_menu" weight="10">
<label>Project</label>
<description key="Project Administration Section"></description>
</web-section>
<web-item key="PluginConfiguration-web-item" name="Plugin Configuration Web Item"
i18n-name-key="com.example.jira.PluginConfiguration-web-item.name"
section="admin_plugins_menu/ProjectAdminMenu" weight="46">
<description i18n-name-key="PluginConfiguration-web-item.description"></description>
<label key="com.example.jira.PluginConfiguration-web-item.label" />
<link linkId="PluginConfiguration-web-item-link">/plugins/servlet/ConfigurePlugin/admin?decorator=admin/</link>
<tooltip>Configure the Project Jira Plugin</tooltip>
</web-item>
<web-resource name="PluginConfiguration Web Resource"
i18n-name-key="com.example.jira.PluginConfiguration-web-resource.name"
key="PluginConfiguration-web-resource">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<description i18n-name-key="PluginConfiguration-web-resource.description"></description>
<context>jira.admin</context>
<transformation extension="js">
<transformer key="jsI18n" />
</transformation>
<resource type="download" name="PluginConfiguration.js"
location="javascript/PluginConfiguration.js">
<property key="content-type" value="text/javascript" />
</resource>
</web-resource>
</atlassian-plugin>