python 3.x – It will be useful to create in this problem an empty string este ’and then fill it with the result that will finally be printed

Thank you for contributing to StackOverflow in Spanish with an answer!

  • Please make sure answer the question. Provide information and share your research!

But avoid

  • Ask for help or clarification, or respond to other answers.
  • Make statements based on opinions; Be sure to back them up with references or with your own personal experience.

For more information, see our tips on how to write great answers.

object-oriented: a Java program that obtains key-value pairs from a text file, which must also be printed in an array / table like

I just want to get some tips on code optimization. How can I do this more OOP? How many classes should I have for this type of homework? My code already works, but I was told to use OOP in a way that made sense to use it.

   import java.util.Scanner;
    import java.util.regex.Matcher; 
    import java.util.regex.Pattern; 
    import java.io.File;
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.util.LinkedHashMap; 
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.util.Iterator;
    import java.util.List;

    public class JavaKeyValue {

        private static Scanner sc;
        private static Matrix matrix;
        private static JavaKeyValue jvKV;
        private String pathToFile = "/Desktop/";
        private String fileName = "javatext.txt";
        private static LinkedHashMap lHM;

        public static void main(String()args) {
            sc=  new Scanner(System.in);
            jvKV = new JavaKeyValue();
            lHM = new LinkedHashMap();
            String action;

            jvKV.createNewTable("Start");

            System.out.println("Matrix has been created");

            do {
                System.out.println("Enter PRINT for Print");
                System.out.println("Enter EDIT for Edit");
                System.out.println("Enter SEARCH for Search");
                System.out.println("Enter RESET for Reset");
                System.out.println("Enter ADD for Add Row");
                System.out.println("Enter SORT for Sort");
                System.out.println("Enter EXIT for Exit");

                action=sc.next();
                sc.nextLine();
                jvKV.doAction(action);
            } while(!action.equalsIgnoreCase("Exit"));
        }

        public void createNewTable(String status) {
            int inputCounter = 0, row = 0, col = 0;
            String kvTextPairs,table, action;

            while(inputCounter <= 3) {
                try{
                    System.out.println("Enter the number of rows:");
                    row=sc.nextInt();
                    System.out.println("Enter the number of columns:");
                    col=sc.nextInt();
                    break;
                }catch(Exception e) {
                    sc.nextLine();
                    inputCounter++;
                    System.out.println("Please input a number");
                    System.out.println("Attempt #"+inputCounter);
                    if (inputCounter == 3) {
                        System.out.println("n Program Terminating");
                        System.exit(0);
                    }
                }
            }

            kvTextPairs = jvKV.getKVTextPairs(status, row, col);

            matrix = new Matrix(lHM, kvTextPairs, row, col);

            lHM = matrix.kvTextPairTolHM(lHM);
            table = matrix.createTable(lHM);
        }

        public String getKVTextPairs(String status, int row, int col) {
            String textFile = "";
            String st;
            if(status.equalsIgnoreCase("Start")) {
                try {
                    File file = new File(pathToFile+fileName);
                    BufferedReader br = new BufferedReader(new FileReader(file));

                    while((st = br.readLine()) != null){
                        textFile += st;
                    }
                } catch(Exception e) {
                    textFile = jvKV.keyValueGenerator(row,col);

                    System.out.println("Text File cannot  be found, Creating new txt file named "+fileName+" with random generated Key,Value");

                    jvKV.createFile(textFile);
                }
            } else {
                System.out.println("Table has been resetted!");
                textFile = jvKV.keyValueGenerator(row,col);
                jvKV.createFile(textFile);      
            }
        return textFile;
        }

        public void createFile(String textFile) {
            try {
                File newFile = new File(pathToFile+fileName);
                if (!newFile.exists()) {
                    newFile.createNewFile();
                }

                FileWriter fw = new FileWriter(newFile.getAbsoluteFile());
                BufferedWriter bw = new BufferedWriter(fw);

                bw.write(textFile);
                bw.close();
            } catch(Exception e) {
                System.out.println(e.getMessage());
            }
        }

        public String keyValueGenerator(int row, int col) {
            char charVal;
            String textFile = "";
            int numbersofAscii = 93, value;
            for(int i=0; i(matrix.editKey(curKey, newKey, lHM));

                            break;

                        case "VALUE":
                            System.out.println("Edit new VALUE, Enter the KEY of the VALUE you want to replace:");
                            curKey = sc.nextLine();

                            System.out.println("Enter the VALUE you want as replacement:");
                            newValue = sc.nextLine();
                            newValue = newValue.substring(0,3);

                            lHM.put(curKey, newValue);

                            break;

                        case "BOTH":

                            System.out.println("Edit BOTH, Enter the KEY of the ITEM you want to replace");
                            curKey = sc.nextLine();

                            System.out.println("Enter the KEY you want as replacement:");
                            newKey = sc.nextLine();

                            System.out.println("Enter the VALUE  you want as replacement:");
                            newValue = sc.nextLine();

                            newValue = newValue.substring(0,3);

                            lHM.put(curKey, newValue);
                            lHM = new LinkedHashMap(matrix.editKey(curKey, newKey, lHM));

                            break;
                    }
                    break;

                case "SEARCH":
                    System.out.println("Enter the text that you want to search:");
                    String searchText = sc.nextLine();

                    matrix.searchTable(lHM, searchText);
                    break;

                case "RESET":
                    jvKV.createNewTable("Reset");
                    break;

                case "ADD":
                    int addRow;

                    System.out.println("Enter the number of rows you want to add:");
                    addRow=sc.nextInt();

                    matrix.addRow(addRow, lHM);

                    break;

                case "SORT":

                    break;

                case "EXIT":

                    break;      

            }

            matrix.createTable(lHM);
        }

    }

