text:
Q: Adding a user to a group using django rest framework programmatically I want to be able to attach a user to a group upon creation.
Here is the result of select * from auth_group:

Here is the my serializer.py file:
from rest_framework import serializers

from .models import User

class UserSerializer(serializers.ModelSerializer):

class Meta(object):
    model = User
    fields = ('id', 'email', 'first_name', 'last_name', 'phone', 'address', 'is_active', 'is_staff',
              'is_superuser', 'date_joined', 'password',)
    extra_kwargs = {'password': {'write_only': True}}

Here is my model.py file:
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
from django.contrib.auth.models import PermissionsMixin, UserManager, Group
from django.db import models, transaction

# Create your models here.
from django.utils import timezone

class UserManager(BaseUserManager):

    def _create_user(self, email, password, **extra_fields):
    """
    Creates and saves a User with the given email,and password.
    """
    if not email:
        raise ValueError('User must have an email address')
    email = self.normalize_email(email)
    if not extra_fields["group_id"]:
        raise ValueError('User must have group id')
    try:
        with transaction.atomic():
            user = self.model(email=email, **extra_fields)
            group = Group.objects.get(extra_fields["group_id"])
            group.user_set.add(user)
            user.set_password(password)
            user.save(using=self._db)
            return user
    except:
        raise

def create_user(self, email, password=None, **extra_fields):
    extra_fields.setdefault('is_staff', False)
    extra_fields.setdefault('is_superuser', False)
    return self._create_user(email, password, **extra_fields)

def create_superuser(self, email, password, **extra_fields):
    extra_fields.setdefault('is_staff', True)
    extra_fields.setdefault('is_superuser', True)

    return self._create_user(email, password=password, **extra_fields)

class User(AbstractBaseUser, PermissionsMixin):
"""
An abstract base class implementing a fully featured User model with
admin-compliant permissions.

"""
email = models.EmailField(max_length=40, unique=True)
first_name = models.CharField(max_length=30, blank=True)
last_name = models.CharField(max_length=30, blank=True)
phone = models.CharField(max_length=20, blank=True)
address = models.CharField(max_length=30, blank=True)
is_active = models.BooleanField(default=True)
is_staff = models.BooleanField(default=False)
date_joined = models.DateTimeField(default=timezone.now)

objects = UserManager()

USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['first_name', 'last_name', 'phone']

def get_full_name(self):
    """" Used to display user's full name """
    return "{}, {}".format(self.first_name, self.last_name)

def __srt__(self):
    return self.email

def save(self, *args, **kwargs):
    super(User, self).save(*args, **kwargs)
    return self

And finally, here is my view.py:
class CreateUserAPIView(APIView):
# Allow any user (authenticated or not) to access this url
permission_classes = (AllowAny,)

def post(self, request):
    user = request.data
    serializer = UserSerializer(data=user)
    serializer.is_valid(raise_exception=True)
    serializer.save()
    return Response({"user": serializer.data, "status": status.HTTP_200_OK})

I want for this request:
{
"email": "myemail@gmail.com",
"first_name": "myfirst_name",
"last_name": "mylast_name",
"phone": "000556660",
"address": "myaddress",
"password": "mypassword",
"group_id": 5
}

To get this response:
{
"status": 200,
user: {
"email": "myemail@gmail.com",
"first_name": "myfirst_name",
"last_name": "mylast_name",
"phone": "000556660",
"address": "myaddress",
"password": "mypassword",
"groups": [5]
}
}

I have followed this link Adding a user to a group in django but it's not helping me.
Thanks, any help would be appreciated.

A: Try this :
class UserSerializers(serializers.ModelSerializer):
# groups = GroupSerializer(many=True)

class Meta:
    model = User
    fields = ('id', 'email', 'first_name', 'last_name', 'phone', 'address', 'is_active', 'is_staff',
          'is_superuser', 'date_joined', 'password', 'groups')

def create(self, validated_data):
    groups_data = validated_data.pop('groups')
    user = User.objects.create(**validated_data)
    for group_data in groups_data:
        # Group.objects.create(user=user, **group_data)
        user.groups.add(group_data)
    return user

Edit:  Because User and Group are in many-to-many relations so you can directly add the group field in the users serializers. For more details follow django.contrib.auth.models package and User inherits AbstactUser and AbstractUser inherits PermissionsMixin which has groups as many to many field.


text:
Q: Generic UITableView keyboard resizing algorithm I've searched a lot for code that resizes the table view to accomodate for keyboard showing and hiding, but almost every single post i came across assumes that the table view is taking the entire view of its view controller. I have an iPad application where the table view is only taking part of the screen. What's the correct way to resize the table view in this case? (all the code in the posts i've mentioned above fails)

A: I've found the easiest solution to be this one(I'm not fan of using subviews for this kind of stuff):
register for keyboard frame change notification(idealy register in viewWillAppear: and unregister in viewWillDisappear:):
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidChangeFrame:) name:UIKeyboardDidChangeFrameNotification object:nil];

and then in method:
- (void)keyboardDidChangeFrame:(NSNotification*)aNotification
{
    NSDictionary* info = [aNotification userInfo];
    UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
    CGRect kbFrame = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
    CGRect kbIntersectFrame = [window convertRect:CGRectIntersection(window.frame, kbFrame) toView:self.scrollView];
    kbIntersectFrame = CGRectIntersection(self.bounds, kbIntersectFrame);

    UIEdgeInsets contentInsets = UIEdgeInsetsMake(0.0, 0.0, kbIntersectFrame.size.height, 0.0);
    self.scrollView.contentInset = contentInsets;
    self.scrollView.scrollIndicatorInsets = contentInsets;
}

or if You want to get rid of the "jump" after changing contentInset:
- (void)keyboardDidChangeFrame:(NSNotification*)aNotification
{
    NSDictionary* info = [aNotification userInfo];
    UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
    CGRect kbFrame = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
    CGRect kbIntersectFrame = [window convertRect:CGRectIntersection(window.frame, kbFrame) toView:self.scrollView];
    kbIntersectFrame = CGRectIntersection(self.scrollView.bounds, kbIntersectFrame);

    // get point before contentInset change
    CGPoint pointBefore = self.scrollView.contentOffset;
    UIEdgeInsets contentInsets = UIEdgeInsetsMake(0.0, 0.0, kbIntersectFrame.size.height, 0.0);
    self.scrollView.contentInset = contentInsets;
    self.scrollView.scrollIndicatorInsets = contentInsets;
    // get point after contentInset change
    CGPoint pointAfter = self.scrollView.contentOffset;
    // avoid jump by settings contentOffset
    self.scrollView.contentOffset = pointBefore;
    // and now animate smoothly
    [self.scrollView setContentOffset:pointAfter animated:YES];
}

A: The simple solution is to add my extension UIViewController+Keyboard.swift to your project, with a single line setupKeyboardNotifcationListenerForScrollView(tableView) it will auto resize automatically. No need to subclass anything, just an extension! Its open source at SingleLineKeyboardResize

A: Simple solution - register to receive keyboard notifications on init or viewDidLoad with:
[[NSNotificationCenter defaultCenter] addObserver:self
                                       selector:@selector(keyboardWillShow:)
                                           name:UIKeyboardWillShowNotification
                                         object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
                                       selector:@selector(keyboardWillHide:)
                                           name:UIKeyboardWillHideNotification
                                         object:nil];

then when the notification is received, you can use the given rect of the keyboard to adjust the frame of your tableView:
- (void)keyboardWillShow:(NSNotification *)notification
{
   // Get the size of the keyboard.
   CGSize keyboardSize = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;

   CGRect newTableFrame = _myTableView.frame;
   //Here make adjustments to the tableview frame based on the value in keyboard size
   ...

   _myTableView.frame = newTableFrame;
}

- (void)keyboardWillHide:(NSNotification *)notification
{
   //Here change the table frame back to what it originally was.
}

A: The following code does what you want and works with any device and any layout. The code is courtesy of the Sensible TableView framework (with permission to copy and use).
- (void)keyboardWillShow:(NSNotification *)aNotification
{
if(keyboardShown)
    return;

keyboardShown = YES;

// Get the keyboard size
UIScrollView *tableView;
if([self.tableView.superview isKindOfClass:[UIScrollView class]])
    tableView = (UIScrollView *)self.tableView.superview;
else
    tableView = self.tableView;
NSDictionary *userInfo = [aNotification userInfo];
NSValue *aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
CGRect keyboardRect = [tableView.superview convertRect:[aValue CGRectValue] fromView:nil];

// Get the keyboard's animation details
NSTimeInterval animationDuration;
[[userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] getValue:&animationDuration];
UIViewAnimationCurve animationCurve;
[[userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey] getValue:&animationCurve];

// Determine how much overlap exists between tableView and the keyboard
CGRect tableFrame = tableView.frame;
CGFloat tableLowerYCoord = tableFrame.origin.y + tableFrame.size.height;
keyboardOverlap = tableLowerYCoord - keyboardRect.origin.y;
if(self.inputAccessoryView && keyboardOverlap>0)
{
    CGFloat accessoryHeight = self.inputAccessoryView.frame.size.height;
    keyboardOverlap -= accessoryHeight;

    tableView.contentInset = UIEdgeInsetsMake(0, 0, accessoryHeight, 0);
    tableView.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, accessoryHeight, 0);
}

if(keyboardOverlap < 0)
    keyboardOverlap = 0;

if(keyboardOverlap != 0)
{
    tableFrame.size.height -= keyboardOverlap;

    NSTimeInterval delay = 0;
    if(keyboardRect.size.height)
    {
        delay = (1 - keyboardOverlap/keyboardRect.size.height)*animationDuration;
        animationDuration = animationDuration * keyboardOverlap/keyboardRect.size.height;
    }

    [UIView animateWithDuration:animationDuration delay:delay
                        options:UIViewAnimationOptionBeginFromCurrentState
                     animations:^{ tableView.frame = tableFrame; }
                     completion:^(BOOL finished){ [self tableAnimationEnded:nil finished:nil contextInfo:nil]; }];
}
}

- (void)keyboardWillHide:(NSNotification *)aNotification
{
if(!keyboardShown)
    return;

keyboardShown = NO;

UIScrollView *tableView;
if([self.tableView.superview isKindOfClass:[UIScrollView class]])
    tableView = (UIScrollView *)self.tableView.superview;
else
    tableView = self.tableView;
if(self.inputAccessoryView)
{
    tableView.contentInset = UIEdgeInsetsZero;
    tableView.scrollIndicatorInsets = UIEdgeInsetsZero;
}

if(keyboardOverlap == 0)
    return;

// Get the size & animation details of the keyboard
NSDictionary *userInfo = [aNotification userInfo];
NSValue *aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
CGRect keyboardRect = [tableView.superview convertRect:[aValue CGRectValue] fromView:nil];

NSTimeInterval animationDuration;
[[userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] getValue:&animationDuration];
UIViewAnimationCurve animationCurve;
[[userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey] getValue:&animationCurve];

CGRect tableFrame = tableView.frame;
tableFrame.size.height += keyboardOverlap;

if(keyboardRect.size.height)
    animationDuration = animationDuration * keyboardOverlap/keyboardRect.size.height;

[UIView animateWithDuration:animationDuration delay:0
                    options:UIViewAnimationOptionBeginFromCurrentState
                 animations:^{ tableView.frame = tableFrame; }
                 completion:nil];
}

- (void) tableAnimationEnded:(NSString*)animationID finished:(NSNumber *)finished contextInfo:(void *)context
{
// Scroll to the active cell
if(self.activeCellIndexPath)
{
    [self.tableView scrollToRowAtIndexPath:self.activeCellIndexPath atScrollPosition:UITableViewScrollPositionNone animated:YES];
    [self.tableView selectRowAtIndexPath:self.activeCellIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
}
}

Notes:
a. The above two methods have been added to the notification center using the following code:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];

b. The ivars used above has been declared like this:
BOOL keyboardShown;
CGFloat keyboardOverlap;

c. 'self.activeCellIndexPath' is always set to the indexPath of the cell owning the currently active UITextField/UITextView.
Enjoy! :)

A: Check out this project, it's drag and drop so just declare the tablview as type TPKeyboardAvoidingTableView

