text:
Q: Access arraylist from another class without "return" Assert.fail(); unable to access return I have read all similar question but nothing help.
how to access arraylist from another class without "return"
Test Fail is not returning failedtest
As I have Assert.fail(); under same method which I need return value.
Please help me find solution for if any alternative way to access arraylist .
public class FrontPage extends SeleniumUtils implements IHomePage {
public List<String> failedtest = new ArrayList<String>();

public List<String> CheckSummaryExposure(WebDriver driver, String actualView, String viewName) throws InterruptedException {
    String[] actualViews = actualView.split(",");
    List<String> views = new ArrayList<>();
    boolean flag = false;
        for (int i = 0; i < actualViews.length; i++) {

            if (views.get(i).equals(actualViews[i].trim().toString())) {
                Add_Log.info("Successfully displayed " + viewName);
                Reporter.log("Successfully displayed " + viewName);
            } else {
                Add_Log.info(" filter criteria is not displayed " + viewName);
                Reporter.log(" filter criteria is not displayed " + viewName);
                failedtest.add(" filter criteria is not displayed " + viewName);
                flag = true;
            }
        }

        if (flag) {
            TestResultStatus.Testfail = true;
// Test Fail is not returning failedtest
            Assert.fail();
        } else {
            Add_Log.info("Successfully all filter);
            Reporter.log("Successfully all filter);
        }
        System.out.println("PRINT FAIL SENTENCE");
System.out.println(failedtest);
return failedtest;
    }

other class [Sanity_TC]  to call FrontPage class, method CheckSummaryExposure  with return failedtest
public class Sanity_TC extends SuiteBase {
    static public HashMap<String, String> Remark = new HashMap<>();
List<String> failedtest =null;
@Test(dataProvider = "SanityTCTest", dataProviderClass = utility.Xlsdataprovider.class, groups = "Dashboard", alwaysRun = true)
public void Sanity_TC015(LinkedHashMap<String, String> data) throws InterruptedException, SQLException {
    String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
            loadWebBrowser();
            objLoginPage.login(getDriver(), username, password, URLs.get(Key), Instance);
            String result = String.join("-",FP.CheckSummaryExposure(getDriver(), actualViews, viewName));
            Remark.put(methodName, result);


text:
Q: pasar un array de c# a c++ Estoy utilizando código nativo en c#. estoy intentado pasar un array de c# a C++ utilizando Pinvoke. Una vez en C++, quiero llenar ese array que he pasado como parámetro con los valores de un cv::Mat.
El problema es que estoy usando la función copy y no creo que este pasando bien los parámetros.
¿Alguien puede ayudarme? un saludo y gracias
MI CODIGO DE C++ :
__declspec(dllexport)
void video(unsigned char* arr) {
Mat frame;
Mat resi;
Mat dst;//dst image
camera >> frame;
if (frame.empty()) {
    return;
}
flip(frame, dst,1);
//resize(dst, resi, Size(width, height));
cv::cvtColor(dst, dst, COLOR_BGR2RGB);
copy(dst.datastart, dst.dataend, arr);
}

MI CÓDIGO DE C#:
 [DllImport("NativoPrincipio")]
 public static extern void video(byte[] img);

 imgData = new byte[width * height* 4];
 video(imgData);

A: [DllImport("NativoPrincipio")]
public static extern void video(IntPtr img);

byte[] getVideo(int width, int height)
{
   var imgData = new byte[width * height * 4];
   GCHandle h = GCHandle.Alloc(imgData, GCHandleType.Pinned);
   video(h.AddrOfPinnedObject());
   return imgData;
}

redpajama_set_name: RedPajamaStackExchange


text: Q: how to expand running process android? help, please, how i can to expand running process in adroid? For example in my case I receive push message from GCM and show notification. I want to check on notification click whether my application is running. If running it must expand, else - run new process


text:
Q: Having some issues with long lived connections (Chrome Extension Manifest v3) I've been having some issues having my different scripts in my extension communicating with each other. the main stuff like sending the array from as.js -> background.js -> popup.js works but im having issues sending the data from background.js -> as.js for the file download. any insight would be helpful aswell as any tips on where i can improve the existing working code.
Thanks,
Sam
Code:
manifest.json
{
    "manifest_version": 3,
    "name": "Helper",
    "description": "Desc",
    "version": "0.1",
    "icons": {
        "16": "./icons/16.png",
        "48": "./icons/48.png",
        "128": "./icons/128.png"
    },
    "background": {
        "service_worker": "./scripts/background.js"
    },
    "action": {
        "default_icon": {
            "16": "./icons/16.png",
            "48": "./icons/48.png",
            "128": "./icons/128.png"
        },
        "default_title": "Test Extension",
        "default_popup": "./popup.html"
    },

    "content_scripts": [
        {
            "matches": [
                "https://www.website.com/*"
            ],
            "js": [
                "./scripts/jquery-3.6.0.min.js", "./scripts/fileSaver.js", "./scripts/as.js"
            ],
            "run_at": "document_idle"
        }
    ],
    "optional_permissions": [
        "activeTab",
        "tabs",
        "storage"
      ]

}

background.js
const data = []

chrome.runtime.onConnect.addListener(function (port) {

    console.assert(port.name === "mh");

    port.onMessage.addListener(function (msg) {

        if (msg.links === undefined) {

            switch (msg.type) {
                case "getData":

                    port.postMessage({
                        'data': data
                    });

                    break;
                case "text":

                    port.postMessage({
                        dlData: data
                    });

                    break;
            }

        } else {

            if (Array.isArray(msg.links)) {

                data.length = 0

                msg.links.forEach(e => {
                    data.push(e)
                });

            }
        }

    });

});

as.js (The Part that actually does stuff to the page)
//
// Random Unrelated Stuff...
//

var port = chrome.runtime.connect({
        name: "mh"
    });

    port.postMessage({
        links: data
    });

    port.onMessage.addListener(function (da) { // <--- This is the point where the code stops working.

        console.log('hello')

        console.log(da)

        toTextFile('download', da.dlData)

    });

function toTextFile(fileName, data) {

    var blob = new Blob(
        [`${data.join("\n")}`], {
            type: "text/plain;charset=utf-8"
        }
    );

    saveAs(blob, `${fileName}.txt`);

}

popup.html
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
    <link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous">

Image URL's

                <button class="button is-dark">

                </button>

                <button class="button is-dark" id="download">

                </button>

popup.js
getData()

async function getData() {

    // Request Data
    var port = chrome.runtime.connect({ name: "mh" });
    port.postMessage({ type: 'getData' });

    // Download Button
    var dl = document.getElementById("download")
    dl.addEventListener('click', port.postMessage({ type: 'text' }));

    // Process da Links
    port.onMessage.addListener(function (msg) {

        if (!msg.data) return;

        if (Array.isArray(msg.data)) {

            var data = msg.data.join('
').replace(/"/g, '')

            var p = document.createElement('p');

            p.innerHTML = `${data}`;
            p.setAttribute("id", "text-copy");

            document.getElementById('copy').appendChild(p);

        }

    });

}


text:
Q: Bootstrap dropdown-menu not working in Liferay 6.2 I'm trying to do a new navbar in Liferay 6.2, but dropdown menu isn't working. I suspect AUI is guilty of this, but not sure here you got my code:

                ....

                        <button type="button" class="btn btn-danger" data-toggle="dropdown" data-target="#demo">
                            simple collapsible
                        </button>

 Enlace 1

 Enlace 2

 Enlace 3

<button class="btn navbar-btn btn-success"> Boton</button>

It's an example, I haven't started the real solution yet. Thanks in advance!

A: Got it!, solved like this:

                            <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" data-target="#">
                                simple collapsible
                            </button>

 link 1

 link 2

 link 3

<button class="btn navbar-btn btn-success"> button </button>

It was needed
 and <button... data-target="#">. I suppouse it's because bootstrap works in a different way with dropdown and collapse.


text:
Q: Objective-C: How to check if a class gets extended by a category? In Java, you can use instanceof to check if a class extends another class or implements an interface.
In Objective-C, you can use isKindOfClass to check if a class extends another class:
if ([myObject isKindOfClass:[AnClass class]]) { }

But how can I check if a class gets extended by a category?

EDIT 2
My code of the first EDIT was unfortunately a bit confusing and nonsensical, sorry! Now, here is my new code:
I'll explain the whole problem:
I've got a class ViewCustomerCreate thats extends UITableViewController. ViewCustomerCreate gets extended by the category ICheckBox. This is my code that doesn't work:
- (void)closeModalView {
    UINavigationController *parent = (UINavigationController *)self.navigationController.parentViewController;
    UIViewController *parentViewContr = parent.topViewController;

    if ([parentViewContr isKindOfClass:[id<ICheckBox> class]]) { // ERROR-MESSAGE see below
        id<ICheckBox> parent2 = (id<ICheckBox>)parentViewContr; // works fine :-)
        [parent2 setSelectedElementId:checkedIndex]; // works fine :-)
    }

    [self.navigationController dismissModalViewControllerAnimated:YES];
}

The error message is: "error: 'id' is not an Objective-C class name or alias"
I think that I can't use isKindOfClass to check if a class gets extended by a category, isn't it?
PS: What do I want? I have a general modal view with checkboxes and if I close this view, the parent-view should get informed what the user choose.

EDIT 3
OMG, I confounded Category with Protocol!! Aaaaahhhhh ^^
THE SOLUTION:
if ([parentViewContr conformsToProtocol:@protocol(ICheckBox)]) {

A: There is no way to check if a class is extended by a category, but you can check whether or not an instance responds to a particular selector with:
- (BOOL)respondsToSelector:(SEL)sel;

In Objective-C you should worry less about what an object is, and worry more about what an object can do.
If it walks like a duck, sounds like a duck and looks like a duck, then it can probably fly, you know what I mean?
You should use this as such:
if ([myObject respondsToSelector:@selector(myMethod:)])
{
    // do whatever you need to do
}

Just a quick note, since you mentioned Java interfaces. You can check if an object implements a protocol (similar to Java interfaces, but not exactly the same) by using:
- (BOOL)conformsToProtocol:(Protocol *)aProtocol;

A: If you have defined a category on UIViewController, there are no instances of UIViewController that it is not applied to.  Hence, a runtime check does not make sense.
Let's look at your actual problem:
parent.setMySpecialValue = 1; // DOES NOT WORK :-(

What does "DOES NOT WORK" actually mean?  Do you get a compiler error or a runtime error.  If the former, there are a couple of possible issues to loo at:

*

*You haven't included the header file containing the category in the source file that uses that method

*It is a property that you have named incorrectly.  If the property is called mySpecialValue, that line of code should read:
parent.mySpecialValue = 1;

or
[parent setMySpecialValue: 1];

As of now, categories cannot define instance variables, so having a synthesized property might be an issue, so that might also be your problem, but you need to give more information about what "DOES NOT WORK" means.


text:
Q: Can a .NET WCF application work with more than one network adapter? We have an existing .NET Framework 4.7.1 application that communicates with a .NET server in a domain through WCF/NetTcp. We now need a third-party external hardware to send data to it. However, this hardware will ideally not be in the corporate network, but on its own network, so a second network card (*) would be installed on the PC:
                      ------ Network 1 (AD domain) ------------
                     |                                         |
                     |   -----------------                     |
                     | | PC Win10        |                     |
                     | |.NET application |                     |
                     | | WCF             |                     |
Network 2            | |-----------------|                     |
CLIENT APP* ---------> |ETH2*        ETH1| ------> .NET SERVER |
                     |  -----------------                      |
                     |                                         |
                      ------------------------------------------
* = new

Question
Can this be done in application level, ex. with an additional app/process and named pipes between them, or even better, in a single application (the existing one)? Or should it be done at network layer, ex. bridging or another solution?

A: NETTcpbinding is only applicable to the internal network environment. If you want to use internal network services from the outside, it is recommended to publish an external network address from the inside so that the outside can access it, or you can add binding to make your service available for external access.


text:
Q: How to draw 10000 circles in Random locations using JavaFX? I'm trying to draw 10,000 circles in JavaFX but it seems like its not working and I'm not even able to draw a single circle. Actually it trows me an error:

This is the code that I currently have:
public class RandomCircles extends Application {

    private Random randomNumbers;
    private int count;
    private final double MAX_X = 600;
    private final double MAX_Y = 300;
    private final int FINAL_CIRCLES = 10000;

    public void start(Stage primaryStage){

        Circle initCircle = new Circle();
        initCircle.setStroke(Color.BLACK);
        initCircle.setStrokeWidth(3);
        initCircle.setRadius(1);

        for(count = 0; count <= FINAL_CIRCLES; count++){
            initCircle.setCenterX(randomNumbers.nextInt((int) MAX_X));
            initCircle.setCenterY(randomNumbers.nextInt((int) MAX_Y));
        }

        Group baseDemo = new Group(initCircle);

        // Scene scene = new Scene(baseDemo, MAX_X, MAX_Y);
        Scene scene = new Scene(baseDemo);
        scene.setFill(Color.WHITE);
        scene.getWidth();

        primaryStage.setTitle("10,000");
        primaryStage.setScene(scene);
        primaryStage.setResizable(true);
        primaryStage.show();
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        launch(args);
    }
}

Can somebody also tell me if using the setCenterX/Y is the right approach to create the circles in random locations?
Thanks.
UPDATE: To the person who though of my post as a duplicate, it is not. My problem comes from my logic that I implemented in my code not from a NullPointerException(not really) error. , which was wrong. Some guy already helped me to solve it.

A: After fixing the runtime error you are getting, your code only draws one circle. That's because you only add one circle to your scene graph. The for loop basically does nothing. The last X and Y coordinates for the circle's center are used to draw the single, solitary circle. You need to add ten thousand circles.
In the code below, I changed 10_000 to 100 (one hundred) since 10_000 has too many overlapping circles in the stage dimensions that you set. I also increased each circle's radius.
import java.util.Random;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;

public class RandomCircles extends Application {
    private Random randomNumbers = new Random();
    private int count;
    private final double MAX_X = 600;
    private final double MAX_Y = 300;
    private final int FINAL_CIRCLES = 100;

    public void start(Stage primaryStage){
        Group baseDemo = new Group();
        for(count = 0; count <= FINAL_CIRCLES; count++){
            Circle initCircle = new Circle();
            initCircle.setStroke(Color.BLACK);
            initCircle.setStrokeWidth(3);
            initCircle.setRadius(5);
            initCircle.setCenterX(randomNumbers.nextInt((int) MAX_X));
            initCircle.setCenterY(randomNumbers.nextInt((int) MAX_Y));
            baseDemo.getChildren().add(initCircle);
        }

        Scene scene = new Scene(baseDemo);
        scene.setFill(Color.WHITE);
        scene.getWidth();

        primaryStage.setTitle("100");
        primaryStage.setScene(scene);
        primaryStage.setResizable(true);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

A: Change this line:
private Random randomNumbers;
to this:
private Random randomNumbers = new Random();
Your code is assuming the the Random object will be allocated like the other member variables, but it is an object and must be created with new.


text:
Q: Match context pattern inside a tactic/tactic notation I find a pattern inside my goal through a tactic.
Why does this fail:
        Tactic Notation "my_context_match" uconstr(g) :=
          match goal with
          | |- context[g] => idtac
          end.

          my_context_match _.

While this succeeds?
        match goal with
          | |- context[_] => idtac
        end.

Is there any way to write a my_context_match, such that I can pass incomplete patterns (with _ on them) and see if anything inside my goal matches the patter?

A: Support for uconstr is very patchy.  I've just reported #9321.  Note that even this fails:
Goal True.
  let v := uconstr:(True) in
  lazymatch constr:(v) with
  | v => idtac
  end. (* Error: No matching clauses for match. *)

As suggested by @eponier in a comment, you can use open_constr instead of uconstr.  However, this will leave unresolved evars.  Here is a tactic that will work, and will not leave unresolved evars:
Tactic Notation "my_context_match" uconstr(g) :=
  (* [match] does not support [uconstr], cf COQBUG(https://github.com/coq/coq/issues/9321),
     so we use [open_constr] *)
  let g := open_constr:(g) in
  (* turning [g] into an [open_constr] creates new evars, so we must
     eventually unify them with the goal *)
  let G := match goal with |- ?G => G end in
  (* We now search for [g] in the goal, and then replace the matching
     subterm with the [open_constr] [g], so that we can unify the
     result with the goal [G] to resolve the new evars we created *)
  match G with
  | context cG[g]
    => let G' := context cG[g] in
       unify G G'
  end.

Goal True /\ True.
  my_context_match _.
  my_context_match (_ /\ _).
  Fail my_context_match (_ \/ _).
  my_context_match True.
  exact (conj I I).
Qed.


text:
Q: Hamiltonian for a magnetic field An atom has an electromagnetic moment, $\mu = -g\mu_B S$ where S is the electronic spin operator ($S=S_x,S_y.S_z$) and $S_i$ are the Pauli matrices, given below. The atom has a spin $\frac{1}{2}$ nuclear magnetic moment and the Hamiltonian of the system is
\begin{gather*}
    H = -\mu .B + \frac{1}{2}A_0S_z
\end{gather*}
The first term is the Zeeman term, the second is the Fermi contact term and $A_0$ is a real number. Obtain the Hamiltonian in matrix form for a magnetic field, $B=B_x,B_y,B_z$. Show that when the atom is placed in a magnetic field of strength B, aligned with the z axis, transitions between the ground and excited states of the atom occur at energies:
\begin{gather*}
    E= g\mu_B B + \frac{1}{2}A_0
\end{gather*}
The Pauli Matrices are:
\begin{gather*}
    S_x = \frac{1}{2}
\begin{bmatrix}
    0 & 1 \\ 1 & 0
\end{bmatrix} ,
    \ S_y = \frac{1}{2}
\begin{bmatrix}
    0 & -i \\ i & 0
\end{bmatrix} ,
   \ S_z = \frac{1}{2}
\begin{bmatrix}
    1 & 0 \\ 0 & -1
\end{bmatrix}
\end{gather*}
Where do I even start for a solution to this problem I am unclear as to how to formulate the B matrix. If I can get that hopefully the second part will become apparent to prove

A: The Hamiltonain is calculated as
\begin{align}
H =&  \, g \mu_B \, \left(B_x S_x + B_y S_y + B_z S_z\right) \, + \, \frac{1}{2}A_0 S_z = \\
=&  \, \frac{g \mu_B}{2} \, \left(B_x \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} + B_y  \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix} + B_z  \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}\right) \, + \, \frac{1}{4}A_0  \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \\
=& \, \frac{g \mu_B}{2} \, \begin{bmatrix} B_z & B_x-iB_y \\ B_x+iB_y & -B_z \end{bmatrix} \, + \, \frac{1}{4}  \begin{bmatrix} A_0 & 0 \\ 0 & -A_0 \end{bmatrix} \\
\end{align}
In the case of a constant magnetic field aligned with the $z-$axis, $B_x = B_y=0$ and $B_z = B$. Then
$$H = \, \frac{g \mu_B}{2} \, \begin{bmatrix} B_z & 0 \\ 0 & -B_z \end{bmatrix} \, + \, \frac{1}{4}  \begin{bmatrix} A_0 & 0 \\ 0 & -A_0 \end{bmatrix} = \frac{1}{2}\begin{bmatrix} g\mu_B\, B_z+\frac{1}{2}A_0 & 0 \\ 0 & -  \, g\mu_B\,B_z-\frac{1}{2}A_0 \end{bmatrix} $$
By solving the linear eigenvalue equations
$$H \, | \psi \rangle = \lambda\, | \psi \rangle $$ you would get the basis energy states (the eignevectors $| \psi \rangle$) and their energy levels (the eigenvalyes $\lambda$). Since $H$ is a 2 by 2 matrix, so
$$ | \psi \rangle = \begin{bmatrix}\psi_1 \\ \psi_2 \end{bmatrix}$$ the equation is
$$\begin{bmatrix} \frac{1}{2} g\mu_B\, B_z+\frac{1}{4}A_0 & 0 \\ 0 & -  \, \frac{1}{2} g\mu_B\,B_z-\frac{1}{4}A_0 \end{bmatrix} \, \begin{bmatrix}\psi_1 \\ \psi_2 \end{bmatrix} = \lambda \, \begin{bmatrix}\psi_1 \\ \psi_2 \end{bmatrix}$$ so it is easy to see that the egienvectros are
$$\begin{bmatrix} 1 \\ 0 \end{bmatrix} \text { and } \begin{bmatrix} 0 \\ 1\end{bmatrix}$$ with energy levels
$$ \frac{1}{2} g\mu_B\, B_z+\frac{1}{4}A_0 \,\, \text { and }\,\, - \frac{1}{2} g\mu_B\, B_z-\frac{1}{4}A_0$$ respectively. There are only two eigenstates and the transition from on to the other happens when the energy is equal to the difference of the energy levels, i.e.
$$\left(\frac{1}{2} g\mu_B\, B_z+\frac{1}{4}A_0 \right) - \left( - \frac{1}{2} g\mu_B\, B_z-\frac{1}{4}A_0\right) =  g\mu_B\, B_z+\frac{1}{2}A_0$$


text:
Q: Select Statement for localhost and insert into network database module for localhost connection
This is my module for connecting localhost
    Function connect()
    con.ConnectionString = "Driver={MySQL ODBC 3.51 Driver};server=localhost;database=tablelocal;uid=root;pwd=root;option=0"
    con.Open()
    End Function

    Function Disconnect()
    con.Close()
    End Function

module for network connection
This is my module for connecting through network
    Function connectnetwork()
    con.ConnectionString = "Driver={MySQL ODBC 3.51 Driver};server=192.168.0.1;database=samplenetwork;uid=root;pwd=root;option=0"
    con.Open()
    End Function

    Function Disconnectnetwork()
    con.Close()
    End Function

Please See my edit
    Dim sourceConnection As New OdbcConnection(connect())
    Dim destinationConnection As New OdbcConnection(connectNetwork())
    Dim adapter As New OdbcDataAdapter("SELECT * from local ", sourceConnection)
    Dim insertCommand As New OdbcCommand("INSERT INTO network", destinationConnection)

    With insertCommand.Parameters
        OdbcCommand = New Odbc.OdbcCommand("Insert into network select * from local ", con)
        OdbcCommand.ExecuteNonQuery()
    End With

    adapter.InsertCommand = insertCommand

    'Keep the RowState of each row as Added so it is ready to be inserted.'
     adapter.AcceptChangesDuringFill = False

    Dim table As New DataTable

    'Retrieve data from source database.'
     adapter.Fill(table)

    'Save data to destination database.'
     adapter.Update(table)

A: Just use two different connections with your data adapter, e.g.
Dim sourceConnection As New OdbcConnection("source connection string here")
Dim destinationConnection As New OdbcConnection("destination connection string here")
Dim adapter As New OdbcDataAdapter("SELECT ...", sourceConnection)
Dim insertCommand As New OdbcCommand("INSERT ...", destinationConnection)

With insertCommand.Parameters
    'Add parameters here.'
End With

adapter.InsertCommand = insertCommand

'Keep the RowState of each row as Added so it is ready to be inserted.'
adapter.AcceptChangesDuringFill = False

Dim table As New DataTable

'Retrieve data from source database.'
adapter.Fill(table)

'Save data to destination database.'
adapter.Update(table)

A: while on network all the commands and queries are Case Sensitive (for mysql)
all the things in "" (Double Quotes) must be Case Sensitive (for mysql)
Maybe try to add "Protocol=socket;" to the connection string.
OR check the firewall
sometimes firewall who didn't let it through
check This


text:
Q: DbContext onModelCreating filter data I have in my ASP.NET Core 2.0 App in the DBContext class following Code.
DbContext
public DbSet<MyTable> MyTable1 { get; set; }
...
protected override void OnModelCreating(ModelBuilder modelBuilder) {
  modelBuilder.Entity<MyTable>().ToTable("MyTable");

is it correct the .ToTable always gets the whole content of the table?
I need only certain data (filter). for example get projects from table Project which employees ID = 4.
The employee ID I have but after successful login. How do I get the data now in my controller class?

A: ToTable simply maps the object to the table. Until you request data with a linq statement its not doing anything. When you call ToList on the where clause then you EF will reach out to the database and query returning only the desired results.
All that is is doing is saying that MyTable maps to MyTable in sql. Nothing more.
If you want to specifically filter the entire result set permanently you can do so with Eneity.HasQueryFilter(y => y.ID == 4);


text:
Q: Teamasys skylink-webrtc web integration for audio and vedio call console issues I am using Temasys skylink webrtc plugin and implemented screen share functionality  in Temasys console by creating app and its generating app key and secret key.Implemented screen share functionality by using app-key with in javascript code its working fine for local.Now i am getting issue in video call and audio call functionality in console its shows error no meeting preschedule for this static key.

<video id="localVideo" autoplay="autoplay"></video>

<button type="button" onclick="joinRoom()">Start Call</button>
<button type="button" onclick="leaveRoom()">End Call</button>


text:
Q: How to convert IntPtr to Cursor or SafeHandle? I'm in .NET 3.5, I have found
CursorInteropHelper.Create()

method here. However it is absolutely unclear how do I convert IntPtr for cursor to SafeHandle. The list of implementations of SafeHandle listed here does not include SafeCursorHandle and others are abstract or unrelated. Is the only way to go is to create my own implementation of SafeHandle?

A: SafeHandle is an abstract class.  It wants you to provide an object of a concrete SafeHandle derived class that can release the handle.  Unfortunately you forgot to mention how you obtained that IntPtr so we cannot know how it should be released.
I'll take a guess and assume it is a GDI cursor, the one you get from the CreateCursor() winapi function.  Which requires calling DestroyCursor() to release the handle.  Such a class could look like this:
class SafeCursorHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid {
    public SafeCursorHandle(IntPtr handle) : base(true) {
        base.SetHandle(handle);
    }
    protected override bool ReleaseHandle() {
        if (!this.IsInvalid) {
            if (!DestroyCursor(this.handle))
                throw new System.ComponentModel.Win32Exception();
            this.handle = IntPtr.Zero;
        }
        return true;
    }
    [System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]
    private static extern bool DestroyCursor(IntPtr handle);
}

Tweak the ReleaseHandle() override as necessary to release the handle in your case.

A: According to the MSDN doc, ReleaseHandle() must never fail:
http://msdn.microsoft.com/de-de/library/system.runtime.interopservices.safehandle.releasehandle%28v=vs.110%29.aspx
"Because one of the functions of SafeHandle is to guarantee prevention of resource leaks, the code in your implementation of ReleaseHandle must never fail."
IMO, this means that it must not throw - just like native destructors.


text:
Q: Currently compiling, but receiving nothing but end to program? import java.util.Scanner;

public class PD {
    public static void main(String[] args) {

        Scanner input = new Scanner (System.in);

        System.out.print("Enter your number: " );
        int number = input.nextInt();
        for (int count = 2; count < number; count++) {
            String blank = "";
            String Snumber = count + blank;
            if (isPalindromic(count) && isPrime(count) &&
                isPalindromic((int)(Snumber.length())) &&
                isPrime((int)(Snumber.length()))){
                    System.out.println( count + "is double palidromic prime");
            }
            else
                continue;
        }
    }

    // method to find palindromic
    public static boolean isPalindromic(int count) {
        String blank = "";
        String convert = count + blank;
        for (int i = 0, q = 1; i <= (convert.length()/2 - 1); i++, q++) {
            if (convert.substring(i,q) == convert.substring(convert.length() - q, convert.length() - i)){
                return true;
            }
        }
        return false;
    }

    // method to find prime
    public static boolean isPrime(int count ) {
        for (int divisor = 2; divisor <= count/2; divisor++) {
            if (count % divisor == 0) {
                return false;
            }
        }
        return true;
    }
}

Currently the thing compiles and ask for input, but it always results in nothing.
Does someone see something wrong with my program that is obvious wrong.
Overall, the program receives input and has to look through values 2 until it hits the value the user wants and print the ones that follow the if statement.

A: Your isPalindromic method is not functioning properly. It is not returning true for palindromic numbers. Change it to this:
public static boolean isPalindromic(int count) {
        String blank = "";
        String convert = count + blank;
        int n = convert.length();
        for (int i = 0; i < (n / 2 + 1); i++) {
            if (convert.charAt(i) != convert.charAt(n - i - 1)) {
                return false;
            }
        }

        return true;
}


text:
Q: How to do typecast with prestored typeid(T) during runtime? I created a resource system in CPP:
template<typename T>
class Resource{
public:
    Resource() {}
    void push(std::shared_ptr<T> pRes) {
        _items.emplace(_nextId++, pRes);
    }
    friend class ResourceManager;
private:
    size_t _nextId{ 0 };
    std::unordered_map<size_t, std::shared_ptr<T>> _items;
};
class ResourceManager{
public:
    ResourceManager() {}
    ~ResourceManager() {
        for (auto& pair : _resources) delete pair.second;
    }
    template<typename T>
    void register() {
        Resource<T>* pRes = new Resource<T>;
        _resources.emplace(typeid(T).name(), (void*)pRes);
    }
    template<typename T>
    Resource<T>& getResource(){
        return *(T*)_resources[typeid(T).name()];
    }
private:
    std::unordered_map<std::string, void*> _resources;
};

Now I want to add a method to ResourceManager to modify all registered resources inside _resources. How can I typecast void* with stored typeid(T).name()?

A: You can't because the type needs to be known at compile time, and the keys of the map are not.
There are a few issues with your implementation: you're deleting a void* in your destructor (which is UB), and your getResource function returns a T instead of a Resource<T>.
A solution is to have some type erasure (via virtual functions):
class ErasedResource {
private:
    ErasedResource() = default;
    ErasedResource(ErasedResource&&) = default;

    template<typename T>
    friend class Resource;
    friend class ResourceManager;

    void push(std::shared_ptr<void> pRes) {
        _items.emplace(_nextId++, std::move(pRes));
    }

    size_t _nextId{ 0 };
    // Store an "untyped" shared_ptr
    std::unordered_map<size_t, std::shared_ptr<void>> _items;

public:
    virtual ~ErasedResource() = default;
};

template<typename T>
class Resource : public ErasedResource {
public:
    Resource() = default;
    Resource(ErasedResource&&) = delete;
    Resource(Resource&&) = default;

    void push(std::shared_ptr<T> pRes) {
        ErasedResource::push(std::static_pointer_cast<void>(std::move(pRes)));
    }
    friend class ResourceManager;

private:
    std::shared_ptr<T> get(std::size_t index) const {
        auto it = _items.find(index);
        if (it == _items.end()) return nullptr;
        return std::static_pointer_cast<T>(it->second);
    }
};

class ResourceManager{
public:
    ResourceManager() = default;
    template<typename T>
    void register() {
        std::unique_ptr<ErasedResource> pRes(new Resource<T>);
        _resources.emplace(std::type_index(typeid(T)), std::move(pRes));
    }
    template<typename T>
    Resource<T>& getResource() const {
        ErasedResource& res = *_resources.at(std::type_index(typeid(T)));
        return static_cast<Resource<T>&>(res);
    }
private:
    // Switch to `type_index` (for performance)
    // and `unique_ptr` (to avoid writing a destructor)
    std::unordered_map<std::type_index, std::unique_ptr<ErasedResource>> _resources;
};

And if you want some function to operate on each resource that uses the type T, add a virtual function to do it. For example, if you wanted to call "item.f()" for each item in the resource, add a virtual void call_f() = 0 function to ErasedResource and override it in Resource<T>.


text:
Q: Google ecommerce tracking code for Dukapress wordpress E-commerce plugin How I can get e-commerce tracking by google analytics from Dukapress Wordpress ecommerce plugin? I have already switched on e-commerce tracking from google analytics.But can't find options to configure it from my site. I am using Dukapress e-commerce plugin.
And One more thing I need to know, I have find an article here http://www.sitepoint.com/track-ecommerce-transactions-google-analytics-reports/
But I want to know that I need to write "_add_item" code once or more? If more, then how much?

A: You should do _addItem for each line of item bought in the e-commerce tracking code. Once all items are added into the transaction queue, you should do a _trackTrans.
Just like the post you are referring to, it says:

"3. Add individual products
  A code block is required for all products purchased within the transaction. The data is required in the following order:"

So one _addItem per product bought within a transaction.


text:
Q: Why does powershell freeze for a bit when running my python scripts Sometime I look back at my terminal when there is a python script running and the console output has frozen, then I right-click on the terminal and the console output (printing to screen) beings again.
Its a bit disconcerting because sometimes I think my script has broken.
Do others also experience this?  Anybody know a fix?
Thanks in advance for any responses

A: If it's intermittent with all other factors being unchanged, it sounds like you've inadvertently selected some text in the PowerShell console and it's halted updating output so that you can do something with it.
Next time, be careful to look to see if you have something selected before clicking.

A: I agree with @alroc's suggestion; i.e. the cause could be accidentally clicking on the console.
A solution to prevent this is to right click on the powershell console window's title bar, select properties, uncheck Quick Edit Mode, then click OK.  This disables some features (i.e. copy by select & enter, paste by right click), but means if you accidentally click on the screen it does no harm.
Another solution's to simply press escape (or right click in the script's window) if the script's taking a while - generally that'll do no harm (i.e. it won't terminate your script), but it will exit the edit session, allowing the script to resume if it had been paused due to edit mode.
To play with these, run the below script, then click on the screen whilst it's running (this script just outputs a bunch of numbers).
1..99999999

To terminate the script completely, press ctrl+c.


text:
Q: "his men have left IS alone and have moved to eliminate the middle ground"
He showed every sign of believing what he said. His position is that he is fighting terrorism that is inspired and funded by foreigners and driven by extremist religious ideology, and that the rest of the world needs to come round to his way of thinking. I asked about the allegation that his men have left IS alone and have moved to eliminate the middle ground by concentrating on the armed groups that are favoured by the west. I suggested he had done it to offer Syrians a false choice, between his regime and the jihadists. He denied it, unsurprisingly.

Source: http://www.telegraph.co.uk/news/worldnews/middleeast/syria/11410628/Jeremy-Bowen-My-day-with-the-dictator.html#disqus_thread
I would like to ask a native speaker how he/she understands the bold passage of the text. May be my hesitation regarding this part stems from the fact that my knowledge of the civil war in Syria is superficial so I interpret it that Assad's army stopped its military action against IS and turned its attention to the opposition which is considered as being "salonfähig" by the West. But not sure if this is a correct interrpretation.

A: I think your understanding is correct.  Let's break down the sentence.

I asked about the allegation that his men have left IS alone and have moved to eliminate the middle ground by concentrating on the armed groups that are favoured by the west.

  I asked about the allegation...

An allegation is a claim that someone has made about something.  What allegation?

...that his men have left IS alone and...

That is, that Assad's men are not attacking IS or are ignoring IS.  And what else?

...(that his men) have moved to eliminate the middle ground...

That is, they have tried to remove the moderate option between the extremes.  How did they do it?

...by concentrating on the armed groups...

They are mainly attacking the groups of armed men.  Which armed groups?

...that are favoured by the west.

These armed groups are the ones that the West (by which we usually mean Western Europe and North American countries) likes.


text:
Q: split a key-value pair in Python I have a dictionairy as follows:
 {
    "age": "76",
    "Bank": "98310",
    "Stage": "final",
    "idnr": "4578",
    "last number + Value": "[345:K]"}

I am trying to adjust the dictionary by splitting the last key-value pair creating a new key('total data'), it should look like this:
 "Total data":¨[
 {
 "last number": "345"
 "Value": "K"
  }]
  }

Does anyone know if there is a split function based on ':' and '+' or a for loop to accomplish this?
Thanks in advance.

A: One option to accomplish that could be getting the last key from the dict and using split on + for the key and : for the value removing the outer square brackets assuming the format of the data is always the same.
If you want Total data to contain a list, you can wrap the resulting dict in []
from pprint import pprint

d = {
    "age": "76",
    "Bank": "98310",
    "Stage": "final",
    "idnr": "4578",
    "last number + Value": "[345:K]"
}

last = list(d.keys())[-1]
d["Total data"] = dict(
    zip(
        last.strip().split('+'),
        d[last].strip("[]").split(':')
    )
)
pprint(d)

Output (tested with Python 3.9.4)
{'Bank': '98310',
 'Stage': 'final',
 'Total data': {' Value': 'K', 'last number ': '345'},
 'age': '76',
 'idnr': '4578',
 'last number + Value': '[345:K]'}

Python demo


text:
Q: Filter extended properties by contact id With this code I get the extended properties for contacts with a specific display name:
foreach(Contact c in contacts)
{
  // some code...
  view.PropertySet = new PropertySet(BasePropertySet.IdOnly, properties);
  filter = new SearchFilter.IsEqualTo(FolderSchema.DisplayName, c.DisplayName);
  items = service.FindItems(folderId, filter, view);
}

I want to filter not by the DisplayName but by the Contact.Id, but i can't find a way to do that.

A: To search by Contact.Id use the ItemSchema.Id like given below...
filter = new SearchFilter.IsEqualTo(ItemSchema.Id, c.Id);

A: That's what I have done in the end, i did not find a better solution.
I get all contacts with the same name and iterate through them to find the correct contact.
        foreach (Item item in items.Items)
        {
            foreach (var ext in item.ExtendedProperties)
            {
                // check if the extended property is from this contact
                if (c.Id.ChangeKey == item.Id.ChangeKey)
                {
                    extendedProperties.Add(ext);
                }
            }
        }


text:
Q: how to insert date picker in ios using phonegap Please help me in implementing the date picker in IOS .I try three things
1) Type ="Date " it is working fine but there is no done button.
2) I take date box there is  of focus and fluctuation.
Now i thought to insert Native plugin of date picker in iOS(Latest).
Or  provide some example of mobile scroll in IOS

A: If you want native date picker use plug in:
https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/DatePicker
else use normal jquerymobile datebox:
http://dev.jtsage.com/jQM-DateBox2/

A: Js code:

/**
 * Cordova DatePicker Plugin
 * Copyright (c) Greg Allen 2011
 * MIT Licensed
 *
 * Updated for Cordova 2.1 by Robert (Jamie) Munro
 */
if (typeof cordova !== "undefined") {
    /**
     * Constructor
     */
    function DatePicker() {
        this._callback;
    }

    /**
     * show - true to show the ad, false to hide the ad
     */
    DatePicker.prototype.show = function(options, cb) {
        var padDate = function(date) {
            if (date.length == 1) {
                return ("0" + date);
            }
            return date;
        };

        if (options.date) {
            options.date = options.date.getFullYear() + "-" +
            padDate(options.date.getMonth()+1) + "-" +
            padDate(options.date.getDate()) +
            "T" + padDate(options.date.getHours()) + ":" +
            padDate(options.date.getMinutes()) + ":00Z";
        }
        var defaults = {
            mode : 'datetime',
            date : '',
            allowOldDates : true,
            allowFutureDates : true
        };

        for (var key in defaults) {
            if (typeof options[key] !== "undefined")
                defaults[key] = options[key];
        }
        this._callback = cb;

        cordova.exec("DatePicker.show", defaults);
    };

    DatePicker.prototype._dateSelected = function(date) {
        var d = new Date(parseFloat(date) * 1000);
        if (this._callback)
            this._callback(d);
    }

    cordova.addConstructor(function() {
                           if (!window.plugins) {
                           window.plugins = {};
                           }
                           window.plugins.datePicker = new DatePicker();
                           });
};

datepicker.m code:

//  Phonegap DatePicker Plugin
//  Copyright (c) Greg Allen 2011
//  MIT Licensed
//
//  Additional refactoring by Sam de Freyssinet

#import "DatePicker.h"

@interface DatePicker (Private)

// Initialize the UIActionSheet with ID <UIActionSheetDelegate> delegate UIDatePicker datePicker (UISegmentedControl)closeButton
- (void)initActionSheet:(id <UIActionSheetDelegate>)delegateOrNil datePicker:(UIDatePicker *)datePicker closeButton:(UISegmentedControl *)closeButton;

// Creates the NSDateFormatter with NSString format and NSTimeZone timezone
- (NSDateFormatter *)createISODateFormatter:(NSString *)format timezone:(NSTimeZone *)timezone;

// Creates the UIDatePicker with NSMutableDictionary options
- (UIDatePicker *)createDatePicker:(CGRect)pickerFrame;

// Creates the UISegmentedControl with UIView parentView, NSString title, ID target and SEL action
- (UISegmentedControl *)createActionSheetCloseButton:(NSString *)title target:(id)target action:(SEL)action;

// Configures the UIDatePicker with the NSMutableDictionary options
- (void)configureDatePicker:(NSMutableDictionary *)optionsOrNil;

@end

@implementation DatePicker

@synthesize datePickerSheet = _datePickerSheet;
@synthesize datePicker = _datePicker;
@synthesize isoDateFormatter = _isoDateFormatter;

#pragma mark - Public Methods

- (CDVPlugin *)initWithWebView:(UIWebView *)theWebView
{
    self = (DatePicker *)[super initWithWebView:theWebView];

    if (self)
    {
        UIDatePicker *userDatePicker = [self createDatePicker:CGRectMake(0, 40, 0, 0)];
        UISegmentedControl *datePickerCloseButton = [self createActionSheetCloseButton:@"Close" target:self action:@selector(dismissActionSheet:)];
        NSDateFormatter *isoTimeFormatter = [self createISODateFormatter:k_DATEPICKER_DATETIME_FORMAT timezone:[NSTimeZone defaultTimeZone]];

        self.datePicker = userDatePicker;
        self.isoDateFormatter = isoTimeFormatter;
        userDatePicker.datePickerMode=UIDatePickerModeCountDownTimer;

        [self initActionSheet:self datePicker:userDatePicker closeButton:datePickerCloseButton];
    }

    return self;
}

- (void)show:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
{
    if (isVisible) {
        return;
    }

    [self configureDatePicker:options];
    [self.datePickerSheet showInView:[[super webView] superview]];
    [self.datePickerSheet setBounds:CGRectMake(0, 0, 320, 485)];

    isVisible = YES;
}

- (void)dismissActionSheet:(id)sender {
    [self.datePickerSheet dismissWithClickedButtonIndex:0 animated:YES];
}

- (void)onMemoryWarning
{
    // It could be better to close the datepicker before the system
    // clears memory. But in reality, other non-visible plugins should
    // be tidying themselves at this point. This could cause a fatal
    // at runtime.
    if (isVisible) {
        return;
    }

    [self release];
}

- (void)dealloc
{
    [_datePicker release];
    [_datePickerSheet release];
    [_isoDateFormatter release];

    [super dealloc];
}

#pragma mark - UIActionSheetDelegate methods

- (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex
{
    NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.datePicker._dateSelected(\"%i\");", (int)[self.datePicker.date timeIntervalSince1970]];
    [super writeJavascript:jsCallback];
}

- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
{
    isVisible = NO;
}

#pragma mark - Private Methods

- (void)initActionSheet:(id <UIActionSheetDelegate>)delegateOrNil datePicker:(UIDatePicker *)datePicker closeButton:(UISegmentedControl *)closeButton
{
    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
                                                             delegate:delegateOrNil
                                                    cancelButtonTitle:nil
                                               destructiveButtonTitle:nil
                                                    otherButtonTitles:nil];

    [actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];

    [actionSheet addSubview:datePicker];
    [actionSheet addSubview:closeButton];

    self.datePickerSheet = actionSheet;

    [actionSheet release];
}

- (UIDatePicker *)createDatePicker:(CGRect)pickerFrame
{
    UIDatePicker *datePickerControl = [[UIDatePicker alloc] initWithFrame:pickerFrame];
    datePickerControl.datePickerMode=UIDatePickerModeCountDownTimer;
    return [datePickerControl autorelease];
}

- (NSDateFormatter *)createISODateFormatter:(NSString *)format timezone:(NSTimeZone *)timezone;
{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setTimeZone:timezone];
    [dateFormatter setDateFormat:format];

    return [dateFormatter autorelease];
}

- (UISegmentedControl *)createActionSheetCloseButton:(NSString *)title target:(id)target action:(SEL)action
{
    UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:title]];

    closeButton.momentary = YES;
    closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);
    closeButton.segmentedControlStyle = UISegmentedControlStyleBar;
    closeButton.tintColor = [UIColor blackColor];

    [closeButton addTarget:target action:action forControlEvents:UIControlEventValueChanged];

    return [closeButton autorelease];
}

- (void)configureDatePicker:(NSMutableDictionary *)optionsOrNil;
{
    NSString *mode = [optionsOrNil objectForKey:@"mode"];
    NSString *dateString = [optionsOrNil objectForKey:@"date"];
    BOOL allowOldDates = NO;
    BOOL allowFutureDates = YES;

    if ([[optionsOrNil objectForKey:@"allowOldDates"] intValue] == 1) {
        allowOldDates = YES;
    }

    if ( ! allowOldDates) {
        self.datePicker.minimumDate = [NSDate date];
    }

    if ([[optionsOrNil objectForKey:@"allowFutureDates"] intValue] == 0) {
        allowFutureDates = NO;
    }

    if ( ! allowFutureDates) {
        self.datePicker.maximumDate = [NSDate date];
    }

    self.datePicker.date = [self.isoDateFormatter dateFromString:dateString];

    if ([mode isEqualToString:@"date"]) {
        self.datePicker.datePickerMode = UIDatePickerModeDate;
    }
    else if ([mode isEqualToString:@"time"])
    {
        self.datePicker.datePickerMode = UIDatePickerModeCountDownTimer;
    }
    else
    {
        self.datePicker.datePickerMode = UIDatePickerModeDateAndTime;
    }
}

@end

Datepicker.h code:

//  Phonegap DatePicker Plugin
//  Copyright (c) Greg Allen 2011
//  MIT Licensed

#import <Foundation/Foundation.h>
#import <Cordova/CDVPlugin.h>

#ifndef k_DATEPICKER_DATETIME_FORMAT
#define k_DATEPICKER_DATETIME_FORMAT @"yyyy-MM-dd'T'HH:mm:ss'Z'"
#endif

@interface DatePicker : CDVPlugin <UIActionSheetDelegate> {
    UIActionSheet *_datePickerSheet;
    UIDatePicker *_datePicker;
    NSDateFormatter *_isoDateFormatter;
    BOOL isVisible;

}

@property (nonatomic, retain) UIActionSheet* datePickerSheet;
@property (nonatomic, retain) UIDatePicker* datePicker;
@property (nonatomic, retain) NSDateFormatter* isoDateFormatter;

//- (void) prepare:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
- (void) show:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;

@end


text:
Q: Windows 10 update disrupting Ubuntu dual boot once again I am typing this on my phone now as my laptop has been put out of use by what had just occurred.
After a recent windows 10 update, I was once again faced with problems relating to my Ubuntu dual boot. This time however the situation seems different as my laptop did not boot directly into Windows, rather booted into a very stripped down version of grub 2, and upon exiting I was greeted with a system menu showing 2 'windows' options and an 'unknown device'. Windows was the only option that worked so I used Windows for the past few days. Recently windows has become very slow and sluggish hence I was trying to get my Ubuntu back.
As this is a problem I had not faced before, I tried to use a boot-repair USB drive this time, however I ran into many errors with this software. First it tells me:
$GPT detected. Please create a BIOS-Boot partition...$
Which I attempted by setting my UEFI partition to unformatted, however not only did that not work it seemed have resulted in my being unable to access even the stripped down grub menu to boot into Windows, instead displaying the error 'no boot able device'.
Next I tried to alter the settings of boot repair by changing in the settings, under >GRUB location, and ticking 'Separare /boot/efi partition:' as suggested by the error message. This still didn't seem to work and I was given the following pastebin:
http://paste.ubuntu.com/p/hTz4vjdpSD
At this point I'm quite afraid of doing much else now for fears of making my predicament even worse. That is why I have turned to the experts at SU wondering if anyone here could shed some insight into the issue at hand here.
Here is a boot repair summary generated by the app:
http://paste.ubuntu.com/p/PdNBXrX4mF/
Thank you very much!


text:
Q: How do I associate my application with a pinned program on the Windows 7 taskbar? We have an application, let's call it MyApp. On installation, we create a desktop icon for MyApp, which basically calls MyLauncher.exe /launch MyApp.exe. MyLauncher does some useful stuff (check for updates, etc.), and then starts MyApp.

A user with Windows 7 might want to pin it to the task bar (i.e., right mouse button on the desktop icon, "Pin to Taskbar"):

However, since the shortcut points to MyLauncher, the following happens when the user starts the application (either with the desktop icon or the taskbar icon): MyLauncher does its stuff, and, afterwards, it starts MyApp. On the taskbar, the result is as follows:

I understand why this happens. Since MyLauncher starts MyApp, the Windows 7 taskbar sees them as two different applications.
Obviously, my question is: As the developer of MyLauncher and MyApp, can I do something about this? I'd like the Windows 7 taskbar to "associate" all instances of MyApp.exe with the shortcut starting MyLauncher.exe /lauch MyApp.exe.

A: Try playing around with the "App Ids"
See here for more info:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
"Application User Model IDs (AppUserModelIDs) are used extensively by the taskbar in Windows 7 and later systems to associate processes, files, and windows with a particular application. In some cases, it is sufficient to rely on the internal AppUserModelID assigned to a process by the system. However, an application that owns multiple processes or an application that is running in a host process might need to explicitly identify itself so that it can group its otherwise disparate windows under a single taskbar button and control the contents of that application's Jump List."

A: One thing you can do is not show the task-bar icon for the application at all. In WPF it's as simple as a property setting:
ShowInTaskbar="False"
The problem with this approach is that it will reduce usability because the user can no longer tell when the application is running or easily bring it to the forefront when it gets lost behind other windows. In order to alleviate some of these concerns, you can create a notify icon for this application which would enable some of these functions and also give the user some feedback as to the application's current state. (Running, not running, etc..)
This msdn resource has a good code sample on how to create notify icons in windows forms. You can use the same method for WPF applications as well.

SMALL TIP: Notify icons are 16x16 pixels. Try to find a vector version of the icon prior to resizing as this will give you crisper results because you tend to lose a lot of detail at that size.
Some user interaction with the notify-icon can include:

*

*Double-Click > Brings the application to the front

*Right-Click > Brings up a context menu with some choices. (I.E. Bring to front, close, etc...)

*Mouse-Over > Brings up a tool-tip with some information regarding the application.

A: 1)
This is more of an architectural question / problem - that's a bit of an unusual design for such purposes,
i.e. if an updater (I'm guessing you have more but to start w/ that) is required that's usually checked within the app - then if update is deemed you start an outside process and update the app etc.
Launcher (as described) would make sense if you are launching many different things or you have a generic solution or in more complex cases - e.g. you have a 'host process' that loads dll-s, services etc.
So basically you're running into problems because of a bit unfortunate design, decision - unless you have something that warrants that sufficiently.
But having you said that you didn't wish to redesign...
2)
You could still do a 'trick' with launcher - and make kind of a simple work around...

