text:
Q: Encontrar palavra em arquivo txt em python Tenho um programa chamado anagrams.py e a função dele é mostrar as permutações de uma palavra digitada pelo usuário caso a mesma esteja no arquivo words.txt.
Este é o código completo:
""" Anagrams by WhoisBsa """
from itertools import permutations
import sys

def findPermutation(wrd):
    """ Find the permutation of the words """
    parmutationList = permutations(wrd)
    for item in parmutationList:
        print(''.join(item))

def checkWord(wrd, wordLine):
    """ Checks whether the word exists in the file or not """
    while True:
        for i in wordLine.readlines():
            if wrd in i:
                result = True
                break
            else:
                result = False
        if result:
            findPermutation(wrd)
            break
        else:
            print('This word is not available')
            break

def main():
    """ Main function """
    with open('words.txt', 'r') as f:
        word = sys.argv[1].upper()
        checkWord(word, f)
        f.close()

if __name__ == '__main__':
    main()

Esse código roda perfeitamente com uma exceção: na verificação da função checkWord a condição
if wrd in i:

procura qualquer palavra que satisfaça a condição, ou seja, se eu digito a palavra house e rodo o código, a intenção é que o retorno (caso esteja no arquivo) seja todas as permutações da palavra house, entretanto, no arquivo há a palavra blockhouse, e com isso o programa verifica se há house no arquivo e quando ele encontra a palavra blockhouse ele para e faz as permutações da palavra house.
Eu sei que a condição if wrd in i vai validar qualquer palavra que satisfaça a condição. A questão é que se eu uso
if wrd == i:

o programa não funciona, ele vai direto pro else.
Um outro problema é que se eu digitar hou o programa vai encontrar blockhouse e fazer o anagrama da palavra hou sendo que a mesma não existe.
Pensei usar o método regex para válidar isso mas eu não sei como aplicar nesse código.

A: O operador in do Python tem comportamentos diferentes se o segundo operando (o que vem depois do in) for uma str ou bytes, e se for um outro tipo de sequência.
No caso de você fazer a in b e ambos serem strings, se a existir em qualquer posição dentro de b, ele retorna True - mesmo que  "a" tenha mais de um item de comprimento. assim "house" in "housekeeper" é True. Se, no entanto, b for outro tipo de sequência, como uma lista, somente se uma cópia de a estiver na sequência o resultado é True:
"house" in ["housekeeper",] - retorna False: aqui  "housekeeper" é um elemento dentro da lista que está sendo "investigada" pelo in.
Portanto, você resolve seu problema facilmente se, ao invés de fazer as buscas direto dentro do texto lido de cada linha do arquivo, você converter cada linha para uma lista de palavras inteiras antes.
Você não dá exemplo do seu arquivo .txt, mas supondo-se que ele não tenha pontuação além de espaços em branco e quebras de linha, é só trocar a linha
for i in wordLine.readlines():
     if wrd in i:
         ...

Por:
 for line in wordline:

      words = line.strip().split()
      if wrd in words:
          ...

Coementando as mudanças:

*

*eu processo a linha, removendo espaços em branco de newline do final
da linha chamando o .strip(). (Nesse ponto, se houver pontuação, você poderia remove-la, aí sim usando expressões regulares para remover os assentos)

*eu divido a linha em uma lista de palavras onde houver espaços em branco, com o método "split". Uma linha com "housekeeper heart mother" fica ['hosekepper', 'heart', 'mother']
E, sem ser essencial para o problema:

*

*eu removo a chamada ao método readlines: Python não precisa do readlines para iterar as linhas de um arquivo num for - esse método praticamente existe por razões históricas

*Não uso a variável i para a variável do for: i é muito usado na maioria das outras linguagens que não tem um "for each" prático, que percorre a sequência desejada diretamente - nessas linguagens é comum ter uma variável "i" que vai servir de "índice"  e ser descartada logo em seguida. o for de Python já obtemos direto o elemento que interessa (nesse caso, as linhas do arquivo), então é melhor dar um nome que faça sentido pra variável.

Além disso tem outros pontos do seu programa que precisam de atenção: você tem um while True que não é usado pra nada, por exemplo (dentro dele tem um if que tem um break no if e no else) - mas não tem  a ver com a sua pergunta.

A: Uma solução, tal como indicou na sua pergunta, passa pelo uso de expressões regulares. Fica aqui uma exemplo, alterando apenas a sua função checkWord:
def checkWord(wrd, wordLine):
    """ Checks whether the word exists in the file or not """
    for line in wordLine:
        if re.search(r'\b' + re.escape(wrd) + r'\b', line, flags=re.IGNORECASE):
            findPermutation(wrd)
            return

    print('This word is not available')

Apenas quando a palavra exacta for encontrada, e não uma palavra derivada (por por meio do acréscimo de um sufixo ou prefixo), as permutações serão geradas.
Dependendo do tamanho do ficheiro, pode ser mais eficiente ler o seu conteúdo de uma vez e efectuar apenas uma pesquisa.
def checkWord(wrd, wordLine):
    """ Checks whether the word exists in the file or not """
    if re.search(r'\b' + re.escape(wrd) + r'\b', wordLine.read(), flags=re.IGNORECASE):
        findPermutation(wrd)
    else:
        print('This word is not available')

Não se esqueça de importar o módulo re
O \b é uma espécie de âncora. Quando adicionado a um dos lados da regex vai capturar o padrão especificado no início, fim ou a palavra exata. Neste caso, pretendemos a palavra exacta, pelo que adicionamos o \b no início e fim da palavra a pesquisar.
Da wikipédia:

\b    Casa a separação de palavras, o que inclui também o começo (^) e o
  fim ($) da cadeia de caracteres testada. A definição dos caracteres
  que formam palavras varia de acordo com a implementação, mas é seguro
  assumir pelo menos [a-zA-Z0-9_]. Havendo suporte, o atalho \w é uma
  alternativa válida. O Java é uma notável exceção na medida em que
  suporta \b mas não \w. Notar que apesar de parecida com os limites de
  palavras definidos pela POSIX, esta sequência de escape não distingue
  o começo e o final da palavra, somente a separação em si.

A: De acordo com os comentários, o que vc precisa fazer é apenas procurar a palavra digitada no texto e, se existir, criar os anagramas, para isso criei um exemplo simulando a leitura de um texto em um arquivo:
import io
from itertools import permutations

txt = '''
Este texto contem house e uma anagrama esouh também casa menino
boy asac boi e mala mas pode-se ver sam e homeoffice assim como
boi e mala etc.
'''

text = io.StringIO(txt).read().split()

palavra = input ('digite a palavra:')

permutacoes = None
if palavra in text:
    permutacoes = permutations(palavra)

if permutacoes is not None:
    anagramas = []
    for item in permutacoes:
      anagramas.append(''.join(item))
    print(anagramas)
else:
    print('Não encontrado')

Saida (considerando q o usuario tenha digitado 'house'):
['house', 'houes', 'hosue', 'hoseu', 'hoeus', 'hoesu', 'huose', 'huoes',
'husoe', 'huseo', 'hueos', 'hueso', 'hsoue', 'hsoeu', 'hsuoe', 'hsueo', 'hseou',
 'hseuo', 'heous', 'heosu', 'heuos', 'heuso', 'hesou', 'hesuo', 'ohuse', 'ohues',
'ohsue', 'ohseu', 'oheus', 'ohesu', 'ouhse', 'ouhes', 'oushe', 'ouseh', 'ouehs',
 'ouesh', 'oshue', 'osheu', 'osuhe', 'osueh', 'osehu', 'oseuh', 'oehus', 'oehsu',
 'oeuhs', 'oeush', 'oeshu', 'oesuh', 'uhose', 'uhoes', 'uhsoe', 'uhseo', 'uheos',
 'uheso', 'uohse', 'uohes', 'uoshe', 'uoseh', 'uoehs', 'uoesh', 'ushoe', 'usheo',
 'usohe', 'usoeh', 'useho', 'useoh', 'uehos', 'uehso', 'ueohs', 'ueosh', 'uesho',
 'uesoh', 'shoue', 'shoeu', 'shuoe', 'shueo', 'sheou', 'sheuo', 'sohue', 'soheu',
 'souhe', 'soueh', 'soehu', 'soeuh', 'suhoe', 'suheo', 'suohe', 'suoeh', 'sueho',
 'sueoh', 'sehou', 'sehuo', 'seohu', 'seouh', 'seuho', 'seuoh', 'ehous', 'ehosu',
 'ehuos', 'ehuso', 'ehsou', 'ehsuo', 'eohus', 'eohsu', 'eouhs', 'eoush', 'eoshu',
 'eosuh', 'euhos', 'euhso', 'euohs', 'euosh', 'eusho', 'eusoh', 'eshou', 'eshuo',
 'esohu', 'esouh', 'esuho', 'esuoh']

Obs.:
Claro que dependendo do conteudo do seu arquivo vc precisa fazer um trabalho de "sanitização" pontuação tb tera que ser sanitizada.
Veja funcionando no repl.it


text:
Q: Display line number in addition to characters in emacs ocaml error message Right now I'm in Emacs tuareg mode and I'm getting this error message
             * * *             * * * * * *       * *           Characters 2686-2820:

But it's impossible to find where that's happening.
Here is my .emacs file-
(add-to-list 'load-path "~/tuareg-caml-mode")
(add-to-list 'load-path "~/tuareg-2.0.4")
(setq auto-mode-alist (cons '("\\.ml\\w?" . tuareg-mode) auto-mode-alist))
(autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code" t)
(autoload 'camldebug "camldebug" "Run the Caml debugger" t)
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
(require 'linum)
(global-linum-mode 1)

A: I was wondering about the same thing and suspected there must be some sort of convenient solution for us out there already. First, I found this:
http://www.ocamlpro.com/files/tuareg-mode.pdf
which contains all the relevant short-cuts for Tuareg mode. Second, from that cheat-sheet, "ctrl-c `" (control-c apostrophe) in the top-level takes you straight to the error at hand. (For me this seems to work better when I've entered a function into the toplevel instead of a full buffer).

redpajama_set_name: RedPajamaStackExchange


text:
Q: Function Composition VS Function Application
*

*Do anyone can give example of function composition?

*This is the definition of function composition operator?
(.) :: (b -> c) -> (a -> b) -> a -> c
f . g = \x -> f (g x)

This shows that it takes two functions and return a function but i remember someone has expressed the logic in english like
boy is human -> ali is boy -> ali is human

*

*What this logic related to function composition?

*What is the meaning of strong binding of function application and composition and which one is more strong binding than the other?

Please help.
Thanks.

A: (Edit 1: I missed a couple components of your question the first time around; see the bottom of my answer.)
The way to think about this sort of statement is to look at the types.  The form of argument that you have is called a syllogism; however, I think you are mis-remembering something.  There are many different kinds of syllogisms, and yours, as far as I can tell, does not correspond to function composition.  Let's consider a kind of syllogism that does:

*

*If it is sunny out, I will get hot.

*If I get hot, I will go swimming.

*Therefore, if it is sunny about, I will go swimming.

This is called a hypothetical syllogism.  In logic terms, we would write it as follows: let S stand for the proposition "it is sunny out", let H stand for the proposition "I will get hot", and let W stand for the proposition "I will go swimming".  Writing α → β for "α implies β", and writing ∴ for "therefore", we can translate the above to:

*

*S → H

*H → W

*∴ S → W
Of course, this works if we replace S, H, and W with any arbitrary α, β, and γ.  Now, this should look familiar.  If we change the implication arrow → to the function arrow ->, this becomes

*

*a -> b

*b -> c

*∴ a -> c
And lo and behold, we have the three components of the type of the composition operator!  To think about this as a logical syllogism, you might consider the following:

*

*If I have a value of type a, I can produce a value of type b.

*If I have a value of type b, I can produce a value of type c.

*Therefore, if I have a value of type a, I can produce a value of type c.

This should make sense: in f . g, the existence of a function g :: a -> b tells you that premise 1 is true, and f :: b -> c tells you that premise 2 is true.  Thus, you can conclude the final statement, for which the function f . g :: a -> c is a witness.
I'm not entirely sure what your syllogism translates to.  It's almost an instance of modus ponens, but not quite.  Modus ponens arguments take the following form:

*

*If it is raining, then I will get wet.

*It is raining.

*Therefore, I will get wet.

Writing R for "it is raining", and W for "I will get wet", this gives us the logical form

*

*R → W

*R

*∴ W
Replacing the implication arrow with the function arrow gives us the following:

*

*a -> b

*a

*∴ b
And this is simply function application, as we can see from the type of ($) :: (a -> b) -> a -> b.  If you want to think of this as a logical argument, it might be of the form

*

*If I have a value of type a, I can produce a value of type b.

*I have a value of type a.

*Therefore, I can produce a value of type b.

Here, consider the expression f x.  The function f :: a -> b is a witness of the truth of proposition 1; the value x :: a is a witness of the truth of proposition 2; and therefore the result can be of type b, proving the conclusion.  It's exactly what we found from the proof.
Now, your original syllogism takes the following form:

*

*All boys are human.

*Ali is a boy.

*Therefore, Ali is human.

Let's translate this to symbols.  Bx will denote that x is a boy; Hx will denote that x is human; a will denote Ali; and ∀x. φ says that φ is true for all values of x.  Then we have

*

*∀x. Bx → Hx

*Ba

*∴ Ha
This is almost modus ponens, but it requires instantiating the forall.  While logically valid, I'm not sure how to interpret it at the type-system level; if anybody wants to help out, I'm all ears.  One guess would be a rank-2 type like (forall x. B x -> H x) -> B a -> H a, but I'm almost sure that that's wrong.  Another guess would be a simpler type like (B x -> H x) -> B Int -> H Int, where Int stands for Ali, but again, I'm almost sure it's wrong.  Again: if you know, please let me know too!
And one last note.  Looking at things this way—following the connection between proofs and programs—eventually leads to the deep magic of the Curry-Howard isomorphism, but that's a more advanced topic.  (It's really cool, though!)

Edit 1: You also asked for an example of function composition.  Here's one example.  Suppose I have a list of people's middle names.  I need to construct a list of all the middle initials, but to do that, I first have to exclude every non-existent middle name.  It is easy to exclude everyone whose middle name is null; we just include everyone whose middle name is not null with filter (\mn -> not $ null mn) middleNames.  Similarly, we can easily get at someone's middle initial with head, and so we simply need map head filteredMiddleNames in order to get the list.  In other words, we have the following code:
allMiddleInitials :: [Char]
allMiddleInitials = map head $ filter (\mn -> not $ null mn) middleNames

But this is irritatingly specific; we really want a middle-initial–generating function.  So let's change this into one:
getMiddleInitials :: [String] -> [Char]
getMiddleInitials middleNames = map head $ filter (\mn -> not $ null mn) middleNames

Now, let's look at something interesting.  The function map has type (a -> b) -> [a] -> [b], and since head has type [a] -> a, map head has type [[a]] -> [a].  Similarly, filter has type (a -> Bool) -> [a] -> [a], and so filter (\mn -> not $ null mn) has type [a] -> [a].  Thus, we can get rid of the parameter, and instead write
-- The type is also more general
getFirstElements :: [[a]] -> [a]
getFirstElements = map head . filter (not . null)

And you see that we have a bonus instance of composition: not has type Bool -> Bool, and null has type [a] -> Bool, so not . null has type [a] -> Bool: it first checks if the given list is empty, and then returns whether it isn't.  This transformation, by the way, changed the function into point-free style; that is, the resulting function has no explicit variables.
You also asked about "strong binding".  What I think you're referring to is the precedence of the . and $ operators (and possibly function application as well).  In Haskell, just as in arithmetic, certain operators have higher precedence than others, and thus bind more tightly.  For instance, in the expression 1 + 2 * 3, this is parsed as 1 + (2 * 3).  This is because in Haskell, the following declarations are in force:
infixl 6 +
infixl 7 *

The higher the number (the precedence level), the sooner that that operator is called, and thus the more tightly the operator binds.  Function application effectively has infinite precedence, so it binds the most tightly: the expression f x % g y will parse as (f x) % (g y) for any operator %.  The . (composition) and $ (application) operators have the following fixity declarations:
infixr 9 .
infixr 0 $

Precedence levels range from zero to nine, so what this says is that the . operator binds more tightly than any other (except function application), and the $ binds less tightly.  Thus, the expression f . g $ h will parse as (f . g) $ h; and in fact, for most operators, f . g % h will be (f . g) % h and f % g $ h will be f % (g $ h).  (The only exceptions are the rare few other zero or nine precedence operators.)


text:
Q: Lattice automorphisms of finite order Are there any known examples of lattice automorphisms of finite order in indefinite lattices being classified up to conjugacy?

A: Yes, there are such examples. You can refer to this question on MO where the automorphism goup of an indefinite lattice is described. In this example, torsion elements are of order 2, and an element in each conjugacy class is given. Another simple example is the case of the form $H\perp<2>$ ($H$ is the hyperbolic plane) whose orthogonal group is isomorphic to $\mathbf Z/2 \times \Gamma$, where $\Gamma$ is isomorphic to $\mathbf Z/4\star_{\mathbf Z/2}\mathbf Z/6$.
The very well known torsion elements are the reflections, whose conjugacy classes are known in small dimensions thanks to the work of Vinberg (and some other great mathematicians).  When the group is generated by reflections (as in the case of $H\perp<2>$, you obtain by Vinberg algorithm a fundamental domain, and you just have to compute the stabilizers of the bounding elements (which are intersections of the hyperplanes relative to which the reflections act) to obtain a finite set of representants of all conjugacy classes of torsion elements. Then a little more work identify representants in the same class. This should work with the group $\mathrm{O}_{1,n}(\mathbf Z)$ for $n\leq 13$, for example (see Vinberg : on groups of unit elements of certain quadratic forms).


text:
Q: javascript parameters cut down in IE Hello I have passed value of div lang attribute in my jquery function.this is working perfect in all browse except IE.
 While inspects in FIREFOX div look like below code.

<input type="checkbox" class="outtaHere" value="2" id="check2" name="f[]">

While inspects in IE div look like below code.

<input id="check2" class="outtaHere" name="f[]" value="2" type="checkbox">

You can see the difference of div lang attributes value. In firefox it takes all value of lang but in IE the last 3 value is not displayed as well fourth value from last is cut down so i have get this values undefined in IE.
Please suggest me how can i resolve this?

A: Use data instead of the lang attribute....

<input type="checkbox" class="outtaHere" value="2" id="check2" name="f[]">

You can then access it in javascript (using jQuery) like this...
$("#myCheckbox2").data("lang");

A: Please Upload following js file for solving ie problem


text:
Q: Angular/Phonegap App: Cannot Display Image Using File URI I'm using Phonegap's getPicture() method to save the File URI to an image, which I then try to display in an img element, but can't. Here's more detail.

*

*I have a view with the following image element: <img id='myImage' ng-src="{{imageSrc}}" style='width:320px;display:block'/>

*When I push a button in the view it calls the getPhoto() method in the view's controllers. Here's the code for the controller:
.controller('captureController',function($scope,$rootScope,$state,$document){

$scope.getPhoto = function() {
navigator.camera.getPicture(
    captureSuccess,
    captureError,
    {
     quality:5,
     destinationType: Camera.DestinationType.FILE_URI,
     sourceType: Camera.PictureSourceType.CAMERA,
     encodingType: Camera.EncodingType.PNG
    }
);
}

function captureSuccess(imageURI) {
    var image = document.getElementById('myImage');

    $rootScope.imageSrc=imageURI
    $rootScope.$apply()
    alert($rootScope.imageSrc)

}

function captureError(error) {
var msg = 'An error occurred during capture: ' + error.code;
alert('there was an error')
}

})

*When I take a picture, the resulting alert returns the path to the photo (file:///var/mobile/Applications//tmp/cdv_photo_069.png), but the photo doesn't appear in the image element.

I've verified that photos are in the phone's tmp directory,and I've also tried replacing the image element's ng-src attribute with src="file:///....cdv_photo.png". The image element is still not rendering the picture.
Any advice would be greatly appreciated.


text:
Q: Scala - make method from List Companion Object I see that that List.make is getting called here
http://aperiodic.net/phil/scala/s-99/p12.scala
But I have solved the problem using padTo because make doesn't exist anymore
  def decode[A](listOfTuples: List[(Int, A)]): List[Any] = {
    listOfTuples flatMap {
      x => Nil.padTo(x._1,x._2)
    }
  }

So, have I got this wrong?

A: List.make was deprecated since Scala 2.8.0 in favor of List.fill. Your approach using padTo is correct, it just isn't as intuitive.
def decode[A](listOfTuples: List[(Int, A)]): List[A] = {
  listOfTuples flatMap {
    x => List.fill(x._1)(x._2)
  }
}

Note that I replaced Any with the type parameter A.

A: The solution could be to use fill method from list. The solution is shown below:
scala> val l1 = List((4, 'a'), (1, 'b'), (2,'c'))
l1: List[(Int, Char)] = List((4,a), (1,b), (2,c))

scala> def decode[A](l: List[(Int, A)]): List[A] = {
     | l flatMap { e => List.fill(e._1)(e._2)}
     | }
decode: [A](l: List[(Int, A)])List[A]

scala> decode[Char](l1)
res60: List[Char] = List(a, a, a, a, b, c, c)

Hope it helps!!

A: Is this ok?
def decode[A](listOfTuples: List[(Int, A)]): List[A] = {
  listOfTuples flatMap { case (n, e) =>
    List.fill(n)(e)
  }
}


text:
Q: How to bypass a login form with PHP and curl? We want to have a unique login form for different Softwares. We wrote a login form to get the username and password and send them to a ASP.Net software using curl and PHP like this:
define("COOKIE_FILE", "cookie.txt");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://192.168.100.1/webrest/default.aspx");
curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: 192.168.100.1'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,
            array(
                'txtUserName' => 'user',
                'txtPassword' => 'pass',
                '__VIEWSTATE' => '/wEPDwUKLTg1ODEyNzU0Mg9kFgICAw9kFgQCDw8PFgIeBFRleHQFMdmH2YTYr9uM2YbaryDYsdi02K8g2b7Yp9uM2K/Yp9ixINin24zYsdin2YbbjNin2YZkZAIRDw8WAh8ABZQB2KrZ',
                '__VIEWSTATEGENERATOR' => '',
                '__EVENTVALIDATION' => '',

            )
);

$server_output = curl_exec ($ch);

echo $server_output;
curl_close ($ch);

But we can't login and get the source of login form again as output without any error!
Can we get login and then send user to the target page like "http://192.168.100.1/webrest/reserve.aspx"?


text:
Q: How to run Angular 2 client app and Node server app on the same host I have built an app in Angular 2 to fetch data from a DB, and used node/express to fetch data from the server and serve it to the Angular client. Currently both of them are running in different local hosts. How do I combine them into a single project and run it on the same host?

A: Suppose your express site is running on localhost:3500 and all api call begins with /api
create proxy.conf.json with the content
{
  "/api": {
    "target": "http://localhost:3500",
    "secure": false
  }
}

then edit package.json and change "start": "ng serve", to "start": "ng serve --proxy-config proxy.conf.json"
now run the project using command npm start.Note:- ng serve will not work
For more information find documatation here


text:
Q: How is it possible that references are not in the correct order if I put them in a figure caption in LyX? I'm using LyX and I added a reference to a figure caption. Now this reference is the number [1] in the reference list even if it appears later than many others. It looks like the float captions have a higher priority in counting references' appearance.
I added many things to my preamble but even if I delete those lines in the preamble the problem stays.
I'm using a customized bibtex style, but in a brand new article it works in the proper way.
Where could the problem stay?

A: A fancy way for avoiding this problem is to add a short title to the figure (without the citation). This is possible in LyX without adding any additional package to the preamble.


text:
Q: Android App Crashing. Async likely the cause So I am making an Android app. Essentially what it does, is it fetches the user's longitude and latitude vid the network provider. It then passes that to a method which uses a geocoder to get back the zip code. Once I have the zip code, I make a request to WunderGround and get back the forecast a JSON. I then use GSON to parse it up, and get each Day's Date, Temp(F) and Conditions.
HOWEVER, my app keeps crashing, and I have no idea why. LogCat only tells me that it is in 'FutureTask'. I Googled that and it has something to do with threads, so I am assuming something in my Async is off.
If anyone can take a look at my code and give me some advice on how to fix this I would appreciate it.
CODE OMITTED (NO LONGER NECESSARY)
LOGCAT:
02-20 22:53:38.632: I/Adreno-EGL(31953): <qeglDrvAPI_eglInitialize:316>: EGL 1.4 QUALCOMM build:  (CL4169980)
02-20 22:53:38.632: I/Adreno-EGL(31953): OpenGL ES Shader Compiler Version: 17.01.10.SPL
02-20 22:53:38.632: I/Adreno-EGL(31953): Build Date: 09/26/13 Thu
02-20 22:53:38.632: I/Adreno-EGL(31953): Local Branch:
02-20 22:53:38.632: I/Adreno-EGL(31953): Remote Branch:
02-20 22:53:38.632: I/Adreno-EGL(31953): Local Patches:
02-20 22:53:38.632: I/Adreno-EGL(31953): Reconstruct Branch:
02-20 22:53:42.846: E/dalvikvm(31953): Could not find class 'com.google.gson.JsonParser', referenced from method com.example.midterm2.MainActivity$parseJSON.doInBackground
02-20 22:53:42.846: W/dalvikvm(31953): VFY: unable to resolve new-instance 738 (Lcom/google/gson/JsonParser;) in Lcom/example/midterm2/MainActivity$parseJSON;
02-20 22:53:42.886: W/dalvikvm(31953): threadid=12: thread exiting with uncaught exception (group=0x417a0898)
02-20 22:53:42.936: E/AndroidRuntime(31953): FATAL EXCEPTION: AsyncTask #1
02-20 22:53:42.936: E/AndroidRuntime(31953): java.lang.RuntimeException: An error occured while executing doInBackground()
02-20 22:53:42.936: E/AndroidRuntime(31953):    at android.os.AsyncTask$3.done(AsyncTask.java:299)
02-20 22:53:42.936: E/AndroidRuntime(31953):    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
02-20 22:53:42.936: E/AndroidRuntime(31953):    at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
02-20 22:53:42.936: E/AndroidRuntime(31953):    at java.util.concurrent.FutureTask.run(FutureTask.java:239)
02-20 22:53:42.936: E/AndroidRuntime(31953):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
02-20 22:53:42.936: E/AndroidRuntime(31953):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
02-20 22:53:42.936: E/AndroidRuntime(31953):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
02-20 22:53:42.936: E/AndroidRuntime(31953):    at java.lang.Thread.run(Thread.java:841)
02-20 22:53:42.936: E/AndroidRuntime(31953): Caused by: java.lang.NoClassDefFoundError: com.google.gson.JsonParser
02-20 22:53:42.936: E/AndroidRuntime(31953):    at com.example.midterm2.MainActivity$parseJSON.doInBackground(MainActivity.java:197)
02-20 22:53:42.936: E/AndroidRuntime(31953):    at com.example.midterm2.MainActivity$parseJSON.doInBackground(MainActivity.java:1)
02-20 22:53:42.936: E/AndroidRuntime(31953):    at android.os.AsyncTask$2.call(AsyncTask.java:287)
02-20 22:53:42.936: E/AndroidRuntime(31953):    at java.util.concurrent.FutureTask.run(FutureTask.java:234)
02-20 22:53:42.936: E/AndroidRuntime(31953):    ... 4 more

A: According to the line that reads as
Caused by: java.lang.NoClassDefFoundError: com.google.gson.JsonParser
02-20 22:53:42.936: E/AndroidRuntime(31953):    at com.example.midterm2.MainActivity$parseJSON.doInBackground(MainActivity.java:197)

your GSON parser library isn't being packaged up in your APK properly.  You should probably double check your dependency configuration.
I'm not sure how you have your project set up, but question: Libraries do not get added to APK anymore after upgrade to ADT 22 would probably be helpful.


text:
Q: Exactly where to fetch data inside a sevice (ngOnInit or inside constructor)? On logOut from my ionic angular app I am using auth.signOut() metohd. But when I register with new email, in home component it is fetching data from previously signedOut user. It looks like constructor of service is not getting called. When I reload, it works fine.
constructor(
private authService: AuthService,
private db: AngularFireDatabase,
) {
this.getUserId();
this.patientsRef = db.list(`/${this.loggedUserId}/patients`);
this.afPatients = this.patientsRef.snapshotChanges()
    .pipe(
      map(changes =>
        changes.map(c => ({ id: c.payload.key, ...c.payload.val()}))
        )
    );
}

getUserId() {
this.authSub = this.authService.userId
.pipe(
  take(1)
).subscribe(userId => {
  if (!userId) {
    return;
  } else {
    this.loggedUserId = userId.toString();
  }
});
}

A: You can call unsubscribe inside the auth.signOut(). Also it would be better if you provided sample code.


text:
Q: ssh other macbook and `security find-identity -p codesigning -v` no permissions When I ssh macbook as root user and run
security find-identity -p codesigning -v`

I get

0 valid identities found

But when I run the following directly on the macbook
security find-identity -p codesigning -v

It shows all identities.
I read this SO question but still can't solve it.
how can I show all identities with ssh on macbook.

A: I find that you should login to the remote machine with a ssh private key, just like ssh -i /path/to/your/id_rsa root@remote.com. Then you can have permission to access all security data.


text:
Q: style.fontWeight not working I'm trying to to offer the user some control over the text display. I use document.getElementsByClassName to target all the selector inside a parent selector (has the class basic-text-frame). every thing run smoothly except myfunction8 (which control fontWeight)
and when delete the css it works
any ideas?

function myFunction3() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "x-large";

  }
}

function myFunction4() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "large";

  }
}

function myFunction5() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "16px";

  }
}

function myFunction6() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "small";

  }
}

function myFunction7() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "x-small";
  }
}

function myFunction8() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontWeight = "900";
  }
}
.Basic-Text-Frame {
  margin: 10px;
}

p.SubEnglish {
  -epub-ruby-position: over;
  color: #231f20;
  direction: rtl;
  font-family: "WinSoft Pro", sans-serif;
  font-size: 1.3em;
  font-style: normal;
  font-variant: normal;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 0px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: justify;
  text-decoration: none;
  text-indent: 0px;
}

h4.SmallEnglish {
  -epub-ruby-position: over;
  color: #231f20;
  direction: rtl;
  font-family: "WinSoft Pro", sans-serif;
  font-size: 1.3em;
  font-style: normal;
  font-variant: normal;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0px;
  margin-left: 0px;
  margin-right: 30px;
  text-align: justify;
  text-decoration: none;
  text-indent: -16px;
}

h1.Latin {
  -epub-ruby-position: over;
  color: #166827;
  direction: rtl;
  font-family: "WinSoft Pro", serif;
  font-size: 2em;
  font-style: normal;
  font-variant: normal;
  font-weight: bold;
  line-height: 1.3;
  margin-bottom: 10px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: center;
  text-decoration: none;
  text-indent: 0px;
}

h2.English {
  -epub-ruby-position: over;
  color: #25408f;
  direction: rtl;
  font-family: "WinSoft Pro", serif;
  font-size: 1.5em;
  font-style: normal;
  font-variant: normal;
  font-weight: bold;
  line-height: 1.2;
  margin-top: 30px;
  margin-bottom: 10px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: justify;
  text-decoration: none;
  text-indent: 0px;
}

h3.Num {
  -epub-ruby-position: over;
  color: #231f20;
  direction: rtl;
  font-family: "WinSoft Pro", sans-serif;
  font-size: 1.3em;
  font-style: normal;
  font-variant: normal;
  font-weight: 500;
  line-height: 1.3;
  margin-top: 10px;
  margin-bottom: 0px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: justify;
  text-decoration: none;
  text-indent: 0px;
}
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html" ; charset="UTF-8">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

  <title>1-1</title>
  <link href="../../css/Book.css" rel="stylesheet" type="text/css" />

 <button class="button" onclick="myFunction3()">bigger</button> <button class="button" onclick="myFunction4()">big</button> <button class="button" onclick="myFunction5()">normal</button> <button class="button" onclick="myFunction6()">small</button>
    <button
      class="button" onclick="myFunction7()">smaller</button> <button class="button" onclick="myFunction8()">fontWieght</button>

lorem this is bold ipsum lorem ipsum  this is also bold ipsum lorem ipsumlorem ipsum lorem ipsum lorem ipsum lorem ipsum.

d. lorem ipsum lorem ipsum lorem ipsum lorem ipsm lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum.

lorem ipsum lorem ipsum lorem ipsum lorem im lorem psum lorem ipsum lorem ipsum lorem ipsum.

I. lorem ipsum

A. lorem ipsum lorem ipsum lorem ipsum (active pharmaceutical ingredient (API))

1. lorem ipsum This is bold lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsumlorem ipsum lorem ipsumlorem ipsum.

C. lorem ipsum lorem ipsum lorem ipsumlorem ipsum lorem ipsum

A: If you don't want to change your CSS structure:
function goDeep(element, cssObj){
  var e = element.getElementsByTagName('*');
  for(var i=0,l=e.length; i<l; i++){
    for(var p in cssObj){
      e[i].style[p] = cssObj[p];
    }
  }
}
function myFunction8() {
  var cols = document.getElementsByClassName('Basic-Text-Frame'), css = {fontWeight:'900'};
  for(var i=0,l=cols.length; i<l; i++){
    goDeep(cols[i], css);
  }
}

A: remove the font-weight: 500 from the parents' classes

function myFunction3() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "x-large";

  }
}

function myFunction4() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "large";
    cols[i].style.fontWeight = "";
  }
}

function myFunction5() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "16px";
    cols[i].style.fontWeight = "";
  }
}

function myFunction6() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "small";
    cols[i].style.fontWeight = "";

  }
}

function myFunction7() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "x-small";
    cols[i].style.fontWeight = "";
  }
}

function myFunction8() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontWeight = "900";
  }
}
.Basic-Text-Frame {
  margin: 10px;
}

p.SubEnglish {
  -epub-ruby-position: over;
  color: #231f20;
  direction: rtl;
  font-family: "WinSoft Pro", sans-serif;
  font-size: 1.3em;
  font-style: normal;
  font-variant: normal;
  /* font-weight: 500; */
  line-height: 1.4;
  margin-bottom: 0px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: justify;
  text-decoration: none;
  text-indent: 0px;
}

h4.SmallEnglish {
  -epub-ruby-position: over;
  color: #231f20;
  direction: rtl;
  font-family: "WinSoft Pro", sans-serif;
  font-size: 1.3em;
  font-style: normal;
  font-variant: normal;
  /* font-weight: 500; */
  line-height: 1.3;
  margin-bottom: 0px;
  margin-left: 0px;
  margin-right: 30px;
  text-align: justify;
  text-decoration: none;
  text-indent: -16px;
}

h1.Latin {
  -epub-ruby-position: over;
  color: #166827;
  direction: rtl;
  font-family: "WinSoft Pro", serif;
  font-size: 2em;
  font-style: normal;
  font-variant: normal;
  /* font-weight: bold; /*
  line-height: 1.3;
  margin-bottom: 10px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: center;
  text-decoration: none;
  text-indent: 0px;
}

h2.English {
  -epub-ruby-position: over;
  color: #25408f;
  direction: rtl;
  font-family: "WinSoft Pro", serif;
  font-size: 1.5em;
  font-style: normal;
  font-variant: normal;
  font-weight: bold;
  line-height: 1.2;
  margin-top: 30px;
  margin-bottom: 10px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: justify;
  text-decoration: none;
  text-indent: 0px;
}

h3.Num {
  -epub-ruby-position: over;
  color: #231f20;
  direction: rtl;
  font-family: "WinSoft Pro", sans-serif;
  font-size: 1.3em;
  font-style: normal;
  font-variant: normal;
  font-weight: 500;
  line-height: 1.3;
  margin-top: 10px;
  margin-bottom: 0px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: justify;
  text-decoration: none;
  text-indent: 0px;
}
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html" ; charset="UTF-8">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

  <title>1-1</title>
  <link href="../../css/Book.css" rel="stylesheet" type="text/css" />

 <button class="button" onclick="myFunction3()">bigger</button> <button class="button" onclick="myFunction4()">big</button> <button class="button" onclick="myFunction5()">normal</button> <button class="button" onclick="myFunction6()">small</button>
    <button
      class="button" onclick="myFunction7()">smaller</button> <button class="button" onclick="myFunction8()">fontWieght</button>

lorem this is bold ipsum lorem ipsum  this is also bold ipsum lorem ipsumlorem ipsum lorem ipsum lorem ipsum lorem ipsum.

d. lorem ipsum lorem ipsum lorem ipsum lorem ipsm lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum.

lorem ipsum lorem ipsum lorem ipsum lorem im lorem psum lorem ipsum lorem ipsum lorem ipsum.

I. lorem ipsum

A. lorem ipsum lorem ipsum lorem ipsum (active pharmaceutical ingredient (API))

1. lorem ipsum This is bold lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsumlorem ipsum lorem ipsumlorem ipsum.

C. lorem ipsum lorem ipsum lorem ipsumlorem ipsum lorem ipsum

A: You should either remove the font-weight from p.SubEnglish, or change the font for the paragraph(p) elements with the JS code.
Your current JS changes the fontWeight only for the containing div, but the font-weight which has been set by your CSS for the p.SubEnglish is still "active", because the inner element's css rule is "stronger" than the outer container's rule. For example, if you have:

123456

The text color will always be black, even if you change the div's style (unless you use !important which is not recommended)
I fix it for the paragraphs in your snippet, but same goes for other inner elements(header elements
), so try to work on it.

function myFunction3() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "x-large";

  }
}

function myFunction4() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "large";

  }
}

function myFunction5() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "16px";

  }
}

function myFunction6() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "small";

  }
}

function myFunction7() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "x-small";
  }
}

function myFunction8() {

    var paragraphs = document.getElementsByClassName("SubEnglish");

  for (i = 0; i < paragraphs.length; i++) {

    paragraphs[i].style.fontWeight = "900";
  }

  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontWeight = "900";
  }
}
.Basic-Text-Frame {
  margin: 10px;
}

p.SubEnglish {
  -epub-ruby-position: over;
  color: #231f20;
  direction: rtl;
  font-family: "WinSoft Pro", sans-serif;
  font-size: 1.3em;
  font-style: normal;
  font-variant: normal;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 0px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: justify;
  text-decoration: none;
  text-indent: 0px;
}

h4.SmallEnglish {
  -epub-ruby-position: over;
  color: #231f20;
  direction: rtl;
  font-family: "WinSoft Pro", sans-serif;
  font-size: 1.3em;
  font-style: normal;
  font-variant: normal;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0px;
  margin-left: 0px;
  margin-right: 30px;
  text-align: justify;
  text-decoration: none;
  text-indent: -16px;
}

h1.Latin {
  -epub-ruby-position: over;
  color: #166827;
  direction: rtl;
  font-family: "WinSoft Pro", serif;
  font-size: 2em;
  font-style: normal;
  font-variant: normal;
  font-weight: bold;
  line-height: 1.3;
  margin-bottom: 10px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: center;
  text-decoration: none;
  text-indent: 0px;
}

h2.English {
  -epub-ruby-position: over;
  color: #25408f;
  direction: rtl;
  font-family: "WinSoft Pro", serif;
  font-size: 1.5em;
  font-style: normal;
  font-variant: normal;
  font-weight: bold;
  line-height: 1.2;
  margin-top: 30px;
  margin-bottom: 10px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: justify;
  text-decoration: none;
  text-indent: 0px;
}

h3.Num {
  -epub-ruby-position: over;
  color: #231f20;
  direction: rtl;
  font-family: "WinSoft Pro", sans-serif;
  font-size: 1.3em;
  font-style: normal;
  font-variant: normal;
  font-weight: 500;
  line-height: 1.3;
  margin-top: 10px;
  margin-bottom: 0px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: justify;
  text-decoration: none;
  text-indent: 0px;
}
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html" ; charset="UTF-8">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

  <title>1-1</title>
  <link href="../../css/Book.css" rel="stylesheet" type="text/css" />

 <button class="button" onclick="myFunction3()">bigger</button> <button class="button" onclick="myFunction4()">big</button> <button class="button" onclick="myFunction5()">normal</button> <button class="button" onclick="myFunction6()">small</button>
    <button
      class="button" onclick="myFunction7()">smaller</button> <button class="button" onclick="myFunction8()">fontWieght</button>

lorem this is bold ipsum lorem ipsum  this is also bold ipsum lorem ipsumlorem ipsum lorem ipsum lorem ipsum lorem ipsum.

d. lorem ipsum lorem ipsum lorem ipsum lorem ipsm lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum.

lorem ipsum lorem ipsum lorem ipsum lorem im lorem psum lorem ipsum lorem ipsum lorem ipsum.

I. lorem ipsum

A. lorem ipsum lorem ipsum lorem ipsum (active pharmaceutical ingredient (API))

1. lorem ipsum This is bold lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsumlorem ipsum lorem ipsumlorem ipsum.

C. lorem ipsum lorem ipsum lorem ipsumlorem ipsum lorem ipsum

A: You  changed the font-weight for
, but its each children have own font-weight, so it will overrides the inherited font-weight: 900;
Based on you can't change css, one solution is loop all children for
, then change their font-weight.
Below is one sample codes ( I added one text='test', you can use your origial code to see what happened (it will be bolder successfully using your codes)):

function myFunction3() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "x-large";

  }
}

function myFunction4() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "large";

  }
}

function myFunction5() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "16px";

  }
}

function myFunction6() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "small";

  }
}

function myFunction7() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");

  for (i = 0; i < cols.length; i++) {

    cols[i].style.fontSize = "x-small";
  }
}

function myFunction8() {
  var cols = document.getElementsByClassName("Basic-Text-Frame");
  let _loopAll = function (obj) {
    let childs = obj.childNodes;
    for (let j=0; j < childs.length; j++) {
      if(childs[j].style) {
        childs[j].style.fontWeight = "bolder";
        _loopAll(childs[j])
      }
    }
  }
  for (i = 0; i < cols.length; i++) {
    cols[i].style.fontWeight = "bolder";
    _loopAll(cols[i])
  }
}
.Basic-Text-Frame {
  margin: 10px;
}

p.SubEnglish {
  -epub-ruby-position: over;
  color: #231f20;
  direction: rtl;
  font-family: "WinSoft Pro", sans-serif;
  font-size: 1.3em;
  font-style: normal;
  font-variant: normal;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 0px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: justify;
  text-decoration: none;
  text-indent: 0px;
}

h4.SmallEnglish {
  -epub-ruby-position: over;
  color: #231f20;
  direction: rtl;
  font-family: "WinSoft Pro", sans-serif;
  font-size: 1.3em;
  font-style: normal;
  font-variant: normal;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0px;
  margin-left: 0px;
  margin-right: 30px;
  text-align: justify;
  text-decoration: none;
  text-indent: -16px;
}

h1.Latin {
  -epub-ruby-position: over;
  color: #166827;
  direction: rtl;
  font-family: "WinSoft Pro", serif;
  font-size: 2em;
  font-style: normal;
  font-variant: normal;
  font-weight: bold;
  line-height: 1.3;
  margin-bottom: 10px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: center;
  text-decoration: none;
  text-indent: 0px;
}

h2.English {
  -epub-ruby-position: over;
  color: #25408f;
  direction: rtl;
  font-family: "WinSoft Pro", serif;
  font-size: 1.5em;
  font-style: normal;
  font-variant: normal;
  font-weight: bold;
  line-height: 1.2;
  margin-top: 30px;
  margin-bottom: 10px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: justify;
  text-decoration: none;
  text-indent: 0px;
}

h3.Num {
  -epub-ruby-position: over;
  color: #231f20;
  direction: rtl;
  font-family: "WinSoft Pro", sans-serif;
  font-size: 1.3em;
  font-style: normal;
  font-variant: normal;
  font-weight: 500;
  line-height: 1.3;
  margin-top: 10px;
  margin-bottom: 0px;
  margin-left: 0px;
  margin-right: 0px;
  text-align: justify;
  text-decoration: none;
  text-indent: 0px;
}
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html" ; charset="UTF-8">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

  <title>1-1</title>
  <link href="../../css/Book.css" rel="stylesheet" type="text/css" />

 <button class="button" onclick="myFunction3()">bigger</button> <button class="button" onclick="myFunction4()">big</button> <button class="button" onclick="myFunction5()">normal</button> <button class="button" onclick="myFunction6()">small</button>
    <button
      class="button" onclick="myFunction7()">smaller</button> <button class="button" onclick="myFunction8()">fontWieght</button>

  Test

lorem this is bold ipsum lorem ipsum  this is also bold ipsum lorem ipsumlorem ipsum lorem ipsum lorem ipsum lorem ipsum.

d. lorem ipsum lorem ipsum lorem ipsum lorem ipsm lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum.

lorem ipsum lorem ipsum lorem ipsum lorem im lorem psum lorem ipsum lorem ipsum lorem ipsum.

I. lorem ipsum

A. lorem ipsum lorem ipsum lorem ipsum (active pharmaceutical ingredient (API))

1. lorem ipsum This is bold lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsumlorem ipsum lorem ipsumlorem ipsum.

C. lorem ipsum lorem ipsum lorem ipsumlorem ipsum lorem ipsum


text:
Q: jscrollPane not working at all I know I use a bad title but I can't describe it different.
The code is here : http://jsfiddle.net/FFjgc/3/
Header :
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<link rel="stylesheet" type="text/css" href="http://jscrollpane.kelvinluck.com/style/jquery.jscrollpane.css" />
<script type="text/javascript" src="http://jscrollpane.kelvinluck.com/script/jquery.jscrollpane.min.js"></script>
<script type="text/javascript" src="http://jscrollpane.kelvinluck.com/script/jquery.mousewheel.js"></script>
<script type="text/javascript" src="http://jscrollpane.kelvinluck.com/script/mwheelIntent.js"></script>

<script type="text/javascript">
$(document).ready(function() {
    $('.scroll').jScrollPane();
});
</script>

And the css
.scroll {
width: 100%;
height: 200px;
overflow: auto;
}

It's so simple, I use all the libraries and I'm sure there is no error in the code since I'm looking at it the last 2 hours.
Thank you.

A: There is no problem with the jQuery version. You should wrap your content with p tag to run Jscrollpane. In this way your content will look more semantic.
Example Here

A: I ran this issue and finally jScrollPane is working with all its features using jQuery 1.9.1.
The solution was very straightforward: initialize the plugin on window.load.
$(window).load(function) {
  $(".your-selector").jScrollPane();
}

I hope this help someone

A: The problem is de Jquery version.
Test with http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js


text:
Q: How to properly organize a CMake project with multiple subdirectories? I have this project structure:

and I'm trying to set CMakeList.txt files properly. My aim is simply linking the library to main.cpp. So I have these CMakeList.txt files:
library/CMakeList.txt:

source/CMakeList.txt:

root:

When I try to build the project, I get this error:
ld: library not found for -lMyLib
Where is the mistake, and how should I properly organize structure for such projects?

A: You used find_library yet you did not use ${MyLib} variable. Consult find_library documentation.
You used link_directories, yet it's local to the directory it was used in. Upper directories are unaffected.
Use an IMPORTED library or an INTERFACE library to link with .a file. See https://stackoverflow.com/a/10550334/9072753 and https://stackoverflow.com/a/41909627/9072753 answers. If it's one library only, I think prefer IMPORTED. Move target_include_directories(Source ...) to  library/CMakeLists.txt and instead of Source add include directories to your library, it's conceptually the library include directory.
I recommend, subjective, depens: move target_include_directories(Source.. inside source/CMakeList.txt. I.e. keep all Source related stuff inside source/CMakeLists.txt. And maybe add EXCLUDE_FROM_ALL to add_subdirectory(library).
Use set_target_properties instead of set(CMAKE_CXX_STANDARD. Overall, prefer to solely use *target* specific stuff instead of set(...).


text:
Q: Force a Rails controller to return a Rack::Response I have a gem responsible for handling off-site payments for my users. Given an amount and a payment gateway, it determines how to redirect to the gateway's payment page. The redirection can be via GET or an auto-submitted POST form, with various headers.
I need it to be compatible with Sinatra and other Rack frameworks, so it returns a Rack::Response.
However, I have trouble telling my Rails controller that this is the response I want to send the user, and that it should just return it.
I can integrate it easily in Sinatra :
get '/pay' do
  rack_response = Rack::Response.new(['Hello'], 200, {'Content-Type' => 'text/plain'})
  return rack_response.to_a
end

The following seems to work in Rails 4 :
# test_controller.rb
def pay
  rack_response = Rack::Response.new(['Hello'], 200, {'Content-Type' => 'text/plain'})

  self.response = ActionDispatch::Response.new(*rack_response.to_a)
  self.response.close
  return
end

However I cannot find an elegant way to make it work in a Rails 3.2 app. Am I missing something?

A: This seems to work in a Rails 3.2 app
# test_controller.rb
def pay
  rack_response = Rack::Response.new(['Hello'], 200, {'Content-Type' => 'text/plain'})

  self.response_body = rack_response.body
  self.status = rack_response.status
  self.response.headers = rack_response.headers

  return
end

It seems a little wonky though, if anyone has a more elegant way I'd take it


text:
Q: Do you have to do the events to get through the game? There are many events in the game that give you EP that you can use to enhance your characters. Is it necessary to do them or can you get through the game (in terms of combat abilities and survival) without them just fine?
I ask because I have no interest in spending more time with Prototype 1 than necessary to understand the story and events to be able to move on to the second title of the game.

A: You can complete the game without completing a single side event, I did so myself. They only give extra EP but you can get enough EP from other missions and collectibles.
I do recommend you do the optional infiltration missions because these give unique and useful abilities, and usually don't take more than a few minutes each.


text:
Q: How to update subdocument with findOneAndUpdate? there is a document in collection books :
{ _id : someMongooseGeneratedId,
  name : 'myBook',
  data : [{_id : 'page', name : 'one'},{ _id : 'chapter', name : 'Chapter One' }]
 }

I want to update books where book name is 'myBook' :
 Set name of chapter as 'Chapter 1' to the data where _id is 'chapter'
result as :
{ _id : someMongooseGeneratedId,
  name : 'myBook',
  data : [{_id : 'page', name : 'one'},{ _id : 'chapter', name : 'Chapter 1' }]
 }

I am looking to do the same with single query with mongoose.

A: The following works for me :
Model.findOneAndUpdate({ name : 'myBook', "data._id" : 'chapter' }, { "data.$.name" : 'Chapter 1' });


text:
Q: tel: scheme not working on Android (MONACA hybrid App) <ons-list-item modifier="tappable" ng-repeat="x in con">
        <ons-icon icon="fa-phone" style="color:#37C837;"></ons-icon>  {{x.name}}
      </ons-list-item>

Tapping on anchor link does not do anything. {{x.phoneNumber}}is a valid phone number.(checked in console)


text:
Q: UITableView in UIViewController reloadData not updating table view I have my MainViewController which a UIViewController class, in this view I have a table view and another view embedded in it. As you can see I added the table view delegates to the view controller.
@interface MainViewController : UIViewController <FlipsideViewControllerDelegate,   UITableViewDataSource, UITableViewDelegate> {

Now to my question which has been asked about 50 times from multiple searches on the internet but still I have not been able to find a solution.
Why doesn't reloadData work...?
I am downloading info from an XML feed and I refresh the feed from the app delegate:
- (void)applicationDidBecomeActive:(UIApplication *)application

I have inserted multiple NSLogs, this is what I have found. The refreshed data from the XML feed is coming in no problem. But the table view cells are not being refreshed.
I placed a NSLog in:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

Although the data is being refreshed, when I call [tableView reloadData]; the cellForRowAtIndexPath is never called.
I am hoping someone can help me with this issue, I have been working on this issue for about 12 hours with no luck. I have exhausted the search button on multiple sites....
FYI:
-Table View is wired in Interface Builder.
-My tables are being loaded one by one via TableViewCells, following Apples example starting on page 51 of the Table View Programming guide.
Additional Code:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return 17;
}

Thanks for the help

A: Do you have any example Code ?
My first ideas:

*

*Datasource not connected

*Rows in Section give 0 back

*Sections give 0 back

A: Everything is working now... That was a lot of time wasted on my part...
- (void)applicationWillEnterForeground:(UIApplication *)application
{
[_mainViewController refresh];
[_mainViewController.tableView reloadData];
}

- (void)refresh {
Parser *xmlParser = [[Parser alloc] init];
[xmlParser parseRssFeed:@"http://www.somesite.com/file.xml" withDelegate:self];
[xmlParser release];
[self.tableView reloadData];
}


text:
Q: Address Bar of PopUp Window I am making an online exam. The exam proper is in a popup window (to avoid opening new tabs for research). The problem is in the popup window. When I reload (highlighting the address in the address bar and press enter), my timer resets and other data will change. Is there a way to avoid reloading the popup window?

A: You can ask the user to confirm to reload using onbeforeunload event. But i dont think you can prevent browser built in functions
try
  window.onbeforeunload = function () { return confirm('Are you sure?' };

A: As the answer from @Murali i would suggest:
window.onbeforeunload = function () {
return confirm('Do you really whant to add +1 to you reset counter and -1 to your final exam evaluation?' };

And then , if you are using php (any other server language still apply ) :
<?php
// in your popup page //
session_start();
if(!isset($_SESSION["load_count"])){
    $_SESSION["load_count"]=0;
} else {
    $_SESSION["load_count"]+=1;
}
?>

...
in the html part
<?php echo "you currently reloaded the page ".$_SESSION["load_count"]." times"; ?>

it doesn't block them to refresh, but better than nothing.
You can also try:
window.onbeforeunload = function () { return false; };

but remember if students are normal people they can use browser console and terminate any javascript by themselves.
For that reason, if your timer logic is in javascript, you are not completely safe.


text:
Q: make-kpkg build kernel with -O0 for kgdb I am going to setup kgdb to debug Ubuntu debian kernel.
By default, the kernel compiled by make-kpkg has been optimized (-O2) so I am not able to debug the variables.
Is there a way to disable the kernel compilation optimization (for example, -O0)?
thanks!
Currently, gdb reports the variable has been optimized:
(gdb) p pb
$5 = <optimized out>

A: The Linux kernel depends on -O2.  It will not compile with any lower optimization levels.  It uses several GCC "tricks" that only work when certain optimizations are turned on, such as inline functions that are supposed to act like macros.


text:
Q: How does one obtain the lavfi.aphasemeter.phase frame metadata in FFMPEG? I'm trying to derive the numeric representation of a sound file's phase.
FFMPEG's aphasemeter filter seems to fit the bill for computing this number; the docs explicitly say:

The filter also exports the frame metadata lavfi.aphasemeter.phase which represents mean phase of current audio frame. Value is in range [-1, 1]. The -1 means left and right channels are completely out of phase and 1 means channels are in phase.

https://ffmpeg.org/ffmpeg-filters.html#aphasemeter
However, I can't seem to figure out how to use this filter to get that numeric value. When I experiment with various commands, I get various error messages. For example, ffmpeg -i input_file.wav -f aphasemeter.phase says I need an output, but ffmpeg -i input_file.wav -f aphasemeter.phase output_file.txt produces is not a suitable output format \ output_file.txt: Invalid argument
I'm looking for that -1 through 1 value; a graphical representation of that--though seemingly the main point of that filter--is not what I'm looking for.
Any ideas?
In case it matters, I'm using the WSL, having installed ffmpeg by apt-get.

A: Logged metadata values can be accessed and exported using the (a)metadata filter.
ffmpeg -i in.wav -af aphasemeter=video=0,ametadata=print:file=inwav-phase.txt -f null -

The text file will have the data in the format,
...
frame:105  pts:107512  pts_time:2.23983
lavfi.aphasemeter.phase=0.600750
frame:106  pts:108536  pts_time:2.26117
lavfi.aphasemeter.phase=0.554201
...


text:
Q: Logging into my node app's server as a root user I am trying to set up a simple CI/CD Pipeline for my app with Jenkins but am having difficulty logging into my node app's server as a root user following the instructions provided.
I am following this article.
Here's a link to an image for where I'm getting hung up.
Here's what I've tried in my terminal:

*

*Entering ssh root@NODE.SERVER.IP verbatim into the terminal. (received response: ssh: Could not resolve hostname node.server.ip: nodename nor servname provided, or not known)

*Entering ssh root@172.20.20.20 the terminal seems to become unresponsive to the following commands i.e. (adduser <lastname>)


text:
Q: Concatenate Fields from Gridview I have an ASP.NET page that contains textboxes, dropdownlists  and a gridview. There are two ways to fill in the form, one is when a user selects a row from the gridview the values from the cells populate the textboxes and dropdownlists, the other is the user can directly enter the data into the form.
This helps in adding, deleting and updating records from my database. My dropdownlists and gridview are populated with values from a sql statement on the page load event...
DROPDOWNLIST:
 dt = dal.FillDataTable(dbType.SqlServer, "SELECT V_VendorNo + ' | ' + V_VendorName FROM VendorTbl")
    ddlVendorEncum.DataSource = dt
    ddlVendorEncum.DataTextField = dt.Columns.Item(0).ToString
    ddlVendorEncum.DataValueField = dt.Columns.Item(0).ToString
    ddlVendorEncum.DataBind()

GRIDVIEW:
dts = dal.ExecuteSelectStoredPro(dbType.SqlServer, "EncumBugSearch", "@year", lblDef_FY.Text)
    gvEncumbered.DataSource = dts
    gvEncumbered.DataBind()

Because the dropdownlist is a concatentation of two columns from my table, when I select a row in my gridview the value will not populate the dropdownlist with the selected value. Is there a way to do a reverse type concatenation to get the dropdownlist to populate? I tried this:
ddlVendorEncum.Text = gvEncumbered.SelectedRow.Cells(1).ToString

which is the way I populate the textboxes but I get an error.

A: You could use
string s = dt.Columns.Item(0).ToString().Split("|".ToCharArray());

and then use the first item in the array (s[0]), but that's the hard way.  There's a much easier way.

Change
SELECT V_VendorNo + ' | ' + V_VendorName FROM VendorTbl

to
SELECT V_VendorNo + ' | ' + V_VendorName, VendorNo FROM VendorTbl

and then set the DataValueField to the second field returend from the query.
ddlVendorEncum.DataTextField = dt.Columns.Item(0).ToString
ddlVendorEncum.DataValueField = dt.Columns.Item(1).ToString

(Assuming VendorNo isthe primary key.)

A: I think you need to CAST as you are using two different Datatypes in your sql statement
SELECT CAST(V_VendorNo AS Char(10)) + ' | ' + V_VendorName FROM VendorTbl

I am assuming V_VendorNo is Int type in your DB
Try it.


text:
Q: Updating size of frame in canvas in customtkinter I have created a GUI with a scrollbar in customtkinter, but I have some problems with it. The GUI consists of two frames: the first one is a scrollable canvas frame with input fields; the second frame consists of a single button that, when clicked, adds fields to the first frame. The problem is that the height of the first frame is initially set to 400, but I want to add some height each time the Add row button is clicked. I tried to do it by self.canvas.itemconfigure(self.window, height=400+(50*self.xr), but it doesn't seem to work: there is no visual effect, but after printing the height of the frame is changed.
import customtkinter

class Adder:

    def __init__(self, app):
    self.app = app
    self.app.title("self.Scrollbar testing")
    self.app.geometry('{}x{}+{}+{}'.format(550, 460, 750, 250))
    self.xr = 1

    self.app.grid_rowconfigure(0, weight=1)
    self.app.grid_columnconfigure(0, weight=1)

    self.frame = customtkinter.CTkFrame(master=self.app)
    self.frame.grid(row=0,column=0, padx=15,pady=15, sticky="NSEW")

    self.frame.grid_rowconfigure(0, weight=1)
    self.frame.grid_columnconfigure(0, weight=1)

    self.canvas = customtkinter.CTkCanvas(self.frame)
    self.canvas.grid(row=0,column=0, sticky="NSEW")

    self.canvas.grid_rowconfigure(0, weight=1)
    self.canvas.grid_columnconfigure(0, weight=1)

    self.frame_2 = customtkinter.CTkFrame(master=self.canvas)

    self.scrollbar = customtkinter.CTkScrollbar(master=self.frame, orientation="vertical", command=self.canvas.yview, height=460, width=15)
    self.scrollbar.grid(row=0, column=0, sticky="NE")

    self.canvas.configure(yscrollcommand=self.scrollbar.set)
    self.canvas.bind("<Configure>", lambda e: self.canvas.configure(scrollregion=self.canvas.bbox("all")))

    self.window = self.canvas.create_window((0,0), window=self.frame_2, anchor="nw", height=400)

    self.entry_1 = customtkinter.CTkEntry(master=self.frame_2, placeholder_text=f"entry")
    self.entry_1.grid(row=0, column=0, sticky="NSEW", padx=10, pady=10)

    self.entry_2 = customtkinter.CTkEntry(master=self.frame_2, placeholder_text=f"entry")
    self.entry_2.grid(row=0, column=1, sticky="NSEW", padx=10, pady=10)

    self.entry_3 = customtkinter.CTkEntry(master=self.frame_2, placeholder_text=f"entry")
    self.entry_3.grid(row=0, column=2, sticky="NSEW", padx=10, pady=10)

    self.frame_3 = customtkinter.CTkFrame(master=self.app)
    self.frame_3.grid(row=1,column=0, sticky="NSEW", pady=10)

    def add_row():

        self.canvas.itemconfigure(self.window, height=400+(50*self.xr))

        self.entry_1 = customtkinter.CTkEntry(master=self.frame_2, placeholder_text=f"entry")
        self.entry_1.grid(row=self.xr, column=0, sticky="NSEW", padx=10, pady=10)

        self.entry_2 = customtkinter.CTkEntry(master=self.frame_2, placeholder_text=f"entry")
        self.entry_2.grid(row=self.xr, column=1, sticky="NSEW", padx=10, pady=10)

        self.entry_3 = customtkinter.CTkEntry(master=self.frame_2, placeholder_text=f"entry")
        self.entry_3.grid(row=self.xr, column=2, sticky="NSEW", padx=10, pady=10)

        self.xr += 1

    button = customtkinter.CTkButton(master=self.frame_3, text="Add row", command=add_row)
    button.grid(row=0, column=1, columnspan=3, padx=10, pady=10)

root = customtkinter.CTk()
app = Adder(root)
root.mainloop()

A: I hope i understood your problem correctly as the self.canvas.itemconfigure(self.window, height=400+(50*self.xr) in fact does work (you can see it getting bigger if you make the gui bigger).
The problem you are probably having is that you cant access the newly created space by scrolling. To achieve this you will need to add
            self.canvas.configure(scrollregion=self.canvas.bbox("all"))

right below your self.canvas.itemconfigure(self.window, height=400+(50*self.xr))
This let's your scrollbar work even after you change the size by clicking the button.
import customtkinter

class Adder:

    def __init__(self, app):
        self.app = app
        self.app.title("self.Scrollbar testing")
        self.app.geometry('{}x{}+{}+{}'.format(550, 460, 750, 250))
        self.xr = 1

        self.app.grid_rowconfigure(0, weight=1)
        self.app.grid_columnconfigure(0, weight=1)

        self.frame = customtkinter.CTkFrame(master=self.app)
        self.frame.grid(row=0, column=0, padx=15, pady=15, sticky="NSEW")

        self.frame.grid_rowconfigure(0, weight=1)
        self.frame.grid_columnconfigure(0, weight=1)

        self.canvas = customtkinter.CTkCanvas(self.frame)
        self.canvas.grid(row=0, column=0, sticky="NSEW")

        self.canvas.grid_rowconfigure(0, weight=1)
        self.canvas.grid_columnconfigure(0, weight=1)

        self.frame_2 = customtkinter.CTkFrame(master=self.canvas)

        self.scrollbar = customtkinter.CTkScrollbar(
            master=self.frame, orientation="vertical", command=self.canvas.yview, height=460, width=15)
        self.scrollbar.grid(row=0, column=0, sticky="NE")

        self.canvas.configure(yscrollcommand=self.scrollbar.set)
        self.canvas.bind("<Configure>", lambda e: self.canvas.configure(
            scrollregion=self.canvas.bbox("all")))

        self.window = self.canvas.create_window(
            (0, 0), window=self.frame_2, anchor="nw", height=400)

        self.entry_1 = customtkinter.CTkEntry(
            master=self.frame_2, placeholder_text=f"entry")
        self.entry_1.grid(row=0, column=0, sticky="NSEW", padx=10, pady=10)

        self.entry_2 = customtkinter.CTkEntry(
            master=self.frame_2, placeholder_text=f"entry")
        self.entry_2.grid(row=0, column=1, sticky="NSEW", padx=10, pady=10)

        self.entry_3 = customtkinter.CTkEntry(
            master=self.frame_2, placeholder_text=f"entry")
        self.entry_3.grid(row=0, column=2, sticky="NSEW", padx=10, pady=10)

        self.frame_3 = customtkinter.CTkFrame(master=self.app)
        self.frame_3.grid(row=1, column=0, sticky="NSEW", pady=10)

        def add_row():

            self.canvas.itemconfigure(self.window, height=400+(50*self.xr))
            self.canvas.configure(
                scrollregion=self.canvas.bbox("all"))

            self.entry_1 = customtkinter.CTkEntry(
                master=self.frame_2, placeholder_text=f"entry")
            self.entry_1.grid(row=self.xr, column=0,
                              sticky="NSEW", padx=10, pady=10)

            self.entry_2 = customtkinter.CTkEntry(
                master=self.frame_2, placeholder_text=f"entry")
            self.entry_2.grid(row=self.xr, column=1,
                              sticky="NSEW", padx=10, pady=10)

            self.entry_3 = customtkinter.CTkEntry(
                master=self.frame_2, placeholder_text=f"entry")
            self.entry_3.grid(row=self.xr, column=2,
                              sticky="NSEW", padx=10, pady=10)

            self.xr += 1

        button = customtkinter.CTkButton(
            master=self.frame_3, text="Add row", command=add_row)
        button.grid(row=0, column=1, columnspan=3, padx=10, pady=10)

root = customtkinter.CTk()
app = Adder(root)
root.mainloop()

A: Since you are using grid to manage the entry widgets in the frame, you shouldn't set the height of the canvas object. By removing both instances of height=... the frame will automatically always be tall enough to hold all of the entry widgets.
The other thing you need to do is reconfigure the scrollregion whenever the frame changes size (either by you computing the height, or by letting grid recompute it for  you.
If you remove the explicit setting of the height, you can define add_row to look like this - note the final statement that was added:

def add_row():

    self.entry_1 = customtkinter.CTkEntry(master=self.frame_2, placeholder_text=f"entry")
    self.entry_1.grid(row=self.xr, column=0, sticky="NSEW", padx=10, pady=10)

    self.entry_2 = customtkinter.CTkEntry(master=self.frame_2, placeholder_text=f"entry")
    self.entry_2.grid(row=self.xr, column=1, sticky="NSEW", padx=10, pady=10)

    self.entry_3 = customtkinter.CTkEntry(master=self.frame_2, placeholder_text=f"entry")
    self.entry_3.grid(row=self.xr, column=2, sticky="NSEW", padx=10, pady=10)

    self.xr += 1

    self.canvas.configure(scrollregion=self.canvas.bbox("all"))


text:
Q: PHP Cookies Not Unsetting [Unusual Situation] I have a problem with some cookies not unsetting. I have had a look through this question but all the answers have not worked.
I have 13 cookies in total, which I need to clear to test occasionally. When I unset them using:
setcookie("name", "", time() - 3600, '/');

What makes this unusual, is that using the same code with a different name unsets 10 of 13 cookies, leaving 3 still set... All the cookies are created at the same time, and I am trying to unset them all at the same time. I have checked the cookie names which all match what is stored on my PC.
As stated, I have tried all the answers in the post linked above, but none have worked. The cookies are set and unset from within the same directory, just a different file of which permissions are the same level.
Any suggestions?
(Not sure if it matters, but I'm using Chrome on Mac)
Example:
Setting cookies during login (I've dumbed it down to the 4 key cookies I need)
if($pass == 1) {
    setcookie('auth_code',$no_generator,$cookie_expire,'/');
    setcookie('username',$_POST['username'],$cookie_expire,'/');
    setcookie('admin',$admin,$cookie_expire,'/');
    setcookie('login_time',$date,$cookie_expire,'/');
    $_SESSION['logged_in'] = "true";
    header('Location: /logs.php');
}

Unsetting Cookies:
setcookie("admin", "", time() - 3600, '/');
setcookie("login_time", "", time() - 3600, '/');
setcookie("username", "", time() - 3600, '/');
setcookie("auth_code", "", time() - 3600, '/');

$cookie_expire is set to: $cookie_expire = time() + (21*365*24*60*60);.

A: your code work well in my localhost.
did you try set cookies name as array? i did a little modification for my local:
<?php
    $pass=$_GET['pass'];
    if($pass == 1) {
        $a='A';
        $cookie_expire = time() + (21*365*24*60*60);
    setcookie('coo[auth_code]',$a,$cookie_expire,'/');
    setcookie('coo[username]',$a,$cookie_expire,'/');
    setcookie('coo[admin]',$a,$cookie_expire,'/');
    setcookie('coo[login_time]',$a,$cookie_expire,'/');
    //$_SESSION['logged_in'] = "true";
    header('Location: ./log.php');
}

then unset using looping
foreach($_COOKIE['coo'] as $k=>$v){
    setcookie("coo[$k]", "", time() - 3600, '/');
}

Just in case,

Note from php.net

If the PHP directive register_globals is set to on then cookie values will also be made into variables. In our examples below,

$TestCookie will exist. It's recommended to use $_COOKIE.


text:
Q: Cache-control in response headers I have this server response for a file that I want not to be cached from the browsers. The response has two cache control headers.

*

*Cache-Control: no-cache, no-store, must-revalidate (which is what I want and)

*Cache-Control: private (which is appended by default from netscaler and the server side guys tell me they cannot remove it)

My question is which one will prevail?
HTTP/1.1 200 OK
Date: Mon, 20 Jan 2014 15:29:53 GMT
Server: Apache
Last-Modified: Fri, 17 Jan 2014 16:50:54 GMT
ETag: "682-4f02d58643780"
Accept-Ranges: bytes
Cteonnt-Length: 1666
P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM"
Keep-Alive: timeout=5, max=1000
Connection: Keep-Alive
Content-Type: text/javascript
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0
Cache-Control: private
Content-Encoding: gzip
Content-Length: 716

A: As per RFC2616, setting the same header multiple times should be equivalent to setting it once with all values separated by comas.

Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. It MUST be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma.

So in your case, it would be equivalent to
Cache-Control: no-cache, no-store, must-revalidate, private

private will just further prevent the response to be cached by a proxy between the server and the browser, so it shouldn't have any adverse effect.

A: Having researched a similar issue for a client, I can tell you from my own experience that, if this content is being served through a Citrix NetScaler and compression has been enabled, anything with a content-type of text will have a Cache-Control: private value set by the NetScaler. How you're getting two entries is beyond me. However, Yolanda's answer is most likely correct. The only reason for the caveat is that RFC2616 was superseded in 2014. (See https://www.w3.org/Protocols/rfc2616/rfc2616.html)
Regarding the NetScaler adding/replacing the Cache-Control header, it appears that it can be turned off; You just have to know how. Had to open a case with Citrix to learn about CTX124717 (FAQ:Preventing the Cache-Control Response Header from being Set to private).
If compression is enabled on the NetScaler, two of the default policies (ns_cmp_content_type and ns_adv_cmp_content_type) "compress data when the response contains Content-Type header and contains text" (see http://docs.citrix.com/en-us/netscaler/10-5/ns-optimization-wrapper-10-con/ns-compression-gen-wrapper-con/ns-compression-configactions-tsk.html). Using the NetScaler API Mgr (nsapimgr) you can prevent the Compression feature from adding the Cache-Control response header (nsapimgr -ys cmp_no_cc_hdr=1).


text:
Q: In java protected membes access from diff package In Java, how can I access protected members in a different package?
package p1
    class base
        protected int x

package p2
    import p1.*
    class derived extends base
        int x

class subderived extends derived
     int x

From subderived main I want to access x of p1.base as protected specification we can use only inheritance we can't use reference to access base x. To access derived x we can use super.x, but from subderived, how can we access base.x?

A: Protected members are accessible from immediately derived and sub-derived classes without any qualifiers: rather than writing
base.x = 123;

you can write
x = 123;

and it will compile fine, as long as it is in a method of a derived class. However, in order for this to work, you need to remove members with the same name from the derived class itself: otherwise, the base member is hidden, and cannot be accessed through more than one level of inheritance hierarchy through the normal syntax of the language, i.e. without using reflection.


text:
Q: Getting "not authenticated" Error in Nuxt.js middleware with SSR and Amplify I would like to create a Nuxt.js middleware to check if an user is authenticated or not. That works fine while navigation inside of the app. But when I refresh the page I always get:
[ERROR] 43:48.846 foo - SERVER {                                                                  15:43:48
  error: 'not authenticated'
}
 ERROR  [ERROR] 43:48.844 AuthError -                                                                     15:43:48
        Error: Amplify has not been configured correctly.
        The configuration object is missing required auth properties.
        Did you run `amplify push` after adding auth via `amplify add auth`?
        See https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup for more information

*

*AWS Amplify has an article with SSR Support here: SSR Support for AWS Amplify
There you can find the code to enable SSR and checking for user authentication

*In the Nuxt.js Docs, you can find:

In universal mode, middlewares will be called once on server-side (on the first request to the Nuxt app, e.g. when directly accessing the app or refreshing the page) and on the client-side when navigating to further routes.

Alright, so I enabled SSR in my amplify plugin and adjusted the middleware:
if (process.server) {
const { Auth } = withSSRContext(context.req)
try {
  await Auth.currentAuthenticatedUser()
} catch (error) {
  return context.redirect(302, '/auth/signin')
}

}
When I refresh the page, the code gets executed, but I always get a "not authenticated" error and "Amplify has not been configured correctly". On the other hand everything works perfectly fine on client side (signin, signup, etc.)
Any idea guys? I can't find a solution...
Kind regards

A: I ran in to the same problem and it turned out I had to adjust my configuration. I'm in NextJS but it looks like the same issue. In changed the way I configured Amplify in my component from:
Amplify.configure({ ...config })

to
Amplify.configure({ ...config, ssr: true })

Without setting the ssr property, my server side code was not able to pickup the current authenticated user and all I got was 'The user is not authenticated' in the server logs.
I'm using aws-amplify@3.3.4

A: Just try to configure Auth. No need to provide ssr: true.
At least thats what worked for me..
if (process.server) {
const { Auth } = withSSRContext(context.req)
Auth.configure({...config})
try {
  await Auth.currentAuthenticatedUser()
} catch (error) {
  return context.redirect(302, '/auth/signin')
}


text:
Q: Concurrent Reads and Write to an Excel file Is it possible to have only one process do WRITE and many doing a READ operation on an excel file? I am using ExcelPackage(EPPlus) for this.
To demo, I wrote two console app one to write iteratively and another to read. Running them concurrently will cause a failure on either side.
WRITE
// simply write to a column
var fileLocation = "D:\\Book.xlsx";
FileInfo fi = new FileInfo(fileLocation);

int i = 1;
while (1 == 1)  //ALERT: an infinite loop!
{
    using (ExcelPackage excelPackage = new ExcelPackage(fi))
    {
        ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets["Sheet1"];
        var row = worksheet.Row(2);

        worksheet.Cells[$"A{i}"].Value = "Test " + i.ToString();
        excelPackage.Save();
        i++;
    }
}

READ
//simply populate a list reading excel
var fileLocation = "D:\\Book.xlsx";
FileInfo fi = new FileInfo(fileLocation);
List<string> list = new List<string>();
ExcelWorksheet worksheet = null;
int i = 1;
while (1 == 1)  //ALERT: an infinite loop!
{
    using (ExcelPackage excelPackage = new ExcelPackage(fi))
    {
        worksheet = excelPackage.Workbook.Worksheets["Sheet1"];
        if (worksheet.Cells[i, 1].Value != null)
        {
            list.Add(worksheet.Cells[i, 1].Value.ToString());
        }
    }

    list.Clear();
}

A: I slightly changed my code by making the WRITE program lock the file before writing and READ to be resilient when a failure happens:
WRITE: Use a FileStream and lock it before attempting to write. This will prevent the WRITE from failing
READ: added a retry mechanism implementing a try/catch block
Modified code:
WRITE
// simply write to a column
var fileLocation = "D:\\Book.xlsx";
FileInfo fi = new FileInfo(fileLocation);

int i = 1;
while (1 == 1)  //ALERT: an infinite loop!
{

    using (ExcelPackage excelPackage = new ExcelPackage(fi))
    {
        ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets["Sheet1"];
        worksheet.Cells[$"A{i}"].Value = "Test " + i.ToString();

        using (var fs = new FileStream(fileLocation, FileMode.Open, FileAccess.ReadWrite, FileShare.Read))
        {
            fs.Lock(0, fs.Length);
            excelPackage.SaveAs(fs);
            try
            {
                fs.Unlock(0, fs.Length); // this raises an exception if fs unlocked already by itself
            }
            catch (IOException ex) when (ex.Message.ToLower().StartsWith("the segment is already unlocked.",
                StringComparison.InvariantCultureIgnoreCase))
            {
                // NOP; just ignore if already unlocked
            }
        }
        i++;
    }
}

READ
//simply populate a list reading excel
var fileLocation = "D:\\Book.xlsx";
FileInfo fi = new FileInfo(fileLocation);
List<string> list = new List<string>();
ExcelWorksheet worksheet = null;
int i = 1;
while (1 == 1)  //ALERT: an infinite loop!
{
    try
    {
        using (ExcelPackage excelPackage = new ExcelPackage(fi))
        {
            worksheet = excelPackage.Workbook.Worksheets["Sheet1"];
            if (worksheet.Cells[i, 1].Value != null)
            {
                list.Add(worksheet.Cells[i, 1].Value.ToString());
            }

            Console.WriteLine(worksheet.Dimension.Rows.ToString()); // just prove that it read
        }
    }

    catch (Exception ex) when (
        ex is IOException &&
        ex.Message.StartsWith("The process cannot access the file because another process has locked a portion of the file.", StringComparison.InvariantCultureIgnoreCase))
    {
        Console.WriteLine($"Attempt: {i}");
    }

    list.Clear();
}

in the actual app's code I set the limit of READ's WHILE to 3 to retry twice if first read attempt failed. That proves to be more than enough in my case (as the WRITEs are short; append a row at a time) and the app is running well over a month.

A: You can not read and write same file concurrently as its get locked when you are reading it. You can read the entire file into memory and then you can process it and after processing you can write it back.


text:
Q: Application defined or object oriented error. Code working from sheet and not working from another irow1 = Sheets("Customer Template").Range("K" & Rows.Count).End(xlUp).Offset(0).Row
Sheets("Customer Template").Cells(irow1 + 1, 11) = "Total"
Sheets("Customer Template").Cells(irow1 + 1, 12) = WorksheetFunction.Sum(Sheets("Customer Template").Range(Cells(6, 12), Cells(irow1, 12)))
Sheets("Customer Template").Cells(irow1 + 1, 13) = WorksheetFunction.Sum(Sheets("Customer Template").Range(Cells(6, 13), Cells(irow1, 13)))

This code while running in Customer Template Sheet its working properly, but when running from different sheet its throwing an error as application defined error. Debug error is showing in last two rows.
Please anyone help on this.


text:
Q: It's some kind of magic... or bug? I added my program to the SendTo. I send two files to it.
They are:
C:\ThisIsMySuperTestHelloWorld\ThisBookIsRedMyPenIsWhite\test.jpg
C:\ThisIsMySuperTestHelloWorld\ThisBookIsRedMyPenIsWhite\hello.jpg

The code below shows C:\ThisIsMySuperTestHelloWorld\ThisBookIsRedMyPenIsWhite\test.jpg@C:\ThisIsMySuperTestHelloWorld\ThisBookIsRedMyPenIsWhite\test.jpg
procedure TForm1.FormCreate(Sender: TObject);
var Files: array of PAnsiChar;
    i: Integer;
begin
  SetLength(Files, 2);

  for i:=0 to 1 do begin
   Files[i] := PAnsiChar(ParamStr(2+i));
  end;

  ShowMessage( Files[0] +'@' + Files[1] );
end;

I use Delphi 6 on Windows7.
Under Delphi Xe3 (still Win7) I changed (both) PAnsiChar to PWideChar and I have the same effect.
My SendTo link links to:
"C:\<PATH_HERE>\Project1.exe" c

and is placed here:
C:\Users\<USER>\AppData\Roaming\Microsoft\Windows\SendTo

A: What about using strings? For example:
procedure HandleParams;
var Files: array of string;
    i: Integer;
begin
  SetLength(Files, ParamCount);
  for i := 1 to ParamCount do
        Files[i-1] := ParamStr(i);

  if ParamCount >= 2 then
        ShowMessage( Files[0] +'@' + Files[1] );
end;

Your code does not work, because PAnsiChar is only a Pointer and does not store the actual string data. When you assign the string returned from the ParamStr function only a pointer to the (temporary) function result is stored. The actual data is overwritten with the next function call. This can even crash your program when further used.
By the way, your ParamStr index iterates over 2 and 3, with references to the second and third parameter; maybe that's not intended as the arguments start at index 1 (index 0 being the program call itself)?
To solve the issue one has to store the string data, which makes the pointers kinda useless, but anyway, here's a fixed version of your example:
procedure HandleParamsPAnsi;
var Files: array of PAnsiChar;
    FilesData: array of AnsiString;
    i: Integer;
begin
  SetLength(Files, 2);
  SetLength(FilesData, 2);

  for i:=0 to 1 do begin
      FilesData[i] := AnsiString(ParamStr(1+i));
      Files[i] := PAnsiChar(FilesData[i]);
  end;

  ShowMessage( Files[0] + '@' + Files[1] );
end;


text:
Q: WinSCP/CuteFTP - Download files owned by another user I have a "sudo user" account created on my server.
When using PuTTY, sudo "operation" allows me to do any operation without any problems; However I have a 37M file I need to check and I need to download it to my local machine; the problem is that WinSCP/CuteFTP is unable to download a file owned by another user. Is there a way to download that file without changing the owner?

A: When you connect via Putty switch to user by using your sudo privilege. Then copy file under /tmp folder. After that you would be able to download that file via winscp/cuteFTP.


text:
Q: How could I implement a xor operation of big integers with gmpy? I want to xor two big integers.
Just installed the gmpy2 library, but no mpz_xor operation anywhere.
Am I missing something?

A: Python has operator overloading, so they just made it ^. I would post a demo, but I only have access to gmpy 1.17, not gmpy2. Here's a code link showing the presence of an ^ overload, though.


text:
Q: Xcode simulator error when accessing files from iCloud --"Could not communicate with a helper function" iOS 13.1 I am not able to access files from iCloud using the  simulator.
I have logged in successfully to iCloud and able see the file listing. However, I get the error below  when I select any of the files. This is only happening on the simulator.
Mac version: Mojave 10.14.6
Xcode: Version 11.1 (11A1027)
IOS-13.1
-- Update --
This seems to be happening only iOS 13.1.. I upload simulator 12.4 and it works ok...


text:
Q: Is there a way to dynamically set collections name on MongoDB Quarkus? In Spring I'm able to use SpEL, and create a collection dynamically for the context of the incoming request, all I've to do is annotate the POJO with @Document and pass the query as a annotation parameter like:
import org.springframework.data.mongodb.core.mapping.Document;

@Document("#{@bean.someMething}Customer")
public class Customer {

    // Fields || Getter || Setter

}

But I can't figure a way to easily set this on Quarkus / MongoDB.
I do not mind in using quarkus-mongodb-client or mongodb-panache.
I tough that about producing a bean with @RequestContext that would be responsible to create a new MongoDatabase (com.mongodb.client.MongoDatabase) client with some info from the headers.


text:
Q: how to add increasingly more to an array Is there a way to have Q different updates of the following kind:
v[start] = v[start] + 1;
v[start + 1] = v[start + 1] + 2;
v[start + 2] = v[start + 2] + 3

and so on.. to the position end
v[end] = v[end] + end - start + 1

in O(N+Q)?
I mean something like difference arrays. Can you please help me?
If it helps, the array is initially only 0s.
Clarification:
N = array size
Q = Number of updates
All the updates have different starting and ending indices and I do not need to access any element of the array in between the updates. I only need them after i performed each update.

A: Oops, I read the problem as
v[start] = v[start] + 1;
v[start + 1] = v[start] + 2;
v[start + 2] = v[start + 1] + 3

This sounds like the job for scan methods (compare e.g. with Haskell's scanl), e.g. std::transform_exclusive_scan:
#include <iostream>
#include <iterator>
#include <numeric>
#include <vector>

int main() {
  std::vector v{0, 0, 0, 0};
  int value_increment = 1;
  std::transform_inclusive_scan(
      v.begin(), v.end(), std::ostream_iterator<int>(std::cout, " "),
      std::plus<int>{},
      [&value_increment](int x) { return x + value_increment++; });
  // 1 3 6 10
}

A: You're changing every member in a range in a similar way, so std::transform does what you want. The only mildly tricky thing is an extra variable that is increased every time. (Example not compiled or tested)
int i = 0;
std::transform(std::begin(v), std::end(v), std::begin(v),
               [&](int e) { return e + (++i); });


text:
Q: Indexed View w Business Logic I have been tasked to create several 'views' on data that exists on our analytics server. These views are 'business logic' heavy, but will be referenced by potentially multiple tools, so we are trying to centralize the logic into the sql server.
In essence, we have two operating companies, so we select a bunch of stuff from a bunch of tables into a 'standard' format, including a few columns that use formulas/case statements to output something meaningful to the biz.
Each company has a view. Then there is a parent view that combines them with a union all. The two company specific views are maintained by different people, but the both sides have the same columns / definitions / etc.
I was hoping to create an indexed view on the unioned view to materialize it as we are having some performance issues in our end point analysis tool.
Any help is appreciated! Thanks in advance!


text:
Q: Make a iOS WebView behave like a ebook reader Normally within a webview, when your page is too long, you can scroll vertically like a browser, that is the default.
I want to make this webview behave like a ebook reader, say when you need 3 pages to display the whole content, instead of scrolling vertically, you can slide to the next page which like a ebook reader (e.g. iOS Kindle app).
Any thoughts on how to implement this? Or any existing components I can use?
Cheer.

A: Very much depends on how much control you (want to) have on the html...
For complete layout control (magazine like) there's baker framework.
Or if you need a quick and dirty script auto generate html file with pagination (instapaper like), I'd use css3 multi-column layout, with some js to calculate the column needed. And use something like SwipeView to manage the scrolling.

A: This is not trivial, and there are a couple of HTML projects having to do with pagination. The ubiquitous jQuery also includes support for paginating HTML content.
Have look at this S.O. post for more details.

A: You can use UISwipeGestureRecognizer on UIWebView and move to the Page programmatically
Good Luck

A: To do this, you could start with a UIPageViewController and populate each page with a UIWebView, each scrolled down to a certain offset and disable scrolling of the underlying scroll view.


text: Q: Using ng-repeat and SQLite Database I have created a Cordova App that displays data from a web service. The app allows the user to save the data (contacts) to the apps Local Storage. The user has the ability to go back and display all the contacts and delete if they want. Everything works fine, but now I want to store my data (contacts) in an SQLite DB located in the app. I have the app working where when the user saves a contact it will still be stored in Local Storage, but will also be stored in my database. The problem is my app is using AngularJS to iterate over an object of contacts to display them, but when I retrieve my contacts from the database, they are in an Array, which Angular will not iterate over using the ng-repeat. I have tried converting the array to an object but that doesn't work. It seems there should be a simple answer using AngularJS. Has anyone ever tried to use the ng-repeat and an SQLite DB diplaying the data using ng-repeat?


text:
Q: Eclipse: similar plugin to emacs ace-jump-mode? Currently I use emacs but sometimes it takes a long time to configure it. I would like to use eclipse, but what I miss there is jumping around. Does emacs have some plugin which is working like ace-jump-mode: http://emacsrocks.com/e10.html?

A: Try this one from my github. https://github.com/whunmr/emacsIDEAsForEclipse/blob/master/acejump_1.0.0.201608252253.jar
source code is also available in the same repo.


text:
Q: Content inside iframe match width of parent div I have a responsive website that changes style sheets depending on browser width. I have a webform embeded through an iframe. The webform it's self is also responsive. Is there anyway to have the webform width reflect the parent div width.

A: iframe { position: relative; width: 100% }


text:
Q: ONOS vs Opendaylight what are the factors need to be considered What all factors need to be considered when I have to choose between ONOS and Opendaylight ?

ONOS focuses on performance and scalability ,whereas
ODL focuses on bringing Legacy and NGN together

This is what I found on internet.
All the references and studies are from 2016 or 2017. Both ODL and ONOS released many versions after that.

*

*Does OpenDayLight still lack scalability and high availability ? (Neon Version)

*Is there any other factors which need to be considered while choosing
between ONOS and ODL for my usecase ?
Note : My requirement includes a traffic steering in hub and spoke architecture for Service Provider and an SD-WAN MANO.