text:
Q: Spring-Boot WebClient block() method returns error java.lang.IllegalStateException I'm trying to fetch value(string) using Spring WebFlux WebClient, (Using SpringBoot version 2.4.5,)
@GetMapping("/test")
public Mono<String> getData(){
    WebClient webClient = WebClient.create("http://localhost:9999");
    Mono<String> stringMono = webClient.get()
            .uri("/some/thing")
            .retrieve()
            .bodyToMono(String.class);
    stringMono.subscribe( System.out::println);
    System.out.println("Value : " + stringMono.block()); // this doesn't work,  expecting to return ResponseBody as "Hello World" ,
    return stringMono;
}

But getting below error
2021-05-11 20:02:15.521 ERROR 55613 --- [ctor-http-nio-2] a.w.r.e.AbstractErrorWebExceptionHandler : [19114471-1]  500 Server Error for HTTP GET "/test"
java.lang.IllegalStateException: block()/blockFirst()/blockLast() are blocking, which is not supported in thread reactor-http-nio-2
    at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:83) ~[reactor-core-3.4.3.jar:3.4.3]
    Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
    |_ checkpoint ⇢ HTTP GET "/test" [ExceptionHandlingWebHandler]
Stack trace:
        at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:83) ~[reactor-core-3.4.3.jar:3.4.3]
        at reactor.core.publisher.Mono.block(Mono.java:1703) ~[reactor-core-3.4.3.jar:3.4.3]
        at com.example.demo.DemoApplication.getData(DemoApplication.java:28) ~[main/:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
        at org.springframework.web.reactive.result.method.InvocableHandlerMethod.lambda$invoke$0(InvocableHandlerMethod.java:146) ~[spring-webflux-5.3.4.jar:5.3.4]
        at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:151) ~[reactor-core-3.4.3.jar:3.4.3]

Reference for block method - https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html#webflux-client-synchronous

A: When using Webflux, the whole idea is that you don't block - you'll cause massive performance problems if you do (see here for a related answer that explains why) so the framework explicitly disallows it, throwing an exception if you try.
You also shouldn't subscribe manually - while not a "mortal sin" in the reactive world as blocking is, that's certainly another red flag. Subscription is handled by the framework. You just need to return the Mono, and Webflux will subscribe when required to handle your request. In your case your manual subscription means the entire chain will actually be executed twice for each request - once to print the result out to the terminal, and once to return the result to the /test endpoint.
Instead, if you want a "side-effect" like this (printing out the value when you have it) then you need to alter the reactive chain to do so, using the doOnNext() operator. This means you can then do:
return webClient.get()
          .uri("/some/thing")
          .retrieve()
          .bodyToMono(String.class)
          .doOnNext(s -> System.out.println("Value: " + s));

This will ensure the value is printed out to the terminal, but without blocking, and without manually subscribing.


text:
Q: Quickblox 422 No recipient issue using Android SDK I am using Quickblox Android Chat SDK for my chat module. I have implemented whatever the process stated in Quickblox Site. I was able to register,login and creating session to the Quickblox programmatically and able to chat and chat history successfully. I got struck for some users, I am not able to chat as I am getting 422 error "'{"errors":{"base":["No recipients. At least one user should be subscribed for GCM (Android Push) (through SDK or REST API)"]}}'". But for some users, I am not facing any problem. Please suggest me the solution for this problem.

A: In means that a user doesn't have a push subscription, so he can't receive pushes
follow this guide to subscribe a user to receive push notifications http://quickblox.com/developers/SimpleSample-messages_users-android#Giving_a_user_a_Push_Notification_subscription

redpajama_set_name: RedPajamaStackExchange


text:
Q: how do i declare a custom function in twilio function runtime environment? I have a function and a few helper functions that are supposed to access Slack message history and return the first message that matches a certain number string.
I have tested the code extensively on my computer's Node.js environment to verify it works and is correct. However, I can't get it to work inside the run-time environment of Twilio Function; I keep getting the error "Missing name in function declaration.", and the function just won't chain properly or work like a function at all.
What am I doing wrong?
exports.handler = function(context, event, callback) {

    if(event.event){
         if(event.event.channel == context.CHANNEL_ID){
            if(event.event.subtype){
                console.log("bot posting");
                if(event.event.thread_ts){
                    console.log("bot posting in thread");
                    console.log(event);
                }
                else{
                    console.log("bot posting in channel");
                    console.log(event);
                }
            }
            else{
                console.log("staff posting");
                if(event.event.thread_ts){
                    console.log("staff posting in thread");
                    console.log(event);
                }
                else{
                    console.log("staff posting in channel");
                    console.log(event);
                }
            }
         }
    }
    else{
        console.log("incoming sms message");
        console.log(typeof event.From);
    }

    returnTS("6049248010").then(function (ts) {
        console.log(ts);
    });

    callback(null);
};

var getSlackHistory = async function (ts) {

    try {
        var response;

        if (typeof ts === 'undefined') {
            response = await got('https://slack.com/api/channels.history?'
                + 'token=' + context.TWILIO_TOKEN
                + '&channel=' + context.TWILIO_CHANNEL_ID);
        }
        else {
            response = await got('https://slack.com/api/channels.history?'
                + 'token=' + context.TWILIO_TOKEN
                + '&channel=' + context.TWILIO_CHANNEL_ID
                + '&latest=' + ts);
        }

        return await JSON.parse(response.body);
    }
    catch (error) { console.log("failure"); }

}

var getAllSlackHistory = async function () {
    var message_history = [];
    try {
        var response = await getSlackHistory();
        //  console.log(response.messages[response.messages.length - 1].ts);
        for (var i = 0; i < response.messages.length; i++) {
            message_history.push(response.messages[i]);
        }
        while (response.has_more) {
            response = await getSlackHistory(response.messages[response.messages.length - 1].ts);
            for (var i = 0; i < response.messages.length; i++) {
                message_history.push(response.messages[i]);
            }
        }
        return await message_history;
    }
    catch (error) {
        console.log(error);
    }

}

var returnTS = async function (numberString) {
    try {
        var message_history = await getAllSlackHistory();
        //console.log(message_history.length);
        // console.log(numberString);
        for (var i = 0; i < message_history.length; i++) {
            //  console.log(message_history[i].text);
            // console.log(message_history[i].text.includes(numberString));
            if (message_history[i].text.includes(numberString))
                //  console.log(message_history[i].ts);
                return message_history[i].ts;
        }
    }
    catch (error) {
        console.log(error);
    }
}

A: Twilio developer evangelist here.
As you said in the comments, this has to do with asynchronous operations and the callback to Twilio Functions.
Currently, the final few lines of your function are:
  returnTS("6049248010").then(function (ts) {
      console.log(ts);
  });

  callback(null);
};

returnTS is an asynchronous function, returning a promise in this case. Twilio Functions will cease all operations once you call the callback function (or after 5 seconds) so in this case you should only call the callback once your asynchronous functions are complete. If you move the call to callback within the promise callback, then things should work as you expect. Try the following instead:
  returnTS("6049248010").then(function (ts) {
      console.log(ts);
      callback(null);
  });
};


text:
Q: Why can't I dynamic_cast "sideways" during multiple inheritence? The following code throws std::bad_cast
struct Foo {
    void foo () {}
};

struct Bar {
    Bar () {
        dynamic_cast <Foo &> (*this) .foo ();
    }
    virtual ~ Bar () {}
};

struct Baz : public Foo, public Bar {
};

int main ()
{
    Baz b;
}

I remember once reading how dynamic_cast has implementation performance trade-offs because "it traverses the full inheritence lattice" in order to evaluate correctly. What the compiler needs to do here is first cast up and then down again.
Is it possible to make the above work or do I need to add
virtual Foo* Bar::as_foo()=0;
?

A: There are no virtual functions in Foo, so dynamic_cast is perfectly obliged to fail. There needs to be a virtual function. It's also a bad idea to do so during construction, as you're going to run into construction order issues.

A: Assuming that Bar should inherit from Foo (which it does not in the current example), the problem you're seeing here is commonly refered to as the diamond problem.  Which version of foo do you want to use, the Bar::foo() or the Foo::foo()?  You're going to need to specify a virtual inheritance:
struct Foo{
    ~virtual Foo(){}
     void foo(){}
};

struct Bar : virtual public Foo

struct Baz : virtual public Foo, public Bar

to let it know that there should only exist one type of foo().  Hence, virtual inheritance is used to invoke the call to foo() within the constructor.
Edit:
And to be clear, I am assuming you want Bar to inherit from Foo.  If you don't have that in your code then that's the cause of the bad cast error.  There's no inheritance hierarchy for Bar to traverse to get to Foo.  Also, modern compilers shouldn't even compile without the virtual inheritance but certain legacy compilers will happily @#$#$ it up.
And if I'm going to comment on another answer, I better follow through with my own answer!

A: There are a couple of things wrong in your example, perhaps it's an accident?
Bar does not inherit from Foo, so it cannot be cast down to Foo in the constructor of Bar. They also do not share a common inheritance parent, and therefore cannot be cast between each other (sideways). What you probably want is:
struct withFoo {
    virtual void foo () {}
    virtual ~withFoo() {}
};

struct Foo : public virtual withFoo {
};

struct Bar : public virtual withFoo {
    Bar () {
        foo();  // no need to cast!
    }
};

struct Baz : public Foo, public Bar {
};

int main ()
{
    Baz b;
    b.foo(); // because of virtual inheritance from withFoo, there is no ambiguity here
}

Hope this helps! If you need clarifications, please ask!

A: Constructing a Baz involves constructing its bases, and one of those is a Bar. The Bar base of the Baz is not castable to Foo, even if the final Baz should be.


text:
Q: I get a 403 when I go to http://localhost/~admin/ I'm running mac osx 10.8.
when I go to localhost or 127.0.0.1/ my browser says: "It Works!".
However when I go to localhost/~admin/ or 127.0.0.1/~admin/ my browser says:
"Forbidden
You don't have permission to access /~admin/ on this server."
How do I change this?!??!?! It's driving me nuts!
This is my /etc/apache2/users/admin.conf:
<Directory "/Users/admin/Sites/">
        Options Indexes MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