*

*Launch the 'MyApp -argument:check' first (and have icon on desktop belong to it, not the launcher), and have an argument 'fork' on startup and if 'check' do a small 'shim' code which lauches the 'MyLauncher',

*get the launcher to do what it's supposed to be doing - you can even close the main MyApp after launching,

*when launcher is done it launches the MyApp again (or more complex to close if left only if update is needed etc. - but the previous is easier), and use some other argument or don't use any (depends on what you want etc.),

*You're doing some process double redirection of a sort - start app => launcher => app again,

*you should have no problems with the icons this way,

*with all this you should be careful about supplying  proper manifests to either app (most often the launcher which needs to update, more permissions) if an 'admin' mode is required, but I guess you have that already,

that might do the trick, haven't tried but I don't see why it shouldn't - and you can keep the existing architecture in place etc.

A: It was already mentioned to set the Application user Model ID. How this is done could be easily seen in this post: How to group different apps in Windows task bar?
But then you still have the problem that when the Application is pinned, it will not pin the Launcher. But there is also a solution for this, that the Launcher is pinned instead: Pinning to the taskbar a "chained process"


text:
Q: Grid Sizer with jQuery I'm writing myself a little game in JavaScript, using jQuery. The game has a board, with cells in it, much like Minesweeper: the user clicks a cell, and its data needs to be changed in some way. Each cell is presented by a simple image, but has some more data associated with it.
What I mostly need is, when the user clicks a cell, I have to somehow determine the row and column which was clicked, manipulate the data appropriately and change the view.
On one hand, setting the click handler on every individual cell seems like an overkill, but if you set the click handler on the whole table, it becomes PITA to determine which table cell was clicked.
How would you handle such a situation? Maybe there is a plugin already that can simplify the whole thing?

