text:
Q: Extjs Grid Edit Plugin - Textfield focus not removed when resizing parent modal window When setting clicksToEdit : 2 option to edit a cell using grid edit plugin, the textfield sets focus properly. When dragging or resizing the modal window the textfield needs to remove the focus.
The issue is that the textfield is not blurred.
Here's a screenshot of the issue:

plugins: [
    Ext.create('Ext.grid.plugin.CellEditing', {
        clicksToEdit : 2
    })
],

I have attached the code in JSFiddle.
Steps to reproduce the issue:

*

*double click to edit the name.

*resize the panel from right bottom.Now the textbox have a focus and position of textbox is changed.

A: As far as I can see from your code, this has to be an unfixed issue with ExtJS 4.2.x. I am not sure about ExtJS 4.2.4 and 4.2.5, but as of 4.2.3 the bug is still there.
The "funny" thing about this is that the datepickerfield editor does it correctly. Possibly you can look at the code of datepickerfield and make an override for textfield based on that.
In newer versions of ExtJS (5.1 and 6.0), the problem does no longer show.
You could ask for workaround availability in the Sencha forums.
EDIT: A valid workaround would be to add to your cellediting plugin:
pluginId: 'editing'

and to your panel:
listeners:{
    resize:function(panel) {
        var plugin = panel.down('grid').getPlugin('editing');
        if(plugin.editing) plugin.cancelEdit();
    }
}


text:
Q: Multiple background-color layers I wondered if it was possible to create two background-colors for a div an overlay them.
I want a white background-color so that the content below this div doesn't shine through and another rgba() color painted over this white to create lighter colors per script.

A: Though Adrift's answer is the way to go, you can also use pseudo elements for this.
body {
    background: white;
    position: relative;
}

body:before {
    content: "";
    position: absolute;
    top: 0;
    left; 0;
    width: 100%;
    height: 100%;
    background: rgba(220,14,120,0.5);
    z-index: 1;
}

/* Just to be sure, automatically set all elements to a higher z-index than the pseudo element */
body * {
    z-index: 2;
    position: relative;
}

Here is a fiddle.
However, this is not production friendly:

*

*Setting position relative on body and all other elements when not necessary

*Setting unnecessary z-index on all elements

The only upside this method has, is that it doesn't use gradients which, from a semantic standpoint, is more logical.

A: Without understanding why you want this, it can be done by using solid color gradients: fiddle.
body {
    background: linear-gradient(rgba(220,14,120,0.5), rgba(220,14,120,0.5)),
                linear-gradient(white, white); /* first bg is on top of this */

}

A: You can't define two background-colors for one element, but you could overlay one coloured element on top of a white one in order to get a blending effect, while blocking out anything below them:
JSFiddle
HTML

CSS
div {
    width: 100px;
    height: 100px;
}

.one {
    background-color: #fff;
}
.two {
    top: 0;
    left: 0;
    background-color: rgba(0,0,255,0.2);
}

A: To answer your question, yes there is a way. You can use a background image and a background color on the same div. Check out this SOF post.
Although I would consider a different method like this:
Structure:

CSS:
.parent {
    position: relative:
}
.white, .color {
    position:absolute;
    top: 0px;
    left: 0px;
}
.white {
    z-index: 9998;
}
.color {
    z-index: 9999;
}

You can mess around with the details here, but the overall idea is that your layer the divs on top of each other. The div with the higher z-index will be on top. Change their colors accordingly. The parent div being relative will keep the absolute divs inside of that container.

A: To achieve multiple background colors in CSS, a common proposal is

*

*Solid Color Gradients

But there is an alternative:

*

*Solid Color background-images via SVG Data URIs

The working example below contains the following areas with the following background colors:

*

* - dark-gray

*
 - light-gray

*
 - translucent red
In this set-up, we want to use the same theme-color for all the circles, rgba(255, 0, 0, 0.5) but we also want the circles inside the
 to appear to have the same background-color as the circle outside
.
We can observe that, due to the application of the technique below to div.circle.does-not-blend - the rightmost of the two circles inside
 - that circle ends up with the same apparent background-color as div.circle outside
.

The Approach
The approach is to give div.circle.does-not-blend:

*

*the same initial background-color as

*an SVG Data URI background-image with the same translucent red background-color as the other .circle elements

The SVG background-image
The SVG Data URI background-image looks like this:
data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" style="background-color:rgba(255, 0, 0, 0.5);"%2F%3E

The Result
In the final result we see that the light-gray background-color of
 does not bleed through and influence the final background-color of div.circle.does-not-blend

Working Example

main {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 180px;
  padding: 0 9px;
  background-color: rgb(127, 127, 127);
  border: 1px solid rgb(0, 0, 0);
}

section {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex: 0 0 66%;
  background-color: rgb(191, 191, 191);
  height: 162px;
}

.circle {
  display: inline-block;
  width: 120px;
  height: 120px;
  color: rgb(255, 255, 255);
  text-align: center;
  line-height: 120px;
  background-color: rgb(255, 0, 0, 0.5);
  border-radius: 50%;
}

.circle.does-not-blend {
  background-color: rgb(127, 127, 127);
  background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" style="background-color:rgba(255, 0, 0, 0.5);"%2F%3E');
}

Incorrect

Correct

redpajama_set_name: RedPajamaStackExchange


text:
Q: is it possible to convert an Array to a NodeList in javascript? leetcode problem --Linked lists-- I am trying to solve a leetcode problem and I think I have figured it out, the problem is that my function returns an Array with the correct Answer and the problem specifies that I must return a NodeList,
I can't figure out how to create a NodeList without reaching to the DOM, or to transform my Array to NodeList.
The problem is:

Merge two sorted linked lists and return it as a new sorted list. The
new list should be made by splicing together the nodes of the first
two lists.
Example:
Input: 1->2->4, 1->3->4 Output: 1->1->2->3->4->4

my code is :
const listOne = [1, 2, 4];
const listTwo = [1, 3, 4];

function myFunction(l1, l2) {
  let lslength;
  let newList = [];
  if (l1.length >= l2.length) {
    lslength = l1.length;
  } else {
    lslength = l2.length;
  }
  for (let i = 0; i < lslength; i++) {
    if (l1[i] === l2[i]) {
      newList.push(l1[i]);
      newList.push(l2[i]);
    } else if (l1[i] < l2[i]) {
      newList.push(l1[i]);
      newList.push(l2[i]);
    } else if (l1[i] > l2[i]) {
      newList.push(l2[i]);
      newList.push(l1[i]);
    } else if (l1[i]) {
      newList.push(l1[i]);
    } else {
      newList.push(l2[i]);
    }
  }
  return newList;
}

myFunction(listOne, listTwo);

--------EDIT---------
ok so I really didnt understand the problem because its about Linked Lists, now I know, thank you

A: You don't need to do that.
The test cases are represented like arrays for user simplicity I guess. Though, LinkedList and array are two different data types. Your function is returning an array, which is not a desired output here. The desired output is simply a merged linked list, not a merged array.
Here we'd use a sentinel node to merge two linked lists. This'll get accepted:
/**
 * Definition for singly-linked list.
 * function ListNode(val, next) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.next = (next===undefined ? null : next)
 * }
 */
/**
 * @param {ListNode} l1
 * @param {ListNode} l2
 * @return {ListNode}
 */
var mergeTwoLists = function(l1, l2) {
    var sentinel = {
        val: -1,
        next: null
    };

    var curr = sentinel;
    while (l1 && l2) {
        if (l1.val > l2.val) {
            curr.next = l2;
            l2 = l2.next;
        } else {
            curr.next = l1;
            l1 = l1.next;
        }
        curr = curr.next;
    }

    curr.next = l1 || l2;

    return sentinel.next;
};

References

*

*For additional details, you can see the Discussion Board. There are plenty of accepted solutions with a variety of languages and explanations, efficient algorithms, as well as asymptotic time/space complexity analysis1, 2 in there.

*LinkedList vs. Array


text:
Q: Changing width filter inputbox primefaces datatable Hi how do i apply the ccs style for the filter inputbox in a primefaces datatable, trying to use filterstyle this way:
 <p:column styleClass="placaColumna" filterStyle="width=16px" headerText="Placa" filterBy="#
 {bandeja.placa}"><h:outputText value ="#{bandeja.placa}"/></p:column>

thanks :D

A: You can also use an CSS class with the option filterStyleClass
Don't forget to use !important in your css class
filterStyleClass="cssClass"

.cssClass{width: 16px !important}

A: Your inline style CSS syntax is incorrect.  It should be like this.
filterStyle="width: 16px;"


text:
Q: Accented tags not displayed properly on edit page on mobile web site When editing a question with tags which contain accent marks (and likely other non-ASCII characters), the display is garbled, showing HTML escape sequences to the user:

The above screen shot is taken while editing this question on my Nexus 4 with Android 5.1.1 viewing the mobile web site (not the Android app).  Although I initially discovered the issue trying to edit this question on the pre-private-beta ES.SO (so likely not yet visible to many people).

A: As reported by @JuanM, and confirmed on my Pixel, this is now fixed. Thank you!


text:
Q: Git SSH authentication I have Debian, Fisheye and Git on my server.
My git repos are managed by Fisheye. There is no authentication at the Fisheye part. All authentication procedures are managed by git.
I would like to use SSH authentication, so that I do not need to provide username and password as I push my changes to the server. I know how to create an rsa key, but where do I copy my public key at the server?

A: The key part of the article "Git on the Server - Setting Up the Server" is:

you need to add some developer SSH public keys to the ~/.ssh/authorized_keys file for that user.
  Let's assume you've received a few keys by e-mail and saved them to temporary files. Again, the public keys look something like this:

$ cat /tmp/id_rsa.john.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCB007n/ww+ouN4gSLKssMxXnBOvf9LGt4L
ojG6rs6hPB09j9R/T17/x4lhJA0F3FR1rP6kYBRsWj2aThGw6HXLm9/5zytK6Ztg3RPKK+4k
Yjh6541NYsnEAZuXz0jTTyAUfrtU3Z5E003C4oxOj6H0rfIF1kKI9MAQLMdpGW1GYEIgS9Ez
Sdfd8AcCIicTDWbqLAcU4UpkaX8KyGlLwsNuuGztobF8m72ALC/nLF6JLtPofwFBlgc+myiv
O7TCUSBdLQlgMVOFq1I2uPWQOkOWQAHukEOmfjy2jctxSDBQ220ymjaNsHT4kgtZg2AYYgPq
dAv8JggJICUvax2T9va5 gsg-keypair

(Note: make sure the key is displayed on one single line)

You just append them to your authorized_keys file:

$ cat /tmp/id_rsa.john.pub >> ~/.ssh/authorized_keys

If you don't have an authorized_keys file on your server, create it, but make sure to protect it correctly.
server$ mkdir ~/.ssh
server$ chmod 700 ~/.ssh
server$ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
server$ chmod 600 ~/.ssh/authorized_keys
server$ rm ~/id_rsa.pub

See "Creating SSH keys for Gerrit and Hudson" for a concrete example.

*

*Make sure git is in the PATH used by your ssh daemon.

*Make sure all parent directories of your ~/.ssh are not writable for the group (chmod 755 only).

A: You need to paste your public key inside ~/.ssh/authorized_keys. Create the file if it doesn't exist.


text:
Q: how to return some default value for items in 'where' clause which are not matching(not existing) in database table column I have a database table flight
pkid       from_city            to_city
1         Melbourne            BuenosAires
2         Budapest             Tokyo
3         Praslin              Anchorage

Then I have a list/tuple of some random to_cities ['Paris','Tokyo','Madrid','Anchorage','im_not_on_earth']
Now using sqlalchemy metadata I want a query which would return a pkid for a matching to_city in the given list  if exists or else return some default value say 0 if doesn't exist
So basically my output should give me surely some integer for every city where I can map each integer in my output to some city in the given input
Any example outputs as follows will work for me -
{'Paris':0, 'Tokyo': 2, 'Madrid': 0, 'Anchorage': 3, 'im_not_on_earth': 0}

or simply......  [0,2,0,3,0]
Any ideas or suggestions on how to do this? I thought I could achieve this by using coalesce. But that works only if the values in where clause exists in db table. Not sure if my understanding of coalesce is right.
EDIT:
** I don't want to iterate using for loop and query for each element in the given input **

A: You could use apply() and define your own function, for example:
def get_id(x):

    find = flight[flight['to_city']==x]['pkid'].values
    match = find[0] if list(find) else 0
    return match

dict(zip(to_cities, pd.Series(to_cities).apply(get_id).values))

Yields:
{'Paris': 0, 'Tokyo': 2, 'Madrid': 0, 'Anchorage': 3, 'im_not_on_earth': 0}

A: What you are wanting to do an outer join between your provided list of cities and the to_city column in the flight table. Given that the database has no knowledge of your list of provided cities you will have to do this join in application code with a loop. In your example code you also have each to_city appearing in only one database row and thus mapping to only one pkid. I assume that it would be possible for multiple different from_cities to have flights going to the same to_city and thus you will need to have each to_city mapping to a list of pkids rather than a single value. A to_city with no flights going to it will therefore be represented by an empty list rather than a 0.
You can retrieve the list of matching cities with a single database query but you will need a loop to do the outer join with your provided list of to_cities. The following code should achieve what you want. As you have not provided your sqlalchemy code I have assumed you are using the ORM with the Declarative system to define your table.
from collections import defaultdict

class Flight(Base):
    __tablename__ = 'flight'

    pkid = Column(Integer, primary_key=True)
    from_city = Column(String)
    to_city = Column(String)

to_cities = ['Paris','Tokyo','Madrid','Anchorage','im_not_on_earth']
query_result = session.query(Flight.to_city, Flight.pkid).filter(Flight.to_city.in_(to_cities)).all()
matching_cities = defaultdict(list)
for city, pkid in query_result:
    matching_cities[city] += [pkid]
result = {city: matching_cities.get(city, []) for city in to_cities}

It would be worth thinking about your database design given that you are having to do an outer join in application code. The database would be a far more efficient place to carry this out. If you had a separate table of all city names with a foreign key relationship to the flight table then you could achieve what you want in a single query by performing an outer join between the city and flight tables within your query.


text:
Q: Solving Integral $\int_{0}^{x}K_{0}\left(\frac{2t^{\beta /2}}{\sigma ^{\beta }}\right)\;dt$ This question is a continuation of the question posted here. The problem here is to solve the integral with modified Bessel function of second kind, $K_0\left(u\right)$:
$$F\left ( x \right )=\frac{2\beta }{\left ( \sigma \Gamma \left [ \frac{1}{\beta } \right ] \right )^{2}}\int_{0}^{x}K_{0}\left ( \frac{2t^{\frac{\beta }{2}}}{\sigma ^{\beta }} \right )dt$$
where $\beta, \sigma, x>0$ and $F(x)$ is the Cumulative Distribution Function (CDF) of a distribution
The main problem here is to solve
$$\int_{0}^{x}K_{0}\left ( \frac{2t^{\frac{\beta }{2}}}{\sigma ^{\beta }} \right )dt$$
I tried using guidance from here but no luck. How can this be solved? Thanks
Answer:
Follow @Lucian's comment below


text:
Q: Marketing Cloud - User email sending authentication - from address I was recently told that I was no longer able to send emails from validated user email address in Marketing Cloud. Previously we have validated the emails and then checked the box to add them to the reply from box in Salesforce when sending an email.
I just tried to do this and I was not only able to but also didn't get any error messages.
Can anyone confirm if this feature is being removed and should not be used or if I have been passed on some incorrect information?

A: I have also got the same email recently. For my case, I have just contacted support and they said to ignore that mail and it is working fine.
I believe in your email they would have mentioned the affected domain name & MID, just check if the domain is still delegated to exact target name servers.
You can just check if the domain is delegated or not with this link - https://xnnd.com/dele.cgi?t=dele&d=example.com
Just enter you domain and you can see if it's delegated or not.
If its delegated then you are good. Let me know if this helps.


text:
Q: Firebase Console does not show my app version in the target filter I implemented firebase notifications in my app last year and all worked fine, now this year I've been modifying images in my app to bring the visual design up to date and upon testing notifications I've found that my version is not listed in firebase console under cloud messaging.
If I look at the dashboard it shows that version 2.0 exists however when I go into cloud messaging and put in the filter to only target my app version it only shows 1.0 & 1.2 which were versions from last year.
Any ideas on why the filter isn't showing my new version but the dashboard is showing it?

A: If the version is not shown, then type in the new version in the search box and click Create value like in the screenshot.


text:
Q: Filtering on a list I have a list of Countries and I am using it as a search, so if I am searching for a specific country, once its found the country I want, I selected it from the filtered list. The problem is, when I select the 112th item on the filtered list, if it is at the top of the filtered list, the result is actually the 1st item on the unfiltered list.
This will be an easier way of explaining it, I've uploaded a video to it which can be found here Search Example
my Adapter for the Search is here:
    public Context mContext;
public ArrayList<Countries> countryArrayList;
public ArrayList<Countries> original;

public CountryAdapter(Context context, ArrayList<Countries> countryArrayList) {
    mContext = context;
    this.countryArrayList = countryArrayList;
}

@Override
public void notifyDataSetChanged() {
    super.notifyDataSetChanged();
}

@Override
public int getCount() {
    return countryArrayList.size();
}

@Override
public Object getItem(int position) {
    return countryArrayList.get(position);
}

@Override
public long getItemId(int position) {
    return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    CountryHolder holder;

    if (convertView == null) {
        convertView = LayoutInflater.from(mContext).inflate(R.layout.search_results_row_list, parent, false);
        holder = new CountryHolder();
        holder.countryName = (TextView) convertView.findViewById(R.id.country_text);
        holder.countryFlag = (ImageView) convertView.findViewById(R.id.country_flag);
        convertView.setTag(holder);
    } else {
        holder = (CountryHolder) convertView.getTag();
    }
    holder.countryName.setText(countryArrayList.get(position).getCountryName());
//        holder.countryFlag.setImageResource(countryArrayList.get(position).getImgId());
    return convertView;
}

@Override
public Filter getFilter() {
    return new Filter() {
        @Override
        protected FilterResults performFiltering(CharSequence constraint) {
            final FilterResults oReturn = new FilterResults();
            final ArrayList<Countries> results = new ArrayList<>();
            if (original == null)
                original = countryArrayList;
            if (constraint != null) {
                if (original != null && original.size() > 0) {
                    for (final Countries g : original) {
                        if (g.getCountryName()
                                .contains(constraint.toString()))
                            results.add(g);
                    }
                }
                oReturn.values = results;
            }
            return oReturn;
        }

        @SuppressWarnings("unchecked")
        @Override
        protected void publishResults(CharSequence constraint, FilterResults results) {
            countryArrayList = (ArrayList<Countries>) results.values;
            notifyDataSetChanged();
        }
    };
}

public class CountryHolder {
    TextView countryName;
    ImageView countryFlag;
}

Sorry I forgot where I am actually selecting the country
private void setSearchResultsList() {
    final CountryAdapter countryAdapter = new CountryAdapter(getActivity(), controller.getCountriesArrayList());
    countryAdapter.getFilter().filter(searchPhrase);
    countryAdapter.notifyDataSetChanged();

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            String selectedCountry = controller.getCountriesArrayList().get(+position).getCountryName();
            mISearch.searchResult(selectedCountry);

        }
    });

    listView.setAdapter(countryAdapter);
}

Thanks

A: Once for all the time:
If you are using AdapterView.setOnItemClickListener, the right way to get clicked item is such implementation:
adapterView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        Object item = parent.getItemAtPosition(position);
    }
});

parent.getItemAtPosition(position) returns Adapter.getItem(position) from your adapter used in AdapterView (with setAdapter)
so for example:

*

*if you are using ArrayAdapter<T> you should cast parent.getItemAtPosition(position) to T and use it ...

*for ArrayAdapter<POJO> use:
POJO item = (POJO)parent.getItemAtPosition(position);

*if you are using CursorAdapter

*

*Cursor c = (Cursor)parent.getItemAtPosition(position);

*if you are using SimpleAdapter

*

*Map<String, ?> item = ( Map<String, ?>)parent.getItemAtPosition(position);
of course it depends on your Adapter implementation ... so you should remeber that Adapter should return the right object with getItem(position)
As it is stated in the documentation it apply to: ListView, GridView, Spinner, Gallery and other subclasses of AdapterView
So in your case the right way is obviously:
Countries country = (Countries)parent.getItemAtPosition(position);

A: do this way

add one method in adapter class to get current list
public ArrayList<Countries> GetCurrentListData() {
        return countryArrayList;
    }

CountryAdapter dcAdapter = new CountryAdapter("whatever your perameter");
    listview.setAdapter(dcAdapter);
    lstDoctorsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                        @Override
                        public void onItemClick(AdapterView<?> parent, View view,
                                                int position, long id) {
                            try {
                                Countries countries = dcAdapter
                                     .GetCurrentListData().get(position);
                                // get data from countries model class

                            } catch (Exception e) {

                            }
                        }
                    });


text:
Q: NoClassDefFound for JTDS JDBC while trying to connect to SQL Server I'm working on a login that gets a list of usernames and passwords from an SQL server. Using another program I am sure that the URL for the SQL server is working and that the server works. So it starts in the main activity shown here:
activity_login.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.qrscanner.mahindra.estimateapp.Login">

    <RelativeLayout
        android:layout_width="0dp"
        android:layout_height="495dp"
        tools:layout_constraintTop_creator="1"
        tools:layout_constraintRight_creator="1"
        android:layout_marginStart="8dp"
        android:layout_marginEnd="8dp"
        app:layout_constraintRight_toRightOf="parent"
        android:layout_marginTop="8dp"
        tools:layout_constraintLeft_creator="1"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp">

        <ImageView
            android:id="@+id/imageView"
            android:layout_width="100dp"
            android:layout_height="50dp"
            android:layout_alignParentEnd="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentStart="true"
            android:layout_alignParentTop="true"
            app:srcCompat="@mipmap/ic_launcher" />

        <TextView
            android:id="@+id/username_textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="171dp"
            android:text="@string/username"
            android:textColor="@android:color/black"
            android:textSize="24sp"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true" />

        <EditText
            android:id="@+id/username_input"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="textPersonName"
            tools:layout_editor_absoluteX="0dp"
            tools:layout_editor_absoluteY="0dp"
            android:layout_below="@+id/username_textView"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true" />

        <TextView
            android:id="@+id/password_textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/password_input"
            android:layout_alignEnd="@+id/username_textView"
            android:layout_alignRight="@+id/username_textView"
            android:layout_marginBottom="43dp"
            android:text="@string/password"
            android:textColor="@android:color/black"
            android:textSize="24sp" />

        <EditText
            android:id="@+id/password_input"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="78dp"
            android:ems="10"
            android:inputType="textPassword"
            tools:layout_editor_absoluteX="0dp"
            tools:layout_editor_absoluteY="0dp"
            android:layout_below="@+id/username_input"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true" />

        <Button
            android:id="@+id/login_button"
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:text="@string/login"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="43dp"
            android:onClick="CheckLogin"/>

    </RelativeLayout>

</android.support.constraint.ConstraintLayout>

Login.java
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;

import java.util.ArrayList;

public class Login extends AppCompatActivity {

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

  public void CheckLogin(View v){
      /* Check SQL server to see if login is correct*/

      Log.d("TEst", "------------------------Begin");
      EditText usernameEdit = (EditText) findViewById(R.id.username_input);
      EditText passwordEdit = (EditText) findViewById(R.id.password_input);

      Log.d("TEst", "--------------------------Part1");

      String username = usernameEdit.getText().toString();
      String password = passwordEdit.getText().toString();

      Log.d("TEst","---------------------------Part2");

      //Get Login cred table
      WebTalker server = new WebTalker();
      GlobalVars global = new GlobalVars();

      Log.d("TEst","---------------------------Part3");

      ArrayList<ArrayList<String>> logins = server.GetTable("dbo.Logins", this);//TODO: insert table name here for logins

      Log.d("TEst","---------------------------Part4");

      for (int i = 0; i <= logins.size(); i++) {
          if (logins.get(i).get(0) == username) {
              if (logins.get(i).get(1) == password) {
                  global.setString("username", username, this.getApplicationContext());
                  setContentView(R.layout.activity_main);
              }
          }
      }

      server.PopUp("Invalid username or password", this, R.layout.activity_login);
  }

}

Then after I enter anything into the username and password fields and hit the "Login" button, this script launches:
WebTalker.java
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.AsyncTask;
import android.util.Log;
import android.view.Gravity;
import android.widget.TextView;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

/**
 * Talks to SQL server and does requested action
 *
 * TableArray Format
 *
 * tableArray[row][column]
 */

public class WebTalker {

    private ArrayList<ArrayList<String>> table = new ArrayList<ArrayList<String>>();
    private static final Object waitObj = new Object();
    private Activity activ;

    private String error;
    private ArrayList<ArrayList<String>> tableArray = new ArrayList<ArrayList<String>>();

    private ResultSet rs;
    private Statement stmt;
    private Connection con;

    public ArrayList<ArrayList<String>> GetTable(String tableName, Activity act) {
        activ = act;
        new CheckServer().execute(tableName);

        //Wait for Async to finish
        synchronized (waitObj) {
            try {
                waitObj.wait();
            } catch (InterruptedException e) {
                PopUp("Error: Synchronization error", activ, R.layout.activity_login);
            }
        }
        return table;
    }

    private void postResult(ArrayList<ArrayList<String>> asyncresult) {
        table = asyncresult;
        synchronized (waitObj) {
            waitObj.notify();
        }
    }

    private class CheckServer extends AsyncTask<String, Void, Void>
    {
        /* Fetch info from server and run through it */

        //TODO:Change this later
        private String connectionUrl = "jdbc:jtds:sqlserver://10.173.139.55:1433/master/user=Admin;password=123;";

        @Override
        protected Void doInBackground(String... tableName) {
            //Make sure that tablename is a directory to the table

            try {

                //GetDriver
                Class.forName("net.sourceforge.jtds.jdbc.Driver");
                    //Connect
                    Log.d("TEst", "-------------------------Start Connection");
                    con = DriverManager.getConnection(connectionUrl);

                    Log.d("TEst","---------------------------Connected");

                    //Create and execute SQL statement
                    String SQL = "SELECT * FROM " + tableName[0];

                    stmt = con.createStatement();
                    rs = stmt.executeQuery(SQL);

                    int column = 0;
                    int row = 0;

                    ArrayList<String> tempArray = new ArrayList<String>();
                    //Run through the data
                    while(rs.next()) {
                        //compile to array
                        while(rs.getString(column) != null) {
                            tempArray.add(rs.getString(column));
                            column += 1;
                        }
                        tableArray.add(tempArray);
                        row += 1;
                        column = 0;
                    }

            } catch (SQLException e) {
                Log.d("TEst","---------------------------" + e.toString());
                error = "Error: SQL Exception";
            } catch (ClassNotFoundException e) {
                Log.d("TEst","---------------------------" + e.toString());
                error = "Error: ClassNotFoundException";
            } finally {
                //Close Connections
                if (rs != null) try { rs.close(); } catch(SQLException e) {}
                if (stmt != null) try { stmt.close(); } catch(SQLException e) {}
                if (con != null) try { con.close(); } catch(SQLException e) {}
            }

            return null;
        }

        @Override
        protected void onPostExecute(Void v) {
            if (error != null) {
                PopUp(error, activ, R.layout.activity_login);
            }
            postResult(tableArray);
        }

    }

    public void PopUp(String errorMessage, final Activity act, final int layoutToLoad){
        /*Create a pop-up dialog box containing the errormessage*/

        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(act);

        final TextView view = new TextView(act);
        view.setText(errorMessage);
        view.setTextSize(18);
        view.setGravity(Gravity.CENTER);

        // set prompts.xml to alertdialog builder
        alertDialogBuilder.setView(view);

        // set dialog message
        alertDialogBuilder.setCancelable(false).setPositiveButton("Return", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
            act.setContentView(layoutToLoad);
            }
        });

        // create alert dialog
        AlertDialog alertDialog = alertDialogBuilder.create();
        // show it
        alertDialog.show();
    }

}

The Error shown below pops up when the program hits this line:
con = DriverManager.getConnection(connectionUrl);

