text:
Q: Adding values to existing array of arrays I'm making an array that will look like this var qwe = [[a,b],[c],[d]] with the purpose of a and b being the identifiers.
a - d are coming from reading the DOM. My current JS is doing what I want it to but I want to combine the similar arrays by their identifiers. Running the below code will give me
qwe =[
[100,200],[3],[2],
[200, 300],[12],[4],
[100,200],[2],[6]
]

but I want the final array to add the similar arrays by their identifiers so it will end up looking like (based on previous example)
qwe =[
[100,200],[5],[8],
[200, 300],[12],[4]
]

HTML

    ID
    Location
    Value
    Other

    <input name="itinValue" value="100">
    <input name="location" value="200">
    <input name="num" value='3'>
    <input name="other" value='2'>

    <input name="itinValue" value="200">
    <input name="location" value="300">
    <input name="num" value='12'>
    <input name="other" value='4'>

    <input name="itinValue" value="100">
    <input name="location" value="200">
    <input name="num" value='2'>
    <input name="other" value='6'>

JS
var table = document.querySelectorAll('[name="itinValue"]');
var qwe = [];

for(var i = 0; i < table.length; i++) {
  var a = document.getElementsByName('itinValue')[i].value;
  var b = document.getElementsByName('location')[i].value;
  var c = document.getElementsByName('num')[i].value;
  var d = document.getElementsByName('other')[i].value;
  var x = [[a,b],[c],[d]];

  //Compare,find,add here

  //if identifiers do not exist
  qwe.push(x);

}

This is a fiddle to my example that also correctly outputs the html too https://jsfiddle.net/3oge7wxg/125/

A: It looks like you want something called an associative array, "dict" in python, a key/value pairing, with the keys being your [a,b] part and the values your [c,d] parts.
You can emulate this in JavaScript through objects.
Further reading is here:

*

*JavaScript Associative Arrays Demystified

*JavaScript Basics: How to create a Dictionary with Key/Value pairs

A: I would use objects, just create a composite key:
var table = document.querySelectorAll('[name="itinValue"]');
var qwe = {};

for(var i = 0; i
 [key.split("_")].concat(qwe[key]));

https://jsfiddle.net/3oge7wxg/161/
Edit: Number constructors; Added fiddle

A: There are key facts I am taking note of in your question:

*

*you are looping an array of data.

*you are storing data based on a key which is a tuple.

*values where key is a match is an addition option.

*a,b,c,d are all ints,so if these are strings, you would need to run parseint() if they are strings.  This can be done by checking if it is currently type is a string, and if so, convert it.

Since it is a tuple and those are not implmented in javascript, you can do something like this.
var m = {};
var table = document.querySelectorAll('[name="itinValue"]');
for(var i = 0; i < table.length; i++) {

  var a = +document.getElementsByName('itinValue')[i].value;
  var b = +document.getElementsByName('location')[i].value;
  var c = +document.getElementsByName('num')[i].value;
  var d = +document.getElementsByName('other')[i].value;

  var key = a.toString() + "-" + b.toString();
  //creates key = "100-200"
  if (m[key]){
    m[key] = [m[key][0] + c, m[key][1] + d]
  }else{
    m[key] = [c,d]
  }
}

in the end, your map will now have unique keys and a map that looks like:
{
  "100-200": [5,8],
  "200-300": [12,4]
}

and if for whatever reason, you need to break up they keys later, you just split on the key.   map.keys[index].split("-")
I think this is clean, but if you want to go a bit more, you could turn it into a class.
You then store the information in qwe.  If you need to, you can easily convert that from a map to a list, but it depends on your desired implementation goal. The key difference generally is whether or not you wish to maintain order.  qwe is populated only with this information, and given your comment based on this being your implementation not the best one, it gives me enough insight to believe that order isnt really as important as preservation of they key data elements, this key/tuple, and 2 values.

A: If you know the amount of fields per row, here is an alternate way of retrieving your array.
var qwe = {};
var els = document.querySelectorAll('table#tab input');
for (i=0; i<els.length; i+=4) {
    var indexer = i < 4 ? 0 : i;
    var row = {
        a: [
            parseInt(els[indexer].value)
          , parseInt(els[indexer+1].value)
        ]
        , c: parseInt(els[indexer+2].value)
        , d: parseInt(els[indexer+3].value)
    };
    row.key = row.a.join('_');

    if (qwe[row.key]) {
        qwe[row.key][1][0]+=row.c;
        qwe[row.key][2][0]+=row.d;
    } else {
        qwe[row.key] = [row.a, [row.c], [row.d]];
    }
}

console.log( Object.values(qwe) );

A: You could try to find the item for updating and if not push the new array.

var table = document.querySelectorAll('[name="itinValue"]'),
    qwe = [],
    a, b, c, d, i,
    item;

for (i = 0; i
 l === a && r === b);
    if (item) {
        item[1][0] += c;
        item[2][0] += d;
    } else {
        qwe.push([[a, b], [c], [d]]);
    }
}

console.log(qwe);

    ID
    Location
    Value
    Other

    <input name="itinValue" value="100">
    <input name="location" value="200">
    <input name="num" value='3'>
    <input name="other" value='2'>

    <input name="itinValue" value="200">
    <input name="location" value="300">
    <input name="num" value='12'>
    <input name="other" value='4'>

    <input name="itinValue" value="100">
    <input name="location" value="200">
    <input name="num" value='2'>
    <input name="other" value='6'>

Version with Map.

var table = document.querySelectorAll('[name="itinValue"]'),
    qwe = [],
    a, b, c, d, i,
    item
    map = new Map;

for (i = 0; i < table.length; i++) {
    a = +document.getElementsByName('itinValue')[i].value;
    b = +document.getElementsByName('location')[i].value;
    c = +document.getElementsByName('num')[i].value;
    d = +document.getElementsByName('other')[i].value;

    item = map.get([a, b].join('|'));
    if (item) {
        item[1][0] += c;
        item[2][0] += d;
    } else {
        item = [[a, b], [c], [d]]
        map.set([a, b].join('|'), item);
        qwe.push(item);
    }
}

console.log(qwe);

    ID
    Location
    Value
    Other

    <input name="itinValue" value="100">
    <input name="location" value="200">
    <input name="num" value='3'>
    <input name="other" value='2'>

    <input name="itinValue" value="200">
    <input name="location" value="300">
    <input name="num" value='12'>
    <input name="other" value='4'>

    <input name="itinValue" value="100">
    <input name="location" value="200">
    <input name="num" value='2'>
    <input name="other" value='6'>


text:
Q: Saving mixed structured data with h5py I have a dataset with 100,000 entries, each of the form:
{
attr1 float[300]
attr2 float[300]
attr3 float[300]
attr4 float
attr5 float
attr6 float
}

What is the most efficient way to store this in an .hdf5 file?

A: Without your data (and the data structure) or a code example, it's hard to provide an example specific to your problem. I created a PyTables example that shows the basic operation. There are a lot of ways to define the table structure and input the data. I like to create a np.dtype and reference with description=. In this example, I create and add the data row-by-row using a list with one tuple. However, if you have all the data, you can create an NumPy structured array and reference with the obj= parameter. This will create the array and populate all in one shot
Here is  PyTables example with 100 rows and attr1/2/3 arrays sized to 10 elements. It shows the logic. You can modify to increase the number of rows and array elements.
All of the PyTables table methods are explained here:
PyTables table methods
import tables as tb
import numpy as np

attr1  = np.arange(10.)
attr2  = 2.0*np.arange(10.)
attr3  = 3.0*np.arange(10.)
attr4  = 4.0
attr5  = 5.0
attr6  = 6.0

ds_dt = np.dtype({'names':['attr1', 'attr2', 'attr3',
                           'attr4', 'attr5', 'attr6'],
                  'formats':[(float,10), (float,10), (float,10),
                              float, float, float ] })

with tb.File('SO_58674120_tb.h5','w') as h5f:

     tb1 = h5f.create_table('/','my_ds', description=ds_dt)
     for rcnt in range(1,100):
         data_list = [ (rcnt*attr1, rcnt*attr2, rcnt*attr3,
                        rcnt*attr4, rcnt*attr5, rcnt*attr6), ]
         tb1.append(data_list)

You can do the same with h5py. The process is similar, but there are differences. For example, you have to size the dataset with shape=, and add maxshape= if you want to extend the dataset in the future. Also, I only know how to add data by referencing numpy arrays (not lists like PyTables). So I created recarr to hold the intermediate data. Again, if you have all your data, you don't have to load it row by row.
See code below:
import h5py
import numpy as np

attr1  = np.arange(10.)
attr2  = 2.0*np.arange(10.)
attr3  = 3.0*np.arange(10.)
attr4  = 4.0
attr5  = 5.0
attr6  = 6.0

ds_dt = np.dtype({'names':['attr1', 'attr2', 'attr3',
                           'attr4', 'attr5', 'attr6'],
                  'formats':[(float,10), (float,10), (float,10),
                              float, float, float ] })
recarr = np.empty((1,), dtype=ds_dt)

with h5py.File('SO_58674120_h5.h5','w') as h5f:

     h5f.create_dataset('my_ds', dtype=ds_dt, shape=(100,), maxshape=(None) )
     for rcnt in range(1,100):
         recarr['attr1']= rcnt*attr1
         recarr['attr2']= rcnt*attr2
         recarr['attr3']= rcnt*attr3
         recarr['attr4']= rcnt*attr4
         recarr['attr5']= rcnt*attr5
         recarr['attr6']= rcnt*attr6
         h5f['my_ds'][rcnt] = recarr[0]

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can I load new content without reloading the page based on hashtags fragments? Imagine I'm on:
http://example.com/
I click in a link containing a hashbang fragment identifier, let's say:
http://example.com/#!/login
I would like it to show the login form without reloading the page. How is this done?

A: Have a look at jQuery Ajax to find out how to load new content without refreshing the page, then maybe move on to BackboneJS and use its routers to get the hash thing working.
Edit:
Here's a tutorial, I'm not going to write one for you. But it comes down to having a server side which is able to provide the needed content for you (a log in form), whether it does so asynchronously or synchronously is besides the point. Then using a Backbone Router which will read the hash bang and call the right JavaScript function based on this hash bang, this JavaScript function should live inside a Backbone Controller, and it should handle the instantiating of a new Backbone View and adding it to the DOM. The Backbone View could be added to a predefined Backbone Region, and could be loading an UnderscoreJS template to make things even easier.

A: If you would like a much simpler solution you should take a look at another concise answer here: Handle URL anchor change event in js. In summary, you periodically check window.location.hash for changes and run your javascript to bring up the login content.