A: add the click handler on the whole table. use event.target to get the clicked cell. add an attribute to each cell that will tell you what row/col it is, that way you dont have to run any massive/heavy JS to figure it out.
psuedocode:
$("table.game").click(function(e){
  var cell = e.target;
  var pos = $(cell).attr("name").split["_"];
  var x = pos[0];
  var y = pos[1];
  return false;
});

markup:

     sdfasdfa

note: having a name start with a digit isnt good, so fix as needed

A: This is a perfect example of a great use of the live() function. To find the x and y positions you just need to count the number of cells before or rows above this one:
$('#minesweeperTable td').live('click', function() {
    var $this = $(this),
        xPos = $this.prevAll('td').length,
        yPos = $this.closest('tr').prevAll('tr').length
    ;
    // your code here
});

The best thing about this is that no matter how many cells you have, there's only one event handler which makes for much better performance.

A: If your table is generated dynamically (js or php for instance) you could have each cell with a class and / or id attributes that gave you the information.
I don't know how you represent your cells so in pseudo code :

  <row>
    <cell id="cell-0x0" />
    <cell id="cell-0x1" />
    ...
  </row>
  <row>
    <cell id="cell-1x0" />
    ...
  </row>
  ...

Then in jQuery :
$('#board cell').click(function(){
  var coord = $(this).attr('id').substr(5).split('x');
  // do your stuff
});

