text:
Q: RHEL6 - disable the tiered-progress bar during boot How do you get RHEL6 to display the "traditional" display of startup information instead of the tiered/stacked progress bar?
The standard info dump is displayed during shutdown.

A: plymouth-set-default-theme text
/usr/libexec/plymouth/plymouth-update-initrd

or, remove "rhgb quiet" from the Grub configuration (/boot/grub/menu.lst).

A: The program that shows you the fancy loading screen is called Plymouth.
See if you can find it with checkconfig --list, and disabled the service if needed.
If that isn't the cause, it's probably the "quiet" option in Grub.
Disable it by removing the word quiet from the boot options in your /boot/grub/menu.lst file.

A: Just found this method, and it seems the cleanest way:
grubby --update-kernel=ALL --remove-args="rhgb quiet"

A: If you boot in text mode which is how most servers would be set up you have to do the following.  In text mode, plymouth paints a colorful text bar which is difficult to completely remove.  It's NOT in chkconfig and disabling "rhgb" and "quiet" do not disable this feature.  Here's how to do it properly in CentOS 6.x.  Steps 1 and 2 also disable features that can cause trouble on a server or virtual machine that should not be provisioned with a graphical console.
1) Remove rhgb and quiet from the "kernel" line(s) in /boot/grub/grub.conf.
2) Remove or comment out the splashimage and hiddenmenu lines.
3) Type plymouth-set-default-theme details --rebuild-initrd.
4) Restart and see if it works.
On the bright side the boot time messages are all saved in /var/spool/plymouth/boot.log and /var/log/boot.log.
When I think about it a little more, I realized that since I'm usually not in front of the server's screen anyway, the plymouth system is not a terrible thing.  However, when I'm debugging startup problems when I am in front of the server's screen, plymouth is a nuisance that should have been made easier to remove.

A: Actually, removing rhgb, which I presume stands for "RedHatGraphicalBoot" solved this issue for me on CentOS6.
Just add this line to your post install ks.conf script:
#Save original, just in case
rsync /boot/grub/grub.conf /boot/grub/grub.conf.orig
#edit and output to /tmp/grub.conf
cat /boot/grub/grub.conf |sed -e s/rhgb// > /tmp/grub.conf
#replace & remove temp
cat /tmp/grub.conf > /boot/grub/grub.conf ; rm -f /tmp/grub.conf

A: Or in one line (less maintenance and at least as easy to understand):
sed -i .orig s/rhgb///g /boot/grub/grub.conf

Creates a backup first, and edits the file inline.


text:
Q: Does $\mathbb E[X] < \infty$ imply that $\mathbb E[e^X] < \infty$? Let $X$ be a non-negative random variable with finite expectation. Is this sufficient to say that $\mathbb E[e^X] < \infty$?
Jensen's equality clearly shows that if $\mathbb E[X] = \infty$ then also $\mathbb E[e^X] = \infty$, but is the converse true?

A: No. We might have $P(X=n)=2^{-n}$. Then $\Bbb E[X]=2$ and $\Bbb E[e^X]=\sum_n 2^{-n}e^n=\infty$

redpajama_set_name: RedPajamaStackExchange


text:
Q: Как проверить тип установленной модели в QTableView для организации ветвления Есть представление QTableView, оно отображает модель QSqlTableModel. Организован поиск через QSortFilterProxyModel, и результаты поиска помещаются в тот-же QTableView. Для редактирования записей создана форма QDataWidgetMapper.
Необходимо проверить, какая сейчас модель активна в QTableView, и на основании этого вызвать правильную привязку QDataWidgetMapper.
Код методы вызова формы:
void MyForm::setMyModel(MySqlTableModel *myModel)
{
    this->initForm(myModel);
    this->init();
}

void MyForm::setMyProxyModel(QSortFilterProxyModel *proxy)
{
    this->initForm(proxy);
    this->init();
}

