text:
Q: Range of Lifted Differential Operators Let $D:C^\infty M \rightarrow C^\infty M$ a differential operator on a Riemannian manifold $M$. Define its maximal extension as closed operator $$D_\max:L^2M\supset \mathrm{dom}(D_\max):=\{u\in L^2M\vert Du\in L^2M\} \rightarrow L^2M, u \mapsto Du$$
Further suppose that $p\colon\hat M\rightarrow M$ is a finite-sheeted Riemannian covering and that $\hat D$ is the lift of $D$, i.e. $\hat Dp^*u=p^*Du$ for $u\in C^\infty M$. Similar to above define $\hat D_\max$ as closed operator in $L^2 \hat M$.
Question: If $D_\max$ has closed range, does also $\hat D_\max$ have closed range?
Below are some thoughts and proof attempts:

Examples and alternative Characterization:
If $M$ is compact, then closedness of range is often trivial. Let's look at some non-compact examples. We use the following characterization:
"A closed operator $A$ has closed range iff there is an "Poincaré-inequality" of the form $\Vert A u \Vert_{L^2} \ge C \Vert u - Qu\Vert_{L^2}$, where $Q\in \mathcal{B}(L^2M)$ is the orthogonal projection onto $\ker A$. "
E.g. if $M$ is a bounded open subset of euclidean space (with $\partial \bar M$  not too terrible) and $D= \nabla$, then the Poincaré-Wirtinger inequality tells us that $D_\max$ has closed range. However, if $M=\mathbb{R}^n$ then $\nabla$ does not have closed range. These two examples show that the closed range assumption is really a global condition, which makes it harder to deal with covering spaces. Also it suggests that $p$ better be finite-sheeted, otherwise we might for example run into trouble when lifting an operator from the torus to the euclidean plane.

Lifting the property for invariant functions:
Let $H_0\subset L^2\hat M$ be the subspace of functions which are invariant under the action of $\mathrm{Aut}(p)$, equivalently $H_0=\{p^*u \vert u\in L^2 M\}$. It's easy to see that the the Poincaré-inequality from $M$ lifts to functions in $H_0 \cap \mathrm{dom }(\hat D_\max)$. But does this imply that the Poincaré-inquality holds for all functions?
In an attempt to understand this, let's consider a $2$-sheeted cover, for simplicity $p\colon S^2\rightarrow \mathbb{R}P^2$. Then $\mathrm{Aut}(p)$ is generated by the antipodal map $a$ and we have
$$
L^2\hat M = \ker (a^* -1 ) \oplus \ker (a^* + 1 )=: H_0 \oplus H_1.
$$
It'd be great if he had an isomorphism $T\colon H_0 \xrightarrow{\sim}H_1$ that commutes with $D$ (on say smooth functions). But this seems to be impossible. Finding $T$ which is an iso is not hard: Let $\chi$ the characteristic function of the upper half plane, then $Tu=\chi u - a^*(\chi u)$ defines an iso, but does not even preserve the smooth subspace. If we want smooth functions to be preserved, we immediately think of a multiplication operator $Tu=\varphi u$, for an antipodal map $\varphi: S^2\rightarrow S^1$ (it has to be nowhere-vanishing, so we might as well map into the circle). But this is forbidden by Borsuk-Ulam.

Using partitions of $1$?
Denote $\hat u=\vert\mathrm{Aut}(p)  \vert ^{-1}\cdot \sum_{a\in \mathrm{Aut}(p)}a^*u\in H_0$ and suppose $f_1 + \dots + f_N =1$ is a partition of unity such that $a^* \mathrm{supp} f_i \cap \mathrm{supp} f_i = \emptyset$ if $a\neq \mathrm{id}$. Then all information about $u \in L^2\hat M$ is contained in the collection $(f_1 u)\hat{~},\dots , (f_1 u)\hat{~}$. For each of those we have a Poincarè-inequality and I hoped to generalize it to $u$, but for that one needs control on $\Vert df_i \Vert_{L^\infty}$ (which in general isn't even finite).


text:
Q: How to convert Unix epoch time in SQLite Could you help me convert UNIX epoch time into format yyyy-mm-dd hh:mm:ss (24h) in SQLite? (GMT+7 would be appreciated).
Example: from 1319017136629 to Wednesday, October 19, 2011 4:38:56 PM GMT+7.
p/s: Just looked around and found a solution:
SELECT datetime(1319017136629, 'unixepoch', 'localtime');

But i am still looking for a way to batch convert UNIX epoch time in SQLite.

A: SELECT  DATE(ROUND(1601272453000 / 1000), 'unixepoch')

A: To change the values in the database, use the UPDATE command:
UPDATE MyTable SET MyColumn = datetime(MyColumn, 'unixepoch', 'localtime')

A: 1319017136629 is a value in milliseconds, which is not UNIX epoch time;
therefore it has to be divided by 1000 and rounded to integer seconds; only then DATE() and DATETIME() will convert.
SELECT DATETIME(ROUND(dateColumn / 1000), 'unixepoch') AS isodate FROM tableName

Converting database values to localtime is unfortunate; conversion on output is less problematic.
The Y2038 problem might already be worth a consideration.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Convertir PropertyName a KeySelector C# Estoy implementando sorting en las peticiones de una API.
Primero instale este NuGet

AutoMapper.Extensions.ExpressionMapping v3.0.5
   Para convertir las expresiones de DTOs a Entities

Los OrderBy funcionaban correctamente con ExpressionMapping pero tener que crear un ExpressionMapping por cada propiedad en cada entidad es mucho trabajo y poco eficiente, es inclusive una mala práctica para cuando tenga que darle mantenimiento al sistema.
Por eso instale este otro NuGet.

System.Linq.Dynamic.Core v1.0.20
   Para importar métodos OrderBy que soportan string. Ej: users.OrderBy("name desc")

Código

DTO

public class AuthorDto
{
    public Guid Id { get; set; }
    public string Name { get; set; }
    public int Age { get; set; }
    public string MainCategory { get; set; }
}

Entity

public class Author : IAuthor
{
    public Guid Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public DateTimeOffset DateOfBirth { get; set; }
    public string MainCategory { get; set; }
    public virtual ICollection<ICourse> Courses { get; set; }
        = new List<Course>() as ICollection<ICourse>;
}

Repository Query Author

public IEnumerable<Author> QueryAuthors(AuthorParameters authorParameters)
{
    // query operations ...

    string orderBy = authorParameters.OrderBy; // OrderBy = "Name desc"
    if (!string.IsNullOrWhiteSpace(orderBy))
    {
        // This works
        // gets converted to: authors => authors.OrderBy(a => a.FirstName);
        //Expression<Func<IQueryable<AuthorDto>, IQueryable<AuthorDto>>>
        //  dtoExpression = dtos => dtos.OrderBy(a => a.Name);

        // Thows System.Linq.Dynamic.Core.Exceptions.ParseException
        Expression<Func<IQueryable<AuthorDto>, IQueryable<AuthorDto>>>
            dtoExpression = dtos => dtos.OrderBy(orderby);

        var expression = _mapper.Map<Expression<Func<IQueryable<Author>,
            IQueryable<Author>>>>(dtoExpression);

        collection = expression.Compile()(collection);
    }

    // paging operations ...
}

Ahora cuando lo ejecuto me da el siguiente error.
   "An exception of type 'System.Linq.Dynamic.Core.Exceptions.ParseException'
   occurred in System.Linq.Dynamic.Core.dll but was not handled in user
   code: 'No property or field 'Name' exists in type 'Author''"

Estoy pensando hacer un extension method para IQueryable<T> con el objectivo de convertir los propertyName a KeySelector y aplicar "asc/desc" algo como:
public static IQueryable<T> ApplySorting<T>(this IQueryable<T> collection,
    string orderBy)
{
    var func = GetKeySelectorWithPropertyName<T>(orderBy);

    Expression<Func<IQueryable<T>, IQueryable<T>>>
        dtoExpression = dtos => dtos.OrderBy(func);

    var expression = _mapper.Map<Expression<Func<IQueryable<T>,
        IQueryable<T>>>>(dtoExpression);

    return expression.Compile()(collection);
}

public static Func<T,TKey> GetKeySelectorWithPropertyName<T>(string orderBy)
{
    //TODO: get key selector from property name ...
}

EL problema es que no sé como implementar GetKeySelectorWithPropertyName. Si alguien conoce algún NuGet que haga esto por mí, o ha pasado por este mismo problema, me gustaría saber como puedo resolverlo, o si existe una mejor solución para el mismo.


text:
Q: Map-Reduce Logs on Hive-Tez I want to get the interpretation of Map-Reduce logs after running a query on Hive-Tez ? What the lines after INFO: conveys ?
Here I have attached a sample
INFO  : Session is already open
INFO  : Dag name: SELECT a.Model...)
INFO  : Tez session was closed. Reopening...
INFO  : Session re-established.
INFO  :
INFO  : Status: Running (Executing on YARN cluster with App id application_14708112341234_1234)

INFO  : Map 1: -/-  Map 3: -/-  Map 4: -/-  Map 7: -/-  Reducer 2: 0/15     Reducer 5: 0/26 Reducer 6: 0/13
INFO  : Map 1: -/-  Map 3: 0/118    Map 4: 0/118    Map 7: 0/1  Reducer 2: 0/15 Reducer 5: 0/26  Reducer 6: 0/13
INFO  : Map 1: 0/118    Map 3: 0/118    Map 4: 0/118    Map 7: 0/1  Reducer 2: 0/15 Reducer 5: 0/26 Reducer 6: 0/13
INFO  : Map 1: 0/118    Map 3: 0/118    Map 4: 0(+5)/118    Map 7: 0/1  Reducer 2: 0/15 Reducer 5: 0/26 Reducer 6: 0/13
INFO  : Map 1: 0/118    Map 3: 0(+5)/118    Map 4: 0(+7)/118    Map 7: 0(+1)/1  Reducer 2: 0/15 Reducer 5: 0/26 Reducer 6: 0/13
INFO  : Map 1: 0/118    Map 3: 0(+15)/118   Map 4: 0(+18)/118   Map 7: 0(+1)/1  Reducer 2: 0/15 Reducer 5: 0/26 Reducer 6: 0/13

A: The log you posted is DAG execution log. The DAG consists of
Map 1,Map 3,Map 4,Map 7 mappers vertices and reducers: Reducer 2,Reducer 5,Reducer 6
Map 1: -/- - this means that the vertex is not initialized, the number of mappers are not calculated yet.
Map 4: 0(+7)/118 - this means that totally there are 118 mappers, 7 of them are running in parallel, 0 completed yet, 118-7=111 are pending.
Reducer 2: 0/15 - this means that totally there are 15 reducers, 0 of them are running, 0 of them are completed (15 reducers pending).
Negative figures (there are no such in your example) = number of failed or killed mappers or reducers
Qubole has explanation about Tez log: https://docs.qubole.com/en/latest/user-guide/hive/using-hive-on-tez/hive-tez-tuning.html#understanding-log-pane


text:
Q: Rails + Omniauth: undefined method `[]' for nil:NilClass I'm trying to use the Spotify API to sign up/in a user via Devise but I'm getting:
undefined method[]' for nil:NilClass`
in:
pages_controller.rb
@spotify_user = RSpotify::User.new(request.env['omniauth.auth'])
===
Here's my stack:
home.html.erb

<%= link_to 'Sign in with Spotify', user_spotify_omniauth_authorize_path %>

routes.rb
devise_for :users, :controllers => { :omniauth_callbacks => 'callbacks' }

