text:
Q: Without using WebDriverWait my code return: element click intercepted / with WebDriverWait returns 'NoneType' object is not iterable Code Proposal:
Collecting the links to all the games of the day present on the page (https://int.soccerway.com/matches/2021/07/28/), giving me the freedom to change the date to whatever I want, such as 2021/08/01 and so on. So that in the future I can loop and collect the list from several different days at the same time, in one code call.
Even though it's a very slow model, without using Headless, this model clicks all the buttons, expands the data and imports all 465 listed match links:
for btn in driver.find_elements_by_xpath("//tr[contains(@class,'group-head  clickable')]"):
    btn.click()

Full Code:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time

options = Options()
options.add_argument("start-maximized")
options.add_experimental_option("excludeSwitches", ["enable-logging"])
driver = webdriver.Chrome(r"C:\Users\Computador\Desktop\Python\chromedriver.exe", options=options)

url = "https://int.soccerway.com/matches/2021/07/28/"

driver.get(url)
driver.find_element_by_xpath("//div[@class='language-picker-trigger']").click()
driver.find_element_by_xpath("//a[@href='https://int.soccerway.com']").click()
time.sleep(10)
for btn in driver.find_elements_by_xpath("//tr[contains(@class,'group-head  clickable')]"):
    btn.click()
time.sleep(10)
jogos = driver.find_elements_by_xpath("//td[contains(@class,'score-time')]//a")
for jogo in jogos:
    resultado = jogo.get_attribute("href")
    print(resultado)
driver.quit()

But when I add options.add_argument("headless") so that the browser is not opened on my screen, the model returns the following error:

Message: element click intercepted

To get around this problem, I analyzed options and found this one on WebDriverWait (https://stackoverflow.com/a/62904494/11462274) and tried to use it like this:
for btn in WebDriverWait(driver, 1).until(EC.element_to_be_clickable((By.XPATH, "//tr[contains(@class,'group-head  clickable')]"))):
    btn.click()

Full Code:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time

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

options = Options()
options.add_argument("start-maximized")
options.add_argument("headless")
options.add_experimental_option("excludeSwitches", ["enable-logging"])
driver = webdriver.Chrome(r"C:\Users\Computador\Desktop\Python\chromedriver.exe", options=options)

url = "https://int.soccerway.com/matches/2021/07/28/"

driver.get(url)
driver.find_element_by_xpath("//div[@class='language-picker-trigger']").click()
driver.find_element_by_xpath("//a[@href='https://int.soccerway.com']").click()
time.sleep(10)
for btn in WebDriverWait(driver, 1).until(EC.element_to_be_clickable((By.XPATH, "//tr[contains(@class,'group-head  clickable')]"))):
    btn.click()
time.sleep(10)
jogos = driver.find_elements_by_xpath("//td[contains(@class,'score-time')]//a")
for jogo in jogos:
    resultado = jogo.get_attribute("href")
    print(resultado)
driver.quit()

But because it's not iterable, it returns in error:

'NoneType' object is not iterable

Why do I need this option?
1 - I'm going to automate it in an online terminal, so there won't be any browser to open on the screen and I need to make it fast so I don't spend too much of my time limits on the terminal.
2 - I need to find an option that I can use any date instead of 2021/07/28 in:
url = "https://int.soccerway.com/matches/2021/07/28/"

Where in the future I'll add the parameter:
today = date.today().strftime("%Y/%m/%d")

In this answer (https://stackoverflow.com/a/68535595/11462274), a guy indicated a very fast and interesting option (He named the option at the end of the answer as: Quicker Version) without the need for a WebDriver, but I was only able to make it work on the first page of the site, when I try to use other dates of the year, he keeps returning only the links to the games of the current day.
Expected Result (there are 465 links but I didn't put the entire result because there is a character limit):
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/fc-sheriff-tiraspol/alashkert-fc/3517568/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/fk-neftchi/olympiakos-cfp/3517569/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/scs-cfr-1907-cluj-sa/newcastle-fc/3517571/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/fc-midtjylland/celtic-fc/3517576/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/fk-razgrad-2000/mura/3517574/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/galatasaray-sk/psv-nv/3517577/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/bsc-young-boys-bern/k-slovan-bratislava/3517566/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/fk-crvena-zvezda-beograd/fc-kairat-almaty/3517570/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/ac-sparta-praha/sk-rapid-wien/3517575/
https://int.soccerway.com/matches/2021/07/28/world/olympics/saudi-arabia-u23/brazil--under-23/3497390/
https://int.soccerway.com/matches/2021/07/28/world/olympics/germany-u23/cote-divoire-u23/3497391/
https://int.soccerway.com/matches/2021/07/28/world/olympics/romania-u23/new-zealand-under-23/3497361/
https://int.soccerway.com/matches/2021/07/28/world/olympics/korea-republic-u23/honduras-u23/3497362/
https://int.soccerway.com/matches/2021/07/28/world/olympics/australia-under-23/egypt-under-23/3497383/
https://int.soccerway.com/matches/2021/07/28/world/olympics/spain-under-23/argentina-under-23/3497384/
https://int.soccerway.com/matches/2021/07/28/world/olympics/france-u23/japan-u23/3497331/
https://int.soccerway.com/matches/2021/07/28/world/olympics/south-africa-u23/mexico-u23/3497332/
https://int.soccerway.com/matches/2021/07/28/africa/cecafa-senior-challenge-cup/uganda-under-23/eritrea-under-23/3567664/

Note 1: There are multiple types of score-time, such as score-time status and score-time score, that's why I used contains in "//td[contains(@class,'score-time')]//a"
Update
If possible, in addition to helping me solve the current problem, I am interested in an improved and faster option for the method I currently use. (I'm still learning, so my methods are pretty archaic).

A: Brondby IF,
I see, two issues with your script
First is
for btn in WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//tr[contains(@class,'group-head  clickable')]"))):
    btn.click()

basically, this is wrong cause element_to_be_clickable will again return a single webelement, so you will get non-inerrable error instead we can use visibility_of_all_elements_located that will return a list.
Second you can not click directly, cause few elements are not in Selenium view port, so we will have to use ActionsChain
See below :
options = webdriver.ChromeOptions()
options.add_argument("--disable-infobars")
options.add_argument("start-maximized")
options.add_argument("--disable-extensions")
options.add_experimental_option("prefs", {"profile.default_content_setting_values.notifications": 2})
options.add_argument("--headless")
options.add_experimental_option("prefs", {"profile.default_content_settings.cookies": 2})

driver = webdriver.Chrome(options = options)
driver.implicitly_wait(30)
driver.get("https://int.soccerway.com/")
driver.find_element_by_xpath("//div[@class='language-picker-trigger']").click()
driver.find_element_by_xpath("//a[@href='https://int.soccerway.com']").click()
sleep(10)
for btn in WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.XPATH, "//tr[contains(@class,'group-head  clickable')]"))):
    ActionChains(driver).move_to_element(btn).click().perform()
sleep(10)
jogos = driver.find_elements_by_xpath("//td[contains(@class,'score-time')]//a")
for jogo in jogos:
    resultado = jogo.get_attribute("href")
    print(resultado)

Output :
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/fc-sheriff-tiraspol/alashkert-fc/3517568/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/fk-neftchi/olympiakos-cfp/3517569/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/scs-cfr-1907-cluj-sa/newcastle-fc/3517571/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/fc-midtjylland/celtic-fc/3517576/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/fk-razgrad-2000/mura/3517574/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/galatasaray-sk/psv-nv/3517577/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/bsc-young-boys-bern/k-slovan-bratislava/3517566/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/fk-crvena-zvezda-beograd/fc-kairat-almaty/3517570/
https://int.soccerway.com/matches/2021/07/28/europe/uefa-champions-league/ac-sparta-praha/sk-rapid-wien/3517575/
https://int.soccerway.com/matches/2021/07/28/world/olympics/saudi-arabia-u23/brazil--under-23/3497390/
https://int.soccerway.com/matches/2021/07/28/world/olympics/germany-u23/cote-divoire-u23/3497391/
https://int.soccerway.com/matches/2021/07/28/world/olympics/romania-u23/new-zealand-under-23/3497361/
https://int.soccerway.com/matches/2021/07/28/world/olympics/korea-republic-u23/honduras-u23/3497362/
https://int.soccerway.com/matches/2021/07/28/world/olympics/australia-under-23/egypt-under-23/3497383/
https://int.soccerway.com/matches/2021/07/28/world/olympics/spain-under-23/argentina-under-23/3497384/
https://int.soccerway.com/matches/2021/07/28/world/olympics/france-u23/japan-u23/3497331/
https://int.soccerway.com/matches/2021/07/28/world/olympics/south-africa-u23/mexico-u23/3497332/

A: You don't need Selenium
Selenium should never be the primary way of scraping data from the web. It's slow and generally requires more lines of code than its alternatives. Whenever possible, use requests coupled with the lxml parser. In this particular use case, you're using selenium only to switch between different URLs, which is something that can be easily hardcoded, thereby avoiding the need to use it in the first place.
import requests
from lxml import html
import csv
import re
from datetime import datetime
import json

class GameCrawler(object):
    def __init__(self):
        self.input_date = input('Specify a date e.g. 2021/07/28: ')
        self.date_object = datetime.strptime(self.input_date, "%Y/%m/%d")
        self.output_file = '{}.csv'.format(re.sub('/', '-', self.input_date))
        self.ROOT_URL = 'https://int.soccerway.com'
        self.json_request_url = '{}/a/block_competition_matches_summary'.format(self.ROOT_URL)
        self.entry_point = '{}/matches/{}'.format(self.ROOT_URL, self.input_date)
        self.session = requests.Session()
        self.HEADERS = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'}
        self.all_game_urls = []
        self.league_urls = self.get_league_urls()

    def save_to_csv(self):
        with open(self.output_file, 'a+') as f:
            writer = csv.writer(f)
            for row in self.all_game_urls:
                writer.writerow([row])
        return

    def request_other_pages(self, page_params):
        params = {
            'block_id': 'page_competition_1_block_competition_matches_summary_11',
            'callback_params': json.dumps({
                "page": page_params['page_count'] + 2,
                "block_service_id": "competition_summary_block_competitionmatchessummary",
                "round_id": int(page_params['round_id']),
                "outgroup":"",
                "view":1,
                "competition_id": int(page_params['competition_id'])
            }),
            'action': 'changePage',
            'params': json.dumps({"page": page_params['page_count']}),
        }
        response = self.session.get(self.json_request_url, headers=self.HEADERS, params=params)
        if response.status_code != 200:
            return
        else:
            json_data = json.loads(response.text)["commands"][0]["parameters"]["content"]
            return html.fromstring(json_data)

    def get_page_params(self, tree, response):
        res = re.search('r(\d+)?/$', response.url)
        if res:
            page_params = {
                'round_id': res.group(1),
                'competition_id': tree.xpath('//*[@data-competition]/@data-competition')[0],
                'page_count': len(tree.xpath('//*[@class="page-dropdown"]/option'))
            }
            return page_params if page_params['page_count'] != 0 else {}
        return {}

    def match_day_check(self, game):
        timestamp = game.xpath('./@data-timestamp')[0]
        match_date = datetime.fromtimestamp(int(timestamp))
        return True if self.date_object.day == match_date.day else False

    def scrape_page(self, tree):
        for game in tree.xpath('//*[@data-timestamp]'):
            game_url = game.xpath('./td[@class="score-time "]/a/@href')
            if game_url and self.match_day_check(game):
                self.all_game_urls.append('{}{}'.format(self.ROOT_URL, game_url[0]))
        return

    def get_league_urls(self):
        page = self.session.get(self.entry_point, headers=self.HEADERS)
        tree = html.fromstring(page.content)
        league_urls = ['{}{}'.format(self.ROOT_URL, league_url) for league_url in tree.xpath('//th[@class="competition-link"]/a/@href')]
        return league_urls

    def main(self):
        for index, league_url in enumerate(self.league_urls):
            response = self.session.get(league_url, headers=self.HEADERS)
            tree = html.fromstring(response.content)
            self.scrape_page(tree)
            page_params = self.get_page_params(tree, response)
            if page_params.get('page_count', 0) != 0:
                while True:
                    page_params['page_count'] = page_params['page_count'] - 1
                    if page_params['page_count'] == 0:
                        break
                    tree = self.request_other_pages(page_params)
                    if tree is None:
                        continue
                    self.scrape_page(tree)
            print('Retrieved links for {} out of {} competitions'.format(index+1, len(self.league_urls)))
        self.save_to_csv()
        return

if __name__ == '__main__':
    GameCrawler().main()

So when is Selenium worth using?
Nowadays, it's common for websites to serve dynamic content, so if the data that you'd want to retrieve isn't statically loaded:

*

*check the browser's network tab to see whether there's a request
specific to the data of interest to you and,

*try to emulate it with requests.

If points #1 and #2 aren't possible due to the way in which the webpage is designed, your best option would then be to use selenium which will fetch the required content through simulated user interactions. For the HTML parsing, you may still choose to use lxml, or you can stick to selenium which also provided that functionality.
First edit:

*

*Fixed issues raised by OP

*Included a limitation of the presented code

*Code refactoring

*Added a date check to make sure that only those matches which were played on the specified date are saved

*Added functionality for allowing search results to be saved

Second edit:

*

*Added functionality for navigating through all pages of each listed competition with get_page_params() and request_other_pages()

*More code refactoring

A: Try to add the Options window-size Without using WebDriverWait
options.add_argument("window-size=1440,900")

O/P


text:
Q: Working with omega sub-theme and having trouble to make susy, sass and compass work properly I'm working with omega sub-theme and i'm having trouble to make susy, sass and compass work properly.
Every single time i go to terminal and execute $ compass watch i get the next result:

LoadError on line 51 of /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb: no such file to load -- rgbapng
  Run with --trace to see the full backtrace

I have trie diferent version of Ruby using RVM and still have the same problem.
The next is the result of the --trace command:

/Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:51:in require'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/configuration/data.rb:161:inrequire'
    /Users/----/----/----/sites/all/themes/----/config.rb:21:in get_binding'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/configuration/serialization.rb:20:inget_binding'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/configuration/serialization.rb:23:in parse_string'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/configuration/serialization.rb:15:in_parse'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/configuration/serialization.rb:14:in open'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/configuration/serialization.rb:14:in_parse'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/configuration/file_data.rb:7:in new_from_file'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/configuration/inheritance.rb:204:inwith_defaults'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/configuration/file_data.rb:6:in new_from_file'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/configuration/helpers.rb:42:inconfiguration_for'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/configuration/helpers.rb:97:in add_project_configuration'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/commands/project_base.rb:31:inadd_project_configuration'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/commands/project_base.rb:25:in configure!'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/commands/project_base.rb:15:ininitialize'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/commands/update_project.rb:37:in initialize'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/exec/sub_command_ui.rb:42:innew'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/exec/sub_command_ui.rb:42:in perform!'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/lib/compass/exec/sub_command_ui.rb:15:inrun!'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/bin/compass:30
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/bin/compass:44:in call'
    /Library/Ruby/Gems/1.8/gems/compass-0.12.2/bin/compass:44
    /usr/bin/compass:23:inload'
    /usr/bin/compass:23

Thanks for any help in advance.

A: My problem was simple, i was using the wrong command to install the rgbapng gem, instead of using gem install rgbang you should be using gem install compass-rgbang.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Align one equation left, center the other I want to write the formulation
\begin{align}
\begin{split}
\text{Find } u_{h} \in S_{h,0}^{1} \text{ such that} \\
a(u_{h},v_{h}) = l(v_{h}) \qquad \forall v_{h} \in S_{h,0}^{1}
\end{split}
\end{align}

However the first line should be left aligned, while the second remains centered and the spacing between them and the common equation number remains the same. Can this be done somehow?

A: Building on @barbarabeeton's suggestion:

\documentclass{article}
\begin{document}
Find $u_{h} \in S_{h,0}^{1}$ such that
\begin{equation}
a(u_{h},v_{h}) = l(v_{h})\ \forall\ v_{h} \in S_{h,0}^{1}\,.
\end{equation}
\end{document}

A: Not quite what you want (the equation number is on the 2nd line), with \shortintertextfrom mathtools:
\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{gather}
\shortintertext{Find $ u_{h} \in S_{h,0}^{1} $ such that}
a(u_{h},v_{h}) = l(v_{h}) \qquad \forall v_{h} \in S_{h,0}^{1}
\end{gather}

\end{document}

A: I'm not sure if I understand your question correctly. Do you possibly intend to produce the following output?

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\setlength{\parindent}{0pt}
\begin{document}
    A\par A
    \begin{align}
        \begin{split}
            &\text{Find $u_{h} \in S_{h,0}^{1}$ such that} \\
            &a(u_{h},v_{h}) = l(v_{h}) \qquad \forall v_{h} \in S_{h,0}^{1}
        \end{split}
    \end{align}
    A\par A
\end{document}

A: Your requirements seem a bit strange to me, I mean, why do you want the equation number centered between a text line and a math line? Anyway, here is one way to do it, use text mode for the first line and subtract a vertical space of \baselineskip + \abovedisplayskip to use gathered in mathmode with the first line empty.
\documentclass{article}
\usepackage{amsmath}
\begin{document}

A\par A

Find $u_{h} \in S_{h,0}^{1}$ such that
\par\addvspace{\dimexpr-\baselineskip-\abovedisplayskip}
\begin{equation}
\begin{gathered}
\\
a(u_{h},v_{h}) = l(v_{h}) \qquad \forall v_{h} \in S_{h,0}^{1}
\end{gathered}
\end{equation}

A\par A

\end{document}


text:
Q: ¿Cómo puedo sumar los valores de un mismo campo previamente obtenido? - TypeScript Soy algo nuevo en esto, y no he podido encontrar una solución. Me gustaría sumar los valores de un campo llamado Towel, estoy usando una tabla dinámica en donde obtengo el campo a partir de otras funciones, utilizo Angular y Firestore.
El campo lo obtengo y lo almaceno en:
item10: string = 'Towel';

En donde para poder sumar, estaba usando este código:
  view() {
this.total = this.transactions.map(t => t.item10).reduce((acc, value) => acc + value, 0);
return this.total;   }

Sé que si escribo t.Towel  en vez de t.item10 me suma correctamente, pero como el valor Towel es un valor que el usuario ingresa, hace que estos datos sean dinámicos.
La idea es usar la variable item10.
Adjunto un stackblitz que hice como ejemplo:
https://stackblitz.com/edit/angular-cpvwqw?file=src%2Fapp%2Ftable-multiple-header-footer-example.ts
De antemano muchas gracias por su ayuda.

A: Explicación en el código:
  item10: string = 'Towel';

  transactions: Transaction[] = [
    {id: 'B1', Towel: 4},
    {id: 'B2', Towel: 5},
    {id: 'B3', Towel: 2},
    {id: 'B4', Towel: 4},
    {id: 'B5', abc: 25}, // aquí no existe Towel así que devolverá undefined
    {id: 'B6', Towel: 15},
  ];

  total:number = 0;
  view() {
    this.total =
    this.transactions
    // crear arreglo con los valores de la propiedad Towel
    // si el objeto no tiene la propiedad Towel entonces habrá valores
    // undefined entonces se usa el operador ?? para retornar un 0 donde Towel
    //sea undefined
    .map(t => t[this.item10] ?? 0)
    .reduce((acc, value) => acc + value, 0);
    return this.total;
  }

A: Puedes acceder a la clave dinamicamente:
this.total = this.transactions
          .map(t => t[this.item10] ?? 0) // aqui el cambio
          .reduce((acc, value) => acc + value, 0);

A: Creo que puede usar la desestructuración, que puede ayudarlo a obtener solo el valor que desea del objeto que recibió en el map. Haz algo como esto:

transactions = [
    {id: 'B1', Towel: 4},
    {id: 'B2', Towel: 5},
    {id: 'B3', Towel: 2},
    {id: 'B4', Towel: 4},
    {id: 'B5', Towel: 25},
    {id: 'B6', Towel: 15},
  ];

function view() {
    const total = transactions.map(({Towel}) => Towel).reduce((acc, value) => acc + value, 0);
    return total;
  }

console.log(view());

En su archivo .ts reemplace este código:
view() {
    this.total = this.transactions.map(({Towel}) => Towel).reduce((acc, value) => acc + value, 0);
    return this.total;
  }


text:
Q: Is glfwSwapInterval() reliable? Is glfwSwapInterval(1) reliable enough to cap framerate to 60 fps, or should I manually cap it myself? I often see people manually capping framerates instead of using this function.
Will the function provide a steadier, more stable fps than manual capping?

A: As far as I know, the glfwSwapInterval is to do with the v-sync on your monitor/graphics card. Have a look at this forum post which goes into more detail:
https://www.opengl.org/discussion_boards/showthread.php/177446-glfwSwapInterval%28%29-and-glfwSwapBuffer%28%29-Questions
I'm not sure but on most modern hardware I expect it won't make much of a difference!


text:
Q: Parse Error Syntax; Unexpected end of file So my first time coding PHP and I have created a registration page for a potential website. However when I go to run the code, it gives me the following:
Parse error: syntax error, unexpected end of file in C:\LOCATION on line 123
I know I am more than likely missing a curly brace somewhere. But for the life of me I can't find it. If someone can glance their eyes over and spot it I would appreciate it :)
<?php
$page_title = 'Register';
include 'header.php';

//master control to ensure scripts only execute when form is submitted
if ($_SERVER['REQUEST_METHOD']=='POST')
{
    //Opens connection to database and create an array to store any errors in
    require 'connect.php';
    $errors = array();

    //Checks to see if username is empty and if not true stores it into a variable
    if( empty($_POST['username']))
    {
        $errors[] = 'Please enter username';
    }
    else
    {
        $username = mysqli_real_escape_string($conn,trim($_POST['username']));
    }

    //Checks to see if email is empty and if not true stores it into a varible
    if( empty($_POST['email']))
    {
        $errors[] = 'Please enter email';
    }
    else
    {
        $email = mysqli_real_escape_string($conn,trim($_POST['email']));
    }

    //Check to see if passwords match and if they do store into variable
    if( !empty($_POST['pass1']))
    {
        if( $POST['pass1'] != $_POST['pass2'])
        {
            $errors[] = 'Passwords do not match';
        }
        else
        {
            $pass = mysqli_real_escape_string($conn, trim($_POST['pass1']));
        }
    }
    else
    {
        $errors[] = 'Please enter a password';
    }

    //Checks to see if Email is already registered
    if( empty( $errors))
    {
        $q = "SELECT user_id FROM users WHERE user_email='$email'";
        $r = mysqli_query($conn, $q);
        if( mysqli_num_rows($r) != 0)
        {
            $errors[] = 'Email Address is already registered';
        }

    //Checks to see if username is already taken
    if( empty( $errors))
    {
        $q = "SELECT user_id FROM users WHERE user_name='$username'";
        $r = mysqli_query($conn, $q);
        if( mysqli_num_rows($r) != 0)
        {
            $errors[] = 'Username is already taken, please choose another';
        }

    //If successful send data to to database
    if( empty( $errors))
    {
        $q = "INSERT INTO users
            (user_name, user_pass, user_email, user_date, user_level)
            VALUES ('$username', SHA1('$pass'), '$email', NOW(), '0')";
        $r = mysqli_query($conn, $q);

        if($r)
        {
            echo'
Registered!

you may now login
';
        }

            //Closes connections
            mysqli_close($conn);
            include 'footer.php';
            exit();
    }
    //Otherwise display errors
    else
    {
        echo'
Error!

Following errors have occured:
';
        foreach($errors as $msg)
        {
            echo " - $msg
";
        }
        echo '
Please try again
';
        mysqli_close($conn);
    }

}
?>

Sign-up

<form action="signup.php" method="POST">

        Username:<input type="text" name="username" value="<?php if (isset($_POST['username'])) echo $_POST['username'];?>">

        Password:<input type="password" name="pass1">
        Repeat Password:<input type="password" name="pass2">

        E-Mail Address:<input type="text" name="email" value="<?php if (isset($_POST['email'])) echo $_POST['email'];?>">

    <input type="submit" value="register">

</form>

<?php
    include'footer.php';
?>


text:
Q: Realm entry corrupted immediately after write We are running into a really strange issue with Realm (Swift). If we retrieve an entry immediately after writing it to the db it is completely different from the written one. What could possible cause this. Below is a screenshot from the debugger where it happens. The code to fetch the entry looks like this:
func fetchEntry(assetID: String) throws -> UploadInfo? {
    let realm = try Realm()
    return realm.objects(UploadInfo.self).filter { $0.assetID == assetID }.first
}

The entry class looks like this:
class UploadInfo: Object {

    override static func primaryKey() -> String? {
        return "assetID"
    }

    override static func indexedProperties() -> [String] {
        return ["sessionID", "taskID"]
    }

    @objc dynamic var sessionID: String = ""
    @objc dynamic var taskID: Int = 0
    @objc dynamic var totalBytesSent: Int64 = 0
    @objc dynamic var totalBytesExpectedToSend: Int64 = 0
    @objc dynamic var downloadProgress: Float = 0.0
    @objc dynamic var uploadProgress: Float = 0.0

    @objc dynamic var fileURLPath: String = "" // path of file that is uploaded (i.e. multipart body)
    @objc dynamic var path: String = ""
    @objc dynamic var assetID: String = "" //PHAsset localIdentifier

    @objc dynamic var fileModificationTime: DegooTimestamp = 0
    @objc dynamic var fileSize: Int64 = 0 // unprocessedTotalFileDataLength
    @objc dynamic var fileChecksumBase64: String = ""
    @objc dynamic var fileChecksum: Data = Data(base64Encoded: "")!

    var fileURL: URL {
        return URL(fileURLWithPath: fileURLPath)
    }

    func makeCopy() -> UploadInfo {
        let ui = UploadInfo()
        ui.sessionID = sessionID
        ui.taskID = taskID
        ui.totalBytesSent = totalBytesSent
        ui.totalBytesExpectedToSend = totalBytesExpectedToSend
        ui.downloadProgress = downloadProgress
        ui.uploadProgress = uploadProgress
        ui.fileURLPath = fileURLPath
        ui.path = path
        ui.assetID = assetID
        ui.fileModificationTime = fileModificationTime
        ui.fileSize = fileSize
        ui.fileChecksumBase64 = fileChecksumBase64
        ui.fileChecksum = fileChecksum
        return ui
    }
    }

    extension UploadInfo {
    var data: Data? {
        do {
            guard try FileManager.default.isFile(at: self.fileURL) else { return nil }
            return try Data(contentsOf: self.fileURL)
        } catch {
            Log.error(error)
            return nil
        }
    }

    var asset: PHAsset? {
        return PHAsset.fetchAssets(withLocalIdentifiers: [self.assetID], options: nil).firstObject
    }

    var shouldBeOptimized: Bool {
        guard let asset = self.asset else { return false }
        return ImageOptimizer.default.shouldBeReoptimized(width: asset.pixelWidth, height: asset.pixelHeight)
    }

    func cleanUpUrls() {
        for url in urlsToCleanUp {
            do {
                if FileManager.default.fileExists(atPath: url.absoluteString) {
                    try FileManager.default.removeItem(at: url)
                }
            } catch {
                Log.error(error)
            }
        }
    }

    var urlsToCleanUp: [URL] {
        let localAssetPathHelper = LocalAssetPathHelper()
        let assetFileName = localAssetPathHelper.fileName(for: URL(fileURLWithPath: self.path))
        let multipartBodyFileName = localAssetPathHelper.fileName(for: self.fileURL)
        return [
            URL(fileURLWithPath: localAssetPathHelper.path(for: multipartBodyFileName)),
            URL(fileURLWithPath: localAssetPathHelper.path(for: "/Photos/".appending(assetFileName))),
            URL(fileURLWithPath: localAssetPathHelper.path(for: "/Videos/".appending(assetFileName)))
        ]
    }
}

We have tried this on both Realm 3.1.1 and 3.5.0.


text:
Q: React native push-notifications OneSignal/Firebase Hi i want to ask a question about React native notifications. I have an app that display many youtube playlist and I want to enable push notification when a new video is added to the playlist. Is it better if I use OneSignal or Firebase for the notification ? Thanks !

A: Both Are Equal Notification funcationality here is sample project with Tutorial may be it can help.
Firebase Push Notification : https://enappd.com/blog/firebase-push-notifications-in-react-native/81/
One Signal Push Notification : https://medium.com/differential/react-native-push-notifications-with-onesignal-9db6a7d75e1e


text:
Q: How to stop useState from re-rendering a component where state wasn't used I have a parent component A where state and useState are set. The parent has two children - component B which receives useState as a prop and component C which receives state as a prop.
So, if B runs setState, then C should re-render. This all works fine. The problem I'm having is that B is ALSO re-rendering, even though it does not receive state as a prop. Ideally, I ONLY want C to re-render.
Also, I don't want to compare previous state to current state, because if it is a heavily nested array or object with lots of data, then the performance hit could be very significant.
Is there any way of achieving this? Or do I have to use something like the Context API instead?
Code Example:
// App.jsx - A
const App = () => {
  const [state, setState] = useState(0);

  return (

      <One updateNumber={setState} />
      <Two number={state} />

  );
};

// One.jsx - B
const One = ({ updateNumber }) => {
  console.log("=> Render One");
  return (
    <button onClick={updateNumber.bind("", Math.random() * 10)}>Update Number</button>
  );
};

// Two.jsx - C
const Two = ({ number }) => {
  console.log('=> Render Two')
  return (
Number: {number}
)
};

A: If Parent Component rerenders its children will rerender too.
The only way of avoiding that behaviour in your child component is by memoizing the component so it only renders once because it does not depend on any state update.

A: state is a state of parent component (A) which is updated when you call setState from component B ==> every children component will be re-render too. To prevent component B (only accept setState as a props) re-render you can use React.memo.
// One.jsx - B
const One = React.memo(({ updateNumber }) => {
  console.log("=> Render One");
  return (
    <button onClick={updateNumber.bind("", Math.random() * 10)}>Update Number</button>
  );
};)

Note: Because React guarantee setState will not be changed after each re-render so can directly pass it to component B, if you pass a normal function make sure you wrap it with useCallback to memoize the function.
DO NOT use Context API in this case, there is NO way to prevent re-rendering, because when you update values from context API, every consumer will be re-rendered directly without checking props,


text:
Q: error 404 on example test with Laravel 5.4 Using Laravel 5.4, I can't run the example test provided for phpunit:
<?php

namespace Tests\Feature;

use Tests\TestCase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class ExampleTest extends TestCase
{
    /**
     * A basic test example.
     *
     * @return void
     */
    public function testBasicTest()
    {
        $response = $this->get('/');

        $response->assertStatus(200);
    }
}

Running command phpunit from the root of my project outputs:
PHPUnit 6.0.10 by Sebastian Bergmann and contributors.

F.                                                                  2 / 2 (100%)

Time: 147 ms, Memory: 12.00MB

There was 1 failure:

1) Tests\Feature\ExampleTest::testBasicTest
Expected status code 200 but received 404.
Failed asserting that false is true.

/home/username/public_html/myproject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:76
/home/username/public_html/myproject/tests/Feature/ExampleTest.php:21

With my .env at root contains:
APP_URL=http://localhost/~username/myproject/public

I saw this similar question, but the answer was useless.
Any idea?
Edit:
Note that the url http://localhost/~username/myproject/public/ is perfectly working through a browser.

A: Add virtual host, and use that domain for APP_URL.
In Ubuntu 17.04, you can do so by creating a .conf file in /etc/apache2/sites-available with the following content:
<VirtualHost *:80>
    DocumentRoot "/path/to/your/laravel/project/public"
    ServerName name.of.your.virtual.host

    <Directory "/path/to/your/laravel/project/public">
        AllowOverride All
    </Directory>
</VirtualHost>

Then enable the virtual host with the apache command:
sudo a2ensite name.of.your.file.conf

And finally restart apache:
systemctl reload apache2


text:
Q: AngularJS - why is the ng-click handler not being fired? Here's the HTML:

        ...

Here are the associated directive and controller:
angular
    .module('app.assignments')
    .directive('stfrAssignments', assignmentsDirective)
    .controller('AssignmentsController', AssignmentsController);

function assignmentsDirective() {
    var directive = {
        restrict: 'E',
        templateUrl: 'components/assignments/assignments.html',
        scope: {
            assignments: '='
        },
        controller: 'AssignmentsController',
        controllerAs: 'vm'
    };
    return directive;
}

function AssignmentsController() {
    var vm = this;

    function handleAssignmentClicked() {
        console.log('handleAssignmentClicked');
    }
}

When I click an assignment (a row in the table), the handleAssignmentClicked() function is not being called. Where should I look for the problem?

A: Update: As pointed out by a comment, the parent directive (which we supposed is being used) is using the controllerAs syntax, which is addressed in the second point [2]. I leave the first one for information.
[1] The this keyword in your controller is not the same as its $scope, unless you use the contoller as controllerName syntax.
You can inject $scope in your controller:
function AssignmentsController($scope) {
  $scope.handleAssignmentClicked() {
    console.log('handleAssignmentClicked');
  }
}

[2] Or alternatively, which is your case:

...

And in your controller you would use this to make the function accessible:
this.handleAssignmentClicked = function() { ... }


text:
Q: CRUD Swing - Request Insert Into I would like to create a CRUD system through a From .There are 4 fields in my table : CodeA, TitreA, SortieA, IdentA (foreign key) .The last field in the form is a dropdown fiels and When I enter values for all the fields and save the form, there occurs a problem.
Here is a preview:
https://zupimages.net/up/18/21/uxwa.png
I guess the problem is about syntax:
public boolean insertAlbum (Album alb)
    {

        boolean ok = ConnexionMySQL.getInstance().actionQuery("Insert into album (CodeA, TitreA, SortieA, IdentC) values ('" + alb.getCodeA() + "','" + alb.getTitreA() +
        "'," + alb.getSortieA() + "," + alb.getCatApp().getIdentC());

        return ok;
    }

Any help will be appreciated!


text:
Q: Doctrine2 PostFlush event listener for new entities I have an event listener which should catch the entities that are new created, and make some extra processing to them. Can someone tell me how can I catch the flushed entities in the "PostFlush" event? because I need their ids, and I can't get them in other event. I have tried to get them from the UnitOfWork with the "getScheduledEntityInsertions" function, but there are no entities.
Thank you.

A: There is no event related to "postFlush".
According to your description, you can use "postPersist" event.

 * The postPersist event occurs for an document after the document has
 * been made persistent. It will be invoked after the database insert operations.
 * Generated primary key values are available in the postPersist event.


text:
Q: python-telegram-bot keyboard doesn't appear I'm trying to make a bot for channel management and the keyboard (channel_markup in the code) for the channel selection doesn't appear. Now this keyboard is hard coded but later I want to introduce a used-based keyboard for channel.

    from telegram import ReplyKeyboardMarkup
    from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler, ConversationHandler)
    from Post import Post

   MENU, CHANNEL = range(2)

   menu_markup = ReplyKeyboardMarkup([['POST', 'HTML']], one_time_keyboard=True, resize_keyboard=True)

   def error(update, context):
       """Log Errors caused by Updates."""
       logger.warning('Update "%s" caused error "%s"', update, error)

   def start(bot, update, user_data):
       reply_text = 'Hi!'
       update.message.reply_text(reply_text, reply_markup=menu_markup)
       return MENU

   def new_post(bot, update, user_data):
       user_data['post'] = Post()
       channel_markup = ReplyKeyboardMarkup([['Test1', 'Test2']],
                 one_time_keyboard=True, resize_keyboard=True)
       update.message.reply_text(text="Select channel",
       replyMarkup=channel_markup)
       return CHANNEL

   def channel_choice(bot, update, user_data):
       channel = update.message.text
       user_data['post'].channel = channel
       update.message.reply_text('Hi', reply_markup=menu_markup)
       return MENU

   def test_bot(args):
       pass

   def main():
       updater = Updater("TOKEN")
       dp = updater.dispatcher
       conv_handler = ConversationHandler(

           entry_points=[CommandHandler('start', start, pass_user_data=True)],

           states={
               MENU: [RegexHandler('^POST$', new_post, pass_user_data=True)],

               CHANNEL: [RegexHandler('^Test1$', channel_choice, pass_user_data=True)]
           },

           fallbacks=[RegexHandler('^fallbacks$', test_bot)])

       dp.add_handler(conv_handler)

       # log all errors
       dp.add_error_handler(error)

       # Start the Bot
       updater.start_polling()

       # Run the bot until you press Ctrl-C or the process receives SIGINT,
       # SIGTERM or SIGABRT. This should be used most of the time, since
       # start_polling() is non-blocking and will stop the bot gracefully.
       updater.idle()

A: Replace replyMarkup with reply_markup.


text:
Q: How to execute code inside performFetchWithCompletionHandler only when application is in active state? I want to perform some action during some interval of time.But this should not occour when app is in background or inactive state.
I have implemented this as follows
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

UIApplication.shared.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum)
   return true
}

