text:
Q: Notepad++: Invalid schema or missing namespace Error what occurs is "Invalid schema or missing namespace".  I'm new to this, and I don't know what have I do now. This error doesn't show me any wrong line or some other missing value im my code.
When I click in my NotePad++: Plugs -> XML Tools -> Validate now -> Invalid schema or missing namespace
I have XSD file this:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xsd:annotation>
        <xsd:documentation xml:lang="pl">Definicja zawiadomienia w formacie XML</xsd:documentation>
    </xsd:annotation>
    <xsd:element name="WYDZIAŁ">
        <xsd:annotation>
            <xsd:documentation>Dokładny opis wydziału</xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="IDENTYFIKATOR" type="xsd:ID">
                    <xsd:annotation>
                        <xsd:documentation>ID wydziału</xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element name="NAZWA" type="xsd:string">
                    <xsd:annotation>
                        <xsd:documentation>Nazwa wydziału</xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element name="ADRES" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
                    <xsd:annotation>
                        <xsd:documentation>Adres wydziału</xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element ref="PRACOWNICY"/>
                <xsd:element ref="ZBIÓR_PRZEDMIOTÓW"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <!--===========================================================-->
    <xsd:element name="PRACOWNICY">
        <xsd:annotation>
            <xsd:documentation>Informacje dotyczace pracowników</xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="IMIE" type="xsd:string">
                    <xsd:annotation>
                        <xsd:documentation>Imie parcownika</xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element name="NAZWISKO" type="xsd:string">
                    <xsd:annotation>
                        <xsd:documentation>Nazwisko pracownika</xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element name="TYTUŁ" type="xsd:string">
                    <xsd:annotation>
                        <xsd:documentation>Tytuł pracownika</xsd:documentation>
                    </xsd:annotation>
                    <xsd:simpleType>
                        <xsd:restriction base="xsd:string">
                            <xsd:enumeration value="NAUKOWY"/>
                            <xsd:enumeration value="ADMINISTRACYJNY"/>
                            <xsd:enumeration value="TECHNICZNY"/>
                        </xsd:restriction>
                    </xsd:simpleType>
                </xsd:element>
                <xsd:element name="KATEGORIA" type="xsd:string" minOccurs="0">
                    <xsd:annotation>
                        <xsd:documentation>KATEGORIA pracownika</xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element name="ADRES" type="xsd:string">
                    <xsd:annotation>
                        <xsd:documentation>ADRES parcownika</xsd:documentation>
                    </xsd:annotation>
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="ULICA" type="xsd:string">
                                <xsd:annotation>
                                    <xsd:documentation>ULICA</xsd:documentation>
                                </xsd:annotation>
                            </xsd:element>
                            <xsd:element name="NUMER" type="xsd:integer">
                                <xsd:annotation>
                                    <xsd:documentation>NUMER</xsd:documentation>
                                </xsd:annotation>
                            </xsd:element>
                            <xsd:element name="KOD_POCZTOWY" type="xsd:string">
                                <xsd:annotation>
                                    <xsd:documentation>KOD_POCZTOWY</xsd:documentation>
                                </xsd:annotation>
                                <xsd:simpleType>
                                    <xsd:restriction base="xsd:string">
                                        <xsd:minLength value="6"/>
                                        <xsd:maxLength value="6"/>
                                        <xsd:pattern value="\d{2}-\d{3}"/>
                                    </xsd:restriction>
                                </xsd:simpleType>
                            </xsd:element>
                            <xsd:element name="MIEJSCOWOSC" type="xsd:string">
                                <xsd:annotation>
                                    <xsd:documentation>MIEJSCOWOSC</xsd:documentation>
                                </xsd:annotation>
                            </xsd:element>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="ZBIÓR_PRZEDMIOTÓW">
        <xsd:annotation>
            <xsd:documentation>Informacje dotyczace adresata zawiadomienia</xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="ID_PRZEDMIOTU" type="xsd:ID">
                    <xsd:annotation>
                        <xsd:documentation>ID_PRZEDMIOTU</xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element name="NAZWA" type="xsd:string">
                    <xsd:annotation>
                        <xsd:documentation>NAZWA</xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element name="LICZBA_UCZESTNIKOW" type="xsd:integer">
                    <xsd:annotation>
                        <xsd:documentation>LICZBA_UCZESTNIKOW</xsd:documentation>
                    </xsd:annotation>
                    <xsd:simpleType>
                    <xsd:restriction base="xsd:integer">
                        <xsd:minInclusive  value="6"/>
                        <xsd:maxInclusive  value="400"/>
                    </xsd:restriction>
                </xsd:simpleType>
                </xsd:element>
                <xsd:element name="PROWADZCY" type="xsd:string" minOccurs="0">
                    <xsd:annotation>
                        <xsd:documentation>Numer wydzialu</xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

and my xml file like this:
<?xml version="1.0" encoding="UTF-8" ?>
<WYDZIAŁ>
    <IDENTYFIKATOR>12</IDENTYFIKATOR>
    <NAZWA>WARTOŚĆ TEKSTOWA NAZWA</NAZWA>
    <ADRES> WARTOSC TEKSTOWA ADRES</ADRES>
    <PRACOWNICY>
        <IMIE>WARTOŚĆ TEKSTOWA IMIE</IMIE>
        <NAZWISKO>WARTOŚĆ TEKSTOWA NAZWISKO</NAZWISKO>
        <TYTUŁ>WARTOŚĆ TEKSTOWA TYTUŁ</TYTUŁ>
        <KATEGORIA>WARTOŚĆ TEKSTOWA KATEGORIA</KATEGORIA>
        <ADRES>
            <ULICA>WARTOŚĆ TEKSTOWA ULICA</ULICA>
            <NUMER>21</NUMER>
            <KOD_POCZTOWY>62-890</KOD_POCZTOWY>
            <MIEJSCOWOSC>WARTOŚĆ TEKSTOWA MIEJSCOWOSC</MIEJSCOWOSC>
        </ADRES>
    </PRACOWNICY>
    <ZBIÓR_PRZEDMIOTÓW>
        <ID_PRZEDMIOTU>12</ID_PRZEDMIOTU>
        <NAZWA>WARTOŚĆ TEKSTOWA NAZWA</NAZWA>
        <LICZBA_UCZESTNIKOW>66</LICZBA_UCZESTNIKOW>
        <PROWADZACY>WARTOŚĆ TEKSTOWA PROWADZCY</PROWADZACY>
    </ZBIÓR_PRZEDMIOTÓW>
</WYDZIAŁ>

A: Notepad++ problems:  You have to associate your XSD with your XML.  I will show an example of how to do so via the standard hint mechanism provided by xsi:noNamespaceSchemaLocation in the XML below, or use Notepad++'s particular binding mechanism.
See:

*

*Using Notepad++ to validate XML against an XSD

*How to link XML to XSD using schemaLocation or noNamespaceSchemaLocation?
XSD problems: Do not define both a type attribute and provide a type child element to xs:element.  (3 occurrences of this issue)
XML problems: Abide by the XSD's enumeration constraints given on several elements.  Spell the tag the same as is specified in the XSD.  Etc.
Corrections to your XSD and XML follow.  Once you follow the instructions for associating the XSD with your XML, the updated XSD will validate the updated XML.
XSD
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xsd:annotation>
    <xsd:documentation xml:lang="pl">Definicja zawiadomienia w formacie XML</xsd:documentation>
  </xsd:annotation>
  <xsd:element name="WYDZIAŁ">
    <xsd:annotation>
      <xsd:documentation>Dokładny opis wydziału</xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="IDENTYFIKATOR" type="xsd:ID">
          <xsd:annotation>
            <xsd:documentation>ID wydziału</xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="NAZWA" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Nazwa wydziału</xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="ADRES" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
          <xsd:annotation>
            <xsd:documentation>Adres wydziału</xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element ref="PRACOWNICY"/>
        <xsd:element ref="ZBIÓR_PRZEDMIOTÓW"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <!--===========================================================-->
  <xsd:element name="PRACOWNICY">
    <xsd:annotation>
      <xsd:documentation>Informacje dotyczace pracowników</xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="IMIE" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Imie parcownika</xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="NAZWISKO" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Nazwisko pracownika</xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="TYTUŁ">
          <xsd:annotation>
            <xsd:documentation>Tytuł pracownika</xsd:documentation>
          </xsd:annotation>
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="NAUKOWY"/>
              <xsd:enumeration value="ADMINISTRACYJNY"/>
              <xsd:enumeration value="TECHNICZNY"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="KATEGORIA" type="xsd:string" minOccurs="0">
          <xsd:annotation>
            <xsd:documentation>KATEGORIA pracownika</xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="ADRES">
          <xsd:annotation>
            <xsd:documentation>ADRES parcownika</xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="ULICA" type="xsd:string">
                <xsd:annotation>
                  <xsd:documentation>ULICA</xsd:documentation>
                </xsd:annotation>
              </xsd:element>
              <xsd:element name="NUMER" type="xsd:integer">
                <xsd:annotation>
                  <xsd:documentation>NUMER</xsd:documentation>
                </xsd:annotation>
              </xsd:element>
              <xsd:element name="KOD_POCZTOWY">
                <xsd:annotation>
                  <xsd:documentation>KOD_POCZTOWY</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="6"/>
                    <xsd:maxLength value="6"/>
                    <xsd:pattern value="\d{2}-\d{3}"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element name="MIEJSCOWOSC" type="xsd:string">
                <xsd:annotation>
                  <xsd:documentation>MIEJSCOWOSC</xsd:documentation>
                </xsd:annotation>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="ZBIÓR_PRZEDMIOTÓW">
    <xsd:annotation>
      <xsd:documentation>Informacje dotyczace adresata zawiadomienia</xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="ID_PRZEDMIOTU" type="xsd:ID">
          <xsd:annotation>
            <xsd:documentation>ID_PRZEDMIOTU</xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="NAZWA" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>NAZWA</xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="LICZBA_UCZESTNIKOW">
          <xsd:annotation>
            <xsd:documentation>LICZBA_UCZESTNIKOW</xsd:documentation>
          </xsd:annotation>
          <xsd:simpleType>
            <xsd:restriction base="xsd:integer">
              <xsd:minInclusive  value="6"/>
              <xsd:maxInclusive  value="400"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="PROWADZCY" type="xsd:string" minOccurs="0">
          <xsd:annotation>
            <xsd:documentation>Numer wydzialu</xsd:documentation>
          </xsd:annotation>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

