viernes, 5 de abril de 2024

APPEND all the txt content of several files *.log in unique fiel output.txt (run in cmd)

 type *.log > output.txt

QUERY amb regex al GoogleSheets

 


Boxplot from data

 <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Boxplot Example</title>
    <!-- Include Plotly.js -->
    <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
    <!-- Your HTML content here -->
    <div id="boxplot"></div>

    <script>
        // Data
        const data = [
            [1, 1, 2, 7, 7, 5, 10, 3, 6, 8, 3, 4, 1, 7, 7, 4, 1, 5, 8, 6, 1, 2, 8, 4, 4, 6, 8, 6],
            [2, 2, 3, 5, 3, 7, 2, 4, 6, 2, 2, 2, 2, 3, 4, 4, 1, 3, 5, 2, 3, 5, 3, 3, 8, 8, 3],
            [1, 3, 7, 10, 8, 10, 7, 7, 9, 5, 4, 2, 7, 7, 6, 1, 4, 8, 6, 1, 3, 10, 7, 3, 9, 8, 9],
            [1, 4, 7, 8, 8, 6, 9, 9, 2, 6, 7, 8, 1, 6, 6, 1, 6, 7, 1, 3, 7, 1, 8, 7, 6, 7],
            [2, 3, 6, 8, 6, 9, 6, 6, 8, 3, 4, 2, 5, 5, 6, 6, 0, 4, 8, 6, 2, 3, 8, 4, 6, 7, 7, 6],
            [2, 5, 6, 6, 7, 5, 6, 6, 6, 6, 6, 5, 8, 7, 9, 2, 7, 6, 1, 3, 7, 4, 7, 10, 8, 7],
            [3, 4, 7, 6, 10, 5, 7, 8, 4, 5, 5, 7, 6, 6, 1, 5, 6, 2, 3, 8, 5, 5, 8, 6, 6],
            [3, 5, 7, 6, 9, 7, 7, 7, 5, 6, 4, 6, 5, 7, 1, 2, 7, 1, 4, 7, 4, 6, 8, 7, 6],
            [4, 4, 6, 6, 9, 6, 7, 7, 5, 6, 5, 5, 6, 6, 2, 8, 7, 3, 4, 7, 4, 6, 8, 8, 6],
            [5, 5, 8, 5, 9, 6, 9, 8, 4, 4, 4, 5, 6, 5, 7, 7, 4, 5, 9, 6, 6, 9, 7]
        ];

        // Function to draw boxplot
        function drawBoxPlot(data) {
            const boxplotData = data.map(column => {
                return {
                    y: column,
                    type: 'box',
                };
            });

            const layout = {
                title: 'Boxplot Diagram',
            };

            Plotly.newPlot('boxplot', boxplotData, layout);
        }

        // Call the function with data
        drawBoxPlot(data);

    </script>
</body>
</html>


miércoles, 3 de abril de 2024

append two tables side-by-side

Tenim un grup de dades de tal manera disposades que les files parelles es complementen amb les imparelles. Voldriem una nova taula on cada fila parella sigui seguida de la fila imparella, tot en una única fila en cada cas. 

La fórmula al googlesheets és:

=QUERY({FILTER(Sheet1!A:Y, MOD(ROW(Sheet1!A:A), 2) = 1), FILTER(Sheet1!A:Y, MOD(ROW(Sheet1!A:A), 2) = 0)}, "SELECT *") 

domingo, 31 de marzo de 2024

sábado, 30 de marzo de 2024

Retrieve plain text from website - from xpath pointer

 const element = document.evaluate("//*[@id='__next']//div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
const innerText = element ? element.innerText : "Element not found";
console.log(innerText);


jueves, 28 de marzo de 2024

EXCEL Power Query - keep the file name

 = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"Column1", type text}})

sábado, 23 de marzo de 2024

Representación gràfica de bobinados (Autocad)







(defun c: capdew()
    (setq pt1(getpoint "\nEnter first point: ")); Ask the user to select the first point
        (setq pt2(getpoint "\nEnter second point: ")); Ask the user to select the second point

    ; Get the X and Y coordinates of pt1
        (setq pt1_x(car pt1))
        (setq pt1_y(cadr pt1))

    ; Get the X and Y coordinates of pt2
        (setq pt2_x(car pt2))
        (setq pt2_y(cadr pt2))

    ; Calculate the middle point
        (setq mid_pt_x(/ (+ pt1_x pt2_x) 2.0))
            (setq mid_pt_y(/ (+ pt1_y pt2_y) 2.0))
  
  ; Calculate vertical distance relative to mid_pt_x
    (setq vertical_distance(* -0.5(/ (- pt2_x pt1_x) 2.0)))
  
  ; Calculate the Y coordinate of the perpendicular point
    (setq mid_pt_y_perpendicular(+ mid_pt_y vertical_distance))

    (setq mid_pt(list mid_pt_x mid_pt_y)); Create a list for the middle point
        (setq perpendicular_pt(list mid_pt_x mid_pt_y_perpendicular)) ; Create a list for the perpendicular point

            (setq extended_line_end(list pt2_x mid_pt_y_perpendicular)) ; Create a list for the end point of the extended line

                (command "line" pt1 perpendicular_pt pt2); Draw the lines
  

)

(defun c: capdev()
    (setq pt1(getpoint "\nEnter first point: ")); Ask the user to select the first point
        (setq pt2(getpoint "\nEnter second point: ")); Ask the user to select the second point

    ; Get the X and Y coordinates of pt1
        (setq pt1_x(car pt1))
        (setq pt1_y(cadr pt1))

    ; Get the X and Y coordinates of pt2
        (setq pt2_x(car pt2))
        (setq pt2_y(cadr pt2))

    ; Calculate the middle point
        (setq mid_pt_x(/ (+ pt1_x pt2_x) 2.0))
            (setq mid_pt_y(/ (+ pt1_y pt2_y) 2.0))
  
  ; Calculate vertical distance relative to mid_pt_x
    (setq vertical_distance(* 0.5(/ (- pt2_x pt1_x) 2.0)))
  
  ; Calculate the Y coordinate of the perpendicular point
    (setq mid_pt_y_perpendicular(+ mid_pt_y vertical_distance))

    (setq mid_pt(list mid_pt_x mid_pt_y)); Create a list for the middle point
        (setq perpendicular_pt(list mid_pt_x mid_pt_y_perpendicular)) ; Create a list for the perpendicular point

            (setq extended_line_end(list pt2_x mid_pt_y_perpendicular)) ; Create a list for the end point of the extended line

                (command "line" pt1 perpendicular_pt pt2); Draw the lines

                    (princ(strcat "\nThe middle point coordinates are: "(rtos mid_pt_x) ","(rtos mid_pt_y)))
                    (princ(strcat "\nThe perpendicular point coordinates are: "(rtos mid_pt_x) ","(rtos mid_pt_y_perpendicular)))
)


miércoles, 7 de febrero de 2024

Inserir salt de pàgina en codi html

 First page (this will be on page n.1)

<div style="break-after:page"></div>

Second page (This will be on page n.2)