text:
Q: Cursor pointer show only on header text on center of the header not full header to show the pointer I am trying to show cursor pointer only on header text not full header.
I hade tried with given - text-center but its have issue of pointer showing on where mouse over on header but my requirement show pointer only on text on the header
Mycode like this

Header Text

Please help me out

A: Try wrapping the actual text in an inline element, such as a span, and styling it's hover state:

    your text here

header span:hover {
    cursor: pointer;
}


text:
Q: How to define when you should hide "Show More" button? I have a mysql table of products.
I have a product listing page where User has a button "Show more" to load more products on the page.
After clicking on this button jQuery calculates how many displayed products are on the page (N) and makes an AJAX request to the table for getting 20 more products (N+20).
Now I should create a trigger when I should hide the button.
Which trigger I should choose? What is the best way to define that there are no products.
Please, help.

A: There are 2 ways I guess,

*

*The simple way would be counting number of response rows that's returned by your AJAX function. If it's smaller than 20 then hide the button.. However, if your records number is a multiple of 20 then there will be a glitch in the last response, because it won't hide the button.

*The perfect way is to calculate number of records in your table, then save that data in your js variable. Then compare that variable value with the number of times you ask for another record.. If they have same value then hide the button, if not then show the button.

A: I have no idea how have you reached that functionality since you are not sharing the code and thus I cannot give you the most accurate help, only this one:

*

*when loading the page and retrieving the first X rows from DB, retrieve the amount of all rows (matching the search criteria) as well

*make this count visible to the template

*in jQuery, count how many rows have you already loaded

*

*this means, that on page start you are displaying X rows, the amount of total rows is Y, and the number of currently displayed rows is Z

*immediately after the page is loaded you need to compare if Z <= Y then do not display button else display the button

*if the button was displayed I guess you are listening to click event on this button and then performing your AJAX request, here after the AJAX is successfully completed, you need to do Z += X and again compare if Z > Y then hide the button
That should be your logic, now turn it into your code.

A: It depends on the frequency of product list updating.
If the amount of products changes often (say, more than once a day or so), I would execute a query on each AJAX request, checking if I have more items (for example, checking if N+20 >= count(id) of products), and on the callback hide the button.
Otherwise, I would just inject the amount of products as a JS parameter into the page, validate against it on each click (N+20 <= count_products), and save myself some AJAX \ SQL loading time.

A: you can get the count of all lines using PHP and save it in an hidden field or in a variable after that you can test (using jquery) to see the current number of records in the page (you are already doing that ) then test it with the number in the hidden field/variable and show/hide your button

A: Finally I choose next variant:
I want to load more 20 products.
In backend code I switch this number to 21.
So then in jQuery I show just 20 BUT I check if there one more product I should NOT hide the button.
That's it.
Thanks guys anyway!

redpajama_set_name: RedPajamaStackExchange


text:
Q: Multiple file upload is not working using jQuery and Ajax and PHP I want to do multiple file upload. I tried lot but I'm not able to get the solution. Whenever I am uploading multiple images, it is taking only first image value.
formData.append('file[]', $('input[type=file]')[0].files[0]);

I am trying like this I am getting single image
formData.append('file[]', $('input[type=file]')[1].files[1]);

I am trying like this I am getting error

Uncaught TypeError: Cannot read property 'files' of undefined

$("#basicFormBtn").click(function(e){
    e.preventDefault();
    var formData = new FormData();
    var formData = new FormData($('#basicForm')[0]);
    formData.append('file[]', $('input[type=file]')[0].files[0]);
    $.ajax({
        type:'POST',
        url :"test_session.php",
        data: formData,
        cache: false,
        contentType: false,
        processData: false,
        success: function(data) {
            console.log(data);
        },
        error:function(exception){
            alert('Exeption:'+exception);
        }
    });
});

<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

Basic Form

        <form id="basicForm">

                    User Name:
                    <input type="text" class="form-control" id="userName" placeholder="Enter userName" name="userName" required="">

                    Album:
                    <input type="file" name="file" required="" multiple>

            <input type="submit" name="submit" value="submit" class="btn btn-info" id="basicFormBtn">
        </form>

I'm getting output like this (in test_session.php) with print_r($_FILES);
Array
(
    [file] => Array
        (
            [name] => Array
                (
                    [0] => 1.png
                )

            [type] => Array
                (
                    [0] => image/png
                )

            [tmp_name] => Array
                (
                    [0] => C:\xampp5.6\tmp\phpC3C0.tmp
                )

            [error] => Array
                (
                    [0] => 0
                )

            [size] => Array
                (
                    [0] => 166275
                )

        )

     )

A: Try this you will get all uploaded files.
Your old code
<input type="file" name="file" required="" multiple>

Change with this
<input type="file" name="file[]" required="" multiple>

A: that's because you not set array value to your append file input. try this :
var i=0;//set default array value
$("#basicFormBtn").click(function(e){
i++;//set next array value
e.preventDefault();
var formData = new FormData();
var formData = new FormData($('#basicForm')[0]);
formData.append('file['+i+']', $('input[type=file]')[0].files[0]);//push next array value
$.ajax({
    type:'POST',
    url :"test_session.php",
    data: formData,
    cache: false,
    contentType: false,
    processData: false,
    success: function(data) {
        console.log(data);
    },
    error:function(exception){
        alert('Exeption:'+exception);
    }
});

});


text:
Q: CMake: Copy Frameworks into App Bundle In my project directory I have some 3rd party frameworks, namely SFML, that I need to copy into the app bundle when I build my app. Any clean way to do that (maybe like the Copy Files Build Phase in Xcode)?
Thanks

A: You should check out CMake's BundleUtilities module.
There's a wiki entry complete with a functioning sample app here:
https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/BundleUtilities
The documentation for the BundleUtilities module is here:
http://www.cmake.org/cmake/help/v2.8.8/cmake.html#module:BundleUtilities
I recommend configuring a CMake -P script that calls fixup_bundle appropriately and then using a CMake "install(SCRIPT ...)" command to call that script at install time. Ask more specific questions later if you run into any problems with this approach, or if there's something unclear about the example or documentation.


text:
Q: Conversion not possible in dotnet core with inheritance and generics Here is my current code (.net core):
Box code:
class Box { }

SpeicalBox code:
class SpecialBox : Box { }

Stack code:
interface Stack<T> where T : Box
{
    AnotherInterface<T> TheFunction();
}

SpecialStack code:
class SpecialStack : Stack<SpecialBox> { }

StacksHolder code:
class StacksHolder
{
    private List<Stack<Box>> Stacks = new List<Stack<Box>>();
}

This is the error i get:
I am getting the following error if I am trying to add a SpecialStack to the list of Stacks in the StacksHolder:

cannot convert from 'SpecialStack' to 'Stack'

The code I use for that:
class StacksHolder
{
    private List<Stack<Box>> Stacks = new List<Stack<Box>>();

    public StacksHolder()
    {
        Stacks.Add(new SpecialStack());
    }
}

Does anyone have an idea why that does not work?
I would be very happy if anyone could explain me, how to fix it.
Thanks in advance!

A: I could fix my problem by adding the out keyword to both interfaces Stack and AnotherStack.
Thank you @Lee for bringing me to the solution!
Solution Code:
Stack code:
interface Stack<out T> where T : Box
{
    AnotherInterface<T> TheFunction();
}

AnotherInterface code:
interface AnotherInterface<out T> where T : Box
{
}


text:
Q: Scrape non-href link using selenium I am relatively new to scraping and have come across a complex site (https://adviserinfo.sec.gov/firm/summary/104518) where I cannot figure out how to follow a link using Selenium (the link is called "View Form ADV By Section"). I have found the data I wanted now elsewhere but would love to find out how it can be done.
Usually there would be an href tag and hovering over the menu would display the target url however this is not evident. I've tried using the xpath for the div / li / span but get the error that the element is not interactable.
def get_details(url):
     chrome_options = webdriver.ChromeOptions()
     prefs = {"profile.default_content_setting_values.notifications" : 2}
     chrome_options.add_experimental_option("prefs",prefs)
     chrome_options.add_argument("--headless")
     driver = webdriver.Chrome(ChromeDriverManager().install(),options=chrome_options)
     #driver = webdriver.Chrome('./chromedriver',options=chrome_options)
     driver.get(url)
     print(driver.title)
     time.sleep(5)
     print(driver.current_url)
     html = driver.page_source
     soup = BeautifulSoup(html)
     for tag in soup.findAll("li", {"analytics-label": "View Form ADV By Section"}):
          print(tag)
     driver.find_element_by_xpath('/html/body/div[1]/div/div/div[1]/div/div/ul/div[6]/li').click()
     time.sleep(5)
     print(driver.current_url)
     driver.quit()

If you manually click the link then a new tab is opened where the url looked to be based on a combination of the ORG PK and the FLNG PK (https://files.adviserinfo.sec.gov/IAPD/content/viewform/adv/sections/iapd_AdvIdentifyingInfoSection.aspx?ORG_PK=104518&FLNG_PK=024FFC7A000801B405611B1102CCD535056C8CC0). I thought I could construct the url but cannot find where the FLNG PK comes from...
The questions I have are:

*

*how is the website generating these links without any kind of href tags (assume the script is doing it somehow...)?

*Is there a way to get Selenium to access the link?

*If not, is there a way to find out / construct the link some other way?

thanks a lot


text:
Q: How to automate an IME application in android? I'm trying to automate an IME application in android. The actual scenario is that,we need to open some kind of default editor on the phone(Email, Gmail,Message)and try to generate touch event on the IME(Input method editors).
I had even tried it out with robotium tool to pass the key events, but couldn't accomplish the actual scenario.
So please help me out in solving this problem I really want to know whether their is any way to stimulate touch events on the IME an perform the click events.
Thanks and Regards
Rajesh Samson.


text:
Q: Finding $x$-intercepts of $4x^2-3y^2+2xy-12=0$ I've got to find the x-intercepts of $4x^2-3y^2+2xy-12 = 0$.
I've tried isolating one variable and it just doesn't work out. Wolfram|Alpha says the answer is $√3$.
How can this be solved?

A: The x-intercept by definition is when $y=0$. Putting this into the equation we get
$4x^{2}-12=0$.
So $x^{2}=3$. Thus, $x=\pm\sqrt{3}$.


text:
Q: How can I remove the shadow that's included on product images? BIG CARTEL I am using the Luna theme on big cartel, but when viewing on a mobile device the products become difficult to see due to the box shadow. I came across a help page from big cartel that suggested copying a code into the CSS but this did not change it. The code was as follows:
#product_images li img {
  box-shadow: none;
  webkit-box-shadow: none
}

Is this code correct or is there another way I could change this?

A: You can try using !important to make sure the code in your CSS is being overridden. You were also missing the # before the product_images and the - before the webkit which might be part of the problem.
#product_images li img {
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
}