callbacks_controller.rb
class CallbacksController <  Devise::OmniauthCallbacksController
  skip_before_action :verify_authenticity_token
  def spotify
    @user = User.from_omniauth(request.env["omniauth.auth"])
    sign_in_and_redirect @user
  end
end

initializers/devise.rb
  RSpotify.authenticate(ENV["SPOTIFY_CLIENT_ID"], ENV["SPOTIFY_CLIENT_SECRET"])
  config.omniauth :spotify, ENV["SPOTIFY_CLIENT_ID"], ENV["SPOTIFY_CLIENT_SECRET"], scope: 'user-read-email playlist-modify-public user-library-read user-library-modify'


text:
Q: CSS selector for empty file input I know that styling file input is pretty minimal, which is not a bad thing.
Is there some way of selecting file input which is empty?
The plan is to show or hide a submit button depending on whether the file input is empty.

A:
Is there some way of selecting file input which is empty?

No.
You'll need JavaScript. You can find several answers here on SO and elsewhere. The basic idea is to watch the element for change events, add a class such as non-empty indicating there are files selected, then style  input[type="file"].non-empty + label, assuming you are using the technique of using a label as the replacement file input button. You will have to special-case form.reset() which empties file inputs inside the form but does not trigger a change event on the input. Here's some sample code (without the form.reset part):

// Add a class to a file input if it's not empty.
function mark() { this.classList.toggle('non-empty', this.files.length); }

// Watch a file input and update non-empty status.
function watch(input) { input.addEventListener('change', mark); }

// Get all file inputs.
const inputs = Array.from(document.querySelectorAll('input[type=file]'));

// Watch all file inputs in the whole document.
inputs . forEach(watch);
input[type="file"]                          { width: 0.1px; height: 0.1px; }
input[type="file"].non-empty + label        { color: green; }
input[type="file"].non-empty + label::after { content: ' (specified)'; }
<input type="file" id="input">
Specify file

A: If you are comfortable marking the input as required, you could do it with just css:

input:invalid ~ .chosen {
    display: none;
}
input:valid ~ .empty {
    display: none;
}
<input type="file" required>

Empty
Chosen


text:
Q: Range of arguments in loss function of logistic regression We have the following loss function for logistic regression, the so called log-loss defined as:
$- \Big[\sum_i y^{i}\log(h(x^i))+(1-y^i)\log(1-h(x^i))\Big]$
We also know that logistic regression assigns a datasample to class y=1 if the posterior probability $h(x)$ of class $y=1$ is bigger than 0.5.
Now my question: The term $y^{i}\log(h(x^i))$ quantifies the case where the true label is "$y=1$", but the prediction is "$y=0$". The prediction "$y=0$" is however only done when $h(x)<0.5$. Does this mean that the $h(x^i)$ in $y^{i}\log(h(x^i))$ always will be $<0.5$?

A:
We also know that logistic regression assigns a datasample to class y=1 if the posterior probability p of class y=1 is bigger than 0.5.

This is not true; logistic regression is not a classifier. But the notation here is a little confusing because $p$ does not appear in your expression for the loss.

The term $y^{i}\log(h(x^i))$ quantifies the case where the true label is "$y=1$", but the prediction is "$y=0$".

This is not true. The way to think about the log-loss function is that $y^i$ works as a "switch." If $y^i=1$, then the term $\log(h(x^i))$ is added to the loss; if $y^i=0$, the term $\log(1-h(x^i))$ is added to the loss.

The prediction "$y=0$" is however only done when $h(x)<0.5$.

When we're considering the log-loss, at no point do we consider whether or not $h(x^i)>0.5$. If $y^i=1$ but $h(x^i) < 0.5$, even if $h(x^i)$ is very small, the expression is evaluated as it is written. Very small values $h(x^i)$ naturally imply that the loss contribution for the sample will be very large, which is exactly what we want because in that case, the model poorly predicts the sample.


text:
Q: PHP ZipArchive getFromName can't read file with relative path I'm trying to read a file content from a zip file with ZipArchive with the method getFromName. My file name has a double dot in it (..). Here's my code:
$zip = new ZipArchive();

$zip->open('book.zip');

$content = $zip->getFromName('book/html/../README.md');

var_dump($content);

The structure of my zip file is this:
Archive:  book.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2016-06-01 11:09   book/
        0  2016-06-01 11:02   book/html/
     1855  2016-06-01 11:02   book/html/composer.json
     2354  2016-06-01 11:09   book/README.md
---------                     -------
     4209                     4 files

My PHP script is in the same directory as my zip file.
When I try to list the file in the folder that I have zipped with Linux command like this:
ls -l book/html/../README.md

It works perfectly. I don't understand why ZipArchive can't read this relative path correctly.
Note: I know that I can read the file with the absolute path: book/README.md but I really need to use the relative path with .. because the file paths are loaded dynamically from another place and I don't have a control on them.

A: I spent a day or so on a similar issue trying to read relative file paths including ".." change directories. ZipArchive is unable to handle those paths if the file is not extracted. The best solution I came up with without having to extract the Zip, was to use the following function to get the full path for the file you want: http://php.net/manual/en/function.realpath.php#84012. After getting the full file path, ZipArchive::getFromName() will be able to find the file you're looking for.


text:
Q: Mercurial - active changeset after a pull When you do an hg pull which results in multiple heads, which of the heads is 'active' on your file system?
Ie: Given a local repostory with changesets:
A1 - A2 - A3

And then doing an hg pull which results in multiple heads:
A1 - A2 - A3
        \
          B3

Prior to doing an hg merge, which changeset will be active on the file system?  Will it be A3 or B3?

A: Not sure what you mean by "active on the filesystem", but after doing hg pull the working directory is not changed. You need to do hg update to update the working folder to one of the pulled commits.
When doing hg update you can specify the changeset you need. If you don't, the working directory is updated to the tip of the current named branch.


text:
Q: Teradata database Size I am working in Teradata database my database utilization is above 90%. I cannot delete the data from the tables so I applied COMPRESS logic to the columns which has repeated values. By doing this my Database size got reduced to some extent.please help me if there is any other way to reduce database size/utilization ?

A: You can use Compression in Teradata.
As a side note: 90% utilization doesn't necessarily mean, that after it reaches 100% it will break. It'll probably just expand, but to be certain you need to check proper options of your db.


text:
Q: Flutter limit number of items in Hive Box In my recipe app a user can save a recipe to his/her favorites. This works by adding the recipe to a hive box when the user saves the recipe to favorites. The plan is to limit the number of favorites to 10 in a free version. In the paid version there will be the limit of 30 recipes. How can I do it with hive box?

A: There is no code so I do not know what type of code you have written. But I can explain the logic below and you can work your way ahead.
Retrieve all Fav recipes present in the hive in the form of a list.
if(hiveRecipeList.length < 10){
 addRecipeToHive();
}else{
 upgradeToPro()
}


text:
Q: nagios does not send emalis I'm trying to setup email notifications on a nagios server. The nagios machine has been running okay for a little while now. Except for the fact that it hasn't been sending emails. I've been using a chrome plugin in it's place until I get this resolved.
Anyhow, this is how I have my contacts file setup:
define contact{
       contact_name                     nagiosadmin             ; Short name of user
       use                              generic-contact         ; Inherit default values from generic-contact template (defined above)
       alias                            Nagios Admin            ; Full name of user
       email                            admin@example.com;      <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
       service_notification_period      24x7
       host_notification_period         24x7
       service_notification_options     w,u,c,r,f
       host_notification_options        d,u,r,f
       service_notification_commands    notify-service-by-email
       host_notification_commands       notify-host-by-email
       }

define contactgroup{
    contactgroup_name       admins
    alias                   Nagios Administrators
    members                 nagiosadmin
    }

And I have my host and service definitions setup like this:
define host{
    use                     linux-server            ; Name of host template to use
                                                    ; This host definition will inherit all variables that are defined
                                                    ; in (or inherited by) the linux-server host template definition.
    host_name               web1
    alias                   web1
    address                 10.10.10.6
    contact_groups          admins
    }

define service{
    use                             local-service         ; Name of service template to use
    host_name                       web1
    service_description             HTTP
    contact_groups                  admins
    check_command                   check_http
    notifications_enabled           1
    }

I've tested if this works by shutting down http on a web server it's monitoring. Waited a while and no message received on the mail server.
I've also telnetted to the mail server on the nagios machine. And I'm able to send an email to the account I want via telnet.
I'd appreciate some help here!

A: Look inside your service notification command configuration and execute it  in a terminal for debugging.
Example :

define command {
    command_name    notify-service-by-email
    command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n $NOTIFICATIONCOMMENT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}


text:
Q: postgreSQL: Sorting when creating XML I am stuck writing my query to output some XML.
I got a table with a couple of 100ets of entries:
Table dokumentationsschritte(simplified)
dokuschritt_id,vorgang_id,version_pool,version_lokal,typ,vorgang_nummer
My query:
SELECT XMLFOREST(tb1."xml-val" AS "dokumentationsschritte")
FROM
(SELECT XMLAGG(XMLELEMENT(NAME dokumentationsschritt ,XMLATTRIBUTES(t.dokuschritt_id AS dokuschritt_id,t.vorgang_id AS vorgang_id,t.version_pool AS version_pool,t.version_lokal AS version_lokal,t.deprecated AS deprecated),
XMLELEMENT(NAME typ,t.typ),XMLELEMENT(NAME dokuschritt_nummer,t.dokuschritt_nummer))) AS  "xml-val"
FROM dokumentationsschritte t WHERE t.vorgang_id='4930c02e-1457-316c-c11f-9b7d7f1acb85') AS tb1;

This works, as I get all entries as XML:
<dokumentationsschritte>
  <dokumentationsschritt dokuschritt_id="88942eb7-fbeb-3740-a1b5-a188b0029791" vorgang_id="4930c02e-1457-316c-c11f-9b7d7f1acb85" version_pool="0" version_lokal="3" deprecated="0">
    <typ>1</typ>
    <dokuschritt_nummer>1204</dokuschritt_nummer>
  </dokumentationsschritt>
  <dokumentationsschritt dokuschritt_id="94bdeccf-2c89-3163-bd10-6f4353c8b575" vorgang_id="4930c02e-1457-316c-c11f-9b7d7f1acb85" version_pool="0" version_lokal="3" deprecated="0">
    <typ>1</typ>
    <dokuschritt_nummer>755</dokuschritt_nummer>
  </dokumentationsschritt>
</dokumentationsschritte>

but I would like to ORDER BY dokuschritt_nummer
As soon as I add an ORDER BY it errors out asking for a GROUP BY, but if I add that, the XML gets screwed... No more root node, but a dokumentationsschritte node for each entry.
[edit]
SELECT XMLFOREST(tb1."xml-val" AS "dokumentationsschritte")
FROM
(SELECT XMLAGG(XMLELEMENT(NAME dokumentationsschritt ,XMLATTRIBUTES(t.dokuschritt_id AS dokuschritt_id,t.vorgang_id AS vorgang_id,t.version_pool AS version_pool,t.version_lokal AS version_lokal,t.deprecated AS deprecated),
XMLELEMENT(NAME typ,t.typ),XMLELEMENT(NAME dokuschritt_nummer,t.dokuschritt_nummer GROUP BY dokuschritt_nummer ORDER BY dokuschritt_nummer))) AS  "xml-val"
FROM dokumentationsschritte t WHERE t.vorgang_id='4930c02e-1457-316c-c11f-9b7d7f1acb85') AS tb1;

