text:
Q: Whats the best way to update the gradient value in QML from C++? In my QML file I have gradient defined as below:
ColorizedRoundedButton
{
   gradient: Gradient
           {
             GradientStop { position: 0.0; color: "#3f5c43" }
             GradientStop { position: 0.33; color: "#113d14" }
             GradientStop { position: 0.66; color: "#023105" }
             GradientStop { position: 1.0; color: "#056508" }
           }
}

So here I want this gradient value to be applied through Stylesheet i.e exactly setting this value from C++.
I have the Style.h file like this:
#include <QLinearGradient>

Q_DECLARE_METATYPE(QLinearGradient)

class Style: public QObject
{
  Q_PROPERTY(QLinearGradient PositiveGradient READ getPositiveGradient WRITE setPositiveGradient)

  QLinearGradient _positiveGradient;
  QLinearGradient getPositiveGradient();
  void setPositiveGradient(QLinearGradient p_grad);
}

With this approach of using the QLinearGradient type as Q_PROPERTY and changing the QML file to:
gradient: style.PositiveGradient

This approach didnt work, I am getting the runtime error as cannot assign QLinearGradient to QQuickGradient*.
Anybody knows the solution for this or any better solution to pass the gradient values between c++ and QML ?

A: Declare Class:
class Style: public QObject
{
    Q_OBJECT

 public:
    explicit Style(QObject *parent = nullptr)
    {}

public slots:
    QStringList stops()
    {
        QLinearGradient gradeint(0, 0, 1, 100);
        gradeint.setColorAt(0, "red");
        gradeint.setColorAt(1, "black");

        QStringList colors;

        for (const auto &g : gradeint.stops())
        {
            colors.append(g.second.name());
        }

        return colors;
    }
};

After you wrote this class register it in main and write in qml:
Rectangle {
id: root

    gradient: Gradient {
        id:gradient
    }

    Component
    {
        id:stopComponent
        GradientStop {}
    }

    Component.onCompleted:
    {
        var stops = Style.stops()

        var stopsList = [];
        var length = stops.length;

        for (let i = 0; i < length; i++) {
            var s1 = stopComponent.createObject(root, {"position": i / length , "color": stops[i]});
            stopsList.push(s1)
        }
        gradient.stops = stopsList
    }
}


text:
Q: jQuery - find the id is existing in iframe condition fails I am generating the iframe and its id dynamically.
Now I have a situation to find if the Id is already existing or not.
My code will be,
function createIframe(intxnId){

    alert("Id is : "+"$('#"+intxnId+"')");

    if($("'#ch"+intxnId+"'").length == 0){
        alert("Creating the new Iframe intxnId is: " +intxnId);
        var iframe = "<iframe id='ch"+intxnId+"' src='" + contexPath + "/HeartChat.html?intxnId="+intxnId+"' class='iframeSize'></iframe>";
        alert("iFrame Details : "+iframe);

        $("#chatMessageArea").find("#messageArea").html(iframe);

    }else{
        alert("ID is already present !");
    }
}

My alert for the dynamic Id is ,

But I got the error as,

Good answers are definitely appreciated !