А тут должна быть правильная проверка:
void MainWindow::on_tableViewUi_doubleClicked(const QModelIndex &index)
{
    this->myEditForm = new MyForm();
    this->myEditForm->setParent(this, Qt::Window);
    this->myEditForm->setWindowModality(Qt::WindowModal);

    qDebug() << "Я ТУТ" << this->ui->tableViewUi->selectionModel()->model();
//возвращает модель
    if(this->ui->tableViewUi->selectionModel()->model() == QSqlTableModel//не работает)
//а вот как проверить и выполнить if???
    {
        this->myEditForm->setMyModel(this->mySqlTableModel);
    }
    if(this->ui->tableViewUi->selectionModel()->model() == QSortFilterProxyModel) //не работает...
    {
        this->myEditForm->setMyProxyModel(this->sortModel);
    }
    this->myEditForm->getMyMapper()->setCurrentModelIndex(index);
    this->myEditForm->show();
}

A: В Qt все модели являются наследниками QAbstractItemModel, которая в свою очередь наследуется от QObject. Соответственно становится возможной проверка типа объекта посредством метода QObject::inherits():
QAbstractItemModel *model = this->ui->tableViewUi->selectionModel()->model();
if(model->inherits("QSqlTableModel") == true) { ... }
else if(model->inherits("QSortFilterProxyModel") == true) { ... }

A: Задача решена. Весь вывод из всех методов осуществить через QSortFilterProxyModel и проверки становятся не нужны.


text:
Q: How to choose text we input in a dropdown using vba in selenium? So this is my first time writing VBA Selenium code based on what i learned from youtube. Basically it works great but then i have a minor hiccup that i couldn't resolve until now.
The problem is i couldn't choose what i input in the dropdown box.
This is the condition after i paste the agent code that i wanted (https://prnt.sc/1yrd0m6)
The agent code that i wanted is on the list but it's located on the bottom (https://prnt.sc/1yrdbq3)
So how do i choose that specific agent code?
Can anyone help me?
HTML
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="select2-input ignore-validation" role="combobox" aria-expanded="true" aria-autocomplete="list" aria-owns="select2-results-1" id="s2id_autogen1_search" placeholder="" aria-activedescendant="select2-result-label-10200">

My Code
Option Explicit
Private cd As selenium.ChromeDriver
Sub Reassign()

    Dim FindBy As New selenium.By
    Dim lr As Long, i As Long
    Dim t As Long
    Dim Agent As Variant
    Dim opl As selenium.WebElement

    Set cd = New selenium.ChromeDriver

    cd.Start
    cd.Get "http://ekiwi.id.tmsapp.net/index.php"
    cd.Wait (3000)

    'If different user please change username and password
    cd.FindElementByName("username").SendKeys "teamlead333@ekiwiID.com"
    cd.FindElementByName("password").SendKeys "dePMlQ60jL"
    cd.FindElementByCss("#loginFormDiv > form > div:nth-child(6) > button").Click
    cd.Wait (3000)
    cd.FindElementByCss("#sidebarnav > li:nth-child(5) > a > i").ClickDouble
    cd.Wait (3000)
    cd.FindElementByCss("#sidebarnav > li:nth-child(5) > ul > li:nth-child(2) > a > i").Click
    cd.Wait (3000)
    cd.FindElementByCss("#appnav > ul > div > button.btn.module-buttons.btn-bhs.btn-filter-header.filter > span").Click
    cd.Wait (3000)

With Sheet1

lr = Sheet1.Cells(Rows.Count, "B").End(xlUp).Row
Agent = Sheet1.Cells(Rows.Count, "D").End(xlUp).Row

t = 1

    For i = 3 To lr

    'Clear Filter
    cd.FindElementByCss("#appnav > ul > div > button.btn.module-buttons.btn-bhs.filter.btn-clear-filter > i").Click
    cd.Wait (3000)
    'Paste leadid from excel
    cd.FindElementByCss("#tblMailList0_wrapper > div:nth-child(2) > div > div > div.dataTables_scrollHead > div > table > thead > tr.bhs-filter.ddd > th:nth-child(2) > span > input").SendKeys .Cells(i, "B")
    'Enter function
    cd.FindElementByCss("body").Click
    cd.Wait (4000)
    'Select leadid by checkbox
    cd.FindElementByCss("#tblMailList0 > tbody > tr > td:nth-child(1) > input").Click
    cd.Wait (3000)
    'Reassign leadid
    cd.FindElementByCss("#btnReassign").Click
    cd.Wait (2000)
    cd.FindElementByCss("#s2id_selected-agent > a > span.select2-arrow > b").Click
    cd.Wait (2000)
    cd.FindElementByCss(".select2-input.ignore-validation.select2-focused").SendKeys .Cells(i, "D")
    cd.Wait (2000)
    cd.FindElementByClass("select2-result-label").Click
    cd.Wait (2000)
    cd.FindElementById("add-to-order-list").Click
    cd.Wait (2000)
    cd.FindElementByCss("#assign-agent").Click
    cd.Wait (2000)

    t = t + 1

Next

End With

cd.Close
MsgBox "Macro Done"

End Sub

A: EDIT
you replace the line  (not tested because no vba)
cd.FindElementByCss(".select2-input.ignore-validation.select2-focused").SendKeys .Cells(i, "D")

by
cd.FindElementByXPath("//ul[@id='select2-results-1']//div[text()='agentbk12']").click()

i have tested on python its functional, i think its the right syntax in VBA, you just adapt the creation of string xpath with your content of cellule excel
my python:
#Reassign leadid open popup
cd.find_element_by_css_selector("#btnReassign").click()
time.sleep(2)
#click inside popup to open all choices
cd.find_element_by_css_selector("#s2id_selected-agent > a > span.select2-arrow > b").click()
time.sleep(2)
#select the choice with text agentbk12 and click it to set the field
cd.find_element_by_xpath ("//ul[@id='select2-results-1']//div[text()='agentbk12']").click()


text:
Q: If $L\mid K$ is a finite extension of fields then K is perfect iff L is perfect
Problem: Let $L\mid K$ be a finite extension of fields. Then $K$ is perfect $\iff$ $L$ is perfect.

The implication $\implies$ is quite easy and it has already been discussed here.
I'm interested in the implication $\impliedby$ because of the following application:

Suppose $\text{char}(k)=p>0$. Then any finitely generated field extension $K\mid k$ that is perfect has $\text{tr.deg}_k(K)=0$.

For the proof of this recall that a purely trascendental extension is never perfect as $t_1$ is never a $p$-power in the field $k(t_1,\dots,t_n)$. Then if $K$ is a finite extension of a purely trascendental extension it wouldn't be perfect as well.
That can be restated in a neat way in the language of algebraic geometry:

If $\text{char}(k)>0$ then any $k$-variety with perfect function field must have dimension $0$.

Also it would be interesting to see if the equivalence in the problem is true if we change finite extension by algebraic extension. Again the implication $\implies$ is not so hard and has been discussed here.

A: Suppose $K$ is not perfect.  Then some $a\in K$ has no $p$th root in $K$.  I claim that the polynomial $f(x)=x^{p^n}-a$ is irreducible over $K$ for any $n\in\mathbb{N}$.  To prove this, let $b$ be a $p^n$th root of $a$ in an extension field of $K$ and note that $f(x)$ factors as $(x-b)^{p^n}$.  Let $g$ be the minimal polynomial of $b$ over $K$.  Then $g$ is the minimal polynomial of every root of $f$, so $f=g^m$ for some $m$.  Since $\deg f=p^n$, $m$ must be a power of $p$; say $m=p^d$.  We then have $g(x)=(x-b)^{p^{n-d}}=x^{p^{n-d}}-b^{p^{n-d}}$ and thus $b^{p^{n-d}}\in K$.  If $d>0$, we see that $(b^{p^{n-d}})^{p^{d-1}}=b^{p^{n-1}}$ is a $p$th root of $a$ in $K$, which is a contradiction.  Thus $d=0$ and $m=1$ so $f=g$ is irreducible.
Now if $L$ is a perfect extension of $K$, then $a$ must have a $p^n$th root in $L$ so $f$ must have a root in $L$.  Since $f$ is irreducible, this means $[L:K]\geq \deg f=p^n$.  Since $n$ is arbitrary, this means $[L:K]$ must be infinite.

A: In the answer of darij grinberg the following equality is given $[L:K]=[L^p:K^p]$ (for the proof notice that $K$-basis of the vector space $L$ correspond to $K^p$-basis of $L^p$ under Frobenius). Using this I think we can answer the problem in a really short way:
As we have the tower of extensions
$$K^p\hookrightarrow K\hookrightarrow L=L^p$$
we have that $[L^p:K^p]=[L:K][K:K^p]$ but as $[L:K]=[L^p:K^p]$ we conclude $[K:K^p]=1$.

A: Here is an argument that is simpler than @EricWofsey's, although it may well be equivalent to it in some way.
Assume that $L$ is perfect. We must prove that $K$ is perfect.
Assume the contrary. Thus, $K$ (and therefore $L$ as well) has characteristic $p$ for some prime $p$. Consider this $p$. Let $F$ denote the Frobenius endomorphism of any field of characteristic $p$; this sloppy notation is justified because the restriction of a Frobenius endomorphism to a subfield is always the Frobenius endomorphism of that subfield. Note that $F$ is always injective.
We have $F\left(K\right) = K^p \subsetneq K$ (since $K$ is not perfect). Thus, $F^i\left(F\left(K\right)\right) \subsetneq F^i\left(K\right)$ for each $i \geq 0$ (since $F$ is injective, and thus $F^i$ is injective). Hence, for each $i \geq 0$, we have $F^{i+1}\left(K\right) = F^i\left(F\left(K\right)\right) \subsetneq F^i\left(K\right)$. Hence, we have a chain $F^0\left(K\right) \supsetneq F^1\left(K\right) \supsetneq F^2\left(K\right) \supsetneq \cdots$ of fields. Since $L \supseteq K = F^0\left(K\right)$, we can extend this chain to a chain
\begin{equation}
L \supseteq F^0\left(K\right) \supsetneq F^1\left(K\right) \supsetneq F^2\left(K\right) \supsetneq \cdots .
\label{darij1.eq.chain1}
\tag{1}
\end{equation}
On the other hand, $F\left(L\right) = L^p = L$ (since $L$ is perfect), and thus (by induction) we see that $F^i\left(L\right) = L$ for each $i \geq 0$.
Now, let $d = \left[L : K\right]$. Also, let $i = d+1$. Thus, $d+1 = i < i+1$.
From $d = \left[L : K\right]$, we see that $L$ is a $d$-dimensional $K$-vector space. Hence, $F^i\left(L\right)$ is a $d$-dimensional $F^d\left(K\right)$-vector space (since $F$ is injective, and thus $F^i$ is injective). In other words, $L$ is a $d$-dimensional $F^i\left(K\right)$-vector space (since $F^i\left(L\right) = L$).
Moreover, from \eqref{darij1.eq.chain1}, we obtain
\begin{equation}
L \supseteq F^0\left(K\right) \supsetneq F^1\left(K\right) \supsetneq F^2\left(K\right) \supsetneq \cdots \supsetneq F^i\left(K\right) .
\label{darij1.eq.chain2}
\tag{2}
\end{equation}
This is a chain of fields, and thus is a chain of $F^i\left(K\right)$-vector subspaces of $L$ (because any field is a vector space over any of its subfields). All these subspaces have dimension $\leq d$ (since $L$ is a $d$-dimensional $F^i\left(K\right)$-vector space), and these dimensions must decrease by at least $1$ at each $\supsetneq$ sign. Thus, the chain \eqref{darij1.eq.chain2} yields the following chain of inequalities:
\begin{equation}
d \geq \dim\left(F^0\left(K\right)\right) > \dim\left(F^1\left(K\right)\right) > \dim\left(F^2\left(K\right)\right) > \cdots > \dim\left(F^i\left(K\right)\right)
\end{equation}
(where $\dim$ stands for dimension as $F^i\left(K\right)$-vector spaces). Thus, the $i+1$ integers $\dim\left(F^0\left(K\right)\right),\dim\left(F^1\left(K\right)\right),\dim\left(F^2\left(K\right)\right),\ldots,\dim\left(F^i\left(K\right)\right)$ must be distinct and must all belong to the set $\left\{0,1,\ldots,d\right\}$. Thus, this set $\left\{0,1,\ldots,d\right\}$ must contain at least $i+1$ distinct integers. But it does not (since its size is $d+1 < i+1$). This contradiction shows that our assumption was wrong. Hence, we have shown that $K$ is perfect.


text:
Q: CSS max-width property crashes everything I have a flex block, and some blocks inside it:

.flex.column {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
}
.listing-item {
    height: 225px;
    cursor: pointer;
    position: relative;
    width: 100%;
}
.listing-item {
    height: 225px;
    cursor: pointer;
    position: relative;
    width: 100%;
}

.flex {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

.group-reel {
    transform: translate3d(0px, 0px, 0px);
    position: absolute;
    height: 100%;
    width: auto;
}
.unbox-case .reel-item {
    height: 100%;
    width: 150px;
    padding: 2px;
}
.items-center {
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}
.justify-center {
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
}

What I have to do, is to make this flex block max-width 100%, but what I'm getting now you can see on a screenshot above. Also attaching a screenshot of structure of my flex-block and all inside elements:
click
When im trying just to add max-width 100% to .group-reel it make it looks like this:


text:
Q: Spring - @Value returns null I have a properties file under /src/main/resources/ and I want to load data from it using Spring.
In my Spring-context.xml I have this :
<context:property-placeholder location="classpath:UserUtil.properties" />

and also have <context:component-scan base-package="com.myApp" />
and in my class I load it like :
@Value("${injectMeThis}")
private String injectMeThis;

but the value is always null
EDIT:
to check if the value, I use this :
System.out.println(new myClass().getInjectMeThis());

A: System.out.println(new myClass().getInjectMeThis());

Spring will only parse @Value annotations on beans it knows. The code you use creates an instance of the class outside the scope of Spring and as such Spring will do nothing with it.
Assuming you have setup your application context correctly a @Value cannot be null as that will stop the correct startup of your application.
Your XML file contains a <context:component-scan /> assuming myClass is part of that package the easiest solution is to add @Component to myClass and then retrieve the instance from the context instead of creating a new instance.

A: In your class, add class level annotation @PropertySource("UserUtil.properties"). This should solve the problem.


text:
Q: Etymology of "Buff" and "Nerf" as used in video-game slang In video games, when the makers increase the power of something, it is sometimes referred to as a buff.  If they decrease the power of something, it is called a nerf or a de-buff.  This also applies to player abilities to temporarily increase or decrease their power.
Where do these terms come from?

A: Wikipedia gives info on origin and context of both terms:

Nerf (computer gaming):
In video gaming a nerf is a change to
  a game that reduces the desirability
  or effectiveness of a particular game
  element. The term is also used as a
  verb for the act of making such a
  change.The opposite of nerf is buff
  (in one of that term's two usages).
The term originated with Ultima
  Online, and refers to the Nerf brand
  of toys which are soft and less likely
  to cause serious injury.It is used in
  the context of virtual worlds such as
  MMORPGs (like UO) and MUDs, but has
  become a part of the general
  vocabulary of gamer slang and can be
  found in various places where
  adjustment of power levels from one
  version of a game to the next is
  relevant.
Buff (computer gaming):
Buff is a term used in some video
  games, especially MMORPGs and MUDs, to
  describe increases in the power of a
  game element. There are two main
  usages. The first describes a
  permanent (or at least indefinite)
  increase in power levels as a result
  of adjustments to game mechanics,
  usually in pursuit of game balance. In
  this usage, buff is the opposite of
  nerf. The second usage of buff
  describes an effect (usually cast as a
  spell) that temporarily enhances a
  player.

You can read the linked articles for more.
Online Etymology Dictionary has an entry for buff as well:

1570s, buffe leather, from M.Fr. buffle "buffalo" (15c., via It. from L. bufalus; see buffalo). The color term comes from the hue of buffalo hides (later ox hides); association of "hide" and "skin" led c.1600 to in the buff, and use of buff or suede to polish metal led to sense of verb "to polish with a buff" (1885). Related: Buffed;
  buffing. Buff-colored uniforms of N.Y.C. volunteer firefighters since 1820s led to
  meaning "enthusiast" (1903).
The Buffs are men and boys whose love of fires, fire-fighting and firemen is a
  predominant characteristic. [N.Y. "Sun," Feb. 4, 1903]
Adj. meaning "well-built, hunky" is from 1980s, from sense "polish, make attractive."

A: Nerf, I would assume, comes from the Nerf company who manufactured foam projectile toys and sports balls for safe, indoor play. To "nerf" an effect, is to decrease its potential destructive output.
Buff, refers to a buffer:

*

*a device or a piece of material for reducing shock or damage due to contact

*a means or device used as a cushion against shock

*something that serves as a protective barrier

*a person who shields another

In more general gaming terms, a buff is something that provides a beneficial status effect (usually temporarily or under certain conditions).

A: The Wikipedia article cut and paste is not incorrect, but neither is it very illuminating.
The noun "buff", in a game related context, is related to the verb "to buff".  The verb carries the same meaning as "to polish".  In a game, a buff is a bonus or other benefit applied to some object.  Using a verb as a noun is called nominalization, and it happens all the time in English.
The noun "nerf", which may be used equivalently as a verb, seems to have been used in print first around 2003, in a book called "Designing Virtual Worlds" by Richard Bartle.  "Now you're only making 40 UOC per pelt. What do you do? Either you accept the realities of the free market or you dash off an email to the community service team screeching 'Your STOOPID game NERFED snow wolves!!!'  Raph Koster, who's well known as a game designer, gives the following explanation of the etymology: "For the record, the term 'nerfing' entered online gaming vocabulary because of [Ultima Online]. At some point, we reduced the power of swords in melee combat, and players started complaining that they were hitting each other woth nerf swords. The rest is history."  Nerf, of course, is also a brand name for a line of foam toys such as swords.

A: Nerf is also the name of a brand of brightly-colored firearms that are aimed at the 8-12 year old demographic; as such, these toy guns were only capable of firing soft pellet darts made of foam.
So I guess you could say that by 'nerfing' a gameplay mechanic, it's in reference to making it less effective by any means possible.
Conversely, the word "buff" (which I would imagine is short for buffering), would act as the complete opposite; someone who is getting buff is building up their stats or characteristics.

A: The correct answer to this query has already been submitted, however, I would like to expand somewhat on the reply;
NERFED is a player-created term used to describe the reduced effectiveness of certain aspects pertaining to the player's acquired abilities or materials in a particular game.  This term is a negative response by the players to developers making adjustments for game balance in response to issues caused by the power of the ability or materials prior to the adjustments.
It is important to understand that if the developers made another choice and tried to power up the rest of the game to match the power of the unbalanced property, escalation would begin.  Often the developers are forced to make hard choices that players may be unhappy with but ultimately are there to maintain game playability over the longer term.


text:
Q: Copy View Definitions from Azure Synapse (SQL) to Snowflake Is there any method or tool to copy and/or convert view definitions from SQL to Snowflake? I am responsible for copying hundreds of views (definitions not data) from SQL to Snowflake and I am reaching out to ask if there is a "good" way to do this? I do have the SQL tables copied to Snowflake via Azure Data Factory, but I'm stuck on moving the view definitions over to Snowflake.
I tried selecting all the view definitions from SQL but that was unreliable. I tried Redgate but that didn't work. I googled this extensively


text:
Q: What's more efficient? Storing variable references vs not (Context in Android) Let's say we are in the middle of a method. And I have a choice between two styles of programming.
Option A: use getContext().getResources() every time I need to access resources
public void doSomeStuffA(){
  //...
  getContext().getResources().getDrawable(R.drawable.ic_launcher);
  getContext().getResources().getDrawable(R.drawable.ic_arrow);      //...
}

Option B: Store getContext().getResources() in a variable.
public void doSomeStuffB(){
  //...
  Resources r = getContext().getResources();
  r.getDrawable(R.drawable.ic_launcher);
  r.getDrawable(R.drawable.ic_arrow);
  //...
}

Which style is better?

A: Like so much in performance and tuning, the correct answer is "it depends".  99 percent of the time, the difference between an extra hashmap dereference versus a variable reference is not the biggest (or even noticable) performance issue.  The trick is to understand when it is likely to be an issue (frequent calls in tight loops for example).
Within a single method, I would tend to use option B primarily for readability.

A: As a general practice (Not in particular this case)
Use Option A:

*

*Resources keep on changing and you want the most recent value of resource.

*If you are calling methods on resource just once.
Use Option B:

*

*Resources don't change then you can use a reference and use it wherever you want.

A: Use Kotlin to make everything neat and clean )
fun someFun() {
    with(getContext()) {
        var d1 = getDrawable(R.drawable.ic1)
        val d2 = getDrawable(R.drawable.ic2)
        ...
    }
}


text:
Q: Replace multiple strings with multiple values in Julia In Python pandas you can pass a dictionary to  df.replace in order to replace every matching key with its corresponding value. I use this feature a lot to replace word abbreviations in Spanish that mess up sentence tokenizers.
Is there something similar in Julia? Or even better, so that I (and future users) may learn from the experience, any ideas in how to implement such a function in Julia's beautiful and performant syntax?
Thank you!
Edit: Adding an example as requested
Input:
julia> DataFrames.DataFrame(Dict("A" => ["This is an ex.", "This is a samp.", "This is a samp. of an ex."]))
3×1 DataFrame
 Row │ A
     │ String
─────┼────────────────────
   1 │ This is an ex.
   2 │ This is a samp.
   3 │ This is a samp. of an ex.

Desired output:
3×1 DataFrame
 Row │ A
     │ String
─────┼────────────────────
   1 │ This is an example
   2 │ This is a sample
   3 │ This is a sample of an example

A: In Julia the function for this is also replace. It takes a collection and replaces elements in it. The simplest form is:
julia> x = ["a", "ab", "ac", "b", "bc", "bd"]
6-element Vector{String}:
 "a"
 "ab"
 "ac"
 "b"
 "bc"
 "bd"

julia> replace(x, "a" => "aa", "b" => "bb")
6-element Vector{String}:
 "aa"
 "ab"
 "ac"
 "bb"
 "bc"
 "bd"

If you have more complex replace pattern you can pass a function that does the replacement:
julia> replace(x) do s
           length(s) == 1 ? s^2 : s
       end
6-element Vector{String}:
 "aa"
 "ab"
 "ac"
 "bb"
 "bc"
 "bd"

There is also replace! that does the same in-place.
Is this what you wanted?
EDIT
Replacement of substrings in a vector of strings:
julia> df = DataFrame("A" => ["This is an ex.", "This is a samp.", "This is a samp. of an ex."])
3×1 DataFrame
 Row │ A
     │ String
─────┼───────────────────────────
   1 │ This is an ex.
   2 │ This is a samp.
   3 │ This is a samp. of an ex.

julia> df.A .= replace.(df.A, "ex." => "example", "samp." => "sample")
3-element Vector{String}:
 "This is an example"
 "This is a sample"
 "This is a sample of an example"

Note two things:

*

*you do not need to pass Dict to DataFrame constructor. It is enough to just pass pairs.

*In assignment I used .= not =, which perfoms an in-place replacement of updated values in the already existing vector (I show it for a comparison to what @Sundar R proposed in a comment which is an alternative that allocates a new vector; the difference probably does not matter much in your case but I just wanted to show you both syntaxes).


text:
Q: WebView qml doesn't work correctly on iOS 11 I've a problem, i need to open url inside app, and I used a WebView, but doesn't work correctly.
imported this:
import QtWebView 1.0

my code:
Rectangle{
    width: Screen.width
    height: Screen.height
    color: "Orange"
    anchors.fill: parent
    z:9999999

    WebView {
        id: webviewer
        anchors.fill: parent
        url: "http://www.google.com"

        onLoadProgressChanged: {
            console.log(webviewer.loadProgress)
        }
    }
}

and in the .pro file i've put:
QT += webview

And my main.cpp
QtWebView::initialize();

my console.log is printing correctly the load status, but on the screen I don't see nothing.
Why?

A: Works on iOS, the solution is:

Open project in Xcode from build folder, and set App Transport Security Settings, you must add Allow Arbitrary Loads and sets it on YES.
Now the WebView works.

A: initialize() creates opengl surface, in this case You must first open parent window(surface to display) , other solution is to comment initialize() - page will show. If you'll decide to show it on GL surface, try to se ALWAYSSTACKONTOP attribute to see, if other windows dont cover webview, opengl is rendered first,so any other background can make it not visible. You may also open webview class parented to other, visible window, but if you will show it fullscreen, it will be flicker a while


text:
Q: Build the proper array with push method to send data to google sheet in the right format For a very specific goal, for which I won't go into detail here, I need to grab some data from one spreadsheet and send these data to another one. However I must use the push method somewhere in my code.
Concretely here is what I'm trying to do :
function myFunction() {
    var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Raw_data");
    var sheet2 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet10");
  var Row_count = sheet.getLastRow()
  var raw_data = sheet.getDataRange().getValues();

   var data = [];

  for (var i = 0; i < Row_count ; i++) {
    data.push(raw_data[i].toString())
    }

sheet2.getRange(1, 1,1, 307).setValues([data]);
  }

So basically I would like to be able to breakdown the getValues(); output and recompose it with the push method.
Right now all my data are being send in sheet2 on the same row. Using the push method how do I go to get the following output :
Header1,Header2,Header3,Header4,etc...
Data11,data12,data13,data14
Data21,data22,data23,data24
Data31,data32,data33,data34,
etc...

thanks !

A: According to the documentation, the range you're pushing that data into should be the same shape as the data you're pushing, but it isn't if I'm reading getRange correctly. There are two differences: Your range is only one row high, and your range is 307 columns wide. But your data is Row_count rows high, and one column wide (with that column containing the result of converting the cells into a single comma-delimited string).
So I'd think changing your getRange at the end would be sufficient:
sheet2.getRange(1, 1, Row_count, 1).setValues([data]);
// -------------------^^^^^^^^---^

In a comment, you've said you want the data you pass to setValues to be the same shape as raw_data. Right now it isn't, raw_data is a two-dimensional structure; you're building a one-dimensional array with string-joined values and then wrapping it in another array — so it ends up being two-dimensional, but it's one row with Row_count columns.
You'll need nested loops if you want to build the same structure:
var data = [];
var row;
var dataRow;
var rowIndex;
var Col_count = raw_data[0].length;
var colIndex;
for (rowIndex = 0; rowIndex < Row_count; rowIndex++) {
    row = raw_data[i];
    dataRow = [];
    data.push(dataRow);
    for (colIndex = 0; colIndex < colCount; colIndex++) {
        dataRow.push(row[colIndex]);
    }
}
sheet2.getRange(1, 1, Row_count, Col_count).setValues(raw_data);


text:
Q: Bean/Component from another maven project not found I am new to the Spring Boot framework and currently trying to learn while working on a very large application. The application consists of many (maven based) Spring Boot projects and it has the following structure:

*

*Project1

*

*com.x.y.z

*com.x.y.w

*Project2

*

*com.x.y.a.b

*com.x.y.a.c

*Project3

*

*com.x.y.d.e

*com.x.y.d.f
All the projects output jar and are based on com.x.y packages. Project1 contains the main function. There is a chance that any project is dependent on the other project (but not cyclic dependency since maven doesn't allow that). However, for the sake of example, assume Project3 is dependent on Project1. Projects are built with dependencies.
Question
When I place any @Component class inside Project1, it finds them without any problem. However, when I place a @Component inside another project (Project3 in our example) which is dependent on Project1 (the main project) it fails to find it.
Attempts to solve
As suggested in the documentation and Google source, I have tried using @ComponentScan("com.x.y") in the main class as well, but it didn't work out.
Also, I have tried both solutions on this post but they didn't work.
Any help will be really appreciated.


text:
Q: How to format number of digits with kable I want to format x and y using 3 digits: e.g. for x I want to obtain 0.035, 0.790, 0.453.
I tried using the following, without success:
---
title: "format 3 digits"
output:
  word_document: default
---

```{r echo=FALSE,message=FALSE, warning=FALSE}
library(tidyverse)
library(knitr)

df <- tibble(x = c(0.0345, 0.7898, 0.4534),
             y = c(-0.0345, -0.7898, -0.4534),
             z = c(1, 2, 3))
df %>%
  mutate_if(is.numeric, format, digits=3, nsmall=0) %>%
  kable(.)
```

A: Try
df %>%
  kable(digits = 3)

Also _if, _all, etc. verb have been superseded in dplyr >= 1.0.0 by across.

A: Responding to LMc's solution. Here is an option using across.
library(tidyverse)
library(knitr)

df <- tibble(x = c(0.0345, 0.7898, 0.4534),
             y = c(-0.0345, -0.7898, -0.4534),
             z = c(1, 2, 3))
df %>%
  mutate(across(where(is.numeric), ~ round(., digits = 3))) %>%
  kable(.)


text:
Q: IE6,7 on a link hover, absolute positioning not changing on child I have the following HTML and CSS:

            Recent development
            Beaufort Park 6
        1, 2 & 3 bedroom apartments available from £160,000

            Beaufort Park 5
            1, 2 & 3 bedroom apartments available from £160,000

            Beaufort Park 4
            1, 2 & 3 bedroom apartments available from £160,000

CSS:
#topdevelopments {

}
    #topdevelopments a {
        border:#4D4D4D 10px solid;
        display:block;
        color:#fff !important;
        font-family:"MetaPlusBookRoman", sans-serif;
        font-size:16px;
        height:153px;
        margin-bottom:10px;
        overflow:hidden;
        position:relative;
        width:212px;
    }
        #topdevelopments a span { display:block; }
        #topdevelopments a span.popup {
            height:133px;
            left:0px;
            overflow:hidden;
            padding:10px;
            position:absolute;
            top:153px;
            width:192px;
            -webkit-transition: all 0.5s ease-in-out;
            -moz-transition: all 0.5s ease-in-out;
            -o-transition: all 0.5s ease-in-out;
            -webkit-transition: all 0.5s ease-in-out;
            transition: all 0.5s ease-in-out;
        }
        #topdevelopments a:hover span.popup { top:0px; }
        #topdevelopments a.agreen span.popup { background-color:#C1D82F; }
        #topdevelopments a.ablue span.popup { background-color:#36A6E8; }
        #topdevelopments a.apurple span.popup { background-color:#C6168D; }
        #topdevelopments a span.popup .first {
            font-family:"MetaPlusBlackRoman", sans-serif;
            font-size:20px;
            opacity:0.5;
        }
        #topdevelopments a span.popup .heading {
            border-bottom:#fff 2px solid;
            font-family:"MetaPlusBlackRoman", sans-serif;
            font-size:20px;
            margin-bottom:5px;
        }
        #topdevelopments a span.corner {
            background:url(images/corner/corner-dgrey.png);
            bottom:0px;
            height:40px;
            position:absolute;
            right:0px;
            width:40px;
        }
        #topdevelopments a span.go {
            bottom:4px;
            height:16px;
            position:absolute;
            right:4px;
            width:16px;
        }
        #topdevelopments a.agreen span.go { background-image:url(images/go/go-green.png); }
        #topdevelopments a.ablue span.go { background-image:url(images/go/go-blue.png); }
        #topdevelopments a.apurple span.go { background-image:url(images/go/go-purple.png); }
        #topdevelopments a.agreen:hover span.go { background-image:url(images/go/goh-green.png); }
        #topdevelopments a.ablue:hover span.go { background-image:url(images/go/goh-blue.png); }
        #topdevelopments a.apurple:hover span.go { background-image:url(images/go/goh-purple.png); }