Second class

import java.util.Scanner;
import java.util.regex.Matcher; 
import java.util.regex.Pattern; 
import java.io.File;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.Iterator;
import java.util.List;

public class Matrix{

    private Matrix matrix;
    private JavaKeyValue jvKV;
    private LinkedHashMap lHM;
    private String kvTextPair;
    private int row,col;
    private String table;

    public Matrix(){
        matrix = this;
        jvKV = new JavaKeyValue();
    }

    public Matrix(LinkedHashMap lHM, String kvTextPair, int row, int col) {
        this();
        this.lHM = lHM;
        this.kvTextPair = kvTextPair;
        this.row = row;
        this.col = col;
    }

    public LinkedHashMap kvTextPairTolHM(LinkedHashMap lHM) {
        lHM = new LinkedHashMap();
        Pattern pattern = Pattern.compile("\( ((.{3})\,(.{3})) \)");
        Matcher matcher = pattern.matcher(this.kvTextPair);
        String item, key, value;

        while(matcher.find()) {
            item=matcher.group(1);
            key=matcher.group(2);
            value=matcher.group(3);
            lHM.put(key, value);
        }
        return lHM;
    }

    public String createTable(LinkedHashMap lHM) {
        String table = "";
        int colCounter = 0, rowCounter = 0, row = this.row, col = this.col;
        Iterator> lHMIterator = lHM.entrySet().iterator();

        while(lHMIterator.hasNext()){
            Map.Entry entry = lHMIterator.next();
            table += "{"+ entry.getKey()+ ","+ entry.getValue()+ "} ";
            colCounter++;
            if(colCounter == col) {
                table += "n";
                colCounter = 0;
                rowCounter++;

                if(rowCounter == row) {
                    break;
                }
            }
        }
        this.table = table;
        return table;
    }


    public String getTable() {
        return this.table;
    }

    public LinkedHashMap editKey(String oldKey, String newKey, LinkedHashMap lHM) {
        LinkedHashMap newlHM = new LinkedHashMap();
        Iterator> lHMIterator = lHM.entrySet().iterator();

        if(!lHM.containsKey(oldKey)) {
            System.out.println("This key doesn not exist");
            return lHM;
        }

        while(lHMIterator.hasNext()) {
            Map.Entry entry = lHMIterator.next();
            String key = entry.getKey();
            String value = entry.getValue();
            if(key.equals(oldKey)) {
                key = newKey;
                if(key.length()>3){
                    key=key.substring(0,3); 
                }
            }
            newlHM.put(key, value);
        }
        return newlHM;
    }

    public void searchTable(LinkedHashMap lHM, String searchText) {
        String result = "";
        int col = this.col, row = this.row;
        List> list = new ArrayList<>();
        list.add(new ArrayList<>());
        int rowCounter = 0, colCounter = 0;
        Iterator> lHMIterator =    lHM.entrySet().iterator();
        while(lHMIterator.hasNext()) {
            Map.Entry entry=lHMIterator.next();
            String key = entry.getKey();
            String value = entry.getValue();
            String keyval = key+","+value;
            result += this.searchOccur(searchText, key, "KEY", rowCounter, colCounter);
            result += this.searchOccur(searchText, value, "VALUE", rowCounter, colCounter);
            list.get(rowCounter).add(keyval);
            colCounter++;
            if(colCounter == col) {
                list.add(new ArrayList<>());
                colCounter=0;
                rowCounter++;
            }
        }
        System.out.println(result);
    }