A: Your jQuery selector is invalid, for some reason it is wrapped in single quotes. Change to:
if($("#ch"+intxnId).length == 0){

Currently your selector evaluates to:
$("'#chXYZ'") // wrong, it should evaluate to $("#chXYZ")

Also, there is no code in your question that could produce the alert shown.

redpajama_set_name: RedPajamaStackExchange


text:
Q: MySQL randomly says SQLSTATE[HY000] [2002] Connection Refused Using PHP, Symfony Framework, MySQL.
Switched to new server.
System randomly triggers SQLSTATE[HY000] [2002] Connection refused. Does this related to server/database setting?
Database setting adjusted:
max_allowed_packet: 268435456


text:
Q: Jquery datepicker, devise and rails 5 I've created additional fields on the Devise customer user registration page.  I was originally using the rails 5 date_field.  However, I've discovered this is not compatible with FF or IE.  I am now in the process of switching to jquery datepicker via the 'jquery-ui-rails' gem.
The gem is working, the calendar pops up and the field is filled with the correct date.  The jquery library requires the rails text_field to be used instead of the date_field.
The problem comes in when you try to save the field.  The form is obviously sending the field as a string, and rails doesn't know what to do with it so it just ignores it and doesn't save it in the database.  The database field is a DateTime.
What is the best/simplest way to convert this string to a date via the "Devise" user model?  Or is there a better approach?  Thanks.


text:
Q: jquery scroll() executing multiple times I'm using jQuery to add a button next to all A>SPAN tags found on a page.  The page itself grows as the user scrolls down, which is why I'm using the Scroll function - I need to continually add the button to the new page sections.
The below code continually adds buttons to the sections that already have buttons on them.  I'm trying to only show one button next to each found tag combination. I've tried every combination I can think of.  I'm hoping someone has an easy solution I can try.
Thank you.
$(window).scroll(function () {
  if (!$("a span button").length) {
    $("a span").after(
      ' <button type="button" class="btn btn-secondary btn-sm">BUTTON</button>'
    );
  }
});

A: jQuery's .after() inserts a sibling element, not a descendant. For example, if you had

  Text

the result of your code would be

  Text
  <button>BUTTON</button>

This doesn't match your selector "a span button" because the <button> is not a descendant of the .
I would instead add some property or class to the  to identify that it has been button-ised, then you can omit those elements in your selections
$(window).scroll(() => {
  $("a span:not(.buttonised)").each((_, span) => {
    $(span)
      .addClass("buttonised")
      .after(
        $("<button>", {
          class: "btn btn-secondary btn-sm",
          text: "BUTTON",
          type: "button",
        })
      );
  });
});


text:
Q: mailto links not working in Chrome and Safari Mobile In my jQuery Mobile App, I have a mailto link, its href attribute is dynamically generated and it is 'clicked' via jQuery.Here is the link code:
This is the mailto
link

A click handler is attached to it like this:
$('#mailLink').bind('click', function() {
window.location.href = $(this).attr('href');
});

Lastly,a function creates the href attribute for the link with emailaddress, subject and message body and click is simulated via jQuery:
$emailAddress= ..

$subject= ....
$body=...
$emailString="mailto:"+$emailAddress+$subject+$body;
$emailLink= $("#mealMail");
$emailLink.attr("href",$emailString);
$emailLink.click();

Now, this code is working perfectly in:
Mozilla desktop
Safari desktop
Android
But not working in:
Safari Mobile
Chrome desktop
Any suggestions?

A: After searching for complex solutions, I found a much easier solution by chance. The issue here is that if a mailto link is directly clicked, it works in all browsers, but if it is indirectly clicked, such as via jQuery .click() function, it does not work in all browsers. Therefore, here is my implementation:
This is a mail to link
$emailAddress= ..

$subject= ....
$body=...
$emailString="mailto:"+$emailAddress+$subject+$body;
$emailLink= $("#emailLink");
$emailLink.attr("href",$emailString);

Now, depending upon the context of an application, the href parameter of the link can be setup and when this link is clicked, it works. I have tested in following browers:

*

*Mozilla Firefox Desktop

*Safari Desktop

*Chrome Desktop

*Safari mobile on ipad 1

A: You should not use mailto:
Check if is not better to create a simple "Contact us" form.
But still, take a look at this: i-cant-get-mailto-links-to-open-the-mail-app-from-mobile-safari-when-using-jqto


text:
Q: Use multiple index on seek method VBA How to use multiple index key with equal on first field and greather than on second field.
ex:
on MS Access
Table: Persons(Name[string], Family_name, Age[Int])
Index: Second_key(Name, Age)

on VBA
DIM Name as string
DIM Age as Integer
DIM Table_1 as Recordset

Name = "Tom"
Age = 20

Set Table_1 = Currentdb.OpenRecorset("Persons")
Table_1.INDEX = "Second_key"
Table_1.SEEK "=", Name, ">", Age

and I get error "RUN-TIME error '3421' Type conversion error"
MS Access allows searching by multiple keys, see https://msdn.microsoft.com/en-us/library/bb221096%28v=office.12%29.aspx
Please, help Me.

A: Ignoring your example a bit, because it makes no sense to me why you'd use that specific index for that sort of data, not even mentioning why you'd want to seek through it that way. I'm just assuming that some part of this is an abstract example you worked up just to ask the general question...
Double check the documentation. Recordset.Seek doesn't expect you to use different comparators for each column in a multicolumn index. Instead, it will find the first item that matches for the comparator and all values specified. You'd want to replace your current code with something like Table_1.SEEK ">=", Name, Age which will seek to the first row where Name >= Name and Age >= Age
But that's probably not quite what you wanted to achieve, because it allows Name > Name and Age = Age. So you're probably better off just changing to a SQL query that gives exactly what you wanted, like
SELECT TOP 1 Name, Family_Name, Age
FROM Persons
WHERE Name = [SearchName]
  AND Age > [SearchAge]

then use a QueryDef to get a recordset from this saved, parameterized query like in these examples: https://msdn.microsoft.com/en-us/library/office/ff820966.aspx


text:
Q: An automated process, daily job to save specific SQL Server tables from a specific database into Excel file format I'm new to SSIS and my requirement is to develop an automated process to run on a daily basis in order to save some SQL Server tables from a specific database into Excel file on local system.
I have the following on my machine:

*

*SSIS Business Intelligence

*Microsoft SQL Server Integration Services Designer Version 12.0.2430.0

*Microsoft SQL Server Data Tools 12.0.61021.0

*Visual Studio Professional 2013

*SQL Server 2012 Express edition (free edition doesn't have Import/Export SSIS package wizard)

I have created a SSIS package under SSBI Integration Services using following two approaches
Approach 1: Using File System Task and Data Flow Task
  (Source: https://www.youtube.com/watch?v=BlWlQyIt86g&pbjreload=10)
Approach 2: Using Script task from control flow
  (Source: http://www.techbrothersit.com/2016/03/how-to-export-sql-server-tables-from.html)
SSIS package reads the SQL Server tables and saves output file as Excel file in local folder path. Package is working fine on local Visual Studio. However, I'm having problem when I tried to automate the process by executing the SSIS package either from the SQL Server job agent or from the command prompt to make a bat file.
From the SQL Server job agent: when I load the SSIS package in SQL Server job agent steps from local source, I'm getting

0xC0010014** exception related to LoadFromXML fails please refer the attached file.

I'm not quite sure why I'm getting this exception is this due to me using a free SQL Server version? I couldn't find solution for this.

From the command prompt: I found dtexec in the following paths, latest modified date is with the C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\dtexec.exe

C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn
C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn

I have executed the following command
With DTS path 120:
"C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\dtexec.exe" /File "C:\Users\username\Desktop\DataBackupExcel.dtsx"

results in:

Exception: Code: 0xC000F427
  Source: File System Task
  Description: To run a SSIS package outside of SQL Server Data Tools you must install File System Task of Integration Services or higher.

With DTS path 110:

Code: 0xC001700A
  Source: DataBackupExcel
  Description: The version number in the package is not valid. The version number cannot be greater than current version number.
Code: 0xC0016020
  Source: DataBackupExcel
  Description: Package migration from version 8 to version 6 failed with error 0xC001700A; "The version number in the package is not valid. The version number cannot be greater than current version number.".
Code: 0xC0010018
  Source: DataBackupExcel
  Description: Error loading value "8" from node "DTS:Property".
Could not load package "C:\Users\username\Desktop\ DataBackupExcel.dtsx" because of error 0xC0010014.
Description: The package failed to load due to error 0xC0010014 "One or more error occurred. There should be more specific errors preceding this one that explains the details of the errors. This message is used as a return value from functions that encounter errors.". This occurs when CPackage::LoadFromXML fails.
  Source: DataBackupExcel

Initially I thought it's doable task, but now I'm stuck at one point and I'm not able to go further. Am I missing anything or any version mismatch couldn't able to figure out? Please don't consider this post as duplicate, I have tried different approaches mentioned in SO and other sources but none of them worked. Like (updating the SSIS from VS updates, file path changes and executing command on administrator mode etc)


text:
Q: Canvas Drawing with Surface Pen I'm currently using this Code to draw in a canvas with a pen from a Microsoft Surface (on a surface, of course):
<html>
      <head>
        <style>
          /* Disable intrinsic user agent touch behaviors (such as panning or zooming) */
          canvas {
            touch-action: none;
          }
        </style>

      <script type='text/javascript'>
        var lastPt = null;
        var canvas;
        var ctx;

        function init() {
          canvas = document.getElementById("mycanvas");
          ctx = canvas.getContext("2d");
          var offset  = getOffset(canvas);
          if(window.PointerEvent) {
            canvas.addEventListener("pointerdown", function() {
              canvas.addEventListener("pointermove", draw, false);
            }
            , false);
            canvas.addEventListener("pointerup", endPointer, false);
          }
          else {
            //Provide fallback for user agents that do not support Pointer Events
            canvas.addEventListener("mousedown", function() {
              canvas.addEventListener("mousemove", draw, false);
            }
            , false);
            canvas.addEventListener("mouseup", endPointer, false);
          }
        }

        // Event handler called for each pointerdown event:
        function draw(e) {
          if(lastPt!=null) {
            ctx.beginPath();
            // Start at previous point
            ctx.moveTo(lastPt.x, lastPt.y);
            // Line to latest point
            ctx.lineTo(e.pageX, e.pageY);
            // Draw it!
            ctx.stroke();
          }
          //Store latest pointer
          lastPt = {x:e.pageX, y:e.pageY};
        }

        function getOffset(obj) {
          //...
        }

        function endPointer(e) {
          //Stop tracking the pointermove (and mousemove) events
          canvas.removeEventListener("pointermove", draw, false);
          canvas.removeEventListener("mousemove", draw, false);

          //Set last point to null to end our pointer path
          lastPt = null;
        }

      </script>
    </head>
    <body onload="init()">
      <canvas id="mycanvas" width="500" height="500" style="border:1px solid black;"></canvas>
    </body>
  </html>

So far so good, its working fine.
What I'm planning to do now, is that the canvas reacts to the pressure on my surface pen.
I know that PointerEvent has a property pressure and I know that for canvas, there is lineWidth. But how can I combine those? So when I only put a little bit of pressure I get a thin line and the more pressure the thicker the line gets?
Thanks
Edit: just realized, that there seems to be a problem in the code, even when drawing with the pen, it seems to jump to the else case (so the fallback for using the mouse), tried to add a console.log into the if part, and its not printed... Why is this?


text:
Q: Various proofs of Hahn Banach theorem . I have been seeing various versions of Hahn Banach theorem . There are few confusions that i would like to clarify .
1) In some proof they assume the existence of a sublinear functional and the functional $f$ must satisfy $\le$ condition to the sublinear functional $p$ . Does there always exist a sublinear functional ?
In some proofs they don't say anything about the sublinear functional , is it wrong ?
2) I am not able to appreciate the induction , because it assumes the existence of the extension of linear functional and finally says that maximal element should be the Space itself ? I particularly have a problem in applying the first induction step.
I would like to have some knowledge about my confusions and misunderstandings .
Thanks

A: For (1), in most applications we are working in a normed space $(X, \|\cdot\|)$, and we usually apply the Hahn-Banach theorem with the sublinear functional $p(x) = c \|x\|$ for some constant $c > 0$ (you can verify this is indeed sublinear).  For instance, if we have a bounded linear functional on a subspace $M$ (so that $\|f(x)\| \le c \|x\|$ for all $x \in M$), applying Hahn-Banach with $p(x) = c\|x\|$ produces a bounded extension of $f$ to all of $X$.
For (2), it's hard to be specific without seeing the proof you are looking at, but basically the key step of the proof is that you can extend the functional to a larger subspace (in which the previous subspace has codimension 1).  The induction guarantees that you can repeat this extension again and again, and you never have to stop until your subspace is all of $X$, at which point you are done.


text:
Q: Python: how to multiply each element in a row and a column without looping In Python, I have a column array and a row array, say, [1, 3, 5] and [2, 4, 6, 8]' and I want to create a matrix of size 4*3 by multiplying each element in both of them. Is it possible to do without looping?

A: Vectorized calculation are best done with numpy:
import numpy as np

x = np.arange(1,6,2) # [1,3,5]
y = np.arange(2,9,2) # [2,4,6,8]
x = np.array([x]) # add dimension for transposing.
y = np.array([y])
result = np.dot(x.T, y)

result:
array([[ 2,  4,  6,  8],
       [ 6, 12, 18, 24],
       [10, 20, 30, 40]])

A: You can use the below code
import numpy as np
>>> x1 = np.arange(2,9,2)   # [2,4,6,8]
>>> x2 = np.arange(1,6,2)   # [1,3,5]
>>> result = x1.dot(x2)
>>> print result


text:
Q: MySql Database Stuck In Instruction ORDER BY RAND So I have this university project where I have to create a database in MySql about managing Football competitions where I've got this procedure to fill in a full season, but it crashes half the time when I call it. I really don't know how that can be. I even sent it to a friend of mine who has a better PC and the crashing ratio gets even worse. The code segment is pasted down below if you want to take a closer look. The link is if you want to test the whole thing. Thanks in advance and I'm sorry the parameters are in portuguese. Thanks in advance.
Link: https://codeshare.io/5zbb4W
    DROP PROCEDURE IF EXISTS create_jornada_primeira_volta;
    DELIMITER @

    CREATE PROCEDURE create_jornada_primeira_volta()
    BEGIN
    DECLARE xepoca, xcompeticao, xepoca2, xjornada, cnt, njogos INT;
    SELECT cod_epoca, cod_competicao INTO xepoca, xcompeticao FROM Epoca GROUP BY cod_epoca DESC LIMIT 1;
    SELECT num_jornada, cod_epoca INTO xjornada, xepoca2 FROM Jornada GROUP BY cod_epoca DESC LIMIT 1;
    IF (xepoca != xepoca2 OR xjornada IS NULL) THEN
        SET xjornada = 1;
    ELSE
        SET xjornada = xjornada + 1;
    END IF;
    SELECT num_equipas(xcompeticao)/2 INTO njogos;
    SET cnt = 0;
    INSERT INTO Jornada VALUES (xjornada, xepoca, xcompeticao);
    WHILE (cnt != njogos) DO
        CALL create_jogo_primeira_volta;
        SET cnt = cnt + 1;
    END WHILE;
END;
@
DELIMITER ;

DROP PROCEDURE IF EXISTS create_jornada_segunda_volta;
DELIMITER @

CREATE PROCEDURE create_jornada_segunda_volta()
BEGIN
    DECLARE xepoca, xcompeticao, xjornada, cnt, njogos, xequipa_visitada, xequipa_visitante, xinfraestrutura, xequipa_arbitragem INT;
    SELECT cod_epoca, cod_competicao INTO xepoca, xcompeticao FROM Epoca GROUP BY cod_epoca DESC LIMIT 1;
    SELECT num_jornada INTO xjornada FROM Jornada GROUP BY num_jornada DESC LIMIT 1;
    SET xjornada = xjornada + 1;
    SELECT num_equipas(xcompeticao)/2 INTO njogos;
    SET cnt = 0;
    INSERT INTO Jornada VALUES (xjornada, xepoca, xcompeticao);
    WHILE (cnt != njogos) DO
        SELECT cod_visitado, cod_visitante
            INTO xequipa_visitante, xequipa_visitada
            FROM Jogo
            Where num_jornada = xjornada - (num_equipas(xcompeticao) * 2 - 2) / 2 AND cod_epoca = xepoca
            ORDER BY cod_equipa_arbitragem
            LIMIT cnt,1;
        CALL create_equipa_arbitragem;
        SELECT cod_equipa_arbitragem INTO xequipa_arbitragem FROM Equipa_arbitragem GROUP BY cod_equipa_arbitragem DESC LIMIT 1;
        SELECT cod_infraestrutura INTO xinfraestrutura FROM Infraestrutura WHERE tipo = 'Estadio' AND cod_clube = (SELECT cod_clube FROM Equipa WHERE cod_equipa = xequipa_visitada);
        INSERT INTO Jogo VALUES (xepoca, xcompeticao, xjornada, xequipa_visitada, xequipa_visitante, xequipa_arbitragem, xinfraestrutura, null, null);
        SET cnt = cnt + 1;
    END WHILE;
END;
@
DELIMITER ;

DROP PROCEDURE IF EXISTS create_epoca;
DELIMITER @

CREATE PROCEDURE create_epoca()
BEGIN
    DECLARE ncompeticoes, cnt_comp, cnt_jornadas, nepoca, njornadas INT;
    SELECT COUNT(*) INTO ncompeticoes FROM Competicao;
    SET cnt_comp = 1;
    SELECT cod_epoca INTO nepoca FROM Epoca GROUP BY cod_epoca DESC LIMIT 1;
    IF nepoca IS NULL THEN
        SET nepoca = 1;
    ELSE
        SET nepoca = nepoca + 1;
    END IF;
    WHILE (cnt_comp != (ncompeticoes + 1)) DO
        INSERT INTO Epoca VALUES (nepoca, cnt_comp, 2017, CURDATE(), null, null);
        SELECT ((num_equipas(cnt_comp) * 2 - 2) / 2) INTO njornadas;
        SET cnt_jornadas = 0;
        WHILE (cnt_jornadas < njornadas) DO
            CALL create_jornada_primeira_volta;

            SET cnt_jornadas = cnt_jornadas + 1;
        END WHILE;
        SET cnt_jornadas = 0;
        WHILE (cnt_jornadas != njornadas) DO
            CALL create_jornada_segunda_volta;
            SET cnt_jornadas = cnt_jornadas + 1;
        END WHILE;
        SET cnt_comp = cnt_comp + 1;
    END WHILE;
END;
@
DELIMITER ;


text:
Q: Form view (for Inserting only) - contains drop down list I have a form view in ASP.NET with a text box and a drop down list.
I'm trying to populate the drop down list - from a separate table than the one I'm inserting data into.  For example - a list of states - with Value = CA; Text = California.
I have a LINQ statement that I've created, but I can't seem to populate the ddl.
Any suggestions?

A: First of all return a list from your table:
myEntities dc = new myEntities();
List<MyTable> lst = (from ro in dc.MyTable select ro).ToList();

Than, add an object into your list (or insert into a position).
lst.Insert(0, new MyTable(){TextField = "California", ValueField = "CA"});
drp.DataSource = lst;
drp.DataBind();


text:
Q: Built-in camera not working on Ubuntu 20.04 installed on Macbook pro late 2013 I have tried all the existing suggestions (including iSight, cheese) I could find on this and other forums to make the camera work, but nothing seems to work.
Here is the error message from cheese:
: cheese_preferences_dialog_setup_resolutions_for_device: assertion 'device != NULL' failed

Does anyone know if there is any update regarding the camera issue for Ubuntu 20.04?


text:
Q: Set of solutions for nearest point to a convex polyhedron (simplex) I'm working on a problem that involves the sets of solutions to the problem of finding nearest point of a convex polyhedron to a given point. Let $y$ be a point in a convex polyhedron defined by a set of linear inequalities $Ay \leq b$ and $x \in \Bbb R^n$ a target point. Specifically, I'm concerned with solutions when in terms of Euclidean distance where the convex polyhedron is the interior of a simplex, i.e.,
\begin{gather*}
  \min_y \, y^\top y - 2 x^\top y \\
  \text{subject to } Ay \leq b
\end{gather*}
with
\begin{align*}
  A = \begin{bmatrix} -I_n \\ 1_n^\top \end{bmatrix} \quad \text{and} \quad b = \begin{bmatrix} 0_n \\ 1 \end{bmatrix} .
\end{align*}
Now, my question concerns the solutions as $x$ changes. In particular, I'm pretty sure that the sets of $\Bbb R^n$ that get mapped to the simplex in this way can be separated by half-planes. Intuitively, this is because for each $x$ not in the simplex, the nearest point should either be a corner or a face. Using the algorithm here, I convinced myself this was true for $\Bbb R^2$, as I could find a pattern that looked something like this:

where the orange sets are closest to a corner and the blue sets are closer to a face. I'm looking for either:

*

*A reference to this type of result and, ideally, a way to describe those sets that get mapped to the corners and faces when the dimensionality is larger than 2.

*A way to make this argument rigorous.

A: I had written a previous answer, but I think my new answer supersedes it, so I'm replacing the old one with what follows.
I claim that if $S$ is convex polyhedron in $\mathbf{R}^n$, then:

*

*for each $x \in \mathbf{R}^n$, there is a unique point $f(x) \in S$ closest to $x$;

*for each $x \in \mathbf{R}^n$, the point $f(x)$ is the orthogonal projection of $f$ onto some face of $S$ (of dimension $0, \dots, n$);

*this face can be chosen to be the smallest face of $S$ containing $f(x)$;

*this choice being made, the boundaries of the sets in the corresponding partition of $\mathbf{R}^n$ are contained in the union of finitely many hyperplanes $H$, which can be determined as follows: for each face $k$-dimensional face $F$ of $S$ ($k = 1, \dots, n$) , and each $(k-1)$-dimensional subface $F'$  of $F$, let $H$ be the collection of all points whose orthogonal projection onto the subspace extending $F$ belongs to the subspace extending $F'$;

*if $T \subseteq \mathbf{R}^n$ is one of the sets of the partition, and $F$ is the associated face, then $f(x)$ is the orthogonal projection of $x$ onto $F$ for all points $x$ in the closure of $T$ (not only for $x$ in $T$).
That the boundaries can be curved when $S$ is not assumed convex is shown by the following example. Let $S$ be the quadrilateral $ABCD$ with $A = (1,0)$, $B = (0,0)$, $C = (0,2)$, $D = (-1,-1)$. Then one of the boundaries is a portion of the parabola with focus $A$ and directrix $BC$.
I'll begin with some general comments about projecting onto a convex set.
If $S$ is any subset of $\mathbf{R}^n$, the function $x \mapsto d(x,S)$ is continuous on $\mathbf{R}^n$. If $S$ is closed, then by a simple compactness argument, the distance $d(x,S)$ is attained at at least one point $s \in S$.
If $S$ is closed and convex, then this point $s$ is unique, for if the minimum distance were attained in two points $s_1$ and $s_2$, the midpoint of the segment $s_1s_2$ would be still closer to $x$. Thus we can define a projection function $f \colon \mathbf{R}^n \to S$ assigning to each $x \in \mathbf{R}^n$ the unique point $f(x)$ of $S$ that is closest to it.
The projection function $f$ is in fact continuous. If $x \in \mathbf{R}^n$ and $\varepsilon > 0$, let $S' = S - B(f(x),\varepsilon)$. The distance $d(x,S')$ is attained at some point $s' \in S'$, and by the uniqueness of the projection we have $d(x,S') = d(x,s') > d(x,f(x)) = d(x,S)$. Now as $y \to x$, we have $d(y,S) \to d(x,S)$ and $d(y,S') \to d(x,S')$, hence for $y$ sufficiently close to $x$, we must have $f(y) \in B(f(x),\varepsilon)$, which shows that $f$ is continuous.
Now assume that $S$ is a convex polyhedron. For any $s \in S$, there is a face of minimum dimension $d$ (with $0 \leq d \leq n$) to which $s$ belongs. This face is contained in all other faces containing $s$, and it is also the unique face containing $s$ within its interior (where "interior" means the interior relative to the subspace extending the face). Thus we can partition space into a finite number of subsets by assigning to each $x \in \mathbf{R}^n$ the face associated in this way with $f(x)$.
If $f(x)$ belongs to the interior of a particular face $F$, it is easy to see that $f(x)$ is determined as the orthogonal projection of $x$ onto the subspace extending $F$ (since otherwise there must be nearby points of $F$ that are closer to $x$). More generally, if $f(x)$ belongs to a face $F$, though not necessarily to its interior, then $f(x)$ must be the orthogonal projection of $x$ onto the subspace extending some subface of $F$.
Now assume that $x$ is a boundary point of one of the subsets into which $\mathbf{R}^n$ is partitioned. Then $x$ is as close as we like to points associated with two distinct faces, say $F$ and $G$. By the continuity of $f$, the point $f(x)$ belongs to $F \cap G$. Thus
$f(x)$ can be obtained by orthogonal projection onto some subface of $F \cap G$. At the same time, by continuity, $f(x)$ must be the orthogonal projection of $x$ onto $F$ as well as onto $G$. The faces $F$ and $G$ being assumed distinct, in any case $f(x)$ is simultaneously the orthogonal projection of $x$ onto a face of $S$ (either $F$ or $G$) and a proper subface of that face. Since we can always replace the subface by one of dimension one less than that of the face, the result follows.


text:
Q: Add removeClass function in my Jquery I've been stuck for this problem more than a week -_-. What I need to do is add the removeclass function in my jQuery validation below. In bid and rfq validation add the removeclass.
I have dropdown and two textbox (rfq and bid), when I select BIDDING in dropdown the bid textbox hide. But the problem is when I tried to submit the validation requirements comes out bcoz the textbox bid doesn't have a value. So I tried to add a removeclass function in textbox depends on dropdown value.
This is my working Fiddle http://jsfiddle.net/mHCk7/4/
Part of Validation jQuery
if (bid == "") {
    $("span.val_bid").html("This field is required.").addClass('validate');
    validation_holder = 1;
}
else {
    if (!bid_regex.test(bid)) { // if invalid phone
        $("span.val_bid").html("Integer Only is Allowed!").addClass('validate');
        validation_holder = 1;
    }
    else {
        $("span.val_bid").html("");
    }
}
if (rfq == "") {
    $("span.val_rfq").html("This field is required.").addClass('validate');
    validation_holder = 1;
}
else {
    if (!rfq_regex.test(rfq)) { // if invalid phone
        $("span.val_rfq").html("Integer Only is Allowed!").addClass('validate');
        validation_holder = 1;
    }
    else {
        $("span.val_rfq").html("");
    }
}

Remove Class jquery
$('#txt1').change(function () {
    if ($(this).val() == 'NEGOTIATED' || $(this).val() == 'SHOPPING' || $(this).val() == '') {
        $("#txt2,#txt3").val('');
        $("#txt2").removeClass("mandatory");
        $("#txt3").removeClass("mandatory");
    }
    else if ($(this).val() == 'BIDDING') {
        $("#txt3").val('');
        $("#txt3").removeClass("mandatory");
    }
    else if ($(this).val() == 'RFQ') {
        $("#txt2").val('');
        $("#txt2").removeClass("mandatory");
    }
    else {
        //here you can specify what to do if the value is NOT negotiated or SHOPPING
    }
});

A: here is the updated code


text:
Q: Fetching JSON from URL in SwiftUI the following is the code I am trying to get to work, all I want to do is display the current price and the currency it is in.
the link returns a format of :
{"currency":"USD","rate":"178.0466666666667"}
import SwiftUI
import Combine

struct BitcoinPrice: Decodable, Identifiable {
    var id = UUID()
    let currency: String
    let rate: String
}

struct BSVPrice: View {
    @State private var requests = Set<AnyCancellable>()
    @State private var exchangeRate = [BitcoinPrice]()

    var body: some View {
        NavigationView {
            List(exchangeRate) { rate in
                VStack(alignment: .leading) {
                    Text(rate.currency)
                    Text(rate.rate)
                }
            }
            .navigationTitle("Bitcoin Price")
        }

        .onAppear {
            let bitcoinPriceURL = URL(string: "https://api.whatsonchain.com/v1/bsv/main/exchangerate")!
            //let bitcoinPriceTask = fetch(bitcoinPriceURL, defaultValue: [BitcoinPrice]() )
            fetch(bitcoinPriceURL, defaultValue: [BitcoinPrice]() ) {
                exchangeRate = $0
            }
        }
    }

    func fetch<T: Decodable>(_ url: URL, defaultValue: T, completion: @escaping (T) -> Void) {
        let decoder = JSONDecoder()

        URLSession.shared.dataTaskPublisher(for: url)
            .retry(1)
            .map(\.data)
            .decode(type: T.self, decoder: decoder)
            .replaceError(with: defaultValue)
            .receive(on: DispatchQueue.main)
            .sink(receiveValue: completion)
            .store(in: &requests)
    }

    func fetch<T: Decodable>(_ url: URL, defaultValue: T) -> AnyPublisher<T, Never> {
        let decoder = JSONDecoder()

        return URLSession.shared.dataTaskPublisher(for: url)
            .retry(1)
            .map(\.data)
            .decode(type: T.self, decoder: decoder)
            .replaceError(with: defaultValue)
            .receive(on: DispatchQueue.main)
            .eraseToAnyPublisher()
    }
}

struct BSVPrice_Previews: PreviewProvider {
    static var previews: some View {
        BSVPrice()
    }
}

Does anyone know why the JSON is not loading into the application? Any help would be great, I have got the code to work with a different API so a bit confused.

A: First you're suppressing your error by using .replaceError(with: defaultValue) which will hide any errors and replace them with a default value (here an empty list).

In
func fetch<T: Decodable>(_ url: URL, defaultValue: T, completion: @escaping (T) -> Void)

you're trying to decode T.self:
.decode(type: T.self, decoder: decoder)

which should be of BitcoinPrice type to work.
Note that the response from your link is a single object, not an array.
However, in your view, you pass [BitcoinPrice] as the default value:
fetch(bitcoinPriceURL, defaultValue: [BitcoinPrice]() ) { ...

which infers T to be of type [BitcoinPrice].
Also remove var id = UUID() from BitcoinPrice:
struct BitcoinPrice: Decodable {
    let currency: String
    let rate: String
}

and use it like this:
List(exchangeRate, id: \.currency) { rate in

I also recommend to use plural names for collections, ie. exchangeRates instead of exchangeRate.


text:
Q: How to add and display new subnode on button tap? I have ASViewController with root node. In init I add some nodes. I need to display new node after button tap. How I can do it?

A: Just use Layout Transition
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{

  ASStackLayoutSpec *stack = [[ASStackLayoutSpec alloc] init];
  if (self.buttonState == SignupNodeName) {
    [stack setChildren:@[field, self.buttonNode, self.newNode]];
  } else {
    [stack setChildren:@[field, self.buttonNode]];
  }

  UIEdgeInsets insets = UIEdgeInsetsMake(15.0, 15.0, 15.0, 15.0);
  return [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:stack];
}


text:
Q: Fetching a github repo in react gives a "Module "stream" has been externalized for browser compatibility and cannot be accessed in client code" error I am currently stuck with a problem trying to fetch github repo data using the octokit npm package.
I use vite to run a dev server and when I try to make a request, the error that i get is:
Uncaught Error: Module "stream" has been externalized for browser compatibility and cannot be accessed in client code.

My React .tsx file looks like this:
import { Octokit, App } from 'octokit'
import React from 'react'

const key = import.meta.env.GITHUB_KEY
const octokit = new Octokit({
    auth: key
  })
await octokit.request('GET /repos/{owner}/{repo}', {
    owner: 'OWNER',
    repo: 'REPO'
  })

export default function Repos() {

  return (
    <>

    </>
  )
}

I have redacted the information for privacy purposes.
If anyone knows how to resolve this issue with vite, please let me know!

A: Check first if this is similar to octokit/octokit.js issue 2126

I worked around this problem by aliasing node-fetch to isomorphic-fetch. No idea if it works for all usages within octokit, but works fine for my project.
You'll need to install the isomorphic-fetch dependency before making this config change.
// svelte.config.js

const config = {   // ...   kit: {
    // ...
    vite: {
      resolve: {
       alias: {
         'node-fetch': 'isomorphic-fetch',
       },
     },
   },
 },
};

export default config;

Note: there are still questions about the support/development of octokit: issue 620.


text:
Q: Required Attribute wont work on with addEventListener? My goal is that passing data from a form to another element.
My code works when passing the data, but the time when the form is empty and user attempt to press the button, the required attribute won't work even tho I put the attribute to every form inputs. I want to prevent user submitting empty data.
Here's a sample code

const passBtn = document.querySelector("#btnSubmit");
const inputEmail = document.querySelector("#inputEmail");
const recieveText = document.querySelector("#recieveText");
const getEmail = document.querySelector("#getEmail");

passBtn.addEventListener("click", function(e) {

  e.preventDefault();
  getEmail.textContent = inputEmail.value;

})
<form legend="Form">
  <fieldset>
    <legend>
      MyForm
    </legend>
    <input id="inputEmail" type="email" placeholder="Email" required />
    <button id="btnSubmit" type="submit">
          Pass Text
        </button>
  </fieldset>
</form>

    Recieved Text Here

A: for having the form validation triggered you need to listen to the form submit event and for that you can change your code to:
const form = document.querySelector("#form");
const inputEmail = document.querySelector("#inputEmail");
const recieveText = document.querySelector("#recieveText");
const getEmail = document.querySelector("#getEmail");

form.addEventListener("submit",function(e){
e.preventDefault();
getEmail.textContent = inputEmail.value;

/* recieveText.value = inputEmail.value; */

})

and also you need to have a name attribute for elements as well:
then update:
<input id="inputEmail" type="email" placeholder="Email" required />

to
<input id="inputEmail" type="email" name="inputEmail" placeholder="Email" required />

https://jsfiddle.net/ko5py9cw/


text:
Q: CakePHP 3 - Login Error - Call to a member function identify on boolean Hello I'm using CakePHP 3 to simple setup a site which some pages of it need user to login first.
It was fine when I put the loadComponent('Auth', blablabla) code in initialize() of AppController.php.
src\Controller\AdminController.php
...
public function login() {
    if ($this->request->is('post')) {
        $admin = $this->Auth->identify();
        if ($admin) {
            $this->Auth->setUser($admin);
            return $this->redirect($this->Auth->redirectUrl());
        }
        $this->Flash->error('Your username or password is incorrect.');
    }
}
...

src\Controller\AppController.php
...
public function initialize() {
    parent::initialize();
    $this->loadComponent('RequestHandler');
    $this->loadComponent('Flash');
    $this->loadComponent('Auth', [
        'Authenticate' => [
            'Form' => [
                'userModel' => 'Admin',
                'Fields' => [
                    'username' => 'email',
                    'password' => 'password'
                ]
            ]
        ],
        'loginAction' => [
            'controller' => 'Admin',
            'action' => 'login',
        ]
    ]);

    $this->Auth->allow(['display']);
}
...

At this point, I needed to login in order to view all other pages of the site.
But I tried to put this same authentication setup in another controller called JustController, and after I logged in, a fetal error stated

Call to a member function identify() on boolean

has been shown.
It should be possible to setup authentication in other controllers so that the site can have more than 1 set of login system instead of covering whole site by setting up in AppController, doesn't it?
Thank you.


text:
Q: C# ChromeDriver Proxy not being set I have a project that uses ChromeDriver and a proxy I pay for. There's no authentication on the proxy. It used to set the proxy just fine but now when I run it, if I check my public IP address it's still my address, not the proxy address. I'm not sure if Chrome changed something or what, but does anyone know how to get the proxy to work again?
                string proxyAddress = "https://xxx.xx.xx.xxx:xxxx"; //the x's are just masking the actual ip address

                ChromeDriverService cds = ChromeDriverService.CreateDefaultService();
                ChromeOptions co = new ChromeOptions();
                if (!String.IsNullOrWhiteSpace(proxyAddress))
                {
                    co.Proxy = new Proxy(){
                        HttpProxy = proxyAddress,
                        Kind = ProxyKind.Manual,
                        IsAutoDetect = false
                    };
                }
                co.AddArgument("ignore-certificate-errors");
                co.AddArguments("chrome.switches", "--disable-extensions");
                cds.HideCommandPromptWindow = true;
                ChromeDriver drv;
                if (commandTimeout != null)
                {
                    drv = new ChromeDriver(cds, co, (TimeSpan)commandTimeout);
                }
                else
                {
                    drv = new ChromeDriver(cds, co);
                }

I've also tried this, but then every site Chrome says "This Site Can't be reached" and has the error code: ERR_NO_SUPPORTED_PROXIES.
string proxyAddress = "https://xxx.xx.xx.xxx:xxxx"; //the x's are just masking the actual ip address

                ChromeDriverService cds = ChromeDriverService.CreateDefaultService();
                ChromeOptions co = new ChromeOptions();
                if (!String.IsNullOrWhiteSpace(proxyAddress))
                {
                     co.AddArgument(String.Format("--proxy-server={0}", proxyAddress));
                }
                co.AddArgument("ignore-certificate-errors");
                co.AddArguments("chrome.switches", "--disable-extensions");
                cds.HideCommandPromptWindow = true;
                ChromeDriver drv;
                if (commandTimeout != null)
                {
                    drv = new ChromeDriver(cds, co, (TimeSpan)commandTimeout);
                }
                else
                {
                    drv = new ChromeDriver(cds, co);
                }

A: To anyone running into the same issue, I managed to to get it to work by replacing
co.AddArgument(String.Format("--proxy-server={0}", proxyAddress));

with this
co.AddArgument(String.Format("--proxy-server=http://{0}:{1};https://{0}:{1}", proxy.Address.Host, proxy.Address.Port));

My only guess is that it needed to be set for both http and https.


text:
Q: Decoding Nested JSON in PHP Excuse me if this has been covered, but I've looked and can't find an answer that works.
I have the following JSON (shortened for clarity):
[{
    "header": {
        "msg_type": "0001"
    },
    "body": {
        "event_type": "ARRIVAL",
        "train_id": "384T22MJ20"
    }
},{
    "header": {
        "msg_type": "0003"
    },
    "body": {
        "event_type": "DEPARTURE",
        "train_id": "382W22MJ19"
    }
}]

Now I know I can use json_decode to create a php array, but not knowing much about php I don't know how to get it to do what I want. I need to be able to access a value from each array. For example I would need to extract the train_id from each array. At the moment I have this:
$file = "sampleData.json";
$source = file_get_contents($file);
$data = json_decode($source);

$msgbdy = $data->body;
foreach($msgbdy as $body){
   $trainID = $body->train_id;
}

I know this is wrong, but I'm not sure if I'm on the right track or not.
Thanks in advance.

A: anonymous objects are deserialized as array-members, foreach can handle that :
$objs = json_decode($source)
foreach($objs as $obj)
{
   $body = $obj->body; //this is another object!
   $header = $obj->header; //yet another object!
}

and within that loop, you can now access msg_type, train_id and event_type via $body and $header

A: I suggest to pass it true as a parameter, it is easier to work with associative arrays than objects:
$messages = json_decode($source, true);
foreach($messages as $message){
   $trainID = $message["body"]["train_id"];
}

A: You process it in the wrong order: your string is an array of objects. Not an object with arrays.
You first need the large foreach loop to iterate over the array and then access for each element the "body" and "train_id".
Your code should thus read:
foreach($data as $item) {
    echo $item->body->train_id; //or do something else with $item->body->train_id
}

A: Maybe something like:
$data = json_decode($source);

foreach ($data as $message) {
    $trainId = $message->body->train_id;
    // Not sure what you want to do wit this ^
}

You need to loop over each whole entry. See how where the data is repeated, and that is what you need to loop over.

A: Your trying to access an array like an object. The array notation would be $data[0]['body'] to retrieve the value for the "body" key in the first entry in the array.


text:
Q: python salesforce not connecting , home okay, work not. Firewall / Security? I registered my own salesforce developer login.
I am able to connect to this from my home computer and my work computer via the salesforce login url.
I am now writing python code to extract from salesforce. The code is below.
The code runs on my work laptop when I am at home and connected to my ISP.
When running the same code on my work laptop at work, (so now using work ISP), the code fails to connect.
The error I get when I run at work is:
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='login.salesforce.com', port=443): Max retries exceeded with url: /services/Soap/u/40.0 (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'))
So expect something going on with firewall and what not.
But am confused. It does not seem right that my work laptop is more "open" to outside when I use my ISP. I would have thought the security / firewall would have been implemented in a layer between work laptop and the ISP. So ISP agnostic. These laptops are meant to be used at home as well. I am not doing anything wrong in that respect.
Python code below.
import unicodecsv
from salesforce_bulk import SalesforceBulk

bulk = SalesforceBulk(password='**', username='**', security_token='**')

job = bulk.create_query_job("Contact", contentType='CSV')

batch = bulk.query(job, "select Id,LastName from Contact")

bulk.close_job(job)

while not bulk.is_batch_done(batch):

    sleep(10)

for result in bulk.get_all_results_for_query_batch(batch):

    reader = unicodecsv.DictReader(result, encoding='utf-8')

    for row in reader:

        print(row) # dictionary rows

Oops. Figured it out. Need to add proxies parameter when connecting to salesforce at work. Bit of a revelation. There is a level of security/protection that is missing on a work laptop when it used at home. Did not realise that networks / firewall / security worked in such a way.


text:
Q: How to run Magento 2 with pub as document root? I have a nexcess hosting with document root /home/aae3re95/dev.example.com/html and i need to set /home/aae3re95/dev.example.com/html/pub as document web root.
Please tell me steps to make pub as document root.
Thanks

A: check if you are using apache/ngnix ecc.
If you are using nginx go in /etc/ngnix/site-avaible and search for $MAGE_ROOT variable.
If you don't know about this kind of things try this command:
grep -nri '/home/aae3re95/dev.example.com/html' /

It will show you where it's placed the variable to change.
Cheers


text:
Q: Fix for RunUAT.bat How can we fix it, we used RunUAT.bat BuildCookRun -project="E:\agent\_work\1\s\P1.uproject" -clientconfig=Development -platform=Win64 -cook -stage -pak -stagingdirectory="E:\agent\_work\1\s\" -package -build to compile our game with Azure Pipeline but we have this error https://imgur.com/a/37lfR5j one more thing we are not going to supply .uproject in game folder because we want to sell this game

A: I think the issue is related to your unreal project. And you used your private agent to build this project under azure devops pipeline.
Try these:
1) remove win64 platform configuration under command
2) update or reinstall unreal enigne on the pricate agent
3) or you could re-name the project to xxx-Win32-Shipping.exe or xxx-Win64-Shipping.exe.
Besides, you could report the issue on Unreal Engine forum.