XML
<?xml version="1.0" encoding="UTF-8" ?>
<WYDZIAŁ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="try.xsd">
  <IDENTYFIKATOR>a12</IDENTYFIKATOR>
  <NAZWA>WARTOŚĆ TEKSTOWA NAZWA</NAZWA>
  <ADRES> WARTOSC TEKSTOWA ADRES</ADRES>
  <PRACOWNICY>
    <IMIE>WARTOŚĆ TEKSTOWA IMIE</IMIE>
    <NAZWISKO>WARTOŚĆ TEKSTOWA NAZWISKO</NAZWISKO>
    <TYTUŁ>NAUKOWY</TYTUŁ>
    <KATEGORIA>WARTOŚĆ TEKSTOWA KATEGORIA</KATEGORIA>
    <ADRES>
      <ULICA>WARTOŚĆ TEKSTOWA ULICA</ULICA>
      <NUMER>21</NUMER>
      <KOD_POCZTOWY>62-890</KOD_POCZTOWY>
      <MIEJSCOWOSC>WARTOŚĆ TEKSTOWA MIEJSCOWOSC</MIEJSCOWOSC>
    </ADRES>
  </PRACOWNICY>
  <ZBIÓR_PRZEDMIOTÓW>
    <ID_PRZEDMIOTU>a13</ID_PRZEDMIOTU>
    <NAZWA>WARTOŚĆ TEKSTOWA NAZWA</NAZWA>
    <LICZBA_UCZESTNIKOW>66</LICZBA_UCZESTNIKOW>
    <PROWADZCY>WARTOŚĆ TEKSTOWA PROWADZCY</PROWADZCY>
  </ZBIÓR_PRZEDMIOTÓW>
</WYDZIAŁ>


text:
Q: Old story about an assassin squad sent to kill a man who stopped war The story is told from the point of view of a member of a squad of soldiers sent to infiltrate a dome of some kind that belongs to an immortal man who stopped all countries from fighting wars.
The immortal constructed the dome and would fire missiles at any country that launched an attack of an kind.

The view point character is a member of the 30th squad sent to kill the immortal. They infiltrate the dome but end up in a death trap maze where each member dies except him. He survives and confronts the immortal who is actually a member of the 10th squad sent to kill the immortal. The immortal did exist but at some point a squad killed him. Instead of letting all the countries restart war a single member of the squad decided to continue the anti war campaign.

All numbers are approximate.
Ring any bells for anyone?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Unable to delete records from mysql database using codeigniter datamapper I am developing a site that will fetche reviews on various renowned car dealers (i.e. Fordham Toyota, Westchester Toyota, Toyota Of Manhattan etc.) from  major review sites like CitySeach, Dealer Rater, Insider Pages, Yelp, Yahoo-local, Google+ etc. Basically the functionality of this site is to allow business owners to monitor their online reviews on major review sites.
I am using codeigniter and datamapper (version 1.8) in this project and facing some problems to delete data from mysql database.
Here is my part of table structures as follows:
        +----------+      +----------------+      +--------------+
        | Profile  |      | profiles_users |      | users        |
        +----------+      +----------------+      +--------------+
        | id       |<---- | id             |----->| id           |
        | name     |      | profile_id     |      | name         |
        +----------+      | user_id        |      | email        |
          |               +----------------+      | password     |
          |                                       +--------------+
          +--> +--------------+
               | reviews      |
               +--------------+
               | id           |
               | title        |
               | author       |
               | review       |
               | rating       |
               | date         |
               | profile_id   |
               +--------------+

In the "profile" table I am storing the delar name (i.e like Fordham Toyota, Westchester Toyota etc.) and in "user" table I am storing the name of the business owners.  I am using the api to fetch reviews and store them within "reviews" table with "profile-id".
There may be more than 20000 reviews for each profile. Presently I have avg. 12000 reviews per profile.
Whenever I am going to delete a profile, the reviews for that profile should be deleted , but here I get an error message like :
"Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20 bytes) in /home/business/public_html/system/database/DB_active_rec.php on line 1999"
Can anybody please suggest me in this regard.

A: Try to change memory limit like this:
ini_set('memory_limit', '-1');


text:
Q: PHP error in mysql database selection I wrote a code in PHP to connect with Mysql database and add data into it.. code is given below:
$dbhostname = "localhost";
$dbusername = "root";
$dbpassword = "root";
$dbname = "rms_invoice";

