text:
Q: Transforming object recursively I have an object, or an array of objects, with props containing strings, arrays and other objects.
I want to transform the nested arrays containing objects with the prop language into an object with the language as key and the object itself as prop.
Lets say I want to transform recursively this object:
{
    "WhatPage": [
        {
            "id": 1,
            "WhatPageTranslations": [
                {
                    "id": 1,
                    "title": "What",
                    "WhatPageId": 1,
                    "language": "en"
                },
                {
                    "id": 2,
                    "title": "Qué",
                    "WhatPageId": 1,
                    "language": "es"
                },
            ],
            "WhatPageImages": [
                {
                    "id": 1,
                    "title": "image title 1",
                    "WhatPageId": 1,
                    "WhatPageImagesTranslations": [
                        {
                            "id": 1,
                            "title": "What",
                            "WhatPageImageId": 1,
                            "language": "en"
                        },
                        {
                            "id": 2,
                            "title": "Qué",
                            "WhatPageImageId": 1,
                            "language": "es"
                        },
                    ]
                },
            ]
        }
    ]
}

Then I can use this function that check if its an array or an object, and transform the data recursively:
export const transformTranslatedData = function(data) {
    var clonedData = JSON.parse(JSON.stringify(data));
    const transform = function(data) {
        for (var prop in data) {
            if (data[prop].length > 0 && data[prop] instanceof Array && data[prop][0].hasOwnProperty('language')) {
                var transformedData = data[prop].reduce(function(prev, current, index) {
                    prev[current.language] = current;

                    return prev;
                }, {});
                data[prop] = transformedData;

            } else if (data[prop] instanceof Object && !(data[prop] instanceof Array)) {
                transformTranslatedData(data[prop]);
            } else if (data[prop] instanceof Array) {
                let array = JSON.parse(JSON.stringify(data[prop]));
                array.forEach((item) => {
                    transformTranslatedData(item);
                });
            }
        }

        return data;
    };
    if (clonedData instanceof Array) {
        var newData = [];
        clonedData.map((item) => {
            newData.push(transform(item));
        });
    } else if (clonedData instanceof Object && !(clonedData instanceof Array)) {
        var newData = {};

        newData = transform(clonedData);
    }

    return newData;
};

This works, but only for the first level of the object —WhatPageTranslations—. On the second level, when it reaches WhatPageImagesTranslations, it transforms the data, but this data is not appended to the object.
If anyone has any idea why is this happening I would be grateful!

A: When you call transformTranslatedData recursively, it makes a copy of the object that you pass it, and modifies that. So the object you're recursing through doesn't get modifies.
YOU need to copy the result of the transform back into the original object.
        } else if (data[prop] instanceof Object && !(data[prop] instanceof Array)) {
            data[prop] = transformTranslatedData(data[prop]);
        } else if (data[prop] instanceof Array) {
            let array = JSON.parse(JSON.stringify(data[prop]));
            data[prop] = array.map((item) => {
                transformTranslatedData(item);
            });
        }

A: I think you can simplify your recursive function. In your solution, you seem to be cloning a lot (at each recursive call). You can create a deep copy once and then be free to modify it in your recursive function (as @Barmar mentioned).
This considerably focuses our effort to examining and deciding whether or not to transform the "current" part of the data in the recursion:

const myData = {
  "WhatPage": [{
    "id": 1,
    "WhatPageTranslations": [{
        "id": 1,
        "title": "What",
        "WhatPageId": 1,
        "language": "en"
      },
      {
        "id": 2,
        "title": "Qué",
        "WhatPageId": 1,
        "language": "es"
      },
    ],
    "WhatPageImages": [{
      "id": 1,
      "title": "image title 1",
      "WhatPageId": 1,
      "WhatPageImagesTranslations": [{
          "id": 1,
          "title": "What",
          "WhatPageImageId": 1,
          "language": "en"
        },
        {
          "id": 2,
          "title": "Qué",
          "WhatPageImageId": 1,
          "language": "es"
        },
      ]
    }, ]
  }]
};

function transform(data) {
  // base case
  if (data instanceof Array && data.length && data[0].hasOwnProperty('language')) {
    return data.reduce((acc, curr) => {
      acc[curr.language] = curr;
      return acc;
    }, {});
  }

  // array but not base case
  if (data instanceof Array) return data.map(transform);

  // object but not base case
  if (typeof data === 'object' && !(data instanceof Array)) {
    for (let key in data) {
      data[key] = transform(data[key]);
    }
  }

  // primitive, so return as is
  return data;
}

console.log(transform(JSON.parse(JSON.stringify(myData))));


text:
Q: Sample Size Calculation - Two Independent Means I am trying to design an email test to measure the demand lift obtained from a marketing promotion (treatment) versus no promotion (control). To do so, I want to calculate the per-group sample size required to get a significant read on the difference in average demand per-customer for different marketing segments.
To do so, I am applying the following formula (for each segment):
$$
N = \frac{2(Z_{1-\alpha/2}+Z_{\pi})^2\sigma^2}{\Delta^2}
$$
Where:
$Z_{1-\alpha/2}$ = percentile of the normal distribution used as the critical value in a two-tailed test (1.96)
$Z_{\pi}$ = percentile of the normal distribution where $\pi$ is the power of the test (0.84 for 80th percentile)
$\sigma$ = within-group standard deviation
$\Delta$ = expected mean difference between the treatment versus control population
To calculate the standard deviation and expected mean difference above, I pulled historical response for the same period last year during which the test will run. My question is this: should the group means and standard deviations be estimated from the total population which was exposed to the treatment (and control), respectively, or should the mean and standard deviation be calculated based on respondents only? Put another way, should I use the mean/variance for the full audience exposed to a given treatment in the past, or the mean/variance for responders only, and then back solve for required full audience?
The results that I'm getting appear counter-intuitive, with similar required sample sizes among the most-engaged and least-engaged audiences, so I know I must be doing this wrong.
Most of the material that I've come across from the marketing community involves using a desired difference in response rate to solve for appropriate per-group sample sizes. In my case, however, the metric of interest is demand-based rather than raw response (average demand per customer). That said, the response rate is an important metric, as it is particularly low for certain groups of customers, but it does not directly reflect the metric of interest.
Thanks in advance!

A: Here is a simulation to show that your approximate formula
for sample size $n$ gives a reasonable answer for a particular
case, which may be realistic.
Suppose $\sigma^2/\Delta^2 = 9,$ significance level is 5%
and desired power is 80%. Then the formula gives $n \approx 141.$
[An exact formula would use a noncentral t distribution, but
with $n > 100,$ the approximate formula should be OK.]
n = 2*(1.96+.84)^2*9;  n
[1] 141.12

Now suppose I do $m = 100\,000$ two-sided pooled two-sample t tests using samples of size $n = 150$ to try to detect a
significant difference (5% level) in sample means from populations
$\mathsf{Norm}(\mu_1 = 100, 15)$ and $\mathsf{Norm}(\mu_2 = 105, 15),$ so that $\Delta = 5, \sigma= 15$ and
$\sigma^2/\Delta^2 = (15/5)^2 = 9.$ [For the population means, only $\Delta=|\mu_1-\mu_2| = 5$ matters.]
Then I should reject at
the 5% level a little more than 80% of the time. The simulation
shows rejection 82% of the time, so the simulation is in
substantial agreement with your formula.
set.seed(2020)
pv = replicate(10^5, t.test(rnorm(150,100,15),
                            rnorm(150,105,15),var.eq=T)$p.val)
mean(pv <= .05)
[1] 0.82189

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do I restore Ubuntu's default interface? When I downloaded and install nvidia drivers, both the top bar and bottom bar disappeared. When I removed them, some applications worked, but the bars are still missing and fancy shortcuts such as alt+tab don't work. Thus, I'm not sure how I can restore a screen I minimized. How do I restore it as it was, or should I use this time as opportunity for change?

A: Maybe the easier way is to setup a new account from scratch and to get all of the data you need from /home/your_username to /home/your_new_username afterwards.

A: Next time, when I am doing a Google search, I must remember certain keywords: "dash" and "launcher". The answer is this: https://askubuntu.com/a/76951/110280


text:
Q: Return in json from stored procedure in MVC web api public class VersionController : ApiController
{
    [HttpGet]
    public List<AutoCompleteCompany> acCompany(string term)
    {
        DataSet ds = new DataSet();
        List<AutoCompleteCompany> co= new List<AutoCompleteCompany>();

        try
        {
            ds = getdetails(term);//privae method returns dataset
            co = ds.Tables[0].ToList<AutoCompleteCompany>();
        }
        catch (Exception ex)
        {
        }

        return co;
    }
}

Properties below
public class AutoCompleteCompany
{
    public string Value { get; set; }
}

Converts dataset to list
public static List<T> ToList<T>(this DataTable table) where T : new()
{
    IList<PropertyInfo> properties = typeof(T).GetProperties().ToList();
    List<T> result = new List<T>();

    foreach (var row in table.Rows)
    {
        var item = CreateItemFromRow<T>((DataRow)row, properties);
        result.Add(item);
    }

    return result;
}

private static T CreateItemFromRow<T>(DataRow row, IList<PropertyInfo> properties) where T : new()
{
    T item = new T();

    foreach (var property in properties)
    {
        if (property.PropertyType == typeof(System.DayOfWeek))
        {
            DayOfWeek day = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), row[property.Name].ToString());
            property.SetValue(item, day, null);
        }
        else
        {
            if (row[property.Name] == DBNull.Value)
                property.SetValue(item, null, null);
            else
                property.SetValue(item, row[property.Name], null);
        }
    }

    return item;
}

Webapiconfig
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(name: "DefaultApi",
                routeTemplate: "Api/{controller}/{action}/{id}",
                defaults: new { id = RouteParameter.Optional });

Error:

No HTTP resource was found that matches the request
MessageDetail: no action was found on the controller 'AutoComplete' that matches the request.

and below custom method works
public string GetAccess(string id)
{
    return "value3";
}

Please suggest a way to return dataset from stored procedure in to json as result (web api rest)

A: Because your controller name is Version, not AutoComplete. You just use wrong url.

A: Change your return type to IActionResult, and wrap your list in an OkObjectResult, like so...
return Ok(co);

A: Instead of returning a List you can just return a JsonResult like this.
[HttpGet]
public JsonResult acCompany(string term)
{
  DataSet ds = new DataSet();
  List<AutoCompleteCompany> co= new List<AutoCompleteCompany>();
  try
  {
    ds = getdetails(term);//privae method returns dataset
    co= ds.Tables[0].ToList<AutoCompleteCompany>();
  }
  catch (Exception ex)
  {
  }
  return Json(new { co {);
}

A: You must call something like :
http://yourhostname/Api/Version/acCompany?term=someString

Your Controller name is Version not AutoComplete!

A: I know this has been answered via query string. But as mentioned by OP in comments, if you want to invoke your endpoint like this: http://localhost:5555/api/Version/acCompany/somevalue
then you will need to modify your webapi action parameter to taken in id instead of term as shown below:
[HttpGet]
public List<AutoCompleteCompany> acCompany(string id)
{
   // rest of your action code would make use of id instead of term
}

After this change, you should be able to invoke it as http://localhost:5555/api/Version/acCompany/somevalue. When this is invoked, id will take in somevalue.
The reason why you need to use id is because the way how they are configured in webapiconfig.cs.


text:
Q: error data in loop foreach does'nt display good syntax I don't understand why in my foreach loop I can't use
$products_option_value['products_option_value_id'] for example. I must use
    $option['products_option_value']['products_option_value_id'] to display the good result else I have just a value
Below the elements
var_dump($options_array);
array (size=7)
  0 =>
    array (size=7)
      'products_option_id' => string '213' (length=3)
      'products_option_value' =>
        array (size=13)
          'products_option_value_id' => string '171' (length=3)
          'option_value_id' => string '179' (length=3)
          'name' => string 'S' (length=1)
          'image' => null
          'quantity' => string '100' (length=3)
          'subtract' => string '0' (length=1)
          'price' => string '1.0000' (length=6)
          'price_prefix' => string '+' (length=1)
          'weight' => string '0.00' (length=4)
          'weight_prefix' => string '+' (length=1)
          'customers_group_id' => string '99' (length=2)
          'products_option_model' => string '99' (length=2)
          'option_tax_class_id' => string '99' (length=2)
      'option_id' => string '40' (length=2)
      'name' => string 'Taille' (length=6)
      'type' => string 'select' (length=6)
      'value' => null
      'required' => null
etc

  foreach ($options_array as $option) {
    foreach ($option['products_option_value'] as $products_option_value) {
      var_dump($products_option_value);
    }
  }

the result is :
   var_dump($option); result

    array (size=7)
      'products_option_id' => string '213' (length=3)
      'products_option_value' =>
        array (size=13)
          'products_option_value_id' => string '171' (length=3)
          'option_value_id' => string '179' (length=3)
          'name' => string 'S' (length=1)
          'image' => null
          'quantity' => string '100' (length=3)
          'subtract' => string '0' (length=1)
          'price' => string '1.0000' (length=6)
          'price_prefix' => string '+' (length=1)
          'weight' => string '0.00' (length=4)
          'weight_prefix' => string '+' (length=1)
          'customers_group_id' => string '99' (length=2)
          'products_option_model' => string '99' (length=2)
          'option_tax_class_id' => string '99' (length=2)
      'option_id' => string '40' (length=2)
      'name' => string 'Taille' (length=6)
      'type' => string 'select' (length=6)
      'value' => null
      'required' => null

var_dump($products_option_value) result

    products_info_options_new.php:84:string '171' (length=3)
    products_info_options_new.php:84:string '179' (length=3)
    products_info_options_new.php:84:string 'S' (length=1
    etc

A: http://php.net/manual/en/control-structures.foreach.php
You should use foreach($array as $key => $value) when iterating trough arrays that have keys. (I mean arrays such as this: array("key" => $value), and this is also your array)


text:
Q: While overriding customer createaccount() apis iam getting below errors magento2 rest api I have Overrrided the v1/customers rest api and added in my custom module the method CreateAccount() in my model file
and the file is working fine when checking postman
But while creating a customer it is giving an errors like below
Can you please help me out on this.
Fatal error:  Uncaught Error: Call to a member function getValue() on null in vendor/magento/module-customer/Model/AccountManagement.php: 811
Stack trace:
#0 vendor/magento/module-customer/Model/AccountManagement.php(745): Magento\Customer\Model\AccountManagement->getMinPasswordLength()
#1 app/code/vendor/CustomApi/Model/AccountManagement.php(513): Magento\Customer\Model\AccountManagement->checkPasswordStrength('Password6')
#2 /var/www/html/magento2/generated/code/Meetanshi/CustomApi/Model/AccountManagement/Interceptor.php(24): Meetanshi\CustomApi\Model\AccountManagement->createAccount(Object(Magento\Customer\Model\Data\Customer), 'Password6', '')
#3 [internal function
]: Meetanshi\CustomApi\Model\AccountManagement\Interceptor->createAccount(Object(Magento\Customer\Model\Data\Customer), 'Password6', '')
#4 /var/www/html/magento2/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array(Array, Array)
#5 vendor/magento/module-customer/Model/AccountManagement.php on line 811
{
"messages": {
"error": [
{
"code": 500,
"message": "Fatal Error: 'Uncaught Error: Call to a member function getValue() on null in /var/www/html/magento2/vendor/magento/module-customer/Model/AccountManagement.php:811\nStack trace:\n#0 /var/www/html/magento2/vendor/magento/module-customer/Model/AccountManagement.php(745): Magento\Customer\Model\AccountManagement->getMinPasswordLength()\n#1 /var/www/html/magento2/app/code/Meetanshi/CustomApi/Model/AccountManagement.php(513): Magento\Customer\Model\AccountManagement->checkPasswordStrength('Password6')\n#2 /var/www/html/magento2/generated/code/Meetanshi/CustomApi/Model/AccountManagement/Interceptor.php(24): Meetanshi\CustomApi\Model\AccountManagement->createAccount(Object(Magento\Customer\Model\Data\Customer), 'Password6', '')\n#3 [internal function]: Meetanshi\CustomApi\Model\AccountManagement\Interceptor->createAccount(Object(Magento\Customer\Model\Data\Customer), 'Password6', '')\n#4 /var/www/html/magento2/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array(Array, Array)\n#5 /var/ww' in '/var/www/html/magento2/vendor/magento/module-customer/Model/AccountManagement.php' on line 811",
"trace": "Trace is not available."
}
]
}

A: It seems in which object you are calling the getValue() having nothing to operate. Just print the data and verify if you have some data to operate.


text:
Q: What is the proper way to set the PROPS type? I'm working with REDUX in REACT and am working on getting the mapStateToProps functionality to work correctly.
Here is my component:
interface NavProps{
    loggedIn: boolean,
    loggingIn: boolean
}

class Navigator extends Component {

public render(){
    const { loggedIn } = this.props as NavProps;
    return (
        ...removed irrelevant code
      );
    }
}

const mapStateToProps = (state: RootReducer): NavProps => {
    const { authentication } = state;
    const { loggedIn, loggingIn } = authentication;
    return{
        loggedIn,
        loggingIn
    };
}

export default connect(mapStateToProps, null)(Navigator);

Here you can see I used:
const { loggedIn } = this.props as NavProps;

If not, I get an error that 'loggedIn' is not in this.props.
In the tutorials I looked at, they all used something like this with no problem:
const { loggedIn } = this.props

Am I doing it correctly or am I missing a step that will make the props correctly reflect what is assigned during mapStateToProps?
Update:
 I've gone back and reviewed a couple of the tutorials on REDUX. I see now they were using JSX, not TSX, so maybe I DO have to use type assertion to appease Typescript.
Update:
A couple of people suggested:
class Navigator extends Component <NavProps>

However, that produces this error:
Type '{}' is missing the following properties from type 'Pick<NavProps, "loggedIn" | "loggingIn">': loggedIn, loggingIn  TS2739

<Router>
22 |

> 23 |         <Navigator />

Not sure if it makes any difference, but here is the component that is embedding NAVIGATOR:
const App = () => (
  <Provider store={store}>
    <Router>

        <Navigator />
            <Switch>
              <Route exact path="/libraries" component={Libraries} />
            </Switch>

    </Router>
  </Provider>
);

export default App;

Ok, I found a suggestion here:
TS2740 Type is missing the following properties from ReadOnly error in React Native with TypeScript app
As strange as it seems from the comments below, the answer is to do it like this:
class Navigator extends Component<any, any>

Even though it doesn't seem right to just stick 'any' in there.
Here is one that is a little clearner:
TS2739 - Type missing in following properties
It suggests making the props optional:
interface NavProps{
    loggedIn?: boolean,
    loggingIn?: boolean
}

class Navigator extends Component<NavProps>

A: We can see that in the TypeScript docs here:
class Navigator extends Component<NavProps> {

Here is how it looks on my machine:

A: According to my comments above, I have test this and there's no problem at all
interface NavProps {
  loggedIn: boolean
  loggingIn: boolean
}

class Navigator extends Component <NavProps> {
  public render() {
    const { loggedIn } = this.props
    console.log(loggedIn)
    return null
  }
}

const mapStateToProps = (state: RootReducer): NavProps => {
  const { authentication } = state
  const { loggedIn, loggingIn } = authentication
  return {
    loggedIn,
    loggingIn,
  }
}

export default connect(mapStateToProps, null)(Navigator)

except that I don't have the RootReducer type from your question

update: try to write the connect like this, too
export default connect<NavProps>(mapStateToProps, null)(Navigator)


text:
Q: Receiving wrong value in main() after calling on change_global() function This code is exactly as written in the book I'm using, but the example in the book shows that the third instance of cout in main() should provide the integer -10. Instead it provides 10. Why is my program not providing the actual value given to "glob" in the change_global() function? I'm aware the book is outdated, it is the 4th edition of Beginning C++ through Game Programming.
int glob = 10; // global variable

void access_global();
void hide_global();
void change_global();

int main()
{
    cout << "In main() glob is: " << glob << "\n\n";
    access_global();

    hide_global();
    cout << "In main() glob is: " << glob << "\n\n";

    change_global();
    cout << "In main() glob is: " << glob << "\n\n";

    return 0;
}

void access_global()
{
    cout << "In access_global() glob is: " << glob << "\n\n";
}

void hide_global()
{
    int glob = 0;
    cout << "In hide_global() glob is: " << glob << "\n\n";
}

void change_global()
{
    int glob = -10;
    cout << "In change_global() glob is: " << glob << "\n\n";
}

A: Posted by Retired Ninja
"I'm looking at the source code for the book downloaded from here: delmarlearning.com/companions/content/1305109910/datafiles/… It is not the same as what you've typed, there is a global variable named glob and it is changed by the change_global function. Remove the int from int glob = -10; – Retired Ninja 38 secs ago"
This solves my issue, thank you all for the help!


text:
Q: document.getElementById.innerHTML not working document.getElementById gets the element (i.e p tag) but as soon as
it writes in it the content disappears. There is no error on console but whatever is written within p tag disappears as soon as anything is written onto the p tag.
I can't find any reason for it not working also i'am not allowed to use php for accepting form inputs.

var d=new Date();
 var cday=d.getDay();
 var cmonth=d.getMonth();
 var cyear=d.getFullYear();
 var day,month,year,dage,mage,yage;
 function getDOB() {
  var DOB = new Date(document.getElementById("DOB").value);
  year = DOB.getFullYear();
  month = DOB.getMonth();
  day = DOB.getDay();
}

document.getElementById("inp").onclick = function execute() {
  getDOB();
  yage = cyear - year;

  if (cmonth >= month) {
    mage = cmonth - month;
  } else {
    mage = 12 - (month - cmonth);
    yage = yage - 1;
  }

  if (cday >= day) {
    dage = cday - day;
  } else {
    mage = mage - 1
    dage = 30 - (day - cday);
  }

  document.getElementById("output").innerHTML = "your age is " + dage + " days " + mage + " months " + yage + " years";
}

  <form id="form">
    <!input type="text" id="day" placeholder="dd">
    <! input type="text" id="day" placeholder="mm">
    <!input type="text" id="day" placeholder="yyyy">
    <input type="date" id="DOB">
    <button id="inp">submit</button>

  </form>

A: Your code contains earlier errors and could not reach the innerHTML yet.
Here's the error to start with:

Uncaught ReferenceError: cyear is not defined

You'll also have to add return false; to the end of the function to prevent the form from submitting, as stated by @thewatcheruatu.

A:

date=new Date();           // Get current date
cyear=date.getFullYear();  // current year
cmonth=date.getMonth()+1;  // current month
cday=date.getDate();       // current day

function getDOB()
    {
        var DOB=new Date(document.getElementById("DOB").value);
        year=DOB.getFullYear();
        month=DOB.getMonth();
        day=DOB.getDate();     // getDate() function returns the current date
    }

function execute()
    {
        getDOB();
        yage=cyear-year;
        if( cmonth>=month)
        {
            mage=cmonth-month;
        }
        else
        {
                mage=12-(month-cmonth);
                yage=yage-1;
        }
        if ( cday>=day )
        {
            dage=cday-day;
        }
        else
        {
            mage=mage-1
            dage=30-(day-cday);
        }
        document.getElementById("output").innerHTML="your age is "+dage+" days "+mage+" months "+yage+ " years";
    }

    <form id="form">
        <!input type="text" id="day" placeholder="dd">
        <! input type="text" id="day" placeholder="mm">
        <!input type="text" id="day" placeholder="yyyy">
        <input type="date" id="DOB">
        <button type="button" id="inp" onclick="execute()">submit</button>

    </form>


text:
Q: SQL WHERE clause for column all capitalized table_beatles contains the following data in column name.

*

*John

*PAUL

*george

*RINGO

In MS-SQL is there anyway to get any item which is all caps? eg
SELECT * FROM table_beatles where name is (AllCaps SYNTAX HERE)

to return PAUL and RINGO.

A: How you do this depends on the collation used. If you have a case insensitive collation, you are asking SQL to treat lower and upper case the same. So you may need to do this:
SELECT  *
FROM    table_beatles
WHERE   UPPER(name) COLLATE Latin1_General_CS_AS
             = name COLLATE Latin1_General_CS_AS

This forces SQL to use a case sensitive (CS) comparison for the equality check. If you already have a case sensitive collation, then you can omit the two COLLATE parts of this. But given you've asked the question, I'm guessing you haven't.

A: You want to do a case sensitive search. There are many methods explained here: Case sensitive search in SQL Server queries

A: SELECT * FROM table_beatles where UPPER(name) = name


text:
Q: What is the best way to move this text nearby the logo? currently I'm making a nav bar for a product landing page. And I can't get this " Johns auto service " to get placed near the car picture. When I try to add h1 or p tags then it pushes down out of the div. But when I dont add anything it stays there. So what is the best way to place it in the center right side of the picture like a logo I mean ( like a stackoverflow logo). Thanks for help.  And if there's anything I should change please tell me because I'm still learning this and any advice would be appreciated .

 body {
        margin:0;
      }
      #header {
        display:flex;
        max-height:50px;
      }

      #nav-bar {
        width:40vw;
        justify-content:space-around;
        align-items:center;
      }
      .image {
        width:60vw;
        background-color:gray;
      }
      #header-img{
        width:50px;
      }

       ul {
        padding: 0;
        list-style-type:none;
        display:flex;
        justify-content:space-between;
      }

        Johns auto service

Location

How it works

Pricing

A: As far i can see you didn't declare your .css file in the head of the document.
Add  in the head of your document.
styles.css can be anything you named your . css file.

A: You should add display:inline-block to your p tag or h1 or whatever. So it stays inside the parent.
#header p {
    display: inline-block;
}