text:
Q: Enforce transactions for write operations in SQL Server How do I ensure and enforce that all write operations to my MS SQL Server DB are transactions-based?
The reason I want to do this is that the DB contains financial account data and operations that fail halfway through some set of changes should not be able to mess up the database by mistake or by crashing.
The application is written in ASP.NET C#.
Thanks.
Edit:
There is a DAL but it does not (yet) require transactions for changes.
We wrote the DAL ourselves. We did not use ORM.
I know how to perform one transaction from ASP.NET.
I want to ensure that all changes are made in transaction form so that if the application throws some exception in the middle, there will be no change to the database.

A: Any SQL-statement is atomic by default, but often you need to perform two or more of them and be sure the whole set is atomic. So you need to manually start and commit a transaction. If you use ADO.NET in your application the code can look like this:
using (SqlConnection db = new SqlConnection("connectionstring"))
{
      db.Open();
      SqlTransaction transaction = db.BeginTransaction();
      try
      {
         new SqlCommand("update statement", db, transaction).ExecuteNonQuery();
         new SqlCommand("another statement", db, transaction).ExecuteNonQuery();
         // additional operations here
         transaction.Commit();
      }
      catch (SqlException sqlError)
      {
         transaction.Rollback();
      }
}

A: You might want to look at setting SQL Server to use implicit transactions: http://msdn.microsoft.com/en-us/library/ms188317.aspx