Error Message:
05-25 17:03:18.292 22223-23272/com.qrscanner.mahindra.estimateapp E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
  Process: com.qrscanner.mahindra.estimateapp, PID: 22223
  java.lang.RuntimeException: An error occurred while executing doInBackground()
      at android.os.AsyncTask$3.done(AsyncTask.java:318)
      at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
      at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
      at java.util.concurrent.FutureTask.run(FutureTask.java:242)
      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
      at java.lang.Thread.run(Thread.java:762)
   Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/ietf/jgss/GSSManager;
      at net.sourceforge.jtds.jdbc.TdsCore.createGssToken(TdsCore.java:4400)
      at net.sourceforge.jtds.jdbc.TdsCore.sendMSLoginPkt(TdsCore.java:1971)
      at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:617)
      at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:371)
      at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
      at java.sql.DriverManager.getConnection(DriverManager.java:569)
      at java.sql.DriverManager.getConnection(DriverManager.java:237)
      at com.qrscanner.mahindra.estimateapp.WebTalker$CheckServer.doInBackground(WebTalker.java:84)
      at com.qrscanner.mahindra.estimateapp.WebTalker$CheckServer.doInBackground(WebTalker.java:67)
      at android.os.AsyncTask$2.call(AsyncTask.java:304)
      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
      at java.lang.Thread.run(Thread.java:762)
   Caused by: java.lang.ClassNotFoundException: Didn't find class "org.ietf.jgss.GSSManager" on path: DexPathList[[zip file "/data/app/com.qrscanner.mahindra.estimateapp-2/base.apk", zip file "/data/app/com.qrscanner.mahindra.estimateapp-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.qrscanner.mahindra.estimateapp-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.qrscanner.mahindra.estimateapp-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.qrscanner.mahindra.estimateapp-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.qrscanner.mahindra.estimateapp-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.qrscanner.mahindra.estimateapp-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.qrscanner.mahindra.estimateapp-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.qrscanner.mahindra.estimateapp-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.qrscanner.mahindra.estimateapp-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.qrscanner.mahindra.estimateapp-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.qrscanner.mahindra.estimateapp-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.qrscanner.mahindra.estimateapp-2/lib/arm64, /system/lib64, /vendor/lib64]]
      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
      at net.sourceforge.jtds.jdbc.TdsCore.createGssToken(TdsCore.java:4400)
      at net.sourceforge.jtds.jdbc.TdsCore.sendMSLoginPkt(TdsCore.java:1971)
      at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:617)
      at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:371)
      at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
      at java.sql.DriverManager.getConnection(DriverManager.java:569)
      at java.sql.DriverManager.getConnection(DriverManager.java:237)
      at com.qrscanner.mahindra.estimateapp.WebTalker$CheckServer.doInBackground(WebTalker.java:84)
      at com.qrscanner.mahindra.estimateapp.WebTalker$CheckServer.doInBackground(WebTalker.java:67)
      at android.os.AsyncTask$2.call(AsyncTask.java:304)
      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
      at java.lang.Thread.run(Thread.java:762)

Thank You!


text:
Q: Equivalence Relation - $\forall f,g \in W : fLg \iff \lim_{x \to {\infty}}f(x) = \lim_{x \to {\infty}}g(x)$ There is $W=\left\{ f:(0,\infty) \to \mathbb R | \lim_{x \to \infty} exists\right\}$
Equivalence relation L :
$\forall f,g \in W : fLg \iff \lim_{x \to {\infty}}f(x) = \lim_{x \to {\infty}}g(x)$
$1.$ Prove every relation class has the same cardinality and what it is.
$2.$ Find cardinality $W/L$
My solution:
$1.$ I know that for every real number a there exists a sequence $r_n$ of rational numbers such that $r_n$ approaches a.
I dont know how to deal with it from here.
$2.$ There are $\mathfrak{c}$ real numbers so $|W/L|=\mathfrak{c}$
I'd be grateful for your help!

A: First, note that $|\{f : (0, \infty) \to \mathbb{R}\}| = |\mathbb{R}|^{|(0, \infty)|} = (2^{\aleph_0})^{2^{\aleph_0}} = 2^{\aleph_0 \times 2^{\aleph_0}} = 2^{\max(\aleph_0, 2^{\aleph_0})} = 2^{2^{\aleph_0}} = \beth_2$. This provides an upper bound on the cardinality of an equivalence class.
Secondly, consider the equivalence class which converges to a fixed number $c$ - call this class $C$. Consider the following function $g : \{f : (0, 1) \to \mathbb{R}\} \to C$ defined by
$$g(f)(x) = \begin{cases}
  f(x) & x \in (0, 1) \\
  c    & otherwise
\end{cases}$$
Clearly, $g$ is injective. Thus, $|C| \geq |\{f : (0, 1) \to \mathbb{R}\}| = \beth_2$.
Thus, $|C| = \beth_2 = 2^{\frak c}$, where ${\frak c} = 2^{\aleph_0} = |\mathbb{R}|$.
Your solution for part 2 is correct.


text:
Q: Powershell filter results don't match results from a pipeline I can use the following commands produce the desired output without any blank lines.
PS C:\> Get-ChildItem $Home | Out-String | ForEach-Object {($_.tostring()).split([Environment]::Newline)} | Where-Object {$_}
    Directory: C:\Users\user
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        03/04/2019     15:50            Contacts
d-r--        19/03/2020     10:48            Desktop
d-r--        19/03/2020     10:48            Documents
d-r--        03/04/2019     15:50            Downloads
d-r--        03/04/2019     15:50            Favorites
d-r--        03/04/2019     15:50            Links
d-r--        03/04/2019     15:50            Music
d-r--        03/04/2019     15:50            Pictures
d-r--        03/04/2019     15:50            Saved Games
d-r--        03/04/2019     15:50            Searches
d-r--        03/04/2019     15:50            Videos
PS C:\>

However if I create a filter to do the same job it doesn't work.
PS C:\> filter Strip-Blanks ()
>> {
>>   $input | Out-String | ForEach-Object {($_.tostring()).split([Environment]::Newline)} | Where-Object {$_}
>> }
>>
PS C:\> Get-ChildItem $Home | Strip-Blanks
    Directory: C:\Users\user
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        03/04/2019     15:50            Contacts
    Directory: C:\Users\user
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        19/03/2020     10:48            Desktop
    Directory: C:\Users\user
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        19/03/2020     10:48            Documents
    Directory: C:\Users\user
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        03/04/2019     15:50            Downloads
    Directory: C:\Users\user
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        03/04/2019     15:50            Favorites
    Directory: C:\Users\user
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        03/04/2019     15:50            Links
    Directory: C:\Users\user
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        03/04/2019     15:50            Music
    Directory: C:\Users\user
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        03/04/2019     15:50            Pictures
    Directory: C:\Users\user
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        03/04/2019     15:50            Saved Games
    Directory: C:\Users\user
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        03/04/2019     15:50            Searches
    Directory: C:\Users\user
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        03/04/2019     15:50            Videos
PS C:\>

Obviously when piping the results from Get-ChildItem to my filter each (file/folder) object is being passed separately and ends up being displayed with it's own header.  The question is why doesn't this happen when piping the output through Out-String in the first example and can I get my filter to behave in the same way?
Thank you.

A: It's tricky. In the first example, out-string is blocking until it has all the lines. Your filter would have to do the same.  Notice the delay until all 3 numbers are input.
& { 1;sleep 1;2;sleep 1;3 } | out-string

If you take out-string out of the filter, it would work.  Out-String outputs one multiline string.
filter Strip-Blanks {
  $input |
  ForEach-Object {($_.tostring()).split([Environment]::Newline)} |
  Where-Object {$_}
 }

Get-ChildItem | Out-String | Strip-Blanks

    Directory: /Users/js/foo
UnixMode   User             Group                 LastWriteTime           Size Name
--------   ----             -----                 -------------           ---- ----
-rw-r--r-- js               staff               3/19/2020 22:59              3 file1
-rw-r--r-- js               staff               3/19/2020 22:59              3 file2
-rw-r--r-- js               staff               3/19/2020 22:59              3 file3


text:
Q: How to handle checkbox change dynamically using react onchange Hello how can I handle onChange for multiple check box? The following example allows me to control the value of one checkbox.
class App extends Component {
  constructor() {
    super();
    this.state = {
      i_agree: false
    };
    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  handleChange(event) {
    this.setState({i_agree: !this.state.i_agree});
  }

  handleSubmit(event) {
    console.log(this.state);
    event.preventDefault();
  }

  render() {
    return (

React Checkbox onChange Example - ItSolutionStuff.com

        <form onSubmit={this.handleSubmit}>

            <input
              type="checkbox"
              defaultChecked={this.state.i_agree}
              onChange={this.handleChange}
            /> I Agree with this content...

            <input
              type="checkbox"
              defaultChecked={this.state.isChecked}
              onChange={this.handleChange}
            /> I want to control this...

          <input type="submit" value="Submit" />
        </form>

    );
  }
}

How can I set my handleChange function to handle changes for each checkbox instead of checking for one.
Reference Link
Attempt 1
class App extends Component {
      constructor() {
        super();
        this.state = {
          i_agree: false,
          isChecked: false

        };
        this.handleChange = this.handleChange.bind(this);
        this.handleSubmit = this.handleSubmit.bind(this);
      }

      handleChange(event) {
        this.setState({
          [e.target.name]: !e.target.value
        });
      }

      handleSubmit(event) {
        console.log(this.state);
        event.preventDefault();
      }

      render() {
        return (

React Checkbox onChange Example - ItSolutionStuff.com

            <form onSubmit={this.handleSubmit}>

                <input
                  type="checkbox"
                  defaultChecked={this.state.i_agree}
                  onChange={this.handleChange}
                  name="i_agree"
                /> I Agree with this content...

                <input
                  type="checkbox"
                  defaultChecked={this.state.isChecked}
                  onChange={this.handleChange}
                  name="isChecked"
                /> I want to control this...

              <input type="submit" value="Submit" />
            </form>

        );
      }
    }

I Updated the onChange handler and added name attributes in each label. But this did not work or threw any errors.

A: I would use checked instead of defaultChecked to have a controlled checkbox input.
for handleChange you can use name and checked attributes to update checkbox state (you could also do a flip on its boolean state instead of using checked). this way you can have only one handler for all your checkboxes.
Typescript solution
import React from "react";

interface CheckboxProps {
  checked: boolean;
  label: string;
  name: string;
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
}
// I abstracted Checkbox to a component but it's up to you
const Checkbox = ({ checked, onChange, label, name }: CheckboxProps) => (

    <input
      type="checkbox"
      checked={checked} // use checked to have a controlled component
      onChange={onChange}
      name={name}
    />
    {label}

);

interface AppState {
  iAgree: boolean;
  wantCookies: boolean;
  wishList: boolean;
}

class App extends React.Component<{}, AppState> {
  // constructor method is called implicit you can define state outside
  // for binding methods, you can declare them as arrow functions
  state = {
    iAgree: false,
    wantCookies: false,
    wishList: false
  };

