text:
Q: Unable to load Dynamic WebTable Content Selenium in Python 3.6 I hope you're doing fine.
I'm having a problem extracting rows of table from website by selenium. There are 50 rows showing on website but when I scrape it, there are only 8. First I didn't what was the problem but after so much struggle i found the problem, but can't seem to figure out the solution.
So, the table loads content when i'm focusing on it. When i'm not focusing on other rows, the html look like this:
Div Elements When not focused

But when i go to those rows, it loads the content and unload previous rows.
Div Elements When Focused

1767

HTML5

Big
120x600

HYAffiliates / HYCM

RU Trading

en

AU

1

4

0

0.00%

0

0

$0.00

As you can see, the bullets are visible now indicating it loaded all Childs now when i went/focused to those rows.
I tried this method, but only give me those rows which are focused:
tables = driver.find_elements_by_xpath("//div[contains(@class,'x-grid3-row')]//tr")
    print("Length: "+str(len(tables)))
    for i, table in enumerate(tables):
        data = [item.text for item in table.find_elements_by_xpath(".//*[self::td or self::th]")]

Anyone canplease help me? Thanks in advance
Edited: Solution:
 tables = driver.find_elements_by_xpath("//div[contains(@class,'x-grid3-row')]")
    saved = []
    for table in tables:
        driver.execute_script("arguments[0].scrollIntoView();", table)
        data = [item.text for item in table.find_elements_by_xpath(".//*[self::td or self::th]")]
        print(data)
        saved.append(data)
        time.sleep(0.5)
    print(len(saved))

A: I Would suggest induce WebDriverWait() and wait for visibility_of_all_elements_located()
tables=WebDriverWait(driver,20).until(EC.visibility_of_all_elements_located((By.XPATH,"//table[@class='x-grid3-row-table']//tr")))
print("Length: "+str(len(tables)))
for i, table in enumerate(tables):
    data = [item.text for item in table.find_elements_by_xpath(".//*[self::td or self::th]")]

Add following libraries.
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

Note: If you get the same result as before then you might need to scroll the element.


text:
Q: Get rowid value with datatables when using pure json input In my project I use datatables to display data directly form the database. My input data is pure JSON and I never used any of back end processing methods mentioned in the datatables website
 $(document).ready(function() {
    var table = $('#example').DataTable( {

        "order": [[ -0 ]],
        "pageLength": 24,
        "oLanguage": { "sSearch": '' },
        "lengthChange": false,

        "ajax": {
            "url": "data.php?content=userdata",
            "dataSrc": ""
        },

        "columns": [
            { "data": "id",
               "visible": false,
            },
            { "data": "oid" },
            { "data": "name" },
            { "data": "mobile" },
            { "data": "email" },
            { "data": null,
                "targets": -0,
                "data": null,
                "defaultContent": "<button>test</button>",
            }
        ],

    } );

    $('#example tbody').on( 'click', 'button', function () {
        var data = table.row( $(this).parents('tr') ).data();
        alert("oid is: "+ data[ 1] );
    } );
} );

and my JSON input is like this
[
    {
    id: "3",
    oid: "213",
    name: "Koh Tien Kit Thomas ",
    mobile: 0123456789,
    email: "some@mail.com",
    }
]

but when I click the datatable row button, It saying value is undefined. my json not include the data object as datatables site mentioning. how to fix this ?

A: API method row().data() returns data in the original format. Since you used objects, OID would be available in data['oid'] .
Use the code below instead:
$('#example tbody').on( 'click', 'button', function () {
    var data = table.row( $(this).parents('tr') ).data();
    alert("oid is: "+ data['oid'] );
} );

redpajama_set_name: RedPajamaStackExchange


text:
Q: What is the difference between value constructors and tuples? It's written that Haskell tuples are simply a different syntax for algebraic data types. Similarly, there are examples of how to redefine value constructors with tuples.
For example, a Tree data type in Haskell might be written as
data Tree a = EmptyTree | Node a (Tree a) (Tree a)

which could be converted to "tuple form" like this:
data Tree a = EmptyTree | Node (a, Tree a, Tree a)

What is the difference between the Node value constructor in the first example, and the actual tuple in the second example? i.e. Node a (Tree a) (Tree a) vs. (a, Tree a, Tree a) (aside from just the syntax)?
Under the hood, is Node a (Tree a) (Tree a) just a different syntax for a 3-tuple of the appropriate types at each position?
I know that you can partially apply a value constructor, such as Node 5 which will have type: (Node 5) :: Num a => Tree a -> Tree a -> Tree a
You sort of can partially apply a tuple too, using (,,) as a function ... but this doesn't know about the potential types for the un-bound entries, such as:
Prelude> :t (,,) 5
(,,) 5 :: Num a => b -> c -> (a, b, c)

unless, I guess, you explicitly declare a type with ::.
Aside from syntactical specialties like this, plus this last example of the type scoping, is there a material difference between whatever a "value constructor" thing actually is in Haskell, versus a tuple used to store positional values of the same types are the value constructor's arguments?

A: Well, coneptually there indeed is no difference and in fact other languages (OCaml, Elm) present tagged unions exactly that way - i.e., tags over tuples or first class records (which Haskell lacks). I personally consider this to be a design flaw in Haskell.
There are some practical differences though:

*

*Laziness. Haskell's tuples are lazy and you can't change that. You can however mark constructor fields as strict:
data Tree a = EmptyTree | Node !a !(Tree a) !(Tree a)

*Memory footprint and performance. Circumventing intermediate types reduces the footprint and raises the performance. You can read more about it in this fine answer.
You can also mark the strict fields with the the UNPACK pragma to reduce the footprint even further. Alternatively you can use the -funbox-strict-fields compiler option. Concerning the last one, I simply prefer to have it on by default in all my projects. See the Hasql's Cabal file for example.

Considering the stated above, if it's a lazy type that you're looking for, then the following snippets should compile to the same thing:
data Tree a = EmptyTree | Node a (Tree a) (Tree a)

