text:
Q: html + css + react: how to provide margin to card without affecting the background top margin? I am using bootstrap 5
As soon as I use:

There is a top margin, which looks great for the card. However it pushes my background image down by the same margin. I have tried to put the card in a div with various container types but I can't retain the behaviour of both elements i.e. the card to have the margin from top, but the background image to start right below the header.
Full html:

<link rel="stylesheet" href="https://bootswatch.com/5/cosmo/bootstrap.min.css">

Register

            <form onSubmit={this.onSubmit}>

                    Username
                    <input type="text" className="form-control" name="username" onChange={this.onChange} value={username} />

                    Email
                    <input type="email" className="form-control" name="email"
                    onChange={this.onChange} value={email} />

                    Password
                    <input type="password" className="form-control" name="password"
                    onChange={this.onChange} value={password} />

                    Confirm Password
                    <input type="password" className="form-control" name="password2"
                    onChange={this.onChange} value={password2} />

                    <button type="submit" className="btn btn-primary">
                        Register
                    </button>

                    Already have an account? <Link to="/login">Login</Link>

            </form>

How would I go about ensuring that the background image has 0 margin from top/header while the card maintain the margin from top/header?

A: An easy and quick solution is to set the padding instead than the margin

<link rel="stylesheet" href="https://bootswatch.com/5/cosmo/bootstrap.min.css">

Register

            <form onSubmit={this.onSubmit}>

                    Username
                    <input type="text" className="form-control" name="username" onChange={this.onChange} value={username} />

                    Email
                    <input type="email" className="form-control" name="email"
                    onChange={this.onChange} value={email} />

                    Password
                    <input type="password" className="form-control" name="password"
                    onChange={this.onChange} value={password} />

                    Confirm Password
                    <input type="password" className="form-control" name="password2"
                    onChange={this.onChange} value={password2} />

                    <button type="submit" className="btn btn-primary">
                        Register
                    </button>

                    Already have an account? <Link to="/login">Login</Link>

            </form>

<link rel="stylesheet" href="https://bootswatch.com/5/cosmo/bootstrap.min.css">

Register

            <form onSubmit={this.onSubmit}>

                    Username
                    <input type="text" className="form-control" name="username" onChange={this.onChange} value={username} />

                    Email
                    <input type="email" className="form-control" name="email"
                    onChange={this.onChange} value={email} />

                    Password
                    <input type="password" className="form-control" name="password"
                    onChange={this.onChange} value={password} />

                    Confirm Password
                    <input type="password" className="form-control" name="password2"
                    onChange={this.onChange} value={password2} />

                    <button type="submit" className="btn btn-primary">
                        Register
                    </button>

                    Already have an account? <Link to="/login">Login</Link>

            </form>