A: Here is the keyboard method:
func keyboardControl(notification: NSNotification, isShowing: Bool) {
    var userInfo = notification.userInfo!
    let keyboardRect = userInfo[UIKeyboardFrameEndUserInfoKey]!.CGRectValue
    let curve = userInfo[UIKeyboardAnimationCurveUserInfoKey]!.unsignedIntValue

    let convertedFrame = self.view.convertRect(keyboardRect, fromView: nil)
    let heightOffset = self.view.bounds.size.height - convertedFrame.origin.y
    let options = UIViewAnimationOptions(rawValue: UInt(curve) << 16)
    let duration = userInfo[UIKeyboardAnimationDurationUserInfoKey]!.doubleValue

    //your UITableView bottom constrant
    self.tableViewMarginBottomConstraint.constant = heightOffset

    var contentInsets = UIEdgeInsetsZero
    if isShowing {
        contentInsets = UIEdgeInsetsMake(0.0, 0.0, (keyboardRect.size.height), 0.0)
    }

    UIView.animateWithDuration(
        duration,
        delay: 0,
        options: options.union(.LayoutSubviews).union(.BeginFromCurrentState),
        animations: {
            self.listTableView.contentInset = contentInsets
            self.listTableView.scrollIndicatorInsets = contentInsets
            self.listTableView.scrollBottomToLastRow()
            self.view.layoutIfNeeded()
        },
        completion: { bool in
    })
}

Here is the UITableView extension:
extension UITableView {
    func totalRows() -> Int {
        var i = 0
        var rowCount = 0
        while i < self.numberOfSections {
            rowCount += self.numberOfRowsInSection(i)
            i++
        }
        return rowCount
    }

    var lastIndexPath: NSIndexPath {
        get { return NSIndexPath(forRow: self.totalRows()-1, inSection: 0) }
    }

    func scrollBottomToLastRow() {
        self.scrollToRowAtIndexPath(self.lastIndexPath, atScrollPosition: .Bottom, animated: false)
    }
}

A: You can achieve what you're looking for by using IQKeyboardManager, it's a codeless library, you just have to add it to your Podfile: pod 'IQKeyboardManager' and that's it, it will hand the scrolling effect when the keyboard is shown even if the UITextField/UITextView is not part of a scrollView/tableView.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Dos ComboBox relacionados en un DataGridView en Visual Studio 2012 Tengo este código con un DatagridView y dos ComboBox, uno Provincia y el Otro Ciudad, necesito que al elegir la provincia en el primer combo, el segundo combo me muestre las ciudades correspondientes a esa provincia
Imports System.Data
Imports System.Data.SqlClient
Imports System.Windows.Forms

Public Class Form1
    Dim CBC2 As New DataGridViewComboBoxCell
    Dim bsProvincia As New BindingSource
    Dim bsProvCiudad As New BindingSource

    Dim CONN As New SqlClient.SqlConnection
    Dim DAprovincia As New SqlDataAdapter
    Dim DAciudad As New SqlDataAdapter
    Dim DS As New DataSet
    Dim DT As New DataTable

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        CONN.ConnectionString = ("Data Source=INFONET\INFOSISTEMAS;Initial Catalog=Localidades;Integrated Security=True")
        CONN.Open()

        Dim DAprovincia = New SqlDataAdapter("SELECT * FROM Provincia", CONN)
        Dim DAciudad = New SqlDataAdapter("SELECT * FROM Ciudad", CONN)

        DAprovincia.Fill(DS, "Provincia")
        DAciudad.Fill(DS, "Ciudad")

        Dim rel As New DataRelation("provincia_ciudad", DS.Tables("Provincia").Columns("id"), DS.Tables("Ciudad").Columns("provincia_id"))
        DS.Relations.Add(rel)
        '--------------------------------------------------------------------------------------------------------------

        Dim bsProvincia As New BindingSource
        bsProvincia.DataSource = DS
        bsProvincia.DataMember = "provincia"

        With mProvincia
            .DataSource = bsProvincia 'DS.Tables(0).DefaultView
            .DisplayMember = "provincia_nombre"
            .ValueMember = "id"
        End With

        Dim bsProvCiudad As New BindingSource
        bsProvCiudad.DataSource = bsProvincia
        bsProvCiudad.DataMember = "provincia_ciudad"

        With mCiudad
            .DataSource = DS.Tables(1).DefaultView
            .DisplayMember = "ciudad_nombre"
            .ValueMember = "provincia_id"
        End With

    End Sub

End Class


text:
Q: Accessing private methods inside a singleton class methods in Ruby If I have a ruby class similar to this:
class MyClass
  def self.singleton_method
    do_something_private
  end

  private

  def do_something_private
    puts "doing something private"
  end
end