A: If you have too many table cells setting the click handlers would be heavy, but you can make a workaround to calculate the box number from mouse click's event.page.X and event.page.Y this will give coordinatesof clicked pixel on your screen and you can calculate which box is under that pixel.
Or
You can also use event.target the get the node clicked.
check out jquery.event.
hope it helps, Sinan.

A: The click event bubbles and the original target can be found in the srcElement property of the event object (I think, or it might be another property, but it's there).


text:
Q: Android studio 1.0.1 google map v2 not working on API 10 I create new project and select minimum sdk 2.3.3 gingerbread then select Google map Activity . android studio default preparations do . this project work on api 11 and above و but in api 10(for example Galaxy Y s5360, not install google play services) message show "get google play services" .  For example, I have some applications that run in this version and this device(s5360) google map work without any problem .
please help ( sorry for my english)
my build.gradle is :
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "com.example.ehm.tantum"
    minSdkVersion 10
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.android.support:support-v4:21.0.3'  }

My mainfest is :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ehm.tantum" >

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="@string/google_maps_key" /> // i have API key this prject

    <activity
        android:name=".MapsActivity"
        android:label="@string/title_activity_maps" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

my mapActivity :
public class MapsActivity extends FragmentActivity {

private GoogleMap mMap; // Might be null if Google Play services APK is not available.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    setUpMapIfNeeded();
}

@Override
protected void onResume() {
    super.onResume();
    setUpMapIfNeeded();
}

private void setUpMapIfNeeded() {
    // Do a null check to confirm that we have not already instantiated the map.
    if (mMap == null) {
        // Try to obtain the map from the SupportMapFragment.
        mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                .getMap();
        // Check if we were successful in obtaining the map.
        if (mMap != null) {
            setUpMap();
        }
    }
}

private void setUpMap() {
    mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));
}

