Read and write BAT logs

Oops, next thing I need help with the logic of my .bat

I have an "error" event monitoring tool where she calls .bat out of that call, which has created the following rule:

1 – After calling .bat, he writes a line in the log "type c: temp errors.txt"

  echo ( %date% %time:~0,8% ) "Controle de erros (5x)" >>%LOGFILE%

2 – I need it to control the number of error events from .log

   A cada 5 eventos de erro no mesmo dia escreva no meu log a linha:

   echo ( %date% %time:~0,8% ) "ja teve 5 erros hj" >>%LOGFILE%

3 – And write all 10 error events on different days no. log:

         echo ( %date% %time:~0,8% ) "teve mais de 10 erros" >>%LOGFILE%

………………………………………….. ………………………

@echo off
setlocal enableextensions disabledelayedexpansion

Set LOGFILE = C: ProAgent data CUSTOMIZATIONS.log

: CHECK_ERROR
set error = 0

for / f %% i in (

 ?????????

) from set / a error + = 1

if% error% LEQ 6 (

echo ( %date% %time:~0,8% ) "Controle de erros (5x)" >>%LOGFILE%

goto :SAIR

)

type c: temp errors.txt | findstr / c:% date%

if% errorlevel% neq 0 (

echo %date% >c:temperros.txt

echo ( %date% %time:~0,8% ) "ja teve 5 erros hj" >>%LOGFILE%

)

: EXIT

get out

Read more: -https: //www.pactofsupplement.com/slimphoria-keto/

SlimPhoria Keto

(Official site) Buy now: -https: //www.pactofsupplement.com/slimphoria-keto/

This product has already been considered very special and is different from all other dietary supplements available on the market. This keto pill is the most widely traded pill by volume and its profit margin is higher than that of the others. The reason for this is simply that this is not only accepted by everyone, but is also referred to others by the public, and as a result, demand increases exponentially. In this way, the balance of all vitamins and minerals in your body is maintained, so that ketosis is reached immediately and is maintained for a long time, while at the same time supporting the other main functions of your body. Stay healthy.

Pandas – Read all tables of HTML code with Beautiful Soup 4 in Python

I try to extract all the tables separately from an HTML file, put them in data frames and then convert the data.