And I call MyClass.singleton_method
Then I get this error:
NoMethodError (undefined method `do_something_private' for MyClass:Class):

How can we resolve the error and what is the right way to define private methods which could be called from inside of class methods?

A: That's because do_something_private is defined as the instance method of MyClass. Change it to the class method:
def self.do_something_private
  # do something private
end

Worth reading the note from @Amadan in comments:

Note that private doesn't do anything for class methods, it only makes instance methods private. You need private_class_method def self.do_something_private ... instead.

A: The issue here is that you're calling an instance method from a class method. If you add self to your private method it will become a class method and can be called by the Class name.
Try
self.do_something_private


text:
Q: Writing to a file help in python 2.7 This is my atm, it has a pin code protection thing and can basically run like a normal atm, however i need to make it so it remembers you and your balance everytime you log out and in etc. ive tried doing this with a blank text file(nothing is in the text file) and linked it into my code (as you can see) but it doesnt work, im not sure what i have to add etc. any help?
balance = float(0)

userInput = None

path = 'N:\ATM.txt'
username = 'some_username'

with open(path, 'r') as file:

    for user in file.readlines():
        if user == username:
           print("welcome back")
print("Hello, Welcome to the ATM")
print("")
print("Please begin with creating an account")

name = raw_input("Enter your name: ")

saved_code = str(raw_input("Please enter a 4 digit pin to use as your passcode: "))

try:
    int(saved_code)
    if len(saved_code)!=4:
        raise
except Exception, e:
    print("Error: Pin is not a valid 4 digit code")
    exit()

totalTrails = 3;
currentTrail = 0;
status = 1;

while currentTrail < totalTrails:
    user_code =str(raw_input('Please enter the 4 digit pin on your card:'))
    if user_code==saved_code:
        status=0
        break;
    else:
        currentTrail+=1

if status==0:
    print("correct pin!")
else:
    print("You tried to enter a wrong code more than three times.")
    exit();

print "Hello , welcome to the ATM"

while userInput != "4":
    userInput = raw_input("\n what would you like to do?\n\n     (1)Check balance\n     (2)Insert funds\n" +
    "     (3)Withdraw funds\n     (4)Exit the ATM\n" )

    if userInput == "1":
        print "your balance is", "£" , balance

    elif userInput == "2":
        funds = float(raw_input("Enter how much money you want to add"))
        balance = balance + funds

    elif userInput == "3":
        withdraw = float(raw_input("Enter how much money you want to withdraw..."))
        balance = balance - withdraw

    elif userInput == "4":
        print "Thanks for using the ATM!"

A: You are opening the file in 'r' mode, which means read only, you should use 'r+' if you want to read and write in it.
You are not writing anything to the file - that's done by write() method - in your case
file.write("string I want to write to the file");
After you are done writing to the file, close it - file.close()


text:
Q: Foundation press dropdown in Wordpress remains open all the time Having an issue where my Wordpress dropdown built in the appearance menu section remains open in the primary navigation only on desktop; the mobile menu works as expected.
I'm using Foundation press v.6+. Don't think it's a JS issue since the mobile menu is working and i'm not getting any errors in the console. I have no live site link for an example unfortunately and am just working in localhost.
only active plugin is elementor and default wordpress plugins.
image of what the open drop down looks like
Just trying to find a solution to make the dropdown remain closed until clicked. I have been searching for hours and have found no solutions that work.

A: Turns out , top-bar-right , really dislikes flex properties. removing my display:inline-flex attribute solved my issue.


text:
Q: Error while inserting username and password in login android app using phpmyadmin database So when i tried to insert the username and password which is already inside the phpmyadmin database it gets toast output which is in the onErrorResponse(VolleyError error) and when i saw the Logcat it says
09-30 19:25:34.535 18067-18364/com.example.devarsh.googlemapsbustracker E/Volley: [7269] NetworkDispatcher.processRequest: Unhandled exception java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference
java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference
at com.example.devarsh.googlemapsbustracker.MainActivity$4.getParams(MainActivity.java:91)
    at com.android.volley.Request.getBody(Request.java:464)
    at com.android.volley.toolbox.HurlStack.addBodyIfExists(HurlStack.java:275)
    at com.android.volley.toolbox.HurlStack.setConnectionParametersForRequest(HurlStack.java:249)
    at com.android.volley.toolbox.HurlStack.executeRequest(HurlStack.java:94)
    at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:123)
    at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:131)
    at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)
    at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)
09-30 19:25:34.552 18067-18067/com.example.devarsh.googlemapsbustracker E/MainActivity: com.android.volley.VolleyError: java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference

I already tried to hardcore the Username and password inside my php script but it didnt work for me
Here is the Android Code :
package com.example.devarsh.googlemapsbustracker;

import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;

import java.util.HashMap;
import java.util.Map;

public class MainActivity extends AppCompatActivity {

private static final String TAG = "MainActivity";
private static final int ERROR_DIALOG_REQUEST = 9001;
private Button btnlogin;
private EditText User_name, Pass_word;
private static String URL_LOGIN = "http://192.168.50.127/Android/login.php";

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

    btnlogin = findViewById(R.id.button2);
    User_name =  findViewById(R.id.username);
    Pass_word =  findViewById(R.id.password);

    btnlogin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Login();
        }
    });

    isServicesOK();
}

private void Login(){

    String URL = "http://192.168.2.8/parul/login.php";
    RequestQueue requestQueue = Volley.newRequestQueue(this);
    StringRequest stringRequest = new StringRequest(Request.Method.POST, URL, new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {

            if(response.trim().equals("success")){
                Toast.makeText(getApplicationContext(), "Login Successfull", Toast.LENGTH_LONG).show();
                Intent intent = new Intent(getApplicationContext(), Selection_Activity.class);
                startActivity(intent);
            }else{
                Toast.makeText(getApplicationContext(), "Login Failed", Toast.LENGTH_LONG).show();
            }

        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            Toast.makeText(getApplicationContext(), "Login Unsuccessfull", Toast.LENGTH_LONG).show();
            Log.e(TAG, String.valueOf(error));
            System.out.println("VolleyError start : " + error + ": End of VolleyError");
        }
    }) {
        @Override
        protected Map<String, String> getParams() {

            user = User_name.getText().toString().trim();
            pass = Pass_word.getText().toString().trim();

            Map<String, String> params = new HashMap<>();
            params.put("UserName", User_name.getText().toString().trim());
            params.put("PassWord", Pass_word.getText().toString().trim());

            return params;
        }
    };

    requestQueue.add(stringRequest);

}

public void isServicesOK() {
    Log.d(TAG, "isServicesOK: checking google services version");

    int available = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this);

    if(available == ConnectionResult.SUCCESS){
        //everything is fine and user can make map request
        Log.d(TAG, "isServicesOK: Google Play Services is working");
    }
    else if(GoogleApiAvailability.getInstance().isUserResolvableError(available)){
        //there is an error but we can fix it
        Log.d(TAG, "isServicesOK: An error is there but we can fix it");
        Dialog dialog = GoogleApiAvailability.getInstance().getErrorDialog(this, available, ERROR_DIALOG_REQUEST);
        dialog.show();
    }else{
        Toast.makeText(this, "We cant make maps request", Toast.LENGTH_SHORT).show();
    }
}

}

And here is my php script which is used to get the username and password from the app to check weather it is exist in database or not and this code is for Localhost database using Xampp :
<?php
$conn = mysqli_connect("localhost","root","","users");
mysqli_query($conn, "SET NAMES 'utf8'");

$username = "parul";
$password = "parul1998";

$query = 'SELECT id FROM logintb WHERE username = "'.$username.'" and password = "'.$password.'"';
$result = mysqli_query($conn,$query) or die('error: ' .mysql_error());

if(mysqli_num_rows($result) == 1){

    echo "success";
}else{
    echo "error";
}

?>

The below code is used for testing the app with the live 000webhosting :
<?php
$conn = mysqli_connect("localhost","id7263189_root","dev@1234","id7263189_logintb");
mysqli_query($conn, "SET NAMES 'utf8'");

$username = $_POST["UserName"];
$password = $_POST["PassWord"];

$query = 'SELECT id FROM logintb WHERE username = "'.$username.'" and password = "'.$password.'"';
$result = mysqli_query($conn,$query) or die('error: ' .mysql_error());

if(mysqli_num_rows($result) == 1){

    echo "success";
}else{
    echo "error";
}

?>

I don't know how to solve that invoke virtual method :
com.android.volley.VolleyError: java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference

FYI I am testing this in real device. but when i hardcore the username and password in the php file and run the app in emulator it works fine but when i tried on the real device it's show the Login Unsuccessful Toast.
When i try to run this application in Emulator it works fine without any error but when i try it in the real device it shows that error from OnerrorResponse(VolleyError error) which is a toast of Login Unsuccessful
I am newbie in the android app development so need some help from anyone who can solve this problem for me.
My activity_main.xml code :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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"
android:hardwareAccelerated="true"
android:background="@color/white"
tools:context=".MainActivity">

<View
    android:id="@+id/view2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:hardwareAccelerated="true" />

<ImageView
    android:id="@+id/imageView2"
    android:contentDescription="@string/todo"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="76dp"
    android:background="@color/blend"
    app:srcCompat="@drawable/imagelogo" />

<EditText
    android:id="@+id/username"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="252dp"
    android:ems="10"
    android:hint="@string/User_name"
    android:importantForAutofill="no"
    android:inputType="text" />

<EditText
    android:id="@+id/password"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="186dp"
    android:ems="10"
    android:hint="@string/Pass_word"
    android:importantForAutofill="no"
    android:inputType="textPassword" />

<Button
    android:id="@+id/button2"
    android:layout_width="210dp"
    android:layout_height="wrap_content"
    android:layout_alignParentStart="true"
    android:layout_alignParentBottom="true"
    android:layout_marginStart="81dp"
    android:layout_marginBottom="112dp"
    android:background="@color/colorPrimary"
    android:text="@string/login" />

</RelativeLayout>

Thanks in advance

A: com.android.volley.VolleyError: java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference

This would happen because the EditText you're trying to get the text from is empty. But the interesting point is that you said it works on emulator.
The only solution we-I can suggest is using and getting strings from the EditTexts as follows:
String user = User_name.getText().toString().trim();
String pass = Pass_word.getText().toString().trim();

Declaring variables inside the Map might probably help.

A:  @Override
        protected Map<String, String> getParams() {
            User_name =  findViewById(R.id.username);
            Pass_word =  findViewById(R.id.password);
            user = User_name.getText().toString().trim();
            pass = Pass_word.getText().toString().trim();

            Map<String, String> params = new HashMap<>();
            params.put("UserName", user);  // direct use user
            params.put("PassWord", pass);  // direct use pass

            return params;
        }

update your getParams method find views inside it, it's not better approach but why don't you give it a try.
Remove
android:importantForAutofill="no"

and
android:ems="10"

from edit text


text: Q: I am making a 2-d board game in pygame and I want a video to run in background of the board while user plays the game. Any suggestions how to do so? In pygame I have created a playable chess board and I have set the board in the middle of the pygame window (the board has a smaller dimension than the window), and I want a video to run in the background of the board while user plays the game. Can someone help me how to implement this thing in python, pygame?


text:
Q: Robust numerical solution to linear first order PDE I have a 2D PDE of the form $$\nabla u \cdot \nabla F(x,y) = G(x,y)$$ with known functions $F$ and $G$ and unknown scalar function $u$, which I would like to solve numerically.  $F$ and $G$ are determined from experimental data, and may have noise in them.  Analytically, this is solved by the method of characteristics, and the obvious way to solve it numerically is to just integrate the characteristic equations.  However, I'm not sure that this is the best approach:
For one thing, it seems like if you integrate $u$ along a characteristic curve, after a long time the value will accumulate errors and diverge from the solution along neighboring curves, leading to a non-smooth solution.  This might be exasperated by the noise in $F$ and $G$.
It seems like there should be a more robust approach (perhaps involving a small artificial diffusive term or something), but I haven't found anything in the usual references (Wikipedia, Numerical Recipes, etc.) on solving this sort of equation.  I'm looking for concise techniques and/or references on robustly solving this sort of PDE.
Also, I'm no expert on this, so perhaps my worries about integrating the characteristics are unfounded, and that's a perfectly good way to solve this.  I welcome someone to tell me that is so, if you know better.

Edit: Given the low uptake on this question, I'm starting a bounty, and I will clarify further what I am looking for:

Please provide references or other verifiable information on how to robustly solve (numerically) a linear, first order PDE.  Preferably the solution should be known to work in the presence of noise on the coefficients.  Conversely, if the method of characteristics is suitable for this purpose, please explain why.

A: The PDE rewrite as a 2D linear PDE of the form
$$
au_x + b u_y = G
$$
where $a=F_x$, $b=F_y$. A more versatile approach than integration along characteristics could be based on finite difference shemes or on finite volume schemes (see for instance the Lax-Friedrichs scheme). This becomes more obvious if $a\neq 0$, in which case
$$
u_x + c u_y = R
$$
with $c=b/a$ and $R=G/a$.


text:
Q: Cannot extract certificate organization on some urls I want to be able to look up a website and provide the registered organization for that website.
For example get_company("google.com") -> Google LLC. However, some websites that are signed and display their certificates correctly when opened in chrome don't work. For example "microsoft.com" is one that doesn't work. How can I look those other ones up?
import ssl
import socket
import OpenSSL

def get_certificate(host, port=443, timeout=10):
    context = ssl.create_default_context()
    conn = socket.create_connection((host, port))
    sock = context.wrap_socket(conn, server_hostname=host)
    sock.settimeout(timeout)
    try:
        der_cert = sock.getpeercert(True)
    finally:
        sock.close()
    return ssl.DER_cert_to_PEM_cert(der_cert)

def get_company(url):
    certificate = get_certificate(url)
    x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, certificate)
    return dict(x509.get_subject().get_components())[b'O']

EDIT:
Just to clarify, I am not interested in certificates made by Authorities like Let's Encrypt and I can filter them. They are unrelated to the question. The specific example I posted was because when I go to microsoft.com in Google Chrome I can see the subject field contains the organization.

A: There are multiple validation types of X.509 certificates. Those specify which informations are part of the certificate (and thus validated by the CA issuing the certificate).

*

*Domain Validated (DV): The subject of those certificates contains exactly one value: The domain. Those are very common these days, since that's what you get from Let's Encrypt

*Organization Validated (OV): In addition to the domain, the certificate's subject also contains information about the certificate's owner. Usually just an organization name, sometimes also an actualy name or an organizational unit (OU).

The certificate you have problem with, is probably a DV certificate which simply does not have any organization information in its subject (which you are trying to parse).

A: The certificate currently used on microsoft.com is:
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            78:00:0f:e6:92:e4:bd:9e:fe:63:c5:71:67:00:00:00:0f:e6:92
        Signature Algorithm: sha256WithRSAEncryption
        Issuer: C=US, ST=Washington, L=Redmond, O=Microsoft Corporation, OU=Microsoft IT, CN=Microsoft IT TLS CA 4
        Validity
            Not Before: Feb  5 20:30:44 2020 GMT
            Not After : Feb  5 20:30:44 2022 GMT
        Subject: CN=microsoft.com
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    00:f1:1c:98:26:23:0f:fe:d2:ab:5d:a0:81:07:06:
                    ed:48:49:1b:8e:56:04:bb:de:80:df:06:6f:5a:5a:
                    96:3d:80:1e:3b:7a:aa:9d:c7:43:a0:fa:75:89:a9:
                    38:3c:20:52:cd:43:47:32:43:eb:ad:e7:50:37:b1:
                    3a:53:d1:2d:54:b2:4d:f4:1f:fb:16:ab:bb:50:53:
                    d5:b2:71:2b:a9:0c:fa:77:45:a6:fe:62:74:e1:e3:
                    cd:28:17:52:5c:4c:45:0d:7e:65:f8:44:9e:0f:9e:
                    34:1c:5d:e8:f0:b2:4f:1c:2c:9c:8b:a1:ae:74:a1:
                    1d:d8:2e:fb:10:3d:45:fd:02:cf:1f:d4:c8:8b:d5:
                    18:01:64:c0:ee:01:68:e0:db:da:79:5e:57:ff:a0:
                    a6:64:95:cf:68:4b:36:58:16:45:b0:0d:12:23:11:
                    e0:04:ae:e6:fc:5f:71:29:ff:60:9e:e4:6d:ef:e3:
                    2e:1d:28:e9:1c:23:8c:33:27:f4:33:f6:56:fb:f1:
                    b4:fc:55:96:61:0f:fe:a7:84:e7:c0:3b:84:0d:69:
                    ef:4c:da:83:05:08:81:68:97:d7:34:af:50:0b:78:
                    92:77:fe:8b:75:25:e5:57:51:bb:5a:25:2b:62:89:
                    da:83:69:d8:8f:ff:ce:cb:56:63:1f:2d:0f:23:48:
                    27:ad
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            S/MIME Capabilities:
......0...`.H.e...*0...`.H.e...-0...`.H.e....0...`.H.e....0...+....0
..*.H..
            1.3.6.1.4.1.11129.2.4.2:
                ...i.g.u.......X......gp
.....p..w......F0D. $...Um...v......*2..>*./m\5.*3... v..^.|...$8.....P....b.e...UD....v."EE.YU$V.?./..m..#&c..K.]..\n......p..w......G0E. jFy............./9?4z..d....F....!..H..v.GN.........rc.....wb6...k..v.U.....6.J...W<S...8xp%../..........p..v......G0E.!..{r...GS7...[.....].~7.P...4..Ev. LzM...4
......yj+...
            1.3.6.1.4.1.311.21.10:
                0.0
..+.......0
..+.......
            1.3.6.1.4.1.311.21.7:
                0/.'+.....7.....u...........a...`.]...B...z..d...
            Authority Information Access:
                CA Issuers - URI:http://www.microsoft.com/pki/mscorp/Microsoft%20IT%20TLS%20CA%204.crt
                OCSP - URI:http://ocsp.msocsp.com

            X509v3 Subject Key Identifier:
                89:47:51:EA:1F:28:84:F0:D5:35:E4:97:C7:53:D6:82:D0:BE:C0:46
            X509v3 Key Usage:
                Digital Signature, Key Encipherment, Data Encipherment
            X509v3 Subject Alternative Name:
                DNS:microsoft.com, DNS:s.microsoft.com, DNS:ga.microsoft.com, DNS:mi.microsoft.com, DNS:grv.microsoft.com, DNS:hup.microsoft.com, DNS:mac.microsoft.com, DNS:mkb.microsoft.com, DNS:pme.microsoft.com, DNS:pmi.microsoft.com, DNS:rss.microsoft.com, DNS:sar.microsoft.com, DNS:tco.microsoft.com, DNS:ieak.microsoft.com, DNS:mac2.microsoft.com, DNS:mcsp.microsoft.com, DNS:shop.microsoft.com, DNS:spur.microsoft.com, DNS:build.microsoft.com, DNS:itpro.microsoft.com, DNS:mango.microsoft.com, DNS:music.microsoft.com, DNS:pymes.microsoft.com, DNS:store.microsoft.com, DNS:aether.microsoft.com, DNS:alerts.microsoft.com, DNS:design.microsoft.com, DNS:garage.microsoft.com, DNS:gigjam.microsoft.com, DNS:ignite.microsoft.com, DNS:msctec.microsoft.com, DNS:online.microsoft.com, DNS:stream.microsoft.com, DNS:tpmsec.microsoft.com, DNS:afflink.microsoft.com, DNS:connect.microsoft.com, DNS:develop.microsoft.com, DNS:domains.microsoft.com, DNS:example.microsoft.com, DNS:madeira.microsoft.com, DNS:msdnisv.microsoft.com, DNS:mspress.microsoft.com, DNS:quantum.microsoft.com, DNS:sponsor.microsoft.com, DNS:wwwbeta.microsoft.com, DNS:business.microsoft.com, DNS:empresas.microsoft.com, DNS:learning.microsoft.com, DNS:msdnwiki.microsoft.com, DNS:pinpoint.microsoft.com, DNS:snackbox.microsoft.com, DNS:sponsors.microsoft.com, DNS:stationq.microsoft.com, DNS:aistories.microsoft.com, DNS:community.microsoft.com, DNS:crawlmsdn.microsoft.com, DNS:messenger.microsoft.com, DNS:minecraft.microsoft.com, DNS:backoffice.microsoft.com, DNS:enterprise.microsoft.com, DNS:iotcentral.microsoft.com, DNS:pinunblock.microsoft.com, DNS:reroute443.microsoft.com, DNS:communities.microsoft.com, DNS:explore-smb.microsoft.com, DNS:expressions.microsoft.com, DNS:ondernemers.microsoft.com, DNS:techacademy.microsoft.com, DNS:terraserver.microsoft.com, DNS:communities2.microsoft.com, DNS:connectevent.microsoft.com, DNS:dataplatform.microsoft.com, DNS:entrepreneur.microsoft.com, DNS:hxd.research.microsoft.com, DNS:mspartnerira.microsoft.com, DNS:oemcommunity.microsoft.com, DNS:real-stories.microsoft.com, DNS:www.formspro.microsoft.com, DNS:futuredecoded.microsoft.com, DNS:powerautomate.microsoft.com, DNS:smallbusiness.microsoft.com, DNS:upgradecenter.microsoft.com, DNS:learnanalytics.microsoft.com, DNS:onlinelearning.microsoft.com, DNS:businesscentral.microsoft.com, DNS:cloud-immersion.microsoft.com, DNS:analyticspartner.microsoft.com, DNS:businessplatform.microsoft.com, DNS:explore-security.microsoft.com, DNS:kleinunternehmen.microsoft.com, DNS:partnercommunity.microsoft.com, DNS:explore-marketing.microsoft.com, DNS:innovationcontest.microsoft.com, DNS:partnerincentives.microsoft.com, DNS:phoenixcataloguat.microsoft.com, DNS:szkolyprzyszlosci.microsoft.com, DNS:www.powerautomate.microsoft.com, DNS:successionplanning.microsoft.com, DNS:lumiaconversationsuk.microsoft.com, DNS:successionplanninguat.microsoft.com, DNS:businessmobilitycenter.microsoft.com, DNS:skypeandteams.fasttrack.microsoft.com, DNS:www.microsoftdlapartnerow.microsoft.com, DNS:commercialappcertification.microsoft.com, DNS:www.skypeandteams.fasttrack.microsoft.com
            X509v3 CRL Distribution Points:

                Full Name:
                  URI:http://mscrl.microsoft.com/pki/mscorp/crl/Microsoft%20IT%20TLS%20CA%204.crl
                  URI:http://crl.microsoft.com/pki/mscorp/crl/Microsoft%20IT%20TLS%20CA%204.crl

            X509v3 Certificate Policies:
                Policy: 1.3.6.1.4.1.311.42.1
                  CPS: http://www.microsoft.com/pki/mscorp/cps

            X509v3 Authority Key Identifier:
                keyid:7A:7B:8C:C1:CF:E7:A0:CA:1C:D4:6B:FA:FB:E1:33:C3:0F:1A:A2:9D

            X509v3 Extended Key Usage:
                TLS Web Client Authentication, TLS Web Server Authentication
    Signature Algorithm: sha256WithRSAEncryption
        1f:d8:61:7a:61:9e:d0:15:f9:4b:72:e4:33:e9:13:0c:7b:75:
        c4:5b:06:19:97:dd:f7:d3:c9:2f:15:2c:ee:83:46:bd:8a:d0:
        8a:6c:bc:5e:74:d2:53:80:58:17:ea:fd:d8:83:01:0e:d8:24:
        b5:ee:34:de:5d:bb:d2:16:65:af:fd:59:89:38:c1:af:c0:cf:
        e7:31:76:fb:22:b9:6f:f7:b6:91:54:2d:c9:da:81:cb:8f:84:
        b4:0c:8b:c6:f4:5e:6c:65:a3:ec:c3:be:02:29:8f:67:d3:ef:
        84:58:8f:18:75:0a:bb:97:63:1e:51:b2:1a:35:11:12:61:45:
        26:29:69:08:19:d3:b8:07:96:f0:ff:00:19:40:5e:80:30:83:
        c1:91:81:bb:64:f7:16:df:9f:fc:82:a2:3d:2e:f2:f9:46:60:
        e4:95:ef:41:2b:69:b6:f6:7f:8d:69:bf:82:72:01:d5:d9:34:
        8e:f4:70:67:92:8b:ea:34:b5:cb:b1:b4:71:d4:05:05:a8:d4:
        b6:56:c4:0e:5e:94:05:ce:48:72:54:52:d7:67:03:dd:fc:5b:
        1d:5d:27:09:65:f1:d3:ee:8c:36:84:35:28:89:26:88:ae:35:
        6e:ee:96:64:51:b6:09:0c:d7:5d:d9:60:e2:fb:31:5d:d5:8f:
        e6:2e:0c:0b:00:f5:24:27:48:b3:1e:8b:ee:f3:73:8e:82:a9:
        89:98:7a:ed:10:1d:52:ce:e5:b4:8a:d8:d8:d0:3a:b0:a7:0e:
        da:15:7b:67:f2:3b:35:12:96:ad:87:74:29:d1:b4:db:e6:87:
        37:6f:1d:6a:dc:02:aa:45:dd:15:e4:4a:9b:75:f3:22:4c:48:
        25:a1:90:1e:55:b7:df:35:8f:67:2f:73:94:69:f0:65:b9:ff:
        e8:12:83:ed:98:54:cb:a8:8e:06:7a:2a:45:09:ad:04:77:5b:
        3a:bf:ed:24:35:38:e6:4a:45:49:04:26:05:4e:eb:35:7d:26:
        c1:d5:dd:03:85:e6:a5:79:33:12:b2:53:ca:ab:67:fc:63:c7:
        94:5b:27:30:ce:a5:05:61:f7:62:65:26:a0:d8:9e:3c:dd:35:
        4d:51:0c:ab:ae:39:cb:94:b8:58:20:a0:ba:31:5f:e3:b7:d8:
        b0:15:15:ec:ee:78:8a:e9:a8:62:ca:02:38:df:6e:dd:34:22:
        7f:4f:96:f9:96:10:e7:5e:12:45:df:ed:6d:36:e8:a4:c1:af:
        63:3c:ac:3b:f0:aa:bf:44:a5:d7:5c:02:c0:ce:56:58:c5:77:
        f5:58:45:9a:64:3d:b2:a7:5f:97:d5:25:d2:e8:40:86:4b:bf:
        1c:09:6a:d2:04:d7:d2:a4