A: All operations in MS SQL are transactions-based.  But trasactions can be explicit and implicit.


text:
Q: iOS 10.3 and Audi, Bluetooth audio no longer works. Anyone else? Since updating to iOS 10.3 the Bluetooth audio on my iPhone 6s no longer works with my Audi (2014 RS4).  The phone calls still work, but no audio apps work - they appear to play and the meta-data appears on the car screen, but just silence.  Most frustrating.
Does anyone else have this issue?  I would like to check before I send a bug report to Apple, so I can see if I can narrow-down any causal factors.
(it looks as if at least one other person is having this issue) http://www.audizine.com/forum/showthread.php/758173-iOS-10-3-problem-with-media-as-input
My Audi MMI version is HN+_EU_AU3G_P0767
Thanks

A: Well, Aren't I a fool! It seems that the iOS update for some reason decided to reset the system volume to zero (but only when connected to that Bluetooth device).
The apps that I used to test didn't have the volume slider visible on screen and the car volume controls don't 'pass-through' so it only appeared silent.
Adjusting the iPhone system volume via the physical buttons on the phone brought the audio back....


text:
Q: Foundation Zurb & Top bar does not appear I'm kind of new to Foundation and I'm trying to create a top bar, but my code does not create the top bar for me. Can you help??? I've reviewed the documentation for the top bar, but I'm still stuck.
Thank you in advance.
<!doctype html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Foundation | Welcome</title>
   <link rel="stylesheet" href="css/normalize.css">
  <link rel="stylesheet" href="css/foundation.css">

