text:
Q: SQL query about database I have some trouble with SQL.
I have database structure like below

I should write a query that return: All moviestar's name and address, where they are woman(G='F') and address="Berlin" + all studio's name and address, where address="Berlin" too. Ordered by address.
My suggestion is:
SELECT * FROM
   (SELECT name, address
   FROM MovieStar
   WHERE gender = 'F'
   UNION
   SELECT name, address FROM Studio) T
WHERE T.address LIKE '%Berlin%' ORDER BY T.address;

A: This should work for you.
SELECT name, address
   FROM MovieStar
   WHERE gender = 'F' AND address LIKE '%Berlin%'
   UNION
   SELECT name, address FROM Studio WHERE address LIKE '%Berlin%'
ORDER BY address;

A: You can just do this
SELECT name, address from MovieStar WHERE gender='F' AND address LIKE '%Berlin%'
UNION
SELECT name, address from Studio WHERE address LIKE '%Berlin'

and if you want use subquery like you do in your example, I think you have to add "as" keyword for sub query
SELECT * FROM
   (SELECT name, address
   FROM MovieStar
   WHERE gender = 'F'
   UNION
   SELECT name, address FROM Studio) AS T
WHERE T.address LIKE '%Berlin%' ORDER BY T.address;

but I'm not sure, that's a good deal for performance since you will have a memory table created and then projected


text:
Q: How to close Modal in Reactjs? On button click i was trying to open a model (and modal opening too) and in a same modal it contain a button and on button click i was trying to open another  model (and second modal opening too), but when  second modal is opening i want first model to be closed. can it be possible?
Here is my sandbox demo https://codesandbox.io/embed/dreamy-herschel-cyetn?fontsize=14&hidenavigation=1&theme=dark
const Practice = () => {
    const [modalShow, setModalShow] = useState(false);
    const handleSubmit = event => {
        setModalShow(true);
    };
    return (

            <Button onSubmit={handleSubmit} type="submit">
                Submit
            </Button>
            <Modals show={modalShow} onhide={() => setModalShow(false)} />

    );
};

here is my modal part
const Modals = ({ show, onhide }) => {
    const [modalShowsec, setModalShowsec] = useState(false);

    const Validation = () => {
        setModalShowsec(true);
    };

    return (

            <Modal show={show} onHide={onhide} size="sm" aria-labelledby="contained-modal-title-vcenter" centered>
                <Modal.Header closeButton>
                    <Modal.Title id="contained-modal-title-vcenter">HELLO</Modal.Title>
                </Modal.Header>
                <Modal.Body>

Hi

                </Modal.Body>
            </Modal>
            <button onClick={Validation}> Validate </button>
            <Modal show={modalShowsec} onHide={() => setModalShowsec(false)}>
                <Modal.Header closeButton />
                <Modal.Body>

Hi cool

                </Modal.Body>
            </Modal>

    );
};

A: Call onhide inside Validation function. This will hide the first modal.
const Validation = () => {
        setModalShowsec(true)
        onhide()
    }

redpajama_set_name: RedPajamaStackExchange


text:
Q: Ember - Can't get route from controller when defining custom controller with controllerName I'm trying to bind a custom controller for a route by using:
# app/routes/products/category.coffee

`import Ember from 'ember'`

route = Ember.Route.extend

  controllerName: 'categories/selector'

`export default route`

This works, but when I try to bubble events from that controller to the route it gets in a recursive loop.
I found that this is because the custom controller can't get to the route, because 'target' is the controller:
# app/controllers/categories/selector.coffee

`import Ember from 'ember'`

controller = Ember.ArrayController.extend

  actions:
    back: ->
      console.log "controller back action handle"
      console.log (@ == @get 'target') # => true
      return false # Returning true creates recursive loop

`export default controller`

The template:
# app/templates/products/category.hbs

{{render 'categories/selector'}}

Is this normal behavior? How would I get to the route from this custom controller?

A: The problem was in the template, you should be using:
# app/templates/products/category.hbs

{{partial 'categories/selector'}}

render creates its own context/controller, as stated by @givanse.


text:
Q: How to using Oracle Java SE embedded to work with raspberry sense hat I just set up the sense that with my raspberry pi 3, and play around the Python API, which is pretty cool. Is there any official support for Java SE embedded? I couldn't find any doc how to communicate with GPIO or how to using ME version API with SE embedded

A: Please have a look to the article if you not looked yet to http://www.oracle.com/technetwork/articles/java/raspberrypi-1704896.html
I believe its all will help you. At-least I been able to start working reading this when I started first time.
Also, to answer your question, there is no worry about ME etc. Same code which you write with Normal SDK, will work here too.


text:
Q: How to fill the region between several curves in python? How to fill with colour the region between four curves in this code, please? Two of them is a connection between two points. I tried the following script. The last but one row is wrong.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches

x_shift = 140.5
b = 50
const = 28.3

fig, ax = plt.subplots()
plt.rcParams["figure.figsize"] = [10, 3]

r = np.sqrt(36000)
theta_zoom1 = np.linspace(-0.14*np.pi, 0, 10000)
x1_zoom1 = r*np.cos(theta_zoom1) - x_shift
x2_zoom1 = r*np.sin(theta_zoom1) + b
theta_zoom2 = np.linspace(-0.156*np.pi, 0, 10000)
x1_zoom2 = r*np.cos(theta_zoom2) - x_shift
x2_zoom2 = r*np.sin(theta_zoom2) + b

ax.plot(x1_zoom1 + const, x2_zoom1)
ax.plot(x1_zoom2 + 3*const, x2_zoom2)

plt.plot([60, 130],[-9.2, -9.2])
plt.plot([70, 140],[35.7, 35.7])

ax.fill_between(x2_zoom1, x2_zoom2)

plt.show()

Wrong result:

The desired result:

A: You can use ax.fill_betweenx() to fill the region. This needs a common array of y-values and two arrays of corresponding x-values. np.interp() can be used to match the existing curves to the new y-values. Note that the given y-values need to be in strict increasing order for this to work.
import numpy as np
import matplotlib.pyplot as plt

x_shift = 140.5
b = 50
const = 28.3

fig, ax = plt.subplots()
plt.rcParams["figure.figsize"] = [10, 3]

r = np.sqrt(36000)
theta_zoom1 = np.linspace(-0.14 * np.pi, 0, 10000)
x1_zoom1 = r * np.cos(theta_zoom1) - x_shift
x2_zoom1 = r * np.sin(theta_zoom1) + b
theta_zoom2 = np.linspace(-0.156 * np.pi, 0, 10000)
x1_zoom2 = r * np.cos(theta_zoom2) - x_shift
x2_zoom2 = r * np.sin(theta_zoom2) + b

ax.plot(x1_zoom1 + const, x2_zoom1)
ax.plot(x1_zoom2 + 3*const, x2_zoom2)

ax.plot([60, 130], [-9.2, -9.2])
ax.plot([70, 140], [35.7, 35.7])

y_fill = np.linspace(-9.2, 35.7, 200)
x_fill1 = np.interp(y_fill, x2_zoom1, x1_zoom1 + const)
x_fill2 = np.interp(y_fill, x2_zoom2, x1_zoom2 + 3*const)

ax.fill_betweenx(y_fill, x_fill1, x_fill2, color='crimson', alpha=0.3)

plt.show()


text:
Q: Google Maps - Locations and Circle Hello Stackoverflowers,
I am trying to combine both multiple locations and a circle within the same map, I have had a look around to see how to combine two different element types but I have yet to find anything useful.
Below is some example code that draws a circle:

Now for example if I wishied to place 2 markers at:
lat  29.937641 long -93.969326
lat  30.063964 long -94.116131
How would I incorporate that into the above code? Or visa versa if I had code with points how would I incorporate the circle elements?
As always thanks for your help in advance!

A: function initialize()
{
var mapProp = {
  center:Hotspot,
  zoom:7,
  mapTypeId:google.maps.MapTypeId.ROADMAP
  };

var map = new google.maps.Map(document.getElementById("googleMap"),mapProp);

var marker1=new google.maps.Marker({map:map, position: new google.maps.LatLng(29.937641,-93.969326)});
var marker2=new google.maps.Marker({map:map, position: new google.maps.LatLng(30.063964 .-94.116131)});

var Circle = new google.maps.Circle({
  center:Hotspot,
  radius:25000,
  strokeColor:"#0000FF",
  strokeOpacity:0.8,
  strokeWeight:2,
  fillColor:"#0000FF",
  fillOpacity:0
  });

Circle.setMap(map);
}


text:
Q: TypeScript resolve exact types from json file I have a json configuration file
[{ name: "apple", weight: 1.0 }, { name: "banana", weight: 2.0 }]

I create type that describes this configuration
type Config = { name: "apple" | "banana", weight: number }[];

Now I create a function that returns that configuration
import Configuration from './configuration.json';

function getConfig(): Config {
   return Configuration;
}

I get error saying that

Type 'string' is not assignable to type '"apple" | "banana"'

I understand that the problem is with the field name which type is resolved to string and not "apple" | "banana".
It it possible to resolve .json files with exact types? So that I can be sure that the .json file has the correct structure using only TypeScript type system?

A: It is a cast problem.
Try casting it like this.
function getConfig(): Config {
   return Configuration as Config;
}


text:
Q: Why i can't use switch-case with chars? I can't use chars in switch-cases.
printf("choose: \n[w=woman] [m=man] ");
scanf_s("%s" ,&c);

switch (c) {
    case 'w':
        printf("45,5"); break;
    case 'm':
        printf("50"); break;

}

When we type "w" the code suppose to write "45,5" on the screen but the code doesn't do what we want. It works when i use the same code with necessary edits for numbers (int).

A: If the variable c has the type char then in the call of scanf_s you have to use the conversion specifier %c instead of %s
scanf_s( " %c", &c, ( rsize_t )1 );

Instead of scanf_s to input a character you could use function scanf like
scanf( " %c", &c );

In the both cases pay attention to the leading space in the format string. It allows to skip white space characters as for example the new line character '\n' that can be stored in the input buffer after pressing the Enter key.

A: Maybe it is not the best solution for your problem, but i would recommend to look up,

int strcmp(const char *s1, const char *s2);

It is a standard function, to compare two strings, in case you would use multiple characters to match.


text:
Q: Shell command works in terminal, but fails in node I'm having a problem with a code in typescript that executes a shell script. The code's part that executes the shell script is something like below:
const child = child_process.exec(command.script, (error: child_process.ExecException, stdout: string, stderr: string) => {
    /* ... */
});

It's working fine, but when I try to execute the following script, it fails:
{
    name: "Gerar aab",
    script: `cd ${PATH}/${projectId}/aplicativo/platforms/android && ./gradlew bundle`
}

Console result (stderr):
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

* Where:
Script '/opt/lupi/lupiteste/aplicativo/platforms/android/CordovaLib/cordova.gradle' line: 121