data Tree a = EmptyTree | Node {-# UNPACK #-} !(a, Tree a, Tree a)

So I guess you can say that it's possible to use tuples to store lazy fields of a constructor without a penalty. Though it should be mentioned that this pattern is kinda unconventional in the Haskell's community.
If it's the strict type and footprint reduction that you're after, then there's no other way than to denormalize your tuples directly into constructor fields.

A: They're what's called isomorphic, meaning "to have the same shape".  You can write something like
data Option a = None | Some a

And this is isomorphic to
data Maybe a = Nothing | Just a

meaning that you can write two functions
f :: Maybe a -> Option a
g :: Option a -> Maybe a

Such that f . g == id == g . f for all possible inputs.  We can then say that (,,) is a data constructor isomorphic to the constructor
data Triple a b c = Triple a b c

Because you can write
f :: (a, b, c) -> Triple a b c
f (a, b, c) = Triple a b c

g :: Triple a b c -> (a, b, c)
g (Triple a b c) = (a, b, c)

And Node as a constructor is a special case of Triple, namely Triple a (Tree a) (Tree a).  In fact, you could even go so far as to say that your definition of Tree could be written as
newtype Tree' a = Tree' (Maybe (a, Tree' a, Tree' a))

The newtype is required since you can't have a type alias be recursive.  All you have to do is say that EmptyLeaf == Tree' Nothing and Node a l r = Tree' (Just (a, l, r)).  You could pretty simply write functions that convert between the two.
Note that this is all from a mathematical point of view.  The compiler can add extra metadata and other information to be able to identify a particular constructor making them behave slightly differently at runtime.


text:
Q: Como pegar o mês formatado com zero à esquerda no Typescript Estou tentando pegar o mês no TypeScript com Node.js:
const today = new Date();
var todayMonth = today.getMonth() + 1
if(todayMonth < 10) {
  todayMonth = '0' + todayMonth
}

Mas estou recebendo o seguinte erro:

"O tipo 'string' não pode ser atribuído ao tipo 'number'.ts(2322)."

Como eu poderia fazer colocar o zero na frente se o mês for menor que 10, para ficar 01, 02, 03, etc?

A: getMonth() retorna um número. Se quer uma string, crie outra variável para receber o valor devidamente formatado:
const today = new Date();
const mes = today.getMonth() + 1;
let todayMonth;
if (mes < 10) {
  todayMonth = '0' + mes;
} else {
  todayMonth = mes.toString();
}

Você também pode habilitar o ES2017 (mudando para target: "es2017" no seu tsconfig), assim será possível usar padStart, que já preenche com esse zero à esquerda caso necessário:
const today = new Date();
let todayMonth = (today.getMonth() + 1).toString().padStart(2, 0);

Há outras respostas sugerindo usar toLocaleDateString ou toISOString, que também funcionam (apesar de eu achar um exagero formatar a data para uma string só para fazer vários split's, sendo que - na minha opinião - é bem mais simples obter o mês diretamente com getMonth() e formatá-lo da maneira que achar melhor).
Mas existe outra diferença fundamental: toLocaleDateString retorna o valor do mês de acordo com o timezone do browser (ou o que estiver configurado no node), que é consistente com getMonth(). Já toISOString retorna o mês de acordo com a data em UTC, que nem sempre pode ser o mesmo mês do timezone do browser (e é consistente com getUTCMonth()). Por exemplo, no meu browser o timezone configurado é o Horário de Brasília (no caso, o Chrome usa o do sistema operacional), então veja o que acontece com o código abaixo:

let d = new Date(2019, 5, 30, 23, 0); // 30 de junho de 2019, às 23:00

// resultados obtidos em um browser cujo fuso é o Horário de Brasília
console.log(d.toLocaleDateString('pt-BR')); // 30/06/2019
console.log(d.toISOString()); // 2019-07-01T02:00:00.000Z
console.log(d.getMonth() + 1); // 6
console.log(d.getUTCMonth() + 1); // 7

Se o seu browser está configurado com um fuso horário diferente, os resultados podem variar.
A data criada corresponde a 30 de junho de 2019, às 23:00, no timezone do browser (no meu caso, no Horário de Brasília), então toLocaleDateString retorna 30/06/2019. Já toISOString retorna esta mesma data em UTC (e 30 de junho de 2019, às 23:00 no Horário de Brasília corresponde a 1 de julho de 2019, às 02:00 em UTC), por isso nesse caso o mês é 07. Claro que nem sempre haverá esta diferença (durante boa parte do tempo, o mês local é o mesmo que o mês em UTC), mas dependendo do que está fazendo, é importante decidir se vai usar UTC ou o timezone do browser.
De qualquer forma, você não precisa transformar a data em uma string e fazer split. Se quer o mês de acordo com o timezone do browser, use getMonth(), mas se quer o valor em UTC, use getUTCMonth() - e para ambos, use uma das opções já indicadas acima (if (valor < 10) etc.. ou padStart).

A: É só criar uma variável só para isso, TYpeScript não é JavaScript, cada variável tem um tipo de não pode mudar, ou seja TypeScript não é bagunça:
let month = new Date().getMonth() + 1;
let todayMonth = month.toString();
if (todayMonth < 10) todayMonth = '0' + month.toString();

Coloquei no GitHub para referência futura.

A: Acredito que assim já terá o mês com o zero:
(new Date('Jan 05 2019'))
.toLocaleDateString('pt-BR')
.split('/')[1];

Você também pode obter o mês de uma data formata a partir do retorno em string, no formato ISO:
var dt = new Date('2019-01-10');
console.log(dt.toISOString().split('T')[0].split('-')[1]);

Ambas as maneiras, permitem que você receba uma data originalmente em formato brasileiro, desta maneira você não, necessariamente, precisaria acrescentar o zero quando fosse menor que 10, já que o javascript já está trazendo no formato brasileiro que você precisa, eu apenas filtrei o resultado nos casos a cima, se você deixar o .toLocaleDateString()vazio, ele usará o padrão do navegador do usuário, do local onde ele está.

A: Assim também funciona
mes = new Date().toISOString().split('T')[0].split('-')[1];

Basicamente em uma explicação passo a passo:

*

*new Date(); => retorna um objeto Date que contem data atual juntamente com a hora;

*.toISOString() => retorna a data no padrão iso exemplo '2019-11-05T13:31:22.753Z' , o retorno é do tipo uma string

*.split('T')[0] => vai dividir a string cortando ela onde existe o T, apenas a primeira parte do corte interessa retornando '2019-11-05'

*split('-')[1] => vai dividir a string '2019-11-05' por - sendo assim apenas a segunda ocorrencia interessa, pois está é o mês

*o retorno é '11' do tipo String

O Mesmo codigo funciona para datas especificas
data = '2050-04-21T03:00:00.000Z'; // data no formato ISO
mes = new Date(data).toISOString().split('T')[0].split('-')[1]; // retorna 04
// ou mes = data.split('T')[0].split('-')[1];

let mesAtual = new Date().toISOString().split('T')[0].split('-')[1];
let mesDestaData = new Date('2050-04-21T03:00:00.000Z').toISOString().split('T')[0].split('-')[1];

console.log(mesAtual);
console.log(mesDestaData);


text:
Q: PHP: getting result from XML collection I'm trying to read an XML file with PHP but I'm not able to get data and can't figure out why.
XML structure:
<?xml version="1.0" encoding="UTF-8"?>
<FavoriteListResponse>
   <metadata>
      <offset>0</offset>
      <limit>20</limit>
      <total>1</total>
   </metadata>
   <favorites>
      <favorites objectType="Product">
         <id>5831fd52f9f0c0a80c88dafa</id>
         <productId>511290702</productId>
         <imageId>39d5e666255e351aa42fca3a9b939d04</imageId>
         <product>
            <id>511290702</id>
            <name>Misha Black Cropped Leather Jacket With Asymmetrical Front Zipper</name>
            <brandedName>Mackage Misha Black Cropped Leather Jacket With Asymmetrical Front Zipper</brandedName>
            <unbrandedName>Misha Black Cropped Leather Jacket With Asymmetrical Front Zipper</unbrandedName>
            <currency>USD</currency>
            <price>620.0</price>
            <priceLabel>Sold Out</priceLabel>
            <inStock>false</inStock>
            <stock>
               <stock>
                  <size>
                     <name>M</name>
                  </size>
               </stock>
               <stock>
                  <size>
                     <name>XXS</name>
                  </size>
               </stock>
            </stock>
            <retailer>
               <id>596</id>
               <name>Mackage</name>
               <score>242</score>
            </retailer>
            <brand>
               <id>1590</id>
               <name>Mackage</name>
            </brand>
            <locale>en_US</locale>
            <description>Misha by Mackage is a washed leather jacket for women crafted from genuine lambskin. Fitted silhouette cropped above the hips. Asymmetrical full-length zip closure. Dual zippered front pockets. Nickel hardware. Available in black and sand. Fits true to size. Fitted silhouette. Washed genuine lambskin leather jacket. Cropped above the hips. Padded shoulder yoke. Hem yoke with stitching at the back bottom. Asymmetrical full-length two-way zip closure. Nickel hardware. Coat length from shoulder to hem : 17inches / 43.2cm Model is 5'11/180 cm and wearing a size XS. Shell: 100% Lambskin. Lining (Woven): 100% Polyester.</description>
            <clickUrl>https://api.shopstyle.com/action/apiVisitRetailer?id=511290702&pid=uid5044-35323862-95</clickUrl>
            <image>
               <sizes>
                  <Small>
                     <sizeName>Small</sizeName>
                     <url>https://img.shopstyle-cdn.com/pim/39/d5/39d5e666255e351aa42fca3a9b939d04_small.jpg</url>
                     <width>32</width>
                     <height>40</height>
                     <actualWidth>11</actualWidth>
                     <actualHeight>40</actualHeight>
                  </Small>
                  <XLarge>
                     <sizeName>XLarge</sizeName>
                     <url>https://img.shopstyle-cdn.com/pim/39/d5/39d5e666255e351aa42fca3a9b939d04_xlarge.jpg</url>
                     <width>328</width>
                     <height>410</height>
                     <actualWidth>111</actualWidth>
                     <actualHeight>410</actualHeight>
                  </XLarge>
                  <Medium>
                     <sizeName>Medium</sizeName>
                     <url>https://img.shopstyle-cdn.com/sim/39/d5/39d5e666255e351aa42fca3a9b939d04_medium/mackage-misha-black-cropped-leather-jacket-with-asymmetrical-front-zipper.jpg</url>
                     <width>112</width>
                     <height>140</height>
                     <actualWidth>38</actualWidth>
                     <actualHeight>140</actualHeight>
                  </Medium>
                  <Large>
                     <sizeName>Large</sizeName>
                     <url>https://img.shopstyle-cdn.com/sim/39/d5/39d5e666255e351aa42fca3a9b939d04/mackage-misha-black-cropped-leather-jacket-with-asymmetrical-front-zipper.jpg</url>
                     <width>164</width>
                     <height>205</height>
                     <actualWidth>55</actualWidth>
                     <actualHeight>205</actualHeight>
                  </Large>
                  <IPhoneSmall>
                     <sizeName>IPhoneSmall</sizeName>
                     <url>https://img.shopstyle-cdn.com/mim/39/d5/39d5e666255e351aa42fca3a9b939d04_small.jpg</url>
                     <width>100</width>
                     <height>125</height>
                     <actualWidth>34</actualWidth>
                     <actualHeight>125</actualHeight>
                  </IPhoneSmall>
                  <Best>
                     <sizeName>Best</sizeName>
                     <url>https://img.shopstyle-cdn.com/pim/39/d5/39d5e666255e351aa42fca3a9b939d04_best.jpg</url>
                     <width>720</width>
                     <height>900</height>
                     <actualWidth>243</actualWidth>
                     <actualHeight>900</actualHeight>
                  </Best>
                  <Original>
                     <sizeName>Original</sizeName>
                     <url>https://img.shopstyle-cdn.com/pim/39/d5/39d5e666255e351aa42fca3a9b939d04_best.jpg</url>
                     <actualWidth>243</actualWidth>
                     <actualHeight>900</actualHeight>
                  </Original>
                  <IPhone>
                     <sizeName>IPhone</sizeName>
                     <url>https://img.shopstyle-cdn.com/mim/39/d5/39d5e666255e351aa42fca3a9b939d04.jpg</url>
                     <width>288</width>
                     <height>360</height>
                     <actualWidth>97</actualWidth>
                     <actualHeight>360</actualHeight>
                  </IPhone>
               </sizes>
               <id>39d5e666255e351aa42fca3a9b939d04</id>
            </image>
            <alternateImages>
               <alternateImages>
                  <sizes>
                     <Small>
                        <sizeName>Small</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/39/d5/39d5e666255e351aa42fca3a9b939d04_small.jpg</url>
                        <width>32</width>
                        <height>40</height>
                        <actualWidth>11</actualWidth>
                        <actualHeight>40</actualHeight>
                     </Small>
                     <XLarge>
                        <sizeName>XLarge</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/39/d5/39d5e666255e351aa42fca3a9b939d04_xlarge.jpg</url>
                        <width>328</width>
                        <height>410</height>
                        <actualWidth>111</actualWidth>
                        <actualHeight>410</actualHeight>
                     </XLarge>
                     <Medium>
                        <sizeName>Medium</sizeName>
                        <url>https://img.shopstyle-cdn.com/sim/39/d5/39d5e666255e351aa42fca3a9b939d04_medium/mackage-misha-black-cropped-leather-jacket-with-asymmetrical-front-zipper.jpg</url>
                        <width>112</width>
                        <height>140</height>
                        <actualWidth>38</actualWidth>
                        <actualHeight>140</actualHeight>
                     </Medium>
                     <Large>
                        <sizeName>Large</sizeName>
                        <url>https://img.shopstyle-cdn.com/sim/39/d5/39d5e666255e351aa42fca3a9b939d04/mackage-misha-black-cropped-leather-jacket-with-asymmetrical-front-zipper.jpg</url>
                        <width>164</width>
                        <height>205</height>
                        <actualWidth>55</actualWidth>
                        <actualHeight>205</actualHeight>
                     </Large>
                     <IPhoneSmall>
                        <sizeName>IPhoneSmall</sizeName>
                        <url>https://img.shopstyle-cdn.com/mim/39/d5/39d5e666255e351aa42fca3a9b939d04_small.jpg</url>
                        <width>100</width>
                        <height>125</height>
                        <actualWidth>34</actualWidth>
                        <actualHeight>125</actualHeight>
                     </IPhoneSmall>
                     <Best>
                        <sizeName>Best</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/39/d5/39d5e666255e351aa42fca3a9b939d04_best.jpg</url>
                        <width>720</width>
                        <height>900</height>
                        <actualWidth>243</actualWidth>
                        <actualHeight>900</actualHeight>
                     </Best>
                     <Original>
                        <sizeName>Original</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/39/d5/39d5e666255e351aa42fca3a9b939d04_best.jpg</url>
                        <actualWidth>243</actualWidth>
                        <actualHeight>900</actualHeight>
                     </Original>
                     <IPhone>
                        <sizeName>IPhone</sizeName>
                        <url>https://img.shopstyle-cdn.com/mim/39/d5/39d5e666255e351aa42fca3a9b939d04.jpg</url>
                        <width>288</width>
                        <height>360</height>
                        <actualWidth>97</actualWidth>
                        <actualHeight>360</actualHeight>
                     </IPhone>
                  </sizes>
                  <id>39d5e666255e351aa42fca3a9b939d04</id>
               </alternateImages>
               <alternateImages>
                  <sizes>
                     <Small>
                        <sizeName>Small</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/56/c4/56c4c2a990fb868e7a27a57381330244_small.jpg</url>
                        <width>32</width>
                        <height>40</height>
                        <actualWidth>12</actualWidth>
                        <actualHeight>40</actualHeight>
                     </Small>
                     <XLarge>
                        <sizeName>XLarge</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/56/c4/56c4c2a990fb868e7a27a57381330244_xlarge.jpg</url>
                        <width>328</width>
                        <height>410</height>
                        <actualWidth>124</actualWidth>
                        <actualHeight>410</actualHeight>
                     </XLarge>
                     <Medium>
                        <sizeName>Medium</sizeName>
                        <url>https://img.shopstyle-cdn.com/sim/56/c4/56c4c2a990fb868e7a27a57381330244_medium/mackage-misha-black-cropped-leather-jacket-with-asymmetrical-front-zipper.jpg</url>
                        <width>112</width>
                        <height>140</height>
                        <actualWidth>42</actualWidth>
                        <actualHeight>140</actualHeight>
                     </Medium>
                     <Large>
                        <sizeName>Large</sizeName>
                        <url>https://img.shopstyle-cdn.com/sim/56/c4/56c4c2a990fb868e7a27a57381330244/mackage-misha-black-cropped-leather-jacket-with-asymmetrical-front-zipper.jpg</url>
                        <width>164</width>
                        <height>205</height>
                        <actualWidth>62</actualWidth>
                        <actualHeight>205</actualHeight>
                     </Large>
                     <IPhoneSmall>
                        <sizeName>IPhoneSmall</sizeName>
                        <url>https://img.shopstyle-cdn.com/mim/56/c4/56c4c2a990fb868e7a27a57381330244_small.jpg</url>
                        <width>100</width>
                        <height>125</height>
                        <actualWidth>38</actualWidth>
                        <actualHeight>125</actualHeight>
                     </IPhoneSmall>
                     <Best>
                        <sizeName>Best</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/56/c4/56c4c2a990fb868e7a27a57381330244_best.jpg</url>
                        <width>720</width>
                        <height>900</height>
                        <actualWidth>273</actualWidth>
                        <actualHeight>900</actualHeight>
                     </Best>
                     <Original>
                        <sizeName>Original</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/56/c4/56c4c2a990fb868e7a27a57381330244_best.jpg</url>
                        <actualWidth>273</actualWidth>
                        <actualHeight>900</actualHeight>
                     </Original>
                     <IPhone>
                        <sizeName>IPhone</sizeName>
                        <url>https://img.shopstyle-cdn.com/mim/56/c4/56c4c2a990fb868e7a27a57381330244.jpg</url>
                        <width>288</width>
                        <height>360</height>
                        <actualWidth>109</actualWidth>
                        <actualHeight>360</actualHeight>
                     </IPhone>
                  </sizes>
                  <id>56c4c2a990fb868e7a27a57381330244</id>
               </alternateImages>
               <alternateImages>
                  <sizes>
                     <Small>
                        <sizeName>Small</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/a9/b2/a9b2551df3fe88d30f596ab83a1e764c_small.jpg</url>
                        <width>32</width>
                        <height>40</height>
                        <actualWidth>10</actualWidth>
                        <actualHeight>40</actualHeight>
                     </Small>
                     <XLarge>
                        <sizeName>XLarge</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/a9/b2/a9b2551df3fe88d30f596ab83a1e764c_xlarge.jpg</url>
                        <width>328</width>
                        <height>410</height>
                        <actualWidth>108</actualWidth>
                        <actualHeight>410</actualHeight>
                     </XLarge>
                     <Medium>
                        <sizeName>Medium</sizeName>
                        <url>https://img.shopstyle-cdn.com/sim/a9/b2/a9b2551df3fe88d30f596ab83a1e764c_medium/mackage-misha-black-cropped-leather-jacket-with-asymmetrical-front-zipper.jpg</url>
                        <width>112</width>
                        <height>140</height>
                        <actualWidth>37</actualWidth>
                        <actualHeight>140</actualHeight>
                     </Medium>
                     <Large>
                        <sizeName>Large</sizeName>
                        <url>https://img.shopstyle-cdn.com/sim/a9/b2/a9b2551df3fe88d30f596ab83a1e764c/mackage-misha-black-cropped-leather-jacket-with-asymmetrical-front-zipper.jpg</url>
                        <width>164</width>
                        <height>205</height>
                        <actualWidth>54</actualWidth>
                        <actualHeight>205</actualHeight>
                     </Large>
                     <IPhoneSmall>
                        <sizeName>IPhoneSmall</sizeName>
                        <url>https://img.shopstyle-cdn.com/mim/a9/b2/a9b2551df3fe88d30f596ab83a1e764c_small.jpg</url>
                        <width>100</width>
                        <height>125</height>
                        <actualWidth>33</actualWidth>
                        <actualHeight>125</actualHeight>
                     </IPhoneSmall>
                     <Best>
                        <sizeName>Best</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/a9/b2/a9b2551df3fe88d30f596ab83a1e764c_best.jpg</url>
                        <width>720</width>
                        <height>900</height>
                        <actualWidth>236</actualWidth>
                        <actualHeight>900</actualHeight>
                     </Best>
                     <Original>
                        <sizeName>Original</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/a9/b2/a9b2551df3fe88d30f596ab83a1e764c_best.jpg</url>
                        <actualWidth>236</actualWidth>
                        <actualHeight>900</actualHeight>
                     </Original>
                     <IPhone>
                        <sizeName>IPhone</sizeName>
                        <url>https://img.shopstyle-cdn.com/mim/a9/b2/a9b2551df3fe88d30f596ab83a1e764c.jpg</url>
                        <width>288</width>
                        <height>360</height>
                        <actualWidth>94</actualWidth>
                        <actualHeight>360</actualHeight>
                     </IPhone>
                  </sizes>
                  <id>a9b2551df3fe88d30f596ab83a1e764c</id>
               </alternateImages>
               <alternateImages>
                  <sizes>
                     <Small>
                        <sizeName>Small</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/b8/2a/b82a3ff82915a288cedb59386eb74c4c_small.jpg</url>
                        <width>32</width>
                        <height>40</height>
                        <actualWidth>11</actualWidth>
                        <actualHeight>40</actualHeight>
                     </Small>
                     <XLarge>
                        <sizeName>XLarge</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/b8/2a/b82a3ff82915a288cedb59386eb74c4c_xlarge.jpg</url>
                        <width>328</width>
                        <height>410</height>
                        <actualWidth>114</actualWidth>
                        <actualHeight>410</actualHeight>
                     </XLarge>
                     <Medium>
                        <sizeName>Medium</sizeName>
                        <url>https://img.shopstyle-cdn.com/sim/b8/2a/b82a3ff82915a288cedb59386eb74c4c_medium/mackage-misha-black-cropped-leather-jacket-with-asymmetrical-front-zipper.jpg</url>
                        <width>112</width>
                        <height>140</height>
                        <actualWidth>39</actualWidth>
                        <actualHeight>140</actualHeight>
                     </Medium>
                     <Large>
                        <sizeName>Large</sizeName>
                        <url>https://img.shopstyle-cdn.com/sim/b8/2a/b82a3ff82915a288cedb59386eb74c4c/mackage-misha-black-cropped-leather-jacket-with-asymmetrical-front-zipper.jpg</url>
                        <width>164</width>
                        <height>205</height>
                        <actualWidth>57</actualWidth>
                        <actualHeight>205</actualHeight>
                     </Large>
                     <IPhoneSmall>
                        <sizeName>IPhoneSmall</sizeName>
                        <url>https://img.shopstyle-cdn.com/mim/b8/2a/b82a3ff82915a288cedb59386eb74c4c_small.jpg</url>
                        <width>100</width>
                        <height>125</height>
                        <actualWidth>35</actualWidth>
                        <actualHeight>125</actualHeight>
                     </IPhoneSmall>
                     <Best>
                        <sizeName>Best</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/b8/2a/b82a3ff82915a288cedb59386eb74c4c_best.jpg</url>
                        <width>720</width>
                        <height>900</height>
                        <actualWidth>250</actualWidth>
                        <actualHeight>900</actualHeight>
                     </Best>
                     <Original>
                        <sizeName>Original</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/b8/2a/b82a3ff82915a288cedb59386eb74c4c_best.jpg</url>
                        <actualWidth>250</actualWidth>
                        <actualHeight>900</actualHeight>
                     </Original>
                     <IPhone>
                        <sizeName>IPhone</sizeName>
                        <url>https://img.shopstyle-cdn.com/mim/b8/2a/b82a3ff82915a288cedb59386eb74c4c.jpg</url>
                        <width>288</width>
                        <height>360</height>
                        <actualWidth>100</actualWidth>
                        <actualHeight>360</actualHeight>
                     </IPhone>
                  </sizes>
                  <id>b82a3ff82915a288cedb59386eb74c4c</id>
               </alternateImages>
               <alternateImages>
                  <sizes>
                     <Small>
                        <sizeName>Small</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/e4/9d/e49db198c964ac5c339b2924687c633c_small.jpg</url>
                        <width>32</width>
                        <height>40</height>
                        <actualWidth>32</actualWidth>
                        <actualHeight>40</actualHeight>
                     </Small>
                     <XLarge>
                        <sizeName>XLarge</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/e4/9d/e49db198c964ac5c339b2924687c633c_xlarge.jpg</url>
                        <width>328</width>
                        <height>410</height>
                        <actualWidth>328</actualWidth>
                        <actualHeight>410</actualHeight>
                     </XLarge>
                     <Medium>
                        <sizeName>Medium</sizeName>
                        <url>https://img.shopstyle-cdn.com/sim/e4/9d/e49db198c964ac5c339b2924687c633c_medium/mackage-misha-black-cropped-leather-jacket-with-asymmetrical-front-zipper.jpg</url>
                        <width>112</width>
                        <height>140</height>
                        <actualWidth>112</actualWidth>
                        <actualHeight>140</actualHeight>
                     </Medium>
                     <Large>
                        <sizeName>Large</sizeName>
                        <url>https://img.shopstyle-cdn.com/sim/e4/9d/e49db198c964ac5c339b2924687c633c/mackage-misha-black-cropped-leather-jacket-with-asymmetrical-front-zipper.jpg</url>
                        <width>164</width>
                        <height>205</height>
                        <actualWidth>164</actualWidth>
                        <actualHeight>205</actualHeight>
                     </Large>
                     <IPhoneSmall>
                        <sizeName>IPhoneSmall</sizeName>
                        <url>https://img.shopstyle-cdn.com/mim/e4/9d/e49db198c964ac5c339b2924687c633c_small.jpg</url>
                        <width>100</width>
                        <height>125</height>
                        <actualWidth>100</actualWidth>
                        <actualHeight>125</actualHeight>
                     </IPhoneSmall>
                     <Best>
                        <sizeName>Best</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/e4/9d/e49db198c964ac5c339b2924687c633c_best.jpg</url>
                        <width>720</width>
                        <height>900</height>
                        <actualWidth>720</actualWidth>
                        <actualHeight>900</actualHeight>
                     </Best>
                     <Original>
                        <sizeName>Original</sizeName>
                        <url>https://img.shopstyle-cdn.com/pim/e4/9d/e49db198c964ac5c339b2924687c633c_best.jpg</url>
                     </Original>
                     <IPhone>
                        <sizeName>IPhone</sizeName>
                        <url>https://img.shopstyle-cdn.com/mim/e4/9d/e49db198c964ac5c339b2924687c633c.jpg</url>
                        <width>288</width>
                        <height>360</height>
                        <actualWidth>288</actualWidth>
                        <actualHeight>360</actualHeight>
                     </IPhone>
                  </sizes>
                  <id>e49db198c964ac5c339b2924687c633c</id>
               </alternateImages>
            </alternateImages>
            <extractDate>2016-02-16</extractDate>
            <lastModified>2017-02-05</lastModified>
            <seeMoreLabel>Mackage Leather Jackets</seeMoreLabel>
            <preOwned>false</preOwned>
            <rental>false</rental>
            <colors />
            <sizes>
               <size>
                  <name>XXS</name>
                  <canonicalSize>
                     <id>79</id>
                     <name>XXS (0)</name>
                  </canonicalSize>
               </size>
               <size>
                  <name>M</name>
                  <canonicalSize>
                     <id>85</id>
                     <name>M (8-10)</name>
                  </canonicalSize>
               </size>
            </sizes>
            <categories>
               <category>
                  <id>leather-jackets</id>
                  <name>Leather Jackets</name>
                  <shortName>Leather</shortName>
                  <fullName>Women's Leather Jackets</fullName>
                  <localizedId>leather-jackets</localizedId>
               </category>
            </categories>
            <badges />
         </product>
         <date>
            <date>2016-11-20</date>
            <timestamp>1479671122</timestamp>
            <friendly>Nov 20, 2016</friendly>
         </date>
         <objectId>511290702</objectId>
      </favorites>
   </favorites>
</FavoriteListResponse>

I can't figure it out. Hope someone is willing to help :)

A: SimpleXML is any easy way to go for this data.  This code assumes that the data is in a file, but just change the simplexml_load_file to simplexml_load_string and pass the XML in there.
<?php
error_reporting ( E_ALL );
ini_set ( 'display_errors', 1 );

$xml = simplexml_load_file('t1.xml');
foreach( $xml->favorites->favorites->product as $product ){
    echo "Product name=".(string)$product->name.PHP_EOL;
    echo "Retailer=".(string)$product->retailer->name.PHP_EOL;
    foreach ( $product->sizes->size as $size )    {
        echo "Size:".(string)$size->name.PHP_EOL;
    }

    echo "Small image=".(string)$product->image->sizes->Small->url;
}

This only shows part of the data, but I hope it gives the idea of how to use the structure of XML. Using $xml->favorites gives you the favorites element in the $xml value.  So $xml->favorites->favorites->product will go through each product, and then $product->name gives you the name element.  From each product, this code uses $product->sizes->size to go through each size, but the same could be done for any of the data items.
This outputs (with your example XML ):
Product name=Misha Black Cropped Leather Jacket With Asymmetrical Front Zipper
Retailer=Mackage
Size:XXS
Size:M

A: I normally use this for my work purpose, you can make a try using this,
/**
 * Class xml2array
 */
class xml2array {

    var $arrOutput = array();
    var $resParser;
    var $strXmlData;

    function parse($strInputXML) {

        $this->resParser = xml_parser_create ();
        xml_set_object($this->resParser,$this);
        xml_set_element_handler($this->resParser, "tagOpen", "tagClosed");

        xml_set_character_data_handler($this->resParser, "tagData");

        $this->strXmlData = xml_parse($this->resParser,$strInputXML );
        if(!$this->strXmlData) {
            die(sprintf("XML error: %s at line %d",
                xml_error_string(xml_get_error_code($this->resParser)),
                xml_get_current_line_number($this->resParser)));
        }

        xml_parser_free($this->resParser);

        return $this->arrOutput;
    }
    function tagOpen($parser, $name, $attrs) {
        $tag=array("name"=>$name,"attrs"=>$attrs);
        array_push($this->arrOutput,$tag);
    }

    function tagData($parser, $tagData) {
        if(trim($tagData)) {
            if(isset($this->arrOutput[count($this->arrOutput)-1]['tagData'])) {
                $this->arrOutput[count($this->arrOutput)-1]['tagData'] .= $tagData;
            }
            else {
                $this->arrOutput[count($this->arrOutput)-1]['tagData'] = $tagData;
            }
        }
    }

    function tagClosed($parser, $name) {
        $this->arrOutput[count($this->arrOutput)-2]['children'][] = $this->arrOutput[count($this->arrOutput)-1];
        array_pop($this->arrOutput);
    }
}

$xml_file = file_get_contents('yourxmlfilename.xml');
$objXML = new xml2array();
$arrOutput = $objXML->parse($xml_file);

print '<pre>';
print_r($arrOutput); //print it out, or do whatever!
print '</pre>';

A: function actionFindDataByXMLTag( $result, $xml_tag, $xml_end_tag, $count = null ) {

    $next_string = '';

    $result_array = array();
    $stop = 500;//only 500 items values will be selected

    $i = 0;
    while($i < $stop) {

        if($next_string == '') {

            $from = $result;
        } else {
            $from = $next_string;
        }

        $position = strpos($from, $xml_tag) + strlen($xml_tag);
        $start = substr($from, $position);
        $end = strpos($start, $xml_end_tag);

        $terr_result = substr($start, 0, $end);

        if($terr_result == '') {
            break;
        } else {
            array_push($result_array, $terr_result);
        }

        $next_string = substr($start, $end + strlen($xml_end_tag));

        //var_dump( $next_string );

        $i++;
    }

    return $result_array;
}


text:
Q: Unity inspector can't edit public array's values I want a script that has a public array so that I can modify the values in the inspector. Here's an example script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Foo : MonoBehaviour
{
    public int[] bars;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    }
}

When I add the script to a game object, I can see the empty list in the inspector (as expected).

But when I add elements to the array, the array area is just blank so I can't set the value of each element (or see what the element values are).

Is this just a bug, or am I doing something wrong?
I'm running Unity 2021.2.5f1 on macOS Monterey 12.0.1.

A: I had this same problem after upgrading to a new version of Unity, and I discovered that it works if I move the editor window over to a different screen. Maybe because my main screen is widescreen? I dunno, I can't explain it. If I move the editor back to my main screen, they disappear again. So for now, I just adjust the values on my smaller side-screen, then move back when I'm done. If you don't have more than one screen, perhaps try to change the resolution or something.

A: May be not the best solution but, definin your own serializable int struct may works.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[Serializable]
public struct MyInt
{
    public int Int;
}

public class Foo : MonoBehaviour
{
     public MyInt[] bars;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    }
}