Notice Subject: CN=microsoft.com . The subject name contains only the CommonName attribute, not the Organization attribute. And as with essentially all modern website (HTTPS) certs, and many other SSL/TLS certs also, the Subject field is a legacy value that isn't actually used to identify the subject(s) of the cert; the SubjectAlternativeName extension is used instead.
OTOH the CA that issued this cert is also part (a different part) of Microsoft:
Issuer: C=US, ST=Washington, L=Redmond, O=Microsoft Corporation, OU=Microsoft IT, CN=Microsoft IT TLS CA 4

which does have an Organization attribute identifying Microsoft. However this is rare; very few companies run their own CAs. For example, the current certificate on stackoverflow.com is
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            03:d5:35:ed:f0:9f:bb:da:42:c1:0c:e8:c6:33:d5:39:38:d9
        Signature Algorithm: sha256WithRSAEncryption
        Issuer: C=US, O=Let's Encrypt, CN=Let's Encrypt Authority X3
        Validity
            Not Before: Jan 23 07:00:28 2020 GMT
            Not After : Apr 22 07:00:28 2020 GMT
        Subject: CN=*.stackexchange.com
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    00:9a:32:f8:05:bf:e1:14:7c:7c:39:f4:ce:37:c6:
                    ab:27:e2:7f:6d:73:68:8a:87:a2:c6:1e:f1:bd:39:
                    a3:52:86:99:a8:2d:45:91:e3:f6:ee:ea:ed:0b:ce:
                    6a:a9:30:94:97:83:5e:78:d9:8c:db:1a:e2:bc:e0:
                    ee:b2:b9:f9:b6:80:5a:e3:45:16:b2:fb:42:b7:ca:
                    e9:57:6d:87:fa:4a:44:6b:0b:5c:b4:12:63:17:a9:
                    13:2e:fd:85:0c:09:dd:43:c7:78:60:c6:d1:c2:b7:
                    56:61:d4:9e:72:b7:ea:64:5b:68:0f:d1:b4:5e:73:
                    08:6d:a5:ee:49:4f:e1:e6:d7:83:bd:4e:19:1a:e4:
                    4c:86:11:30:3a:a5:60:e9:fe:32:40:e1:be:8d:04:
                    80:28:a0:7a:7f:37:85:84:29:46:d3:93:8c:21:a1:
                    f6:cf:00:bd:dc:96:df:0c:94:c8:a3:b0:41:6d:1e:
                    4a:86:c0:51:c3:9a:7a:8c:55:e3:de:86:7d:1f:3d:
                    fb:0d:1f:83:ef:23:f6:f3:2a:a2:ff:47:87:a9:cd:
                    8e:d5:f2:3c:84:1b:88:34:86:63:15:a6:5d:c3:5b:
                    e8:04:65:20:88:d9:70:4d:d2:31:45:04:38:fa:b9:
                    3d:04:69:70:19:91:ef:65:79:18:a6:63:50:27:df:
                    87:9b
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Key Usage: critical
                Digital Signature, Key Encipherment
            X509v3 Extended Key Usage:
                TLS Web Server Authentication, TLS Web Client Authentication
            X509v3 Basic Constraints: critical
                CA:FALSE
            X509v3 Subject Key Identifier:
                F0:61:88:B2:8F:1D:EB:1E:FF:68:BC:BD:7A:D0:AF:9C:0C:34:09:18
            X509v3 Authority Key Identifier:
                keyid:A8:4A:6A:63:04:7D:DD:BA:E6:D1:39:B7:A6:45:65:EF:F3:A8:EC:A1

            Authority Information Access:
                OCSP - URI:http://ocsp.int-x3.letsencrypt.org
                CA Issuers - URI:http://cert.int-x3.letsencrypt.org/

            X509v3 Subject Alternative Name:
                DNS:*.askubuntu.com, DNS:*.blogoverflow.com, DNS:*.mathoverflow.net, DNS:*.meta.stackexchange.com, DNS:*.meta.stackoverflow.com, DNS:*.serverfault.com, DNS:*.sstatic.net, DNS:*.stackexchange.com, DNS:*.stackoverflow.com, DNS:*.stackoverflow.email, DNS:*.superuser.com, DNS:askubuntu.com, DNS:blogoverflow.com, DNS:mathoverflow.net, DNS:openid.stackauth.com, DNS:serverfault.com, DNS:sstatic.net, DNS:stackapps.com, DNS:stackauth.com, DNS:stackexchange.com, DNS:stackoverflow.blog, DNS:stackoverflow.com, DNS:stackoverflow.email, DNS:stacksnippets.net, DNS:superuser.com
            X509v3 Certificate Policies:
                Policy: 2.23.140.1.2.1
                Policy: 1.3.6.1.4.1.44947.1.1.1
                  CPS: http://cps.letsencrypt.org

            1.3.6.1.4.1.11129.2.4.2:
                ......v......... N.f.+..% gk..p..IS-...^...o.j.......G0E. Gt...N...O.wDE...~.P.~s..........!.....X....3.uW....z..*.....X......v.^.s..V...6H}.I.2z.........u..qEX...o.j.......G0E. Q...IB...\,.d.q3.T.2.v...z8..0...!.....6....uBJ.......xj....T...Vc.
    Signature Algorithm: sha256WithRSAEncryption
        17:cd:09:07:27:8f:14:2e:bc:f0:55:3d:f2:6f:dc:76:27:1e:
        ed:55:95:66:64:87:a0:b6:6c:dd:71:e1:d2:cb:f6:44:c4:25:
        f7:b3:5f:be:69:16:6b:f1:8b:63:b7:9f:07:73:47:9b:da:d5:
        be:b1:6b:7b:c2:2a:7e:cc:e0:37:29:0d:c7:39:30:0f:84:2a:
        a9:28:3d:93:a7:1d:33:7a:f0:72:73:b7:72:2e:2a:ab:96:65:
        65:f5:af:0b:70:55:13:c7:2c:96:59:0a:b2:ef:c1:14:a2:51:
        f6:c7:b3:ef:89:db:2c:7d:a7:8b:ac:17:c2:44:8e:b8:0a:12:
        27:ff:bb:de:e7:5d:44:24:c0:1f:79:9b:3e:b1:65:a5:58:98:
        cc:f5:ab:3d:e8:8a:70:db:1c:90:14:40:c5:1f:51:4b:b4:7a:
        3c:2e:4b:c8:5e:2b:5d:86:42:2d:f1:e9:64:2a:53:00:10:88:
        fc:7f:41:bd:8b:91:cc:2d:66:b2:af:ea:70:dd:61:cf:a5:c3:
        37:3c:56:a5:db:fc:18:e4:ad:af:0d:42:82:cb:22:d6:d6:93:
        54:5d:89:0e:03:d9:49:9f:80:ee:ab:f4:41:b1:0a:1f:82:4b:
        94:a5:9e:a0:0d:e4:1e:ad:24:ba:1c:91:96:aa:82:df:12:76:
        9e:54:04:55