I made an example, if this answers your question (not sure though messy request)
https://codepen.io/anon/pen/XBBGrJ

Greets

A:  You can check this fiddle

https://jsfiddle.net/Minal4/fvuojp8x/3/
If any questions please feel free to ask :)


text:
Q: Let $a_i\ge0$ for all $i\in I$ such that $\sum\limits_{i\in I} a_i$ is finite, then $\{i\in I:a_i \neq 0\}$ is countable
Let $a_i\ge0$ for all $i\in I$  such that $\sum\limits_{i\in I} a_i$ is finite, then $J=\{i\in I:a_i \neq 0\}$ is countable.

Let $A= \sum\limits_{i\in I} a_i$, then $A$ is an unordered sum defined as $$\sum\limits_{i\in I} a_i = \sup \left\{\sum\limits_{i \in I^0}a_i: I^0\text{ is a finite subset of }I\right\}.$$
I think I have worked most of them out. I let $J_n = \{i\in I:a_i\gt A/n \}$, $n\in \Bbb{N}$. So as $n \to \infty$, $J_n \to \{i \in I: a_i \gt 0\}$ and because $i\in I$, $a_i \in [0,\infty)$ then $|J_n|$ is at most $|I|$. And since $|J|\to |J_n|$, that $|J|$ is bounded by $|I|$ thus it is countable? But I just thought it is not that rigorous. I also need to prove $|I|\lt \infty$ right? If so, how?

A: I'll present another proof. Find a sequence $F_n$ of finite subsets of $I$ such that $\displaystyle\sum_{i\in F_n} a_i \to A$ as $n\to \infty$. Such a sequence exists (can you prove it ?). Then $\displaystyle\bigcup_{n\in \mathbb{N}} F_n$ is a countable union of finite sets and is thus countable. Assume $J$ isn't countable and let thus $a_k\in J- \bigcup_{n\in \mathbb{N}} F_n$. Thus $a_k>0$. Then take $n$ sufficiently large so that $A- \displaystyle\sum_{i\in F_n} a_i < a_k/2$. Then $F:= F_n\cup\{a_k\}$ is still a finite set and $\displaystyle\sum_{i\in F} a_i > A$, which is a contradiction. So $J$ is countable.


text:
Q: Can a Windows program tell if it is in the firewall rules? Of course no program should be able to add itself but are the firewall rules readable by non-privileged applications?  I have an application which needs to be added to the rules for a special operation.  Rather than failing silently or timing out, I'd like the application to proactively prompt the user, "I need access to port xxx and I'm not listed in your firewall rules.  Please go HERE and do THIS so that I can work for you."

A: Yes. The firewall rules are stored in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\FirewallRules registry key. While in theory you could query the key values directly, it's better to use the Windows Firewall API functions:

*

*Windows Firewall for Windows XP with SP2 API Reference

*Using Windows Firewall with Advanced Security (Windows Vista and later)


text:
Q: Dapper ensure that query succeeded best practice I want to use Dapper into my WebApi Project. I Have a method for creating database from query:
    public async Task<bool> CreateDatabase()
    {
        var connection = _connection.GetOpenConnection();

        bool created = await connection.ExecuteAsync(SqlQuery.CreateDatabase);
    }

My question is, how to write query for creating database and how to ensure, that query completed succesfuly and which method from dapper to use?
My SqlQuery.CreateDatabase looks like this:
IF NOT EXISTS(SELECT * FROM sys.databases WHERE name = 'DataBase')
  BEGIN
    CREATE DATABASE DataBase
  END