What should happen is that when the "A" is hovered the "span" that is absolutely positioned out of the view should come into view by changing the "top" parameter. This works but in IE6 and IE7 only does it fail to work. I cannot figure out why. Anyone know why?
I'll add that each of the "A" links are floated left.

A: add:
#topdevelopments a:hover {
  text-indent: 0;
}

IE likes a rule on the a:hover before it will activate an extension of it e.g a:hover span
anything will do as long as it's not already declared on the a rule
i.e. I picked text-indent: 0 as it is a default that is not already on the a rule

A: I created this JSFiddle.  I think you were missing :hover on #topdevelopments a span.go.
Edit although that appears to work, you lose the cursor icon on the links that appear!  You could possibly rectify that with more CSS but it seems a bit messy.  If the other solution works it might be more elegant.


text:
Q: Restart automatically context variables It is possible to configure the ibm chatbot so that automatically when you restart it, the context variables are deleted.

A: Assumption - restart when it reaches desired node
You can make the contents values "" in the node where one conversation ends (for eg- #goodbye node or where some process ends in a node).


text:
Q: Windows 7 install setup for limited user account During the Windows 7 install what is the best way to go about setting up a computer for use with limited user accounts?
Essentially, when it prompts me to create a user (see below) what should I do in order to set Windows up for limited user accounts?

Should I create an admin account and then delete it after the install, or is there someway I can create limited user during the install? What is the best practice here?

A: What ever you type on that screen will be a user with Admin rights (assuming this is a home PC with no group policy or anything else in the mix.)
Once the install is done, setup your "limited accounts."
I'm not sure if you will be able to delete your admin account, as you will need admin rights to do so. There is also the system Administrator account but it is not active by default (usually.)

A: Here's a naming convention I like for two accounts: usernameAdmin for admin privileges, username for limited account. (SteveAdmin and Steve, e.g.)
I second the above: you must have one user account with admin privileges/in the admin group. If you delete all admin user accounts, you will be stuck.


text:
Q: How to delay execution android I am building an android board game which features AI. The AI gets a turn and has to invoke a series of actions after which it posts invalidate to my custom view to update.
I need to slow down these actions so the user gets to see the AI having its turn rather than it flashing by.
I have tried something along these lines
    try {
        doFirstThing();
        Thread.sleep(500)
        //post invalidate

        doNextThing();
        Thread.sleep(1000)
        //post invalidate
     }
     catch (Exception e) {
     }

However this is having absolutely no effect. Also this is running in a separate thread if this wasn't obvious.
Whats my best option I've looked at handler but they don't need right as i need to execute a series of tasks in sequence updating the view each time.

A: Using a Handler, which is a good idea if you are executing from a UI thread...
    final Handler h = new Handler();

    final Runnable r2 = new Runnable() {

        @Override
        public void run() {
            // do second thing
        }
    };

    Runnable r1 = new Runnable() {

        @Override
        public void run() {
            // do first thing
            h.postDelayed(r2, 10000); // 10 second delay
        }
    };

    h.postDelayed(r1, 5000); // 5 second delay

A: Just to add a sample :
The following code can be executed outside of the UI thread.
Definitely, Handler must be use to delay task in Android
Handler handler = new Handler(Looper.getMainLooper());
final Runnable r = new Runnable() {
    public void run() {
        //do your stuff here after DELAY milliseconds
    }
};
handler.postDelayed(r, DELAY);


text:
Q: Update Button Title I have a simple button which is initially labelled with the emoji , and all that I'm trying to do is to remove the emoji once the button is clicked.
import UIKit

class ViewController: UIViewController {

    @IBAction func touchCard(_ sender: UIButton) {
        flipCard(withEmoji: "", on: sender)
    }

    func flipCard(withEmoji emoji: String, on button:UIButton){
        if button.currentTitle == emoji {
            button.setTitle("", for: UIControl.State.normal)
            print("Removed emoji")
        }
    }

}

As I step through the code, the statement button.setTitle("", for: UIControl.State.normal) gets executed, however the emoji does not disappear although it does appear faded, after the button is clicked.
Edit: The title does get updated, but it takes a few (8-10) seconds to do so. Replacing the emoji with another emoji is almost instantaneous though! What could be causing this and how do I fix this?
PS: I'm following along the CS193P lecture (Lecture 1) here.

A: You probably want button.title(for: .normal) instead of button.currentTitle.

A: If the button appears faded, it might be disabled. If you set the title for the disabled state and execute button.setTitle("", for: UIControl.State.normal), nothing will happen to the title for UIControl.State.disabled.
Check if button.setTitle("", for: UIControl.State.disabled) does the trick.

A: You can simply replace your function like below function that i have added for you.
func flipCard(withEmoji emoji: String, on button:UIButton){

        if button.currentTitle == emoji {

            button.setTitle("", for: .normal)
            button.setTitle("", for: .selected)
            button.setTitle("", for: .disabled)

            print("Removed emoji")
        }

    }

Hope this way may help you.


text:
Q: Update the column which retain the old values using SAS SQL Need to update the column in the master file, say Column1 has A & B values.
I have a different set of a file (mapping file) which has 2 different columns Column1 has only A values & Column2 has only B values which have unique values.
My requirement is to replace only A values to B and presented B values must retain same as in the column in the master file.
Please help me to write the update statement in SAS SQL.
I have tried this,
PROC SQL;
UPDATE MASTERTABLE K
SET COLUMN1 = (SELECT L.COLUMN2 FROM MAPPINGFILE L WHERE K.COLUMN1= L.COLUMN1);
QUIT;

A: It sounds like you want to minimally track the master tables pre-map values as well as perform a mapping operation.  If this is not the case please edit the question with more detail and sample data.
The SQL exists operator will let you specify criteria that selects, for update, only those rows that need a mapping action.
data have_master;
  do row = 1 to 100;
    current_value = byte(65 + mod(row,26));
    prior_value = ' ';
    output;
  end;
run;

data have_map;
  length from_value to_value $1;
  input from_value to_value;
datalines;
A a
B d
Z K
run;

proc sql;
  update have_master
  set
    prior_value = current_value
  , current_value = (select to_value from have_map where have_map.from_value = have_master.current_value)
  where
     exists (select * from have_map where have_map.from_value = have_master.current_value)
;

%let syslast=have_master;

I say minimally track because a subsequent use of the query can overwrite a prior_value assigned previously.


text:
Q: Funcion de firebase no funciona Estoy implementando los siguientes enlaces de Firebase en mi HTML:
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-app.js"></script>´
<script defer src="https://www.gstatic.com/firebasejs/7.12.0/firebase-auth.js"></script>
<script defer src="https://www.gstatic.com/firebasejs/7.12.0/firebase-database.js"></script>
<script src="assets/js/custom/crudBeneficiarios.js"></script>

Archivo crudBeneficiarios.js:
var firebaseConfig = {
apiKey: "miApiKey",
authDomain: "miAuthDomain",
databaseURL: "miURL",
projectId: "miProjectID",
storageBucket: "miStorageBucket",
messagingSenderId: "miMessagingSenderId",
appId: "miAppID"
};
firebase.initializeApp(firebaseConfig);

Pero la siguiente linea me causa conflicto:
var db = firebase.database();

Lo hago tal y como aparece en la documentación de firebase, no se que esta mal.
El error que me aparece es:

firebase.database is not a function

A: Quita el defer a los scripts. defer hace que el script se ejecute hasta que la página ha sido renderizada, entonces los scripts con defer se pausan pero luego se ejecuta el script de crudBeneficiarios.js y eso causa el error.
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-database.js"></script>


text:
Q: How to get ToolTip in a ListViewer in JFace?
This is a gridLayout in which the Available side is a Tree Viewer and The Selected side is a ListViewer. Now I have to get a toolTip on the right hand side. Which I am unable to get. I am working on a existing code base , so I am unable to figure out on which line did they add a tooltip + I did not find any keywords like tooltip or mouse Hover. Still how is this implemented.
I am mentioning some code. I believe the answer should be somewhere here only.
 availableViewer = new TreeViewer(resultsComposite, SWT.BORDER | this.getStyle());
        availableViewer.setContentProvider(new ResAndResGroupTreeContentProvider());
        availableViewer.setLabelProvider(SelectionItemLabelProvider.getInstance());
        Tree availableResults = availableViewer.getTree();
        GridData availableResultsGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
        availableResultsGridData.widthHint = LIST_WIDTH_HINT;
        availableResultsGridData.heightHint = LIST_HEIGHT_HINT;
        availableResults.setLayoutData(availableResultsGridData);
        availableViewer.getTree().addSelectionListener(new SelectionAdapter()
        {
            @Override
            public void widgetDefaultSelected(SelectionEvent e)
            {
                moveAvailableItemsToSelected();
            }
        });

This is the selectionViewer content.
  selectedViewer = new ListViewer(resultsComposite, SWT.V_SCROLL | SWT.H_SCROLL| SWT.BORDER
            | this.getStyle());
    selectedViewer.setContentProvider(new ResAndResGroupTreeContentProvider());
    selectedViewer.setLabelProvider(new SelectionItemLabelProvider());
    org.eclipse.swt.widgets.List selectedResults = selectedViewer.getList();
    GridData selectedResultsGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    selectedResultsGridData.widthHint = LIST_WIDTH_HINT;
    selectedResultsGridData.heightHint = LIST_HEIGHT_HINT;
    selectedResults.setLayoutData(selectedResultsGridData);
    selectedViewer.addDoubleClickListener(new IDoubleClickListener()
    {
        @Override
        public void doubleClick(DoubleClickEvent event)
        {
            moveSelectedItemsToAvailable();
        }
    });
    selectedViewer.getList().addKeyListener(new KeyAdapter()
    {
        @Override
        public void keyPressed(KeyEvent e)
        {
            if (e.character == SWT.CR)
            {
                moveSelectedItemsToAvailable();
            }
        }
    });
    selectedViewer.addSelectionChangedListener(new ISelectionChangedListener()
    {
        @Override
        public void selectionChanged(SelectionChangedEvent event)
        {
            updateButtonsEnabled();
        }
    });

Thanks.

A: The ListViewers underlying List widget cannot show different tooltips for each item.
You can assign a tooltip for the entire list like so
listViewer.getList().setTooltipText( "..." );

But if you want a differnt tooltip per item you'll have to use a TableViewer.
What you see on the left side is the native Windows tooltip that appears if an item exceeds the horizontal space. The Table (on Windows) has the same behavior, thus you don't need to explicitly provide tooltips.
For a control that has a default tool tip, such as the Tree on Windows, setting the tooltip to null replaces the default, causing no tooltip to be shown.


text:
Q: get wkt from geometry in lat lon format Using the plane geometry editor plugin in qgis 2.0, WKT representation of a feature is shown. The result is in the lon1 lat1,lon2 lat2 format. e.g.
POLYGON((85.43523762804622379 27.69592296476042037,85.43592529210572195 27.69598802249519665,85.43609697201434017 27.69598624204515147,85.43523762804622379 27.69592296476042037))
I want result in this format lat1 lon1 lat2 lon2. Is there a simple easy way of doing this?

A: In the menu bar, select 'Plugins' -> 'Manage and Install Plugins'. Under the 'Get more' tab in the window that pops up, search 'Swap XY'. Install this plugin then simply run it on the desired placefile. This will update the polygon points to lat/lon format so copied features will display as POLYGON((lat lon, lat lon)). Keep in mind this will also rotate and invert the rendered map until the CRS is updated to take in a lat/lon format as opposed to it's default lon/lat format.


text:
Q: Converting Linq to XML query from C# to VB.Net. Can you spot my error? I'm converting the Linq query below from C# to VB.Net. Can you spot my error? The query joins 3 XML datasets. Thanks in advance!
C# - This one works great.
List<Course> courses =
  (from course in CourseXML.Descendants(ns + "row")
  join coursecategory in CourseCategoryXML.Descendants("Table") on (string)course.Attribute("code") equals (string)coursecategory.Element("DATA")
  join category in CategoryXML.Descendants("Table") on (string)coursecategory.Element("GRP") equals (string)category.Element("GRP")
  where (string)coursecategory.Element("RECTYPE") == "C"
  select new Course {
    CategoryCode = category.Element("GRP").Value,
      Code = course.Attribute("code").Value
  }).ToList<Course>();

VB - I'm getting no results from this, so I suspect I'm either casting improperly or joining improperly.
Dim result = (From course In CourseXML.Descendants(ns + "row") _
Join coursecategory In CourseCategoryXML.Descendants("Table") On CType(course.Attribute("code"), String) Equals CType(coursecategory.Element("DATA"), String) _
Join category In CategoryXML.Descendants("Table") On CType(coursecategory.Element("GRP"), String) Equals CType(category.Element("GRP"), String) _
Where CType(coursecategory.Element("RECTYPE"), String) = "C" _
Select New Course() With _
{ _
  .CategoryCode = category.Element("GRP").Value, _
  .Code = course.Attribute("code").Value _
}).ToList()

A: I used the following site to convert:
    http://www.developerfusion.com/tools/convert/csharp-to-vb/
Dim courses As List(Of Course) = (From course In CourseXML.Descendants(ns & "row") _
    Join coursecategory In CourseCategoryXML.Descendants("Table") On DirectCast(course.Attribute("code"), String) = DirectCast(coursecategory.Element("DATA"), String) _
    Join category In CategoryXML.Descendants("Table") On DirectCast(coursecategory.Element("GRP"), String) = DirectCast(category.Element("GRP"), String) _
    Where DirectCast(coursecategory.Element("RECTYPE"), String) = "C" _
    Select New Course()).ToList(Of Course)()

The main difference is the last Select.

A: You are getting different results because of the casts.
coursecategory.Element("RECTYPE").Value returns a different result than
(string)coursecategory.Element("RECTYPE") == "C" (and obviously CType(coursecategory.Element("RECTYPE"), String) = "C").
If one of your elements is missing a child RECTYPE node, you will not have any results if you properly cast it, which you did in VB.NET.
In C# you didn't cast  (string)coursecategory.Element("RECTYPE") == "C" right.  If you use ToString() or .Value you would get the correct results.
Use coursecategory.Element("RECTYPE").Value instead, and avoid the casts altogether.
You could test this by changing your select to return:
select new {
Wrong = (string)coursecategory.Element("RECTYPE"),  // No exception ... incorrect result!
//Maybe = coursecategory.Element("RECTYPE").ToString() //throws NullReferenceException
//Right = (string)coursecategory.Element("RECTYPE").Value // throws NullReferenceException because of a missing element.
CategoryCode = category.Element("GRP").Value,
Code = course.Attribute("code").Value

});


