Is it possible to write a function in postgresql that writes its parameters directly into a text file?

CREATE OR REPLACE FUNCTION public."AddFiveValues"(
    text1 TEXT,
    text2 TEXT,
    text3 TEXT,
    text4 TEXT,
    text5 TEXT)
    RETURNS TEXT
    LANGUAGE 'sql'

    COST 100
    VOLATILE 
AS $BODY$
CREATE TEMP TABLE mytable AS
   SELECT  $1 as text1,$2 as text2,$3 as text3,$4 as text4,$5 as text5;
COPY mytable TO PROGRAM '/tmp/append'; 
DROP TABLE mytable;
SELECT '1';
$BODY$;

You also need a script & # 39; / tmp / append & # 39; (which can be executed by & # 39; postgres & # 39;):

#!/bin/bash
while read line
do
        echo $line >> /tmp/results.txt
done

SELECT public."AddFiveValues"( '1', '2', '3', '4', '5'); adds a line to & # 39; /tmp/results.txt' added.

Filenames can (or should?) Be changed as needed.

magento2 – How to change the text "Log in" to "Log in" in the top header

app code Vender Modules view frontend layout default.xml



    
                
                    Vender_Module::authorization.phtml
                
    

app code Vender Modules view frontend templates authority.phtml

isLoggedIn()) {
    $dataPostParam = sprintf(" data-post='%s'", $block->getPostParams());
    $customClass = "logoutajax";
}
?>

I hope this will help you !!!!

php – How to put in an array at a position specifies the values ​​of an input text

I need to retrieve the values ​​contained in an input text in a form, and each time the user clicks Submit Submit below that input, I must put that value into an array and display the current value on the screen. However, I can not do this without having to change sides. I try to repeat to test my logic, and nothing happens.





    
    
    
    document
    



    
...

$ 10.00

...

35.00 USD

...

7.50 USD

...

$ 3.00

...

150.00 USD

...

20.00 USD

The Content – Unclosed tags of the shortcode attribute result in plain text

I have several shortcodes and recently found that the attribute looks like this because of a copy error:

(QUANTITY number="01" title="test<")

with the < Day, without closing, the shortcode is returned as plain text (and the continuation of this shortcode)

Is there a way to show it as plain in this case, for example with the htmlspecialchars function. I know that I have to work on the core. in the /wp-includes/shortcodes.php, I found that:

// Reject any unclosed HTML elements
        foreach( $atts as &$value ) {
            if ( false !== strpos( $value, '<' ) ) {
                if ( 1 !== preg_match( '/^(^<)*+(?:<(^>)*+>(^<)*+)*+$/', $value ) ) {
                    $value = '';
                }
            }
        }

I tried to delete this part, but it did not work, and I did not understand the function of the variable $valuebecause it is not used.

I would like the shortcode not to be displayed directly if the tags were not closed or the attribute value is displayed in plain text.

Thank you in advance.

Usability – Placement * Footnote text … End of page or section?

There is a third option: a Footnote Popup,

Enter image description here

The physical position of a footnote is relative to a printed page, in interactive texts the footnote popup is much more useful:

  • The information is located exactly where the footnote is located
  • You do not have to search for a specific place where the information is stored and help the reader not to search for that information

Picture from pagetoscreen.net

Footnotes Popup Codepen example

Sort – Select text in a selectable container

There is a problem where a user can click in the cell of a table and sort the table based on that selection. We've also done research to show that users want to select the contents of these cells in order to copy / paste them.

Once the user clicks in the cell, the table is sorted so that they no longer have the same content and can no longer be selected.

I'm trying to explain to the developers that maybe we can do something that does not change if the user clicks and moves the cursor. But of course we need a small budget, so that even users with nervous mice can sort.

Does anyone know something that fits this pattern, which I can use as an example to show the developers and producers what I'm talking about when I explain this?

Is the explanation of the event and the solution useful here? Is there another solution that I do not think about (without completely getting rid of the feature as suggested)?

A Python script for formatting plain text into a markdown title

I've written a python script to format plain text so that it will sign the title.

For example, change several lines

('1 Introductionn',
 'Part I: Applied Math and Machine Learning Basicsn',
 '2 Linear Algebran',
 '3 Probability and Information Theoryn',
 '10 Sequence Modeling: Recurrent and Recursive Netsn',
 '11 Practical Methodology')

to

('# chapter1: Introductionn',
 'Part I: Applied Math and Machine Learning Basicsn',
 '# chapter2: Linear Algebran',
 '# chapter3: Probability and Information Theoryn',
 '# chapter10: Sequence Modeling: Recurrent and Recursive Netsn',
 '# chapter11: Practical Methodology')

Each chapter title in the original file starts with just one number. Change this from 1 to "# chapter 1:" by inserting "# chapter" in front of the number and inserting a colon ":" after the number. write the new toc finally in a file.

Here is the code

import re
# f_name = 'data_multi_lines_3.md'
f_name = 'data_multi_lines.txt'
with open(f_name) as f:
    line_list = f.readlines()
res_list = ()
for line in line_list:
    res_list.append(re.sub(r'^(d{1,2})( +.*?)', r'# chapter1:2', line))
with open('your_file.md', 'w') as f:
    for item in res_list:
        f.write("%s" % item)

Is there a better approach?

I think I should be worried about the for loop, although I have no idea how to improve it.

2013 – Automatically populate a cell in a list if another cell in the same list contains a specific text value

I would like a cell in an SP list to be automatically populated when a given text value exists in a column in the same list. For example, the list contains two columns named: Flight Route and Spare Parts.

The flight route column is filled out by the planner with a text string, eg. KOKC-KLIT-KDFW-KOKC. If the "Route of Flight" column contains KDFW, the "Spare Parts" column should automatically be filled with "NEEDED". If the route does not contain KDFW, then the Spare Parts column should automatically be filled with "NOT REQUIRED".

Thank you very much.