My libs folder default is empty .
please help .

A: If you have not installed google play services on your device, maps will never work.
You need the same version you use for compiling the app (6.5.87 according to your buildfile)
The fact that other apps are working, means (or i suppose at least) that is because you have an outdated version of play services and the other apps are compiled with older version of play services.
Try to update services on your device


text:
Q: Simple code has error in Xcode: duplicate symbol __ZN4Date8setmonthE I'm new to C++. Trying out a pretty simple problem involving a header file with a class, an implementation.cpp file, and a main .cpp file. Everything works until I run the program, then Xcode gives me this error:
duplicate symbol __ZN4Date8setmonthEi in:
    /Users/KB/Library/Developer/Xcode/DerivedData/3.15-fdmyzxvsswfgagasdplzankmibai/Build/Intermediates.noindex/3.15.build/Debug/3.15.build/Objects-normal/x86_64/main.o
    /Users/KB/Library/Developer/Xcode/DerivedData/3.15-fdmyzxvsswfgagasdplzankmibai/Build/Intermediates.noindex/3.15.build/Debug/3.15.build/Objects-normal/x86_64/implement.o
It says this nine times in a row. I don't know what it's trying to tell me. It also says at the bottom of it all:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Don't know how to fix this, any help would be great, and let me know if you want me to post any of the three files I wrote for this program.
Thanks.