function showDBMessage(){
    if($_POST["name"] != NULL){
        //came from register page
        if(register()){
            print("
Registered successfully!!!");
        } else {
            print("
Registration failed!!!");
        }
    }
}
function register(){
    global $dbhostname,$dbusername,$dbpassword,$dbname;
    // Create connection
    $con=mysqli_connect($dbhostname,$dbusername,$dbpassword);
    // Check connection
    if (!mysqli_connect_errno()) {
        print("MYSQL Connection established...
");
        echo "
Successful: ".mysqli_get_host_info($con);
        $selected = mysqli_select_db($con, $dbname);
        if(false!==$selected){
            $name = mysqli_real_escape_string($con, $_POST["name"]);
            $username = mysqli_real_escape_string($con, $_POST["username"]);
            $password = mysqli_real_escape_string($con, $_POST["password"]);
            $address = mysqli_real_escape_string($con, $_POST["address"]);

            $insertUserQuery="INSERT INTO USER(name,username,password,address) VALUES ('$name','$username','$password','$address')";
            echo $insertUserQuery;
            $result = mysqli_query($con, $insertUserQuery);
            if ( false===$result ) {
                printf("
mysqli_connect_error: %s\n", mysqli_connect_error());
                printf("
mysqli_error: %s\n", mysqli_error($con));
            } else {
                echo "
New User Added!!!

";
                return true;
            }
        }else{
            printf("
Error while selecting database, error:%s\n",mysqli_errno($con));
        }
    } else {
        print("
Failed to connect to MySQL: "+mysqli_connect_error());
    }
    mysqli_close($con);
    return false;
}

and the output is:
MYSQL Connection established...
Successful: localhost via TCP/IP
INSERT INTO USER(name,username,password,address) VALUES ('nitin','ndthokare','p','beed')
mysqli_connect_error:
mysqli_error: No database selected
Registration failed!!!

It is getting connected but database selection seems to be problem. (same query executes successfully through mysql cli).
I tried many possible corrections in code discussed on SO, but could not succeed.
Can anybody help me to find out the mistake?

A:  if(false!==!$selected){

is extremely unusual operator (called "double negative") means you want to execute the following code block only if $selected is FALSE.
to make it much less confusing, write it without all these magic chants
 if($selected){

or even omit this useless check completely.


text:
Q: Selecting column data from SQL ordered inside while loop I have a database like this
|| ID    -     COL1   - COL2||
|| 1     -    row1A  -  1  ||
|| 2     -    row1A  -  1  ||
|| 3     -    row1A  -  2  ||
|| 4     -    row1B  -  2  ||
|| 5     -    row1A  -  3  ||
|| 6     -    row1B  -  3  ||

i want to ECHO these data like this
$query = "SELECT * FROM DB WHERE COL1 = 'row1A'";
while($row = $stmt->fetch()){
    $col = $row['COL1'];
    echo "

Set1: $col
 // = row1A, row1A  as where COL2 = 1

Set2: $col
 // = row1A as where COL2 = 2

Set3: $col
 // = row1A as where COL2 = 3
    ";
}

I'm using this with a relation between 3 tables so each row1A will has its own name in different table, But right now i want to know how can i call the database ordered by COL2
For each SetN gets the value of COL1 WHERE COL2 = N

A: Use ORDER BY in sql. Please check following code.
$query = "SELECT * FROM DB WHERE COL1 = 'row1A' ORDER BY COL2 ASC";

A: You can ORDER any data in SQL Query by COLUMN with

ORDER BY

Like
$query = "SELECT * FROM DB WHERE COL1 = 'row1A' ORDER BY COL2 DESC (or ASC)";


text:
Q: Adding planetary symbols to a graph I am trying to add planetary symbols to a graph in R, while plotting planetary positions. Hershey seems to have those symbols embedded; e.g., demo(Hershey) gives the symbol \JU for the planetary symbol of Jupiter.
The problem is that I cannot add those symbols to the function text().
Any trick to make me move forward?
Thanks in advance.


text:
Q: unable to write the complete audiostream to an audio file in java I am trying to convert audio to audiostream and then back to audio using java. When i read the wav file into the byte array it shows around 30000 bytes but when i write it onto a new fle, it just writes 44 bytes.Please tell me where am i going wrong. The code snippet is as follows:
    File src = new File("C:\\test.wav");
    AudioInputStream ais = AudioSystem.getAudioInputStream(src);
    byte[] data = new byte[ais.available()];
    int x = ais.read(data);

    int n = AudioSystem.write(ais, AudioFileFormat.Type.WAVE, new File("C:\\test2.wav"));
    System.out.println("x="+x+"  n="+n);

The output of n is 44.

A: I believe the problem is that you have read the entire contents of the AudioInputStream into the byte array. This means when you pass the AudioInputStream instance to the AudioSystem.write() method it will already be at the end of the file. (The 44 bytes it is writing are probably just header information or something similar.)
The quick way to diagnose is to comment out the call to ais.read(data) and see if it starts writing out the file properly.
A possible solution is to use the mark() and reset() methods on the AudioInputStream to move back to the start of the file after reading the file into the byte array.


text:
Q: Minesweeper FloodFill JavaScript Got some problems with floodfill, i don't rly understand what is wrong with it as I tried to copy some code from someone other code, it was working for him, for me not.
I have got a 9x9 double dimension array as border. First i wanted to display only fields horizontally, but the code goes infinity. With one FloodFill on it works good.
    function floodFill(x, y) {

    if (y < 0) {
        console.log("left border exceeded");
        return;
    }
    if (y > 8) {
        console.log("right border exceeded");
        return;
    }
    if (numberOfBombsAdjacentToField[x][y] > 0) {
        console.log("there are bombs nearly");
        return;
    }
    if (document.getElementById(((x).toString() + (y).toString())).style.backgroundColor == "darkGray") {
        console.log("already clicked");
        return;
    }
    document.getElementById(((x).toString() + (y).toString())).style.backgroundColor = "darkGray";
    floodFill(x, y + 1);
    floodFill(x, y - 1);
}

A: Ok the problem was with the browser. Google Chrome was reading the color of DarkGray as darkgray. After i renamed it everything is fine. In addition to this i improved my code and that is the final form:
function floodFill(x, y) {

    if (y < 0) {
        console.log("left border exceeded");
        return;
    }
    if (y > 8) {
        console.log("right border exceeded");
        return;
    }
    if (x < 0) {
        console.log("top border exceeded");
        return;
    }
    if (x > 8) {
        console.log("bottom border exceeded");
        return;
    }
    if (board[x][y]) {
        console.log("bomb!");
        return;
    }
    if (document.getElementById(((x).toString() + (y).toString())).style.backgroundColor == "darkgray") {
        console.log("already clicked");
        return;
    }
    if (numberOfBombsAdjacentToField[x][y] > 0) {
        var divToChange = document.getElementById((x.toString() + y.toString()));
        divToChange.innerHTML = numberOfBombsAdjacentToField[x][y].toString();
        divToChange.style.backgroundColor = "darkGray";
        return;
    }
    else {
        document.getElementById(((x).toString() + (y).toString())).style.backgroundColor = "darkGray";
        document.getElementById(((x).toString() + (y).toString())).innerHTML = "";
    }
    floodFill(x, y - 1);
    floodFill(x, y + 1);
    floodFill(x + 1, y);
    floodFill(x - 1, y);
    floodFill(x - 1, y - 1);
    floodFill(x - 1, y + 1);
    floodFill(x + 1, y - 1);
    floodFill(x + 1, y + 1);
}


text:
Q: Amazon Fire TV rooting How to root Amazon Fire TV after the most recent update? I have tried xda-developers recommendations but I have encountered that after the most recent update, the suggested apks to root the device don't work anymore.

A: see http://www.aftvnews.com/how-to-root-the-amazon-fire-tv/ however it looks like with the more recent firmware updates Amazon have locked the device down so it can't be rooted, so unless you have an earlier build you're out of luck


text:
Q: Does this generalization of matrix exponential formula make sense? In a linear algebra class we defined the exponential of some invertible linear matrix $M$ through a power series
$$
\exp M =\sum_{k=0}^\infty \frac{M^k}{k!},
$$
where if one had to write the explicit matrix indices they would have
$$
[\exp M]_{ij} =\text{I}_{ij}+M_{ij}+\frac{1}{2!} \sum_m M_{im}M_{mj}+\frac{1}{3!} \sum_{mn} M_{im}M_{mn}M_{nj}+\cdots,
$$
here the discrete sums run over the dimension of the matrix $M$.
I was wondering if there is a continuum generalization of such sum/expression, where the discrete sum is replaced by integrals over some domain $D$. Say that $M$ becomes some function of two variables $m(x, y)$, then what is the sum (and when does it converge?)
$$
\delta(x-y)+m(x,y)+\frac{1}{2!}\int_D dz\, m(x,z)m(z,y)
+\frac{1}{3!}\int_{D^2} dz\, dw\, m(x,z)m(z,w)m(w, y)+\cdots$$
where in place of the identity matrix I wrote Dirac's delta function.
Is this completely crazy or not? Does the sum equal some sort of $\exp m$ ?
Thank you!

A: Matrices are discrete objects, and matrix exponential is defined through Taylor series for the exponential function.
Matrices represent linear operators on finite-dimensional vector spaces. I guess the continuous analogue would be to consider linear operators on uncountably infinite-dimensional vector spaces, like spaces of functions. These naturally come with some extra structure - often you can take limits of a series of functions, for instance - and they're studied in functional analysis.
In your question you just replaced a matrix with a function in two variables, and this makes no sense to me (but waiting for other users to correct me!) in virtue of what I wrote above, thinking about your generalisation from a matrix to an operator.
If you don't think in terms of matrices, then you can replace $e^{M}$ with $e^{f(x, y)}$ (or you can replace the whole thing with another two variables funtion $h(x, y)$). In this case you will make use of Taylor series in $2$ variables, when expanding your function.
In your case you have finite sums because you're computing matrix products, which added together will give you the exponential matrix.
If you do the same with a $2$ variables function, you won't have any "index sum" as you do with matrices. All the single terms will add up to the infinite to give your initial function (or it's value at a point, provided the series converges).
If you integrate term by term, you just get the integral of your initial function (under certain conditions).
If it's an exponential then you'll get
$$e^{f(x, y)} \approx e^{f(x_0, y_0)} + e^{f(x_0, y_0)} f'(x_0, y_0) + \ldots$$
For other function you'll obey to the general Taylor series to get the required series.
Passing from discrete con continuum is always a tricky game, maybe not always possible, especially if you just step from a matrix to a $2$ variables function.
For example, why would you change the identity operator with the Heaviside generalised function (aka Dirac Delta distribution)? I know that it's the equivalent in the continuum of the Kronecker $\delta$, but at that point when using Dirac distribution, your sum of integrals may lack of sense, for when $x = y$ it's all good (ish), but when $x\neq y$ you get a singularity.

A: Here's an attempt to formally relate your integral formula to the traditional matrix exponential.
Suppose that $m:[0,1]\times [0,1] \to \Bbb C$. We are interested in the function $f:[0,1]\times[0,1] \to\Bbb C$ given by
$$
f(x,y) = \delta(x-y)+m(x,y)+\frac{1}{2!}\int_D dz_1\, m(x,z_1)m(z,y)
+\cdots
$$
We can get an approximation for this quantity using the value of $f$ over $x,y \in \{0,1/n,\dots,1-1/n\}$ by using Riemann approximations for the integrals. In particular, we have
$$
\frac 1{k!} \int_{D^{k-1}} m(x,z_1)m(z_{k-1},y)\prod_{j=1}^{k-2}m(z_j,z_{j+1}) \,dz_1 \cdots dz_k
\\ \approx \frac 1{k!}n^{1-k} \sum_{0 \leq p_1,\dots,p_{k-1} \leq n-1} m(x,p_1/n) m(p_{k-1}/n,y) \prod_{j=1}^{k-2}m(p_j/n,p_{j+1}/n).
$$
If $M$ has entries $M_{ij} = m(i/n,j/n)$ for $1 \leq i,j \leq n-1$ and we have $x = i/n, y = j/n$ for some $i,j$, then the above approximation is the $i,j$ of the matrix $\frac {1}{k! \,n^{k-1}} M^{k}$. Thus, in order to approximate $f(x,y)$, we could compute the sum
$$
I + M + \frac 1{2!\,n} M^2 + \frac{1}{3!\,n^2}M^3 + \cdots \\
= I + n\left[(M/n) + \frac 1{2!}(M/n)^2 + \frac 1{3!} (M/n)^3 + \cdots\right]\\
= I + n[\exp(M/n) - I].
$$
So, perhaps your function can be interpreted as a "limit" of this matrix as $n \to \infty$.

A: The way you should see this is as follows:

*

*Matrices are linear operators that map (finite-dimensional) vectors onto (finite-dimensional) vectors:
$$
  y = Mx.
$$
As a consequence, you use two indices, one for $x$ and one for $y$, and you can write the formula above as
$$
  y_i = \sum_j M_{ij} x_j.
$$
Computing the matrix exponential $e^M$ then works as you describe above, namely: It is defined via a Taylor series.

*There is no conceptual problem to extending this approach to operators that map from countably-infinite to countably-infinite spaces -- think vectors with infinitely many entries. Examples of such spaces are $\ell_2$, or functions that can be written as Fourier series -- for the latter, you can represent the function by its (infinitely many) Fourier coefficients, and operators that map functions in such a space to another function in that space are simply infinite-dimensional matrices for which the matrix exponential is defined in the same way. The only difference is that the sums run over infinitely many values of $i, j, k$.

*Your question is then what happens when you go to operators that map from and to spaces that do not have a countable basis. Say, for example, that you are considering an operator $\cal M$ that maps one function $f\in L^\infty$ to another function $g\in L^\infty$:
$$
  g = {\cal M} f,
$$
in the sense that if you evaluate $g$ at a point $x$, you have
$$
  g(x) = ({\cal M} f)(x),
$$
which is not (necessarily) the same as
$$
  g(x) = {\cal M} (f(x)),
$$
unless $\cal M$ is local. An example of a non-local operator of this kind would be a convolution integral
$$
({\cal M} f)(x) = \int_D m(x,y) f(y) \, dy,
$$
but it could also be local differentiation:
$$
({\cal M} f)(x) = \frac{df}{dx}(x).
$$
What, then, is $e^{\cal M}$? By Taylor expansion, it is
$$
  e^{\cal M} = I + {\cal M} + \frac 1{2!} {\cal M}^2  + \frac 1{3!} {\cal M}^3 + \cdots.
$$
If the operator can be written as a convolution integral with some $m$, this yields
$$
  (e^{\cal M} f)(x)
  =
  If +
  {\cal M} f
+ \frac 1{2!} {\cal M}^2 f
+ \frac 1{3!} {\cal M}^3 f
  + \cdots
\\
  =
  \int_D \delta(x-y) f(y) \, dy +
  \int_D m(x,y) f(y) \, dy
+ \frac 1{2!} \int_{D}\int_D m(x,y) m(y,z) f(z) \, dz \, dy
\\
+ \frac 1{3!} \int_{D}\int_D\int_D m(x,y) m(y,z) m(z,a) f(a) \, da \, dz \, dy
  + \cdots.
$$
As a consequence, the operator $e^{\cal M}$ can be represented as a convolution operator itself, namely
$$
  e^{\cal M}f = \int_D n(x,y) f(y) \, dy
$$
where the "matrix elements" of $e^{\cal M}$ are then
$$
  n(x,y) =
  \delta(x-y) +
  m(x,y)
+ \frac 1{2!} \int_D m(x,y) m(y,z) \, dy
\\
+ \frac 1{3!} \int_{D}\int_D m(x,y) m(y,z) m(z,a) \, dz \, dy
  + \cdots.
$$
This is the proper generalization of the matrix exponential. Whether the sum in the last formula converges is something that will depend on the specific properties of $\cal M$, but one can at least write it down.


text:
Q: когда нажимаю build в build settings вылезает ошибка
раньше была такая ошибка но я забыл как я ее решал, пробовал переустановить андроид студио. в preferens стоит сдк от андроид студио и моя jdk

A: Полной ошибки не вижу, но вероятно надо попробовать обновить градль/принять лицензионное соглашение. Если в ошибке есть что-то про license или update - то в интернете есть туториалы как это сделать:)
Например: https://stackoverflow.com/questions/38096225/automatically-accept-all-sdk-licences


text:
Q: Replace with Javascript the 'var' css property after it has been already set I've an element with a var property set on it like so:

CSS
 .divwithbackground::after {
     background-image: var(--page-header-section-background);
     background-position: center;
     background-size: cover;
 }

This actually works well. But what if I have another javascript which sets the property:
document.documentElement.style.setProperty('--page-header-section-background', bgDataValue, 'important');

this way. Well this works if I remove style this from the DIV tag:
 style="--page-header-section-background: url('myurlimage.jpg');

But this is not the behavior I want. I would like javascript to replace the already set property. Is this possible ?

A: You need to either target the element itself to override the variable

setTimeout(function() {
document.querySelector('.divwithbackground').style.setProperty('--b', 'linear-gradient(blue,blue)');
},1500);
.divwithbackground::after {
  content: "";
  display: block;
  height: 50px;
  background-image: var(--b);
}

Or consider a fallback trick if you want to target the root element:

setTimeout(function() {
document.documentElement.style.setProperty('--b', 'linear-gradient(blue,blue)');
},1500);
.divwithbackground::after {
  content: "";
  display: block;
  height: 50px;
  background-image: var(--b,var(--c));
}

You can also set/reset the initial value like you want:

function change() {
  document.documentElement.style.setProperty('--b', 'linear-gradient(blue,blue)');
}

function reset() {
  document.documentElement.style.setProperty('--b', 'initial');
}
.divwithbackground::after {
  content: "";
  display: block;
  height: 50px;
  background-image: var(--b, var(--c));
}

<button onclick="change()">change</button>
<button onclick="reset()">reset</button>

Related questions/answers for more details:
How to store inherit value inside a CSS custom property (aka CSS variables)?
CSS custom properties (variables) for box model
CSS scoped custom property ignored when used to calculate variable in outer scope


text:
Q: Java AES encryption with keyFile using BouncyCastle SSL I am trying to convert the below Command in SSL to Java
openssl enc -in <inputfilename> -out <file_to_encrypt> -e -aes256 -k s_key

s_key is the file provided which contains the key that will be used to encrypt and decrypt
Steps to be done:
1 - Read the key file
2 - Use it to AES encryption to encrypt file inputfilename
3 - Use the key to  decrypt the same.
I am new to encryption and below is the code i have written so far to encrypt but I am getting issue.
Path path = Paths.get("/home/debashishd/Downloads/s_key");
String content = new String(Files.readAllBytes(Paths.get("/home/debashishd/Downloads/s_key")));

String Test_message = "Hello this is Roxane";

byte[] keyValue = Files.readAllBytes(path);
ByteArrayInputStream byteIS = new ByteArrayInputStream(keyValue);

OpenSSLPBEParametersGenerator gen = new OpenSSLPBEParametersGenerator();
OpenSSLPBEParametersGenerator gen1 = gen;
byte[] saltBytes = Hex.decode(salt.getBytes());
gen1.init(keyValue);
CipherParameters cp = gen1.generateDerivedParameters(256);

byte[] keyBytes = ((KeyParameter)cp);
SecretKeySpec secretKey = new SecretKeySpec(keyBytes,"AES");
System.out.println(secretKey);

Cipher cipher;
Cipher decryptCipher;
cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, secretKey,new IvParameterSpec(new byte[16]));

String encrypt_value = getEncoder().encodeToString(cipher.doFinal(Test_message.getBytes(StandardCharsets.UTF_8)));

System.out.println("Encrypted value: " + encrypt_value);

decryptCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
decryptCipher.init(Cipher.DECRYPT_MODE, secretKey,new IvParameterSpec(new byte[16]));
String Decrypt_result = new String(decryptCipher.doFinal(getDecoder().decode(encrypt_value)));
System.out.println("Decrypted value: " + Decrypt_result);

Is there any changes need to be done to achieve the above encrypt and decrypt
Expected output:
Encrypted value: jvggHDPa58+/zQ+HyGUEk/ypndXbatE+b+hBBqiinABOIwxJ7FXqnDb5j813fPwwm/D6d2Y2uh+k4qD77QMqOg==
Decrypted value: Hello this is Roxane

A: For compatibility with the OpenSSL statement:

*

*a random 8 bytes of salt must be generated

*a 32 bytes key and 16 bytes IV must be derived using EVP_BytesToKey() and the salt

*the result must be given in OpenSSL format:
<ASCII Encoding of Salted__>|<salt>|<ciphertext>
For EVP_BytesToKey() you can apply the OpenSSLPBEParametersGenerator class you already suggested.
EVP_BytesToKey() uses a digest. In earlier versions of OpenSSL MD5 was applied by default, from v1.1.0 SHA256. The digest can be set with the -md5 option. Code and OpenSSL statement must both use the same digest to be compatible. OpenSSLPBEParametersGenerator allows the specification of the digest in the constructor, default is MD5.
The following code, is based on your code, i.e. uses OpenSSLPBEParametersGenerator for EVP_BytesToKey() but additionally considers above points. Instead of encrypting the entire data, streams are applied and the data is encrypted chunk by chunk, so that even large files can be processed:
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import org.bouncycastle.crypto.digests.MD5Digest;
import org.bouncycastle.crypto.engines.AESEngine;
import org.bouncycastle.crypto.generators.OpenSSLPBEParametersGenerator;
import org.bouncycastle.crypto.io.CipherOutputStream;
import org.bouncycastle.crypto.modes.CBCBlockCipher;
import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher;
import org.bouncycastle.crypto.params.ParametersWithIV;

...

String inputPath = "...";
String outputPath = "...";
String passwordStr = "...";

// Generate random 8 bytes salt
SecureRandom random = new SecureRandom();
byte salt[] = new byte[8];
random.nextBytes(salt);

// Derive 32 bytes key (AES_256) and 16 bytes IV
byte[] password = passwordStr.getBytes(StandardCharsets.UTF_8);
OpenSSLPBEParametersGenerator pbeGenerator = new OpenSSLPBEParametersGenerator(new MD5Digest()); // SHA256 as of v1.1.0 (if in OpenSSL the default digest is applied)
pbeGenerator.init(password, salt);
ParametersWithIV parameters = (ParametersWithIV) pbeGenerator.generateDerivedParameters(256, 128); // keySize, ivSize in bits

// Encrypt with AES-256, CBC using streams
try (FileOutputStream fos = new FileOutputStream(outputPath)) {

    // Apply OpenSSL format
    fos.write("Salted__".getBytes(StandardCharsets.UTF_8));
    fos.write(salt);

    // Encrypt chunkwise (for large data)
    PaddedBufferedBlockCipher cipher = new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESEngine()));
    cipher.init(true, parameters);
    try (FileInputStream fis = new FileInputStream(inputPath);
         CipherOutputStream cos = new CipherOutputStream(fos, cipher)) {
        int bytesRead = -1;
        byte[] buffer = new byte[64 * 1024 * 1024]; // chunksize, e.g. 64 MiB
        while ((bytesRead = fis.read(buffer)) != -1) {
            cos.write(buffer, 0, bytesRead);
        }
    }
}

A file encrypted with this code can be decrypted with OpenSSL as follows:
openssl enc -d -aes256 -k <passpharse> -in <enc file> -out <dec file>

Therefore the code is the programmatic analogue of the OpenSSL statement posted at the beginning of your question (whereby the ambiguity regarding the digest still has to be taken into account, i.e. for an OpenSSL version from v1.1.0 SHA256 has to be used instead of MD5).
Note that because of the random salt, different key/IV pairs are generated for each encryption, so there is no reuse, which also removes the vulnerability mentioned in the comment.

A: I was able to achive my result with the below code. The code can indeed be written in a better way and remove the unnecessary initialisation. I will be doing the same in my practical Implementation
public class test2 {
    public static void main(String[] args) throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException {

        Path path = Paths.get("/home/debashishd/Downloads/key");
        String Test_message = FileUtils.readFileToString(new File("/home/debashishd/Downloads/sample.txt"), StandardCharsets.UTF_8);

        /**
         * Read the keyfile provided to encrypt
         */
        byte[] keyValue = Files.readAllBytes(path);
        OpenSSLPBEParametersGenerator gen = new OpenSSLPBEParametersGenerator();
        OpenSSLPBEParametersGenerator gen1 = gen;
        final String salt = "";
        byte[] saltBytes = Hex.decode(salt.getBytes());
        gen1.init(keyValue,saltBytes);
        CipherParameters cp = gen1.generateDerivedParameters(256);
        byte[] keyBytes = ((KeyParameter)cp).getKey();
        SecretKeySpec secretKey = new SecretKeySpec(keyBytes,"AES");

        /**
         * Initialize the Encrypt Ciphers and encrypt the data from input file
         */
        Cipher encryptcipher;
        Cipher decryptCipher;
        encryptcipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
        encryptcipher.init(Cipher.ENCRYPT_MODE, secretKey,new IvParameterSpec(new byte[16]));
        String encrypt_value = getEncoder().encodeToString(encryptcipher.doFinal(Test_message.getBytes(StandardCharsets.UTF_8)));
        System.out.println("Encrypted value: " + encrypt_value);

        /**
         * Initialize the Decrypt Ciphers and decrypt the encrypted data
         */
        decryptCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
        decryptCipher.init(Cipher.DECRYPT_MODE, secretKey,new IvParameterSpec(new byte[16]));
        String Decrypt_result = new String(decryptCipher.doFinal(getDecoder().decode(encrypt_value)));
        System.out.println("Decrypted value: " + Decrypt_result);

    }
}


text:
Q: Get latitude and longitude json format using google maps auto complete using angularjs How to get Get latitude and longitude json format using google maps auto complete using angularjs.

A: Add below script and function in your HTML files,or you can move the function to the JS itself that would be a cleaner approach.

<script type="text/javascript">
    function init() {
    var places = new google.maps.places.Autocomplete(document.getElementById('input'));

    google.maps.event.addListener(places, 'place_changed', function() {
        var place = places.getPlace();
        var address = place.formatted_address;
        var latitude = place.geometry.location.lat();
        var longitude = place.geometry.location.lng();
        var mesg = "Address: " + address;
        mesg += "\nLatitude: " + latitude;
        mesg += "\nLongitude: " + longitude;
        alert(mesg); //will alert after selection...
    });
    }
    google.maps.event.addDomListener(window, 'load', init);
</script>

In your HTML
<input type="text" id="input" ng-model="result"  data-tap-disabled="true" placeholder="Enter an location" data-search="input">

A: I found some solution!
app.directive('googleplace', [function (){
    return {
      restrict: 'EA',
      require: 'ngModel',
      replace: true,
      scope: {
        ngModel: '=',
        place: '=?'

      },
      link: function(scope, element, attrs, model){
        google.maps.places.autocomplete(element[0], options);
        var options = {
          types: ['(geocode)'],
          componentRestrictions: {}
        };

        scope.googleplace = new google.maps.places.Autocomplete(element[0], options);

        goole.maps.event.addListner(scope.googleplace, 'place_changed', function(){
          var geoComponents = scope.googleplace.getPlace();
          var latitude = geoComponents.geometry.location.lat();
          var longitude = geoComponents.geometry.location.lng();

          var addressComponents = geoComponents.address_components;

          addressComponents = addressComponents.filter(function(component){
            switch (component.types[0]) {
              case "locality": // cities
                return true;
              case "administrative_area_level1": //state
                return true;
              case "postal_code": // postal code
                return true;
              case "country": // country
                return true;
              default:
                return false;

            }
          }).map(function(obj) {
              return obj.long_name;
          });

          addressComponents.push(latitude, longitude);

          scope.$apply(function(){
            scope.details = addressComponents; //array containing each location component
            mode.$setViewValue(element.val());
          });

          scope.$on('$destroy', funcion(){
            google.maps.event.clearInstanceListerners(element[0]);
          });

        });
      }
    };
  }]);


text:
Q: Send a message to 2 numbers using Twilio Is it possible to send a message to 2 numbers (or more) with Twilio?
I wrote a script to scrape some stock prices and send it to me by Twilio.
My question can I make it to send the same message for me and other people?
.
Thanks in advance.

A: Twilio developer evangelist here.
You can send the same message to different people at different phone numbers! You would use Python code like this, replacing your account credentials with your own, the message to send, and the different phone numbers to send to.
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'YOUR-ACCOUNT-SID'
auth_token = 'YOUR-AUTH-TOKEN'
client = Client(account_sid, auth_token)
arr = ['PHONE-NUMBER-TO-SEND-TO', 'PHONE-NUMBER-TO-SEND-TO'] #you can add more to this array
for num in arr: #loop through phone numbers in array
    message = client.messages.create(
        body='Message to send to different people',
        from_='YOUR-TWILIO-PHONE-NUMBER',
        to=num
    )
    print(message.sid)

Let me know if this helps at all!


text:
Q: Is Apple breaking MVC rules in MailboxContentViewCell.h on iOS 8? According to MVC rules, V stands for views, and M stands for data. Strict MVC forbids V to access M directly just like http://4.bp.blogspot.com/-tISOU011t_U/T1yDocALTUI/AAAAAAAAAII/AFiwMAr-Z6g/s640/MVC+Obj-C.png shows, right?
I was reverse engineering MobileMail i.e. the Mail App on iOS 8, and have noticed that inside MailboxContentViewCell.h, there was a - (MFMailMessage *)message method. If I'm understanding MVC correctly, MailboxContentViewCell is a V and MFMailMessage is an M, V reads M directly, which breaks the MVC rules. So, is it my misunderstanding of MVC, or Apple breaks MVC indeed in this case?

A: MVC is not a rule. It is a pattern. It's less a rule than a design philosophy and a set of guidelines. In practice most nontrivial apps are unlikely to adopt a pure, unsullied MVC a design, even when MVC is the primary design pattern. Sometimes it's just not a good fit. Sometimes it is a good fit but schedule requirements mean that idealism has to be sacrificed in order to ship something.
So, is Apple violating MVC here? I don't know but it wouldn't surprise me a bit. Nor would it seem especially troubling if they are.


text:
Q: How do I update a Dynamically Linked Busybox in initramfs.cpio? I am trying to properly place a Dynamically Linked Busybox into a initramfs.cpio file. I am trying to add udhcpd server to Busybox which was not included in the built image. Then I am placing the updated version into my initramfs.cpio to be compiled into my linux kernal. I can not figure out which files to add in and where to place them. The initramfs.cpio file in the board's stock image doesn't have many libraries included.
I can compile the board's linux with their source files, update the sd card, and run the recompiled kernel. They have some extra modules for their board that are needed.
I have the correct cross compiler set up and can compile the busybox with or without the added packages I want.
I figured out how to pack
find . -depth -print | cpio -ov > ../initramfs.cpio

and unpack the cpio
cpio -idv < initramfs.cpio

The unpacked stock cpio looks like this
- bin
    + busybox
    + cat2
- cgi_bin
    + cmd
    + download
    + index.cgi
    + mac
    + reboot
    + upload
- dev (empty directory)
- mnt (empty directory)
- proc (empty directory)
- sbin
    + bin2coe
    + dns-sd
    + load_fpga
    + mdnsd.bz2
    + sdctl
    + spiflashctl
    + strace.bz2
    + tshwctl
    + xuartctl
- slib
    + ld-uClibc.so.0
    + libc.so.0
    + libdns_sd.so
    + libutil.so.0
- sys (empty directory)
- tmp (empty directory)
- var
    - run (empty directory)

Busybox Settings:
Cross Compiler Prefix:
/opt/toolchains/arm-ts-linux-uclibcgnueabi/bin/arm-ts-linux-uclibcgnueabi-

Path to sysroot:
/opt/toolchains/arm-ts-linux-uclibcgnueabi/arm-ts-linux-uclibcgnueabi/sysroot

Busybox Bin info:
readelf -d _install/bin/busybox

Tag |  Type    | Name/Value
0x01| (NEEDED) | Shared Library: [libc.so.0]
0x0F| (RPATH)  | Library rpath: [/slib]

What I have done:
Attempt 1
After running make install for busybox, I copied the busybox binary from _install/bin to my unpacked cpio directory test/bin. I packed up the cpio, and then made the kernel with the new initramfs.cpio. I then ran the sd card with the new build. Fails
Attempt 2
I copied the following libraries from
/opt/toolchains/arm-ts-linux-uclibcgnueabi/arm-ts-linux-uclibcgnueabi/sysroot/lib/
+ ld-uClibc.so.0
+ libc.so.0
+ libutil.so.0

and pasted them into my unpacked cpio directory test/slib
Then I placed the binary from the original source, and then one from my busybox build in _install/bin, each in separate builds. Each build did not run correctly. Fails
I am out of ideas.
Everyone seems to statically link it in their guides, but I have about 4MB for my zImage, and it ends up being too big for that.


text:
Q: Add custom view to jhipster app I would like to add a custom view to jhipster app on index.html
I already created the link in navbar.html and added the html file on path src/main/webapp/scripts/app/custom/newView.html

     new view

When I click on the link it doesn't work. Probably it needs a custom route in angular but I can't figure out how to create it. What else should I do?

A: In addition to the other answer, here is another piece of information. Maybe somebody else will find it useful. I had a similar problem with a custom view but only in production. Everything was fine in dev mode. In production mode, nothing would display and I had this javascript error that read "could not resolve ... from state ...".
It turns out that my javascript file (where the state was declared) was declared like this in index.html

...

I had created the separation on purpose, just to make it easier to read. Once I moved it up to have it before endbuild, the problem disappeared. I guess this is related to how the app is packaged somehow? I haven't looked at how it does it.

A: I've figured it out:
I had to add a angularjs route. Created a js file
src/main/webapp/scripts/app/custom/newv.js with the following content:
angular.module('jCrudApp')
    .config(function ($stateProvider) {
        $stateProvider
            .state('newView', {
                parent: 'site',
                url: '/newView',
                views: {
                    'content@': {
                        templateUrl: 'scripts/app/custom/newView.html',
                        //controller: 'MainController'
                    }
                }
            });
    });

and import the new script in index.html


text:
Q: How to send data on a telephone line to ISO8583 host (Dial up NAC), the client is in JAVA? I am building an ISO8583 client written in java, i need to send to ISO8583 host which is hosted on a NAC with a dedicated phone number (Analog).
THe client(PC) is generating TCP/IP data , it should ideally call the phone number and send the data packets and receive the reponse data packets.
I am done with all the Iso8583 parts and also it works with IP->IP,
I want to know how to setup it to work in IP(TCP) -> Analog Phone line (HOST).
Thanks,
Raj

A: If you are using NAC, then you don't need to TCP -> Serial line, that is job of the NAC switch unless you are writing your own switch.
The transaction flow goes ISO HOST -> NAC (TCP)-> NAC (Serial) -> Terminal/POS.
If you want to send serial packets from the PC to the NAC then you need to connect one modem to serial port of the PC and send the data across.
If you have a third party NAC (Ingenico,Verifone) then you don't need modem as they usually give a serial interface that you could connect with PC to send the data.
If you are interested in C APIs (you can easily convert them into java), please checkout the github project
https://github.com/kchandan/nac_switch
I would suggest you to fork it and create JAVA APIs that might be useful to others.


text:
Q: Probability of collision between two particles (Statistical Mechanics) I'm pretty new to statistical mechanics. While reading an introductory book ("Fisica - Meccanica e termodinamica", translated "Physics - Mechanics and Thermodynamics" by C. Mencucci and V. Silvestrini, it's an italian book). I've stumbled on the section talking about the velocity distribution function (chapter 17, pages 583 - 584 - 585). Now the book introduces three functions:
$n(\vec{r}) = {\rho (\vec{r}) \over m}$ which is the particles density. $\rho (\vec{r})$, function of position $\vec{r}$, is the density, $m$ is the mass of a particle of an ideal gas.
$dN(\vec{r}) = n(\vec{r}) dV$ which is the number of particles inside the volume element
$P(\vec{r}) = {n(\vec{r}) \over N}$ which is the particle space distribution function, that is said to satisfy the property for which:
$\iiint P(\vec{r}) dV = {1 \over N} \iiint n(\vec{r}) dV = {1 \over N} \iiint dN(\vec{r}) = 1$
Where $N$ is the total number of particle in $dV$. Now these functions can be generalized to the velocity distribution context, thus:
$N(\vec{v}) = n(\vec{v}) dV$
$P(\vec{v}) = {n(\vec{v}) \over N}$
Now the first question: how do I physically interpret this functions? Should I even try to physically interpret them or should I just stick with the mathematics instead?
Later the author continues and infers that the function $P(\vec{v})$, if there are no outer stresses (if the velocity distribution is isotropic) could be defined to be only a function of $v^2$ thus a function of $K$ (kinetic energy). Henceforth, from there on, the author uses $P = P(K)$.
The following section is the most problematic to me: imagine two particles, whose initial energies are $K_1$ and $K_2$, colliding with each other, with resulting energies $K_1'$ and $K_2'$. The probability for this to happen is said to be proportional to $P(K_1)P(K_2)$ with proportionality constant $C$:
$p = CP(K_1)P(K_2)$
my question is why? I tried to figure it out by substituting $P(K)$ with ${n(\vec{v}) \over N}$. $dN(\vec{v}) = n(\vec{r}) dV$ represents - as it has been explained - all the particles in $dV$ with velocities between $\vec{v}$ and $\vec{v} + d\vec{v}$, therefore I could say that, since, for a collision to happen, the particles need to have a velocity with a direction almost towards the impact point (considering the particle not a point but a sphere with non-zero radius), thus between a certain velocity $\vec{v}$ and a certain other velocity $\vec{v} + d\vec{v}$, and since $N(\vec{v})$ represents all the possible velocities configurations (or at least I think so as $N$, in the case of $n(\vec{r})$, represented the number of particles in $dV$), $P(\vec{v}) dV$ can be thought as some kind of probability. But even if my reasoning is correct, which it seems unluky, where is the $dV$ factor? Is $P(\vec{v}) = P(v) = P(K)$? Why is there the need for the $C$ constant?

A:
$\iiint P(\vec{r}) dV = {1 \over N} \iiint n(\vec{r}) dV = {1 \over N} \iiint dN(\vec{r}) = 1$

Where $N$ is the total number of particle in $dV$. Now these functions can be generalized to the velocity distribution context, thus:

$N(\vec{v}) = n(\vec{v}) dV$

Here you are changing from a number density $n(\vec r)$ that changes in space to a number density $"n"(\vec v)$ that changes in velocity space. In the latter function, I put the "n" in quotes, since it is clearly a different function than the first n function. This kind of bad notation turns out to be a running theme in much of physics.
But you are using the same symbol for both, which can cause some confusion. The functional form of $n(\vec r)$ and the functional form of $n(\vec v)$ are not the same, so it is confusing to use the same symbol for the function (since the only differentiator is the letter you chose to denote the function argument, which is just a dummy variable).

$P(\vec{v}) = {n(\vec{v}) \over N}$

Same here. This is now a probability that the particle has velocity $v$, which is a different function than, say, the spatial probability.

Now the first question: how do I physically interpret this functions?

You are likely leading towards the interpretation that
$$
P(\vec v)d^3v
$$
is the probability that a particle has velocity in the range $d^3v$ about $\vec v$. For example, at a fixed temperature T, a classical gas of particles would have
$$
P(\vec v) = Ae^{-\frac{mv^2}{2T}}\;,
$$
where $A$ is chosen such that the integral over all velocities is 1.

Should I even try to physically interpret them or should I just stick with the mathematics instead?

Yes, both. The physical interpretation is as stated above. But also stick with the mathematics.

Later the author continues and infers that the function $P(\vec{v})$, if there are no outer stresses (if the velocity distribution is isotropic) could be defined to be only a function of $v^2$ thus a function of $K$ (kinetic energy). Henceforth, from there on, the author uses $P = P(K)$.

The author is performing a common abuse of notation. The functional form of
$P(K)$ is not the same as the functional form of $P(v)$ but the author is using the same letter to denote the function because of some strange desire to always denote a probability density with the letter $P$.
If we don't force ourselves to (confusingly) use the same letter, instead we would write
$$
1 = \iiint d^3v P(v) = 4\pi \int dv v^2 P(v) = 4\pi \int dK \frac{dv}{dK} v^2(K) P(v(K))\equiv \int dK \tilde P(K)\;,
$$
and then we would read off the probability density in kinetic energy $\tilde P(K)$ (where I use $\tilde P$ instead of just plain $P$ to avoid confusion) as:
$$
\tilde P(K) = \frac{4\pi}{mv(K)} v^2(K)P(v(K)) = \frac{4\pi}{m\sqrt{2K/m}}\frac{2K}{m}P(\sqrt{\frac{2K}{m}})
$$

The following section is the most problematic to me: imagine two particles, whose initial energies are $K_1$ and $K_2$, colliding with each other, with resulting energies $K_1'$ and $K_2'$. The probability for this to happen is said to be proportional to $P(K_1)P(K_2)$ with proportionality constant $C$:

$p = CP(K_1)P(K_2)$

my question is why?

At this point, your $P(K)$ denotes the probability density that the particle has kinetic energy $K$. The probability you are interested in is roughly the probability that a particle with energy close to $K_1$ gets close (in space) to a particle with energy close to $K_2$. In general, this is some complicated function:
$$
P_2(\vec r, K; \vec r', K')\;,
$$
but as above, we assume we can ignore spatial variation (i.e., there is no dependence on $r$ and $r'$), and then we further go to the so-called "mean field" or "molecular chaos" approximation in which we can treat the particles as independent. This means that the probability of "A and B" $P_2(\vec r_A, K_A; \vec r_B,K_B)$ can be factored into the unconditional probabilities that "A" multiplied by the unconditional probability that "B". I.e.,
$$
P_2(\vec r, K ; \vec r', K') \to CP(K)P(K')\;,
$$
where $C$ is whatever constant arrises from all the spatial integrals, etc, i.e., just whatever it needs to be to make the total integral equal to 1. Of course, if you have already normalized the $P(K)$ correctly, the $C$ might already be equal to 1, but it's not clear without more context.

I tried to figure it out by substituting $P(K)$ with ${n(\vec{v}) \over N}$.

Use the example above for the Boltzmann distribution to understand how to make the change of variables correctly. You basically use $P(K) = \frac{dv}{dK}P(v(K))$ with the understanding that the two $P$s are actually different functions on each side of the equation. (Bad confusing physicist notation).


text:
Q: how to get Category values from json in android? {
    "response":
{
    "Category":
        [
            "Restaurant",
            "Salon",
            "Spa",
            "Dry Cleaners",
            "Car Spa",
            "Hospitals"
        ]
    }
}

A: Try this , it can be Pseudo Code
 String json = <YourJSon String>
    JSONObject object = new JSONObject(json);
    JSONArray array = object.getJSONArray("Category");

    for(int i =0; i<array.size();i++){
    String s = array.get(i).getString();
    }

A: You can do like this-
     try {
            String json = <Your Json String>;
            JSONObject response = new JSONObject(json);
            JSONArray category = response.getJSONArray("Category");
            for (int i = 0; i < category.length(); i++) {
                Log.d("categories are", category.getString(i));
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }


text:
Q: Searching for two or more tags when using join statement and tag map I am having problems with my tag system. I have one table called ads one table called tags and another called tags_map where it links the tags to an ad listing. The problem am having is when I am searching for an ad using more than one tag.
Search parameters: php, lorem and jobs
Tags attached to the ad: jobs, php, html
SQL Query:
SELECT *, a.title AS ad_title, a.id AS ad_id
FROM ads AS a
LEFT JOIN tags_map AS tm ON tm.ad_id = a.id
LEFT JOIN tags AS t ON tm.tag_id = t.id
WHERE a.status='live'
AND (a.description LIKE '%php%' OR a.title LIKE '%php%' OR t.title LIKE '%php%')
AND (a.description LIKE '%lorem%' OR a.title LIKE '%lorem%' OR t.title LIKE '%lorem%')
AND (a.description LIKE '%jobs%' OR a.title LIKE '%jobs%' OR t.title LIKE '%jobs%')
GROUP BY a.id
ORDER BY bump_time DESC

I think the problem is with the join where it can only search for one tag can someone help
Thanks,
CP

A: One tag cannot have a description that meets all three conditions.  However, the set of tags for an ad can have them.  Hence, the logic needs to move to a having clause:
SELECT *, a.title AS ad_title, a.id AS ad_id
FROM ads a LEFT JOIN
     tags_map tm
     ON tm.ad_id = a.id LEFT JOIN
     tags t
     ON tm.tag_id = t.id
WHERE a.status='live'
GROUP BY a.id
HAVING SUM(a.description LIKE '%php%' OR a.title LIKE '%php%' OR t.title LIKE '%php%') > 0 AND
       SUM(a.description LIKE '%lorem%' OR a.title LIKE '%lorem%' OR t.title LIKE '%lorem%') AND
       SUM(a.description LIKE '%jobs%' OR a.title LIKE '%jobs%' OR t.title LIKE '%jobs%')
ORDER BY bump_time DESC ;

Each condition in the having clause checks each keyword.  The > 0 requires that the ad meets each keyword condition. The fact that some of the comparisons come from the ads table and others from the tags table is ok.  The logic will still work.
The select * doesn't really make sense because of the group by.  The fields from the tags and tags_map come from an arbitrary row -- and there may be multiple matching rows.  I would suggest this:
select a.*

If you want the tgs:
select a.*, group_concat(t.title) as tags


text:
Q: ReactInputSelection import from precompiled reactjs I want to reduce the size of bundlejs. But when I use precompiled reactjs, I met some problems.
    externals: {
        'jquery': 'jQuery',
        'jquery-ui': 'jQueryUI',
        'react': 'React',
        'react/addons': 'React.addons',
        'react/lib/ReactMount': 'React.addons.ReactMount',
        'react/lib/ReactInputSelection': 'React.addons.ReactInputSelection',
        'react/lib/LinkedStateMixin': 'React.addons.LinkedStateMixin',
        'react-dom': 'ReactDOM',
        'react-router': 'ReactRouter',
        'history/lib': 'History',
        'history': 'History',
    },

I got  Cannot read property 'getSelection' of undefined when webpack require react/lib/ReactInputSelection.
Can anybody helps me ? Thanks.


text: Q: How to enable user to Sync app directory from external memory to their Dropbox account? My app creates a directory containing database and table to save data in external memory of mobile. I want to enable user to link this app directory with their personal Dropbox which can sync data over 3G or Wi-Fi obviously with dropbox whenever any changes is made in database of app. Any idea how this can be achieved?


text:
Q: Hide Select Menu icon in jQuery Mobile Is it possible to hide the default icon used for select menus within jQuery Mobile? By default they use the down arrow icon. I know it's possible to specify an icon via the data-icon attribute, but I haven't found a way to hide it.
Example that's using the default icon:

    Choose shipping method:
    <select name="select-choice-1" id="select-choice-1">
        <option value="standard">Standard: 7 day</option>
        <option value="rush">Rush: 3 days</option>
        <option value="express">Express: next day</option>
        <option value="overnight">Overnight</option>
    </select>

A: You can use data-iconpos="noicon" like so:

    Choose shipping method:
    <select name="select-choice-1" id="select-choice-1" data-iconpos="noicon">
        <option value="standard">Standard: 7 day</option>
        <option value="rush">Rush: 3 days</option>
        <option value="express">Express: next day</option>
        <option value="overnight">Overnight</option>
    </select>

Any value for the data-iconpos attribute other than: top, right, bottom, or left will not display an icon.
Here is a link to a jsfiddle of this example: http://jsfiddle.net/KWQJf/

A: For one reason or another on SELECT boxes, the div still remained even though I set data-iconpos='noicon'... SO what I did was a littly hackish, but not bad. I called this Jquery function onload (IN ADDITION to data-iconpos='noicon')
 $('.ui-icon.ui-icon-arrow-d.ui-icon-shadow').remove();

Hope this helps anyone who experienced the same problem I did. :)

A: You can override that style in your own stylesheet:
.ui-select .ui-icon-arrow-d {
  display: none;
}


text:
Q: Table floating between subtitle and subsubtitle Using IEEEtran I have a table under subsubsection, which is under subsection. But the table appears between those two. Using the float package does nothing. Only if I write something after subsubsection and before the table it looks as it should. Below is the code:
\documentclass{IEEEtran}
\usepackage[spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{float,booktabs}
\begin{document}
    \section{Datos}
    \subsection{Jaula de ardilla}
        \subsubsection{Conexión $\Delta$} % Consider the following table:
            \begin{table}[H]
                \centering
                \caption{Prueba en vacío}
                \begin{tabular}{lr}
                    \toprule
                    Parámetro & Valor \\
                    \midrule
                    Voltaje & 215 V\\
                    Corriente & 0.68 A\\
                    Potencia & 60 W\\
                    \bottomrule
                \end{tabular}
            \end{table}
\end{document}

But it appears like this:

How should I fix this problem?

A: It worked as you wanted it the way you embedded your example above. I just replaced the optional H into a h. Maybe it could work with h! in your case?

A: The [H] positioning specifier internally creates a full-linewidth minipage and thus can't fit after the \subsubsection-level header, which is set up for run-in style and thus expects to work with something that's less than full line-width.
I can think of two solutions:

*

*Provide some filler text, such as (the Spanish equivalent of) "Consider the information in the following table:", between \subsubsection{Conexión $\Delta$} and \begin{table}[H]; or

*Omit the positioning specifier entirely -- and let LaTeX decide where the table should be placed.
The following screenshot shows the result of the first solution -- I'm afraid I don't know Spanish well enough to translate "Consider the information in the following table:".

\documentclass{IEEEtran}
\usepackage[spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{float,booktabs}
\begin{document}
    \section{Datos}
    \subsection{Jaula de ardilla}
        \subsubsection{Conexión $\Delta$} Consider the following table:
            \begin{table}[H]
                \centering
                \caption{Prueba en vacío}
                \begin{tabular}{lr}
                    \toprule
                    Parámetro & Valor \\
                    \midrule
                    Voltaje & 215 V\\
                    Corriente & 0.68 A\\
                    Potencia & 60 W\\
                    \bottomrule
                \end{tabular}
            \end{table}
\end{document}


text:
Q: JQuery : doesn work javascript files after use load method? I searched for this question a lot but did not get an answer...
I have an a tag and I want a div to be loaded in the partial view when clicked,
The code works fine, but there is a problem with the partial view. I have a JavaScript file in partial view that does not work at all.
 $('#v-pills-tab2-tab').click(function () {
        $('#js-newhorse').load(' #js-newhorse');

    });

html :

@if (userInfo == true)
{
    Not access!!
}
else
{

    List<Tuple<Guid, string>> productions = await _scope.GetProductionsHorse();
    List<Tuple<Guid, string>> microchips = await _scope.GetMicrochipsHorse();
    List<Tuple<Guid, string>> Farsiname = await _scope.GetFaHorseName();
    List<Tuple<Guid, string>> colors = await _scope.GetColorsHorse();
    List<Race> Races = await _scope.GetRaces();

                        <input class="js-checkcode" type="checkbox">

                        <select class="form-control selectmicro js-selected-code js-selected-item" id="select-mcode">
                            @foreach (var item in microchips)
                            {
                                <option value="@item.Item1">@item.Item2</option>
                            }
                        </select>

                        <input class="js-checkname" type="checkbox">

                        <select class="form-control selectname js-selected-name js-selected-item" id="select-name">
                            @foreach (var item in Farsiname)
                            {
                                <option value="@item.Item1">@item.Item2</option>
                            }
                        </select>

        <form id="CreateHorse" method="post">

                            <input type="text" maxlength="15" asp-for="MicrochipCode" autocomplete="off" class="form-control js-inputs">

                            <input type="text" asp-for="FaName" autocomplete="off" class="form-control js-inputs">

                            <input type="text" asp-for="EnName" autocomplete="off"  class="form-control js-inputs">

                            <input type="text" asp-for="FaFatherHorseName" autocomplete="off" class="form-control js-inputs">

                            <input type="text" asp-for="EnFatherHorseName" autocomplete="off"  class="form-control js-inputs">

                            <input type="text" asp-for="FaMotherHorseName" autocomplete="off" class="form-control js-inputs">

                            <input type="text" asp-for="EnMotherHorseName" autocomplete="off" class="form-control js-inputs">

                            <select asp-for="Race" class="form-control js-inputs">
                                @foreach (var item in Races)
                                {
                                    <option value="@item.Id">@item.Title</option>
                                }
                            </select>

                            <select asp-for="ProductionId" class="form-control js-inputs">

                                @foreach (var item in productions)
                                {
                                    <option value="@item.Item1">@item.Item2</option>
                                }
                            </select>

                            <select asp-for="ColorId" class="form-control js-inputs">

                                @foreach (var item in colors)
                                {
                                    <option value="@item.Item1">@item.Item2</option>
                                }
                            </select>

            <input type="submit" value="ثبت" class="btn btn-lg btn-primary pull-left btn-signin js-btninputs js-btn__mcode">
        </form>

}

Can anyone find a solution to this problem?


text:
Q: Where is the error in this proof? Let $\mathfrak{g}$ be a Lie Algebra. Then isn't necessarily true that all vector spaces $V \subset \mathfrak{g}$ are a Lie subalgebra (it is easy to construct an example that this fails).
Now, weird things starting to happen. Define the linear map
$$\rho: \mathfrak{g}\to \{0\} $$
$$X \mapsto 0, $$
and the set $\tilde{V} = \{X \in V; \rho([X,Y]) = 0,$ $\forall$ $Y$ $\in$ $V$}.
I will prove that $\tilde{V} $ is a subalgebra, i.e. $\tilde{V}$ is a linear subspace of $\mathfrak{g}$, and $\{[X,Y]; X,Y \in \tilde{V}\} \subset \tilde{V}$.
Indeed, $\tilde{V}$ is a vector space, because, if $X,Y$ $\in$ $\tilde{V}$, then is it obvious that $X + \lambda Y$ $\in$ $\tilde{V}$.
Moreover if $X,Y \in \tilde{V} \Rightarrow [X,Y] \in \tilde{V},$ because $\rho([[X,Y],Z]) = 0$, $\forall$ $Z$ $\in$ $V$.
Then, we conclude that $\tilde{V}$ is a Lie subalgebra, but $V = \tilde{V}$, implying that $V$ is a Lie subalgebra. So we concluded that any subspace of $\mathfrak{g}$ is a Lie subalgebra!

Where is the error in my argumentation? I can not see what I'm confusing.

A: Your argument fails at the step

Moreover if $X,Y \in \tilde{V} \Rightarrow [X,Y] \in \tilde{V},$ because $\rho([[X,Y],Z]) = 0$, $\forall$ $Z$ $\in$ $V$.

By definition of $\tilde{V}$, the fact that $\rho([[X,Y],Z])=0,\;\forall$ $Z$ $\in$ $V$ does not, in and of itself, imply $[X,Y]\in \tilde{V}$, unless you already know $[X,Y]\in V$.


text:
Q: Pyhtho Django. the messaa is from python file and i want to show it in HTML his code is working but I want the message will show as pop up or alert Pyhtho Django. the messaa is from python file and i want to show it in HTML his code is working but I want the message will show as pop up or alert
Register
{% if messages %}
{% for result in messages %}
<b style="color: green;">{{result}}</b>
{% endfor %}
{% endif %}

A: Have you tried inserting javascript?
{% if messages %}
  {% for result in messages %}
    <script>alert({{result}})</script>
  {% endfor %}
{% endif %}


text:
Q: SWIG: Add comments to generated .py file Using SWIG to generate a Python interface to a C++ application, is there any way to have it comment the functions in the generated .py file? I'm actually pulling in an entire .h file into the .i file, but for a small example:
%module example

bool do_something_interesting(int number, string text);

swig -python example.i Generates:
...
def do_something_interesting(*args):
  return _example.do_something_interesting(*args)
do_something_interesting = _example.do_something_interesting

Ideally, I would like it to automatically add a comment with the original method signature
#bool do_something_interesting(int number, string text)
def do_something_interesting(*args):
  return _example.do_something_interesting(*args)
do_something_interesting = _example.do_something_interesting

But I would be perfectly amenable to writing my own comment somewhere (particularly if the comment could somehow be in the .h file). I thought %pythonprepend might be a possible solution, but it inserts code inside the function definition rather than before it.
EDIT: Here's what I came up with in the .h file. Not the prettiest thing ever but it'll do:
#ifdef SWIG
   %pythonprepend do_something_interesting(int, string) %{
    """Do some interesting thing

    number:Int -- a number
    text:String -- some text

    """
  %}
#endif
bool do_something_interesting(int number, string text);

A: Look at the docstring feature in SWIG for Python.
Probably putting the following line in your .i file
%feature("autodoc", "1")

would do what you want (see http://www.swig.org/Doc2.0/Python.html#Python_nn65 for more options)


text:
Q: Detecting how many items are enabled In my program l am using timers to make pictureboxes visible and after certain time l make them not visible by using picturebox(1-9).visible = true/false.
Finally l have to count how many pictureboxes are visible at any given time.
l can't figure it out l have tried adding them to a variable but the timer does it over and over every second. l have literally no idea how to do it

A: This code is for Images on a worksheet, but can easily be modified for wherever your pictureboxes are:
'Count the visible number before starting.
Dim NumberVisible As Integer
NumberVisible = 0
For i = 1 To 9
    If myWorkSheet.Shapes(i).Visible = msoTrue Then
        NumberVisible = NumberVisible + 1
    End If
Next

'....
'Start timer, do timer code here.
'....
myWorkSheet.Shapes(i).Visible = msoTrue
NumberVisible = NumberVisible + 1

'...
myWorkSheet.Shapes(i).Visible = msoFalse
NumberVisible = NumberVisible - 1

A: You need to check picturebox(1-9).visible itself. The same variable can be set and can also be checked for a given value.
Just loop through all the picture boxes in the form and check their visible property.
Sub foo()

Dim ct As Control
Dim sum As Integer
sum = 0

For Each ct In Me.Controls

    If TypeName(ct) = "Image" Then
        If ct.Visible = False Then
            sum = sum + 1
        End If
    End If

Next

MsgBox sum

End Sub


text:
Q: Cuda thrust global memory writing very slow I am currently writing a code, that calculates a integral Histogram on the GPU using the Nvidia thrust library.
Therefore I allocate a continuous Block of device memory which I update with a custom functor all the time.
The problem is, that the write to the device memory is veeery slow, but the reads are actually ok.
The basic setup is the following:
struct HistogramCreation
{
    HistogramCreation(
    ...
    // pointer to memory
    ...
    ){}

    /// The actual summation operator
    __device__ void operator()(int index){
       .. do the calculations ..
       for(int j=0;j<30;j++){

       (1)  *_memoryPointer =  values (also using reads to such locations) ;

       }
  }
}

void foo(){

  cudaMalloc(_pointer,size);

  HistogramCreation initialCreation( ... _pointer ...);
  thrust::for_each(
    thrust::make_counting_iterator(0),
    thrust::make_counting_iterator(_imageSize),
    initialCreation);
}

if I change the writing in (1)  to the following>
unsigned int val = values;

The performance is much better. THis is the only global memory write I have.
Using the memory write I get about 2s for HD Footage.
using the local variable it takes about 50 ms so about a factor of 40 less.
Why is this so slow? how could I improve it?

A: Just as @OlegTitov said, frequent load/store with global
memory should be avoided as much as possible. When there's a
situation where it's inevitable, then coalesced memory
access can help the execution process not to get too slow;
however in most cases, histogram calculation is pretty tough
to realize the coalesced access.
While most of the above is basically just restating
@OlegTitov's answer, i'd just like to share about an
investigation i did about finding summation with NVIDIA
CUDA. Actually the result is pretty interesting and i hope
it'll be a helpful information for other xcuda developers.
The experiment was basically to run a speed test of finding
summation with various memory access patterns: using global
memory (1 thread), L2 cache (atomic ops - 128 threads), and
L1 cache (shared mem - 128 threads)
This experiment used:
Kepler GTX 680,
1546 cores @ 1.06GHz
GDDR5 256-bit @ 3GHz
Here are the kernels:
__global__
void glob(float *h) {
    float* hist = h;
    uint sd = SEEDRND;
    uint random;
    for (int i = 0; i < NUMLOOP; i++) {
        if (i%NTHREADS==0) random = rnd(sd);
        int rind = random % NBIN;
        float randval = (float)(random % 10)*1.0f ;
        hist[rind] += randval;
    }
}

__global__
void atom(float *h) {
    float* hist = h;
    uint sd = SEEDRND;
    for (int i = threadIdx.x; i < NUMLOOP; i+=NTHREADS) {
        uint random = rnd(sd);
        int rind = random % NBIN;
    float randval = (float)(random % 10)*1.0f ;
        atomicAdd(&hist[rind], randval);
    }
}

__global__
void shm(float *h) {
    int lid = threadIdx.x;
    uint sd = SEEDRND;

    __shared__ float shm[NTHREADS][NBIN];
    for (int i = 0; i < NBIN; i++) shm[lid][i] = h[i];

    for (int i = lid; i < NUMLOOP; i+=NTHREADS) {
        uint random = rnd(sd);
        int rind = random % NBIN;
        float randval = (float)(random % 10)*1.0f ;
        shm[lid][rind] += randval;
    }

    /* reduction here */
    for (int i = 0; i < NBIN; i++) {
        __syncthreads();
        if (threadIdx.x < 64) {
            shm[threadIdx.x][i] += shm[threadIdx.x+64][i];
        }
        __syncthreads();
        if (threadIdx.x < 32) {
            shm[threadIdx.x][i] += shm[threadIdx.x+32][i];
        }
        __syncthreads();
        if (threadIdx.x < 16) {
            shm[threadIdx.x][i] += shm[threadIdx.x+16][i];
        }
        __syncthreads();
        if (threadIdx.x < 8) {
            shm[threadIdx.x][i] += shm[threadIdx.x+8][i];
        }
        __syncthreads();
        if (threadIdx.x < 4) {
            shm[threadIdx.x][i] += shm[threadIdx.x+4][i];
        }
        __syncthreads();
        if (threadIdx.x < 2) {
            shm[threadIdx.x][i] += shm[threadIdx.x+2][i];
        }
        __syncthreads();
        if (threadIdx.x == 0) {
            shm[0][i] += shm[1][i];
        }
    }

    for (int i = 0; i < NBIN; i++) h[i] = shm[0][i];
}

OUTPUT
atom:  102656.00 shm:  102656.00 glob:  102656.00
atom:  122240.00 shm:  122240.00 glob:  122240.00
... blah blah blah ...

  One Thread: 126.3919 msec
      Atomic:   7.5459 msec
      Sh_mem:   2.2207 msec

The ratio between these kernels is 57:17:1. Many things can
be analyzed here, and it truly does not mean that using
L1 or L2 memory spaces will always give you more than 10
times speedup of the whole program.
And here's the main and other funcs:
#include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;

#define NUMLOOP 1000000
#define NBIN 36
#define SEEDRND 1

#define NTHREADS 128
#define NBLOCKS 1

__device__ uint rnd(uint & seed) {
#if LONG_MAX > (16807*2147483647)
    int const a    = 16807;
    int const m    = 2147483647;
    seed = (long(seed * a))%m;
    return seed;
#else
    double const a    = 16807;
    double const m    = 2147483647;

    double temp = seed * a;
    seed = (int) (temp - m * floor(temp/m));
    return seed;
#endif
}

... the above kernels ...

int main()
{
    float *h_hist, *h_hist2, *h_hist3, *d_hist, *d_hist2,
    *d_hist3;
    h_hist = (float*)malloc(NBIN * sizeof(float));
    h_hist2 = (float*)malloc(NBIN * sizeof(float));
    h_hist3 = (float*)malloc(NBIN * sizeof(float));
    cudaMalloc((void**)&d_hist, NBIN * sizeof(float));
    cudaMalloc((void**)&d_hist2, NBIN * sizeof(float));
    cudaMalloc((void**)&d_hist3, NBIN * sizeof(float));

    for (int i = 0; i < NBIN; i++) h_hist[i] = 0.0f;
    cudaMemcpy(d_hist, h_hist, NBIN * sizeof(float),
    cudaMemcpyHostToDevice);
    cudaMemcpy(d_hist2, h_hist, NBIN * sizeof(float),
    cudaMemcpyHostToDevice);
    cudaMemcpy(d_hist3, h_hist, NBIN * sizeof(float),
    cudaMemcpyHostToDevice);

    cudaEvent_t start, end;
    float elapsed = 0, elapsed2 = 0, elapsed3;
    cudaEventCreate(&start);
    cudaEventCreate(&end);

    cudaEventRecord(start, 0);

    atom<<<NBLOCKS, NTHREADS>>>(d_hist);
    cudaThreadSynchronize();

    cudaEventRecord(end, 0);
    cudaEventSynchronize(start);
    cudaEventSynchronize(end);
    cudaEventElapsedTime(&elapsed, start, end);

    cudaEventRecord(start, 0);

    shm<<<NBLOCKS, NTHREADS>>>(d_hist2);
    cudaThreadSynchronize();

    cudaEventRecord(end, 0);
    cudaEventSynchronize(start);
    cudaEventSynchronize(end);
    cudaEventElapsedTime(&elapsed2, start, end);

    cudaEventRecord(start, 0);

    glob<<<1, 1>>>(d_hist3);
    cudaThreadSynchronize();

    cudaEventRecord(end, 0);
    cudaEventSynchronize(start);
    cudaEventSynchronize(end);
    cudaEventElapsedTime(&elapsed3, start, end);

    cudaMemcpy(h_hist, d_hist, NBIN * sizeof(float),
    cudaMemcpyDeviceToHost);
    cudaMemcpy(h_hist2, d_hist2, NBIN * sizeof(float),
    cudaMemcpyDeviceToHost);
    cudaMemcpy(h_hist3, d_hist3, NBIN * sizeof(float),
    cudaMemcpyDeviceToHost);

    /* print output */
    for (int i = 0; i < NBIN; i++) {
        printf("atom: %10.2f shm: %10.2f glob:
    %10.2f¥n",h_hist[i],h_hist2[i],h_hist3[i]);
    }

    printf("%12s: %8.4f msec¥n", "One Thread", elapsed3);
    printf("%12s: %8.4f msec¥n", "Atomic", elapsed);
    printf("%12s: %8.4f msec¥n", "Sh_mem", elapsed2);

    return 0;
}

A: When writing GPU code you should avoid reading and writing to/from global memory. Global memory is very slow on GPU. That's the hardware feature. The only thing you can do is to make neighboring treads read/write in neighboring adresses in global memory. This will cause coalescing and speed up the process. But in general read your data once, process it and write it out once.

A: Note that NVCC might optimize out a lot of your code after you make the modification - it detects that no write to global memory is made and just removes the "unneeded" code. So this speedup may not be coming out of the global writer per ce.
I would recommend using profiler on your actual code (the one with global write) to see if there's anything like unaligned access or other perf problem.


text:
Q: Making use of SQL Alias (as) in PHP I'm using the following query to pull records from a database:
$query = "SELECT password, salt, 'jobseeker' as type
FROM ip_jobseekers
WHERE ipJ_username = '$username'
UNION
SELECT password, salt, 'company' as type
FROM ip_companies
WHERE ipC_username = '$username';";

$result = mysql_query($query);

//No Such User
if (mysql_num_rows($result) < 1) {
    header('Location: login.php?login=fail'); exit;}

to create a new session:
//login successful
else {$_SESSION['user'] = $username;}

I want to include the type of user in the session so that I can specify what content is displated to the user. Is it possible to make use of the "'company' as type" and "'jobseeker' as type" parts of that query to do this? I've make a few attempts at doing it but I've had no success.
Any help would be greatly appreciated.
Thanks.
Kai.

A: There is absolutely no difference between "regular" and aliased fields. You can use the latter as well as any other.

A: to find any error in your query you can run the query like below
$result = mysql_query($query) or trigger_error(mysql_error()." ".$query);

for testing you can use above and you ca redirect to custom error page in production environment.
My personal suggestion is to use PDO. make use of Object oriented Programs to run your code faster and to have standard structure.

A: First of all, you're using the mysql_ set of functions, which are highly dangerous, and you should move over all your code from ASAP.
Next, you should NOT be stringing up queries like this, because your application will grow into this behemoth of SQL everywhere (in the HTML, in the Views, EVERYWHERE), you should probably be using some kind of class/object system where you wrap around the SQL.
And, you should know about the SQL AND clause (I feel horrible linking w3schools, but, that's all I can find right now).


text:
Q: Javascript image scroller, how to keep it scrolling without restarting? I have this script that scrolls images vertically from bottom till the top and it works pretty good except for one thing. I would like this scrolling to be infinite and not to restart every time the frame is empty. In other words, I don't want it to be empty at any time.
You guys think this is possible? Here's the code (I know the script is pretty awful but I've tried so many and this is only one that did the trick for me):

Thanks you in advance guys!

A: Try putting a copy of the image immediately following the one you are scrolling and scroll both. Once the first image leaves the screen completely and the copy is on screen, put the first image behind the copy and continue scrolling until the copy is off screen and the original is completely on screen. If you keep repeating this, you should get the illusion of an infinitely scrolling image.