text:
Q: No different from / not different from
Your suggestion is no different from that of the other employees.
Your suggestion is not different from that of the other employees.

Which is the correct word to use here no or not  and what's the difficulty in their meaning ?
PS : while using no instead of not than sounds better to my ears than using from
I.e.

Your suggestion is no different than that of the other employees

A: "no" can be used as an adverb. So it can modify an adjective.
https://www.merriam-webster.com/dictionary/no?utm_campaign=sd&utm_medium=serp&utm_source=jsonld
https://www.oxfordlearnersdictionaries.com/definition/english/no_3

A: My understanding is:
No different than usually has a negative connotation.
He is no different than he was 10 years ago. (He's supposed to be better, but he isn't.)
He is not different from he was 10 yrs ago. (He was a great man and he still is)

A: Using no different is correct. Using not different is correct, but sounds awkward to me in this context - I would find it more natural to say the same as.
Not different has the sense of absoluteness, and using it indicates that the suggestion is either different or not different. No different has the sense of being on a scale including no different, slightly different, very different etc.

A: No and not are the two most common words we use to indicate negation.
but,
we use " no " before a " noun phrase " only
but we can use " not " with any other phrase or clause
in your sentence
" Your suggestion is no different from that of the other employees. "
is wrong , because " difference " is an adjective here not a noun
so,
" Your suggestion is not different from that of the other employees. "
is the correct answer.

