Win a copy of Head First Android this week in the Android forum!

Chris Ernst

Ranch Hand
+ Follow
since Oct 28, 2015
Chris likes ...
Netbeans IDE MySQL Database Java
Düsseldorf - Germany
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
15
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chris Ernst

Java 8 didn't know to handle var it would create a new class. Or NetBeans 8.2 can't handel it ;)

But with the traditional way from Piet works it as I want
2 years ago
Thank you very much and for the explanation!
Did you write it in Java 10 or higher? Maybe then I have to upgrade in the future, I'am still using Java 8 and the script is not working

And yes Campbell was right, its my first contact with Map... I prefer ArrayList don't know why but it is so ;)


It confused me (its long ago that I code in Java ;), your explanation was great! )  I decided to use the traditinal way

So thank you both very much for your, fast, help!

Cheers
2 years ago
Hey there,
I need your help, cause I don't know how to solve it.
This list is in a arraylist<runners> runners and the entity is the same as the topic.

runner, style, date, distance
Micky Maus, free-style, 2019-06-05, 4654
Goofy, speedrun, 2019-01-02, 5798
Donald Duck, cross, 2019-08-15, 4581
Micky Maus, cross, 2019-04-05, 8709
Donald Duck, normal, 2019-08-15, 4711
Micky Maus, walking, 2019-07-06, 4541

What I need the total sum of the distance for each runner (style and date can be ignore).

My first idea was to create a map like this one:



My expectation is a list with:
Micky Maus, 17904
Donald Duck, 9292
Goofy, 5798

for any help I'am appreciative, Thanks
Cheers Chris
2 years ago
There are only tabs inside no CR or NL, but thanks for the hint tim

I have see it with the snippet from Campbell that there only tabs inside.

And it works now and I am very happy
2 years ago
I'll make it like this


Now I have only to handle the double tabs in front of the xml element, but I think its OK when the tabs will be removed, cause I hope that no special char is inside .
Bit in the case if one or more is inside it have to remove and the format is only for the programmers eyes to read it clear and it looks great

Reading line by line will omit all the \r and \n sequences


I don't create some of this only the tabs

and again a big lovely THANK YOU

Now I make some bench test how fast it is
2 years ago
Thank you!
I'll try it all right now...
I create the XML file with a program (it's an export from a database) to used it for an import in Apache Solr (and when a control char is in the file it sends me an error)
The main problem in my case is, it must be fast. The file is written in a temp folder and after clean up it will send to the right destination.
The other problem is, that we can't see maybe the chars (the most problem was that the char 31 was set in the text).

Please explain what you mean about the whole file being full of control characters


It can be in all "string" areas

What sort of characters? How many?


I don't know so I want to replace them all

2 years ago
hey there,

I need your help.
in my XML file could be some invisible control character: 0x00–0x1F and 0x7F–0x9F.
The XML file is like this:


maybe there some whitespaces, empty rows or tabs (till three in a row like this > \t\t\t <)
It comes from the XML generator...
I need a solution to replace all the control chars. For this I wrote this:


So far so good, but now I have to add each char to the array
Then I'll tryed with this one private final String patternString = "[\\x{00}-\\x{1F}]"; wich I found on https://stackoverflow.com/questions/26897810/using-java-regexes-to-match-a-range-of-unicode-code-points-outside-the-bmp-it?rq=1
But when I replace the match with patternString and remove the foreach loop, is the result that the hole document is full of control chars
On https://www.regular-expressions.info/unicode.html I found the \p{Cc} pattern wich is the same result...

Why? What is my mistake?

Cheers
Chris
2 years ago
I don t know...  the json file is *.js.gz and so bad nested that I chose the xml file...
I gone now the easy way, I kill this line

for those how want to know how to do

see at StackOverflow

Tim and Paul Thanks !
Hey Paul,

yes that should be the easyest way, but (I forgot to told you) that I download the files from a server 7 files for each TV Broadcaster...
Hey Folks,

I want to read a xml file(insert the data to a Database...) see below




To read this file I have this code:


and after run this code I will get this result
run:
C:\tmp\XML\13thstreet.de_2017-12-19.xml
XML Reader C:\tmp\XML\xmltv.dtd (Das System kann die angegebene Datei nicht finden) <- It means: The System can't found this file
BUILD SUCCESSFUL (total time: 0 seconds)

what should I can do to read this file or to delete this line with the doctype?

Cheers

Chris
Dam it works

I don't ne the printText method.

Thanks anyway yeah

at this time I haven't try your last post... but her is the code

what I want is to store selected (the part from the element) in my database and for me is it equal if its null or filled up with data...

I have make toString() to get any result.

When I try it with the item(0).getTextContent, it goes in the first node and then runs in the catch with null like this

Current Element :Episode
id : 4712380
EpisodeName : Blood Rush: Part One
EpisodeNumber : 2
Language : de
Overview :
SeasonNumber : 0
lastupdated : 1391991457
seasonid : 488842
Catch-Block null

I have try XML Read and it worked but I cant select item for item

maybe I have a node in my brain I don't know

And the way to store the data from the file in the database is equal ...