And in the performFetchWithCompletionHandler
 func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {

    print("Background fetch called")

        // foreground

    if (application.applicationState == .active)
    {

        //lines of code to perform

}
}

But when I tried simulating background fetch in simulator ,it is showing the following message
Warning: Application delegate received call to -application:performFetchWithCompletionHandler: but the completion handler was never called.
I tried removing the application state condition and it is working fine.But i want to perform these lines only when app is active and not in background or inactive state.How can I achieve this?

A: You forgot to add the completion handler to the function. It should be called when the data fetch completed.
Insert this to your code if you have new data to display:
completionHandler(.newData)

...this if you have no data:
completionHandler(.noData)

...and this if the fetch failed:
completionHandler(.failed)


text:
Q: How to save dynamically added button for next run in vb.net I have written code to add a button based on the number of buttons the user needs to add to the form. I am having a very difficult time figuring out how to save the buttons that have been added during runtime and have them persist to the next run. I tried using My.Settings, but have had no luck. Any help would be appreciated! Below is the code I am using to add button(s).
Private Sub UploadNew_Click(sender As Object, e As EventArgs) Handles UploadNew.Click

    Num = InputBox("How many lines to add?")

    Dim pt As Point

    pt.X = 9
    pt.Y = 67

    For x = 1 To Num
        DocName = InputBox("What is the name of the document?")
        Buttons(x) = New Button
        Buttons(x).Location = pt
        Buttons(x).Height = 35
        Buttons(x).Width = 434
        Buttons(x).Text = DocName 'assigned earlier in code
        SplitContainer1.Panel1.Controls.Add(Buttons(x))
        pt.Y = pt.Y + 43

    Next