text:
Q: How many significant figures should constants be used to in a calculation where other values are given to varying significant figures? I was recently helping someone study and review the results of a homework assessment in which physics calculations were being performed. The question was related to calculating planetary core pressure for a set of gas giant planets. The pressure is derived using equation that takes the radius of the planet, its average mass density, and the gravitational constant.
The figures for radii and densities were provided in a table, with each value being given to between three and five significant figures. The value of the gravitational constant was not specified in the question text; typically students are expected to look up constant values for themselves.
The person marking the assessment gave a mark for providing the final answer to 3 significant figures, but deducted a mark for specifying the gravitational constant to 5 significant figures in the calculations, stating that it should've been specified to 3 significant figures.
I can almost see an argument for why the constant precision should be limited, but given that we know the gravitational constant with extreme precision, I can also see an argument for it being irrelevant as long as the constant value is specified in the workings and the final answer is given to an appropriately small number of significant figures. It seems counterintuitive to me that the precision of constant input values should be truncated to final SFs prior to the calculation, when the precision of measured/variable input values (e.g. the radii and densities) should not.
Previous tutors have treated this matter in conflicting ways, either ignoring SFs on constants entirely or advising that they should generally be specified to no more precision than the most precise input. The latter advice is why 5 SFs were chosen.
This situation made me realise that I don't actually know if there is a formally correct approach for choosing the number of SFs for constants in calculations like these. Are there hard rules for the appropriate number of SFs to use with constants? Do the rules change for calculations with intermediate steps?


