Categories
Mastering Development

How can I create an archive template for a taxonomy that displays that taxonomies terms within a plugin

I have a taxonomy being created by my plugin called prop_cities and it has a rewright that makes it display as example.com/cities/city-term. I want to add a template to example.com/cities/ that will be and archive of all city-terms but I cant get it to work. here is my full taxonomy.php file and the portion of […]

Categories
Mastering Development

How to inherit Odoo’s POS buttons

I’m trying to add some functions in the POS buttons, specifically the button that shows up like “Validate”. To test if the guide in this link https://odoo-development.readthedocs.io/en/latest/dev/pos/gui.html works, I’m just adding a console.log like the following: odoo.define(‘my_module.js_file’, function (require) { “use strict”; var screens = require(‘point_of_sale.screens’); screens.PaymentScreenWidget.include({ init: function(parent, options) { this._super(parent, options); //My console […]

Categories
CMS Mastering Development Wordpress

WooCommerce CSV Import – all variants disabled [closed]

So far I’ve managed to import some products to WooCommerce via a CSV file without any problems. Now after an updating import I noticed that ALL variants are not active: How can I make all my products active again? I checked the CSV Docs, there’s not such field to set it on “active”. In the […]

Categories
Mastering Development

Convert an array to a hash table or hash map

I have 2 functions: smalltalk and do_smalltalk. smalltalk will check if the user input (intent) matches a word given in the array. If there is a match, the program will move on to do_smalltalk. My question is, how do I change this to a hash table or hash map data structure so that I can […]

Categories
Mastering Development

Convert an array to a hash table or hash map

I have 2 functions: smalltalk and do_smalltalk. smalltalk will check if the user input (intent) matches a word given in the array. If there is a match, the program will move on to do_smalltalk. My question is, how do I change this to a hash table or hash map data structure so that I can […]

Categories
Mastering Development

Can anyone explain what this is

},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&”radio”===b&&n.nodeName(a,”input”)){var c=a.value;return a.setAttribute(“type”,b),c&&(a.value=c),b}}}}}),Zb={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$b[b]||n.find.attr;$b[b]=function(a,b,d){var e,f;return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});var _b=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{“for”:”htmlFor”,”class”:”className”},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&”set”in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&”get”in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute(“tabindex”)||b.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each([“tabIndex”,”readOnly”,”maxLength”,”cellSpacing”,”cellPadding”,”rowSpan”,”colSpan”,”useMap”,”frameBorder”,”contentEditable”],function(){n.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=”string”==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||””).match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(” “+c.className+” “).replace(ac,” “):” “)){f=0;while(e=b[f++])d.indexOf(” “+e+” “)<0&&(d+=e+” “);g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||”string”==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||””).match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(” “+c.className+” “).replace(ac,” “):””)){f=0;while(e=b[f++])while(d.indexOf(” “+e+” “)>=0)d=d.replace(” “+e+” “,” “);g=a?n.trim(d):””,c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return”boolean”==typeof b&&”string”===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if(“string”===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||”boolean”===c)&&(this.className&&L.set(this,”className“,this.className),this.className=this.className||a===!1?””:L.get(this,”className“)||””)})},hasClass:function(a){for(var b=” “+a+” “,c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(” “+this[c].className+” “).replace(ac,” “).indexOf(b)>=0)return!0;return!1}});var […]

Categories
Mastering Development Software

TCP delayed acks vs Nagle’s algorithm

When you have an application that suffers from the unfortunate interaction between TCP delayed ack and Nagle’s algorithm, common solution offered is to turn off Nagle’s algorithm. However, in general searching through the net, it looks like Nagle’s algorithm is overall better idea (basing it off the algorithms in general and this, this, this etc.) […]

Categories
CMS Mastering Development Wordpress

Customize format of settings

I am adding some settings to the “General” settings page: add_settings_section( ‘foobar_settings_section’, ‘Foobar Options’, [$this, ‘foobar_options_callback’], ‘general’ ); $fields = [ ‘foobar_title’ => ‘Title’, ‘foobar_link’ => ‘Link’, // lots more ]; foreach ($fields as $fieldKey => $fieldTitle) { add_settings_field( $fieldKey, $fieldTitle, [$this, ‘foobar_textbox_callback’], ‘general’, ‘foobar_settings_section’, [$fieldKey] ); register_setting(‘general’, $fieldKey, ‘esc_attr’); } This just outputs a […]

Categories
Mastering Development

Canvas: drawing tiles in a loop result in only a single tail being drawn

I’m generating a random “map” like so: generateTiles() { for (let x = 0; x < this.width; x++) { for (let y = 0; y < this.height; y++) { if (Math.random() < 0.3) { this.worldmap[x][y] = new Wall(x, y); } else { this.worldmap[x][y] = new Floor(x, y); } } } } Then, I try to […]

Categories
CMS Mastering Development Wordpress

Speed/Performance difference between `wp_ajax` and `init` checks for AJAX/POST requests?

Typically, people do ajax calls like: add_action( ‘wp_ajax_ACTIONNAME’, [$this, ‘callback_Function’] ); However, I am interested, what are key differences (other than having authorization checks & wp_ajax_nopriv_ ) from doing the AJAX $_POST checks within: add_action( ‘init’, [$this, ‘callback_Function’] ); // or ‘admin_init’ public function callback_Function() { if(!empty($_POST[‘action_name])) …. } my main interest here is if […]