The problem is that find_all (& # 39; table & # 39;) only shows the first table. I even tried exporting the output from find_all directly to a txt. The code in question:

node_count = 0
for path in node_paths:
    html_text = bs4(open(path), 'html5lib')
    tables = html_text.find_all("table")
    f = open("myfile.txt", "a")
    f.write(str(table))
    f.close()
    df = pd.read_html(str(tables))(0)
    df.to_csv(f"temp_data/node{node_count}.csv")
    node_count+=1

The HTML that opens has 3 tables.
Imports are correct and it gives me no mistakes.

python – design decision to read XLSX files instantly or temporarily

I'm working on converting an existing Python-based monolith solution to a microservice. The current flow is pretty simple:

Accept XLSX as input -> run some complex algorithms based on input and a standard file (XLSX) -> generate XMLs

The same application can be used for multiple projects. The default files are project-specific and are preloaded, and these files are rarely changed. These files are manually moved to the project-specific directory when the files are received by the users via email.

When a request for a particular project arrives, the current application reads both the input and standard files to go through the algorithm and finally produces the XML output. The standard files are read intermittently and not read as a whole. Only a few sheets are read at the time of input validation, and other sheets are read at a later time.

As part of my microservice architecture, I decided to provide endpoints for uploading, updating, and retrieving the standard files. Since these standard files are rarely changed, I decided to analyze them after uploading and save them on a REDIS server in order to reduce the effort for parsing during the actual processing, since these files are usually quite large in the size (~ 2GB).

So I am a bit perplexed when I read the standard file with many sheets at once and save it in REDIS. That would be a better solution, or if I read it "sheet by sheet" as needed.

JavaScript – Promise.resolve (). Use then () correctly Error: Not caught (in promise): TypeError: Property cannot be read

Hello, I have the following code:


export class Page {
  constructor(public modalController: ModalController) { }

  private async openModal(value) {    
    const modal = await this.modalController.create({
      component: AnotherPage,
      componentProps: {
        "paramID": 123,
        "paramTitle": "Test Title",
        "takenPhoto": "null"
      }
    });

    return await modal.present();
  }

  public async takePicture() {
    this.openModel(null); // aqui dá certo
    Promise.resolve(this.someMethod()).then(this.openModal); // aqui dá erro
  }

}

In the method takePicture I want to open a modal after doing that Promise.resolve, In the first execution of the function everything works, in the second there are errors.

The error is as follows:

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'modalController' of undefined
TypeError: Cannot read property 'modalController' of undefined
    at tab2.page.ts:25
    at Generator.next ()
    at tslib.es6.js:73
    at new ZoneAwarePromise (zone-evergreen.js:876)
    at Module.__awaiter (tslib.es6.js:69)
    at openModal (tab2.page.ts:22)
    at ZoneDelegate.invoke (zone-evergreen.js:359)
    at Object.onInvoke (core.js:34201)
    at ZoneDelegate.invoke (zone-evergreen.js:358)
    at Zone.run (zone-evergreen.js:124)
    at resolvePromise (zone-evergreen.js:797)
    at resolvePromise (zone-evergreen.js:754)
    at zone-evergreen.js:858
    at ZoneDelegate.invokeTask (zone-evergreen.js:391)
    at Object.onInvokeTask (core.js:34182)
    at ZoneDelegate.invokeTask (zone-evergreen.js:390)
    at Zone.runTask (zone-evergreen.js:168)
    at drainMicroTaskQueue (zone-evergreen.js:559)

Does anyone know how to solve this? Thank you very much

html – How can I read all XML files found in a folder?

I use before xmltodict to read XML one by one from Flask in a web environment using Python.
What I want to do is select a folder and read it so that all existing XML files can be read and everyone gets a code that interests me, listing the name of the file and the keys.
The part of the advice that interests me about XML is already there, I just want to see how to read multiple XMLs from a folder that I can choose.

My code is this to read the XML from HTML

and the python code to iterate over the XML is as follows

import os
import sys
from flask import Flask, render_template, request, redirect, url_for, flash
import xmltodict
app = Flask(__name__)
app.secret_key = 'mysecretkey'

@app.route("/")
def upload_file():
    return render_template('about.html')

@app.route("/uploader", methods=('POST'))
def uploader():
    if request.method == "POST": 
        xml_r = request.files('archivo')
        todo = xmltodict.parse(xml_r)
return todo


if __name__ == '__main__':
    app.run(debug=True)

04/18 – do not read beyond the first line, although this is the case in Excel and Libre Office

I have problems compiling data. I have a tab delim .txt file with some column-specific cells that contain a very large number of characters. The large number of characters causes Libre Calc and Excel to raise errors and skip rows (presumably those that contain cells with too many characters). So I tried to use cut to extract only the columns I wanted (which, to my knowledge, excludes columns with cells with too many characters). But for some reason, cut only reads the first line of the file. Why does cut only read the first line?

If someone has a moment to take a look, you can find the tab delim file at:

https://github.com/wccarleton/askubuntu

Powershell – Double lines easier to read than DRY

Please see the file here, which is printed in separate sections below.
My question is fundamental

  1. Which way is better?
  2. What is easier to understand?
  3. What is easier to change?
  4. What should be the priority? Change or understanding?

NEW WAY to use variables and loops to deduplicate as much as possible. Ideally, only one array should be changed.

$regpath = "HKCU:Control PanelCursors"
$cursorpath = "%LocalAppData%MicrosoftWindowsCursors"

$suffix = "_eoa.cur"
$settings = @(@{Path="."; Force=$true; PropertyType="String";       Name="(Default)";     Value="Windows Inverted"}
              @{Path="."; Force=$true; PropertyType="DWord";        Name="CursorBaseSize";  Value=64}
              @{Path="."; Force=$true; PropertyType="DWord";        Name="Scheme Source"; Value=2}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="Appstarting";     Value=$cursorpath + "busy"   +$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="Arrow";           Value=$cursorpath + "arrow"  +$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="Crosshair";       Value=$cursorpath + "cross"  +$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="Hand";            Value=$cursorpath + "link"   +$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="Help";            Value=$cursorpath + "helpsel"+$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="IBeam";           Value=$cursorpath + "ibeam"  +$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="No";              Value=$cursorpath + "no"     +$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="NWPen";           Value=$cursorpath + "pen"    +$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="Person";          Value=$cursorpath + "person" +$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="Pin";             Value=$cursorpath + "pin"    +$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="SizeAll";         Value=$cursorpath + "move"   +$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="SizeNESW";        Value=$cursorpath + "nesw"   +$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="SizeNS";          Value=$cursorpath + "ns"     +$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="SizeNWSE";        Value=$cursorpath + "nwse"   +$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="SizeWE";          Value=$cursorpath + "ew"     +$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="UpArrow";         Value=$cursorpath + "up"     +$suffix}
              @{Path="."; Force=$true; PropertyType="ExpandString"; Name="Wait";            Value=$cursorpath + "wait"   +$suffix}
             )