Do i need to return something from query?

A: If a problem occurs, it should already present as an exception - probably a SqlException - telling you about it, so: what you have should already be fine. Note, though, that if your connection string tries to connect to the database that doesn't yet exist, then Open[Async] is likely to fail. Ultimately, you could just try connecting to the specified database afterwards to be sure, but again, what you have should already be fine.
Note that it is often the case that app accounts do not have permissions to create databases. In that scenario, you'll need to get a DBA to create the database for you, and tell you the connection details.


text:
Q: Add element to list depending on rule? I understand it allows many facts to be written and a possibility tree created- is it possible to do this:
i would like to add value to list depending whether rule returns true or false?
could some person please show me some small code which can explain this?
thank

A: Suppose you want to generate a list with all the mortals. It can be done with the following code:
% facts
human(victor).
human(peroni).
human(hugo).

% rule
mortal(X) :-
        human(X).

% add X to a list only if rule mortal(X) is true.
add(X,L,[X|L]) :-
        mortal(X).

Example
? add( victor, [hugo], Result).
Result = [victor, hugo].

? add( peroni, [], Result).
Result = [peroni].


text:
Q: Word for a specific crutch gait When looking up some medical terms regarding crutch gait, I found a plethora of resources that detail the different ways how one can properly walk on crutches.
One of this ways is the so called "Two-Point Gait". In this "mode", the patient always advances the foot with the crutch on the opposite side of the body.
Have a look at this video for a demonstration: https://youtu.be/qjukAMe3qJE?t=27
Just in case the link goes dead, let me try to illustrate it with a simple drawing (x foot with injury, > other foot, | crutch):
  |   |   |   |
x   x   x   x
  >   >   >   >
|   |   |   |

It does not really matter, but consider the walking direction from left to right.
Long story short, the question is:
Is there a special term for the walking pattern where a patient does the opposite of what is expected and basically puts foot and crutch of the same side forward at the same time?
Using the notation from above, that might look as follows:
|   |   |   |
x   x   x   x
  >   >   >   >
  |   |   |   |

I have heard some people (physiotherapists) refer to this as "Passgang" in German. According to my research, the direct translation is amble1,2, but the term seems to be primarily used for horses3 (or other animals with four legs) or as a term to describe relaxed walking3,4,5.
Edit:
Prior to asking this question, I studied the following resources:

*

*https://www.physio-pedia.com/Crutches

*https://walkeasy.com/explore/crutch-gaits.php

*https://www.youtube.com/watch?v=ElZkPye4WtA / https://www.registerednursern.com/crutches-nursing-nclex-review/
@MichaelHarvey, added https://www.verywellhealth.com/how-to-walk-safely-with-crutches-2696295 to the list. Thanks for that!
All these sites describe how to use crutches in various modes, but none of them matches what I'm looking for. My best guess would be, that what I'm looking for is an error on the patient's side, i.e. you would not want the patient to walk like this.

1 https://www.linguee.com/german-english/translation/Passgang.html
2 https://de.pons.com/%C3%BCbersetzung/deutsch-englisch/passgang
3 https://www.merriam-webster.com/dictionary/amble
4 https://www.lexico.com/definition/amble
5 https://dictionary.cambridge.org/dictionary/english/amble

A: There are no non-medical terms for crutch gaits (that I, as a non-specialist, am aware of).  For general four-leg gaits, your first is "trotting" and the second is "pacing.  These apply particularly to horses, where some horses trot (moving diagonal legs at the same time) and some pace (moving both left legs at the same time, then both right legs).
An amble (in animal gaits) is a slower pace in which the animal moves Back-left, front-left, back-right, front-right. It is more stable, as there are always three points of contact with the ground.
It would be natural for the terms for four-legged animal locomotion to transfer to humans, when we use our arms with crutches as extra legs.