End Sub

A: I use the binary serialization. It probably could be done with XML serialization also. The trick is to mark the class as <Serializable>You might think we could just serialize the button but that is not marked as serializable in the framework.
Imports System.IO
Imports System.Runtime.Serialization.Formatters.Binary

Public Class SaveDynamicButtons
    Private Buttons As New List(Of MyButtonSettings)

    Private Sub SaveDynamicButtons_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        If Not File.Exists("ButtonList.dat") Then
            Exit Sub
        End If
        Dim myList As List(Of MyButtonSettings)
        ' 1. Create an instance of Binary Formatter
        Dim bf As New BinaryFormatter()
        ' 2. Get an instance of a FileStream for the OpenRead method of File passing in (the fileName)
        Using fs As Stream = File.OpenRead("ButtonList.dat")
            '3. cast back to original object, the Deserialize method of the Binary Formatter passing in the File Stream
            myList = (CType(bf.Deserialize(fs), List(Of MyButtonSettings)))
        End Using
        For Each item In myList
            Dim btn As New Button
            btn.Location = item.Location
            btn.Height = 35
            btn.Width = 434
            btn.Text = item.Text
            Me.Controls.Add(btn)
        Next
    End Sub

    Private Sub AddButtons()
        Dim Num As Integer
        If Not Integer.TryParse(InputBox("How many lines to add?"), Num) Then
            MessageBox.Show("Please enter a valid number")
            Exit Sub
        End If
        Dim pt As Point
        pt.X = 9
        pt.Y = 67
        For x = 1 To Num
            Dim DocName As String = InputBox("What is the name of the document?")
            Dim btn As New Button
            Dim myBtn As New MyButtonSettings
            btn.Location = pt
            myBtn.Location = pt
            btn.Height = 35
            btn.Width = 434
            btn.Text = DocName
            myBtn.Text = DocName
            Me.Controls.Add(btn)
            Buttons.Add(myBtn)
            pt.Y = pt.Y + 43
        Next
    End Sub

    Private Sub SaveButtons()
        Dim bf As BinaryFormatter = New BinaryFormatter()
        'FileStream(FileName, Mode, Access, Share) intellisense overload #9 out of 15
        Using fs As Stream = New FileStream("ButtonList.dat", FileMode.Create, FileAccess.Write, FileShare.None)
            bf.Serialize(fs, Buttons)
        End Using
    End Sub

    Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
        AddButtons()
    End Sub

    Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
        SaveButtons()
    End Sub