* What went wrong:
A problem occurred evaluating project ':app'.
> Unable to determine Android SDK directory.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 9s

The problem is that the same command works perfectdly in terminal. I tried use shelljs and now child_process, and cwd option instead cd but the same issue.
The application is running in a Debian 10 server.
How to solve it, please?

A: The default shell for exec is `/bin/sh'.
Your shell in the terminal is likely bash.
So that's probably one difference, but you can specify a shell in the options.
This looks like a problem with the environment of the script, so you probably want to check that the expected path environment variable is what you think it is in the child process. If you need to, you can specify the environment in the options too.


text:
Q: Django HttpResponseRedirect and NoReverseMatch I am trying to redirect to a new form page whose fields get automatically filled with the data sent from the view function.
My urls.py is:
url(r"user_dashboard/NewRequest/([\{.*\}])", views.request_form, name = "NewRequest")

The view function which is sending the data is present at:
url(r"user_dashboard/NReq", views.request_request, name="NReq"),

which calls the above url.
The return statement from my view function is:
return HttpResponseRedirect(reverse(request_form, kwargs={"device_type":devicetype}))

But, I get the following error:
NoReverseMatch at /user_dashboard/NReq
Reverse for 'inventory_management_app.views.request_form' with keyword arguments '{u'device_type': u'Laptop'}' not found. 1 pattern(s) tried: ['user_dashboard/NewRequest/([\\{.*\\}])']
Request Method: POST
Request URL:    http://127.0.0.1:8000/user_dashboard/NReq
Django Version: 1.11.13
Exception Type: NoReverseMatch
Exception Value:
Reverse for 'inventory_management_app.views.request_form' with keyword arguments '{u'device_type': u'Laptop'}' not found. 1 pattern(s) tried: ['user_dashboard/NewRequest/([\\{.*\\}])']
Exception Location: C:\Anaconda2\lib\site-packages\django\urls\resolvers.py in _reverse_with_prefix, line 497
Python Executable:  C:\Anaconda2\python.exe
Python Version: 2.7.14
Python Path:
['E:\\inventory management\\inventory_management_service',
 'C:\\Anaconda2\\python27.zip',
 'C:\\Anaconda2\\DLLs',
 'C:\\Anaconda2\\lib',
 'C:\\Anaconda2\\lib\\plat-win',
 'C:\\Anaconda2\\lib\\lib-tk',
 'C:\\Anaconda2',
 'C:\\Users\\Jaimik Jain\\AppData\\Roaming\\Python\\Python27\\site-packages',
 'C:\\Anaconda2\\lib\\site-packages',
 'C:\\Anaconda2\\lib\\site-packages\\win32',
 'C:\\Anaconda2\\lib\\site-packages\\win32\\lib',
 'C:\\Anaconda2\\lib\\site-packages\\Pythonwin',
 'C:\\Anaconda2\\lib\\site-packages\\pywinpty-0.5-py2.7-win-amd64.egg']
Server time:    Wed, 6 Jun 2018 07:48:44 +0000

Can anyone please tell me what's wrong present in the above code?

A: Instead of the following regex expression url(r"user_dashboard/NewRequest/([\{.*\}])", views.request_form, name = "NewRequest") in your URL:
try with re group name:
url(r"user_dashboard/NewRequest/(?P<device_name>\w.+)", views.request_form, name = "NewRequest")

Make sure you have device_name as a default argument in your view
def request_form(request,device_name=''):
    '''


text:
Q: How to read json data using javascript? Here the data I get as json from the server?
{id: 1, no: "CP101", pack: "PH"}

How can I read it using javascript?
when I use
var obj = JSON.parse('{id: 1, no: "CP101", pack: "PH"}');
document.getElementById("demo").innerHTML = obj.id + ", " + obj.no;

Gives me No output.

A: you should add some html sympol like this:

document.getElementById('domId').innerHTML="
+"obj.id+obj.no+"
";

because the innerHTML is content like string

A: you must be well formatted your parsing data something like below-
var obj = JSON.parse('{"id": 1, "no": "CP101", "pack": "PH"}');

A: Your Object is not stringified and you can not use JSON.parse.

var obj = {
  id: 1,
  no: "CP101",
  pack: "PH"
};
document.getElementById("demo").innerHTML = obj.id + ", " + obj.no;

console.log("Normal Object", obj, "Type of it is", typeof obj);

var myJSON = JSON.stringify(obj);
console.log("Stringified Object", myJSON, "Type of it is", typeof myJSON);

Read here and here


text:
Q: Connect a bot to Facebook Messenger Following examples show how to connect a bot to Facebook Messenger if it installed on Bot Framework Portal.

*

*https://learn.microsoft.com/en-us/bot-framework/channel-connect-facebook

*https://www.codeproject.com/Articles/1110201/Creating-A-Facebook-Bot-Using-Microsoft-Bot-Framew
But what if bot installed on Azure? What are my steps then? Where to take Callback URL and Verify Token values? How to connect correctly? Bot written on NodeJS and deployed as NodeJS Web App on Azure.

A: Exactly the same steps...
First, to clarify: the bot is not installed on Bot Framework Portal (dev.botframework.com); you are just creating the bot and registering it. And it's there where you will enable the Facebook Messenger channel.
If your bot is hosted in Azure, the only difference then would be that the URL of your bot in the Bot Framework portal will be the URL of your Web App (e.g. mybot.azurewebsites.net) there + /api/messages instead of any other URL.
All the information about how to get the Callback Url and the Token is explained at https://learn.microsoft.com/en-us/bot-framework/channel-connect-facebook#provide-webhook-callback-url-and-verify-token
If you are using Azure Bot Service (which I don't think so, because your question doesn't mention it), then the "portal" is embedded in Azure, at the settings of your bot.


text:
Q: In Which Direction are the Two Bodies Moving During a Collision? When two bodies collide, they apply equal and opposite forces on each other for a brief time. I have looked up the topic in the web, but only found that the bodies apply forces on each other for some short interval of time and not how they move during that interval. After the collision, the two bodies may go in the opposite directions, or in the same direction, but in which direction are they moving during this collision, that is during this brief period of contact (whatever it is microscopically)? I don't know how to go about thinking this problem.

A: Let's read what says Wikipedia:

A perfectly elastic collision is defined as one in which there is no loss of kinetic energy in the collision. In reality, any macroscopic collision between objects will convert some kinetic energy to internal energy and other forms of energy, so no large-scale impacts are perfectly elastic. However, some problems are sufficiently close to perfectly elastic that they can be approximated as such. In this case, the coefficient of restitution equals one.

So what happens in the real case? Hard bodies are one which are not easy deformable. They get deformed in such a way that to some extend of energy the applied energy is kicked back in a short time.
There is nearly no dissipation of the energy out from the direction of the collision. In the direction of the collision the molecules get shifted but this shift has a minimal - in reference to an elastic body - extend and once has gone through the body returns very fast back and kick the other body.

In which direction are the two bodies moving during a collision?

At the first half of the collision the involved area is simply moving slower (gets deformed) as the whole moving body and at the second half this deformation vanishes completely again. If one of the bodies is in rest the description is a little bit different: In the first half of the collision the involved area starts moving and in the second half the body gains velocity faster the deformed area and the deformation vanishes.
To be more precise, the first and the second "half" are a little of different time.

A: Each of the bodies experiences a deformation during the collision, and the deformation is not spatially uniform.  During the initial part of the collision, the leading edges of the bodies become compressed, while the remainder of the bodies are still traveling at their original velocities, and are not yet compressed.  As time progresses, the compression zones grow (at the speed of sound in the material) until the compression zone encompasses the entire body, and its velocity is greatly diminished (or it has stopped all-together).  Then the compression starts getting released at the trailing edge of the body, and the size of this released zone grows (again, at the speed of sound in the material) until the entire body is no longer compressed.  At this point, the body will have its final rebound velocity, and the bodies separate.


text:
Q: Angular2 DI error in jasmine test I'm writing some angular2 unit tests using jasmine and working on a unit test for a component. For some reason, when I try to instantiate the component using the TestBed class, I get a dependency injection error.
LoginComponent:
import { Component } from '@angular/core';
import { LoginService } from './login.service';

@Component({
    selector: 'login',
    template: require('./login.template.pug'),
    styles: [require('./style.scss')],
    providers: [LoginService]
})
export class LoginComponent {
    public username: string;
    public password: string;

    constructor(private loginService: LoginService) {
    }

    public login(username, password) {
        this.loginService.login(username, password)
            .then((token: string) => {
            })
    }
}

LoginComponentTest:
import { TestBed, inject, async, ComponentFixture } from '@angular/core/testing';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { LoginComponent } from './login.component';
import { LoginService } from './login.service';
import { BrowserModule } from '@angular/platform-browser';

describe('LoginComponent', () => {

    class MockClass {
        get(url): Promise<any> {
            throw Error('not implemented');
        };
    }

    beforeEach(async(() => {
        TestBed.configureTestingModule({
            declarations: [
                LoginComponent
            ],

            providers: [
                LoginComponent,
                { provide: LoginService, useClass: MockClass },
            ],

            imports: [
                FormsModule,
                BrowserModule,
                ReactiveFormsModule
            ]
        })
    }));

    it('will let user login', async(() => {
        TestBed.compileComponents()
            .then(() => {
                let fixture: ComponentFixture<LoginComponent> = TestBed.createComponent(LoginComponent);
            });
    }));
});

The line
let fixture: ComponentFixture<LoginComponent> = TestBed.createComponent(LoginComponent);

gives the following error:

Chrome 57.0.2987 (Mac OS X 10.12.3) LoginComponent will let user login
  FAILED    Error: DI Error
        at NoProviderError.ZoneAwareError (webpack:///~/zone.js/dist/zone.js:958:0 <-
  config/spec-bundle.js:75553:33)

I have the LoginComponent declared along with its own dependency, LoginService.
Any ideas about what's going on?

A: Okay, I figured it out, kind of. Apparently the issue has to do with the providers declaration in LoginComponent:
providers: [LoginService]

Once I moved that out of LoginComponent and into AppModule, things started working. Would be interested to know why the test doesn't work with it declared inside the component itself.


text:
Q: How to prevent FAB from scrolling with CoordinateLayout in Android I've the below layout xml for my activity
<android.support.design.widget.CoordinatorLayout
     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:background="@color/white"
     android:fitsSystemWindows="true"
     tools:context=".HomeActivity">

     <android.support.design.widget.AppBarLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:theme="@style/AppTheme.Dark.AppBarOverlay"
          app:elevation="0dp">

          <android.support.v7.widget.Toolbar
               android:id="@+id/toolbar"
               android:layout_width="match_parent"
               android:layout_height="?attr/actionBarSize"
               android:background="?attr/colorPrimary"
               app:layout_scrollFlags="scroll|enterAlways"
               app:popupTheme="@style/AppTheme.Dark.PopupOverlay">
     </android.support.design.widget.AppBarLayout>

     <RelativeLayout
        android:id="@+id/rl_updates"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/ll_footer"
        android:layout_below="@+id/ll_fibres_search">

        <android.support.v4.widget.SwipeRefreshLayout
              android:id="@+id/srl_updates"
              android:layout_width="match_parent"
              android:layout_height="match_parent">

               <android.support.v7.widget.RecyclerView
                     android:id="@+id/rv_all_requirements"
                     android:layout_width="match_parent"
                     android:layout_height="match_parent"
                     android:divider="@color/iron"
                     android:dividerHeight="1px"/>
         </android.support.v4.widget.SwipeRefreshLayout>

         <android.support.design.widget.FloatingActionButton
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:layout_alignParentEnd="true"
              android:layout_alignParentRight="true"
              android:layout_marginBottom="@dimen/activity_horizontal_margin"
              android:layout_marginEnd="@dimen/activity_horizontal_margin"
              android:layout_marginRight="@dimen/activity_horizontal_margin"
              android:onClick="onRequirement"
              android:overScrollMode="never"
              android:src="@drawable/ic_playlist_add_white_24dp"
              app:backgroundTint="@color/pink"/>
    </RelativeLayout>
</android.support.design.widget.CoordinatorLayout>

When I scroll the Recycler View, the App Bar collapses just like I wanted it to be. But the problem is the FAB also shifts down a little bit. I set 16dp margin to the bottom but it sticks to the bottom of the screen.
How do I prevent the FAB from shifting down initially?
This is how it looks now

A: Have you tried taking the FloatingActionButton outside the RelativeLayout and inside the CoordinatorLayout? You can do that and give it the attribute:
    android:layout_gravity="bottom|right|end"

instead of:
    android:layout_alignParentBottom="true"
    android:layout_alignParentEnd="true"
    android:layout_alignParentRight="true"

A: set anchor for your FAB button
app:layout_anchorGravity="bottom|right|end"
 android:layout_gravity="right"

A: Replace RelativeLayout with FrameLayout and add this line to your FAB
android:layout_gravity="right|bottom"
like this
<FrameLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/srl_updates"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/rv_all_requirements"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
 android:divider="@color/iron"
            android:dividerHeight="1px"/>
    </android.support.v4.widget.SwipeRefreshLayout>

    <android.support.design.widget.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/activity_horizontal_margin"
        android:layout_marginEnd="@dimen/activity_horizontal_margin"
        android:layout_marginRight="@dimen/activity_horizontal_margin"
        android:onClick="onRequirement"
        android:layout_gravity="right|bottom"
        android:overScrollMode="never"
        android:src="@drawable/ic_playlist_add_white_24dp"
        app:backgroundTint="@color/pink"/>

</FrameLayout>


text:
Q: Powershell Commands I have figured out how to add active directory groups to a user using the following command
Add-ADGroupMember -Identity "Group Name" -Members "UserName"

Is there a way to add multiple groups to a user or multiple users to a group? I have tried comma separating the users and groups but it doesn't seem to work.

A: get-aduser username | Add-ADPrincipalGroupMembership -MemberOf "group1","group2"


text:
Q: Non-force using 'Jedi' Were there ever any people to follow the Jedi Path that were unable to use the force? Of course, I know that to truly be a Jedi, one had to be able to use the force. Were there ever any folks who decided to follow the Jedi way of thought, just without the force?

A: You didn't really define "Jedi Path", so it's hard to answer. But as far as it can be answered, "no".
Jedi path was all about the Force and Jedi's connection to it. Everything else (morality, ethics) was secondary.
Were there people who wanted to do good deeds and meditated and chose not to anger and experience other negative emotions and helped others? DUH. Of course. Were they "following Jedi Path"? Not in any way, shape or form.
Case in point: Prince Isolder. Luke senses that he has latent Force abilities, but very weak, and counsels him on Jedi Path. But it's all around the Force first, and morality second. The ONLY reason he spent so much time/effort on Isolder was the Force connection, even if weak; and not the fact that Isolder needed moral counseling as a human.
There were some members of the Jedi Order that were not very strong in the force, but I don't think that answers your question. (NJO had a Jedi whose name escapes me who was basically an order historian and not very strong as a Jedi.)
Your question is like asking if anyone followed Christian path without believing that Jesus Christ existed or died for their sins. The former would make them possibly good, moral or whatever person - but in no way shape or form a Christian.

A: No.
The semi-canon "The Jedi Path: A Manual for Students of the Force" (based on the 6 official Star Wars films and the Clone Wars TV series and created in direct collaboration with Lucasfilm) defines someone who follow the Jedi Path as someone who strives to observe the three primary precepts of Jedi teaching;

*

*Mastery of The Force

*Knowledge of the wider world

*The attainment of self-discipline.
While someone could theoretically focus the latter two, the ability to gain mastery of even the most basic elements of the Force (healing, absorbing energy, mindfulness of the living force, telekenesis) is solely the purview of those who are Force Sensitive.


text:
Q: PHPUnit test in Symfony 5 - unit test always return a 404 or 500 Configuration :
OS : MacOS Catalina 10.15.4
Web server : Apache (using MAMP)
PHP version : 7.3.9
Symfony version : Symfony CLI version v4.16.3
Composer version : Composer version 1.10.7
Issue :
I started using PHPUnit as mentioned in the Symfony documentation about testing, and I wanted to try it with a simple test: send get request to my main page (route = '/') and see if I have a 200 status code as expected.
My process :
In my project :
composer req --dev Symfony/PHPUnit-bridge Symfony/css-selector symfony/browser-kit symfony/maker-bundle

bin/console make:functional-test MainControllerTest

and here is the test file in tests/ :
<?php

namespace App\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class MainControllerTest extends WebTestCase
{

    public function testIndex()
    {
        $c = static::createClient();
        $c->request('GET','/');
        $this->assertEquals(200, $c->getResponse()->getStatusCode(), 'REQUEST IS : ' . $c->getRequest());
    }
}

So this is the basic test controller, I just modified it a bit by customizing the output message to get my request as an output.
then :
bin/PHPUnit tests

and finally my output :
PHPUnit 8.3.5 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.3.8 with Xdebug 2.7.2
Configuration: /Applications/MAMP/htdocs/DEV/symfony_app/phpunit.xml

Testing tests
F                                                                   1 / 1 (100%)

Time: 947 ms, Memory: 24.00 MB

There was 1 failure:

1) App\Tests\Controller\MainControllerTest::testIndex

REQUEST IS : GET /DEV/symfony_app/public/index.php/dossier/all HTTP/1.1
Accept:          text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:  ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
Host:            localhost:8888
User-Agent:      Symfony BrowserKit
X-Php-Ob-Level:  1

Failed asserting that 404 matches expected 200.

/Applications/MAMP/htdocs/DEV/symfony_app/tests/Controller/MainControllerTest.php:16

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.

But my web server is running and I can access my '/' route, I've tried changing the Uri to 'http://localhost:8888/DEV/symfony_app/public/' or 'http://localhost:8888/DEV/symfony_app/public/index.php'

but it always returns 404 instead of 200.

I've configured some routes and main is one of them if you are not authenticated you are redirected to '/login' which is one of the only routes you can access as an anonymous user, so I tried to this test with my '/login' route but I also have 404 status.
I'm literally at the beginning of the testing documentation but if this simple test doesn't work I can't go further.

Any clue on this?
Similar issues I saw :
Symfony functional test fail but the same request works in browser
Unfortunately, none of the answers fixed my problem

A: I had the same issue, it reminded me of getting an error on production, it always returned 404 not found, but really the error was 500 error.
so on .env.test.local I changed APP_DEBUG=true, and then from the $client->getResponse, I found out that it was actually giving 500 error because the test database was empty
check if you are actually getting 404 or is it actual 500.


text:
Q: How to keep a digital asset in Hyperledger Fabric? I'm working with the BYFN example using 3 organizations, 2 channels. One channel(c12) between Org1 and Org2, another channel (c23) between Org2 and Org3. The first chaincode is an example where I'm able to transfer value between "A" and "B". When I run the code over c12, I can see I'm able to transfer an amount from A to B. But when I query the same chaincode over c23, the initialization is kept. I understand why (different ledgers) and etc.
Now I would like to introduce the following requirement. I, as an organization, need to transfer this value only if I have the amount available.
The sequence would be:
1. I'm on org2, I have 100, and I wanna transfer 60 to org1. And everything works as expected.
2. I'm on org2, I have 40 and I'll try to transfer 50 to org3 (another ledger - channel). This should fail because I have only 40.
How can I achieve this?
Where will the "shared state" be stored? MSP?
The same approach would work for a complex asset?
Extra information:
- I already have read the documentation, about the assets, account model, the examples, but usually, they are focused only one channel only. Maybe I'm losing something.
- I'm not using hyperledger composer

A: In fabric you have a chaincode and a ledger different for each channel. so if you want to have the business logic descripted you need to use only one channel (with 3 orgs).
You can probably use private data to make the separation you are now doing with the two channels


text:
Q: Forcing/allowing different TravelModes in between different waypoints Had a hard time coming up with a subject description that would fit my question, but I will elaborate:
I'm calculating and plotting a route from A to C with 1 waypoint along the way, lets call it B

So my route looks like this :   A  ->   B (waypoint) ->  C

If the route has this format (passing over waypoint B) I would like to FORCE  the route between point A and B to use travelmode "walking"
I would love to go about this in the most clean way possible , but I was not able to use "waypoints" as such in this way.
I came up with a very hacky alternative of cutting the route from A to C up in 2 separate routes (so needing two separate DirectionsRenderer  objects (1 for each route)) which enabled me to force a travelmode into those objects separately.
Eventually this does exactly what I want it to do ... but it still does not feel right.
Anyone any experience in doing this ? I feel like I just looked over some part in the docs which explains how to set separate travel modes for each route between waypoint.
Short snippet of my hacky alternative:
... code omitted ...

var directionsDisplayDrive  = new google.maps.DirectionsRenderer({suppressMarkers: false, polylineOptions: polylineOptionsDrive});
var directionsDisplayWalk = new google.maps.DirectionsRenderer({suppressMarkers: false, polylineOptions: polylineOptionsWalk});

directionsDisplayWalk.setMap(map);
directionsDisplayDrive.setMap(map);

calcRoute("WALKING", fromCoded, waypoint1); // force WALK from A to B
calcRoute("DRIVING", waypoint1, toCoded);   // force DRIVE from B to C

... rest of code omitted...

Thanks


text:
Q: NSPopover positions incorrectly when NSWindow frame is programmatically changed I have a button in an NSWindow that brings up an NSPopover with:
popover = NSPopover()
popover?.behavior = .applicationDefined
popover?.contentViewController = self
let myDelegate = MyDelegate()
myDelegate.controller = self
popover?.delegate = myDelegate
popover?.show(relativeTo: hostingButton.bounds, of: hostingButton.superview!, preferredEdge: .minY)

This works great and I can drag the window around and resize it while the popover is open with zero problems.
The window, however, displays dynamic content and I have an option to keep it "compact" so to use the minimum height necessary for all of the current content to be shown.
When my code sets the NSWindow's frame with window.setFrame(newFrame, display: true), the popover moves to the other side of the screen. Its vertical alignment is perfect and matches the new window height, but its horizontal position is completely off.
The horizontal positioning on the Screen appears to be matching the x coordinate of the hostingButton within its superview, i.e. it sure looks like popover is using the x coordinate from the button's frame as a screen coordinate!?
Am I doing something wrong?
Is there a way of asking the popover, its hosting view, its superview, or its window to have another go at the positioning?
If not is there a way that I can manually move the popover window to the right place?
Any help would be much appreciated!


text:
Q: Switch to the frame that contains the login prompts in Selenium I'm trying to use Selenium to log into ESPN. A solution that used to work is detailed here. In order to log in I need to find the frame that has the username and password fields and switch to that frame. Unfortunately, that numerical index of that frame isn't always the same. I decided to just try them all, but as soon as I've switched to one frame, switching to the next fails with selenium.common.exceptions.StaleElementReferenceException: Message: The element reference of <iframe class="ob-pifr"> stale: either the element is no longer attached to the DOM or the page has been refreshed. So I'm looking for

*

*A way to switch frames without the StaleElementReferenceException

*A way to check whether a frame is the one I want before I switch to it

*Some other solution, though I'd prefer something introspective to a magic (and presumably fragile) formula like "It's always the third frame from the end)

Here's some sample code that leads to the StaleElementReferenceException:
from time import sleep
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException

driver = webdriver.Firefox(executable_path = '/usr/local/bin/geckodriver')
driver.get("http://games.espn.go.com/ffl/signin")
WebDriverWait(driver, 1000).until(EC.presence_of_all_elements_located((By.XPATH,"(//iframe)")))

elem = None
frms = driver.find_elements_by_xpath("(//iframe)")
print("Found {} frames", len(frms)) # Varies from 6 to 8
for count, frm in enumerate(frms):
    print("Trying frm[{}]".format(count))
    driver.switch_to.frame(frm)
    sleep(2)
    try:
        # The command below will fail the second time around with
        # `either the element is no longer attached to the DOM or the page has been refreshed`
        elem = driver.find_element_by_xpath("(//input)[1]")
    except NoSuchElementException:
        pass
    else:
        break

A: Frame id is disneyid-iframe which opens the login popup So first you need to switch into it
driver.switch_to_frame(driver.find_element_by_id("disneyid-iframe"))

and then perform sendkeys like
driver.find_element_by_xpath("//input[@type='email']").send_keys("emailid")

driver.find_element_by_xpath("//input[@type='password']").send_keys("password")

Other way to switch in frame is ExplicitWait. It wait until frame available once there then it get switched in
wait = WebDriverWait(driver, 60)

wait.until(EC.frame_to_be_available_and_switch_to_it((By.ID, "disneyid-iframe")))

Your Final code will be :
from time import sleep
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException

driver = webdriver.Firefox(executable_path = '/usr/local/bin/geckodriver')
driver.get("http://games.espn.go.com/ffl/signin")

wait = WebDriverWait(driver, 60)

wait.until(EC.frame_to_be_available_and_switch_to_it((By.ID, "disneyid-iframe")))

driver.find_element_by_xpath("//input[@type='email']").send_keys("emailid")
driver.find_element_by_xpath("//input[@type='password']").send_keys("password")
driver.find_element_by_xpath("//button[@type='submit']").click()

Note : Please check syntax as per Python.


text:
Q: Jquery autocomplete "search" method with "" parameter I created dropdown autocomplete based on jq autocomplete.
So I want to get all values with empty textbox value.
I call this code:
element.autocomplete("search", element.val());

Where element.val() returns "".
And nothing happens. No ajax queries.
What should I do to send ajax query with value "" to server using jquery ui autocomplete API?
Edited. It connected to the exist post - Jquery autocomplete "search" method

A: If I understand you correctly, you want the autocomplete drop-down to populate even when there is no content in the textbox. To do this, you have to have the minLength option set to 0. Once you do that, to have the search window open on command (as opposed to when the user types something then erases it), your javascript of element.autocomplete("search", element.val()) should work.


text:
Q: Laravel get routes work, post don't I just can't figure it out, why on my local environment the following routes work perfectly.... and on a Staging environment I have been provided, to test the code, it doesn't work as supposed to
Routes:
Route::controller(Controller::detect());

...

Route::get('api', array(
        'as' => 'api_index',
        'uses' => 'api@index',
));

Route::get('api/(:any)/(:any)', 'api.(:1)@(:2)');
Route::post('api/(:any)/(:any)', 'api.(:1)@(:2)');
Route::put('api/(:any)/(:any)', 'api.(:1)@(:2)');
Route::delete('api/(:any)/(:any)', 'api.(:1)@(:2)');

The problem stands at my post requests, as they just won't be found and always returning a 404 no mather the request. Example:

*

*POST http://staging.test.com/api -> 404

*POST http://staging.test.com/api/user -> 404

*POST http://staging.test.com/api/user/session -> 404

Where all of the above tests, work in my local environment. The GET method works (the only one besides POST that I have tested)
So what am I missing?
UPDATE
Tried changing the order of the Routes::, and tried the different methods... but still the same result

A: Just as @TheShiftExchange said, it seams to be the buggy Controller::detect()'s fault.
Have tried also:
Route::controller(array('api.user', 'api.device'));

But only got it to work with:
Route::controller('api.user');
Route::controller('api.device');


text:
Q: Mysql Replication Master-Master I'm studing a solution to do Mysql replication master-master within servers in different location, for redundancy, load balancing and fault tolerance.
What I figured out so far is that is master-master replication inserts can be done in any of the servers and it will be replicated to the 2nd, 3rd... masters.
I've checked all the tuturials about replications and ready ti implement and test. But there is a problem that i havent found a solution.
Imagine a cenario on a database that all primary keys are INT and auto increment. What happens if two inserts are made on the same time on diferent master-master Mysql replicated servers, can I have the chance of loosinf integrety? Should the db struture have another colum identifying the id of the replication server? What concerns should I have about database struture on a master-master replication?
Thanks

A: Using a combination of auto_increment_increment and auto_increment_offset you can control which keys are created on which master and there should be no overlap.

A: How about using something else than ints? There's also the possibility of using UUIDs/GUIDs. That way, you won't run into primary key conflicts.


text:
Q: Multiple access session to a master virtual machine in my local host My local host computer is Ubuntu Desktop 16.
I am using libvirt KVM and Vagrant to create virtual machines.
I have a master machine that is considered as a web server as well (sudo apt-get install apache2).
I want multiple users to access the webpage (entering the master's ip address in their browser) and download a public key to authenticate their access to the master.
However, I am simulating this scenario in my local host, meaning that I open my browser in my local host and open the master's webpage and I click a button that downloads a public key for me to access the master.
Different public keys should be generated for each user. Also I want the public key or the session to be valid for a certain time until the user is done with his work.
So how can I achieve that? Is there a better solution for my scenario considering the local environment I'm working with? Should I generate multiple private/public keys or only one private key and multiple public keys? How can multiple access sessions be achieved on one master?
Please help me I'm confused and I am a very basic beginner in Linux so if anyone can provide me with the exact commands that would be very helpful.
Thanks.

A: Public-private keys are pairs, you cannot generate multiple public keys for one private key. So you'll have to generate one pair for each user.
As for the expiration time, this has been answered here. The solution uses ssh-agent, but you can also create a cron job that removes keys from the server every X minutes.


text:
Q: Allowing X number of instaces of a Electron application I would like to allow a user to open up to X concurrent instances of an Electron application. How can my application count the number of its open instances?

A: I'm not sure if there's a supported way to do that.
You could do something like this. But this is probably a last resort.


text:
Q: do ruby plugins make starting vim very slow? Lately vim takes a long time to start up when I'm running it to edit a ruby file or a rails project. But it starts up fast when invoked on a plain text file. Is there any way to find out which ruby vim plugins are most responsible for prolonging the startup?

A: The reason for slowliness is often the not set or wrong set ruby_path on compile time of vim (see also discussion on google vim/ruby google group). It is easier to set it in vimrc, because you can change it without recompiling vim. You can set the path through the g:ruby_path variable in your .vimrc file. This is for OS X, but you can change it to be right for Linux. Don't copy and paste both, use the right one.
If you use RBENV add this to your .vimrc:
" ruby path if you are using rbenv
let g:ruby_path = system('echo $HOME/.rbenv/shims')

If you use RVM add this to your .vimrc:
" ruby path if you are using RVM
let g:ruby_path = system('rvm current')

For me the part on loading ruby specific functions in vim got 10 times faster.
If you are using jruby, than the start up slowliness can be even bigger. See examples for fixing it here.

A: If you're using version 7.2.286 or newer, you can run vim --startuptime vim.out foo.rb to log how long the various parts of the startup process take.


text:
Q: ajax and jQuery chat I'm building a PHP chat (similar to the one on badoo.com).\
Here is the thing to check for messages and who is typing.
I send a request per second, it got a little slow.
So, I started searching around and trying to figure out how Facebook pulls out a huge amount of that, without sending so many AJAX requests.
I noted they just send one and it keeps looping, until some changes occur (e.g. a friend gets online, a new message posted...) and then they send another one and so on.
My question is: How can I do that?


text:
Q: Label edges of `fgl` graph based on directives Currently, I have the following data type (call it a directive),
data type = Up (a -> Bool) | Down (a -> bool)

And given a list of directives, I would like to apply/add edge. For example,
([Up (\_ -> True)], "parent")

Should add edge (a, b, "parent"), where a and b are the last two nodes in the traversal based on directive.
Another example,
([Up (\_ -> True), Up (\a -> sex a == "male")], "grandfather")

My aim is to label edges relative to some rooted node. For example, an edge between parent node's and its parent is labelled grandparent so it is relative to some rooted node. I have attempted to use gfold which has an argument Context a b -> [Node] to determine which nodes to visit but could not understand it.


text:
Q: How to exit from a Describe upon a condition(having multiple It's) and proceed to next describe using Protractor Jasmine I have multiple describes and each describe is an E2E test which contains multiple It blocks which are dependent on each other. When I trigger batch execution(Considering 5 test describes/specs) using protractor.config.js, it read the required Describe files and start the batch execution sequentially. Considering each describe has 5 It blocks. When 2nd It block is failed, I want to exit from current describe without executing 3 to 5 it blocks and start the next Describe test.  I tried to use process.exit which terminates the entire batch execution. We can manage flag condition for each it block and handle the case and it is a tedious process. Is there any direct way we can exit from current spec and jump to next spec execution?
Your Suggestions will be highly appreciated...


text:
Q: How to remove a .txt list of passwords from another .txt list of passwords? I have a 164gb passwords list and a rockyou.txt list, and I'd like to remove all rockyou passwords from the 164gb list. Any way to do this? I've researched it a bit, and I haven't found a way to do it with such a large file.

A: First, a disclaimer: Dictionary files of this size are usually so noisy - full of naive 'pass001', 'pass002', 'pass003' sequences that would be much more efficiently applied using rules on GPU instead - that you're better off studying how to use rules and other better alternatives. Further, the utility or time savings of removing such a relatively small list like RockYou from such a large one is probably limited.
But let's assume that the use case is still desirable. There is some complexity here, and the established solutions in the password-cracking practice have trade-offs between how much RAM you have and how much pre-processing you have to do, and there are differing opinions on the "best" way to do it:

*

*With unsorted input files and unlimited RAM, you can simply use rling. But even with its slower -b option, an amount of RAM is needed that's larger than the target file. In practice, rling's write-temp-to-disk options (to work around having less RAM during processing) are currently less performant than alternatives. rling was otherwise expressly designed for this use case, and can even work for files of this size if you divide them into chunks first (more on that below).

*With limited RAM, you can use split to split the file into small enough chunks to be processed within your available RAM (or a little over). You'll have to experiment a bit to find out the right file size, but a little less than 1/2 of your available RAM is often a reasonable starting point. For bonus benefits, simply leave your 164GB file in these smaller chunks - it will save you a lot of trouble by allowing all future analysis and attacks to run against the smaller files in series. Be sure to use split's -l/N option, to ensure that you're splitting between words/records and not breaking the file in the middle of words.

*You can also sort the entire files first. This is a popular option because it scales to arbitrary file sizes for common workflows that do not require preservation of frequency order. For efficiency, you can use the LC_ALL=C environment variable to increase its speed (to skip complex multibyte sorting), and use sort's -S (memory usage cap, to match your system RAM) and -T (tempfile location, preferably to fast storage) options to make this as efficient as feasible. But here I would again recommend keeping the file divided into smaller files, instead of constantly having to work around its monolithic size for no real added benefit (and as noted earlier, the frequency information is destroyed). Once the files are sorted, you can use rli2 from hashcat-utils to remove the RockYou lines from your large file. This requires no major amounts of RAM, because each file can now be classically "mergesort" sorted - read record by record, compared, and written to disk or skipped with the assurance that each line won't have to be compared again because its predecessors and successors are already known. The major limitation of rli2 is that, unlike rling, it can only take one "removefile" as an argument.
All that being said ... by the time you have a 164GB file, you already have the wrong problem. Mashing up many different wordlists into a single monolithic wordlist is an anti-pattern, and usually by the time you received the wordlist, multiple people have been mashing up terrible other lists in with other lists, without regard to source or quality.
Instead, you can shift your model to do the following (which is what I do):

*Instead of always mashing up new sources into your giant file, simply keep all source files separated, and instead remove duplicates from each new source before adding it to your wordlist repository - using rling to remove all your other files from each new file. Even if a new file is large, simply break it into enough pieces to be comfortably processed.

I prefer this last option because:

*

*it scales to handle arbitrary total aggregate size, while fitting into your existing available RAM as needed

*it preserves original file order

*each new file can be deduplicated easily with rling prior to being added to your 'library'


text:
Q: ng-repeat is not working to refresh the display results based on filter search // My ng-repeat is displaying the results fine, but after typing in the search box it is not filtering results as per search. please help. Also, I'm getting data from http.get
   // I'm new to angular js can you help how to repeat search results and display nothing when you don't enter anything in search box.
   // I used ng-show this is helping initially to stop showing
    topic and response are my column headers in sheet

  <input type="text" name="search" ng-model="search" placeholder="Search in all sheets" ></input>

            Question
            Response

        {{user.gsx$topic.$t}}
        {{user.gsx$response.$t}}

A: If you want to add search filter on single field from $scope.users then you have to specify that property from json

also please update input for modal as :
<input type="text" name="search" ng-model="search" placeholder="search" ng-click="didSelectLanguage()"></input>


text:
Q: No Wifi in Qualcom Atheros - Ubuntu 16.04 - Acer Aspire E 15 After Installing Ubuntu 16.04 in Acer laptop with Qualcom Atheros , it does not work. I tried ,
sudo rfkill list all
0: hci0: Bluetooth
    Soft blocked: no
    Hard blocked: no
1: acer-wireless: Wireless LAN
    Soft blocked: no
    Hard blocked: no

Then , checked
uname -r
4.4.0-21-generic

and , as suggested I tried ,
lspci -nnk | grep -iA2 net; dmesg | grep ath10k
02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 15)
    Subsystem: Acer Incorporated [ALI] RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [1025:0987]
    Kernel driver in use: r8169
    Kernel modules: r8169
03:00.0 Network controller [0280]: Qualcomm Atheros Device [168c:0042] (rev 30)
    Subsystem: Foxconn International, Inc. Device [105b:e09a]
    Kernel driver in use: ath10k_pci
[    7.100283] ath10k_pci 0000:03:00.0: pci irq msi interrupts 1 irq_mode 0 reset_mode 0
[    7.390307] ath10k_pci 0000:03:00.0: Direct firmware load for ath10k/cal-pci-0000:03:00.0.bin failed with error -2
[    7.390332] ath10k_pci 0000:03:00.0: Direct firmware load for ath10k/QCA9377/hw1.0/firmware-5.bin failed with error -2
[    7.390336] ath10k_pci 0000:03:00.0: could not fetch firmware file 'ath10k/QCA9377/hw1.0/firmware-5.bin': -2
[    7.390350] ath10k_pci 0000:03:00.0: Direct firmware load for ath10k/QCA9377/hw1.0/firmware-4.bin failed with error -2
[    7.390353] ath10k_pci 0000:03:00.0: could not fetch firmware file 'ath10k/QCA9377/hw1.0/firmware-4.bin': -2
[    7.390365] ath10k_pci 0000:03:00.0: Direct firmware load for ath10k/QCA9377/hw1.0/firmware-3.bin failed with error -2
[    7.390369] ath10k_pci 0000:03:00.0: could not fetch firmware file 'ath10k/QCA9377/hw1.0/firmware-3.bin': -2
[    7.390381] ath10k_pci 0000:03:00.0: Direct firmware load for ath10k/QCA9377/hw1.0/firmware-2.bin failed with error -2
[    7.390384] ath10k_pci 0000:03:00.0: could not fetch firmware file 'ath10k/QCA9377/hw1.0/firmware-2.bin': -2
[    7.390396] ath10k_pci 0000:03:00.0: Direct firmware load for ath10k/QCA9377/hw1.0/firmware.bin failed with error -2
[    7.390398] ath10k_pci 0000:03:00.0: could not fetch firmware (-2)
[    7.390401] ath10k_pci 0000:03:00.0: could not fetch firmware files (-2)
[    7.390404] ath10k_pci 0000:03:00.0: could not probe fw (-2)

Now what should I do ??

A: Your driver requires firmware that is missing:

Direct firmware load for ath10k/QCA9377/hw1.0/firmware-5.bin failed
  with error -2

With a working internet connection by ethernet, tethered or whatever means possible, please open a terminal and do:
sudo apt-get update
sudo apt-get install git
git clone https://github.com/kvalo/ath10k-firmware.git
sudo mkdir /lib/firmware/ath10k/QCA9377
sudo mkdir /lib/firmware/ath10k/QCA9377/hw1.0
cd ath10k-firmware/QCA9377/hw1.0
sudo cp *  /lib/firmware/ath10k/QCA9377/hw1.0
cd /lib/firmware/ath10k/QCA9377/hw1.0
sudo mv firmware-5.bin_WLAN.TF.1.0-00267-1  firmware-5.bin

Reboot and your wireless should be working.


text:
Q: Not able to fix PagerTitleStrip in android The PagerTitleStrip is overflowing. I am not able to see all the title at a time. Not able to make out what i am missing here. I have attached the screenshots.

Also how do i add material UI theme to these tabs. which library  is required and how to i apply the theme for the tab or for the entire application
My adapter code
public class MyAdapter extends FragmentPagerAdapter
{
int totalFragments = 3;

public MyAdapter(FragmentManager fm) {
    super(fm);
}

@Override
public Fragment getItem(int position) {
    return MyFragment.newInstance(position);
}

@Override
public int getCount() {
    return totalFragments;
}

@Override
public CharSequence getPageTitle(int position) {
    switch (position) {
    case 0:
        return "Tab One";
    case 1:
        return "Tab Two";
    case 2:
        return "Tab Three";
}

return null;
}
}

Layout file:
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" >

  <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="0.3"
    android:orientation="vertical" >
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="0.7"
    android:orientation="vertical" >

    <android.support.v4.view.ViewPager
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <android.support.v4.view.PagerTitleStrip
            android:id="@+id/pager_title_strip"
            android:scrollbarSize="200dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top"
            android:background="#33b5e5"
            android:paddingBottom="4dp"
            android:paddingTop="4dp"
            android:textColor="#fff" />

    </android.support.v4.view.ViewPager>
 </LinearLayout>

 </LinearLayout>

A: First, where you have used fill_parent, replace those with match_parent, since filling is deprecated.
Second, the common settings for ViewPager size are
    android:layout_width="match_parent"
    android:layout_height="0px"

and possibly
    android:layout_weight="1"

After these, for your PagerTitleStrip, try
android:layout_width="wrap_content"

Third, The material way of designing tabbed vies is with TabLayout, which Google has some tutorials and examples for.


text:
Q: AChartEngine not displaying Y and X axis values and label count I'm trying to build a line chart with this engine. It is drawing like I expected, except that is not displaying my values. I can't see where is my error, please help me. This is the code:
private View getLineChart(Context context)
{
    List<Double> weights = App.helper.getWeights();
    List<String> weightsDate = App.helper.getWeightsDate();

    for(int x = 0; x < weights.size(); x++)
    {
        for(int y = x + 1; x < weights.size(); x++)
        {
            if(weights.get(x) > weights.get(y))
            {
                double temp = weights.get(x);
                weights.set(x, weights.get(y));
                weights.set(y, temp);
            }
        }
    }

    List<Date> dateList = new ArrayList<Date>();

    for(int x = 0; x < weightsDate.size(); x++)
    {
        Date date = new Date(weightsDate.get(x));
        dateList.add(date);
    }

    Collections.sort(dateList);

    XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
    XYSeriesRenderer xyRenderer = new XYSeriesRenderer();
    XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();

    renderer.addSeriesRenderer(xyRenderer);
    renderer.setChartTitle("Histórico de Peso");

    renderer.setYTitle("Peso");
    renderer.setYLabels(weights.size());
    renderer.setYAxisMin(weights.get(0));
    renderer.setYAxisMax(weights.get(weights.size() - 1));
    renderer.setYAxisAlign(Align.LEFT, 0);
    renderer.setYLabelsAlign(Align.LEFT, 0);

    renderer.setXTitle("Data");
    renderer.setXLabels(weights.size());
    renderer.setXAxisMin(dateList.get(0).getTime(), 0);
    renderer.setXAxisMax(dateList.get(dateList.size() - 1).getTime(), 0);
    renderer.setXLabelsAlign(Align.CENTER);

    renderer.setAxisTitleTextSize(12);
    renderer.setChartTitleTextSize(12);
    renderer.setLabelsTextSize(10);
    renderer.setLegendTextSize(12);
    renderer.setPointSize(5f);
    renderer.setApplyBackgroundColor(true);
    renderer.setBackgroundColor(Color.parseColor("#F5F5F5"));
    renderer.setMarginsColor(Color.parseColor("#F5F5F5"));
    renderer.setAxesColor(Color.LTGRAY);
    renderer.setLabelsColor(Color.parseColor("#5f5f5f"));
    renderer.setShowGrid(true);
    renderer.setGridColor(Color.GRAY);

    XYSeries series = new XYSeries("Peso");

    for(int x = 0; x < weights.size(); x++)
    {
        series.add(weights.get(x), dateList.get(x).getTime());
    }

    dataset.addSeries(series);

    View view = ChartFactory.getLineChartView(context, dataset, renderer);

    Log.d("WEIGHT_TEST", String.valueOf(weights.get(0)));

    return view;
}

I'm calling this on my onResume method. The chart is drawn, but the min and max values are not respected, and the label count isn't respected too. Also, is there a way I can show dd/MM/yyyy dates on the X axis?


text:
Q: I need to insert a captcha for all comments in word press Hi I am new to word press. I need to insert captcha for all the comments wherever seen in word press theme. How can I do it. Please help me.

A: With this plugin you can do it.
http://wordpress.org/plugins/captcha/


text:
Q: Create Model class and sub items problem I have a Asp.net mvc applications and I need a create page.
My class as ;
 public class OrderItemModel
        {
            public OrderItemModel()
            {
                SelectedItems = new List<MenuItem> ;
            }

            public List<MenuItem> SelectedItems { get; set; }
            public string Address { get; set; }
            public string Notlar { get; set; }
            public string Odeme { get; set; }
        }

How can set SelectedItems properties. ? I can't figure out about sub items add.
Have any idea, or example about list properties ?

A: <input type="text" name="SelectedItems[0].SomePropOfMenuItem" value="" />
<input type="text" name="SelectedItems[1].SomePropOfMenuItem" value="" />

A: Use SelectListItems instead of MenuItem:
    public class OrderItemModel
{
    public OrderItemModel()
        {
            SelectedItems = new List<SelectListItem>();
        }

    public List<SelectListItem> SelectedItems { get; set; }
    public string Address { get; set; }
    public string Notlar { get; set; }
    public string Odeme { get; set; }
}

Then, in your controller do:
public ActionResult Index()
{
    OrderItemModel model = new OrderItemModel()
    {
        Address = "blah",
        Notlar = "blah",
        Odeme = "blah"
    };

    for (int i = 0; i < 10; i++)
        model.SelectedItems.Add(new SelectListItem() { Text = "Option " + i, Value = i.ToString(), Selected = i == 5 });

    return View(model);
}

and in your view
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcApplication1.Models.OrderItemModel>" %>
...blah blah...
<%= Html.DropDownList("MyDropDown", Model.SelectedItems) %>


text:
Q: Connecting to a ServerSocket in Java with a Javascript client If I have a ServerSocket in Java, how can I connect to it through Javascript?
This isn't a WebSocket. Here is part of my server code:
ServerSocket server = new ServerSocket(3000);
Socket client = server.accept();
BufferedWriter clientOut = new BufferedWriter(new OutputStreamWriter(client.getOutputStream()));
clientOut.write('Hello World!\n');
clientOut.flush();
clientOut.close();
client.close();
server.close();

When I try to use a WebSocket to connect, I get this error:

SyntaxError: An invalid or illegal string was specified

And this is what I use to connect:
socket = new WebSocket('http://localhost:3000')

Do note that I would also like a pure Javascript way of doing this, and I wouldn't want a Java applet hidden inside my page to send and read data through the socket.

A: the javascript WebSocket is different from the generic socket. if you want to use WebSockets, your java server must implement the WS/WSS handshake protocols.
there is no generic socket connections for javascript. i would suggest that you create a corresponding java socket client.


text:
Q: "forbidden for me" vs "forbidden to me"? I have a doubt how to use the word "forbidden" with which preposition. For example:
"Fats are forbidden for / to me because I am athlete"
"Is it forbidden for / to you as a religious?"

A: Simple common usage is

forbidden for +noun
It is forbidden for me to smoke.
forbidden to +verb
It is forbidden to smoke.


text:
Q: Why doesn't the obvious use of `std::shared_ptr` work? Seems like the obvious use of std::shared_ptr<T[]> (added with C++ 17) is to hold a pointer to T, and use delete[] when it's time to destroy the managed object. But this code:
#include <memory>

int main() {
    std::shared_ptr<int[]> sp(new int[3]);
    return 0;
}

doesn't compile with any of the online compilers I've tried. In all cases, the error message is a variant of this:

/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3759:18:
  note: candidate template ignored:
        requirement 'is_convertible<int *, int (*)[]>::value' was not satisfied [with _Yp = int]
          explicit shared_ptr(_Yp* __p,

that is, the constructor that takes a pointer gets SFINAED out because the pointer to the element type isn't convertible to a pointer to array. That seems to be required in the C++ 17 standard and in C++ 20.
Is that really what's intended? How can I use that constructor? Or, alternatively, how do I create a std::shared_ptr object that correctly manages an array without explicitly specifying a deleter?

A: Your program is valid and it should work. The error: no matching constructor for initialization of 'std::shared_ptr<int []>' was only in Clang with its libc++ standard library implementation till the version 10, and it was fixed in version 11. Resolved bug.
Online demo: https://gcc.godbolt.org/z/WdbdTTPPj


text:
Q: Default resample method used by GEE when exporting images? I want to know what the default resample method will be used when I export image like this :
Export.image.toDrive({
  image: image,
  description: 'imagetest',
  **scale: 1000,**
  region:aoi,
  folder: test',
  crs: 'EPSG:4326',
  maxPixels: 9999999999999
});

Nearest? mean? cubic?...

A: According to the documentation, nearest neighbor is the default resampling method. Also see Tyler Erickson's discussion here for more.


text:
Q: escribir en dos input tengo dos input en un mismo formulario uno se llama municipio y el otro
municipio_inm y lo que quiero es que al momento de escribir en el input municipio se escriba en muncipio_inm o se pase ese valor , solo si el valor de municipio si lo cambio en municipio_inm que no se cambie el de municipio.
     <input name="municipio"  class="form-control" type="text"
      id="municipio" placeholder="Escriba el Municipio" required>

     <input name="municipio_inm" class="form-control"  size="35" type="text"
     id="municipio_inm" placeholder="Escriba el municipio del inmueble"
     required onkeypress="document.forms.m_form_1.municipio.value =
     this.value">

A: Con javascript puedes utilizar el evento oninput para detectar cambios en tú input e ir actualizando el valor de tú otro input.

<!DOCTYPE html>
<html lang="es">
    <head>
        <meta charset="utf-8">
            <title>
                Prueba Input
            </title>
        </meta>
    </head>
</html>
<body>
    <div class="container text-center">
        <input class="form-control" id="municipio" name="municipio" oninput="actualizarValorMunicipioInm()" placeholder="Escriba el Municipio" required="" size="35" type="text">
            <input class="form-control" id="municipio_inm" name="municipio_inm" placeholder="Escriba el municipio del inmueble" required="" size="35" type="text">
            </input>
        </input>
    </div>
    <script>
        function actualizarValorMunicipioInm() {
   let municipio = document.getElementById("municipio").value;
   //Se actualiza en municipio inm
   document.getElementById("municipio_inm").value = municipio;
  }
    </script>
</body>

A: Si lo queres hacer con javascript sobre tu html, deberias buscar el elemento,
document.getElementById('municipio')

y luego cambiamos tu evento onkeypress por onkeyup para copiar el valor luego de que se grave en el primer input
quedaria algo asi
<input name="municipio"  class="form-control" type="text"
      id="municipio" placeholder="Escriba el Municipio" required>

<input name="municipio_inm" class="form-control"  size="35" type="text"
     id="municipio_inm" placeholder="Escriba el municipio del inmueble"
     required onkeyup="document.getElementById('municipio').value = this.value">

A: Pues yo te lo pongo en jQuery:
$(document).ready(function(){
    $('#municipio').change(function(){
  valor=$(this).val();
    $('#municipio_inm').val(valor);
  })
})

Lo que hace es coger el valor del input con id municipio y pasarselo al input con id municipio_inm. No pasa el valor de municipio_inm a municipio.
Debes, por supuesto, agregar la biblioteca de jquery. Si no la tienes puedes usar el cdn de Google:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

El script, si no tienes un archivo para los js, ponlo al pie de todas las páginas donde quieras realizar esta acción.
Aquí la demostración: https://jsfiddle.net/Emerita/16xmujvp/2/


text:
Q: Specify a variable implementing 2 interfaces in .net Is is possible to implement a type specifier with 2 interfaces in .net?  Something like:
Public Sub New(obj as ICollection and INotifyCollectionChanged)
    ''Initialize Code
End Sub

A: No, you will have to define an interface that inherits from both of your desired interfaces.
Public Interface IMyCombinedInterface
    Inherits IColllection, INotifyCollectionChanged

End Interface

A: You can with generic constraints; for example in c#:
public void Something<T>(T obj)
    where T : IFoo, IBar
{....}

Then Something(value) will work only when value is typed as something that implements both IFoo and IBar.


text:
Q: Mapping a SharePoint list item to a C# class Say I have:
public class SPListItem
{
     public override object this[string fieldName]
     {
       get
       {
         return this.GetValue(fieldName);
       }
       set
       {
         this.SetValue(fieldName, value, !this.HasExternalDataSource);
       }
     }
}

public class Bar
{
    public int Prop1 { get; set; }
    public int Prop2 { get; set; }
    public int Prop3 { get; set; }
}

is there any way I can do:
var fooInst = new SPListItem();
Bar barInst = (Bar)fooInst // or maybe Bar.FromFoo(Foo f) if handling the cast is not possible

and then have:
barInst.Prop1 give me the equivalent of:
fooInst["Prop"];
Without implementing the getters and setters for every property in Bar?

A: For my former employer I implemented a DAO pattern for SharePoint. Unfortunately I was not allowed to take the code with me or publish it...  I used annotations together with reflection to solve the issues with different names, optional fields, type casting etc. I also wrote a generator for the DTO-objects. But to be honest, it was a quite big effort for something that LINQ might solve in your case. Or writing your classes by hand, or writing a code generator for the getters and setters - it all depends on the size of your project(s).
Before implementing my own DAO I had a quite bad experience with LINQ to SQL, especially when columns were renamed, added or removed I didn't like the behaviour, I also had performance issues using it. That's why I prefered my own DAO pattern, but for easy tasks LINQ might be enough. My experience with LINQ also might be outdated, it was about 7 years ago ;)

A: Aaaaaand, here we go. This class generates entities from your lists.
From: https://justsharepointthings.wordpress.com/2015/09/10/sharepoint-generate-c-poco-classes-from-an-existing-definition/
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.SharePoint;

namespace Code_Generation {
    /// <summary>
    /// Generates List object entities from a site connection.
    /// </summary>
    public class SPListPocoGenerator {
        string parentDir = "GeneratedListPOCO/";
        string hiddenDir = "GeneratedListPOCO/HiddenLists/";

        private class PropertyString {
            private string _propStr;

            public PropertyString(string propStr) {
                _propStr = propStr;
                _properties = new Dictionary < string, string > ();
            }

            private Dictionary < string, string > _properties;
            public string this[string key] {
                get {
                    return _properties.ContainsKey(key) ? _properties[key] : string.Empty;
                }
                set {
                    if (_properties.ContainsKey(key)) {
                        _properties[key] = value;
                    } else {
                        _properties.Add(key, value);
                    }
                }
            }

            /// <summary>
            /// Replaces properties in the format {{propertyName}} in the source string with values from KeyValuePairPropertiesDictionarysupplied dictionary.nce you've set a property it's replaced in the string and you
            /// </summary>
            /// <param name="originalStr"></param>
            /// <param name="keyValuePairPropertiesDictionary"></param>
            /// <returns></returns>
            public override string ToString() {
                string modifiedStr = _propStr;
                foreach(var keyvaluePair in _properties) {
                    modifiedStr = modifiedStr.Replace("{{" + keyvaluePair.Key + "}}", keyvaluePair.Value);
                }

                return modifiedStr;
            }
        }

        public string _classDefinitionStr = @
        "
using System;
using Microsoft.SharePoint;

public class {{EntityName}}
{
    private SPListItem listItem;
    public {{EntityName}}_InternalProperties InternalProperties
    {
        get; private set;
    }

    public {{EntityName}}(SPListItem li)
    {
        this.listItem = li;
        this.InternalProperties = new {{EntityName}}_InternalProperties(this.listItem);
    }

    {{PropertySections}}
    public class {{EntityName}}_InternalProperties
    {
        private SPListItem listItem;

        public {{EntityName}}_InternalProperties(SPListItem li)
        {
            this.listItem = li;
        }

        {{HiddenPropertySections}}
        {{InternalPropertySections}}
    }
}";

        private const string _propertySectionStr = "\n\n\t" + @
        "public {{PropertyType}} {{PropertyName}}
    {   get { return listItem[Guid.Parse("
        "{{PropertyId}}"
        ")] as {{PropertyType}}; }
        set { listItem[Guid.Parse("
        "{{PropertyId}}"
        ")] = value; }}";

        /// <summary>
        /// Gets string identifying the field type
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        private string GetSafeTypeName(SPField field) {
            if (field.FieldValueType == null) {
                return "object"; //Not going to try to parse it further, this is enough.
            }

            var type = field.FieldValueType;

            if (type.IsValueType) {
                return type.FullName + "?";
            }
            return type.FullName;
        }

        public void GenerateForWeb(SPWeb web) {
            var blackList = new[] {
                "Documents", "Form Templates", "Site Assets", "Site Pages", "Style Library"
            };

            Directory.CreateDirectory(parentDir);
            Directory.CreateDirectory(hiddenDir);

            foreach(SPList list in web.Lists) {
                PropertyString _classDefinition = new PropertyString(_classDefinitionStr);

                string entityName = "SPL_" + list.Title.Replace(" ", "");
                _classDefinition["EntityName"] = entityName;

                foreach(SPField field in list.Fields) {
                    PropertyString propertySection = new PropertyString(_propertySectionStr);

                    propertySection["PropertyType"] = GetSafeTypeName(field); //field.FieldValueType.FullName; -> Returning Null often. Thanks, SharePoint!
                    propertySection["PropertyName"] = field.EntityPropertyName.Replace("_x0020_", "_");
                    propertySection["PropertyId"] = field.Id.ToString();

                    if (SPBuiltInFieldId.Contains(field.Id)) _classDefinition["InternalPropertySections"] += propertySection;
                    else if (field.Hidden) _classDefinition["HiddenPropertySections"] += propertySection;
                    else _classDefinition["PropertySections"] += propertySection;
                }

                if (list.Hidden || blackList.Contains(list.Title)) {
                    File.WriteAllText(hiddenDir + entityName + ".cs", _classDefinition.ToString());
                } else {
                    File.WriteAllText(parentDir + entityName + ".cs", _classDefinition.ToString());
                }
            }

        }

    }

}

A: You could use an ExpandoObject, which is in the System.Dynamic namespace. Try something like this (untested):
public class SPListItemPropertyMapper
{
    private dynamic _expandoObject;

    public SPListItemPropertyMapper(SPListItem listItem)
    {
        _expandoObject = new ExpandoObject();
        foreach (SPField field in listItem.Fields)
        {
            _expandoObject.Add(field.InternalName, listItem.GetFormattedValue(field.InternalName));
        }
    }

    public dynamic FieldValues
    {
        get { return _expandoObject; }
    }
}

Usage:
SPListItem listItem; //your list item here
var propertyMapper = new SPListItemPropertyMapper(listItem);

var title = propertyMapper.FieldValues.Title;
var editor = propertyMapper.FieldValues.Editor;
var created = propertyMapper.FieldValues.Created;

etc. You should consider extending the foreach loop by more logic, to return values based on the field type instead of just using GetFormattedValue.


text:
Q: How to create project versions I have a project that I'm using git to control its versions. Now, I'm going to work on a 2.0 version that will be uploaded to the server after we finish it.
So, I decided to create a new branch to develop the 2.0 version.
My question is: as the master branch is always having bugs fixed, I need to upload this changes to the server without upload the changes related to the version 2.0.
How do you do to make it? The best solution I could find is use git archive to extract the master branch without the changes made on the branch version 2.0. This is really the best solution?

A: AFAIU the branch master is the only branch which needs to go live.
So everytime a new bugfix is added to the branch master, you need to rebase it into your new branch. This way, you new branch contains already the fixes.
And finally you can upload the changes of master by using git archive to avoid sending your .git as well.

A: Think of your master branch as of code for production. There you fix bugs.
And think of your master_2_0 branch as of branch that will be on production some day. There you develop new cool features.
Now when you did some development in master_2_0 and fixed some critical issue in master you should make a merge. Make sure before merge that you have your local branches master and master_2_0 in actual state
git checkout master_2_0 #switch to master_2_0 branch
git merge master # merge branch `master` into master_2_0

This is how fixes from master will go to master_2_0. Sometimes merge conflict may appear if you changes the same parts of the code. You should carefully resolve them.
So doing merge will leave your master branch as it is while will keep master_2_0 branch updated with the fixes from master.
You should deploy to production only the master branch. It depends on how do you deploy. Usually it's done using git clone with specifying branch that you want to checkout (master by default).
git archive also will work for you, it also allows to specify branch that you want to be archived.


text:
Q: Error 403: "Flux query service disabled." But flux-enabled=true has been set in influxdb.conf I have been using InfluxDB (server version 1.7.5)  with the InfluxQL language for some time now. Unfortunately, InfluxQL does not allow me to perform any form of joins, so I need to use InfluxDB's new scripting language Flux instead.
The manual states that I have to enable Flux in /etc/influxdb/influxdb.conf by setting flux-enabled=true which I have done.  I restarted the server to make sure I got the new settings and started the Influx Command Line tool with "-type=flux".
I then do get a different user interface than when I use InfluxQL. So far so good. I can also set and read variables etc. So I can set:
> dummy = 1
> dummy
1

However, when I try to do any form of query of the tables such as: from(bucket:"db_OxyFlux-test/autogen")
I always get
Error: Flux query service disabled. Verify flux-enabled=true in the [http] section of the InfluxDB config.
: 403 Forbidden

I found the manual for Fluxlang rather lacking in basic details of Schema exploration and so I am not sure if this is just an issue with my query raising this error or if something else is going wrong. I tested this both on my own home machine and on our remote work server and I get the same results.
Re: Vilix
Thank you. This lead me in the right direction.
I realised that InfluxDB does not automatically read the config file (which is not very intuitive). But your solution also forces me to start the deamon by hand each time. After some more googling I used:
"sudo influxd config -config /etc/influxdb/influxdb.conf"
So hopefully now the daemon will start automatically each time on startup rather than me having to do this by hand.

A: I have the same issue and solution is to start influxd with -config option:
influxd -config /etc/influxdb/influxdb.conf


text:
Q: Hide page from history I have run into a problem:
I have a page that will be processed many times a week by my customers and each time it will have a different identifier
example
compshop.php?Shopid=2252&sub=s

compshop.php?Shopid=2520&sub=se

compshop.php?Shopid=3152&sub=n

etc....

problem is if possible I don't want all of these to save to the persons history so every time they start typing my url these show as the primary result instead of my home page.
is there a way to stop this
I thought the cache meta tag would deal with this but it appears the cache tag is only for SE indexing
any ideas?

A: If you add a randomly generated parameter, it's extremely unlikely any page will be visited more than once, but your page can still be accessed by URL alone.
For example,
compshop.php?Shopid=2252&sub=s&t=69396872

compshop.php?Shopid=2520&sub=se&t=17094891

compshop.php?Shopid=3152&sub=n&t=79125863

It's not hiding the pages from the history, but it is mostly ensuring that the page is only entered into the history once, so your homepage should still show up first.

A: I think you're about out of luck unless you can send the parameters over POST instead of GET. As @PWHite just mentioned you could append a random value to the parameters as well to make sure that even the same Shopid/sub would show as "different" pages in the history, thus putting your home page at the top of the list in terms of # of visits.


text:
Q: How to remove programatically created controls one by one? i wrote some code for creating controls dynamically. this code is working fine, now i want to remove control one by one on button click. so help me how can i do this ?
 private void button1_Click_1(object sender, EventArgs e)
    {

            Label label = new Label();
            int count = panel1.Controls.OfType<Label>().ToList().Count;
            label.Location = new Point(10, (25 * count));
            label.Size = new Size(40, 20);
            label.Name = "label_" + (count + 1);
            label.Text = "label " + (count + 1);
            panel1.Controls.Add(label);

            TextBox textbox = new TextBox();
            count = panel1.Controls.OfType<TextBox>().ToList().Count;
            textbox.Location = new Point(60, 25 * count);
            textbox.Size = new Size(80, 20);
            textbox.Name = "textbox_" + (count + 1);
            textbox.TextChanged += new System.EventHandler(this.TextBox_Changed);
            panel1.Controls.Add(textbox);

            Button button = new Button();
            count = panel1.Controls.OfType<Button>().ToList().Count;
            button.Location = new Point(150, 25 * count);
            button.Size = new Size(60, 20);
            button.Name = "button_" + (count + 1);
            button.Text = "Button " + (count + 1);
            //button.Click += new System.EventHandler(this.Button1_Click);
            panel1.Controls.Add(button);

    }

A: First, create the list of dynamic controls and add your programmatically created controls to it. Then you can remove controls one by one.
    private List<Control> dynamicControls = new List<Control>();

    private void button1_Click_1(object sender, EventArgs e)
    {

        Label label = new Label();
        //...
        dynamicControls.Add(label);

        TextBox textbox = new TextBox();
        //...
        dynamicControls.Add(textbox);

        Button button = new Button();
        //...
        dynamicControls.Add(button);
    }

    public void RemoveDynamicControls()
    {
        if (dynamicControls.Count > 0)
        {
            var control = dynamicControls[0];

            if (panel1.Controls.Contains(control))
            {
                dynamicControls.Remove(control);
                panel1.Controls.Remove(control);
            }
        }
    }


text:
Q: How to use laravel localization on database fetched records? Basically we can localize the strings in the application using trans() method after making an array in lang directory. But that is kind of hard coding. For example, if we want to translate a message. we would do something like this.
/resources
  /lang
    /en
      messages.php
    /es
      messages.php

and then we make an array and hard code it. just like
<?php

return [
    'welcome' => 'Welcome to our application'
];

But what if data is coming from database? we do not know how many records are coming and what is in the database. For example, we have an articles and we want to translate its title to other language say to French. How can we accomplish this without any package ?

A: You could use the Laravel translation manager from barryvdh.
This is a package to manage Laravel translation files. It does not replace the Translation system, only import/export the php files to a database and make them editable through a webinterface. The workflow would be:

*

*Import translations: Read all translation files and save them in the database

*Find all translations in php/twig sources

*Optionally: Listen to missing translation with the custom Translator

*Translate all keys through the webinterface

*Export: Write all translations back to the translation files.

https://github.com/barryvdh/laravel-translation-manager


text:
Q: (Python3) Check if a variable is in an sqlite3 Database im programming a Discord bot. It saves Usernames and theire money in a sqlite3 database.
Now i need to check if a Username is alredy in the Database to prevent double entries.
money4 = 1000

def add_player(user):
    cursor.execute("INSERT INTO player VALUES (?,?)", (str(user), int(money4)))
    connection.commit()

thats the code to add the name into the database. With that people can get double entries and i just want to block that.
edit: Database looks like this with multiple entries:
[('message.author', 1000), ('Micheltv10#9087', 1000), ('bempel#2040', 1000), ('bempel#2040', 1000), ('Micheltv10#9087', 1000), ('Micheltv10#9087', 1000), ('Micheltv10#9087', 1000), ('Micheltv10#9087', 1000), ('Micheltv10#9087', 1000)]

A: You could try to select the username before inserting to check if it already exists. Or do it properly and make the username unique (maybe as the primary key) in your database structure, so inserting duplicates would throw an error.

A: I solved it by creating a table with a primary key.
cursor.execute("""CREATE TABLE spieler(
            spielername TEXT PRIMARY KEY,
            money INTEGER
            )""")


text:
Q: Memcache data update issue I need help to optimize the rails code to update Memcache data.
The problem is like,
I have JSON data for a particular match in the following manner and writing into the cache.
match_data = {'teams' : 'Team one', 'Team two', 'score' { 'team1':0, 'team2': 1 }, time: 60 }
Rails.cache.write('match_123', match_data) #123 is match id

The above one is a very small example of a match it can have huge data.
So the match data is receiving in the application from the service frequently and updating the same in the cache and used the same to display in front-end as well.
So the actual problem is that I received the match updates in response like score, time, individually and frequently.
So I use the following code to update the cache data.
data = Rails.cache.read('match_123')
data[:time] = 120
OR
data[:score][:team1] = 1

Rails.cache.write('match_123', data)

I am using background jobs to perform the above process.
This process Is being too quick and we have multiple matches running together,
So at a point what is happening here as we updating complete match hash each time in the cache for a particular key-value change.
So what happening when we have two queues for example:
UpdateMatchCacheDataJob.perform_later(score_update)
UpdateMatchCacheDataJob.perform_later(time_update)

Suppose this queue runs together at a time it will either update the time in the cache or score.
This is the complexity I am facing. I have also tried to perform the job now yet got the issue sometime.
UpdateMatchCacheDataJob.perform_now(score_update)
UpdateMatchCacheDataJob.perform_now(time_update)

My problem may resolve if I play with particular data that needs to be updated instead not to update complete hash each time. Or is there a way to update the particular data in a hash
Note: I am using the AWS Memcache instance to store cache data.
I hope I could explain my issue, please let me know if anything needs from my side to explain the issue.


text:
Q: How can I get Table of Contents to fill the page? If the Table of Contents has only a few lines, how can I add spaces between the lines so that it fills the whole page? Is there a command similar to \vfill ?

A: {\setlength\parskip{\fill}
\tableofcontents

}

Probably works but the affect might be a bit odd....

A: Each entry in the table of contents is set as separate paragraph. Therefore the distance between entries can be set via \parskip.
\documentclass{article}
\begin{document}
\begingroup
  \flushbottom
  \setlength{\parskip}{0pt plus 1fil}%
  \tableofcontents
  \newpage
\endgroup
\section{Section A}
\subsection{Subsection B}
\subsection{Subsection C}
\section{Section D}
\subsection{Subsection E}
\end{document}


text:
Q: Accessing attributes from dynamically created sibling elements Learning XSLT!
I have an XML source tree fragment that looks like this:
Using Saxon and XSLT 2.0 to transform...
   <?xml version = "1.0" encoding = "UTF-8"?>
    <Chapter revision="B" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <Content Ref="X123">
            <Ref name="INT1"/>
            <Ref name="INT2"/>
            <Ref name="INT3"/>
            <Ref name="INT4"/>
            <Ref name="INT5"/>
        </Content>
        <Data>
            <Reference name="INT1" Function="CONDUCTOR"></Reference>
            <Reference name="INT2" Function="SIGNAL"></Reference>
            <Reference name="INT3" Function="MIXED"></Reference>
            <Reference name="INT4" Function="PLANE"></Reference>
            <Reference name="INT5" Function="CORE"></Reference>
        </Data>
    </Chapter>

I want it to produce this:
<Chapter>
   <Content>
      <Ref id="INT1" Function="CONDUCTOR">INT1</Ref>
      <Ref id="INT2" Function="SIGNAL">INT2</Ref>
      <Ref id="INT3" Function="MIXED">INT3</Ref>
      <Ref id="INT4" Function="PLANE">INT4</Ref>
      <Ref id="INT5" Function="CORE">INT5</Ref>
   </Content>
</Chapter>

Here's my template fragment:
<xsl:template match="/">
    <xsl:apply-templates select="/Chapter"/>
</xsl:template>

<xsl:template match="/Chapter">
    <xsl:element name="{name()}">
        <xsl:apply-templates select="Content"/>
    </xsl:element>
</xsl:template>

<xsl:template match="Content">
    <xsl:element name="{name()}">
        <xsl:apply-templates select="Ref"/>
    </xsl:element>
</xsl:template>

<xsl:template match="Ref">
    <xsl:element name="{name()}">

        <xsl:attribute name="id">
            <xsl:value-of select="@name"/>
        </xsl:attribute>

        <xsl:attribute name="Function">
            <xsl:value-of select="/Chapter/Data/Reference[@name=/Chapter/Data/Reference/@name]/@Function"/>
        </xsl:attribute>

        <xsl:value-of select="@name"/>

    </xsl:element>
</xsl:template>

But the template above produces this:
It is obviously picking up the values from every node
 <Chapter>
       <Content>
          <Ref id="INT1" Function="CONDUCTOR SIGNAL MIXED PLANE CORE">INT1</Ref>
          <Ref id="INT2" Function="CONDUCTOR SIGNAL MIXED PLANE CORE">INT2</Ref>
          <Ref id="INT3" Function="CONDUCTOR SIGNAL MIXED PLANE CORE">INT3</Ref>
          <Ref id="INT4" Function="CONDUCTOR SIGNAL MIXED PLANE CORE">INT4</Ref>
          <Ref id="INT5" Function="CONDUCTOR SIGNAL MIXED PLANE CORE">INT5</Ref>
       </Content>
    </Chapter>

What do I need to supply as a predicate value to step through the attribute values?
Many thanks

A: Change /Chapter/Data/Reference[@name=/Chapter/Data/Reference/@name]/@Function to /Chapter/Data/Reference[@name=current()/@name]/@Function, then learn about keys and define <xsl:key name="ref" match="Data/Reference" use="@name"/> and use key('ref', @name)/@Function instead to improve performance and readability.
In general you might want to learn about literal result elements and attribute value templates so that
<xsl:template match="Ref">
    <xsl:element name="{name()}">

        <xsl:attribute name="id">
            <xsl:value-of select="@name"/>
        </xsl:attribute>

        <xsl:attribute name="Function">
            <xsl:value-of select="/Chapter/Data/Reference[@name=/Chapter/Data/Reference/@name]/@Function"/>
        </xsl:attribute>

        <xsl:value-of select="@name"/>

    </xsl:element>
</xsl:template>

becomes
<xsl:template match="Ref">
    <Ref id="{@name}" Function="{key('ref', @name)/@Function}">
        <xsl:value-of select="@name"/>
    </Ref>
</xsl:template>

and the complete code is
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xs"
    version="2.0">

    <xsl:key name="ref" match="Data/Reference" use="@name"/>

    <xsl:template match="/Chapter">
        <xsl:copy copy-namespaces="no">
            <xsl:apply-templates select="Content"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="Content">
        <xsl:copy copy-namespaces="no">
            <xsl:apply-templates/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="Ref">
        <Ref id="{@name}" Function="{key('ref', @name)/@Function}">
            <xsl:value-of select="@name"/>
        </Ref>
    </xsl:template>

</xsl:stylesheet>