A: Your suggestion is not different from those of the other employees is correct. Your sentence carries a negative implication by adding not to the main verb is followed by the adjective different like She is not kind

*

*Your first sentenceYour suggestion is no different from that of the other employees is wrong because there's no object and you can't use the determiner no followed by an adjective, it takes a noun here. So you can paraphrase the first sentence as There is no difference between your suggestion and those of the other employees


text:
Q: Scripting all data from database causing tons of Foreign Key Constraint conflicts when re-running I am using an EF code first generated database which provides some seed data, and imported data from other databases (ten thousands of rows, so it doesn't make sense to seed in EF). In an effort to streamline the process I figured I could just script the entire database's data only. So if I ever need to DropCreate (right now we use Migration strategy) my database again I can seed all my data at once.
However, the script generated by SQL Server causes tons of these conflicts:

The INSERT statement conflicted with the FOREIGN KEY constraint...

I can imagine this is because our data is very complex and inserting the data in the wrong order can cause this. Is there some way I can get the .sql script to ignore/turn off all foreign key constraints for the database before populating the tables, but then turn them back on after insertion is complete? There should be no constraint issues once all the data is inserted.

A: Yes, you can temporarily disable foreign keys :
ALTER TABLE MyTable NOCHECK CONSTRAINT FK_MyTable_MyKey

When you reenable the constraint, you should check the constraints to ensure there are no violations, like so (Note the double CHECK CHECK)
ALTER TABLE [MyTable] WITH CHECK CHECK CONSTRAINT FK_MyTable_MyKey

See this post for a database-level solution.


text:
Q: How to avoid the error "Unknown prop <> on tag. Remove this prop from the element"? Please, how can I rewrite this code another way to avoid the error below?
     render() {
            const { children, ...props } = this.props;
            return
{children}

      }

I get this error:
Unknown prop onClickOutside on  tag. Remove this prop from the element. For details (https://facebook.github.io/react/docs/higher-order-components.html#static-methods-must-be-copied-over)

A: Native DOM elements only allowed to have Native DOM attributes. You can't pass any attribute (prop) you want.
If you know what valid props you need to this element you can destruct them out of props and pass them explicit.
For example:
 render() {
            const { children, onClickOutside } = this.props;
            return
{children}

      }

A: You can simply remove in from the ...props you transfer:
render() {
            const { children, onClickOutside, ...props } = this.props;
            return
{children}

      }

If you want onClickOutside to map to the onClick of the div, then handle this explicitly:
render() {
            const { children, onClickOutside, ...props } = this.props;
            return
{children}

      }

Any version of React < 16.x, have a whitelist of available attributes.  So, all attributes passed to elements must be in the whitelist.


text:
Q: What's the equivalent to Mac's "control+command+x" in Windows? (sublime text 2) It's a command to run the code to check which browsers do not need CSS specifications.
Is there a place where I can find the key-map for the two OSs?

A: It should be Alt+Ctrl+X. All Cmd shortcuts transforms to Ctrl, and all Ctrl ones transforms to Alt under Windows or Linux, if their author hasn't set some specific.


text:
Q: I just bought a new computer with Windows 10 and every time I try to open GitBash, I can an error message The error says:
This app can't run on your PC.
To find a version for your PC, check with software publisher

A few minutes ago, It worked when I tried opening it, but I still received the error message.
How do I fix this ?

A: First, make sure you have installed the 64 bits version of Git for Windows
It should be:
Git-2.32.0.2-64-bit.exe or PortableGit-2.32.0.2-64-bit.7z.exe
If you do, follow "How to Fix "This App Can't Run on your PC" in Windows 10" in order to adjust UAC settings.
But I would suspect a wrong version first.


text:
Q: How do I get a local Maven package to bring in its dependencies? I have written a series of classes that I want to turn into a company library. Managing all it's dependencies was a pain so I made a Maven project for it to be handled automatically.
I have packaged my library project into a .jar and added it to my local Maven repository. I can now list it in my application project's pom.xml, it get's brought in just like any other dependency and works great.
The problem is the dependencies of my library do not get brought in. It seems like this should be straight forward but trying to copy other packages in the Maven repository doesn't work.
Right now my jar consists of two directories:
com\company\package\Main.class

And:
META-INF\maven\com.company\package\pom.xml

Where do I need to put the pom.xml file for Maven to go get my dependency's dependencies? Is there something else in the .jar build that I am missing?

A: The Maven POM file (pom.xml), which describes the project/module, is usually placed in the root directory.
The POM file can then be picked up by your Maven installation, which will automatically configure the project, which means also downloading dependencies from their repositories.
For an example of an artifact deployed to a repository, see
http://central.maven.org/maven2/org/springframework/spring-core/5.1.5.RELEASE/


text:
Q: Ansible: parallel execution of delegate_to loop in one task I use delegate_to with nested loop to distribute files among a group of hosts.
But in some cases there is a performance issue, since the task has to be finished on one host in order to be executed on the next one and so on.
In order to decrease the time needed for a task to be completed,is there a way to execute the delegate_to with loop in parallel?
- name: Create backup
  archive:
    path: xxxxx
    dest: xxxxx
    format: gz
  delegate_to: "{{hosts[ ( ((item[0] -1) + (item[1] | int)) - 1) % (hosts|length|int) ] }}"
  run_once: yes
  with_nested:
    - "{{loop_1}}"
    - "{{loop_2}}"

I have already tried the async module, but i realised that it's not the appropriate one for my use case.

A: I would use add_host task to add your hosts into a in-memory group and create new play inside playbook.
An example:
- hosts: all
  tasks:
    - name: Add hosts to in-memory group
      add_host:
        name: '{{hosts[ ( ((item.0 -1) + (item.1 | int)) - 1) % (hosts|length|int)
          ] }}'
        group: _backup_hosts
      loop: '{{ loop1 | product(loop2) | list }}'