text:
Q: Decrypting an apk and executing it at runtime I have an apk encrypted with AES that is stored on my SDCard. When I input the passphrase from a dialog box, the file gets decrypted. This is my code:
    public class MainActivity extends Activity {

//@SuppressWarnings("unchecked")
private static final String TAG = "MyActivity";
@Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

     AlertDialog.Builder alert = new AlertDialog.Builder(this);

        alert.setTitle("Title");
        alert.setMessage("Message");

        // Set an EditText view to get user input
        final EditText input = new EditText(this);
        alert.setView(input);

        alert.setPositiveButton("Ok", new
    DialogInterface.OnClickListener()   {
        public void onClick(DialogInterface dialog, int whichButton) {
        String value = input.getText().toString();
        try {
                Decrypt(value);
                Log.d(TAG,value);
            } catch (InvalidKeyException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (NoSuchAlgorithmException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (NoSuchPaddingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }});

        alert.setNegativeButton("Cancel", new
    DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int
    whichButton) {
                 // Canceled.
            }
            });

             alert.show();
    }
    static void Decrypt(String Key) throws IOException, NoSuchAlgorithmException,
    NoSuchPaddingException, InvalidKeyException {

    final String libPath = Environment.getExternalStorageDirectory() +
    "/encrypted.jar";
    FileInputStream fis = new FileInputStream(libPath);

    FileOutputStream fos = new
    FileOutputStream(Environment.getExternalStorageDirectory() + "/decrypted.jar");
    SecretKeySpec sks = new SecretKeySpec(Key.getBytes(), "AES");
    Cipher cipher = Cipher.getInstance("AES");
    cipher.init(Cipher.DECRYPT_MODE, sks /*originalKey*/);
    CipherInputStream cis = new CipherInputStream(fis, cipher);
    int b;
    byte[] d = new byte[8];
    while((b = cis.read(d)) != -1) {
    fos.write(d, 0, b);
    }
    fos.flush();
    fos.close();
    cis.close();
    }

Now I want that when i click the OK button, not only the encrypted file is decrypted, it is also executed. How should I proceed? Should I use a custom class loader? Any ideas?
Thanks

A: You cannot "execute" an APK, any more than you can "execute" a ZIP file.
If by "execute" you mean "install", you can use ACTION_VIEW with an appropriate Uri and MIME type to the unencrypted APK file on external storage.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Notification email from stackoverflow contains "<3" after zip code I noticed "<3" appears at the very end of the my stackoverflow notification emails (after the zip code). Is this problem related to gmail?

A: StackOverflow loves you.

A: I feel so warm and fuzzy. I love you too, Stack Overflow! <3

A: Stack Overflow loves you! <3
This is the actual code in the email:
<3

So to answer your question, this is intentional and not a problem with GMail.

A: each email is baked with love!


text:
Q: the difference between poisson distribution and poisson process in terms of application What is the difference between poisson distribution and poisson process? I don't know technically in terms of application.
I know the value of lambda = 8 and k = 3, for 100 variates, how can I creates poisson distribution?
thank you.
Read a definition on poisson process;


text:
Q: In Debian Fluxbox, how do I fix the cursor on the second head? I have the problem that my cursor icon doesn't get drawn on the secondary monitor of a two monitor setup. It looks like this on the main screen:

But on the second screen it look like:

Interestingly, if I screenshot it with gnome-screenshot -p the cursor shows on the resulting picture (regardless of which monitor the window is on). This seems to imply that gnome knows what is there but fluxbox or the gpu driver doesn't.
I've tried using other cursor icons and while they show normally on the main monitor they do the same dashed line on the other screen. Happy to add any setting/conifg information would be helpful.
Edit 1
I was a little worried that it might be a driver issue and therefore not easily fixable. I have a "Sapphire Nitro r9 390" using the HDMI out on the 'bad' screen and displayport on the 'good' screen (ah, so maybe I could put both through with displayport. Worth a try anyway.). I'm using the proprietary "AMD Catalyst Linux Graphics Driver" fglrx 15.20.3 [Sep  8 2015]. The command lspci | grep VGA shows:
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Hawaii PRO [Radeon R9 290] (rev 80)

While the driver info fglrxinfo shows:
display: :0  screen: 0
OpenGL vendor string: Advanced Micro Devices, Inc.
OpenGL renderer string: AMD Radeon (TM) R9 390 Series
OpenGL version string: 4.5.13399 Compatibility Profile Context 15.201.1151

I'll try the DP for both and see if it helps.
Edit 2
I got another DP cable but it didn't seem to help. Mirroring the screens still has one with a normal cursor and one with the dots. I guess I'm stuck with it for the time being.
Edit 3
Updating to the latest Catalyst driver seems to have solved my problem, yay! The driver I used was the "Crimson Edition 15.12" dated 12/18/2015. The version info is now:
OpenGL vendor string: Advanced Micro Devices, Inc.
OpenGL renderer string: AMD Radeon (TM) R9 390 Series
OpenGL version string: 4.5.13416 Compatibility Profile Context 15.302

A: The OP has reported that
updating to the latest Catalyst driver seems to have solved the problem.
The version info is now:
OpenGL vendor string: Advanced Micro Devices, Inc.
OpenGL renderer string: AMD Radeon (TM) R9 390 Series
OpenGL version string: 4.5.13416 Compatibility Profile Context 15.302


text:
Q: Update MySQL without specifying column names I want to update a mysql row, but I do not want to specify all the column names.
The table has 9 rows and I always want to update the last 7 rows in the right order.
These are the Fields
id
projectid
fangate
home
thanks
overview
winner
modules.wallPost
modules.overviewParticipant

Is there any way I can update the last few records without specifying their names?
With an INSERT statement this can be done pretty easily by doing this:
INSERT INTO `settings`
VALUES (NULL, ...field values...)

So I was hoping I could do something like this:
UPDATE `settings`
VALUES (NULL, ...field values...)
WHERE ...statement...

But unfortunately that doesn't work.

A: If the two first columns make up the primary key (or a unique index) you could use replace
So basically instead of writing
UPDATE settings
   SET fangate = $fangate,
       home = $home,
       thanks = $thanks
       overview = $overview,
       winner = $winner,
       modules.wallPost = $modules.wallPost,
       modules.overviewParticipant = $modules.overviewParticipant
WHERE id = $id AND procjectId = $projectId

You will write
REPLACE INTO settings
 VALUES ($id,
         $projectId,
         $fangate,
         $home,
         $thanks
         $overview,
         $winner,
         $modules.wallPost,
         $modules.overviewParticipant)

Of course this only works if the row already exist, otherwise it will be created. Also, it will cause a DELETE and an INSERT behind the scene, if that matters.

A: You can't. You always have to specify the column names, because UPDATE doesn't edit a whole row, it edits specified columns.
Here's a link with the UPDATE syntax:
http://dev.mysql.com/doc/refman/5.0/en/update.html

A: No, it works on the INSERT because even if you didn't specify the column name but you have supplied all values in the VALUE clause. Now, in UPDATE, you need to specify which column name will the value be associated.
UPDATE syntax requires the column names that will be modified.

A: Are you always updating the same table and columns?
In that case one way would be to define a stored procedure in your schema.
That way you could just do:
CALL update_settings(id, projectid, values_of_last_7 ..);

Although you would have to create the procedure, check the Mysql web pages for how to do this, eg:
http://docs.oracle.com/cd/E17952_01/refman-5.0-en/create-procedure.html

A: I'm afraid you can't afford not specifying the column names.
You can refer to the update documentation here.


text:
Q: jQuery function not working when content changing I'm using this function in order to add a div inside an element,
(function() {
        $('.p-item').append('

)';
}) ();

I also having a filterable gallery using 'quicksand' plugin in the same page. Inside the gallery, I have elements with above mentioned class(p-item). When I sort the gallery, the contents are changing and suddenly above appended div is Disappearing.
Help me keep the div alive even the gallery is sorted.
Regards.

A: Call this function at the end of sorting process
function addDiv() {
  $('.p-item').append('

)';
}

A: I don't know if quicksand provides any hooks like post-sort events and such, but here is a generic way you can solve this problem:
var doMod = true;
$('#tree')[0].addEventListener('DOMSubtreeModified', function() {
    if (!doMod) { return; }
    doMod = false; // Supress handling of subtree event
    $('#tree').append('foo');
    doMod = true; // Restore the doMod flag
});

$('#tree').html('
New content
');

Example: http://jsfiddle.net/8dUSJ/
The 'DOMSubtreeModified' event is deprecated, though, and it's supposed to be superseded by Mutation observers. I don't have much knowledge about the latter, so refer to documentation. It seems to have questionable browser support.
EDIT:
Just so we're clear about this: the above solution won't keep the DIV 'alive'. It will only allow you to readd it after sorting.

A: You have problem in your code at the end of the append(), you have a ' outside not inside of the append().
(function() {
    $('.p-item').append('

)';
})();        //------------------------------------------^-----here is the issue.

Try this: http://jsfiddle.net/T8VC4/
(function() {
    $('.p-item').append('

');
})();


text:
Q: Make a image in division responsive I am having images in carosuel effect which keeps images in division.I want to make images responsive.despite of adding
class="img-responsive"

to img tag the image is not giving responsive effect can any one help me? and also I wanted to know if there is any way to make division responsive?

A: Yes there is,
<style>
@media only screen and (max-width: 980px) {
.img-responsive {
//insert css for 980 width lower
}}

@media only screen and (max-width: 700px) and (min-width : 400px) {
.img-responsive {
//insert css for 700 width lower
//css will not work at with lower than 400px
}
}
</style>

NOTE you can change the value of max width depending on what with you want to change your div. also you can set a min-width to determine what minimum width will the css take effect
cheers


text:
Q: Trouble with DontDestroyOnLoad I have main scene (street) and many child scenes (houses), to which I can come from the main scene. When I come to one home, then go back to the street, I need player object placed near that house, where he was. So I need to use DontDestroyOnLoad to remember his position.

But when I come at home, I need to disable player object from the main scene and here my code doesn't work. Also after first use of this script in simulation, I can't move cursor up /down, only left/right (and this is first person shooter)
public PS plr;

private GameObject playerOnMainScene;

public void Awake()
{
    PlayerSingleton();
    DisablePlayerOfMainScene();
}

void PlayerSingleton()
{
    if (!plr)
    {
        DontDestroyOnLoad(gameObject);
        plr = this;
    }
    else
        Destroy(gameObject);
}

void DisablePlayerOfMainScene()
{
    playerOnMainScene = GameObject.FindGameObjectWithTag("PlayerOnMainScene");

    if (SceneManager.GetActiveScene().name != "MainScene")
    {
        Debug.Log("1"); // this code doesn't work when scene name != "MainScene"
        playerOnMainScene.SetActive(false);
    }
    else
        playerOnMainScene.SetActive(true);
}


text:
Q: vector function 'at' Since the other direct access methods front(), back() and [] do not check for bounds, does 'at' introduce too much overhead for these checking if the vectors are large and one wants to iterate over them sequentially? I guess if one is sure of the bounds, [] is a better direct access option.

A: That's why there're separate [] and at(). If you're sure that you don't access out of bounds you use [] (or iterators), otherwise you may use at() if you wish.

A: at() cannot be quicker than [], but "too much overhead" is really up to you to decide. I suggest profiling the code with [] and at() and see whether it makes a significant difference.

A: If you want to iterate sequentially, then do neither.
It is preferable to use:
// C++03
BOOST_FOREACH(T const& t, vec) { }

// C++0x
for (T const& t: vec) { }

You'll get the maximum speed with no risk of stepping outside the defined range.

A: at method is slightly slower than the subscript [] operator.
Here is a simple timing test.
#include <ctime>
#include <cstdio>
#include <vector>
#include <stdint.h>
#include <algorithm>
using namespace std;

// Pentium clock timer
extern "C" {
  __inline__ uint64_t rdtsc() {
    uint32_t lo, hi;
    __asm__ __volatile__ (
    "xorl %%eax,%%eax \n        cpuid"
    ::: "%rax", "%rbx", "%rcx", "%rdx");
    __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
    return (uint64_t)hi << 32 | lo;
  }
}

vector<int>A;

uint64_t time_at()
{
    uint64_t start=rdtsc();
    srand(11101);
    for(int i=0;i<10000000;i++)
        int x=A.at(rand()%10000000);
    uint64_t end=rdtsc();
    return end-start;
}

uint64_t time_subscript()
{
    uint64_t start=rdtsc();
    srand(11101);
    for(int i=0;i<10000000;i++)
        int x=A[(rand()%10000000)];
    uint64_t end=rdtsc();
    return end-start;
}

int main()
{
    for(int i=0;i<10000000;i++)
        A.push_back(i);

    printf("At ===> %llu\n",time_at());
    printf("[] ===> %llu\n",time_subscript());
    return 0;
}

A: For one, at throws exception if the index is out of bounds, therefore requiring a compilation with exceptions enabled. That's likely one of the reasons it is just an additonal method for accessing vector elements.


text:
Q: What is the correct way to embed license information into a Jupyter Notebook file? I want to publish a Jupyter Notebook under Apache 2.0 license and therefore need to add a license header to the file, as instructed in the Apache 2.0 License file:

APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
     boilerplate notice, with the fields enclosed by brackets "[]"
     replaced with your own identifying information. (Don't include
     the brackets!)  The text should be enclosed in the appropriate
     comment syntax for the file format. We also recommend that a
     file or class name and description of purpose be included on the
     same "printed page" as the copyright notice for easier
     identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  implied.    See the License for the specific language governing
  permissions and    limitations under the License.

However, just adding the header as JavaScript comment will make the notebook invalid:
//
// Copyright ...
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

{
 "cells": [...],
 "metadata": {...},
 "nbformat": 4,
 "nbformat_minor": 4
}

or
/*
 * Copyright ...
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

{
 "cells": [...],
 "metadata": {...},
 "nbformat": 4,
 "nbformat_minor": 4
}

Both will not be loaded by JupiterLab.
I also noted that there is a top-level key metadata that should be the right place to add license information. However, the documentation does not define a key to add license information.
What is the correct way to embed license information into a Jupyter Notebook file?

A: Some solutions:
1. Repository License File
An article recommends to  just add license information to the contained repository. This is easy to apply, but does not fulfill the guideline. (This is the wrong place to discuses the legal aspects.)
2. License Notice as Content
One could add a markdown cell into the notebook with the license information. This is also easy to apply, but does not support automated processing by e.g. search engines.
3. License as Custom Metadata Field
The current notebook format definition (v4.4) only defines the keys authors, title, language_info, kernelspec, and orig_nbformat in metadata , but also allows additional keys. So one could just add e.g. a license key. In a (declined) feature request, the use of JSON-LD and schema.org was proposed to declare the license and other metadata. An adapted solution:
{
 "cells": [...],
 "metadata": {
  "@context": {
   "CreativeWork": "http://schema.org/CreativeWork",
   "Organization": "http://schema.org/Organization",
   "Person": "http://schema.org/Person",
   "author": "http://schema.org/author",
   "copyrightHolder": "http://schema.org/copyrightHolder",
   "copyrightYear": "http://schema.org/copyrightYear",
   "license": "http://schema.org/license",
   "name": "http://schema.org/name",
   "title": "http://schema.org/name",
   "url": "http://schema.org/url"
  },
  "@type": "CreativeWork",
  "author": [
   {
    "@type": "Person",
    "name": "<full author name>",
    "@id": "<some identifier URI, e.g. an ORCID URI>",
    "url": "<person website URL>"
   }
  ],
  "copyrightHolder": [
   {
    "@type": "Organization",
    "name": "<full organization name>",
    "url": "<organization website URL>"
   },
   {
    "@type": "Person",
    "name": "<full author name>",
    "@id": "<some identifier URI, e.g. an ORCID URI>",
    "url": "<person website URL>"
   }
  ],
  "copyrightYear": <year as yyyy>,
  "kernelspec": {...},
  "language_info": {...},
  "license": "<license URL>",
  "title": "<title of the notebook>"
 "nbformat": 4,
 "nbformat_minor": 4
}

Unfortunately, no additional keys are permitted in the root-node of jupyter notebooks and unknown keys will be removed by JupiterLab. Therefore, the @context and @type (CreativeWork) need to be added into the metadata node, which is not 100% correct, as the whole document (i.e. the root node) is the licensed CreativeWork. One could test it with e.g. Googles Structured Data Testing Tool. Applying this is a bit more work, but I think, it fulfills the guideline and it supports automated processing by e.g. search engines.


text:
Q: How can I run GlassFish and Selenium under the Cucumber test in maven project? How can I map all together in POM-file?

A: pom:
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>
            <groupId>pl.cucumber.test</groupId>
            <artifactId>cucumber-with-glassfish</artifactId>
            <version>1.0.0</version>

            <properties>
                <jdk.version>1.7</jdk.version>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <cucumber.version>1.1.3</cucumber.version>
                <junit.version>4.11</junit.version>
                <maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
                <maven-surefire-plugin.version>2.14.1</maven-surefire-plugin.version>
                <cargo-maven2-plugin.version>1.4.0</cargo-maven2-plugin.version>
                <glasfish.port>8080</glasfish.port>
                <glasfish.home>${project.build.directory}/glasfish</glasfish.home>
                <selenium.version>2.32.0</selenium.version>
            </properties>

            <dependencies>
                <dependency>
                    <groupId>info.cukes</groupId>
                    <artifactId>cucumber-java</artifactId>
                    <version>${cucumber.version}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>info.cukes</groupId>
                    <artifactId>cucumber-junit</artifactId>
                    <version>${cucumber.version}</version>
                    <scope>test</scope>
                </dependency>

                <dependency>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                    <version>${junit.version}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-java</artifactId>
                    <scope>test</scope>
                    <version>${selenium.version}</version>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>${maven-compiler-plugin.version}</version>
                        <configuration>
                            <source>${jdk.version}</source>
                            <target>${jdk.version}</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>${maven-surefire-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>integration-test</id>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.cargo</groupId>
                        <artifactId>cargo-maven2-plugin</artifactId>
                        <version>${cargo-maven2-plugin.version}</version>
                        <configuration>
                            <container>
                                <containerId>glassfish3x</containerId>
                                <zipUrlInstaller>
                                    <url>http://dlc.sun.com.edgesuite.net/glassfish/3.1.2.2/release/glassfish-3.1.2.2.zip</url>
                                    <downloadDir>${basedir}/downloads</downloadDir>
                                </zipUrlInstaller>
                                <output>${project.build.directory}/container.log</output>
                                <append>false</append>
                                <log>${project.build.directory}/cargo.log</log>
                                <systemProperties>
                                    <mySystemProperty>value</mySystemProperty>
                                </systemProperties>
                            </container>
                            <configuration>
                                <home>${glasfish.home}</home>
                                <properties>
                                    <cargo.servlet.port>${glasfish.port}</cargo.servlet.port>
                                    <cargo.logging>medium</cargo.logging>
                                </properties>
                            </configuration>
                            <!--
                            <deployables>
                                 <deployable>
                                                      <groupId>pl.cucumber.warproject</groupId>
                                                      <artifactId>warproject</artifactId>
                                                      <version>1.0</version>
                          <type>war</type>
                                   <properties>
                                     <context>mycontext</context>
                                  </properties>
                                </deployable>
                            </deployables>
                             -->
                        </configuration>
                        <executions>
                            <execution>
                                <id>start-container</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>start</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>stop-container</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </project>

RunIT:
@RunWith(Cucumber.class)
public class RunIT {
    //
}

TestTitlePages:
public class TestTitlePages {

    private WebDriver driver;

    @Given("^Connect to the given address$")
    public void a_User_has_no_money_in_their_current_account() {
        // Create a new instance of the html unit driver
        driver = new HtmlUnitDriver();

    }

    @When("^Address is (.*)$")
    public void connectTo(String address) {
        //Navigate to desired web page
        driver.get(address);
    }

    @Then("^Title is (.*)$")
    public void titleIs(String expectedTitle) {
        //get the title of the page
        String actualTitle = driver.getTitle();
        // verify title
        Assert.assertEquals(actualTitle,expectedTitle);
    }

}

test.feature:
Feature: Check the title

Scenario: Connect to the given address and check the title
Given Connect to the given address
When Address is http://www.google.com
Then Title is Google

Project structure:
src/test/
    java/
        pl/cucumber/test/
            RunIT.java
            TestTitlePages.java
    resources
        pl/cucumber/test
            test.feature

Call mvn verify


text:
Q: How to prove, by induction, that an infinitely nested radical is increasing How do I prove using induction that an infinitely nested radical, like sqrt(1+sqrt(1+sqrt(1+... is increasing. I have seen there are many examples on here like this but haven't seen one that proves the sequence is increasing. Could someone give me some tips or link to one which shows the proof that it is increasing? Thanks.

A: Define $a_{n+1}=\sqrt{a_n+1}$ with $a_1=1$ as in @abiessu's comment. Then you have to prove that $a_n<a_{n+1}$ for all $n$. For $n=1$ is trivial. Suppose that the result is valid for $n$. That is $$a_n< a_{n+1}.$$ And consider the case $n+1$, so we have to prove that $a_{n+1}< a_{n+2}$ but
$$a_{n+1}< a_{n+2}$$
$$\Leftrightarrow a_{n+1}^2< a_{n+2}^2$$ wich is true since  $$a_n+1< a_{n+1}+1$$ by induction hypothesis.

A: Let $f(x) = \sqrt{x+1}$, which is an increasing function of $x$ (for $x > -1$).
The composition of increasing functions is increasing.
Let $a_0 = 1$ and $a_{n+1} = f(a_n)$. Thus $a_n = f^{(n)}(a_0)$ (where $f^{(n)}$ is $f$ composed with itself $n$ times), but
$a_{n+1} = f^{(n+1)}(a_0) = f^{(n)}(a_1)$, so  since $a_1 = \sqrt{2} > a_0$ we have
$a_{n+1} > a_n$.
On the other hand, if you started from some other $a_0$ so that $a_1 < a_0$, the sequence would be decreasing, not increasing.  The boundary between increasing and decreasing is the fixed point, $(\sqrt{5}+1)/2$.


text:
Q: Sass::SyntaxError Preventing Heroku Rails App from Precompiling I'm getting the following error message when I try to push my app to Heroku.  It says the rake is aborted because:
remote:        Sass::SyntaxError: Invalid CSS after "...top: 4px solid ": expected ";", was "\  ;"
remote:        (sass):4367

The weird thing here is that if I search for top: 4px solid in the entire project, it doesn't appear. at all.  The error says (sass):4367, but I have no idea how to find that.
If it matters, I just finished upgrading from Rails 4.2 to Rails 5.2.
Does anyone know a way to find where this is or fix it?

A: I had the same issue, but on Rails 4.2.0. It's caused by a bug in sass 3.7.0 (which was released on the 6th of november). Either downgrading to 3.6.0 or upgrading to the new 3.7.1 release resolves the issue. Specifically, edit your Gemfile.lock and change:
sass (3.7.0) -> sass (3.7.1)

Alternatively you can run bundle update sass, which should now update it to 3.7.1 as well and it will automatically update your Gemfile.lock accordingly.
More information regarding the original bug: https://github.com/sass/ruby-sass/issues/94


text:
Q: Is it okay to create clicklisteners (or other listeners) inside a viewmodelscope? I have a a fragment containing a googleMap where I am creating a bunch of Markers (which also is clickable). They are spiced with different information (colors, shapes and so on) from a room livedata query. In addition I have some MaterialButton buttons (which are styled as pushbuttons) where I toggle the Marker visible status on. At the moment, the "setup" of theese markers takes some time (200ms-2 secs, depends of amount of markers). To get out of that waiting, I was planning to use a viewmodelscope. Since there are some clicklisteners for theese buttons defined in there (they should do some action with the markers), will they still be alive when the viewmodelscope coroutine section ends, and If they are alive, do they still live in the correct coroutine-context, and do I need to do some housekeeping on the listeners when fragment and/or viewmodel ends?
I.E:
class MapsFragment:Fragment(){

   private lateinit var mapsViewModel : MapsViewModel
   private lateinit var googleMap : GoogleMap

//...
   override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {

        mapsViewModel = ViewModelProvider(requireActivity()).get(MapsViewModel::class.java)

        _binding = FragmentMapsBinding.inflate(inflater, container, false)
        val root:View = binding.root
//...
      return root
   }//onCreateView

//...

   override fun onViewCreated(view: View, savedInstanceState:Bundle?){
      super.onViewCreated(view, savedInstanceState)
//...

      mapFragment?.getMapAsync(_googleMap->
         _googleMap?.let{safeGoogleMap->
            googleMap = safeGoogleMap
         }?:let{
            Log.e(TAG,"googleMap is null!!")
            return@getMapAsync
         }
//...

         mapsViewModel.apply{

            liveDataMapsListFromFiltered?.observe(
               viewLifecycleOwner
            ){mapDetailList->

               viewModelScope.launch{

                  binding.apply{

                     //...
                     siteMarkers.map{
                       siteMarker.remove() //removes existing markes from map on update
                     }
                     siteMarkers.clear() //empty the siteMarker array on update
                     //...

                     mapDetailList?.map{
                        it.apply{
                           //...
                           coordinateSiteLongitude?.let { lng->
                              coordinateSiteLatitude?.let { lat->
                                 siteMarkerLatLng = LatLng(lat,lng)
                                 siteLatLngBoundsBuilder?.include(siteMarkerLatLng)
                              }
                           }
                           //...
                           siteMarkerLatLng?.let { safeSiteMarkerLatLng ->
                              val siteMarkerOptions =
                               MarkerOptions()
                                    .position(safeSiteMarkerLatLng)
                                    .anchor(0.5f, 0.5f)
                                    .visible(siteMarkerState)
                                    .flat(true)
                                  .title(setTicketNumber(ticketNumber?.toDouble()))
                                    .snippet(appointmentName)//TODO: Consider build siteId instead
                                    .icon(siteIcon[iconType])
                              siteMarkers.add(
                                  googleMap.addMarker(siteMarkerOptions) //Here are the markers added
                              )
                           }//siteMarkerLatLng?.let

                        }//it.apply

                     }//mapDetailList?.map

                     onSiteCheckedChangeListener?.let{
                        fragmentMapsMapTagSelector
                           ?.apTagSelectorMaterialButtonSite
                           ?.removeOnCheckedChangeListener(it) //clearing listener on button before update
                     }

                     onSiteCheckedChangeListener = MaterialButton.OnCheckedChangeListener { siteButton, isChecked ->

                        siteMarkers.map {
                            it.isVisible = isChecked
                        }
                     }.also {
                        fragmentMapsMapTagSelector
                          ?.mapTagSelectorMaterialButtonSite
                          ?.addOnCheckedChangeListener(it)
                     }

                     //Will this onCheckedChangeListener still survive when this viewmodelscope runs to the end ?

                  }//binding.apply

               }//viewModelScope.launch

            }//liveDataMapsListFromFiltered.observe

         }//mapsviewModel.apply

      }//getMapAsync

   }//onViewCreated

}//MapsFragment

A: I think you misunderstand what a CoroutineScope is. It determines the lifecycle of coroutines that it runs, but not of the objects created in the process of running those coroutines.
viewModelScope is a CoroutineScope that automatically cancels any coroutines it is running when the associated ViewModel is torn down. The coroutine doesn't know what you're doing with it. Cancelling a coroutine merely stops it from running to completion, like returning from a function early. In your code, you set your listeners and haven't stored references to them besides in the views they are set to, so their lives are tied to their respective view's lives.
If you were going to use a coroutine in your fragment to set up something for your UI, you would use the Fragment's lifecycleScope, not the ViewModel's viewModelScope. Like if you were fetching something to show in your UI, you would want that coroutine to be cancelled when the Fragment is destroyed, not the ViewModel which might be outliving the Fragment.
Your use of a coroutine in your example code looks pointless, because I don't see any blocking or asynchronous suspend functions being called. You mentioned setting up site markers is taking like 200ms. I'm not familiar with Google Maps since I haven't used it in the past several years, so I'm not sure which part is time-consuming. Usually, UI elements do not allow you to interact with them on background threads, so you might be out of luck. But maybe the time-consuming part is allowed to be done on background threads. You'll have to read the documentation. Using a coroutine for this won't make it take less time, but can prevent the UI from stuttering/freezing.
If you were going to do some long computation with a coroutine, you would need to switch dispatchers to do the blocking work and interact with the UI elements back on the main dispatcher. Simply putting something in a coroutine doesn't make it take less time, but it provides a convenient way to do something on another thread and then continue on the main thread after the result is ready. For example:
lifecycleScope.launchWhenStarted { // lifecycle coroutines launch on main thread by default
    val result = withContext(Dispatchers.Default) { // switch to dispatcher for background work
        doTimeConsumingCalculation()
    }
    // back on main thread:
    applyResultsToMyViews(result)
}

By using launchWhenStarted instead of launch, a Fragment's lifecycleScope will pause the coroutine when the Fragment is not attached, which will prevent potential crashes from trying to update UI using requireContext() or requireActivity() when there is no Activity.


text:
Q: Copy objects from the nested array into the new array in React JS I have a big nested array of objects and each object has an object called 'set. Something like this:
const arr1 = [
  {
    id: 1,
    subject: 'Subject',
    set: {
      title: 'Title',
      subTitle1: 'SubTitle',
      subTitle2: 'SubTitle',
    },
  },
  {
    id: 2,
    subject: 'Subject',
    set: {
      title: 'Title',
      subTitle1: 'SubTitle',
      subTitle2: 'SubTitle',
    },
  },
]

I want to get the content of each 'set' object from 'arr1' into the 'arr2', like this:
const arr2 = [
  {
    title: 'Title',
    subTitle1: 'SubTitle',
    subTitle2: 'SubTitle',
  },
  {
    title: 'Title',
    subTitle1: 'SubTitle',
    subTitle2: 'SubTitle',
  },
]

A: You can use .map to extract the set from each object

const arr1 = [
  {
    id: 1,
    subject: 'Subject',
    set: {
      title: 'Title',
      subTitle1: 'SubTitle',
      subTitle2: 'SubTitle',
    },
  },
  {
    id: 2,
    subject: 'Subject',
    set: {
      title: 'Title',
      subTitle1: 'SubTitle',
      subTitle2: 'SubTitle',
    },
  },
]

const arr2 = arr1.map(a => a.set);

console.log(arr2 );


text:
Q: Photran editor slow or hangs I have a fairly large fortran90 project in Photran. I find that sometimes the editor just hangs or is very slow. Saving a file or using ctrl+/ for commenting lines seems to trigger this slowness. Any solutions to this?
I do have refactoring turned on as I find it useful to navigate, turning that off seems to help some. Any other solutions?
I am using eclipse-Galileo, photran 5.0 on linux OS. I have jdk 6 as my java environment. Will updating to Helios and a later photran make a difference? Is it easy to update to Helios?
Edit: Just checked TOP, the cpu is working at 100% when I am trying to save a file! And I even have the refactoring turned off.

A: Here is the answer to this question from the photran mailing list...
http://dev.eclipse.org/mhonarc/lists/photran/msg01691.html
See the rest of the thread for more information.
The only solution for now seems to be to turn off refactoring.

A: I was able to reproduce the issues with Photran refactoring on and off when using the same workspace with different Eclipse versions. I think you have to remove your ~/.eclipse and ~/workspace/.metadata directories and have a fresh start. I have been using the latest Eclipse (Kepler) with Photran refactoring on/off without any issue.


text:
Q: One liner for getting a sublist from a Set Is there a one-liner (maybe from Guava or Apache Collections) that gets a sublist from a set. Internally it should do something like this:
public <T> List<T> sublist(Set<T> set, int count) {
  Iterator<T> iterator = set.iterator();
  List<T> sublist = new LinkedList<T>();
  int pos = 0;
  while (iterator.hasNext() && pos++ < count) {
    sublist.add(iterator.next());
  }
  return sublist;
}

Obviously, if there are not enough elements it has to return as many as possible.

A: This should do it:
return (new LinkedList<T>(set)).subList(0, count);

But ensure, that count isn't larger than the size of set.

A: You could use a TreeSet and use it's subSet method:

Returns a view of the portion of this set whose elements range from fromElement to toElement. If fromElement and toElement are equal, the returned set is empty unless fromExclusive and toExclusive are both true. The returned set is backed by this set, so changes in the returned set are reflected in this set, and vice-versa. The returned set supports all optional set operations that this set supports.

EXAMPLE USING INTEGER:
TreeSet<Integer> t = new TreeSet<Integer>();
t.add(1);
t.add(2);
t.add(3);
t.add(4);
t.add(5);

System.out.println("Before SubSet:");

for(Integer s : t){
    System.out.println(s);
}

System.out.println("\nAfter SubSet:");

for(Integer s : t.subSet(2,false,5,true)){
    System.out.println(s);
}

OUTPUT:
Before SubSet:
1
2
3
4
5

After SubSet:
3
4
5

Alternatively, If you do not know the elements and want to return the elements between two points you can use an ArrayList constructed with the Set and use the subList method.
System.out.println("\nAfter SubSet:");

t = new TreeSet(new ArrayList(t).subList(2, 5));

for(Integer s : t){
    System.out.println(s);
}

A: What about this
Set<String> s = new HashSet<String>();
// add at least two items to the set
Set<String> subSet = new HashSet(new ArrayList<String>(s).subList(1, 2));

This would sublist between 1 and 2

A: With Guava:
return FluentIterable.from(set)
  .limit(count)
  .toImmutableList();

(Also, this won't actually iterate over the whole set, in contrast to most of these other solutions -- it'll actually only iterate through the first count elements and then stop.)

A: (new LinkedList<Object>(mySet)).sublist(0, Math.min(count, mySet.size()))

But please note: the code (even your original code) is a little bit smelly, since iteration order of sets depends on the actual set implementation in question (it's totally undefined in HashSet and the key order for TreeSets). So, it is actually an open question, which elements make it into the final sublist.

A: Without creating a copy of the Set beforehand, you can do (using Guava) :
Lists.newLinkedList(Iterables.getFirst(Iterables.partition(mySet, count), ImmutableList.of()))

It's a real LinkedList containing only (up to) the first count elements, not a view on a larger list.


text:
Q: iOS - Is scheduling background task with NSTimer still restricted by Apple? I know I'm pulling straws, but hoping for an answer.
I have an app that needs to communicate with server in background, without user intervention. Either when push notification arrives or at least periodically (every 5 minutes or so).
I can potentially bolt-on location update and send it to server. I can even possible justify using coarse location so Apple approves it. Worst case I will pay $299 for an enterprise developer license and use local distribution (the only one I care about).
My last hope is using periodic dispatch of a background task with NSTimer.
Do apps using this method still fall under Apple restriction on the type of background tasks allowed? (media/location/voip/newsstand/external device) It just seems so discriminatory...
PS. The app works in development mode on ipod touch now, including periodic communication with server. I have not declared anything in plist as far as background mode. Does this mean I'm OK?

A: I have implemented the following and got app approved by apple yesterday. My app doesn't do (media/location/voip/newsstand/external device)
You can get a max time of 600 sec(10 min) by using making use of following code in applicationDidEnterBackground:
if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]) { //Check if our iOS version supports multitasking I.E iOS 4
if ([[UIDevice currentDevice] isMultitaskingSupported]) { //Check if device supports mulitasking
UIApplication *application = [UIApplication sharedApplication]; //Get the shared application instance
__block UIBackgroundTaskIdentifier background_task; //Create a task object
background_task = [application beginBackgroundTaskWithExpirationHandler: ^ {
    [application endBackgroundTask: background_task]; //Tell the system that we are done with the tasks
    background_task = UIBackgroundTaskInvalid; //Set the task to be invalid
    //System will be shutting down the app at any point in time now
}];
//Background tasks require you to use asyncrous tasks
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    //Perform your tasks that your application requires
    NSLog(@"\n\nRunning in the background!\n\n");
    [application endBackgroundTask: background_task]; //End the task so the system knows that you are done with what you need to perform
    background_task = UIBackgroundTaskInvalid; //Invalidate the background_task
});
}

}

Documentation can be found here http://disanji.net/iOS_Doc/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html
I just implemented the backgroundTaskIdentifier object and Invalidate the background_task to check the time, app was alive and was running 600sec. You can even get the remaining time by using this
NSLog(@"Time remaining: %f", application.backgroundTimeRemaining);


text:
Q: Is there a standard algorithm to find the ideal time to poll for new data? There is an API (COVID-19 data to be exact) which posts data every other day more or less at the same time of day (3:30pm, 3:27pm, 3:38pm: 3:58pm, 4:23pm, etc.)
I want to determine the ideal time to retrieve data with the least amount of network calls possible - so polling every 5 minutues is off limits. I want to use data from the past: So when I poll every hour and in the last X days I realized that new data will be posted between 3pm and 5pm, I do not want to poll outside of that range in the future (occasially checking for new data outside that range is okay, so I'm not ending in a too narrow range somethime in the future).
Although I want to narrow down the range where I poll for new data as much as possible.
I'm thinking of an algorithm similar to binary search where I split the time intervall between past new data timestamps with safety polls outside of that range so I end with something like a sliding window.
In addition, I think it is possible to determine a kind of gradient that specifies in which period how often new data is checked for. (i.e. checking every minute from 3:25pm-3:50pm, checkin every 5mins from 3:30pm-3:25pm and 3:50pm-4:30pm, otherwise check every hour).
I wonder if someone smarter than me already did come up with an elegant solution for that problem.


text:
Q: Retrieve AD User info in Spring Boot filter In my spring boot app I am trying to retrieve the AD info of the user(i.e. name, e-mail, etc) after logging in via the AD page. The problem I got is that I cannot figure out how can I get the user info from the AD in an authentication filter.
These are my pom dependencies:
    ...
    <dependency>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>azure-active-directory-spring-boot-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
        <version>2.3.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-oauth2-client</artifactId>
        <version>2.3.1.RELEASE</version>
    </dependency>
    ....

This is my SecurityConfig:
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .authorizeRequests()
                .antMatchers(HttpMethod.OPTIONS).permitAll()
                .antMatchers("/login").permitAll()
                .antMatchers("/login/oauth2/azure**").authenticated() // called when AD returns
                .and().csrf().disable()
            .exceptionHandling().authenticationEntryPoint(unauthorizedEntryPoint())
            .and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
            .and()
            .addFilterBefore(corsFilter(), SecurityContextPersistenceFilter.class)
            .addFilterAfter(exceptionFilter(), SecurityContextPersistenceFilter.class)
            .addFilterBefore(authenticationFilter(), UsernamePasswordAuthenticationFilter.class)
                .addFilterBefore(azureAuthenticationFilter(), BasicAuthenticationFilter.class)

            .addFilterBefore(tokenAuthenticationFilter(), BasicAuthenticationFilter.class)
            .oauth2Login()
            .userInfoEndpoint()
            .oidcUserService(oidcUserService);
    }

And this is my filter:
public class AzureAuthenticationFilter extends BasicAuthenticationFilter {

    public AzureAuthenticationFilter(AuthenticationManager authenticationManager) {
        super(authenticationManager);
    }

    @Override
    protected void doFilterInternal(HttpServletRequest request,
                                    HttpServletResponse response, FilterChain chain)
            throws IOException, ServletException {
        String code = request.getParameter("code");
        String state = request.getParameter("state");
        String sessionSate = request.getParameter("session_state");

        // This is null
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();

        chain.doFilter(request, response);
    }
}

I guess I could do it with OidcUserService, but it looks like I need to build all the objects myself, but do I really need to? What would be the point of azure-active-directory-spring-boot-starter then? I have been searching for an answer for hours, but all I could find was either just for logging in or done in a controller. Any help appreciated. Thanks.


text:
Q: Using two identical classes for each POST and receive - REST New to java and trying the REST. My project has two identical classes but on different packages.
For example,
 com.domainA.Person {
 }

 com.domainB.Person {

 }

Person from DomainA is posted from the client side while on the Server side DomainB.Person is used as Parameter that receives data from DomainA.Person. This is a spring REST POST call. Is this possible or I need to use same class in both the places?

A: OK Based on the info if you have separate projects for server and client. I would suggest that you create a project called lets say "Common". Which can have these classes which are common to both projects. This way you will have only one copy.
Both the projects will have to depend on this third project called common.
In case you don't want to or for some reason cannot use a common project you can use separate copies of Person class in different packages.
But that is duplication of code and may not be considered best practice. if you can spend time to tweak your project setup so that you have one common project it will pay in long run
I hope it helps :)


text:
Q: Mass rename JPG files using command line or perl? I have 519 JPG files in a folder that I need to massively rename.  In the file newnames.txt I have a list of the 519 new file names.  Is there a way through command line or perl to run through that list of names (each on a new line) and rename all the files?

A: Since you didn't specify how you map filenames to "newnames.txt" data, I will give a couple of solutions:
If the filenames are sorted alphabetically, and the order of newnames corresponds to that order:
use File::Slurp;
use File::Copy qw/move/;
my @newnames=read_file("newnames.txt");
chomp(@newnames);
my @files = glob("*.JPG");
for (my $i=0; $i < @files; $i++) {
    die "Not enough new names for file $files[$i]" unless $newnames[$i];
    move($files[$i], $newnames[$i])
          or die "Failed to move $files[$i] to $newnames[$i] : $!";
}

If the filenames are in the same file as new names, in 2 columns:
use File::Slurp;
use File::Copy qw/move/;
my @newnames=read_file("newnames.txt");
chomp(@newnames);
foreach my $line (@newnames) {
    my ($file, $new)= split(/,/, $line);
    move($file, $new)
          or die "Failed to move $file to $new : $!";
}


text:
Q: Is iconv_set_encoding really deprecated since PHP 5.6? The manual says it is not, though I get the following error with PHP 5.6:
Deprecated functionality: iconv_set_encoding(): Use of iconv.internal_encoding is deprecated in...

It is also not found by the PHPCompatibility Code Sniffer standard. I am a little bit confused about this.

A: The PHP manual says that on the "iconv runtime configuration" page:

iconv.input_encoding string
Warning:
  This feature has been DEPRECATED as of PHP 5.6.0. Relying on this feature is highly discouraged.


text:
Q: d3js force layout set node symbol based on d I am trying to create a force layout where nodes will have different images (icons) based on some condition in the .data().  I can understand that we can set other attributes such as style, class etc easily following the standard approach:
nodeSelction.data(...)
  .enter()
  .append("circle")
  .attr("class", function(d) { return xxx; })

Is it possible to do the same thing for deciding whether to add a svg:circle, or some image icon?  I tried doing the same thing to append method, but it doesn't take a function. That is,
the following snippet doesn't work.
nodeSelction.data(...)
  .enter()
  .append(function(d) { return d.group==0?"circle" : "usr.png"})
  .attr("class", function { return xxx; })

So, what is the correct way to achieve the above?


text:
Q: C# DLL on Python I'm trying to work with a C# DLL on Python. The code used to create to C# DLL is included with this question.
from ctypes import*
mydll = cdll.LoadLibrary("Z:\\9. Personal\\Jeet\\New
folder\\ClassLibrary1.dll")
mydll.Add(3,4)`

The code doesn't work and the error is:-
AttributeError: function 'Add' not found
Is there any alternative?
Iron Python is installed on the PC I'm using but I have never used it. Please give me a detailed answer with all steps.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ClassLibrary1
{
    // Interface declaration.
    public interface ICalculator
    {
        int Add(int Number1, int Number2);
    };
    public class Class1 : ICalculator
    {
        public int Add(int Number1, int Number2)
        {
            return Number1 + Number2;
        }
    }
}


text:
Q: neo4j graphql mutating with empty array I am new to graphql and the neo4j graphql library and could use some help.
My aim is to create an optional tags fields to BlockTitle
I have the following schema:
type BlockTitle  {
    id: ID! @id
    created_at: DateTime! @timestamp
    text: String!
    tags: [Tag!]! @relationship(type: "HAS_TAG", direction: OUT)
 }

type Tag {
    id: ID! @id
    created_at: DateTime! @timestamp
    name: String! @unique
 }

in the neo4j graphql docs I red the following:

The relationship at User.posts is considered a "many" relationship. Relationships such as the one above should always be of type NonNullListType and NonNullNamedType, meaning both the array and the type inside of it should have a !.
neo4j doc ref

Honouring the recommendation I made the tags field accordingly: tags: [Tag!]! ...
But I have trouble mutating the following item (with a tag) in apollo studio:
mutation CreateBlockTitles($input: [BlockTitleCreateInput!]!) {
  createBlockTitles(input: $input) {
    blockTitles {
      text
    }
  }
}

with input
{
  "input": {
    "text": "A title without a tag"
  }
}

which returns following error
  "errors": [
    {
      "message": "BlockTitle.tags required",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
    ...

The things I tried / considered:

*

*supplying an empty array [] for the tags field in the mutation but I fail to make that work. I still get the error.

*using [Tag] instead of [Tag!]!, but going against the recommended practice. So do not really want to do that.

Thank you for the help <3

A: IIRC, this was a bug that was fixed in 2.5.3. I've just tried the Mutation and input given above with the code for the current 3.0.1 release, and everything seems to be working as expected.


text:
Q: login form for iphone im developing an app in Titanium Developer, im trying to make a login form so that the users can authenticate through my app to my server so they can get info regarding their respecting user, any help would be appreciated ;)

A: if the endpoint already exists as a webservice, and you are running HTTPS on the server, then the tutorial link provided above should be sufficient.
i personally think for an enterprise application  that has a controlled audience, you don't really need to go the oAuth direction.

A: you should encrypt your connection to your server with oauth. here is an example.

A: in OAuth there are 3 points involved, "the user, the consumer and the provider...
easy example:
facebook speaking...
the user would be us (you, me and the mortals...)
the consumer: any app (from a different development company other than facebook, third party apps)
provider: facebook
in my company..
the user: (the mortals... you and me)
the consumer: an app developed by my company
provider: my company
OAuth was developed so that the third party apps didn't have access to the whole base company database, only certain information about the users regarding the provider DB.
Thats why it generates different types of token so that the third party apps dont get your password or mails or any stuff you dont whant that people outside facebook to se, that token is the one who authenticates the app to have access to certain info regarding the user.
when it comes to my company, im the provider and the consumer, my company database access is only for the company development team. nobody outside my company has access to de DB.
in conclusion: OAuth is the greatest auth protocol ever, but... does your company really needs it?? is there someone outside your company using your resources??  is there a third party development? thats the real question...
to make my point clearer, check out how many providers are compared to clients, every tutorial has always the same few providers: Facebook,twitter,google,yahoo etc...
check out how many clients are?? there must be at least a million or a billion or a number we cant pronounce  (every app developed for Facebook twitter or google has strictly instructions to be authenticated trough OAuth
thats why im not using OAuth for the near present...


text:
Q: python2.7 : iteratiing over list of dicts and evaluating the required value Code :
import json
import urllib
URL = 'www.xyz.com'
data = json.load(urllib.urlopen(url)
print data
[[{"Region":"Europe", "Details":[{"gender":"male", "name":"john", "age":"24", "status":"Ok"}, {"gender":"female", "name":"Rebecca", "age":"22", "status":"None"}], "country":"Germany"}], [{"Region":"Asia", "Details":[{"gender":"male", "name":"kim", "age":"27", "status":"None"}, {"gender":"male", "name":"jen", "age":"22", "status":"None"}], "country":"China"}]]
# here is what I have tried
for i in data:
     for j in i:
          for key in j.keys():
               dicx = j[key]
               for k in dicx:
                 if isinstance(k, dict) and k['status']=='None':
                 print (i['region'], k['name'])) #I wnant to store this value in a variable rather than printing.
#this is giving me the following output.

Europe, Rebecca
Asia, kim
Asia, jen

Scenario : From the data above I want to check if in all "Region"(key) if "status"(key) is "Ok"(value) or "None"(value), if the "status"(key) is "None"(value) then it should return me the details(value) of that particular "Region"(key) along with the "name"(key).
ex:-
desired output (referenced from above data)
Europe, Rebecca

Asia, (kim, jen)

Any Help will be appreciated.

A: This is pretty ugly, but may do want you're asking:
matches = []
for i in data:  #
                # no changes here
                if isinstance(k, dict) and k['status']=='None':
                    # print (i[0]['Region'], k['name'])
                    matches.append(([i[0]['Region'], k['name']]))
from collections import defaultdict
res = defaultdict(list)

for k, v in matches:
    res[k].append(v)

for k, v in res.iteritems():
    if len(v) == 1:
        print'{}, {}'.format(k, v[0])
    else:
        print '{}, ({})'.format(k, ', '.join(map(str, v)))

Edit #1:
...
for k, v in matches:
    result[k].append(v)

mystr = ''

for k, v in result.iteritems():
    if len(v) == 1:
        mystr += '{}, {}'.format(k, v[0])
    else:
        mystr += ' {}, ({})'.format(k, ', '.join(map(str, v)))

print type(mystr)
print mystr

output:
<type 'str'>
Europe, Rebecca Asia, (kim, jen)

An example with 3 regions:
<type 'str'>
Europe, Rebecca America, (David, Ricardo) Asia, (kim, jen)


text:
Q: Вылетает nginx сервер при запросе на не существующие изображения У меня есть сервер nginx на котором запущен backend на django. Я не очень разбираюсь в nginx, но в последнее время он начал вылетать. Открыв логи ошибок nginx я увидел только ошибки об не найденном изображении вроде этого. И таких ошибок много. Но разве nginx не должен пропускать такие ошибки и работать дальше в рабочем состоянии. Вылетает где то раз, два в сутки, без привязки к времени. Помогает от этого перезагрузка nginx. В чем может быть дело?
2021/04/03 00:28:14 [error] 60678#60678: *589 open() "/var/www/html/lk_sizze/media/images_elements/Frame_6619.png" failed (2: No such file or directory), client: 188.247.187.250, server: lk.sizze.io, request: "GET /media/images_elements/Frame_6619.png HTTP/1.1", host: "lk.sizze.io", referrer: "http://localhost:3000/


text:
Q: How to display a form on a small screen I am trying to create a single web page that will display easily on a mobile device, but I am having trouble and was hoping someone could point me in the correct direction.  Please understand that I am new to programming and am learning as I go.
Unfortunately I can not figure out hot to show my code here, but here is a link to the page in question:
Form for mobile devices
Does anyone see anything that would prevent my form from showing up on a smaller screen without having to use scroll bars?
Thanks!

A: I recommend you drop the fixed-width table layout for your form and use a natual flowing layout instead. Here is an example of the first couple of fields:
<form name="contactinfo" method="post" action="process.php" onsubmit="return validateForm();">
    <fieldset>
        <legend>Application Request Form</legend>

            Full Name

            <input type="text" name="name" id="name">

            E-Mail

            <input type="email" name="email" id="email">

        ...
    </fieldset>
</form>

This will immediately help the layout adjust to different devices and it is also better mark-up for the form.
Other recommendations:

*

*Put all your styles in CSS.

*Move your JavaScript to the bottom of the page (i.e. the validation function)

*Consider whether you really need a reset button? What's the use case for it?


text:
Q: Different space between nodes for Tikz legend I want to add a legend to my graph, explaining what different arrows mean.
I thought I might be able to do it using coordinates, but the spaces between them are the same as spaces between the nodes in the graph itself, and I want only a short distance between them. I know there is a simple way but I can't figure it out.
Also how do I add writing next to the arrow, explaining its purpose, and labelling the legend as such?

    \begin{tikzpicture}[
            > = stealth, % arrow head style
            shorten > = 1pt, % don't touch arrow head to node
            auto,
            node distance = 3cm, % distance between nodes
            semithick % line style
        ]
        \tikzstyle{every state}=[
            draw = black,
            thick,
            fill = white,
            minimum size = 10mm
        ]

        \node[state] (A) {$A$};
        \node[state] (B) [right of=A] {$B$};
        \node[state] (C) [below of=A] {$C$};

\tikzset{mystyle/.style={->,line width=2pt}}

        \coordinate[below of=C] (d2);
        \coordinate[right of=d2] (d3);
        \coordinate[below of=d2] (d4);
        \coordinate[right of=d4] (d5);

        \path[->] (A) edge node {} (B);
        \path[->] (A) [mystyle] edge node {} (C);

        \path[->] (d2) edge node {} (d3);
        \path[->] (d4) [mystyle] edge node {} (d5);

    \end{tikzpicture}

A: The following example puts the legend below the lower left corner of the drawing. It does not use the node positioning system, but simple coordinates. Thus the lengths can be controlled easily. Text can be put with node[right] at the end point of the legend arrows:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{automata}

\begin{document}
  \begin{tikzpicture}[
    > = stealth, % arrow head style
    shorten > = 1pt, % don't touch arrow head to node
    auto,
    node distance = 3cm, % distance between nodes
    semithick % line style
  ]
    \tikzstyle{every state}=[
        draw = black,
        thick,
        fill = white,
        minimum size = 10mm
    ]

    \node[state] (A) {$A$};
    \node[state] (B) [right of=A] {$B$};
    \node[state] (C) [below of=A] {$C$};

    \tikzset{mystyle/.style={->,line width=2pt}}

    \path[->] (A) edge node {} (B);
    \path[->] (A) [mystyle] edge node {} (C);

    \draw[->]
      (current bounding  box.south west)
      ++(0, -2em) -- ++(2em, 0)
      node[right] {Thin arrow};
    \draw[mystyle, yshift=-1em]
      (current bounding box.south west)
      ++(0, -1em) -- ++(2em, 0)
      node[right] {Thick arrow};
  \end{tikzpicture}
\end{document}

A: While the answer linked by Claudio should be useful, here is a manual method just for illustration. I have added positioning library and changed the syntax to right = of from right of =. Now you can control the distance by below = 5mm of C route. Further, I have used empty nodes so that the length becomes identical too.
\documentclass[border=5pt]{standalone}

\usepackage{tikz}
\usetikzlibrary{positioning,automata}

\begin{document}
    \begin{tikzpicture}[
            > = stealth, % arrow head style
            shorten > = 1pt, % don't touch arrow head to node
            auto,
            node distance = 3cm, % distance between nodes
            semithick % line style
        ]
        \tikzstyle{every state}=[
            draw = black,
            thick,
            fill = white,
            minimum size = 10mm
        ]

        \node[state] (A) {$A$};
        \node[state] (B) [right = of A] {$B$};
        \node[state] (C) [below = of A] {$C$};

\tikzset{mystyle/.style={->,line width=2pt}}

        \node[state,draw = none,below = 5mm of C] (d2) {\phantom{$A$}};
        \node[state,draw = none,right = of  d2] (d3) {\phantom{$B$}};
        \node[state,draw = none,below = 1mm of d2] (d4) {\phantom{$C$}};
        \node[state,draw = none,right = of d4] (d5) {\phantom{$B$}};

        \path[->] (A) edge node {} (B);
        \path[->] (A) [mystyle] edge node {} (C);

        \draw[->] (d2) -- (d3) node[right] {some text here};
        \draw[->,mystyle] (d4) -- (d5)node[right] {some other text here};

    \end{tikzpicture}
\end{document}


text:
Q: How to simulate an windows azure system at local?
Possible Duplicate:
Is there any Windows Azure Local Development environment?

Hi all.
I want to develop some applications which save data on windows azure but I don't want to purchase Windows Azure account now. Could you tell me how I can setup an simulated Windows Azure at local?
thanks all.

A: You don't need to purchase a real account to experiment with Azure. The toolkit will provide you with a simulated environment for your development. See this link to download the sdk & tools:
http://www.microsoft.com/windowsazure/getstarted/default.aspx


text:
Q: What is the default sequential order of the file in postgres DB I wonder if Postgres use its primary key as the clustering index by default?
If no CLUSTER command is used, what will be the sequence order of the file? Will that be the same as the primary key?

A: The documentation is quite clear:

Clustering is a one-time operation: when the table is subsequently updated, the changes are not clustered. That is, no attempt is made to store new or updated rows according to their index order.

Clustering is a one-time operation.  It is not a property of the table.  Hence, there is no "clustering index by default" -- assuming that you mean that the table is maintained in that order.


text:
Q: How to estimate population mean if samples are drawn under different ciucumstances (i.e. different sample size in each sample)? if samples are drawn from the same population but under different circumstances (i.e. data collected from different machine rather than single machine, also sample size for each machine varies). From sampling distribution point of view, how to approach to it?

A: You can treat the data as a cluster sample survey, which only makes assumptions that observations within a machine are somehow correlated and have something in common, without making any parametric assumptions like normality about that.
library(survey)
nested_in_machines <- svydesign(id = ~machine, data = mydata)
svymean(whatever, design=nested_in_machines)


text:
Q: python: IndexError by deleating an element of the list I want to program a function that solves a mathematic task. The task is given to the function as list (e.g. [3, '+', 4, '*', 15]) and should be solved by regarding that multiplication and division have to be prefered.
def getresult(TaskAsList):
    """Ermitle Ergebnis einer Aufgabe – Aufgabe muss als Liste zugeführt werden"""
    while len(TaskAsList)>1:
        for i in range(len(TaskAsList)-1):
                if TaskAsList[i] == '*':
                    TaskAsList[i-1] = TaskAsList[i-1]*TaskAsList[i+1]
                    del(TaskAsList[i+1])
                    del(TaskAsList[i])
                elif TaskAsList[i] == ':':
                    TaskAsList[i-1] = TaskAsList[i-1]/TaskAsList[i+1]
                    print(i)
                    del(TaskAsList[i+1])
                    del(TaskAsList[i])
        for i in range(len(TaskAsList)-1):
                if TaskAsList[i] == '+':
                    TaskAsList[i-1] = TaskAsList[i-1]+TaskAsList[i+1]
                    del(TaskAsList[i+1])
                    del(TaskAsList[i])
                elif TaskAsList[i] == '-':
                    TaskAsList[i-1] = TaskAsList[i-1]-TaskAsList[i+1]
                    del(TaskAsList[i+1])
                    del(TaskAsList[i])

    return TaskAsList[0]

By trying this, an IndexError will be raised.
 Traceback (most recent call last):   File "<stdin>", line 1, in
 <module>   File "./task_generator.py", line 30, in getresult
     del(TaskAsList[i]) IndexError: list index out of range

Thank you for your help!

A: After you set the range to iterate over, you delete elements from the list, changing its size. The program attempts to iterate over as many items as there were from the start, but there aren't that many items any more.
(del isn't a function. Don't put parentheses around the target.)

A: because you initialize a range running to the first initial length of your list. But if you delete some indexes you list gets smaller... and the for runs still to the initial length
By the way... is your list consisting of double elements? otherwise you might get trouble with your accuracy at the devision

A: def getresult(TaskAsList):
    while len(TaskAsList)>1:
        while ('*' in TaskAsList) or (':' in TaskAsList):
            for i in range(len(TaskAsList)-1):
                    if TaskAsList[i] == '*':
                        TaskAsList[i-1] = TaskAsList[i-1]*TaskAsList[i+1]
                        del(TaskAsList[i+1])
                        del(TaskAsList[i])
                        break
                    elif TaskAsList[i] == ':':
                        TaskAsList[i-1] = TaskAsList[i-1]/TaskAsList[i+1]
                        print(i)
                        del(TaskAsList[i+1])
                        del(TaskAsList[i])
                        break
        for i in range(len(TaskAsList)-1):
                if TaskAsList[i] == '+':
                    TaskAsList[i-1] = TaskAsList[i-1]+TaskAsList[i+1]
                    del(TaskAsList[i+1])
                    del(TaskAsList[i])
                    break
                elif TaskAsList[i] == '-':
                    TaskAsList[i-1] = TaskAsList[i-1]-TaskAsList[i+1]
                    del(TaskAsList[i+1])
                    del(TaskAsList[i])
                    break

    return TaskAsList[0]


text:
Q: Not able to load @angular/platform-browser-dynamic When the application loads I am getting the following error.
http://localhost:49769/node_modules/@angular/platform-browser-dynamic/index.js Failed to load resource: the server responded with a status of 404 (Not Found)
localhost/:21 Error: Error: XHR error (404 Not Found) loading http://localhost:49769/node_modules/@angular/platform-browser-dynamic/index.js
        at XMLHttpRequest.wrapFn [as _onreadystatechange] (https://npmcdn.com/zone.js@0.6.12?main=browser:769:30)
        at ZoneDelegate.invokeTask (https://npmcdn.com/zone.js@0.6.12?main=browser:356:38)
        at Zone.runTask (https://npmcdn.com/zone.js@0.6.12?main=browser:256:48)
        at XMLHttpRequest.ZoneTask.invoke (https://npmcdn.com/zone.js@0.6.12?main=browser:423:34)
    Error loading http://localhost:49769/node_modules/@angular/platform-browser-dynamic/index.js as "@angular/platform-browser-dynamic" from http://localhost:49769/app/main.js(anonymous function) @ localhost/:21
http://localhost:49769/node_modules/@angular/core/index.js Failed to load resource: the server responded with a status of 404 (Not Found)

Please find the folder structure of placing the config and .ts files in my project. Please validate whether the files are placed in correct folders
Package.json
{
  "name": "Testing",
  "version": "1.0.0",
  "scripts": {
    "start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "lint": "tslint ./app/**/*.ts -t verbose",
    "lite": "lite-server",
    "typings": "typings",
    "postinstall": "typings install"
  },
  "license": "ISC",
  "dependencies": {
    "@angular/common": "2.0.0-rc.4",
    "@angular/compiler": "2.0.0-rc.4",
    "@angular/core": "2.0.0-rc.4",
    "@angular/forms": "0.2.0",
    "@angular/http": "2.0.0-rc.4",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "@angular/router": "3.0.0-beta.2",

    "systemjs": "0.19.27",
    "core-js": "^2.4.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "^0.6.12",

    "bootstrap": "^3.3.6"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0",
    "tslint": "^3.7.4",
    "typescript": "^1.8.10",
    "typings": "^1.0.4"
  },
  "repository": { }
}

systemjs.config.js
/**
 * System configuration for Angular 2 samples
 * Adjust as necessary for your application needs.
 */
(function (global) {

    // map tells the System loader where to look for things
    var map = {
        'app': 'app',
        'rxjs': 'node_modules/rxjs',
        '@angular': 'node_modules/@angular'

    };

    // packages tells the System loader how to load when no filename and/or no extension
    var packages = {
        'app': { main: 'main.js', defaultExtension: 'js' },
        'rxjs': { defaultExtension: 'js' },

        '@angular/common': { defaultExtension: 'js', main: 'index.js' },
        '@angular/compiler': { defaultExtension: 'js', main: 'index.js' },
        '@angular/core': { defaultExtension: 'js', main: 'index.js' },
        '@angular/http': { defaultExtension: 'js', main: 'index.js' },
        '@angular/platform-browser': { defaultExtension: 'js', main: 'index.js' },
        '@angular/platform-browser-dynamic': { defaultExtension: 'js', main: 'index.js' },
        '@angular/router': { defaultExtension: 'js', main: 'index.js' },

    };

    var packageNames = [
      '@angular/common',
      '@angular/compiler',
      '@angular/core',
      '@angular/forms',
      '@angular/http',
      '@angular/platform-browser',
      '@angular/platform-browser-dynamic',
      '@angular/router'
    ];

    // add package entries for angular packages in the form
    // '@angular/common': { main: 'index.js', defaultExtension: 'js' }
    packageNames.forEach(function (pkgName) {
        packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
    });

    var config = {
        map: map,
        packages: packages
    };

    System.config(config);

})(this);

tsconfig.json
{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true
  }
}