  // extract name and checked properties
  handleChange = ({
    target: { name, checked }
  }: React.ChangeEvent<HTMLInputElement>) =>
    this.setState({ [name]: checked } as Pick<AppState, keyof AppState>);

  handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
    console.log(this.state);
    event.preventDefault();
  };

  render() {
    const { iAgree, wantCookies, wishList } = this.state;
    return (

React Checkbox onChange Example - ItSolutionStuff.com

        <form onSubmit={this.handleSubmit}>
          <Checkbox
            onChange={this.handleChange}
            name={"iAgree"}
            checked={iAgree}
            label={"I agree with terms"}
          />
          <Checkbox
            onChange={this.handleChange}
            name={"wantCookies"}
            checked={wantCookies}
            label={"I want more cookies"}
          />
          <Checkbox
            onChange={this.handleChange}
            name={"wishList"}
            checked={wishList}
            label={"Put Me on wishlist"}
          />

          <input type="submit" value="Submit" />
        </form>

    );
  }
}

export default App;

Javascript solution
import React from "react";

// I abstracted Checkbox to a component but it's up to you
const Checkbox = ({ checked, onChange, label, name }) => (

    <input
      type="checkbox"
      checked={checked} // use checked to have a controlled component
      onChange={onChange}
      name={name}
    /> { label }

)

class App extends React.Component {
    // constructor method is called implicit you can define state outside
    // for binding methods, you can declare them as arrow functions
    state = {
      iAgree: false,
      wantCookies: false,
      wishList: false,
    };

  // extract name and checked properties
  handleChange = ({target: { name, checked }}) => this.setState({[name]: checked});

  handleSubmit= (event) => {
    console.log(this.state);
    event.preventDefault();
  }

  render() {
    const { iAgree, wantCookies, wishList } = this.state
    return (

React Checkbox onChange Example - ItSolutionStuff.com

        <form onSubmit={this.handleSubmit}>
          <Checkbox onChange={this.handleChange} name={'iAgree'} checked={iAgree} label={'I agree with terms'} />
          <Checkbox onChange={this.handleChange} name={'wantCookies'} checked={wantCookies} label={'I want more cookies'} />
          <Checkbox onChange={this.handleChange} name={'wishList'} checked={wishList} label={'Put Me on wishlist'} />

          <input type="submit" value="Submit" />
        </form>

    );
  }
}

export default  App

fwiw I removed the constructor since it's not necessary. You can keep it though, it's only a cleaner way to declare your classes.
sandbox with implementation TS: https://codesandbox.io/s/so-multi-checkboxes-ts-qz20m
sandbox with implementation JS: https://stackblitz.com/edit/so-multi-checkboxes?file=src/App.js


text:
Q: Cannot read properties of undefined (reading 'log'), winston I am trying to log errors in a file using winston, node js.
but it is giving the error as:
Cannot read properties of undefined (reading 'log')
code:
server.js
const path = require('path');
const express = require('express');
const app = express();
const http = require('http');
const server = http.createServer(app);
const sharp=require('sharp')
const logger=require('./errorLogger')

app.use(express.static(path.join(__dirname,"../public")));

app.get('/down', (req, res) => {

    outFile="output.jpg"
    sharp("../public/vidgo.jpg")
    .resize()
    .toFile(outFile,(err)=>{

        if(err) {
            console.log(err)
            logger.errorLogger.log('error',err) // line 37 mentioned in error
        }

        console.log("----")
        res.download(outFile,err=>{

            if(err) {
                console.log(err)
                logger.errorLogger.log('error',err)
            }

            console.log("down")
        })
    })
  });

server.listen(3000, () => {
  console.log('listening on *:3000');
});

errorLogger.js  module
const {createLogger, transports,format} = require('winston')

const errorLogger=createLogger({
    transports:[
        new transports.File({
            filename:"errLogs",
            level:"error",
            format: format.combine(format.timestamp(),format.json())
        })
    ]
})

log and errors
Error: Input file is missing: ../public/vidgo.jpg]
E:\Novo Cabs\requestLog\nodeserver\server.js:37
            logger.errorLogger.log('error',err)
                               ^

TypeError: Cannot read properties of undefined (reading 'log')
    at Object.<anonymous> (E:\Novo Cabs\requestLog\nodeserver\server.js:37:32)

the file named 'errLogs' is created automatically

A: Add the
module.exports = logger;

to your errorLogger.js file.


text:
Q: Get values from nested array I need help getting the values from this array.
I have this from a mysql db
Array ( [Descuento] => D.L. 25897 AFP [0] => D.L. 25897 AFP [Monto] => 69.2000 [1] => 69.2000 [Nombre] => MARLENE JESUS [2] => MARLENE JESUS )

Array ( [Descuento] => Tardanzas [0] => Tardanzas [Monto] => 0.0500 [1] => 0.0500 [Nombre] => MARLENE JESUS [2] => MARLENE JESUS )

Array ( [Descuento] => Inasistencias [0] => Inasistencias [Monto] => 24.4900 [1] => 24.4900 [Nombre] => MARLENE JESUS [2] => MARLENE JESUS )

Array ( [Descuento] => Cafae-SE [0] => Cafae-SE [Monto] => 16.3000 [1] => 16.3000 [Nombre] => MARLENE JESUS [2] => MARLENE JESUS )

I get this from a Mysql query
SELECT Dscto01 AS Descuento, Mto01 AS Monto, NOMBRES AS Nombre
FROM  data WHERE Dscto01 IS NOT NULL AND DNI = :dni
UNION ALL
                                                                    SELECT Dscto02, Mto02, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto02 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto03, Mto03, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto03 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto04, Mto04, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto04 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto05, Mto05, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto05 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto06, Mto06, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto06 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto07, Mto07, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto07 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto08, Mto08, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto08 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto09, Mto09, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto09 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto10, Mto10, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto10 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto11, Mto11, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto11 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto12, Mto12, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto12 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto13, Mto13, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto13 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto14, Mto14, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto14 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto15, Mto15, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto15 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto16, Mto16, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto16 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto17, Mto17, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto17 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto18, Mto18, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto18 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto19, Mto19, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto19 IS NOT NULL AND DNI = :dni
                                                                    UNION ALL
                                                                    SELECT Dscto20, Mto20, NOMBRES
                                                                    FROM  data
                                                                    WHERE Dscto20 IS NOT NULL AND DNI = :dni LIMIT :start,:end'

And then
foreach($result as $row) {
                    print_r ($row);}

In the first array the [Descuento] result should be D.L. 25897 AFP and the [Monto] 69.2000
I need to put the [Descuento] in a variable and the [Monto] also. Can you please help me. I cant access that info.
Thanks in advance!

A: At each iteration you can access the elements directly using $row['Descuento'] so something like...
foreach ( $result as $row ) {
   $descuento = $row['Descuento'];
   $monto = $row['Monto'];
   // Do something with values
}

The one thing is that each loop will overwrite the last value, so I've added the // do something here as it's commonly seen questions about 'why do I just have the last set of values after loop'.


text:
Q: How to add assemblies in a 64-bit machine? My old cmd-script:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm blabla.dll
C:\Windows\Microsoft.NET\Framework\v2.0.50727\GacUtil -i blabla.dll

(Which works fine in my old machine.)
But now I have a script for a 64-bit machine (Windows Server 2008 R2):
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\RegAsm blabla.dll
C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools\GacUtil -i blabla.dll

Then I get this message:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\RegAsm blabla.dll

Microsoft (R) .NET Framework Assembly Registration Utility
  2.0.50727.5420 Copyright (C) Microsoft Corporation 1998-2004.  All rights reserved.
Types registered successfully

C:\Program Files\Microsoft SDKs\Windows\v7 .1\Bin\NETFX 4.0 Tools\GacUtil -i blabla.dll

'C:\Program' is not recognized as an
  internal or external command, operable program or batch file.

The second command is not successful.

A: You need to quote around the path to gacutil because it has spaces in it. Try:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\RegAsm blabla.dll "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools\GacUtil" -i blabla.dll


text:
Q: What causes memcache to delete keys? Our memcache install recently started removing keys, and we're not sure why.  Large groups of keys vanish at the same time.
Memcache reports that evictions are low to non-existent, and our app has no way to clear memcache (it can only delete specific keys).  Even keys of which the app has no knowledge get deleted, so we're pretty convinced they're getting expired.  However, our memcache configuration hasn't been touched in some time.
Has anyone debugged an issue like this before, and if so, are there any steps you'd recommend we take?  How flexible is memcache's expiration policy - is it possible that we're suddenly running into a criterion based on (say) write frequency to a key?

A: Even if you have set the keys to not expire in Memcached, records will be deleted according to least-recently-used if Memcached fills up. The standard slab-based storage mechanism stores records in fixed size chunks that are allocated from slabs of 1Mb size. Although this is fast, it also means that Memcached can end up wasting quite a lot of memory. Once a slab has been allocated to hold chunks of a particular size I do not think the chunks can be resized. If a mix of large and small objects are cached, and the composition changes over time, it is possible that memcached will end up storeing small objects in much larger chunks if these are the only ones available.
This is one of the issues that companies like e.g. gear6 (www.gear6.com) and northscale (www.northscale.com) have addressed in their Memcached distributions.

A: This turned out to be due to some debug code having been left in the application when it was deployed.
The debug code manually called Memcache::flush.
I think the moral of this story is: "Any time you say, 'it can't be the application', you're probably wrong."  You'd think I would have known that by the time I asked this question, but apparently, I could do with a reminder from time to time.


text:
Q: VSTS CD stage task always prints log in one go I would like to execute UI test cases as as part of CI/CD pipeline. I am using VSTS release management. I created a stage & run the command (npm run e2e-run) as part of one of the tasks, this triggers my test case execution. It takes around 1 hour to execute this task.
Problem is I do not get any response until whole task (test execution) is done. I get only this message "Waiting for console output from an agent...". If I execute command locally in VS code then I get continuous logs (pass/fail messages).
I am observing same behaviour with other tasks as well. Can anybody please tell me how can I get logs continuously instead in one go.