- hosts: _backup_hosts
  tasks:
    - name: Create backup
      archive:
        path: xxxxx
        dest: xxxxx
        format: gz
      run_once: true


text:
Q: Connection error while indexing in Elastic search in aws I want to use elastic search from aws for my usage. Following code works totally fine in my local elastic search but always give error when trying to connect to aws elasticsearch service. I am using python 2.7, django 1.10 and elastic search 5.1.1.
Following is the error

ConnectionError(HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url: //search-test-abc-jlpfzhi64qcrhhqxycov5rzgcq.ap-south-1.es.amazonaws.com/:443/test-index/tweet/1 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f1e2e5e2090>: Failed to establish a new connection: [Errno -2] Name or service not known',))) caused by: ConnectionError(HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url: //search-test-abc-jlpfzhi64qcrhhqxycov5rzgcq.ap-south-1.es.amazonaws.com/:443/test-index/tweet/1 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f1e2e5e2090>: Failed to establish a new connection: [Errno -2] Name or service not known',)))

Also, here is the code that i am using
host = AWS_ELASTIC_SEARCH_URL
awsauth = AWS4Auth(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_ELASTIC_SEARCH_REGION, 'es')

es = Elasticsearch(
    hosts=[{'host': host, 'port': 443}],
    http_auth=awsauth,
    use_ssl=True,
    verify_certs=True,
    connection_class=elasticsearch.RequestsHttpConnection
)

doc = {
'author': 'kimchy',
'text': 'Elasticsearch: cool. bonsai cool.',
'timestamp': datetime.now(),
}
res = es.index(index="test-index", doc_type='tweet', id=1, body=doc)

It is giving error in last line. Also I have made full access to the elastic search url.

A: I finally figured it out. In my case, I was writing host url as "https://example.com/", but it should be given as "example.com" only. Took a lot of while to hit this in my mind. Following is my working code to connect to aws ElasticSearch (5.1) by using python 2.7 and django 1.9.
def bulk_indexing():

     host = 'example.com'  #not https://example.com"
     awsauth = AWS4Auth('access key', 'secret', region, 'es')
     es = Elasticsearch(
         hosts=[{'host': host, 'port': 443}],
         http_auth=awsauth,
         use_ssl=True,
         verify_certs=True,
         connection_class=RequestsHttpConnection
     )
     payload = {'abc' : 'def'}
     es.index('abc-index', 'doc', payload)


text:
Q: Can no longer access WSL2 files from Windows explorer or launch Windows programs from WSL2 I've been running WSL2 on Windows 10 for several months now and just recently lost these abilities. I can still open a WSL2 terminal and interact with my Ubuntu installation there.
Accessing WSL2 files from explorer
I could previously go to \\wsl$\Ubuntu and see all my WSL2 files. I can still see the Ubuntu folder at \\wsl$, but when I try to open it I get a loading bar and nothing happens (even after waiting for a long time):

Also in Powershell:

Opening Windows program from WSL2
Previously I could open Windows programs like explorer and VSCode from a WSL2 terminal with explorer.exe and code respectively. Now when I try this the terminal just hangs and nothing opens.
Note that I can still navigate to /mnt/ and see all my Windows files from the WSL2 terminal.

I'm running Windows 10 Version 1909 (OS Build 18363.1379) and Ubuntu 20.04.1.

A: I'm not sure I have an answer for you, but some general troubleshooting steps to try:

*

*Exit your instances and try a wsl --shutdown.

*If that works, try turning off Windows Fast Startup.  Also avoid hibernation.  These are known to interfere with some WSL network functionality.

*Try adding the following section to your /etc/wsl.conf:
[interop]
enabled = true

This should be the default, but it wouldn't be the first time we've seen WSL not following the defaults for some reason.

*Make sure your Windows temp directory is not compressed

*Make sure your distribution folder under %userprofile%/Local/AppData/Packages is not compressed, especially the LocalState subdirectory where the ext4.vhdx lives.

*If enabled, try turning off Windows Ransomware Protection

A: I had the same issue (although on Windows 11). It was very annoying. I noticed that after a restart it was ok, but after a few minutes and almost always after running VSCode, it was breaking again. Here's what worked for me:

*

*exporting my distro (wsl --export <Distro> <FileName>)

*unregistering it from WSL (wsl --unregister <Distro>)

*uninstalling all WSL-related stuff, like the optional Windows feature, the WSL app from the store (I had them both). I also removed  WSLg but I'm not sure if that was necessary

*restarting

*installing again the app from the store (no need to turn on the optional Windows feature anymore in case you are on build 22000 or higher)

*finally just reimporting the distro (wsl --import <Distro> <InstallLocation> <FileName>)

After going through the above steps the issue was resolved and now my WSL2 works like a charm.


text:
Q: Getting NoSuchElementFound with Scanner I am trying to get a Scanner to read the input of a text file, have that input put into a String, have a StringTokenizer of that String, and then have a String[] with each element of that array being a token of that StringTokenizer. The purpose of this is to get a String[] of the inputted text from the text file such that each element of the array is a word in the text file. However, the code I have so far generates a NoSuchElementFound Exception.
    Scanner f = new Scanner(  "input.txt" ); // Yes, I have the file path here, I changed it though.

    PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt" );
    String temp = "";
    String cString = "";

    while( ( cString = f.nextLine() ) != null ) { // Line where exception occurs

        temp += cString;
    }
    StringTokenizer everythingTokens = new StringTokenizer( temp );
    String[] everything = new String[ everythingTokens.countTokens() ];

    for( int i = 0; i < everything.length; i++ ) {
        everything[ i ] = everythingTokens.nextToken();
    }

    out.println( everything[ 0 ] );

Here is the error message
Exception in thread "main" java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Scanner.java:1585)
at gift1.main(gift1.java:21)
Java Result: 1