text:
Q: MySQLDump to local machine from remote server where remote server is bound to localhost Is there a way of dumping a database from a remote server where the remote server is bound to localhost.  My only thought is to use a ssh tunnel to port forward 3306.
Any thoughts would be appreciated.  Thanks
I've tried:
mysqldump -u<username> -p<password> -h <remote machine> <table> > dump.dmp
I get back:
mysqldump: Got error: 2003: Can't connect to MySQL server on '<remote machine>:3306' (111) when trying to connect

A: Try this:
ssh user@remote_host "mysqldump -u Usue -p'pass' DB | gzip -9" > localPath/dblocal.sql.gz


text:
Q: how to allow EditText to expand pushing peer controls away The xml pasted below is the discussion page on an app I am writing.  It works much like a typical SMS messaging app displaying a message thread, a message entry edittext, and a send button.  The actual thread caption boxes are added to the LinearLayout named messageScroll in code.
It all works very well except when the message gets to be more than two lines, the EditText named etMessage squashes the btnSend button below it down to a barely visible thin line.  What I want to do is have etMessage push the ScrollView above it up.  I'll probably max etMessage to around 10 lines.
I have played with layout gravity and weight with no usable results.  If I give the button or the etMessage a weight, they expand way too tall initially.
How can I get the desired results?
Thanks, Dean
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
    android:focusable="true"
    android:focusableInTouchMode="true"
        android:orientation="vertical" >
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
        >
        <TextView
            android:id="@+id/tvLocate"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Talk"
            style="@style/bigtype" />

        <TextView
            android:id="@+id/tvUserName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="User Name"
            style="@style/largetype"
            android:layout_marginLeft="30dip" />
    </LinearLayout>
    <ScrollView
            android:id="@+id/scroller"
            android:layout_width="fill_parent"
            android:layout_weight=".90"
            android:gravity="bottom"
            android:fillViewport="true"
            android:layout_height="0dip">

        <LinearLayout
            android:id="@+id/messageScroll"
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:gravity="bottom"
            android:orientation="vertical" >
        </LinearLayout>
    </ScrollView>

   <EditText
       android:id="@+id/etMessage"
       android:layout_marginTop="0dip"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:maxLength="160"
       android:layout_marginLeft="10dip"
       android:layout_marginRight="10dip"
       android:inputType="textCapSentences|textMultiLine" />

    <Button
       android:id="@+id/btnSend"
       android:layout_width="wrap_content"
       android:layout_height="0dp"
       android:layout_marginTop="10dip"
       android:onClick="btnSend_Clicked"
       android:layout_marginBottom="5dip"
       android:enabled="true"
       android:layout_weight=".1"
       android:layout_gravity="center_horizontal"
       android:text="Send" />

</LinearLayout>

A: I have corrected the layout. Things to note are using proper layout params and integer values for layout_weights.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:focusable="true"
              android:focusableInTouchMode="true"
              android:orientation="vertical" >

    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >
        >
        <TextView
                android:id="@+id/tvLocate"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Talk"
                 />

        <TextView
                android:id="@+id/tvUserName"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="User Name"

                android:layout_marginLeft="30dip" />
    </LinearLayout>

    <ScrollView
            android:id="@+id/scroller"
            android:layout_width="fill_parent"
            android:layout_weight="1"
            android:gravity="bottom"
            android:fillViewport="true"
            android:layout_height="0dip">

        <LinearLayout
                android:id="@+id/messageScroll"
                android:layout_width="match_parent"
                android:layout_height="200dp"
                android:gravity="bottom"
                android:orientation="vertical" >
        </LinearLayout>
    </ScrollView>

    <EditText
            android:id="@+id/etMessage"
            android:layout_marginTop="0dip"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:maxLength="160"
            android:layout_marginLeft="10dip"
            android:layout_marginRight="10dip"
            android:inputType="textCapSentences|textMultiLine"
            android:text="afkajfjsajf asj ajfkjaldflkasdlkf aljfjl alkdfjkja aljfdkj alkdjflajlklfjkadlfjakd alkdfjlsjf "/>

    <Button
            android:id="@+id/btnSend"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dip"
            android:onClick="btnSend_Clicked"
            android:layout_marginBottom="5dip"
            android:enabled="true"
            android:layout_gravity="center_horizontal"
            android:text="Send" />

</LinearLayout>


text:
Q: IndexOutOfRange Exception while trying to get color values from Kinect v2 in C# I am trying to get the RGB values of each CameraSpacePoint in Kinect v2. While trying to access converted frame data, the code is throwing IndexOutOfRangeException. I found out that following lines are throwing this error:
byte red   = pixels[4 * pixelsBaseIndex + 0];
byte green = pixels[4 * pixelsBaseIndex + 1];
byte blue  = pixels[4 * pixelsBaseIndex + 2];
byte alpha = pixels[4 * pixelsBaseIndex + 3];