which as you see also has only CommonName in Subject, and the real identities in SAN instead, but is issued by LetsEncrypt (exactly the case @mat referred to), so the Issuer Organization is Let's Encrypt. Do you want to report that stackoverflow and stackexchange etc are part of Let's Encrypt?
In general certificates are not required to be owned by an organization at all, much less a 'registered' one, and if one is, it isn't necessarily required to have that organization name contained in the cert.
ADDED: Okay, as noted in comments accessing microsoft.com with HTTPS (not just TLS) redirects to www.microsoft.com, which both your python and my OpenSSL ignored but browsers of course follow -- and (my) Chrome seriously confuses because it still shows microsoft.com/$path in the address bar. www.microsoft.com is on Akamai so you will get a different server than me and may get a different cert, but the cert I get is:
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            2d:00:0c:37:15:62:c4:1d:93:94:08:7f:68:00:00:00:0c:37:15
        Signature Algorithm: sha256WithRSAEncryption
        Issuer: C=US, ST=Washington, L=Redmond, O=Microsoft Corporation, OU=Microsoft IT, CN=Microsoft IT TLS CA 5
        Validity
            Not Before: Oct 21 22:04:04 2019 GMT
            Not After : Oct 21 22:04:04 2021 GMT
        Subject: C=US, ST=WA, L=Redmond, O=Microsoft Corporation, OU=Microsoft Corporation, CN=www.microsoft.com
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    00:d3:10:ad:42:cd:4c:1d:02:b1:0e:6f:fb:c3:3a:
                    a7:6c:ef:fb:d0:d7:21:90:b4:06:1a:65:83:41:72:
                    1d:bb:2b:0d:ff:5c:a9:df:b5:dd:cd:56:3e:ed:61:
                    ee:cc:84:8d:54:f9:b9:27:c6:14:b1:ee:6e:2d:8b:
                    b3:f3:b7:a9:b1:42:24:d9:fc:a7:a0:62:1c:68:b1:
                    dd:ec:38:48:a4:5e:02:55:cc:40:af:87:43:2f:77:
                    a6:9d:ae:f8:b4:d1:c5:1e:43:3d:1d:96:45:24:bb:
                    13:00:8e:21:6c:f8:55:fb:3a:07:f8:c6:df:2e:6f:
                    88:4a:64:f1:81:f3:9b:c3:9d:04:34:38:75:61:2f:
                    d2:2e:51:b6:07:86:68:7c:12:80:c4:75:1f:a8:83:
                    e9:63:ee:ee:4e:2a:dd:d8:11:69:ed:81:b9:df:57:
                    57:7a:e9:4e:7d:91:fa:79:0e:0e:13:ff:31:63:ab:
                    3f:e5:53:72:86:05:68:23:d1:8a:31:1f:c2:86:7e:
                    ea:b6:61:f1:50:b2:6e:d0:e0:c0:c9:9d:1d:8f:35:
                    46:f0:c2:b2:b9:26:57:5c:46:7d:bb:a3:94:95:67:
                    16:81:e7:96:ec:77:21:d6:2f:41:9b:1b:92:68:20:
                    85:a0:f2:91:89:5c:a6:06:7c:04:43:11:58:d6:8a:
                    30:4f
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            1.3.6.1.4.1.11129.2.4.2:
                ...h.f.v..\./.w0".T..0.V..M..3.../ ..N.d....m.bqq.....G0E.!.......L.O.:D.9.F...
.e..$..<..... ..s....'}..o..+....EL.1bN.W.&....u.U.....6.J...W<S...8xp%../..........m.br......F0D. Z&..b.>...r....j-.D.2nH.q{.D.&... E...........D.9.gp.iE(.CO.+B2.~S.u.}>.....Uh$....R.y+..x...j.h.~".....m.bq......F0D. d..z%.t..W.C.}E+.....~...>).1.O.. h....%<..N..9w...VY.......x...fC
            1.3.6.1.4.1.311.21.10:
                0.0
..+.......0
..+.......
            1.3.6.1.4.1.311.21.7:
                0/.'+.....7.....u...........a...`.]...B...z..d...
            Authority Information Access:
                CA Issuers - URI:http://www.microsoft.com/pki/mscorp/Microsoft%20IT%20TLS%20CA%205.crt
                OCSP - URI:http://ocsp.msocsp.com

            X509v3 Subject Key Identifier:
                F6:AB:BF:05:1E:41:B7:70:E9:91:F8:1A:95:6E:F6:0C:2B:09:FB:95
            X509v3 Key Usage:
                Digital Signature, Key Encipherment, Data Encipherment
            X509v3 Subject Alternative Name:
                DNS:wwwqa.microsoft.com, DNS:www.microsoft.com, DNS:staticview.microsoft.com, DNS:i.s-microsoft.com, DNS:microsoft.com, DNS:c.s-microsoft.com, DNS:privacy.microsoft.com
            X509v3 CRL Distribution Points:

                Full Name:
                  URI:http://mscrl.microsoft.com/pki/mscorp/crl/Microsoft%20IT%20TLS%20CA%205.crl
                  URI:http://crl.microsoft.com/pki/mscorp/crl/Microsoft%20IT%20TLS%20CA%205.crl

            X509v3 Certificate Policies:
                Policy: 1.3.6.1.4.1.311.42.1
                  CPS: http://www.microsoft.com/pki/mscorp/cps

            X509v3 Authority Key Identifier:
                keyid:08:FE:25:9F:74:EA:87:04:C2:BC:BB:8E:A8:38:5F:33:C6:D1:6C:65

            X509v3 Extended Key Usage:
                TLS Web Client Authentication, TLS Web Server Authentication
    Signature Algorithm: sha256WithRSAEncryption
        75:63:1a:5b:73:4e:3f:96:2b:e3:b4:a8:c3:55:19:34:b3:26:
        0e:5c:4d:8f:3f:bc:0d:c1:e2:7e:54:1f:2a:c2:26:3a:fb:3f:
        51:f9:54:ac:c1:97:1b:ba:c7:e7:b3:5b:25:9f:67:62:94:93:
        1d:6c:52:25:f2:ac:18:f7:37:a6:07:39:47:5b:31:67:10:db:
        ea:50:6e:5c:43:7d:36:f8:49:32:63:f0:06:4c:8a:24:00:27:
        8d:83:7a:c8:23:59:3f:85:fa:74:13:8e:35:6f:2e:a2:99:27:
        17:e0:91:1c:36:5d:4a:23:1a:16:21:38:7d:50:9e:d0:ba:ce:
        f7:46:f8:44:e3:ec:45:5f:33:1e:7e:7b:8b:50:75:eb:d9:f5:
        72:ab:0b:5e:b3:07:bc:ad:17:9e:ee:eb:c2:bb:ef:77:90:5b:
        39:aa:a6:ec:3a:e0:c0:96:14:93:45:1c:88:d1:1f:73:23:76:
        74:d4:5c:0b:1a:1f:59:07:55:19:0a:af:6a:0a:ad:8f:20:c2:
        9b:f1:09:e8:32:76:91:69:65:18:78:da:b9:cf:08:90:c6:94:
        78:27:9d:4d:8a:61:0a:11:1c:91:7a:11:05:98:a4:66:dc:8b:
        d2:86:63:eb:b8:8a:86:de:a6:9b:87:d2:4f:ec:74:66:eb:b9:
        c1:dc:d4:a0:24:d0:b0:d4:c7:57:41:92:6d:c5:48:45:c8:26:
        68:d8:b0:3f:ed:3e:96:b4:68:71:4a:e3:da:1f:fb:d8:84:0d:
        f0:f7:bf:f8:2a:c3:79:52:4d:94:a0:3d:81:63:65:fa:dd:45:
        fe:bd:c2:29:69:e4:10:dc:8d:50:24:e0:82:20:92:a2:37:58:
        f5:19:23:d6:b4:e2:78:fe:8c:48:15:19:05:67:f7:30:1e:57:
        22:e6:8b:39:33:b4:ff:08:4c:f3:7d:64:af:13:46:fe:4d:26:
        74:2a:43:b5:d2:af:08:a2:1c:01:1a:e4:28:cf:40:dd:3c:6d:
        56:93:9d:f1:ff:64:89:f7:06:68:fa:93:41:8a:fc:7f:18:6b:
        34:1f:3a:e2:ab:02:1b:5e:e8:f1:97:24:04:a5:bc:15:8e:47:
        fe:34:90:01:96:f5:a9:bc:2c:4d:b0:4c:5c:92:2b:d2:50:0f:
        c0:7e:cb:20:01:c9:27:2b:25:1b:45:f7:32:9d:00:46:e9:86:
        5a:a5:70:88:73:82:68:b5:ce:d6:24:90:5f:4c:16:e3:2a:3e:
        94:6c:56:38:db:ce:22:86:9d:d8:d7:9d:fd:fc:4c:eb:be:5f:
        11:50:be:af:e0:c8:e8:12:9b:b7:d0:a1:7c:85:e2:5d:e5:0b:
        a8:e6:42:df:2a:76:16:8f

which does have Organization (and Org Unit) in the Subject, as you want. This may or may not be true for other websites/companies.


text:
Q: Sharing a variable between controllers in angular.js I'm new to angular and I'm wondering how I can share a variable between controllers in angular. I'm using the following scripts -
In Main.js:
function MainCntl($scope) {
  ---code
}

function SearchCtrl($scope, $http) {
    $scope.url = 'http://10.0.0.13:9000/processAdHoc';
    $scope.errorM = "No results";
    $scope.search = function() {

        $http.post($scope.url, { "data" : $scope.keywords}).
        success(function(data, status) {
            $scope.status = status;
            $scope.data = data;
            $scope.result = data;
            alert('yes');
        })
        .
        error(function(data, status) {
            $scope.data = data || "Request failed";
            $scope.status = status;
            alert('no');
            $scope.result = "failed";
        });
    };
}

In Index.html

---code

     <form class="well form-search">

          <input type="image" src="../../images/search1.png" class="searchbox_submit" />
          <input ng-model="keywords" placeholder="Shadow Search" id="tags" class="input-medium search-query rounded" />

     </form>

---code

     {{result}}

Everything works well with the ajax I'm sending data and receiving a response, my question is as follows:
In the SearchCtrl function I have a variable called $scope.result that is later referred to in Index.html. If I insert the html code that contains that variable into the SearchCtrl controller it works fine but if it is in the MainCtrl controller it does not work. How can I share this variable between the controllers.
Thanks ahead

A: Use a service and inject it to both controllers and refer your scope vars to the services variable.
Example:
angular.module("yourAppName", []).factory("myService", function(){

  return {sharedObject: {data: null } }

});

function MainCtrl($scope, myService) {
  $scope.myVar = myService.sharedObject;
}

function SearchCtrl($scope, $http, myService) {
  $scope.myVar = myService.sharedObject;
}

In your template do:
{{myVar.data}}

See an example Uses Angular v1.1.5
The reason you put it in an inner object is to preserve your references, if you keep it without a "sharedObject", and change that object, your binding will be pointing to the old reference and wouldn't show anything in the template.


text:
Q: Is the function app (azure) able to access a folder in a remote vm?
*