Thank you in advance.

A: Your app.css and app.js are missing

  <link rel="stylesheet" href="stylesheets/foundation.min.css">
  <link rel="stylesheet" href="stylesheets/app.css">


text:
Q: The group of automorphisms of a group $G$ that act trivially on $G/N$ $\textbf{Definition.}$ Let $G$ be a finite group which has only a minimal normal subgroup, say $N$. We say that an automorphism $\gamma:G \to G$ acts trivially on $G/N$ if the induced homomorphism $\gamma':G/N \to G/N$( $\gamma':Ng \mapsto Ng^ {\gamma}$) is the identity, that is, $g^{\gamma} \in Ng,~\forall g \in G$.
Let $\Gamma$ denote the group of those automorphisms of L that act trivially on $G/N$.
$\textbf{Statement:}$ If $N$ is abelian and complemented in $G$, then $|\Gamma|=(q-1)a$, where $q=|\mathrm{End}_G(N)|$ and $a$ is the number of complements for $N$ in $G$.
I'm trying to build an equivalence relation on the $\Gamma$ group, but I'm not getting an idea of how to proceed.

A: $\newcommand{\Set}[1]{\left\{ #1 \right\}}$$\newcommand{\norm}{\trianglelefteq}$$\renewcommand{\phi}{\varphi}$$\DeclareMathOperator{\End}{End}$The following treatment is a bit sketchy, but hopefully correct, and comprehensible.
Suppose $\phi \in \End_{G}(N)$, that is, $\phi$ is an endomorphism of $N$ such that $(g^{-1} n g)^{\phi} = g^{-1} n^{\phi} g$, for $n \in N$ and $g \in G$. (In the following I will write $x^{g}$ for $g^{-1} x g$. Since $N^{\phi} \le N$, and $N^{\phi} \norm G$, if $\phi \ne 0$ it follows $\phi$ must be an automorphism of $N$. (Here the $0$ endomorphism is the one mapping the whole of $N$ onto $1$.)
If $\gamma \in \Gamma$, the restriction of $\gamma$ to $N$ is an element of $\End_{G}(N)$, as
$$
(g^{-1} n g)^{\phi}
=
(g^{\phi})^{-1} n^{\phi} g^{\phi}
=
g^{-1} m^{-1} n^{\phi} m g
=
g^{-1} n^{\phi} g,
$$
where $g^{\phi} = m g$ for some $m \in N$, and we have exploited the fact that $N$ is abelian.
Moreover $\gamma$ clearly sends a complement of $N$ to another complement of $N$.
Now fix a complement $H$ of $N$ in $G$. Let $K$ be another complement. Then $$
K
=
\Set{h h^{\psi} : h \in H},
$$
for some function $\psi :H \to N$. We have
$$
h_{1} h_{1}^{\psi} h_{2} h_{2}^{\psi}
=
h_{1} h_{2} (h_{1}^{\psi})^{h_{2}} h_{2}^{\psi},
$$
so that
$$\tag{cocycle}(h_{1} h_{2})^{\psi} = (h_{1}^{\psi})^{h_{2}} h_{2}^{\psi}.$$
Conversely any such cocycle $\psi$ defines a complement of $N$ in $G$, so that there are as many such cocycles $\psi$ as there are complements of $N$ in $G$.
Now for any of the $\theta \in \End_{G}(M)$, and any of the $a$ cocycles $\psi : H \to N$, define for $h \in H$ and $n \in N$
$$
(h n)^{\gamma}
=
h h^{\psi} n^{\theta}.
$$
Then
$$
(h_{1} n_{1} h_{2} n_{2})^{\gamma}
=
(h_{1} h_{2} n_{1}^{h_{2}} n_{2})^{\gamma}
=
h_{1} h_{2} (h_{1}^{\psi})^{h_{2}} h_{2}^{\psi}
(n_{1}^{\theta})^{h_{2}} n_{2}^{\theta}
$$
and
$$
(h_{1} n_{1})^{\gamma} (h_{2} n_{2})^{\gamma}
=
h_{1} h_{1}^{\psi} n_{1}^{\theta}
h_{2} h_{2}^{\psi} n_{2}^{\theta}
=
h_{1} h_{2}
(h_{1}^{\psi})^{h_{2}} (n_{1}^{\theta})^{h_{2}}
h_{2}^{\psi} n_{2}^{\theta},
$$
which equals the previous expression, as $N$ is abelian. Therefore $\gamma \in \Gamma$.


text:
Q: Generate thumbnails from an image src I need to generate some thumbs based in a slideshow. This thumbs are generated directly/dinamically from the img src for each slide.
Now I'm generating a code like this for the thumbs gallery:

...

The li elements are left floated to get a horizontal line with them.
My problem is that the users can upload any image size and orientation images and I can't control correctly the aspect of the thumbs. I need all the thumbs has a particular size. 60x45px, for example.
When the user uploads a vertical image or any other image with a different ratio I have an irregular thumb line, where vertical images occupies a width and larger images are higher than others. How can I get an equal height and width thumbs without cropping the images? Or just cropping a bit to fit the verticals?
I search a lot here and I found some useful scripts, but none get that goal.

A: I like jQuery NailThumb. It's very customizable and easy to use.

A: You can specify the width/height for each image using jQuery. Loop over the
 elements, get the aspect ratios for each image, set the same height om each image and set the with according to the aspect ratio.

A: You could assign the images as backgrounds, then use CCS3 background-size: cover to make it fill the thumbs perfectly. Then use an IE filter for backwards compatibility.
This article explains it best:
http://css-tricks.com/perfect-full-page-background-image/
This would not require any JavaScript.

A: Try this simple function i mentioned here: https://stackoverflow.com/a/14731922/382536
/**
* Conserve aspect ratio of the orignal region. Useful when shrinking/enlarging
* images to fit into a certain area.
*
* @param {Number} srcWidth Source area width
* @param {Number} srcHeight Source area height
* @param {Number} maxWidth Fittable area maximum available width
* @param {Number} maxHeight Fittable area maximum available height
* @return {Object} { width, heigth }
*/
function calculateAspectRatioFit(srcWidth, srcHeight, maxWidth, maxHeight) {

    var ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight);

    return { width: srcWidth*ratio, height: srcHeight*ratio };
}


text:
Q: Google Maps Android API V2 problems with android 4.3 I am novice in Google maps. Just followed this link http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/
when I am launching my app, follwing error is coming up:
Unfotunately Googlemapsv2 has stopped

I have gone through lots of post on stackoverflow but still not getting where is the problem.
logcat output
01-14 18:05:22.301: E/AndroidRuntime(12239): FATAL EXCEPTION: main
01-14 18:05:22.301: E/AndroidRuntime(12239): java.lang.RuntimeException: Unable to start activity ComponentInfo{example.androidhive.googlemapsv2/example.androidhive.googlemapsv2.MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2343)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.app.ActivityThread.access$600(ActivityThread.java:162)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.os.Handler.dispatchMessage(Handler.java:107)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.os.Looper.loop(Looper.java:194)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.app.ActivityThread.main(ActivityThread.java:5371)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at java.lang.reflect.Method.invokeNative(Native Method)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at java.lang.reflect.Method.invoke(Method.java:525)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at dalvik.system.NativeStart.main(Native Method)
01-14 18:05:22.301: E/AndroidRuntime(12239): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:281)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.app.Activity.setContentView(Activity.java:1881)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at example.androidhive.googlemapsv2.MainActivity.onCreate(MainActivity.java:18)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.app.Activity.performCreate(Activity.java:5122)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)
01-14 18:05:22.301: E/AndroidRuntime(12239):    ... 11 more
01-14 18:05:22.301: E/AndroidRuntime(12239): Caused by: java.lang.RuntimeException: API key not found.  Check that <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml
01-14 18:05:22.301: E/AndroidRuntime(12239):    at maps.af.ay.a(Unknown Source)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at maps.af.ay.a(Unknown Source)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at maps.af.al.a(Unknown Source)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at maps.af.be.a(Unknown Source)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at maps.af.bd.a(Unknown Source)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at cmj.onTransact(SourceFile:107)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at android.os.Binder.transact(Binder.java:310)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at com.google.android.gms.maps.internal.IMapFragmentDelegate$a$a.onCreateView(Unknown Source)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at com.google.android.gms.maps.MapFragment$a.onCreateView(Unknown Source)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at com.google.android.gms.dynamic.a$4.b(Unknown Source)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at com.google.android.gms.dynamic.a.a(Unknown Source)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at com.google.android.gms.dynamic.a.onCreateView(Unknown Source)
01-14 18:05:22.301: E/AndroidRuntime(12239):    at com.google.android.gms.maps.MapFragment.onCreateView(Unknown Source)

Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="example.androidhive.googlemapsv2"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="18" />
       <permission
        android:name="example.androidhive.googlemapsv2.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="example.androidhive.googlemapsv2.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <!-- Required to show current location -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

   <!-- Required OpenGL ES 2.0. for Maps V2 -->
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="example.androidhive.googlemapsv2.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
             <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
    </application>