text:
Q: Assign elements of a vector in different vector groups I have a vector of numeric elements and I need to assign them to different subgroups based on their values (group A if <= 20, group B if > 20 & <30). How do I do this in R?
I have tried using loop and if statements but these will take a lot of time since I have a lot of elements in the vector.
Thank you!


text:
Q: C# Indexing - Can i return the whole Class? appologies if I am missing osmething obvious with this one!
Im hoping to have the User decalare a code and then refence the Class name and pull all Data from it.
here is where I will be displaying said info back to the user:
   Console.Write("Input a code:");
                Console.Read();

                Console.WriteLine("code: " + HU2H02.HeadCode);
                    var i = 0;
                    Console.WriteLine("Stop No:     Station:      Arr:     Dep:");
                    foreach (Station stop in HU2H02.CallingPattern)
                    {
                    if (i < HU2H02.CallingPattern.Count-1)
                    {
                        if (i == 0)
                            Console.WriteLine("stop {0}: {1} \t  {3: hh:mm}", i, stop.Name, HU2H02.ArrTimes[i], HU2H02.DepTimes[i]);
                        else
                        Console.WriteLine("stop {0}: {1} \t {2: hh:mm} - {3: hh:mm}", i, stop.Name, HU2H02.ArrTimes[i], HU2H02.DepTimes[i]);
                    }
                    else
                    {
                        Console.WriteLine("stop {0}: {1} \t {2: hh:mm}", i, stop.Name, HU2H02.ArrTimes[i]);
                    }
                        i++;
                    }

Here is my Class code: (Sorry its a bit messy as im still working on it.
     class Train
    {
        public string HeadCode { get; set; }
        public string Origin { get; set; }
        public string Destination { get; set; }
        public List<Station> callingPattern = new List<Station>();
        public List<DateTime> arrTimes = new List<DateTime>();
        public List<DateTime> depTimes = new List<DateTime>();
        public DateTime DepartOrigin { get; set; }
        public DateTime ArriveDestination { get; set; }
        public string Via1 { get; set; }
        public string Via2 { get; set; }
        public string Via3 { get; set; }
        public string Via4 { get; set; }

        public object this[string Headcode]
        {
            get
            {

                Type myType = typeof(Train);
                PropertyInfo myPropInfo = myType.GetProperty(Headcode);
                return myPropInfo.GetValue(this, null);
            }
            set
            {
                Type myType = typeof(Train);
                PropertyInfo myPropInfo = myType.GetProperty(Headcode);
                myPropInfo.SetValue(this, value, null);

            }
        }

        public Train(List<Station> patterns, string newheadCode, string timetoDepartOrigin, string Origin)
        {
            TimeSpan previousTime = new TimeSpan();
            TimeSpan holder = new TimeSpan();
            TimeSpan calcTimeSpan = new TimeSpan();
            int i = 0;
            foreach (Station pattern in patterns)
            {
                CallingPattern.Add(pattern);

                if (pattern.Name == Origin)
                {

                    depTimes.Add(Convert.ToDateTime(timetoDepartOrigin));
                    ArrTimes.Add(Convert.ToDateTime(timetoDepartOrigin));
                    previousTime = TimeSpan.Parse(timetoDepartOrigin);
                }
                else
                {
                    holder = TimeSpan.Parse(callingPattern[callingPattern.Count - 2].DwellTimePeak);
                    calcTimeSpan = previousTime + holder;
                    ArrTimes.Add(DateTime.Parse(Convert.ToString(calcTimeSpan)));

                    if (callingPattern[callingPattern.Count - 1].DwellTimePeak != null)
                    {
                        holder = TimeSpan.Parse(callingPattern[callingPattern.Count - 1].DwellTimePeak);
                        calcTimeSpan = calcTimeSpan + holder;
                        depTimes.Add(DateTime.Parse(Convert.ToString(calcTimeSpan)));

                        previousTime = depTimes[depTimes.Count - 1].TimeOfDay + TimeSpan.Parse(callingPattern[callingPattern.Count - 1].TimetonextStationUP[patterns[i + 1].Name]);
                    }
                }
                i++;
            }

            HeadCode = newheadCode;
            DepartOrigin = Convert.ToDateTime(timetoDepartOrigin);
        }

        public List<DateTime> ArrTimes { get => arrTimes; set => arrTimes = value; }
        public List<DateTime> DepTimes { get => depTimes; set => depTimes = value; }
        internal List<Station> CallingPattern { get => callingPattern; set => callingPattern = value; }

        }
    }
}

Do i need to declare the whole class as Public also?
Im hoping to parse the whole Class back to the Main program or another class for Display and further use as I want this class to be a sub class of a few other classes later on in the design of my program..
im a bit fresh at C# so appologies if any of this does not make sense! Thanks,
Chris

A: To look up a train, you need to maintain a static collection of trains.  Static variables and functions operate at the class level (rather than the instance level).
Add something like this to your class:
private static Dictionary<string, Train> _trains;
private Train GetTrain(string headCode) {
    if (_trains.TryGetValue(headCode, out var train)) {
        return train;
    } else {
        return null;
    }
}
private bool TryGetTrain(string headCode, out Train train) {
    return _trains.TryGetValue(headCode, out train);
}

And, then at the end of your constructor, add some code like this:
 _trains.Add(newHeadCode, this);

Every time you create a new train, it will be added to that dictionary of trains. Then, when you want to look up a train, you can do this.
var myTrain = Train.GetTrain("some head code");

A: if you don't define class as anything, it'll remains as private.
private class cannot be access on other class.
so we define it as internal or public.
internal class can be access on any class which contains current project.
public class is accessable on any class even it's other project.
choose it depends on your purpose.


text:
Q: Get image dimensions with JavaScript using innerHTML I'm working on an AJAX function that receives image URLs. However, I won't be using a node append to insert it. I'm using innerHTML, which makes it difficult to get the file dimensions.
At the moment, I'm using a function which is returning somewhat mixed results. Sometimes it gets the actual dimensions, other times it returns "0" as the image dimensions.
This is my function:
var url = "http://placekitten.com.s3.amazonaws.com/homepage-samples/408/287.jpg";
var width = getDimensions(url)[0];
var height = getDimensions(url)[1];
var insert = '';

    function getDimensions(path) {
            var img = new Image();
            img.src = path;
            return [img.width, img.height];
    }

Not sure why it's acting inconsistently though. Does anyone have any suggestions?
I was thinking it might be something to do with the AJAX inserting the image before it loads the dimensions, although not really sure.
Here's a fiddle, which seems to work as expected, but like I said, it's inconsistent.
http://jsfiddle.net/aH5re/1/
EDIT
Here is a second fiddle with a much larger image. I noticed it's a lot more inconsistent than a smaller image file
http://jsfiddle.net/aH5re/2/