</Directory>

I created aliases in my .bash_profile file so that I can start, restart and stop Apache quickly:
alias startApache="sudo apachectl start"
alias stopApache="sudo apachectl stop"
alias restartApache="sudo apachectl restart"

In my /etc/apache2/httpd.conf file I turned on php5:
LoadModule php5_module        libexec/apache2/libphp5.so

I also made sure to change the permissions for my admin.conf file with this command in terminal:
sudo chmod 644 username.conf


text:
Q: Accepting multiple values as input in Python I just wanted to know if there is any efficient way to take multiple inputs from a user and store it in a list in Python.
Based on my research so far I understand that we can make use of split method to do this however, from what I understand that, if I take this approach and if I have to get 10 value from a user I'll have to define 10 variables and it seems a little tedious to me.
I tried taking multiple inputs and defining it in a list using the following code : x = list(input('Enter 10 numbers ')) print(x) however, this will treat numbers as strings and if I try to use int() function it gives me the following error : invalid literal for int() with base 10
Hence, any suggestions or an efficient approach will be really helpful.

A: try this:
x = list(map(int, input('Enter 10 numbers ').split()))
print(x)

output:
Enter 10 numbers 1 2 34 56 100 22 340 344 44 5
[1, 2, 34, 56, 100, 22, 340, 344, 44, 5]


text:
Q: Game Center Air Native Extension. Connection error Making a Game Center ANE for OS X.
When my app was unsigned, (and with enabled workaround, described here https://devforums.apple.com/message/736545), it works fine.
But when I sign my app for distribution, and disable workaround, it raise errors, when I try to authorize local player
Could not get services from gamed. Please file a radar including GameKit logs, and any gamed crash logs. ERROR Error Domain=NSCocoaErrorDomain Code=4099 "Couldn't communicate with a helper application." (The connection to service named com.apple.gamed.osx was invalidated.) UserInfo=0x325c90 {NSDebugDescription=The connection to service named com.apple.gamed.osx was invalidated.}
Error Domain=GKErrorDomain Code=3 "The requested operation could not be completed due to an error communicating with the server." UserInfo=0x21ce90 {NSLocalizedDescription=The requested operation could not be completed due to an error communicating with the server.}
Has anyone encountered a similar problem?
Here is script, which I use to sign my app:
App=MyApp.app
Cert=3rd Party Mac Developer Application: ...

rm "$App"/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/WebKit.dylib
rm "$App"/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/adobecp.vch
rm -rf "$App"/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/adobecp.plugin
rm -rf "$App"/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/AdobeCP15.plugin
rm "$App"/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/Adobe\ AIR.vch

chmod -R 777 "$App"/

codesign -f -v -s "$Cert" "$App"/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/Flash\ Player.plugin/
codesign -f -v -s "$Cert" "$App"/Contents/Frameworks/Adobe\ AIR.framework/

codesign -f -v -s "$Cert" "$App"/Contents/Resources/META-INF/AIR/extensions/my.awesome.gc/META-INF/ANE/MacOS-x86/GC.framework/GC

codesign -f -s "$Cert" --entitlements MyApp.entitlements "$App"

UPD
The problem occurs only if I sign with the --entitlements MyApp.entitlements.
Here is MyApp.entitlements
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
</dict>
</plist>

Please, tell me, what am i doing wrong?


text:
Q: Как найти одинаковые элементы в массиве и удалить повторяющийся? Есть массив PointCollection с повторяющимися точками. Как удалить одну из них? Возможно ли это сделать через метод Where?

A: Используйте Enumerable.Distinct:
var arr = new[] { <some values> };
var normArr = arr.Distinct(); // массив без дублирующихся значений

Примечание: «Эта операция возвращает объект, перечисляющий элементы входной последовательности source и выдающий последовательность, в которой каждый элемент не эквивалентен предыдущим выданным. Эквивалентность элементов определяется методами GetHashCode и Equals».

"Тру-лоу-левел-импл" (такая же, как и в Enumerable.Distinct, только для массива):
[ThreadStatic]
static readonly HashSet<T> distinctCache = <...>;

public static void Distinct<T>(ReadOnlySpan<T> source, Span<T> target)
{
    // checks skipped

    distinctCache.Clear();

    var copyIndex = 0;

    for (var i = 0; i < source.Length; i++)
        if (!distinctCache.Contains(source[i]))
            target[copyIndex++] = source[i];
}


text:
Q: scrapy :if FormRequest have jsessionid I practice FormRequest and have a problem
Fisrt,I crawl a link in def(parse),and I wiil get a json back in def(parse1).
Then I got the actId in json which I can yield request to crawl other links ,but there is error like this:
 ERROR: Spider error processing <POST http://xxx.tw/ca/to.do;jsessionid=A69C5203A49A12DA450F32E6B2AB0E23?mtd=Search&mId=604>

 exceptions.TypeError: unicode_to_str must receive a unicode or str object, got int

I think it is because it deliver a jsessionid jsessionid=A69C5203A49A12DA450F32E6B2AB0E23
Because I try yield FormRequest(url='http://xxx.tw/ca/toView?mtd=do', callback=self.parse3, formdata={'actId': actId})  desperately,and it works well.
Here is Code:
 def parse(self, response):
    yield FormRequest.from_response(response,
                                    formname='Form',
                                    formdata={'when': '9',
                                              'key': 'please input',
                                             },
                                    callback=self.parse1)
   #<form name="Form" id="search" method="post" action="/ca/to?mtd=do&Id=4">
 def parse1(self, response):
    data = json.loads(response.body)
    tryone =  data.get('to')
    for i in tryone:
        actId = i['actId']
        yield FormRequest(url='http://xxx.tw/ca/toView?mtd=do', callback=self.parse3, formdata={'actId': actId})

 def parse3(self, response):
    print response.status   #200
    print 'haha'

How can I do to solve the question?

A: What is the type of actId ? If it is int than convert actId to string from int. In latest versions of scarpy it requires conversion.
    yield FormRequest(url='http://xxx.tw/ca/toView?mtd=do', callback=self.parse3, formdata={'actId': str(actId)})


text:
Q: Multidimensional Arrays and Observable Collection I've seen many ObservableCollection<T> examples of a 2-dimensional object, but I'm working with a multi-dimensional object.
The Faith Life Church Daily Bible Reading API will produce the JSON data, below (this is shortened, for brevity)...
{
    "dailychapter": [{
        "date": "2016-02-01",
        "book": "Esther",
        "chapter": 7,
        "verses": [{
            "number": 1,
            "text": "So the king and Haman came to banquet with Esther the queen."
        }, {
            "number": 2,
            "text": "And the king said again unto Esther on the second day at the banquet of wine, What is thy petition, queen Esther? and it shall be granted thee: and what is thy request? and it shall be performed, even to the half of the kingdom."
        }]
    }, {
        "date": "2016-02-02",
        "book": "Esther",
        "chapter": 8,
        "verses": [{
            "number": 1,
            "text": "On that day did the king Ahasuerus give the house of Haman the Jews' enemy unto Esther the queen. And Mordecai came before the king; for Esther had told what he was unto her."
        }, {
            "number": 2,
            "text": "And the king took off his ring, which he had taken from Haman, and gave it unto Mordecai. And Esther set Mordecai over the house of Haman."
        }]
    }, {
        "date": "2016-02-03",
        "book": "Esther",
        "chapter": 9,
        "verses": [{
            "number": 1,
            "text": "Now in the twelfth month, that is, the month Adar, on the thirteenth day of the same, when the king's commandment and his decree drew near to be put in execution, in the day that the enemies of the Jews hoped to have power over them, (though it was turned to the contrary, that the Jews had rule over them that hated them;)"
        }, {
            "number": 2,
            "text": "The Jews gathered themselves together in their cities throughout all the provinces of the king Ahasuerus, to lay hand on such as sought their hurt: and no man could withstand them; for the fear of them fell upon all people."
        }]
    }]
}

I have a class, for the JSON, with this structure (classes generated by json2csharp)...
    public class Verses
    {
        public int number { get; set; }
        public string text { get; set; }
    }
    public class DailyChapter
    {
        public string date { get; set; }
        public string book { get; set; }
        public int chapter { get; set; }
        public List<Verses> verses { get; set; }
    }
    public class RootObject
    {
        public List<DailyChapter> dailychapter { get; set; }
    }

I have some level of background in databases, so my initial idea is to use ObservableCollection as a flat database, like so...
date        book        chapter versenumber versetext
"2016-02-01"    "Esther"    7   1       "So the king..."
"2016-02-01"    "Esther"    7   2       "And the king..."
"2016-02-02"    "Esther"    8   1       "On that day..."
"2016-02-02"    "Esther"    8   2       "And the king..."
"2016-02-03"    "Esther"    9   1       "Now in the..."
"2016-02-03"    "Esther"    9   2       "The Jews gathered..."

My ObservableCollection's class is structured as such...
    public class BibleReadingCollection
    {
        public string date { get; set; }
        public string book { get; set; }
        public int chapter { get; set; }
        public int versenumber { get; set; }
        public string versetext { get; set; }

        public BibleReadingCollection(string _date, string _book, int _chapter, int _versenumber, string _versetext)
        {
            date = _date;
            book = _book;
            chapter = _chapter;
            versenumber = _versenumber;
            versetext = _versetext;
        }
    }
    // create a collection (like an array) for the binding data to be added to
    public static ObservableCollection<BibleReadingCollection> biblereadingcollection = new ObservableCollection<BibleReadingCollection>();

My intention is to use this ObservableCollection to feed the UI of my app in a Master/Detail type of scenario (master being the date/chapter and detail being the series of verses).  Theoretically, the master list could be populated by some form of LINQ statement and clicking on one of the chapters would fire another LINQ statement that would populate the detail list with verses.
My question is whether this is the right way to think about ObservableCollections (like a flat database).  Maybe it would be better to have each day (and, thusly, each chapter) as a single record (row) and somehow nest the verses within that record.  I'm not sure if that's even possible (can you stick an ObservableCollection or array within an ObservableCollection?).  I know, in SQL-land, you can join tables so that you don't duplicate so much data.  Then, you can create a query that would output what looks like a flat database.
What do you guys think?  I'm a very amateur developer, so a lot of these concepts are new to me.


text:
Q: Should i keep #wrapper{ width:100%} in print css? Should i keep #wrapper{ width:100%} in print css? because on screen my design is a fixed width design 960 px. but there are so many paper type and sizes in the world and anybody can take print on any size paper, bigger and smaller.
So if in print css i do not specify relative width then i think print of page will cut of from right size if user will take print on the paper size which can smaller or larger  width than my site #wrapper width (960px). then it can create problem.
http://www.dpandi.com/paper/index.html
printer also leave some margin when printing.
So should keep everything is relative size in print css?
update:
And should i also change float left or right to float:none in print css?

A: Yes, you should.  If you stick to a definite pixel size, you could even run into a situation where different visitors could see different amounts of the page cut off because of their printer DPI and/or browser.  You might want to also consider adjusting your font sizes to be relative as well (using em or %).
Word of caution: make sure all your elements flow correctly when you switch over to a relative width, or you could have other parts of your content cut off or pushed into strange places.

A: The browsers tend to translate pixels to a similiar size before sending to printer, so it will look similar to what you see on screen. It will not send the pixel size to the printer.


text:
Q: While loop with function that asks for user input I got this function:
#!/bin/bash
prompt() {
read -r -p "${1:-Usunąć podany plik? [t/N]} " response
case "$response" in
    [tT][eE][sS]|[tT])
        true
        echo "Usuwam... $line"
        ;;
        *)
        false
        echo "Pomijam... $line"
        ;;