Why the application is not able to load platform-browser-dynamic under node_modules? I verified the files exists under the specified folders, still I am getting this error.
Note: though the NPM/Dependencies folder is saying that "Not installed", but I can expand the folder and notice that all the references are installed properly, but still it displays this error/warning message

A: You can not import the node_modules from wwwroot, but you have to copy the bundles in a destination folder in wwwroot, for example by gulp, and then import them from there by systemjs.config.js.
The systemjs.config.js position is correct in wwwroot.
I suggest you follow a few examples, like this: https://github.com/ajtowf/aspnetcore-angular2-seed


text:
Q: why getting Instance of 'Album' as output not the json output? //Standing dart file
 Future<Album> createAlbum(String cn,String amt,String op ) async {
      var queryParams = {
      'cn':cn,
      'amt':amt,   'op':op   }; Xml2Json xml2json=new Xml2Json(); final endpointUrl
 ='https://alpha1.mobikwik.com/recharge.do?uid=***********&pwd=**********&cir=5&reqid=12544172981251';
 final queryString = Uri.parse('queryParameters: $queryParams').query;
 final requestUrl = endpointUrl + '?' + queryString; final response =
 await http.get(Uri.parse(requestUrl), headers:
 {'ContentType':'application/json','X-MClient':'14','checksSum':'c/Jb9GVtPI+fW1sOgKlgdRyfVICd/u6LiiLH9IOLcIM=','Charset':
 'utf-8'});

   if (response.statusCode == 200) {

     // If the server did return a 201 CREATED response,
     // then parse the JSON.
     print(response.body);    xml2json.parse(response.body);    var jsonData=xml2json.toGData();    return
 Album.fromJson(json.decode(jsonData));
        } else {
     // If the server did not return a 201 CREATED response,
     // then throw an exception.
     throw Exception('Failed to create album.');   } }