[/edit]
 <dokumentationsschritte><dokumentationsschritt dokuschritt_id="4b57c57a-0330-3dc7-8eed-f1b0192c6372" vorgang_id="4930c02e-1457-316c-c11f-9b7d7f1acb85" version_pool="0" version_lokal="2" deprecated="0"><typ>2</typ><dokuschritt_nummer>1</dokuschritt_nummer></dokumentationsschritt></dokumentationsschritte>
    <dokumentationsschritte><dokumentationsschritt dokuschritt_id="966136b2-5fc3-306c-88db-064e4d17f710" vorgang_id="4930c02e-1457-316c-c11f-9b7d7f1acb85" version_pool="0" version_lokal="1" deprecated="0"><typ>1</typ><dokuschritt_nummer>2</dokuschritt_nummer></dokumentationsschritt></dokumentationsschritte>

I am pretty much lost. Can you help?
Thanks a lot!
Malte

A: This should work, if you want the data inside the aggregate function to be sorted you have to place the ORDER BY inside the agg([ref]).
SELECT XMLFOREST(tb1."xml-val" AS "dokumentationsschritte")
FROM
(SELECT XMLAGG(
               XMLELEMENT(NAME dokumentationsschritt
                          ,XMLATTRIBUTES(t.dokuschritt_id AS dokuschritt_id,t.vorgang_id AS vorgang_id,t.version_pool AS version_pool,t.version_lokal AS version_lokal,t.deprecated AS deprecated)
                          ,XMLELEMENT(NAME typ,t.typ)
                          ,XMLELEMENT(NAME dokuschritt_nummer,t.dokuschritt_nummer)
                          )
              ORDER BY dokuschritt_nummer
              ) AS  "xml-val"
FROM
dokumentationsschritte t
WHERE t.vorgang_id='4930c02e-1457-316c-c11f-9b7d7f1acb85') AS tb1;


text:
Q: SQL Count with multiple Group By I was wondering if a table could be created using count within multiple group by functions or how to possibly do this.
The goal is to create a table from our DB showing ethnicity numbers of our students based on year in the program.

Year
Black/AA
Hispanic/Latinx
Asian

2022
#
#
#

2023
#
#
#

2024
#
#
#

But can't figure out how to make SQL group them all effectively.
The data set looks like

Student_id
year
ethnicity_id

1
2022
1

2
2022
3

3
2023
3

4
2023
2

5
2024
3

6
2024
1

Ethnicity_id
Name

1
Black/AA

2
Hispanic/Latinx

3
Asian

A: you probably want a pivot. the pivot syntax is different depending on your rdbms.  since you did not provide a rdmbs I will post a more generic solution using the case statement.
select year,
 sum(case when ethnicity_id = 1 then 1 else 0 end) "Black/AA",
 sum(case when ethnicity_id = 2 then 1 else 0 end)  "Hispanic/Latinx",
sum(case when ethnicity_id = 3 then 1 else 0 end)  "Asian"
from student_data
group by year
order by year


text:
Q: Function with different behavior depending on amount of input args I want to create a function which will check if it is a correct hour to make an action, but I want it to be flexible and check condition for every pair of args given as an input to function. I wrote some code how it should look like in theory and now I'm trying to figure out how to write this in code.
def report_time(greater_than1=0, lower_than1=24,
                greater_than2=0, lower_than2=24,
                greater_than3=0, lower_than3=24,
                ...
                greater_thanN=0, lower_thanN=24):
    if greater_than1 < datetime.now().hour < lower_than1:
        logger.info('Hour is correct')
        return True

    if greater_than2 < datetime.now().hour < lower_than2:
        logger.info('Hour is correct')
        return True

    if greater_than3 < datetime.now().hour < lower_than3:
        logger.info('Hour is correct')
        return True

    ...

    if greater_thanN < datetime.now().hour < lower_thanN:
        logger.info('Hour is correct')
        return True

Examples of usage:
foo = report_time(16, 18)
foo = report_time(16, 18, 23, 24)
foo = report_time(16, 18, 23, 24, ..., 3, 5)

A: A better alternative would be to make the function accept only a pair of parameters and then iterate over all pairs outside of the function and check if on any step a True was returned:
def report_time(greater_than=0, lower_than=24):
    return greater_than < datetime.now().hour < lower_than

start_times = [10, 12, 20]
end_times = [11, 15, 22]

for start, end in zip(start_times, end_times):
    if report_time(start, end):
        logger.info('Hour is correct')
        break

This can be shortened using map and any:
valid_times = map(report_time, start_times, end_times)
if any(valid_times):
    logger.info('Hour is correct')

Also, as mentioned by @AzatIbrakov in his comment to another answer, it will be better if you work with tuples. You can use filter in this case:
def within_limits(limits=(0, 24)):
    return limits[0] < datetime.now().hour < limits[1]

time_limits = [(10, 11), (12, 15), (20, 22)]
if any(filter(within_limits, time_limits)):
    logger.info('Hour is correct')

A: You need to look at *args:
def multi_arg_pairs(*args):
    if len(args) % 2 == 1:
        raise ValueError("arguments must be an even number")
    for v1, v2 in zip(args[0::2], args[1::2]):
        print(v1, v2)
        # Do something with your value pairs

multi_arg_pairs(1, 2, 3, 4)

Outputs:
1 2
3 4


text:
Q: Mapbox GL JS Change the fill-color's property value based on an expression I have a chloropleth map with a geojson data source backing it. The data set contains data for each country for two different years, with the fill color based on one of the properties in the JSON. Here is my addLayer code currently, which works fine.
map.addLayer({
                id: 'emissions',
                type: 'fill',
                source: {
                    type: 'geojson',
                    data: './data.json'
                },
                paint: {
                    'fill-color': {
                        property: 'total_2014',
                        type: 'exponential',
                        base: 0.99999,
                        stops: [
                            [3, "hsl(114, 66%, 53%)"],
                            [2806634, "hsl(0, 64%, 51%)"]
                        ]
                    },
                    'fill-opacity': 1
                }
            });

I would like to be able to programatically switch the json property on which the fill color is based, and an expression seems the obvious way to do so, however the following code fails with the error layers.emissions.paint.fill-color.property: string expected, array found.
...
paint: {
                    'fill-color': {
                        property: ['get', propName], // propName var is e.g. 'total_2014'
                        type: 'exponential',
                        base: 0.99999,
                        stops: [
                            [3, "hsl(114, 66%, 53%)"],
                            [2806634, "hsl(0, 64%, 51%)"]
                        ]
                    },
                    'fill-opacity': 1
                }
...

Is there a way to achieve what I'm aiming for? I'm very new to using Mapbox GL JS, so apologies if this is a basic question.

A: Just in case anyone else happens across this requirement, I found a workaround by updating the map's style property directly. This isn't an exact answer since the approach doesn't use expressions, but the performance of mapbox diffing source and applying the changes is very fast and meets my requirements.
function loadDataForYear(year) {
    const style = map.getStyle();
    style.layers.find(({ id }) => id === "emissions").paint['fill-color']['property'] = 'total_' + year;
    map.setStyle(style);
}


text:
Q: Sitecore: Add a New Data Template to my Sublayout I sublayout is about Events.
If I put it inside a page which contains an Event, it will display informations pertaining to it.
I want to add a Data Template to my Sublayout that will allow editors to specify one particular Event from which to draw these informations.

How do I go about creating a Data Template that allows an editor to choose a specific Event from a list?
How do I add this to a given Sublayout?

A: When building componentized architectures as you are doing, you will want to implement the datasource property for a sublayout to make your sublayout a datasource-driven sublayout.
This article by John West should help on how to set a datasource:
http://www.sitecore.net/Learn/Blogs/Technical-Blogs/John-West-Sitecore-Blog/Posts/2010/11/How-to-Apply-Data-Sources-to-Sitecore-ASPNET-Presentation-Components.aspx
The basics are:

*

*Create a template for your Event to contain the data

*On your sublayout item (/sitecore/Layouts/...) set the datasource template property to match to your new Event template.

*Update your code to pull from the datasource item on the sublayout, not the Sitecore.Context.Item

The following post by Mark Ursino is helpful in seeing the code side as well:
http://firebreaksice.com/using-the-datasource-field-with-sitecore-sublayouts/


text:
Q: What is vb6's "Report.DetailCopies" Property in vb.net I am rewriting a vb6 Windows Application to vb.net which is handling crystal report files.
I couldn't find "report.DetailCopies property" in vb.net.
DetailCopies property can produce repeating detail sections like these:

*

*DetailCopies property set as 1 -
Page1           Page2            Page3          Page4
Header        Header           Header         Header-
Detail(1)     Detail(2)        Detail(3)      Detail(4)

Footer          Footer             Footer          Footer

*DetailCopies property set as 2 -
Page1           Page2            Page3          Page4
Header        Header           Header         Header-
Detail(1-1)  Detail(2-1)    Detail(3-1)   Detail(4-1)
Detail(1-2)  Detail(2-2)    Detail(3-2)   Detail(4-2)
Footer          Footer             Footer          Footer

*DetailCopies property set as 3 -
Page1           Page2            Page3          Page4
Header        Header           Header         Header-
Detail(1-1)  Detail(1-3)    Detail(2-1)   Detail(2-3)
Detail(1-2)                           Detail(2-2)
Footer          Footer             Footer          Footer

A: Try using Report.Areas.Item("D").CopiesToPrint = 1 (or 2 or 3).


text:
Q: How to test functions in a function using Jest I have some code that has functions inside functions, and I want to be able to unit test the functions inside the parent function.
I am looking to have tests that unit test these and spy on them (both requirements are needed).
Example:
export default parentFunction = () => {

  const innerFunction = () => {
    //that does stuff
  }

  const anotherInnerFunction = () => {
    //that does more stuff
  }

  //and at some point, the functions are called

  //like this
  innerFunction()

  const anotherFunction = () => {
    //or like this
    anotherInnerFunction()
  }
}

I have not been able to find a way to test these inner functions. I have tried the following.
Example test
import parentFunction from "myfile"

it("should call innerFunction", () => {
  //this causes an error in jest
  const innerFunctionSpy = jest.spyOn(parentFunction, "innerFunction")
  //..etc
  expect(innerFunctionSpy).toHaveBeenCalled()
})

it("will return a value from anotherInnerFunction", () => {
  //this does not work
  const value = parentFunction.anotherInnerFunction()
  //this also does not work
  const value = parentFunction().anotherInnerFunction()
  //..etc
})

Does the parent function need to be refactored in order to be able to tests these inner functions? If my parent function was an object then I could test these, however, I am not sure if I can refactor my code to work like this.
For example
export default parentFunction = {
  innerFunction: () => {
    //that does stuff
  },
  //more code
}

A: You cannot access the variables or functions scoped inside another function in JavaScript. Unless you explicitly expose them by returning them from that function or export them from the module. This is not about Jest, this is how it works in JavaScript.
jest.spyOn(parentFunction, "innerFunction")
The above line of code indicates to Jest that the innerFunction function is set as a property of the parentFunction object but that is not the case. In fact innerFunction is a function scoped inside the parentFunction which cannot be accessed from outside of the scope of parentFunction. Unless you return it explicitly or define it on the module level scope and then export it.
But the inner workings or the implementation details of such inner functions should not be exposed, but if it is needed it should be marked as such using an _ before its name, take the following example:
 //scoped to the module
 const _innerFunction = () => {
    //that does stuff
 }

 //scoped to the module
 const _anotherInnerFunction = () => {
    //that does more stuff
 }

 //exported as a public API
 const anotherFunction = () => {
     _anotherInnerFunction()
 }