End Class

<Serializable>
Public Class MyButtonSettings
    Public Property Location As Point
    Public Property Text As String
End Class


text:
Q: How to resolve gcc compiler optimization-induced segmentation fault on centos dual compiler set up I have a large C++ software project build with gcc.  After adding some new code into the repository, one of the binary started to get Segmentation Fault on larger test data (no segfault on a few smaller test inputs).  I have tested on several different hardwares with two different systems.  Ubuntu 18 and Centos6.  GCC compiler tested are 6.3, 7.4 and 9.2.  Binary build on Ubuntu always good and on Centos is always bad (segfault). The OS giving trouble:
uname -a
Linux hostname 3.10.0-957.27.2.el7.x86_64 #1 SMP Mon Jul 29 17:46:05 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

My Unbuntu has single compiler, but the Cenos usually has a old gcc 4.8, and on top of that we build 6.3, 7.4, or 9.2.  My C++ code was build with various versions gcc and on different harwares, all got segfault at
std::ostream& operator(ostream&, const string&);

but from one of several random places in my code.  I used the -O2 or -O3 option. When using -O0 option the binary has no problem but a few times slower.  I am trying to generate production code which needs to be faster.
I know one solution is to find out which line of code is causing this segmentation fault, which I will try next.  My question is that is there any option while making the gcc compiler that may help to resolve this segfault issue?
I have followed suggestion (provide in the comment section below) turning on full warning and updated all dependent libraries with warning message too (include boost). It looks this solved the problem. I learn a big lesson: any code we write has to pass pedantic Wall. Someone should write an answer to help other programmers.