The input for this in the text file is
Hey,
How are you?

Why is this happening and how can I fix it?

A: That's not how you use a Scanner. You'd instead do:
while (scanner.hasNextLine()) {
   String line = scanner.nextLine();
   // work with your line here
}

Please have a look at the Scanner API and you'll see that it doesn't return null if it runs out of lines. Instead it throws a .... NoSuchElementException. I think that you're confusing its use with that of a BufferedReader, and they're really two completely distinct species.

A: Change to this --
while( f.hasNextLine() ) {
    cString = f.nextLine();
    temp += cString;
}


text:
Q: Vector, Point, Battleship, 2D I shall program some methods in Java for the game battleship? Not sure how it's called in English.
We shall create the method:
private static Point[] createSchiff(int laenge)

Which creates a ship with the length laenge, a random position on the field and random direction, and returns a reference of the ship.
The ship shall be from the type Point and we shall use the object Vector as a container for all ships we create.
The full programmcode I have so far is:
import java.awt.*;
import java.awt.Point;
import java.lang.*;
import java.util.*;
public class Programm34 {
    public int anzahlschiffe=5;
    public Point[] schiffe = new Point[anzahlschiffe];
    public static void main(String[]args){

        Vector v=new Vector();

        int i=10;
        double random=0;
        System.out.println("Zufallszahlen: ");
        for(i=anzahlschiffe;i>0;i--){
            random=random(0,10);
            System.out.print((int)random+" ");
            System.out.println("");
        } //Test für random Methode!!
        int[][] Spielfeld= new int[10][10];

        init(Spielfeld);
        for(int x=9;x>=0;x--){
            for(int y=9;y>=0;y--){
                System.out.print(Spielfeld[x][y]);
                if(y!=0){
                    System.out.print(" ");
                }
                if(y==0 && x!=0){
                    System.out.print("\n");
                }
            }
        }

    }

    private static long random(int u, int o){
        double random;
        random=Math.random()*(u-o)+o;
        return (int)random;
    }

    private static Point[] createSchiff(int laenge){

        point(1,2);

    }

    private static boolean positionOk(Vector<Point[]> schiffe,Point[] schiff){

    }

    private static boolean grenze(Point[] schiff){

    }

    private static boolean konflikt(Vector<Point[]> schiffe,Point[] schiff){

    }

    private static boolean nachbar(Vector<Point[]> schiffe,Point[] schiff){

    }

    private static boolean increment(Vector<Point[]> schiffe,int laenge){

    }

    private static void init(int[][] spielfeld){
        for(int i=9;i>=0;i--){
            for(int j=9;j>=0;j--){
                spielfeld[i][j]=0;
            }
        }
    }

    private static void add(int[][] spielfeld, Vector<Point[]> schiffe){

    }
}

All those methods and the main shall be programmed, but what matters ist the createschiff ("createship") one.
Can you help me explain the vector? the point? And how the whole stuff works? I sit here now for like 2 hours with no progress... thx alot

A: First a minor (but helpful) thing: You should add generics parameters to the vector. (I doubt that it is necessary to use Vector. A List should be sufficient. But when it is in the assignment, you have to do it...)
Vector<Point[]> v=new Vector<Point[]>();

About the createSchiff method: You' have to create several Point objects. Namely, one for each field that is covered by the ship. This could roughly look like this:
private static Point[] createSchiff(int laenge)
{
    int positionX = ... // Some random position
    int positionY = ... // Some random position

    // Create the array that will contain the fields
    // covered by the ship:
    Point result[] = new Point[laenge];

    // Fill the array
    for (int i=0; i<laenge; i++)
    {
        result[i] = new Point(positionX, positionY);

        // Change the position for the next field,
        // depending on the direction of the ship:
        positionX += ...
        positionY += ...
    }

    return result;
}

Then you can call this method like this:
Point ship[] = createSchiff(3);
v.add(ship);

(I could insert more real code instead of the placeholders ... , but you should try this on your own)


text:
Q: prevent from copying color from cli to txt file im using a tool suite and i would like to copy the results to a text file in a readable format how ever the tool suite uses color and when i copy the results it copys the special character codes as well how do i make it where it does not copy the color as well or when the results of the CLI output is regular text
what im using to copy results to the text file is
$ToolSuite --parameters > results.txt

is there a special format or commands that i can type or enter that would just copy text with no format

A: I use this filter to filter out colors:
... | sed  $'s/\e\\[[^m]*m//g'

and a general escape killer:
... | sed $'s/\e\\[[0-9;:]*[a-zA-Z]//g'


text:
Q: How to make a key from an array of length n I am trying to generate a dictionary in python that will later be converted to a JSON object.
I have a list of elements ['element1','element2',...'elementn'] that I want to use as the key.
With the following list:
list1 = ['thing1','thing2',...'thingn']
list2 = ['element1','element2',...'elementn']

I want to make the following JSON object:
x = {
    'thing1' : {
        'thing2' : {
            ....
                'thingn': {}
        }
    },
    'element1' : {
        'element2' : {
            ....
                'elementn': {}
        }
    }
}

So that I can access x as such:
x['thing1']['thing2]...['thingn']

And add new data like this:
x['thing1']['thing2]['newdata']

Since the final JSON object will be hierarchical and the data will be added later, I wanted to iterate through the list of keys and generate the hierarchy as described above.

A: It use for loop to get element and create dictionary and it use start to get nested dictionary to create next dictinary in next loop.
EDIT: I changed name start to node which better describe what is in this variable. It is used to move deeper in this structure like moving from node to node in tree or graph.
x = {}

list1 = ['thing1','thing2','thingn']
list2 = ['element1','element2','elementn']

node = x  # starting node
for item in list1:
    node[item] = {}    # create new sub-dictionary
    node = node[item]  # move to new sub-dictionary

node = x  # starting node
for item in list2:
    node[item] = {}    # create new sub-dictionary
    node = node[item]  # move to new sub-dictionary

print(x)

print(x['thing1']['thing2']['thingn'])

x['thing1']['thing2']['newdata'] = "Hello World!"
print(x['thing1']['thing2']['newdata'])

EDIT: the same as function
def add(start_node, levels):
    node = start_node      # starting node
    for item in levels:
        node[item] = {}    # create new sub-dictionary
        node = node[item]  # move to new sub-dictionary
    #return node

x = {}

list1 = ['thing1','thing2','thingn']
list2 = ['element1','element2','elementn']

add(x, list1)
add(x, list2)

print(x)
print(x['thing1']['thing2']['thingn'])

x['thing1']['thing2']['newdata'] = "Hello World!"
print(x['thing1']['thing2']['newdata'])

Using .split('.') you can use string 'element1.element2.elementn'
add(x, 'element1.element2.elementn'.split('.'))

EDIT: Similar to get value
def add(node, levels):
    '''node: starting node'''
    for item in levels:
        node[item] = {}    # create new sub-dictionary
        node = node[item]  # move to new sub-dictionary
    #return node

def get(node, levels):
    '''node: starting node'''
    for item in levels:
        node = node[item]  # move to new sub-dictionary
    return node

x = {}

add(x, ['thing1','thing2','thingn'])
add(x, 'element1.element2.elementn'.split('.'))

x['thing1']['thing2']['newdata'] = "Hello World!"
print(x['thing1']['thing2']['newdata'])

print( get(x, ['thing1', 'thing2', 'newdata']) )
print( get(x, 'thing1.thing2.newdata'.split('.') ) )


text:
Q: Link insertion doubles line-breaks Whenever I use the question/answer editor's link button, to insert a link, the link gets inserted correctly, but then each line-break is doubled (which means I now have three line-breaks between paragraphs, and single line breaks get empty lines = paragraph breaks.)
Repeating this doubles the line-breaks again, now I have seven empty lines between paragraphs. As an example, here is a screenshot from the editor of a question on the new crypto StackExchange (still in private beta), after inserting three inline links:

Actually, the same thing occurs after inserting an image (look at the source code of this question to see a single example).
This is happening since a day or two (I'm not quite sure), in Opera 11.50 on Ubuntu 11.04. (It does not happen in Firefox 5.0 on the same system.)

A: This is status-bydesign:
if (uaSniffed.isOpera) {
    chunk.before = chunk.before.replace(/\n/g, "\r\n");
    chunk.selection = chunk.selection.replace(/\n/g, "\r\n");
    chunk.after = chunk.after.replace(/\n/g, "\r\n");
}

– but I'm inclined to question this design :)
There's no explanatory comment around this piece of code (which, except for changed variable names, has always been in the editor JavaScript); I'll assume that this was working around an Opera issue that has since been fixed, and thus this special handling can be dropped now.


text:
Q: .Net Core Cant read connection string from appsettings.json I'm currently creating a Web Api in .net core 2.0 and I simply cant get my connection string to work.
I've put my connectionstring into appsettings.json and load it in startup.cs
Appsettings.json
{
"Logging": {
"IncludeScopes": false,
"Debug": {
  "LogLevel": {
    "Default": "Warning"
  }
},
"Console": {
  "LogLevel": {
    "Default": "Warning"
  }
},
"ConnectionStrings": {
  "DatabaseConnection": "Data Source=VMDEVSLN-EOE\\SQLEXPRESS;Initial Catalog=EmployeeDB;Integrated Security=True"
  }
 }
}

Startup.cs
        public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();
        var connection = Configuration.GetConnectionString("DatabaseConnection");
        services.AddDbContext<DatabaseContext>(options => options.UseSqlServer(connection));
    }

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }

        app.UseMvc();
    }
}

