text:
Q: remove parent node while preserving child node in jsoup Consider this sample code-

<outer-tag> Some Text <inner-tag> Some more text</inner-tag></outer-tag>

I want to get the following output -

<inner-tag> Some more text</inner-tag>

How do I achieve this? Thanks!

A: This solution will work for your current example:
String html = "
"
                + "<outer-tag> Some Text <inner-tag> Some more text</inner-tag></outer-tag>"
                + "
";

Document doc = Jsoup.parseBodyFragment(html);

for (Element _div : doc.select("div")) {

    // get the unwanted outer-tag
    Element outerTag = _div.select("outer-tag").first();

    // delete any TextNodes that are within outer-tag
    for (Node child : outerTag.childNodes()) {
        if (child instanceof TextNode) child.remove();
    }

    // unwrap to remove outer-tag and move inner-tag to child of parent div
    outerTag.unwrap();

    // print the result
    System.out.println(_div);
}

Result is:

 <inner-tag>
    Some more text
 </inner-tag>


text:
Q: How to do per number sort the digits (java) If i input 1324,3591
It mean i want the bigger denote in order.
int x = 1324;
int y = 3591;
System.out.println(x+y);

I want the output show:

4321 and 8531
int num = x;
char[] digits = Integer.toString(num).toCharArray();
Arrays.sort(digits);

 System.out.println(digits);
      }

but i want use %04d to make output be 4 digit but if i change to prinf it can't run....

A: You could just sort the number based on their digits.
int num = 1234; //suppose.
char[] digits = (""+num).toCharArray();
Arrays.sort(digits);
System.out.println(new StringBuilder().append(digits).reverse());

redpajama_set_name: RedPajamaStackExchange


text:
Q: Events organized vertically in Week view and horizentally in Month view After playing around with fullcalendar for a large project, i figured out that fullCal sorts events vertically in Week view (check the bottom view of the attached image) and horizontally in Month view (attached image top).
They are all supposed to be sorted horizontally in week view as well.
How can we get them sorted horizontally in week view as well ?
Thanks

A: If you want them all to be horizontal than use the basicWeek view not the agendaWeek view


text:
Q: close excel file during the display for the update i read the data from excel sheet to display it, i need to do some update in the excel every 4 hours for that i need that the excel sheet run only with the web app and closed after the display.
this is my controller:
 //Read data from Total ProdPlan excelSheet
            string path4 = "D:/Project/TProdPlan.xlsx";

        Excel.Application application4 = new Excel.Application();
        Excel.Workbook workbook4 = application4.Workbooks.Open(path4);
        Excel.Worksheet worksheet4 = workbook4.ActiveSheet;
        Excel.Range range4 = worksheet4.UsedRange;
        List<TProdPlan> ListTProdPlan = new List<TProdPlan>();
        for (int row = 2; row <= range4.Rows.Count; row++)

        {
            TProdPlan S = new TProdPlan();
            S.Num= (((Excel.Range)range4.Cells[row, 1]).Text);
            S.stat = (((Excel.Range)range4.Cells[row, 2]).Text);

            ListTProdPlan.Add(S);

        }

        ViewBag.ListTProdPlans = ListTProdPlan;

A: with this code i can close the excel sheet from the process after access to the data.
workbook.close(0);
application.Quit();


text:
Q: Confusion about FreeBSD jail being up to date (or not) I'm new to FreeBSD system administration and I'm a little confused about keeping jails up to date. Different commands seem to give conflicting information:

*

*After sudo pkg -j 18 upgrade, re-running sudo pkg -j 18 upgrade --dry-run tells me Your packages are up to date. So far so good.

*sudo pkg -j 18 audit -F however will tell me 15 problem(s) in 5 installed package(s) found. Since we previously established that all packages are up to date, how can that be? Does that mean the listed vulnerabilities are known but not patched yet?

*To make things even more confusing sudo pkg -j 18 version -vRL= | grep 'needs updating' tells me there are two packages that need updating.
What's the truth?


text:
Q: IntelliJ & MAC and Java 1.8 -- How when 1.6 seems to be default. Can't change? I am a MAC newbie - just recently was handed a mac at a new job. Anyways, I have IntelliJ installed and the default Java 1.6. Ok -- but I want to use Java 1.8 for all my projects. So, when I open IntelliJ and try to add a new SDK -- I can't or lets say _ "I have NO idea how".
My MAC: 10.9.5
When I run java -version, I get: 1.6
which Java: usr/bin/java
When I open 'spotlight' -> System Preferences -> Java -> Java Tab -> view ->
I get:
platform: 1.8 ,
product: 1.8.0_25,
path: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
When I look under my "versions": System/Library/Versions... I only see: 1.5, 1.6
So, to be honest - I am very confused :-)
Any help on getting this 1.8 to be "seen"

A: You need to install the full Java SE Development Kit.
What you have at the moment is merely the Java plugin.


text:
Q: how to call two view from same function in controller on different state using codeigniter php I want to call two different views from same function (function index) in controller,
i have passed one argument(an id) to index function that time i want to show all the list of blog when id's value is null and if i get an id then i want to show only one blog that's id is in url.
And i have successfully done this but i shown a warning
A PHP Error was encountered
Severity: Warning
Message: Missing argument 1 for blog::index()
Filename: controllers/blog.php
Line Number: 5
So please help me to get out from this situation.
my code :-
class blog extends CI_Controller{

function index($url)
{
    $this->load->model('blog_model');
    $url = $this->uri->segment(1);
    $data['blog_details'] = $this->blog_model->getBlog($url);
    $data['blog_comment'] = $this->blog_model->getComment($url);
    $data['blog_all'] = $this->blog_model->getBlogAll();
    $this->load->view('blog',$data);
} }