A: Wild googling using different combinations of words suggested in the comments, the answer by @JamesK, together with "arm"/"leg"/"same side", and so on surfaced some references to namba (or nanba) walking, seemingly originating from Japanese culture, and also found in martial arts (demonstration at a TEDx talk). But I don't expect this term to be used in medicine.
There also seems to be scientific literature about it (e.g. https://www.researchgate.net/publication/266794730_AN_ENERGY-EFFICIENT_LOCOMOTION_SAMURAI-INSPIRED_NAMBA_WALKING), though I cannot judge its reliability. The term ipsilateral movement was used there in the description of Figure 1. Obviously, crutches are not a topic in this paper, but at least from my non-medical perspective, something like ipsilateral crutch gait could work.


text:
Q: File not getting selected in the following Python Code File not getting selected in the following Python Code. The message box should show the file name which is selected but this is showing none.
def ask_master_file_loc():
    path = filedialog.askopenfilename()
    global contracts_v1
    contracts_v1 = glob.glob('file*.csv')
    messagebox.showinfo("Folder Selected", contracts_v1)
    upload.configure(bg = "#C0C0C0", state=DISABLED, relief = SUNKEN)
    create_folder.configure(bg = "#53e13d", state=NORMAL)


text:
Q: Передать данные в input при нажатии кнопки Подскажите, есть ф-ция, как мне сделать так, что при нажатии на кнопку в несколько инпутов передавались данные из массива (саму функцию передачи никак не могу додумать)
    function getmesseg14(){
container.innerHTML = '<input class="ok" type="button" value="OK" onclick="getmesseg56(); return false">';
function getmesseg56(){
``var mynewvar = [  {vaal1:value="12",vaal2:'10.5',vaal3:'12',}  ];
};};

A: Ну, пожалуй начну с того, как грамотно должны быть оформлены методы.

 function getMessage() {
   var messagesArray = ['1st message', '2nd message', '3rd message'];
   $('div#container').empty();

   $(messagesArray).each(function(k) {
     $('div#container').append('
' + messagesArray[k] + '
');
   });
 }

  <button type="button" onclick="getMessage()">Fetch my array messages</button>

Соблюдайте названия методов, при их создании. Если метод должен создать сообщение, то - createMessage (createMsg), удалить - deleteMessage, изменить - editMessage.
UPD
Переписал под jQuery


text:
Q: Joining a pointer and member pointer into a function pointer Please consider such code:
class MyClass{
public:
    void MyFunc(int x){
        std::cout << x << std::endl;
    }
};

int main(){
    MyClass* class_ptr = new MyClass();
    void (Myclass::*member_func_ptr)(int) = &MyClass::MyFunc;

    // This should output '5'.
    (class_ptr->*member_func_ptr)(5);

    /* ??? */

    // I want the following to output '5' exactly the same way as previous call.
    func_ptr(5);
}

How should I complete this code to have func_ptr(...) call the MyFunc from *class_ptr?
If it is possible, I would love to somehow join a MyClass* and a void (Myclass::*)(int) into a void (*)(int).
If not, I expect a clever usage of std::mem_fn and std::function (or other functional utilities) might do the trick.
Ideally, I'd like a C++11 solution (since e.g. std::mem_fun is now deprecated).

A: You can't get a plain function pointer, but you can get a function object using bind or a lambda:
auto bound = std::bind(member_func_ptr, class_ptr, std::placeholders::_1);
auto lambda = [=](int x){return (class_ptr->*member_func_ptr)(x);}

bound(5);  // should output 5
lambda(5); // should output 5 too

Both of these can be converted to std::function<void(int)> if you want.

A: You can't create a function pointer from a member pointer and an object pointer. What you can get is a function object with the same call notation using, e.g., std::bind():
std::bind(member_func_ptr, class_ptr, _1)

You can the use this function object to initialize, e.g., a std::function<void(int)>.


text: Q: Transacciones SQL Necesito hacer una verificación de que se haya realizado correctamente una transacción, siendo que dicha transacción trabaja en varios sistemas, es decir si necesito dar de Alta, en un varios sistemas, a un mismo usuario y uno o todos esos sistemas no se encuentran disponibles como puedo hacer para que el sistema principal reintente hacer la transacción sin tener que repetir el ingreso de datos?


text:
Q: TypeError: $scope.phraseDetail.forEach is not a function when trying to find matches in a single item I keep getting the following error message: TypeError: $scope.phraseDetail.forEach is not a function each time I try to find matches and replace text in a single item.
The code below works perfect when iterating over multiple items in an object, i.e. when the API output is as follows:
/api/phrases/
[
    {
        "id": "f40e0e47-6457-463b-a5f9-9dc97bd2d0ce",
        "phrase": "Training {{group}} to develop their {{attribute}} by ensuring they are comfortable with {{factor}}"
    },
    {
        "id": "66314a72-07ae-445c-97c0-4f659387bbb2",
        "phrase": "Assisting {{person}} in strength and conditioning work to improve {{factor}}"
    }
]

However it does not work when there is only a single item being returned, i.e. as follows:
api/phrases/f40e0e47-6457-463b-a5f9-9dc97bd2d0ce/
{
    "id": "f40e0e47-6457-463b-a5f9-9dc97bd2d0ce",
    "phrase": "Training {{group}} to develop their {{attribute}} by ensuring they are comfortable with {{factor}}"
}

How can I fix this? I have included my code below:
phrase-detail.html (note: bind-html-compile is a directive I nabbed from https://github.com/incuna/angular-bind-html-compile)

controllers.js
function PhraseDetailCtrl($scope, $stateParams, PhrasesService, FilterService, $ionicLoading, $timeout) {

        $ionicLoading.show({
            content: 'Loading',
            animation: 'fade-in',
            showBackdrop: true,
            maxWidth: 200,
            showDelay: 0
        });

        $timeout(function () {

            $ionicLoading.hide();
            $scope.dataLoaded = true;
            $scope.phraseId = $stateParams.phraseId;

            PhrasesService.getPhrasesDetail($scope.phraseId).then(function(dataResponse) {
                $scope.phraseDetail = dataResponse.data;

                var replacers = FilterService.getItemFilter();

                $scope.phraseDetail.forEach(function(e){
                    Object.keys(replacers).forEach(function(key){
                        e['phrase'] = e['phrase'].replace(new RegExp(key, 'g'), replacers[key]);
                    })
                })
            })

        }, 1000)

        $scope.$watch('toggle', function(){
             $scope.toggleText = $scope.toggle ? 'Toggle!' : 'some text';
     })

    }

services.js
/**
*
*/
function PhrasesService($http) {

    this.getPhrasesDetail = function (phraseId) {

        return $http({
            method: 'GET',
            url: server + '/api/phrases/' + phraseId,
        });

    }

}

/**
*
*/
function FilterService() {

    this.getItemFilter = function () {

        var replacers = {
            '{{group}}' : '
group
',
            '{{attribute}}' : '
attribute
',
            '{{factor}}' : '
factor
',
            '{{person}}' : '
person
'
        }

        return replacers;

    }

}


text:
Q: Put a Google Chrome browser action on the side of a window I've written some very simple code (a Google Chrome extension) that gets the keywords from a Google search and display it on a browser action. (I can put the code if necessary).
The thing is for practical reasons I'd like the browser action to be displayed on the side of the browser (like a sidebar).
Is it possible to do this ? I've been searching and so far haven't found.

A: Browser Actions can only ever appear in the top right of the screen next to the Omnibox (url bar).  You can't change where they appear.
If you want to create something that appears on the right of the browser, you can create a content script that will allow you to inject your own HTML, CSS and JS in to any page that the user navigates too. Using this can could create a menu or popup that is anchored to the left or right of the screen.
Conent scripts don't have direct access to most of the chrome.* namespace, but you can easily use message passing to talk to your background page (which has full access) and get it to return results to your content script.


text:
Q: How to determine the excel cell value type(data type such as date, string, float etc.) I want to read the cell(1,1) value in the excel sheet, it is date in the format of 21-08-18.
I'm using the python package xlrd to read the value, it returns the float value ex. like 4567.0
book = xlrd.open_workbook(path)
compSheet = book.sheet_by_name("sheet_name")
cell_value = compSheet.cell_value(1, 1)

How to know the data type of the cell before reading the value whether it is date or string or float or etc.

A: You can get a cell's type to see if it's a date and compare that to xlrd's cell object definition (or directly compare it to the number as seen in that table, as cell.ctype just returns a number).
book = xlrd.open_workbook(path)
compSheet = book.sheet_by_name("sheet_name")
cell = compSheet.cell(1,1)
if cell.ctype is xlrd.XL_CELL_DATE:
    print "Cell 1,1 is a date!"


text:
Q: Combo list focus on Click event- SAP UI5 I have a drop down control with first item as blank. But usually when the user will land on the page, there will be a value selected. User can click on the arrow in combobox to open the list and then choose the first option which is blank to clear the value. Issue is the list of options is too long and as the control always focusses/takes user to the option that was selected key, the user has to do some scrolling to reach the first option of blank.
Is there a way to always redirect the user to the blank option rather than the selected key option?
view.xml
<Label text="Reason"/>
<ComboBox items="{path:'modelName'>/results'}">
    <items>
        <core:Item text="{modelName>description}" key="{modelName>code}"/>
    </items>
</ComboBox>


text:
Q: Literal Does Not Match 01861 select case
         when sale not in  TO_date(sale,'MMYY') then  'N'
         else sale
       end  test
  from daily sales

I would like to see if the data in the column meets the following criteria using the above select. I am receiving the following error:

LITERAL DOES NOT MATCH FORMAT STRING

small data set
0109
0106
0409

column is  a varchar

A: to_date('0109', 'mmyy') is correct, it will return 01-01-2009 00:00:00 AM (in one possible format). So the problem is likely in the column - you may have one or more value(s) that are not, in fact, four digits. You need to do some troubleshooting.
Something I would try:
select max(length(sale)) as max_len, min(length(sale)) as min_len from table_name
(daily sales cannot be a table name - table names don't have spaces in them)


text:
Q: Methods of showing a map has integral or good reduction Question
Say we have a map, C->D, of relative curves over a Dedekind scheme, S. What are some of the available methods for showing that this map has good reduction, or integral reduction, at some s∈S? By this I mean: what are some popular conditions that imply this? What are the tricks people usually use?
Clarification
By a map having good reduction I mean that both Cs and Ds are regular integral curves. By integral reduction I mean that both Cs and Ds are integral curves.

You may assume whatever you want, this is part of the question. Assuming, for example, that C->D is generically Galois; or that D is smooth over S; is legitimate. This is pretty open-ended. Hence, community wiki.

A: You might have a look here.

A: I don't see why there is a map. Why don't you ask when C/S has good reduction? For this, look at Liu, chapter 10.1.


text:
Q: Understanding i/o redirection in the context of _process substitution_ Running GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu).
I don't really understand process substitution (ProcSub) from the perspective of a user interested in lifting the hood on i/o processing and related speed issues. I use ProcSub to script, so I have some knowledge of File Descriptors 0,1,2, but that's pretty much it. I have read a few pretty good posts, e.g. [1], and misc. wikis, e.g. [2],[3], the latter stating: "Process substitution feeds the output (FD 1 and/or 2) of a process (or processes) into the stdin (FD 0) of another process". By that simplest of definitions and for just one process, it seems operationally no different from a simple unnamed pipe.
To look into that I started with tee, in itself interesting from the point of view of i/o.tee permits feeding "stdin to stdout and also to any files given as argument".   So :
$ for i in 1 2 3; do (( j=i+10 )); printf "%d\n" $j > file_$i; done
# so each file in file_{1,2,3} contains the numeral in its name + 10.
$ cat file_{1,2,3} | tee file_4
11
12
13
$ cat file_4
11
12
13

Obviously, I am not interested in seeing data filling my screen ala Matrix, so when:
1) I add a pipe and redirection of shasum's  output ...
$ cat file_{1,2,3} | tee file_4 | shasum -a 256 > file_4.sha256
$

the one liner above exits quietly, file_4 is as before (above) and file_4.sha256 contains the computed SHA256 sum.
The above is just an example to illustrate my question, trying to understand intermediate i/o's. My layman's conclusion is that tee saves the output of the cat cmd in file_4 and its copy normally sent to stdout is actually not sent to stdout but piped to shasum.
Q: Is this even remotely right ?
2) I try the same with ProcSub:
$ cat file_{1,2,3} | tee file_4 >(shasum -a 256 > file_4.sha256)
11
12
13
$

-> No stdout redirection of whatever being sent to FD 1 by tee ?
Q: I am not clear on what ProcSub does or does not do to i/o (obviously it does not affect i/o in this case) and could use an explanation of its mechanism.
3) I try with ProcSub and redirection of final stdout to file_4:
$ cat file_{1,2,3} | tee >(shasum -a 256 > file_4.sha256) > file_4
$

Again this time the one-liner exists quietly.
Q: So the general question is: how are i/o processed for the 3 cases above (or at least for the second and third) ? There are obvious and visible differences in i/o terms (just looking at final stdout), but sometimes different i/o processes can lead to identical end-results on the display. Tx.

A: The idiom >(...) just means (in layman terms): "the name of a file".
And it works as a "name of a file" (sort of, all will be clear in an instant):
$ echo <(date)
/proc/self/fd/11

Or some other number/name on your OS. But echo does print a name, exactly as if you do:
$ echo ProcSubs11
ProcSubs11

And if a file with the label ProcSubs11 exists, you could also do:
$ cat ProcSubs11
contents_of_file_ProcSubs11

Which you could do exactly the same with:
$ cat <(date)
Fri Jan 15 21:25:18 UTC 2016

The difference is that the actual name of the "Process Substitution" is "not visible" and that the details are a lot longer than reading a simple file, as described quite well in all the painful detail in the link to How process substitution is implemented in bash?.

Having said the above, lets review your items.
Q 1

...seems operationally no different from a simple unnamed pipe...

Well, "Process Substitution" is exactly based in an unnamed pipe as your given first link states:

*

*The bash process creates an unnamed pipe for communication between the two processes created later.

The difference is that all the ~6 steps explained in the link are simplified to one idiom >(...) for writing to and <(...) for reading from.
And, it could be argued that the connection (pipe) has a name, as a file has.  Just that that name is hidden from the user (the /proc/self/fd/11 shown at the start).
Example 1

1) I add a pipe and redirection of shasum's output ...
$ cat file_{1,2,3} | tee file_4 | shasum -a 256 > file_4.sha256

There is no "Process Substitution" there, but it worth noting (for later) that tee sends (writes to) what it receive in its stdin to a file file_4 and also sends the same stdin content to stdout. Which happens to be connected to a pipe (in this case) that writes to shasum.
So, in short, in layman terms, tee copy stdin to both file_4 and shasum.
Example 2

2) I try the same with ProcSub:
$ cat file_{1,2,3} | tee file_4 >(shasum -a 256 > file_4.sha256)

Re-using the description above (in layman terms) to describe this example:
Tee copy stdin to three elements: file_4, shasum and stdout.
Why?. Remember that >(...) is the name of a file, lets put that in the line:
$ cat file_{1,2,3} | tee file_4 /proc/self/fd/11

tee is serving the input to two files file_4 and shasum (via "Process Substitution") and the stdout of tee is still connected to its default place: the console. That is why you see the numbers in the console.
To make this example exactly equal to 1), we could do:
$ cat file_{1,2,3} | tee file_4 > /proc/self/fd/11  ### note the added `>`