text:
Q: Magnetic levitation frog example I'm trying to figure out the strength of the magnetic field needed to levitate the frog, assuming it's spherical, has mass $5$kg and diameter $20$cm. I also assume $\vec{B}$ is uniform. Since it's mostly water, I can treat the frog as a diamagnetic material, so it will be repelled away from the field.
I want to find the magnetic dipole moment of this frog in terms of the applied field, but I'm not sure how to go about doing it. My thoughts are, that the sphere will become uniformly magnetized in the field, and will have a magnetic dipole moment $\vec{m}=\frac{4}{3}\pi R^3\vec{M}$, where $\vec{M}$ is the magnetic dipole per unit volume and $R$ is the frog's radius. Then using the relation $\vec{H}=\frac{1}{\mu_0}\vec{B}-\vec{M}$, we'd have $\vec{m}=\frac{4}{3}\pi R^3(\frac{1}{\mu_0}\vec{B}-\vec{H})$, but by Ampere's law, $\oint\vec{H}\cdot\vec{dl}=$ enclosed free current $=0$, we'd just have $\vec{m}=\frac{4}{3}\pi R^3(\frac{1}{\mu_0}\vec{B})$. Is this correct?
Then to find the strenght of the field, I would have $mg\hat{z}=-\vec{F}=\nabla(\vec{m}\cdot\vec{B})$?

A: Yes, the frog will be repelled from the field if the field is non-uniform. Its magnetic moment is given through the susceptibility of Water
$\vec \mu = V \chi \vec H$ and $\chi_\mathrm{water}\approx -9\times 10^{-6}$
Lets say the average field over the Frog is $\mu_0 H = 10\;\mathrm{T}$. This results in an induced moment of $\mu = -0.3 \mathrm{Am}^2 $
Now lets check the force due to a field gradient. With this volume the frog will have 4 Kg. That results in a force due to gravity of about $F\approx 40\;\mathrm{N}$ The force due to the field gradient (assumed to be in $z$-direction) will be
$F= \mu \; \mathrm{d}B/\mathrm{d}z $
We therefore need a field gradient of $133\;\mathrm{T/m}$.
Note, this is the reason why the volume in this levitation experiments are so confined (and why you cannot try this at home).
In reality the field will be larger (16 or more), such that the required gradient reduces accordingly. This gradient also results in a "stable" height. If the frog goes down, field strength increases. Therefore the magnetic moment increases, resulting in an increased force upwards. If it goes up the opposite takes place and there is only one height where gravity is exactly compensated (assuming a constant gradient of course and neglecting movement and variations in $x$ and $y$)
Long story short: you need
$B\;\mathrm{d}B/\mathrm{d}z >\frac{\mu_0 \rho g}{\chi}$


text:
Q: Small linux distro that to run in a VM and which has JRE I'm looking for smallest linux distro with a GUI that natively runs JRE.  DSL doesn't have JRE and I don't really want to spend 15 hours trying to figure out how to install it.  I'm looking for something that pretty much works out of the box.

A: The JRE comes as an RPM or Deb installer. In reality though they are simply archives that go into the package manager. So theoretically you should be able just to extract the contents of one of the installers, dump it in your filesystem, and resolve any missing library issues.
However doing this is a little crazy. Why not take Ubuntu server, install X, then just run the JRE in there? No window manager, no desktop environment, just your Java program. That's plenty light enough if you don't want a DE.


text:
Q: Calculo de SLA no PostgreSQL Quero calcular o tempo entre a data de registro até agora(current_timestamp). Ex: Se o registro foi 2019-03-01 09:11:17 e agora é 2019-03-01 09:46:17 então deverá me retornar 00:35:00 minutos, certo? Só que este tempo deverá parar de contar depois das 18:00 e só retornar depois das 08:00 no dia seguinte. Também não deverá contar nos sábados, domingos e nem em feriados.

A: Não sei se entendi muito bem, mas você quer saber os registros que estão no horário comercial?
Se sim a solução comentada anteriormente resolve. Abaixo segue um exemplo conforme a resposta anterior, e também a complemento com a função isodow, que serve para saber qual dia da semana uma determinada data está. Segue exemplo de consulta de segunda a sexta das 8 a 18 horas:
create table teste (
    datahora timestamp
);

Insert into teste values (current_timestamp);
Insert into teste values (current_timestamp + interval '1' day);
Insert into teste values (current_timestamp + interval '2' day);
Insert into teste values (current_timestamp + interval '3' day);
Insert into teste values (current_timestamp + interval '4' day);

select* from teste where (extract(hour from datahora) between 8 and 18) and (extract(isodow from datahora) between 1 and 5);

Complementando a sua necessidade, de somar o SLA do registro datahora mas somente das 8 as 18 horas dos dias de semana, montei uma query com a clausula WITH e WITH RECURSIVE, mas também poderia ter sido utilizada uma TEMP TABLE. Vale a pena pesquisar um pouco sobre ela e sobre CTE. Segue exemplo:
Insert into teste values (current_timestamp + interval '-10' day);
Insert into teste values (current_timestamp + interval '-12' day);
Insert into teste values (current_timestamp + interval '-15' day);

with recursive sla_dias_anteriores (datahora_original, datahora_inicial, datahora_final, diferenca_horas) as (
    select date_trunc('sec', datahora) as datahora_original, date_trunc('sec', datahora) as datahora_inicial, (date_trunc('day', datahora) +  interval '18' hour) as datahora_final, ((date_trunc('day', datahora) +  interval '18' hour) - date_trunc('sec', datahora)) as diferenca_horas from teste where (extract(hour from datahora) between 8 and 18) and (extract(isodow from datahora) between 1 and 5)
    union
    select datahora_original,
    h.datahora_inicial as datahora_inicial,
    h.datahora_final as datahora_final,
    ( h.datahora_final -  h.datahora_inicial) as diferenca_horas from sla_dias_anteriores as s
    , lateral (select (date_trunc('day', datahora_inicial) +  interval '1' day + interval '8' hour) as datahora_inicial, (date_trunc('day', datahora_final) +  interval '1' day + interval '18' hour) as datahora_final) as h
    where s.datahora_final <= current_timestamp
),
sla_dia_atual (datahora_original, datahora_inicial, datahora_final, diferenca_horas) as (
    select date_trunc('sec', datahora) as datahora_original, h.datahora_inicial as datahora_inicial, h.datahora_final as datahora_final, (h.datahora_final - h.datahora_inicial) as diferenca_horas
    from teste,
    lateral (select (date_trunc('day', current_timestamp::timestamp) +  interval '8' hour) as datahora_inicial, (date_trunc('sec', current_timestamp::timestamp)) as datahora_final) as h
    where (extract(hour from datahora) between 8 and 18) and (extract(isodow from datahora) between 1 and 5)
)
select q.datahora_original, sum (q.diferenca_horas) as soma_sla from (
    select * from sla_dias_anteriores where datahora_final <= current_timestamp
    union
    select * from sla_dia_atual) as q group by q.datahora_original;


text:
Q: DIfferences between create-react-app on macos vs linux? I'm getting a weird error from a project that I started from create-react-app on a macbook. When I cloned the project on my ubuntu drive, when I launch the app (npm start), it gives me this error. With some node & express errors.
TypeError: Path must be a string. Received undefined
at assertPath (path.js:28:11)
at Object.join (path.js:1236:7)

I tried reinstalling my dependencies, clearing npm cache, even reinstalling node.
I noticed some dependencies wouldn't work on linux.
The weird thing is, I have started other react projects on my linux machine and it works fine. The only one that gives me cryptic errors is the one I originally made on macos. Any clues as to what it could be ?


text:
Q: pentaho kettle cannot connect to cloudera cdh4 HDFS I am using pentaho data integration tool (Kettle PDI 5.0) and Cloudera CDH4 (ver 4.6) virtualbox singlenode version.
I am trying to run the tutorial Loading Data into HDFS.
But the problem is that I cannot connect to the CDH4 HDFS:
Kettle shows me the error that it cannot connect to HDFS.
I have configured the active.hadoop.configuration to cdh42 and I am running the spoon.bat file from windows 8.1
Kindly provide help if anyone knows how to setup the connection.

A: To configure connection to Hadoop you need to provide correct configuration files in /plugins/pentaho-big-data-plugin/hadoop-configurations/YOUR_CONF/. You should at least provide core-site.xml.
Then you should edit plugin.properties in /plugins/pentaho-big-data-plugin/ and set active.hadoop.configuration=YOUR_CONF.
I didn't mentioned YOUR_CONF for no reason: it is most likely that CDH 4.2 and 4.6 are not compatible! So you have to create your own configuration dir and provide libraries for it. Most of them come from hadoop and its' components lib folders and others are provided by pentaho like pentaho-hadoop-shims-hadoop-*.jar.
Also, consider reading Hadoop Configurations.

A: So colleague, many times the lack of connection to the directory can be related to the user. when using haddop with pentaho because it is necessary that the user who runs the pentaho is the same user who has the hadoop cores.
for example if you have a user called jluciano on hadoop you need to check a user on the system who uses the same name and then run the process in pentaho, so the accesses to the directory will roll :).
Test it there and anything warns you
Another things, try connect with hostname and after with IP


text:
Q: Extract data from old Clié's Addressbook.pdb file Does anyone know if there exists an utility to extract the data from a AddressDB.pdb1 file (from a Clié, PalmOS).
I am primarily on a Windows 7 laptop, so solutions that work for Windows would be preferred, but are not necessarily required.
1 I got the addressbook file from a backup of the PDA that I ran a while ago on my Linux desktop.

A: Here is a Perl script that does what you want. I used it myself back in the days when I had a PDA. It's old and I don't know if new Perl versions might have have broken it.


