How to get the desired Java output

This Java file is supposed to work and extract information from legoSets.XML and show me the output. At the moment, the result is sum-num only. it does not display any information about the 3 other people I need to see. (name, year, num-parts) I've commented on set-num to see if I can get a name to display the results, but it still shows only set-num.

---Desired Output---
    00-1
    WEETABIX CASTLE
    1970
    471>

But my output shows only the set-num

---real output---
    1: 00-1
    2: 0011-2
    3: 0011-3
    4: 0012-1
    5: 0013-1

---MAIN.Java---
package assign6;

import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;

/**
 *
 * @author assign
 */
public class Assign6 {

    /**
     * @param args the command line arguments
     */
    public static void main(String() args) {
        System.out.print("Welcome to Brad Pitt's Lego Sorter");
        try {
            XMLReader reader = XMLReaderFactory.createXMLReader();
            MyHandler handler = new MyHandler();
            reader.setContentHandler(handler);
            reader.setErrorHandler(handler);

            InputSource inputSource = new InputSource("legoSets.xml");
            reader.parse(inputSource);

            ArrayList data = handler.getsetnums();

            System.out.println("set-num List");
            System.out.println("----------");
            for (int i = 0; i < data.size(); i++) {
                String setnum = data.get(i);
                setnum = setnum.toUpperCase();
                System.out.println((i + 1) + ": " + setnum);
            }

            ArrayList names = handler.getnames();

            System.out.println("name List");
            System.out.println("----------");
            for (int i = 0; i < data.size(); i++) {
                String name = data.get(i);
                name = name.toUpperCase();
                System.out.println((i + 1) + ": " + name);
            }

            ArrayList years = handler.getyears();

            System.out.println("year List");
            System.out.println("----------");
            for (int i = 0; i < data.size(); i++) {
                String year = data.get(i);
                year = year.toUpperCase();
                System.out.println((i + 1) + ": " + year);
            }

            ArrayList numparts = handler.getnumparts();

            System.out.println("num-part List");
            System.out.println("----------");
            for (int i = 0; i < data.size(); i++) {
                String numpart = data.get(i);
                numpart = numpart.toUpperCase();
                System.out.println((i + 1) + ": " + numpart);
            }

        } catch (SAXException ex) {
            Logger.getLogger(Assign6.class.getName())
                    .log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(Assign6.class.getName())
                    .log(Level.SEVERE, null, ex);
        }
    }

}

---MyHandler.Java---
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package assign6;

import java.util.ArrayList;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;

/**
 *
 * @author assign
 */
public class MyHandler extends DefaultHandler {

    private boolean inset;
    private boolean insetnum;
    private boolean inname;
    private boolean inyear;
    private boolean innumpart;
    private String setnumBuffer;
    private String nameBuffer;
    private String yearBuffer;
    private String numpartBuffer;

     private ArrayList setnums, names, years, numparts;

    public ArrayList getsetnums() {
        return setnums;

    }

    public ArrayList getnames() {
        return names;
    }

    public ArrayList getyears() {
        return years;
    }
    public ArrayList getnumparts() {
        return numparts;
    }

    @Override
    public void startDocument() throws SAXException {
        // System.out.println("Start Document")
        inset = false;
        insetnum = false;
        inname = false;
        inyear = false;
        innumpart = false;
        setnumBuffer = "";
        setnums = new ArrayList<>();
        nameBuffer = "";
        names = new ArrayList<>();
        yearBuffer = "";
        years = new ArrayList<>();
        numpartBuffer = "";
        numparts = new ArrayList<>();
    }

    @Override
    public void startElement(String uri, String localName,
            String qName, Attributes attributes) throws SAXException {
        if (localName.equals("lego-sets")) {
            inset = true;
        } else if (inset && localName.equals("set-num")) {
            // System.out.println("Start element : " + localName);
            insetnum = true;
            setnumBuffer = "";

        } else if (inset && localName.equals("name")) {
            // System.out.println("Start element : " + localName);
            inname = true;
            nameBuffer = "";

        } else if (inset && localName.equals("year")) {
            // System.out.println("Start element : " + localName);
            inyear = true;
            yearBuffer = "";
        } else if (inset && localName.equals("num-parts")) {
            // System.out.println("Start element : " + localName);
            innumpart = true;
            numpartBuffer = "";
        }
    }