My Model:
 class Album {
      final String status;   final String txId;   final String balance;   final String discountprice;   Album({   required this.status,
 required this.txId, required this.balance,  required
 this.discountprice });

   factory Album.fromJson(Map<String, dynamic json) {
     return Album(
      status: json['cn'] ,
      txId: json['amt'] ,
       balance: json['op'] ,
       discountprice:json['discount']

     );   } }

How I am trying to show it:
class Recharge extends StatefulWidget {   Recharge({Key? key}) :
 super(key: key);
      @override   _RechargeState createState() = _RechargeState(); }

 class _RechargeState extends State<Recharge {
     final TextEditingController _controller = TextEditingController();   final TextEditingController _controller1 = TextEditingController();
 final TextEditingController _controller2 = TextEditingController();
 Future<Album>? _futureAlbum;

    @override   Widget build(BuildContext context) {
     return MaterialApp(
       title: 'Create Data Example',
       theme: ThemeData(
         primarySwatch: Colors.blue,
       ),
       home: Scaffold(
         appBar: AppBar(
           title: Text('Create Data Example'),
         ),
         body: Container(
           alignment: Alignment.center,
           padding: const EdgeInsets.all(8.0),
           child: (_futureAlbum == null) ? buildColumn() : buildFutureBuilder(),
         ),
       ),
     );   }

   Column buildColumn() {
     return Column(
       mainAxisAlignment: MainAxisAlignment.center,
       children: <Widget[
         TextField(
           controller: _controller,
           decoration: InputDecoration(hintText: 'Enter Mobile No.'),
         ),
         TextField(
           controller: _controller1,
           decoration: InputDecoration(hintText: 'Enter Amount'),
         ),
         TextField(
           controller: _controller2,
           decoration: InputDecoration(hintText: 'Enter Operator.'),
         ),
         ElevatedButton(
           onPressed: () {
             setState(() {
               _futureAlbum = createAlbum(_controller.text,_controller1.text,_controller2.text);

             });
           },
           child: Text('Create Data'),
         ),
       ],
     );   }

   FutureBuilder<Album buildFutureBuilder() {
     return FutureBuilder<Album(
       future: _futureAlbum,
       builder: (context, snapshot) {
         if (snapshot.hasData) {
           return Text(snapshot.data.toString());
         }
        else if (snapshot.hasError) {
           return Text('${snapshot.error}');
         }

         return CircularProgressIndicator();
       },
     );

   } }