A: No one else has answered this question.  I will summarize my experience here without any particular concrete codes.  First, I tested on centos6, where the original gcc was 4.8, and I built the latest gcc 9.2 compiler from gcc7.4.  On this machine binaries build with compiler 9.2 only has segmentation fault when using -O options.  The segfault is always in std ostream& operator<<(ostream&, const string&).  After I went through all my code and all the library used by my code and removed all warnings whatsoever, the segmentation fault was gone. I tested on about one hundreds input files and all finished the program with exit status 0. Strangely enough, the segmentation fault only occurs on my cento6 system initially.  My Ubuntu18 works fine even before removing all compiler warning messages and with the -O1-3 options.
I did some minor updates on my code recently, now I started to see the same segmentation fault ONLY on my Ubuntu18 (with compiler gcc 7.4).  Optimization -g O1, O1, O2, O3 all gave segmentation fault.  -g O0 produced code without any problems.  Now the Centos6 is fine with any optimization.
Since the segmentation fault location is inside standard lib, debug run does not reveal any useful information as to where is the cause of the error.  The only solution left is to comment out different chunk of code to locate which piece of code causes the segmentation fault. This prove to be useful.
After reading the 4 lines of code that caused the segmentation fault. I immediately realized which line had caused the trouble:
// samearray is array<int,4> somearray;
somearray[4]=someNumber;

So the take home message is when segmentation fault is trying to misguide you into thinking about "compiler optimizations", "different Operating systems", "different compiler versions", resist the temptation and sit down to digest your own code by commenting chunks at a time. I still don't know why the revelation of the segmentation fault is connected to compiler optimization option. Hope my suffering can help others.


text:
Q: CoffeeScript JSDoc support in PhpStorm/WebStorm Is there a way to use JSDoc to annotate source code written in CoffeeScript when working in PhpStorm/WebStorm? When working in the IDE, it is very helpful to be able to use JSDoc to have proper code completion for functions.
I found this past question: How to document CoffeeScript source code with JSDoc? However, the answers and comments are not clear on whether it is supported or what the proper syntax is.

A: Unfortunately this is not currently supported. Pleasze feel free to file a request for this feature to youtrack

A: Here is an updated answer for anyone who comes across this thread in the future. WebStorm 2017.3 (the current version as of this writing) has support for CoffeeScript javadocs.
The basic syntax is this:
###*
 * Here is a simple description for foo
 * @param {Bar} bar - Some parameter to foo
 * @returns {Object} The thing that foo returns
###
foo = (bar) ->

WebStorm will give you the documentation when you press ctrl+Q.

A: in coffeescript there is a way to use basic javascript by including code between "`"

coffee code
` common javascript code `
coffee code

there is maybe a possibility to use this to put your jsCode here

coffee code
`
/** @constructor*/
`
coffee code

I did not tried yet that solution...


text:
Q: Convert network Path containing a "@" to URI i want to convert a network path (Directory "\www.dummy.com@ABC\test") to URI:
var uri = new Uri(path, UriKind.RelativeOrAbsolute);

It occures a URIFormatException
How can i fix this?

A: I think you need to change UriKind enum to the Relative value.
This code snippet is working fine:
const string path = @"\www.dummy.com@ABC\test";
var uri = new Uri(path, UriKind.Relative);
Console.Write(uri);

// Output:
// \www.dummy.com@ABC\test


text:
Q: WSL process causing DPC_WATCHDOG_VIOLATION I'm using Bash on Ubuntu for Windows on Windows 10.
Disclaimer: I'm relatively new to Windows. Have almost exclusively used unix systems
I'm downloading ~1 mil images, in groups of up to 100k, by executing the following script in WSL, ($1 is the target folder where the images are downloaded):
#!/bin/bash
SECONDS=0
cat "$1/pics.csv" | xargs -n 1 -P 10 wget -q -P "$1/"
echo "Elapsed $SECONDS seconds"
echo "Adding .jpg extentions"
mmv "$1/*_small" "$1/#1.jpg"
find "$1" -name pics.csv -type f -delete

The process spawns up to 8 threads to download images, renames them and then deletes the csv the urls were read from. The first couple of times the script is started it completes but then it suddenly stops and results in a BSOD.
I've run it multiple times on my Mac without failure. I had to port my project to Windows 10 and want to use WSL as it should be able to run the bash scripts.
I've checked the Event Viewer for error logs - the source seems to be DistributedCOM with the error but I cannot see how that could be the case as it runs fine the first few times.

The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID
  {D63B10C5-BB46-4990-A94F-E40B9D520160}
   and APPID
  {9CA88EE3-ACB7-47C8-AFC4-AB702511C276}
   to the user DESKTOP-E01P1DA[Username] SID (S-1-5-21-2149831090-3283936149-3974900866-1001) from address LocalHost (Using LRPC) running in the application container Unavailable SID (Unavailable). This security permission can be modified using the Component Services administrative tool.

Does anyone have an idea what could be the cause and solution for this?

A: I meet since last weekend  the same issue just without bash installed
For me the identical situation appear afer installing HyperVisor on windows 10 pro
On my side Windows can freeze randomly (on the login screen or when just browsing with chrome) and get the WPC watchdog BSOD
and I have the same 10016 error with exact same clssid and appid
Maybe you can check with BLueScreenView what happen
http://www.nirsoft.net/utils/blue_screen_view.html
On my side I have two different crash occurs
one of the bsod is caused by the ntoskrnl.exe alone
and a second one by dxgkrnl.sys + ntoskrnl.exe + nvlddmkm.sys
When the crash occur I do only web browsing or stay on the logon screen of windows
No crash happen when I watch a video on youtube or on another website
Never happen during discord call
I do what  harrymc say and also removed all graphique driver with DDU in the real safemode and install the latest driver
still digging on this issue and start to be tired
For booting in real the safe mod I use easybcd
http://neosmart.net/EasyBCD/
sorry to post has a answer since I can't post has a comment to give all this information for maybe find the issue
Ps I got the one Watchdog bsod caused by ntoskrnl.exe only by taping this text !!!!!!!


text:
Q: How to pass parameters to a function that is the argument of another function I have an objective function f(x, d), where x is the a vector of two variables (x1, x2) and d is a Nx2 matrix of points,that is given. f(x) is a distance function calculating some compount distance from x to all the points in d.
I'm trying to create a Gradient Descent function for calculating the minimum value of my function. First, I've created a gradient function that depends on the external parameter d, which is given (see below).
# Customers location from an external file (100 customers)
locations = read.csv(file = 'locations.csv')

# Gradient of my objective function is:
obj_fun.grad <- function(x,d) {
  dx <- 2*(x[1] - d$x)/((x[1] - d$x)^2 + 1)
  dy <- 2*(x[2] - d$y)/((x[2] - d$y)^2 + 1)
  s <- c(sum(dx),sum(dy))

  return (s)
}

I then created my gradient descent function as below. I would like to keep this function as most generic as possible, so re-usable for other objective functions.
grad.descent = function(grad.function, x0, max.iter=200, step.size=0.05, stopping.deriv=0.01,...)
{
  # Calculating the length of the initial vector
  n = length(x0)

  # Create a matrix where the coordinates of different steps will be stored
  xmat = matrix(0, nrow=n, ncol=max.iter)
  # Initial guess is the starting point
  xmat[,1] = x0

  for (k in 2:max.iter) {

    # Calculate the gradient, that depends on locations of customers
    grad.cur = grad.function(xmat[,k-1], d=d)

    # Check whether gradient is below the given threshold
    if (sqrt(t(grad.cur)%*%grad.cur) < stopping.deriv) {
      k = k-1;
      break
      }

    # Move in the opposite direction of the grad
    xmat[,k] = xmat[,k-1] - step.size*grad.cur
    }

  # Remove unused positions
  xmat = xmat[,1:k]

  # Return: 1) optimum position, 2) list of all positions, 3) number of iterations
  return(list(x=xmat[,k], xmat=xmat[,1:k], k=k))
}

Now I would like to invoke the grad.descent function passing if the locations file as an additional parameter to be then passed to the gradient function:
gd1 <- grad.descent(obj_fun, x0 = c(200,200), max.iter = 200, step.size=0.5, locations)
However, I get the following error:

Error in fgrad(xmat[, k - 1], d = d) : object 'd' not found

A: R is telling you that the object d is not found because you never told it what d was.
The easiest way to fix it, is to replace the first line inside the for loop in the grad.descent function with the following line:
grad.cur = grad.function(xmat[,k-1], d = locations)

This way the function grad.function knows that it should take the dataframe locations as its second input d.
Note that this works because R uses lexical scoping. You can find more information here.


text:
Q: Ionic 2 - How to remove split panel on login page only? I use this code in app.html, the split-pane is working beautifully. But the problem is, the pane is working for every page like login or SignUp, so please help me to prevent the split pane working for every page.
<ion-split-pane when="(min-width: 768px)">
<ion-menu [content]="content">
  <ion-content id="Chat">
  </ion-content>
</ion-menu>
<ion-nav [root]="rootPage" #content></ion-nav>
</ion-split-pane>

A:     import { Component } from '@angular/core';
    import { MenuController,IonicPage, NavController } from 'ionic-angular';

    @IonicPage()

    @Component({
      selector: 'page-signup',
      templateUrl: 'signup.html',
    })

    export class SignUp {

    constructor(public navCtrl: NavController, public menu : MenuController)
    {
       this.menu.enable(false);
       this.menu.swipeEnable(false);
    }

    ionViewWillLeave(){
    this.menu.enable(true);
    this.menu.swipeEnable(true);
    }
  }

Hope this helps. just disable menu and swipe the menu with that splitpane automatically hides.

A: Based on what hoeksms mentioned here, you could use a shared service like this:
import { Injectable } from '@angular/core';
import { Platform } from 'ionic-angular';