const publicApi = {
  anotherFunction,
  // expose the private functions for unit tests
  _innerFunction,
  _anotherInnerFunction
}

export default publicApi;

Then in your Jest test case:
import publicApi from "myfile"

it("should call anotherFunction", () => {
  const anotherFunctionSpy = jest.spyOn(publicApi, "anotherFunction")
  //..etc
  expect(anotherFunctionSpy ).toHaveBeenCalled()
})

it("should call _innerFunction", () => {
  const innerFunctionSpy = jest.spyOn(publicApi, "_innerFunction")
  //..etc
  expect(innerFunctionSpy ).toHaveBeenCalled()
})


text:
Q: Emulator deleted my all application on restarting....why? I am newbie to android development.yesterday I created an application and installed that appliaction into emulator. It was working fine. I ran it many times.
But today when I launched emulator, It doesn't have any application installed by me.
I dont know where is my application gone.I cant figure out what happened.
Please help me..can anybody know what is problem??
Thanks and Regards
Vaibhav Tyagi

A: One possibility is that when you launch the emulator via the AVD Manager, there is a checkbox which allows you to 'wipe user data' on the emulator. That should be unset.


text:
Q: Ethernet not working ubuntu 14.04 I can't get my device connected to the internet.
This is the content of /etc/network/interfaces:
auto lo
iface lo inet loopback

iface eth0 inet dhcp

iface usb0 inet dhcp

iface wlan0 inet dhcp

When I try "ifup eth0", I get:
no DHCPOFFERS received

Any help would be appreciated. Thanks in advance.
    ifconfig -a
dummy0    Link encap:Ethernet  HWaddr 2e:0e:d3:d4:b1:2e
          BROADCAST NOARP  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr 00:04:4b:21:2f:b9
      BROADCAST MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ip6tnl0   Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
      NOARP  MTU:1452  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
      inet addr:127.0.0.1  Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:65536  Metric:1
      RX packets:8 errors:0 dropped:0 overruns:0 frame:0
      TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:560 (560.0 B)  TX bytes:560 (560.0 B)

rmnetctl  Link encap:IPIP Tunnel  HWaddr
      NOARP  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

sit0      Link encap:IPv6-in-IPv4
      NOARP  MTU:1480  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

A: The interfaces files appears wrong. There should be a auto eth0 above the line iface eth0 inet dhcp.
The same applies for the other network interfaces as well.


text:
Q: jQuery live() removing iPhone touch event attributes? I am binding live events on links in my PhoneGap app. The event does fire successfully (confirmed by alert()ing), but it seems any touch data is not attached to the event object like it should be. This happens on all touch events - touchstart, touchmove, and touchend.
$('a').live('touchend', function(event) {
  event.preventDefault();
  alert(event.touches.length); // event.touches should be populated!
});

Any ideas? Am I SOL with jQuery.live()?

A: The touch events are not currently supported by Events/live.
From the documentation:

Possible event values: click,
  dblclick, mousedown, mouseup,
  mousemove, mouseover, mouseout,
  keydown, keypress, keyup
Currently not supported: blur, focus,
  mouseenter, mouseleave, change, submit

You might want to consider trying to use click if that will suit your needs, or you can switch to using livequery, which probably will support it. (livequery is what live was originally based on, I'm not sure why it doesn't support all of the same events)

A: Actually, you can use the .live method. You don't have the event.touches property because of how jQuery handles events internally. In order to "fix" events, jQuery clones the event. In doing so, it only copies over a limited number of properties for performance reasons. However, you can still access the original event object via the event.originalEvent property.
So your example code would need to look like the following:
$('a').live('touchend', function(event) {
  event.preventDefault();
  console.log(event.originalEvent.touches.length);
});

Here are the properties that are copied over: http://github.com/jquery/jquery/blob/master/src/event.js#L411


text:
Q: Вызов функции с аргументом-объектом, при помощи его названия. Python 3 Дано:
функция f, которая принимает в качестве аргумента некоторый объект, объект O, имя объекта O в виде переменной типа str - NameO.
Как вызвать функцию f, указав объект O, как аргумент, используя NameO?
P.S
В моём случае нежелательно использовать id объекта O.

A: variable='value'
def call(var):
  x=eval(var)
  print(x)
  #value
call('variable')

Использовать функцию eval, либо, ast.literal_eval


text:
Q: 403 error on Wordpress while using Woocommerce Export  whi
Hello There,
I am facing some issue in my WordPress website. When i try to export woo-commerce products with the Generate CSV button. The exporting process stats but it stuck in the middle of the loading. i have checked the error via inspect element on the Console tab and it shows 403 error. Image is attached for the error logs. Is there anyone who can help me to fix this issue.


text:
Q: Add class to a specific div when the bottom of a fixed div touches the top of this div, using jquery After searching a lot, i didn't find a solution. My issue is this: I have a fixed top bar on my page and another div exactly below the fixed one the distance between the two div's is 150px-400px depending on the screen resolution.
What i want to do is to add a new class (some shadow) to the second div when the bottom of the fixed div touches the top of the second div. I know that i can use something like that:
$(function(){
$(window).on('scroll', function(){
   if($(this).scrollTop() > 150){
       $('.content').addClass('shadow');
   }else{
       $('.content').removeClass('shadow');
   }
}).scroll();
});

but it works only if the space between the 2 divs is 150px. How can i make this so my fixed div knows when it touches the top of the second div?
FIDLLE HERE

A: Try this:
$(function(){
  $(window).on('scroll', function(){

     var contentTop = $('.content').offset().top;
     var hHeight = $('.header').height();

     if($(this).scrollTop() > contentTop-hHeight){
         $('.content').addClass('shadow');
     }else{
         $('.content').removeClass('shadow');
     }
  }).scroll();
});


text:
Q: Django forms: Creating checkbox form from CharField in a model I have a Django model that looks like this:
class Group(models.Model):
    group_name = models.CharField(max_length=64)

My end goal is to render an HTML list of checkboxes for all the possible Groups in my database to then use in various AJAX requests. I can do this by (in the template) manually creating a form and rendering it inside <input type='checkbox'> with the appropriate labels, then taking care of the form process manually in the views.
I wanted to see if using Django Forms saved me any work. I created a Form that looks like this:
class GroupForm(forms.ModelForm):
class Meta:
    model = Groups
    fields = ['group_name']
    widgets = {
        'group_name': forms.CheckboxInput,
    }

And then created a formset using all the Groups objects in my database.
GroupFormSet = modelformset_factory(Groups, form=GroupForm)
all_groups_can_edit = GroupFormSet(queryset=Groups.objects.all())

When this is rendered in my template, the resulting HTML looks like this:

    Group name:<input id="id_form-0-group_name" maxlength="64" name="form-0-group_name" type="checkbox" value="Student">

The label for my checkbox is always 'Group name:', but the value of the class is correct ('Student' in this example).
I want my HTML to look like this:

    Student:<input id="id_form-0-group_name" maxlength="64" name="form-0-group_name" type="checkbox" value="Student">

How can I change my GroupForm class to make the label for my checkbox correspond to the name of the particular object used in the form?


text:
Q: How to get newly inserted row ids when inserting with execute? I have a function which returns newly inserted row count:
   BEGIN
   EXECUTE (

      SELECT format('INSERT INTO %1$s(%2$s) SELECT %2$s FROM %1$s WHERE budget_id = $1',
                    _tbl, string_agg(quote_ident(attname), ', '))
      FROM   pg_attribute
      WHERE  attrelid = _tbl
      AND    NOT attisdropped  -- no dropped (dead) columns
      AND    attnum > 0        -- no system columns
      AND    attname <> 'id'   -- exclude id column

      )
   USING _id;

   GET DIAGNOSTICS row_ct = ROW_COUNT;  -- directly assign OUT parameter
  END;

Instead, I have to return a list which contains newly inserted row ids. How can I do that?
I tried with result_oid,@@identity but I got no result.
This function is returning only one value. How can I get all the values?
CREATE OR REPLACE FUNCTION public.test2(_tbl regclass,_id integer)
RETURNS integer[]
LANGUAGE 'plpgsql'
VOLATILE
PARALLEL UNSAFE
COST 100
AS $BODY$DECLARE
ab integer;

BEGIN
  EXECUTE (

  SELECT format('INSERT INTO %1$s(%2$s) SELECT %2$s FROM %1$s WHERE budget_id = $1 RETURNING id',
                _tbl, string_agg(quote_ident(attname), ', '))
  FROM   pg_attribute
  WHERE  attrelid = _tbl
  AND    NOT attisdropped  -- no dropped (dead) columns
  AND    attnum > 0        -- no system columns
  AND    attname <> 'id'   -- exclude id column
  )
 USING _id
 into ab;

 RETURN ARRAY[ab];
END;$BODY$;

A: To return a set, Use RETURN QUERY EXECUTE in a function that RETURNS SETOF integer:
CREATE OR REPLACE FUNCTION pubilc.test_set(_tbl regclass, _id int)
  RETURNS SETOF integer AS
$func$
BEGIN
   RETURN QUERY EXECUTE (
   WITH (
   SELECT format('INSERT INTO %1$s(%2$s)
                  SELECT %2$s FROM %1$s WHERE budget_id = $1
                  RETURNING id'
                , _tbl, string_agg(quote_ident(attname), ', '))
   FROM   pg_attribute
   WHERE  attrelid = _tbl
   AND    NOT attisdropped  -- no dropped (dead) columns
   AND    attnum > 0        -- no system columns
   AND    attname <> 'id'   -- exclude id from column list
   )
   USING _id;
END
$func$  LANGUAGE plpgsql;  -- don't quote the language name

Call:
SELECT * FROM pubilc.test_set('mytbl', 123);

To return an array, move the INSERT to a CTE and feed the result to an array constructor.
Then we don't need the function to RETURNS SETOF int[], because it always returns a single value. The simplest way is to define an OUT parameter and assign the result of the query:
CREATE OR REPLACE FUNCTION public.test_arr(_tbl regclass, _id int, OUT _ids int[]) AS
$func$
BEGIN
   EXECUTE (
   SELECT format('WITH ids AS (
                     INSERT INTO %1$s(%2$s)
                     SELECT %2$s FROM %1$s WHERE budget_id = $1
                     RETURNING id
                     )
                  SELECT ARRAY (TABLE ids)'
               , _tbl, string_agg(quote_ident(attname), ', '))
   FROM   pg_attribute
   WHERE  attrelid = _tbl
   AND    NOT attisdropped  -- no dropped (dead) columns
   AND    attnum > 0        -- no system columns
   AND    attname <> 'id'   -- exclude id from column list
   )
   USING _id
   INTO _ids;
END
$func$  LANGUAGE plpgsql;

Call:
SELECT public.test_arr('mytbl', 123);

Related:

*

*RETURN value directly from INSERT with RETURNING clause

*Find changed columns for near-identical rows across tables

*Why is array_agg() slower than the non-aggregate ARRAY() constructor?


text:
Q: Gerund in a sentence Please, could you explain why we should put in the sentence below the gerund of the verb give:

As an educational consultant, I lead workshops on digital media at schools around the country, giving me an unusual glimpse into the hidden world of middle and high school students.

What does GIVING refer to - to the pronoun  I or workshops? Is it a relative sentence or complex sentence (reduced adverbial)?
Thanks a lot!

A: In a comment, John Lawler wrote:

Giving can't have I as its subject because its object is me; it would be myself if the subject were I. This participial clause (not a gerund -- gerunds are only noun clauses and this is an adverb clause, not the subject or object of a verb) is a reduction of a relative clause: workshops on ..., which give me an unusual ... becomes workshops on ..., giving me an unusual ...

A: I wouldn't try to express this thought in this way. Your question exposes the awkwardness in this sentence. You're struggling with the structure, and you wrote it. Imagine the reader's response. Break the message into two sentences. "I am an educational consultant who conducts workshops across the country. These events give me an unusual glimpse into the hidden world of middle and high school students."


text:
Q: Is the ABC conjecture known to imply the Riemann hypothesis? I once heard from a graduate student that the ABC conjecture implies the Riemann hypothesis. I can't find a reference for this, but given the department the student is from I tend to believe he might know about these things.
I looked through Goldfeld's paper which shows that certain bounds on Shafarevich-Tate groups plus the Generalized Riemann Hypothesis for L-functions associated to certain modular forms imply a form of the ABC conjecture. The article mentions nothing about the opposite implication.

What is the known realationship between ABC, BSD, and GRH? Are any two known to imply the third?

A: Here is a link to many consequences of the ABC-conjecture.

A: Perhaps my friend had seen this entry from Terry Tao's blog. Apparently Shou-Wu Zhang raised the possibility that the ABC conjecture could be conditionally proven subject to strong enough versions of the generalized Riemann hypothesis and the Beilinson-Bloch conjecuture.
That is to say:

$$\text{GRH} + \text{Motive Generalization of BSD} + \delta \implies \text{ABC}.$$

Where $\delta$ is something a bit vague, but there is optimism that it can be formulated and proven "in the near future."

A: I am pretty sure that the answer to the question is no: no two of those big conjectures are known to imply the third.  But I feel somewhat sheepish giving this as an answer: what evidence can I bring forth to support this, and if nothing, why should you believe me?
The only thing I can think of is that in the function field case, ABC and GRH are fully established, but only parts of BSD are known.
(Maybe I should also admit that I didn't know anything about the connection between ABC and bounds on Shafarevich-Tate groups of elliptic curves in terms of the conductor until I glanced just now at the paper of Goldfeld the OP linked to.  The fact that you can build examples of large Sha from triples of integers with large ABC exponent is amazing to me.)
Addendum: I feel especially confident that ABC and GRH do not imply BSD, at least not the part of BSD that asserts finiteness of Shafarevich-Tate groups.  The first two conjectures are essentially analytic in nature, whereas the finiteness of Sha is deeply arithmetic.  It seems extremely unlikely.
Moreover, ABC is really hard, in the sense that for all of the results of the form "X implies ABC" that I've ever seen, X includes a statement which is ABC-like in the sense that it gives a uniform bound on one arithmetic quantity in terms of another.  For example, ABC is known to be of a similar flavor to the Szpiro Conjecture (and implies it), but so far as I know it is only known to be implied by a more-explicitly-ABC-like Modified Szpiro Conjecture.  Admittedly bounding Sha in terms of the conductor, as in Goldfeld's work, is only vaguely ABC-like, but to an arithmetic geometer like me these bounds still feel very "analytic"; I can't see any connection at all between this and BSD.  So I doubt that GRH (let me say ERH, so that I more or less know what I'm talking about -- i.e., Dedekind zeta functions) plus BSD is known to imply ABC.

A: Granville and Tucker's piece in the AMS Notices from 2002 doesn't contain a mention of such a result, so if something like this is true it would have been recent.  It does mention that ABC implies that certain L-functions have no Siegel zeroes, which is weaker than, but related to, GRH.

A: To my surprise, there is another conjecture (C1) bounding Sha by the conductor of an elliptic curve.
C1 + BSD (for rank 0 curves only) implies ABC with exponent 3
C1 (for rank 0 curves only) + GRH implies ABC.
The paper p.10
Conjecture 1 (C1) $|Ш| < \kappa(\epsilon) N^{\frac12 + \epsilon}, (N \to \infty)$
$N$ is the conductor.
The implications are on page 11.


text:
Q: Unable to consume web service I published a simple Hello World web service in an ASP.Net web service project.I closed this project and opened another console based project to consume this web service. The problem is I cannot discover this web service to add reference.When I paste the url, I get the following error
    There was an error downloading 'http://localhost:65436/Service1.asmx/_vti_bin/ListData.svc/$metadata'.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it 127.0.0.1:65436

I am using Visual Studio Ultimate 2013, I don't have IIS server installed.
UPDATE- : I created a new Console based project in the existing solution and it works fine.But the problem is how do I run this console project,when I click the debug button, it deploys it on browser.I simply printed the string output returned by web method,I need to see this output on console.

A:
I closed this project and opened another console based project to consume this web service. The problem is I cannot discover this web service to add reference.

Because the web service is not running. Web service references can only be generated when the metadata is available.
You can either:

*

*Run two instances of Visual Studio, one for the web service and one for the client

*Put a service and client project in one solution.

Also, you shouldn't use ASMX for new development. Take a look at WCF and WebAPI.

A: Sometimes it happens to me too. I press F5 to start debugging the web service, immediately stop debugging, and then try to update the web reference again. Usually it helps.

A: you can deploy the web service on IIS then consume it in console application.


text:
Q: Line Smoothing in Tableau I have a 3 point line chart in Tableau with 5 series.  I would like to make the lines smoother instead of sharp angles.  Any suggestions would be greatly appreciated.  Tried moving average- but not enough data points to do it.

A: You can use TabPy and interpolation to achieve smooth lines in Tableau:
https://community.tableau.com/s/question/0D54T00000G54nZSAR/how-to-create-a-smoothed-line-chart-with-tableau-python-detailed-guide
Curved vs Original

A: For a n-point line chart (for you n=3)

*

*Right click vizualiztion -> Trend lines -> Show trend lines

*Right click vizualiztion (again) -> Trend lines -> Edit trend lines

*In pop-up window select Polynomial, Degree with n - 1 (for you 2)
degrees

*Click OK

Resulting trend line will be smooth and pass through all n points of your viz.
Now change vizualization type from line to circle (on a Marks shelf)


text:
Q: Loop through XML result (a list) getting more details from another XML request OK I have manage to cobble together 2 XML requests that return the info I would like to ultimately put into a CSV. I need some help to loop one over the other, I have tried various For Each loops etc. but I just don't seem to get it to work. I'm not sure if there is a better / more efficient way to make the request, any suggestions welcome.
$username = "abc"
$password = "mypassword"
$encoded =  [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($username+":"+$password ))
$headers = @{Authorization = "Basic " + $encoded}

$ConnectionURI = "https://api.myisp.net/xml/stable/ListConnections.php?liveorceased=live&fields=Customer Ref"
$GetConnections = Invoke-RestMethod -Uri $ConnectionURI -Headers $headers
$ConnectionList = $GetConnections.ResponseBlock.Response.OperationResponse.ADSLAccount
$ConDetailsURI = "https://api.myisp.net/xml/stable/AdslAccount.php?ref=" + $Connections

$details = Invoke-RestMethod -Uri $ConDetailsURI -Headers $headers
$details.ResponseBlock.Response.OperationResponse.ADSLAccount |
    Select OurRef, Telephone, NAT, IPAddress, FullUsername, Status, CBUK,
           Downstream, Upstream

$ConnectionList returns the following:

CustomerRef
-----------
ADSL123456
ADSL789101
ADSL000001
ADSL007111
ADSL111111
ADSL222222
ADSL333333
ADSL444444
ADSL555555
ADSL666666
ADSL777777
ADSL888888
ADSL999999

Which I would like to request the details for from https://api.myisp.net/xml/stable/AdslAccount.php?ref=" + $ConnectionList.
An example of the $details returned:

OurRef       : ADSL123456
Telephone    : 0123456789
NAT          : Y
IPAddress    : 70.1.2.3
FullUsername : 0123456789@vmyisp.net
Status       : Installed
CBUK         : BBEU21234561
Downstream   : 80Mbit/s
Upstream     : 20Mbit/s


text:
Q: How to configure asp.net mvc route for the url "http://localhost:1234/#/animal" I'm trying to configure a route for the url pattern "http://localhost:1234/#/animal"
Basically I want different actions to be executed for "http://localhost:1234" and "http://localhost:1234/#/animal"
So I added a route like below.
routes.MapRoute(
                name: "DefaultHashed",
                url: "#/{id}",
                defaults: new { controller = "Default", action = "HashedIndex", id = UrlParameter.Optional }
            );

But it still uses the Default route shown below and not DefaultHashed route. What am i missing?
routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Default", action = "Index", id = UrlParameter.Optional }
            );

Edit:
This is an ASP.NET MVC with Angular SPA. The Index action of default controller is shown below.
 public ActionResult Index(int id)
        {
            if (User?.IsAuthenticated)
            {
               return View("/dist/Index.cshtml");
            }
            return RedirectToAction("SignIn", "Authentication");
        }

Here I want to redirect to external url if the posted url is  "http://localhost:1234". if not I should load the angular page.


text:
Q: Data sets for realistic random/test data generation Where to get data sets for random or test data generation, such as names/surnames with distribution, address data, university/school names, company names etc.?
I've found the list of English names and surnames, with the count of them (unfortunately I haven't noted from where I got that). I got address database from Poland.  However these data sets from other countries would also be very useful for me. So with university and school names.
What data do you need as source for such information? Could you provide links to such data? (of course, only those who are free publicly available)

A: There are many open source and commericial test data generators on internet. Below 2 are good ones

*

*http://www.sqledit.com/dg/

*http://www.generatedata.com/#about

*for random numbers/strings: http://www.random.org/

A: I think you will find answer to your question in following topics:
Sample database for exercise
https://stackoverflow.com/questions/202092/where-can-i-find-free-and-open-data

A: Amazon has made several public data sets available for free download:
http://aws.amazon.com/publicdatasets/

A: Try http://www.mockaroo.com
You can generate up to 100,000 rows of data in CSV, tab-delimited and SQL formats, save & reuse schemas, and automate test data generation using curl.

A: There is a free API at http://randomprofile.com/api-for-developers/ for generating test user profiles which include name, surname, address, bank info, CC number, blood type etc. Not sure about the schools, but useful if you're looking after data on Asian users.


text:
Q: enumerate in multicols The following image illustrates what am looking for:

Essentially I want the numbering to occur as shown above but using the multicol and enumitem package. But when I try it by using the following code:
\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{enumitem,multicol}
\begin{document}
\begin{enumerate}
\item Evaluate each of the following if $x$ is a non-zero real number.
    \begin{multicols}{2}
    \begin{enumerate}[itemsep=1cm]% The item sep is my choice here.
    \item $\dfrac{|x|}{x}$
    \item $\dfrac{x}{|x|}$
    \item $\dfrac{|-x|}{-x}$
    \item $|x|-|-x|$
    \end{enumerate}
    \end{multicols}
\end{enumerate}
\end{document}

I get:

Essentially, I want the (b) to be where the (c) is. I know this has been done but I can't seem to find it.

A:
\documentclass{article}
\usepackage{amsmath,amssymb}
%\tracingall
\def\horizlist#1#2#3{%
  \setcounter{enumi}{0}%
  #3%
  \flushleft
  \dimen0 \linewidth
  \divide\dimen0 by #1\relax
  \advance\dimen0 -#2\relax
  \def\item{\hfil\egroup\penalty50 \hfill
  \refstepcounter{enumi}%
  \leavevmode\hbox to \dimen0 \bgroup\space(\theenumi)\space}%
  \leavevmode\bgroup\hskip 0pt plus -1fill }