esac
}

And I want it to work inside a loop that reads line by line from a .txt file:
while IFS= read -r line
        do
            echo "$line" && prompt
        done < lista.txt

As I run the script here's the output (it doesn't actually prompt for user input):
11M /home/kamil/TEST/FOLDER ZE SPACJAMI/PLIK ZE SPACJAMI2.pdf
Pomijam... 11M /home/kamil/TEST/FOLDER ZE SPACJAMI/PLIK ZE SPACJAMI2.pdf
11M /home/kamil/TEST/FOLDER ZE SPACJAMI/PLIK ZE SPACJAMI4.pdf
Pomijam... 11M /home/kamil/TEST/FOLDER ZE SPACJAMI/PLIK ZE SPACJAMI4.pdf
11M /home/kamil/TEST/FOLDER ZE SPACJAMI/PLIK ZE SPACJAMI6.pdf
Pomijam... 11M /home/kamil/TEST/FOLDER ZE SPACJAMI/PLIK ZE SPACJAMI6.pdf

The lista.txt file looks like that if I use this loop:
while IFS= read -r line
        do
            echo "$line"
        done < lista.txt

Output:
11M /home/kamil/TEST/FOLDER ZE SPACJAMI/PLIK ZE SPACJAMI2.pdf
11M /home/kamil/TEST/FOLDER ZE SPACJAMI/PLIK ZE SPACJAMI3.pdf
11M /home/kamil/TEST/FOLDER ZE SPACJAMI/PLIK ZE SPACJAMI4.pdf
11M /home/kamil/TEST/FOLDER ZE SPACJAMI/PLIK ZE SPACJAMI5.pdf
11M /home/kamil/TEST/FOLDER ZE SPACJAMI/PLIK ZE SPACJAMI6.pdf
11M /home/kamil/TEST/FOLDER ZE SPACJAMI/PLIK ZE SPACJAMI.pdf

My desire is that it prompts a user input as it reads every line.

A: The line you need to change is :
read -r -p "${1:-Usunąć podany plik? [t/N]} " response < /dev/tty


text:
Q: How to build a web service client with blueprint we have built a WAR with one servlet and one JPS and converted it to make a bundle by using the maven bundle plugin.
The servlet and jsp's are running fine in Apache Karaf with pax-web.
Now I would like to use a web service client in that servlet. How can I achieve that?
So far we used the cxf-codegen maven plugin to create all required classes to build a client.
We have all the dependencies: cxf-rt-transports-http, cxf-rt-ws-addr, cxf-rt-ws-policy, cxf-rt-frontend-jaxrs,
cxf-rt-ws-security and cxf-rt-transports-http-jetty declared in maven. Futhermore I have the following entry
inside the blueprint.xml:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
    xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
   http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
   http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd">

    <bean id="myServlet" class="com.production.dashboard.DataCombination">
            <property name="dataMergingService" ref="dataMergingService"/>
    </bean>

    <service ref="myServlet" interface="javax.servlet.http.HttpServlet">
            <service-properties>
                    <entry key="alias" value="/hello" />
            </service-properties>
    </service>

    <jaxws:client id="dataMergingService"
            serviceClass="com.production.engine.datacombination.OrderDataMergingService"
            address="http://localhost:8181/engine/datacombination?wsdl" />

When I use this approach the injection fails because the client is always null.
Could anybody please explain me how a web service client has to be used in OSGi, blueprint and
in conjunction with a war enabled bundle?
Many thanks in advance.
Cheers
Hilderich

A: Do you have a real war or do you have a jar using the http service, cause right now the way the blueprint xml looks like you define a servlet within the blueprint xml. Though you talk about a war that contains servlets and jsps. Beware you have two different extenders taking care of the servlet and the blueprint context, both can't be mixed. So you need to make sure you have a way of accessing the bundle context from the servlet.
Take a look at either the whiteboard-blueprint sample or the war-spring
sample. The first one only uses blueprint, the other one mixes a war with spring-dm, which will also work with spring 3.