@Injectable()
export class SplitPaneData {

    splitPaneState: boolean;

    constructor(public platform: Platform) {
        this.splitPaneState = false;
    }

    setSplitPane(state: boolean) {
        if (this.platform.width() > 768) {
            this.splitPaneState = state;
        } else {
            this.splitPaneState = false;
        }
    }

    getSplitPane() {
        return this.splitPaneState;
    }

}

And in the app.component use that service to show/hide it:
<ion-split-pane [when]="splitPaneData.getSplitPane()">

If you want to hide it in a given page, you can use the ionViewWillEnter and ionViewWillLeave lifecycle events:
ionViewWillEnter() {
    // Disable the split plane in this page
    this.splitPaneData.setSplitPane(false);
}

ionViewWillLeave() {
    // Enable it again when leaving the page
    this.splitPaneData.setSplitPane(true);
}

A: update ionic 5
work for me login.page.ts
  constructor(
    private api: LoginService,
    private loadCt: LoadingController,
    private nav : NavController,
    public menu : MenuController
    ) {
      this.menu.enable(false);
      this.menu.swipeGesture(false)
     }

     ionViewWillLeave(){
      this.menu.enable(true);
      this.menu.swipeGesture(true);
      }


text:
Q: Deploy multiple Application to the same Azure web app viaAzure DevOps I've a two applications, backend and frontend, hosted on the same Azure web app (os : windows).
Actually, i Deploy the two artficats via FTP/S.
I use wwwroot folder to the front and a subfolder in wwwroot folder to the backend
I would use Azure Devops to  create a Azure Release to deploy the two application to my web app.
I can't use two app service for the backend and the frontend.
What is the best approch to deploy ? and It's possible to specify a subfolder target in Azure App service into Azure release ?
Regards

A: It is impossible to specify a subfolder to deploy to in azure release pipeline using the deployment tasks. The artifacts will be deployed to wwwroot folder by default.
However,You can use copy files task in your release pipeline to copy the backend artifacts into the subfolder which resides in the frontend artifacts folder. And then deploy the frontend artifacts folder which contains the backend artifacts in its subfolder. See below:

You can also run Kudu rest api in azure powershell task to deploy to azure web app service.
You can  first use the command api to create a subfolder in wwwroot.
{
 "command" = 'md subfolder',
 "dir"='D:\home\site\wwwroot'
}

Then you can deploy the backend artifacts to the subfolder using zip deploy api
$apiUrl = "https://{sitename}.scm.azurewebsites.net/api/zip/site/wwwroot/subfolder"
Please check out this blog for more information. See this thread for example using azure powershell task to call kudu rest api


text:
Q: how to make listtile scrollview on flutter I need a scrollview for my app I could not found good any sources for fixing it if you have any suggestions please let me know thanks
also I am calling decor method from other page if you want to see it I can share it
I am calling decor method from other page if you want to see it I can share it
import 'package:flutter/cupertino.dart';
      import 'package:flutter/material.dart';
        import 'package:resat/BurgerListView/decoration.dart';
      import 'item.dart';
       import 'detailspage.dart';
class BurgerList extends StatelessWidget {
  static const title = 'Title';

 // This widget is the root of your application.
 @override
 Widget build(BuildContext context) {
final padding = EdgeInsets.all(8.0);
final border = BeveledRectangleBorder(
  borderRadius: BorderRadius.circular(25.0),
);
return MaterialApp(
  title: 'title',
  home: Scaffold(
    appBar: AppBar(
      title: Text("Menu"),
    ),
    body: GridView.count(
        crossAxisCount: 2,
        children: _foodItems.map((FoodItem item) {
          return Padding(
            padding: padding,
            child: Card(
              shape: border,
              child: InkWell(
                child: new Container(
                  decoration: BoxDecoration(
                    image: DecorationImage(
                      image: AssetImage(
                        item.imageAssetPath,
                      ),
                      fit: BoxFit.cover,
                    ),
                    borderRadius: BorderRadius.circular(25.0),
                  ),
                ),
                onTap: () {
                  Navigator.push(
                      context,
                      new MaterialPageRoute(
                                builder: (BuildContext context) =>
                                    FoodItemWidget(item: item)));
                },
              ),
            ),
           );
              }).toList(growable: false)),
        ),
      );
        }
    }

    List<FoodItem> _foodItems = <FoodItem>[
          FoodItem("Item 1", "android/assets/wraps/wrap1.jpeg"),
    FoodItem("Item 2", "android/assets/wraps/wrap2.jpeg"),
  FoodItem("Item 3", "android/assets/wraps/wrap3.jpeg"),
  FoodItem("Item 5", "android/assets/wraps/wrap1.jpeg"),
 FoodItem("Item 6", "android/assets/wraps/wrap1.jpeg"),
   FoodItem("Item 7", "android/assets/images/lunch.jpeg"),
    FoodItem("Item 8", "android/assets/images/lunch.jpeg"),
    FoodItem("Item 9", "android/assets/images/lunch.jpeg"),
  FoodItem("Item 10", "android/assets/images/lunch.jpeg"),
 ];

   class FoodItemWidget extends StatelessWidget {
  final FoodItem item;

const FoodItemWidget({Key key, this.item}) : super(key: key);

          @override
       Widget build(BuildContext context) {
     return MaterialApp(
       home: Scaffold(
       body: Column(
         children: <Widget>[
      Image.asset(item.imageAssetPath),
      Text(item.name, style: TextStyle(fontSize: 24.0, fontWeight:
FontWeight.bold),),

           decor(),
           decor(),
           decor(),
           decor(),
           decor(),
         ],

       ),

    ),
  );
}
}

enter image description here

A: Instead of using a Column widget, you might use ListView Widget, that works similarly but bring you to use scroll behavior
ListView(
    padding: const EdgeInsets.all(8),
        children: <Widget>[
            decor(),
            decor(),
            decor(),
            decor(),
            decor(),
    ],
)


text:
Q: what is result $T(n)=\sum_{i=1}^n T(i-1) T(n-i)$ What is result following forlmula?
If suppose $n=5$
$T(n)=\sum_{i=1}^n T(i-1) T(n-i)$
Now every $T$ call again $T(n)=\sum_{i=1}^n T(i-1) T(n-i)$
and we can't get exactly number!
I mean we can't get number from every $T$
So what is the result in the forlmula with $n=5$ ?


text:
Q: gtk 3 popup menu I am programming GTK 3.4 with python (with GObject introspection).
I don't understand why the menu created in the cb2 function does not show, or sometimes flashes and disappears, while clicking on bc1 works fine.
The program don't know all items to put on the menu before the user clicks the button.
Any ideas?
#!/usr/bin/python

from gi.repository import Gtk

def create_menu():
    m = Gtk.Menu()
    item = Gtk.MenuItem(u"piano")
    m.append(item)
    m.show_all()
    return m

menu1 = create_menu()

def cb1(widget):
    menu1.popup(None, None, None, None, 0, 0)
    return True

def cb2(widget):
    menu2 = create_menu()
    menu2.popup(None, None, None, None, 0, 0)
    return True

w = Gtk.Window()
grid = Gtk.Grid()
w.add(grid)

b1 = Gtk.Button("cb1")
grid.add(b1)
b1.connect('clicked', cb1)

b2 = Gtk.Button("cb2")
grid.add(b2)
b2.connect('clicked', cb2)

w.connect('destroy', Gtk.main_quit)
w.show_all()
Gtk.main()

A: I am not familiar with the python bindings
Don't create the menu within the callback, just populate it with items
m = Gtk.Menu()

def populate_menu(widget)
  item = Gtk.MenuItem(u"piano")
  m.append(item)
  m.show()
  return True

w = Gtk.Window()
grid = Gtk.Grid()
w.add(grid)

b1 = Gtk.Button("foofoo")
grid.add(b1)
b1.connect('clicked', populate_menu)
...


text:
Q: Convert JSON to Different Json Format I want to convert my JSON Array in different manner.
My Actual array like as below :
[["Feb 18, 2016 11:53:49 AM", 12], ["Feb 18, 2016 11:54:49 AM", 30]]

And i want it like as below :
{
"data": [["Feb 18, 2016 11:53:49 AM", 12], ["Feb 18, 2016 11:54:49 AM", 30]]
}

Please advice.

A: Your element [["Feb 18, 2016 11:53:49 AM", 12], ["Feb 18, 2016 11:54:49 AM", 30]] is not a Json array, but simply an array.
To verify if your element is an array you may write in the browser console:
Array.isArray(yourarray)
To convert it to a JSON object you need simply create the object and to print you may use the JSON.stringify.

var arr = [["Feb 18, 2016 11:53:49 AM", 12], ["Feb 18, 2016 11:54:49 AM", 30]];
var result = {'data': arr};
document.write(JSON.stringify(result));


text:
Q: Linking in several C object files that contain functions with equivalent signature Lets say I have a C++ program and I want to call functions from a C object file in it. The constraint is that I'm not allowed to make any changes to the C source files.
In this case I would include the C header as extern "C" in my C++ file, call the function, compile the C object using gcc -c, and pass the result to g++ along with the actual C++ sources.
I guess what I would also do is to put the C-header #include inside a named namespace block in the C++ file, as to keep the local namespace clean (who knows what other fancy stuff there is in the .h file).
What now if I need to call functions from two C object files. Lets say that they have different signatures. But there are also some duplicate functions in the object files. Wouldn't my linker blow up at this point if I tried to pass both objects to g++ at the same time? Same for globals.
Again: I'm not allowed to change ANY of the C sources. Else I would just rename the .c files to .cxx, wrap their contents and the contents of the corresponding headers inside namespace bla { } and feed everything to g++.
(Yes, C is not a subset of C++, as has already been mentioned in one of the comments)

A: Your last paragraph has a good solution - why not make a C++ file something like this:
namespace c_namespace_1 {
    #include "CFile1.c"
}

namespace c_namespace_2 {
    #include "CFile2.c"
}

And so on.... then you could compile this file as C++ and not have to modify the original sources.

A: You could bring the C executable codes in as individual binary data files and handle the function pointer casting yourself - basically do the linker's job for it.  If the binary directly wouldn't work, get the assembler output of the C files and wrap them in functions similiar to the above suggestion of namespaces.

A: How about compile each C subsystem to its own LIB file, then compile a separate C++ LIB file that includes the appropriate C LIB and provides wrapped function calls to only the C functions in its .LIB
ie:
file1.c => file1.lib
file2.c => file2.lib

Wrapper1.cpp + file1.lib => Wrapper1.lib
Wrapper2.cpp + file2.lib => Wrapper2.lib