Which becomes (yes, the space between > and  >( must be used.
$ cat file_{1,2,3} | tee file_4 > >(shasum -a 256 > file_4.sha256)

That is redirecting tee's stdout to the "Process Substitution".
Q 3

Q: So the general question is: how are i/o processed for the 3 cases above

I believe I just did explain the 3 cases, if not clear, please comment.
Q 4 (in comments, Please edit and add the question)

why the <(...) construct won't work in the third case.

Because (in layman terms) you can not insert a male prong into a male socket.
The <(...) idiom reads from what is inside the "Process substitution" and therefore provides an "output" and should be inserted in the stdin of the outside command. The outside command tee is trying to connect stdout (like) elements. So, that pair could not match.
An important note:
The command cat hides some details when applied to "Process Substitution", as both this command will give the same output:
$ cat   <(date)
$ cat < <(date)

All is correct, but drawing conclusions from a misleading equality is wrong.

A:
it seems operationally no different from a simple unnamed pipe.

The point is that not every software may support reading from stdin or writing to stdout.
Furthermore if you want input from several processes then you cannot tell them apart (without looking at the data itself) with just a pipe:
{ echo foo; echo bar; } | cat
# vs.
cat <(echo foo) <(echo bar)

with cat obviously being a bad example. But with awk it can make a difference (FNR vs. NR).
2)
tee file_4 >(shasum -a 256 > file_4.sha256)

No stdout redirection of whatever being sent to FD 1 by tee?

No, why should there be? >(cmd) does not mean "redirect stdout"! So there is a command without redirection. In case 3) you add redirection to the command and the output is redirected.
You can use this for a better understanding of your command lines:
echo tee file_4 >(shasum -a 256 > file_4.sha256)


text:
Q: char pointer and printf 2 please advise me on the following output:
int main()
{

  char ***x = "jjhljlhjlhjl";

  char ***q = "asddfwerwerw";

  **q = **x;

  printf("x:%s\n",x);
  printf("q:%s\n",q);

}

Output: 1 Segmentation fault

A: This is what you should have:
#include <stdio.h>

int main(void) {

  char *x = "jjhljlhjlhjl";

  char *q = "asddfwerwerw";

  q = x;

  printf("x:%s\n",x);
  printf("q:%s\n",q);

  return 0;

}

If you want to initialize a character string, use char *x
Don't use ***x. That means pointer to pointer to pointer to a char.
Hope that helps.

A: "Segmentation fault" is not an output, it's an indication that your program has crashed.
This should come as no surprise, because string literals are char*, not char***. Trying to double-derefefence such pointers is undefined behavior, because it re-interprets the content of a string literal as a pointer to char. This is what is causing the crash.
You can modify your program as follows to make it legal:
int main() {
    char *x = "jjhljlhjlhjl";
    char tmp[] = "asddfwerwerw";
    char *q = tmp;

    *q = *x;
    // This will produce an output that should be easy to explain:
    printf("x:%s\n",x);
    printf("q:%s\n",q);
}


text:
Q: What can I do if a user doesn't accept my answer?
Possible Duplicate:
What happens if you answered a question, questioner says thanks, but didn't accept your answer as correct?

On Stack Overflow I've answered a new user's homework question.
It is clear that I helped him and my answer is the only one, however, (assuming that because he is new) he didn't accept my answer.
I know I shouldn't be "farming" the board for points but it's a bit annoying to see my efforts go "unrewarded". I was wondering what is the course of action here. Do I wait for him to notice?

A: You shouldn't do anything right now. You should wait for the user to respond to you, e.g. if he needs more clarification or doesn't know how to solve his problem with your answer.
Regardless, there's no obligation for people to accept answers. Posting comments like, "Please accept my answer" are noise and – when it comes down to it – quite rude. You can ask the OP if he needs more help or if something was unclear with your answer, offering to improve it and add information.
Eventually, a "0% accept rate" shown for this OP will get him the usual "y u no accept answers?" comments from the community, so sooner or later they'll probably follow up on their questions and accept answers.
But even then, if it doesn't happen, don't worry. Two upvotes weigh more than the score you get from an accepted answer.

A: My experience is that:

*

*New users quickly learn that not selecting an answer effects them, and before long if they are using Stack Exchange often, they'll come back to select an answer.  Meaning that if you're answering questions for new users, expect that you might not get selected as an answer right away. Further, if the user never plans to use Stack Exchange again, don't expect to them to learn how to select an answer, or that you'll later get selected as an answer.

*Experienced users know that it's in their best interest to select an answer if one is in fact provided. Meaning if you're answering questions from an experienced user that has a low acceptance rate for selecting an answer, don't be surprised if the user doesn't select your answer as the answer.
Either way, don't ping the user with comments requesting they select your answer as the answer.

A: This is normal - nothing "blatant" about it.
Some users do not accept answers - you need to learn to live with it.
I have gotten answer accepted a couple of years later... don't lose hope ;)


text:
Q: Do I have to put get/set methods in the class definition in matlab ? Is one forced to place all get and set functions in the class definition file in Matlab ?
I'm asking since this really makes the file a bit messy and defeats the purpose of having a class definition folder.

A: Yes, if you use property set and get access methods (in fact any method with a dot in the name), you must include them within the classdef file, not in separate files. See the documentation.
However, if you have have a special reason to want to put as much as possible in separate files, you can define methods getMyProp and setMyProp in separate files, and then within the classdef file have the get.myProp and set.myProp functions call them.

A: If you use them then you need to define them. but you can also define your variables as public.


text:
Q: Induction help discrete Math? A) For what natural number is this claim true?
B) Prove that your answer to (a) is correct using induction on n
I know the answer is 3 for the first one but I don't know how to do the second question.
5^n > 4^n + 3^n + 2^n

A: Yes, $3$ is the smallest $n\in\Bbb N$ such that $5^n>4^n+3^n+2^n$. Checking that $5^3>4^3+3^3+2^3$ is the basis step of your proof by induction that $5^n>4^n+3^n+2^n$ for all $n\ge 3$. For the induction step itself you need to assume that $5^n>4^n+3^n+2^n$ for some $n\ge 3$ and somehow conclude from this that $5^{n+1}>4^{n+1}+3^{n+1}+2^{n+1}$.
$$\begin{align*}
5^{n+1}&=5\cdot 5^n\\
&>5\left(4^n+3^n+2^n\right)&\text{by the induction hypothesis}\\
&=5\cdot4^n+5\cdot3^n+5\cdot2^n\;;
\end{align*}$$
is it always true that
$$5\cdot4^n+5\cdot3^n+5\cdot2^n\ge 4^{n+1}+3^{n+1}+2^{n+1}\;?$$


text:
Q: Embedded Derby With Glassfish Is it sensible to use embedded derby with Glassfish? If yes or no, what would be the reason?
If I use embedded derby with Glassfish do I have to configure JDBC Connection Pool? If yes, is there any good tutorials about it? Because I have being trying to find one but still with no luck.
I try to understand whether I should use with my web application Embedder Derby or normal Derby as a database.
For example when I try to configure JDBC Connection Pool with Resource Type java.sql.Driver and Datasource Classname org.apache.derby.jdbc.EmbeddedDriver I get following error:
[#|2013-09-21T16:37:20.011+0300|SEVERE|glassfish3.1.2|javax.enterprise.resource.resourceadapter.com.sun.gjc.spi|_ThreadID=39;_ThreadName=Thread-2;|RAR5111 : Error casting to javax.sql.Datasource
java.lang.ClassCastException: org.apache.derby.jdbc.EmbeddedDriver cannot be cast to javax.sql.DataSource
    at com.sun.gjc.spi.DSManagedConnectionFactory.getDataSource(DSManagedConnectionFactory.java:163)
    at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:102)
    at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getUnpooledConnection(ConnectorConnectionPoolAdminServiceImpl.java:697)
    at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.testConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:426)
    at com.sun.enterprise.connectors.ConnectorRuntime.pingConnectionPool(ConnectorRuntime.java:1086)
    at org.glassfish.connectors.admin.cli.PingConnectionPool.execute(PingConnectionPool.java:130)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
    at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214)
    at org.glassfish.admin.rest.resources.TemplateExecCommand.executeCommand(TemplateExecCommand.java:127)
    at org.glassfish.admin.rest.resources.TemplateCommandGetResource.processGet(TemplateCommandGetResource.java:78)
    at sun.reflect.GeneratedMethodAccessor211.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
    at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
    at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
    at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
    at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182)
    at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147)
    at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148)
    at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
    at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)
|#]

A: Solution for this is not to add Driver classname for Datasource classname which was very obvious.


text:
Q: Git diff broken in window git bash shell (Windows) I am working under Windows 7, using the github client and sometimes the git bash shell.
I used to configure my git diff tool with Winmerge using the following information:
How do I view 'git diff' output with a visual diff program?
For an unknown reason, I cannot use the git diff command anymore:
$ git diff
error: cannot spawn winmerge.sh: No such file or directory
external diff died, stopping at path/to/a/file

winmerge.sh is located in a folder accessible from the path from the regular cmd shell, but not from the git bash shell.
I also tried to reset the git diff config by removing every line relative to diff and difftool (both in the ~/.gitconfig file and with the git config --global --unset command), but the error message above keep displaying when calling git diff.
Any help would be warmly appreciated!

A: In fact I had a reference to winmerge.sh in the PATH. Sorry for the bad question!


text:
Q: Unable to Turbo boost Macbook Pro I have MBP 13" 2012, my cpu 2.5 Ghz up to 3.1 Ghz but when I use Intel Gadget, the cpu only reach 2.9 Ghz on render and heavy use situation. Is it possible to make cpu reach 3.1 Ghz by terminal command or by an application ?

A: 3,1GHz is a single core maximum. Like when running prime95 on one core.
http://www.intel.com/content/www/us/en/architecture-and-technology/turbo-boost/turbo-boost-technology.html
Intel has a sneaky way of suggesting that it will work on all cores under some conditions but that's just advertising unfortunately.