    @Override
    public void characters(char() ch, int start, int length) throws SAXException {
        String data = new String(ch, start, length);
        if (inset && insetnum) {
            // System.out.println("Characters : " + data);
            setnumBuffer = setnumBuffer + data;
        } else if (inset && inname) {
            // System.out.println("Characters : " + data);
            nameBuffer = nameBuffer + data;
        } else if (inset && inyear) {
            // System.out.println("Characters : " + data);
            yearBuffer = yearBuffer + data;
        } else if (inset && innumpart) {
            // System.out.println("Characters : " + data);
            numpartBuffer = numpartBuffer + data;
    }
    }     
    @Override
    public void endElement(String uri, String localName,
            String qName) throws SAXException {
        if (localName.equals("inset")) {
            inset = false;
        } else if (inset && localName.equals("set-num")) {
            // System.out.println("Title: " + titleBuffer);
            // System.out.println("End element   : " + localName);
            // System.out.println();            
            setnums.add(setnumBuffer);
            insetnum = false;
        } else if (inset && localName.equals("name")) {
            // System.out.println("Title: " + titleBuffer);
            // System.out.println("End element   : " + localName);
            // System.out.println();            
            names.add(nameBuffer);
            inname = false;
        } else if (inset && localName.equals("year")) {
            // System.out.println("Title: " + titleBuffer);
            // System.out.println("End element   : " + localName);
            // System.out.println();            
            years.add(yearBuffer);
            inyear = false;
        } else if (inset && localName.equals("num-parts")) {
            // System.out.println("Title: " + titleBuffer);
            // System.out.println("End element   : " + localName);
            // System.out.println();            
            numparts.add(numpartBuffer);
            innumpart = false;
        }
    }

    @Override
    public void endDocument() throws SAXException {
        // System.out.println("End Document");
    }

    @Override
    public void error(SAXParseException e) throws SAXException {
        System.out.println("ERROR: Line number " + e.getLineNumber());
        System.out.println("ERROR:             " + e.getMessage());
    }

    @Override
    public void fatalError(SAXParseException e) throws SAXException {
        System.out.println("FATAL ERROR: Line number " + e.getLineNumber());
        System.out.println("FATAL ERROR:             " + e.getMessage());
    }

}

---legoSets.xml---

    
        00-1
        WEETABIX CASTLE
        1970
        471
    
    
        0011-2
        TOWN MINI-FIGURES
        1978
        12
    
    
        0011-3
        CASTLE 2 FOR 1 BONUS OFFER
        1987
        2
    
    
        0012-1
        SPACE MINI-FIGURES
        1979
        12
    

Python Formatting pprint output – specifically hexadecimal

I am pretty new to Python. Use python3.6.6. I work with a lot of huge nested data structures and it is very convenient to use pprint.pprint to export them as text files. However, I would like all integers in the structure to be printed as hexadecimal constants, but do not see any way to do it. I could write custom print routines and use the hex () function, but it would be a ton of work and I should write separate routines for each data structure. No suggestion?

thank you,

David

output format – Copy and paste in the original form

In Mathematica 10, after copying an expression containing clues and fractions, the pasted result is always restored to the input format, such as the index [a, 1]. How to change this default setting so that it is pasted in the same form as when copying?

database – How to fix the "Query failed" error in drush sql-sync output 2?

I have exactly the same problem as in How to solve the "Query failed" error in drush sql-sync output?, Exactly the same output. This guy found the answer because his password in settings.php was wrong, but my password is correct and it still does not work. can someone help you please?

drush sql-query --strict=0 --file=/tmp/mob_20191203_224013.sql.gz --file-delete --uri=mob --root=/home/fc/1/de/mob/web -vvv
 (preflight) Config paths: /home/fc/1/de/mob/vendor/drush/drush/drush.yml,/home/fc/1/de/mob/drush/drush.yml
 (preflight) Alias paths: /home/fc/1/de/mob/web/drush/sites,/home/fc/1/de/mob/drush/sites
 (preflight) Commandfile search paths: /home/fc/1/de/mob/vendor/drush/drush/src,/home/fc/1/de/mob/drush
 (bootstrap) Starting bootstrap to max (0.04 sec, 8.57 MB)
 (bootstrap) Drush bootstrap phase: bootstrapDrupalRoot() (0.04 sec, 8.57 MB)
 (bootstrap) Change working directory to /home/fc/1/de/mob/web (0.04 sec, 8.57 MB)
 (bootstrap) Initialized Drupal 8.7.10 root directory at /home/fc/1/de/mob/web (0.04 sec, 8.76 MB)
 (bootstrap) Drush bootstrap phase: bootstrapDrupalSite() (0.04 sec, 9.06 MB)
 (bootstrap) Initialized Drupal site mob at sites/default (0.04 sec, 9.29 MB)
 (bootstrap) Drush bootstrap phase: bootstrapDrupalConfiguration() (0.04 sec, 9.29 MB)
 (debug) Add service modifier (0.04 sec, 9.45 MB)
 (info) Executing: command -v mysql (0.05 sec, 9.91 MB)
 (info) Executing: mysql --defaults-file=/tmp/drush_IsKDek --database=mob --host=localhost --silent -A < /tmp/mob_20191203_224013.sql.gz (0.05 sec, 9.96 MB)