Application.cpp + Wrapper1.lib + wrapper2.lib => Application.exe

Note that this off the top of my head and I have no idea if the linker will still go boom
Of course you could compile Wrapper1 and Wrapper2 to dll's instead of Lib's and that would ensure the linker doesn't go boom!

A: This is pretty hacky, but one solution is to rename the function(s) in question via macros, so that they have different names as far as the linker is concerned.
For example, if you have too functions called foo, one of which takes an int and the other of which takes a double, in files IntFoo.c and DoubleFoo.c, you can compile them like this:
cc -Dfoo=IntFoo -o IntFoo.o IntFoo.c
cc -Dfoo=DoubleFoo -o DoubleFoo.o DoubleFoo.c

Then in your C++, you can do this:
#define foo IntFoo
extern "C" {
    #include "IntFoo.h"
}

#define foo DoubleFoo
extern "C" {
    #include "DoubleFoo.h"
}

#undef foo

There are lot of caveats here: you have to ensure that the symbol foo is used only as the name of the function you want, you have to ensure that you define the macros appropriately everywhere that the symbol foo is used.  If there are duplicate symbols, you have to define macros for those as well.
It is probably a much better solution to just fix the C files.


text:
Q: Switching Permissions of User Files I am new to Bash and trying to write a find command that finds all files that don't have read, write, or execute permissions for the user, and then changes the mode to enable read access.
I've tried a few different ways including:
find . ! -perm /u+rwx | -exec chmod u+r {} \;
Am I on the right track?


text:
Q: magento 1.9 admin is disabled . How to enable backend again? today is magento 1.9.3 admin showing a blank page. I suppose that it is because magento 1 is not supported anylonger. However for some personal reasons, I can't go to magento 2 ! How can I enable magento 1 admin ? Thanks

I uploaded saved site and database from 3 days ago as admin were working ok ... But admin is still not working !

A: I confirm that there are no exceptions log. I can connect to admin url with login and password. But while logged, Linking to catalog, categories, orders etc ... nothing happens, admin page is still blank, whatever I click on ! all of my 4 magento 1.9.3 sites have the same trouble. Any idea ? If not because of the end of the support ... what else ? Many thanks


text:
Q: PHP select data from table, not working Ok so i don't really know PHP, when someone submits a form, it needs to check if that datetimestamp is already in the mysql table or not then do something.
localhost.php:
<?php
$hostname_localhost = "localhost";
$database_localhost = "bookings";
$username_localhost = "username";
$password_localhost = "password";
$localhost = mysql_pconnect($hostname_localhost, $username_localhost, $password_localhost) or trigger_error(mysql_error(),E_USER_ERROR);
?>

Main file:
<?php require_once('../Connections/localhost.php'); ?>
<?php
$date = $_POST['date'];

$result = mysql_query("SELECT * FROM `bookingtable` WHERE `Date of Session` = '$date'");
if(mysql_num_rows($result) > 0) {
    echo 'the date was found, please try another';
} else {
    echo 'the date wasnt found';
};
?>

It used to work but now it just always says thats it's not in the table when it actually is.

A: write the following line at end of localhost.php
mysql_select_db($database_localhost);

A: Try this code:
Localhost.php
   <?php
        $hostname_localhost = "localhost";
        $database_localhost = "bookings";
        $username_localhost = "username";
        $password_localhost = "password";
        $tablename_localhost = //your name of your table from database
        $localhost = mysql_pconnect($hostname_localhost, $username_localhost, $password_localhost, $tablename_localhost) or trigger_error(mysql_error(),E_USER_ERROR);
   ?>

Main.php
    <?php require_once('../Connections/localhost.php');

     $date = $_POST['date'];

     $result = mysql_query($localhost, "SELECT * FROM bookingtable WHERE Date of Session = '$date'");

     if(mysql_num_rows($result) > 0) {
         echo 'the date was found';
     } else {
          echo 'the date wasnt found';
     };
 ?>


text:
Q: Where does the Sith tradition of having a pseudonym come from? Sheev Palpatine had the pseudonym Darth Sidious, Anakin Skywalker had Darth Vader and Hego Damask was Darth Plagueis. But where does the tradition of having a pseudonym come from and why?
My first intuition: during the Galactic Republic, they had to hide their true identities. But then, Dessel used Darth Bane even before he started the Rule of Two and went underground and even earlier, there were others like Darth Nihilus. So, it can't be simply a "It is useful to hide as a Sith and avoid being identified if somebody overhears the name"-thing.
Canon answer if possible, Legends is accepted if no Canon answer exists.

A: Most likely a large part of why Sith do this is because they feel that they are truly different people then they were before, and do not want to continue using the same names. Throughout the Star Wars films, there is an emphasis on the fact that when someone falls to the Dark Side they become someone different then they were before, from a certain point of view. For example, Obi-Wan says that Luke's father was dead because he fell to the Dark Side, and Darth Vader himself refused to go by Anakin Skywalker anymore; he was simply Darth Vader. Another example would be Ben Solo going by Kylo Ren, even though he wasn't a Sith he still took on a new name when he joined the Dark Side, and then in Rise of Skywalker

He comes back to the Light Side and switches his name back to Ben.

It seems that it's more of a Dark Side thing then specifically a Sith thing. See here for the difference between Sith and Dark Jedi. Most Dark Jedi seem to do this but as we'll see in a moment not all of them do...
Now as for when this started I'm not completely sure. In Legends the farthest back my knowledge goes is Knights of the Old Republic I and II. There are 5 Sith Lords in these games.
Darth Sion: it's unclear whether or not Sion was his birth name
Darth Nihlus: This likely was not his birth name, but it's never stated.
Darth Traya: Traya is likely not her birth name, most of the game she goes by the name

 Kreia

But she lies a lot in the game so it's possible that Traya is her real name and the other is a pseudonym
Darth Malak and Darth Revan: Malak and Revan were their real names. However Kreia theorizes in the second game that Revan never truly 'fell' but that he was the same person as before, and joined the Sith to stop a greater evil. If so that would explain why he stuck with his same name, and Malak likely did the same since he was his apprentice and wanted to emulate him.
So it almost certainly started at the latest when Darth Nihlus, Darth Sion, and Darth Traya fell, likely shortly after or during the Mandalorian War, but it quite possibly started before then.
In canon, all I really know about would be from the movies and every Sith in them takes on a pseudonym, it's possible Darth Maul's name is Maul since it's never stated in the movies and I don't know what it is, but it's unlikely since every other Sith has taken on a pseudonym.


text:
Q: wp_filter_kses allow HTML5 video? Is there a way to allow my users to add HTML5 video tag (without shortcodes) into my textfield/textarea?
Allowed anchor styles and bold tags are working, but as soon I add 'video' and 'source' it doesn't work anymore:(
Any help is appreciated. Thx.
function validate_setting($plugin_options){
    //This Works
    $allowed_html = array(
     'a' => array(
    'href' => array (),
    'title' => array ()),
    //This works also
    'b' => array(
    'style'=> array(),
    ),
     //This is not working...
    'video' = array(
    'width' => true,
    'height' => true
     ),
     //This also is not working...
    'source' = array(
    'src' => true,
    'type' => true
     ),
     );

$plugin_options['text_area']= wp_kses($plugin_options['text_area'],$allowed_html);
return $plugin_options;
}

A: Ok This Thread did helped me a LOT!
So now my function works (i can embeld HTML5 videos) and it looks like this:
function validate_setting($plugin_options){

global $allowedtags;
$allowedtags = array(
'a' => array(
'href' => array (),
'title' => array ()),
'b' => array(
'style'=> array(),
),
);

$allowedtags['video'] = array(
    'width' => true,
    'height' => true
);
$allowedtags['source'] = array(
    'src' => true,
    'type' => true
);

$plugin_options['text_area'] = wp_kses($plugin_options['text_area'],$allowedtags);
 return $plugin_options;
}


text:
Q: Spring NullPointerException despite the relevant annotations used I'm trying to do simple login in vaadin but when I'm trying login I got the NullPointerException. Don't know why my @autowired object is not created. I've got the @Component annotation on CustomerService. Checked the SQL statements, they are ok I suppose. I tried also to remove customer variable and use just service method but the result was the same...
CustomerService code:
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class CustomerService {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public List<Customer> findAll() {
        return jdbcTemplate.query(
                "SELECT id, first_name, last_name, email, phoneNumber, login, password FROM customers",
                (rs, rowNum) -> new Customer(
                        rs.getLong("id"),
                        rs.getString("first_name"),
                        rs.getString("last_name"),
                        rs.getString("email"),
                        rs.getString("phoneNumber"),
                        rs.getString("login"),
                        rs.getString("password")));
    }

    public Customer find(String login, String password){
        return jdbcTemplate.queryForObject("SELECT id, first_name, last_name, email, phoneNumber, login, password FROM customers WHERE login='"
                + login + "' AND password='" + password + "'", Customer.class);
    }

    public void create(Customer customer){
        jdbcTemplate.update(
                "INSERT INTO customers (first_name, last_name, email, phoneNumber, login, password) VALUES ('"+
                        customer.getFirstName() + "','"+ customer.getLastName()+ "','"+ customer.getEmail()+ "','" +
                        customer.getPhoneNumber() +"','" + customer.getLogin() + "','" + customer.getPassword()+"')");
    }
}

Login code:
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.spring.annotation.SpringView;
import com.vaadin.ui.*;
import org.springframework.beans.factory.annotation.Autowired;

@SpringView(name = "LoginView")
public class LoginView extends VerticalLayout implements View{

    @Autowired
    private CustomerService service;

    private Customer customer;

    private TextField login;
    private PasswordField password;
    private Button loginBtn;
    private Button registerBtn;

    protected void init() {
        login = new TextField("Login");
        password = new PasswordField("Password");
        loginBtn = new Button("Sign in");
        registerBtn = new Button("Register");
        HorizontalLayout buttons = new HorizontalLayout(loginBtn, registerBtn);
        loginBtn.addClickListener((Button.ClickListener) clickEvent -> login());
        registerBtn.addClickListener((Button.ClickListener) clickEvent -> register());
        this.addComponents(login, password, buttons);
        this.setComponentAlignment(login, Alignment.TOP_CENTER);
        this.setComponentAlignment(password, Alignment.TOP_CENTER);
        this.setComponentAlignment(buttons, Alignment.TOP_CENTER);
    }