A: There are some more factors playing in the Intel Turbo Boost Game.
New Processors like the i3 i5 i7 Generations from Intel als intelligent.
So here are some parameters CPU's are evaluating before going to maniac mode.

*

*CPU Core Temperatur

*Power Status

*Mainboard Temeratur

*how many cores are used

*and much more

So it isn't easy to explain all of the things but if the CPU Temp is over an certain level - Intel CPU is downclocking - so you won't reach the 3,1GHz - and if you are using Battery Power the System does not allow the energy intensive obove 2,8Ghz.
Also the Turbo Mode is acitvated if only one core need "extrem" CPU Power, because the Heat has to be transfered from the CPU out of the Macbook. So you will get 3,1Ghz only in some circumstances.


text: Q: How to deal with MS document I am using POI library to deal with docx, pptx, xlsx and so on. It is strange that MS turn all the embedded files such as .wma, .vsd into .bin. Is there any way to extract them back to the original file with proper extension rather than .bin?


text:
Q: What is the reason for the blue underline? Flutter Does anyone know the reason for the blue lines??
When I double the size variable, the blue underlines turn into red underlines.

A: It's a linter warning. Usually it tells you about the best practices that can improve your code quality.
In this case, it is asking you to use const keyword for those widgets while initialising. The exact rule for this warning can be found here: prefer_const_constructors.
You can check all the linter rules here

A: it just tells you if you do this your code would work better or would be more readable.
in this case, adding const to your Icon would make this widget not to rebuild completely from scratch and use data that have been stored in ram


text:
Q: CANNOT POST with brackets I have a project, when I run with MAMP everything works fine. But when I run in brackets, it throws an error
CANNOT POST /b.html?xx=yy....
HTML:
<form id="emailForm" action="b.html" method="POST">
    <input id="emailModal" type="email" name="email" placeholder="Email" required class="form-control input-lg" value=""></input>
</form>

JS:
Esta función convierte un objeto en una lista de parámetros.
  function objToParams(infoUserShow){
   var str = "";
   for (var key in infoUserShow) {
   if (str != "") {
    str += "&";
   }
       str += key + "=" + encodeURIComponent(infoUserShow[key]);
   }
return str;
 }

This is the Object:
         var infoUserShow = {
          nickname : eventObj.user.nickname
          ,loginProvider : eventObj.user.loginProvider
          ,photoURL : eventObj.user.photoURL
          ,country : eventObj.user.country
          ,isLogged : false
        }

        console.log(objToParams(infoUserShow));

Here we make the submit to the
            //Email exists validation
            var userMail = eventObj.user.email;
               if(!userMail) {
          //We customize the modal header for the customer
          document.getElementById('customMsg').innerHTML = "Hey " + infoUserShow.nickname + "!";

          $('#myModal').modal({
            backdrop: 'static',
            keyboard: false
          });
          $('#myModal').modal('show');

        }else{
          //set user as logged
          infoUserShow.isLogged = true;

          //Add + 1 session to the cookie
          setAddCookie();

          //ADD parameters infoUserShow to the URL
          emailForm.action = "b.html" + objToParams(infoUserShow);

          emailForm.submit();
        }

        $('#Cancel').click(function() {
          $('#myModal').modal('hide');
        });

        $('#Confirm').click(function() {
          var emailValidation = true; //data entered is correct

          if(emailValidation){
            //set user as logged
            infoUserShow.isLogged = true;

            //Add + 1 session to the cookie
            setAddCookie();

            //ADD parameters infoUserShow to the URL
            emailForm.action = "b.html?" + objToParams(infoUserShow);

            emailForm.submit();
          }

        });


text:
Q: Integration testing of React front end with Django REST backend Does anybody know how to do integration testing of a (React) frontend with Django REST backend. I was able to write functional tests for the frontend with Nightwatch.js and with a fake server API. I am also able to separately test Django REST API - Django offers a LiveServerTestCase that can start a test server for you with a test database and destroy it at the end. I'm wondering if it's possible to somehow use/setup Django's test server that can be called by the front end (i.e. Nightwatch tests).
I'm open to other ideas on how I can approach this problem.

A: It is always a bit tricky to integration test heavy client side javascript applications. My tool of choice for this scenario is to use Capybara - a nice Ruby DSL for interacting with web pages - together with a javascript enabled driver. I have used both webkitdriver and poltergeist succesfully. They are both headless so you can run tests in the background without disturbing browsers popping up. (The case with selenium....) There are issues with both in certain cases that I don't remember right now.
Since you are using Django you may want to do testing in Python. I would suggest looking for support for one of the two drivers mentioned above. Also the node.js community may have something useful for this.


text:
Q: Check out working copy to existing files I don't have a working copy. Just imported the files from the server and did some changes. Is it possible to check out a working copy to existing local files and be able to commit the changes I made?

A:
imported the files from the server

WHAT?!

Is it possible to check out a working copy to existing local files

No. And any SVN documentation clearly states it: you can checkout into empty dir only. You have:

*

*Checkout repository into any another location

*Integrate your changes into WC

*Commit changes

*

*Forget about own brainless "workflow"

A: Nope. But you can check out a working copy, then copy your changes over the top of it.
You'd just better hope the server had the latest version of the files, and you're not overwriting other people's changes.
You're using version control wrong. Start using a working copy.


text:
Q: Decrease memory allocations C++ I have troubles coming up with a good strategy to reduce the memory allocations for the following problem:
I am constructing a tree. At start, I only have the root which contains some data ( a list (std::vector) of indices ). I split in two parts where part of the indices go to the left child and the other part go to the right one. I do not know how many would go to left / right. Once, I am done processing the root, I no longer need to store the indices for it. In fact, I am only interested in those for the leaves. Furthermore, additional data can be added at each split!
So, if the root has 20 elements, then after the split the left one may have 12 elements and the right one 10.
In each node, I keep an std::vector which contains those indices. When I am adding the elements, I push_back() the element which leads to many memory allocations.
What would be a good strategy to keep the indices?
The question is relevant to the generation of the SBVH data structure.
Code:
struct Node {
     std::vector<unsigned> indices_;
     // ... some other stuff here
}
void partition(Node* node) {
    Node* left = new Node();
    Node* right = new Node();
    float axis = findSplitPosition(node);

    for(size_t i = 0; i < node->indices_.size(); ++i) {
        if (index is strictly left on axis) {
            left->indices_.push_back(node->indices_[i]);
        } else if(index is strictly right on axis) {
            right->indices_.push_back(node->indices_[i]);
        } else {
            // it intersects the axis -> add to left and right
            left->indices_.push_back(node->indices_[i]);
            right->indices_.push_back(node->indices_[i]);
        }
    }

    // root indices no longer needed
    node->indices_.clear();

}

A: If each node has to maintain a dynamic list itself, then you can use std::vector::reserve() before calling all those push_back()s.
If, however, the entire length is determined once you set up the root and that initial vector remains unchanged, and then you just "split it" between each node, then the nodes themselves can simply hold pointers to the data inside the initial vector—thereby eliminating nearly all allocations around this data structure.

A: Basically if you cannot reserve the vectors based on some heuristics, you fall victim to Schlemiel's algorithm (a milder version though, because the geometric growth ensures a O(n) time complexity on n consecutive insertions instead of O(n^2)).
But you can get away with a constant number of allocations if first you go through the node's indices and record whether the given index should go to the left subnode, the right subnode or both. Also keep track of the left/right subnode's index count:
struct Foo {
    bool goesIntoLeft;
    bool goesIntoRight;
};

std::vector<Foo> foo;
foo.reserve(node->_indices.size());
int leftCount = 0;
int rightCount = 0;
for (auto i = 0; i < node->_indices.size(); ++i) {
    if (index goes into left) {
        foo.push_back({ true, false });
        ++leftCount;
    } else if (index goes into right) {
        foo.push_back({ false, true });
        ++rightCount;
    } else { // goes into both
        foo.push_back({ true, true });
        ++leftCount;
        ++rightCount;
    }
}

std::vector<Node> leftNodes;
leftNodes.reserve(leftCount);
std::vector<Node> rightNodes;
rightNodes.reserve(rightCount);

for (auto i = 0; i < node->_indices.size(); ++i) {
    if (foo[i].goesIntoLeft) leftNodes.push_back(nodes._indices[i]);
    if (foo[i].goesIntoRight) rightNodes.push_back(nodes._indices[i]);
}

This way you only do 3 allocations, namely foo, leftNodes, rightNodes. Though you have to iterate through the indices twice, the heavy lifting (the geometric calculations) is done in the first loop exclusively.


text:
Q: JSON Post data empty - Linux curl Command I am trying to post json data to php file using linux curl command, (Lamp Server)
$ curl -V -H "Content-Type: application/json" -X POST -d '{"id": "123"}'
       http://localhost/crm/UpdateUser.php

In UpdateUser.php,
<?php echo var_dump ($_POST);?>

OUTPUT:
[ec2-user@ip-10-35-1-181 ~]$ curl -v -H "Content-Type: application/json" -X POST -d '{"id": "123"}' http://viacrm.odema.net/crm/UpdateUser.php