Please see the complete code below:
int depthWidth = kinectSensor.DepthFrameSource.FrameDescription.Width;
int depthHeight = kinectSensor.DepthFrameSource.FrameDescription.Height;
int colorWidth = kinectSensor.ColorFrameSource.FrameDescription.Width;
int colorHeight = kinectSensor.ColorFrameSource.FrameDescription.Height;

ushort[] depthData = new ushort[depthWidth * depthHeight];
CameraSpacePoint[] cameraPoints = new CameraSpacePoint[depthData.Length];
ColorSpacePoint[] colorPoints = new ColorSpacePoint[depthData.Length];

// Assuming RGBA format here
byte[] pixels = new byte[colorWidth * colorHeight * 4];

depthFrame = multiSourceFrame.DepthFrameReference.AcquireFrame();
colorFrame = multiSourceFrame.ColorFrameReference.AcquireFrame();

if ((depthFrame == null) || (colorFrame == null))
{
    return;
}

depthFrame.CopyFrameDataToArray(depthData);
coordinateMapper.MapDepthFrameToCameraSpace(depthData, cameraPoints);
coordinateMapper.MapDepthFrameToColorSpace(depthData, colorPoints);

// We are using RGBA format
colorFrame.CopyConvertedFrameDataToArray(pixels, ColorImageFormat.Rgba);

for (var index = 0; index < depthData.Length; index++)
{
    var u = colorPoints[index].X;
    var v = colorPoints[index].Y;

    if (u < 0 || u >= colorWidth || v < 0 || v >= colorHeight) continue;

    int pixelsBaseIndex = (int)(v * colorWidth + u);
    try
    {
        byte red = pixels[4 * pixelsBaseIndex + 0];
        byte green = pixels[4 * pixelsBaseIndex + 1];
        byte blue = pixels[4 * pixelsBaseIndex + 2];
        byte alpha = pixels[4 * pixelsBaseIndex + 3];
    }
    catch (IndexOutOfRangeException ex)
    {
        int minValue = 4 * pixelsBaseIndex;
        int maxValue = 4 * pixelsBaseIndex + 3;
        Console.WriteLine((minValue > 0) + ", " + (maxValue < pixels.Length));
    }
}

The code looks fine however I am not sure what am I missing here! How to avoid IndexOutOfRangeException exception? Any suggestions, please?

A: First thing pixelsBaseIndex =< 2070601 (2070601 = 1919 * 1079)
2074817 is an invalid value for the pixelsBaseIndex.
This error could be somewhere here.
if (u < 0 || u >= colorWidth || v < 0 || v >= colorHeight) continue;

int pixelsBaseIndex = (int)(v * colorWidth + u);

Best thing is to console log u, v, colorWidth, colorHeight and validate them.
EDIT
As i suspected, it is caused by the Floating-Point Arithmetic.
Mapping one frame to another frame needs complex matrix calculations, thus u,v get floating point values. Keep in mind that u,v are the pixel coordinates of the color space. They must be non-negative integers.
My recommended solution is
...
    int u = (int) Math.Floor(colorPoints[index].X);
    int v = (int) Math.Floor(colorPoints[index].Y);

    if (u < 0 || u >= colorWidth || v < 0 || v >= colorHeight) continue;
...

FYI
Check out following lines of code to understand why u, v pixel coordinates getting floating point values. The decision, taking the floor or discarding the invalid values, is depending on the developer since in either cases, you are loosing some sort of information. For example, taking the floor means you are taking the color of the nearest pixel.
In my personal option, out putting more precise value (thus floating point value) is important for developers who do more calculations on the outputted values.For example, point cloud registration.
depth_to_color
calculating x offset for rgb image based on depth value


text:
Q: Taking $y \rightarrow 0$ without continuity Find all functions $f: \mathbb{R}^{+} \rightarrow \mathbb{R}^{+}$ such that
$$f(xf(x + y)) = yf(x) + 1$$
holds for all $x, y \in \mathbb{R}^{+}$.
Can I take $y \rightarrow 0$, and solve the functional equation $$f(xf(x))=1$$
Without proving that $f$ is continuous? Since taking $y \rightarrow 0$ does not affect the domain directly, is it possible? If not, why?


text:
Q: How to compare a symbol with a symbol taken from a list If I compare two symbols using equal? I get different results depending on whether one of the symbols is from a list and one is not.
This is demonstrated below:
; The following returns #t
(equal? (list-ref '('a 'b) 1) (list-ref '('a 'b) 1))

; But this return #f
(equal? 'b (list-ref '('a 'b) 1))

What is the best way to compare two symbols when one is from a list and one is not?  If you can help me understand why this is the case then even better.

A: You weren't comparing symbols:
> (list-ref '('a 'b) 1)
''b
> (symbol? (list-ref '('a 'b) 1))
#f

due to double quoting:
> (list-ref '(a b) 1)
'b
> (symbol? (list-ref '(a b) 1))
#t

So your initial case becomes
> (equal? 'b (list-ref '(a b) 1))
#t

If your list only contains symbols, it's more common to use eq? to compare them (it's supposed to be faster):
> (eq? 'b (list-ref '(a b) 1))
#t

If you double quoted because your list may contain other types, then use
> (list 'a 'b)
'(a b)

instead of
> '(a b)
'(a b)


text:
Q: Fourier transform cross product of gradients I got stucked in a simple Fourier transform of a vector calculus equation...
Let $\lambda$ and $\mu$ be two scalar fields and $\vec{v}$ be a vector fields. Fourier transform the following equation
$$\nabla^2 \vec{v}=\nabla \times (\nabla \lambda \times \nabla \mu)$$
My attempt is:
let $\lambda(x)=\int d\vec{p} \hat{\lambda}_p e^{i\vec{p}\cdot\vec{x}}$ and $\mu(x)=\int d\vec{q} \hat{\mu}_q e^{i\vec{q}\cdot\vec{x}}$
$$\nabla \times \int d\vec{p}\,\, \, (i\vec{p})\hat{\lambda}_p e^{i\vec{p}\cdot\vec{x}} \times \int d\vec{q} \,\,\, (i\vec{q})\hat{\mu}_q e^{i\vec{q}\cdot\vec{x}} $$
$$=\nabla \times \int \int d\vec{p}\,d\vec{q} \,\, (-\vec{p}\times \vec{q}) \hat{\lambda}_p \hat{\mu}_q e^{i(\vec{p}+\vec{q})\cdot\vec{x}}$$
$$-i\int \int d\vec{p}\,d\vec{q} \,\, ((\vec{p}+\vec{q})\times (\vec{p}\times \vec{q})) \hat{\lambda}_p \hat{\mu}_q e^{i(\vec{p}+\vec{q})\cdot\vec{x}} $$
which would vanish since $$(\vec{p}+\vec{q})\times (\vec{p}\times \vec{q})=0$$
Could anyone give a hint on what I did wrong?
Edits:
One condition on $\vec{v}$ is that it is divergence-free, i.e. $\nabla\cdot \vec{v}=0$. This might be important but I forgot to state.
The book claims that
$$v(\vec{k})=\int \int \,d\vec{k}_1 \,d\vec{k}_2\, \varphi(\vec{k}_1,\vec{k}_2) a^*(k_1)\,a(\vec{k}_2) \, \delta(\vec{k}+\vec{k}_1-\vec{k}_2)$$
where
$$\varphi(\vec{k}_1,\vec{k}_2)=\frac{1}{2(2\pi)^{3/2}}[\vec{k}_1+\vec{k}_2-(\vec{k}_1-\vec{k}_2)\frac{k_1^2-k_2^2}{|\vec{k}_1-\vec{k}_2|^2}]$$
and a transition of varialbe is defined as below
$$\hat{\mu}(\vec{k})=\frac{a(\vec{k})+a^*(-\vec{k})}{\sqrt{2}},\quad \hat{\lambda}(\vec{k})=\frac{a(\vec{k})-a^*(-\vec{k})}{\sqrt{2}}$$


text:
Q: get/use radio button value android I FIGURED OUT WHAT I WAS DOING. I HAD THE VARIABLE NAME IN QUOTES WITH THE REST OF THE URL STRING.
How do you save the value of a Radio button into a variable and use that variable later.
I can see the variable Day_Item in my LogCat and the value is in there but when  try using Day_Item later it does not show the valuable.
Below is a section of my code that shows the buttons.
String Day_Item = null;
    public class SearchDB extends Activity {
        private static final String TAG = "MyApp";
        String start_log = "STARTED";
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.search_layout);

        final RadioButton radio_monday = (RadioButton) findViewById(R.id.monday);
        radio_monday.setOnClickListener(radio_listener);
cityspinner.setOnItemSelectedListener(new OnItemSelectedListener() {

    @Override
     public void onItemSelected(AdapterView<?> parent, View view, int position,long arg3)
     {
      int id = parent.getId();

       if (spinner2_count2 < spinner2_count1 ) {
           spinner2_count2++;  }
          else
          {
                 String city_spinner_log = "CITY SPINNER";
                 Log.d(TAG, city_spinner_log);

                    String item = cityspinner.getSelectedItem().toString();
                    String nameContentType = "name";
                    String cityURL = "GetRestaurant.php?day=Day_Item&city=" + item;
                    Log.d(TAG, cityURL);
                    String shop_data =  DataCall.getJSON(cityURL,nameContentType);
                    Log.d(TAG,  shop_data);
                    Bundle bundle = new Bundle();
                    bundle.putString("shopData", shop_data);

                       Intent myIntent = new Intent(SearchDB.this, ShowRestaurant.class);
                       myIntent.putExtras(bundle);
                       startActivityForResult(myIntent, 0);
           }

    }
      }

   //ONCLICKLISTENER that saves RADIO value into a variable.

    public OnClickListener radio_listener = new OnClickListener() {
        public void onClick(View v) {
            // Perform action on clicks

            RadioButton rb = (RadioButton) v;
            Day_Item = (String) rb.getText();
            Log.d(TAG,Day_Item);
            Toast.makeText(SearchDB.this, Day_Item, Toast.LENGTH_SHORT).show();
        }
    };
}

A: You would need a bit more code to get a good solid answer. Such as how is Day_Item allocated? And is it's scope global? Are you calling it from another activity or the one it's allocated within? These are just guesses at this point:
1) Are you sure your onClickListener isn't firing multiple times? Thus setting Day_Item to an undesired text or nothing at all?
2) Rather a question/answer,

"but when try using Day_Item later it does not show the valuable"

I'm assuming this means that it is null? Well if it's being set properly, and then it is being null'd... it either is being explicitly null'd by you somewhere (such as (1)) or else the allocation and scope are the issue area I believe...


text:
Q: How to use "IF" code with multiple conditions? I have 5 columns of data with around 50,000 rows. This is the ambulance response times to an incident. I am trying to figure out the total number of incidents as multiple ambulances respond to a single incident. The 'IF' function has been useful upto a certain extent where the multiple ambulances reached at the same time but when it is not at the same time, it considers it as a different incident. I would like to add a buffer of 20 minutes but I am not able to figure out how to incorporate that. The second problem is with the incident number. The incidents 2014-014374-006, 2014-014374-009 are the same, just the ending numbers are different. How do I differentiate? Can I do it in excel or other platforms?
http://imgur.com/a/30VHl

A: To return the incident number, use a formula like this: "=IF(ISERROR(SEARCH("-",D5,SEARCH("-",D5)+1)),D5,LEFT(D5,SEARCH("-",D5,SEARCH("-",D5)+1)-1))" where D5 is the cell with your incident number.
What this formula does is it first creates an if statement that will allow you to determine if the incident has the second dash or if it doesnt. If it doesn't, then it will return the value in the cell. If it does, it will return the text to the left of that dash. The search function looks for a substring, and by nesting a search and adding "1" to the value of the first search, we are looking for the substring that comes after the first one is found.
It is a rather confusing formula the first time you use it, but it works like a charm once you understand it.
I will see if I can figure the dates out. That might be more difficult. If you can simply use the incident number for this, you will likely have an easier time.


text:
Q: PL/SQL: ORA-00933: SQL command not properly ended for PL/SQL Function I am trying to write a PL/SQL Function to return Nth highest Salary. I keep getting the Runtime error below. The error is on 'Return result;' line

PL/SQL: ORA-00933: SQL command not properly ended ORA-06575: Package
  or function GETNTHHIGHESTSALARY is in an invalid state

Code:
CREATE FUNCTION getNthHighestSalary(N IN NUMBER) RETURN NUMBER IS result NUMBER;

BEGIN

  select Salary into result
  from
    (select dense_rank() over (order by salary desc) as Ranks, ID, Salary
     from Employee) a
     where a.Ranks = N

RETURN result;
END;

snapshot of main code

A: You have missing semi-colon where a.Ranks = N. It is supposed to be where a.Ranks = N;


text:
Q: wait -n ; is not waiting for all subshells to complete I have this bash script:
#!/usr/bin/env bash

DIRN=$(dirname "$0")

OUTPUT_PATH=${PROJECT_ROOT:-$PWD}/npm-install-output.log

(cd $(dirname "$0")/one && echo $PWD && rm -rf node_modules ; npm --loglevel=warn --progress=false install) &
(cd $(dirname "$0")/two && echo $PWD && rm -rf node_modules ; npm --loglevel=warn --progress=false install) &
(cd $(dirname "$0")/three && echo $PWD && rm -rf node_modules ; npm --loglevel=warn --progress=false install) &

wait -n; echo "EXIT CODE => $?"

EXIT=$?

echo " all done with parallel installs "
echo " => bash exit code for script '$(dirname "$0")/$(basename "$0")' => $EXIT" &&
exit ${EXIT}

from my logging output, seems very clear that one of the subshells runs after the wait -n call.
How can I use wait or another construct such that I wait for all subshells to complete?

A: help wait is pretty clear about that:

If the -n option is supplied, waits for the next job to terminate and
      returns its exit status.

Use wait instead of wait -n

If you are interested in all three return values use:
for i in 1 2 3 ; do
    wait -n
    echo "exit code $?"
done


text:
Q: OpenGL ES 2.0: Can't seem to render second VBO? I have 2 VBO's and 2 IBO's in OpenGL ES 2.0. I don't have any problems rendering the first VBO but the second one doesn't get rendered. I do not get an error either.
First VBO contains a GL_STATIC_DRAW object with 9 vertices. The second VBO contains 4 vertices to create a simple 2D plane so that I can render a user interface into it.
Here's the relevant parts of my code in C. renderBG() renders the first VBO and renderUI() renders the second VBO. Am I doing this the correct way?
void renderBG(OGL_STATE_T *state) {

    matIdentity(modelViewMatrix);
    matTranslate(modelViewMatrix, 0, 0, -1.0);

    _currentRotation = _currentRotation + 0.5;
    _currentRotation = fmod(_currentRotation, 360);
    matRotate(modelViewMatrix, 0, 0, 45);
    matRotate(modelViewMatrix, 0, _currentRotation, 0);

    const GLfloat *mvMat = modelViewMatrix;
    const GLfloat *pMat = projectionMatrix;

    glClearColor(0, 0.05, 0, 1.0);
    glClearDepthf(10.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glViewport(0,0,state->screen_width, state->screen_height);

    glBindBuffer(GL_ARRAY_BUFFER, state->nsVB);

    glUniformMatrix4fv(_projectionUniform, 1, 0, pMat);
    glUniformMatrix4fv(_modelViewUniform, 1, 0, mvMat);

    glVertexAttribPointer(_positionSlot, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);
    glVertexAttribPointer(_colorSlot, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex),
            (GLvoid *) (sizeof(float) * 3));

    glEnableVertexAttribArray(_positionSlot);
    glEnableVertexAttribArray(_colorSlot);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, state->nsIB);
    glDrawElements(GL_TRIANGLES, sizeof(nsIndices)/sizeof(nsIndices[0]),
            GL_UNSIGNED_BYTE, 0);

}