</manifest>

MainActivity.java
package example.androidhive.googlemapsv2;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;

import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.widget.Toast;

public class MainActivity extends Activity{
    private GoogleMap googleMap;
    private final String TAG ="GoogleMapsv2";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        try {
            initializeMap();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    // Function to load map. If map is not created it will create it for you

    private void initializeMap() {
        Log.d(TAG,"IntializeMap");
        if (googleMap == null) {
            googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
            // Check if map is created successfully
            if (googleMap == null) {
                Toast.makeText(getApplicationContext(), "Unable to create maps",Toast.LENGTH_SHORT).show();
            }
        }
    }

    @Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        initializeMap();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

}

activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.MapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</RelativeLayout>

Edit :
when I make following change in my manifest file
<meta-data android:name="com.google.android.gms.version" android:value="AIzaSyBAjfcxZvbt_COHjy7igHZnLBfsO1cfoM8" />

Another error comes up
01-14 18:28:21.323: W/Bundle(13254): Key com.google.android.gms.version expected Integer but value was a java.lang.String.  The default value 0 was returned.
01-14 18:28:21.355: W/Bundle(13254): Attempt to cast generated internal exception:
01-14 18:28:21.355: W/Bundle(13254): java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
01-14 18:28:21.355: W/Bundle(13254):    at android.os.Bundle.getInt(Bundle.java:945)
01-14 18:28:21.355: W/Bundle(13254):    at android.os.Bundle.getInt(Bundle.java:927)
01-14 18:28:21.355: W/Bundle(13254):    at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
01-14 18:28:21.355: W/Bundle(13254):    at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
01-14 18:28:21.355: W/Bundle(13254):    at com.google.android.gms.maps.internal.q.v(Unknown Source)
01-14 18:28:21.355: W/Bundle(13254):    at com.google.android.gms.maps.internal.q.u(Unknown Source)
01-14 18:28:21.355: W/Bundle(13254):    at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
01-14 18:28:21.355: W/Bundle(13254):    at com.google.android.gms.maps.MapFragment$b.cE(Unknown Source)
01-14 18:28:21.355: W/Bundle(13254):    at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
01-14 18:28:21.355: W/Bundle(13254):    at com.google.android.gms.dynamic.a.a(Unknown Source)
01-14 18:28:21.355: W/Bundle(13254):    at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
01-14 18:28:21.355: W/Bundle(13254):    at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
01-14 18:28:21.355: W/Bundle(13254):    at android.app.Activity.onCreateView(Activity.java:4734)
01-14 18:28:21.355: W/Bundle(13254):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
01-14 18:28:21.355: W/Bundle(13254):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
01-14 18:28:21.355: W/Bundle(13254):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
01-14 18:28:21.355: W/Bundle(13254):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-14 18:28:21.355: W/Bundle(13254):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-14 18:28:21.355: W/Bundle(13254):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:281)
01-14 18:28:21.355: W/Bundle(13254):    at android.app.Activity.setContentView(Activity.java:1881)
01-14 18:28:21.355: W/Bundle(13254):    at example.androidhive.googlemapsv2.MainActivity.onCreate(MainActivity.java:18)
01-14 18:28:21.355: W/Bundle(13254):    at android.app.Activity.performCreate(Activity.java:5122)
01-14 18:28:21.355: W/Bundle(13254):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
01-14 18:28:21.355: W/Bundle(13254):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)
01-14 18:28:21.355: W/Bundle(13254):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
01-14 18:28:21.355: W/Bundle(13254):    at android.app.ActivityThread.access$600(ActivityThread.java:162)
01-14 18:28:21.355: W/Bundle(13254):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
01-14 18:28:21.355: W/Bundle(13254):    at android.os.Handler.dispatchMessage(Handler.java:107)
01-14 18:28:21.355: W/Bundle(13254):    at android.os.Looper.loop(Looper.java:194)
01-14 18:28:21.355: W/Bundle(13254):    at android.app.ActivityThread.main(ActivityThread.java:5371)
01-14 18:28:21.355: W/Bundle(13254):    at java.lang.reflect.Method.invokeNative(Native Method)
01-14 18:28:21.355: W/Bundle(13254):    at java.lang.reflect.Method.invoke(Method.java:525)
01-14 18:28:21.355: W/Bundle(13254):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
01-14 18:28:21.355: W/Bundle(13254):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
01-14 18:28:21.355: W/Bundle(13254):    at dalvik.system.NativeStart.main(Native Method)
01-14 18:28:21.374: D/AndroidRuntime(13254): Shutting down VM
01-14 18:28:21.374: W/dalvikvm(13254): threadid=1: thread exiting with uncaught exception (group=0x414929a8)
01-14 18:28:21.378: E/AndroidRuntime(13254): FATAL EXCEPTION: main
01-14 18:28:21.378: E/AndroidRuntime(13254): java.lang.RuntimeException: Unable to start activity ComponentInfo{example.androidhive.googlemapsv2/example.androidhive.googlemapsv2.MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2343)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.app.ActivityThread.access$600(ActivityThread.java:162)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.os.Handler.dispatchMessage(Handler.java:107)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.os.Looper.loop(Looper.java:194)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.app.ActivityThread.main(ActivityThread.java:5371)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at java.lang.reflect.Method.invokeNative(Native Method)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at java.lang.reflect.Method.invoke(Method.java:525)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at dalvik.system.NativeStart.main(Native Method)
01-14 18:28:21.378: E/AndroidRuntime(13254): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:281)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.app.Activity.setContentView(Activity.java:1881)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at example.androidhive.googlemapsv2.MainActivity.onCreate(MainActivity.java:18)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.app.Activity.performCreate(Activity.java:5122)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
01-14 18:28:21.378: E/AndroidRuntime(13254):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)
01-14 18:28:21.378: E/AndroidRuntime(13254):    ... 11 more
01-14 18:28:21.378: E/AndroidRuntime(13254): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 4030500 but found 0.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