text:
Q: Difference in css outcome between static and jinja2 html I am using Flask and therefore Jinja2 to dynamically create a web page.
When I use the render_template function the resulting web pages pick up my css styles normally and do as I expect with some strange exceptions.
For example, the following css and html code is working 100% as intended:
CSS:
.intro {
  font-family: monospace;
  font-size: 24px;
  color: #455934;
  padding-top: 30px;
  padding-right: 50px;
  padding-bottom: 5px;
  padding-left: 50px;
}

HTML:

    Hello

However when using a ``Jinja2``` template:

    {{title}}

The css style for this class is ignored.
This is not true for any other styles in the same css file and template, for reference the whole template looks like this and the styles for div containers, background, etc. work as intended:
<!DOCTYPE html>

        <meta charset="utf-8">
        <link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='gemuese_style.css') }}">
        <title>{{title}}</title>

                        {{title}}

{{result}}

Edit:
Some testing has shown me that the style seems to work depending on the variable jinja renders. The template is rendered based on the output of different functions who generally return a list of a string and another list. The string is then used to fill in the {{title}} part where the css is failing.
For some functions it does work but I am not sure why because there is no difference in the return format.
Edit2:
Look at the difference between This rendered template  and this one.


text:
Q: VS 2010 debugger not loading symbols when attaching to NUnit (I just posted this in the NUnit discussion group on groups.google.com)
Under VS 2008, I would run my tests under NUnit, and, if I needed to
debug, I would attach the VS2008 debugger to the running Nunit process
(Debug -> Attach to Process), and set any breakpoints on code I wanted
to examine. When I hit the Run buttion in NUnit, it would hit the
breakpoint. (BTW, if it matters, this was running NUnit 2.5.2).
I just upgraded to NUnit 2.5.4 and VS 2010.  When I set a breakpoint,
then attach to NUnit, I get a little warning symbol on the breakpoint
dot, and hovering over it gives the tooltip "Breakpoint will not be
hit. No symbols are currently loaded".  Going to the Debug -> Windows -> Modules window shows a whole bunch of Windows and NUnit modules
loaded, with the Symbol Status of "Skipped loading symbols", and then
1 module with a funny name that changes each time (r1euhmh5 right
now), and Symbol Status of "No symbols loaded". (There is no trace of a module with a name remotely like my DLL under test).
Right clicking the funny filename (assuming that to be some mapping from my
DLL under test), and clicking Load Symbols From -> Symbol Path, and
navigating to the bin\debug folder, then clicking the pdb file of my
DLL under test, I get the message "A matching symbol was not found in
this folder".  (The top of the Open dialog box has a line that says
"Original location: r1euhmh5.pdb")
So what's changed?  And how do I go about debugging/breakpointing
under VS 2010/NUnit 2.5.4  (Or is it possible I screwed something up
when I decided to go through my VS2010 options and set some of them to
more advanced levels than I knew what I was doing?)
I appreciate any help.

A: I'm not sure I understand exactly why, but the answer is to attach the debugger to nunit-agent.exe instead of nunit.exe.  See Charlie Poole's response here

A: There's information on this blog post about how to tell NUnit to use the correct .Net framework in the nunit.exe configuration file.
The benefit to fixing this in the configuration file is that it allows you to set up your unit test project so that you can launch NUnit as an external command when you select Debug -> Start New Instance.


text:
Q: AES/CCM Encryption and Plaintext Length Exceeds Maximum Message Length I am trying to perform an encryption and decryption in Crypto++ library using AES128 cipher with CCM mode of operation. I have a problem when I try to encrypt string longer than 16777215 bytes.
My code:
const int TAG_SIZE = 8;
CCM< AES, TAG_SIZE >::Encryption e;
CCM< AES, TAG_SIZE >::Decryption d;

e.SetKeyWithIV( key, sizeof(key), iv, sizeof(iv) );
e.SpecifyDataLengths( 0, plain.size(), 0 );

//Encryption
StringSource ss1(
  plain,
  true,
  new AuthenticatedEncryptionFilter(
    e,
    new StringSink(cipher)
   )
);

d.SetKeyWithIV( key, sizeof(key), iv, sizeof(iv) );
d.SpecifyDataLengths( 0, plain.size(), 0 );

//Decryption
AuthenticatedDecryptionFilter df( d,
  new StringSink(recovered)
);
StringSource ss2(
  cipher,
  true,
  new Redirector(df)
);

When I try to encrypt/decrypt a plaintext which is size of a CD (737280000), I get the following error:

"terminate called after throwing an instance of 'CryptoPP::InvalidArgument'
    what():  AES/CCM: message length 737280000 exceeds the maximum of 16777215"

My question is, how do I encrypt/decrypt a plaintext which is longer than 16777215 bytes?

A:
My question is, how do I encrypt/decrypt a plaintext which is longer than 16777215 bytes?

CCM mode is specified in NIST SP800-38c. Section A.1, Length Requirements, discusses maximum plain text under a security context. A security context is the {key, iv} combination (with some hand waiving).
I believe you have three choices. First, you can increase the length of the IV. The larger the iv, the more plain text you can encrypt. The max iv length is 13 so it does not scale up forever.
Second, you have to re-key or change the iv before you hit the maximum plain text under the context. You can find the maximum plain text length using MaxMessageLength(). Crypto++ tracks the number of bytes processed via m_totalMessageLength, but it is not exposed to user programs. You will have to track it yourself.
Third, you can change algorithms. An algorithm like ChaCha20Poly1305 allows you to encrypt 2^38-1 64-byte blocks. That is just under 2^44 bytes or about 256 GB. You should be safe with ChaCha20Poly1305.

Crypto++ tells you the maximum number of bytes via MaxMessageLength(). In the case of CCM it is based on the iv length, and tracked through m_L in the code below.
lword MaxMessageLength() const
    {return m_L<8 ? (W64LIT(1)<<(8*m_L))-1 : W64LIT(0)-1;}

MaxMessageLength() is used in authenc.cpp. ProcessData() throws an exception when the limit is hit:
if (m_state >= State_IVSet && length > MaxMessageLength()-m_totalMessageLength)
    throw InvalidArgument(AlgorithmName() + ": message length exceeds maximum");
m_totalMessageLength += length;

const int TAG_SIZE = 8;
CCM< AES, TAG_SIZE >::Encryption e;
CCM< AES, TAG_SIZE >::Decryption d;

Your tag size is a tad bit on the small side. You might want to use the maximum size, if your protocol allows it.

I recommend you switch algorithms. CCM is a bastard mode that got standardized in the early 2000's through some Wireless Working Group. Then, NIST adopted it because it was already standardized.
At the time CCM was standardized there were better Authenticated Encryption modes available, like CWC, OCB, EAX and GCM. Unfortunately the damage was done. And now you have algorithms like Bernstein's ChaChaPoly1305.
You might also want to checkout AEAD Comparison on the Crypto++ wiki. The comparison shows CCM is about the worst of the authenticated encryption modes.


text:
Q: Iterating through arrays with given limits (python) I have measurements from three different elements. (tin, copper, lead)
They get evaluated differently as the have different limits.
For example i have the lead, tin and copper content in a stone mixture as my measurements and the certain limits which return different things.
measurement_lead = 150
measurement_tin = 1
measurement_copper = 1002
limits_lead = [0.5, 10, 50, 100]
limits_tin = [0.7, 14, 990, 11000]
limits_copper = [5, 60, 61, 98880]

Now i have to check if one (or more) of my measurements are above the highest limit, if yes "do something", if no i have to check if one is above the second highest and under the highest limit - and so on, until the condition if the measurement is smaller than the smallest of the limits
Hope it's any clear. Trying to write it in python :)
Edit: There are always 4 limits and the amount can't vary. These are given limits for each element. The measurements can be equal to a limit. It should always check bigger or equal to.
tried this:
measurement_lead = 201
measurement_copper = 10
measurement_tin = 2008

e_mat = 2000
b_mat = 900
pw = 20
t_mat = 1
limits_lead = [t_mat, pw, b_mat, e_mat]

e_mat = 45
b_mat = 43
pw = 34
t_mat = 2
limits_copper = [t_mat, pw, b_mat, e_mat]

e_mat = 10
b_mat = 5
pw = 2
t_mat = 0.5
limits_tin = [t_mat, pw, b_mat, e_mat]

for i in limits_lead:
    if i >= e_mat:
        print("measurement is higher then e_mat")
    elif e_mat >= i >= b_mat:
        print("measurement is between e_mat and b_mat")
    elif b_mat >= i >= pw:
        print("measurement is between b_mat and pw")
    elif pw >= i >= t_mat:
        print("measurement is between pw and t_mat")
    elif t_mat >= i >= rw:
        print("measurement is between t_mat and rw")
    elif i >= rw:
        print("measurement is lower then rw")

Now it somehow needs to check if one measurements is higher the e_mat (with its given limits, every element has different limits), if no: if one measurements is between e_mat and b_mat and so on.

A: Your question needs some clarification:

*

*Are the limits list always in ascending order? assumption: no

*Are there always just 4? assumption: no

*What happens if the measurement is equal to a value in your limits? assumption: is never equal

I made some assumptions and wrote a function for you to find out which range your measurement falls in so that you can "do_something":
    def find_out_position(limits_element, measurement_element):
        limits_element = sorted(limits_element)
        limits_element.append(measurement_element)
        index = sorted(limits_element).index(measurement_element)
        if index == 0:
          print ("measurement is lower than lowest")
        elif index == len(limits_element)-1:
          print ("measurement is higher than highest")
        else:
          print ("measurement is between {} and {}".format(limits_element[index-1], limits_element[index+1]))

A: I assumed it doesn't matter if all three measurements meet the limit as long as one does. If that is the case, try this:
    if measurement_lead >= limits_lead[3] or measurement_tin >= limits_tin[3] or measurement_copper >= limits_copper[3]:
      #do something because 1 or more meets the highest requirement
      exit

    elif measurement_lead >= limits_lead[2] or measurement_tin >= limits_tin[2] or measurement_copper >= limits_copper[2]:
      #do something because 1 or more is between the second highest and highest
      exit

    elif measurement_lead >= limits_lead[1] or measurement_tin >= limits_tin[1] or measurement_copper >= limits_copper[1]:
      #do something because 1 or more is between the third highest and second highest
      exit

    else:
      #do something because 1 or more is between the lowest and third highest
      exit

Idk what your do sth is but make sure you end the loop after 'doing something' so that the next elif block only executes if none of the three conditions are met in the previous block. Let me know if that makes sense. :)


text:
Q: Routing Conundrum I have quite a strange problem. In my angular app my routing module is mixing up components. So if I put in the address for component-x it will take me instead to component-y. If I change the order of the route object the route that same address suddently goes to the right component or even sometimes it can't find the component at all.
I tried making all the variables in the path's unque, adding  pathMatch: 'full', runGuardsAndResolvers: 'always' and even stripping all everything down to a standard implementation. I upgraded from 10 -12 hoping it would fix itself but alas!
Here is my code:
const routes: Routes = [
    { path: '', component: HomeComponent, pathMatch: 'full' },
    { path: '**', component: NotFoundComponent },
    // Shope Pages
    // ------------------------
    { path: ':catCompCategory/:catCompCategoryChild' , component: CategoryComponent },
    { path: ':catParCompCategory' , component: CategoryParentComponent },
    { path: 'checkout' , component: CheckoutComponent },
    { path: 'filter/:condition/:value/:parameter' , component: FilteredProductsComponent },
    { path: ':singleProdCompCategory/:singleProdCompCategoryChild/:singleProdCompProductName' , component: SingleProductComponent },
    { path: 'view-all/:allCompCategory' , component: ViewAllComponent },
    // General Pages
    // ------------------------
    { path: 'help-center/about-us', component: AboutUsComponent },
    { path: 'bounce', component: BounceComponent, pathMatch: 'full' },
    { path: 'help-center/contact-us', component: ContactUsComponent },
    { path: 'help-center/faq', component: FaqComponent },
    { path: 'help-center/order-tracking', component: OrderTrackingComponent },
    { path: 'help-center/privacy-policy', component: PrivacyPolicyComponent },
    { path: 'help-center/returns', component: ReturnsComponent },
    { path: 'help-center/terms-conditions', component: TermsConditionsComponent },
    // Payfast
    // ------------------------
    { path: 'payfast/cancel', component: CancelComponent },
    { path: 'payfast/notify', component: NotifyComponent },
    { path: 'payfast/success', component: SuccessComponent }
];

@NgModule({
    imports: [
        RouterModule.forRoot(routes, {
            anchorScrolling: 'enabled',
            onSameUrlNavigation: 'reload',
            useHash: true
        }
    )],
    exports: [RouterModule]
})

export class RoutingModule {}

Here are my typescript settings:
"baseUrl": "./",
 "allowSyntheticDefaultImports": true,
 "importHelpers": true,
 "sourceMap": true,
 "declaration": false,
 "downlevelIteration": true,
 "experimentalDecorators": true,
 "moduleResolution": "node",
 "target": "es2017",
 "module": "es2020",
 "lib": [
 "es2018",
 "dom"
        ],
 "typeRoots": [
 "node_modules/@types",
 "./typings.d.ts"
        ],
 "resolveJsonModule": true,
 "esModuleInterop": true,
 "skipLibCheck": true

I'm sure it's starting at me right in the face, but I'd really appreciate some help on this! Thank you so much

A: When you have routes defined with only route params this is the behavior you get. This is why it is bad practice to not have a constant path and have only route params.
Quick hack fix is to move any routes that start with params to the end of the routes array.
The real fix is to add a constant to the beginning of those routes. Such as "category/something/something-else" for the category component.


text:
Q: Find the intersection and sum of two polynomial subspaces Given that we have:
\begin{align}
V&=\{p\in\Bbb{R}_4(x) : p'(0)=0 \wedge p(1)=p(0)=p(-1)\} \\
W&=\{p\in\Bbb{R}_4(x) : p(1)=0\}.
\end{align}
I am asked to find the dimensions of $V,W,V+W,V \cap W $ and their respective bases.
Rewrite $V$ and $W$:
\begin{align}
V&=\{p\in\Bbb{R}_4(x): x^2 (x-1)(x+1) \text{ divides } p\} \\
W&=\{p\in\Bbb{R}_4(x): (x-1) \text{ divides } p \}
\end{align}
In this case I get that $V \cap W=V$
and the base of $V$ is $\{x^4-x^2\}$
the base for $W$ is $\{x-1,x^2-x,x^3-x^2,x^4-x^3\}$
thus the dimensions are $1$ and $4$... the only thing I'm not sure about is the sum of those two spaces any help with that?


text:
Q: Printer driver depends on libbeecrypt7:i386 but it's not in repositories I just did a fresh install of Kubuntu 16.04 and now I'm trying to configure a printer.
The printer is a Canon mf4320d, so I downloaded the driver from manufacturer's website and tried to install it. However, during installation, it says that cannot find neither package libeecrypt7:i386 nor libeecrypt-dev:i386.
I have i386 architecture enabled and I already have installed some i386 packages from repositories, so that doesn't seem to be the problem.
Also, I installed this same printer on Xubuntu 14.04 with no problems at all.
This packages used to be in universe repository, but they seem to have been removed in the most recent versions of Ubuntu. (note: I have universe repository enabled)
What should I do the best to install the driver? Maybe downloading and installing the packages from previous ubuntu versions repositories?
Thanks!
PD: is there any reason for this packages being removed from repositories?
Edit: my question is not about how to install a package from a previous version repository, my question was if this is a good solution in this case, or if there is another better solution.

A: beecrypt has been removed from Debian, and thus from Ubuntu as well, due to it being unmaintained by its developers and not used by any other package in Debian.
Hopefully Canon will soon provide a package which does not depend on it, but in the meantime it should be fine to install the Trusty package. You can also try to look for third-party repositories providing a Xenial package.

A: Newer version of Canon driver (3.40) depends on "libgcrypt20:i386" and "libgcrypt20-dev:i386" packages. So these packages should be installed instead.


text:
Q: How to create filled contour lines in QGIS? How can I create contour lines that are filled with a graduated symbol usinq QGIS?
In ArcGIS for Desktop I can do this. What about in QGIS?

A: I've done it by styling the geotiff image based on the pixel value.
By default, the geotiff looks gray. So I go to Properties (right click the layer in leftside panel), and in the 'style' tab, select 'Colormap':

In the Colormap tab, I add a bunch of entries. In my geotiffs, 'nodata' has been replaced with a zero value (indicating buildings theres) which i set to black, the rest is scaled up colorwise based on the pixel value (950 = 9.50m above sea level.
For nice maps, find the upper and lower bounds first, and use Colorbrewer to find a nice color ramp. A bit of effort at first, but can save the style:

I set it to 'discrete', so it goes by steps. If done every meter, you could mimic the contour lines like this, albeit it less smooth then the calculated ones would/could be. Depending on what you need the map for, you can make the colors move gradually in between by setting it to 'Linear'.
Given I combine it with other data, I then went to Transparancy tab, set 50% transparancy, overlayed it on a base map, for this result:

You may notice:
- on the low end my range estimate was off, as there's ALOT below my lower bound which should be split up more. This is however just for the sake of the example pictures.
- Deliberately taken screenshot at the end of the map so you'd see the overlay.
- All data used here is data provided by AGIV (GRB Vlaanderen WMS + DHM Vlaanderen, raster 5x5m) and is not to be spread without mentioning source of data.


text: Q: How to handle GZIP-ed ajax responses? Do you have any suggestions on how to handle GZIP-ed ajax responses from a webservice with WRT?My code is working fine on emulator but not on devices (N8,X7).Does smartphone browser supports HTTP- Compression(gzip)?


text:
Q: Mapping to a file with paramaeters Is it possible to map values to a file with a fixed template?
For example i have a file:
bla bla bla dsfdfsf  ldfksj $value asd sdfkl jkdhs f

Now i want to map say value 100 to parameter "value", so my output file text will be:
bla bla bla dsfdfsf  ldfksj 100 asd sdfkl jkdhs f

A: Database? :)
If you do not want the DB then you might want to take a look on CsvMapReader.
Some examples of reading with CsvMapReader are available here.
... and writing examples are here.


text:
Q: Unable to fetch data from Room database using view model I am using room db in my app and I am using MVVM design pattern.When I am creating view model in that at the time of accessing dao method its showing me below error.
No value passed for parameter 'context'

Below is my code:
RoomDb.kt
@Database(entities=[UserEntity::class],version = 1)
abstract class RoomDb: RoomDatabase() {

abstract fun useDao():UserDao

companion object{

    private var INSTANCE:RoomDb ?= null

    fun getRooomDb(context: Context): RoomDb{

        if(INSTANCE == null){

          INSTANCE = Room.databaseBuilder<RoomDb>(
              context.applicationContext,RoomDb::class.java,"AppDb"
          ).allowMainThreadQueries().build()
        }

        return INSTANCE!!
     }
   }
}

UserDao
@Dao
interface UserDao {

@Query("SELECT * FROM Users ORDER BY id DESC")
fun getAllUsers(): List<UserEntity>

@Insert
fun insertUser(user: UserEntity)

@Delete
fun deleteUser(user: UserEntity)

}

HomeViewModel.kt
class HomeViewModel: ViewModel(){

fun allUser(){

    val db = RoomDb.getRooomDb().useDao()
  }
}

I am getting error in RoomDb.getRooomDb().useDao() line.Someone let me know how can I resolve this error.

A: I got it fixed actually in HomeViewModel class I have to use AndroidViewModel and not ViewModel because I need to pass the context in viewmodel in this case ViewModel don't have any way to get a context but in AndroidViewModel we can pass context so HomeViewModel.kt should be like this:
HomeViewModel.kt
class HomeViewModel(application: Application): AndroidViewModel(application){

fun allUser(): LiveData<List<UserEntity>> {

    val dao = RoomDb.getRooomDb(getApplication()).useDao()

  }
}


text:
Q: Get an Integer with Flutter from the Cloud Firestore I am new at Flutter and I try to build an App. I want to Display an double on a Textwidget from Cloud Firestore.
My CloudFirestore look like this:

How can I read the double of 200 in a TextWidget and Displays all the time the new value?
I have create a function to add Integer on the specific logged In User Mail what looks like this:
geldNew = _firestore.collection('guthaben').doc(loggedInUser?.email).set({
  'geld': geld,
});

A: You can use a StreamBuilder and the snapshots to stream the value, so when there's a change, the UI gets updated automatically like so:
class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: StreamBuilder<DocumentSnapshot>(
          stream: FirebaseFirestore.instance
              .collection('guthaben')
              .doc("loggedInUser?.email")
              .snapshots(),
          builder: (context, snapshot) {
            if (snapshot.hasData) {
              return const CircularProgressIndicator();
            }
            return Text((snapshot.data!.data() as Map)["geld"].toString());
          },
        ),
      ),
    );
  }
}

If you want to get the value just once, you can use a FutureBuilder like so:
class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: FutureBuilder<DocumentSnapshot>(
          future: FirebaseFirestore.instance
              .collection('guthaben')
              .doc("loggedInUser?.email")
              .get(),
          builder: (context, snapshot) {
            if (snapshot.hasData) {
              return const CircularProgressIndicator();
            }
            return Text((snapshot.data!.data() as Map)["geld"].toString());
          },
        ),
      ),
    );
  }
}


text:
Q: VB.NEt SpVoice / SAPI always first in action Hello guys i want to get some help.. because my program "BINGO caller" the SAPI/SpVoice is always speaking first before displaying the value in my textbox. and other problem is while speaking the SAPI all buttons and commands are not functioning they become ok when the SAPI is done speaking and the number they speak is showing in texbox after the speak. please help me.. i want to my program is displaying the number while SAPI speak the value in my textbox. please help me. this is my code in displaying the Number and letter in textbox and this is the code in SAPI
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

    nos = randomarray(index)
    index = index + 1

    If nos <= 15 And nos >= 1 Then
        col = "B"
    ElseIf nos <= 30 And nos >= 16 Then
        col = "I"
    ElseIf nos <= 45 And nos >= 31 Then
        col = "N"
    ElseIf nos <= 60 And nos >= 46 Then
        col = "G"
    ElseIf nos <= 75 And nos >= 61 Then
        col = "O"
    End If

    lbl_no.Text = nos
    lbl_let.Text = col

    sVar = Mid(nos, 1, 1)
    sVar2 = Mid(nos, 2)

    CType(Me.Controls("lbl_" & nos.ToString), Label).BackColor = Color.Yellow

    If index = randomarray.Count Then
        Timer1.Stop()
        btn_pause.Enabled = False
        btn_clear.Show()
        btn_exit.Hide()
    End If

    voice()
    txt_count.Text = index - 1

End Sub

This is the SAPI code
Sub voice()
    Dim VObj As Object
    VObj = CreateObject("SAPI.SpVoice")

    With VObj
        .Volume = 100
        .Rate = -2
        .Speak(col & " " & nos)
        .Speak(col & " " & sVar & " " & sVar2)
    End With
End Sub

This is my Screenshot of my program

A: instead of calling voice() on the ui thread just call it on a thread pool thread.
'voice()
System.Threading.ThreadPool.QueueUserWorkItem(AddressOf voice)


text:
Q: Puzzle Piece html/css I need to create a header that pieces can be easily added or removed based on the page being built and I'm having trouble with one part.
I have a header that looks like this will all components in

and if the nav is removed it should adapt to look like this (vertically centered)

My question is how can I accomplish something like this in css. It also needs to work in IE8.

A: I think this is what you are looking for.
Now you can change its positions or remove them and add or remove buttons from nav bar.
But remember that you must keep some spacing standards to achieve a good design, so, obviously you will need to change the heights and maybe add some paddings/margins. Be aware that each border fills 1px of the total header's height

        <input type="search" class="nav-search">

Apps

Games

Movies

Books

Newspapers

.header,
.nav-list{
    display: -moz-box;
    display: -webkit-flexbox;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: -moz-flex;
    display: flex;
    -webkit-flex-direction: row;
    -moz-flex-direction: row;
    -ms-flex-direction: row;
    flex-direction: row;
}

.header{
    height: 120px;
    border-bottom: solid 1px black;
    align-items: center;
}

.navWap{
    height: inherit;
}

.nav-search,
.nav-list {
    width: 700px;
    height: 40px;
    line-height: 40px;
}

.nav-list ~ .nav-search,
.nav-search ~ .nav-list{
    margin-top: 12px;
}

.nav-list > li{
    text-align: center;
    flex-grow:1;
    border: solid 1px black;
    border-right: none;
}

.nav-list > li:last-child{
    border-right: solid 1px black;
}

Working here:
http://codepen.io/EderIraizoz/pen/EaBgWg


text:
Q: Fullscreen hero image behaves weird while scrolling on mobile My fullscreen hero header doesn't work well on mobile devices. It changes height while scrolling but I have no idea why. Here is the code:

Asaxs

gotta be kidding me

      Check

header{
  background-image:url(https://c4.staticflickr.com/4/3798/9692831755_27d2032a69_k.jpg);
  background-size:cover;
  position:relative;
  height:100vh;
  max-height: 100vh;
  overflow: hidden;
}

.hero{
    padding-right: 60px;
    position:absolute;
    top:60%;
    text-align:right;
    width:100%;
    color:#fff;
    font-size:36px;
    -ms-transform: translate(0,-50%); /* IE 9 */
    -webkit-transform: translate(0,-50%); /* Safari */
    transform: translate(0,-50%);
}


text:
Q: Ajax Error when looping Im using a mixture of php and javascript/jquery to scrape a websites prices from there webpage, there's no API so unfortunately I scrape the html page and pick up the prices/title from the html(I know this is a really risky way of doing it but its the only way).
Anyway, this is whats going on:
I pull in the external webpage using php file_get_contents()
This method is within a foreach loop, for every external page I want to grab data from.
This is my javascript.
<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js' type='text/javascript'></script>
            <script type='text/javascript'>
            console.log('page-{$i}');

                $('.page-{$i}').find('.search_result_row').each(function(i, obj) {
                    //This will give us each individual apps details.
                    var appTitle    = $(this).find('.title').text();
                    var appPrice    = $(this).find('.search_price').text();
                    var appDiscount = $(this).find('.search_discount').text();

                    var appDetails = {
                        'appTitle'    : appTitle,
                        'appPrice'    : appPrice,
                    };

                    callAjax(appDetails);
                    var my_delay = 5000;

                    function callAjax(appDetails) {
                        $.ajax({
                         url: 'Upload.php',
                          type: 'POST',
                          data: appDetails,
                          dataType: 'JSON',
                         success:function(data) {
                                console.log(data);
                           },
                         error:function(jqXHR, textStatus, errorThrown) {
                            console.log('request failed ' + textStatus + errorThrown);

                            console.log(appDetails);
                         }
                        });
                    }
                });
            </script>

Everything works fine for the first URL, and for about half of the urls that I'm grabbing data from. The issue is SOME of the data  being sent via ajax is returning the following error
Upload.php net::ERR_EMPTY_RESPONSE

Can any of you help?

A: Try this. You must stringify your details before you post them as json. This could be a reason for ERR_EMPTY_RESPONSE.
function callAjax(appDetails) {
                            appDetailsJsonString = JSON.stringify(appDetails);
                            $.ajax({
                             url: 'Upload.php',
                              type: 'POST',
                              data: {appDetailsJson: appDetailsJsonString},
                              dataType: 'json',
                             success:function(data) {
                                    console.log(data);
                               },
                             error:function(jqXHR, textStatus, errorThrown) {
                                console.log('request failed ' + textStatus + errorThrown);

                                console.log(appDetails);
                             }
                            });
                        }


text:
Q: Why is Java prohibiting inheritance of inner interfaces? I.e. why is the following "cyclic dependency" not possible?
public class Something implements Behavior {
    public interface Behavior {
        // ...
    }
}

Since interfaces don't reference the outer class this should be allowed; however, the compiler is forcing me to define those interfaces outside the class. Is there any logical explanation for this behavior?

A: Imagine you are the compiler.
We are saying you to create a class Something.
This class implements Behavior...
But Behavior does not exist yet because Something is not already registered...
Do you understand the problem ?
See class as box which contains things. Behavior is contained in the box Something. But Something does not exist.

A: Relevant rules in spec:
http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.1.4

A class C directly depends on a type T if T is mentioned in the extends or implements clause of C either as a superclass or superinterface, or as a qualifier of a superclass or superinterface name.

http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.1.3

An interface I directly depends on a type T if T is mentioned in the extends clause of I either as a superinterface or as a qualifier within a superinterface name.

Therefore if A extends|implements B.C, A depends on both C and B. Spec then forbids circular dependencies.
The motivation of including B in the dependency is unclear. As you mentioned, if B.C is promoted to top level C2, not much is different as far as the type system is concerned, so why A extends C2 is ok, but not A extends B.C? Granted a nested type B.C does have some prviledged access to B's content, but I can't find anything in spec that makes A extends B.C troublesome.
The only problem is when C is an inner class. Suppose B=A, A extends A.C should be forbidden, because there's a circular dependency of "enclosing instance". That is probably the real motivation - to forbid outer class from inheriting inner class. The actual rules are more generalized, because they are simpler, and make good sense anyway even for non-inner classes.

A: The simple fact that the language specs forbid it should be enough.
Some reasons I could think of:

*

*It wouldn't be useful.

*For whatever reasons you might want to use this, I'm sure there exist better options.

*Child classes should extend base classes, so why would you declare a base class inside its own child?

*It would be counter-intuitive having a separate class extend your inner-class.


text:
Q: EditText Limit Upto 5 contacts only I am making a Panic App, and allowing user to add multiple contacts and showing selected contacts into EditText by doing Tap on Add to Contacts button, whenever he/she wants to add.
In EditText getting something like this: 9867XXXXXX, 9866XXXXXX, ......
Changes i require:
Limit upto 5 Contacts only
I know how to limit for characters length in EditText, but don't know how to limit of 5 contacts only ?
     private Button btnAddContacts ;
     private EditText editContacts

    ..............................
    btnAddContacts = (Button) findViewById(R.id.btnAddContacts);
    btnAddContacts.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                 Intent it= new Intent(Intent.ACTION_GET_CONTENT);
                 it.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE);
                 startActivityForResult(it, 1);
            }
        });

        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            if (data != null) {
             Uri uri = data.getData();

            if (uri != null) {
             Cursor c = null;
             try {
             c = getContentResolver().query(uri, new String[]{
             ContactsContract.CommonDataKinds.Phone.NUMBER,
             ContactsContract.CommonDataKinds.Phone.TYPE },
             null, null, null);

             if (c != null && c.moveToFirst()) {
              String number = c.getString(0);
              int type = c.getInt(1);
              showSelectedNumber(type, number);
               }
              } finally {
             if (c != null) {
               c.close();
             }
          }
        }
      }
    }

        public void showSelectedNumber(int type, String number) {

            if(editContacts != null && editContacts.getText().toString().length()==0)
                editContacts.setText(number);
           else
                if(editContacts != null) editContacts.append(","+number);

        }

A: You can use a flag say maxNoContacts
Snippet:
public YourActivity extends Activity
{
int maxNoContacts = 0;

 public void onCreate(Bundle savedInstanceState)
 {
    super.onCreate(savedInstanceState)
    ...
    btnAddContacts.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
     if(maxNoContacts <5 )
       {
         Intent it= new Intent(Intent.ACTION_GET_CONTENT);
         it.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE);
         startActivityForResult(it, 1);
       }
    else
      {
              //show toast saying you added maximum no of contacts.
      }

    }
    });
 }

//Update maxNoContacts if contacts fetched properly.
  @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (data != null) {
     Uri uri = data.getData();

    if (uri != null) {
     Cursor c = null;
     try {

     c = getContentResolver().query(uri, new String[]{
     ContactsContract.CommonDataKinds.Phone.NUMBER,
     ContactsContract.CommonDataKinds.Phone.TYPE },
     null, null, null);

     if (c != null && c.moveToFirst()) {
      String number = c.getString(0);
      int type = c.getInt(1);

       maxNoContacts++; //Increment maxNoContacts if it fetches contact properly.

      showSelectedNumber(type, number);
       }
      } finally {
     if (c != null) {
       c.close();
     }
    }
  }
 }
}

}


text:
Q: In xarray, large, on-disk dataset from many small cdfs I'm new to xarray and would appreciate some help getting my project started. I would like to create a single, on-disk xarray dataset or dataframe from many (1000s) of gas chromatography - mass spectrometry (gcms) files, one per sample run. My initial purpose is simply plotting overlays of data from arbitrary sets of samples, mass-to-charge (m/z) channels, and retention time windows, and xarray's indexing and lazy-loading seem ideal.
I have the data in the manufacturer's (weird) cdf format, one file per sample, and have converted each to pandas dataframe in a format like
            t        14       15       16        17        18       19  \
0       271.0  102144.0  14864.0  43584.0   25816.0   82624.0   9992.0
1       271.1  102720.0  15608.0  42896.0   25208.0   82432.0  10024.0
2       271.2  101184.0  14712.0  42256.0   24960.0   81472.0   9960.0
3       271.3  101824.0  14704.0  41216.0   25744.0   83008.0   9984.0
4       271.4  102208.0  14152.0  41336.0   25176.0   81536.0  10256.0

where t goes up to 2100.0 sec and the columns go up to 500 (so 488 x 18000). I have 1000s of such files, each with a different sample name.
I originally envisioned xr.concat'ing them into one huge file. So, following the docs, I've been able to create a Dataset structure from a single sample and save it to cdf as follows:
ds1 = xr.Dataset({'intensity': (['time', 'mz'], c1[["{}".format(x) for x in range(14, 501)]].values)},
             coords={'mz': range(14, 501),
                     'time': c1['t'].values,
                     'sample':['c1']})
ds1.to_netcdf('test_ds1.nc')

<xarray.Dataset>
Dimensions:    (mz: 487, smp: 1, time: 18185)
Coordinates:
  * time       (time) float64 271.0 271.1 271.2 271.3 271.4 271.5 271.6 ...
  * mz         (mz) int64 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ...
  * smp        (smp) <U2 'c1'
Data variables:
    intensity  (time, mz) float64 1.005e+05 1.444e+04 4.162e+04 2.536e+04 ...

(note mz represents mass-to-charge-ratio, which is what 15, 16...500 are)
As expected, loading several dsi's with xr.open_dataset does not increase memory use of the python process (I'm looking at activity monitor on mac osx), which is good.
However, on running
d = xr.concat([ds0, ds1], dim='sample')

memory use shoots up ~70MB/sample, indicating that d is fully in memory, and this won't scale to the 1000s of samples.
What can I do in xarray to enable fast access to the dataset on disk? It seems like xr.concat is not a scalable way to create a huge cdf file. Perhaps I need a way to xr.concat directly to disk, or a separate tool to combine cdfs.

A: Xarray's lazy loading for combining multiple netCDF files on disk requires using dask.
I recommend using open_mfdataset which takes care of most of these details automatically, e.g., xr.open_mfdataset('all/my/files/*.nc', concat_dim='sample').


text:
Q: Почему метод computed не работает при изменении input.value? При изменении значений полей в input.value в поле total ничего не происходит, а по идее должны складываться. Почему нет реактивности и как это исправить?

new Vue({
  el: "#app",
  data: {
  numbers: [5,5,0,0],
    totalNumbers: 0
  },
  computed: {
   countAll(){
     return this.numbers.forEach((item) => {
       this.totalNumbers += item;
      })
    }
  }
})
table {
  width: 100%;
  outline: 1px solid black;
}
tr {
  outline: 1px solid #ccc;
}
td {
  border: 1px dashed green;
}

      Number

        <input type="text" :value="item">

      total {{ totalNumbers }}

A: <input type="text" :value="item"> - этой строкой вы только выводите значение в input. Но при изменении значения - массив numbers не изменяется.
1 вариант
Для этого нужно определить метод, который будет изменять значение текущего input.

  <input type="number" :value="item" @input="update($event, index)" />

methods: {
  update(event, index) {
    this.numbers.splice(index, 1, Number(event.target.value))
  }
}

2 вариант
Либо воспользоваться директивой v-model для двунаправленного связывания данных с элементами форм input, textarea и select.

  <input type="number" v-model.number="numbers[index]" />

Теперь значения в массиве numbers будут обновляться при вводе в input. А модификатор .number у v-model будет автоматически приводить значение к типу Number. Как видно второй вариант попроще, не нужно определять методы в поле methods.
Обратите внимание на numbers[index] - просто записать v-model="item" не даст никакого эффекта для массива, состоящего из примитивов.

Так как у вас уже определено вычисляемое свойство countAll, то вводить промежуточное свойство totalNumbers уже не нужно.

// Отключим ненужные для примера
// сообщения в консоли.
Vue.config.productionTip = false
Vue.config.devtools = false

new Vue({
  el: "#app",
  data: {
    numbers: [5, 5, 0, 0]
  },
  computed: {
    total() {
      // Воспользуемся методом `reduce`.
      // https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce
      return this.numbers.reduce((accumulator, current) => accumulator + Number(current))
    }
  }
})
body {
  margin-top: 50px;
}

table {
  width: 100%;
  outline: 1px solid black;
}

tr {
  outline: 1px solid #ccc;
}

td {
  border: 1px dashed green;
}

        Number

          <input type="number" v-model.number="numbers[index]" />

        total {{ total }}


text:
Q: Nothing appears in terminal when trying to activate my conda environment I am trying to create and activate an anaconda environment. To create the environment, I used the following command:
(base) C:\Users\sanse> conda create -n myenv python=3.6

After this environment was created, I double checked with:
(base) C:\Users\sanse> conda info --envs

and this listed all my environments, and this new one I just created was in that list.
However, when I type either of the following commands:
conda activate myenv
activate myenv

, they execute in the prompt, the (base) disappears, but the name of the environment, (myenv) does not show up, and the prompt is just left as:
(base) C:\Users\sanse> conda activate myenv
C:\Users\sanse>

I then type in the info command again and it indicates that I am still in the base environment.
What is going on here? How can I activate an environment?

A: My computer uses Windows10 OS.
Not long ago, there was no problem.
But nowadays, my 'Anaconda prompt' cannot activate my environment.
If I try to activate an environment, it cannot activate the environment, and (base) disappears.
The prompt returns as below.
(base) C:\Users\user>conda activate
C:\Users\user>

The deactivation vice versa.
(base) C:\Users\user>conda deactivate
C:\Users\user>

conda info returns
(base) C:\Users\user>conda activate DataScience
C:\Users\user>conda info

     active environment : base
    active env location : C:\ProgramData\Anaconda3
            shell level : 1
       user config file : C:\Users\user\.condarc
 populated config files : C:\Users\user\.condarc
          conda version : 4.10.3
    conda-build version : 3.18.11
         python version : 3.7.5.final.0
       virtual packages : __cuda=11.2=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : C:\ProgramData\Anaconda3  (read only)
      conda av data dir : C:\ProgramData\Anaconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\ProgramData\Anaconda3\pkgs
                          C:\Users\user\.conda\pkgs
                          C:\Users\user\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\user\.conda\envs
                          C:\ProgramData\Anaconda3\envs
                          C:\Users\user\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.10.3 requests/2.22.0 CPython/3.7.5 Windows/10 Windows/10.0.19041
          administrator : False
             netrc file : None
           offline mode : False

'''
It says that the conda activate does not work in the 'Anaconda prompt'.
I was wandered for a while, and I tried this using the 'Anaconda PowerShell prompt'.
It succeeded to activate the environment.
Activation via 'Anaconda Navigator' also worked
(base) PS C:\Users\user> conda activate DataScience
(DataScience) PS C:\Users\user>

(DataScience) PS C:\Users\user> conda info

     active environment : DataScience
    active env location : C:\ProgramData\Anaconda3\envs\DataScience
            shell level : 2
       user config file : C:\Users\user\.condarc
 populated config files : C:\Users\user\.condarc
          conda version : 4.10.3
    conda-build version : 3.18.11
         python version : 3.7.5.final.0
       virtual packages : __cuda=11.2=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : C:\ProgramData\Anaconda3  (read only)
      conda av data dir : C:\ProgramData\Anaconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\ProgramData\Anaconda3\pkgs
                          C:\Users\user\.conda\pkgs
                          C:\Users\user\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\user\.conda\envs
                          C:\ProgramData\Anaconda3\envs
                          C:\Users\user\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.10.3 requests/2.22.0 CPython/3.7.5 Windows/10 Windows/10.0.19041
          administrator : False
             netrc file : None
           offline mode : False

My questions remains:

*

*Why the 'Anaconda prompt' is malfunction activating my environment?

*What difference made 'Anaconda PowerShell prompt' work at the same time?


text:
Q: Eclipse RCP retrieve compilation errors I'm developing an eclipse rcp. When i run a project, it is first builded and then launched. If the builder failed to compile the project, then i have to notify the user about that.
Which is the better way to know if there were errors during compilation?
thanks

A: One way is to add your own builder in eclipse. Go to Project->properties->Builders and then New to add your own builder. You can have an ant script or maven as builder. Ofcourse you need to know ant for this.

A: The solution was contained in the api of IncrementalProjectBuilder in the build method:

Throws:
      CoreException - if this build fails.

I have to throw an exception when the builder failed.


text:
Q: Replacing numbers with colours in a dataframe in r I have the following data.frame
df<-data.frame(x=c("A","B","C"),colour=c(0.3,0.6,0.9))

  x colour
1 A    0.3
2 B    0.6
3 C    0.9

I want to replace the numbers in df[,"colour"] with colours such that
< 0.4 = colour 1
0.4 - 0.7 = colour 2
< 0.7= colour 3

I have tried the following replacement scheme but the previous colour assignment are replaced with the latter. Any advice?
library(RColorBrewer)

g<-brewer.pal(3,"Greens")

col1<-df[,"colour"] < 0.4
df[col1,"colour"]<-g[1]
col2<-df[,"colour"] < 0.7
df[col2,"colour"]<-g[2]
col3<-df[,"colour"] >= 0.7
df[col3,"colour"]<-g[3]

Thanks for you advice.
THE SOLUTION
Thanks seancarmody (and spaceman for useful comments)
v<-c(0.45,0.65,0.75,0.85,0.95)
breaks<-c(0.4,0.5,0.6,0.7,0.8,0.9)

#Create a colour for each section
cols<-brewer.pal(length(breaks)+1,"Greens")
#Replace the gsim values with colours using the breaks
v <- as.character(cut(v, c(-Inf, breaks, Inf),labels=cols))

 > v
[1] "#C7E9C0" "#74C476" "#41AB5D" "#238B45" "#005A32"

A: Your approach will work if you change order:
col2<-df[,"colour"] < 0.7
df[col2,"colour"]<-g[2]
col1<-df[,"colour"] < 0.4
df[col1,"colour"]<-g[1]

Since everything less than 0.4 is also less than 0.7, your approach was overwriting col1. Since you've edited your original question, the above is out of date. I'd just use the more general approach here:
breaks <- c(0.4, 0.7)  # you can add more cut points here
cols <- brewer.pal(length(breaks) + 1, "Greens")
df$colour <- as.character(cut(df$colour, c(-Inf, breaks, Inf), labels=cols))


text:
Q: Print all paths to leafs of a tree-like list array and concatenate corresponding values in the path I have an array consisting of keys and values where keys are a tree like numbered list.
This is the input array:
inputArr =     [
                ["1", "I can "],
                ["1.1", "speak "],
                ["1.1.1", "English."],
                ["1.1.2", "Chinese "],
                ["1.1.2.1", "well."],
                ["1.2", "eat noodles."],
                ["1.3", "play football."],
                ["2", "I "],
                ["2.1", "drink."],
                ["2.2", "sleep."],
                ["3", "I am the man."],
                ["4", "Hire me."]
               ]

Expected output:
outputArr =    [
                ["1.1.1", "I can speak English."],
                ["1.1.2.1", "I can speak Chinese well."],
                ["1.2", "I can eat noodles."],
                ["1.3", "I can play football."],
                ["2.1", "I drink."],
                ["2.2", "I sleep."],
                ["3", "I am the man."],
                ["4", "Hire me."]
               ]

Let me explain the first output:
The first leaf in the inputArray is "1.1.1". It's path is: "1"->"1.1"->"1.1.1". When the
values in the path are concatenated: "I can " + "speak " + "English.".
I have studied all the relevant stackoverflow questions. I have got no clues to my problem.
I am thinking of an algorithm like this:
iterating from bottom of the array:
if the key length is 1, it is a root parent item.
if the key above has length >1, it is a leaf item. Now, get path by splitting the key, and concatenate the corresponding values.

I have tried editing Bit's code. But it only works partially. The code I have used is:
function getSentences(arr) {

  let outputArr = [],
    s = [],
    curr, next;

  for (let i = 0; i < arr.length - 1; i++) {
    curr = arr[i];
    next = arr[i + 1];

    if (curr[0].length == 1) {
      s.push(curr[1]);
      if (curr[0].length == next[0].length) outputArr.push([curr[0], s.join('')]);
    } else if (curr[0].length < next[0].length) {
      s.push(curr[1]);
    } else if (curr[0].length >= next[0].length) {
      outputArr.push([curr[0], s.join('') + curr[1]]);
      if (curr[0].length > next[0].length) {
        s.pop();
      }
    }
  }

  for (i = 0; s.length == next[0].length; i++) {
    s.pop()
  }
  s.push(next[1])
  outputArr.push([next[0], s.join('')])

  return outputArr

}

var inputArr = [
  ["1", "I can "],
  ["1.1", "speak "],
  ["1.1.1", "English."],
  ["1.1.2", "Chinese "],
  ["1.1.2.1", "well."],
  ["1.2", "eat noodles."],
  ["1.3", "play football."],
  ["2", "I "],
  ["2.1", "drink."],
  ["2.2", "sleep."],
  ["3", "I am the man."],
  ["4", "Hire me."]
];

var outputArr = getSentences(inputArr);
console.log(outputArr);

Can you suggest any correction or update, any alternative piece of code, any algorithm or hint about the problem? Any help will be much appreciated.

A: Assuming your data is always properly sorted, like in the example, we can do this in linear time using a stack. The basic algorithm would be like this:

*

*init the stack with a dummy item

*take each data item

*compare data item with the top of the stack (TOS)

*if the item > TOS (like 1.1 > 1), push it to the stack and continue

*otherwise, output everything on the stack concatenated

*while item <= TOS, keep popping items off the stack

*in the end, output everything that's left on the stack

A: This can be definitely improved, but it works.
function getSentences(arr) {

  let outputArr = [], s = [], curr, next;

  for (let i=0; i < arr.length-1; i++) {
    curr = arr[i];
    next = arr[i+1];

    if (curr[0].length == 1) {
      s.push(curr[1]);
      if (curr[0].length == next[0].length) outputArr.push([curr[0], s.join('')]);
    }

    else if (curr[0].length < next[0].length) {
      s.push(curr[1]);
    }

    else if (curr[0].length >= next[0].length) {
      outputArr.push([curr[0], s.join('') + curr[1]]);
      if (curr[0].length > next[0].length) {
        s.pop();
      }
    }
  }

  for (i=0; s.length == next[0].length; i++) {
    s.pop()
  }
  s.push(next[1])
  outputArr.push([next[0], s.join('')])

  console.log(outputArr);
  return outputArr

}

This function assumes something like "1.12.2" shouldn't exist and that the array is sorted like in the example.
If you want it to work with the hypothetical "1.12.2", replace .length in the comparisons with path.replace(/[^.]/g, "").length

A: You could build a tree first and the get the connected pathes and strings.

const
    getPathes = ({ value = '', sub }) => sub
        ? Object
            .entries(sub)
            .flatMap(([k, v]) => getPathes(v).map(([p, s]) => [k + (p && '.') + p, value + (value && '') + s]))
        : [['', value]],
    input = [["1", "I can "], ["1.1", "speak "], ["1.1.1", "English."], ["1.1.2", "Chinese "], ["1.1.2.1", "well."], ["1.2", "eat noodles."], ["1.3", "play football."], ["2", "I "], ["2.1", "drink."], ["2.2", "sleep."], ["3", "I am the man."], ["4", "Hire me."]],
    tree = input.reduce((t, [path, value]) => {
        path.split('.').reduce((o, k) => (o.sub ??= {})[k] ??= {}, t).value = value;
        return t;
    }, {}),
    result = getPathes(tree);

console.log(result);
console.log(tree);
.as-console-wrapper { max-height: 100% !important; top: 0; }


text:
Q: How to add custom CSS in iframe tag for Web view I want my site to look different in app. How can I apply custom CSS to web view?
<iframe  src="https://url.com" style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;">
  Your browser doesn't support iframes
</iframe>


text:
Q: Result of Invoke-RestMethod returns a system.object[] after exported to csv I'm working on a project where I use Invoke-RestMethod in PowerShell to get information that I'll export in CSV format. Seems simple enough, but I'm having an issue with the exported data. Most of the csv file is fine, but two columns just say "System.object[]" instead of the actual underlying data. The data itself is just an array of strings, but I want it exported as a single string separated by columns.
This is what I currently have:
'''
$scheduleResult = Invoke-RestMethod -Uri $scheduleURL -Method GET -Headers $headers

    if (!$Error) {
        $scheduleResult | Add-Member -MemberType NoteProperty -Name "Workspace" -Value $workspaceName
        $scheduleResult | Add-Member -MemberType NoteProperty -Name "Dataset" -Value $datasetName
        $scheduleResult | Add-Member -MemberType NoteProperty -Name "Dataset ID" -Value $datasetID
        $scheduleResult | Export-Csv -Path $refreshSchedPath -Append -Encoding UTF8
    }

'''

A: Add the .ToString() method when you select the value. Ex:
$scheduleResult | Add-Member -MemberType NoteProperty -Name "Workspace" -Value $workspaceName.ToString()

A: Did you mean "exported as a single string separated by commas"?  If so, you just need to join the arrays into a single strings using the -join operator.
$scheduleResult = Invoke-RestMethod -Uri $scheduleURL -Method GET -Headers $headers

if (!$Error) {
    $scheduleResult | Add-Member -MemberType NoteProperty -Name 'Workspace' -Value ($workspaceName -join ', ')
    $scheduleResult | Add-Member -MemberType NoteProperty -Name 'Dataset' -Value ($datasetName -join ', ')
    $scheduleResult | Add-Member -MemberType NoteProperty -Name 'Dataset ID' -Value ($datasetID -join ', ')
    $scheduleResult | Export-Csv -Path $refreshSchedPath -Append -Encoding UTF8
}


text:
Q: DataStax Enterprise Amazon AMI I'm trying to launch a new instance of DataStax AMI on a EC2 Amazon instance. I tried this in 2 different regions (us-east and eu-west), using these AMIs: ami-ada2b6c4, ami-814ec2e8 (us-east) and ami-7f33cd08, ami-b2212dc6 (eu-west)
I followed this documentation:
http://www.datastax.com/documentation/datastax_enterprise/4.6/datastax_enterprise/install/installAMI.html
So this is what I've done so far:

*

*I've created a new security group (with those specific ports - I cannot upload the print screen because I have just created this account)

*I've create a new key pair

*I've launched the DataStax AMI with these configuration details:
--clustername cluster --totalnodes 4 --version enterprise --username my_name
--password my_password --searchnodes 2
(I have verified my credentials - I can login here http://debian.datastax.com/enterprise/ )

*After selecting the previous created security group & key pair I launched the instance.

*I've connected to my DataStax Enterprise EC2 instance and this is the displayed log:
Cluster started with these options:
--clustername cluster --totalnodes 4 --version enterprise --username my_name
--password **** --searchnodes 2
03/12/15-08:59:23 Reflector: Received 1 of 2 responses from: [u'172.31.34.171']...
Exception seen in ds1_launcher.py. Please check ~/datastax_ami/ami.log for more info.
Please visit ....
and the ami.log shows these messages:
[INFO] 03/12/15-08:59:23 Reflector: Received 1 of 2 responses from: [u'172.31.34.171']
[ERROR] EC2 is experiencing some issues and has not allocated all of the resources in under 10 minutes.
Aborting the clustering of this reservation. Please try again.
[ERROR] Exception seen in ds1_launcher.py:
Traceback (most recent call last):
File "/home/ubuntu/datastax_ami/ds1_launcher.py", line 22, in initial_configurations
ds2_configure.run()
 File "/home/ubuntu/datastax_ami/ds2_configure.py", line 1135, in run
File "/home/ubuntu/datastax_ami/ds2_configure.py", line 57, in exit_path
AttributeError: EC2 is experiencing some issues and has not allocated all of the resources in under 10 minutes.
Aborting the clustering of this reservation. Please try again.

Any suggestion on how to fix this?
Any help will be greatly appreciated!
Have a nice day!

A: seems to be an issue with Amazon EC2 instances.
looks like there are no available instances of that type in that region at that AZ at that moment.
another thing you can try is just using the repos install just opscenter in a ec2 instance that you already have (or a new one), and try to create the new nodes/cluster through opscenter, it's pretty simple and will let you choose the AMI, secGroup and keyPair you already have.


text:
Q: Getting shell prompt twice in Java JSch Shell Okay so, I'm having a problem where the response from the shell is very inconsistent.
The welcome message for example, can come in 2 separate responses. And for some reason, when I use any command after that, the prompt will show up twice in my response.
I've noticed that these problems only occur when using my own piped input/output streams. When I use System.in and System.out, these problems don't occur at all.
Here's a picture where I use System.in and System.out:

When using my own piped input/output streams:

Below the related code.
SSHConnection.java
package com.displee.ssh;

import com.jcraft.jsch.*;

import java.util.function.Function;

public class SSHConnection {

    private static final JSch JSCH_INSTANCE = new JSch();

    private Session session;

    private ShellSession shellSession;

    public SSHConnection(String ip, String username, String password) {
        try {
            this.session = JSCH_INSTANCE.getSession(username, ip);
            this.session.setPassword(password);
            this.session.setConfig("StrictHostKeyChecking", "no");
        } catch(Exception e) {
            e.printStackTrace();
            this.session = null;
        }
    }

    public boolean connect() {
        try {
            session.connect();
            return true;
        } catch(Exception e) {
            e.printStackTrace();
            session.disconnect();
            return false;
        }
    }

    public boolean isConnected() {
        return session.isConnected();
    }

    public void disconnect() {
        session.disconnect();
    }

    public boolean startShellSession(Function<String, Void> callback) {
        try {
            shellSession = new ShellSession();
            shellSession.start(session, callback);
            return true;
        } catch(Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    public void writeShellMessage(String message) {
        shellSession.write(message + "\r\n");
    }

}

ShellSession.java
package com.displee.ssh;

import com.jcraft.jsch.Channel;
import com.jcraft.jsch.ChannelShell;
import com.jcraft.jsch.Session;

import java.io.*;
import java.util.function.Function;

/**
 * A class representing a shell session.
 * @author Displee
 */
public class ShellSession {

    /**
     * If this session is running.
     */
    private boolean running = true;

    private PipedOutputStream poutWrapper;

    private PipedInputStream pin = new PipedInputStream(4096);

    private PipedInputStream pinWrapper = new PipedInputStream(4096);

    private PipedOutputStream pout;

    private String lastCommand;

    /**
     * Constructs a new {@code ShellSession} {@code Object}.
     */
    public ShellSession() {
        try {
            pout = new PipedOutputStream(pinWrapper);
            poutWrapper = new PipedOutputStream(pin);
        } catch(Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * Start this shell session.
     * @param session The ssh session.
     */
    public void start(Session session, Function<String, Void> callback) {
        ChannelShell shellChannel = null;
        try {
            shellChannel = (ChannelShell) session.openChannel("shell");
            shellChannel.setInputStream(pin);
            shellChannel.setOutputStream(pout);
            shellChannel.connect();
        } catch(Exception e) {
            e.printStackTrace();
        }
        if (shellChannel == null) {
            return;
        }
        final Channel channel = shellChannel;
        Thread thread = new Thread(() -> {
            while (running) {
                try {
                    if (pinWrapper.available() != 0) {
                        String response = readResponse();
                        callback.apply(response);
                    }
                    Thread.sleep(100);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            channel.disconnect();
        });
        thread.setDaemon(true);
        thread.start();
    }

    /**
     * Stop this shell session.
     */
    public void stop() {
        running = false;
    }

    /**
     * Send a message to the shell.
     * @param message The message to send.
     */
    public void write(String message) {
        lastCommand = message;
        try {
            poutWrapper.write(message.getBytes());
        } catch(IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * Read the response from {@code pinWrapper}.
     * @return The string.
     * @throws IOException If it could not read the piped stream.
     */
    private synchronized String readResponse() throws IOException {
        final StringBuilder s = new StringBuilder();
        while(pinWrapper.available() > 0) {
            s.append((char) pinWrapper.read());
        }
        return s.toString();
    }

}

My JavaFX controller:
package com.displee.ui;

import com.displee.ssh.SSHConnection;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

import java.net.URL;
import java.util.ResourceBundle;

public class Controller implements Initializable {

    @FXML
    private TextArea console;

    @FXML
    private TextField commandInput;

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        SSHConnection connection = new SSHConnection("host", "username", "password");
        connection.connect();
        connection.startShellSession(s -> {
            console.appendText(s);
            return null;
        });
        commandInput.setOnAction(x -> {
            connection.writeShellMessage(commandInput.getText());
            commandInput.clear();
        });
    }

}

Complete code: https://displee.com/upload/SSHProject.zip
I tried increasing the size of my inputstreams, but that didn't work.
This problem is really frustrating me.
If anyone know how I can fix my problem, I'd really appreciate it.
Note: I've also noticed that it's pretty slow when using my piped streams. How can I speed this up?

A: Are you correctly processing CR (carriage return)?
The server probably sends the prompt twice in all cases. But if there's CR between the two prompts, when printed on System.out the second prompt will overwrite the first. While if your stream interprets the CR as a "new-line" (=line feed), you get two prompts.


text:
Q: Struts 2 Login Form Problems I want to create a simple login form in Struts 2 but I'm having problems at seeing the input fields for some reason and after I submit the name of the user doesn't appear.
Here is the code:
Struts redirects to my struts.xml.
my struts.xml
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <constant name="struts.enable.DynamicMethodInvocation" value="false"/>

    <constant name="struts.devMode" value="true" />

    <package name="user" namespace="/User" extends="struts-default">
        <action name="Login">
            <result>Login.jsp</result>
        </action>
        <action name="DashboardAction" class="action.DashboardAction">
            <result name="success">Dashboard.jsp</result>
        </action>
    </package>

</struts>

The Bean class
DashboardAction.java:
package action;

public class DashboardAction {
    private String username;

    public String execute(){
        return "success";
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }
public String getPassword() {
    return password;
}

public void setPassword(String password) {
    this.password = password;
}

}

The JSPs
Login.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Login</title>

Struts 2 Login Test

           <form action="DashboardAction" id="form1" method="post" autocomplete="off">

                    <s:textfield name="username" label="Utilizador"/>

                    <s:password name="password" label="Password"/>

                    <s:submit value="Entrar" method="execute"/>

            </form>

Dashboard.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Welcome User</title>

Hello
        <s:property value="username"/>

Why doesn't this work after I press submit? It's supposed to go to Dashboard.jsp?

A: Here you go :
 <result name="success">/Dashboard.jsp</result>

You need to specify the full-path to the JSPs in your results. Notice the /. You need to do the same to your other result pages including Login.jsp

A: You should map the form to the action that accept data submitted. Use Struts tags
<%@ taglib prefix="s" uri="/struts-tags" %>

<s:form action="Welcome" ...
  <s:textfield name="username" ...
  <s:password name="unknown" ...

couldn't map the password field because in your action there's not a property. May be if you create it
private String unknown;

public String getUnknown() {
    return unknown;
}

public void setUnknown(String unknown) {
    this.unknown = unknown;
}

A: Define property password in your action class like below.
DashboardAction.java
package action;

public class DashboardAction {
    private String username;
    private String password; // you don't have this line in your action class.
    public String execute(){
        return "success";
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }
public String getPassword() {
    return password;
}

public void setPassword(String password) {
    this.password = password;
}

}


text:
Q: Branching processes extinction (homework) This is my stochastic process course homework. I can solve (a)(b), which are easy to prove. But I have no idea about (c). Could you give me some idea?

A: Hints:

*

*$P(\text{extinction}\mid X_n\ne0)=P(\text{extinction}; X_n\ne0)/P(X_n\ne0)$

*$P(X_n\ne0)\geqslant P(\text{survival})=1-P(\text{extinction})$

*$P(\text{extinction}; X_n\ne0)=P(\text{extinction})-P(X_n=0)$

This yields (if I am not mistaken and to help you check your solution to come) the upper bound
$$
P(\text{extinction}\mid X_n\ne0)\leqslant\frac{a}{1-a}\rho^n$$


text:
Q: Is it safe to refer to a possibly nonexistant variable after a check in an if statement? Say I have a myObject class with a member called prop. I have a variable var which may or may not be a myObject. I want to check if prop holds a certain value, and if so, do something, and if it doesn't, or var is not a myObject, do nothng.
Would it be safe to do the following:
if isinstance(var, myObject) and var.prop == 10:
    #Do something

Basically, is it guaranteed that the second part of that if statement will not be checked if the first part evaluates to False? If it is checked even if var is not a myObject, an error will be thrown.

A: To answer your question, yes, and short circuits. But I wouldn't do it that way. A better method is to use hasattr or a try, except block.
if hasattr(var, 'prop') and var.prop == 10:
    print var.prop

Or (if it's unusual for a propless var to come along):
try:
    print var.prop
except AttributeError:
    print "propless var"


text:
Q: Android Studio "Error retrieving parent, No resource found that match the given name" on TargetSdkVersion update to 23 While updating TargetSdkVersion to 23 on project build using older targetVersion on Android Studio, i got following error on build.
/path/to/project/app/build/intermediates/res/merged/debug/values/values.xml
Error:(1334) Error retrieving parent for item: No resource found that matches the given name '@style/TextAppearance.AppCompat.Light.Base.SearchResult.Subtitle'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/path/to/AndroidSdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1

The build.gradle is
apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.myapplicaitonid"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 8
        versionName "1.0.7"

    }
    buildTypes {
        release {
            minifyEnabled false;
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile "com.android.support:appcompat-v7:23.1.1"
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.squareup.picasso:picasso:2.4.0'
}

Tried : https://stackoverflow.com/a/27243716/4221298
but still same issues.
Anyone faced similar and solved?

A: Got It
This theme is deprecated.
Read TextAppearance.AppCompat.Light.SearchResult.Subtitle

Error:(1144) Error retrieving parent for item: No resource found that
  matches the given name
  '@style/TextAppearance.AppCompat.Light.Base.SearchResult.Subtitle'.

<style name="TextAppearance.AppCompat.Light.SearchResult.Subtitle"
           parent="TextAppearance.AppCompat.Light.Base.SearchResult.Subtitle">
</style>

As Android evolves with each new version, some behaviors and even appearances might change. However, if the API level of the platform is higher than the version declared by your app's targetSdkVersion, the system may enable compatibility behaviors to ensure that your app continues to work the way you expect.
You can't call due to deprecation .

TextAppearance.AppCompat.Light.Base.SearchResult.Subtitle
  DEPRECATED From API 23 .


text: Q: Web Config for node js REST API inorder to host in windows server IIS I'm first time creating REST API in node js. Can someone guide me what webconfig file should contain. I need to deploy this on windows server & I need to call this restapi from front end.


text:
Q: Eclipse Spring Boot - AutoConfigure cycle detected between HibernateJpaAutoConfiguration and CacheAutoConfiguration I am using injecting some other projects in my service . But while integrating them I am facing below exception :
java.lang.IllegalStateException: AutoConfigure cycle detected between org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration and org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration
All of the projects which I am injecting in my main project are built on spring-boot 2.1.3
What can fix this issue.
Please let me know if any other information required regarding this.
Below are the logs that are generated while running the service :
*

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v0.0.1-SNAPSHOT)

2019-05-23 19:49:08.398  INFO 12596 --- [           main] c.k.r.m.KmartMasterServiceApplication    : Starting KmartMasterServiceApplication on ******* with PID (started by athora0 in C:\Users\******\Documents\Migration Project\ababba)
2019-05-23 19:49:08.402  INFO 12596 --- [           main] c.k.r.m.KmartMasterServiceApplication    : No active profile set, falling back to default profiles: default
2019-05-23 19:49:09.691 ERROR 12596 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: AutoConfigure cycle detected between org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration and org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration
    at org.springframework.util.Assert.state(Assert.java:73) ~[spring-core-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.autoconfigure.AutoConfigurationSorter.doSortByAfterAnnotation(AutoConfigurationSorter.java:92) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.autoconfigure.AutoConfigurationSorter.doSortByAfterAnnotation(AutoConfigurationSorter.java:95) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.autoconfigure.AutoConfigurationSorter.sortByAnnotation(AutoConfigurationSorter.java:78) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.autoconfigure.AutoConfigurationSorter.getInPriorityOrder(AutoConfigurationSorter.java:67) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector$AutoConfigurationGroup.sortAutoConfigurations(AutoConfigurationImportSelector.java:461) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector$AutoConfigurationGroup.selectImports(AutoConfigurationImportSelector.java:442) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGrouping.getImports(ConfigurationClassParser.java:881) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:804) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:774) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:315) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at com.kmart.res.master_service.KmartMasterServiceApplication.main(KmartMasterServiceApplication.java:28) [classes/:na]*


text:
Q: Поочередный клик на элементы набора в цикле Привет! есть html

Как сделать поочередный клик на каждом из элементов с задержкой в 1 сек и весь этот процесс повторить заново при достижении последнего элемента?
Пробовал это для обхода элементов (хотя бы один раз)
$('.litle a').each(function(){
setTimeout(function(){
$(this).click();
},1000);
});

И это
$('.productp .litle a').each(function(){
setTimeout(function(){
$(this).trigger('click');
},1000);
});

На элементы также навешен обработчик клика,который меняет картинки в слайдере. Потому я хочу пробежаться по элементам и увидеть поочередную смену картинок слайдера. этого не происходит и ошибок нет в консоли. ЧЯДНТ?

A: Можете так попробовать:
var $items = $('.litle a'),
    items_length = $items.length,
    i = 0;

$items.click(function(e){
  e.preventDefault();

  console.log($(this).attr('dat'))
});
setInterval(function(){
  if(i == items_length) {
    i = 0
  }

  $items.eq(i).click()

  i++

}, 1000)

https://codepen.io/anon/pen/NygLXE


text:
Q: Backup battery charger I'm trying to design some kind of backup battery charger - please see the image:

Normally, the DC supply is ON, and provides current for load and also charges the battery. Battery should be charged to 27V or more, and maximum charging current must be limited to 4 A (when battery is fully charged up the current should automatically decrease to 0).
When DC supply is turned OFF, the battery provides current for load instead, with maximum allowed current.
I'd like to ask You for any references, circuit ideas or even some keywords to look for on internet and other sources.
Thanks.

A: keyword: power path controller, ideal diode
something like that http://www.linear.com/product/LTC4417
look also at others vendors, like TI, Fairchild, On semi
Implementation is possible with discrete components only, cheaper but less efficient.


text:
Q: Appcelerator Titanium Alloy MVC: how is '$' useful? The framework is set up so that you can load multiple Views (and presumably associated Controllers) at the same time, but I'm having trouble writing correct controller code that 'knows' where everything is.
The Titanium documentation describes the '$' usage like so:

All UI elements which have an id attribute in a view are automatically defined and available as a property prefixed by the special variable $ in the controller. The $ is a reference to the controller. ... To access external controllers and views, use the Alloy.createController and Controller.getView methods, respectively.

The Titanium doc also says that generally Views and Controllers work in pairs.
Suppose I have a View defined that contains a 'back' button, and another View that is a refresh button.  The point is that these Views contain associated controllers that need to work no matter what context I'm in.  The back button needs to always close the top level window, and the refresh button needs to reload the main view's data, whatever 'main view' I am looking at.
So I create a master view, and load these two views into it.  Now I have 3 View-Controllers working together in one context.  The logic requires that the back button knows how to close its parent, or even do additional things depending on where you 'go back' from; the refresh button obviously needs to know how to access the parent view's data.  How can I use '$' to code if i'm always confined to a single controller?  To me, it doesn't make sense that I'm loading 'external' controllers or views when all 3 entities are working in the same place.

A: Here is an example how you can use $ between different Alloy controllers.
index.js:
$.open.addEventListener('click', function() {
    var view = Alloy.createController(view, { title: 'First Title' });
    view.setTitle('Second Title');
});

$.index.open();

view.js:
var args = arguments[0] || {};

$.setTitle = function(title) {
    $.title.text = title;
};

if (args.title) {
    $.setTitle(args.title);
}

Of course I assume that index.xml and view.xml exists and are similar to this:
index.xml:
<Alloy>
    <Window>
        <Button id="open" title="Open New Window" />
    </Window>
</Alloy>

view.xml:
<Alloy>
    <Window>
        <Label id="title">Empty Title</Label>
    </Window>
</Alloy>