text:
Q: How to parse multiple schema files in GraphQL Java I am using GraphQL with java. I have several schema files to be parsed. Can anybody please let me know whether there is a way to do it. I have used the below way which lets only one schema file to be parsed.
@Value("classpath:dashboard.graphql")
private Resource schemaResource;

File schemaFile = schemaResource.getFile();
TypeDefinitionRegistry definitionRegistry = new SchemaParser().parse(schemaFile);

Supose I have two schema files such as dashboard.graphql and student.graphql. Then how can we parse these two files ?
Can anybody please explain me.
Thanks

A: I know this is an oldish question, but the SO answer appears before the official GraphQL-java documentation, so I thought I'd post it here:
SchemaParser schemaParser = new SchemaParser();
SchemaGenerator schemaGenerator = new SchemaGenerator();

File schemaFile1 = loadSchema("starWarsSchemaPart1.graphqls");
File schemaFile2 = loadSchema("starWarsSchemaPart2.graphqls");
File schemaFile3 = loadSchema("starWarsSchemaPart3.graphqls");

TypeDefinitionRegistry typeRegistry = new TypeDefinitionRegistry();

// each registry is merged into the main registry
typeRegistry.merge(schemaParser.parse(schemaFile1));
typeRegistry.merge(schemaParser.parse(schemaFile2));
typeRegistry.merge(schemaParser.parse(schemaFile3));

GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(typeRegistry, buildRuntimeWiring());

A: we did it like this using a schemaParserBuilder:
SchemaParserBuilder parser = SchemaParser.newParser();
parser.files(arrayOfFileNames);//fill the array with the paths to your schema files
//define other properties like resolvers here
GraphQLSchema schema = parser.build().makeExecutableSchema();

Another idea if you need that TypeDefinitionRegistry-object. Just read all your schema files separatly, merge them into a String and use schemaParser.parse(String schema). In fact parser.files is doing exactly that.


text:
Q: Securing up ubuntu on Amazon ec2 let's say you create a new instance on Amazon ec2 and you choose a default Ubuntu AMI. What things would you recommend for making the instance as secure as possible?
Elias

A: This is a fairly nebulous question with answers that span books.  It wouldn't matter where you were deploying to, you are talking about securing a Linux server.

A: What purpose are you deploying it for? Is this a web server, database, something else? To Nathans point, you are mainly talking about securing a Linux sever.

A: Elias: The quick answer is to decide which services you want to expose (ssh, http, https) and enable only those services on your machine.  I usually assign ssh to a non-standard port (something other than port 22), as I've noticed brute force attacks occur there.  Change the sshd port by editing /etc/ssh/sshd_config and restart the ssh service.  Keep in mind that you can have a service running on the machine but still exclude access to it from via your security group.
Consider Fail2ban or alternatives to deflect brute force ssh attempts.
Don't overlook the obvious.  I've watched attacks probe the standard LAMP stuff, checking for common passwords.  Create user accounts with: sudo adduser --disabled-password, then copy your public key to the instance.  Avoid services (ftp) that don't use a secure connection.  My preference is to run web services over https rather than http.
I've not even scratched the surface, but if you apply a few commonsense procedures, you should avoid the most common generic attacks.


text:
Q: SQL statement to find last word in string I have a table with a text field that contains one or more words, separated by spaces. I want to isolate the last word in that text field. For example if the table contained:
|col1 |
+-----+
|a    |
|b c  |
|d e f|

I want a query that will return:
|result|
+------+
|a     |
|c     |
|f     |

Thanks in advance!
Barry
P.S. I am running MySQL 5.1

A: SELECT SUBSTRING_INDEX(TRIM(col1), ' ', -1) FROM table;

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substring-index


text:
Q: Optimizing the design of a workflow engine database I need help optimizing this design because I don't think it's going to scale well.
Background info
The database is for a workflow engine app. End users create Transactions with different attributes, and a transaction goes through a series of steps based on a subset of its attributes (right now the subset is 3, but it could change in the future).
The number and order of the steps the Transaction goes through comes from routes that I defined. These routes almost never change.
This is the structure of the tables that are used to find a route.

This is what the Transaction table looks like.
CREATE TABLE `Transaction` (
 `TID` int(11) NOT NULL AUTO_INCREMENT,
 `Type` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
 `WavPost` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
 `EmployeeClass` char(1) COLLATE utf8mb4_unicode_ci NOT NULL,
 PRIMARY KEY (`TID`)
)

This is a view I created to generate all possible routes (route_vw)
  select
    `d`.`facstaff` AS `facstaff`,
    `f`.`waveposted` AS `waveposted`,
    `h`.`tempreg` AS `tempreg`,
    `j`.`step_name` AS `step_name`,
    `i`.`route_step_id` AS `route_step_id`,
    `i`.`route_id` AS `route_id`,
    `i`.`step_id` AS `step_id`,
    `i`.`ndx` AS `ndx`,
    `i`.`on_time` AS `on_time`,
    `i`.`behind` AS `behind`,
    `i`.`late` AS `late`
from
    (
        (
            (
                (
                    (
                        (
                            (
                                (
                                    `route_defn` `a`
                                    join `fac_staff_list` `c` on(
                                        (
                                            `a`.`fac_staff_list_id` = `c`.`fac_staff_list_id`
                                        )
                                    )
                                )
                                join `fac_staff` `d` on(
                                    (
                                        `c`.`fac_staff_list_id` = `d`.`fac_staff_list_id`
                                    )
                                )
                            )
                            join `wave_post_list` `e` on(
                                (
                                    `a`.`wave_post_list_id` = `e`.`wave_post_list_id`
                                )
                            )
                        )
                        join `wave_post` `f` on(
                            (
                                `e`.`wave_post_list_id` = `f`.`wave_post_list_id`
                            )
                        )
                    )
                    join `temp_reg_list` `g` on(
                        (
                            `a`.`temp_reg_list_id` = `g`.`temp_reg_list_id`
                        )
                    )
                )
                join `temp_reg` `h` on(
                    (
                        `g`.`temp_reg_list_id` = `h`.`temp_reg_list_id`
                    )
                )
            )
            join `route_step` `i` on(
                (
                    `a`.`route_defn_id` = `i`.`route_id`
                )
            )
        )
        join `step_defn` `j` on(
            (
                `i`.`step_id` = `j`.`step_defn_id`
            )
        )
    )

This is how I find the route for a (the) Transaction(s).
select *
from `Transaction` `A`
join `route_vw` `B`
on (
    (`B`.`facstaff` = `A`.`EmployeeClass`)
    and (`B`.`waveposted` = `A`.`WavPost`)
    and (`B`.`tempreg` = `A`.`Type`)
)