*What is the problem?
I have created a function app which creates some files under path D:\home\site\wwwroot\afolder. What I need is the function app to copy and paste these files to a remote server (VM in Azure) under a specific folder in the VM.

*What I tried :
https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-vnet
Based on the above documentation, a function app can access resources in remote network with vnet integration - it is like declaring to the function app that it will be under the same vnet as the VM and then it would hopefully be able to access the resources / folder of the remote VM. (no luck)
Based on their documentation:

There are some things that VNet Integration doesn't support including: Mounting a drive

I am not sure if I can achieve what I need with the vnet integration after all.
So the question is: can I copy & paste the files created by the function app to a remote VM folder and if yes in which way?


text:
Q: Linked List OCaml How would I create a linked list to hold my data in OCaml? I'm trying to make a singly linked list, however I'm having trouble with the syntax. I just want to make a module to simply get the 'a from the linked list, insert 'a or delete 'a.
Anyone have any idea?

A: As aneccodeal told, ocaml already has lists.
However, for your interest, this is how you could build your own list. Obviously, you would never use it on a real application :) If you want to have some trees, the data structure would be very similar.
exception Empty_list

type 'a my_list = Nil | List of 'a * 'a my_list

let head = function
     Nil -> raise Empty_list
   | List(e,_) -> e;;

let tail = function
    Nil -> Nil
   | List(_,t) -> t

let l = List(1, List(4, List(8, Nil)));;

print_endline (string_of_int(head l));;

print_endline (string_of_int (head(tail l)));;

A: OCaml has lists built in:
List of integers:
[1;2;3;4;5] ;;
  returns: int list = [1; 2; 3; 4]
List of Strings:
["this";"that";"other"];;
  returns: string list = ["this"; "that"; "other"]
Or you can use the cons operator :: to build lists:
1::2::3::[];;
  returns: int list = [1; 2; 3]
To get the head (first item) of a list:
List.hd [1;2;3]
returns 1
To get the tail of a list (all items after the first item)
List.tl [1;2;3]
returns: int list = [2; 3]
Also, you can have a look at how lists are implemented in the OCaml standard library by looking at:
[installation location for OCaml]/lib/ocaml/std-lib/list.ml

A: Doesn't OCaml already have lists as a primitive?  I haven't done SML since college, but I seem to recall head and tail primitives.  I see that other people have implemented a true linked list data structure out there though... check out Dustin's OCaml Linkedlist for example.


text:
Q: Что означает запись в error log? Всем привет! Отлавливаю ошибку wordpress + ubuntu 16.04 , apache2. Лег сайт. Смотрю логи:
в аксес по времени отру:

212.90.166.2 - - [25/Jul/2018:13:47:03 +0300] "GET /wp-content/uploads/2017/01/768x130_generator_2.jpg HTTP/1.1" 200 32386 "http://matari.ua/generators.html?swoof=1&pa_obem-resivera-l=50-100" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.95.67.50.242 - - [25/Jul/2018:14:08:00 +0300] "GET / HTTP/1.1" 500 601 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0"

и error log ( не могу понять , что значит этот кусок ( по времени подходит ) ):

[Wed Jul 25 13:46:55.437099 2018] [:error] [pid 4054] [client 212.90.166.2:61323] PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, function 'my_deregister_javascript' not found or invalid function name in /var/www/html/wp-includes/plugin.php on line 524, referer: http://matari.ua/kompressory.html?gclid=Cj0KCQjwv-DaBRCcARIsAI9sba_o5Qj_2-JzJyOB8wRwFMsLOEj5VLD7APp9O0s0OKTv44ntaQIYCzkaAt83EALw_wcB

в конце много <0x00> , sublime не дает скопировать.


text:
Q: compare only time vlaue from textbox using javascript? I am taking three text boxes. time in text boxes are not to be same. means 1st text box value is 2013-10-01 12:00 date time.and second is 2013-10-01 12:00 and third also 2013-10-12 12:00.but actual problem is that when date are diff-rent then same time should be allow.when date and time are same so it should through error message or alert message to user.please help me to solve this.
function validate Form()
{

var a=document.get Element By Id("mybox1"). value;
var b=document.get Element By Id("mybox2"). value;
var c=document.get Element By Id("mybox3"). value;

var a_time = a.replace(/ /g,''). sub st r (a.replace(/ /g,''). length - 5);
var b_time = b.replace(/ /g,''). sub st r (b.replace(/ /g,''). length - 5);
var c_time = c.replace(/ /g,''). sub st r (c.replace(/ /g,''). length - 5);

if (a=="" &&  b=="" && c=="")
  {
  alert("Please select at least one date and time !");
  return false;
  }
else if (a_time === b_time)
  {
  alert("Please select diff-rent time!");
  return false;
  }
else if (a_time === c_time)
  {
  alert("Please select diff-rent time!");
  return false;
  }
  else
  {
      return true;
  }
}

A: Try this... only need to compare date too...
if (a=="" &&  b=="" && c=="")
        {
            alert("Please select at least one date and time !");
            return false;
        }
        else if (a_time === b_time && a===b)
        {
            alert("Please select diff-rent time!");
            return false;
        }
        else if (a_time === c_time && a===c)
        {
            alert("Please select diff-rent time!");
            return false;
        }


text:
Q: Conversion between int and char not working as expected To convert a char to its Int equivalent I use:
scala> 'a'.asDigit
res2: Int = 10

I expect to convert 10 to char a by using toChar method:
scala> 10.toChar
res3: Char =

But a is not being returned.
How can you convert and un-convert a digit to char?

A: You need to use Character.forDigit:
'a'.asDigit  // res1: Int = 10

Character.forDigit(10, 16)  // res1: Int = 10

Note that the RADIX value for asDigit is 16 (hexadecimal), and using another one is likely to cause encoding problems. Scala uses RichChar to wrap a character and supply the asDigit function. This uses the underlying conversion provided by Java Character class, the relevant documentation for which is here.
To understand a little of what is going on here, note that 10 is the decimal representation of a, which is the hexadecimal representation for 10. That is, in hexadecimal the tenth number on the number line is a. This is a different representation than when you're converting to unicode characters, say, but it gets confusing because:
'a'.asDigit  // res1: Int = 10
'b'.asDigit  // res2: Int = 11
'f'.asDigit  // res3: Int = 15
'g'.asDigit  // res4: Int = 16
'z'.asDigit  // res5: Int = 35

So, what is happening is that your character is converted to a hexadecimal number which is then being represented as an integer. But converting from an integer to a character directly doesn't work.

A: There is a difference between asDigit and toInt. If you want the Int equivalent of 'a' in terms of the Ascii character set then use toInt.
scala> 'a'.toInt
res12: Int = 97

scala> 97.toChar
res13: Char = a

To see why 10.toChar does not print anything check out the character tables.


text:
Q: Mesh Analysis for Complicated Circuit How do I solve this Circuit with Mesh Analysis method? Help Please. Specificly with mesh analysis please, with nodal analysis its easy.

A: I guess you see a current loop which goes through your both current sources and the 4kOhm resistor. You got stuck because you couldn't figure out how to write KVL equation for that loop.
But that loop doesn't need an equation, it has current 0.001Vx/8
You need 2 KVL equations which contain unknown loop currents of the voltage sources.
The third equation is got by setting the sum of loop current from voltage source Vx/2 and loop current 0.001Vx/8 equal with minus 1uA. This trick (=to present a current source as a sum of 2 loop currents) is also used in many supermesh examples although this isn't one of them.


text:
Q: Export source project to WAR using command line I want to export a eclipse project in a file .WAR using command line .
In Eclipse I do

File -> export -> web -> WAR file

I can deployed the WAR file in Glassfish  and that work well. The size of the WAR is 44700 Kb.
In command line I do this -> "jar uvf XYproject.war XYproject"
I have the XYproject.war with the size of  90200 Kb and when I deploy that in Glassfish. Nothing run.
I don't understand why the size of the WAR is not the same using command line or using eclipse and I don't understand why the WAR don't work ?


text:
Q: how to control the extent of multi-barplot on the X-axis with GNUPLOT I am trying to make a multi-barplot as in the attached image, but the counting on the X-axis must start from 44 up to 127 not from 1 up to 84 as it is now.
Can anyone please indicate how to do that?
set ylabel "Sec. Struct. Probability" offset -1
set yrange [0:1.0]
set xlabel "domain sequence"
set xrange [1:84]
set lmargin 15
set style data histogram
set style histogram cluster gap 1
set border 3
set boxwidth 0.9 absolute
set style fill solid 1.00 border
set xtics out
set xtics nomirror
set x2tics out
set x2tics nomirror
set x2tic scale 0
set ytics out
set ytics nomirror
set ytics font "Times-Roman,12"
set ytics offset 0.6, 0.05
set xtics font "Times-Roman,12"
set xtics offset -0.15,0.4
set xtics scale 3
set x2tics font "Courier,10"
set x2tics offset 0,graph -1.08
set datafile separator " "
set size ratio 0.5

plot "./SS_prediction.forGNUPLOT.dat" using 3:x2ticlabel(1) lc rgb "red" fs transparent solid 0.8 noborder title "Helix", \
"" using 4 lc rgb "blue" fs transparent solid 0.8 noborder title "Beta", \
"" using 5 lc rgb "green" fs transparent solid 0.8 noborder title "PPII"

My data file is here

A: To start the histogram at x=44 you can use the newhistogram keyword, which allows you to specify a starting value with at 44:
set xrange [44:127]
...
plot newhistogram at 44, \
    "./SS_prediction.forGNUPLOT.dat" using 3:x2ticlabel(1) ...


text:
Q: How to unpack deep nested iterable structure Say for example I have a structure that contains many sub-elements some of which are structures:
v = [1, 2, 3, [4, (5, 6)]]

How can I unpack these into a series of names that contain only the contents of the structures and not a structure?
Trying a, b, c, d, e, f = v raises a ValueError while using the starred expression would assign a structure to the names. How can I unpack them in order to get:
print(a, b, c, d, e, f)

to print:
1 2 3 4 5 6

A: Another option you might consider is to flatten the structure and then assign it.
def flatten(container):
    for i in container:
        if isinstance(i, (list,tuple)):
            for j in flatten(i):
                yield j
        else:
            yield i

Then
a, b, c, d, e, f = flatten(v)

A: Assignments are defined recursively, you need to use parentheses () and/or square brackets [] to enclose target names and match the nested structure of your iterable. In your case:
a, b, c, (d, (e, f)) = v
print(a, b, c, d, e, f)
1 2 3 4 5 6

Similarly, with no change in semantics, you could use [] to denote the structure:
a, b, c, [d, [e, f]] = v
print(a, b, c, d, e, f)
1 2 3 4 5 6

or, of course, mix them up.
Python will then unpack v and assign the first 3 values normally, then unpack the contents of (d, (e, f)) and assign d and then again unpack (e, f) and do the same.
You can see this happening if you import the dis module and disassembling the statement with dis.dis:
dis.dis('a, b, c, (d, (e, f)) = v')
  1           0 LOAD_NAME                0 (v)
              3 UNPACK_SEQUENCE          4      # <- first unpack
              6 STORE_NAME               1 (a)
              9 STORE_NAME               2 (b)
             12 STORE_NAME               3 (c)
             15 UNPACK_SEQUENCE          2      # <- second unpack
             18 STORE_NAME               4 (d)
             21 UNPACK_SEQUENCE          2      # <- third unpack
             24 STORE_NAME               5 (e)
             27 STORE_NAME               6 (f)
             30 LOAD_CONST               0 (None)
             33 RETURN_VALUE

In general, to unpack arbitrarily nested structures, match the structure in the left side of the assignment (target-list):
v = [1, [2, [3, [4, 5]]]]
[a, [b, [c, [d, e]]]] = v
print(a, b, c, d, e)
1 2 3 4 5

the outer [] are, of course, unnecessary, just adding them to show that simply matching the structure suffices.


text:
Q: Dynamic Linq - Setting orderby expression type at runtime I'm using dynamic Linq and have the where clauses working. Now I'm looking to add orderby clauses but am having a problem being able to set the type of the dynamic expression. Below is working code that I have:
class MyClass {
    public string Owner;
    public DateTime Inserted;
}