A: write a toJson function in your model.
Map<String, dynamic> toJson() => {
"cn": status,
"amt": txId,
"op": balance,
"discount": discountprice,
};

And then call it
print(album.toJson())


text:
Q: Redirect page without changing the url I have a page running a custom shortcode. When an element on the page is clicked I am pushing a new url into the browser (using history.pushstate) and displaying the content in the same window.
If this url is copied and pasted at a later date into the browser, I want to be able identify this and display the content. As the requested element is not actually a real page/post, I am having difficulty. I can use template_redirect hook to identify if it is the link I am interested in, and I can forward the page - but I don't want to forward, I want to keep the url but load a specific page.
Is there a way of doing this?

A: This can be achieved using a Virtual Post. See this link on how to do it. https://ashiqur.com/how-to-add-a-virtual-page-in-wordpress/


text:
Q: Perf command not support energy when passing process ID I want to attach perf to a process and measure the package energy. As you can see below, the example shows that power/energy-pkg/ works fine.
$ perf stat -a -e power/energy-pkg/ -- sleep 1

 Performance counter stats for 'system wide':

              1,71 Joules power/energy-pkg/

       1,019749321 seconds time elapsed

The C code gets the PID at the beginning and stops until a SIGCONT is received. With the following commands, I launch the program in background and grab the PID. Then I continue the execution and run perf with the PID.
$ ./app &
$ PID=`pidof app`
$ kill -SIGCONT $PID
$ perf stat -a -e power/energy-pkg -p $PID
   Performance counter stats for process id '2590':

    <not supported> Joules power/energy-pkg/

      34,002655205 seconds time elapsed