Set-Location $regpath #set location to registry folder where we will make all changes
#$DebugPreference = "Continue"
foreach ($regkey in $settings) {
    New-ItemProperty @regkey #create all the registry keys
    Write-Debug ($regkey | Out-String)
}
#$settings.ForEach(New-ItemProperty @_) #alternative method testing

OLD WAY. With only 1 variable.

#Set Mouse Pointer Scheme to Windows Inverted, large size
$cursorpath = "%LocalAppData%MicrosoftWindowsCursors" #this references the environment variable directly
##$cursorpath = "%SystemRoot%cursors" #this references the environment variable directly
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name "(Default)"      -Value "Windows Inverted"                    -PropertyType String       -Force
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name CursorBaseSize   -Value 64                                    -PropertyType DWord        -Force
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name "Scheme Source"  -Value 2                                     -PropertyType DWord        -Force
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name AppStarting      -Value ($cursorpath + "busy"   + "_eoa.cur") -PropertyType ExpandString -Force
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name Arrow            -Value ($cursorpath + "arrow"  + "_eoa.cur") -PropertyType ExpandString -Force #same
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name Crosshair        -Value ($cursorpath + "cross"  + "_eoa.cur") -PropertyType ExpandString -Force
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name Hand             -Value ($cursorpath + "link"   + "_eoa.cur") -PropertyType ExpandString -Force
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name Help             -Value ($cursorpath + "helpsel"+ "_eoa.cur") -PropertyType ExpandString -Force
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name IBeam            -Value ($cursorpath + "ibeam"  + "_eoa.cur") -PropertyType ExpandString -Force #same
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name No               -Value ($cursorpath + "no"     + "_eoa.cur") -PropertyType ExpandString -Force #same
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name NWPen            -Value ($cursorpath + "pen"    + "_eoa.cur") -PropertyType ExpandString -Force
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name Person           -Value ($cursorpath + "person" + "_eoa.cur") -PropertyType ExpandString -Force #same
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name Pin              -Value ($cursorpath + "pin"    + "_eoa.cur") -PropertyType ExpandString -Force #same
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name SizeAll          -Value ($cursorpath + "move"   + "_eoa.cur") -PropertyType ExpandString -Force
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name SizeNESW         -Value ($cursorpath + "nesw"   + "_eoa.cur") -PropertyType ExpandString -Force
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name SizeNS           -Value ($cursorpath + "ns"     + "_eoa.cur") -PropertyType ExpandString -Force
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name SizeNWSE         -Value ($cursorpath + "nwse"   + "_eoa.cur") -PropertyType ExpandString -Force
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name SizeWE           -Value ($cursorpath + "ew"     + "_eoa.cur") -PropertyType ExpandString -Force
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name UpArrow          -Value ($cursorpath + "up"     + "_eoa.cur") -PropertyType ExpandString -Force
New-ItemProperty -Path "HKCU:Control PanelCursors" -Name Wait             -Value ($cursorpath + "wait"   + "_eoa.cur") -PropertyType ExpandString -Force #same
# It's so annoying that only 6/17 names are the same. I guess it'd due to changes in modern thinking about naming conventions and how they thought
#previously. This raises the question about how to do it right in OSes? That's why APIs are hard I guess. 

Javascript – Script JS file in Netbeans cannot be read

I am trying to insert a script into my HTML text:


    

The problem is probably the path, but I can't find my mistake. I change it 100 times. Here is my "http://stackoverflow.com/myFunction.js":

        function myFunction() {
        // Declare variables
        var input, filter, table, tr, td, i, txtValue;
        input = document.getElementById("myInput");
        filter = input.value.toUpperCase();
        table = document.getElementById("myTable");
        tr = table.getElementsByTagName("tr");
        var tamano = 0;
        // Loop through all table rows, and hide those who don't match the search query
        console.log(tr.length);
        for (i = 0; i < tr.length; i++) {
        td = tr(i).getElementsByTagName("td")(7);
        //console.log(td);
        if (td) {
        txtValue = td.textContent || td.innerText;
        if (txtValue.toUpperCase().indexOf(filter) > -1) {
        tamano = tamano +1;
        tr(i).style.display = "";
        } else {
        tr(i).style.display = "none";
        }

        }
        }
        var list = document.getElementById("capa");   // Get the 
    element with id="myList" list.removeChild(list.childNodes(0)); console.log(tamano); var capa = document.getElementById("capa"); var h1 = document.createElement("p"); h1.innerHTML = tamano; capa.appendChild(h1); }

And you can see my project folder here:

project folder

Can you help me find out what I'm doing wrong?

Thanks a lot!