I don't see about the 2 thes, but let's say they are.let arr1 = [-10, 12, -12, 40, 35, 100]
let arr2 = [-100, 81, 0, 1, 1, -101.2];
let min = Math.min(...arr1.concat(arr2));
console.log(min);
Try building the HC in the following way:model = Sequential()
model.add(Dense(70, input_shape=(X.shape[1],), activation='relu'))
model.add(Dense(80, activation='relu'))
model.add(Dense(90, activation='relu'))
model.add(Dense(70, activation='relu'))
model.add(Dense(Y.shape[1], activation='softmax'))
It's actually better to use the vector. This is an example:#include <iostream>
#include <vector>
#include <iterator> // заголовочный файл итераторов
using namespace std;
int main()
{
vector<int> array1; // создаем пустой вектор
// добавляем в конец вектора array1 элементы 4, 3, 1
array1.insert(array1.end(), 4);
array1.insert(array1.end(), 3);
array1.insert(array1.end(), 1);
// вывод на экран элементов вектора
copy( array1.begin(), // итератор начала массива
array1.end(), // итератор конца массива
ostream_iterator<int>(cout," ") //итератор потока вывода
);
return 0;
}
Function str.split accepts the separator you didn't give. Total b equal to the reference line b = ['<исходная строка>']♪ Mass decisions:Option 1. b = list(s) - just converting the line into a list. Each symbol will be a separate part of the list.Option 2. b = s - Piton's building supports the same indexing and sliding methods as the list, so it doesn't make sense to convert the line to the list.Comment on the name: If you call a function getMiddleIf she returns the meaning, she turns it off. Otherwise it's something. showMiddle It's working.Minor explanation https://www.w3schools.com/python/ref_string_split.asp ♪ He accepts a separator line (which, by default, is equal to the default sign - that is, separate words). Examples of use:# дефолтное значение разделителя – пробел
>>> str.split('Hello, World!')
['Hello,', 'World!']
# можно обращаться напрямую к объекту
# и передавать строку, а не символ
>>> '1713abc2834bce1895'.split('bc')
['1713a', '2834', 'e1895']
First of all, if the script ends with an exception you can capture, the normal thing is that you handle this exception so that the process itself is self-managed and when the failure occurs, re-start all that is necessary to continue. Python allows a great handling of exceptions, if you know in advance that an exception may occur that is not in your hands correct, instead of letting your process end abruptly is better to capture that exception and to end in a controlled way the work you are doing (or restart it) carrying out the process safely (close of open files or sockets, controlled termination of threads, etc.). A very simplified example to illustrate what I mean is the following: #!/usr/bin/env python
import time
def main():
time.sleep(10)
raise RuntimeError()
if name == "main":
while True:
try:
main()
except RuntimeError:
print("[WARNING]: script execution fail.")
continue
break
If during execution main() a type exception occurs RuntimeError (in this case it always occurs at 10 seconds of being called) it again calls repeating the process indefinitely. If it ends properly or because of another exception (p.e) Ctrl + c) the process ends. In case the above is not possible, you have several options:Use the Demons Manager https://www.freedesktop.org/software/systemd/man/systemd.service.html : I don't remember.
since 15.04 it is integrated into the system. In addition to allowing you to start the service manually and reboot in case of failure automatically, you can get it started to start the system. The basic idea is to create a new .service file: $ sudo touch /etc/systemd/system/twitterBot.service
$ sudo chmod 664 /etc/systemd/system/twitterBot.service
$ sudo nano /etc/systemd/system/twitterBot.service
The basic file content can be:[Unit]
Description=Python Twitter monitor
After=network.target
After=systemd-user-sessions.service
After=network-online.target
[Service]
ExecStart=/ruta/a/tu/script.py
Restart=on-failure
[Install]
WantedBy=multi-user.target
Edited .service We save it and recharge it:$ systemctl daemon-reload
With this we can start our service when we want to:$ sudo systemctl start twitterBot
Put it down with:$ sudo systemctl stop twitterBot
Enable it to be executed on the start of the system:$ sudo systemctl enable twitterBot.service
Disable it to be executed on the start of the system:$ sudo systemctl disable twitterBot.service
Get service information:$ sudo systemctl status twitterBot.service
This is just a basic example, systemd has much more potential, in the previous link you have the documentation.Important: Don't forget to give execution permissions to the script and make sure you have the appropriate shebang line at the beginning of the that points to the correct interpreter (p.e #!/usr/bin/env python2).Use cron to schedule a task that every x time checks if the process is ongoing and if not relaunch it. Use a second script in Python or bash that is responsible for launching the subprocess and launching it again if it does not end in a expected way. The basic idea would be something like that:import subprocess
path = "ruta/a/tu/script.py"
while True:
try:
subprocess.check_call(["python2", path])
except subprocess.CalledProcessError:
continue
There are probably many more ideas, such as the one that @Gytree says, using a script instead of cron that checks if the process is running every time. However, in my opinion, the first thing is to make the script self-manage its exceptions (instead of abruptly ending when it occurs) and for everything else (for example, the process ends with unexpected shutdown of the computer) Systemd is a very good tool.
Apparently you don't have read permissions in that folder or may the route be badly tipped, out of this is a very bad practice trying to access with the complete route to the TEMPLATES, the right way is to access using using 'app/template.html'.You can fix your problem by configuring in your settings file the folder/s where you will have your templates using the corresponding settings, e.g.:TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), 'templates'),
)
By default you must already have it configured, then just render using the function well render a shortcut that allows you to pass the context and template in this way:from django.shortcuts import renderdef my_view(request):
# View code here...
return render(request, 'myapp/index.html', {
'foo': 'bar',
})
Or the traditional way:from django.http import HttpResponse
from django.template loaderdef my_view(request):
# View code here...
t = loader.get_template('myapp/index.html')
c = {'foo': 'bar'}
return HttpResponse(t.render(c, request), content_type='application/xhtml+xml')
You can see more information in the https://docs.djangoproject.com/en/3.0/topics/http/shortcuts/#example
First, you never allow the user to enter data of the type that doesn't touch, filter the input so that only numbers can be allowed.
If the data has already been introduced, use regular expressions.In your case, to get a number with decimals use the expression: \d*?.\d*If you also find that as a decimal separator they use "," use this other: \d*?(.ATA,)\d*More information: http://www.oracle.com/technetwork/es/articles/sql/expresiones-regulares-base-de-datos-1569340-esa.html http://mysql.conclase.net/curso/?cap=regulares%20%22%22
All you need is a return at the end of the function Iretate: prev.next = headval.next
headval = None
# OJO: Falta un return
return True
Modify the part where you test the function:b = None
while not b:
a = input("lugar? ")
b = availableparking.Iretare(a)
if b:
print("Desocupado")
else:
print("Ocupado")
DemoA17
A4
lugar? A5
Ocupado
lugar? A4
Desocupado
You can't, because for that you would have to modify the size of that window area which is a component of the operating system that tkinter uses without altering.These are all the "freedoms" I know concerning the icons in tkitner:Make a multisize icon in this https://icoconvert.com/ free of charge and use it in the executable, this way depending on the zoom in the file browser the executable icon will look more or less large.You can also convert to base64 the icon not to depend on the icon.png file from the tkinter window and have the logo within the same code, more information https://github.com/Ariel-MN/Tkinter_base64_Images .
The entire internet was digging, official documentation, nothing, but it happened like this:namespace.in(room).clients(function(err, clients) {
console.log(clients.length);
});
May and c filterand c lambda:key = 'test'
my_list = ['testzxc', 'someqwe', 'thisert']
new_list = list(filter(lambda i: key not in i , my_list))
>>> new_list
['someqwe', 'thisert']
but the old good list comprehension is even clearer than I am:new_list = [i for i in my_list if key not in i]