A: You'll have to wait for the image to finish loading before you can get the dimensions properly and reliably.  What's currently happening is that it's returning the dimensions before the image is potentially fully loaded.  If you have it already cached you may be getting correct dimensions but on a large image uncached you're not going to get reliable results.
Have a look at this demo about how you could perhaps achieve that.
http://jsfiddle.net/robschmuecker/aH5re/5/
Javascript:
var url = "http://www.hdwallpapers.in/download/transformers_4_age_of_extinction-2560x1440.jpg";

var div = document.querySelector('div');
alert('loading image now');
var button = document.querySelector('.test');
getDimensions(url);

button.addEventListener('click', function () {
    div.innerHTML = insert;
});

function getDimensions(path) {
    var img = new Image();
    img.src = path;
    img.onload = function () {
        alert('loaded');
        var width = img.width;
        var height = img.height;
        insert = '';
        button.disabled = false
    };
}


text:
Q: flask admin edit child objects on click Flask-Admin shows child objects defined by relationships in its standard edit view. For example, if User objects have Address children, looking at the edit view for User will show the Address child in the appropriate field. The user can then remove the object, or add another one.
I want users to be able to click through, or otherwise have the ability to enter the edit view of child objects. In the example I'm describing, the user should be able to access the edit view of the Address object directly from the edit view of the User object.
The only thing I've found at all related is inline_models, but this isn't a solution. The implementation is extremely fragile (it can't handle long distance relationships, for example). Flask-Admin is aware of child objects! I can see them in the view! I just want them to become a link to their own edit view...
Anyone have any idea how to accomplish this or can link to an example?

A: Here is a single file simple example of placing a link to another model's edit view in an edit view. It may help you or not.

I've used a User - Address relationship, a user has an address and address can have many users.
I've used Faker to generate sample data so you'll need to pip install faker into your environment.
The idea is to use Flask-Admin form rules and in this case I'm configuring form_edit_rules.
I've created two custom rules:
Link, inheriting BaseRule. The constructor takes three values; an endpoint, a name of an attribute to pass along with the endpoint in the Flask url_for method and finally the text to appear as the link. In this example the endpoint is 'address.edit_view' because this is the view we want to link to.
MultiLink, similar to Link accepts it works with a relation.
Here's the code (there's little error checking):
from random import randint
from flask import Flask, url_for
from flask_admin.contrib import sqla
from flask_admin import Admin
from flask_admin.form.rules import BaseRule
from faker import Faker
from flask_sqlalchemy import SQLAlchemy
from markupsafe import Markup
from sqlalchemy import func, select
from sqlalchemy.ext.hybrid import hybrid_property

fake = Faker()

# Create application
app = Flask(__name__)

# Create dummy secrey key so we can use sessions
app.config['SECRET_KEY'] = '123456790'

# Create in-memory database
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:'
# app.config['SQLALCHEMY_ECHO'] = True
db = SQLAlchemy(app)

# Flask views
@app.route('/')
def index():
    return 'Click me to get to Admin!'

class Address(db.Model):

    __tablename__ = 'addresses'

    id = db.Column(db.Integer, primary_key=True)
    number = db.Column(db.String(255))
    street = db.Column(db.String(255))
    city = db.Column(db.String(255))
    country = db.Column(db.String(255))

    @hybrid_property
    def user_count(self):
        return len(self.users)

    @user_count.expression
    def user_count(cls):
        return select([func.count(User.id)]).where(User.address_id == cls.id).label("user_count")

    def __unicode__(self):
        return ', '.join(filter(None, [self.number, self.street, self.city, self.country]))

class User(db.Model):
    __tablename__ = 'users'
    id = db.Column(db.Integer, primary_key=True)
    first_name = db.Column(db.String(255))
    last_name = db.Column(db.String(255))
    email = db.Column(db.String(254))

    address_id = db.Column(db.Integer, db.ForeignKey('addresses.id'), index=True)
    address = db.relationship(Address, backref=db.backref('users'))

    def __str__(self):
        return unicode(self).encode('utf-8')

    def __unicode__(self):
        return '{} {}'.format(self.first_name, self.last_name)

class Link(BaseRule):
    def __init__(self, endpoint, attribute, text):
        super(Link, self).__init__()
        self.endpoint = endpoint
        self.text = text
        self.attribute = attribute

    def __call__(self, form, form_opts=None, field_args=None):
        if not field_args
            field_args = {}

        _id = getattr(form._obj, self.attribute, None)

        if _id:
            return Markup('{text}'.format(url=url_for(self.endpoint, id=_id), text=self.text))

class MultiLink(BaseRule):
    def __init__(self, endpoint, relation, attribute):
        super(MultiLink, self).__init__()
        self.endpoint = endpoint
        self.relation = relation
        self.attribute = attribute

    def __call__(self, form, form_opts=None, field_args=None):
        if not field_args
            field_args = {}
        _hrefs = []
        _objects = getattr(form._obj, self.relation)
        for _obj in _objects:
            _id = getattr(_obj, self.attribute, None)
            _link = 'Edit {text}'.format(url=url_for(self.endpoint, id=_id), text=str(_obj))
            _hrefs.append(_link)

        return Markup('
'.join(_hrefs))

class UserAdmin(sqla.ModelView):
    can_view_details = True

    form_edit_rules = (
        'first_name',
        'last_name',
        'email',
        'address',
        Link(endpoint='address.edit_view', attribute='address_id', text='Edit Address')
    )

class AddressAdmin(sqla.ModelView):
    can_view_details = True

    column_list = ['number', 'street', 'city', 'country', 'user_count', 'users']

    form_edit_rules = (
        'number',
        'street',
        'city',
        'country',
        'users',
        MultiLink(endpoint='user.edit_view', relation='users', attribute='id')
    )

admin = Admin(app, template_mode="bootstrap3")
admin.add_view(UserAdmin(User, db.session))
admin.add_view(AddressAdmin(Address, db.session))

def build_db():
    db.drop_all()
    db.create_all()

    for _ in range(0, 20):
        _users = []
        for _ in range(0, randint(1, 10)):
            _user = User(
                first_name=fake.first_name(),
                last_name=fake.last_name(),
                email=fake.safe_email(),
            )
            _users.append(_user)

        _address = Address(
            number=fake.random_digit_not_null(),
            street=fake.secondary_address(),
            city=fake.city(),
            country=fake.country(),
            users = _users
        )

        db.session.add(_address)

    db.session.commit()

@app.before_first_request
def first_request():
    build_db()

if __name__ == '__main__':
    app.run(port=5000, debug=True)


text:
Q: Does "exploitation" have only a negative meaning? According to Oxford Living dictionaries, the term exploitation has two meanings.

*

*Treating someone unfairly in order to benefit from their work.

*The action of making use of and benefiting from resources.

When we say "exploitation of labour" or "workforce", which definition is usually intended? Can it be used for the second meaning? And can the second definition be also negative?

A: .In the realm of music management and contracts, the word 'exploit' is used in a positive context regularly. Recently, a friend I assist signed his first record deal. The contract detailed the percentage the label would receive in exchange for the exclusive right to exploit the master recording. Both parties signed and agreed that it was in the best interest of everyone that the label exploit the recording to the best of their ability. So, in this scenario, exploitation is encouraged

A: The right to explore and exploit natural resources freely
Sovereignty Over Natural Resources: Balancing Rights and Duties
Nico Schrijver - 2008 - Law
(Try any google search with resources after exploit- you will have to qualify resources, e.g. as natural, economic, etc. if using google search with search term in quotes.)
When it's resources, connotation is neutral.
Apple factories accused of exploiting Chinese workers
www.theguardian.com
When 'exploit' is followed by any human or community, it's critical.
(Try any google search with workers, people following 'exploit(ing)'.)
Exploit 'human resources', though truly of the former type, is stylistically too close to the latter for the comfort of less-perspicacious audiences (i.e. most of them ;)

A: Exploitation is almost always negative when talking about people, property, or anything substantial. Even though 'take advantage of' is synonymous it's better to 'take advantage of' and opportunity than to 'exploit' it. It suggests unfairness, underhandedness, and immorality.

A: According to etymonline.com
exploitation (n.)

1803, "productive working" of something, a positive word among those
  who used it first, though regarded as a Gallicism, from French
  exploitation, noun of action from exploiter (see exploit (v.)). Bad
  sense developed 1830s-50s, in part from influence of French socialist
  writings (especially Saint Simon), also perhaps influenced by use of
  the word in U.S. anti-slavery writing; and exploitation was hurled in
  insult at activities it once had crowned as praise.

When we say "exploitation of labor" or "workforce", which definition is usually intended?
Definition of utilizing resources which might be human or material should be implied.


text:
Q: Cant play the video Vlc Url scheme IOS I have a video.mp4 and i want to play it on vlc
i am new to swift and this stuff so i dont know if this url scheme is right or wrong
this is the code below
let path = Bundle.main.path(forResource: "Video", ofType: "mp4")
    let vlcURL = "vlc://\(path!)"
    let vlcItem = ( URL(string:vlcURL)!)
    UIApplication.shared.open(vlcItem)

EDIT: I tried to play a stream and it works
but I want to play a video saved locally how do I do that
EDIT2: I managed to get the URL path to vlc but it when I click play it shows a black screen and closes it


text:
Q: grouping and logical implication in math mode How could I typeset a formula like this:

It should respect typographic rules, but it must look very similar.

A: You could use the aligned environment (requires the amsmath package), e.g.
\left. \begin{aligned}
   A &= T \\
   B &= F
\end{aligned} \right\} \implies A \vee B = T \vee F = T

A: (Assuming you meant to use logical disjunction and logical implication)
\[
\left.\begin{array}{l}
    A = T \\ B = F
\end{array}\right\}
\implies A \lor B = T \lor F = T
\]

A: This code should do what you want:
\[
  \left.
  \begin{array}{c}
    A = T\\
    B = F
  \end{array}
  \right\}
  \Rightarrow A \vee B = T \vee F = T
\]