A: I think you better define a default value for the variable you are expecting to get:
function index($url = NULL){

This will make your function to set the $url as NULL in case there was not argument passed to the function in the URL.
function index($url = NULL)
{
    $this->load->model('blog_model');
    //$url = $this->uri->segment(1);
    $data['blog_details'] = $this->blog_model->getBlog($url);
    $data['blog_comment'] = $this->blog_model->getComment($url);
    $data['blog_all'] = $this->blog_model->getBlogAll();
    $this->load->view('blog',$data);
}


text:
Q: Meaning of reverse newlyweds? "The station doors open, and every officer in the building files down the stairs and forms a line on either side of me [Amy], holding the press back, creating an honor guard for me, and Rhonda and I run in holding hands like reverse newlyweds, rushing straight up to my parents who are waiting just inside the doorway"...
After you have married in church you usually rush out of the "doorway" to walk down the stairs of the church while your family and friends are cheering, hence the reverse? Am I way off?


text:
Q: Replacing null values with join I have two tables
      Table1:                                Table2:
ID:      Type:     Amount:               ID:       Amount:
165      Red         300                 188       425
167      Red         100                 189       500
168      Blue        250                 222       129
188      Grey        NULL                333       247
189      Grey        NULL                369       328

I am trying to replace the null values from table 1 by joining on table 2.
My code results in two amount columns.
LEFT JOIN table2
ON table2.pk = table1.pk
AND table1.Type IS NULL

A: I think you want:
select t1.id, t1.type, coalesce(t1.amount, t2.amount)
from table1 t1 left join
     table2 t2
     on t1.id = t2.id;

A: Hope this helps for your needs
select t1.id,t1.type,isnull(t1.amount,t2.amount) 'Amount' from table1 t1 left join  table2 t2 on t1.id = t2.id

you can use isnull() function so that if the first table amount is null then it will take second table value.


text:
Q: PhP Session Destruction not as eXpected I have added this code to  the top of  my page and it is executed when a user login.
<?php
$lifetime=86400;session_start();setcookie(session_name(),session_id(),time()+$lifetime,"/","","TRUE","TRUE");
?>

My intention is to increase the session life time to +1 day since the last access.
But for some reason this is not working, session expires after an indefinite x amount of time even though my browser indicates that the session will expire +1 day when i check the  console.
I am running my web application on apache and an ubuntu environment.
By doing a few search in my info.php file i found this as my local value
session.cookie_lifetime 0
session.gc_divisor  1000
session.gc_maxlifetime  86400
session.gc_probability  1

To my best of knowledge i think ubuntu is doing gabbage collection in the /var/lib/php/sessions folder with cron jobs because i am using windows as a   development environment and i don't see any of that happen.
my question is. Have i done anything wrong or am i right to say ubuntu is doing gabbage collection,so it will be advisable to change the session.save_path and if so what is the best way to that esp allowing permissions


text:
Q: Trouble converting SQL Query into JPQL (Eclipselink) Hey guys,  I have the following query and for the life of me I can't seem to translate it into JPQL.  The working SQL is:
select * from TB_PRINT_DETAIL y inner join
(select JOB_ID,max(COPY_NUM) MAX_COPY_NUM from TB_PRINT_DETAIL  group by JOB_ID  ) x
on y.JOB_ID = x.JOB_ID and y.COPY_NUM = x.MAX_COPY_NUM

My feeble attempt at translating it is as follows:
select o from PrintDetailEntity o inner join (select o2.jobId, max(o2.copyNumber) as
maxCopyNum from PrintDetailEntity o2 group by o2.jobId ) as x on o.jobId = o2.jobId and
o.copyNum = o2.maxCopyNum where o.printSuppressionReasonEntity is null

Thanks in advance for any light you can shine!

A: If I understand your query right (select entities that have the biggest copyNumber among the entites with the same jobId), the following should work:
SELECT o
FROM PrintDetailEntity o
WHERE o.copyNumber =
    (SELECT MAX(e.copyNumber) FROM PrintDetailEntity e WHERE o.jobId = e.jobId)


text:
Q: Flash message (Stimulus) is not worked in heroku I'm working on a personal development application with Rails7+Tailwind, and I implemented the code to delete flash messages in stimulus with reference to a web article.
I'm having trouble solving the problem that Stimulus (erasing Flash messages) that was running on Local doesn't work when deployed on Heroku.
Codes of the part related to the following, so
If you have any doubts, please let me know.
Development environment.
Rails 7.0.2.4.
ruby 3.1.2p20
Error messages on heroku logs is as followings.
2022-06-02T07:51:13.858354+00:00 app[web.1]: F, [2022-06-02T07:51:13.858304 #4] FATAL -- : [a7811503-f91a-4d6e-9a5d-978744f7129b]
2022-06-02T07:51:13.858355+00:00 app[web.1]: [a7811503-f91a-4d6e-9a5d-978744f7129b] ActionController::RoutingError (No route matches [GET] "/assets/controllers/flash_controller.js"):

app/views/layouts/application.html.erb is as followings.
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>
    <%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>

    <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
    <%= javascript_importmap_tags %>
    <%= render 'layouts/shim' %>

    <title><%= page_title(yield(:title)) %></title>

      <%= render 'shared/navbar' %>
      <%= render partial: 'shared/flash' %>

        <%= yield %>
        <%= render 'shared/footer' %>

Where the part which is used stimulus.
<% flash.each do |key, value| %>
  <div data-controller="flash" class="flex items-center fixed top-5 right-5 <%= css_class_for_flash(key) %> py-3 px-5 rounded-lg">

<%= value %>

    <button type="button" data-action="flash#dismiss">
      <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
      </svg>
    </button>

<% end %>

app/javascript/controllers/flash_controller.js
import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
  connect() {
    setTimeout(() => {
      this.dismiss();
    }, 3000);
  }
  dismiss() {
    this.element.remove();
  }
}

app/javascript/controller/index.js
import { application } from "./application"

import FlashController from "./flash_controller.js"
application.register("flash", FlashController)

A: As commented by appleII717, the cause was that the folder structure used esbuild even though importmap was used.
The reference source which I copied the code of stimulus is using esbuild, but I have not noticed about that.
By modifying the folder configuration for importmap, stimulus now works even in heroku environment!
app/javascript/controller/index.js
// Import and register all your controllers from the importmap under controllers/*

import { application } from "controllers/application"

// Eager load all controllers defined in the import map under controllers/**/*_controller
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
eagerLoadControllersFrom("controllers", application)


text:
Q: How can i turn single character containting string type to Char in Haskell? I am new to Haskell. I have string containing single character for example "A" or "3". I want to turn it into character to check if it is a digit with isDigit :: Char -> Bool function. How can I turn that the string into character?
I tried:
isDigit head x
-- and
isDigit take 1 x

witch gave me errors:
Variable not in scope: isDigit :: ([a0] -> a0) -> String -> Bool and Variable not in scope: isDigit :: (Int -> [a0] -> [a0]) -> t0 -> String -> Bool

A: The function isDigit is defined in Data.Char, so you'll need to import that module.  Also, as noted in the comment, the expression isDigit head x will try to call isDigit with two arguments, head, and x.  You want to evaluate head x and pass that single argument to isDigit, so you'll need to write isDigit (head x).  The following program should work:
import Data.Char

string1 = "A"
string2 = "3"

main = do
  print $ isDigit (head string1)
  print $ isDigit (head string2)

or if you are trying to evaluate this interactively in GHCi, use:
ghci> import Data.Char
ghci> isDigit (head "A")
False
ghci> isDigit (head "3")
True


text:
Q: damaged file after using lseek function to change file position in c ( getting same size but corrupted content) I'm using lseek in my socket application to  to change the file position in case of packet drops and then  re-transmit dropped packets , so I'm changing the file position multiple times and I'm pretty sure that I'm setting position related parameters correctly. I'm getting the same file size at client side no problem with that , however the more that I change the file position the more i find myself unable to open the transmitted file.
do you have any idea why is that happening ?

A: Are you using the same compiler settings for both programs? Perhaps you have the data (byte) alignment that is not the same for each program.  Hence the size of your structs will differ, causing your seek calculations to be incorrect / different.


text:
Q: /dev/rfcomm0 goes stale, but I can see Bluetooth device is still sending data I am working with a Bluetooth sensor device on Linux. I use the standard tools to connect to it on a serial port, so:
$ sudo rfcomm connect 0
  Connected /dev/rfcomm0 to 00:07:80:93:52:3B on channel 1
  Press CTRL-C for hangup

I have a Java program that reads from /dev/rfcomm0 and processes the data. However, after a while (varying time ~1hr), I can't read any further data, but the device is still connected. I note the following:

*

*If I open the Bluetooth manager, it shows me that data is still flowing from the device

*cat /dev/rfcomm0 shows no output

*The connection, still exists. I have to manually close the connection, reconnect and restart my Java app.

So essentially, the connection, /dev/rfcomm0, seems to go stale. Is this a simple thing to fix? Will it be my app or is it to do with the serial port? What can the problem be?
Many thanks


text:
Q: jQuery UI tabs, validate before switching tabs I'm using jQuery UI tabs on a private project.
my tabs are identified like this:

tab1

tab2

tab3

    ....

All of this is working fine.
However in the content of each tab i have some forms. i need that when i click on #tab2, while #tab1 is active, do some validations in the form in #tab1, and if everything is ok show that tab.
I have this listener for the tabs
    $('a[href$="#tab1"]').click(function(){
        return false;
    });

Checked around SO and found answers telling to return false, (that didn't worked) others pointed to the official docs, but i could not apply a working solution.
How can i do it?
Edit
Here is the fiddle
Fiddle

A: From the Official documentation beforeActivate
This will trigger immediately before a tab is activated, allowing you to do your validations and allow the tab to be shown.
$( "#tabs" ).tabs({
  beforeActivate: function( event, ui ) {
    var clicked_id = ui.newPanel.attr('id');
    if (clicked_id == 'tab2' )
    {
       // Do your validations
        return false;
    }
    ....
  }
});

A: This will only go to the next tab it all the inputs in the current the are not empty:
$("a[href*='tab']").click(function(){
    if($("input[value='']").length > 0){
        return false;
    }
}

A: you can do this:
 $('#mydiv').tabs({
        activate: function(event, ui) {
            var sel = ui.newPanel.attr('id');
            if (sel == 'mydiv1' )
            {
                if(!validate()){
                    $(this).tabs({
                        active: 0
                    });
                }
            }

            if (sel == 'mydiv2' )
            {
                if(!validate()){
                    $(this).tabs({
                        active: 1
                    });

                }
            }
        }});

A: You can use beforeActivate event and check if all inputs in the old panel are filled.
Code:
$("#tabs").tabs({
    beforeActivate: function (event, ui) {
        var $emptyFields = $("input",ui.oldPanel).filter(function () {
            return $.trim(this.value) === "";
        });
        if ($emptyFields.length) return false
    }
})

Demo: http://jsfiddle.net/IrvinDominin/5ypo0xgo/


text:
Q: Code organization Matlab I write some program at Matlab. I do it in .m file. And it's 300+ strings of code now, so it became not very comfortable for reading. My idea is to use it like in C++: I want to create local functions at the end of this file and put pieces of code into them. It would be easy to read and it would consist of some logical parts.
But I faced the fact that local functions can be created only in body of other function! So I can't create this:
x = 1;
y = 2;
z = myLocalFnc(x,y);

function res = myLocalFnc (a,b)
 res = a.*b;
end

This generate error:

Function definitions are not permitted in this context.

I can do it by including the whole code into one function:
function myBigFcn
x = 1;
y = 2;
z = myLocalFnc(x,y);
end

function res = myLocalFnc (a,b)
 res = a.*b;
end

But now all the variables became local and it return to workspace nothing.
Modify input/output for this function any time I create some variable - I don't think I walk the right way... Here are described advantages and disadvantages of this method.
I know I can create function in additional .m file, save it and use in my script - OK, but a lot of them are single-operation, I don't want to create so much new files.
My question is ARE any other methods of code organizing?

A: If you really want your main thing to be a script (I don't recommend this), you can put all the other functions in separate .m files and call those from within the script.
The other option, as you've noted is to put the entire contents of your "main" part into a function at the top of your code. You can return all the necessary values via the output arguments or save them to a .mat file if you need access to them later.
As a side note, the ability to put local functions within a script (what you're trying to do) is present in R2016b which will be released later this Fall.
Update
If you want an easy way to convert your code to a function. You can easily save all variables to a struct at the end of your function automatically and just return this struct.
function output = my_script_that_is_now_a_function(inputs)

    % Do stuff

    % Now save all variables in a struct and return it
    tmpfile = tempname;
    save(tmpfile);
    output = load(tmpfile);
    delete(tmpfile);
end

A: One option, if you don't mind saving a file locally, is to restructure your code into multiple functions (all in the same file) and pass the necessary variables as output. You then have a short script which calls this function and creates the necessary variables.
For example, say your script looks like this
numPoints = 5;
a = randn(numPoints);
b = sin(a);
c = a + b;

You could restructure it to look like
function data = main()
  data.numPoints = 5;
  data.a = getA(data.numPoints);
  data.b = getB(data.a);
  data.c = getC(data.a, data.b);

function a = getA(numPoints)
  a = randn(numPoints);

function b = getB(a)
  b = sin(a);

function c = getC(a, b)
  c = a + b;

and create a script file which looks like
data = main();

You then have a struct called data which contains all of your variables. If you really want them to be contained in separate variables (i.e. not in a struct) then there are a couple of ways to do it. One is to unpack them manually,
a = data.a;
b = data.b;
c = data.c;

clear data;

Another is to save the struct, and then reload it (this has the advantage of keeping a copy of the workspace that you used for this fun of the function, for later analysis).
save('workspace.mat', '-struct', 'data');
load('workspace.mat');


text:
Q: How do I add a new, valid tag when I don't have enough reputation? I'd like to post a question on StackOverflow, but I think I should be able to tag it with java swing unit-testing fest. Poor me, there is no fest tag; There is junit and testing, I'm certainly not sure this is the right thing to do, so figure I'll start here.
Edit Question located here: When is the right time to call robot.cleanUp()

A: Go ahead and post your question, link to it here, and I'll add the fest tag for you.  (Or one of the other nice, helpful people will beat me to it.)


text:
Q: convert ed25519 private ssh key to RSA private key I'm looking to convert an ed25519 private key to an rsa private key using ssh-keygen.
I found this helpful guide but I am having trouble figuring out how to specify that the input format is ed25519 and the export format should be rsa.
I've tried a bunch of different ways trying to match the synopsis and the description of flags, but every time I try, I get "Too many arguments" error from ssh-keygen.
I'd also like to find the command to generate a public key from a ed25519 private key to verify that it works.

A: No, it can't be converted. RSA and EdDSA are not just different types of keys, these are totally different Cryptosystems. Key generation algorithms, private keys are just part of it.
All the conversion options available in ssh-keygen are usually convert one type of RSA key to another type of RSA key. e.g. converting OPENSSH RSA key to PKCS8 RSA key. Basically, that so called conversion is just packaging RSA key in different ways.

A: As mentioned in "How to generate secure SSH keys", ED25519 is an EdDSA signature scheme using SHA-512 (SHA-2) and Curve25519

The main problem with EdDSA is that it requires at least OpenSSH 6.5 (ssh -V) or GnuPG 2.1 (gpg --version), and maybe your OS is not so updated, so if ED25519 keys are not possible your choice should be RSA with at least 4096 bits.

To generate the private key:
ssh-keygen -t ed25519 -P "" -f myid_ed25519

From the private key, you can generate its public key (which has nothing to do with RSA):
ssh-keygen  -y -f myid_ed25519 > myid_ed25519.pub


text:
Q: Использование ORM Realm с RecylerView Доброго времени суток.
Осваиваю ORM Realm. Столкнулся с непонятной мне ошибкой.
Имеется класс адаптера для recyclerView, вот кусок кода
List<Dog> dogs = Collections.emptyList();

public void addDog(Dog dog) {
    dogs.add(dog);
    this.notifyDataSetChanged();
}
public RecycleViewAdapter(List<Dog> dogs) {
    this.dogs = dogs;
}

Далее, вот сам класс Dog
import io.realm.RealmObject;
    public class Dog extends RealmObject{

    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }
    @Override
    public String toString(){
       return "!!! Name - "+name+" | Age - "+age;
    }
}

Добавление новых собак в бд происходит следующим образом
public void addDog() {
    realm.executeTransaction(new Realm.Transaction() {
        @Override
        public void execute(Realm realm) {
            Dog dog = realm.createObject(Dog.class);
            dog.setName(nameDog.getText().toString());
            dog.setAge(Integer.parseInt(ageDog.getText().toString()));
        }
    });
}

, на данном этапе все ок.
После того как добавили в бд, приходит уведомление об этом, я смотрю что изменилось и пытаюсь изменить данные в адаптере RecyclerView, но тут выпадает досадная ошибка
вот код в котором приходят уведомления
final RealmResults<Dog> puppies = realm.where(Dog.class).lessThan("age", 7).findAll();
puppies.addChangeListener(new OrderedRealmCollectionChangeListener<RealmResults<Dog>>() {
        @Override
        public void onChange(RealmResults<Dog> dogs, @Nullable OrderedCollectionChangeSet changeSet) {
            int[] s = changeSet.getInsertions();
            adapter.addDog(dogs.last());
        }
    });

Ошибка возникает вот тут adapter.addDog(dogs.last());
java.lang.UnsupportedOperationException: This method is not supported by 'RealmResults' or 'OrderedRealmCollectionSnapshot'.

Получается что List dogs в конструкторе адаптара можно спокойно присваивать значение RealmResults. Но вот воспользоваться методом add у List dogs уже нельзя. Пожалуйста подскажите почему выпадает эта ошибка, как ее устранить?

A: RealmResults хранит изменяющуюся в реальном времени выборку из БД. Засим в неё и нельзя добавлять элементы, т.к. этим занимается сама БД. Вам вообще не нужно вручную добавлять что-то в список. он сам автоматически добавляет/удаляет элементы. Засим вам надо в onChange лишь уведомить адаптер о изменениях данных.
final RealmResults<Dog> puppies = realm.where(Dog.class).lessThan("age", 7).findAll();
puppies.addChangeListener(new OrderedRealmCollectionChangeListener<RealmResults<Dog>>() {
        @Override
        public void onChange(RealmResults<Dog> dogs, @Nullable OrderedCollectionChangeSet changeSet) {
            adapter.notifyDataSetChanged();
        }
    });

A: Чтобы все упростить, используйте RealmRecyclerViewAdapter. Тогда не нужно будет уведомлять об изменениях в данных. Просто работаете с базой, а список обновляется автоматически.
Пример реализации можно посмотреть здесь.


text:
Q: DOMXPath help needed I make a code that search for a specific document name (example: SZ-1000) and collect all the links what div class="box" contain.(index.php) The document name maybe contain one or two documents with an ID. (26904, 26905) It works like a charm. I get the IDs back.
But I want to list all the attachments that links contains as links.
The trick is now, there's no div element, only table or dd to specific the attachments locations.

*

*site >

*

*document name (SZ-1000)  >

*

*document(s) ID  >

*

*attachments link

I think something wrong with that section:
$xpath->query('//table[@id="content clear-block"]');
Catchable fatal error: Object of class DOMNodeList could not be converted to string in C:\AppServ\www\test\import.php on line 35

Result of var_dump($articles) in import.php;
object(DOMNodeList)#3 (0) { }
object(DOMNodeList)#3 (0) { }

My code:

index.php

$site = 'http://192.168.0.1:81/?q=search/node/SZ-1000';
$html = file_get_contents($site);
$doc = new DOMDocument();
$doc->loadHTML($html);
$xpath = new DOMXpath($doc);
$articles = $xpath->query('//div[@class="box"]');

$links = array();
   foreach($articles as $container) {
   $arr = $container->getElementsByTagName("a");
     foreach($arr as $item) {
      $href =  $item->getAttribute("href");
      $links[] = $href;
     }
}
   foreach($links as $link){
     $text = end(split('/',$value));
     echo $text."
";
     $wr_out = file_get_contents("http://127.0.0.1/test/import.php?value=".$text);
     echo $wr_out;
  }

import.php

$value = $_GET['value'];
$site = 'http://192.168.0.1:81/?q=node/'.$value;
$html = file_get_contents($site);
$doc = new DOMDocument();
$doc->loadHTML($html);
$xpath = new DOMXpath($doc);
$articles = $xpath->query('//table[@id="content clear-block"]');

$links = array();
   foreach($articles as $container) {
   $arr = $container->getElementsByTagName("a");
      foreach($arr as $item) {
      $href =  $item->getAttribute("href");
      $links[] = $href;
      echo $href;
     }
}

Thanks for your reply!
Edit:

The 'Catchable fatal error: Object of class DOMNodeList could not be
  converted to string in C:\AppServ\www\test\import.php on line 35'

error fixed:

echo $wr_out->tagName;

A: Oookay, finally i made it. Here's the solution for the after-ages.
With UTF-8 char encoding.

index.php

    <?php

// get some variables from an external source | i use it with Google spreadsheet
    $get = $_GET['get'];
    $site = 'http://192.168.0.1:81/?q=search/node/'.$get;
    $html = file_get_contents($site);

    //libxml_use_internal_errors(true);

    $doc = new DOMDocument();
    $doc->loadHTML($html);

    $xpath = new DOMXpath($doc);
    $articles = $xpath->query('//div[@class="box"]');

    if(!empty($articles)){

    $links = array();
    foreach($articles as $container) {
       $arr = $container->getElementsByTagName("a");
       foreach($arr as $item) {
          $href =  $item->getAttribute("href");
          $links[] = $href;
       }
    }
    $wr_out = "";

    foreach($links as $value){
        $text = end(split('/',$value));
        $wr_out.=file_get_contents("http://127.0.0.1/projekt/search/import.php?value=".$text);

    }

    if(empty($wr_out))
        echo "There is no document with that ID";
        else
    echo $wr_out;
    }
    else
    echo "There is no document with that ID";
    ?>

import.php

    $value = $_GET['value'];
    $site = 'http://192.168.0.1:81/?q=node/'.$value;
    $html = file_get_contents($site);

    //libxml_use_internal_errors(true);

    $doc = new DOMDocument();
    $doc->loadHTML($html);

    $elements = $doc->getElementsByTagName('tbody');
    $table = $elements->item(0);

    $rows = $table->childNodes;

        foreach ($rows as $node) {

          if($node->tagName == "tr"){

            $a = $node->firstChild->firstChild;

             foreach ($a->attributes as $attr) {
                if($attr->nodeName == "href"){
                    $value = $attr->nodeValue;
                    ?>
                        <!doctype html>

                            <title>Search</title>
                          <meta charset="UTF-8">

                                    <?=$value?> | <a href='<?=$value?>'>LINK

                        <?

                }
            }
         }
    }?>


text:
Q: How to grep with expansion of curly braces? I have a list of files that have the nomenclature yyyyMMdd. I would like to get the lsit of the files excluding a few dates. To do so I use the following command
$ ls | grep -ve 202003{04,11,23}
grep: 20200311: Is a directory
grep: 20200323: Is a directory

The command only works if I expand out the curly brace manually, spacing the option -e inbetween, i.e.
ls | grep -v -e 20200304 -e 20200311 -e 20200323

What would be a more efficient way of doing it?

A: You can't to this with shell expansion as you want to do because it will replace your single argument with multiple separate arguments (if and only if there are files or directories that match the pattern - if there is no match other undesired things can happen). However, the argument to grep is a regular expression. With extended regular expressions (the -E flag) you can do this.
$ ls | grep -vEe "202003(04|11|23)"

Do note, you don't need -e for a single search parameter, so
$ ls | grep -vE "202003(04|11|23)"

also works.

A: You may need this: ls | grep -vP "202003(04|11|23)"
If -P doesn't work, try replace it with -E.


text:
Q: Matrix multiplication in python and mysql I have a currency exchange dictionary, as follows:
exchange_rates = {'USD': 1.00000,
                  'EUR': 1.32875,
                  'GBP': 1.56718, ...}

Then I retrieve the sales information for a product, using:
SELECT price, currency FROM sales

There are perhaps a million rows, which may look like this:
- 2.99    USD
- 3.01    EUR
- etc.

How would I do matrix multiplication to get the total sum in USD?

A: Instead of getting one million rows from the database and doing the calculation in Python, give your dictionary to the database and get the database to do the calculation and send you back the result.
You can do this by making a query similar to the following:
SELECT SUM(price * exchange_rate) AS total
FROM sales
LEFT JOIN
(
    SELECT 'USD' AS currency, 1.00000 AS exchange_rate
    UNION ALL
    SELECT 'EUR', 1.32875
    UNION ALL
    SELECT 'GBP', 1.56718
    -- ...
) AS exchange
ON exchange.currency = sales.currency

A: Do
SELECT price FROM sales

then sum up all the items you get back, assuming the numbers in your table are in USD.

A: SELECT SUM(price * factor)
FROM
       (
        SELECT sales.price AS price, exchange.factor AS factor
        FROM   sales
        JOIN   exchange ON exchange.currency = sales.currency
       ) AS t

This assumes you have an exchange table


text:
Q: Returning Complex Type from Entity Framework i have stored procedure like this :
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[CustOrderHist] @CustomerID nchar(5)
AS
SELECT ProductName, Total=SUM(Quantity)
FROM Products P, [Order Details] OD, Orders O, Customers C
WHERE C.CustomerID = @CustomerID
AND C.CustomerID = O.CustomerID AND O.OrderID = OD.OrderID AND OD.ProductID = P.ProductID
GROUP BY ProductName

i am adding this SP to my Entity Model. this SP does not returning any table of database so How would i add function import of this and fill my gridview ? Please help


text:
Q: Explain the arithmetics of this trigonometrical expression $$(\frac{d_1}{2} + \frac{d_1}{2} \cdot \cos(2x))+(\frac{d_2}{2} \cdot \sin(2x)) = \frac{d_1}{2}.$$
Can someone explain how the arithmetics works here?
(My teacher has only noted that "filtration removes $\cos(2x)$ and $\sin(2x)$")

A: As has been pointed out in comments, for this equation to hold for all $x$, we need to have $d_1=d_2=0$. The reference to being removed by filtration doesn't refer to an arithmetic operation inherent in this equation, but to the application of a low-pass filter indicated in the second image linked to in a comment.


text:
Q: Nuxt environment variable exposed in Production I have a .env file with all my secret connection strings. When I build and deploy it to production environment on Azure App Service, I can see all my .env content inside /_nuxt/app.c0ab03c.js
How can I fix it? thanks!

A: I think you are using the dotenv-module from Nuxt.
If yes, then, the module takes in an option to make only a certain set of environment variables available in Nuxt's context.
E.g.
export default {
  buildModules: [
    ['@nuxtjs/dotenv', { only: ['some_env_variable_key'] }]
  ]
}


text:
Q: Spring data neo4j embedded remote shell connection not allowed I am trying to connect embedded server but always getting
Caused by: java.io.IOException: Unable to lock org.neo4j.kernel.impl.nioneo.store.StoreFileChannel@5ceccc52

This is my configuration file.
@Configuration
@EnableNeo4jRepositories
public class Neo4jConfig extends Neo4jConfiguration {

public static final Setting<Boolean> remote_shell_enabled = Settings.setting("remote_shell_enabled", Settings.BOOLEAN, Settings.TRUE);
public static final Setting<Boolean> enable_remote_shell = Settings.setting("enable_remote_shell", Settings.BOOLEAN, Settings.TRUE);
public Neo4jConfig() {
    setBasePackage("com.repo", "com.model");
}

@Bean
GraphDatabaseService graphDatabaseService() {
    return new GraphDatabaseFactory()
            .newEmbeddedDatabaseBuilder("neo.db2")
            .setConfig(enable_remote_shell, "true")
            .newGraphDatabase();

}
}

A: How are you trying to connect the shell?
Just do:
bin/neo4j-shell
No -path parameter !! As then you would start a new database on the same directory.


text:
Q: Find the area of the triangle EGB.
Through the centroid $G$ of a triangle $ABC$, a secant line is drawn, cutting sides $AB$ and $BC$. On the straight line a point $E$ is considered. Calculate the area of the triangle $EBG$ if the areas of the triangles $ECG$ and $AEG$ are $20$ and $30$ respectively.
(Answer: $50$)

My progress:
I can't develop much..sorry.

I know $G$ is centroid :
$\therefore S_{\triangle ABG} = S_{\triangle AGC} = S_{\triangle BGC}.$
Also $\triangle AEG, \triangle EGC, \triangle BEG$ have the same base.
I don't see similarity of triangles.
The heights are different...
I didn't understand the function of the line
????

A: Let $D$ be the midpoint of $AC$. Drop the perpendicular lines from $A,$ $B,$ $C$ and $D$ to $\overleftrightarrow{EG}$.

Since $DD'$ is the midline of trapezium $AA'C'C$,
$$DD'=\frac{AA'+CC'}2.$$
As $G$ is the centroid,
$$\frac{BB'}{DD'}=\frac{BG}{GD}=\frac21.$$
Therefore, $BB'=AA'+CC'.$
Thus, $[\triangle BEG]=[\triangle AEG]+[\triangle CEG].$


text:
Q: Get timestamp of first day of the same month from UNIX timestamp without any conversions to local time Suppose that I have UNIX timestamp like this
1252301772

and I need to convert it to another timestamp representing the first day of the same month (without any conversions to the local time or something like this). Example:
1252301772 -> 07 Sep 2009 05:36:12 GMT
x -> 01 Sep 2009 00:00:00 GMT

A: #include <time.h>

time_t first_of_the_month(time_t t)
{
  struct tm tmt;
  if (!gmtime_r(&t, &tmt))
    return -1;
  tmt.tm_sec = 0;
  tmt.tm_min = 0;
  tmt.tm_hour = 0;
  tmt.tm_mday = 1;
  tmt.tm_isdst = -1;
  return timegm(&tmt);
}

This uses the non-standard timegm function (thanks to Jeremy Friesner for pointing that out). If that function isn't available on your platform you can use mktime but that depends on the local timezone, so you would need to adjust the program's timezone (by setting TZ in the environment and calling tzset) before and after calling mktime, which is not thread-safe because it alters global program state.


text:
Q: "cannot unpack non-iterable NoneType object" after Windows 11 update I have an auto-click program to check my office attendance.
However, this program do not work after Windows 11 update yesterday.
The part of the program code and error message (not a full code) is below:
Program:
#!/usr/bin/env python
# coding: utf-8

# In[ ]:
import pyautogui
import time

# Find and Click ERP icon
pyautogui.doubleClick('erp.png')

# Find and Click Personal button
while True:
    try:
        pyautogui.click('personal.png')
        break
    except:
        time.sleep(0.1)

Error:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
C:\Users\ADMINI~1\AppData\Local\Temp/ipykernel_11732/4182218478.py in <module>
      7
      8 # Find and Click ERP icon
----> 9 pyautogui.doubleClick('erp.png')
     10
     11 # Find and Click Personal button

Nothing is changed, including the filename and directory.
I don't understand the reason for the error.

A: It works!
The icon shape of the first png image file is changed due to Windows 11 update. I replaced the png file from the old to the new version, and it does not have any errors.


text:
Q: Display jquery dialog in parent window I have a website, that uses an iframe. The iframe itself is the content of the website. Now in the iframe I would like to use the jQuery Dialog. However when using it, the overlay and dialog is only displayed inside the iframe not on the parent. My parent html has the following html defined for the dialog:

In my iframe I am using the following javascript to create the dialog and to show it.
dlg1 = $(window.parent.document.getElementById("modalHolder"));
dlg1 = dlg1.dialog({
    width: 300,
    height: 150,
    modal: true,
    autoOpen: false,
    resizable: false,
    closeOnEscape: false,
    draggable: false,
    overlay:
    {
        backgroundColor: 'red',
        opacity: 0.65
    },
    open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});

To show the dialog I use this:
dlg1.dialog('open');

A: Because the dialog function is running within the context of the iframe, it will always create the dialog divs (like the semi transparent background div and the dialog div) as children of the iframe's . Even though you're grabbing the element from the parent document, the actual script is still running in the iframe. If you have Firefox and Firebug, you should be able to use the HTML inspector to see what's going on.
I can only think of two solutions:

*

*Use a modified version of the jQuery dialog library. I do not recommend this at all

*Move your JavaScript so that it executes within the context of the parent document.

A: There is simple and graceful solution:

*

*Include jquery and jqueryui into your parent window

*After this you can access to the parent JQuery object within iframe

For example:
var $jParent = window.parent.jQuery.noConflict();
var dlg1 = $jParent('#modalHolder');
dlg1.dialog();


text:
Q: Interpret dispersion parameter in gamma GLM? On p. 383, Fox writes that "[with a gamma GLM] the dispersion parameter is simply the inverse of the shape parameter." I am trying to understand for what distribution this applies to.   Using an intercept only model (see first analysis below) it seems that we are modeling the distribution of Y.  But when I add a very strong predictor, that is no longer true.  So I would like to what distribution is the dispersion parameter modeling?
    #example
    n = 10000
    set.seed(0)
    y = sort(rgamma(n, 5, .25))

    ###intercept only
    fit.0 = glm(y~1,Gamma)
    var(y)
    mean(fitted(fit.0))^2*summary(fit.0)$dispersion
1/summary(fit.0)$dispersion

    ###add predictor that is not too strongly related to the
      #response
    x = runif(n, 1, 9)
    fit.1 = glm(y~x,Gamma)
    summary(fit.1)
    var(y)
    mean(fitted(fit.1))^2*summary(fit.1)$dispersion
1/summary(fit.1)$dispersion

    ## sort x so that the relationship is now very strong,
    ## I can no longer
    ## compute variance from dispersion

    x = sort(runif(n, 1, 9))
    fit.2 = glm(y~x,Gamma)
    summary(fit.2)
    var(y)
    mean(fitted(fit.2))^2*summary(fit.2)$dispersion
1/summary(fit.2)$dispersion


text:
Q: C++ File Creation Help Needed!
Possible Duplicate:
How do I create a file with a user-supplied name in C++?

I was wondering how to have the user enter some text and the program create a file with the text entered by the user as the name of the file.
Thanks In Advance!!

A: http://www.cplusplus.com/doc/tutorial/files/
Also look at iostream on that same site. Just go through the tutorial and you'll have it working in no time.
There you go that should get you started. Regardless of whether this is homework or not, you want to learn to do things yourself. I'm not trying to sound rude or condescending, but if you have no desire to learn for coding, then you won't be a good coder. Simple as.
I hope you were asking for pointers on where you can learn and do things your way, rather than get us to write you the code for you.
Ray

A: Something like this would do:
#include <fstream>
#include <iostream>
#include <string>

int main()
{
    std::string filename;
    std::cout << "Enter file name: ";
    std::cin >> filename;
    std::ofstream ofs(filename.c_str());
}


text:
Q: Редирект, которого нет Здравствуйте.
Возникла уже не первый раз подобная ситуация: на сайте был редирект, допустим, такой:
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule (.*) https://название_сайта.ru/$1 [L,R=301]

Но штука такая, что редирект этот был на сайте под адресом
http://поддомен.название_сайта.ru
Как следствие, браузер меня перекидывал на основной. Но когда я этот редирект убрал - то тот-же браузер продолжает меня по этому редиректу кидать.
Это при том, что другие браузеры уже сайт на поддомене открывают корректно.
Удаление истории и др. не помогает. При чем проблема на chrome, firefox, opera, safary. Т.е. не имеет значения, че это за браузер.
Получается, что факт редиректа где-то на компе у браузера сохраняется и продолжает срабатывать. Проблема как на OS X El Capitan, так и на Windows 10.
Может быть кто-то знает, в чем проблема может быть? Подскажите, пожалуйста, как решить проблему?

A: Спасибо пользователю Vasiliy Rusin за ответ.
Сам ответ: Попробуйте на том же браузере что вызывает редирект, запустить в инкогнито, если перекидывать перестает, то вы не правильно чистите кэш браузера.


text:
Q: Command line redirection lose accents in output I want to fetch all logs from my svn project and output it to a file. The problem is that sometimes the notes are written in french and have accents "é",  "à", etc.
When I use this command:
svn log svn://mysvnserver/mysite/trunk

the ouput in the dos window is fine. The accents are present.
But when I redirect the output to a file like this
svn log svn://mysvnserver/mysite/trunk > C:\releaseNotes.txt

all accents are lost, why?
I even force the file to be in utf-8 but as soon as I run the command line the file is forced back to ANSI making the accents unreadable.
What should I do?

A: First of all, the Subversion command-line client has plenty of problems with display and handling of non-ASCII characters on Windows. The authors consider it not too big a problem, because apparently whoever needs to handle more than ASCII is a moron, especially if they're on Windows. It manifests itself in strange ways at times:
S:\Joey\Wikipedia Work\Flags>svn log "Flag of Čáslav.svg"
svn: 'Flag of Cáslav.svg' is not under version control

... even though the file is in the repository. Quite a while back the authors gave up on actually supporting non-ASCII characters and instead chose to ignore/fix the issue by converting everything into ASCII/Latin 1 by stripping accents, etc. (note the Č vs. C in the example above) to side-step display problems. I can try finding the bug report that was closed that way again but it's been a while.
EDIT: Using cmd /u does not work; the redirected file still has only CP1252 encoding.
I am still trying to coax TortoiseSVN into writing such a file but without much success so far, even though I succeeded in opening the log window.
Aaah, what you can do, however, is to use the --xml option and then parse the XML to get the data you want. The XML file uses UTF-8 encoding and doesn't mangle characters. It's more complicated, though, but if you have PowerShell at your disposal, it should be fairly easy to replicate the normal output based on the XML.

A: Doyou know about chcp DOS-command?
Use it (with correct charset) before svn log in bat-file


text:
Q: Unable to add documents into DB with user - "You are not a server admin" I'm having issues with the users I've created being able to actually submit anything into the DB I've listed them under.  I've followed the steps listed here (Creating regular users in CouchDB) and reviewed countless pages of documentation trying to sort this out.  (Ex: http://wiki.apache.org/couchdb/Security_Features_Overview).
I'm using v1.5 and trying to set the user "testAdmin" as the admin for the "test" DB.  superadmin, in this is my admin account created through the futon interface.
If I check the security document I can see my permissions there that should allow the testAdmin user to access the DB:
curl -X GET http://superadmin:1234@localhost:5984/test/_security

response:
   {
      "admins":
         { "names":["testAdmin"],
           "roles":[]
         },
      "readers":
         { "names":["testUser"],
           "roles":[]
         }
    }

Then if I run this, I get "You are not a server admin."
curl -X PUT http://testAdmin:5678@localhost:5984/test/ -d '{"abc": "def"}'

response:
{"error":"unauthorized","reason":"You are not a server admin."}

I've tried switching the user to a reader, I've also tried using the other user I've created that's currently listed as reader, and I keep encountering the same error.
Edit:  I'm able to log in to Futon with the users I've created just fine, and their permissions all appear to be working fine within Futon, but I'm still unable to use curl successfully.

A: You're trying to create a database instead of creating a document. If you want to create document without predefined ID - use POST request instead.

A: Using

curl

curl -u USER:PASS -X PUT "http://host:port/db_target" -d '{...}'

This may have been the resolution to the initial question.

A: It's worth adding that Fauxton often "forgets" its authentication if you leave it open and doesn't realize it, failing in odd ways until you reload the page and it realizes you need to log in again.
Short story shorter I was having a similar problem and just needed to re-authenticate to resolve it.

A: @Kxepal has already solved the problem. So just to make it clear this is what is happening.
You have a superadmin who in couchdb terms is a server admin and can do anything. He/She can create databases, delete them, get any document etc.
Then you have other users who have privileges assigned to them by you. So when you created that _security document what you did was tell couchdb that dbadmin was the administrator of the database and dbreader was a member of the database. From futon this is the definition of admin and members

Database admins can update design documents and edit the admin and member lists.
Database members can access the database. If no members are defined, the database is public.

Once you define an admin or a member your database ceases to be public. Only users with sufficient privileges can access them.
With your request as @Kxepal pointed out you tried to create a database. A database admin can't create a database. That right belongs to the server admin, in your case superadmin.


text:
Q: Word that means "the opposite of what you would expect" I'm looking for a word that means the opposite of what one would expect. This word might be used to express the surprise that a teenager's grandmother uses text messaging much more than he does, or that a city seems brighter at night than it does during the day.
I'm not seeking the word ironic or irony which refer to the use of something to describe its opposite experience or emotion.

A: "Contradictory" or "contrary" is perhaps the best word I can think of to describe the situation you are trying to describe.  An opposite and unexpected conclusion.
The antithesis of something is also the exact opposite of what you are referring to, or in opposition of what you are referring to.  So if you had an expected reaction, and the reaction were the exact opposite, you could say it was the 'antithesis' of what you expected.
You could do the same thing just using the word "opposite", actually.
If you don't mind making the statement that the result was impossible, you could also call it a paradox, meaning that the statement should be false, but is nontheless true.  I wouldn't recommend this though, as it requires a very precise use of the word.

A: *

*shocking

*unforeseen

*remarkable

*unanticipated

*abnormal

*astonishing

*astounding (THEAO)

A:
Counterintuitively, the teenager's grandmother uses text messaging much more than he does.
counterintuitive - contrary to what intuition or common sense [or expectation] would indicate.

Potential differences between counterintuitive and unexpected are...

1: Normally, only "facts" or "conclusions" (not "events") are described as counterintuitive.
2: Normally, counterintuitive implies that you actually expect an "opposite" scenario to be true.
3: Something can be unexpected even if you hadn't previously given any thought to the possibility of it happening. Thus, the doorbell can ring unexpectedly late at night, but probably not counterintuitively.

A: The term anomaly means

something that deviates from what is standard, normal, or expected:
there are a number of anomalies in the present system
[with clause]:
  the apparent anomaly that those who produced the wealth were the poorest

Anomaly may be used in circumstances that deviate, but are not necessarily opposite.

A: You also might want to consider "improbably:"
Improbable: unlikely to be true or to occur; also: unlikely but true or real.
E.g.

Today, improbably enough, the frequent characterization of North Korea as a Stalinist or hard-line communist nation appears to be having a calming effect...
Improbably, the tiger survives.
Improbably, the US Dollar strengthens.
Improbably, the teenager's grandmother uses text messaging much more than he does.

Other adverbs that could work for you are "unbelievably" and "incredibly."
Unbelievable: too improbable to be believed.

Unbelievably, the surgery has no apparent effect on personality or memory.
Unbelievably, the teenager's grandmother uses text messaging much more than he does.

Incredible: too extraordinary and improbable to be believed.

Incredibly, the grandmother agrees with him and is ready to hand the kid over to him.
Incredibly, the teenager's grandmother uses text messaging much more than he does.

"Surprisingly" could do the trick also.
Surprising: unexpected or unusual: causing surprise.

Surprisingly, the teenager's grandmother uses text messaging much more than he does.

A: Perhaps this is what you're searching for? My google search came up with this website first, and then this wikipedia article.
An auto-antonym (sometimes spelled autantonym), or contronym (also spelled contranym), is a word with a homograph (another word of the same spelling) which is also an antonym (a word with the opposite meaning). An auto-antonym is alternatively called an antagonym, Janus word (after the Roman god), enantiodrome, self-antonym, antilogy, or addad (Arabic, singular didd).[2][3] It is a word with multiple meanings, one of which is defined as the reverse of one of its other meanings. This phenomenon is called enantiosemy,[4] enantionymy or antilogy.
http://en.wikipedia.org/wiki/Auto-antonym

A: We can call it as Paradoxical Reaction which means a medicine which is used to reduce pain increases the pain when it is consumed.
another words may be exclaimed, astonished or shocked, almost next to impossible...

A:
The city is bright during the day, though conversely, it seems even brighter at night.

'Conversely' could fit well, depending on how you structure the sentence.

Jane the teenager sent texts very often, as is typical of girls her age, though conversely, her grandmother sent even more texts than her.

A: I might say those cited outcomes (gran using text talk) were 'refreshing', but probably not what you're looking for...

A: How about the word startling? (adjective)
very surprising, astonishing, or remarkable.
synonyms:   surprising, astonishing, amazing, unexpected, unforeseen, staggering, shocking, stunning.

A: Perversely, his grandmother uses text-messaging more often then he. Rather, "it is perverse that..." would be a better sentence construction.
also:  It is abnormal that...
Weird would also suffice.

A: I think the word you were looking for was 'sarcasm' or the statement was 'sarcastic'

A: Parodoxically, ironically, or counterintuitively  are the words that come to mind.


text:
Q: how to make the test case pass while using data driven in selenium c# I have c# code like the following to loop through rows to get new code in this case the loop not finished but code created
 for (int i = 1; i < 100; i++)
 {
      driver.FindElement(By.Id("Code"))
          .SendKeys(data.ExcelFile(i, 1));

      driver.FindElement(By.Id("Code")).Click();
  }

I try to use break with if statement and assertion but not work
how can I make the test pass also

A: Please structure your questions better as it is hard to understand what you are wanting.
In saying that you should be using a foreach loop, with your current setup you are relying on the fact there will always be <100 rows within your excel spreadsheet.
Using the foreach loop will exit the loop once all rows have been 'processed'
In regards to how you can make tests pass? You can't make tests pass, tests will pass if the assertion is successful


text:
Q: Deserializing json with nested dictionary I've gotten pretty far but ran into wall with this. Have JSON coming from a web API I am using.
Here is the Json string (or at least the first part)
{
  "id": "065f1b17-0b2c-47c1-9674-c2bfda8c05bc",
  "number": "167",
  "title": "SSF-5003 MC Checklist HVAC",
  "status": "open",
  "description": null,
  "shared": false,
  "items":
  [
    {
      "id": "a31a2f92-e948-4563-809e-6faed67e5db3",
      "description": "Project Number",
      "type": "text-area",
      "comment": null,
      "issue": null,
      "response": {
        "value": "Az001",
        "responded_by": {
          "id": "1208055465",
          "organization": {
            "id": "1207960635",
            "name": "xxxxxxxxx",
            "trading_name": "xxxx"
          },
          "first_name": "Brett",
          "last_name": "VanDyke"
        },
        "responded_at": "2017-03-02T14:45:47.924Z"
      },
      "item_number": "1",
      "photo_url": null,
      "response_options": [ ]
    },

My two classes:
Public Class HVAC
    Public Property id As String
    Public Property number As Int64
    Public Property title As String
    Public Property status As String
    Public Property description As String
    Public Property items As hvac_item()
End Class

Public Class hvac_item
    Public Property id As String
    Public Property description As String
    Public Property type As String
    Public Property item_number As Int32
    Public Property response As Dictionary(Of String, String)
End Class

Main code deserliazing the json:
json_in = File.ReadAllText(Path.GetTempPath() & "\hvac.json")
Dim hvac = JsonConvert.DeserializeObject(Of HVAC)(json_in)

If I comment out the "response" property I deserialize without any errors and see all info (except in the "response" section).
Cannot figure out how to get the dictionary information out. Think I might have to deserialize that within the hvac_item class but not sure.
Any help would be greatly appreciated.

A: These are my best guess at the classes I get from the incomplete JSON fragment provided...
Public Class HVAC
    Public Property id As String
    Public Property number As String
    Public Property title As String
    Public Property status As String
    Public Property description As Object
    Public Property _shared As Boolean
    Public Property items As Item()
End Class

Public Class Item
    Public Property id As String
    Public Property description As String
    Public Property type As String
    Public Property comment As Object
    Public Property issue As Object
    Public Property response As Response
    Public Property item_number As String
    Public Property photo_url As Object
    Public Property response_options As Object()
End Class

Public Class Response
    Public Property value As String
    Public Property responded_by As Responded_By
    Public Property responded_at As Date
End Class

Public Class Responded_By
    Public Property id As String
    Public Property organization As Organization
    Public Property first_name As String
    Public Property last_name As String
End Class

Public Class Organization
    Public Property id As String
    Public Property name As String
    Public Property trading_name As String
End Class

And to access the data....
Dim HVAC = Newtonsoft.Json.JsonConvert.DeserializeObject(Of HVAC)(IO.File.ReadAllText("\HVAC.json"))


text:
Q: HTML5 Video // Completely Hide Controls How Could I completely hide HTML5 video controls?
<video width="300" height="200" controls="false" autoplay="autoplay">
<source src="video/supercoolvideo.mp4" type="video/mp4" />
</video>

false didn't work -- how is this done?
Cheers.

A: First of all, remove video's "controls" attribute.
For iOS, we could hide video's buildin play button by adding the following CSS pseudo selector:
video::-webkit-media-controls-start-playback-button {
    display: none;
}

A: There are two ways to hide video tag controls

*

*Remove the controls attribute from the video tag.

*Add the css to the video tag
video::-webkit-media-controls-panel {
display: none !important;
opacity: 1 !important;}

A: You could hide controls using CSS Pseudo Selectors like
Demo: https://jsfiddle.net/g1rsasa3

//For Firefox we have to handle it in JavaScript
var vids = $("video");
$.each(vids, function(){
       this.controls = false;
});
//Loop though all Video tags and set Controls as false

$("video").click(function() {
  //console.log(this);
  if (this.paused) {
    this.play();
  } else {
    this.pause();
  }
});
video::-webkit-media-controls {
  display: none;
}

/* Could Use thise as well for Individual Controls */
video::-webkit-media-controls-play-button {}

video::-webkit-media-controls-volume-slider {}

video::-webkit-media-controls-mute-button {}

video::-webkit-media-controls-timeline {}

video::-webkit-media-controls-current-time-display {}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.1/jquery.min.js"></script>
<!-- Hiding HTML5 Video Controls using CSS Pseudo selectors -->

<video width="800" autoplay controls="false">
  <source src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" type="video/mp4">
</video>

A: A simple solution is – just to ignore user interactions :-)
video {
  pointer-events: none;
}

A: This method worked in my case.
video=getElementsByTagName('video');
function removeControls(video){
  video.removeAttribute('controls');
}
window.onload=removeControls(video);

A: <video width="320" height="240" autoplay="autoplay">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

A: Like this:
<video width="300" height="200" autoplay="autoplay">
  <source src="video/supercoolvideo.mp4" type="video/mp4" />
</video>

controls is a boolean attribute:

Note: The values "true" and "false" are not allowed on boolean
  attributes. To represent a false value, the attribute has to be
  omitted altogether.

A: document.addEventListener("DOMContentLoaded", function() { initialiseMediaPlayer(); }, false);

function initialiseMediaPlayer() {

    mediaPlayer = document.getElementById('media-video');

    mediaPlayer.controls = false;

    mediaPlayer.addEventListener('volumechange', function(e) {
        // Update the button to be mute/unmute
        if (mediaPlayer.muted) changeButtonType(muteBtn, 'unmute');
        else changeButtonType(muteBtn, 'mute');
    }, false);
    mediaPlayer.addEventListener('ended', function() { this.pause(); }, false);
}


text:
Q: Can refraction of the atmosphere be so high that the surface of a planet seems concave to its inhabitants? In their novel Inhabited Island by brothers Strugatsky, the inhabitants of a planet think they live on the inner surface of a giant sphere because the refraction of the atmosphere makes the surface appearing concave.
At the same time, the atmosphere is suitable for a human to breathe.
I wonder whether it is actually possible?

A: It is so possible that it actually happens on Earth, where I suppose
we are both breathing.
I think you should read the mirage page of Wikipedia (where I learned all I am saying here) as this can
actually happen on our planet. It is called a superior mirage, and
happen when you have temperature inversion, with a ground colder than
the air above.
The classical mirage that you see in the desert, or on a hot road, is
an inferior mirage due to the fact that air is hotter near the ground,
hence less dense and with a smaller refraction index than the air
above. It makes things appear lower than they are (including
apparently reflecting the sky). So it would, if anything, make the
planet appear to have a stronger curvature ...  except for the fact
that everything you see is upside down, as if reflected by the surface
of a lake.
Superior mirages are often more complex. They do make things appear
higher than they are, but they can also give images that "can be right-side up
or upside down, depending on the distance of the true object and the
temperature gradient."
What is more remarkable is that the curved trajectory of the light
rays can be such that the observer can see beyond the horizon, as
if there was a huge mirror overhead. This effect can sometimes shorten
significantly the polar winter night. It also allows seeing ships
beyond the horizon, or make them seem to be in the sky.
Still according to Wikipedia, with a temperature gradient
+12.9°C per 100 meters of elevation "horizontal light rays will just
follow the curvature of the Earth, and the horizon will appear flat".
So I guess that with a higher gradient, the planet will seem concave.
But these phenomena are usually very unstable.


text:
Q: How to dismiss a Snackbar when user interact elsewhere? How to dismiss a Snackbar when user interact elsewhere, like the way Gmail app dismiss Snackbars when user scrolls, clicks elsewhere, leaves the activity etc.
This behavior has also been mentioned in Material Design:

A: Maybe override dispatchTouchEvent in Activity.
private Snackbar mSnackbar;

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {

    if (ev.getAction() == MotionEvent.ACTION_DOWN) {
        if (mSnackbar != null && mSnackbar.isShown()) {

                Rect sRect = new Rect();
                mSnackbar.getView().getHitRect(sRect);

                //This way the snackbar will only be dismissed if
                //the user clicks outside it.
                if (!sRect.contains((int)ev.getX(), (int)ev.getY())) {
                    mSnackbar.dismiss();
                    mSnackbar == null;
                }
        }
    }

    return super.dispatchTouchEvent(ev);
}

Thanks to Eme's and gicci's comments for improvement to this. (I haven't tested this new slightly edited verstion).

A: As the guidelines that you provided in your question state:

or user interaction elsewhere (such as summoning a new surface or activity)

It does not mention anything regarding swipes or clicks while the snackbar is displayed.
In other words, so long as the user remains on the same activity the snackbar should just disappear on it's own after a timeout or if the user delibaretly swipes it off.
Also, I checked Google's Gmail app and the snackbars don't disappear if the user swipes on the same screen.


text:
Q: Dynamically Loading Page Class/Assembly: Type or name could not be found in the global namespace I am trying to create an ASP.Net Web application that stores it's "content" (ASPX/ASCX and assemblies) somewhere other than the file system (Inside a service, for example) and loads them in dynamically as required.
I have successfully created a VirtualPathProvider that takes care of reading ASPX/Master/ASCX files from alternate locations but I am running into problems when those ASPX pages Inherit a class - ie: when they have code behind.
Thanks to answers in another question I am now successfully able to load the assemblies into the application at run time. But when my the runtime attempts to compile my page I get the following error:

"Compiler Error Message: CS0400: The
  type or namespace name 'Web' could not
  be found in the global namespace (are
  you missing an assembly reference?)"
[System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
  public class default_aspx
  : global::Web.Code.CodeBehind,
  System.Web.SessionState.IRequiresSessionState,
  System.Web.IHttpHandler

I have boiled down my code to a simple example of what is going wrong so that it is easy for you to see. You can download this code here.
The assembly is being loaded in dynamically at run time using the AppDomain.AssemblyResolve event. This is in the global.asax and looks like this:
protected void Application_Start(object sender, EventArgs e)
{
    AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(Assembly_Resolve);
}

Assembly Assembly_Resolve(object sender, ResolveEventArgs args)
{
    Assembly assembly = AppDomain.CurrentDomain.Load(Resources.Web_Code);
    if (args.Name == assembly.FullName)
    {
        return assembly;
    }
    return null;
}

Any ideas?
EDIT
If for any reason you need to update the Web.Code assembly - you will need to copy it into the "ReferencedAssemblies" folder of the web project for those changes to take effect.

A: I encountered the same problem when trying to load assemblies from DB (and using the AssemblyResolve event). But it seems to work fine if you load assemblies from disk or at least save a copy of the .dll file somewhere on the disk.

A: OK. Can you try the following - remove the AssemblyResolve event. We will now use web.config runtime configuration to resolve this assemblies. In the <runtime> configuration add the following:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <probing privatePath="ReferencedAssemblies" />
</assemblyBinding>

I can't explain to myself why the two approaches - AppDomain.AssemblyResolve and this runtime AssemblyBinding give different results when dealing with PageBuildProvider. I was looking around the PageBuildProvider class to find any clues about what is happening, but still no luck. I'll probably look further into this as it got my attention and will post here if I find any solution.
Let me know if this solution with web.config file works for you. The only caveat is that you can't use resources to store your assemblies. You need to store them on the file system, any folder that is under the project one - as is currently with ReferencedAssemblies folder.


text:
Q: How to find IPV4 from hostname / worksation Name ijn VB.net Does anybody know how to grab the ipV4 of a machine connected over a LAN network in VB.NET? and output it via a textbox to look like a console window?
I have 3 text boxes, so 1 if for hostname/ws input and the second should show the ip address that had been grabbed and the 3rd to act as a console window to output CMD text
the code i currently have is:
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
        Dim textvar As String = txtWS.Text
        Dim Command As String
        Try
            Command = "Ping" & " " & txtWS.Text
            Shell("cmd.exe /k" & Command, 1, True)

            'Get IP Address of the Host
            Dim Hostname As IPHostEntry = Dns.GetHostEntry(txtWS.Text)
            Dim ip As IPAddress() = Hostname.AddressList

            txtIP.Text = ip(0).ToString
        Catch ex As Exception
            MsgBox("Unable to Ping Hostname or Workstation! Please try again, or try via IP Address." & vbCrLf & "Error: " & ex.Message, MsgBoxStyle.Critical)

        End Try
    End Sub

This works great for pinging but does not always return the right IP address i need to specify it to be the IPv4 every time and i want to output the console text in a textbox inside my app instead of the cmd window i have seen a few questions like this but nothing answered that incorporate these 2 functions


text:
Q: Assigning default filtering values for complex API request model before passing it to business domain? I am writing an API (web-service) for my customers and there is an endpoint which allows to search for the documents in my storage (files, folders) by applyingg complex filters.
Initially, client need to send the following model to my API:
public class GetFactDocumentsTableWithFilterCommand :
    IRequest<GetFactDocumentsTableCommandResult>,
    ICommandWithIdentityAttached
{
    public string FolderId { get; set; }
    public IEnumerable<FolderContentItemType> ContentType { get; set; }
    public IEnumerable<int> StatusId { get; set; }
    public IEnumerable<string> AuthorId { get; set; }
    public IEnumerable<string> ReceiverId { get; set; }
    public string DocumentNumber { get; set; }
    public string DocumentName { get; set; }
    public IEnumerable<int> DocumentTypeId { get; set; }
    public IEnumerable<FolderContentItemDirection> Direction { get; set; }
    public IEnumerable<FolderContentItemCategory> Category { get; set; }
    public DateTime ? CreatedOnFrom { get; set; }
    public DateTime ? CreatedOnTo { get; set; }
    public int ? Top { get; set; }
    public int ? Page { get; set; }
    public string OrderBy { get; set; }
    public string OrderByDirection { get; set; }
    public IdentityUserInfo IdentityUserInfo { get; set; }
}

For example, suppose API caller wants to get all documents with statuses 1,2,5, that was created during the last month and intended to be sent to the external customer and that was formed by specific author. Than the caller need to create model and apply filtering values:
var filteringRequest = new GetFactDocumentsTableWithFilterCommand()
{
    StatusId = new List<int>() {1,2,5},
    CreatedOnFrom = new DateTime(2019, 05, 01),
    CreatedOnTo = new DateTime(2019, 05, 30),
    Direction = new List<FolderContentItemDirection>() { FolderContentItemDirection.External },
    AuthorId = new List<string>() { "author-id" }
};

var response = await _documentServerProxy.GetFactDocumentsTable(filteringRequest);

Caller do not need to fill all values, so if some values for filtering is missing, I need to assign default values. I created additional private method in my server-side, in service layer:
private async Task<GetFactDocumentsTableWithFilterCommand> PopulateWithDefaultFiletringOptionsForMissingMembers(
        GetFactDocumentsTableWithFilterCommand command)
    {
        // If no FolderId provided, it means that client requested the root folder.
        if (string.IsNullOrWhiteSpace(command.FolderId))
            command.FolderId = await GetRootFolderIdForCompany(command.IdentityUserInfo.CompanyId);

        // If can't parse FolderId, it means that client requested the wrong folder, cancel operation.
        bool canParseFolderIdToGuid = Guid.TryParse(command.FolderId, out var folderIdAsGuid);
        if (canParseFolderIdToGuid == false)
            throw new ArgumentException($"Provided FolderId is not a correct GUID sequence!", command.FolderId);

        if (command.ContentType == null) command.ContentType = Array.Empty<FolderContentItemType>();
        if (command.StatusId == null) command.StatusId = Array.Empty<int>();
        if (command.AuthorId == null) command.AuthorId = Array.Empty<string>();
        if (command.ReceiverId == null) command.ReceiverId = Array.Empty<string>();
        if (command.DocumentTypeId == null) command.DocumentTypeId = Array.Empty<int>();
        if (command.Direction == null) command.Direction = Array.Empty<FolderContentItemDirection>();
        if (command.Category == null) command.Category = Array.Empty<FolderContentItemCategory>();
        if (command.CreatedOnFrom == null) command.CreatedOnFrom = DateTime.MinValue;
        if (command.CreatedOnTo == null) command.CreatedOnTo = DateTime.MaxValue;

        int defaultTopValue = _configurationManager.GetTopValue(), defaultPageValue = 1;
        string defaultOrderBy = "DocumentName", defaultOrderByDirection = "descending";

        var allowedOrderByDirections = new string [] { "descending", "ascending" };

        if (command.Top.GetValueOrDefault() == 0) command.Top = defaultTopValue;
        if (command.Page.GetValueOrDefault() == 0) command.Page = defaultPageValue;

        if (string.IsNullOrWhiteSpace(command.OrderBy)) command.OrderBy = defaultOrderBy;

        if (string.IsNullOrWhiteSpace(command.OrderByDirection) ||
            allowedOrderByDirections.Contains(command.OrderByDirection) == false)
        {
            command.OrderByDirection = defaultOrderByDirection;
        }

        return command;
    }

In method PopulateWithDefaultFiletringOptionsForMissingMembers I have a lot of default values assigning logic, for example, Array.Empty and so on, because later this model will be used for generating LINQ-to-SQL query, so no NULL values allowed.
I wonder if it is correct approach for preparing my model for later processing or should I use another options, like assigning default values in model class itself, like:
public class GetFactDocumentsTableWithFilterCommand :
IRequest<GetFactDocumentsTableCommandResult>,
ICommandWithIdentityAttached
{
   public string FolderId { get; set; } = "default-folder-id";
   // so on...
}

I have doubts with such default-values in class declaration code, because some default values will be loaded from database, so I need somehow inject database-accessing code into my model class.
Basically, I want to know, how and where to assign default values for such DTOs, if some of default values stored in configuration files (like TOP), some of them stored in database (like FolderId).


text:
Q: Problems with logback This thread solve my problem in WAR (JSF 2) project, but when project is EAR this solution dont work.
Logback and Jboss 7 - don't work together?
I am using JBOSS 7.1.
UPDATE:
I create a new JSF project in eclipse (JBoss Tools and JBOSS 7.1 runtime). Add the jars slf4j-api-1.7.5.jar, logback-core-1.0.13.jar, logback-classic-1.0.13.jar and logback-access-1.0.13.jar.
this code in bean:
@Named
public class BeanTeste {

private Logger log = LoggerFactory.getLogger(BeanTeste.class);

public void executar(){
log.debug("TESTE DE DEBUG");
log.info("TESTE DE INFO");
log.warn("TESTE DE WARN");

// print internal state
   LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
   StatusPrinter.print(lc);

System.out.println("METODO COMPLETADO!");
}

should return:
18:00:09,278 INFO  [stdout] (http--0.0.0.0-8080-1) 18:00:09.274 [http--0.0.0.0-8080-1] DEBUG com.br.teste.BeanTeste - TESTE DE DEBUG

18:00:09,280 INFO  [stdout] (http--0.0.0.0-8080-1) 18:00:09.279 [http--0.0.0.0-8080-1] INFO  com.br.teste.BeanTeste - TESTE DE INFO

18:00:09,282 INFO  [stdout] (http--0.0.0.0-8080-1) 18:00:09.282 [http--0.0.0.0-8080-1] WARN  com.br.teste.BeanTeste - TESTE DE WARN

18:00:09,284 INFO  [stdout] (http--0.0.0.0-8080-1) 18:00:09,223 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]

18:00:09,286 INFO  [stdout] (http--0.0.0.0-8080-1) 18:00:09,224 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]

18:00:09,288 INFO  [stdout] (http--0.0.0.0-8080-1) 18:00:09,224 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.xml]

18:00:09,291 INFO  [stdout] (http--0.0.0.0-8080-1) 18:00:09,225 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Setting up default configuration.

18:00:09,293 INFO  [stdout] (http--0.0.0.0-8080-1)

18:00:09,293 INFO  [stdout] (http--0.0.0.0-8080-1) METODO COMPLETADO!

but return
Exception starting filter WicketFilter: java.lang.ClassCastException: ch.qos.logback.classic.LoggerContext cannot be cast to ch.qos.logback.classic.LoggerContext

in a WAR project, I create a jboss-deployment-structure.xml file and place it in WEB-INF directory and solved my problem.
<jboss-deployment-structure>
    <deployment>
        <!-- Exclusions allow you to prevent the server from automatically adding some dependencies     -->
        <exclusions>
            <module name="org.slf4j" />
            <module name="org.slf4j.impl" />
        </exclusions>
    </deployment>
</jboss-deployment-structure>

When the WAR project is add a EAR project the problem returns.
any ideas?

A: I changed my jboss-deployment-structure.xml with the content below and it worked.
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<ear-subdeployments-isolated>true</ear-subdeployments-isolated>
<deployment>
    <exclusions>
        <module name="org.apache.log4j" />
        <module name="org.slf4j" />
        <module name="org.slf4j.ext" />
        <module name="org.slf4j.impl" />
        <module name="org.slf4j.jcl-over-slf4j" />
        <module name="org.apache.commons.logging" />
        <module name="org.jboss.logging"/>
        <module name="org.jboss.logging.jul-to-slf4j-stub"/>
        <module name="org.jboss.logmanager"/>
        <module name="org.jboss.log4j.logmanager"/>
        <module name="org.apache.log4j"/>
        <module name="org.log4j"/>
    </exclusions>
    <dependencies>
    </dependencies>
</deployment>
<sub-deployment name="Teste.war">
    <exclusions>
        <module name="org.apache.log4j" />
        <module name="org.slf4j" />
        <module name="org.slf4j.ext" />
        <module name="org.slf4j.impl" />
        <module name="org.slf4j.jcl-over-slf4j" />
        <module name="org.apache.commons.logging" />
        <module name="org.jboss.logging"/>
        <module name="org.jboss.logging.jul-to-slf4j-stub"/>
        <module name="org.jboss.logmanager"/>
        <module name="org.jboss.log4j.logmanager"/>
        <module name="org.apache.log4j"/>
        <module name="org.log4j"/>
    </exclusions>
</sub-deployment>
<sub-deployment name="TesteEJB.jar">
    <exclusions>
        <module name="org.apache.log4j" />
        <module name="org.slf4j" />
        <module name="org.slf4j.ext" />
        <module name="org.slf4j.impl" />
        <module name="org.slf4j.jcl-over-slf4j" />
        <module name="org.apache.commons.logging" />
        <module name="org.jboss.logging"/>
        <module name="org.jboss.logging.jul-to-slf4j-stub"/>
        <module name="org.jboss.logmanager"/>
        <module name="org.jboss.log4j.logmanager"/>
        <module name="org.apache.log4j"/>
        <module name="org.log4j"/>
    </exclusions>
</sub-deployment>

thanks a lot!!!!


text:
Q: It seems that auxilliary verb is omitted in this sentence
The $400m he was saving each year by making no scrap and no off-quality tiles more than paid for the R&D and the process changes.

The sentence is from an article talking about a carpet company. I think a auxiliary verb (was) should be placed just before "more than" here, so is the sentence grammartical?

A: This is indeed an odd but very common verb structure in contemporary English. It is used when the speaker wants to say that an action surpassed a threshold of some kind.  In register, it is conversational, not formal.

My dog chewed up my homework.
  -- Looks like he more than chewed it up. He appears to have devoured it! Where is it?

That is, He did more than chew it up, he devoured it.
Notice that the tense is simple past without auxiliary in more than chewed.  Rather than an omission of the auxiliary, this construction is an alternative to it.

Your work has more than met our expectations. It has surpassed them.
She more than won the race—she set a world record.
You more than passed the course you were failing early in the semester; you aced the final exam.

The construction appears also with other tenses.

With rising electricity costs, these solar panels will more than pay for themselves after ten years.

That is, they will have done more than pay for themselves after ten years; their initial acquisition cost will already have been offset by savings on your electricity bills, and thenceforward all of the savings on the energy bill will go directly into your pocket.

A: The sentence is perfectly grammatical. "The Economist" is a high-quality publication with its own well-respected style guide and a strong editorial team. If you see something unusual in The Economist, assume that it's right and try to analyze it.
Now let's get to this phrase. You could say, for example,

I worked a temp job this summer, and the money that I earned there paid for a trip to California.

Here, in the article, $400 million paid for the R&D and the process changes, and a lot of money was left over (let's say these things only cost $250 million). Thus, this money more than paid for this and that stuff.


text:
Q: Random behavior on button click at times in Android App Not sure how should I phrase it, but In my app sometimes a single button click generates multiple events and hence it ends up sending multiple similar transactions to the server which is causing data integrity problem. Here is the code flow, Do note that this code runs on users phone which may have weaker connections at times, hence I store the data in SQLite and there is a separate sync service which sends data (fetching from SQLite tables) to Server when Internet is connected.
This is where the click is captured and event is posted for Main Activity (Landing Page)
@OnClick(R.id.btn_add_attempt)
    public void onAttemptClick() {
      try{
         btnAddAttempt.setEnabled(false);
         EventBus.getDefault().post(new ExampleActionEvent());
         moveToHomePage();
      } catch (Exception e){
         e.printStackTrace();
         Crashlytics.logException(e);
      }
 }

Here is the Event subscription from my main Activity.
@Subscribe()
    public void onExampleAction(ExampleActionEvent exampleActionEvent)
    {
        if(application == null) application = (ExApplication) getApplication();

        final Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {

                ArrayList<Something> somethings = application.getArray().getsomethings();
                if (!ExUtils.validatesomethings(somethings)){
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            RiderUtils.showSimplePopup(
                                    MainLandingActivity.this,
                                    getString(R.string.title_alert),
                                    getString(R.string.alert_message),
                                    getString(R.string.done),
                                    null,
                                    false,
                                    new DialogInterface.OnClickListener() {
                                        @Override
                                        public void onClick(DialogInterface dialog, int which) {
                                            showPendingSomething();
                                            ExUtils.moveToPending(MainLandingActivity.this);
                                        }
                                          },
                                    null,
                                    false);
                        }
                    });
                    return;
                }
                status = application.getArray().getStatus();

                imageLocalPath = application.getArray().getsomethings().get(0).getPhotoPath();

                Log.d(Const.TAG, "image path is: "+imageLocalPath);

                try {
                    ExUtils.pushExampleActionEvent(application.getArray(), MainLandingActivity.this, xyz, abc);
                } catch (Exception e) {
                    e.printStackTrace();
                }

                FileWriteEvent fileWriteEvent = null;
                String currentTimestamp = application.getArray().getTimestamp();

                switch (status) {
                    case Const.UPDATE_SUCCESS:
                        fileWriteEvent = new FileWriteEvent(Const.EVENT_CSV_FILE_SUCCESS_VALUE, application.getArray(), "",
                                cachedLocation, currentTimestamp, null);
                        break;
                    case Const.UPDATE_ATTEMPTED:
                        fileWriteEvent = new FileWriteEvent(Const.EVENT_CSV_FILE_ATTEMPTED_VALUE, riderApplication.getBulkArray(), "",
                                cachedLocation, currentTimestamp, null);
                        ExUtils.showSnackbar(holder, getString(R.string.Example), Snackbar.LENGTH_LONG);
                        break;
                }

                if(fileWriteEvent != null)
                {
                    EventBus.getDefault().post(fileWriteEvent);
                }

                createAll();    //SQLite DB call for Inserting some data

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            switch (status) {
                                case Const.UPDATE_SUCCESS:
                                    RiderUtils.showSnackbar(holder, getString(R.string.Success), Snackbar.LENGTH_LONG);
                                    break;
                                case Const.UPDATE_ATTEMPTED:
                                    RiderUtils.showSnackbar(holder, getString(R.string.Failed), Snackbar.LENGTH_LONG);
                                    break;
                            }
                        }catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                });
            }
        });

        thread.start();
    }