void renderUI(OGL_STATE_T *state) {

    matIdentity(modelViewMatrix);
    matTranslate(modelViewMatrix, 0, 0, -1.0);

    const GLfloat *mvMat2 = modelViewMatrix;
    const GLfloat *pMat2 = projectionMatrix;

    glViewport(0,0,state->screen_width, state->screen_height);

    glBindBuffer(GL_ARRAY_BUFFER, state->uiVB);

    glUniformMatrix4fv(_projectionUniform, 1, 0, pMat2);
    glUniformMatrix4fv(_modelViewUniform, 1, 0, mvMat2);

    glVertexAttribPointer(_positionSlot, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);
    glVertexAttribPointer(_colorSlot, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex),
            (GLvoid *) (sizeof(float) * 3));

    glEnableVertexAttribArray(_positionSlot);
    glEnableVertexAttribArray(_colorSlot);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, state->uiIB);
    glDrawElements(GL_TRIANGLES, uiIndicesArraySize / uiIndicesElementSize,
            GL_UNSIGNED_BYTE, 0);

    GLenum err;

    if ((err = glGetError()) != GL_NO_ERROR)
        printf("There was an error");
}

void render(OGL_STATE_T *state) {

    renderBG(state);
    renderUI(state);

    eglSwapBuffers(state->display, state->surface);
    check();
}

EDIT:
Here's some additional information. This is how the Vertex and Index arrays are populated in the second VBO:
GLfloat _width = uiWidth;
GLfloat _height = uiHeight;

Vertex uiVertices[] = {
    {{-_width,_height,0}, {1,1,1,1}},       // Top left
    {{_width,_height,0}, {1,1,1,1}},        // Top right
    {{-_width,-_height,0}, {1,1,1,1}},      // Bottom left
    {{_width,-_height,0}, {1,1,1,1}}        // Bottom right
};

GLubyte uiIndices[] = {
    0,1,2,
    2,1,3
};

uiVerticesArraySize = sizeof(uiVertices);
uiVerticesElementSize = sizeof(uiVertices[0]);
uiIndicesArraySize = sizeof(uiIndices);
uiIndicesElementSize = sizeof(uiIndices[0]);

printf("%f %f\n", uiVertices[0].Position[0], uiVertices[0].Position[1]);

glGenBuffers(1, &state->uiVB);
glBindBuffer(GL_ARRAY_BUFFER, state->uiVB);
glBufferData(GL_ARRAY_BUFFER, sizeof(uiVertices), uiVertices, GL_STATIC_DRAW);

glGenBuffers(1, &state->uiIB);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, state->uiIB);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(uiIndices), uiIndices, GL_STATIC_DRAW);

A: So turns out I had my indices declared in clockwise order (Thinking that would face the normal towards the Camera) and GL_CULL_FACE enabled. Switched the indices around and all is good with the world.


text:
Q: Relativity of Simultaneity - confusion regarding the ordering of events when taking different inertial frames as the origin I'll admit my question steals a graphic from this user's post here, but it is a different question regarding the same scenario that struck confusion of mine. Here is the graphic, illustrating the property of Relativity of Simultaneity:

I completely agree with the implications here with $S'$ moving relative to $S$. Since light moves at a fixed speed, it would be paradoxical to suggest Sally would say light from both events reached her at the same time, but here is what confuses me:
Say we consider $S'$'s point of view. So instead of $S'$ moving at speed $v$ relative to $S$, $S$ moves at speed $-v$ relative to $S'$. This should be equally true. In that case, after events $A$ and $B$ occur, $S'$ remains in place relative to $S$ and $S$ moves to the left some, reversing the example in the graphic. In that case, $S$ should've received the light from $A$ first, then from $B$ just as $S'$ received light from $B$ first then $A$ when moving with velocity $v$ relative to $S$. And in this case, $S'$ receives both signals at the same time.
So, I've just created an argument that $S'$ and $S$ can receive both events at the same time if we consider their frame as the origin and everything else moving relative to it, and both can receive both events at different times if moving relative to a reference frame at the origin. Where have I gone wrong?

A: Your logical flaw seems to be in the initial assumption that the events $A$ and $B$ happen simultaneously in both frames $S$ and $S^{'}$. If you reverse the argument, as you did, by assuming $S^{'}$ stationary, then either $A$ and $B$ are no longer simultaneous or, if you assume they are, then they are not the same events anymore, but $A^{'}$ and $B^{'}$.


text:
Q: A warning appears under my project name? I posted a questions a couple of days ago about eclipse notifying me of an error I didn't have.
An error appears under my project name but no error exists?
I fixed that error but now I face another problem. Under my project name, a little yellow warning sign appears. My program runs fine though. Can someone explain to me what it means or how to get rid of it?

A: Click Window > Show View > Problems to open the Problem View. This should list any warnings/errors showing up in Package Manager.


text:
Q: passing values based on selection I am working with angularjs. I have a table with data column which has hyperlink and when clicked in  data the 'prID' is passed to the URL as shown in the demo. But issue is for some of the rows in the table i have multiple prID's passed, when clicked on it, it is passing all the prID's instead i want to pass only one prID on which user mouse over and click on that ID.
DEMO:
https://plnkr.co/edit/sWbpovAT7II1eM4yRA2X?p=preview
example: For second row in the table i have values 2; 30; 21 . When user mouseover and click on it currently it is passing 2; 30; 21 in the URL instead i want to pass single value at a time. When user mouse over on 2 it should pass value 2 and when mouseover on 30, it should pass 30...This way i have couple of rows with multiple prIDs and the data is dynamic.
sample code:

          {{data.prID}}

A: You need nested loop when multiple ID on data.prID. Please try this way:

    {{link}};

A: Here's the code I've edited from Hanif

// Code goes here

angular.module('ui.bootstrap.demo', ['ngAnimate', 'ngSanitize', 'ui.bootstrap']);
angular.module('ui.bootstrap.demo').controller('DataCtrl', function ($scope) {

$scope.dataInfo = [
   {
     "prID": "1",
      "name": "Fight Club",
      "desc": "Brad"
    },
   {
     "prID": "2; 30; 21",
      "name": "Matrix (Series)",
      "desc": "Keanu Reeves"
    },
   {
     "prID": "33",
      "name": "V for Vendetta",
      "desc": "Hugo Weaving"
    },
    {
     "prID": "13",
      "name": "V for Vendetta",
      "desc": "Hugo Weaving"
    },
    {
     "prID": "111; 55",
      "name": "V for Vendetta",
      "desc": "Hugo Weaving"
    },
    {
     "prID": "3",
      "name": "V for Vendetta",
      "desc": "Hugo Weaving"
    }
  ];

});
<!doctype html>

    <link href="//netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

          {{link}};

Demo here