    public String searchOccur(String searchText,String text, String keyval, int rowCounter, int colCounter) {
        String res = "", comparison;
        int occurences=0;

        for(int i=0; i<=text.length()-searchText.length(); i++) {
            comparison="";
            for(int a=0; a

graphics: a strange line appears in the printed version of a Mathematica image in a pdf document

My system / workflow

  • Mathematica version 11
  • MikTeX 2.9: tex-> dvi-> ps-> pdf-> paper

I have encountered the following difficulty. I can't tell if the problem is caused by Mathematica, MikTeX, Adobe or even the local printer. Asking here first, because the production chain starts with Mathematica.

The problem:

  1. I produced a piece of 2D graphics needed in my notes. A copy of the Folium of Descartes along with some small extras to prove the implicit function theorem. One of the EPS files produced is here http://users.utu.fi/lahtonen/FoilX.eps
  2. Then I included it in a LaTeX document. The appearance of that image is exactly what I expected in the TeXWorks preview, as well as when viewing the final PDF document.
  3. I use four variants of the same image (with different additional components) in the conference notes. When printed, each and every one of them has two additional lines: a ray from the origin to the northwest and a shorter vertical line on the left edge. A scanned sample version is here http://users.utu.fi/lahtonen/3316_001.pdf

Internet searches give the following results

Can anyone suggest something, diagnose the problem or anything else? One of the successes mentions that the problem can be caused by an image that contains transparency. My EPS looked good with GhostView (or something like that). Are there more sophisticated tools available for free?

Be a fashion leader by choosing Swimwear Online

Be a fashion leader by choosing Swimwear Online
Who does not want to spend time on the beach, especially during the summer weekend? What we need for our quality time and to stand out on the beach are beautiful swimsuits. Not a single swimsuit looks beautiful unless someone uses them with confidence. So choose the swimsuit boldly, as it becomes your style symbol among others on the beach. You can buy swimsuits online, as it saves you time, since the trusted online shopping platform gives you ample options to choose your favorite. Berrylook always offers you the opportunity to buy from hundreds of collections of modern swimsuits that are also of the best quality material at a reasonable cost.

Fashion swimsuit according to the shape of your body
Remember, not all swimsuits make us bold and sexy, it depends on the shape of our body, and we select the swimsuits accordingly. In addition, we should always worry about the quality of the clothing material, since these dresses are directly attached to our bodies. The poor quality of the material and the bad fit bother you and can ruin your vacation.
Swimsuit of a piece stamped with scraps: nothing looks as adorable as the stamping of pieces of a piece. It adapts to all body shapes; However, it looks amazing in the body that has some extra fat. Try the V-neck with a one-piece floral print with a strap above the waist.

Bikini- Bikini with long sleeve print is the all-time favorite for all women. Try the long-sleeved print bikini with a round neck and it will make you adorable and sexy.

Bohemian halter three-piece suit bikini loved by women of all ages. It completely covers the body and falls by the shoulder makes it very comfortable and suitable for all body shapes.

Women's maxi dresses are a loose outfit that falls from the shoulder to the knee or toe, and one can wear it on any occasion, as well as casual. Every woman in the world wants to have maxi dresses in her closet. We dedicate a lot of energy and time to choosing our favorite maxi dresses, which makes us beautiful and sexy. To save time, we can buy our favorite maxi on a reliable online platform like Berrylook, which offers an extensive collection at the tip of our fingers.

Some adorable women's maxi dresses onwww.berrylook.com
Long dress with elastic waist print: elastic around the belly that exposes a little the upper part of the body and flows from the waist. It is perfect for women with a well maintained figure. Try it on a round neck.
Long dress with asymmetric sleeve and flared with asymmetric hem: wear a round neck with a belt around the belly, makes you adorable.

MattBurditt1reviewed byMattBurditt1in.Be a fashion leader by choosing Swimwear Online
Be a fashion leader by choosing Swimwear Online
Who does not want to spend time on the beach, especially during the summer weekend? What we need for our quality time and to stand out on the beach are beautiful swimsuits. Not a single swimsuit looks beautiful unless someone uses them with confidence. So choose the swimsuit boldly, as it becomes your style symbol among others on the beach. You can buy swimsuits online, as it saves you time, since the reliable online shopping platform gives you a lot
Classification:5

.

pdf: I want all the attachments of the order to be printed once "print everything" with the invoice in the magento sales network

In the Magento2.3 sales grid, there is a pull-down tab that says "Print everything." When I select this, I not only want the order invoice to be printed, I also want all the documents attached to the order to be printed.

The attachments of the order are loaded using the default Magento2.3 custom product functionality as jpg or pdf files.

I would appreciate it if you could help me with the code or the solution.

front end: How to make printed messages appear immediately on the console when they are inside a long loop?

I noticed that something changed, I'm not sure when this started, if it's with 12.0 or 11.3.

I like to use Print inside any Do or Table for debugging. I have all the impressions sent to the console that I have open to see how far the computation has arrived.

        Current value[$FrontEnd, {"PrintAction"}] = {"PrintToConsole"}

When the number of iterations is large, the front end does not show print statements at all in the console, until the cycle ends. which nullifies the purpose of the impressions since I want to see them while the loop is running.

The console may not scroll automatically or messages may be buffered but not emptied.

What is the correct way to do the Print appear immediately? I found that adding a Pause[0.1] after each impression, it shows the impression in each iteration. A lower value of Pause that 0.1 It did not work so well.

But this means that the loop now takes more time.

Here is an MWE that I was using now.

Clear all[x,y,t,n,m]
L = 20;
H = 30;
c = 3/10;
f1[x_]: = By parts[{{1,48/100 L<= x<= 52/100 L},{0,True}}];
f2[y_]: = By parts[{{1,48/100 H<= y<= 52/100 H},{0,True}}];
numberOfTerms = 200;
beef[n_,m_]= N @ Integrate[f1[x]* f2[y]*Sin[(n Pi)/L x]*Sin[(m Pi)/H y], {x, 0, L}, {y, 0, H}];

And now the loop.

Be careful. Before running this loop, be sure to save all your work. As the front part can be blocked until the loop is completed, which can take many minutes. So if you do not want to wait, you can do not Be able to stop the evaluation.

Anm = Table[Print["n=", n, ", m=", m]; (*Pause[.1]; *)
Evaluate[res[n, m]], {n, 1, numberOfTerms}, {m, 1, numberOfTerms}];

Now, while the above is running, when looking at the console, it shows that nothing is being printed, until the cycle is completed, then all the messages will be displayed at the same time.

Using 12.0 in windows 10 with 64 GB of RAM.

Printed canvas 60×40 and resolution.

I would like to know how much resolution I need to print the 60×40 canvas? I would place the print on canvas about 7 feet tall and it would be seen about 10 feet away. Is the resolution 4082 x 2836 good enough?

Printing: is it possible to know if a 35mm film has been printed?

Is there any way to find out if the Kodak 200 Gold cans have been printed (such as the Advantix)?

Kodak Gold is a 35mm film that is treated differently than APS films. While the APS movie starts in the can, it is exposed, it is rewound in the can, it is processed, it is put behind in the can, then returned to you …

The 35 mm film starts in the can, it is exposed, it is rewound in the can, The can is discarded in the processing. and you get the negatives developed with any impression you have requested.

If you have a can of Kodak Gold that still has the leader of the film out, it is likely that it has never been exposed. That said, it is still possible. Since you do not know the story, you should treat this as if you had been exposed. There is no damage and very little cash is lost when processed.

If the film is completely in the can, it has been exposed but has not been processed. It would not be bad to process it now, but keep in mind that the movie deteriorates over time. Some films support the latent image very well … and others, not so much. You can get these processed but do not expect miracles.

If you have developed negatives, then they have been processed. There is no way to know if the impressions were made along with the development. The SOP for department store processing would have been to create 4 "x6" prints for each frame … but many labs offer the buyer the ability to select what they want (which includes not getting any printing).

design – Why are messages on the road printed upside down?

You read as you approach.

Theoretically Actually, the levels of visual acuity mean that some people (like you and me) can read the whole block at once. Another reason why painting information about the pavement is not always ideal.

Here is a good visual of how it is designed to work in practice:

The trick is (as the previous image shows) the spacing of the lines must be a function of the travel speed: fast => more distance, slow => less distance. At high speed, this is quite effective. Slow is a little more complicated …

The problem of slow speed.

The smaller space at low speed is still effective in heavy traffic (where the car in the front conceals the successive lines) and in poor visibility conditions, such as fog, where the headlights reveal one line at a time. But the adaptation that makes those important scenarios work also makes it an uncomfortable reading when nothing prevents your vision. It is an exchange.

The government says so

If you spend some time with the fantastic FHWA MUTCD, you will see that they do not like to talk about words on the pavement. There are reams of paper dedicated to permanent signs. But there is a non-negligible section in the road markings. These are mostly lane indicators and other communications based on symbols.

The most specified word mark is "ONLY" for use in several lane directions. But there is a small section that talks about messages of several lines. Here is the actual specification of the FHWA (emphasis mine):

The marks of words and symbols must not exceed the three lines of information.

If a pavement word word message consists of more than one line of
information, It should be read at the travel address.. The first word
of the message should be the closest to the road user.

Trust the researchers

In the end, remember that the Federal Highway Administration of the United States carries out extensive the investigation on these things. That research is hard to find, but I've read about situations where the addition of pavement markings reduced a given problem (such as people who deviate from the curve).

In most situations, these messages should be a complement to traffic signals., which are usually easier to read. In that function, they work quite well.

How to increase the sales of your product making the packaging better – Everything else

Tea is not just an herb; It is a paradigm of taste and luxury, as well as having health benefits in some ways. Tea packaging is a great tool to impress buyers. Every day, the new tea brands start their business, but only a few acquire the identity due to the choice of the tea packaging company. Loose tea leaves are susceptible because they are easily crushed and can lose their aroma due to moisture and oxygen if they are not properly placed in the boxes.

1. Standing bags

The personalized tea boxes are also designed in the form of standing bags. There are many styles of these boxes, such as service rack locks, tear cuts, hanging holes, spouts, and air release valves. This packaging is also attractive because the custom printed tea boxes are designed to be quite modern and innovative.

2. Materials used in the packaging of tea.

The advanced materials that are now used are Kraft paper, cotton paper and rice paper. Because tea has a distinctive fragrance that must be kept safe, aluminum packaging is always used. However, it is still better to expose the tea leaves through a window cut into the wholesale tea boxes so that the customer is sure of what to choose. The elegant tea packaging mock-up is essential for a high-quality tea brand. The design of a model that provides a separate identity to your tea package and impressions in the minds of tea lovers is inevitable.

3. Package designs of individual or multiple tea blends

UK tea boxes are often packaged in the form of a single flavor tea in individual packages. However, few people like to use a combination of different herbal infusions and fragrances. Many brands are testing tea boxes for sale in which various combinations of tea are added to provide a different flavor.

4. Lun Yau hinder packing.

The packaging of the basket involves many ideas of tea packaging and allows flexibility in the design and labeling of tea paper boxes. These are simple bags with a black area to mark the packages with chalk sticks. Small businesses use this type of boxes or bags and provide a personal touch to customers.

5. Box of tea bags.

Tea boxes are the best way to store these fresh leaves. Tea makers match the packaging of the film roll with beautifully designed cardboard or Kraft paper boxes. They are quite profitable because these wholesale tea boxes are cheap and easy to obtain from the correct packaging supplier.

6. Paper envelopes of divine delight of tea.

For office and travel use, tea container suppliers provide individual servings for a single cup, packaged in sachets to provide the same taste and fresh scent each time a person drinks the usual cup of tea. The tea packaging template is printed on each fragrance to provide the feeling of a complete tea experience.

7. Glass jars and jute bags.

Tea brands often use jars to store some high-quality specific tea leaves. These jars cost a lot, but the product is also expensive for customers at that time. Jute bags are very fashionable these days, as they provide an earthy and elegant appearance to tea.

8. Kraft paper boxes with rolls of cylindrical cardboard.

A modern tea packaging design to insure divine teas is to use Kraft paper boxes attached with a roll of thick paper to keep in loose tea bags or circular tea bags. It works as you pull the box to open it; slowly reveals a part of the roll opening. This keeps the moisture proof of the tea crisp and fresh.

9. Cropped tray for easy access

A disturbing trend of packaging tea boxes is to use secure access boxes that customers can place on their counters and pick up the tea bag from the bottom of the box when they need tea.

10. Ready to drink tea.

Cans and boxes of prefabricated tea are also available through wholesale suppliers of tea containers.

.