Expression<Func<MyClass, bool>> whereExpression = DynamicExpression.ParseLambda<MyClass, bool>("owner = \"joe\"");
Expression<Func<MyClass, DateTime>> orderExpression = DynamicExpression.ParseLambda<MyClass, DateTime>("inserted");
var result = from item in table.Where(whereExpression).OrderBy(orderExpression) select item;
result.ToList().ForEach(m => Console.WriteLine("inserted=" + m.Inserted + "."));

Because I need to use different properties in the orderby expression what I'd like to be able to do is use something like the code below which is not working.
Expression<Func<MyClass, bool>> whereExpression = DynamicExpression.ParseLambda<MyClass, bool>("owner = \"joe\"");
Type orderType = typeof(DateTime);
Expression<Func<MyClass, orderType>> orderExpression = DynamicExpression.ParseLambda<MyClass, orderType>("inserted");
var result = from item in table.Where(whereExpression).OrderBy(orderExpression) select item;
result.ToList().ForEach(m => Console.WriteLine("inserted=" + m.Inserted + "."));

The compiler isn't happy with the line delcaring the orderExpression. Is there any way to set the type of a Func at runtime?

A: Looks like the dynamic Linq extension methods take care of it all for me. I was making it too hard.
var result = from item in table.Where("owner = \"joe\"").OrderBy("inserted") select item;
result.ToList().ForEach(m => Console.WriteLine("inserted=" + m.Inserted + "."));

A: Yeah - though one problem is that DynamicLinq won't let you sort using an IComparer. I have a solution to that.


text:
Q: Find the matrix of a linear map using change of basis I'm supposed to solve this task using the theory behind change of basis. So, I'm given a linear operator $\varphi :{ R }^{ 3 }\rightarrow { R }^{ 3 }$ that maps
$\begin{pmatrix} 1 \\ 1 \\ 0 \end{pmatrix}\mapsto \begin{pmatrix} 2 \\ 1 \\ -1 \end{pmatrix},\quad \begin{pmatrix} -1 \\ 2 \\ 1 \end{pmatrix}\mapsto \begin{pmatrix} -1 \\ 0 \\ 3 \end{pmatrix},\quad \begin{pmatrix} 0 \\ 1 \\ 1 \end{pmatrix}\mapsto \begin{pmatrix} 1 \\ 1 \\ 2 \end{pmatrix}$.
I'm supposed to find the matrix of this map in the standard basis $f$ that is the set of columns of the identity matrix of $dim=3$
Let $e$ and $e'$ be:
$e=\begin{pmatrix} 1 & -1 & 0 \\ 1 & 2 & 1 \\ 0 & 1 & 1 \end{pmatrix},\quad e'=\begin{pmatrix} 2 & -1 & 1 \\ 1 & 0 & 1 \\ -1 & 3 & 2 \end{pmatrix}$
Then we can find the transition matrix from $e$ to $e'$:
$e'=eS\quad \Rightarrow \quad S={ e }^{ -1 }e'$
Then we can use elementary operation with rows of the augmented matrix to calculate ${ e }^{ -1 }e'$
$\left( { e }|e' \right) \quad \rightarrow \quad \left( { E }|{ e }^{ -1 }e' \right) \quad \rightarrow \quad S$
Well, I don't know what to do next. I was told to recall that the $j$-th column of the matrix $A$ of the operator $\varphi$ in the basis $f$ is the coordinate column of $\varphi({f}_{j})$ in the basis $f$. Here $f$ denotes the standard basis, i.e. ${f}_{1}=(1,0,0)$,  ${f}_{2}=(0,1,0)$ and ${f}_{3}=(0,0,1)$, but I don't see how this is supposed to help me.

A: Let $A$ be the map from the standard basis to the standard basis. Let $e,e'$ be the matrices given in the question. Then
we have $e'=A e$, so you want to compute $A=e' e^{-1}$.


text:
Q: sentence structure quesiton
In comparing different methods by which a teacher's performance can
  be evaluated and educational outcomes improved, researchers found
  that a critique of teacher performance leads to enhanced educational
  outcomes if the critique is accompanied by the information that
  teacher performance is merely one of several factors that determines
  the educational outcomes.

I am having hard time understanding the structure of bold part, especially because of the part "outcomes improved". Between "outcomes" and "improved", is there an "can be" hided so it can be paralleled with "performance can be evaluated"?

A: Yes, there is a hidden "can be".
It would read:

by which a teacher's performance can be evaluated and their educational outcomes can be improved


text:
Q: 'Plus' keyword is not working on mysql fulltext searching I am using a keyword like 'iphone 6 plus' or anything including 'plus' keyword for mysql full text searching on my local database, but its return empty result.
Its only for plus keyword cause when i was using a query like match('keyword_map') against ('plus' IN BOOLEAN MODE).
This query returns empty result.There is a lot of data stored in my database with plus keyword. When i use mysql like search its working.
Please anybody give me solution for that.

A: Plus is mysql reserved keyword. there is also another keyword like
ACCESSIBLE (R)  ACTION  ADD (R)
AFTER   AGAINST AGGREGATE
ALGORITHM   ALL (R) ALTER (R)
ANALYZE (R) AND (R) ANY
AS (R)  ASC (R) ASCII
ASENSITIVE (R)  AT  AUTHORS
AUTOEXTEND_SIZE AUTO_INCREMENT  AVG
AVG_ROW_LENGTH  BACKUP  BEFORE (R)
BEGIN   BETWEEN (R) BIGINT (R)
BINARY (R)  BINLOG  BIT
BLOB (R)    BLOCK   BOOL
BOOLEAN BOTH (R)    BTREE
BY (R)  BYTE    CACHE
CALL (R)    CASCADE (R) CASCADED
CASE (R)    CATALOG_NAME    CHAIN
CHANGE (R)  CHANGED CHAR (R)
CHARACTER (R)   CHARSET CHECK (R)
CHECKSUM    CIPHER  CLASS_ORIGIN
CLIENT  CLOSE   COALESCE
CODE    COLLATE (R) COLLATION
COLUMN (R)  COLUMNS COLUMN_NAME
COMMENT COMMIT  COMMITTED
COMPACT COMPLETION  COMPRESSED
CONCURRENT  CONDITION (R)   CONNECTION
CONSISTENT  CONSTRAINT (R)  CONSTRAINT_CATALOG
CONSTRAINT_NAME CONSTRAINT_SCHEMA   CONTAINS
CONTEXT CONTINUE (R)    CONTRIBUTORS
CONVERT (R) CPU CREATE (R)
CROSS (R)   CUBE    CURRENT_DATE (R)
CURRENT_TIME (R)
https://dev.mysql.com/doc/refman/5.5/en/keywords.html

A: Plus is mysql reserved keyword thats why plus is not working in mysql match against search.


text:
Q: Please help me interpreting Elementary Set Theory question I have to prove something for homework, but I can not for the life of me figure out what the theorem I'm supposed to prove is. Again, please: I am not asking for you to prove it for me (that's my hw and I want to do it myself), I am just asking you to help me understand what it is that I am trying to prove here.
What is  this "theorem like 1.1.5 for the intersection and union of A" which I am supposed to prove?

A: The book is hinting for you to show that
$$
\left(\bigcup_{Y\in\mathcal{A}}Y\right)^{c}=\left(\bigcap_{Y\in\mathcal{A}}Y^{c}\right)
$$
and
$$
\left(\bigcap_{Y\in\mathcal{A}}Y\right)^{c}=\left(\bigcup_{Y\in\mathcal{A}}Y^{c}\right).
$$
Note that when $\mathcal{A}=\left\{ A,B\right\} $ you get back your
original problem.
Edit:

*

*We define $\bigcup_{Y\in\mathcal{A}}Y$ as the set of all $x\in X$ s.t. $x\in Y$ for some $Y\in\mathcal{A}$.

*We define $\bigcap_{Y\in\mathcal{A}}Y$ as the set of all $x\in X$ s.t. $x\in Y$ for all $Y\in\mathcal{A}$.

A: The statements (a) and (b) are the so-called De Morgan's laws for pairs of sets. Very similar statements hold for triplets of sets:
$$(A\cup B\cup C)^c=A^c\cap B^c\cap C^c$$
and $$(A\cap B\cap C)^c=A^c\cup B^c\cup C^c\;.$$
Can you state a similar pair of theorems for not just two or three sets at a time, but for arbitrary collections of sets? Once you actually state the right theorems, proving them won't be hard.


text:
Q: How can I update a nested array with ionic4 storage Using
openSavedForm() {
  this.storage.get('test').then((val) => {
    this.auditResults = JSON.parse(val);
    this.audit = this.auditResults
    this.auditOne = this.auditResults.siteVehicle;
    console.log('pull all', this.audit);
  });
}

I can view my key value pair stored items in sqlite.  Here is a photo of the of the console.log

Is it possible to only update only the siteVehicle Array with
async saveFormUpdates() {
  this.newAudit =this.auditOne;
  await this.storage.set( 'test', JSON.stringify(this.newAudit));
  console.log ("storage", this.newAudit);
}

with out deleting all the other arrays?

A: My async saveFormUpdates() was wrong.  Turns out just saving this.audit instead of this.auditOne did everything with no further input from me.
async saveFormUpdates() {
 this.newAudit = this.audit;
 await this.storage.set( 'test', JSON.stringify(this.newAudit));
 console.log ("storage", this.newAudit);
}


text:
Q: R dies unexpectedly with segmentation fault when loading 'xlsx' and 'caret' in that order When I load xlsx followed by caret, R dies with segmentation fault.
> library("xlsx")
Loading required package: rJava
Loading required package: xlsxjars
> library(caret)
Loading required package: lattice
Loading required package: ggplot2
Segmentation fault (core dumped)

However, if I load caretfirst, followed by xlsx, R works fine.
> library(caret)
Loading required package: lattice
Loading required package: ggplot2
> library("xlsx")
Loading required package: rJava
Loading required package: xlsxjars
>

Any idea what could be wrong?
UPDATE:
OS: CentOS 6.9
R:  3.2.5
R configured with:
./configure --enable-R-shlib CFLAGS=-fPIC --with-cairo --with-libpng --with-jpeglib --with-libtiff --with-system-zlib --with-system-pcre --with-system-xz --with-tcltk