text:
Q: CAS with redis cluster I'm working on CAS using redis as ticket registry. On my local CAS uses redis as ticket rigistry and it's woking fine. Followed installation procedure given here
But I want redis behind load balancer if one redis goes down, CAS may contact other.
Redis configuration:
cas.ticket.registry.redis.host=localhost
cas.ticket.registry.redis.port=6379

But here I think redis cluster may not help since CAS connects to 6379 on localhost. As per above configuration if 6379 goes down or localhost (system) goes down CAS may not contact it. If redis cluster runs behind load balancer then one fail other may provide service. How to configure CAS with redis behind load balance?


text:
Q: "make" comment does not work after "cmake" on Mac OSX Trying to install a plugin to Gazebo 11 on my Macbook Air M1. I will try to perform co-simulation between Simulink and Gazebo. After extracting gazeboplugin.zip , I applied
mkdir build
cd build

Then I tried
cmake ..

I got an error
CMake Error at CMakeLists.txt:32 (message):
  The compiler /Library/Developer/CommandLineTools/usr/bin/c++ has no C++11
  support.  Please use a different C++ compiler.

Then I solved this by changing  cmakelists.txt from
#/* Copyright 2019-2020 The MathWorks, Inc. */
##########################################
# CMakeLists.txt for gazebo_plugin_for_simulink #
##########################################

cmake_minimum_required(VERSION 2.8)

PROJECT(gazebo_plugin_for_simulink)

#################################
# Specify the CMake module path #
#################################

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}  -Wall  -O3 -march=native ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall   -O3 -march=native")

# Check C++11 or C++0x support
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)

if(COMPILER_SUPPORTS_CXX11)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
   add_definitions(-DCOMPILEDWITHC11)
   message(STATUS "Using flag -std=c++11.")
elseif(COMPILER_SUPPORTS_CXX0X)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
   add_definitions(-DCOMPILEDWITHC0X)
   message(STATUS "Using flag -std=c++0x.")
elseif(COMPILER_SUPPORTS_CXX17)
    set (CMAKE_CXX_STANDARD 17)
    message(STATUS "Using C++17 standard")
else()
   message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")

IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++ -Wno-deprecated-declarations -Wno-unused-function")
ENDIF()

find_package(Boost 1.58.0 REQUIRED COMPONENTS date_time)
find_package(gazebo REQUIRED)

# Gazebo Minumum Supported version number
SET(GAZEBO_MIN_SUPPORTED_VERSION "9")
# Gazebo Maximum Supported version number
SET(GAZEBO_MAX_SUPPORTED_VERSION "11")

message(STATUS "Found Gazebo ${GAZEBO_VERSION}: major version is ${GAZEBO_MAJOR_VERSION}")

# Validate Installed Gazebo version
if("${GAZEBO_MAJOR_VERSION}" VERSION_LESS "${GAZEBO_MIN_SUPPORTED_VERSION}" OR "${GAZEBO_MAJOR_VERSION}" VERSION_GREATER "${GAZEBO_MAX_SUPPORTED_VERSION}" )

  message(FATAL_ERROR "\nThe installed version of Gazebo is not supported for Gazebo Co-Simulation Plugin generation.\n"
   " The Gazebo Co-Simulation Plugin supports,\n"
   "    minimum Gazebo version: gazebo ${GAZEBO_MIN_SUPPORTED_VERSION}.x series\n"
   "    maximum Gazebo version: gazebo ${GAZEBO_MAX_SUPPORTED_VERSION}.x series\n")

endif()

include_directories(
include/
msgsproto/
${Boost_INCLUDE_DIR}
${GAZEBO_INCLUDE_DIRS}
)

link_directories(
  ${GAZEBO_LIBRARY_DIRS}
)

###############################################
# USE => cmake .. -DTESTING=ON  to trun ON testing

option(TESTING "plugin testing" OFF)

if(TESTING)
   ADD_SUBDIRECTORY(msgsproto/pkgtest)
endif()

ADD_SUBDIRECTORY(msgsproto)
ADD_SUBDIRECTORY(src/transport)
ADD_SUBDIRECTORY(src/gazeboserver)
ADD_SUBDIRECTORY(src/gazebocustom)
ADD_SUBDIRECTORY(src/gazeboplugin)

if(TESTING)
   ADD_SUBDIRECTORY(src/gazeboplugin/pkgtest)
   ADD_SUBDIRECTORY(src/gazeboserver/gazebomsghandler/pkgtest)
   ADD_SUBDIRECTORY(src/gazebocustom/gazebocustommsghandler/pkgtest)
endif()

to
# Sets the C++ compiler
# Available: C++11, C++14 and C++17
cmake_minimum_required(VERSION 3.25)
project(ProjectName)
include(CheckCXXCompilerFlag)

CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)

if( (${CMAKE_VERSION} VERSION_GREATER "3.8.2") OR (${CMAKE_VERSION} VERSION_EQUAL "3.8.2") )

  if(COMPILER_SUPPORTS_CXX17)
    set (CMAKE_CXX_STANDARD 17)
    message(STATUS "Using C++17 standard")
  elseif(COMPILER_SUPPORTS_CXX14)
    set (CMAKE_CXX_STANDARD 14)
    message(STATUS "Using C++14 standard")
  elseif(COMPILER_SUPPORTS_CXX11)
    set (CMAKE_CXX_STANDARD 11)
    message(STATUS "Using C++11 standard")
  elseif(COMPILER_SUPPORTS_CXX0X)
    set (CMAKE_CXX_STANDARD 11)
    message(STATUS "Using C++11 standard")
  else()
    message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 or above support. Please use a different C++ compiler.")
  endif()

else()

  if(COMPILER_SUPPORTS_CXX14)
    set (CMAKE_CXX_STANDARD 14)
    message(STATUS "Using C++14 standard")
  elseif(COMPILER_SUPPORTS_CXX11)
    set (CMAKE_CXX_STANDARD 11)
    message(STATUS "Using C++11 standard")
  elseif(COMPILER_SUPPORTS_CXX0X)
    set (CMAKE_CXX_STANDARD 11)
    message(STATUS "Using C++11 standard")
  else()
    message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 or above support. Please use a different C++ compiler.")
  endif()

endif()

After solving ( I guess ) this issue I got this after making cmake ..
mfurkanozata@Furkans-MacBook-Air build % cmake ..

-- Using C++17 standard

-- Configuring done

-- Generating done

-- Build files have been written to: /Users/mfurkanozata/src/GazeboPlugin

Finally I aplly make command and got nothing. The plugin was not built and as usual after applying
gazebo ../world/multiSensorPluginTest.world --verbose

I got this error
[Err] [Plugin.hh:212] Failed to load plugin lib/libGazeboCoSimPlugin.so: dlopen(lib/libGazeboCoSimPlugin.so, 0x0009): tried: 'lib/libGazeboCoSimPlugin.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlib/libGazeboCoSimPlugin.so' (no such file), '/opt/homebrew/Cellar/gazebo11/11.12.0_2/lib/../lib/lib/libGazeboCoSimPlugin.so' (no such file), '/opt/homebrew/Cellar/gazebo11/11.12.0_2/bin/../lib/lib/libGazeboCoSimPlugin.so' (no such file), '/usr/lib/lib/libGazeboCoSimPlugin.so' (no such file, not in dyld cache), 'lib/libGazeboCoSimPlugin.so' (no such file)

Failed to load plugin lib/libGazeboCoSimPlugin.dylib: dlopen(lib/libGazeboCoSimPlugin.dylib, 0x0009): tried: 'lib/libGazeboCoSimPlugin.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlib/libGazeboCoSimPlugin.dylib' (no such file), '/opt/homebrew/Cellar/gazebo11/11.12.0_2/lib/../lib/lib/libGazeboCoSimPlugin.dylib' (no such file), '/opt/homebrew/Cellar/gazebo11/11.12.0_2/bin/../lib/lib/libGazeboCoSimPlugin.dylib' (no such file), '/usr/lib/lib/libGazeboCoSimPlugin.dylib' (no such file, not in dyld cache), 'lib/libGazeboCoSimPlugin.dylib' (no such file)

Can you help me in this issue?


text:
Q: How to read audit log in SharePoint 2013 online App? My requirement is to build an SharePoint Hosted App for Online to read audit logs. So anybody know how to read using java-script(so we can build it using NAPA also) ? If it is not possible then how to create an SharePoint App and in code behind  we can read Audit Logs?

A: The audit API is not available via the Client Object Model.
http://msdn.microsoft.com/en-us/library/ee557057(v=office.14).aspx
The same question
Can I Access the SPAuditQuery from the JavaScript Class Library?


text:
Q: jQuery ComboBox hack for custom input I'm using the code for this combobox.
I thought I would be slick by commenting out this part, which would allow text entry beyond unmatched queries.
/*Commented out to allow user input
if (!valid) {
    remove invalid value, as it didn't match anything
    $(this).val("");
    select.val("");
    input.data("autocomplete").term = "";
    return false;
}*/

The problem I'm running into with my cleverness is that I can't get this value while validating the form in JS. Any ideas on how I could do this?

A: The code for JQuery UI combobox has been modified since this question was posted and answered.  The link provided in the question still works, but the code there is different from the code being discussed in this thread.
Here is a fix for the new combobox code (as of 9/2/15) that works like Peter's approach.
First remove this block to prevent the custom value from being deleted:
this.input
  .val( "" )
  .attr( "title", value + " didn't match any item" )
  .tooltip( "open" );
this.element.val( "" );
this._delay(function() {
  this.input.tooltip( "close" ).attr( "title", "" );
}, 2500 );
this.input.autocomplete( "instance" ).term = "";

Replace with this block to add the custom value as a select option and set it as the current value:
this.element.append('<option>' + this.input.val() + '</option>'); //Add the new option
this.element.val(this.input.val()); //select the new option

A: So I got around this. I created a hidden variable:
<input id="EnterYourOwnValue" type="hidden" value="Enter New... or Select" />

Then I edited part of the jquery combo to save the value typed into EnterYourOwnValue:
                            if (!valid) {
                                $("#EnterYourOwnValue").val($(this).val());
                                /*Commented out to allow user input
                                //remove invalid value, as it didn't match anything
                                $(this).val("");
                                select.val("");
                                input.data("autocomplete").term = "";
                                return false;
                                */
                            }

OR to saves the selected value into it:
                        select: function (event, ui) {
                            $("#EnterYourOwnValue").val(ui.item.option.value);
                        ui.item.option.selected = true;
                        self._trigger("selected", event, {
                            item: ui.item.option
                        });

Now the autocomplete combobox is hacked to be a select or enter your own value in one box!

A: Why don't you just add the "invalid" input to the end of the select element like this
if (!valid) {
    select.append('<option>' + $(element).val() + '</option>'); //Add the new option
    select.val($(element).val()); //select the new option
}

This is only ever relevant if you are using straight text values in your select
I found your code while searching for an answer for this, but after reading your answers realised what I had to do.

A: Spent ages trying to get this to work with multiple comboboxes.
To get this post to work with multiple comboboxes I had to add this:

if($(select).attr('name') == YourComboBoxName) $("#EnterYourOwnValue").val($(this).val())

A: This is what did it for me while working with multiple comboboxes
of course I had to make a hidden input as well.
var thisinput = this.element.attr("name");
var value = this.input.val();

    if(thisinput == "YourComboBoxName"){
    $("#EnterYourOwnValue").val(value);
    }