I am not able to figure out why is it misbehaving sometimes randomly otherwise it runs smoothly, Hence I am not able to regenrate the issue while debugging.

A: So after sometimes I looked at the problem again and found out the developer who worked before me had not declared the Main Activity as SingleInstance and hence Every time if the app was opened from Notification Drawer as we were showing it in Notification drawer if app is running, then it was creating a new Activity hence registering on EventBus which was causing the issue by creating duplicate events.


text:
Q: Jetty WARs container - different class loader for the same class I have a jetty server that contains 6 wars.
for example: a.war, b.war and more..
a and b have a dependency on x jar. both of them use the same version.
I have a strange problem:
when the jetty is installed on a windows machine on C disk, everything works as expected.
when the jetty is installed on a windows machine on E disk, I get "class cast exception" in line:
LogRecord logRecord = (LogRecord) loggingEvent.getMessage().getParameters()[0]; (72).
I see that one LogRecord comes from a.war with one class loader and the second ((LogRecord) loggingEvent.getMessage().getParameters()[0]) comes from b.war with a different class loader.
I want to understand what can be the root cause. and if I have a way to avoid it.
Thanks in advance

A: Logging is tricky with isolated classloaders.
Option 1: using the Servlet spec properly

*

*Ideally, per Servlet spec, Logging should be isolated within the individual webapps.

