text:
Q: Android FATAL EXCEPTION: main? i have this code
package com.UPFIM.casa;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;

public class Constancias extends Activity {

    public String nivels;
    public String tipos;

    public String cant;
    public String fot;

    public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.constancias);

            EditText nombre = (EditText) findViewById(R.id.name);
     EditText matricula = (EditText) findViewById(R.id.edusuario);
     EditText mensaje;
     EditText subje;

            final String nivel[]=new String[]{"Nivel","Preparatoria","Profesional"};
            final String tipoc[]=new String[]{"Tipo de Constancia",
                    "Inscripción en el Periodo en Curso",
                    "Inscripción en el Periodo Inmediato Anterior",
                    "Inscripción con Periodo Vacacional",
                    "Servicio Militar Nacional",
                    "Inscripción con Promedio Acumulado",
                    "Inscripción con Promedio del Periodo Inmediato Anterior",
                    "Inscripción en el Periodo en Curso con Materias Inscritas",
                    "Inscripción en el Periodo Inmediato Anterior con Materias",
                    "Inscripción con Promedio del Periodo Inmediato Anterior y Promedio Acumulado",
                    "Inscripción en el Periodo en Curso con Materias Inscritas y Calificaciones",
                    "Inscripción en el Periodo Inmediato Anterior con Materias que se Cursaron y Calificaciones",
                    "Inscripción en el Periodo de Verano",
                    "Documentación en Trámite de Legalización",
                    "Documentación en trámite de Apostille",
                    "Terminación de Estudios",
                    "Terminación de Estudios con Promedio",
                    "Carta de Buena Conducta",
                    "Nivel de Ingles",
                    "Beca"};

            final String[] cantidad = new String[]{"1->$20.00","2->$40.00","3->$60.00","4->$80.00","5->$100.00"};
            final String[] foto = new String[]{"Si","No"};

     final Spinner spinner1 = (Spinner)findViewById(R.id.spinner1);
     final Spinner spinner2 = (Spinner)findViewById(R.id.spinner2);
     final Spinner spinner3 = (Spinner)findViewById(R.id.spinner3);
     final Spinner spinner4 = (Spinner)findViewById(R.id.spinner4);

    ArrayAdapter<String> adapter =
            new ArrayAdapter<String>(this,
                    android.R.layout.simple_spinner_item, nivel);
    spinner1.setAdapter(adapter);

    adapter.setDropDownViewResource(
            android.R.layout.simple_spinner_dropdown_item);

    spinner1.setAdapter(adapter);

    spinner1.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
            public void onItemSelected(AdapterView<?> parent,
                android.view.View v, int position, long id) {
                nivels = new String("\nNivel: " + nivel[position]);
            }

            public void onNothingSelected(AdapterView<?> parent) {
                nivels = new String("");
            }
    });

    ArrayAdapter<String> adapter1 =
            new ArrayAdapter<String>(this,
                    android.R.layout.simple_spinner_item, tipoc);
    spinner2.setAdapter(adapter1);

    adapter1.setDropDownViewResource(
            android.R.layout.simple_spinner_dropdown_item);

    spinner2.setAdapter(adapter1);

    spinner2.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
            public void onItemSelected(AdapterView<?> parent,
                android.view.View v, int position1, long id) {
                tipos = new String("\nTipo: " + tipoc[position1]);
            }

            public void onNothingSelected(AdapterView<?> parent) {
                tipos = new String("");
            }
    });

    ArrayAdapter<String> adapter2 =
            new ArrayAdapter<String>(this,
                    android.R.layout.simple_spinner_item, cantidad);
    spinner3.setAdapter(adapter2);

    adapter2.setDropDownViewResource(
            android.R.layout.simple_spinner_dropdown_item);

    spinner3.setAdapter(adapter2);

    spinner3.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
            public void onItemSelected(AdapterView<?> parent,
                android.view.View v, int position2, long id) {
                cant = new String("\nCantidad: " + cantidad[position2]);
            }

            public void onNothingSelected(AdapterView<?> parent) {
                cant = new String("");
            }
    });

    ArrayAdapter<String> adapter3 =
            new ArrayAdapter<String>(this,
                    android.R.layout.simple_spinner_item, foto);
    spinner4.setAdapter(adapter3);

    adapter3.setDropDownViewResource(
            android.R.layout.simple_spinner_dropdown_item);

    spinner4.setAdapter(adapter3);

    spinner4.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
            public void onItemSelected(AdapterView<?> parent,
                android.view.View v, int position3, long id) {
                fot = new String("\nFoto: " + foto[position3]);
            }

            public void onNothingSelected(AdapterView<?> parent) {
                fot = new String("");
            }
    });

    mensaje.setText("" + nombre.getText().toString() + "\n" + matricula.getText().toString() + nivels + tipos + cant + fot );
    subje.setText("Solicitud de Constancia APP");

     }

     public void enviarme (View view){
         Intent itSend = new Intent( android.content.Intent.ACTION_SEND);

         itSend.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"spartan-004@hotmail.com"});
         itSend.putExtra(android.content.Intent.EXTRA_SUBJECT,subje.getText());
         itSend.putExtra(android.content.Intent.EXTRA_TEXT, mensaje.getText());

         startActivity(itSend);

     }

}

But i don't found my error because i see this log
03-18 19:26:28.065: E/AndroidRuntime(371): FATAL EXCEPTION: main
03-18 19:26:28.065: E/AndroidRuntime(371): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.UPFIM.casa/com.UPFIM.casa.Constancias}: java.lang.NullPointerException
03-18 19:26:28.065: E/AndroidRuntime(371):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
03-18 19:26:28.065: E/AndroidRuntime(371):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-18 19:26:28.065: E/AndroidRuntime(371):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-18 19:26:28.065: E/AndroidRuntime(371):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
03-18 19:26:28.065: E/AndroidRuntime(371):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-18 19:26:28.065: E/AndroidRuntime(371):  at android.os.Looper.loop(Looper.java:123)
03-18 19:26:28.065: E/AndroidRuntime(371):  at android.app.ActivityThread.main(ActivityThread.java:3683)
03-18 19:26:28.065: E/AndroidRuntime(371):  at java.lang.reflect.Method.invokeNative(Native Method)
03-18 19:26:28.065: E/AndroidRuntime(371):  at java.lang.reflect.Method.invoke(Method.java:507)
03-18 19:26:28.065: E/AndroidRuntime(371):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-18 19:26:28.065: E/AndroidRuntime(371):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-18 19:26:28.065: E/AndroidRuntime(371):  at dalvik.system.NativeStart.main(Native Method)
03-18 19:26:28.065: E/AndroidRuntime(371): Caused by: java.lang.NullPointerException
03-18 19:26:28.065: E/AndroidRuntime(371):  at android.app.Activity.findViewById(Activity.java:1647)
03-18 19:26:28.065: E/AndroidRuntime(371):  at com.UPFIM.casa.Constancias.<init>(Constancias.java:22)

here is the layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/fondo">
<ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <TextView
            android:id="@+id/tituloAbout"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top"
            android:gravity="center"
            android:text="@string/constancias"
            android:textSize="15dp" />

        <TextView android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/vacio"
            android:paddingLeft="10dip"/>

        <TextView android:layout_width="fill_parent" android:layout_height="wrap_content"
            android:text="@string/nom" android:paddingLeft="10dip"/>

        <EditText
            android:id="@+id/name"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="10dip"
            android:inputType="textPersonName"/>

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:paddingLeft="10dip"
            android:text="@string/Nivel" />

        <Spinner
            android:id="@+id/spinner1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            />

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:paddingLeft="10dip"
            android:text="@string/tipo" />

        <Spinner
            android:id="@+id/spinner2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            />

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:paddingLeft="10dip"
            android:text="@string/cant" />

        <Spinner
            android:id="@+id/spinner3"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            />

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:paddingLeft="10dip"
            android:text="@string/foto" />

        <Spinner
            android:id="@+id/spinner4"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            />

        <TextView
            android:id="@+id/btn1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dp"
            android:paddingLeft="10dip"
            android:text="@string/Advertencia" />

        <Button
            android:id="@+id/enviar"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:paddingLeft="10dip"
            android:text="@string/send"
            android:onClick="enviarme" />

    </LinearLayout>
</ScrollView>