\def\endhorizlist{\hfil\egroup\endflushleft}

\begin{document}
\begin{enumerate}
\item Evaluate each of the following if $x$ is a non-zero real number.
    \begin{horizlist}{2}{1cm}{\renewcommand\theenumi{\alph{enumi}}}
    \item $\dfrac{|x|}{x}$
    \item $\dfrac{x}{|x|}$
    \item $\dfrac{|-x|}{-x}$
    \item $|x|-|-x|$
    \end{horizlist}
\end{enumerate}
\end{document}

To see what is happening here, if you want the numbering to go right-left before down that is normal paragraph word order so the thing to do is just make a series of boxes of fixed width If they are (say) 1/3 of text width and you makes a paragraph of such boxes in a flush left paragraph then Tex will naturally wrap the paragraph with three boxes on a line and they will align vertically as they are all the same width. the rest of the code just increments a counter and puts (\the...) at the front of the box, and hides the \makebox[0.3\textwidth]{...} syntax to use the standard \item syntax so it is easy to switch between list types.
In other words compare to the following which is the same apart from cosmetic syntax changes.

\documentclass{article}

\begin{document}
\begin{flushleft}

\makebox[.3\textwidth][l]{one one}
\makebox[.3\textwidth][l]{two 2 two 2 two}
\makebox[.3\textwidth][l]{three three 3}
\makebox[.3\textwidth][l]{4 4 4 4 4 }
\makebox[.3\textwidth][l]{fifth box}
\makebox[.3\textwidth][l]{number 6}
\makebox[.3\textwidth][l]{7 7 7 7 }
\makebox[.3\textwidth][l]{eight}
\makebox[.3\textwidth][l]{nine nine}
\makebox[.3\textwidth][l]{10}

\end{flushleft}
\end{document}

Even though the result has the appearance of being in three columns, it is just a typeset paragraph with the alignment being automatic as each "word" in the paragraph is a box of equal size.

A: Here is an option using the defined \newitem command. The contents is set in a \parbox that naturally flows left-to-right, providing the enumeration in the style you're after:

\documentclass{article}
\usepackage{amsmath,amssymb}% http://ctan.org/pkg/{amsmath,amssymb}
\usepackage{enumitem,multicol,setspace}% http://ctan.org/pkg/{enumitem,multicol,setspace}
\newcounter{subenum}[enumi]
\renewcommand{\thesubenum}{\alph{subenum}}
\newcommand{\newitem}[1]{%
  \refstepcounter{subenum}%
  \parbox{\dimexpr.5\linewidth-.5\columnsep}{%
    \makebox[\labelwidth][r]{(\thesubenum)\hspace*{\labelsep}}%
    #1}\hfill%
}
\begin{document}
\begin{enumerate}[start=8]
  \item Evaluate each of the following if $x$ is a non-zero real number.
    \begin{multicols}{2}
      \begin{enumerate}[itemsep=1cm]% The item sep is my choice here.
        \item $\dfrac{|x|}{x}$
        \item $\dfrac{x}{|x|}$
        \item $\dfrac{|-x|}{-x}$
        \item $|x|-|-x|$
      \end{enumerate}
    \end{multicols}
  \item Evaluate each of the following if $x$ is a non-zero real number.\par
    \setstretch{3}%
    \newitem{$\dfrac{|x|}{x}$}
    \newitem{$\dfrac{x}{|x|}$}
    \newitem{$\dfrac{|-x|}{-x}$}
    \newitem{$|x|-|-x|$}
\end{enumerate}
\end{document}

Spacing consideration is provided by setspace and can be tweaked (also removing some additional "\topsep" white space, if needed).

For a slightly more automated approach to changing the number of columns, add
\usepackage[nomessages]{fp}% http://ctan.org/pkg/fp

to your document preamble, and use
\FPeval\thecolwidth{round(1/4:4)}% Specify number of columns -> column width
\newcommand{\newitem}[1]{%
  \refstepcounter{subenum}%
  \parbox{\dimexpr\thecolwidth\linewidth-.5\columnsep}{%
    \makebox[\labelwidth][r]{(\thesubenum)\hspace*{\labelsep}}%
    #1}\hfill%
}

as your definition for \newitem. Modify 1/4 to 1/<col nums> to increase the number of columns.

A: This is easy with the exsheets package and the tasks package. The following example hopefully is self-explaining:
\documentclass{article}
\usepackage[T1]{fontenc}

\usepackage{mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}

\usepackage{exsheets}% loads the `tasks' package
\SetupExSheets{
  headings = runin-nr
}
\settasks{
  counter-format = tsk[a]. ,
  label-format = \sffamily\itshape\bfseries
}

\setcounter{question}{43}% only for this example

\begin{document}

\begin{question}
  Evaluate each of the following if $x$ is a non-zero real number.
  \begin{tasks}(2)
    \task $\dfrac{\abs{x}}{x}$
    \task $\dfrac{x}{\abs{x}}$
    \task $\dfrac{\abs{-x}}{-x}$
    \task $\abs{x}-\abs{-x}$
  \end{tasks}
\end{question}

\end{document}

A: Here is another solution which does not have to define a new \item command.
\documentclass[12pt,a4paper]{article}
\usepackage{amsmath,amssymb}%for \dfrac
\usepackage[inline]{enumitem}%for enviroment enumerate*
\usepackage{tabto}%for \tab and \NumTabs
\begin{document}
\begin{enumerate}[start=44]
\item Evaluate each of the following if $x$ is a non-zero real number.\\
  \NumTabs{2}
  \begin{enumerate*}[itemjoin=\tab]
  \item $\dfrac{|x|}{x}$
  \item $\dfrac{x}{|x|}$
  \item $\dfrac{|-x|}{-x}$
  \item $|x|-|-x|$
  \end{enumerate*}
\end{enumerate}
\end{document}

Here is what the solution looks like

The command \NumTabs{2} is a to specify that there should be two tab stops,
this uses the current value of \linewidth
to create tab stops for the rest of the document.
Thus if the line width changes and if you need to use tabs,
then it is best to rewrite \NumTabs{2}.
The command \tab makes the text that follows it to be positioned at the next tab stop.
The environment enumerate* is used to create inline lists,
thus I put a \\ after "is a non-zero real number."
The option itemjoin is used to specify what comes between the items,
in this case the command \tab comes in between each item.

A: Here is a boring one that uses the resume functionality of enumitem package. It's not the most efficient as the code starts stops the enumerate environment too much. But the result is acceptable visually. You can introduce all kinds of additional tweaks since it's just a tabular environment.
\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{enumitem}
\newcommand{\Choices}[4]{\begin{tabular}{p{0.5\textwidth} p{0.5\textwidth}}
\begin{enumerate*}[series=lafter]
    \item #1
\end{enumerate*} &%
\begin{enumerate*}[resume=lafter]
    \item #2
\end{enumerate*} \\[2\baselineskip]
\begin{enumerate*}[resume=lafter]
    \item #3
\end{enumerate*} &%
\begin{enumerate*}[resume=lafter]
    \item #4
\end{enumerate*}
\end{tabular}}

\begin{document}
\begin{enumerate}
\item Evaluate each of the following if $x$ is a non-zero real number.

\Choices{$\dfrac{|x|}{x}$}{$\dfrac{x}{|x|}$}{$\dfrac{|-x|}{-x}$}{$|x|-|-x|$}

\item Evaluate each of the following if you can.

\Choices{This question is not answerable (is that a real word?)}
{This question does not have any correct answer}
{$\int_0^\pi{\tan\sqrt\theta d\theta}$}
{Whatever is a valid answer!}
\end{enumerate}
\end{document}


text:
Q: Probability with percentages of population The question goes like this: The American Diabetes Association estimates that 5.9% of Americans have diabetes. Suppose that a medical lab has developed a simple diagnostic test for diabetes that is 98% accurate for people who have the disease and 95% accurate for people who do not have it. If the medical lab gives the test to a randomly selected person, what is the probability that the person has diabetes given a positive test?
I'm not exactly sure where to start, but I was thinking about the 98% accurate test of positive for those with diabetes and the 5% inaccuracy of the test stating that you have a positive test when you don't. I do note however that 94.1% of the population don't have diabetes whereas 5.9% do have it, which means that there is a greater stress on the inaccurate test of positive for those that don't have the disease.

A: If the test for those without diabetes has 95% accuracy then
100 - 95 = 5% that may have diabetes with the 2nd test.
If the 1st test that is 95% accurate AND the 2nd test is also given,
assuming that the tests are different then taking the 5.9% from the earlier sentence
I reckon that 5.9% X 95% X 5% = 0.059 X 0.95 X 0.05 = 0.0028025
or approximately 0.0028
very approximately 3 people per 1000 will be positive for diabetes.
However this statement seems a little contradictory
"Suppose that a medical lab has developed a simple diagnostic test for diabetes that is 98% accurate for people who have the disease and 95% accurate for people who do not have it"
as I thought there was only one test for diabetes unless one is a test
for TYPE 1 diabetes and the other a test of TYPE 2 diabetes.
So my answer is based on the assumption of two separate tests.


text:
Q: Custom variantion wp7 slider How would you guys go about creating a slider where the thumb stays centered, but the image or background of the slider slides with a slide gesture.
The only real example I could find is here, in the second screenshot:
http://www.windowsphone.com/en-US/apps/5ffe35e4-8e43-e011-854c-00237de2db9e
Basically the slider "thumb" would stay in place, but the numbers on the scale move with a finger swipe.
Just looking for some direction here on how you would approach this. What control would you recommend I start with? Or would it be easier to create a custom control?

A: I haven't tried it but a slider might be too hard because of the way it is constructed; the area/scale that you want to slide consists of two repeat buttons and those do not easily slide. So it might be best to NOT use the slider because the code of the Slider class expects these template parts to be present.
I'd try with plain, templated control. The thumb is pure decoration. I'd add the 'scale' in a scrollview without scrollbars.


text:
Q: Magento template/layout how to make changes to product view
Possible Duplicate:
Pinpointing the difference and changes made between two pages in magento 1.6.2

http://dokha.co/index.php/shisha-tobacco/al-fakher-shisha-tobacco-108.html
As you can see from the link above the product page is disorganized to some degree.
I have made some modifications below, in firebug, and took a screenshot. Can anyone advise on how to put these changes into effect?

A: You are trying to move up the "Select a Flavor" block?
Look at the source and delete the DOM node

. I use google Chrome browser because it is very easy to do things just like this. I right-clicked on Select a Flavor then selected Inspect Element. In the lower pane, I navigated up until the clearer block and deleted that.

A: To make the css changes to your page. Please create a custom.css file in the skin/frontend/yourfolder/css/custom.css and add the styles which you made in the browser.
Personally, I use Google Chrome browser to make changes to the page and then copy into the customised .css file.
It is always best practise not to replace in the default .css but use a customised version, so you have a version of the original file.
Hope it helps.
Cheers


text:
Q: How does Python 3 convert instances of custom types into dict keys? How is an instance of a custom type (i.e. a user-written class) converted to a dict key in Python 3?
Consider for example the following code, where a class has a single variable that should define whether instances are alike:
class MyClass:
    def __init__(self, x):
        self.x = x

d = {MyClass(1): 1}
assert d[MyClass(1)] == 1

The assert fails because the two different MyClass instances don't resolve to the same dict key, even though they are alike.

A: To make custom types usable as dict keys, they must define __hash__ and __eq__. I don't know if this is documented anywhere, I wasn't able to find any definition at least, but I've been told so informally:
class MyClass:
    def __init__(self, x):
        self.x = x

    def __hash__(self):
        return hash(self.x)

    def __eq__(self, rhs):
        return rhs.x == self.x

d = {MyClass(1): 1}
assert d[MyClass(1)] == 1


text:
Q: What well-known objects have this as their symmetry group? I'm currently working with a geometric object that has a symmetry group isomorphic to the direct sums of three cyclic groups of order two, i.e.,
$$\mathbb{Z}_2\oplus\mathbb{Z}_2\oplus\mathbb{Z}_2,$$
so it is generated by three reflections.
I'm wondering if any other, well-known and well-studied objects have this as their symmetry group as well?
Thank you.

A: A rectangular box will do.
The points $(a,b,c,d),(a,b,d,c),(a,b,-c,-d),(a,b,-d,-c)$ form a rectangle in the $c-d$ plane, as four points on a hyperbola $cd=constant$.
Another four points happen with $a$ and $b$ swapped; the vector from one rectangle to the other is $(b-a,a-b,0,0)$ Which is perpendicular to the rectangles.
The set $V=\{(w,x,y,z)|w=a,x=b\}$ is a plane in $\mathbb{R}^4$.
The intersection of $V$ with $S$ is a region bounded by the hyperbola $yz=ab$.
This hyperbola has the symmetries of  a rectangle. It only has the symmetries of a square if $ab=0$.


text:
Q: Laravel returning null value with where method (if variable is passed) I'm trying to use a where method in laravel query. i have a string containing two values (separated by comma). I need to search with value that is after the comma. So i used explode php function to make an array . So I get an array containing two key-value pairs. i want to use 2nd value to search database. So i'm storing the second value in a variable and then passing that variable in the where method. But it's returning blank collection object
Here's the code
$vehicles_name_trim_ar = explode(',', Input::get('vehicles_name_trim'));

print_r of $vehicles_name_trim_ar is
    Array
    (
        [0] => A3
        [1] =>  2.0T Premium Automatic
    )

//storing both values in seperate variable
$model_name = $vehicles_name_trim_ar[0];
$model_trim = $vehicles_name_trim_ar[1];

$model = Model::where('model_trim', $model_trim)->get();

It's returning blank result. However if i'm proving static value, it return the result
$model = Model::where('model_trim', "2.0T Premium Automatic")->get();

What am i doing wrong?

A: You have a space at the start of the second value. try this:
$model_name = trim($vehicles_name_trim_ar[0]);
$model_trim = trim($vehicles_name_trim_ar[1]);


text:
Q: How to write a app to connect an Android device to a host USB GPS device I have a standalone GPS enabled data recorder in my car that can function as either a USB host or device. (Its a class 0x00h USB device). I currently connect to it via a WM 6.5 app running on my Palm Treo 750.
I would like to port my WM 6.5 app to an Android phone.  (I don't have a specific Android phone in mind, I would like it to be as generic as possible).
Replicating the GUI is not that difficult, but I am having trouble getting started on the USB communication.
I'd appreciate it if someone could point me towards an example, or the appropriate tutorial.
Thanks

A: You probably cannot do this without modifying the android installation on the phone or modifying the GPS.
Three methods come to mind:
a) modify the GPS so that in host mode it can talk the android ADB protocol and do something like driver the adb shell or simulate an adb port forward to talk to the appliction on the phone
b) modify the android installation to support an additional usb target capability already supported by the gps, such as emulating a usb-serial converter or emultaing your wm phone.
c) modify the android installation to function as a usb host, and compile in a usb driver for the gps previously tested on a desktop linux
a requires in depth development for the gps, b & c require rooting the phone
oh, one more:
d) Get a usb-target microcontroller board with bluetooth.  Plug into the GPS and implement a target interface that the GPS host can talk to.  Use serial over bluetooth to talk to the phone.


text:
Q: Im attempting to create a search page for users to search other users throughout the database, but app keeps crashing When i press the button to get to my search page the app crashes and returns
"libc++abi.dylib: terminating with uncaught exception of type NSException"
I'm still new to coding and I'm not sure what I'm doing wrong
 @IBOutlet weak var SearchTable: UITableView!

    var userArray = [NSDictionary?]()
    var filteredUsers = [NSDictionary?]()

    var dataRef = Database.database().reference()

    let searchController = UISearchController(searchResultsController: nil)

    override func viewDidLoad() {
        super.viewDidLoad()

        searchController.searchResultsUpdater = self
        searchController.dimsBackgroundDuringPresentation = false
        definesPresentationContext = true
        tableView.tableHeaderView = searchController.searchBar

        dataRef.child("users").queryOrdered(byChild: "username").observe(.childAdded, with: { (snapshot) in

            self.userArray.append(snapshot.value as? NSDictionary)

            self.SearchTable.insertRows(at: [IndexPath(row: self.userArray.count-1, section: 0)], with: UITableView.RowAnimation.automatic)

        }) { (error) in
            print(error.localizedDescription)
        }

    }

    // MARK: - Table view data source

    override func numberOfSections(in tableView: UITableView) -> Int {
        // #warning Incomplete implementation, return the number of sections
        return 1
    }

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

        if searchController.isActive && searchController.searchBar.text != "" {
            return filteredUsers.count
        }
        return self.userArray.count
    }

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "SearchCell", for: indexPath)

        let user : NSDictionary?

        if searchController.isActive && searchController.searchBar.text != "" {
            user = filteredUsers[indexPath.row]
        } else {
            user = self.userArray[indexPath.row]
        }

        cell.textLabel?.text = user?["username"] as? String

        return cell
    }

    func updateSearchResults(for searchController: UISearchController) {

        filterContent(searchText: self.searchController.searchBar.text!)

    }

    func filterContent(searchText:String)
    {
        self.filteredUsers = self.userArray.filter{ user in

            let Uname = user!["username"] as? String

            return(Uname?.lowercased().contains(searchText.lowercased()))!

        }

        tableView.reloadData()
    }

}

I'm expecting for the page to open and i have the ability to search with the search bar. the error message i receive is
libc++abi.dylib: terminating with uncaught exception of type NSException

A: This problem has nothing to do with Firebase. From the comment you have written under your question, you pasted this console message instantiated view controller with identifier "UIViewController-vhH-By-pea" from storyboard "Main", but didn't get a UITableView.'. I believe you have hooked up a UIViewController screen from the Storyboard with a UITableViewController class. This is wrong, you need to change your class to be a subclass of UIViewController instead of UITableViewController. Then, set the SearchTableView's delegate and dataSource to it.
So, your class should be:
class MyViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, ... {

Then set the TableView's delegate and dataSource to self in the viewDidLoad method:
override func viewDidLoad() {
    super.viewDidLoad()
    // ...
    SearchTableView.dataSource = self
    SearchTableView.delegate = self
    // ...
}

By the way, if your Controller only have a UITableView in it and nothing else, then, you may want to consider using a UITableViewController instead of a UIViewController with a UITableView. UITableViewController is esseentially a UIViewController with a UITableView being the main view on it, so no need to redo all the work :)


text:
Q: SELinux rules for i2c files in sysfs in Android I created kernel driver as loadable module for one of my I2C devices. The driver creates few sysfs file under I2C corresponding folder (/sys/devices/i2c/i2c-0/0-0008/) using instantiation through new_device file (/sys/devices/i2c/i2c-0/new_device).
Lollipop enforced SELinux so I need to create rules for my applications that need access to the device's sysfs file. Mostly these are system applications (they fall into definition of platform_app in the Android SELinux). Problem is that applications in any application domain are not allowed to write to sysfs files:
neverallow { appdomain -bluetooth -nfc }
    sysfs:dir_file_class_set write;

So I decided to create file context exclusively for my device:
file_context:

/sys/devices/i2c-0/0-0008(/.*)?                     u:object_r:sysfs_mydeviceic:s0

The result is interesting: default driver files and folders like name and uevent etc. get the proper context but not the files created by the sysfs part of the I2C driver:
root@android:/sys/devices/i2c-0/0-0008 # ls -Z
--w--w--w- root     root              u:object_r:sysfs:s0 data
lrwxrwxrwx root     root              u:object_r:sysfs_mydeviceic:s0 driver -> ../../../bus/i2c/drivers/mydevice
-rw-rw-rw- root     root              u:object_r:sysfs:s0 locked
-r--r--r-- root     root              u:object_r:sysfs_mydeviceic:s0 modalias
-r--r--r-- root     root              u:object_r:sysfs_mydeviceic:s0 name
drwxr-xr-x root     root              u:object_r:sysfs_mydeviceic:s0 power
-rw-rw-rw- root     root              u:object_r:sysfs:s0 protection
-rw-rw-rw- root     root              u:object_r:sysfs:s0 state
lrwxrwxrwx root     root              u:object_r:sysfs_mydeviceic:s0 subsystem -> ../../../bus/i2c
-rw-r--r-- root     root              u:object_r:sysfs_mydeviceic:s0 uevent

I'm looking for help how to proceed with this problem: if I still want to convert sysfs context into sysfs_mydeviceic for the rest of the files, then how to do this? Or is there other way to enable writing to sysfs files by the applications?

A: I ran into the same problem when porting some drivers to Android 5. It seems that not all sysfs files are put into the correct selinux context. This only seems to happen for devices instantiated dynamically though new_device.
The solution for me was to trigger selinux to restore the file contexts using restorecon(8).
In the same script you use to instantiate your device, execute the following command:
restorecon -r /sys/devices/i2c-2/

The -r flags tells restorecon to work recursively. If you prefer, you can also list every file individually.
If you use tha Android init scripts (such as /init.rc), there is another command available:
restorecon_recursive /sys/devices/i2c-2/

Again, there is the restorecon command which only restores single files.
See the SEAndroid documentation for details.


text:
Q: What accounts to use when installing SQL Server 2008 Developer I am installing SQL Server 2008 Developer here, and on the Server Configuration step of the installation it asks me about Service Accounts. What do I choose here?
I can see the available ones in the screen shot, although on most of them I can only select two or three of those. When I click the Use the same account for all SQL Server 2008 services button I can choose between NT AUTHORITY\NETWORK SERVICE and NT AUTHORITY\SYSTEM.
What do I choose here, and why?

A: From Microsoft:

Local System account. The name of this
  account is NT AUTHORITY\System. It is
  a powerful account that has
  unrestricted access to all local
  system resources. It is a member of
  the Windows Administrators group on
  the local computer, and is therefore a
  member of the SQL Server sysadmin
  fixed server role
Network Service account. The name of
  this account is NT
  AUTHORITY\NetworkService. It is
  available in Microsoft Windows XP and
  Microsoft Windows Server 2003. All
  services that run under the Network
  Service account are authenticated to
  network resources as the local
  computer.

So unless you need your Dev SQL Server to use Network Services, you can use Local System account.
Update:
To Configure your surface area go Start->Microsoft SQL Server->Configuration Tools->SQL Server Surface Area Configuration.
Thats how you setup for incoming connections. Also make sure the SQL Browser server is running.
I would also recommend either SQL 2005 for Dummies or SQL Server 2005 Bible to do some study on some of the basic stuff of SQL Serve. The bible will also go more indepth should you be beyond the dummies type book.

A: If you want to play it safe, make a local account like "SQLServices" on your machine, with no special rights or access. Then install SQL and choose that account, and the SQL installer will add only those rights that the service account requires. I do it this way so that the service account will have only minimal OS rights.


text:
Q: Ajax vs webservices what is different between ajax and webservices. Anybody provide with some examples?

A: It's nonsensical to compare these things.
"Ajax" is a process that occurs in the browser. It is the act of calling some local server-side page, without refreshing the "main" viewing area, and then doing various things with that result (grabbing the data, making changes, changing the existing DOM (adding elements), whatever).
Webservices are a Serverside-thing that allows you to call methods, in your code, but have that call actually go to a remote machine. The call to the Webservice is generally also made server-side.

A: The term "Ajax" is generally used :

*

*When the request is sent by a browser (client-side) to a server

*When the transfered data is XML or JSON or HTML.

The word "webservice" is generally used :

*

*When the request is sent by a server to another server, without a browser being involved

*When the transfered data is SOAP -- at least when it's a SOAP webservice ^^ (Opposed to REST, for instance, which generally doesn't imply SOAP)

But I'd say that Ajax is basically some specific kind of webservice.

A: i think ajax and web services are kind of similar, here is why i think so.
as i understood it, in your app sometimes you will have to implement an "API" which has several useful functions. and it is those functions which are called "web services". these 'functions' acts in response to the http requests and "does" something with the data provided.
in ajax siimilar kind of work happens as well,just through javascript thats it.
so, to sum it all up, an API has 'web services' within it, and ajax behaves like 'web services'. in this manner, yes i think it is correct to call ajax and web services similar.


text:
Q: Resolvent R(1) of the Laplace operator not compact I want to show that $$R_\Delta(1):=(1-\Delta)^{-1} $$ is not compact in $\mathbb{R}^3$.
I have found that for $\chi_{B}$ being the characteristic function for a set $B\subset\mathbb{R}^n$, $\chi_{B}(1-\Delta)^{-1}$ is compact since it has kernel $$K(x,y):=\chi_B(x)\frac{e^{-||x-y||}}{4\pi||x-y||},$$ which is clearly $K\in L^{2}(\mathbb{R}^3\times\mathbb{R}^3)$.
Theorem 9.14 in "Introduction to Spectral Theory" states that if an integral operator on $L^2(\mathbb{R}^n)$ has a Kernel in $L^2(\mathbb{R}^{2n})$, then the operator is compact. But shouldn't $(1-\Delta=^{-1}$ then not be compact too, since it has the same Kernel without the $\chi_B(x)$? Or am I too tired to see why this characteristic function decides upon $K\in L^{2}(\mathbb{R}^3\times\mathbb{R}^3$)?

Computing $\sigma((1-\Delta)^{-1})$ with Fourier transform gives me
$$(F(1-\Delta)^{-1}F^{-1}\phi)(k)=(1+||k||^2)^{-1}\phi(k)$$
so the spectrum is the same as the multiplication with $(1+||k||^2)^{-1}$. This means the spectrum would be $(0,1]$, a contradiction to $(1-\Delta)^{-1}$ compact since $0\not\in \sigma((1-\Delta)^{-1})$ (and since it is bounded but not closed?). But I could still apply Theorem 9.14?
Edited for clarity.

A: Thanks to the comments of Branimir I got it now:
So $\Delta$ is locally compact, since we can write $(\chi_B(x)R_\Delta(1)f)(x)$ as$$(\chi_B(x)R_\Delta(1)f)(x)=\int\underbrace{\chi_{B}(x)\frac{e^{-||x-y||}}{4\pi||x-y||}}_{:=K(x,y)}f(y)dy,$$
where $K(x,y)\in L^2(\mathbb{R}^6)$. This can be seen by transforming $w=x-y$ and then going to spherical coordinates. In $\mathbb{R}^3$ this gives a factor $r^2$ in the integral, so the whole thing stays bounded.
With this we have shown with Theorem 9.14, that $\chi_B(x)R_\Delta(z)$ is compact for a $z\in\rho(\Delta)$ (and therefore for all $z\in \rho(\Delta)$ (first resolvent identity)). So $\Delta$ is locally compact.
Now if we look at $R_\Delta(1)$, the theorem cannot be applied, since the kernel here will be just $K(x,y)=\frac{e^{-||x-y||}}{4\pi||x-y||}$ which is not in $L^2(\mathbb{R}^6)$ (the characteristic function IS needed), the theorem can therefore not be applied.
One can even show that $R_\Delta(1)$ is not compact, since as seen in the post, $\sigma(R_\Delta(1))=[0,1]$ which is not discrete. This is a contradiction to $R_\Delta(1)$ being compact.
Thanks for the help!


text:
Q: Edit user - ms access I have a Login system which connects to a table called Employees. I now require to make an edit user form that allows me to edit the username or password of the person logged in.
i have tried using
 Me.UserName = Nz(DLookup("Username", "Employees", "Username='" & TempVars("EmployeeType2") & "'"), "")

 Me.Password = Nz(DLookup("Password", "Employees", "Username='" & TempVars("EmployeeType2") & "'"), "")

But this does not allow the changes to be saved.
How would I make it so that this tempvar 9username and password) are editable in text format?
here is a the code of how my login works.
Option Compare Database
Option Explicit

Private Sub ButtonLogin_Click()
 Dim rs As Recordset

Set rs = CurrentDb.OpenRecordset("Employees", dbOpenSnapshot, dbReadOnly)

rs.FindFirst "UserName='" & Me.TxtUsername & "'"

If rs.NoMatch Then
    Me.LblWronguser.Visible = True
    Me.TxtUsername.SetFocus
    Exit Sub
End If

Me.LblWronguser.Visible = False

If rs!Password <> Nz(Me.Txtpassword, "") Then
    Me.LblWrongpass.Visible = True
    Me.Txtpassword.SetFocus
    Exit Sub
End If

Me.LblWrongpass.Visible = False

TempVars("EmployeeType") = rs!EmployeeType_ID.Value
TempVars("EmployeeType2") = rs!UserName.Value

DoCmd.OpenForm "Home"
DoCmd.Close acForm, Me.Name

End Sub

A: To set the TempVars use below:
TempVars("EmployeeType") = Me.UserName.Value
TempVars("EmployeeType2") = Me.Password.Value


text:
Q: Why is my USB drive treated as an internal hard disk drive? I have a 8 GB Sandisk Cruzer USB drive that I just purchased a few weeks ago. I use two systems, viz Windows XP and Windows 7 Professional. When I connect my drive to Windows 7, it's working properly as an external USB drive; I can remove it by safely remove option. But an issue is arising when I connect it to a Windows XP machine. It's treated as an internal hard drive!! I cannot even safely remove it.
The file system is FAT32. I used other USB drives too, but this is kind of weird; I've never seen this issue.. What is the reason and how can I fix this problem?

A: The file system is not the issue nor is it as what it shows up, that's just a user representation. To avoid file corruption you need to have that drive disable its write caching.
Now, I don't remember the XP path, but it should be in its properties.
Right click the drive > Properties > look for Policies and select Quick removal if it's not already selected.
Under 7 I know it's under Right click the drive > Properties > hardware > select the drive in question > Properties button > Policies tab.
I also have a drive, it's one of those 1,8" pocket USB hard drives. Ideally, it would be best to show up as a removable drive, but it shows up as a plain HDD, which has its advantages when trying to boot up OSes, and it's set for quick removal and formatted with NTFS. I have no issues with it even if most of the times I just yank it out of the USB port whenever I need it.

A: On Windows XP you can change it by opening properties on the device:

*

*Click hardware tab

*Select the USB drive

*Click properties

*Change setings

*Policies tab

*Select Quick Removal

In a simple way, that choice turns off the cache feature on a USB/HDD drive (external). That will make it respond a little bit slower, but you can eject it quickly.


text:
Q: How to achieve a 'hidden' communication between 2 windows phone 8.1 apps I am developing 2 apps in WP 8.1.
One should send requests(I call it "sender") and the other one should answer on them (I call it "receiver"). Both will be installed on the same WP device.
The perfect solution will be the one that user will not see in the UI that some "communication" is happening with different application.
But no matter how I try, the turnstile animation is displayed whenever "sender" hide/get visible.
[I removed splash screen, set transitions to null. However even if I close the receiver immediately (after the LaunchUri was called) I still can see the turnstile animation]
Imagine this example:

*

*"sender":
User will click on "test button" and this code will be called:
await Launcher.LaunchUriAsync(new Uri("myreceiver:giveMeYourSecret"));

*in "receiver"
as the answer on this code:
await Launcher.LaunchUriAsync(new Uri("mysender:MySecretPassword"));

and closes itself.

*in "sender":
MySecretPassword is displayed in some TextBlock.
I know that this example is nonsense. I just need to achieve communication between 2 apps without any "not-wanted animations"(like turnstile).
My Questions:

*

*Is there another way how to communicate between 2 windows phone 8.1 apps than via LaunchUri?

*Is it possible to remove turnstile animation when the app is being resumed/deactivated ?

Thanks for any suggestions :)


text:
Q: Calculator for pi stopping I'm trying to calculate pi with the precision of 10 decimal places. And the efficiency has to be the best(speed and memory allocation). The programming language is C in CodeBlocks.
I don't want to change the formula I'm using:
Problem: after a while, the resulting number stops incrementing but the iteration doesn't stop.
I'm not sure if this is a math problem or some kind of variable overflow.
The resulting number is 3.1415926431 and the number I want to achieve is 3.1415926535.
Every time the incrementation stops at this specific number and the iteration continues. Is there a possibility of an overflow or something?
Now I'm printing out every thousandth iteration (just the see the process) This will be deleted in the end.
notice the
 a = n; a *= 4 * a; is for memory efficiency, there are more similar cuts I did.
code I'm using
#include <stdio.h>
#include <math.h>
#include <time.h>

int main(){
    double time_spent = 0.0;
    clock_t begin = clock();
    int n=1;
    double resultNumber= 1;
    double pi = 3.1415926535;
    double pi2 = pi / 2;
    double a;
    while(1){
        a = n;
        a *= 4 * a;
        resultNumber *= a / (a - 1);
        n++;

        if (fabs(resultNumber - pi2) < pow(10,-10))
            break;

        if (n%1000==0) {
            printf("%.10f %d\n", resultNumber*2, n);
        }
    }

    clock_t end = clock();
    time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
    printf("The elapsed time is %f seconds", time_spent);
    return 0;
}

You can try it out here:
https://onlinegdb.com/q2Gil1DHdy

A:
Is there a possibility of an overflow or something?

The precision of floating-point numbers is limited.  In a typical C implementation, double has 53 bits of mantissa, which corresponds to about 15 significant decimal digits.  But the range of such FP numbers is much larger than +/- 1015, so when your FP number is large enough, the units digit is not significant.  Then subtracting 1 from it will not produce a different number.  When your a reaches that point, the quotient a / (a - 1) will be identically 1, so multiplying by that will not change the working result.
It's possible that you would get enough additional precision by using long double instead of double.  That might help both in getting you more terms in your product before the problem described above sets in, and also by reducing the relative magnitude of FP rounding errors earlier in the computation.

A: You can rescue a little of the accuracy by the following trick:
4n² / (4n² - 1) = 1 + 1 / (4n² - 1)

For large n, these factors are close to 1 and challenge the floating-point representation. You can use the identity
(1 + a)(1 + b)(1 + c)... = 1 + (a + b + c...) + (ab + ac + ... + bc + ...) ...

So for small terms a, b, c... (when the second order terms disappear), it is more accurate to use the approximation 1 + (a + b + c...), of course summing inside the parenthesis first.