* Hostname was NOT found in DNS cache
*   Trying 54.217.206.217...
> POST /crm/UpdateUser.php HTTP/1.1
> User-Agent: curl/7.36.0
> Host: 192.168.1.16
> Accept: */*
> Content-Type: application/json
> Content-Length: 13
>
* upload completely sent off: 13 out of 13 bytes
< HTTP/1.1 200 OK
< Date: Mon, 16 Jun 2014 12:25:00 GMT
* Server Apache/2.2.27 (Amazon) is not blacklisted
< Server: Apache/2.2.27 (Amazon)
< X-Powered-By: PHP/5.3.28
< Content-Length: 13
< Connection: close
< Content-Type: text/html; charset=UTF-8
<
array(0) {
}
* Closing connection 0

Always the Post data shows empty, I even tried to use "ACCEPT: application/json", still same problem. Please can anyone guide this ?

A: $_POST only contains the results of decoding an application/x-www-form-urlencoded request. You need to read the raw request body. If you have the always_populate_raw_post_data configuration directive turned on, then the raw body will be in $HTTP_RAW_POST_DATA; otherwise you can obtain it by reading from the php://input stream.

A: Instead of $_POST try it:
<?php
    print($HTTP_RAW_POST_DATA);
?>


text:
Q: Install python2.7 unmet dependencies problems - Ubuntu 18.04 I recently clean reinstalled Ubuntu 18.04 and now wanted to install python2.7 for various other dependencies, however am unable to do so. Running sudo apt install python and sudo apt install python-minimal both have very similar errors:
python:
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 python : PreDepends: python-minimal (= 2.7.15~rc1-1) but it is not going to be installed
          Depends: python2.7 (>= 2.7.15~rc1-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

python-minimal:
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 python-minimal : Depends: python2.7-minimal (>= 2.7.15~rc1-1~) but it is not going to be installed
                  Recommends: python but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Installing python2.7-minimal then outputs:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 python2.7-minimal : Depends: libpython2.7-minimal (= 2.7.15-4ubuntu4~18.04.1) but 2.7.15-4ubuntu4~18.04.2 is to be installed
                     Recommends: python2.7 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Installing python2.7 runs into the exact same error as before, and libpython2.7 is already installed, since apt-cache policy libpython2.7 returns:
libpython2.7:
  Installed: 2.7.15-4ubuntu4~18.04.2
  Candidate: 2.7.15-4ubuntu4~18.04.2
  Version table:
 *** 2.7.15-4ubuntu4~18.04.2 100
        100 /var/lib/dpkg/status
     2.7.15-4ubuntu4~18.04.1 500
        500 http://ftp.ticklers.org/archive.ubuntu.org/ubuntu bionic-updates/main amd64 Packages
        500 http://ftp.ticklers.org/archive.ubuntu.org/ubuntu bionic-security/main amd64 Packages
     2.7.15~rc1-1 500
        500 http://ftp.ticklers.org/archive.ubuntu.org/ubuntu bionic/main amd64 Packages

Yes I have ran sudo apt update and upgrade, and I have been looking for answers for multiple days now without success. Any help would be greatly appreciated, because I think the inability to install python2.7 might be related to Ubuntu not being able to recognize hardware ports (such as HDMI) and not being able to change the brightness.
Hardware information:
Product Name: Acer Aspire A715-72G
Processor: Intel(R) Core(TM) i5-8300H CPU @ 2.30GHz
Additional Graphics Card: GP107M [GeForce GTX 1050 Mobile]
I am very new to Ubuntu, and Unix in general, so I hope it is a beginner mistake and it is easily fixable. This is the first question I have asked so if there is anything more I should add, please tell me so.
All help would be greatly appreciated, thank you very much!
EDIT: Add the output of sudo apt update
Hit:1 http://ftp.ticklers.org/archive.ubuntu.org/ubuntu bionic InRelease
Hit:2 http://ppa.launchpad.net/apandada1/brightness-controller/ubuntu bionic InRelease
Hit:3 http://archive.canonical.com/ubuntu bionic InRelease
Hit:4 http://ftp.ticklers.org/archive.ubuntu.org/ubuntu bionic-updates InRelease
Ign:5 http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu bionic InRelease
Hit:6 http://ftp.ticklers.org/archive.ubuntu.org/ubuntu bionic-backports InRelease
Hit:7 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease
Hit:8 http://ftp.ticklers.org/archive.ubuntu.org/ubuntu bionic-security InRelease
Err:9 http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu bionic Release
  404  Not Found [IP: 91.189.95.83 80]
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

A: Maybe you would be knowing this and it is not a solution to your question but
Python 2.7 will not be maintained past 2020. Originally, there was no official date. Recently, that date has been updated to January 1, 2020.
Please avoid using Python 2.7


text:
Q: Executing Specification with Scope does not call sub tests Given the following Specification
class Config2Spec extends org.specs2.mutable.Specification {
  "reading different versions of config should work" in new aScope  {
    "buffer should contain a proper config" in {
      buffer(0).content should have size 1
    }
   "buffer should have fresh config" in {
      buffer should have size 2
      buffer(1).content should have size 2
    }
 }

 trait aScope extends Scope {
   val buffer : mutable.Buffer[Config] = mutable.Buffer()
   val cfg1 = "l1"

   val cfg2 = "l1\nl2"

   val file = "testCfg"
   val path = Paths.get(System.getProperty("user.home"), "test")
   Files.createDirectories(path)
   val of = ObservableFile(path, file)
   Files.write(of.asPath, cfg1.getBytes("UTF-8"))
   buffer += ConfigReader.read(file, {cfg => buffer += cfg})
   Files.write(of.asPath, cfg2.getBytes("UTF-8"))
   Thread.sleep(1000)
  }
}

the two examples "buffer should contain a proper config" and "buffer should have fresh config" never get called. What does have to be changed to get this working?

A: Scopes can only be used on "terminal" examples:
class Config2Spec extends org.specs2.mutable.Specification {
  "reading different versions of config should work" in {
    "buffer should contain a proper config" in new aScope {
      i === 0
      i += 1
    }
    "buffer should have fresh config" in new aScope {
      i === 0
      i += 1
   }
 }

  trait aScope extends Scope {
    var i = 0
  }
}


text:
Q: Is there a way in Playwright to select a specific button inside a dynamic table? I'm new in developing and I'm facing a real problem with the creation of one e2e test.
Basically, I have a table with 2 or more rows, every row has 5 columns ( title, x, y,z button).
How can I click the button on the correct row using the title? (This is a test to prove that the delete process of this table works).
The application I'm testing is written with React framework, so all the tables change frequently and I need a way to trust the code and don't have any bugs.
I need to click this element but it is not ever in the same position
HTML

     Some Title
     x
     y

       <button>I need to click this</button>


text:
Q: stuck on starting app and after started mongodb is not connecting I have installed meteor. On command prompt while creating an app the command is stuck on starting app. Following are the steps which I done

*

*mkdir meteor

*cd meteor

*meteor create todo

*cd todo

*meteor

after this output shows as below

*

*started proxy

*starting your app

after that I have add set URL for mongo dB
as shown below:
c:/users/om/meteor/todo> set MONGO_URL=mongodb://localhost:27017
after that I used meteor command
the output is as shown below

*

*started proxy

*app is started

after creating app meteor is not connecting to the mongodb and does not show after proxy that started mongodb

A: Try this:
set MONGO_URL=mongodb://localhost:27017/my-database-name

You'll notice that I added a database name at the end, which is probably what you are missing.


text:
Q: APNS pushes not re-sent when device becomes available again, GCM pushes are I am using the Azure Notification Hub to send push notifications to iOS and Android devices. Currently when a device is not available when the push is sent (either it has no signal or is powered off, for example) then on iOS the push is never received, whereas on an Android device the push is received within seconds of the device becoming available again.
Is this something I have control over in the NH configuration, or is it governed internally by the Azure NH?
If it's handled internally by NH, is there any way I can know when a push has not been successfully received by the app and schedule it to be re-sent?

A: By default Azure NH sends notifications by setting the APNS-expiration to zero (APNS treats the notification as if it expires immediately and does not store the notification or attempt to redeliver it) but this is configurable when sending notifications, using this API:
public Task<NotificationOutcome> SendNotificationAsync(
    Notification notification
)

Example:
AppleNotification notification = new AppleNotification(jsonPayload, DateTime? expiry)

expiry identifies the date when the notification is no longer valid and can be discarded.
await SendNotificationAsync(notification)

You can also set the expiry through templates.
First, you have to create registration like this.
AppleTemplateRegistrationDescription registration = new AppleTemplateRegistrationDescription(DeviceToken)
{
    BodyTemplate = new CDataMember(ApnsBodyTemplate)
};
registration.Expiry = @"$(apnsexpirytime)";
await client.CreateRegistrationAsync(registration);

You can use SendTemplateNotificationAsync API to send apple notification with expiry like this.
DateTime actualExpiryTime = DateTime.UtcNow.AddHours(1);
Dictionary<string, string> nameValuePairs = new Dictionary<string, string>();
// other template property values

nameValuePairs.Add("apnsexpirytime", actualExpiryTime.ToString("o"));
await client.SendTemplateNotificationAsync(nameValuePairs);


text:
Q: Could not open '/lib/ld.so.1': No such file or directory when cross compiling mips I am trying to compile some C code with the intention of executing it on a Mips Linux o32 embedded system. I have simple C code,
#include <stdio.h>
void main(){
    printf("Hello world");
}

and compiled it with
mips-linux-gnu-gcc -mfp32 helloworld.c

I know I cant run it on my linux machine so to test it first I got qemu and tried to run it with
qemu-mips ./a.out

But I am getting an error
qemu-mips: Could not open '/lib/ld.so.1': No such file or directory

Which I suspect has to do with the fact that I am including stdio.h but did not link it. How could I fix this.
I expected the code to run.

A:
I am getting an error
qemu-mips: Could not open '/lib/ld.so.1': No such file or directory
Which I suspect has to do with the fact that I am including stdio.h but did not link it.

This is because you have compiled a dynamically linked executable. You should be able to see it in the readelf -l a.out | grep interpreter output. So when you run it the QEMU needs the target dynamic linker, but it cannot find one, because the /lib contains your host binaries and there's no ld.so.1 in it.
It can be fixed by building static executable (mips-linux-gnu-gcc -mfp32 -static helloworld.c), or by supplying the location of the target MIPS rootfs (containing lib/ld.so.1 and other needed libraries) in the QEMU command line (qemu-mips -L<path to directory with MIPS rootfs> ./a.out).