text:
Q: Export data generated in JPanel to excel I have a Java Application that creates a JPanel menu and part of the program is to export data provided by the user inside JPanel to excel.
I want to create excel file and provide certain formatting inside my program.
I have tried using Apache POI, my code for the function is below. The function is called with a press of a button inside the JPanel when the application is running.
    private static void processExcelInformation() throws FileNotFoundException
{
    JOptionPane.showMessageDialog(panel, "stuck before workbook", "Display",
            JOptionPane.WARNING_MESSAGE);
    HSSFWorkbook workbook = new HSSFWorkbook(); // <---- I cannot seem to initialize new workbook
    JOptionPane.showMessageDialog(panel, "created workbook", "Display",
            JOptionPane.WARNING_MESSAGE); // <---- This message is not displayed when the application runs
    HSSFSheet sheet = workbook.createSheet("Sample sheet");
    JOptionPane.showMessageDialog(panel, "created sheet", "Display",
            JOptionPane.WARNING_MESSAGE);

    Map<String, Object[]> data = new HashMap<String, Object[]>();
    data.put("1", new Object[] {"Emp No.", "Name", "Salary"});
    data.put("2", new Object[] {1d, "John", 1500000d});
    data.put("3", new Object[] {2d, "Sam", 800000d});
    data.put("4", new Object[] {3d, "Dean", 700000d});

    Set<String> keyset = data.keySet();
    int rownum = 0;
    for (String key : keyset) {
        Row row = sheet.createRow(rownum++);
        Object [] objArr = data.get(key);
        int cellnum = 0;
        for (Object obj : objArr) { // <---- This statement does not allow the application to run, I get an error
            Cell cell = row.createCell(cellnum++);
            if(obj instanceof Date)
                cell.setCellValue((Date)obj);
            else if(obj instanceof Boolean)
                cell.setCellValue((Boolean)obj);
            else if(obj instanceof String)
                    cell.setCellValue((String)obj);
            else if(obj instanceof Double)
                cell.setCellValue((Double)obj);
        }
    }

    try {
        JOptionPane.showMessageDialog(panel, "stuck before xls", "Display",
                JOptionPane.WARNING_MESSAGE);
        FileOutputStream out =
                new FileOutputStream(new File("new.xls"));
        workbook.write(out);
        out.close();
        System.out.println("Excel written successfully..");
        JOptionPane.showMessageDialog(panel, "Excel written", "Display",
                JOptionPane.WARNING_MESSAGE);

    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

Check for comments where I have issues with my code.
Maybe someone can recommend me another way to complete my task or provide me a solution to my issues.
Thanks
Here's more to my code...
public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            soccerStock = new ArrayList<Soccer>();
            childrenStock = new ArrayList<Children>();
            miniSoccerStock = new ArrayList<MiniSoccer>();
            tennisStock = new ArrayList<Tennis>();
            universalStock = new ArrayList<Universal>();
            try {
//                  processExcelInformation();
                parseXMLInput();
                initializeGrassChoices();

            } catch (JAXBException e) {
                e.printStackTrace();
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            Calculator ex = new Calculator();
            ex.setVisible(true);
        }
    });
}

public Calculator() {
    initUI();
}

public final void initUI() {
    initGrassRollChoices();
    initPanel();
    createMenu();
}

This is the button that calls processExcelInformation() function...
JMenuItem xls = new JMenuItem("Excel", null);
    xls.setMnemonic(KeyEvent.VK_E);
    xls.setToolTipText("Export Excel");

    xls.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                processExcelInformation();
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

    });

When I call processExcelInformation() during compilation from main function it creates the excel file as asked. However, when I write my code to call processExcelInformation() function using a button I get an error when launching my application.

A: There is an open source package called Jexcel which might provide the tools you need. See this Source Forge site for the source packages. For tutorials and API docs you can look here.
Additional: I've just read some reviews. Seems JExcel doesn't enjoy a very good rep and doesn't support xlsx format.
Looking at your code I can see that there may be a problem with the for-loop you've indicated. You haven't mentioned what the error is, but I suspect you cannot simply treat an array as a collection. I'd be inclined to try something more traditional like this:
for (int i = 0; i < objArr.length; i++){
 ...
}

A: Take a look at JExcel. It´s pretty easy to use  if you don´t need overly complicated spreadsheets and there are a lot examples and HowTos if you ask our friend Google.


text:
Q: How to drop column from organize by column table in DB2? Please help how to drop column from organized by column table is it possible to drop i by alter table drop column?

A: You can't issue an ALTER TABLE ... DROP COLUMN statement to drop a column from a column-organized table.
If you need to drop a column, you'd need to create a new table without the new column and populate it from the existing table using an INSERT INTO ... SELECT statement.


text:
Q: Constantly getting 401 when trying to post to Tumblr blog I'm getting a 401 constantly without further explanation of what the error is when posting to Tumblr via the v2 API.
Requests are below - linebreaks are added for readibility
POST http://api.tumblr.com/v2/blog/[blog].tumblr.com/post HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: api.tumblr.com
Content-Length: 303

body=test&
oauth_consumer_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&
oauth_nonce=4712451&
oauth_signature_method=HMAC-SHA1&
oauth_timestamp=1312610497&
oauth_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&
oauth_version=1.0&
type=text&
oauth_signature=ccN%2f0E%2bat42BAzdkDPJ%2ffcuMacY%3d

I get the following response
HTTP/1.1 401 Not Authorized
Date: Sat, 06 Aug 2011 06:01:43 GMT
Server: Apache
P3P: CP="ALL ADM DEV PSAi COM OUR OTRo STP IND ONL"
Vary: Accept-Encoding
X-Tumblr-Usec: D=38791
Content-Length: 60
Connection: close
Content-Type: application/json

{"meta":{"status":401,"msg":"Not Authorized"},"response":[]}

Does anyone can spot why?

A: You can check your base string here
http://quonos.nl/oauthTester/
and you can check everything here
http://hueniverse.com/oauth/guide/authentication/
Also, personally I've had some trouble when my signature included a +, as yours does above, (+ = %2b urlencoded). I solved the problem by testing for the + in my signature and re-signing if it did.


text:
Q: efficient way to join 65,000 .csv files I have say 65,000 .csv files that I need to work with in julia language.
The goal is to perform basic statistics on the data set.
I had some ways of joining all the data sets
#1 - set a common index and leftjoin() - perform statistics row wise
#2 - vcat() the dataframes on top of each other - vertically stacked use group by

Eitherway the final data frames are very large ! and become slow in processing
Is there an efficient way of doing this ?
I thought of performing either #1 or #2 and splitting the joining operations in thirds, lets say after 20,000 joins save to .csv and operate in chunks then at the end join all 3 in one last operation.
Well not sure how to replicate making 65k .csv files but basically below I loop through the files in the directory, load the csv then vcat() to one df. Question more relating to if there is a better way to manage the size of the operation. vcat() makes something grow. Ahead of time maybe I can cycle through the .csv files, obtain file dimensions per .csv, initialize the full dataframe to final output size, then cycle through each .csv row by row and populate the initialized df.
using CSV
using DataFrames

# read all files in directory
csv_dir_tmax = cd(readdir, "C:/Users/andrew.bannerman/Desktop/Julia/scripts/GHCN data/ghcnd_all_csv/tmax")

# initialize outputs
tmax_all = DataFrame(Date = [], TMAX = [])
c=1
for c = 1:length(csv_dir_tmax)
    print("Starting csv file ", csv_dir_tmax[c]," - Iteration ",c,"\n")
        if c <= length(csv_dir_tmax)
    csv_tmax = CSV.read(join(["C:/Users/andrew.bannerman/Desktop/Julia/scripts/GHCN data/ghcnd_all_csv/tmax/", csv_dir_tmax[c]]), DataFrame, header=true)
        tmax_all = vcat(tmax_all, csv_tmax)
    end
end

A: The following approach should be relatively efficient (assuming that data fits into memory):
tmax_all = reduce(vcat, [CSV.read("YOUR_DIR$x", DataFrame) for x in csv_dir_tmax])

A: initializing the final output to the total size of final output (like vcat() would finally build). Then populate it element wise seems to be working way better:
# get the dimensions of each .csv files
tmax_all_total_output_size = fill(0, size(csv_dir_tmax,1))
tmin_all_total_output_size = fill(0, size(csv_dir_tmin,1))
tavg_all_total_output_size = fill(0, size(csv_dir_tavg,1))
tmax_dim = Int64[]
tmin_dim = Int64[]
tavg_dim = Int64[]
c=1
for c = 1:length(csv_dir_tmin) # 47484 - last point
    print("Starting csv file ", csv_dir_tmin[c]," - Iteration ",c,"\n")
        if c <= length(csv_dir_tmax)
    tmax_csv = CSV.read(join(["C:/Users/andrew.bannerman/Desktop/Julia/scripts/GHCN data/ghcnd_all_csv/tmax/", csv_dir_tmax[c] ]), DataFrame, header=true)
    global tmax_dim = size(tmax_csv,1)
        tmax_all_total_output_size[c] = tmax_dim
    end
    if c <= length(csv_dir_tmin)
    tmin_csv = CSV.read(join(["C:/Users/andrew.bannerman/Desktop/Julia/scripts/GHCN data/ghcnd_all_csv/tmin/", csv_dir_tmin[c]]), DataFrame, header=true)
    global tmin_dim = size(tmin_csv,1)
        tmin_all_total_output_size[c] = tmin_dim
    end
    if c <= length(csv_dir_tavg)
    tavg_csv = CSV.read(join(["C:/Users/andrew.bannerman/Desktop/Julia/scripts/GHCN data/ghcnd_all_csv/tavg/", csv_dir_tavg[c]]), DataFrame, header=true)
    global tavg_dim = size(tavg_csv,1)
        tavg_all_total_output_size[c] = tavg_dim
    end
end

# sum total dimension of all .csv files
tmax_sum = sum(tmax_all_total_output_size)
tmin_sum = sum(tmin_all_total_output_size)
tavg_sum = sum(tavg_all_total_output_size)

# initialize final output to total final dimension
tmax_date_array = fill(Date("13000101", "yyyymmdd"),tmax_sum)
tmax_array = zeros(tmax_sum)
tmin_date_array = fill(Date("13000101", "yyyymmdd"),tmin_sum)
tmin_array = zeros(tmin_sum)
tavg_date_array = fill(Date("13000101", "yyyymmdd"),tavg_sum)
tavg_array = zeros(tavg_sum)

# initialize outputs
tmax_all = DataFrame(Date = tmax_date_array, TMAX = tmax_array)
tmin_all = DataFrame(Date = tmin_date_array, TMIN = tmin_array)
tavg_all = DataFrame(Date = tavg_date_array, TAVG = tavg_array)
tmax_count = 0
tmin_count = 0
tavg_count = 0

Then begin filling the initialized df.


text:
Q: VS C++: A task was canceled I tried to compile this in Visual Studio Premium 2013 (last version), I am using Windows 10. (I hope not my OS is the problem, on CodeBlocks is working really fine).
#include <iostream>

using namespace std;

int main()
{
    cout << "Hello World!";
    return 0;
}

And I get this error:
1>------ Build started: Project: OtherTest, Configuration: Debug Win32 ------
1>A task was canceled.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Any source code that I try to compile, finish with this error (even a empty one).