In SqlCommands.php line 199:

  (Exception)    
  Query failed.

/tmp/mob_20191203_224013.sql.gz exists, / tmp / drush_IsKDek does not do it
Drush is 9.7.1, mint 19.2, aka

loc:
  root: /home/fc/1/de/mob/web
  uri: mob
  options:
    command-specific:
      sql-sync:
        sanitize: true
        structure-tables:
          common:
            - cache_advagg
            - cache_bootstrap
            - cache_config
            - cache_container
            - cache_data
            - cache_default
            - cache_discovery
            - cache_dynamic_page_cache
            - cache_entity
            - cache_menu
            - cache_page
            - cache_render
            - cache_toolbar
            - watchdog
            - history
            - sessions
    os: Linux
  paths:
    dump-dir: /tmp
    files: sites/default/files

formatting – How to format output numbers like 0.?

I have a function that is given below. If my number, n is 0. or 1. the function gives 0.E0 or 1.E0, respectively. However, I would like to form it as 0.0000E0 or 1.0000E0 as the other numbers given in the function. How could I solve this problem?

f(n_) := ScientificForm(N(n), NumberFormat -> (Row({#1, "e", If(#3 == "", "0", #3)}) &));

Thank you.

terminology – General types of output of a computer

I'm trying to understand what are the general types of output from a computer.
I guess the general types of output described below are the only ones in the cosmos, but I could be wrong:

  • Filtered raw data: Output such as a document available only to be read, but not edited (as it was open with a read-only program "viewer")
  • Armored interface: Output as a document available to be read and edited (as it was open with a text editor)
  • Space change: Output such as the result of a computerized machine, or a system built into the computer (such as a robot and perhaps also a quantum computer or a physical computer but not hardware)

A similar attempt is to define what are the only possible ways to enter data into a computer, such as CLUI, TUI, GUI and possibly other methods.

Is there a consensus among computer scientists on the general types of output of a computer?

The output of the Bash Time command is different with the assignment of environment variable

Usually, the time The command displays three lines:

> time sleep 2
real    0m2.003s
user    0m0.000s
sys     0m0.006s

However, when added with a variable assignment, the output becomes a line:

> VAR="" time sleep 2
0.00user 0.00system 0:02.00elapsed 0%CPU (0avgtext+0avgdata 2060maxresident)k
0inputs+0outputs (0major+86minor)pagefaults 0swaps

Why does this happen? And is there a way to keep the variable assignment while having the output on three lines?

linux – Redirect the bash output to a file in the bash script

I try to process multiple videos in one folder and produce results by redirecting their output to a text file. When I do this in the bash script, it does not work, does not redirect and displays on the screen. What should I change? How to fix it?

for f in *.mp4
do
  echo "Processing $f file..."
  # take action on each file. $f store current file name
  python myscript.py $f &> ../log-$f.txt 
done

loop – How to use the single.php output in function.php

In single.phpinside the loop, the code indicates the text output.



$content = get_the_content();
$content = apply_filters('the_content', $content);
echo wp_strip_all_tags($content);
$Temp_text=wp_strip_all_tags($content);

?>

Is it possible to use $Temp_text in functions.php.

input value array how to replace decoding value as output with JavaScript code help

Hello

I have a variable value of dynamic input array
Decode the values
1 -> Java
2 -> HTML
3 -> SQL
4 -> PHP
5 -> DOTNet
6 -> JavaScript
7 -> Oracle
SEMrush

input values
arrstrval = 1,2,5,4,7

but my output should be as below
arrstrval = Java, HTML, DOTNet, PHP, Oracle

Can any one help me? Please