text:
Q: How to solve jQuery ajax load more issue? I am using load more functionality in my application using jQuery ajax. This is my ajax code:
$(document).ready(function() {
     $(document).on('click','.show_more', function(e) {
                e.preventDefault();
                var ID = $(this).attr('id');
                //$('.show_more').hide();
                //$('.loding').show();
                alert(ID)
                $.ajax({
                    type:'POST',
                    url:'ajax_load_more.php',
                    data:{"id" : ID},
                    success:function(html){
                        $('#show_more_main'+ ID).remove();
                        $('.showmorediv').append(html);
                    }
                });
                e.preventDefault();
            });

For testing i put alert to display id it working perfectly. But ajax code is not working.there is no error and no console log found.
i double check ajax_load_more.php page it working perfectly according to alerted id.
Here is my php code
if(isset($_POST["id"]) && !empty($_POST["id"]))
{

    $queryAll = $conn->query("SELECT COUNT(*) as num_rows FROM product WHERE id < ".$_POST['id']." ORDER BY id DESC");
    $row = $queryAll->fetch_array();
    $allRows = $row['num_rows'];
    $showLimit = 3;

    $query2 = $conn->query("SELECT * FROM product WHERE id < ".$_POST['id']." ORDER BY id DESC LIMIT ".$showLimit);
    $rowCount = $query2->num_rows;
    if($rowCount > 0){
        while($row_p = $query2->fetch_array()){
            $loadmoreid = $row_p["id"]; ?>

                    <a href="product-details/<?=preg_replace('!\s+!', '-',preg_replace("/[^A-Za-z0-9 \s+]/",' ',$row_p[4]));?>-<?=$row_p[0];?>">
                        <img src="<?=$row_p[13];?>" alt="<?=$row_p[3];?>"/>

                        -<?php echo $offprice=round((($row_p[5]-$row_p[6])*100)/$row_p[5]); ?>%

                            <a href="product-details/<?=preg_replace('!\s+!', '-',preg_replace("/[^A-Za-z0-9 \s+]/",' ',$row_p[4]));?>-<?=$row_p[0];?>"><?=$row_p[3];?>

                        Rs.<?=$row_p[6];?>
                        Rs.<?=$row_p[5];?>

                        <button class="btn btn-default add-cart" data-id="<?=$row_p[0];?>" data-name="<?=$row_p[3];?>" data-summary="<?=$row_p[3];?>" data-price="<?=$row_p[6];?>" data-quantity="1" data-image="<?=$row_p[13];?>">Add to cart</button>

            <?php
            }
            if($allRows > $showLimit)
            {
            ?>
                <div class="show_more_main" id="show_more_main<?php echo $loadmoreid; ?>">
                    <span id="<?php echo $loadmoreid; ?>" class="show_more btn btn-primary" title="Load more posts btn btn-primary">More
                    Loading…

        <?php }
        }
    }
?>

A: You can get the unknown error by using jquery ajax error function as like this
https://stackoverflow.com/a/8918298/7419418


text:
Q: Trouble using SQLite 1.0.92 with Entity Framework 6.1 I'm trying to use Entity Framework with a SQLite database file, but can't make it work.
I'm using Visual Studio 2012, SQLite 1.0.92, and Entity Framework 6.1.
The edmx diagram correctly displays my tables, so I guess the mapping works, but when I try to do :
_Context = new DataContext();
var test = _Context.Set<T>().ToList();

I get the following exception :

No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SQLite'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

As suggested in other SO posts, I tried adding this in my DbContext constructor to make sure the dll is copied :
var ensureDLLIsCopied = System.Data.Entity.SqlServer.SqlProviderServices.Instance;

The result is that instead of throwing and exception, my program just hangs forever.
I aslo tried to change the app.config file as suggested here and in this post's accepted answer, but no changes.
Any ideas?
Thank you

Edit :
I changed my DbContext from this :
public class DataContext : DbContext { }

to this :
public class DataContext : DbContext
{
    public DataContext() : base("name=Entities") { }
}

Now, the exception I get is :

Cannot find 'Entities' connection string in the application configuration file

But the 'Entities' connection string is in app.config :
<add name="Entities"
 connectionString="metadata=res://*/Entities.Model.csdl|res://*/Entities.Model.ssdl|res://*/Entities.Model.msl;provider=System.Data.SQLite;provider connection string="data source=mypath\dbname.db""
 providerName="System.Data.EntityClient" />

A: Are you sure you have your app.config setup properly? I'm using EF6.1 with System.Data.SQLite v1.0.92.0 using the following app.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite" />
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".Net Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
    </DbProviderFactories>
  </system.data>
  <entityFramework>
    <providers>
      <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
    </providers>
  </entityFramework>
</configuration>

This will need to be in the app.config for the executing program not the app.config for the assembly which contains your DbContext.  Alternatively you could use code based configuration as I answered here which you can place in the same assembly as your DbContext.
And also yes if your DbContext is in a different assembly then that assembly will need some code referencing SQLite otherwise the compiler won't include the references to the required SQLite assemblies.  You've provided an incorrect reference above to SqlServer rather than SQLite which won't work.

A: if you used System.Data.SQLite v1.0.92.0
Replace the old snippet in Web.config:
  <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.SQLiteProviderServices, System.Data.SQLite.Linq"/>
  <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"/>

Instead of:
  <entityFramework>
<providers>
  <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"/>
</providers>

It works for me.
The difference is in "invariantName", remove the "EF6".


text:
Q: MongoDB match criteria in aggregate acting unexpectedly I am currently working with a collections with documents like this
{
    "_id": {
        "$oid": "5aa8665dcfe5305814e6dd90"
    },
    "userID": "5aa71af7b562de0c690eb6e0",
    "rebate": 64,
    "status": "approved"
}

The query I am running is as follows:
var id = "5aa71af7b562de0c690eb6e0";

Warranty.aggregate(
    [
        {
            $match: {
                "userID": id,
                "status": "approved"
            }
       },
       {
           $group: {
               "_id": null,
               "total": {
                   $sum: "$rebate"
               }
          }
      }
    ], function(err, sum) {

        if (err) throw err;

        res.send(sum);

});

Currently, this is returning []
The expected result is [ { "_id": null, "total": 64 } ]
I have also attempted to cast the variable id to ObjectId like so:
"userID": mongoose.Types.ObjectId(id) and the result is still an empty array.
The interesting thing is if I remove the match "userID" line this works and returns [ { "_id": null, "total": 64 } ] but I need this to limit the query to the active user only.
I am new to Mongo aggregate.
Possible solution
For some reason doing this "userID": id + '', fixes the issue.  I don't really understand why; would anyone explain to me why this is the case? I would assume since the id is comprised of alpha-numeric characters that it would already be a string, right?

A: The id needed to be converted to a string for some reason.  I do not understand why this is the case but simply adding  "userID": id + '' made the query run as expected.


text:
Q: If $S$ is a Noetherian ring and $R\subset S$ is a sub-ring, prove that $R$ is Noetherian or a counterexample If $S$ is a Noetherian ring and $R\subset S$ is a sub-ring, prove that
$R$ is Noetherian or a counterexample if this assertion is not always
certain.
I have thought for a long time about this and I come to the following conclusion that I do not know if it is correct:
I think this is not true in general and I think the following can work: we have that $\mathbb{Z}\subset\mathbb{R}$, is there an ideal that is not finitely generated in $\mathbb{Z}$ and that is finitely generated in $\mathbb{R}$?

A: Every field is Noetherian, and every integral domain embeds as a sub-ring of its field of fractions. So one source of counterexamples is non-Noetherian integral domains.
For example, for any field $k$, the field $k(x_1,x_2,\dots)$ of rational functions in infinitely many variables is Noetherian, but its subring $k[x_1,x_2,\dots]$ is not Noetherian.

A: Since I run into this very same question for didactical reasons, I believe it could be useful to have other examples at hand.
Personally, I would contribute with the ring $\mathbb{Z}\left[\sqrt{p}\mid p \text{ is a positive prime number}\right]$ obtained by adding to $\mathbb{Z}$ all the real roots of positive prime numbers, which is a subring of $\mathbb{R}$ but it is not Noetherian. Indeed, the ideal
$$\langle \sqrt{p} \mid p \text{ is a positive prime number} \rangle$$
is not finitely generated.


text:
Q: Node.js - How to programatically catch warning messages In some specific ocasions, if the programmer is not careful, Node.js generate the following warning: (node:11548) MaxListenersExceededWarning: Possible EventEmitter memory leak detected, but the process continue running, and this message gets lost in the console output  during initialization, there's a way the initialization process can catch this warning message in order to not proceed the initialization if it occurs? Thanks in advance.

A: That specific message is there because often times when you exceed the default warning level for the number of listeners to a specific eventEmitter this is a sign that there's some sort of "leak" of listeners where you're adding listeners in a way that they pile up (not using them correctly).  The default level for this warning is 10.
So, it's generally worth debugging the cause of this warning and understanding whether it's a legit warning (a sign of a real problem) or a false warning (not caused by an actual problem).
If you know which eventEmitter this is coming from and you've convinced yourself that there is not an actual problem here, then you can raise the limit that causes the warning with:
emitter.setMaxListeners(30);    // pick whatever limit is appropriate

You can see the doc for that method here.

You can catch this particular warning with this code:
process.on('warning', warningInfo => {
   // examine the warning here and decide what to do
   console.log(warningInfo);
});

You can demonstrate the issue with this simple node.js program:
const EventEmitter = require('events');

const e = new EventEmitter();

// create one more listener for the same event than the default
// warning limit
for (let i = 0; i < 11; i++) {
    e.on("greeting", () => {
        console.log("greeting");
    });
}

// listen for the warning
process.on('warning', info => {
    console.log(info);
});

A: One of the ways of catching errors is always try and catch.
You can always catch uncaught exceptions with node.js by doing
process.on('uncaughtException', err => {
  console.error('There was an uncaught error', err)
  process.exit(1) //mandatory (as per the Node.js docs)
})


text:
Q: Lync 2010 SDK issues with Silverlight 5 I have updated my existing application which uses lync sdk assemblies to silverlight 5. from there onwards, the application does not compile gives out an error
The tag 'UCTreeView' does not exist in XML namespace 'clr-namespace:Microsoft.Lync.Controls;assembly=Microsoft.Lync.Controls'
I've added following references
Microsoft.Lync.Controls
Microsoft.Lync.Controls.Framework
Microsoft.Lync.Model
Microsoft.Lync.Utilities
System.Windows.Controls
Following XAML gives compile errors
    <UserControl x:Class="aa.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:c="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:controls="clr-namespace:Microsoft.Lync.Controls;assembly=Microsoft.Lync.Controls"
    mc:Ignorable="d"
    xmlns:Microsoft_Lync_Controls_Internal_Converters="clr-namespace:Microsoft.Lync.Controls.Internal.Converters;assembly=Microsoft.Lync.Controls"
    xmlns:Microsoft_Lync_Internal_Utilities_Helpers="clr-namespace:Microsoft.Lync.Internal.Utilities.Helpers;assembly=Microsoft.Lync.Utilities"
    xmlns:Microsoft_Lync_Controls_Internal="clr-namespace:Microsoft.Lync.Controls.Internal;assembly=Microsoft.Lync.Controls"
    xmlns:Microsoft_Lync_Controls_Internal_Framework_Commands="clr-namespace:Microsoft.Lync.Controls.Internal.Framework.Commands;assembly=Microsoft.Lync.Controls.Framework"
    d:DesignHeight="300" d:DesignWidth="400">
    <UserControl.Resources>
        <Style x:Key="ContactListStyle1" TargetType="controls:ContactList">
            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
            <Setter Property="Microsoft_Lync_Internal_Utilities_Helpers:SetterValueBindingHelper.PropertyBindingCollection">
                <Setter.Value>
                    <Microsoft_Lync_Internal_Utilities_Helpers:SetterValueBindingHelperCollection>
                        <Microsoft_Lync_Internal_Utilities_Helpers:SetterValueBindingHelper Binding="{Binding DefaultControlBackgroundBrush, Source={StaticResource ControlColors}}" Property="Background"/>
                    </Microsoft_Lync_Internal_Utilities_Helpers:SetterValueBindingHelperCollection>
                </Setter.Value>
            </Setter>
            <Setter Property="IsTabStop" Value="False"/>
            <Setter Property="UseLayoutRounding" Value="False"/>
            <Setter Property="AllowDrop" Value="False"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="controls:ContactList">
                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
                            <Grid x:Name="PART_ContactListGrid" Grid.Row="0">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Grid AutomationProperties.AutomationId="PivotBar" Visibility="{Binding ShowPivotBar, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="10"/>
                                    </Grid.RowDefinitions>
                                    <Grid Height="26" Visibility="{Binding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=PivotBarDivider}">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>
                                        <Microsoft_Lync_Controls_Internal:EnterEnabledRadioButton AutomationProperties.AutomationId="ViewByGroupButton" Content="{Binding Resources.ContactListFilterGroup, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}" Grid.Column="0" GroupName="ViewByOptions" IsChecked="{Binding GroupViewBySetting, ConverterParameter=Groups, Converter={StaticResource EnumToBoolConverter}, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{Binding IsSignedIn, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ListFilterRadioButtonStyle}">
                                            <ToolTipService.ToolTip>
                                                <ToolTip Content="{Binding Resources.ContactListFilterGroupToolTip, Source={StaticResource ResourcesWrapper}}" Style="{StaticResource DefaultToolTipStyle}"/>
                                            </ToolTipService.ToolTip>
                                        </Microsoft_Lync_Controls_Internal:EnterEnabledRadioButton>
                                        <Microsoft_Lync_Controls_Internal:EnterEnabledRadioButton AutomationProperties.AutomationId="ViewByStatusButton" Content="{Binding Resources.ContactListFilterStatus, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}" Grid.Column="1" GroupName="ViewByOptions" IsChecked="{Binding GroupViewBySetting, ConverterParameter=Status, Converter={StaticResource EnumToBoolConverter}, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{Binding IsSignedIn, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ListFilterRadioButtonStyle}">
                                            <ToolTipService.ToolTip>
                                                <ToolTip Content="{Binding Resources.ContactListFilterStatusToolTip, Source={StaticResource ResourcesWrapper}}" Style="{StaticResource DefaultToolTipStyle}"/>
                                            </ToolTipService.ToolTip>
                                        </Microsoft_Lync_Controls_Internal:EnterEnabledRadioButton>
                                        <Microsoft_Lync_Controls_Internal:EnterEnabledRadioButton AutomationProperties.AutomationId="ViewByRelationshipButton" Content="{Binding Resources.ContactListFilterRelationship, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}" Grid.Column="2" GroupName="ViewByOptions" IsChecked="{Binding GroupViewBySetting, ConverterParameter=Relationship, Converter={StaticResource EnumToBoolConverter}, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{Binding IsSignedIn, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ListFilterRadioButtonStyle}">
                                            <ToolTipService.ToolTip>
                                                <ToolTip Content="{Binding Resources.ContactListFilterRelationshipToolTip, Source={StaticResource ResourcesWrapper}}" Style="{StaticResource DefaultToolTipStyle}"/>
                                            </ToolTipService.ToolTip>
                                        </Microsoft_Lync_Controls_Internal:EnterEnabledRadioButton>
                                        <Microsoft_Lync_Controls_Internal:SplitButton x:Name="PART_ViewLayoutMenu" AutomationProperties.AutomationId="ViewLayoutMenu" Grid.Column="3" HorizontalAlignment="Right" Height="22" IsEnabled="{Binding IsSignedIn, RelativeSource={RelativeSource TemplatedParent}}" Padding="2,0,2,0" Style="{StaticResource SplitButtonControlTertiaryStyle}" VerticalAlignment="Center">
                                            <Microsoft_Lync_Controls_Internal:SplitButton.DropDown>
                                                <Microsoft_Lync_Controls_Internal:ContextMenu>
                                                    <Microsoft_Lync_Controls_Internal:RadioMenuItem x:Name="PART_OneLineMenuItem" AutomationProperties.AutomationId="OneLineRadioButton" GroupName="LineViewGroup" Header="{Binding Resources.ContactListViewOneLine, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}">
                                                        <Microsoft_Lync_Controls_Internal:RadioMenuItem.Icon>
                                                            <ContentControl Style="{StaticResource IconStyle.OneLineView}"/>
                                                        </Microsoft_Lync_Controls_Internal:RadioMenuItem.Icon>
                                                    </Microsoft_Lync_Controls_Internal:RadioMenuItem>
                                                    <Microsoft_Lync_Controls_Internal:RadioMenuItem x:Name="PART_TwoLinesMenuItem" AutomationProperties.AutomationId="TwoLinesRadioButton" GroupName="LineViewGroup" Header="{Binding Resources.ContactListViewTwoLine, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}">
                                                        <Microsoft_Lync_Controls_Internal:RadioMenuItem.Icon>
                                                            <ContentControl Margin="0,1,0,0" Style="{StaticResource IconStyle.TwoLineView}"/>
                                                        </Microsoft_Lync_Controls_Internal:RadioMenuItem.Icon>
                                                    </Microsoft_Lync_Controls_Internal:RadioMenuItem>
                                                    <Microsoft_Lync_Controls_Internal:MenuItem Header="{Binding Resources.ContactListViewShowFriendlyName, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}" IsCheckable="True" IsChecked="{Binding ShowFriendlyName, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
                                                    <Microsoft_Lync_Controls_Internal:MenuItem IsTabStop="False" IsEnabled="False" Style="{StaticResource MenuItemSeparatorStyle}"/>
                                                    <Microsoft_Lync_Controls_Internal:RadioMenuItem x:Name="PART_SortByDisplayNameMenuItem" GroupName="SortByGroup" Header="{Binding Resources.ContactListViewDisplayName, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}"/>
                                                    <Microsoft_Lync_Controls_Internal:RadioMenuItem x:Name="PART_SortByAvailabilityMenuItem" GroupName="SortByGroup" Header="{Binding Resources.ContactListViewAvailability, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}"/>
                                                    <Microsoft_Lync_Controls_Internal:MenuItem IsTabStop="False" IsEnabled="False" Style="{StaticResource MenuItemSeparatorStyle}"/>
                                                    <Microsoft_Lync_Controls_Internal:MenuItem Header="{Binding Resources.ContactListViewShowFrequentContacts, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}" IsCheckable="True" IsChecked="{Binding ShowFrequentContacts, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
                                                </Microsoft_Lync_Controls_Internal:ContextMenu>
                                            </Microsoft_Lync_Controls_Internal:SplitButton.DropDown>
                                            <Microsoft_Lync_Controls_Internal:SplitButton.LeftToolTip>
                                                <ToolTip Content="{Binding Resources.ToolTipContactListLayoutMenuLeft, Source={StaticResource ResourcesWrapper}}" Style="{StaticResource DefaultToolTipStyle}"/>
                                            </Microsoft_Lync_Controls_Internal:SplitButton.LeftToolTip>
                                            <Microsoft_Lync_Controls_Internal:SplitButton.RightToolTip>
                                                <ToolTip Content="{Binding Resources.ToolTipContactListLayoutMenuRight, Source={StaticResource ResourcesWrapper}}" Style="{StaticResource DefaultToolTipStyle}"/>
                                            </Microsoft_Lync_Controls_Internal:SplitButton.RightToolTip>
                                            <Grid>
                                                <ContentControl Style="{StaticResource IconStyle.OneLineView}" Visibility="{Binding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=PART_OneLineMenuItem, FallbackValue=Collapsed, Mode=OneWay}"/>
                                                <ContentControl Style="{StaticResource IconStyle.TwoLineView}" Visibility="{Binding IsChecked, Converter={StaticResource NotBooleanToVisibilityConverter}, ElementName=PART_OneLineMenuItem, Mode=OneWay}"/>
                                            </Grid>
                                        </Microsoft_Lync_Controls_Internal:SplitButton>
                                    </Grid>
                                    <ToggleButton x:Name="PivotBarDivider" AutomationProperties.AutomationId="PivotBarDivider" Height="10" IsChecked="True" AutomationProperties.Name="Pivot bar divider" Grid.Row="1" Style="{StaticResource ToggleButtonPivotDividerStyle}"/>
                                </Grid>
                                <controls:UCTreeView x:Name="PART_TreeControl" ContextualInformation="{TemplateBinding ContextualInformation}" ContactLayoutView="{TemplateBinding ContactLayoutView}" GroupViewBySetting="{TemplateBinding GroupViewBySetting}" HorizontalContentAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" ItemsSource="{TemplateBinding Contacts}" IsEnabled="{TemplateBinding IsSignedIn}" Grid.Row="1" ShowFriendlyName="{TemplateBinding ShowFriendlyName}" ScrollViewer.VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" Style="{StaticResource UCTreeViewStyle1}"/>
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
    </Grid>
</UserControl>

A: I've bad news for you. Lync 2010 needs and require Silverlight 4 SDK, it was created for that version. For example, if you try install Lync 2010 AFTER Silverlight 5 Tools, you need to do a downgrade. Otherwise you will find bugs, and bugs, and conflicts, and conflicts, for ever.
Try with this thread: http://social.msdn.microsoft.com/Forums/en-US/communicationsserversdk/thread/85f3990a-de73-4ed2-b6c2-f515a9a8fec5


text:
Q: "Voivode" word usage in modern English "Voivode" - is this word used commonly in English? Also others like 'voivodeship' (e.g. for a road)?
Which I personally, as a native Polish speaker, would like to use in the modern context as a reference to provincial roads.

A: Collins and Merriam-Webster agree that the "common" spelling is vaivode, but that is to overstate: neither voivode nor vaivode are common in English, and most English-speakers will not be familiar with it unless they have greater than average knowledge about the history or geography of Central and Eastern Europe.
There are only two results for voivode in the Corpus of Contemporary American English, both from the same website about a television episode featuring Dracula, and none for vaivode. There is only one result for voivode in the slightly older British National Corpus, about Janos Hunyadi (coincidentally about Transylvania, if not Dracula).
I was not myself familiar with voivode, although I was aware of voivodeship being the word for a subdivision of Poland. As with terms like prefectures or Länder it may be used if the reader is expected to be familiar with the term, but for broader audiences will be translated as province, region, state, or so on as may be conventional.

A: I was expecting to see zero results but there are some for voivode:
lengusa
And only one for vaivode:
lengusa
All of them are from Encyclopedia Britannica and seem to related to Balkans or Romania. Example:

When the Turks decisively defeated Hungary at the Battle of Mohács (1526), Transylvania effectively became independent. Its voivode John (János Zápolya), who was elected king of Hungary (November 1526), engaged Transylvania in a 12-year war against Ferdinand I, the Habsburg claimant to the Hungarian throne. Afterward Hungary was divided between the Habsburgs and the Turks, and Transylvania was transformed into an autonomous principality that was subject to Turkish suzerainty (1566).
-- Encyclopedia Britannica

A: You will find the word used in the trilogy With Fire and Sword by the Polish author Henryk Sienkowitz. This is the only place I ever met the word. It is a translation that retains the original form rather than using English alternatives. Therefore I cannot recommend using it in contemporary English without explanation.

Wikipedia

Wikipedia

Here it refers to an administrative area or province, the Voivodeship, whose leader is the Voivode.
It comes from Slavonic roots such as Russian Voina, war, and Vodit', to lead. Hence the Voivode is the military, or partly military, leader of the province or voivodeship.


text:
Q: Conditions for friendship paradox variant The friendship paradox is sometimes summarised as stating that:

*

*Most people have fewer friends than most of their friends.
However, the mathematical explanation provided usually shows something different: namely, that

*The average number of friends that a typical person has is less than the average number that a typical friend has.
In other words, the average degree of a randomly selected vertex in an undirected graph is less than the average degree of a randomly selected endpoint of a randomly selected edge.
Furthermore, the following variation of the paradox is not always true:

*Most people have fewer friends than their friends have on average.
This can be seen by removing one edge from the complete graph $K_5$: 3 out of 5 people then have more friends (4) than their friends do on average (3.5). Note however, that statement 1 is still true for this graph (assuming less-than-or-equals definitions of 'most' and 'fewer') as those 3 don't actually have more friends than half of their friends.
Is statement 1 always true? If not, under what conditions does it hold?
Clarification: statement 1 asserts that for an arbitrary finite undirected graph, fewer than half of the vertices are popular, where a vertex is popular iff it has a greater degree than over half of its neighbours.


text:
Q: How to move a file from sdcard to app data folder? In my app I need to move files from the sdcard to /data/data/com.pack.main/ folder.The code I am using is this:
            ContextWrapper cw = new ContextWrapper(getApplicationContext());
            File directory = cw.getDir("/data/data/com.cuelearn.main/", Context.MODE_PRIVATE);
            File mypath=new File(directory,object.VIDEO_FILENAME+".mp4");
            copyFile(new File(Environment.getExternalStorageDirectory(),"/cue_learn_data/video_files/"+object.VIDEO_FILENAME+".mp4"),mypath);

and the copyFile() method is:
                public static void copyFile(File src, File dst) throws IOException
            {
                System.out.println("copying files");
                FileChannel inChannel = new FileInputStream(src).getChannel();
                FileChannel outChannel = new FileOutputStream(dst).getChannel();

                try
                {
                    inChannel.transferTo(0, inChannel.size(), outChannel);
                }
                finally
                {
                    if (inChannel != null)
                        inChannel.close();
                    if (outChannel != null)
                        outChannel.close();
                }
            }

Can any one tell me where I am going wrong. The file in the sdcard is present but still not working.May be anyone could give me a easier way to do this?


text:
Q: Apple product warranty information using script i was trying write a script which will in turn give me warranty expiration details of my apple product(OS X devices).
I found some old scripts written in shell as well as python in github which are making use of old link  https://selfsolve.apple.com/wcResults.do?sn="serial number".
But recently apple has taken down that link and added below mentioned link for getting all the warranty related information.
https://checkcoverage.apple.com/in/en/?sn="serial number".
problem with new link is that they have introduced "CAPTCHA" for querying warranty information, when i use the link using curl it results in some bad data because of it.
is there any way to bypass this captcha or any alternative way to get the information would be of great help.
Mainly i am looking for solution in shell script.
Ex :https://github.com/rustymyers/warranty
Note: i found some python script which make use of manufacturing date to confirm warranty but it is based on assumption and it also won't yield exact expiration date.


text:
Q: Is there a way to temporarily disable existing alert emails from executing? I have a powershell script the runs automatically once a week to move old list items to an archive list. On the current list my end users are receiving alerts when the item is moved (create/deleted) from the list.
I found a code sample for powershell that is suppose to stop the alert emails, but all it seems to do is just remove the ability to create new alerts by disabling the button.
## To enable alerts for Web application

$SPwebapp=Get-SPWebApplication "http://SharePointSite.com"

# To Disable alerts for a Web application
$SPwebapp.AlertsEnabled = $false
$SPwebapp.Update()

Does anyone know of a way to temporarily disable existing email alerts so I can run my script without users getting alert emails for sharepoint 2013? If possible in powershell.

A: If you have developer knowledge, you can interrupt the email alerts, according to :
http://blogs.msdn.com/b/sharepointdeveloperdocs/archive/2007/12/14/how-to-customizing-alert-emails-using-ialertnotificationhandler.aspx. We have used it to modify the email alert.
The other solution is to filter them in exchange, but the exchange guy won't be very happy


text:
Q: get request from Blazor WASM to dotnet franework Web API does not respond My godaddy remote hosted web api http://impexmail.co/api/Departments/Getdepartments responds to get and post requests from Postman and HTML with jquery but not responding to
Blazor WASM. With the same blazor wasm methods I can reach and get to for example https://jsonplaceholder.typicode.com/todos.. Any suggestions appreciated.

A: You making a call to a HTTP resource from HTTPS. This is blocked by Blazor. Docs are here.
I would upgrade your api to be https. Alternately you could run your app in http.
You could override the policy's but I think you have a cors problem then.

A: I too think you have a CORS issue as mentioned by Brian Parker. You need to enable CORS on your Web API and re publish it to your shared hosting account. Check out Microsoft documentation below for enabling it in your project.
https://learn.microsoft.com/en-us/aspnet/core/security/cors?view=aspnetcore-3.1


text:
Q: "str contains" Function SIDDHI i have a queshion.
Can I make a query and use the "str:contains" function with two events.
For example replace:
 from DSBStream[(str:contains(correlation_phr_incident_detail, '0.0.0.0')==FALSE)]
select *
insert into DSBFiltered;

BY
from DSBStream#window.length(0) join Trazablack as t
on (str:contains(correlation_phr_incident_detail, t.atribute)==FALSE)
select t.sensorValue as sensorValue
insert current events into trazawhite;

this is possible?

A: This is not possible since Trazablack is a RDBMS event table. As a work around you can divide the query in to two parts where first query will get atribute from table by joining and second query will check srt:contains.


text:
Q: Dockerfile returns built dist folder I have simple vue.js app, and I wanted to use Dockerfile to build it:
FROM node:14.14.0-stretch
WORKDIR '/app'
COPY package*.json ./
RUN npm install
COPY . ./
RUN env
RUN npm run generate

is it possible now, using docker-compose, and in compose not build it, but use already prepared image, to get from volume dist folder ? so I could copy it to nginx ?

A: I suggest that you wanna serve dist folder using nginx.
You should use multi stage build for this https://docs.docker.com/develop/develop-images/multistage-build/
Dockerfile
FROM node:14.14.0-stretch as build
WORKDIR '/app'
COPY package*.json ./
RUN npm install
COPY . ./
RUN env
RUN npm run generate

# create cdn stage from nginx image
FROM nginx:stable-alpine as cdn

# copy nginx config to serve files from /data/www
COPY nginx.conf /etc/nginx/nginx.conf

# copy built files from build stage to /data/www
COPY --from=build /app/dist /data/www

# nginx listen on port 80
EXPOSE 80
CMD [ "nginx" ]

nginx.conf
events {
    worker_connections 1024;
}

http {
    server {
        location / {
            root /data/www;
        }
    }
}

docker-compose.yml
version: '2.4'

services:
  nginx-cdn:
    build:
      context: path/to/Dockerfile
      target: cdn
    ports:
      - '80:80'


text:
Q: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY /dev/sda7 contains a file system with errors, check forced.
 Inodes that were part of a corrupted orphan linked list found.

/dev/sda7: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
        (i.e., without -a or -p options)
fsck exited with status code 4
The root filesystem on /dev/sda7 requires a manual fsck

Busybox v1.22.1 (Ubuntu 1:1.22.0-15ubuntu1) built in shell (ash)
Enter 'help' for a list of built-in commands.

(initramfs) _

please help

A: Try this:
You would have to use the live-dvd/usb.
You would boot the live-dvd/usb with your PC.
And run fsck from a terminal:
sudo -i
umount /dev/sda7
fsck /dev/sda7 -y


text:
Q: Custom Component with condition in Right bar I try to create a component which has the possibility to change the URL, IMAGE-Link and DESCRIPTION in the right bar. For example at the standard component Report I can choose which report should be displayed. How can I add this option for custom components. I googled at lot but I didn't find something about this.
I created a custom template in lightning builder with a lot of fields like a tablet. Now I want to put in to each field the custom component with different content. My actual solution is to add for each field a component.
<aura:component implements="flexipage:availableForAllPageTypes" access="global">

        Description

</aura:component>

({
    doSomething : function(component, event, helper) {
        console.log('Hey There .. the anchor was clicked');
        console.log(event) ;
        var href = event.srcElement.href;
        console.log(href);

    }
})

A: Aura Component Design Resources is the solution to your problem. Official SF documentation can be found here. Within your Aura component directory, you need to create a .design file and include the component attributes that you want to expose as design:attribute. So, your aura component could be as given below:
<aura:component implements="flexipage:availableForAllPageTypes" access="global">

    <aura:attribute name="url" type="String"/>
    <aura:attribute name="imagelink" type="String"/>
    <aura:attribute name="description" type="String"/>

            {!v.description}

</aura:component>

And, the design attributes (in .design file) could be defined as shown in the code snippet below:
<design:component label="<Component Label>">
    <design:attribute name="url" label="URL" description="Placeholder for the url value"/>
    <design:attribute name="imagelink" label="Image Link" description="Provide the image url here"/>
    <design:attribute name="description" label="Description" description="Brief overview of the link"/>
</design:component>

You may specify default values for the design attributes, make it as a picklist, specify form factor support etc. The component attributes of different instances of this component (in the same or different lightning pages) would get the value provided via the design attributes (in the properties pane within Lightning App Builder).


text:
Q: Using autocomplete with LINQ query with an alias I'm using autocomplete with a LINQ query.  The code works when I don't use an alias for the column but gets an error when I use an alias. Here is the code that works:
var suggestions = from v in db.ValueDocument
                          select v.HeaderTitle;

var namelist = suggestions.Where(n => n.ToLower().StartsWith(term.ToLower()));

return this.Json(namelist, JsonRequestBehavior.AllowGet);

If I change the query to below it gets an error.
var suggestions = from v in db.ValueDocument
                           select new { Header = v.HeaderTitle };

The error I'm getting has to do with the AnonymousType.
If anyone could point me in the right direction that would be fantastic.  Thanks!

A: LINQ doesn't have an object model for your aliased suggestions.
I would create a model for this aliased ValueDocument:
public class ValueDocumentAlias
{
     public string Header {get;set;}
}

Then modify your code to look like this:
var suggestions = from v in db.ValueDocument
                  select new ValueDocumentAlias{ Header=v.HeaderTitle };

var namelist = suggestions.Where(n => n.Header.ToLower().StartsWith(term.ToLower()));

return this.Json(namelist, JsonRequestBehavior.AllowGet);


text:
Q: Generating words from trained RNN model: "Variable already exists, disallowed. Did you mean to set reuse=True in VarScope? " So I implemented a RNN word generator model in jupytor notebook.
When I was trying to use the trained model to generate some words:
    with open(os.path.join(cfgs['save_dir'], 'config.pkl'), 'rb') as f:
       saved_args = cPickle.load(f)

    with open(os.path.join(cfgs['save_dir'], 'words_vocab.pkl'), 'rb') as f:
       words, vocab = cPickle.load(f)

    with tf.Session() as sess:
       model = Model(saved_args, True)
       tf.global_variables_initializer().run()
       saver = tf.train.Saver(tf.global_variables())
       ckpt = tf.train.get_checkpoint_state(cfgs['save_dir'])
       if ckpt and ckpt.model_checkpoint_path:
           saver.restore(sess, ckpt.model_checkpoint_path)
           print(model.sample(sess, words, vocab, cfgs['n'], cfgs['prime'], cfgs['sample'], cfgs['pick'], cfgs['width']))

It works for the first time, but if I run the code again there is an error:
    ValueError: Variable rnnlm/softmax_w already exists, disallowed. Did you mean to set reuse=True in VarScope?

Right now I have to shut down the ipynb file then run the code to get a new sample.
How to change the code to avoid this situation?

A: You can call the model.sample function multiple times without a problem but everything else (creating the session, constructing the Model, loading the checkpoint) should only be run once. If you refactor your code then you won't see that error message anymore.


text:
Q: Error sysprepping Windows 8 Enterprise 90-day trial I am using the Windows 8 Enterprise 90-day trial to evaluate the latest version of Windows for a private school.  The way I work is that I use sysprep to prepare an generalized image, then I clone it to the school's computers.
When I follow the instructions and try sysprep on my installation of Windows 8 in VirtualBox, sysprep thinks briefly and gives me an error message:
Fatal error occurred while trying to sysprep the machine.

Once I acknowledge it, sysprep closes. I checked the Windows Event Log, and there's nothing there that I could see.
I also followed some instructions to cure this problem, but nothing changed.  The error remains.
My best guess is that the 90-day trial prohibits the use of sysprep, but I can't be sure. It might also be my use of VirtualBox, or who-knows-what.  Has anyone had success with this, or encountered the same issue on real hardware?

A: Disregard all of the below. First paragraph on the link you gave states SkipRearm is no longer valid. Who knew!
There's a number of reasons this can show up, but the one that has bit me on the backside is that you can only sysprep an image 4 times before that error message appears - once it shows up, you're SOL. You'll need to reinstall from the original media.
The way to get round this is to use the SkipRearm setting in an answer file while you're originally building your image. This means the sysprep counter isn't incremented, but it also doesn't reset your activation grace period. You should use this setting while you're making your customisations, then sysprep, then test, then once you're happy, remove the settings and sysprep one last time.
It's discussed in more detail here: http://support.microsoft.com/kb/929828
Of course the best way to do it is install from original media every time using Microsoft Deployment Toolkit and an Answer files to automate everything, as advocated here: http://blogs.technet.com/b/askcore/archive/2011/05/11/sysprep-skiprearm-and-image-build-best-practices.aspx

A: You must purchase license from Microsoft to sysprep it!


text:
Q: Stitching in a loop WHat I am trying to do is to take 2 2 images from then stitch them together in a loop. This is the code i am trying to use:
for i in range(1,3):
    imageA = cv2.imread('frame%d.jpg'%i);i=i+1;print imageA.shape;
    imageB = cv2.imread('frame%d.jpg'%i);i=i+1;print imageB.shape;
    result,vis = stitcher.stitch([imageA, imageB], showMatches=True)
    cv2.imwrite('Stitch%d.jpg'%n,result); n=n+1;

But it is giving an error:
Traceback (most recent call last):
  File "test1.py", line 123, in <module>
    imageA = cv2.imread('frame%d.jpg'%i);i=i+1;print imageA.shape;
AttributeError: 'NoneType' object has no attribute 'shape'

Now when i remove the for loop and only execute the statements which were in the loop, it runs perfectly fine.
What could be the problem?


text:
Q: Storing result from FOR loop as one array (array only saves each results separately) I have tried searching but can't find anything to help, maybe my problem is too simple! Anyway, I'm running an ajax request. The data given to the request is an array. Here is my code:
var id = "1#2#3#4#5#";
var chkdId = id.slice(0, -1);
var arr = chkdId.split('#');
var checkedId = '';
var chkdLen = arr.length;
for (var i = 0; i < chkdLen; i++) {
    checkedId = arr[i];
    var checkedId = checkedId;
    var data = {};
    var year = $('#year').val();
    data["year"] = year;
    data['type'] = "report";
    data['accidentId'] = checkedId;
    console.log(data);
    ajax.readData('/report/readreport', data, null,
        function (result) {
            console.log(result);
        },
        function (error) {
            alert('err ' + error);
        }
    );

}

request array:
Object {year:"2015" type: "report", accidentId: "1"}
Object {year:"2015" type: "report", accidentId: "2"}
Object {year:"2015" type: "report", accidentId: "3"}
Object {year:"2015" type: "report", accidentId: "4"}
Object {year:"2015" type: "report", accidentId: "5"}

result:
{"data":[{"name":aaaa,"age":"15"}]}
{"data":[{"name":bbb,"age":"25"}]}
{"data":[{"name":ccc,"age":"65"}]}
{"data":[{"name":ddd,"age":"45"}]}
{"data":[{"name":eee,"age":"24"}]}

How to store the results in a single array?

A: Here is my Solution
var id = "1#2#3#4#5#";
var chkdId = id.slice(0, -1);
console.log(chkdId);
var arr = chkdId.split('#');
var checkedId = '';
var chkdLen = arr.length;

// here is the array
var arrayWithResults = [];

for (var i = 0; i < chkdLen; i++) {
    checkedId = arr[i];
    var checkedId = checkedId;
    var data = {};
    var year = $('#year').val();
    data["year"] = year;
    data['type'] = "report";
    data['accidentId'] = checkedId;
    console.log(data);
    ajax.readData('/report/readreport', data, null,
        function (result) {
            console.log(result);

            // here you push in the requested data
            arrayWithResults.push(result);
        },
        function (error) {
            alert('err ' + error);
        }
    );
}

A: Take the ajax out of for. This will send only One ajax request to server and minimize the load on server.
var params = [];
for (var i = 0; i < chkdLen; i++) {
    checkedId = arr[i];
    var data = {};
    var year = $('#year').val();
    data["year"] = year;
    data['type'] = "report";
    data['accidentId'] = checkedId;

    params.push(data);
    // ^^^^^^^^^^^^^^
}

ajax.readData('/report/readreport', params, null,
//                                  ^^^^^^
    function (result) {
        console.log(result);
    },
    function (error) {
        alert('err ' + error);
    }
);


text:
Q: How can I determine the bottleneck for block lag? There are some questions on this already, but many of them seem to apply to 1.9 only, or be caused by a broken version of Java. What I want to know instead is how to actually determine the bottleneck myself.
How can I tell if it's RAM? (And if it is, can a swapfile fix this?)
Do I have the Java -Xmx etc. parameters set incorrectly?
Is it the CPU, the network connection itself, something else?
I'm asking for a troubleshooting guide, not a solution for one specific situation or modpack
(which, in my case, would be a Hexxit server on a Raspberry Pi 3 with OSMC)

A: A basic troubleshooting guide(by no means conclusive, and based on personal experience):
For determining the actual cause, try changing settings, disabling/enabling mods, and seeing if anything changes. If it changes for the better, you're going in the right direction. Minecraft has so many different aspects, it's very hard to figure out the exact problem.
Step 1: Know your mods. Certain mods will interact badly with each other, e.g. Logistics pipes and EE2, when hooked up together, make a lot of lag.
Step 2: As you mentioned, RAM is important. Everything depends on how many mods you are running, how many players you have, how many dimensions and chunks etc. If you haven't dedicated enough RAM, or have used the wrong arguments, you'll be slow on everything. For reference, the right way to dedicate the RAM is:
-Xmx[amount of memory maximum, followed by the measurement of it, e.g. 4G, 512M]  -Xms[amount of memory minimum, same format]
Step 3: As previously mentioned, certain devices can cause lag. Get notifications on your server saying that 'lag causing devices will be removed, and the player who owns them may be punished', or something to a similar effect. If this doesn't work, consider a world reset.
Step 4: If none of the above options are effective, consider investing in better hardware, or a server hosting provider with a good reputation and non-ripoff prices. CreeperHost is apparently very good, but I've never personally used them. Good luck!
Side note: a Hexxit server on a Pi? You can run a vanilla MC server on a Pi without too much difficulty, but Hexxit... Not optimistic.


text:
Q: Mocha file 404 test js front end I'm trying to implement this tutorial by the way
https://blog.codeship.com/mocha-js-chai-sinon-frontend-javascript-code-testing-tutorial/
https://github.com/mochajs/mocha/raw/master/mocha.js
but in file mocha.js i found a 404...
Can someone help me and provide this file to put on front end...
I couldn't found the right one as equal to work on it.
Many thanks
Carlos Vieira

A: I already solved...
I have checked the version and then applied...
https://cdnjs.com/libraries/mocha/1.16.0
Done
Thanks
Carlos Vieira


text:
Q: Kill python script launched by a subprocess called by another script (Windows) I'm trying to integrate ESA'2 sen2cor python-script into my workflow. To do this I create a subprocess with which I call the "L2A_Process.bat" file, which in turn calls the "L2A_Process.py" script.
I want to launch the sen2cor-script with a timeout since it gets stuck and freezes from time to time, so as to automatically re-launch it if it failed.
To launch it and catch a timeout I successfully used the following script:
import os, subprocess
from signal import CTRL_BREAK_EVENT

timeout = 3600 #1hour
l1c_safe_path = "path/to/my/input/file.SAFE" #product that I want to process
command = ["L2A_process.bat", l1c_safe_path]
p = subprocess.Popen(command,shell=False, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
try:
    p.wait(timeout)
except subprocess.TimeoutExpired:
    os.kill(p.pid, CTRL_BREAK_EVENT)

This is as far as I got. It results in the sen2cor-script being paused  giving the following output:
Terminate batch job (Y/N)

I'd like to know how I can properly terminate my subprocess "p" with all it own child-subprocesses (i.e. "L2A_Process.py").
Some observations:

*

*This script needs to run on Windows;

*I've tried to kill the subprocess without the creationflag I've used in the example above: this results in the subprocess being killed but the "L2A_Process.py" script deteaches an keeps running (which is the core of my problem);

*I cannot use a CTRL_C_EVENT  since I want to re-launch the failed "L2A_Process.py" in a loop until it succeeds.

A: This code works for me to monitor Sen2cor status while converting L1C to L2A for Sentinel 2 data. The Sen2cor process is time and cpu consuming so be patient. It took half an hour to create L2A with DEM, DDV, etc. Hope it helps
from subprocess import Popen, PIPE
import os

pathtoprodS1C = "path_to_L1C_product"   // safe file
outdirS2A = "output_dir"                // where L2A files will be placed
pathtoL2Process = "path_to_L2A_Process" //if not in path

pathtoGIPP = "path_to_your_GIPP/L2A_GIPP.xml"

procName = "./L2A_Process"

os.chdir(pathtoL2Process)
import shlex
pcall = "./{} {} --output_dir {} --tif --GIP_L2A {}".format(procName,
                                                pathtoprodS1C,
                                                pathtoprodS2A,
                                                pathtoGIPP)
args = shlex.split(pcall)
print(args)
try:
    p = Popen(args, stdout=PIPE)
    eut = p.stdout.readline()
    while eut:
        eut = p.stdout.readline()
        print(eut)
finally:
    print('Sen2Cor is Done')

exit()


text:
Q: how to find out missing number from seqentail numbers? I got table1 that contains sequential number in range between 1 - 100
and I want to get out missing number using pl without creating new table
I tried to do it by this way but it absolutely not professional way and
I tried to use
select min_val.nextval keyword but I fail so any simple and professional way to do it
declare
min_val number(4);
max_val number(4);
current_val number(4);

cursor ids_cur is
select ids from test1;

begin

for ids_rec in ids_cur
loop
if min_val is not null then
min_val:=min_val+1;
DBMS_OUTPUT.PUT_LINE(min_val);
else
DBMS_OUTPUT.PUT_LINE(min_val);

end if;
end loop;
end;

A: The most efficient way to do such a query is to use a select statement rather than a cursor.  Set-based operations are faster.  Here is one method, using a recursive CTE:
with nums(n) as (
      select 1 as n from dual
      union all
      select n + 1
      from nums
      where n < 100
     )
select nums.n as MissingId
from nums left outer join
     test1
     on nums.n = test1.id
where test1.id is null;

This should generalize pretty easily to 9,999 values.
If you just want to know if numbers are missing, there are other approaches for that.

A: I come up with this solution but i am gtting error message that fetch return more than one row but I am reading cursor from record whay ??!
declare
current_num number(4);

cursor c1 is
select ids from test1;

 BEGIN

 for rec in c1
 loop
select rownum into current_num from  all_objects
   where  rownum<=(select max(ids) from  test1)
   minus
   select ids
   from test1;

   DBMS_OUTPUT.PUT_LINE(current_num);
 end loop;
 END;


text:
Q: Matlab Finding the Zeros of a Symbolic Function I have a symbolic function, whose zeros I am particular interested in knowing. I have searched through google, trying to find something related to my query, but was unsuccessful.
Could someone please help me?
EDIT:
T(x,t) = 72/((2*n+1)^2*pi^3)*(1 - (2*n+1)^2*pi^2*t/45 + (2*n+1)^4*pi^4*t^2/(2*45^2) - (2*n+1)^6*pi^6*t^3/(6*45^3))*(2*n+1)*pi*x/3;

for i=1:1:1000
    T_new = 72/((2*i+1)^2*pi^3)*(1 - (2*i+1)^2*pi^2*t/45 + (2*i+1)^4*pi^4*t^2/(2*45^2) - (2*i+1)^6*pi^6*t^3/(6*45^3))*(2*i+1)*pi*x/3;

    T = T + T_new;

end

T = T - 72/((2*n+1)^2*pi^3)*(1 - (2*n+1)^2*pi^2*t/45 + (2*n+1)^4*pi^4*t^2/(2*45^2) - (2*n+1)^6*pi^6*t^3/(6*45^3))*(2*n+1)*pi*x/3;

T = T(1.5,t);

T_EQ = 0.00001

S = solve(T - T_EQ == 0,t);

The problem that I get is that S is an a vector which contains imaginary numbers. I expected a real number, because I am trying to calculate a time.
Here is a little background as to what I am trying to do:
http://hans.math.upenn.edu/~deturck/m241/solving_the_heat_eqn.pdf
In the given link is the heat equation solved for a particular one-dimensional case. The temperature distribution, that satisfies the prescribed boundary and initial conditions, is given on page 50, I believe.
What I would like to do is find the time at which the one-dimensional object equilibrates with the environment, which is held at a constant temperature of T=0. As far as I know, the easiest way to do this would be to use the Taylor expansion of the exponential function, using only the first few terms, because I expect the equilibrium time to be relatively short; and then use the small angle approximation for the sine function, because the rod has a relatively small length. Doing just this, I made a for loop to generate terms just as the summation function would--as you can see, I used 1000 terms.
Does what I am doing seem wrong to anyone? If there is a better method, could someone please recommend it?

A: You shouldn't be surprised to see imaginary roots provided that at least one root is real and positive, corresponding to your time. The question is if the time makes any sense due to the approximations that you're making. Have you plotted the the actual function to get a rough approximation for where the zero is?
I can't really comment on the particular problem you're trying to solve. You need to make sure that you're using enough Taylor expansion terms an that they are accurate for the domain. Have you tried this leaving in the exp and/or sin? Is there any reason that you can't just use zero? And have you checked that your summation has converged after 1,000 terms? Or does it converge much sooner or not at all?
The main question is why are you using symbolic math at all to solve this? This seems like a numeric problem unless you're experiencing overflow/underflow issues in your summation. You can find the zero using fzero in this case:
N = 32;  % Number of terms in summation
x = 1.5;
T_EQ = 1e-5;
n = (2*(0:N)+1)*pi;
T = @(t)sum((72./n.^3).*exp(-n.^2*t/45).*sin(n*x/3))-T_EQ;
S = fzero(T,[0 1e3]) % Bounds around a root guarantees solution if function monotonic

which returns
S =

  56.333877640358708

If you're going to use solve, I'd do something like the following to avoid for loops:
syms t
N = 32;
x = 1.5;
T_EQ = 1e-5;
n = (2*sym(0:N)+1)*sym(pi);
T(t) = sum((72./n.^3).*exp(-n.^2*t/45).*sin(n*x/3));
S = double(solve(T-T_EQ==0,t))

or, using symsum:
syms n t
N = 32;
x = 1.5;
T_EQ = 1e-5;
T(t) = symsum((72/(pi*(2*n+1))^3)*exp(-(pi*(2*n+1))^2*t/45)*sin(pi*(2*n+1)*x/3),n,0,N);
S = double(solve(T-T_EQ==0,t))

Lastly, your symbolic solutions are not even exact as some your pi variables are being converted to rational approximations. pi is floating point. Things like pi*t are generally safe if t is symbolic, because pi will be recognized as such. However, pi^2 is calculated in floating-point before being converted to symbolic due to order of operations. In general your should use sym('pi') or sym(pi) in symbolic expressions.

A: Assuming you have a polynomial or trigonometric function of x or y, and what you mean by "zeros" is the values where the function crosses the axis, i.e., either x or y is zero, you can call the value of the function when a variable is 0. An example:
syms x y
f=-cos(x)*exp(-(x^2)/40);
ezsurf(f,[-10,10])

F=matlabFunction(f,'vars',{[x]});
F([0])

The ezsurf just visualizes the plot. If you want a function of both x and y, you do something like the following:
syms x y
f=-cos(x)*cos(y)*exp(-(x^2+y^2)/40);
ezsurf(f,[-10,10])

F=matlabFunction(f,'vars',{[x,y]});
for y=0
    solve(f)
end

This will give you the value of the function for which integer multiples of x correspond to zero points for y (values of the function that are on the y=0 plane).


text:
Q: YUI DataTable get total number records I am new to YUI and I am using YUI 2 Datatable, I would like to alert if the total number of record is more than 4000 and not to render the table.
below is my piece of code.
this.myDataSource = new YAHOO.util.DataSource("<?php echo $html->url('/parser/dynload').'?params_array_serialized='.$params_array_serialized; ?>");

this.myDataTable = new YAHOO.widget.DataTable("gridbox", myColumnDefs,this.myDataSource, myConfigs);

I dont know how to get total number of record. Any one can help in this.

A: If I remember correctly, this.myDataTable would have a getRecordSet() method which returns a RecordSet object which is a where the DataTable stores its data.  The RecordSet has a length (or perhaps it was count?) property or was it getLength() method.  Anyway, regardless of the names which I cannot quite remember but the debugger will tell you, the RecordSet object is the key to it.
I do remember that the last build of the API docs for YUI went wrong and I believe the RecordSet object got accidentally dropped or misplaced so you won't find it there.


text:
Q: Can you please to explain how to use the Record controller in jmeter for web application? I want to know any specified link to know about record controller

A: Here you go

*

*User Manual entry

*JMeter Proxy Step by Step guide

*JMeter Browser Recording Tutorial Video

*How To Use JMeter To Record Test Scenarios tutorial
Hopefully that's enough to start with.


text:
Q: detect whether a text area is being used with javascript MAJOR THANKS TO EVERYONE WHO POSTED TO TRY TO HELP. YOU GUYS ARE AWESOME! :)
I used @jsfriend00 solution and it accomplished the functionality I needed for client browser cache problem.
Hi I have a question regarding javascript:
Wondering if there is a way to detect whether a textarea is being used by a user meaning the user is messaging another user but there isn't yet an enter keystroke?
I've been thinking I can solve my cache issue with my private networking stream if I can get the client browser cache to refresh only if the user is not attempting to message another user because then obviously they loose what they're typing because of automatic refresh.
Say for example the following textarea:

 <title></title>

  <?php echo smiley_js(); ?>

<?php echo form_open('controller/function') ?>

chat here:
<textarea name="create" id="create" onfocus="autoRefresh(this.id)" rows="3" cols="20"></textarea>
<?php echo form_error('create'); ?>

<?php echo form_submit('submit','chat');?>
 <?php echo form_close();?>

A: If what you want to know is whether the focus is currently in your textarea, then you can just check that by checking to see if document.activeElement is your textarea object or not.
var obj = document.getElementById("myTextArea");
if (document.activeElement === obj) {
    // focus is currently in my textarea
}

You can see a working demo: http://jsfiddle.net/jfriend00/NCSed/

If what you want to know is when your textarea is being modified, here is some code that will install a change handler on your textarea and call your event handler anytime the text in the textarea is changed.  This code works with either textarea objects or input objects.  Unlike other methods, this captures changes done by typing, by mouse editing, cut, copy, paste and drag/drop.  You can then tell when the user is typing or when any text has been typed.  Here's a working test engine for this code: http://jsfiddle.net/jfriend00/xxCkm/.
And, here's the code:
// add event cross browser
function addEvent(elem, event, fn) {
    if (elem.addEventListener) {
        elem.addEventListener(event, fn, false);
    } else {
        elem.attachEvent("on" + event, function() {
            // set the this pointer same as addEventListener when fn is called
            return(fn.call(elem, window.event));
        });
    }
}

function onChange(elem, fn, data) {
    var priorValue = elem.value;

    function checkNotify(e, delay) {
        // log('checkNotify - ' + e.type);
        if (elem.value != priorValue) {
            priorValue = elem.value;
            fn.call(this, e, data);
        } else if (delay) {
            // the actual data change happens aftersome events
            // so we queue a check for after
            setTimeout(function() {checkNotify(e, false)}, 1);
        }
    }

    // Which events to monitor
    // the boolean value is whether we have to
    // re-check after the event with a setTimeout()
    var events = [
       "keyup", false,
       "blur", false,
       "focus", false,
       "drop", true,
       "change", false,
       "input", false,
       "paste", true,
       "cut", true,
       "copy", true
    ];
    for (var i = 0; i < events.length; i+=2) {
        (function(i) {
            addEvent(elem, events[i], function(e) {
                checkNotify(e, events[i+1]);
            });
        })(i);
    }
}

Then, sample usage is like this:
var obj = document.getElementById("test");
onChange(obj, function(e) {
    // your code goes here for whatever you want to do
    // when the change handler is called
    console.log("change - " + e.type);
});

Looking at the code in your comment, I would suggest this:

A: var textarea = document.getElementById("create") ;
textarea.onfocus = function() {
    // Do something while the textarea being used by a user
};

textarea.onblur = function() {
    // Do something while the textarea not being used by a user
};

A: This is actually one of the very rare cases where I'm going to say jQuery makes it easier.
if($("#create").is(":focus")) {
    // element is in use
}

The alternative would be something like:
document.body.onfocus = function(e) {
    e = e || window.event;
    window.elementWithFocus = e.target || e.srcElement;
}
...
if( document.getElementById('create') == window.elementWithFocus) {
    // element is in use
}


text:
Q: How to check if my site is up reliable by c# I have that code:
static async Task Main()
    {
        await ConfigureLogger();
        var domain = ConfigJson.WebServer.Domain;
        var hc = new HttpClient();
        int count = 0;
        while (count < 10)
        {
            try
            {
                var result = await hc.SendAsync(new HttpRequestMessage(HttpMethod.Head,
            new Uri(domain)));
                return;
            }
            catch (HttpRequestException err)
            {
                count++;
                Log.Error($"Error to connecting {domain} №{count}");
                Log.Error(err.Message);
                await Task.Delay(1000);
            }
        }
        if (count >= 10)
        {
            var command = $@"cd {Pathes.pathToWorkDirectory}; ";
            command += @"killall dotnet ./WebSite/WebSite.dll; ";
            command += @"dotnet ./WebSite/WebSite.dll; ";
            ExecuteCommand(command);
        }
        Log.Information("The WebSiteController executed!");
        Log.CloseAndFlush();
    }

My task is to check if my site is up by 10 times. If it is not, I run my site again.
Pay attention that I run my site if it does not response at all. The errors with code != 200 do not have any importance.
But my problem is that I can not reliable check it. Because I can get any error of type HttpRequestException(for example The SSL connection could not be established) and then the crontab on Linux will run site again and again.
Because that error can be permanent.

A: I refused requests to the site. Instead, I check for a process by ID. You can use that(Do not pay attention on ClassLibrary.File_Manager(). It is my own API.):
class Program
{
    static async Task Main()
    {
        await ConfigureLogger();
        int procId = GetWebSiteProcessId();
        Process WebSiteProc = null;
        try
        {
            if (procId != -1) WebSiteProc = Process.GetProcessById(procId);
        }
        catch (ArgumentException err) when (err.Message.IndexOf($"{procId} is not running") > -1)
        {
            DeleteFileProcessId();
        }

        if (WebSiteProc != null)
        {
            Log.Information($"ID: {procId}");
            Log.Information("WebSite is working");
            Log.CloseAndFlush();
        }
        else
        {
            Log.Information("Restarting the WebSite");
            var command = $@"cd {Pathes.pathToWorkDirectory}; ";
            command += @"dotnet ./WebSite/WebSite.dll; ";
            Log.CloseAndFlush();
            await ExecuteCommand(command);
        }
    }

    private static async Task ExecuteCommand(string command)
    {
        using (Process proc = new Process())
        {
            proc.StartInfo.FileName = "/bin/bash";
            proc.StartInfo.Arguments = "-c \" " + command + " \"";
            proc.StartInfo.UseShellExecute = false;
            proc.Start();
            var procId = proc.Id.ToString();
            await WriteProcessIdToFile(procId);
        }
    }
    private static async Task ConfigureLogger()
    {
        var logConfig = new LoggerConfiguration()
               .MinimumLevel.Debug()
               .WriteTo.Console()
               .WriteTo.Seq(ConfigJson.Seq);
        Log.Logger = logConfig.CreateLogger();
    }

    private static async Task WriteProcessIdToFile(string id)
    {
        var fm = new ClassLibrary.File_Manager();
        var path = Path.Combine(Pathes.pathToWorkDirectory, "WebSiteProcessId.txt");
        fm.OpenFile(path, "Write", id);
    }

    private static int GetWebSiteProcessId()
    {
        var directoryFiles = new DirectoryInfo(Pathes.pathToWorkDirectory).GetFiles();
        var file = directoryFiles
        .Where(file => file.Name == "WebSiteProcessId.txt")
        .SingleOrDefault();
        if (file == null) return -1;

        var fm = new ClassLibrary.File_Manager();
        var path = Path.Combine(Pathes.pathToWorkDirectory, "WebSiteProcessId.txt");
        string idStr = fm.OpenFile(path, "Read", null).fileData;
        int id = Convert.ToInt32(idStr);
        return id;
    }

    private static void DeleteFileProcessId()
    {
        var directoryFiles = new DirectoryInfo(Pathes.pathToWorkDirectory).GetFiles();
        var file = directoryFiles
        .Where(file => file.Name == "WebSiteProcessId.txt")
        .SingleOrDefault();

        if (file != null)
        {
            File.Delete(file.FullName);
        }
    }
}


text:
Q: How to close Python socket server when all of its multiple clients close the connection? I have made a multithreaded Python socket server.
It supports multiple socket client connections.
My code is:
import socket
from _thread import *

def multi_threaded_client(connection):
    response = ''
    while True:
        data = connection.recv(10000000)
        response += data.decode('utf-8')
        if not data:
            print(response)
            break
        connection.send(bytes(some_function_name(response), "utf-8"))
    connection.close()

class socketserver:
    def __init__(self, address='', port=9090):
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.address = address
        self.port = port
        self.sock.bind((self.address, self.port))
        self.cummdata = ''

    def recvmsg(self):
        self.sock.listen(65535)
        self.conn, self.addr = self.sock.accept()
        print('connected to', self.addr)
        self.cummdata = ''

        start_new_thread(multi_threaded_client, (self.conn, ))

        return self.cummdata

    def __del__(self):
        self.sock.close()

serv = socketserver('127.0.0.1', 9090)

print('Socket Created at {}. Waiting for client..'.format(serv.sock.getsockname()))

while True:
    msg = serv.recvmsg()

I also want the server to detect if any new client is connected to /disconnected from it.
Once all the clients are disconnected from it, I want the server to be closed on its own.
I could not figure this out


text:
Q: Filtering a python list, while coupling non-filtered terms to other lists. I am trying to filter out items in a list containing the term "FX" using the filter function and a lambda. This works fine:
MarketnoFX=list(filter(lambda x: "FX" not in x, Openmarket))

However, this list needs to be coupled to two other lists containing numerical value, so say if the xth term is omitted from this list (via the creation of a new list), it must also be omitted from the other 2 lists. I would usually simply use list comprehensions.
Openmarket=[someitems]
coupled1=[]
coupled2=[]

    for item in Openmarket:
        if "FX" in item:
            pass
        else:
            someotherlist.append(item)
            k=Openmarket.index(entry)
            someotherotherlist.append(coupled1[k])

However, doing this doesn't produce the correct results, and upon printing the index of items containing "FX", I get for example it showing that it is finding the 12th and 33rd terms twice, and the 71st term only once.
The filter function seems like a more elegant way of doing things, but how do I couple it to the other lists? I have read about a zip function, but I am not sure how to apply it here. I am not a very experienced Python programmer.
Thanks.

A: You are correct, using zip() is a good way to solve this.
Basically, it can takes three lists and iterate through each n-th element at the same time, so this is very useful here.
As it returns a list of tuples, you can then filter it to keep tuples where the first value (which is the element from Openmarket) does not contains FX. Elements from someotherlist and someotherotherlist are filtered at the same time.
Finaly, you can get back your inital lists by "unzipping" the list of tuples, thanks to unpacking.
Python 2
zipped = zip(Openmarket, someotherlist, someotherotherlist)
filtered = filter(lambda (a, b, c): "FX" not in a, zipped)
Openmarket, someotherlist, someotherotherlist = zip(*filtered)

Python 3
zipped = list(zip(Openmarket, someotherlist, someotherotherlist))
filtered = list(filter(lambda elems: "FX" not in elems[0], zipped))
Openmarket, someotherlist, someotherotherlist = zip(*filtered)


text:
Q: Отправка альбома в telegram канал. Python Добрый день! Подскажите пожалуйста как настроить отправку нескольких фотографий в telegram канал, так, чтобы они отображались одним постом (альбом), а не каждая фотография отдельным постом.
Отправляю, используя python telegram bot api.
Код:
import telebot
for j in range(c):
        bot.send_photo(channel_name, post_media[j]['photo']['src_xxbig'])

A: В API это реализовано методом sendMediaGroup:

Use this method to send a group of photos or videos as an album. On
  success, an array of the sent Messages is returned.

*

*chat_id  - Unique identifier for the target chat or username of the    target channel (in the format @channelusername)

*media    - A JSON-serialized array describing    photos and videos to be sent, must include 2–10 items

*disable_notification - Sends the messages silently.    Users will receive a notification with no sound

*reply_to_message_id - If the messages are a reply, ID    of the original message

В библиотеке python telegram bot api это реализовано одноимённым методом sendMediaGroup.

A: with open('files/1.jpg', 'rb') as f1, open('files/2.jpg', 'rb') as f2:
            bot.send_media_group(call.message.chat.id, [InputMediaPhoto(f1), InputMediaPhoto(f2)])

https://core.telegram.org/bots/api#sendmediagroup
media - Массив InputMediaAudio, InputMediaDocument, InputMediaPhoto и InputMediaVideo.
документация pyTelegramBotAPI
Сериализованный в формате JSON массив, описывающий отправляемые сообщения, должен включать от 2 до 10 элементов.

A: У telebot для python можно сделать так:

from telebot.types import InputMediaPhoto
def send_album_with_text(message):
        wget.download("https://example.com/766793/15675732133090s.jpg")
        pic1 = open("15675732133090s.jpg", "rb")
        wget.download("https://example.com/766793/15675732133111s.jpg")
        pic2 = open("15675732133111s.jpg", "rb")
        media = [InputMediaPhoto(pic1, caption="test"), InputMediaPhoto(pic2)]
        bot.send_media_group(message.chat.id, media)