Categories
Mastering Development

Plotly: How to prevent text overlapping between traces?

I’m working with a bar chart and a scatter trace. I must show the values as text instead of using hover text. I didn’t find an answer reading the documentation. Maybe you could help me! It would be great if I could find a way to set the bars’ text at the bottom of the […]

Categories
Mastering Development

Force Javascript/Node to wait for service completion

I’m trying to make a call to a service and build an object with the resulting value. If I knew what I was doing, I’d also handle errors, but I don’t know how. Unfortunately, the code begins the service call, then returns to the statement following the service before the service call finishes. I don’t […]

Categories
Mastering Development

Getting max value from dictionary and corresponding values

I have python script which is using google STT engine and then it loops through dictionary to check where is the biggest match (ratio) using difflib SequenceMatcher UPDATE (better explanation of what script needs to do): variable izgovoreno contains string (from google STT engine,actually microphone) – let’s say it’s value is “lights” there is nested […]

Categories
Ask Mathematics

On the subcategory of product-preserving functors

A well-known theorem of Freyd and Kelly says that the subcategory of functors $F : A \to Set$ that commute with a prescribed class of limits is reflective inside the whole $[A,Set]$. The proof of this statement relies on an application of the small object argument: for a functor $F : A \to Set$ the […]

Categories
Mastering Development

Python Flask unable to get past CORS

I have the following script written in python from flask import Flask, request, jsonify from flask_cors import CORS, cross_origin app = Flask(__name__) CORS(app, resources=r’/chat’, headers=’Content-Type’) @app.route(“/chat”) def chat(): print(request) request.get_data() data = json.loads(request.data) response = chatbot.get_response(str(data[‘message’])) response_data = response.serialize() response = jsonify({‘data’: response_data}) return response app.run(host=”0.0.0.0″, port=8900, debug=True) I am calling this API from a […]

Categories
Development System & Network

Fail2Ban not banning, Regex shows many fails in logs

I have the following jail defined in my /etc/fail2ban/jail.conf. For privacy/security I’ve replaced references to IPs with local 10.0.0.x addresses. [ssh-iptables] enabled = true filter = sshd banaction = iptables[name=SSH, port=ssh, protocol=tcp] logpath = /var/log/secure backend = auto findtime = 18000 bantime = 65535 maxretry = 5 Using the filter available here for sshd. I […]

Categories
Development

How can I convert many statement mysql dinamis to laravel eloquent?

Mysql query like this : SET @sql_dinamis = ( SELECT GROUP_CONCAT( DISTINCT CONCAT(‘SUM( IF(id_barang=’,id_barang,’,jml_bk,0)) AS br’,id_barang)) FROM barang_keluar ); SET @SQL = CONCAT(‘SELECT month(tgl_keluar) as m,’,@sql_dinamis,’ FROM barang_keluar WHERE month(tgl_keluar) and year(tgl_keluar)=2019 GROUP BY month(tgl_keluar)’ ); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; I want to convert it to laravel eloquent, but i’m […]

Categories
Development

Optimizing R code to cbind rows to a data frame

I have two data frames. For every row in the first data frame (df), there are three corresponding rows in the second data frame (design). What the code needs to do, is take every row in df, match it to the three corresponding rows in design, and then append the three corresponding rows to a […]

Categories
Development Linux

Get and set the script arguments from within a function in bash

Context: I have an old bash script with a big section parsing its arguments. It happens now that I need to call this section twice, so I plan to move it to a function to avoid code duplication. The problem: In that section, set –, shift and $@ are used, meaning that they won’t apply […]

Categories
Development System & Network

gsutil error /bootstrapping/gsutil.py

gsutil is giving me the following error. It is installed in its latest version on a linux suse 12. Can you help me? gsutil Traceback (most recent call last): File “/root/google-cloud-sdk/bin/bootstrapping/gsutil.py”, line 13, in import bootstrapping File “/root/google-cloud-sdk/bin/bootstrapping/bootstrapping.py”, line 46, in from googlecloudsdk.core.updater import update_manager File “/root/google-cloud-sdk/lib/googlecloudsdk/core/updater/update_manager.py”, line 36, in from googlecloudsdk.core import yaml File […]