devtools.SessionInfo output
> sessionInfo()
R version 3.2.5 (2016-04-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.9 (Final)

locale:
 [1] LC_CTYPE=en_US.utf8          LC_NUMERIC=C
 [3] LC_TIME=en_US.utf8           LC_COLLATE=en_US.utf8
 [5] LC_MONETARY=en_US.utf8       LC_MESSAGES=en_US.utf8
 [7] LC_PAPER=en_US.utf8          LC_NAME=en_US.utf8
 [9] LC_ADDRESS=en_US.utf8        LC_TELEPHONE=en_US.utf8
[11] LC_MEASUREMENT=en_US.utf8    LC_IDENTIFICATION=en_US.utf8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
 [1] randomForest_4.6-12 class_7.3-14        xlsx_0.5.7
 [4] xlsxjars_0.6.1      rJava_0.9-8         MASS_7.3-47
 [7] TTR_0.23-1          caret_6.0-76        ggplot2_2.2.0
[10] lattice_0.20-34     devtools_1.13.2

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.8        nloptr_1.0.4       plyr_1.8.4             iterators_1.0.8
 [5] tools_3.2.5        xts_0.10-0         digest_0.6.10      lme4_1.1-12
 [9] memoise_1.0.0      tibble_1.2         nlme_3.1-128       gtable_0.2.0
[13] mgcv_1.8-16        Matrix_1.2-7.1     foreach_1.4.3      parallel_3.2.5
[17] SparseM_1.74       withr_1.0.2        stringr_1.1.0      MatrixModels_0.4-1
[21] stats4_3.2.5       grid_3.2.5         nnet_7.3-12        minqa_1.2.4
[25] reshape2_1.4.2     car_2.1-3          magrittr_1.5       scales_0.4.1
[29] codetools_0.2-15   ModelMetrics_1.1.0 splines_3.2.5      assertthat_0.1
[33] pbkrtest_0.4-6     colorspace_1.3-1   quantreg_5.29      stringi_1.1.2
[37] lazyeval_0.2.0     munsell_0.4.3      zoo_1.7-13

A: In case someone comes across this, I was able to fix it using the dev version of XLSX. For me it was an issue after updating to 10.13.5
devtools::install_github('dragua/xlsx', ref='7ed97ff')

That library works for me. Strange that I have the issue now, a full 11 months after many others reported an issue with Ubuntu.


text:
Q: Multitouch swipe gesture How can I simulate a two-finger left-to-right swipe within a UITextView in UIAutomation?
I've tried this:
var textView = target.frontMostApp().mainWindow().textViews()[0];
textView.dragInsideWithOptions({
    touchCount:2,
    startOffset:{x:0.2, y:5.80},
    endOffset:{x:0.8, y:5.80},
    duration:1.5
});

But apparently it is not having any effect. Sometimes it looks like it is doing only one finger gesture even I am passing 2 as the touch count.
One concern is: How UIAutomation knows where place the second touch? I am only specifying the start and end of one touch, not two. Is this correct? Maybe this is the origin of my problem?
Also, I have not very clear the coordinates system of objects. Unless I pass very small values  for x, y I usually get warnings: out of bounds. Passing coordinates I would usually pass using Objective-C seem to be way large :(

A: A very late answer...
I met your problem today, in 2015, and I have the chance to have Apple doc for this function. Wasn't the case in 2012 perhaps...
Apple docs says :

You can use offsets to achieve finer precision in specifying the hitpoint within the rect for the specified element. The offset comprises a pair of x and y values, each ranging from 0.0 to 1.0. These values represent, respectively, relative horizontal and vertical positions within the rect, with {x:0.0, y:0.0} as the top left and {x:1.0, y:1.0} as the bottom right. Thus, {x:0.3, y:0.6} specifies a position just below and to the left of center, and {x:1.0, y:0.5} specifies a position centered vertically at the far right.
This example performs a slow drag within the target element from left edge to right edge, just below the top:
target.dragInsideWithOptions({startOffset:{x:0.0, y:0.1}, endOffset:{x:1.0, y:0.1}, duration:1.5});

So x and y values are relative within the rect you choose.
In your example :
startOffset:{x:0.2, y:5.80}

You begin the swipe from left in the textview at 20% of its length, and y is 5.80 times beyond the border...
It would better work with values as :
startOffset:{x:0.0, y:0.1}, endOffset:{x:0.5, y:0.1}

For my part, I made the two-finger left-to-right swipe work with this code :
target.frontMostApp().mainWindow().dragInsideWithOptions({touchCount:2, startOffset:{x:0.0, y:0.1}, endOffset:{x:0.5, y:0.1}, duration:1});


text:
Q: How to create UITableView Cell with avatar and text using Auto Layout in iOS with IB? I've tried Label.width = width constraint and get this:

But I want to get something like this:

So, the size of the label width equals the size of the table cell minus avatar width and paddings. How can I achieve this?

A: To achieve required effect you can add following constraints:

Cell prototype:

Label constraints:

After applying all constraints select cell's label and press ⌥+⌘+= to update label's frame


text:
Q: Can the XML serialiser be altered to not output the XML version? I am serialising a number of classes to an XML file using the following code
static void GetFromDBToXml()
    {
        var thejob = Xmltodb.Singleton.DBManager.GetSingleObject<job>("jobid", JobData.Job.Jobid);
        var theparts = Xmltodb.Singleton.DBManager.GetListOfObjects<parts>("jobid", JobData.Job.Jobid);
        var thesurv = Xmltodb.Singleton.DBManager.GetListOfObjects<jobsurvey>("jobid", JobData.Job.Jobid);

        try
        {
            using (var fs = new FileStream(Path.Combine(Xmltodb.Singleton.ContentDirectory, "temp.xml"), FileMode.OpenOrCreate))
            {
                var xmlSerializer = new XmlSerializer(typeof(job));
                xmlSerializer.Serialize(fs, thejob);
                xmlSerializer = new XmlSerializer(typeof(parts));
                foreach (var p in theparts)
                    xmlSerializer.Serialize(fs, p);
                xmlSerializer = new XmlSerializer(typeof(jobsurvey));
                foreach (var s in thesurv)
                    xmlSerializer.Serialize(fs, s);
            }
        }
        catch (InvalidOperationException ex)
        {
            Console.WriteLine("Can't write the xml file : {0}--{1}", ex.Message, ex.StackTrace);
        }
    }

The code is being drawn directly from SQLite and written to an XML file.
While this works, at the end of each class and start of the next I'm getting the XML header added each time. In other words
</jobsurvey>
<?xml version="1.0" encoding="utf-8">
<parts xmlns:xsi="http://www.w3.org ...

Is there a way to prevent the serialiser from generating the <?xml and xmlns: parts for each class being serialised without having to create the file, then reparse to remove these bits I don't need?

A: You can try something like this.
The important things here are XMLWriterSettings and XmlSerializerNamespaces.
XmlWriterSettings settings = new XmlWriterSettings();
settings.OmitXmlDeclaration = true;

MemoryStream ms = new MemoryStream();
XmlWriter writer = XmlWriter.Create(ms, settings);

XmlSerializerNamespaces names = new XmlSerializerNamespaces();
names.Add("", "");

XmlSerializer cs = new XmlSerializer(typeof(Cat));

cs.Serialize(writer, new Cat { Lives = 9 }, names);

ms.Flush();
ms.Seek(0, SeekOrigin.Begin);
StreamReader sr = new StreamReader(ms);
var xml = sr.ReadToEnd();


text:
Q: Unable to configure nestjs/mongoose, initial database I am not sure I understand the nestjs/mongoose configuration.
I am not getting any results back and am assuming it is querying my admin database.
app.module.ts:
import { ConfigService } from './config/config.service';
import { Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';

import { ConfigModule } from './config/config.module';
import { CaseAssetsModule } from './case-assets/case-assets.module';

@Module({
  imports: [
    ConfigModule,
    CaseAssetsModule,
    MongooseModule.forRootAsync({
      imports: [ConfigModule],
      useFactory: async (configService: ConfigService) => ({
        uri: configService.getString('mongodb.uri'),
        useNewUrlParser: true,
        useUnifiedTopology: true,
      }),
      inject: [ConfigService],
    })
  ],
  controllers: [],
  providers: [],
})
export class AppModule { }

my config setting:
mongodb.uri = mongodb://<<myuser>>:<<mypwd>>#@<<myserver>>:27017/admin

case-assets.module.ts:
import { AssetSchema } from './asset.schema';
import { Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { CaseAssetsController } from './case-assets.controller';
import { CaseAssetsService } from './case-assets.service';

@Module({
  imports: [MongooseModule.forFeature([{ name: 'Asset', schema: AssetSchema, collection: 'assets' }])],
  controllers: [CaseAssetsController],
  providers: [CaseAssetsService]
})
export class CaseAssetsModule {}

Where do I specify the database that I want to connect to? I specify admin because that is the database that I authenticate against.
Gina

A: You've determined what database you want to connect to via the configuration given to the MongooseModule.forRootAsync() method. From there, anything used from MongooseModule.forFeature() uses the same configuration (i.e. the same database)
Edit with Solution
Okay, now I understand the problem. Looks like with mongo you can supply an authSource query parameter like so mongodb://mongodb1.example.com:27317,mongodb2.example.com:27017/?authSource=authDB. So long as you need auth for every model in your db, this kind of URI should handle it. You can pass this to the MongooseModule.forRoot({}) or MongooseModule.forRootAsync({}) configuration.
If you need this to be on a per model basis, however, I don't think the current MongooseModule can handle that.
Edit
Solution with two connections:
app.module.ts
MongooseModule.forRootAsync({
 imports: [ConfigModule],
 connectionName: 'firstDB',
 useFactory: async (config: ConfigService) => ({
  uri: config.get('app.firstDB'),
  useNewUrlParser: true,
  useUnifiedTopology: true,
 }),
 inject: [ConfigService],
}),
MongooseModule.forRootAsync({
 imports: [ConfigModule],
 connectionName: 'secondDB',
 useFactory: async (config: ConfigService) => ({
  uri: config.get('app.secondDB'),
  useNewUrlParser: true,
  useUnifiedTopology: true,
 }),
 inject: [ConfigService],
}),

cats.module.ts
@Module({
 imports: [
  MongooseModule.forFeature(
   [
     {
      name: 'Cat',
      schema: CatSchema,
      collection: 'cats',
     },
    ],
   'firstDB',
  ),
 ],
})
export class CatsModule {}

dogs.module.ts
@Module({
 imports: [
  MongooseModule.forFeature(
   [
     {
      name: 'Dog',
      schema: DogSchema,
      collection: 'dogs',
     },
    ],
   'secondDB',
  ),
 ],
})
export class DogsModule {}


text:
Q: Add styling to translation string in i18n-js React Native I use i18n-js for translation purposes in my React Native app. But I cannot get any styling like different colors, bold etc. to my translations.
This is my en.js:
import {Text} from "react-native";

  const highlightText = (string) =>
    string.split(" ").map((word, i) => (
      <Text key={i}>
        <Text style={{ backgroundColor: "#ECEAFF", color: "#5F5C7E" }}>
          {word}
        </Text>
      </Text>
    ));

const en = {
   testTranslation:`This Text has some styling to it: ${highlightText("<h1>Hello</h1>")} isn't that pretty?`,

I use the translation on my screen like this:
import i18n from "i18n-js";
import { de } from "../../../locales/de";
import { en } from "../../../locales/en";
import { fr } from "../../../locales/fr";

i18n.fallbacks = true;
i18n.translations = { en, de, fr };

...
 <Text>
     {i18n.t("testTranslation")}
 </Text>

The outcome is this:

This Text has some styling to it: [object Object] isn't that pretty?

Any help how to style the text is much appreciated!

A: You can use syntax something like this
Create 3 string in translation file. Example
in translation files
str1: 'this is"
str2: 'bold'
str3: 'copy'

Now you can do something like
<>
  <Text>{i18n.t(str1)}</Text>
  <Text className="boldStyle">{i18n.t(str2)}</Text>
  <Text>{i18n.t(str3)}</Text>
<>

There are other patterns for the same. but this is clean and small


text:
Q: spring batch remote chunking for realtime data processing We have to process around 2 million records within 6-7 hrs and all this records are not available immediately. It comes in real time in the batch of 1000 or 2000 like that. I was thinking of using spring batch remote chunking as in our case bottleneck is processing those individual record. Reading them is very fast and also we will not have to read all 2 million all together.
Our goal is to process those 1000 or 2000 records as soon as possible so other system can use it as it is waiting on them.
My question is

*

*Is it a good idea to use spring integration jdbc poller to read those 1000 record and launch spring batch job with remote chunking with multiple slave?

*Is there any sample project available about remote chunking?


text:
Q: spring data REST webmvc HATEOAS - How to identify target type in a link property? I am working on a CRUD application using spring-data-rest-webmvc.
I have a Product entity as below:-
{
"version": 0,
"displayName": "Test Product",
"_links": {
    "self": {
        "href": "http://localhost/services/data/products/123465"
    },
    "fixedParentCategories": {
        "href": "http://localhost/services/data/products/123465/fixedParentCategories"
    }
}

When I access the URL for the property "fixedParentCategories" (http://localhost/services/data/products/123465/fixedParentCategories), it returns a 404 (ResourceNotFoundException thrown and translated to 404).
The problem that I have here is that, this 404 response does not help me identify what type of objects go into this collection (fixedParentCategories).
If there is an item present in the collection, I get a response like below:-
{
"_embedded": {
    "categories": [
        {
            "version": 0,
            "displayName": "Test category",
            "_links": {
                "self": {
                    "href": "http://localhost:8080/services/data/categories/54c9963a8c21fbd950b6f1cf"
                },
            }
        }
    ]
}

}
It clearly says that the items are of type "categories".
My question is: Is there any way of identifying the target item type when the collection is empty, so that the client side code can address it properly?


text:
Q: asp.net AjaxControlToolkit CalendarExtender: setting displayed month programmatically from client side Is there a way to set the calendar extender, or a method I can call so it always displays the month containing the selected date when the target textbox is clicked? I have found the method to set the selected date, but this does not automatically bring the month of the selected date into view.

A: You can handle the onClientShown event:
<cc1:calendarextender ID="Calendarextender1"
    OnClientShown="clientShown" ...

For example:
<script type="text/javascript">
    function clientShown(sender, args) {
        var extender= $find('Calendarextender1');
        sender.set_visibleDate(extender._selectedDate);
        // the following is just to show you some other interesting methods
        //sender.set_todaysDate(extender._selectedDate);
        //sender.set_selectedDate(extender._selectedDate);
    }
</script>

I'm afraid there's no documentation, so try them out.