Please help me to find out the solution.

A: As you commented on @gokhan answer, you should do
<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

However, you still need to do
<meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="@string/app_key" />

where app_key is your Key.
I suggest you to create an ids.xml file inside your values folder and have something like:
<resources>
    <string name="app_id" translatable="false">1234567890</string>
    <string name="app_key" translatable="false">QWERTTYruyfgREYT</string>
    <string name="facebookAppId" translatable="false"></string>

A: Probably You forgot to add your google_api_key you must add your key for use this service
You should add your key too AndroidManifest.xml
<application>

<meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="xxxxxxxxxx" />

</application>

like this.
I hope this is help you

A: I think you need to download google play services r10  or even r12. Then you don't need
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

For better understanding follow this link

A: After adding these two lines in my manifest file It worked .
For eclipse add this :
    <meta-data android:name="com.google.android.gms.version"
     android:value="@integer/google_play_services_version" />

    <meta-data android:name="com.google.android.maps.v2.API_KEY"
              android:value="Your KEY" />

If you are using Android Studio with gradle0.7+ then add this line:
<meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="Your Key" />

A: package com.synergyifs.libapp;

import android.Manifest;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Address;
import android.location.Criteria;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AutoCompleteTextView;
import android.widget.Toast;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.ui.PlacePicker;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.synergyifs.libapp.adapter.PlacesAutoCompleteAdapter;

import java.util.List;
import java.util.Locale;

/**
 * Created by Admin34 on 23-03-2016.
 */