DbContext
public class DatabaseContext : DbContext
{
    public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options)
    {

    }
    public DbSet<CustomerTB> CustomerTB { get; set; }
}

I believe the problem lies somewhere in my appsettings.json but I just cant find it

A: Your ConnectionStrings section is inside the Logging section, I don't know if that's what you meant but anyway you can access the DatabaseConnection like this:
var connection = Configuration["Logging:ConnectionStrings:DatabaseConnection"];

A: In asp.net core 1.x you should read settings through ConfigurationBuilder. In Startup.cs
public Startup(IHostingEnvironment env)
{
    var builder = new ConfigurationBuilder()
        .SetBasePath(env.ContentRootPath)
        .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
        .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
        .AddEnvironmentVariables();
    Configuration = builder.Build();
}

It could be the same approach in asp.net core 2.


text:
Q: How to know and set address serial number/Public_Key/Private_Key in ESP32 there.
I'm still quite confused when I want to develop ESP32.
I'm planning to create a special (.bin) for the Serial Number, Public Key and Private Key.
I've also read the document from ESP32 but I'm still confused about making an address (Serial Number, Public Key and Private Key). Can anyone tell me, how to make an address on ESP32?
Thank you


text:
Q: How to compile maven web project in different version and run in different version I have created a maven web project in eclipse. I want to compile it in jdk 1.6 and have its run time environment as 1.8.I have tomcat as the web container to run the project. For compiling I am aware of the Compliance level option in the project settings. Is it the correct way to go about the compile  time requirement? And what settings do I have to change to make it run on java 1.8?

A: Use the Maven compiler plugin to set the source and runtime version of jdk & jvm respectively.
<build>
 <pluginManagement>
  <plugins>
   <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.7.0</version>
      <configuration>
      <source>1.6</source>
      <target>1.8</target>
      </configuration>
   </plugin>
  <plugins>
<pluginManagement>
<build>


text:
Q: Hodoop + Nutch 1.15 + Solr Cloud 7.3.1 index no result Him I have a Cluster based on Hadoop. I use Nutch 1.15 with success and i crawl some urls.
I have installed Solr 7.3.1 and I like to use the Cloud one, So When i run SOlr with this cmd:
./solr-7.3.1/bin/solr start -c

I have also setup in nutch-site.xml some solr vars:
<property>
   <name>solr.server.type</name>
   <value>cloud</value>
</property>

<property>
   <name>solr.server.url</name>
   <value>http://localhost:8983/solr/nutch_collection/</value>
</property>

<property>
   <name>solr.zookeeper.url</name>
   <value>http://localhost:9983/</value>
</property>

and this for index to solr:
 bash ./run_nutch.sh solrindex -Dsolr.server.url=http://localhost:8983/solr/nutch_collection/ crawl/crawldb -linkdb crawl/segments/*

No errors and job finish, but no documents on my collection...
What i miss?
Thanks

A: solr.server.url is now removed from nutch 1.15 version. You now have to configure a single XML file (conf/index-writers.xml)
The default value setup in index-writers.xml is http://localhost:8983/solr/nutch/. So either you want to change that value in the xml file or create core named nutch instead of nutch_collection and test it out.

https://apache.org/dist/nutch/1.15/CHANGES.txt


text: Q: Is there any way to get solution file if we have source file in vb.net I published vb.net project and decompiled using justdecompile tool(dll file) and received source file is there any way to get solution file from that?


text:
Q: Impresspages ugly hash tag in address bar I wish to know what is the purpose of these ugly has tag at the end of every link in the address bar of a Impresspages 4.x website. How can I remove them from Impresspages front side website...

A: i think you mean slash " / "
this tag was added to improve the speed for running website on apache,
for delete this option you can going to config -> advanced options -> then remove "Add trailing slash at the end of page URL"

A: if you are talking about something like this http://yourwebpage.com/contact/#.VMw7dftwbs0 just look for AddThis or another social plugin and deactivate it in admin->Plugins.
This should remove hashtag from URLs.


text:
Q: Simple PHP Server info request - not working at all Going off of my other question and its pair.
I'm looking to grab the Hostname:Port value as found in the phpinfo() function. I can't seem to find it anywhere and it's not in $_SERVER.

A: You can use the $_SERVER['SERVER_NAME'] for this. You only need to configure the server accordingly that it returns the expected value. You're apparently using newer than Apache HTTPD 1.3.
You need to set UseCanonicalName directive to on in the <VirtualHost> entry in httpd.conf (also check the warning at the bottom of the linked document!).
<VirtualHost *>
    ServerName example.com
    UseCanonicalName on
</VirtualHost>

Also see this answer.

A: Apache 2.0 server with PHP 5.2 $_SERVER['SERVER_PORT'] should give you 80 for http connections.
For the hostname, for me these two work identically:
echo $_SERVER['HTTP_HOST'];
echo $_SERVER['SERVER_NAME'];

...should do the trick.
Read more about the $_SERVER variable here


text:
Q: Searching with pentaho on mysql with string varible I am working with Pentaho. In the transformation, the input is a csv. Working on the flow, I receive a String (str='hello').
I also have an SQL table with two columns (col1 and col2).
I want the value of col1 where col2 is equal to str. Using a Execute SQL script, I have written the following:
SELECT col1 FROM table WHERE col2=str;
It returns always the same error "Unknown column 'str' in 'where clause'".
Is it possible to search in the table with the specific value of str ('hello')?

A: You can use the Table input step.
You calculate the value of str column in your transformation, use the Select values step to just pass that column as entry in the Table Input step (if you have more columns from calculating that one, if not the Select values is not needed), filling up in the Table input step Insert data from step option to specify which step is passing the columns you want to use in the query from table input, and you also check the box to Execute for each row you receive from the previous step. Then you use this query:
SELECT col1 FROM table WHERE col2=?

Here is a screenshot from a example where I pass two columns to my Table input step to use in my query:


text:
Q: convert a date string using PHP I need to convert a date string in a format like bellow using PHP,
2015-07-30T08:05:00.917Z

I try to convert using the bellow code,
echo str_replace('+00:00', '.917Z', gmdate('c', strtotime('2016-04-05 00:00:00')));

This will create  2016-04-05T00:00:00.917Z This is not correct,Is there any function to create date like this format?

A: There are two ways to create date from String.
1. date_create_from_format
   $date=date_create_from_format("DATE_FORMAT",$dateString);

2. $date=new DateTime();
   $date=$date->createFromFormat("DATE_FORMAT", $dateString);

Using following link to get your DATE_FORMAT.
http://php.net/manual/en/function.date.php

A: You can do it as @Alok has mentioned in his answer.
Or similarly using the following code.
$date = DateTime::createFromFormat('U.u', microtime(TRUE));

echo $date->format('Y-m-d\TH:i:s.u\Z');

Note that the microsecond mentioned in your question is of 3 digits. But generally php date formatting outputs microseconds in 6 digits precision.
Like the above code outputs  2016-04-06T09:24:50.830000Z
So I think you have to do some hack there if the digit precision is important.

A: Pass it through the function formatTime. This creates a new DateTime object in PHP called $date that can also easily be manipulated if you need. The examples below formats the date in two different ways, both work.
Procedural Style:
function formatTime($millis) {
        $date = new DateTime($millis);
        return date_format($date, 'l, jS F Y \a\t g:ia');
}

Object Oriented Style:
function formatTime($millis) {
        $date = new DateTime($millis);
        return $date->format('l, jS F Y \a\t g:ia');
}

The format for date can be found at this link:
http://php.net/manual/en/function.date.php
Hope this helps.


text:
Q: javascript function - the correct way to do this Hi all and thanks for looking,
What is the correct way to do this:

with this in the link tags: onClick="flag(scotislands)"; and the image name being scotislands.jpg
Many thanks,
B.

A: In the following line you have your string identifiers mixed up:
document.getElementById("flag").innerHTML="";

It should be:
document.getElementById("flag").innerHTML='';

EDIT
Also, as Joel spotted, onClick="flag(scotislands)"; should be onClick="flag('scotislands')";

A: You need to quote the text in the link tag, otherwise it tries and fails to find a variable with the name scotislands.
 onClick="flag('scotislands');"

then change the assignment of the innerHTML to the following:
 document.getElementById("flag").innerHTML=""

Note the use of single quotes internally to set of the url, but double quotes around each of the inline text bits.
Generally, though, I'd prefer something unobtrusive (no code in markup).  Using a framework, such as jQuery, I'd do something like:
 Scotislands

Then using javascript, I'd add a handler for all such links:
 $(function() {
     $('a.flag-identifier').click( function() {
         var flag = $(this).attr('href').replace('#','');
         $('#flag').html( '' );
         return false;
     });
 });

This would add a click handler that gets the flag name from the href on the anchor, then replaces the named element flag's content with the image constructed by adding the name of the country to the image url.  Note that I omitted the global variable nation, but you could easily set it from within the click handler as well if necessary.

A: The string that you are setting innerHTML to is not quoted properly.  Try this:
document.getElementById("flag").innerHTML="";

