Categories
CMS Joomla Mastering Development

How to set article options and associations programmatically?

I work on a custom Joomla 3 module that creates articles programmatically based on user input. I can create the articles, but I could not find a way to set the article options and associations when the article is created. I found this article on where the options are stored in the Joomla DB, but […]

Categories
Linux Mastering Development Ubuntu

Glib.MainLoop.quit() doesnt stop the loop

Im using this code from gi.repository import GLib as glib import dbus from dbus.mainloop.glib import DBusGMainLoop import sys def print_notification(bus, message): keys = [“app_name”, “replaces_id”, “app_icon”, “summary”, “body”, “actions”, “hints”, “expire_timeout”] args = message.get_args_list() if len(args) == 8: print(“hi”) glib.MainLoop().quit() def main(): DBusGMainLoop(set_as_default=True) session_bus = dbus.SessionBus() session_bus.add_match_string_non_blocking(“type=’method_call’,interface=’org.freedesktop.Notifications’,member=’Notify’,eavesdrop=true”) session_bus.add_message_filter(print_notification) loop = glib.MainLoop() loop.run() main() I need […]

Categories
Mastering Development

Vue Test Utils mount in multiple tests

I am testing my Vue App using Vue Test Utils and Jest. Below is my dashboard component. <template> <div class=”dashboard-v2″> <div class=”component-container”> <component :loading=”loading” :key=”identifier” :is=”currentTab” /> </div> <SnackBar v-on:snackBarHide=”displaySnackBar = false” :text=”snackBarText” :show=”displaySnackBar” :type=”snackBarType” /> </div> </template> <script> import { mapState } from “vuex”; import “@/shared/chart-kick”; import EventBus from “@/shared/event-bus”; import Tabs from “./helpers/Tabs”; […]

Categories
Mastering Development

How to convert this json into string and get value of the ‘id’ property

I want to return only course id within jsonList.but My code is not working. My json output: “{\”courses\”:[{\”id\”:5,\”fullname\”:\”Course temp\”,\”displayname\”:\”Course temp\”,\”shortname\”:\”ct\”,\”categoryid\”:17,\”categoryname\”:\”Course templates\”,\”sortorder\”:40002,\”summary\”:\”\”,\”summaryformat\”:1,\”summaryfiles\”:[],\”overviewfiles\”:[],\”contacts\”:[],\”enrollmentmethods\”:[\”manual\”],\”idnumber\”:\”\”,\”format\”:\”topics\”,\”showgrades\”:1,\”newsitems\”:5,\”startdate\”:20120160,\”enddate\”:20120160,\”maxbytes\”:0,\”showreports\”:0,\”visible\”:1,\”groupmode\”:0,\”groupmodeforce\”:0,\”defaultgroupingid\”:0,\”enablecompletion\”:1,\”completionnotify\”:0,\”lang\”:\”\”,\”theme\”:\”\”,\”marker\”:0,\”legacyfiles\”:0,\”calendartype\”:\”\”,\”timecreated\”:1583825606,\”timemodified\”:1583910617,\”requested\”:0,\”cacherev\”:1583913808,\”filters\”:[{\”filter\”:\”displayh5p\”,\”localstate\”:0,\”inheritedstate\”:1},{\”filter\”:\”mathjaxloader\”,\”localstate\”:0,\”inheritedstate\”:1},{\”filter\”:\”activitynames\”,\”localstate\”:0,\”inheritedstate\”:1},{\”filter\”:\”mediaplugin\”,\”localstate\”:0,\”inheritedstate\”:1}],\”courseformatoptions\”:[{\”name\”:\”hiddensections\”,\”value\”:0},{\”name\”:\”coursedisplay\”,\”value\”:0}]}],\”warnings\”:[]}” My code:(I want to return only id) public int GetCourseDetails(Course course) { string URI = “http://localhost/Moodle/webservice/rest/server.php”; using (WebClient wc = new WebClient()) { wc.QueryString.Add(“wstoken”, “49345fa96c58118326b874bxxxxx”); wc.QueryString.Add(“wsfunction”, “core_course_get_courses_by_field”); wc.QueryString.Add(“moodlewsrestformat”, “json”); wc.QueryString.Add(“field”, “shortname”); wc.QueryString.Add(“value”,course.shortname); var response_data […]

Categories
Artificial Intelligence (AI) Development

What algorithm to use for finding artists/bands in text and differentiating between artists that share the same name

Here’s the data I have: Text from articles from various music blogs & music news sites (title, summary, full content, and sometimes tags). I used a couple different NLP/NER tools (nltk, spacy, and stanford NER) to determine the proper nouns in the text, and gave each proper noun a score based on how many times […]

Categories
CMS Development Magento

Extending third party extension but Class does not exist when compiling

I’m extending a third party extension, and it looks like this, with registration and module I know their right. di.xml <?xml version=”1.0″?> <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:ObjectManager/etc/config.xsd”> <preference for=”Invoicing\Moloni\Libraries\MoloniLibrary\Controllers\Products” type=”Custom\Moloni\Libraries\MoloniLibrary\Products” /> </config> and products.php <?php namespace Custom\Moloni\Libraries\MoloniLibrary; use Invoicing\Moloni\Libraries\MoloniLibrary\Controllers\Products as custommoloni; use Invoicing\Moloni\Libraries\MoloniLibrary\Controllers; use Invoicing\Moloni\Libraries\MoloniLibrary\Moloni; use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Sales\Api\Data\OrderInterface; use Magento\Sales\Model\ResourceModel\Order\Tax\Item; use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory; use Magento\Catalog\Model\Category […]

Categories
Development

convert right side of join of one to many tables into an array in knex

Please help I have table ideas that look like this ideas = { id, title, abstract, background, classification, technicalfeild, tag, user_id, } and a table idea-images that look like this idea-images = { id, idea_id, banner, image_details } they have a one to many relations. I need to select all the ideas that have public […]

Categories
Development

Angular test how to mock ActivatedRoute data

I have a real big problem with mocking ActivatedRoute data property. No matter what I am doing all it ends up with error message : Error: <spyOnProperty> : Property data does not have access type get. Moving stub const to separate mock class also not solving the issue. I have found that this should be […]

Categories
Development

Array.map() doesn’t render React component

I am having a problem where i’m trying to render pass an array’s data to a card component but it doesn’t appear on the page, the card component renders normally on its own: import React, { Component } from ‘react’ import { Container, Grid, Card, Segment, Header } from ‘semantic-ui-react’; import ArticleCard from ‘./ArticleCard’; export […]

Categories
Development

Dynamic Forms in React, Cannot read property ‘map’ of undefined

Overview So I’m only new to React and I’m having trouble trying to create a dynamic form. At the moment I want bug.pages and bug.steps_to_reproduce to be dynamic, meaning when I click a button like the “+ Add Page” it will add the new fields to bug.pages and display the new fields on the form. […]