public class MapDemoActivity extends AppCompatActivity implements OnMapReadyCallback,
        GoogleApiClient.ConnectionCallbacks,
        GoogleApiClient.OnConnectionFailedListener,
        GoogleMap.OnMarkerDragListener, GoogleMap.OnMapLongClickListener {

    int PLACE_PICKER_REQUEST = 1;
    private GoogleMap map;
    private LatLng synergyIFS = new LatLng(18.511478, 73.801217);
    private GoogleApiClient googleApiClient;
    private double longitude;
    private double latitude;

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

        SupportMapFragment fragment = (SupportMapFragment) this.getSupportFragmentManager().findFragmentById(R.id.main_map);
        fragment.getMapAsync(this);
        googleApiClient = new GoogleApiClient.Builder(MapDemoActivity.this)
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .addApi(LocationServices.API).build();
    }

    private void initMap(GoogleMap googleMap) {
        map = googleMap;
        CameraUpdate center = CameraUpdateFactory.newLatLng(synergyIFS);
        CameraUpdate zoom = CameraUpdateFactory.zoomTo(10f);
        map.moveCamera(center);
        map.animateCamera(zoom);
        map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
        getCurrentLocation();
        map.setMyLocationEnabled(true);
        map.setOnMapLongClickListener(this);
        map.setOnMarkerDragListener(this);

    }

    private void getCurrentLocation() {
        Location location = LocationServices.FusedLocationApi.getLastLocation(googleApiClient);
        if (location != null) {
            //Getting longitude and latitude
            longitude = location.getLongitude();
            latitude = location.getLatitude();

            //moving the map to location
            moveMap();
        }
    }

    private void moveMap() {
        String msg = latitude + ", " + longitude;

        //Creating a LatLng Object to store Coordinates
        LatLng latLng = new LatLng(latitude, longitude);

        //Adding marker to map
        map.addMarker(new MarkerOptions()
                .position(latLng) //setting position
                .draggable(true) //Making the marker draggable
                .title("Current Location")); //Adding a title

        //Moving the camera
        map.moveCamera(CameraUpdateFactory.newLatLng(latLng));

        //Animating the camera
        map.animateCamera(CameraUpdateFactory.zoomTo(15));

        //Displaying current coordinates in toast
        Toast.makeText(this, msg, Toast.LENGTH_LONG).show();
    }

    protected void onStart() {
        googleApiClient.connect();
        super.onStart();
    }

    @Override
    protected void onStop() {
        googleApiClient.disconnect();
        super.onStop();
    }

    @Override
    public void onMapReady(GoogleMap googleMap) {
        initMap(googleMap);
    }

    @Override
    public void onConnected(Bundle bundle) {
        getCurrentLocation();
    }

    @Override
    public void onConnectionSuspended(int i) {

    }

    @Override
    public void onConnectionFailed(ConnectionResult connectionResult) {

    }

    @Override
    public void onMarkerDragStart(Marker marker) {

    }

    @Override
    public void onMarkerDrag(Marker marker) {

    }

    @Override
    public void onMarkerDragEnd(Marker marker) {
        latitude = marker.getPosition().latitude;
        longitude = marker.getPosition().longitude;

        //Moving the map
        moveMap();
        new ReverserGeoCoding(MapDemoActivity.this).execute(marker.getPosition());
    }

    @Override
    public void onMapLongClick(LatLng latLng) {
        map.clear();

        //Adding a new marker to the current pressed position
        map.addMarker(new MarkerOptions()
                .position(latLng)
                .draggable(true));
    }

    class ReverserGeoCoding extends AsyncTask<LatLng,Void,String>
    {
        Context mContext;

        public ReverserGeoCoding(Context context){
            super();
            mContext = context;
        }
        @Override
        protected String doInBackground(LatLng... params) {

            Geocoder geocoder=new Geocoder(mContext);
            double Lat=params[0].latitude;
            double  Long=params[0].longitude;

            List<Address> addresses = null;
            String addressText="";

           try
           {
               addresses = geocoder.getFromLocation(Lat, Long,2);
           }catch (Exception e)
           {
               e.printStackTrace();
           }
            if(addresses != null && addresses.size() > 0 ){
                Address address = addresses.get(0);

                addressText = String.format("%s, %s, %s",
                        address.getMaxAddressLineIndex() > 0 ? address.getAddressLine(0) : "",
                        address.getLocality(),
                        address.getCountryName());
            }
            return addressText;
        }

        @Override
        protected void onPostExecute(String s) {

               if(s!=null)
               {
                   Toast.makeText(mContext,s,Toast.LENGTH_SHORT).show();
               }
            else
               {
                   Toast.makeText(mContext,"no address found",Toast.LENGTH_SHORT).show();
               }
        }
    }
}

<?xml version="1.0" encoding="utf-8"?>
<manifest
    package="com.synergyifs.libapp"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:largeHeap="true"
        android:name=".app.MyApplication"
        android:theme="@style/AppTheme">

        <activity android:name=".SplashScreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity
            android:name=".HomeActivity"
            android:windowSoftInputMode="adjustPan"
            android:screenOrientation="portrait">
        </activity>
        <activity
            android:name=".Login"
            android:windowSoftInputMode="adjustPan"
            android:screenOrientation="portrait">
        </activity>
        <activity
            android:name=".RegisterUser"
            android:windowSoftInputMode="adjustPan"
            android:screenOrientation="portrait">
        </activity>
        <activity
            android:name=".MapDemoActivity"
            android:windowSoftInputMode="adjustPan"
            android:screenOrientation="portrait">
        </activity>
        <activity
            android:name=".PlacesActivity"
            android:windowSoftInputMode="adjustPan"
            android:screenOrientation="portrait">
        </activity>
        <!-- ATTENTION: This was auto-generated to add Google Play services to your project for
             App Indexing.  See https://g.co/AppIndexing/AndroidStudio for more information. -->
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version"/>
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_api_key"/>
    </application>

</manifest>


text:
Q: Random value from database column but only one time in Laravel My database query return random row from database. Is there any way when page load and return this random string when user refresh the page to not change the string?
So this is my controller
public function view() {

    $view = View::orderByRaw("RAND()")->limit('1')->get();

    return View::make('site.view', [
            'view' => $view
        ]);
}

And in my blade I have
@foreach($view as $rand)
  {{ Form::open() }}
      {{ $rand['my_view'] }}

       // bunch of form fealds
       <button type="submit" class="btn btn-primary">Submit</button>
  {{ Form::clode() }}
@endforeach

So here user got random string and need to fill the form and add also this string. Then I save all information in database. Everything is saved perfectly in database. The problem is that user can refresh multiple time table after he submit form and can get confused when he see another random string...

A: Option #1 - save the data you got from the View::make to a session and return it:
public function view() {
    $rand_view = Session::get('rand_view');
    if (!$rand_view) {
        $view = View::orderByRaw("RAND()")->limit('1')->get();

        $rand_view = View::make('site.view', [
            'view' => $view
        ]);

        Session::put('rand_view', $rand_view);
    }
    return $rand_view;
}

Option #2 - for a specific user - always generate the same "random":
public function view() {
    // To make sure we generate the same RAND() we generate a random seed for each user and we save that seed in the session for that user.
    $rand_seed = Session::get('rand_seed');
    if (!$rand_seed) {
        $rand_seed = mt_rand();
        Session::put('rand_seed', $rand_seed);
    };

    $view = View::orderByRaw("RAND({$rand_seed})")->limit('1')->get();

    return View::make('site.view', [
        'view' => $view
    ]);
}

Update
After some debugging it seems like option #1 will not work because View::make returns an object that can't be serialized. If you need this solution use option #2

A: Just save the random data into a session variable a display the contents of the session variable if it is present. Just do not forget to unset the variable when it is no longer needed.


text:
Q: Divs in same line only on a wider window See: fiddle
When the window is long enough, both divs are in the same line, but when it's smaller, the second div(.footers) moves to a new line. I wan't them to be in the same line all the time.
Css from the left div:
.footer .footer_links {
    float: left;
    width: 250px;
    padding: 25px 0px 0px 20px;
    min-height: 95px;
    border-right: 1px solid #d9d9d9;
    text-align: left;
}

Css from the right div:
.footer .footers {
    text-align: left;
    float: left;
    padding: 0px 20px 0px 20px;
}

What is causing this problem?

A: If you only want to give the left div (.footer_links) a fixed height, instead of floating the div on the right (.footers), give it overflow:hidden. This will cause it to fill the remaining width of the page:
.footer .footers {
    text-align: left;
    overflow:hidden;
    padding: 0px 20px 0px 20px;
}

JSFiddle

A: try this give max-width:
DEMO
CSS
footer {
    background: #f2f2f2 !important;
    margin-top: 20px;
    padding: 10px 0px 10px 0px;
}
.footer .footer_links {
    float: left;
    width: 250px;
    padding: 25px 0px 0px 20px;
    min-height: 95px;
    border-right: 1px solid #d9d9d9;
    text-align: left;
}
.footer a {
    font-size: 14px;
    color: #898989 !important;
}
.footer .footers {
    text-align: left;
    overflow:hidden;
    padding: 0px 20px 0px 20px;
}
.footer .footers p {
    font-size: 14px;
    color: #898989;
    line-height: 20px;
}

.clear{
    clear: both;
}

in DEMO2 you have write max-width: then its working
DEMO2
CSS
.footer .footers {
    text-align: left;
    float: left;
    padding: 0px 20px 0px 20px;
    max-width:300px;
}

A: .footer .footer_links {
    float: left;
    width: 20%; // In percent
    padding: 25px 0px 0px 20px;
    min-height: 95px;
    border-right: 1px solid #d9d9d9;
    text-align: left;
}

.footer .footers {
    text-align: left;
    float: left;
    width:70%; // In percent
    padding: 0px 20px 0px 20px;
}

A: You can add to a .footers div a white-space , and fixed height:
.footer .footers {
    text-align: left;
    float: left;
    padding: 0px 20px 0px 20px;
    white-space: nowrap;
    height: 20px;
}


text:
Q: Detect what Unicode glyphs exist? Is there a way in JavaScript/CSS/web stuff to detect whether the system has a valid glyph for a certain Unicode character?
For example, I would like to detect whether a certain character in a language shows up as a square box because the user doesn't have a font that shows those Unicode points, or if they will actually be seeing the characters.

A: Possible solution described here: Detecting missing character glyphs, and Firefox's little boxes with hex codepoints inside them
Basically, paint the glyph to a canvas as an oblique (normal) character, paint to another canvas as italic. then compare pixel by pixel. If they are identical, then the glyph is not available in the font.