*The LogRecord class should only come from the webapp WEB-INF/lib/ location.

*The LogRecord class should not come from the server or system classloader.

*Logging events coming from a webapp should not be handled/appended by a server level configuration file.

*Each webapp should have it's own logging configuration.

*Your server level logging should use a different logging implementation than your webapps.

Option 2: Breaking the servlet spec classloader isolation
Alternatively you can complete break the webapp classloader isolation and force the logging classes to only be picked up by the server level classloader.  This is the iron-handed approach to managing logging.
Example:
WebAppContext webapp = (WebAppContext)handler;
// System classes are classes that cannot be replaced by
// the webapps, and they are *always* loaded from the
// system classloader
webapp.getSystemClassMatcher().add("org.apache.log4j.");
webapp.getSystemClassMatcher().add("org.slf4j.");
webapp.getSystemClassMatcher().add("org.apache.commons.logging.");

// Server classes are classes that are hidden from being
// loaded by the web application using system classloader,
// so if web application needs to load any of such classes,
// it has to include them in its distribution.
// A negative pattern ("-pattern") means the class is not
// hidden from the webapp classloader.
webapp.getServerClassMatcher().add("-org.apache.log4j.");
webapp.getServerClassMatcher().add("-org.slf4j.");
webapp.getServerClassMatcher().add("-org.apache.commons.logging.");