Also, your onClick is trying to send an non-existent object called "scotislands".  Try this instead:
onClick="flag('scotislands');"

A: function flag(nation) {
  var myFlag = document.getElementById("flag").getElementsByTagName("img")[0];
  myFlag.src = "images/flags/"+nation+".jpg";
}

A: It depends what you mean by "correct". I suspect from the fact you're using innerHTML that you don't mean "conforming to a recognised standard, such as DOM", but that's what you're getting from me:
function flag(nation) {
    var flagEl = document.getElementById("flag");
    while (flagEl.firstChild) {
        flagEl.removeChild(flagEl.firstChild);
    }
    var img = document.createElement("img");
    img.src = "images/flags/" + nation + ".jpg";
    flagEl.appendChild(img);
}


text:
Q: Adjust label/symbol size in print composer automatically when choosing different scale for atlas I am having trouble with my labels/symbols in the print composer and didn't find a solution here so far.
I have a project with a certain area from which I have to create several layouts in the print composer. Example below.

*

*Map with overview in 1:250

*Map with overview in 1:150 with several map sheets which are 1:50 or 1:20
When I create the map sheets with the atlas function in 1:50 and 1:20 it's necessary to adjust the label and symbol size for the layout in the print composer to get a good symbol/label size.
First image 1:20 and second 1:50

Is it possible to create a label or symbol rule which specifies the exact size of the symbol/label in the print composer when choosing a map sheet with 1:20 and 1:50? At the moment I manually change the size of the symbol/label for the print composer which is annoying.
Summarized:

*

*map sheets created which are in 1:20 and 1:50 and show different things

*the label/symbol size should be changed automatically when choosing 1:20 or 1:50 in the print composer via the atlas

Would this be possible?

A: if your size are set as millimeter they stay the same regardless of the scale.
If you want to have symbol/label that get bigger as you zoom in you should use the "Meters at Scale" or "Map Units" setting.
If you want to have different styling (including symbol/label size) in your overview and general map you could create different layer style and Map Theme and set each kind of map it's own map theme
If you want fine control of symbol/label size depending on map scale you could use the data defined override with an expression like this one :
CASE
    WHEN  @map_scale < 35 THEN 5
    WHEN  @map_scale > 35 THEN 0.5
END


text:
Q: jquery scroll to a px count from top and then set a div to be fixed from the top for the rest of the scroll I am looking to change a div's css when i scroll to a certain point down the page, a certain amount of pixels from the top of the page.
On page load i would have a div positioned statically. Once I started to scroll down the page and i hit a point from the top (say 100px for demo purposes) i want to change that static div to become fixed like 20px from the top. Which would be done via the css() property of jquery. THis would allow it to stay at that fixed 20px all the way down the page.
What jquery property can i use to know when i hit that 100px mark. I want this to also revert once someone gets back to the top so that the div is put back to where it was when the page loaded and not 20px from the top.
Any ideas?

A: You could use the scroll() event to run the code, and the scrollTop() method to see where you are.
Here's a demo: http://jsfiddle.net/EahRx/
(I used the values you provided, so there's a jump. I'm sure it will look better in your actual page.)
var fixed = false;

$(document).scroll(function() {
    if( $(this).scrollTop() >= 100 ) {
        if( !fixed ) {
            fixed = true;
            $('#myDiv').css({position:'fixed',top:20}); // Or set top:20px; in CSS
        }                                           // It won't matter when static
    } else {
        if( fixed ) {
            fixed = false;
            $('#myDiv').css({position:'static'});
        }
    }
});

The fixed variable prevents the .css() code from running more times than it needs to.

A: Try using scrollTop:
$(window).scroll(function(){
    if  ($(window).scrollTop() >= 100){
        //CSS changes go here
    }
});

A: Here's a lovely jQuery plug-in that I found that does the trick nicely and gives you some useful additional features, such as setting the offset and changing the css between "attached" and "detached" mode.
http://code.google.com/p/sticky-panel/

A: I just found this. I think this is really interesting; I liked it.


text:
Q: Fear of asking girl out - is called ...? Fear or phobia of asking girl out, fear of rejection(that she would say no or even worse).
Here, Soceraphobia (fear of her father/brother) is not involved.
Mostly guys are feared by most compelling feelings of asking girl out. Some however have overcame such intimidation. What this fear is called? Is there any word sum it up ?

A: If you want to ask a girl out and have no fear of rejection, you have self-confidence.
If you are scared to ask a girl out, it is probably because you are shy.

A: It is called love-shyness colloquially. The person is called a love-shy.
It can be applied to women also but it is usually associated with men. The term can cover the fear of any romantic interaction with the opposite sex.

*

*love-shy men are unable to get girlfriends/wives either because they don't know how, or they are too affraid.

*it means finding it difficult to be assertive in informal situations involving potential romantic or sexual partners. For example, a heterosexual love-shy male will have trouble initiating conversations with women because of strong feelings of anxiety.
[Urbandictionary]

Note: If you want a phobia word, there is pussyphobia in slang but I don't recommend using it because it is too slangy and has other connotations as well.

Ildan has pussyphobia because he is scared to ask girls out or talk to them. [Urbandictionay]

Although, the term is used in this article about a man who cannot approach a girl without becoming a nerve wreck from nyc.barstoolsports but it is not a serious news site. They got it from a Telegraph article and reworded it.
An extreme case can be gynophobia (or gynephobia):

...is an abnormal fear of women, a type of specific social phobia. In the past, the Latin term horror feminae was used. [Wikipedia]

A: This kind of fear or phobia is also  called:
Dating anxieties:

*

*Dating, by its very nature, is a situation in which two people have not already committed to a permanent relationship. So, for many people, if not most people, dating relationships are experienced as insecure attachments and therefore anxiety producing.

(from psychologytoday.com)
Phobia of dating:

*

*When you feel shaky or phobic about various aspects of dating or rejection by your prospective partner.
  Often many issues related to phobia of dating can be resolved when you simply ask your partner what to do.

(form www.phobia-fear-release.com)

A: If this fear of asking a girl out gives an almost pleasurable sensation of fright:
Why not-

*

*thrill

*tingle


text:
Q: Classification using ANN Hi wlel I am doing a project to recognize a pen using ANN with emgucv C# visual studio 2010. I have a question about ANN. I must train ANN in order to recognize a pen. So I have one neuron in ouput layer for two classification(a pen or not pen) So I train ANN with 1100 image of pens and my question is: Do I need to train ANN with any images that is not a pen for the second class(first class is a pen) or If I show a image that ANN was not trained, ANN will assume that is not a pen?

A: as @Beaker points out, it will assume everything is a pen. However, you can use the level of the output to predict how likely it is to be a pen. But what you really want to do is to train it on pens and non-pens. You may also see better performance with 2 outputs nodes, one for pen and one for not pen. That is typically how people do NN classification, although using a single should work. Be aware that your choice of activation function will guide the range of inputs and outputs between nodes (sigmoid expects 0-1, tanh -1 to 1). Also, the number of levels of the network and the number of neurons in each hidden layer can make a big difference. Make sure you have at least one hidden layer. It is unlikely to do well if you have an input and output layer only.
I would use some online images of random objects to train the negative cases, if you have none. However, as you seem to have a usage of this in mind, giving it images close to the ones it will see when used after training will result in better performance.


text:
Q: s3 amazon Metadata Content-Type         ObjectMetadata metadata = new ObjectMetadata();

        metadata.setContentEncoding("gzip");
        metadata.setContentType("application/x-gzip");
        metadata.addUserMetadata("Expires","3600");
        metadata.addUserMetadata("Cache-Control","public");
        metadata.addUserMetadata("max-age","432000");

i am getting key in s3 as "x-amz-meta-max-age","x-amz-meta-expires". Its adding
"x-amz-" in front please help but setContentEncoding,setContentType is working fine but for rest 3 getting "x-amz-" in front please help

A: You can set:
metadata.setExpirationTime("Thu, 21 Mar 2042 08:16:32 GMT");
metadata.setCacheControl("public");

For more information: http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/model/ObjectMetadata.html


text:
Q: Need to get application name while fetching logcat in Android App I try the below code to read device's Log. Is there any way to identify the application name from the Logs so that I can record application specific Log.
Process process = Runtime.getRuntime().exec("logcat -d *:E");
BufferedReader bufferedReader = new BufferedReader(new
    InputStreamReader(process.getInputStream()));
String line;
while ((line = bufferedReader.readLine()) != null)
{
}

A: logcat will record pid, and pid refers to application name.
You may use ps or other command to get relation between pid and application name.


text:
Q: Database design for efficient retrieval This was one of my interview questions. There is a huge database which is going to hold millions of employee records. I should be able to efficiently query based on any fields like first name, last name, age, location etc and the results should be retrieved quickly. How would you go about  designing the database. I answered based on indexing etc , but the interview was not satisfied. Any suggestions as to how this design is actually done ?

A: I'm not sure about context of the question, but as far as I understand you were asked about data modeling, not about 'pure' optimization of existing database/queries.
I'd go with the following approach. An enterprise can have 'operational database' or OLTP which is optimized for entering new data (minimal set of indexes, highly normalized), and 'decision-support database' (data warehouse, OLAP systems) which has lots of redundancy from normalization perspective, but allows you to search by different criteria very fast. Modeling data warehouse from OLTP system is quite a big topic and requires deep understanding of business needs.
To answer the question about searching through employees I'd propose to build a simple star schema (where each search condition represented by a dimension table). Then appropriate technique like indexing, partitioning, materialized view may be added on top of the model.

A: Those requirements suggest considering a key-value store to me rather than a traditional SQL database.
A key-value store will allow you to do relatively unstructured query (i.e. you don't need to define the schema ahead of time) and is designed for very fast reads.
Examples:

*

*Redis

*Casandra

*Couch

*MongoDB

A: Perhaps the interviewer wanted one key word : normalisation
All the indices in the world aren't going to help an in-normalised database - perhaps the 'employee records' in question contained name, address... on each and every record and the records were projects, vacation days, sick days, etc.
The clue, I believe, is in 'millions of' 'employee' records. Even the biggest government departments don't have 'millions of' employees, so the database isn't normalised.