As you can see the energy number is invalid. Any idea about this behavior?


text:
Q: Azure data upload and SQL database update failure for filename tracking I have a scenario, in which I upload the file to Azure and will get the uploaded filename. Now I would need to store the filename (received for Azure upload) to SQL database.
In case, if database down means it will fail to capture the filename (received for Azure upload) to SQL database but the File upload to Azure was successful.
Here, how can I update the filename (received for Azure upload) to SQL database?

A: You can add the filename to your Azure SQL Database whenever you upload new blob in Storage account using Azure Logic App.
Create Logic App service using Azure Portal. Follow link.
Once it is created, Go to the resource. Click on Logic App Designer and select Blank Logic App.
Search for when blob is added or modified and select it.

Give the connection name, storage account name and storage account access key to connect your storage account. Click Create.

Fill the details to connect your container. Fill other required details to run your logic app automatically after given interval time. Click on + Next Step.

Search for SQL Server and select. Fill the required details to connect with your SQL Server. Click Create.

In the next step, select the server, database and table. Also select the column name in which you want to store the filenames. In the selected column name, select List of Files DisplayName. This will capture the filenames you uploaded in the container.

Lastly, click on Save -> Run Trigger -> Run to run your app login.
Simply, add any blob in your container and it's filename will be added in your SQL Database. Check below for reference.