The above can be implemented as a DeploymentManager binding so that it is applied to all webapps being deployed.
import org.eclipse.jetty.deploy.App;
import org.eclipse.jetty.deploy.AppLifeCycle;
import org.eclipse.jetty.deploy.graph.Node;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.webapp.WebAppContext;

public class CentralizedWebAppLoggingBinding implements AppLifeCycle.Binding
{
    public String[] getBindingTargets()
    {
        return new String[]
            {"deploying"};
    }

    public void processBinding(Node node, App app) throws Exception
    {
        ContextHandler handler = app.getContextHandler();
        if (handler == null)
        {
            throw new NullPointerException("No Handler created for App: " + app);
        }

        if (handler instanceof WebAppContext)
        {
            WebAppContext webapp = (WebAppContext)handler;
            webapp.getSystemClassMatcher().add("org.apache.log4j.");
            webapp.getSystemClassMatcher().add("org.slf4j.");
            webapp.getSystemClassMatcher().add("org.apache.commons.logging.");

            webapp.getServerClassMatcher().add("-org.apache.log4j.");
            webapp.getServerClassMatcher().add("-org.slf4j.");
            webapp.getServerClassMatcher().add("-org.apache.commons.logging.");
        }
    }
}


text:
Q: Wich is the most efficient/easy way for end-user to get data from Analysis database? I know that you can quey a cube by connecting from excel to Analysis database and using formulas like cubevalue() or cubemember(). I also know that after converting the power pivot to formulas you can access the attribute and the value related only by writing a text.
For example: for Branch dimension, instead writing cubemember("connections";"[DimBranch].[Name].[All].[London])", you can write in the cell only "London". However, this won't work if you have a parent-child dimension and want to retrieve the amount for one of the intermediate levels.
Does anyone know how I can avoid writing these formulas directly by the end-user? Can I pass the text "London" as a parameter?

A: You can put your cube formula in a separate cell and reference the cell where users type in the name they want.  For example, if you have users put the branch name in cell B2, you can put this formula in another cell.
=cubemember("Connection","[DimBranch].[Name].[All].[" & B2 & "])"


text:
Q: What is the equivalent of TiXmlAttribute for tinyxml2 and how to use it? I've encountered a problem that I'm not being able to solve using tinyxml2.
I have a function that receives as a parameter a XMLElement and I need to iterate over its attributes. With tinyxml, this worked:
void xmlreadLight(TiXmlElement* light){
    for (TiXmlAttribute* a = light->FirstAttribute(); a ; a = a->Next()) {
         //Do stuff
    }
}

Using the same with tinyxml2, like in the example below, I get the following error:

a value of type const tinyxml2::XMLAttribute * cannot be used to initialize an entity of type tinyxml2::XMLAttribute *

void xmlreadLight(XMLElement* light){
    for (XMLAttribute* a = light->FirstAttribute(); a ; a = a->Next()) {
         //Do stuff
    }
}

The XML code in question is:
<lights>
   <light type="POINT" posX=-1.0 posY=1.0 posZ=-1.0 ambtR=1.0 ambtG=1.0 ambtB=1.0 />
</lights>

where light is the XMLElement passed into the function xmlreadLight. Not sure if my question is properly set up, so if theres some info missing, let me know.

A: Going by the error message, it looks like you need to do:
for (const XMLAttribute* a = light->FirstAttribute(); a ; a = a->Next()) { ...
     ^^^^^

Presumbably, the return type of FirstAttribute has been made const in tinyxml2.

If you check the Github repository for the tinyxml2.h file on line 1513 you will see this:
/// Return the first attribute in the list.
const XMLAttribute* FirstAttribute() const {
    return _rootAttribute;
}


text:
Q: How to execute custom javascript or external js in AMP page on page load? I want to add integrate chatbot like "https://plan-your-trip.user.com/login/?next=/" to my mobile amp page. And what this js to execute on page load.
I have tried amp-script - but it works with some user interaction. I want JS to execute on page load.
Sample Chat bot script:
https://user.com/en/integrations/custom-script/

A: Please take a look amp-iframe, which will allow you to load your chat bot in an iframe.