Problem
Array
(
    [EVENT_ID] => 4
    [Duration] => 0.003877
    [SQL_TEXT] => SELECT *
FROM Transaction A
INNER JOIN route_vw D on (
A.EmployeeClass = D.facstaff AND
A.WavPost = D.waveposted AND
A.Type = D.tempreg
)
    [DIGEST_TEXT] => SELECT `d` . `facstaff` AS `facstaff` , `f` . `waveposted` AS `waveposted` , `h` . `tempreg` AS `tempreg` , `j` . `step_name` AS `step_name` , `i` . `route_step_id` AS `route_step_id` , `i` . `route_id` AS `route_id` , `i` . `step_id` AS `step_id` , `i` . `ndx` AS `ndx` , `i` . `on_time` AS `on_time` , `i` . `behind` AS `behind` , `i` . `late` AS `late` FROM ( ( ( ( ( ( ( ( `UchihaTigerTalent` . `route_defn` `a` JOIN `UchihaTigerTalent` . `fac_staff_list` `c` ON ( ( `a` . `fac_staff_list_id` = `c` . `fac_staff_list_id` ) ) ) JOIN `UchihaTigerTalent` . `fac_staff` `d` ON ( ( `c` . `fac_staff_list_id` = `d` . `fac_staff_list_id` ) ) ) JOIN `UchihaTigerTalent` . `wave_post_list` `e` ON ( ( `a` . `wave_post_list_id` = `e` . `wave_post_list_id` ) ) ) JOIN `UchihaTigerTalent` . `wave_post` `f` ON ( ( `e` . `wave_post_list_id` = `f` . `wave_post_list_id` ) ) ) JOIN `UchihaTigerTalent` . `temp_reg_list` `g` ON ( ( `a` . `temp_reg_list_id` = `g` . `temp_reg_list_id` ) ) ) JOIN
    [NO_INDEX_USED] => 0
    [NO_GOOD_INDEX_USED] => 0
    [ROWS_AFFECTED] => 0
    [ROWS_SENT] => 214
    [ROWS_EXAMINED] => 820
)

These stats were taken when Transaction had 14 rows. Based on the ROWS_EXAMINED I don't think this method is going to scale up well. Is there a better way to write this so that I don't have to examine so many rows?
Note: I uploaded a db-fiddle.com demo.
Update 1
Question - "I don't understand your 1-column "*_list" tables."
Answer - The *_lists tables allows me to specify and reuse a set/list of values that a route should be used for.
E.G

Route #4 (route_defn.route_defn_id = 4) is applicable to Staff transactions.
Route #5 is applicable to Faculty transactions.
A route with fac_staff_list_id = 3 is applicable to both Faculty and Staff transactions.  * Note there are no routes with a fac_staff_list_id = 3.
This logic and structure applies to temp_reg_list and wave_post_list as well.
Update 2
"No intermediate table (*_list) is needed in a 1:many mapping. The fac_staff table simply needs a column route_defn_id. Get rid of the intervening fac_staff_list. (Ditto for other 1:many relationships.)" - @rick-james
"Please provide EXPLAIN SELECT ... and SHOW CREATE TABLE" - @rick-james
The updated schema below is based on the suggestions from @rick-james.

show create view route_vw
CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `route_vw` AS select `fac_staff`.`facstaff` AS `facstaff`,`wave_post`.`waveposted` AS `waveposted`,`temp_reg`.`tempreg` AS `tempreg`,`route_step`.`route_step_id` AS `route_step_id`,`route_step`.`route_id` AS `route_id`,`route_step`.`step_id` AS `step_id`,`route_step`.`ndx` AS `ndx`,`route_step`.`on_time` AS `on_time`,`route_step`.`behind` AS `behind`,`route_step`.`late` AS `late` from ((((`route_defn` join `fac_staff` on((`route_defn`.`route_defn_id` = `fac_staff`.`route_defn_id`))) join `wave_post` on((`route_defn`.`route_defn_id` = `wave_post`.`route_defn_id`))) join `temp_reg` on((`route_defn`.`route_defn_id` = `temp_reg`.`route_defn_id`))) join `route_step` on((`route_defn`.`route_defn_id` = `route_step`.`route_id`)))

show create table route_defn
CREATE TABLE `route_defn` (
 `route_defn_id` int(11) NOT NULL AUTO_INCREMENT,
 PRIMARY KEY (`route_defn_id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

show create table fac_staff
CREATE TABLE `fac_staff` (
  `fs_id` int(11) NOT NULL AUTO_INCREMENT,
  `route_defn_id` int(11) NOT NULL,
  `facstaff` varchar(1) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`fs_id`),
  UNIQUE KEY `route_defn_id` (`route_defn_id`,`facstaff`),
  KEY `facstaff` (`facstaff`),
  CONSTRAINT `fac_staff_ibfk_1` FOREIGN KEY (`route_defn_id`) REFERENCES `route_defn` (`route_defn_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

show create table wave_post
CREATE TABLE `wave_post` (
  `wp_id` int(11) NOT NULL AUTO_INCREMENT,
  `route_defn_id` int(11) NOT NULL,
  `waveposted` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`wp_id`),
  UNIQUE KEY `route_defn_id` (`route_defn_id`,`waveposted`),
  KEY `waveposted` (`waveposted`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

show create table Transaction
CREATE TABLE `Transaction` (
  `TID` int(11) NOT NULL AUTO_INCREMENT,
  `Type` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `RequestType` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `WavPost` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `IncSupPosition` int(8) unsigned zerofill NOT NULL,
  `IncSupEmplid` int(6) unsigned zerofill NOT NULL,
  `Supervisor` varchar(55) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Phone` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `Location` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `HireMgrName` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
  `HireMgrEmail` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `Comment` varchar(1000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `Title` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `SalaryStart` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `PositionJustification` varchar(1500) COLLATE utf8mb4_unicode_ci NOT NULL,
  `InternalComparison` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `AdditionalDuties` varchar(1000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ReducedTask` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `PositionNumber` int(8) unsigned zerofill DEFAULT NULL,
  `StatePosition` varchar(8) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `JobReqID` varchar(8) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `JobCode` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `DepartmentID` int(4) unsigned zerofill NOT NULL,
  `DepartmentName` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
  `BudgetCenter` varchar(4) COLLATE utf8mb4_unicode_ci NOT NULL,
  `FullPart` varchar(1) COLLATE utf8mb4_unicode_ci NOT NULL,
  `StandardHours` float NOT NULL,
  `IncumbentEmplid` int(6) unsigned zerofill DEFAULT NULL,
  `IncumbentName` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `PreHireEscalate` int(11) NOT NULL DEFAULT ''1'',
  `CountyCode` int(2) unsigned zerofill NOT NULL,
  `StateCode` varchar(2000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `EmployeeClass` char(1) COLLATE utf8mb4_unicode_ci NOT NULL,
  `SubmittedBy` varchar(8) COLLATE utf8mb4_unicode_ci NOT NULL,
  `TimeStamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`TID`),
  UNIQUE KEY `TID` (`TID`,`Type`,`WavPost`,`EmployeeClass`),
  KEY `BudgetCenter` (`BudgetCenter`),
  KEY `HireMgrEmail` (`HireMgrEmail`),
  KEY `SubmittedBy` (`SubmittedBy`),
  KEY `Type` (`Type`),
  KEY `EmployeeClass` (`EmployeeClass`),
  KEY `WavPost` (`WavPost`),
  KEY `Type_2` (`Type`,`WavPost`,`EmployeeClass`)
) ENGINE=InnoDB AUTO_INCREMENT=6380 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

show create table temp_reg
CREATE TABLE `temp_reg` (
  `tr_id` int(11) NOT NULL AUTO_INCREMENT,
  `route_defn_id` int(11) NOT NULL,
  `tempreg` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`tr_id`),
  UNIQUE KEY `route_defn_id` (`route_defn_id`,`tempreg`),
  KEY `tempreg` (`tempreg`),
  KEY `rotue_defn_id` (`route_defn_id`),
  CONSTRAINT `temp_reg_ibfk_1` FOREIGN KEY (`route_defn_id`) REFERENCES `route_defn` (`route_defn_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=84 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

show create table route_step
CREATE TABLE `route_step` (
  `route_step_id` int(11) NOT NULL AUTO_INCREMENT,
  `route_id` int(11) NOT NULL,
  `step_id` int(11) NOT NULL,
  `ndx` int(11) NOT NULL,
  `on_time` tinyint(1) DEFAULT NULL,
  `behind` tinyint(1) DEFAULT NULL,
  `late` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`route_step_id`),
  UNIQUE KEY `route_id_2` (`route_id`,`step_id`,`ndx`),
  KEY `step_id` (`step_id`),
  KEY `ndx` (`ndx`),
  KEY `route_id` (`route_id`),
  CONSTRAINT `route_step_ibfk_1` FOREIGN KEY (`step_id`) REFERENCES `step_defn` (`step_defn_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `route_step_ibfk_2` FOREIGN KEY (`route_id`) REFERENCES `route_defn` (`route_defn_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

A:
1 route is applicable many fac_staff types.

No intermediate table (*_list) is needed in a 1:many mapping.  The fac_staff table simply needs a column route_defn_id.  Get rid of the intervening fac_staff_list.  (Ditto for other 1:many relationships.)


text:
Q: CSS: content that overflows div Actually I don't know how to find solution to this problem and how to name it.
Here's the link to my site:
http://www.portalpraktyk.pl/podstrona_itp
The problem is that I have page divided into 3 standard parts: top, content, footer. Between content and footer there's also facebook div to put social plug-in. What happens is that content of both divs (facebook and footer) stays under content div, but both divs actually goes up to content area (you can see dark background div right under header and behind content div).
I won't show you a code, because I don't know where the problem is. The best way is to check how this is written with web developer and firebug browser plugins.
Does anybody know solution to this problem?

A: You need to clear your floats right after your #content div closes.

A: Your problem is a classic problem of floats not clearing.
Look for information on .clearfix.
Basically the div#contents, has a height of 0, because #box_left and #box_right are floated, so div#contents is not containing them, and because of this your page gets all messed up.
Another tip is that instead of using position:relative and asigning a top:30px value, use margin-top:30px.


text:
Q: Windows firewall - block all incoming connections enable/disable - CREATE SCRIPT Is it possible to create script which enable/disable the first checkbox of windows 7 firewall settings (Block all incoming connections....)?

A: enable:
netsh advfirewall set domainprofile firewallpolicy blockinboundalways,allowoutbound

disable:
netsh advfirewall set domainprofile firewallpolicy blockinbound,allowoutbound


text:
Q: How to remove data from string builder Hi i all having a requirement to delete particular data from a text file. I have written some code to get my exact data to remove but now i am little bit confused in removing that particular data can any one help me.
Initially this is my data in text file where i am storing to a Stringbuilder
101 111111111 1111111111110150105A094101

52201               1                   1         PPD1         111015111015   1111000020000001

6241110000251                00000000011              1                     1 0111000020000001

822000000100111000020000000000000000000000011                                  111000020000001

52251               1                   1         PPD1         011015111015   1111000020000002

6281110000251                00000000011              1                     1 0111000020000002

822500000100111000020000000000010000000000001                                  111000020000002

9000002000001000000020022200004000000000001000000000001

Now by using certain code i am getting the data to delete i.e assume i would like to delete from 5 to 8 which exists. I am storing this to another StringBuilder as follows
52251               1                   1         PPD1         011015111015   1111000020000002

6281110000251                00000000011              1                     1 0111000020000002

822500000100111000020000000000010000000000001                                  111000020000002

I would like to remove this from the main Stringbuilder i am having. Is this the correct process or if any better way let me know

A: You could use StringBuilder.Replace.
sb1.Replace(sb2.ToString(), "");

But better is to iterate over the data you wish to keep and serialize it to the file again. Take care to overwrite the file atomically if you don't want to risk losing data if the computer crashes while you are saving.


text:
Q: Returning XML natively in a .NET (C#) webservice? I realize that SOAP webservices in .NET return XML representation of whatever object the web method returns, but if I want to return data formatting in XML what is the best object to store it in?
I am using the answer to this question to write my XML, here is the code:
XmlWriter writer = XmlWriter.Create(pathToOutput);
writer.WriteStartDocument();
writer.WriteStartElement("People");

writer.WriteStartElement("Person");
writer.WriteAttributeString("Name", "Nick");
writer.WriteEndElement();

writer.WriteStartElement("Person");
writer.WriteStartAttribute("Name");
writer.WriteValue("Nick");
writer.WriteEndAttribute();
writer.WriteEndElement();

writer.WriteEndElement();
writer.WriteEndDocument();

writer.Flush();

Now I can return this output as a String to my calling webmethod, but it shows up as <string> XML HERE </string>, is there anyway to just return the full xml?
Please in your answer, give an example of how to use said object with either XmlWriter or another internal object (if you consider XmlWriter to be a poor choice). The System.Xml package (namespace) has many objects, but I haven't been able to uncover decent documentation on how to use the objects together, or what to use for what situations.

A: This is how I ended up doing it;
StringBuilder sb = new StringBuilder();
XmlWriter writer = XmlWriter.Create(sb, settings);

writer.WriteStartDocument();
writer.WriteStartElement("People");

writer.WriteStartElement("Person");
writer.WriteAttributeString("Name", "Nick");
writer.WriteEndElement();

writer.WriteStartElement("Person");
writer.WriteStartAttribute("Name");
writer.WriteValue("Nick");
writer.WriteEndAttribute();
writer.WriteEndElement();

writer.WriteEndElement();
writer.WriteEndDocument();

writer.Flush();

XmlDocument xmlDocument = new XmlDocument();
xmlDocument.LoadXml(sb.ToString());
return xmlDocument;

May not be the best method, but it appears to be working. Let me know if you have a better method. Thanks.

A: Just return a XmlDocument. e.g.
[WebMethod]
public XmlDocument Quux()
{

}

A: XmlElement, not XmlDocument.
Return an XmlElement.

A: you can have a class that represent your XML and return that class or also return your xml inside an XMLNode


text:
Q: non-sequential index collection I have a collection of objects that I need an Iterator over that can go through the objects in order (both forward and back) but can also go to any object when given the index of that object (which represents the lesson number of an assignment).
However, The index for each Object needs to be specifically predefined, in order, and there is no guarantee that my list of objects will have sequential indexes (I could have the indexes 0, 1, 6, 9 for example).
I currently have an ArrayList() which I am instantiating with the largestIndex I expect to be possible as the initial capacity, but I keep getting ArrayIndexOutOfBounds exception whenever I try to use the add(index, Object) method on my ArrayList
my code looks like this:
    int largestIndex = unindexedAssignments.get(unindexedAssignments.size() - 1).getAssignmentID();
    //index of 0 is ignored so add +1 to make sure we have enough space
    assignments = new ArrayList<>(largestIndex + 1);

    System.out.println("LargestIndex: " + (largestIndex + 1));

    //populate assignments List
    for(Assignment assignment : unindexedAssignments) {
        //add the assignment to the list such that the index == the lesson number
        System.out.println("adding assignment with index of " + assignment.getAssignmentID());
        assignments.add(assignment.getAssignmentID(), assignment);
    }

and the console spits out something like this (windows cmdpromt does not support copy/paste >_<):
largestIndex: 3
adding assignment with index of 1
java.lang.IndexOutOfBoundsException: Index 1, Size: 0
    at java.util.ArrayList.rangeCheckForAdd(Unkown Source)
    at java.util.ArrayList.add(Unknown Source)
    (the rest of the stack trace pointing to the section of code I gave above ...)

I don't why the Size == 0 when I created what should have been an ArrayList with size 4?
A related question: am I misusing an ArrayList (and it's ListIterator) when there is a better default Java collection to use for this circumstance? The desired end-result is that my object has an Iterator object which is able to traverse back and forth and goto a specific location (right now I would just create a new ListIterator at the given index if it exist)

A: Lists do not support sparse indices. If you want to add to an index that's past the end of the list, you have to create all of the intermediate indices as well.
Use a SortedMap. Maps are perfect for when you have non-contiguous indices. You can look up any assignment by its lesson number, and you can iterate over all the key-value pairs in order.
SortedMap<Integer, Assignment> assignments = new TreeMap<>();

for (Assignment assignment: unindexedAssignments) {
    assignments.put(assignment.getAssignmentID(), assignment);
}

You could also use Java 8 streaming syntax as an alternative to an explicit loop.
Map<Integer, Assignment> assignments = unindexedAssignments.stream()
    .collect(Collectors.toMap(
        a -> a.getAssignmentID(),  // keys
        a -> a,                    // values
        (a, b) -> throw new IllegalStateException("duplicate lesson number"),
                                   // what to do if two items have the same key
        TreeMap::new               // map class constructor
    ));


text:
Q: What is a right way of creating apps into django project? (doubts about file location) I have doubts about a right file location into a django project.
Prologue
Let's imaging, I'm going to create an ecommerce web app "consumer-to-consumer". One user can sell something and other one can buy it.
Even though the app is big, assume that it contains a detail page of the product and a page with list of products.
A user can add, delete, update images of his product. The app helps him resize images, put some filters and effects.
Moreover, a user can add comment about any product, review, image, seller, and he can send comments to support e.t.c.
If a user have a lot of products the app automatically create a XML feed which will be sent to another "consumer-to-consumer" websites to increase shows of the user's ads and increase sales.
Development
Firstly, I start project and than start app "products".
The question is: should I  create an own app for comment or images or a xml feed? Or should I put all code into products/forms.py and products/views.py of "product".
The first variant is:
project
  products
    views.py
    models.py
    forms.py
    ...

The second one is:
project
  products
    templates
    views.py
    models.py
    forms.py
    ...
  comments
    templates
    views.py
    ...
  xml_feed
    templates
    views.py
    ...

Question
What is the best approach to it? What rules do you use to understand that this stuff is for one app and this isn't?

A: A Django apps is usually a self-contained group of configurations, classes, views, templates and urls (all optional, of course), although it always has dependencies. They may be inserted or removed from a project at will.
Given that definition, it makes sense to question: Does the next implementation refer to a functionality of my current app? Or is it a complete new thing?
As a helper, think of the Django administration site: Is it logical to put your new models inside the same group (app)? Or should it be a new set of models?


text:
Q: pandas groupby difference in days, subset, combination on another column I have a mobile repair data as shown below.
Which is sorted based on ID and Date.
ID  Status  Date    Cost
0   1   F   2017-06-22  500
1   1   M   2017-07-22  100
7   1   F   2018-06-22  600
9   1   M   2018-08-22  150
10  1   F   2019-03-22  750
2   2   M   2017-06-29  200
5   2   F   2017-09-29  600
6   2   F   2018-01-29  500
16  2   M   2018-03-29  100
17  2   M   2018-04-29  100
18  2   F   2018-12-29  500
3   3   M   2017-03-20  300
8   3   F   2018-06-20  700
11  3   M   2018-10-20  250
4   4   M   2017-08-10  800
12  4   F   2018-06-10  100
13  4   F   2018-10-10  500
14  4   M   2019-01-10  200
15  4   F   2019-06-10  600

F - Failure
M - Maintenance
Q1) My aim is to find out the impact of M(Maintenance) in increasing the duration for F (failure).
ie. How failure time is varying with a Maintenance in between them.
df['D'] = df.groupby('ID')['Date'].diff().dt.days

First I am trying to subset the above data frame with consecutive F-F pattern as shown below
F-F pattern (consecutive F-F - ID wise)
ID  Status  Date    Cost
5   2   F   2017-09-29  600
6   2   F   2018-01-29  500
12  4   F   2018-06-10  100
13  4   F   2018-10-10  500

Please help me the code in pandas to get above subset.
And similarly I would like to subset M-F, F-M and M-M pattern and analyse the duration. Please propose your thoughts apart from subsetting,  to solve this problem.
Expected F-M subset
ID  Status  Date    Cost
0   1   F   2017-06-22  500
1   1   M   2017-07-22  100
7   1   F   2018-06-22  600
9   1   M   2018-08-22  150
6   2   F   2018-01-29  500
16  2   M   2018-03-29  100
8   3   F   2018-06-20  700
11  3   M   2018-10-20  250
13  4   F   2018-10-10  500
14  4   M   2019-01-10  200

A: Use:
#convert to datetimes and sorting
df['Date'] = pd.to_datetime(df['Date'])
df = df.sort_values(['ID', 'Date', 'Status'])

#differenc column
df['D'] = df.groupby('ID')['Date'].diff().dt.days
#create statust column with next and previous values per groups
df['S1'] = df.groupby('ID')['Status'].shift() + '-'+ df['Status']
df['S2'] = df['Status']  + '-'+ df.groupby('ID')['Status'].shift(-1)

#filter by boolean indexing
pat = 'F-F'
df1 = df[df['S1'].eq(pat) | df['S2'].eq(pat)]
print (df1)
    ID Status       Date  Cost      D   S1   S2
5    2      F 2017-09-29   600   92.0  M-F  F-F
6    2      F 2018-01-29   500  122.0  F-F  M-F
12   4      F 2018-06-10   100  304.0  M-F  F-F
13   4      F 2018-10-10   500  122.0  F-F  M-F

pat = 'F-M'
df1 = df[(df['S1'].eq(pat) | df['S2'].eq(pat))]
print (df1)
    ID Status       Date  Cost      D   S1   S2
0    1      F 2017-06-22   500    NaN  NaN  F-M
1    1      M 2017-07-22   100   30.0  F-M  M-F
7    1      F 2018-06-22   600  335.0  M-F  F-M
9    1      M 2018-08-22   150   61.0  F-M  M-F
6    2      F 2018-01-29   500  122.0  F-F  F-M
16   2      M 2018-03-29   100   59.0  F-M  M-M
8    3      F 2018-06-20   700  457.0  M-F  F-M
11   3      M 2018-10-20   250  122.0  F-M  NaN
13   4      F 2018-10-10   500  122.0  F-F  F-M
14   4      M 2019-01-10   200   92.0  F-M  M-F


text:
Q: What is the encoding used for Khmer Language I want to know what encoding is used for Khmer Language (Official language of Cambodia). Is it UTF-8 or UTF-16.

A: A language doesn't have an encoding. What it might have is a set of characters that are commonly used when writing in that language. Some encodings only support subsets of Unicode, but both UTF-8 and UTF-16 can encode all Unicode characters, so either will work (i.e. will allow you to represent anything in Unicode) if you have the ability to choose which to use. (If you want characters which aren't in Unicode, neither UTF-8 nor UTF-16 is going to help you.)
I would typically use UTF-8 as a default - pretty much every platform supports UTF-8, whereas UTF-16 is slightly less well supported. On the other hand, you may find that there are lots of characters used by Khmer which take two bytes to encode in UTF-16 but three bytes in UTF-8, making UTF-8 take a bit more space. You should investigate this by encoding sample documents in both encodings if space is important to you.