text:
Q: Proof of the Strong Markov Property for Continuous Time Markov Chains I am trying to understand the proof of Theorem 6.5.4 (the strong Markov
property for continuous time Markov chains) in J.R. Norris' book Markov Chains. It states that for $ X = (X_t)_{t
\geq 0}   $ Markov$ (λ,Q)  $ and $ T $ a stopping time of $ X $,
conditional on $ T < \zeta $ and $ X_T = i $, $
(X_{T+t})_{t  \geq 0}   $ is Markov$ (δ_i, Q)  $ and independent of $
\mathcal{F}_T $. Here, $ \zeta $ denotes the first explosion time of
the chain.
For completeness, the proof goes as follows: On $ \{ T < \zeta\} $ set $ \widetilde{X}_t =
X_{T+t} $ and denote $ (\widetilde{Y}_n)_{n  \geq 0}   $ the jump chain
and $ (\widetilde{S}_n)_{n  \geq 1}   $ the holding times of $
\widetilde{X} $. We want to show that for all $ A ∈ \mathcal{F}_T $, all
$ i_0,\ldots, i_n ∈ I $ and all $s_1,\ldots, s_n  \geq 0  $ it holds
that
\begin{equation*}
    \begin{aligned}
        &\mathbb{P}[ \{ \widetilde{Y}_0 = i_0, \ldots, \widetilde{Y}_n = i_n,
            \widetilde{S}_1 > s_1,\ldots, \widetilde{S}_n > s_n\}
            \cap A \cap \{ T < \zeta \} \cap \{ X_T =i\}  ] \\
        &= \mathbb{P}_i[ \{ Y_0 = i_0, \ldots, Y_{n}  = i_n, S_{1}  >
                s_1,\ldots, S_{n}  > s_n\}] \\
        &\quad \quad  \times \mathbb{P}[ A \cap  \{T < \zeta\} \cap \{ X_T
        =i\}  ]. \\
    \end{aligned}