    private void login(){
        customer = service.find(login.getValue(), password.getValue());  // <== Here I got Null Exception
        if(customer==null){
            Window popup = new Window();
            popup.setContent(new Label("User not found!"));
            popup.setVisible(true);
            popup.center();
            getUI().addWindow(popup);
        } else {
            getUI().setContent(new BookView(customer));
        }
    }
    private void register(){
        Window popup = new Window();
        popup.setContent(new RegisterView());
        popup.setVisible(true);
        popup.center();
        getUI().addWindow(popup);
    }

    @Override
    public void enter(ViewChangeListener.ViewChangeEvent viewChangeEvent) {
        init();
    }

    LoginView(){
        init();
    }
}

EDIT:
MainUI class:
@SpringUI
public class MainUI extends UI {

    @Override
    protected void init(VaadinRequest vaadinRequest) {

        setContent(new LoginView());
    }
}

A: The NullPointerException is caused by the way that you initialise the view. If you make a new Spring will not be aware of this and the dependencies will not be injected. If you want to create a new instance on runtime, you can do that using the ApplicationContext. Alternatively, if you need a single instance, you can autowire the dependency directly. Change your MainUI as follows:
@SpringUI
public class MainUI extends UI {
    @Autowired
    LoginView loginView;

    @Override
    protected void init(VaadinRequest vaadinRequest) {

        setContent(loginView);
    }
}

In LoginView Class, you don't need the constructor and you can annotate the init() method with @PostConstruct so that it gets called just after initialization.
@SpringComponent
@Scope("prototype")
public class LoginView extends VerticalLayout implements View{

    @Autowired
    private CustomerService service;

    private Customer customer;

    private TextField login;
    private PasswordField password;
    private Button loginBtn;
    private Button registerBtn;

    @PostConstruct
    protected void init() {
        login = new TextField("Login");
        password = new PasswordField("Password");
        loginBtn = new Button("Sign in");
        registerBtn = new Button("Register");
        HorizontalLayout buttons = new HorizontalLayout(loginBtn, registerBtn);
        loginBtn.addClickListener((Button.ClickListener) clickEvent -> login());
        registerBtn.addClickListener((Button.ClickListener) clickEvent -> register());
        this.addComponents(login, password, buttons);
        this.setComponentAlignment(login, Alignment.TOP_CENTER);
        this.setComponentAlignment(password, Alignment.TOP_CENTER);
        this.setComponentAlignment(buttons, Alignment.TOP_CENTER);
    }

    private void login(){
        customer = service.find(login.getValue(), password.getValue());
        if(customer==null){
            Window popup = new Window();
            popup.setContent(new Label("User not found!"));
            popup.setVisible(true);
            popup.center();
            getUI().addWindow(popup);
        } else {
            getUI().setContent(new BookView(customer));
        }
    }
    private void register(){
        Window popup = new Window();
        popup.setContent(new RegisterView());
        popup.setVisible(true);
        popup.center();
        getUI().addWindow(popup);
    }

    @Override
    public void enter(ViewChangeListener.ViewChangeEvent viewChangeEvent) {
        //init();
        //This init can be removed because with the current scope a new instance will be returned every time
    }

}


text:
Q: Moving rows up and down in an EditorGridPanel Does anyone have/know of a working example of a moving rows within an EditorGridPanel (or know why it's not working for me)?
I've found few examples, and the ones I've found use this approach:
// calculate the new index, then remove the record from the store, and re-insert it at the new index
grid.getStore().remove(record);
grid.getStore().insert(index, record);

In my case this fails. It looks good in the grid, but 2 DELETE http requests actually get sent to the server, and no PUT. This becomes evident when I reload the page - the moved row has actually been deleted.
He're the basic config of my store:
var remoteJsonStore = new Ext.data.JsonStore({
            storeId: 'colStore',
            autoDestroy: false,
            autoSave: true,
            proxy: new Ext.data.HttpProxy({url:'/exercises/collect/data_rows'}),
            restful: true,
            format: 'json',
            disableCaching: false,
            autoLoad: true,
            writer: new Ext.data.JsonWriter({
              encode: false
            }),
            root: 'data',
            idProperty: 'data_row_id',
            fields: recordFields,
            baseParams:{section_id:GridUtils.properties[gridId]['section_id']},
            listeners:{
              exception:function(misc){
                 // stuff....
              },
              beforewrite:function(store, action, rs, options, arg){
                this.baseParams["position"]=rs.rowIndex;
              },
              beforesave:function(store, data){
                 // stuff....                }
              }
            }
});

A: I had a similar problem when implementing a DnD reordering view. The problem is that the store marks every remove()d record for delete, even if you re-insert it.
Reading the source of Ext.data.Store's remove() method, I found a solution:
remove: function(records, /* private */ isMove) {

See? We can pass a second boolean agument to tell the store we are just moving the record! But being marked as private and not documented, we should take care when upgrading to a new version of the framework.
So the final solution is:
grid.getStore().remove(record, true); // just moving
grid.getStore().insert(index, record);

ExtJS version: 4.1


text:
Q: Can I use both dir and buildFile in a GradleBuild task? I am trying to call a gradle task from a sub directory, using a different builg.gradle file.
I have the following task:
task(subTask, type: GradleBuild) {
    dir = new File(project.projectDir, "db/" + project.dbName)
    buildFile = new File(project.projectDir, "build.gradle.subdir")
    tasks = [params,...]
    startParameter.projectProperties = [env: project.env]
}

I can either pass 'dir' or 'buildFile', but when I pass both, then the projectDir will be the directory where the passed 'buildFile' resides and not the one I pass as 'dir', and I would like them to be in 2 different directories, as seen in the above task. Any idea how could this be done?
update:
so I have the following files:
build.gradle
build.gradle.subdir
db/dbA/
db/dbA/gradle.properties
db/dbB/
db/dbB/gradle.properties
because of some historic things currently we do the following:
cp build.gradle.subdir db/dbA/build.gradle
cd db/dbA
../gradlew task...
and I need to do it for each sub-directory under db
So I thought I might do at least 1 step further (although still hacky) and eliminate the need of an external shell script to do the loop over the directories, and the copy, cd.
I am almost there:
I am able to manually copy the build.gradle.subdir and then the above task (without passing buildFile) works
OR
I can pass buildFile, but not the dir, in which case it starts to run the task, but it doesn't read db/dirA/gradle.properties, which is needed to do the task.

A: The project directory must be the same directory as the directory containing the build script and gradle.properties file. You'll have to find a different solution to your problem.


text:
Q: Keepass program removed and certain folders are still password protected I had installed Keepass and set up a master password, then tried to set up one application which didn't work.  Because it didn't seem to work the way I had expected, I uninstalled the program.
Afterwards, I realized that Windows folders like My Music & My Pictures etc were locked.  Is there any way to get access to these folders?

A: Keepass does not encrypt files or folders, it is simply a tool for keeping your passwords safe and organised.
If you installed a program that locked and/or encrypted your files, a solution really depends on the program you used.
If it simply changed NTFS permissions or similar, it is a trivial task. If however you used something like True Crypt, you could have set up full encryption and you will need your keys to unlock.
In any situation, the best case is to re-download the original tool and try to undo the changes you made.
If this is not possible, we really need more information to help you further such as the name of the program you used and/or what you did.


text:
Q: How can I say that someone is taking too long? What should I use when I want to say that someone is taking too long?
I have seen different ways and I don't know which of these I should use.
At the moment of speaking

What takes you so long?
Why does it take you so long?

 Past action

What took you so long?
Why did it take you so long?

So can I say:

Why do girls take so long to get ready?
  or
  What takes girls so long to get ready?

Sorry but I couldn't come up with better examples.
It will be great if you can help me. Thank you!

A: Ngrams clearly show that "what is taking you so long" is probably your best bet for the situation at the moment of speaking.
(I had to shorten the phrase because ngrams can't be more than 5 words. I presume that the results for "takes you so long" mainly pertain to situation when it regularly takes someone too long to do something (which is the default use of Present Simple), e. g., "I'd love to have you help me, but it usually takes you so long."
So when you are speaking about a specific situation that is in progress right now, you should use Present Continuous: "what's taking you so long".
But your sentence

Why do girls take so long to get ready?

implies that it usually, regularly  takes them too long. Present Simple is the correct tense to use in this situation.
Regarding "what" vs "why", I'd say they are more or less interchangeable when we are speaking in the moment. In the "girls usually take longer" example, the specific reason (what) can be very different (can't find the dress; messed up her makeup and has to re-do it; grabbed a bag and its handle broke, so she had to fix the handle; etc. etc. etc.).
"What" usually implies that you are asking for a specific reason. So it would be more often used "in the moment". "Why" usually invites philosophizing about some general trends in someone's speed of preparation. That is why, semantically, in your example about girls (where Present Simple is used), "why" is a better choice.
In your first two sentences, both "why" and "what" could be appropriate (with "why" being sort of a "You always take so long, and you are now taking too long, too, WHY OH WHY?" question; and "what" asking about a specific reason), but you need to use Present Continuous.


text:
Q: Python- how to compare values that change with each iteration of loop on dictionary? Given a dictionary (db) and string (type), my function needs to search through the whole dictionary and find all items that have string(type) as their ONLY type, find all items that have type as 1/2 of their types, and sums the two values. Then it must return the tuple of the statistics.
I'm hung up on how to keep track of the counter and the function is returning incorrect tuples. I think my structure may be sound but I know it's not working properly. How can I fix this? What will help me keep track of the counter? Is my issue with the if statements not checking correctly?
Here is my current code:
def count_by_type(db,type):
    only_type=0
    half_type=0
    for key, values in db.item():
        if type in values[1] or values[2]:
            half_type+=1
        if type in (values[1] or values[2]) and (values[1] or values[2]==None:)
            only_type+=1
    my_sum=half_type+ only_type
    return (only_type, half_type, my_sum)

Here is an example of expected input/output:
db={'bulb':(1,'Grass','poison', 1, False),
    'Char':(4, 'poison','none', 1, False)}

types='poison'

'char' has poison as its only type, only_type+=1
'bulb' has poison as 1/2 of its types, half_type +=1
my_sum=2
return: (1,1,2)

A: There were a few syntax issues in your code that were causing the logic to not evaluate as you expected.  Here is corrected code.
Code:
def count_by_type(the_db, the_type):
    only_type = 0
    half_type = 0
    for values in the_db.values():
        if the_type in (values[1], values[2]):
            if None in (values[1], values[2]):
                only_type += 1
            else:
                half_type += 1

    return only_type, half_type, half_type + only_type

Test Code:
db = {
    'bulb': (1,'Grass', 'poison', 1, False),
    'Char': (4, 'poison', None, 1, False)
}

print(count_by_type(db, 'poison'))

Results:
(1, 1, 2)