`

A: Your problem is this:
EditText nombre = (EditText) findViewById(R.id.name);
EditText matricula = (EditText) findViewById(R.id.edusuario);

You are initialising EditTexts before their instances are added to Activity by
setContentView();

So this always will throw NPE.
Solution: Move these lines behind setContentView() and it will works.
setContentView(R.layout.constancias);
EditText nombre = (EditText) findViewById(R.id.name);
EditText matricula = (EditText) findViewById(R.id.edusuario);

Explanation:
Whenever you want to initialise your widgets with findViewById() at first must be called
setContentView(R.layout.layoutId)

because key purpose of setContentView() method is to create all instances of UI elements contained in layout you define and that will be set as content of Activity. So always if you will call findViewById() before setContentView() it always throws NullPointerException becauses Views are null.

A: To get the view first you need to set layout of activity.
Move these lines inside the onCreate method.
EditText nombre = (EditText) findViewById(R.id.name);
EditText matricula = (EditText) findViewById(R.id.edusuario);

like
 public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.constancias);

    EditText nombre = (EditText) findViewById(R.id.name);
    EditText matricula = (EditText) findViewById(R.id.edusuario);
   .....
 }

EDIT:
You did not even initialize the
EditText mensaje;
EditText subje;

and here you setting the text.
Again here NPE
mensaje.setText("" + nombre.getText().toString() + "\n" + matricula.getText().toString() + nivels + tipos + cant + fot );
subje.setText("Solicitud de Constancia APP");

So initialize these also in onCreate method as I initialized above.

A: You might be working on 2 different project and mistakenly you could have copy google-services.json of one project to another project. It happen to me. Hope it helps
Your debug might have different google-services file where as release might have another.. same for IOS googleinfo.plist


text:
Q: Single Page Wordpress CSS and JS links i got a custom template with blog post in it...
In my header.php, inside the <head> i have my links like this ...
<link href="http://www.mysite.com/css/design.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="http://www.mysite.com/js/myjs.js"></script>

those links are working in my custom template.. by using
<?php get_header(); ?>
All blog post in my custom page are there.. no layout problems.
But when i click one of the post. my layout is broken. and when i checked it via Inspect Element. the link is like this
<link href="http://www.mysite.com/blog/css/design.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="http://www.mysite.com/blog/js/myjs.js"></script>

* EDIT *  from the answers below, above is my original question, anyway my problem is still the same.
I added this to my functions.php  and removed the links on my header.php
also i copied the files inside the wordpress folder called links...
/httpdocs/blog/wp-content/themes/myblog/links
    // Get Links

    function theme_scripts_styles() {

  wp_enqueue_style( 'my-styles', get_stylesheet_directory_uri() . '/links/design.css', array(), '1.0', 'all' );

  wp_enqueue_script( 'my-scripts1', get_stylesheet_directory_uri() . '/links/cufon-yui.js', array(), '1.0', true );

  wp_enqueue_script( 'my-scripts2', get_stylesheet_directory_uri() . '/links/232MKSD_200.font.js', array(), '1.0', true );

  wp_enqueue_script( 'my-scripts3', get_stylesheet_directory_uri() . '/links/232MKSDB_400.font.js', array(), '1.0', true );

  wp_enqueue_script( 'my-scripts4', get_stylesheet_directory_uri() . '/links/fonts.js', array(), '1.0', true );

  wp_enqueue_script( 'my-scripts5', get_stylesheet_directory_uri() . '/links/OpenSans_400.font.js', array(), '1.0', true );

  wp_enqueue_script( 'my-scripts6', get_stylesheet_directory_uri() . '/links/OpenSansSB_600.font.js', array(), '1.0', true );

}

 add_action( 'wp_enqueue_scripts', 'theme_scripts_styles' );

A: My guess is that you are using relative URLs in your header.php file. That would explain the difference in the paths. (It is probably differnt on archive pages too, right?) Don't do that. Relative URLs do not work well in a WordPress context. Generally, you want to use get_permalink(), site_url(), home_url(), etc. to create absolute URLs. For the template files you want get_template_directory_uri() and get_stylesheet_directory_uri().
I am guessing that you are also not registering and enqueueing the stylesheets and scripts.
See:
http://codex.wordpress.org/Function_Reference/wp_register_script
http://codex.wordpress.org/Function_Reference/wp_enqueue_script
http://codex.wordpress.org/Function_Reference/wp_register_style
http://codex.wordpress.org/Function_Reference/wp_enqueue_style

redpajama_set_name: RedPajamaStackExchange


text:
Q: Upgrade to Windows 8 on Ubuntu 12.04 LTS Windows are now selling versions of windows for £25.00. I want to update and get rid of ubuntu. How do I do this? And will it be comptable for ubuntu? I hope so.
Pls help.
(Oh, and I am using an E-System 1201 laptop that is running Ubuntu 12.04 LTS. It also has a brokencount>0' error. I hope that error does not affect the system upgrading.)

A: The MS upgrade is for Windows 7 not for Ubuntu!


text:
Q: Unable to login to main pc(server) in serva pxe boot I can not pass from here it

Unable to login here. It says invalid password of network name not found i tried everything, But I am unable to pass from it

A: Two possibilities:

*

*Invalid Password:
This problem is usually seen when the WIA_WDS_SHARE is not properly created.
You create WIA_WDS_SHARE at Serva's PC; that share must grant minimally reading rights to some Serva's PC "user" identified by its username and password. You cannot use a username with no password here.
Those are the username and password required by ServaPENet.
On very rare occasions the problem could be also triggered by a malfunctioning NIC driver. You have to check this too.

*Network Name not Found:
This sometimes happens on back-to-back situations where the booting client is unable to find the WIA_WDS_SHARE. You can solve this by turning on the WINS service on Serva's PC or you can alternative try just adding the wins DHCP option (44) to Serva.
44|192.168.1.1

where 192.168.1.1 is Serva's IP
For more info you should carefully read this link.

A: For me I had to explictly share the WIA_WDS folder as WIA_WDS_SHARE, that is select that folder specifically. Go to properties - share - change share name - accept. If you can't change the share name you may need to unshare the folder and share it again.

A: The error 0x56 also originates by putting a wrong username. In the folder WIA_WDS_SHARE, you must give the security option, and in this it appears the real name of the user, which must be placed in the client computer with the password of the corresponding user.


text:
Q: Steps to create a chooser dialog using intent.createChooser() in android I want to create an app where I want to pop-up the Chooser dialog for all messenger apps.
I want to know how Intent can be used in such cases. And, where all we need to make changes in order to use intent.
Thank you in advance.


text:
Q: Why does Javascript that is ran in google console only set a selector to the last value either in a loop or just stardard flow I'm attempting to set a value on an input based on a selector, when I try to set the value more than once it only ever sets the last value, I was doing this in a for loop but for simplicity, the results here are the same;
var input = document.querySelector("#challengeInput-36757ce5057c429fae3c0ea0a4e65e16-answer");
input.value = 1;
sleepFor(2000);
input.value = 2;

function sleepFor(sleepDuration) {
    var now = new Date().getTime();
    while (new Date().getTime() < now + sleepDuration) {
        /* Do nothing */
    }
}

Output:

A: Javascript is single threaded, meaning it can't run your code AND update the DOM at the same time. So you will only see the input updated after your code has run to completion.
To push events to a later time, while allowing things to happen in between, such as updating the DOM, you need to push a callback onto the event queue: https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#queue
The simplest way to do that is with setTimeout.

const input = document.querySelector("input");
input.value = 1;
setTimeout(() => input.value = 2, 1000)
setTimeout(() => input.value = 3, 2000)
<input />

If you want the same event to be pushed to the back of the event queue after running, you can use setInterval

const input = document.querySelector("input");
let value = 1;
input.value = value;
setInterval(() => input.value = ++value, 1000)
<input />


text:
Q: How to open an excel sheet using Java? I am trying to make a program through which i want to manipulate data in the excel sheet,
But data is being manipulated only when the excel sheet is open.
whats the process to open and close it using java coding.

A: You can use POI to read and write Excel sheets.
This article is interesting to understand how to use it :
http://onjava.com/pub/a/onjava/2003/04/16/poi_excel.html

A: Hey look, there's a tutorial on how to do this link from the JExecel website!
http://www.andykhan.com/jexcelapi/tutorial.html
Side note: It looks like JExcel is file based only. This means you can't interact with an open spreadsheet. If you need to interact with an open spreadsheet you will have to use JNI or a library such as J-Integra COM, which uses JNI.


text:
Q: QML iterating over custom elements and calling function I have a custom element called MenuButton:
import QtQuick 1.1
import VPlay 1.0

Image {
property alias text: buttontext.text
property alias mouseArea: area
property alias fontBold: buttontext.font.bold
property alias textSize: buttontext.font.pixelSize

id: button
source: "img/cloudButton.png"
opacity: 1

Text {
    id: buttontext
    color: "black"
    anchors.verticalCenter: parent.verticalCenter
    anchors.left: parent.left
    anchors.leftMargin: 50
    font.bold: true
}

MouseArea {
    id: area
    anchors.fill: parent

    onPressed: button.opacity = 0.7
    onReleased: button.opacity = 1.0

    onCanceled: button.opacity = 1.0
}

function doStuff {

    // do something here
}

    width: 200
    height: 60
}

Now, in my main View, I have a Column with 5 of those MenuButtons. And I want to iterate over them and call the function doStuff(). How do I do that?
I tried with column.childAt(i) and stuff like that, nothing worked.
MainView.qml
Rectangle {

width: 480; height: 320
        // HERE IS MY PROBLEM, how do I iterate over all my elements in the column?
        function update() {

              for(var i = 0; i < 5; i++) {
                   column.childAt(i).doStuff(); // THIS IS WHAT I WANT TO DO
              }
        }

        Column {

            id: column
            spacing: 5
            anchors.centerIn: parent

            Repeater {
                id: repeater
                model: 5

                MenuButton {
                    id: levelbutton
                    text: "Level " + (modelData+1);
                    source: "img/cloud4.png"
                }
            }
        }
}

The problem is in my update function in the MainView.qml
I dont know how to iterate over the elements and call the doStuff() function.

A: You may use Component.onCompleted attached signal, like this:
import QtQuick 1.0

Rectangle {
    height: 600
    width: 600

    Repeater {
        model: 5
        Item {
            Component.onCompleted: console.log('Component ' + index + ' completed!')
        }
    }
}

However, please consider, that this imperative operation is not good, because it will be called all time after model update. Probably you have problem X and asking how to get Y, that (you think) will solve your X?

A: From what I've seen in the source code in the QDeclarativePositioners class you cannot access the children elements!
But you could turn the way you call your doStuff() method: when do you want it to be called? After some time has passed (then add a Timer element to your MenuButton), or when a signal occurs? In the latter case, you could use the Connections element and listen to the signal beign emitted in your calling qml file where you use the Column and Repeater.
Cheers, Chris

A: You can access the children of an element via the children property that exists on all QtObjects.  It contains an array of child elements and can be freely acccessed in javascript.
eg. element.children[0].doStuff()
Generally speaking, you should avoid actions that require you to manually iterate over the children.  However, if you are attempting to write code that generically calls something on each of the children you do not always have a choice.


text:
Q: ORA-14450 GTT alter table issue Iam facing a issue while altering the GTT table.
I need to find the active users on that table, Can someone help in query regarding how to find the active users on the specific object in oracle database

A: As far as I can tell, you didn't explain what problem you're trying to solve, but rather what you think that might help you solve it. So, let me try to guess.
Here's a global temporary table (GTT):
SQL> create global temporary table gtt (id number) on commit preserve rows;

Table created.

SQL> insert into gtt values (1);

1 row created.

SQL> commit;

Commit complete.

You're trying to alter it, but - it fails:
SQL> alter table gtt add name varchar2(10);
alter table gtt add name varchar2(10)
*
ERROR at line 1:
ORA-14450: attempt to access a transactional temp table already in use

OK, so - delete row(s) and commit, then try again:
SQL> delete from gtt;

1 row deleted.

SQL> commit;

Commit complete.

SQL> alter table gtt add name varchar2(10);
alter table gtt add name varchar2(10)
*
ERROR at line 1:
ORA-14450: attempt to access a transactional temp table already in use

Still no luck. But, if you truncate the table, then it works:
SQL> truncate table gtt;

Table truncated.

SQL> alter table gtt add name varchar2(10);

Table altered.

SQL>

If that's not what you're after, then see if this answers your question: connect as a privileged user (such as SYS, if you don't have any other) and run such a query: it shows who owns the GTT, its name, who locked it (which Oracle user) and which operating system user is it (that might help you to contact those people):
SQL> select b.owner,
  2         b.object_name,
  3         a.oracle_username,
  4         a.os_user_name
  5    from v$locked_object a, dba_objects b
  6   where a.object_id = b.object_id;

OWNER           OBJECT_NAM ORACLE_USERNAME OS_USER_NAME
--------------- ---------- --------------- ------------------------------
SCOTT           GTT        SCOTT           littlefoot

SQL>


text:
Q: Restricting access to port 6800 I've recently set up my first Ubuntu server and installed scrapy and scrapyd. I've written a few spiders, and I've figured out how to execute the spiders through the API on port 6800. I also noticed there's a web interface there. I've also noticed that pretty much anyone could do the same, especially since the data at the web interface lists all the project and spider names. Is there a way to protect this feature so that only I can manage this?
Thanks,
Chad

A: I figured it out. I couldn't figure out how to get .htaccess to do what I wanted, which was to password-protect a port where a service was listening to requests. I used iptables instead, assuming that the communication to that port was only going to be coming from a few different IPs.


text:
Q: Positioning div in div I am having a problem in placing a div inside a div as required. Please look at the code below.

    <title></title>

testing 100% height and 90% width in red container

Now I want to place the green div, inside red div, by utilizing all of the height of red div. Thus green div should have height equivalent to red div and width as 90% of the width of red div. I think i have done the same, but its not working, in any browser.
To see the problem, copy the code i provided and save it as a HTML file. Then look it in IE.
Please help me.

A: *

*You have no Doctype, so browsers will enter Quirks mode and get lots of things wrong (IE more than others)

*Percentage heights applied to elements which are children of elements with a height of "auto" are treated as having a height of "auto". Since you haven't specified a height for the body element, it has its default value of "auto".

A: Remember to put a DOCTYPE at the beginning or the page will render in quirks mode.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

A: Your red div has to have a height specified, min-height doesn't work in IE.

A: WORKING NOW.................
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <title></title>

testing 100% height and 90% width in red container


text:
Q: iMac 27" 2010 Black screen just after chime I'm having a problem on my iMac 27" Just after the chime it will show the loading bar then after a few seconds it just turns off so there's no way I can get to use the keyboard.Is this possibly a power supply problem? I would appreciate some help.. Thanks
Thundereux


text:
Q: Idea fails to detect imported scala library in java project I am currently working in a Java project, but need functionality from a Scala library. I added the Scala library, called factorie, as an external library.

I also added it as a dependency for the modules that need it.

However, IntelliJ Idea cannot find the library when attempting to import it, and will give a 'cannot resolve symbol'-error highlight and at compilation time.
To solve the problem I have tried adding the Scala SDK as a dependency to these modules, as well as resetting the caches.
Both the Java project and the Scala project are fairly big projects that I edited locally. They both use Maven poms that I have not edited.
So, in a nutshell: how can I ensure that Idea can detect my external Scala library?


text:
Q: How to use Django 2.2 with legacy PostgreSQL 8.4 database? I am developing a new application on Django (DRF + Angular). The current LTS version of Django 2.2. The required data is stored in the PostgreSQL 8.4 database. But Django 2.2 supports PostgreSQL 9.4 and higher. Update PostgreSQL is not possible. What to do in this situation? What are the options?

A: I think what you can do is to:

*

*dump your information in the database to a separate file

*uninstall and upgrade your postgres server

*load the earlier dumped data back to your new database

Since I don't know your operating system so I can't give you clear command-line instructions, but do check out the docs. By the way, since you're changing, why not switch to Django 3 directly? Otherwise you might've to repeat this process again.
Hope this helps

A: Luckily you are on the minimum supported version for this, so you can use pg_upgrade to update your Postgres install (docs)
This way you don't need to dump/restore your database. The process is a little long-winded so I'll refrain from copying it all here in case this becomes out of date.


text:
Q: This case in the CGEL puzzles me In the CGEL(Quirk et al), the case below puzzles me because an adverb phrase or a prepositional phrase rarely serves as subject.

10.15 Adverbial forms as subject:
(1) Slowly is exactly how he speaks.
(2) Will after the snow be soon enough?

It is said in the book that the following two conditions allow this use of adverbials.
(i)the adverbial is a fragment of understood clause(of 15.16), or
(ii) the sentence can be related to one with prop it(of 10.26)
I've read extremely carefully on every detailed term either of 15.16 or of 10.26. Condition (ii) is understandable, whereas Condition (i) is way too difficult to understand.
How can I judge whether the adverbial is a fragment of understood clause?
How does a non-native speaker define the understood clause?


text:
Q: Why does this viewHelper error occur in TYPO3 and how do I fix ilt? When trying to get my custom extension to run in TYPO3 v9.5.11, I get this error message:
Undeclared arguments passed to ViewHelper
TYPO3\CMS\Fluid\ViewHelpers\FlashMessagesViewHelper: renderMode, class, id.
Valid arguments are: queueIdentifier, as

I do not exactly know who is trying to pass arguments to the ViewHelper and why it would be failing.
Would creating my own viewHelper be beneficial in this scenarion or is there an easy way of fixing the issue?

A: in your custom extension, the FlashMessages ViewHelper is used.
You can easily search recursively for <f:flashMessages in the extension folder.
The error message gives you the changes, you need to do:
Valid arguments are: queueIdentifier, as
But in your extension, the arguments renderMode, class and id are used.
You need to remove the invalid arguments, maybe the documentation gives you the needed hints: https://docs.typo3.org/other/typo3/view-helper-reference/9.5/en-us/typo3/fluid/latest/FlashMessages.html


text:
Q: jenkins pipeline additional parameters I have a step in a shared library to set build properties with some common parameters. I'm trying to pass additional parameters to the step such that:
def call(buildParams = []) {
  def commonParams = [
        booleanParam(name: 'release', defaultValue: false, description: 'Release the project'),
  ]
  properties([
        parameters(commonParams + buildParams)
  ])
}

I'm calling this like:
standardProperties(buildParams = [booleanParam(name: 'test', defaultValue: false, description: 'test'))

However I get an NPE:
java.lang.NullPointerException
at org.jenkinsci.plugins.workflow.multibranch.JobPropertyStep$Execution.run(JobPropertyStep.java:127)
at org.jenkinsci.plugins.workflow.multibranch.JobPropertyStep$Execution.run(JobPropertyStep.java:92)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:42)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:229)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:153)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)

A: So the invocation of your standardProperties method doesn't need to specify buildParams =, this is part of the interface. Try:
standardProperties([booleanParam(name: 'test', defaultValue: false, description: 'test')])

For easy reading I recommend
List params = [
    booleanParam(name: 'test', defaultValue: false, description: 'test')
]
standardProperties(params)


text:
Q: rails polymorphic association on 1 model Does rails provide multiple polymorphic association. And allow has_many relation.
class Picture < ActiveRecord::Base
  belongs_to :image, polymorphic: true
  belongs_to :icon, polymorphic: true
end

class Event < ActiveRecord::Base
  has_many :pictures, as: :image
  has_many :pictures, as: :icon
end

Thank you

A: Rails' active record does allow you to define a polymorphic association.
From the docs:
class Picture < ApplicationRecord
  belongs_to :imageable, polymorphic: true
end

class Employee < ApplicationRecord
  has_many :pictures, as: :imageable
end

class Product < ApplicationRecord
  has_many :pictures, as: :imageable
end


text:
Q: Javascript generic search of array of objects I'm trying to come up with a function that allows for a deep generic search of an array of objects, even nested object data like this:
let orders = [
{
  id: 7,
  order_number: 1234
  address: {
    last_name: "Anderson",
    first_name: "John"
  }
},
{
  id: 8,
  order_number: 4321,
  address: {
    last_name: "Franko",
    first_name: "Billy",
  }
}
]

The function needs to be flexible enough to handle any String or Numeric data and search the entire array of objects without needed to know which fields to search for, should search the entire objects fields
So for example something like this would work:
let searchedData = searchData(orders, 'john')

Would return:
[
{
  id: 7,
  order_number: 1234
  address: {
    last_name: "Anderson",
    first_name: "John"
  }
}
]

And
let searchedData = searchData(orders, '4321')

Would return:
[
{
  id: 8,
  order_number: 4321,
  address: {
    last_name: "Franko",
    first_name: "Billy",
  }
}
]

This would need to be able to work to unlimited levels deep, the depth of the objects will not be known.
It also needs to be case insensitive.
I did the following function:
searchData(arr, query) {
  let data = [];

  for(let item of arr) {
    if(item.order_number.includes(query) || item.address.last_name.toLowerCase().includes(query) ||   item.address.first_name.toLowerCase().includes(query)) {
      data.push(item);
    }
  }
}

The problem is this function isn't abstract enough to work with any array of objects.

A: Just modify it a bit:

searchData(arr, query) {
  let data = [];
  let re = new RegExp(query, 'i');

  for (let item of arr) {
    for (let p in item) {
      if (re.test(item[p]))
        data.push(item[p]);
    }
  }
  return data;
}

I use regex so that it's case-insensitive, and return the "data" var at the end (which is important).
This isn't recursive, so it won't handle your nested objects, but you can add that in pretty easily but just testing the type of item[p], running the function and merging what's returned.
However, you won't get the property of what's being searched, and that may be what you're after. For that, you would need to push a new object instead of just the value.
But hopefully this helps some.

A: You can use a simple recursive inner function. You may need to modify the matching condition to suit your needs.

let orders = [ { id: 7, order_number: 1234, address: { last_name: "Anderson", first_name: "John" } }, { id: 8, order_number: 4321, address: { last_name: "Franko", first_name: "Billy", } } ];
function searchData(data, val){
  function find(data){
    if(data===val||data.toString && val.toString && data.toString().toLowerCase().includes(val.toString().toLowerCase()))return true;//you can modify the matching condition
    return data===Object(data) && Object.values(data).some(find);
  }
  return (Array.isArray(data)?data:Object.values(data)).filter(find);
}
console.log(searchData(orders, 'John'));
console.log(searchData(orders, '4321'));

A: You could take a recursive approach by looking to objects and find in the values.

const
    searchData = (data, val) => {
        const
            isObject = o => o && typeof o === 'object',
            find = o => o === val
                || o.toString() === val.toString()
                || isObject(o) && Object.values(o).some(find);

        return data.filter(find);
    };

let orders = [ { id: 7, order_number: 1234, address: { last_name: "Anderson", first_name: "John" } }, { id: 8, order_number: 4321, address: { last_name: "Franko", first_name: "Billy", } } ];

console.log(searchData(orders, 'John'));
console.log(searchData(orders, '4321'));
.as-console-wrapper { max-height: 100% !important; top: 0; }


text:
Q: How can I convince my logistic robots to maintain depots for goods I request for myself? My base has grown quite large and I spend a lot of time keeping the surrounding free of annoying tree-hugging eco-terrorist hippies alien scum.
I covered my whole base with a logistics network and set up my character logistic slots, so my logistic robots will replenish any of my combat consumables (ammunition, capsules, repair packs etc.) as soon as I get near it. Unfortunately my combat supplies are manufactured at one end of my base, so when I am at the other end it can take quite a while until the logistics fleet arrives.
So I placed multiple stashes of combat supplies in passive provider chests all around my perimeter, so my logistics robots can resupply from the nearest one. But now I have to make sure that all these supply depots are full all the time, which requires me to regularly drive around the whole base to refill them. This pretty much defeats the purpose of the logistics network system and I wonder if I can somehow automatize that.
My first idea was to place a requester chest and a passive provider chest next to each other with an inserter taking from the requester chest to the provider chest. The plan was that the requester requests the combat supplies from my combat supply production center which then get transferred to the provider chest which then transfers them to me when required. But this lead to an infinite loop because the requester would request from the provider next to it instead of from the production center.
Is there a way to get my logistics robots to maintain a bunch of depots all around my base while also having them resupply me from said depots?

A: Use Trains
It's a bit bothersome and hard to maintain and expand, but the idea is simple:

*

*Set up a station on your base with a requester chest with whatever supplies you want to move.

*Set up filters on the train with those same supplies

*Build a rail network that reaches all the way where you want

*Place a station and a passive provider on that end of the factory

Of course, you're going to have a similar problem if the requester chest on your base is not filled often enough.  You could just use conveyor belts instead of a chest if you can, to minimize the chances of looping, and keep a constant supply of raw materials.  Alternatively, segment your logistic network so that you don't have that loop.

A: Update
Starting from 0.16 it seems it will be possible to use a new type of buffer chest explicitly for this purpose: https://www.factorio.com/blog/post/fff-203
I have built several variations of the circuit-based approach described below since I wrote this answer to improve the design and work out annoyances (like no items ending up in the storage chest until requests have been satisfied). None of them have worked perfectly yet or became so complex they can't easily be explained so therefore I have not updated this answer yet. With a future (as of this writing) 0.16.x release it seems this problem will go away completely.
The new buffer chests (green) will be a hybrid between requester chests (blue) and passive provider chests (red). I presume the robots will attempt to fill these new chests before putting anything into generic storage chests (yellow), and also grab from them before going to storage or passive providers, given the images and descriptions in that blog post:

By using a buffer chest, you can setup a dedicated 'supply area', where the buffer chest will already contain all the typical items, and the bots can quickly top-up your inventory.
...
Using the buffer chest, it will be easy to setup nearby supplies to
  quickly repair the walls when needed.
- Factorio devs

Circuit network approach
The idea is to prevent an infinite loop by not requesting anything when it's not needed, and not allowing anything to be picked up from your remote depot until it has been filled completely, at which point it makes everything available to the player (or any other requester chests nearby).

*

*Put a requester chest somewhere near where you want things delivered,
do not make it request anything yet. Make sure it's set to "set requests".

*Put a regular non-logistics chest next to it, leaving one space between them. This will be our "buffer" to prevent loops.

*Put an inserter between the chests, rotated so it picks from the requester chest and places into the regular chest.

*Put a storage chest 1 tile away from the regular chest.

*Put an inserter between those chests so it takes from the regular chest and puts it into the storage chest.

*Put a decider combinator somewhere nearby, set it to trigger if combat supply X goes below Y amount. Set the output type to "1 of X".

*Grab a wire (say red) and connect the regular and storage chests together with the inserter which takes from the regular chest, and connect them with the input side of the combinator. The combinator should now show the current total amount of supply X in the depot as its input value, and the output value should be 1 of that type.

*Set the condition on that inserter to only trigger if supply X is equal to the amount Y.

*Connect the output of the combinator to the requester chest.

The depot should now slowly begin to fill the regular "buffer" chest via the requester chest and the first inserter between them. Once the target amount Y has been reached the requests will stop and the other inserter will take over and dump everything into storage. Requests will resume once the total number of X-items in the chests goes below the Y threshold.
Since bots prioritize fetching from storage chests, they will likely grab from there over a passive provider chest further away when you pass by.
If there's stuff left in the storage chest after you're tanked up, they will be moved back to the requester chest by the bots and end up in the buffer chest again, until the're eventually dumped back into the storage chest when the system has reached the threshold.
There are ways to tweak this system for various purposes and uses.
If you want to fill the depot faster; put an arithmetic combinator between the first combinator and the requester chest, and set it to multiply the input amount (1) by some factor (say 10) (make sure to output the same type). The chest will keep requesting 10 items until the system is full (prepare for some overflow as bots always grab/deliver a full cargo hold if they can).
You could use more combinators to always request the exact number of items left until the system is full, but simply multiplying the number of items requested uses fewer components.
If bots often end up re-filling the system from itself by emptying lots of items from the storage chest into the requester, add another decider combinator (using the green network) which triggers if the storage chest contains Z items, where Z is much lower than the total amount above (Y) and set it so the inserter only grabs that amount from the buffer.
It may take slightly longer to restock the player as the storage chest is emptied out more often, but the bots will more likely restock the depot more efficiently as there's not as much "available" from the depot itself.
You could also let the filling of the storage chest be player-controlled by hooking up a state-reading gate pole (or even multiple ones at different locations) to the iserter and only allowing it to operate while you're standing near the gate(s). But if you have to run to a specific location you may as well grab directly from the buffer chest, perhaps conveniently placed near your gates.


text:
Q: Binary tree challenge example I have been watching some lectures from the excellent Richard Buckland and experimenting with binary trees but I don't completely understand how to implement one. Below is how far I have got.
class Tree(object):
    def __init__(self, val, left=None, right=None):
        self.val = val
        self.left = left
        self.right = right

t = Tree(4, Tree(2, Tree(1), Tree(3)), Tree(6, Tree(5), Tree(7)))

Could somebody refer me to a simple example problem which can be solved using a binary tree. I don't really understand what data I will be presented with to create the tree or how I could use it practically. I'm scared to google for some examples because I don't want somebody else's source code. I want to work out the implementation myself.  But before I can do this I feel I need a problem to solve. Ideally, I would like a couple fairly trivial example  problems and then a few more intermediate problems.

A: Your code above is a "valid" implementation of a binary tree... it's already complete. You have nodes (which you call Trees) and each node can have 0, 1, or 2 children. edit Actually I just realized that you can't implement an empty tree using your implementation, but that's a small nitpick.
This is a semantic thing but it's "sort of important". A binary tree by itself isn't really used for problems at all. A standard binary tree is not really useful--it's just a tree where each node has at most two children. This link should clarify what I'm saying (and probably contains a sufficient answer to your question): https://stackoverflow.com/a/2159506.
I think what you're actually interested in is a "balanced binary search tree" which has extra properties. In particular, it's "ordered" from the left to right (that's a vague description, but I don't want to be hand-wavy and say that the "left child is less than the parent and its sibling" when it could actually be equal in some implementations). It also has a O(log(n)) bounded depth (you won't have trees of height n with n objects in it... which is just a linked list).
Anyways, to answer your question: it's sort of boring, but a common suggestion is to implement an abstract data structure such as a heap or dictionary. Note the terminology: a heap can be implemented using a binary search tree. A heap, by definition, is not tied to any implementation. It only requires that certain operations can be performed on it (e.g. peek(), min(), add(), etc). Choosing a primitive data structure like a binary tree is necessary to produce a heap (otherwise it's just this abstract thing floating in your head). Choosing a balanced binary search tree also gives time complexities to those operations (e.g. a heap implemented with a balanced binary search tree has O(log(n)) peek(). See the wiki link for more details: http://en.wikipedia.org/wiki/Heap_(data_structure)#Comparison_of_theoretic_bounds_for_variants).
Once you've written a heap, you can look at any problem whose algorithm uses a heap... there's a lot. Say you want to find the kth largest element in linear time. Heap (proving this is a bit tricky though). What if you want to implement Prim's algorithm? Heap. What if you want to sort arbitrary objects with worst case O(n log(n))? Heapsort (note that usually people don't use heap sort since it's not actually fast).

A: Well, try this: http://www.spoj.com/problems/TREE/
Or this: http://www.spoj.com/problems/THREECOL/
http://www.spoj.com/problems/NWERC11B/
These problems are not trivial, and will ask time, but you will definitely learn from this.
Basically, there is a vast number of problems that essentially need binary trees in some way. For example, building an inference algorithm in propositional logic.
And yes, if you can get a hold of Sedgewick's algorithms, there are chapters about binary search trees, for example, pretty useful.


text:
Q: switching to branch in Eclipse created from atlassian jira I have created a branch from atlassian jira and I can see the branch in the sourcetree, under branches. But when I am going to Eclipse -> Team -> Switch to -> Other -> Remote Tracking  I can't see it anywhere.
When I also go to the command line and type
git branch -a

I don't see it

A: Did you make sure you fetched from remote after having created the new branch in JIRA?
If not, it would explain the remote branch not showing up in your branch -a log.
In that case, just git fetch and your local refs of remote branches will be updated.
(And then you'll be able to git checkout <your_new_branch> to create the local counterpart and set its upstream in one go)


text:
Q: Error trying to separate an array containing managed object context Could anyone please tell me why I am getting this error and why this code isn't working?
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[__NSArrayI componentsSeparatedByString:]: unrecognized
selector sent to instance 0x109494750'

This is the code with problems:
NSArray *array = [self.managedObjectContext executeFetchRequest:request error:nil];
NSString *dateString = [array valueForKey:@"dateString"];
NSArray *datesArray = [dateString componentsSeparatedByString:@","];//line with problems

A: When you call valueForKey: on array the result will be an NSArray containing the result of calling valueForKey: on each of it's elements.
So dateString is not actually a string it's an instance of NSArray, which does not respond to componentsSeparatedByString:. You need to index into the array to get the date you want before  calling componentsSeparatedByString: on that

A: It's an indication that dateString isn't a string. When you call -valueForKey: on an array, it returns an array. Per the docs:

Returns an array containing the results of invoking valueForKey: using key on each of the array's objects.

So you're calling a string method on an array. It's not clear what you're trying to accomplish by calling -valueForKey:. Perhaps you meant -objectAtIndex:?


text:
Q: Finite Axiomatizability In the situation I have an infinite set of closed wfs $\mathfrak{B}=\{\mathfrak{B}_{1}, \mathfrak{B}_{2}, \mathfrak{B}_{3}, ...\}$. It is also the case that no $\mathfrak{B}_{k}$ can be proven with the conjunction of all $\mathfrak{B}_{j}$ where $j < k$.
$T$ is the theory of all sentences that can be proven from $\mathfrak{B}$, and so prove that the theory $T$ is not finitely axiomatizable.
Naively, I understand this to be because there can be no model for every finite subset of $\mathfrak{B}$, so there is no model for $\mathfrak{B}$. In other words, not every theorem  of $\mathfrak{B}$ holds as $\mathfrak{B}_{1},\mathfrak{B}_{2},\mathfrak{B}_{3}, ..., \mathfrak{B}_{j} \vdash \mathfrak{B}_{k}$ does not hold. Is this along the right lines?

A: This is an application of compactness. The single sentence $\mathfrak A$ axiomatizing $T$ must be a logical consequence of $\{\mathfrak B_1,\mathfrak B_2,\ldots\}$ and thus of finitely many $\mathfrak B_1,\ldots,\mathfrak B_n$. But it also must imply $\mathfrak B_{n+1},$ since that is a consequence of $\{\mathfrak B_1,\mathfrak B_2,\ldots\}.$ So then $\mathfrak B_{n+1}$ is a logical consequence of $\{\mathfrak B_1,\ldots,\mathfrak B_n\},$ contrary to assumption.


text:
Q: Smartphone turns off my monitor when placed on a specific position? I am not sure what the hell is going on, neither I know where to ask.
For me it looks like phenomenon, but it often ends up being completely explanatory.

I've discovered that if I place my SAMSUNG Galaxy S4 mini smartphone somewhere in the right of the DELL Inspiron (n series) touchpad, it turns off the monitor. I made sure the mobile devise has nothing turned on (such as wifi, bluetooth etc)

DETAILS:
It turns off the laptop's monitor when it keeps vertical proximity to the hotspot(s) not larger than an inch.

Who has any idea what this is about ?

A: The Inspirons have a magnetic catch for when you close the laptop lid.
They use the magnetic sensor to work out when the lid is closed so the screen no longer needs to be on.
Your phone is triggering the sensor.


text:
Q: Error when executing SSIS package through SQL Server Agent job I need to find a way to create a backup of a table's schema. I've been trying to do so using a Transfer SQL Server Object, but I don't see how you can specify the specific source and destination table to copy the schema to/from when using this type of control flow item in a package. Once I can figure this out, I will be scheduling this to run automatically. I would appreciate any assistance with this. Thanks!
Update
Thanks, all. I have the following problem - I have the Transfer SQL Server Objects control flow item working when executing from Visual Studio, and it is copying the table structure from one server/database to another server. I have created this as an SSIS package and imported it onto the original server (the one having the table structure copied), however, when trying to run the package job, I keep getting the error saying, "Failed to connect to server...there were errors during task validation...package execution returned DTSER_FAILURE (1)...the step failed." Does anyone have any idea of why it would run fine in Visual Studio, but not as a job?

A: Bit late, but maybe this answer will help someone else. There are (at least) two things that can cause an execution difference between you executing the package in BIDS and SQL Server running the package through a job.
1) The package protection level in BIDS package project
The ProtectionLevel property of your package is set to one of the following values:

*

*DontSaveSensitive

*EncryptSensitiveWithUserKey

*EncryptSensitiveWithPassword

*EncryptAllWithPassword

*EncryptAllWithUserKey

*ServerStorage

The default value is for some insane reason EncryptSensitiveWithUserKey. This means that sensitive information in the package is encrypted based on the credentials of the user who created the package. This also means that if another user (someone who did not create and save the package) opens or runs the package you get an error - that is, if there is any sensitive information in the package.
So you want to change this default value to something more sensible like DontSaveSensitive (our standard value) or EncryptSensitiveWithPassword.
2) The executing account in SQL Server Agent job
The standard value for the Run as field in the Job Step window is the SQL Server Agent Service Account. This account is configured when SQL Server is installed and permissions depend on the account that was chosen.

So it could be the case that this account does not have permission to do something that is defined in your package. Connect to another database server, for example.
You can choose another account to run the package, by setting up a proxy. More information on this can be found elsewhere on StackOverflow, see here for example.


text:
Q: iOS : Colorize only the black part of an image quick question : I usually colorize my images, but they are only black and white image masks. I now have an image with a transparent background, a black part and other parts that are already colorized.
Is there a way to programmatically colorize only the black part of the image? I tried several kCGBlendMode, but none worked. I wonder if I have a to create a new image, use it as a mask for the colorized parts and then programmatically colorize the rest of the image.
Do you have any idea how to achieve this simply? Thanks.

A: take a look this solution: there is not bad example how to make a mask any shape with a black and white image
https://github.com/NickTitle/iOS7-Trans-Blur/blob/master/README.md


text:
Q: $f(x) = c \sin x$, sample mean$=\overline{X}_n$; for large $n$ find $\mathbb{P}(\overline{X}_n<1)$
$X$ has a pdf $f(x) = c \sin x$ on $[0, \pi]$. Assuming $n$ is large, find the probability that the sample mean, $\overline{X}_n$ is less than $1$.

I found the mean $\pi/2$ and am trying to find $Z$ but I am not sure if I need use normal distribution.
My solution :
$$Z=\frac{\overline{X}_n-\mu}{(\sigma/\sqrt{n})}=\frac{1-\frac{\pi}{2}}{(\sqrt{\pi^2-8})/2}=\frac{1-\pi}{\sqrt{\pi^2-8}}\approx-1.566$$
Next,
$$\mathbb{P}(\overline{X}_n<1)\approx\mathbb{P}(Z\le-1.566)\approx0.0594$$


text:
Q: Time delay between consecutive photon absorptions by atoms/molecules? We are just getting introduced to some basics of quantum physics at school and in my nationally prescribed school book, its written that:

Planck assumed that radiation could be subdivided into discrete chunks of energy. He suggested that atoms and molecules could emit or absorb energy only in discrete quantities and not in a continuous manner.

This made me visualize photons(as an example of quantum) as energy carrying particles, which can be absorbed by atoms or molecules one at a time.
But, does this mean there is a delay in time between absorption of one photon and the next one? I think there is as my book clearly says discrete chunks of energy. Also, if the answer is yes, how long is it, or what does it depend on?
But again, we have learnt that light is a wave, and a wave is continuous(If I am not wrong), so when considering quantum physics, do we ditch the electromagnetic wave properties of light or something?
Sorry if this question sounds naive, I just got introduced to these new concepts after years of classical mechanics.

A:
This made me visualize photons(as an example of quantum) as energy carrying particles, which can be absorbed by atoms or molecules one at a time.

In the Standard Model of particle physics photons are zero mass particles on an equal axiomatic level as electrons, for example.In mainstream physics the SM is the basic frame of particles and from these all other physics theories  emerge (except  gravity and general relativity,it is still not included in the quantum theories with strict mathematics)

But, does this mean there is a delay in time between absorption of one photon and the next one? I think there is as my book clearly says discrete chunks of energy. Also, if the answer is yes, how long is it, or what does it depend on?

Matter is composed out of zillions of particles. Avogadro's number gives $6.02214076×10^{23}$ elementary entities per mole of matter.
There are several ways photons can be absorbed in matter, 1) individual photons interacting with atoms and changing the energy level of the electrons 2)individual photons interacting with molecules and changing the quantum configuration energy levels3) with a lattice consisting of zillion of atoms again changing the energy levels.4) They can scatter with the above and lose energy. (The end result is that the impinging photons disappear into raising the heat of the sample under study but this does not involve the question )
Individual photons are absorbed by individual atoms/molecules/lattice  in the particular mass one is studying.

But again, we have learnt that light is a wave, and a wave is continuous(If I am not wrong), so when considering quantum physics, do we ditch the electromagnetic wave properties of light or something?

In physics we do not ditch any theory that is working in its own area of validity. Maxwell's equations describe light, electromagnetic waves, very well for dimensions where quantum effects are very small. The build up of classical waves by photons is a complicated mathematically form that one can understand when studying physics further, as it needs quantum field theory.


text:
Q: Laravel docs do a contract vs facade but fail to explain what it is really about from the official docs
https://laravel.com/docs/5.4/facades
this seems easy to test (the cache class)
public function testBasicExample()
{
    Cache::shouldReceive('get')
         ->with('key')
         ->andReturn('value');

    $this->visit('/cache')
         ->see('value');
}

as well in the documentation of facades it is written:

When building a third-party package that interacts with Laravel, it's
  better to inject Laravel contracts instead of using facades. Since
  packages are built outside of Laravel itself, you will not have access
  to Laravel's facade testing helpers.

I really don't see how this is true. The package very well will access functions of laravel, so I don't see how it should not work with testing?
now in contracts https://laravel.com/docs/5.4/contracts they go on a little philosophical discussion what to use, facades or contracts. Isn't it better to use them together? Because contracts are nothing else than an interface. Now the idea of an interface is not new at all. I don't really get, what is the point about first of all comparing facades and contracts when:
facades are basically a extended class of laravel adding testing possibilities. They hide the implementation though and make it harder to read what functions are available on the class. E.g. you always first have to figure out what implementation is used of the facade, to see what methods there are.
contracts on the other hand are nothing else than interfaces. Basically the laravel people telling us "use interfaces". I agree, interfaces are great. But I don't see in what way this relates to facades. They are not related. They are not interchangeable neither.
So what is this all about?
why say "use contracts OR facades" they are not related, and should be used together imho.
An example is the Mail facade:
/**
 * @see \Illuminate\Mail\Mailer
 */
class Mail extends Facade{...

so accessing Mail:: will return an instance of \Illuminate\Mail\Mailer
lets look at \Illuminate\Mail\Mailer
class Mailer implements MailerContract, MailQueueContract
{

nothing else than a class implementing a contract aka interface.
What exactly are they trying to tell us?

A:
third-party package

is key term here to consider. Not every package is used with Laravel only.

The package very well will access functions of laravel

Is that true if I use CodeIgniter? Nope.
Now if you build a package specifically for Laravel, then by all means, use facades all day.
The whole point of this is to not couple yourself tightly with a single framework.


text:
Q: How to pass from Eclipse 32 bits to 64 bits? I am using a 32 bits Eclipse and I want to migrate to a 64 bits versions of it with ALL my configuration and plugins, so that my migration would be invisible.
All my attempts so far have shown some problems : plugins not working, but that are shown as installed, lost of workspace configuration...
I try to migrate from Eclipse Oxygen (2018-03) 32bits to Eclipse Oxygen (2018-03) 64bits.
I tried to duplicate my current "eclipse" folder and my "workspace" folder, then to unzip the 64bits Eclipse into the duplicate of my Eclipse, but it doesn't work, as some of my plugins are gone...
Somebody has done it before ? I can't find any help on the web.


text:
Q: How to change the font of a Picker? I want to set the font to title2 for the items in the Picker (e.g..font(Font.title2.weight(.heavy))) so it's of a size and type.
Unfortunately, it doesn't read any font mentions and still displays super small font.
Here's my code (I got rid of any of my failed experiments):
struct PlayView: View {
    @State private var selectedLevel = "3"
    let levels = ["1", "2", "3", "4", "5"]
    @State private var selectedLife = "3"
    let lives = ["1", "2", "3", "4", "5"]
    @State private var selectedLetterMethod = "Sound"
    let letters = ["Sound", "Written"]
    @State private var showWelcomeView = false

    var body: some View {
        ZStack {
        VStack() {
            HStack{
                Text("N:")
                    .font(Font.title2.weight(.heavy))
                Picker("Level (n)", selection: $selectedLevel)
                {
                    ForEach(levels, id: \.self) {
                        Text($0)
                            .font(.title2)
                    }
                }
            }
            HStack{
                Text("Lives:")
                    .font(Font.title2.weight(.heavy))
                Picker("Lives", selection: $selectedLife) {
                    ForEach(lives, id: \.self) {
                        Text($0)
                    }

                }
            }
            HStack{
                Text("Letters:")
                    .font(Font.title2.weight(.heavy))
                Picker("Letter display", selection: $selectedLetterMethod) {
                    ForEach(letters, id: \.self) {
                        Text($0)
                    }
                }
            }

A: If you set your pickerStyle to .wheel it will reflect all the font changes that you set.
As per your code as there is no pickerStyle the default is set to .menu and no font styling will be applied when its .menu.
Attaching a few references to support the explanation

*

*When PickerStyle set to .wheel

If you notice I have 2 picker items with different font styles and both are applied properly when .pickerStyle is set to .wheel
The first picker item as blue with a smaller font and the second item has red color with a bigger font.

*

*When PickerStyle is set to .menu
if the pickerStyle is set to .menu it shows up like below even with the same font styling

Inorder to apply any font styling you should set your Picker's pickerStyle value to .wheel
Your output would be something like this


text:
Q: How to display items of dictionary on different labels in asp.net I am new to asp.net coding and trying to get the keys and values of dictionary to be displayed on different labels using loop.
I have 10 labels with id Label1,Label2,...., Label10.
How do i display the keys and values on different label using loops ?
Dictionary<string, int> numbers_of_items = new Dictionary<string, int>();
        numbers_of_items.Add("Kettle",30);
        numbers_of_items.Add("juicer", 40);
        numbers_of_items.Add("toaster", 50);
        numbers_of_items.Add("microwave", 60);
        numbers_of_items.Add("dishwaher", 70);

        for (int i =0; 1<numbers_of_items.Count;i++)
        {
            // I am stuck here. Dont know how to set each key and value to
            //different labels
        }

A: Something like this:
Code behind:
foreach (KeyValuePair<string, int> entry in myDictionary)
{
    Label newLabel = new Label();
    newLabel.Text = entry.Value;
    PlaceHolder1.Controls.Add(newLabel);
}

HTML:
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>


text:
Q: How To debug and fix a PPTP VPN client connection I have just installed Ubuntu 13.10 and I'm trying to set up a VPN client. I have configured it with the same settings I use on a Mac and I am able to connect from that without any problem.
When I click on the VPN connections I see two messages pop up, one after the other.
1) VPN connection has been successfully established
2) The VPN connection failed.
I've searched around for a solution without any luck. I'm not experienced in these matters at all. I've provided the log in the hope that it helps.
NetworkManager[2650]: <info> Starting VPN service 'pptp'...
NetworkManager[2650]: <info> VPN service 'pptp' started (org.freedesktop.NetworkManager.pptp), PID 3052
NetworkManager[2650]: <info> VPN service 'pptp' appeared; activating connections
NetworkManager[2650]: <info> VPN plugin state changed: init (1)
NetworkManager[2650]: <info> VPN plugin state changed: starting (3)
NetworkManager[2650]: <info> VPN connection 'Bioxydyn' (Connect) reply received.
pppd[3056]: Plugin /usr/lib/pppd/2.4.5/nm-pptp-pppd-plugin.so loaded.
pppd[3056]: pppd 2.4.5 started by root, uid 0
pppd[3056]: Using interface ppp0
pppd[3056]: Connect: ppp0 <--> /dev/pts/1
NetworkManager[2650]:    SCPlugin-Ifupdown: devices added (path: /sys/devices/virtual/net/ppp0, iface: ppp0)
NetworkManager[2650]:    SCPlugin-Ifupdown: device added (path: /sys/devices/virtual/net/ppp0, iface: ppp0): no ifupdown configuration found.
NetworkManager[2650]: <warn> /sys/devices/virtual/net/ppp0: couldn't determine device driver; ignoring...
pptp[3060]: nm-pptp-service-3052 log[main:pptp.c:314]: The synchronous pptp option is NOT activated
whoopsie[996]: online
pptp[3074]: nm-pptp-service-3052 log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 1 'Start-Control-Connection-Request'
pptp[3074]: nm-pptp-service-3052 log[ctrlp_disp:pptp_ctrl.c:739]: Received Start Control Connection Reply
pptp[3074]: nm-pptp-service-3052 log[ctrlp_disp:pptp_ctrl.c:773]: Client connection established.
whoopsie[996]: online
pptp[3074]: nm-pptp-service-3052 log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 7 'Outgoing-Call-Request'
pptp[3074]: nm-pptp-service-3052 log[ctrlp_disp:pptp_ctrl.c:858]: Received Outgoing Call Reply.
pptp[3074]: nm-pptp-service-3052 log[ctrlp_disp:pptp_ctrl.c:897]: Outgoing call established (call ID 0, peer's call ID 10009).
whoopsie[996]: online
pppd[3056]: CHAP authentication succeeded
pppd[3056]: LCP terminated by peer
pptp[3074]: nm-pptp-service-3052 log[ctrlp_disp:pptp_ctrl.c:929]: Call disconnect notification received (call id 10009)
whoopsie[996]: online
whoopsie[996]: online
pppd[3056]: Connection terminated.
avahi-daemon[630]: Withdrawing workstation service for ppp0.
NetworkManager[2650]: <warn> VPN plugin failed: 1
NetworkManager[2650]:    SCPlugin-Ifupdown: devices removed (path: /sys/devices/virtual/net/ppp0, iface: ppp0)
pppd[3056]: Modem hangup
pptp[3060]: nm-pptp-service-3052 warn[decaps_hdlc:pptp_gre.c:204]: short read (-1): Input/output error
pptp[3060]: nm-pptp-service-3052 warn[decaps_hdlc:pptp_gre.c:216]: pppd may have shutdown, see pppd log
NetworkManager[2650]: <warn> VPN plugin failed: 1
pppd[3056]: Exit.
pptp[3074]: nm-pptp-service-3052 log[callmgr_main:pptp_callmgr.c:234]: Closing connection (unhandled)
pptp[3074]: nm-pptp-service-3052 log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 12 'Call-Clear-Request'
pptp[3074]: nm-pptp-service-3052 log[call_callback:pptp_callmgr.c:79]: Closing connection (call state)
NetworkManager[2650]: <warn> VPN plugin failed: 1
NetworkManager[2650]: <info> VPN plugin state changed: stopped (6)
NetworkManager[2650]: <info> VPN plugin state change reason: 0
NetworkManager[2650]: <info> Policy set 'virginmedia2204860' (wlan0) as default for IPv4 routing and DNS.
NetworkManager[2650]: <warn> error disconnecting VPN: Could not process the request because no VPN connection was active.
NetworkManager[2650]: <info> VPN service 'pptp' disappeared

A: I see that you connect to vpn server with chap auth, and after that
pppd[3056]: LCP terminated by peer
Try to switch off MPPE encryption.


text:
Q: Why do I keep getting a "Cannot find '...' in scope" error? I am trying to make a second view on an app which is like a leaderboard. When the game has completed 10 rounds on ContentView, I want the calculated score to be stored and printed on the ScoreboardView (accessed by a button). I used @Binding to connect the score variable from one view to the other, but keep getting the "out of scope" error. Does anyone know why this is? Here is my code for the ScoreboardView:
'''
import SwiftUI

struct scoreboardView: View {
    @Binding var score: Int
    var body: some View {
            List {
                ForEach(1..<9) {
                    Text("Game \($0): \(score) ")
                }
            }
        }

}

struct scoreboardView_Previews: PreviewProvider {
    static var previews: some View {
        scoreboardView(score: $scoreTracker)
        }
}

'''
This is not my final code, therefore ignore the middle. However, I get the error in the last line of the initializing of the preview.

A: You don't have anything defined called scoreTracker in your code, but you're trying to use it in your preview. Instead, you can pass a constant in place of your binding (just for preview purposes):
struct scoreboardView: View {
    @Binding var score: Int
    var body: some View {
        List {
            ForEach(1..<9) {
                Text("Game \($0): \(score) ")
            }
        }
    }
}

struct scoreboardView_Previews: PreviewProvider {
    static var previews: some View {
        scoreboardView(score: .constant(50))
    }
}


text:
Q: Neo4j query for shortest path stuck (Do not work) if I have 2way relationship in graph nodes and nodes are interrelated I made relation graph two relationship, like if A knows B then B knows A, Every node has unique Id and Name along with other properties.. So my graph looks like

if I trigger a simple query
MATCH (p1:SearchableNode {name: "Ishaan"}), (p2:SearchableNode {name: "Garima"}),path = (p1)-[:NAVIGATE_TO*]-(p2) RETURN path
 it did not give any response and consumes 100% CPU and RAM of the machine.

UPDATED
As I read though posts and from comments on this post I simplified the model and relationship. Now it ends up to
Each relationship has different weights, to simplify consider horizontal connections weight 1, vertical weights 1 and diagonal relations have weights 1.5
In my database there are more than 85000 nodes and 0.3 Million relationships
Query with shortest path is not ends up to some result. It stuck in the processing and CPU goes to 100%

A: Let's consider what your query is doing:
MATCH (p1:SearchableNode {name: "Ishaan"}),
      (p2:SearchableNode {name: "Garima"}),
      path = (p1)-[:NAVIGATE_TO*]-(p2)
RETURN path

If you run this query in the console with EXPLAIN in front of it, the DB will give you its plan for how it will answer.   When I did this, the query compiler warned me:

If a part of a query contains multiple disconnected patterns, this
  will build a cartesian product between all those parts. This may
  produce a large amount of data and slow down query processing. While
  occasionally intended, it may often be possible to reformulate the
  query that avoids the use of this cross product, perhaps by adding a
  relationship between the different parts or by using OPTIONAL MATCH

You have two issues going on with your query - first, you're assigning p1 and p2 independent of one another, possibly creating this cartesian product.  The second issue is that because all of your links in your graph go both ways and you're asking for an undirected connection you're making the DB work twice as hard, because it could actually traverse what you're asking for either way.  To make matters worse, because all of the links go both ways, you have many cycles in your graph, so as cypher explores the paths that it can take, many paths it will try will loop back around to where it started.  This means that the query engine will spend a lot of time chasing its own tail.
You can probably immediately improve the query by doing this:
MATCH p=shortestPath((p1:SearchableNode {name:"Ishaan"})-[:NAVIGATE_TO*]->(p2:SearchableNode {name:"Garima"}))
RETURN p;

Two modifications here - p1 and p2 are bound to each other immediately, you don't separately match them.  Second, notice the [:NAVIGATE_TO*]-> part, with that last arrow ->; we're matching the relationship ONE WAY ONLY.  Since you have so many reflexive links in your graph, either way would work fine, but either way you choose you cut the work the DB has to do in half.  :)
This may still perform not so great, because traversing that graph is still going to have a lot of cycles, which will send the DB chasing its tail trying to find the best path.  In your modeling choice here, you usually shouldn't have relationships going both ways unless you need separate properties on each relationship.   A relationship can be traversed in both directions, so it doesn't make sense to have two (one in each direction) unless the information that relationship is capturing is semantically different.
Often you'll find with query performance that you can do better by reformulating the query and thinking about it, but there's major interplay between graph modeling and overall performance.  With the graph set up with so many bi-directional links, there will only be so much you can do to optimize path-finding.

A: im afraid you wont be able to do much here. your graph is very specific, having a relation only to closest nodes. thats too bad cause neo4j is ok to play around the starting point +- few relations away, not over whole graph with each query
it means, once, you are 2 nodes away, the computational complexity raises up to:
8 relationships per node
distance 2
8 + 8^2

in general, the top complexity for a distance n is
O(8 + 8^n) //in case all affected nodes have 8 connections

you say, you got like ~80 000 of nodes.this means (correct me if im wrong), the longest distance of ~280 (from √80000). lets suppose your nodes
(p1:SearchableNode {name: "Ishaan"}),
(p2:SearchableNode {name: "Garima"}),

to be only 140 hopes away. this will create a complexity of 8^140 = 10e126, im not sure if any computer in the world can handle this.
sure, not all nodes have 8 connections, only those "in the middle", in our example graph it will have ~500 000 relationships. you got like ~300 000, which is maybe 2 times less so lets supose the overal complexity for an average distance of 70 (out of 140 - a very relaxed bottom estimation) for nodes having 4 relationships in average (down from 8, 80 000 *4 = 320 000) to be
O(4 + 4^70) = ~10e42

one 1GHz CPU should be able to calculate this by:
-1000 000 per second
10e42 == 10e36 * 1 000 000 -> 10e36 seconds

lets supose we got a cluster of 100 10Ghz cpu serves, 1000 GHz in total.
thats still 10e33 * 1 000 000 000 -> 10e33seconds
i would suggest to just keep away from AllshortestPaths, and look only for the first path available. using gremlin instead of cypher it is possible to implement own algorithms with some heuristics so actually you can cut down the time to maybe seconds or less.
exmaple: using one direction only = down to 10e16 seconds.
an example heuristic: check the id of the node, the higher the difference (subtraction value) between node2.id - node1.id, the higher the actual distance (considering the node creation order - nodes with similar ids to be close together). in that case you can either skip the query or just jump few relations away with something like MATCH n1-[:RELATED..5]->q-[:RELATED..*]->n2 (i forgot the syntax of defining exact relation count) which will (should) actually jump (instantly skip to) 5 distances away nodes which are closer to the n2 node = complexity down from 4^70 to 4^65. so if you can exactly calculate the distance from the nodes id, you can even match ... [:RELATED..65] ... which will cut the complexity to 4^5 and thats just matter of miliseconds for cpu.
its possible im completely wrong here. it has been already some time im our of school and would be nice to ask a mathematician (graph theory) to confirm this.

A: MATCH (p1:SearchableNode {name: "Ishaan"}), (p2:SearchableNode {name: "Garima"}),path = (p1)-[:NAVIGATE_TO*]->(p2) RETURN path

Or:
MATCH (p1:SearchableNode {name: "Ishaan"}), (p2:SearchableNode {name: "Garima"}), (p1)-[path:NAVIGATE_TO*]->(p2) RETURN path


text:
Q: xpath with dom document I'm trying the find a xml node with xpath query. but i cannot make it working. In firefox result is always "undefined" and chrome throws a error code.
<script type="text/javascript">

var xmlString = '<form><name>test</name></form>';
var doc = new DOMParser().parseFromString(xmlString,'text/xml');

var result = doc.evaluate('/form/name', doc,
                          null, XPathResult.ANY_TYPE, null);

alert(result.stringValue);

</script>

what's wrong with this code ?

A: XPathResult.ANY_TYPE would return a node set for xpath expression /form/name, so result.stringValue would have trouble converting node set to string. In this case you could use result.iterateNext().textContent
However, an expression like count(/form/name) would return a number value when used with XPathResult.ANY_TYPE and you could use result.numberValue to retrieve the number in that case.
Some more detailed explanation at https://developer.mozilla.org/en/DOM/document.evaluate#Result_types

A: I don't know why did you get this error, but you can change XPathResult.ANY_TYPE to XPathResult.STRING_TYPE and will works (tested in firefox 3.6).
See:
var xmlString = '<form><name>test</name></form>';
var doc = new DOMParser().parseFromString(xmlString,'text/xml');
var result = doc.evaluate('/form/name', doc, null, XPathResult.STRING_TYPE, null);
alert(result.stringValue); // returns 'test'

See in jsfiddle.

DETAILS:
The 4th parameter of method evaluate is a integer where you specify what kind of result do you need (reference). There are many types, as integer, string and any type. This method returns a XPathResult, that has many properties.
You must match the property (numberValue, stringValue) with the property used in evaluate.
I just don't understand why any type didn't work with string value.


text:
Q: Modifying web api 2 odata get query result I have an Odata controller get method like bellow:
 public class ProductController : ApiController
{
    [MyEnableQuery(PageSize = 48, AllowedQueryOptions = AllowedQueryOptions.OrderBy | AllowedQueryOptions.Top | AllowedQueryOptions.Skip | AllowedQueryOptions.InlineCount | AllowedQueryOptions.Filter, AllowedFunctions = AllowedFunctions.SubstringOf | AllowedFunctions.ToLower)]

    public IQueryable<tbDefine_Products> GetProducts([FromODataUri] int CategoryID)
    {
        ProductHandler _handler = new ProductHandler();
        IQueryable<tbDefine_Products> _list =_handler.GetProductActiveList(CategoryID);
        return _list;
    }
}

Now i wants to modify my query result before sending it to clinet... i want to something like _list.Tolist() and then iterating through the result array
       List<tbDefine_Products> _list2 = _list.ToList<tbDefine_Products>();
       for (int i = 0; i < _list2.Count; i++)
       {
        / *some code here to modify result */
       }

I have read a little about ActionFilterAttribute and  ActionFilterAttribute.OnActionExecuted and
    HttpActionExecutedContext Classes but i dont know how implement my ideas

A: Seems that you have already have a implementation about EnableQuery Attribute : MyEnableQuery, you should override the method:
public virtual IQueryable ApplyQuery(IQueryable queryable, ODataQueryOptions queryOptions)

get the query result first and then filter the result:
var result = base.ApplyQuery(queryable, queryOptions);
// filter the result.
return result;


text:
Q: asp.net popup div with buttons no firing VB code behind, just javascript I have the following code in ASP.net / VB.
When a button is pressed on the page, the div_yes_no (see code below) popsup as a YesNO message. The popup shows two buttons (YES and NO)

            Are you sure you want to transfer this data (Y/N) ?

            <asp:Button ID="btnYES" runat="server" Text="Yes" OnClientClick="ShowCoverNONE(''); Hide2();" OnClick="btnYES_Click"  CssClass="STD_button" />
            <asp:Button ID="btnNO" runat="server" Text="No" OnClientClick="ShowCoverNONE(''); Hide2();" CssClass="STD_button" />

This is the code in VB which should run when btnYES is clicked:
    Protected Sub btnYES_Click(sender As Object, e As EventArgs)
        MsgBox("hello")
        .... actual code
   End Sub

The problem is that the btnYES_Click code is not firing, just the javascript fires: OnClientClick="ShowCoverNONE(''); Hide2();"
Any ideas what's missing and or how to do this a better way?

A: You can't use the MsgBox("hello") in ASP.NET as you use it in windows forms application. Can you try by removing it?

A: ASP.Net with VB.NET as Code-behind usualy does not use the OnClick attribute on Buttons. Instead you need to add the Handles-clause with the button's name in your VB.Net Code-behind code. Like this:
Protected Sub btnYES_Click(sender As Object, e As EventArgs) Handles btnYES.Click
        MsgBox("hello")
        .... actual code
End Sub

Please also look at this page: How to use OnClick and OnClientClick events to Prevent Double Clicking on your ASP.Net Buttons.

A: Ok, I finally found the answer to this problem. For others in case they encounter the same, the problem was that the code
asp:Button ID="btnYES" runat="server" Text="Yes" OnClientClick="ShowCoverNONE(''); Hide2();" OnClick="btnYES_Click"  CssClass="STD_button" />

was NOT within the Ajax ContentTemplate/updatepanel:
</ContentTemplate>
</asp:UpdatePanel>

Once I put it there, it all worked as normal.


text:
Q: Is it possible to bundle/ship PHP+MySQL in standalone executable? I am trying to create an application that has a sender and receiver. The entire application is only meant to be used on a LAN and can also possibly be done almost completely through the browser.
The "sender" part is an application of some sort that will need to run a local server on the person's computer and allow for php,html,css,js, and mysql to run.
On the "receiver" end, it is simply a person's browser accessing a webpage being served up from the "sender" application.
I have been looking into nodejs as a means of accomplishing the server part of this...but I am not sure if I can ship it as an exe with mysql and php installed and allow it to be execd from php. I am aware of being able to install these extensions using npm, but I want to ship a whole exe to the end user and not have them install node on their own.
Is this possible? If so, how? Thanks in advance.

A: You may want to look into XAMPP. It appears to be a portable(-ish) installation of Apache, PHP, MySQL, and a few other things (e.g., Perl). You way want to see if you can strip out the irrelevant parts and put your application code into it somehow.

A: I believe there is a sure way to this.
I came across server2go some few months ago and it does the work perfectly.
Just download server2go from here http://www.server2go-web.de/download/download.html
Run the application and a folder will be created to the location specified with all the needed files in it.
Just copy your php, html, css etc files to the www folder
Import your mysql database if you are using mysql
When all is set, zip the folder and then use
zipInstaller, you can get it here http://www.nirsoft.net/utils/zipinst.html
ZipInstaller creates an exe application.
Thanks


text:
Q: Jboss GC not freeing up memory We have an an enterprise application deployed in wildfly 8.2 with min & max heap set to 1.5 GB. One of the actions is causing too much objects to be loaded into the heap. Although the object is dereferenced after the action, the jvm heap usage is not coming down.
But, if I manually trigger GC externally(using jcmd), I am seeing a huge dip in the heap usage. Why is normal GC not reducing the memory as much as GC.run?
JVM settings

-Xms1536m -Xmx1536m -XX:MaxMetaspaceSize=512m -XX:ReservedCodeCacheSize=128M -server -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Djsse.enableSNIExtension=false -Dsun.rmi.dgc.client.gcInterval=600000 -Dsun.rmi.dgc.server.gcInterval=600000

A: What you trigger from the outside is Major/Full GC, which is not triggered automatically unless absolutely necessary. The JVM tries to make a living with garbage in the Old Generation for as long as it can, in order to avoid the infamous GC pause.


text:
Q: Out of operation records in local data manager (increase MaxNoOfLocalOperations) from NDBCLUSTER MaxNoOfConcurrentOperations=150000
MaxNoOfConcurrentTransactions=150000
MaxNoOfLocalOperations=150000

I have above parameters in config.ini, when i try to delete rows in a table i get below error
mysql> delete from radacct where acctinputoctets=0 and acctoutputoctets=0;
ERROR 1297 (HY000): Got temporary error 1217 'Out of operation records in local data manager (increase MaxNoOfLocalOperations)' from NDBCLUSTER.

mysql> explain delete from radacct where acctinputoctets=0 and acctoutputoctets=0;
+----+-------------+---------+------+---------------+------+---------+------+---------+-------------+
| id | select_type | table   | type | possible_keys | key  | key_len | ref  | rows    | Extra       |
+----+-------------+---------+------+---------------+------+---------+------+---------+-------------+
|  1 | SIMPLE      | radacct | ALL  | NULL          | NULL | NULL    | NULL | 1209607 | Using where |
+----+-------------+---------+------+---------------+------+---------+------+---------+-------------+

How to determine the optimum value for maxnooflocaloperations ?

A: *

*vi config.ini, /var/lib/mysql-cluster/XX/config.ini or /var/lib/mysql-cluster/config.ini
※XX : id of ndb_mgmd(MGM) node

*add MaxNoOfConcurrentOperations=2000000

*restart ndb cluster

A: These parameters values should be like this:
MaxNoOfLocalOperations>MaxNoOfConcurrentOperations>MaxNoOfConcurrentTransactions


text:
Q: Angular trying to append object data but it's always replacing I am trying to append data with the following code:
mydata;

append(data) {

    var obj = { id: data };

    this.newObj = {...this.newObj, ...obj};

    alert(JSON.stringify(this.newObj));
}

Example usage:
append(1);

Then...
append(2);

My result is always just the replacing ... it's updating and not merging both results.
How can I fix this?

A: That works perfectly. Why? Because objects key must be unique. So you can't have {id:1, id2}, this is invalid object.
You can use array instead and simply use push method:
class test
{
    newObj :Array<{}> = [];

  append(data:number) :void {
    var obj = { id: data };

    this.newObj.push(obj);

    alert(JSON.stringify(this.newObj));
 }
}
var l = new test();

l.append(1);
l.append(2);

Result is :[ { id: 1 }, { id: 2 } ]
PlaygroundLink

A: With your last comment, this should work. You should have an array declared outside the function as variables declared inside the function have a "function/block" scope. I would suggest you do some research before posting a question.

let myData = [];
function append(data){
    var obj = { 'id': data };
    myData.push(obj);
    console.log(myData);
}

append(1);
append(2);
append(3);


text:
Q: Mocking static class function in jest doesn't work Given a very basic javscript class
Foo.js
export default class Foo {
    static bar() {
        console.log("bar");
    }
}

how can I mock the bar function?
Here is what i thought should work (but isn't):
Foo.test.js
import Foo from "./Foo.js";

it("test", () => {
    jest.mock("./Foo.js"); // mock Foo class
    const myMock = jest.fn(); // create a new mocking function
    Foo.prototype.bar = myMock;

    Foo.bar();

    console.log(myMock.mock.calls);
});

But then Foo.bar() call in the test calls the original function (so "bar" get logged) and console.log(myMock.mock.calls); prints a empty list, so the mocking function istn used.
What am I doing wrong?

A: The class was mocked after it was imported, the mock doesn't affect it. jest.mock should be either moved to top level so it could be hoisted before import, or in case the class doesn't need to be mocked for the whole suite, import should be placed inside a test and possibly replaced with require.
bar method isn't mocked because it's static method but it's prototype method that was mocked. Methods shouldn't be mocked by assignment because this prevents them from being restored.
It should be:
jest.spyOn(Foo, 'bar').mockImplementation(() => ...);

It should preferably be restored with jest.restoreAllMocks() or restoreMocks configuration option to not affect other tests.


text:
Q: Passing more than the message to the Web Socket @onmessage event I am working on a Single Page Chat Application that uses Web Socket. My question is :Is there a way to pass more than the message to the function on event @OnMessage? like passing also the user's nickname and photo.
I have tried the following code (added the parameters _nickname and _photo),but after I run it I get the problem :
Server Tomcat v7.0 Server at localhost failed to start.

JavaScript in HTML :
function sendMessage() {
    console.log("0000000");
    if (websocket != null) {
        websocket.send(msg,_nicknname,_photo);
    }
    msg = "";
}

Web Socket ChatEndPoint.java:
@OnMessage
public void deliverChatMessege(Session session, String msg ,String _nickname,String _photo) throws IOException{
    try {
        if (session.isOpen()) {
           //deliver message
           ChatUser user = chatUsers.get(session);
           doNotify(user.username, msg, _nickname,_photo, null);
        }
    } catch (IOException e) {
            session.close();
    }
}

I was thinking about a way to pass the message, nickname and photo Json-like from JavaScript but I don't know how to get it in the side of the web socket server.
Am I missing something ?
Please help me.
Thanks

A: With a send method you can only send strings (see docs). However, you can send a JSON object if you use JSON.stringify. Then in the server you can decode the string and you will have your data.
Example
function sendMessage() {
    console.log("0000000");
    if (websocket != null) {
        var data = {
            msg: msg,
            nickname: _nickname,
            photo: _photo
        };
        websocket.send(JSON.stringify(data));
    }
    msg = "";
}


text:
Q: Remove if old value I have a mongo collection that controls a log of entities.
I want to remove old entities:
{
    "_id" : ObjectId("5a3bf52aa0195f5dd63ff96e"),
    "firstName" : "name17",
    "email" : "email17@gamail.com",
    "recovery" : {
        "token" : "afcc9f4d-3fd5-4fa4-a48b-402f7eea07da",
        "updatedAt" : ISODate("2017-12-21T17:53:46.710Z"),
        "createdAt" : ISODate("2017-12-21T17:53:46.710Z")
    },
    recoveryAttempts: [{
        "token" : "afcc9f4d-3fd5-4fa4-a48b-402f7eea07da",
        "updatedAt" : ISODate("2017-12-21T17:53:46.710Z"),
        "createdAt" : ISODate("2017-12-21T17:53:46.710Z")
    }, {
        "token" : "4a26e0af-d8dd-412e-83fa-fddb209ac646",
        "updatedAt" : ISODate("2017-12-20T17:53:46.710Z"),
        "createdAt" : ISODate("2017-12-20T17:53:46.710Z")
    }, {
        "token" : "34c4fd55-aea9-441d-8e0e-a5fbd0377b48",
        "updatedAt" : ISODate("2017-12-19T17:53:46.710Z"),
        "createdAt" : ISODate("2017-12-19T17:53:46.710Z")
    }, {
        "token" : "c7d67571-8a99-48e8-a7bd-e210693ff119",
        "updatedAt" : ISODate("2017-12-18T17:53:46.710Z"),
        "createdAt" : ISODate("2017-12-18T17:53:46.710Z")
    }]
}

How can I delete recoveryAttempts older than X hours?


text:
Q: Re push a directory to remote git after accidentally deleting it I have my project on openshift. I commited and pushed some changes on my git remote host but accidentaly deleted them after ssh logging on the server. I tried to re-add them commit them and push them but when I commit it says that there is nothing to commit. I tried to force push but it says that everything is up to date. Is there a way to recommit something without reverting back?
git add path/to/my/directory/
git commit -m "Re commiting"
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working directory clean

Tried this to
git push -f
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

In Git 2.0, Git will default to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Everything up-to-date

How can I re-push my directory?

A: I'm not familiar with openshift but I presume that there's a git post-receive
hook on the server which checks out your master branch to a certain working
directory.
You should check the contents of this hook on the remote server (it should be
located at something like ~git/repositories/project.git/hooks/post-receive).
More thank likely, it will contain a command similar to:
GIT_DIR=~git/repositories/project.git/ GIT_WORK_TREE=/var/www/vhosts/project  git checkout -f master

You should then run that command while logged in as the git user; running as
another user will lead to file permission problems.