\end{equation*}
It suffices to prove this with $ \{ T < \zeta\} $  replaced by $ \{ J_m
\leq T < J_{m+1} \} $ for $ m ∈ \mathbb{N}_0 $ arbitrary. In two lemmas
preceding the proof, it has been shown that

*

*$ \{ J_m  \leq T\} \cap \{X_T = i\} ∈ \mathcal{F}_T $, such that. w.l.o.g. $ A ⊆  \{ J_m  \leq T\}\cap \{X_T =i\}$ and

*Let $ \mathcal{G}_m = σ(Y_0,\ldots, Y_m, S_1,\ldots, S_m) $. Then there
exist $ T_m $  and $ A_m $ which are $ \mathcal{G}_m$-measurable such
that $ T = T_m $ and $ 1_{A} = 1_{A_m}   $ on $ \{ T < J_{m+1} \}  $
Conditional on $ Y_m = i $, $ S_{m+1}  $ is independent of $
\mathcal{G}_m $ and thus of $ T_m - J_m  $ and $ A_m $, so by
memorylessness of the exponential distribution
$$ \mathbb{P}][S_{m+1} > s_1 + (T_m - J_m) | Y_m = i, S_{m+1} > T_m  - J_m  ] =
e^{-q_i s_1} = \mathbb{P}_i[S_1 > s_1]  . $$
Hence by the Markov property of the jump chain
\begin{equation}
    \begin{aligned}
        &\mathbb{P}[ \{ \widetilde{Y}_0 = i_0, \ldots, \widetilde{Y}_n = i_n, \\
            & \quad \ \ \widetilde{S}_1 > s_1,\ldots, \widetilde{S}_n > s_n\} \cap A \cap
            \{J_m  \leq T < J_{m+1}\} \cap \{ X_T =i\}  ] \\
        &= \mathbb{P}[ \{ Y_m = i_0, \ldots, Y_{m+n}  = i_n, S_{m+1} >
            s_1 + (T_m - J_m), \\
            & \quad \ \ S_{m+2}  > s_2,\ldots, S_{m+n}  > s_n\} \cap A_m \cap
            \{S_{m+1} > T_m - J_m \} ] \\
        &= \mathbb{P}_i[ \{ Y_0 = i_0, \ldots, Y_{n}  = i_n, \\
        & \quad \ \ S_{1}  > s_1,\ldots, S_{n}  > s_n\}] \mathbb{P}[ A \cap
            \{J_m  \leq T < J_{m+1} \} \cap \{ X_T =i\}  ] \\
    \end{aligned}
    \tag{$*$}
\end{equation}
Now to the actual question: My problem lies in understanding the last set of manipulations,
specifically relating to the second bullet above. As I understand it, what is used (this would be Lemma 6.5.3. in the book) is that there exists a random variable $ T_m $, measurable w.r.t. $ \mathcal{G}_m $, with $ T_m 1_{\{ T < J_{m+1}\}} = T 1_{\{ T < J_{m+1}\}}  $. Clearly this implies $ \{T < J_{m+1} \} \subseteq  \{ T_m < J_{m+1}\}   $, but I don't see how it implies $ \{T <
J_{m+1} \} = \{T_m < J_{m+1} \} $, without which it is hard to make sense of the equalities in $ (*) $. Similarly with the switch from $ A $ to $ A_m $ - it seems to me as if the information $ T < J_{m+1}  $ was lost in the intermediate step.


text:
Q: MFC - How to send messages between 2 different Views I have 2 CView-derived classes, CThumbView and CMainView. The CThumbView class displays thumbnails of images and the CMainView class controls the View that displays the original image.
I want to display the first thumbnail and its original when my application starts up. I tried using OnInitialUpdate, but that is not the ideal way as it bothered the other functionalities that was handling the main view.
How can I do this by sending a user-defined message between the 2 views?

A: Since you are using the Document View Architecture you need to take advantage of the CDocument::UpdateAllViews function of the document from your view in order to update rest of the views. This function will call OnUpdate of each view.
The data is held by the document. Views access the data & update themselves accordingly.


text:
Q: Using Scope Identity for multiple inserts within a stored procedure I am trying to use scope identity twice within a stored procedure.
My stored procedure has 3 elements,

*

*1st an insert into a table (I use the scope identity here to get the
newly inserted row ID)

*2nd an insert to the 2nd table, this inserts the ID from the 1st
insert, I also use the scope identity to get the id of this new row

*3rd an update to the 1st table with the 2nd table new ID

The first table ID works fine although I do not seem to be able to get the ID from the 2nd table and then update the 1st with that ID.
Is this possible?

A: You should be able to do it this way
insert t1 values (...) -- first insert

declare @id1 as int = scope_identity() -- store the first id

insert t2 values (@id1, ...) -- second insert

update t1
set id2 = scope_identity() -- id from the second table
where id1 = @id1 -- primary key of the first table

A: Use querys something like this
INSERT INTO [Table1] ([Id1] ,[Name],[DateCreated])
VALUES (@RId, @Name, GetDate())

DECLARE @NewId1 INT=0  -- recently inserted id in Table-1
SET @NewId1  = (SELECT @@IDENTITY)

INSERT INTO [Table2] ([Id2],[Id1],[Name],[DateCreated])
VALUES (@RId, @NewId1, @Name, GetDate())  -- insert the newly created Table-1 id into Table-2

DECLARE @NewId2 INT=0 -- recently inserted id in Table-2
SET @NewId2  = (SELECT @@IDENTITY)

INSERT INTO [Table3] ([Id3],[Id2],[Name],[DateCreated])
VALUES (@RId, @NewId2, @Name, GetDate())  -- insert the newly created Table-2 id into Table-3