A: It's nice to hear from you. In the meantime I have reached a better understanding about
Java Web Applications running in OSGi containers.
First of all my application is an ordinary Java Web Application, i.e. a WAR. With the
additional OSGi Manifest meta data (Web-ContextPath, Webapp-Context) that WAR was
enabled to be a Web Application Bundle (WAB).
Furthermore as you mentioned above the blueprint.xml wasn't recognized by the OSGi
container Apache Karaf because there was no Manifest meta data (Bundle-Blueprint) the Blueprint Extender is trying to detect.
The maven bundle plugin (i.e. the bnd tool) is building the WAB on every build.
<plugin>
       <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <inherited>true</inherited>
        <executions>
           <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
                  <goal>manifest</goal>
            </goals>
            <configuration>
                     <supportedProjectTypes>
                <supportedProjectType>jar</supportedProjectType>
                <supportedProjectType>bundle</supportedProjectType>
                <supportedProjectType>war</supportedProjectType>
                  </supportedProjectTypes>
            <instructions>
                <Bundle-SymbolicName>${web.contextPath}</Bundle-SymbolicName>
                <Bundle-ClassPath>
                    .,
                    WEB-INF/classes,
                    WEB-INF/lib/jstl-1-2.jar,
                    WEB-INF/lib/ops4j-base-io-1.4.0.jar,
                    WEB-INF/lib/ops4j-base-lang-1.4.0.jar,
                    WEB-INF/lib/ops4j-base-monitors-1.4.0.jar,
                    WEB-INF/lib/ops4j-base-store-1.4.0.jar,
                    WEB-INF/lib/ops4j-base-util-property-1.4.0.jar,
                    WEB-INF/lib/org.ops4j.pax.tipi.hamcrest.core-1.3.0.1.jar,
                    WEB-INF/lib/standard-1.1.2.jar
                </Bundle-ClassPath>
                <Bundle-Blueprint>WEB-INF/classes/OSGI-INF/blueprint/*.xml</Bundle-Blueprint>
                <Web-ContextPath>${web.contextPath}</Web-ContextPath>
                    <Webapp-Context>${web.contextPath}</Webapp-Context>
                <Export-Package>
                    !org.production.engine.datacombination
                </Export-Package>
                <Import-Package>
                    javax.servlet,
                    javax.servlet.http,
                    javax.servlet.*,
                    javax.servlet.jsp.*,
                    javax.servlet.jsp.jstl.*,
                    !junit.framework,
                    !org.junit,
                    !sun.misc,
                        !org.ops4j.pax.swissbox.*,
                        *
                </Import-Package>
                <DynamicImport-Package>
                    javax.*,
                    org.xml.sax,
                    org.xml.sax.*,
                    org.w3c.*
                </DynamicImport-Package>
            </instructions>
            </configuration>
        </execution>
    </executions>

</plugin>

However to run the web application in Apache Karaf you must install the feature war:
features:install war

In addition the jre 1.6 had to export further packages (excerpt of jre.properties):
jre-1.6= \
     ...
     com.sun.org.apache.xalan.internal.res, \
     com.sun.org.apache.xml.internal.utils, \
     com.sun.org.apache.xpath.internal, \
     com.sun.org.apache.xpath.internal.jaxp, \
     com.sun.org.apache.xpath.internal.objects

With all that the Servlet Container (Jetty) was running and JSP pages were
rendered correctly.
Now I explain how to use the Web Service Client within the Servlet.
With the WSDL file located in the resource directory I create all essential
classes in order to build the Web Service Client. To do that easily the Maven
cxf-codegen-plugin creates these classes:
<plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <executions>
        <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
                <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
                <encoding>UTF-8</encoding>
                <wsdlOptions>
                    <wsdlOption>
                        <wsdl>src/main/resources/datacombination_1.wsdl</wsdl>
                        <wsdlLocation>classpath:datacombination_1.wsdl</wsdlLocation>
                        <extraargs>
                            <extraarg>-b</extraarg>
                            <extraarg>${basedir}/src/main/resources/jaxb-binding-date.xml</extraarg>
                            <extraarg>-compile</extraarg>
                        </extraargs>
                    </wsdlOption>
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Now I can connect the generated web service classes with the real Web Service
inside the blueprint.xml and publish it as an OSGi service:
<jaxws:client id="dms"
        serviceClass="org.production.engine.datacombination.OrderDataMerging"
        address="/engine/datacombination"
        wsdlLocation="classpath:/datacombination_1.wsdl"
        serviceName="ns1:OrderDataMergingService"
        endpointName="ns1:OrderDataMergingPort" />

<service ref="dms" interface="org.production.engine.datacombination.OrderDataMerging" />

Inside the Servlet class I was now able to instantiate the generated Service class and
the Web Service was called on the remote machine:
OrderDataMergingService dataMergingService = new OrderDataMergingService();
String orderId = dataMergingService.getOrderDataMergingPort()
                .importOrder(wsRequest);

The one and only secret I haven't conceived yet why I have to publish that OSGi service?
Because when the OSGi service (ref="dms" in blueprint.xml) is missing the Web Service Client doesn't work.
Cheers
Johannes


text:
Q: Charts not displayed in django admin view? I am trying to display some charts in my admin view( by extending admin/base.html) and I want to use a template instead of libraries such as charts.Js to display them. I want my view to be like the following (https://colorlib.com/polygon/cooladmin/index.html). Github repo here (https://github.com/puikinsh/CoolAdmin). However, in my case no charts are being displayed.
I have integrated all files and folders( containing static files) and set all dependencies correctly andhe main.js(contains code for charts) are also working.
Extract from main.html(includes links)

overview

                        <button class="au-btn au-btn-icon au-btn--blue">
                            add item</button>

10368

                                    members online

                                <canvas id="widgetChart1"></canvas>

Extract from main.js
(function ($) {
  // USE STRICT
  "use strict";

  try {
    //WidgetChart 1
    var ctx = document.getElementById("widgetChart1");
    if (ctx) {
      ctx.height = 130;
      var myChart = new Chart(ctx, {
        type: 'line',
        data: {
          labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
          type: 'line',
          datasets: [{
            data: [78, 81, 80, 45, 34, 12, 40],
            label: 'Dataset',
            backgroundColor: 'rgba(255,255,255,.1)',
            borderColor: 'rgba(255,255,255,.55)',
          },]
        },
        options: {
          maintainAspectRatio: true,
          legend: {
            display: false
          },
          layout: {
            padding: {
              left: 0,
              right: 0,
              top: 0,
              bottom: 0
            }
          },
          responsive: true,
          scales: {
            xAxes: [{
              gridLines: {
                color: 'transparent',
                zeroLineColor: 'transparent'
              },
              ticks: {
                fontSize: 2,
                fontColor: 'transparent'
              }
            }],
            yAxes: [{
              display: false,
              ticks: {
                display: false,
              }
            }]
          },
          title: {
            display: false,
          },
          elements: {
            line: {
              borderWidth: 0
            },
            point: {
              radius: 0,
              hitRadius: 10,
              hoverRadius: 4
            }
          }
        }
      });
    }
})(jQuery);

Expected ouput should be like the following (https://colorlib.com/polygon/cooladmin/index.html). However mine gets rendered without any charts. I beleive something is preventing the JS from applying the chart onto the html page.
Any helps will be appreciated. Also Do let me know if the question need updating.
Thanks.

A: Solution: it uses chart.js.
https://www.chartjs.org/
You will have to have a js file with datapoints.
Try opening the chrome developer console and inspect the js.


text:
Q: Why is the Maven javafx plugin failing to run the test project I am trying to follow this tutorial to set a Maven JavaFX project in IntelliJ https://openjfx.io/openjfx-docs/#maven (IntelliJ non-modular with Maven) but it fails whatever I do.
I have been trying a lot of internet advice. I tried setting VM variables in the pom, I made sure JAVA_HOME is pointing to my JDK 12 directory, and I checked that in the project structure the JDK is correctly set.
This is my pom file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>asterion</groupId>
    <artifactId>exitpoll</artifactId>
    <packaging>jar</packaging>
    <version>0.1.0-SNAPSHOT</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>12</maven.compiler.source>
        <maven.compiler.target>12</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>12.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>12.0.2</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>12</source>
                    <target>12</target>
                    <release>12</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.3</version>
                <configuration>
                    <source>12</source>
                    <target>12</target>
                    <release>12</release>
                    <mainClass>asterion.App</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

and this is the output:
"C:\Program Files\Java\jdk-12.0.2\bin\java.exe" -Dmaven.multiModuleProjectDirectory=D:\exitpoll "-Dmaven.home=L:\software\IntelliJ IDEA 2019.2\plugins\maven\lib\maven3" "-Dclassworlds.conf=L:\software\IntelliJ IDEA 2019.2\plugins\maven\lib\maven3\bin\m2.conf" "-Dmaven.ext.class.path=L:\software\IntelliJ IDEA 2019.2\plugins\maven\lib\maven-event-listener.jar" "-javaagent:L:\software\IntelliJ IDEA 2019.2\lib\idea_rt.jar=61323:L:\software\IntelliJ IDEA 2019.2\bin" -Dfile.encoding=UTF-8 -classpath "L:\software\IntelliJ IDEA 2019.2\plugins\maven\lib\maven3\boot\plexus-classworlds-2.6.0.jar" org.codehaus.classworlds.Launcher -Didea.version2019.2.1 org.openjfx:javafx-maven-plugin:0.0.3:run
[IJ]-1-Unknown-[IJ]-event=org.apache.maven.settings.building.DefaultSettingsBuildingRequest@1bdf8190
[IJ]-1-Unknown-[IJ]-event=org.apache.maven.settings.building.DefaultSettingsBuildingResult@50687efb
[IJ]-1-Unknown-[IJ]-event=org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest@56e07a08
[IJ]-1-ProjectDiscoveryStarted-[IJ]-id=unknown
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< asterion:exitpoll >--------------------------
[INFO] Building exitpoll 0.1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[IJ]-1-ARTIFACT_RESOLVED-[INFO]
[INFO] --- javafx-maven-plugin:0.0.3:run (default-cli) @ exitpoll ---
[IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.apache:apache:pom:21-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\***\.m2\repository\org\apache\apache\21\apache-21.pom-[IJ]-artifactCoord=org.apache:apache:pom:21-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.eclipse.sisu:org.eclipse.sisu.plexus:pom:0.3.3-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\***\.m2\repository\org\jboss\weld\weld-api-parent\1.0\weld-api-parent-1.0.pom-[IJ]-artifactCoord=org.jboss.weld:weld-api-parent:pom:1.0-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.codehaus.plexus:plexus-languages:pom:0.9.11-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.ow2.asm:asm:pom:7.0-beta-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\***\.m2\repository\com\thoughtworks\qdox\qdox\2.0-M9\qdox-2.0-M9.pom-[IJ]-artifactCoord=com.thoughtworks.qdox:qdox:pom:2.0-M9-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\***\.m2\repository\org\apache\commons\commons-parent\43\commons-parent-43.pom-[IJ]-artifactCoord=org.apache.commons:commons-parent:pom:43-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\***\.m2\repository\org\codehaus\plexus\plexus-utils\1.5.5\plexus-utils-1.5.5.pom-[IJ]-artifactCoord=org.codehaus.plexus:plexus-utils:pom:1.5.5-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.apache.maven:maven-model-builder:pom:3.0.5-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\***\.m2\repository\org\codehaus\plexus\plexus\5.1\plexus-5.1.pom-[IJ]-artifactCoord=org.codehaus.plexus:plexus:pom:5.1-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\***\.m2\repository\org\apache\commons\commons-parent\39\commons-parent-39.pom-[IJ]-artifactCoord=org.apache.commons:commons-parent:pom:39-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.apache:apache:pom:16-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\***\.m2\repository\org\codehaus\mojo\mojo-parent\34\mojo-parent-34.pom-[IJ]-artifactCoord=org.codehaus.mojo:mojo-parent:pom:34-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\***\.m2\repository\org\codehaus\plexus\plexus-utils\3.1.0\plexus-utils-3.1.0.jar-[IJ]-artifactCoord=org.codehaus.plexus:plexus-utils:jar:3.1.0-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\***\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar-[IJ]-artifactCoord=com.google.code.findbugs:jsr305:jar:3.0.2-[IJ]-error=
Error occurred during initialization of boot layer
java.lang.module.FindException: Error reading module: C:\Users\***\.m2\repository\org\openjfx\javafx-base\12.0.2\javafx-base-12.0.2-win.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Unsupported major.minor version 55.0
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:491)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:453)
    at org.openjfx.JavaFXRunMojo.execute (JavaFXRunMojo.java:97)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:491)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:453)
    at org.openjfx.JavaFXRunMojo.execute(JavaFXRunMojo.java:97)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.009 s
[INFO] Finished at: 2019-08-25T22:03:42+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.3:run (default-cli) on project exitpoll: Error: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

[INFO]
[INFO] -------------------------< asterion:exitpoll >--------------------------
[INFO] Building exitpoll 0.1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- javafx-maven-plugin:0.0.3:run (default-cli) @ exitpoll ---
Error occurred during initialization of boot layer
java.lang.module.FindException: Error reading module: C:\Users\***\.m2\repository\org\openjfx\javafx-base\12.0.2\javafx-base-12.0.2-win.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Unsupported major.minor version 55.0
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:491)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:453)
    at org.openjfx.JavaFXRunMojo.execute (JavaFXRunMojo.java:97)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:491)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:453)
    at org.openjfx.JavaFXRunMojo.execute(JavaFXRunMojo.java:97)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)

As José Pereda indicates, the important error message is java.lang.module.InvalidModuleDescriptorException: Unsupported major.minor version 55.0

A: I solved it, although in a somewhat radical way. For some reason, java -version returned a different Java version, 10. I deleted all JDKs from my computer and reinstalled JDK 12, and now the problem is solved.
Thanks to José Pereda for his help pinpointing the issue!

A: This can also happen when running from netbeans (showed up for me when updating java version).
The solution is taken from here
You'll need to update this variable with the location of your jdk (even if you already have JAVA_HOME set up)
netbeans_jdkhome="C:\Program Files\Java\jdk<version>
this is located in this file
C:\Program Files\NetBeans <version>\netbeans\etc\netbeans.conf


text:
Q: How to make some loading text for HTML5 iFrame I have an iFrame object that are defined like this:
<iframe src="iFrame SRC" frameborder="0" width="160" height="200" scrolling="no" longdesc="longdesc URL">
</iframe>

Now this frame took a long time to load, is it possible to make a loading text that simple says Loading frame..., and when the frame appears make the text go away? I tried putting the text right above the frame definition like this:
Loading...
<iframe ...>
</iframe>

It does stay on top of the frame but never goes away. How do you put a loading text for an iframe?

A: You can wrap the iFrame in a DIV with a class for loading a back ground image.
<div class="iframe-loading">
   <iframe src="iFrame SRC" frameborder="0" width="160" height="200"  scrolling="no" longdesc="longdesc URL">
   </iframe>
</div>

 .iframe-loading {
  background:url(../images/loading.gif);
 }

A: A long time ago I used to do this:
<iframe src="iFrame" etc. ...>
Loading frame...
</iframe>


text:
Q: What's the max level we can get in Skyrim and max perks?
Possible Duplicate:
Is it possible to maximize all the skills and gain all the perks?

I was wondering if it was possible to max out all skills, perks or there's a max level so you'll have to choose wisely ?

A: The "hard cap" is level 81, while the "softcap" is level 50.
This means from level 50 onward it gets progressively harder to level until level 81 (when all skills reach 100) you can't level at all.
Source


text:
Q: How set nodejs redis persistence config? I am using node redis.
I want to change the persistence config of redis.
I want to set it to AOF(Append Only File).
How to do that in node js after creating the redisClient ?
const redisclient = redis.createClient();
... (What else ) ...

How to set the persistence config?
I googled, i don't find any suitable doc for that

A: I believe what you are looking for is CONFIG SET, which has a small blurb that mentions:

It is possible to switch persistence from RDB snapshotting to
append-only file (and the other way around) using the CONFIG SET
command. For more information about how to do that please check the
persistence page.

The linked persistence page says that:

You can turn on the AOF in your configuration file:
appendonly yes

The nodejs redis library implements a 1-to-1 mapping of the redis commands, so there is a config method on the client object that you can use like:
client.config("SET", "appendonly", "yes");


text:
Q: Decrypt AES/CBC/PKCS5Padding with CryptoJS I generate 128bit AES/CBC/PKCS5Padding key using Java javax.crypto API. Here is the algorithm that I use:
public static String encryptAES(String data, String secretKey) {
    try {
        byte[] secretKeys = Hashing.sha1().hashString(secretKey, Charsets.UTF_8)
                .toString().substring(0, 16)
                .getBytes(Charsets.UTF_8);

        final SecretKey secret = new SecretKeySpec(secretKeys, "AES");

        final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
        cipher.init(Cipher.ENCRYPT_MODE, secret);

        final AlgorithmParameters params = cipher.getParameters();

        final byte[] iv = params.getParameterSpec(IvParameterSpec.class).getIV();
        final byte[] cipherText = cipher.doFinal(data.getBytes(Charsets.UTF_8));

        return DatatypeConverter.printHexBinary(iv) + DatatypeConverter.printHexBinary(cipherText);
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
}

public static String decryptAES(String data, String secretKey) {
    try {
        byte[] secretKeys = Hashing.sha1().hashString(secretKey, Charsets.UTF_8)
                .toString().substring(0, 16)
                .getBytes(Charsets.UTF_8);

        // grab first 16 bytes - that's the IV
        String hexedIv = data.substring(0, 32);

        // grab everything else - that's the cipher-text (encrypted message)
        String hexedCipherText = data.substring(32);

        byte[] iv = DatatypeConverter.parseHexBinary(hexedIv);
        byte[] cipherText = DatatypeConverter.parseHexBinary(hexedCipherText);

        final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");

        cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(secretKeys, "AES"), new IvParameterSpec(iv));

        return new String(cipher.doFinal(cipherText), Charsets.UTF_8);
    } catch (BadPaddingException e) {
        throw new IllegalArgumentException("Secret key is invalid");
    }catch (Exception e) {
        throw Throwables.propagate(e);
    }
}

I can easily encrypt and decrypt messages using secretKey with these methods. Since Java has 128bit AES encryption by default, it generates a hash of the original secret key with SHA1 and takes the first 16-bytes of the hash to use it as secret key in AES. Then it dumps the IV and cipherText in HEX format.
For example encryptAES("test", "test") generates CB5E759CE5FEAFEFCC9BABBFD84DC80C0291ED4917CF1402FF03B8E12716E44C and I want to decrypt this key with CryptoJS.
Here is my attempt:
var str = 'CB5E759CE5FEAFEFCC9BABBFD84DC80C0291ED4917CF1402FF03B8E12716E44C';

CryptJS.AES.decrypt(
CryptJS.enc.Hex.parse(str.substring(32)),
CryptJS.SHA1("test").toString().substring(0,16),
{
  iv: CryptJS.enc.Hex.parse(str.substring(0,32)),
  mode: CryptJS.mode.CBC,
  formatter: CryptJS.enc.Hex,
  blockSize: 16,
  padding: CryptJS.pad.Pkcs7
}).toString()

However it returns an empty string.

A: The problem is that you're using a 64 bit key as a 128 bit. Hashing.sha1().hashString(secretKey, Charsets.UTF_8) is an instance of HashCode and its toString method is described as such:

Returns a string containing each byte of asBytes(), in order, as a two-digit unsigned hexadecimal number in lower case.

It is a Hex-encoded string. If you take only 16 characters of that string and use it as a key, you only have 64 bits of entropy and not 128 bits. You really should be using HashCode#asBytes() directly.

Anyway, the problem with the CryptoJS code is manyfold:

*

*The ciphertext must be a CipherParams object, but it is enough if it contains the ciphertext bytes as a WordArray in the ciphertext property.

*The key must be passed in as a WordArray instead of a string. Otherwise, an OpenSSL-compatible (EVP_BytesToKey) key derivation function is used to derive the key and IV from the string (assumed to be a password).

*Additional options are either unnecessary, because they are defaults, or they are wrong, because the blockSize is calculated in words and not bytes.

Here is CryptoJS code that is compatible with your broken Java code:

var str = 'CB5E759CE5FEAFEFCC9BABBFD84DC80C0291ED4917CF1402FF03B8E12716E44C';

console.log("Result: " + CryptoJS.AES.decrypt({
    ciphertext: CryptoJS.enc.Hex.parse(str.substring(32))
}, CryptoJS.enc.Utf8.parse(CryptoJS.SHA1("test").toString().substring(0,16)),
{
  iv: CryptoJS.enc.Hex.parse(str.substring(0,32)),
}).toString(CryptoJS.enc.Utf8))
<script src="https://cdn.rawgit.com/CryptoStore/crypto-js/3.1.2/build/rollups/sha1.js"></script>
<script src="https://cdn.rawgit.com/CryptoStore/crypto-js/3.1.2/build/rollups/aes.js"></script>

Here is CryptoJS code that is compatible with the fixed Java code:

var str = 'F6A5230232062D2F0BDC2080021E997C6D07A733004287544C9DDE7708975525';

console.log("Result: " + CryptoJS.AES.decrypt({
    ciphertext: CryptoJS.enc.Hex.parse(str.substring(32))
}, CryptoJS.enc.Hex.parse(CryptoJS.SHA1("test").toString().substring(0,32)),
{
  iv: CryptoJS.enc.Hex.parse(str.substring(0,32)),
}).toString(CryptoJS.enc.Utf8))
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/sha1.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script>

The equivalent encryption code in CryptoJS would look like this:

function encrypt(plaintext, password){
    var iv = CryptoJS.lib.WordArray.random(128/8);
    var key = CryptoJS.enc.Hex.parse(CryptoJS.SHA1(password).toString().substring(0,32));
    var ct = CryptoJS.AES.encrypt(plaintext, key, { iv: iv });
    return iv.concat(ct.ciphertext).toString();
}

console.log("ct: " + encrypt("plaintext", "test"));
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/sha1.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script>

A: This one perfectly worked for me
import * as CryptoJS from 'crypto-js';
const SECRET_CREDIT_CARD_KEY = '1231231231231231' // 16 digits key

    decrypt(cipherText) {
        const iv = CryptoJS.enc.Hex.parse(this.SECRET_CREDIT_CARD_KEY);
        const key = CryptoJS.enc.Utf8.parse(this.SECRET_CREDIT_CARD_KEY);
        const result = CryptoJS.AES.decrypt(cipherText, key,
          {
            iv,
            mode: CryptoJS.mode.ECB,
          }
          )
          const final  = result.toString(CryptoJS.enc.Utf8)
          return final
      }

    console.log(decrypt('your encrypted text'))

using this library in Angular 8
https://www.npmjs.com/package/crypto-js


text:
Q: For a given function get its parent object Lets say i have this code:
function GetParentObject(fn){
   //get parent object from function

}

var obj = GetParentObject(eval); //returns window

How do i implement GetParentObject function?

A: This is where this comes in.
The this keyword returns the object that owns the function where it is called.


text:
Q: add element with attributes in minidom python I want to add a child node with attributes to a specific tag. my xml is
<deploy>
</deploy>

and the output should be
<deploy>
  <script name="xyz" action="stop"/>
</deploy>

so far my code is:
dom = parse("deploy.xml")
script = dom.createElement("script")
dom.childNodes[0].appendChild(script)
dom.writexml(open(weblogicDeployXML, 'w'))
script.setAttribute("name", args.script)

How can I figure out how to find deploy tag and append child node with attributes ?

A: xml.dom.Element.setAttribute
xmlFile = minidom.parse( FILE_PATH )

for script in SCRIPTS:

    newScript = xmlFile.createElement("script")

    newScript.setAttribute("name"  , script.name)
    newScript.setAttribute("action", script.action)

    newScriptText = xmlFile.createTextNode( script.description )

    newScript.appendChild( newScriptText  )
    xmlFile.childNodes[0].appendChild( newScript )

print xmlFile.toprettyxml()

Output file:
<?xml version="1.0" ?>
<scripts>
    <script action="list" name="ls" > List a directory </script>
    <script action="copy" name="cp" > Copy a file/directory </script>
    <script action="move" name="mv" > Move a file/directory </script>
    .
    .
    .
</scripts>


text:
Q: How to use custom file system jar for hive in EMR I want to use a custom file system lets name it X, for my hive Application in EMR which is different from existing file systems example EMRFS, HDFS. But when I switch to my hive shell and try
add jar s3://sample/X.jar;

CREATE EXTERNAL TABLE TEST(sample_key1 int, sample_key2 STRING)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
LOCATION 'X://sample/test/path';

It throws an error:
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:Got exception: java.io.IOException No FileSystem for scheme X.

Usually I do this to get it to work in spark:
1. spark-shell --jars s3://sample/X.jar
2. spark.sparkContext.hadoopConfiguration.set("fs.x.impl", "{My FS jar main file.}")
3. spark.read.csv("X://sample/test/path").
Maybe what I am missing is the 2nd step(conf setting), but I tried the same thing in hive shell as:
SET fs.x.impl=<My FS jar main file.>

** Update:
I tried giving the second step as a part of hive-site configuration, now it seems it understands that an X file system exists, but gives the following error instead('ClassNotFoundException') even though the same thing worked for emrfs with spark, maybe there is a different way for hive to parse this jar.:
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:java.lang.RuntimeException: java.lang.ClassNotFoundException: Class com.amazon.ckp.fs.CkpFS not found)

But that too didn't work any idea what I can do here?


text:
Q: How to formulate that a factor may influence a variable or the changes in that variable? I wonder how to formulate how multiple factors (for instance an announcement of Central Bank A, B and C) may influence a variable. For example, consider the following formula:
$$\Delta I^n_t = f (A_t, B_t, C_t)$$ where $I^n_t$ refers to the interest rate of a security with maturity $n$ at time $t$ and $A_t, B_t, C_t$ refer to announcements of central bank A, B and C on time $t$ respectively.
The above formula indicates that changes in variable $I$ are a function of the announcements of the central banks'. However, how can one introduce this equation? Let me show what my concerns are by the following sentences:

Changes in $I$ may be due to announcements of Central bank A. However,
  announcements of central bank B and C may also influence $I$

My concern is the last part of the sentence, "influence $I$". Should this indeed be: "influence $I$" or should it be "influence $\Delta I$"? I doubt about this because when the announcements influence $I$ then this should automatically lead to a change in $I$ right?. On the other hand, it is not in line with my equation above. Furthermore, isn't it the case that when some factor influences the changes in some variable, that this variable actually influences the speed of changes in this variable (like a second derivative)?


text:
Q: Get data by joining table does not work in oracle I have 2 tables where I want to join it and gets its data. For ex: Table A consists of Error Code and the description of its code is in Table B.
So the value of Error Code is stored like ,1, ,2, ,1,2 in table A.
tbl_fiber_invalid_trans_data   -> Table A
TBL_INVALID_ERROR_DATA    ->  Table B.
I tried joining like below but the Remarks was all blank

SELECT a.SPAN_ID,MAINTENANCE_ZONE_NAME,a.MAINTENANCE_ZONE_CODE,a.R4G_STATE_NAME,
a.NETWORK_CATEGORY,a.NETWORK_TYPE,a.CONSTRUCTION_METHODOLOGY,
a.INVENTORY_STATUS_CODE,a.OWNERSHIP_TYPE_CODE,a.ROUTE_NAME,a.INTRACITY_LINK_ID ,
a.CALCULATED_LENGTH, REPLACE(a.REMARKS, ',1', '1') as REMARKS
  FROM tbl_fiber_invalid_trans_data a
  left JOIN TBL_INVALID_ERROR_DATA t
   ON a.REMARKS = t.ID;

Let me know where I am wrong. and how to replace all those comma separated values
update

Table:tbl_fiber_invalid_trans_data
Name                     Null Type
------------------------ ---- ---------------
SPAN_ID                       NVARCHAR2(100)
MAINTENANCE_ZONE_NAME         NVARCHAR2(100)
MAINTENANCE_ZONE_CODE         NVARCHAR2(50)
R4G_STATE_NAME                NVARCHAR2(50)
STATE_NAME                    NVARCHAR2(50)
NETWORK_CATEGORY              NVARCHAR2(100)
NETWORK_TYPE                  NVARCHAR2(100)
CONSTRUCTION_METHODOLOGY      NVARCHAR2(50)
INVENTORY_STATUS_CODE         NVARCHAR2(20)
OWNERSHIP_TYPE_CODE           NVARCHAR2(20)
ROUTE_NAME                    NVARCHAR2(100)
INTRACITY_LINK_ID             NVARCHAR2(100)
CALCULATED_LENGTH             NUMBER(38,8)
LAST_UPDATED_BY               NVARCHAR2(100)
LAST_UPDATED_DATE             DATE
REMARKS                       NVARCHAR2(1000)

Table:TBL_INVALID_ERROR_DATA

Name     Null Type
-------- ---- --------------
ID            NUMBER(18,8)
ERR_CODE      NVARCHAR2(500)

Sample data as followed
Table 1
[![img1][1]][1]
Sample data table 2
[![enter image description here][2]][2]

A: Here's a simplified example that shows how you can extract integers from a comma separated list (REMARKS in tbl_fiber_invalid_trans_data), and then join that to the error codes list (TBL_INVALID_ERROR_DATA) to get the messages:
WITH codes AS (
  SELECT DISTINCT SPAN_ID, REGEXP_SUBSTR(remarks, '\d+', 1, level) AS code
  FROM tbl_fiber_invalid_trans_data
  CONNECT BY REGEXP_SUBSTR(remarks, '\d+', 1, level) IS NOT NULL
)
SELECT t1.*, t2.err_code
FROM tbl_fiber_invalid_trans_data t1
JOIN codes c ON c.SPAN_ID = t1.SPAN_ID
LEFT JOIN TBL_INVALID_ERROR_DATA t2 ON t2.id = c.code
ORDER BY t1.SPAN_ID

Output (for my simplified demo):
SPAN_ID     MAINTENANCE_ZONE_NAME   REMARKS     ERR_CODE
1           Zone 1                  ,1          Span id length too short
2           Zone 2                  ,2          Inventory suspended
3           Zone 3                  ,1,2        Span id length too short
3           Zone 3                  ,1,2        Inventory suspended
4           Zone 4                  ,2,1        Span id length too short
4           Zone 4                  ,2,1        Inventory suspended
5           Zone 5                  null        null

If you want all the errors for a zone in one line, you can aggregate them in a second CTE and JOIN to that instead:
WITH codes AS (
  SELECT DISTINCT SPAN_ID, REGEXP_SUBSTR(remarks, '\d+', 1, level) AS code
  FROM tbl_fiber_invalid_trans_data
  CONNECT BY REGEXP_SUBSTR(remarks, '\d+', 1, level) IS NOT NULL
),
msgs AS (
  SELECT SPAN_ID, LISTAGG(err_code, ', ') WITHIN GROUP (ORDER BY code) AS err_codes
  FROM codes c
  LEFT JOIN TBL_INVALID_ERROR_DATA t2 ON t2.id = c.code
  GROUP BY SPAN_ID
)
SELECT t1.*, m.err_codes
FROM tbl_fiber_invalid_trans_data t1
JOIN msgs m ON m.SPAN_ID = t1.SPAN_ID
ORDER BY t1.SPAN_ID

Output
SPAN_ID     MAINTENANCE_ZONE_NAME   REMARKS     ERR_CODES
1           Zone 1                  ,1          Span id length too short
2           Zone 2                  ,2          Inventory suspended
3           Zone 3                  ,1,2        Span id length too short, Inventory suspended
4           Zone 4                  ,2,1        Span id length too short, Inventory suspended
5           Zone 5                  null        null

Demo on dbfiddle

A: You need a join with LIKE as follows:
ON a.REMARKS || ',' like '%,'|| t.ID || ',%';

Update
You must use the following query:
SELECT SPAN_ID,
       MAINTENANCE_ZONE_NAME,
       MAINTENANCE_ZONE_CODE,
       R4G_STATE_NAME,
       NETWORK_CATEGORY,
       NETWORK_TYPE,
       CONSTRUCTION_METHODOLOGY,
       INVENTORY_STATUS_CODE,
       OWNERSHIP_TYPE_CODE,
       ROUTE_NAME,
       INTRACITY_LINK_ID,
       CALCULATED_LENGTH,
       LISTAGG(ID,',') WITHIN GROUP (ORDER BY ID) AS REMARKS,
       LISTAGG(ERR_CODE,',') WITHIN GROUP (ORDER BY ID) AS ERR_CODE
FROM
(SELECT DISTINCT A.SPAN_ID,
       MAINTENANCE_ZONE_NAME,
       A.MAINTENANCE_ZONE_CODE,
       A.R4G_STATE_NAME,
       A.NETWORK_CATEGORY,
       A.NETWORK_TYPE,
       A.CONSTRUCTION_METHODOLOGY,
       A.INVENTORY_STATUS_CODE,
       A.OWNERSHIP_TYPE_CODE,
       A.ROUTE_NAME,
       A.INTRACITY_LINK_ID,
       A.CALCULATED_LENGTH,
       T.ID,
       T.ERR_CODE
  FROM TBL_FIBER_INVALID_TRANS_DATA A
  LEFT JOIN TBL_INVALID_ERROR_DATA T
  ON A.REMARKS || ',' LIKE '%,' || T.ID  || ',%')
GROUP BY SPAN_ID,
       MAINTENANCE_ZONE_NAME,
       MAINTENANCE_ZONE_CODE,
       R4G_STATE_NAME,
       NETWORK_CATEGORY,
       NETWORK_TYPE,
       CONSTRUCTION_METHODOLOGY,
       INVENTORY_STATUS_CODE,
       OWNERSHIP_TYPE_CODE,
       ROUTE_NAME,
       INTRACITY_LINK_ID,
       CALCULATED_LENGTH


text:
Q: sudo to root in middle of script I have a Perl script running as user1. This script is basically used to stop/start or bounce a process running as user2 on RHEL.
Now, the stop/start is working since i am using a warpper of user2 to run the stop/start and bounce commands.
The issue is, this process is a jvm which is usually busy. So, stop/start or bounce wont work all the time if the jvm is really busy. So I am trying to kill the processid using a kill -9 for a quicker bounce.
So, can i do a sudo to user2 or root in the middle of my Perl script running as user1 to kill -9 the process.
I tried using
su - user2 -c `kill -9 pid`;
sudo -u user2 -c `kill -9 pid`;

So my script to stop/start/bounce is running as user1. The process being stopped/started/bounced is running as user2.
I want my Perl script to kill the process if stop/start/bounce is taking longer than 30 secs.
Please help.

A: If you can't fix your sudoers file with visudo, then the Expect module is an option:
#!/usr/bin/perl

use Expect;

# Get the password when your program starts
my $pw = <>;

# ... do stuff ...

# use the password when you need it
my $exp = Expect->spawn("/usr/bin/sudo", "-k", "-u", "user2", "kill", "-9", $pid);
print("expecting the prompt\n");
$exp->expect(undef, "-re", "Password:", sub { print("prompt matched\n"); $exp->send($pw); exp_continue; });
$exp->soft_close();

Seriously, though, the best thing is to put the appropriate entry in sudoers.


text:
Q: C++11 auto variable In  Essentials of Modern C++ Style (video), Herb Sutter advocates:
auto varname = Constructor{ ... };

instead of
Constructor varname( ... );

I tried doing:
auto log = fstream{"log.txt", fstream::out};

but received an error message from g++4.8 -std=c++11 about deleted functions (regardless of whether I use curly brackets or parentheses).
Is it my fault or g++'s?
fstream log{"log.txt", fstream::out};

works fine.
MCVE:
#include <fstream>

using namespace std;
int main(int argc, char **argv)
{
    auto log = fstream{"log.txt", fstream::out};
    //fstream log{"log.txt", fstream::out};
    log << "hello world" << endl;
}

Error:
g++ -std=c++11    1.cc   -o 1
1.cc: In function 'int main(int, char**)':
1.cc:6:47: error: use of deleted function 'std::basic_fstream<char>::basic_fstream(const std::basic_fstream<char>&)'
     auto log = fstream{"log.txt", fstream::out};
                                               ^
In file included from 1.cc:1:0:
/usr/include/c++/4.8/fstream:776:11: note: 'std::basic_fstream<char>::basic_fstream(const std::basic_fstream<char>&)' is implicitly deleted because the default definition would be ill-formed:
     class basic_fstream : public basic_iostream<_CharT, _Traits>
           ^
/usr/include/c++/4.8/fstream:776:11: error: use of deleted function 'std::basic_iostream<char>::basic_iostream(const std::basic_iostream<char>&)'
In file included from /usr/include/c++/4.8/fstream:38:0,
                 from 1.cc:1:
/usr/include/c++/4.8/istream:795:11: note: 'std::basic_iostream<char>::basic_iostream(const std::basic_iostream<char>&)' is implicitly deleted because the default definition would be ill-formed:
     class basic_iostream
           ^
/usr/include/c++/4.8/istream:795:11: error: use of deleted function 'std::basic_istream<char>::basic_istream(const std::basic_istream<char>&)'
/usr/include/c++/4.8/istream:58:11: note: 'std::basic_istream<char>::basic_istream(const std::basic_istream<char>&)' is implicitly deleted because the default definition would be ill-formed:
     class basic_istream : virtual public basic_ios<_CharT, _Traits>
           ^
/usr/include/c++/4.8/istream:58:11: error: use of deleted function 'std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)'
In file included from /usr/include/c++/4.8/ios:44:0,
                 from /usr/include/c++/4.8/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from 1.cc:1:
/usr/include/c++/4.8/bits/basic_ios.h:66:11: note: 'std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)' is implicitly deleted because the default definition would be ill-formed:
     class basic_ios : public ios_base
           ^
In file included from /usr/include/c++/4.8/ios:42:0,
                 from /usr/include/c++/4.8/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from 1.cc:1:
/usr/include/c++/4.8/bits/ios_base.h:786:5: error: 'std::ios_base::ios_base(const std::ios_base&)' is private
     ios_base(const ios_base&);
     ^
In file included from /usr/include/c++/4.8/ios:44:0,
                 from /usr/include/c++/4.8/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from 1.cc:1:
/usr/include/c++/4.8/bits/basic_ios.h:66:11: error: within this context
     class basic_ios : public ios_base
           ^
In file included from /usr/include/c++/4.8/fstream:38:0,
                 from 1.cc:1:
/usr/include/c++/4.8/istream:795:11: error: use of deleted function 'std::basic_ostream<char>::basic_ostream(const std::basic_ostream<char>&)'
     class basic_iostream
           ^
In file included from /usr/include/c++/4.8/istream:39:0,
                 from /usr/include/c++/4.8/fstream:38,
                 from 1.cc:1:
/usr/include/c++/4.8/ostream:58:11: note: 'std::basic_ostream<char>::basic_ostream(const std::basic_ostream<char>&)' is implicitly deleted because the default definition would be ill-formed:
     class basic_ostream : virtual public basic_ios<_CharT, _Traits>
           ^
/usr/include/c++/4.8/ostream:58:11: error: use of deleted function 'std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)'
In file included from /usr/include/c++/4.8/fstream:38:0,
                 from 1.cc:1:
/usr/include/c++/4.8/istream:795:11: error: use of deleted function 'std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)'
     class basic_iostream
           ^
In file included from 1.cc:1:0:
/usr/include/c++/4.8/fstream:776:11: error: use of deleted function 'std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)'
     class basic_fstream : public basic_iostream<_CharT, _Traits>
           ^
/usr/include/c++/4.8/fstream:776:11: error: use of deleted function 'std::basic_filebuf<char>::basic_filebuf(const std::basic_filebuf<char>&)'
/usr/include/c++/4.8/fstream:72:11: note: 'std::basic_filebuf<char>::basic_filebuf(const std::basic_filebuf<char>&)' is implicitly deleted because the default definition would be ill-formed:
     class basic_filebuf : public basic_streambuf<_CharT, _Traits>
           ^
In file included from /usr/include/c++/4.8/ios:43:0,
                 from /usr/include/c++/4.8/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from 1.cc:1:
/usr/include/c++/4.8/streambuf:802:7: error: 'std::basic_streambuf<_CharT, _Traits>::basic_streambuf(const std::basic_streambuf<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits<char>]' is private
       basic_streambuf(const basic_streambuf& __sb)
       ^
In file included from 1.cc:1:0:
/usr/include/c++/4.8/fstream:72:11: error: within this context
     class basic_filebuf : public basic_streambuf<_CharT, _Traits>
           ^
make: *** [1] Error 1

A: The auto var = Type{...}; syntax requires Type to be move-constructible, but gcc did not implement movable fstreams until GCC 5.1. Your code compiles with GCC 5.1.

A: If I'm not wrong that advice comes from Herb Sutter.
Apparently, the problem is due to the fact that you cannot copy-construct std::fstream (std::fstream's copy constructor is marked as delete). However, intuitively one would say that, since you have a temporary on the right-hand side, the move-constructor rather than the copy-constructor should be used.
In fact, the following compiles fine on clang (clang++ -std=c++11, OS X Mavericks):
#include <iostream>
#include <fstream>

int main() {

auto log = std::fstream{"test.cpp", std::fstream::out};

}


text:
Q: numpy pickle data exchange with C++ Eigen or std::vector I am writing numpy data to sqlite database with pickling.
Is there anyway to read this pickle from c++ to EigenMatrix or std::vector ?
Best

A: You can either use Boost Libraries or the specifically designed cross-language library Picklingtools.
Edit: you can find an example to the latter one on this post.


text:
Q: How does Matlab implement knnclassify? Anyone have any idea how knnclassify is implemented in Matlab? I was wondering if they use a kd-tree for efficient distance computations. Any ideas?

A: I think the matlab documentation related to this is very clear. However your question about ... use a kd-tree for efficient distance computations is not quite so clear.
I mainly mean who cares, but if you do; then do some timings between alternatives.
Anyway the question with 'rules'-parameter is way much more complicated, than just finding out some simple kd-tree usage. So please really try to time your operations first and if they are not sufficient somehow, I'll surely be able to fine tune them for you then!


text:
Q: WPF - Tabcontrol - Tab Item with DataGrid jumps if I switch tabs In the below WPF XAML I have a tab control with 3 tabs, the content in the second tab jumps while switching tabs. If I comment out the DataGrid markup and try it works without any issue. Not sure If it's causing because of DataGrid.
<Border Background="GhostWhite" Name="SPCBorder" BorderBrush="Gainsboro" Grid.Row="2" Grid.Column="2" Visibility="{Binding Path=ButtonSPCVisibility}">
  <StackPanel Orientation="Vertical">
    <Grid>
      <TabControl Style="{StaticResource TabControlStyleSPC}" Margin="10">
        <TabItem Style="{StaticResource TabItemStyleSPC}">
          <TabItem.Header>
            <StackPanel Orientation="Horizontal">
              <TextBlock Text="Search SPC"/>
            </StackPanel>
          </TabItem.Header>
          <Grid>
            <Grid.RowDefinitions>
              <RowDefinition Height="*"/>
              <RowDefinition Height="*"/>
              <RowDefinition Height="*"/>
              <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            Deal Number:
            <TextBox Height="30" Name="SPCSearchDealNumTextBox" Grid.Row="1"
                     Width="180" HorizontalAlignment="Left" Margin="15,0,0,10"
                     Text="{Binding DealNumSPC}"/>
            <Button Content="Search SPC" Grid.Row="2" Grid.ColumnSpan="2"
                    HorizontalAlignment="Center" Width="110" Height="30"
                    FontWeight="Bold" Name="btnSPCSearch"
                    Command="{Binding AddSPCDeals}" Margin="0,10,0,10"/>
            <ScrollViewer Grid.Row="3" Grid.ColumnSpan="2" CanContentScroll="True"
                          HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
                          Margin="25,15,10,20" >
              <DataGrid Name="SPCSearchDataGrid" FontFamily="Calibri" Height="350"
                        ItemsSource="{Binding DealsAddedSPC, Mode=TwoWay}"
                        HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                        HeadersVisibility="Column" Background="White" FontSize="15"
                        GridLinesVisibility="None" AutoGenerateColumns="False"
                        IsReadOnly="True"
                        ColumnHeaderStyle="{StaticResource DataGridColumnStlye}"
                        RowStyle="{StaticResource DataGridRowStyle}">
                <DataGrid.Columns>
                  <DataGridTextColumn Header="Deal Number" Binding="{Binding DealNumber}" Width="100"/>
                  <DataGridTextColumn Header="Deal Description" Binding="{Binding DealDesc}" Width="300"/>
                  <DataGridTextColumn Header="Company Name" Binding="{Binding CompanyName}" Width="300"/>
                  <DataGridTextColumn Header="Deal BeginDate" Binding="{Binding DealBeg,StringFormat={}{0:d}}" Width="200"/>
                  <DataGridTextColumn Header="Deal EndDate" Binding="{Binding DealEnd,StringFormat={}{0:d}}" Width="200"/>
                  <DataGridTextColumn Width="200" Header="Org ID" Binding="{Binding OrgId}"/>
                  <DataGridTextColumn Width="200" Header="Customer #" Binding="{Binding EucNr}"/>
                </DataGrid.Columns>
              </DataGrid>
            </ScrollViewer>
          </Grid>
        </TabItem>
        <TabItem Style="{StaticResource TabItemStyleSPC}">
          <TabItem.Header>
            <StackPanel Orientation="Horizontal">
              <TextBlock Text="Create SPC"/>
            </StackPanel>
          </TabItem.Header>
          <Grid>
            <Grid.RowDefinitions>
              <RowDefinition Height="*"/>
              <RowDefinition Height="*"/>
              <RowDefinition Height="*"/>
              <RowDefinition Height="*"/>
              <RowDefinition Height="*"/>
              <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <GroupBox Grid.Column="0" Grid.Row="0" Grid.RowSpan="3" Grid.ColumnSpan="2" Margin="5">
              <GroupBox.Header>
                <TextBlock FontWeight="Bold" Text="Special Pricing Code - Details"></TextBlock>
              </GroupBox.Header>
              <StackPanel>
                <StackPanel Grid.Row="0" Margin="10 10 10 0" Orientation="Horizontal">
                  Customer Engagement
                  <ComboBox SelectedIndex="0" ItemsSource="{Binding CustEngagementListSPC}"
                            SelectedValuePath="CustChannelID" DisplayMemberPath="CustChannelDesc"
                            SelectedValue="{Binding specialPricingCode.CustChannelId}"
                            Height="30" Name="CustEgmtSPC" Width="250" FontSize="15" Opacity="1"/>
                </StackPanel>
                <StackPanel Grid.Row="1" Margin="10 10 10 0" Orientation="Horizontal">
                  Publication Type
                  <ComboBox SelectedIndex="0" IsTextSearchEnabled="True"
                            SelectedValue="{Binding specialPricingCode.PublicationType}"
                            SelectedValuePath="Content" Height="30"
                            Name="PublicationType" Width="250" FontSize="15">
                    <ComboBoxItem Name="pubTypeItemSelect">Select</ComboBoxItem>
                    <ComboBoxItem Name="pubTypeItem1">Listed</ComboBoxItem>
                    <ComboBoxItem Name="pubTypeItem2">Unlisted</ComboBoxItem>
                  </ComboBox>
                </StackPanel>
                <StackPanel Grid.Row="2" Margin="10 10 10 0" Orientation="Horizontal">
                  Visibility Level
                  <ComboBox SelectedIndex="0" IsTextSearchEnabled="True"
                            SelectedValue="{Binding specialPricingCode.VisibilityLevel}"
                            SelectedValuePath="Content" Height="30"
                            Name="Visibilitylevel" Width="250" FontSize="15">
                    <ComboBoxItem  Name="VisibilitylevelSelect">Select</ComboBoxItem>
                    <ComboBoxItem  Name="VisibilitylevelItem1">External</ComboBoxItem>
                    <ComboBoxItem  Name="VisibilitylevelItem2">Internal</ComboBoxItem>
                  </ComboBox>
                </StackPanel>
              </StackPanel>
            </GroupBox>
            <GroupBox Grid.Row="4" Grid.Column="0" Margin="5 5 0 5">
              <GroupBox.Header>
                <TextBlock FontWeight="Bold" Text="Assignment Type - Deal Inclusion"></TextBlock>
              </GroupBox.Header>
              <StackPanel Grid.Column="0">
                <StackPanel Margin="10 10 10 0" Orientation="Horizontal">
                  Geo Code:
                  <ComboBox Height="30" Width="250" FontSize="15"
                            Opacity="1" Name="DealInclusionGeoCodeCombo"
                            IsTextSearchEnabled="True" IsEditable="True" HorizontalAlignment="Left"></ComboBox>
                </StackPanel>
                <StackPanel Margin="10 10 10 0" Orientation="Horizontal">
                  Customer Code:
                  <ComboBox Height="30" Width="250" FontSize="15" Opacity="1"
                            Name="DealInclusionCustCodeCombo" IsTextSearchEnabled="True"
                            IsEditable="True" HorizontalAlignment="Left"/>
                </StackPanel>
                <StackPanel Margin="10 10 10 0" Orientation="Horizontal">
                  Program Code:
                  <ComboBox Height="30" Width="250" FontSize="15" Opacity="1"
                            Name="DealInclusionPrmCodeCombo" IsTextSearchEnabled="True"
                            IsEditable="True" HorizontalAlignment="Left"/>
                </StackPanel>
                <StackPanel Margin="10 10 10 0" Orientation="Horizontal">
                  Local Code:
                  <ComboBox Height="30" Width="250" FontSize="15" Opacity="1"
                            Name="DealInclusionLocalCodeCombo"
                            IsTextSearchEnabled="True" IsEditable="True"
                            HorizontalAlignment="Left"/>
                </StackPanel>
              </StackPanel>
            </GroupBox>
            <GroupBox Grid.Row="4" Margin="5 5 0 5" Grid.Column="1">
              <GroupBox.Header>
                <TextBlock FontWeight="Bold" Text="Assignment Type - Deal Exclusion"></TextBlock>
              </GroupBox.Header>
              <StackPanel>
                <StackPanel Margin="10 10 10 0" Orientation="Horizontal">
                  Geo Code:
                  <ComboBox Height="30" Width="250" FontSize="15" Opacity="1"
                            Name="DealExclusionGeoCodeCombo" IsTextSearchEnabled="True"
                            IsEditable="True" HorizontalAlignment="Left"/>
                </StackPanel>
                <StackPanel Margin="10 10 10 0" Orientation="Horizontal">
                  Customer Code:
                  <ComboBox Height="30" Width="250" FontSize="15" Opacity="1"
                            Name="DealExclusionCustCodeCombo" IsTextSearchEnabled="True"
                            IsEditable="True" HorizontalAlignment="Left"/>
                </StackPanel>
                <StackPanel Margin="10 10 10 0" Orientation="Horizontal">
                  Program Code:
                  <ComboBox Height="30" Width="250" FontSize="15" Opacity="1"
                            Name="DealExclusionPrmCodeCombo" IsTextSearchEnabled="True"
                            IsEditable="True" HorizontalAlignment="Left"/>
                </StackPanel>
                <StackPanel Margin="10 10 10 0" Orientation="Horizontal">
                  Local Code:
                  <ComboBox Height="30" Width="250" FontSize="15" Opacity="1"
                            Name="DealExclusionLocalCodeCombo" IsTextSearchEnabled="True"
                            IsEditable="True" HorizontalAlignment="Left"/>
                </StackPanel>
              </StackPanel>
            </GroupBox>
            <GroupBox Grid.Row="5" Grid.ColumnSpan="2"  Margin="5 5 0 5">
              <GroupBox.Header>
                <TextBlock FontWeight="Bold" Text="Deal Added List"></TextBlock>
              </GroupBox.Header>
              <StackPanel Orientation="Vertical">
                <Button Content="Authorize Deals" HorizontalAlignment="Right" Width="110"
                        Height="30" FontWeight="Bold" Name="btnSPCAddDeal"
                        Command="{Binding AddSPCDeals}" Margin="240,10,15,10" />
                <ScrollViewer CanContentScroll="False" HorizontalScrollBarVisibility="Auto"
                              VerticalScrollBarVisibility="Auto" Margin="25,15,10,20">
                  <DataGrid Name="SPCDealsDataGrid" FontFamily="Calibri"
                            SelectionMode="Extended" Height="350"
                            ItemsSource="{Binding DealsAddedSPC, Mode=TwoWay}"
                            HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HeadersVisibility="Column"
                            Background="White" FontSize="15"
                            GridLinesVisibility="None" AutoGenerateColumns="False"
                            IsReadOnly="True"
                            ColumnHeaderStyle="{StaticResource DataGridColumnStlye}"
                            RowStyle="{StaticResource DataGridRowStyle}">
                    <DataGrid.Columns>
                      <DataGridTextColumn Header="Deal Number" Binding="{Binding DealNumber}" Width="100"/>
                      <DataGridTextColumn Header="Deal Description" Binding="{Binding DealDesc}" Width="300"/>
                      <DataGridTextColumn Header="Company Name" Binding="{Binding CompanyName}" Width="300"/>
                      <DataGridTextColumn Header="Deal BeginDate" Binding="{Binding DealBeg,StringFormat={}{0:d}}" Width="200"/>
                      <DataGridTextColumn Header="Deal EndDate" Binding="{Binding DealEnd,StringFormat={}{0:d}}" Width="200"/>
                      <DataGridTextColumn Width="200" Header="Org ID" Binding="{Binding OrgId}"/>
                      <DataGridTextColumn Width="200" Header="Customer #" Binding="{Binding EucNr}"/>
                    </DataGrid.Columns>
                  </DataGrid>
                </ScrollViewer>
                <Button Content="Save SPC" HorizontalAlignment="Right" Width="100"
                        Height="30" FontWeight="Bold" Name="btnSaveSPC"
                        Command="{Binding SaveSPC}" Margin="240,10,15,10"/>
              </StackPanel>
            </GroupBox>
          </Grid>
        </TabItem>
        <TabItem Style="{StaticResource TabItemStyleSPC}">
          <TabItem.Header>
            <StackPanel Orientation="Horizontal">
              <TextBlock Text="Inclusion-Exclusion"/>
            </StackPanel>
          </TabItem.Header>
        </TabItem>
      </TabControl>
    </Grid>
  </StackPanel>
</Border>

UPDATE: I have added styles of Tab Control and Tab Item