text:
Q: Is there a way in salesforce using soql where we can get documents owned by other users but not necessarily shared to me? I want to collect all the documents owned by each User in Salesforce account.
I have created accessToken with User A's email, where User A is a System Admin with property PermissionsModifyAllData and PermissionsViewAllData is true.
For User A we get all docs for which he is owner of but for all other users we get docs in which User A is a shared permisison by directly shared or with Domain shared i.e. when trying to query docs for let say User B we are not able to get docs in which User B is owner but it is not shared with User A.
I am using below SOQL with accessToken created with User A's login.
https://testdomain.salesforce.com/services/data/v48.0/queryAll?q=select Id, Title, Description, ContentSize, isDeleted, OwnerId, ParentId, LastModifiedDate, LastModifiedById, CreatedDate, FileType, FileExtension, PublishStatus from ContentDocument where OwnerId = '005XXXX000XXXX00XX'

Any lead to solve this usecase will be much appreciated.

A: By Adding QueryAllFiles Permisison to the Profile which User belongs to I am able to fetch all other user's documents as well.
It was mentioned in the salesforce document as well which I missed at the first time.

Enable the Query All Files permission to let your View All Data users
bypass the restrictions on querying files. Query All Files returns all
files, including files in non-member libraries and files in unlisted
groups. Users can't edit, upload new versions, or delete files they
don't have access to. View All Data permission is required to enable
Query All Files.


text:
Q: Good way to get images from the file system and send them using HttpClient to an API in C# I am using ASP.NET Core 3.1. How can I get images from the file system and send them as IFormFile to an external API. The external API was built by me, I have total control over the code.
//here I grab the images from the file system.
List<String> images= System.IO.Directory.GetFiles(@"C:\www\proj\wwwroot\fotos_produtos\" + produto.DirFotos).Select(Path.GetFullPath).ToList();

product.Image1 = /// Image1 is a IFormFile, how can I convert the File system image to Iform File

HttpResponseMessage response = await client.PostAsJsonAsync("http://localhost:51265/api/produtos", product);

A: IFormFile represents a file sent with the HttpRequest. That is, it is used on the server receiving the files. In your case, you should use MultipartFormDataContent and ByteArrayContent.
        var file = await File.ReadAllBytesAsync("your path");

        HttpClient httpClient = new HttpClient();
        MultipartFormDataContent form = new MultipartFormDataContent();

        form.Add(new ByteArrayContent(file, 0, file.Length), "Image1", "image1.jpg");
        HttpResponseMessage response = await httpClient.PostAsync("your url", form);

This way, Image1 can be used as IFormFile on your server.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Refresh Contents Pane in ArcGIS Pro It seems I am missing simple functionality in Pro. How to update Contents pane in ArcGIS Pro other than to remove a layer from it and add it again?
I am working on some script which adds a subtype for a specific layer and it works fine, however, Contents pane is not automatically updated and subtype is not visible in it. There is a workaround where the script will remove a layer from the map(which might remove styling) and add it again.
But is there a simple refresh button for Contents pane or something similar I am missing here?


text:
Q: Novella where two travellers meet on an anomalously hot rock passing through the galaxy A couple years ago I read two novellas/novels set in the same universe. The outer galaxy is united in a largely digital civilization. Anyone that tries to enter the galactic core mysteriously finds themselves turned around.
In the first one, two travellers from different planets meet at a hot rock passing between their two solar systems. The main character, while she is on the trip, her whole planet slows down so that they will only experience a few years subjectively like her, as is there custom. On the planet/rock they find an aquatic species. The heat is caused by them figuring out how to turn themselves into little quantum strings or something that can run simulations and produce energy. Most people are in the circle faction but some are spiral in and others are spiral out.
In the second one, two travellers are invited to the galactic core as a planet is found that has DNA on it. The story alternates between their investigations and strange tale of weird alien life. It turns out the aliens are the source of the DNA and they evolved in the galactic core. Realizing how much the core sucks, they vowed to always push away others who try to enter the core. Thus they are revealed to be the mysterious keepers of the core.

A: The first story is the novella Hot Rock by Greg Egan. I read it in the 2010 anthology Godlike Machines.
It's set on the planet Tallulah. This is a rogue planet, i.e. a planet drifting alone through space, so it should have cooled to only a few degrees Kelvin but instead it is warm enough to have liquid water. The two travellers are Azaz and Shelma, who are sent to investigate the planet.
They find a sentient life form that look like lizards, and these have the three philosophies, Spiral In, Spiral Out and Circle:

The lizards had no apparent social hierarchies, and as hermaphrodites they exhibited no sexual dimorphism, but the scouts identified one curious form of division. Many of the
lizards identified themselves as belonging to one of three groups, which were named for the actions of spiraling inward, spiraling outward, and, the clear majority, following a circle.

I would guess the second book is Incandescence by Greg Egan. The galaxy is controlled by two groups, the Amalagum and the Aloof. The Aloof control the galactic core and prevent all attempts by the Amalgum to enter the core. The story starts when an uncatalogued DNA world is found by the Amalgum.


text:
Q: Adding a new line between itemized lines I'm having a problem trying to format my homework in LaTeX:
\documentclass[11pt]{article}

\usepackage[a4paper,margin=2cm]{geometry}
\usepackage[dutch]{babel}
\usepackage{parskip}
\usepackage{amssymb}
\usepackage{amsmath}
\begin{document}

....
\begin{enumerate}
\item Exercise 1....
\item Given $g:\mathbb{R}\to\mathbb{R}$, ....
\begin{enumerate}
\item Because .... it follows that ....
Given another $h:\mathbb{R}\to \mathbb{R}, \ x\longmapsto \sqrt{...}$
\item Because .... it follows that ....
\end{enumerate}
\end{enumerate}

\end{document}

Now, I would like the second "Given" function to be aligned the same way as the first one.
How do I make this happen, while still having the second item labeled with (b)?
so what I would like to get is something like:
1.) ....
2.) Given f...
     (a) .....
    Given g...
     (b) .....

And what I get now is:
1.) ....
2.) Given f...
     (a) .....
         Given g...
     (b) .....

A: I'd invite you to review your schema to see if this is really what you want; interrupting a list like this usually is a signal of not the best design choice. Perhaps you can find another way to present the information?
That being said, one option using the resume option from enumitem:
\documentclass[11pt]{article}
\usepackage[a4paper,margin=2cm]{geometry}
\usepackage[dutch]{babel}
\usepackage{parskip}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{enumitem}

\begin{document}

\begin{enumerate}
\item Exercise 1....
\item Given $g\colon\mathbb{R}\to\mathbb{R}$,
\begin{enumerate}
\item Because .... it follows that ....
\end{enumerate}
Given another $h\colon\mathbb{R}\to \mathbb{R}$,
\begin{enumerate}[resume]
\item Because .... it follows that ....
\end{enumerate}
\end{enumerate}

\end{document}

Without enumitem you can manually adjust the counter:
\documentclass[11pt]{article}
\usepackage[a4paper,margin=2cm]{geometry}
\usepackage[dutch]{babel}
\usepackage{parskip}
\usepackage{amssymb}
\usepackage{amsmath}

\begin{document}

\begin{enumerate}
\item Exercise 1....
\item Given $g\colon\mathbb{R}\to\mathbb{R}$,
\begin{enumerate}
\item Because .... it follows that ....
\end{enumerate}
Given another $h\colon\mathbb{R}\to \mathbb{R}$,
\begin{enumerate}
\setcounter{enumii}{1}
\item Because .... it follows that ....
\end{enumerate}
\end{enumerate}

\end{document}

or save it at the end of the first list and then use the value to step it in the second.
By the way, to separate the function name from its domain, codomain, you should use \colon and not : (there's a different in the horizontal spacing); no need for \longmapsto; use \mapsto.

A: Simply issuing a \par command will push the required statement one line down. But then, you will have two distances you should get rid of; the \leftmargin and the \listparindent of the current list. So, naturally, you can add this:
\par\hspace{\dimexpr-\leftmargin-\listparindent}

so that your statement can have the same alignment as the previous one. To be honest, I agree with @GonzaloMedina on the idea of choosing a better design.

\documentclass[11pt]{article}
\usepackage[a4paper,margin=2cm]{geometry}
\usepackage[dutch]{babel}
\usepackage{parskip,amssymb,amsmath}
\begin{document}

\begin{enumerate}
\item Exercise 1 ...
\item Given $g:\mathbb{R}\to\mathbb{R}$, ...
\begin{enumerate}
\item Because ... it follows that ... \par\hspace{\dimexpr-\leftmargin-\listparindent}
Given another $h:\mathbb{R}\to \mathbb{R}, \ x\longmapsto \sqrt{...}$
\item Because ... it follows that ...
\end{enumerate}
\end{enumerate}

\end{document}


text: Q: Как реализовать отправку сообщения с сервера на почту / телеграм (куда угодно) на php или javascript? На сайте сделал кнопку, при нажатии на которую собирается некоторое сообщение и отправляется на почту с помощью mail на php. Как я уже понял, этот метод устаревший и не надежный, так как зачастую сервер не считает нужным отправлять это письмо на почту. Поэтому возник вопрос, как корректно сделать отправку сообщения на почту либо на телеграм / ВК с помощью ботов? На каком языке это лучше сделать: php или JavaScript? Какие подводные камни? Буду благодарен за полезные ссылки и теорию!


text:
Q: How to copy not only binary file into CLion "Build output path"? I starded default "untitled" project in CLion. Add in project directory "config" with file "tools.conf" in it.
Then I changed default CMakeLists.txt to this:
cmake_minimum_required(VERSION 3.5)
project(untitled)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp)
add_executable(untitled ${SOURCE_FILES})

install(DIRECTORY config DESTINATION ${CMAKE_INSTALL_PREFIX})
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX})

Now I can type manually in shell:
cmake -DCMAKE_INSTALL_PREFIX=/home/me/build .; make; make install

And binary with directory both will be in /home/me/build.
But if I set in CLion - File - Settings - Build, Execution, Deployment - CMake - Build output path - /home/me/build and then press "Build" button. It generates directory /home/me/build/Debug and puts only one binary "untitled" in it.
I want CLion copied all project files in its "Build output path". How can I do this?


text:
Q: C# Convert byte array to string, using preamble or default encoding Im trying to convert a byte array to a string. The byte array includes a preamble (if the used encoder had one of those), and you must specify the default encoding if no preamble is stored in the byte array.
My code looks like this
public static string ArrayToStringUsingPreambleOrDefaultEncoder(byte[] bytes, Encoding defaultEncoder, out Encoding usedEncoder) {
  using (var mem = new MemoryStream(bytes))
  using (var reader = new StreamReader(mem, defaultEncoder, true)) {
    string result = reader.ReadToEnd();
    usedEncoder = reader.CurrentEncoding;
    return result;
  }
}

But it doesnt do the trick as I would expect.
How do I make a StreamReader use the encoding specified by the preamble or a default encoding if no preamble is found. Do I really have to manually compare the preamble of ALL known encoders to the start of the array to find the right one?

A: From MSDN: "StreamReader is designed for character input in a particular encoding". So yes, you really do need to sniff out the correct encoding from the preamble to do this. There's an example method to do this here:
http://www.personalmicrocosms.com/Pages/dotnettips.aspx?c=15&t=17
Edit: The above link is broken but the old page is available at Wayback Machine Internet Archive:  https://web.archive.org/web/20090203034127/http://www.personalmicrocosms.com/Pages/dotnettips.aspx?c=15&t=17*


text:
Q: Using filter to replace search function in Python To Python lovers and experts,
My code:
def getAssignee(keyTitle):
    assignee = ''
    for item in assigneeList:
        if(item['title']==keyTitle):
            assignee = item['name']
            break
    return assignee

My intention: To try out filter in python and replace above code with filter function. Assignee list is a list of dictionaries.
E.g.
assigneeList = [{'title':'Book', 'name':'Davis'},{'title':'TV','name':'Samsung'}]

My reference: Most efficient way to search in list of dicts
My attempt:
assignee = filter(lambda item: item['title']=='TV',assigneeList)
print(assignee['name'])

My Output:
Not working. Error "Value 'assignee' is unsubscriptable"
My question: How to get the assignee name, like how I got from the getAssignee() function?

A: The result of filter is a filter object, you can handle this several ways, and handling the eventuality of an empty filter

*

*use next(.., None) to get first matching or None value
def getAssignee(keyTitle):
    assignee = next(filter(lambda item: item['title'] == keyTitle, assigneeList), None)
    return assignee['name'] if assignee else ''

*collect the items in a list then pic the first
def getAssignee(keyTitle):
    assignee = list(filter(lambda item: item['title'] == keyTitle, assigneeList))
    return assignee[0]['name'] if assignee else ''

The next solution if more performant as it don't generates all the filter object, (the list will consumes all the filter, and eventually it could be big)

A: >>> assignee = filter(lambda item: item['title']=='TV',assigneeList)
>>> type(assignee)
<class 'filter'>

In python 3 filter function will return filter object. filter(function, iterable) is equivalent to the generator expression (item for item in iterable if function(item)). So In order to evaluate the items you can call list(assignee)


text:
Q: Chrome extension and accessing Google Drive I want to access google drive from a chrome extension and it appears that Google provides 2 ways to do it.
One is via the google-api-javascript-client:
https://github.com/google/google-api-javascript-client
I cannot find the npm entry for this library. Can it be installed via npm?
The other seems to be via the google-api-nodejs-client
https://github.com/googleapis/google-api-nodejs-client
This can be installed via this npm entry: https://www.npmjs.com/package/googleapis
Can google-api-nodejs-client be used in a Chrome extension?


text: Q: Asymptotic behaviour of a fourier transform Suppose $a(z) = \sum_{k=0}^n c_ke^{i\alpha_k z}, z\in\mathbb{C}$ for some real numbers $\alpha_k$. What methods would be available to me if I wanted to look at the asymptotic behaviour of $$I(s) = \int_a^b \dfrac{e^{i \xi t}}{|a(t)|^2}\,dt$$ as $\xi \to \pm\infty$? I did some computations (similar to this computation on asymptotics of Fourier coefficients) using residues for the simple case where $n = 1$ and $[a,b]$ matching the period of $|a(t)|^2$ but is it doable for $n>1?$


text:
Q: How do I create sections in a f.select input? I have a Posts model which belongs_to: Category.
When I create the post I can select from a list of categories which it belongs to.
My model category has a name and a gender attribute.
So, for example, some categories are "Accessories", "Jeans", "Shirts" (with gender "Male"), and the same for gender "female".
I could precede all of the names of the categories with men or women, i.e.: "Men's Jeans", "Women's Jeans", but I would prefer to separate the f.select into two sections - "Men", "Women". Something that would look like this:
Men
  Accessories
  Jeans
  etc
Women
  Accessories
  Jeans
  etc

The category does have the gender attribute, so I can differentiate by that as well as by ID because the first 10 id's belong to men and the next 10 belong to women. I just don't know how to show this within an f.select. Here is my current select:
<%= f.select :category_id, @categories.collect {|c| [ c.name, c.id ]} %>

Any help would be greatly appreciated as always!
EDIT
Alright my helper method is
def option_groups_from_collection_for_select(collection, group_method, group_label_method, option_key_method, option_value_method)
  collection.map do |group|
    option_tags = options_from_collection_for_select(
      group.send(group_method), option_key_method, option_value_method)

    content_tag(:optgroup, option_tags, :label => group.send(group_label_method))
  end.join.html_safe
end

and select is
<%= f.select(:type_id, option_groups_from_collection_for_select(@categories, :types, :category, :id, :name)) %>

This is getting the correct category & type and looks good, but when I go and edit the post, the select doesn't show the currently selected item.

A: See grouped_collection_select. It'll look like this:
<%= f.grouped_collection_select(:category_id, Category.top_level, :children, :name, :id, :name %>


text:
Q: Prove that the elements of these two sequences are not null Let $x_{n+1}=x_n+2y_n$ and $y_{n+1}=y_n-x_n$, where $x_1=1$ and $y_1=-1$.
I tried proving by contradiction, I tried by induction, I got nothing.
This is a question I had on an exam, I didn't manage to solve it, and afterwards I spent one day thinking about it and still came up with nothing.
Please note that a full solution is not necessary, if you could just provide a hint, that would be awesome.
The origin of the question was to show that $\left( \begin{array}{ccc}
1 & 2 \\
-1 & 1 \\
\end{array} \right)^n$ has no zero elements for any positive integer $n$.

A: The pair $(x_n, y_n)^T$ is equal to
$$
\begin{pmatrix}
1 & 2 \\
-1 & 1
\end{pmatrix}^{n-1}
\begin{pmatrix}
1 \\ -1
\end{pmatrix}.
$$
If you want to prove that there is no $n$ s.t. $x_n=y_n=0$, then you just use that fact that a regular matrix never maps a nonzero vector to zero. If you want to prove that for any $n$ neither $x_n$ nor $y_n$ is zero, do the eigenvalue decomposition and compute $x_n, y_n$ exactly.

A: Let $A=
\left( {\begin{array}{*{20}c}
   1 & 2  \\
   { - 1} & 1  \\
\end{array}} \right)
$. Let try us to diagonalize this matirx, we have to find first the eigenvalue of $A$.
\begin{align}
\left| {\lambda I - A} \right| = \left| {\begin{array}{*{20}c}
   {\lambda  - 1} & { - 2}  \\
   1 & {\lambda  - 1}  \\
\end{array}} \right| = \left( {\lambda  - 1} \right)^2  + 2 = \lambda ^2  - 2\lambda  + 3 \ne 0\,\,\left( {\text{for}\,\,\text{all}\,\,\text{real}\,\,\lambda } \right)
\end{align}
so that no "real" eigenvalues and thus the matrix $A$ is not diagonalizable; i.e., there is NO a non-singular matirx $P$ such that $PAP^{-1}=D$ (D:=diagonal matirx), or we write $A=P^{-1}DP$

A: Hint: look at their remainders $\pmod p$ for some small primes $p$.


text:
Q: How to determine the distribution iof this transformed variable $X_c = X ({1_{\{|X|>c\}}}-{1_{\{|X|\le c\}}})$ I have one question from econometric class which asks to find the probability distribution of the following:
$$X_c = X ({1_{\{|X|>c\}}}-{1_{\{|X|\le c\}}}) $$
where $X \sim N(0,1)$ and $c > 0$.
I am not even sure what $X_c$ is referring to. Does anyone have any idea? Thanks!

A: As you suggest ${1_{\{|X|>c\}}}-{1_{\{|X|\le c\}}}$ will be $1$ if $|X|>c$ and $-1$ otherwise.
I suggest you start by drawing a picture. Draw yourself a normal density.

Colour it in (say) blue where the expression ${1_{\{|X|>c\}}}-{1_{\{|X|\le c\}}}$ is $1$ and red where it's $-1$. Mark few values along the x-axis in both the blue and red regions. What will happen to the blue parts? What will happen to the red parts - where do they map to? If you can't see it yet, join each point up to its image on the axis (with a curved arrow). Can you see what's going on? (it should be quite obvious once you draw the diagram) Now go back and see if you can do it algebraically.

Ahem. I was looking for something more or less like this:

A: Hints: Consider some generic $x\in\mathbb{R}$ and let $Z=2\cdot 1_{|X|\geq c}-1$. $Z=1$ means $X>c$ or $X<-c$ and $Z=-1$ otherwise. Let $\Phi$ denote the CDF of $N(0,1)$. Then, $\Pr(X_c\leq x)=\Pr(XZ\leq x)$ and
\begin{aligned}
\Pr(XZ\leq x)=\Pr(X Z\leq x\;\cap\; Z=1)+\Pr(X Z\leq x\;\cap\; Z=-1)\equiv \color{red}{A}+\color{blue}{B}.
\end{aligned}
There are 3 cases:

*

*$x<-c$: show $A=\Phi(x)$ and $B=\ldots$ (To see why $A=\Phi(x)$ here, note $Z=1$ and $XZ\leq x$ for $x<-c$ is equivalent to $X<x$.)

*$-c\leq x\leq c$: show $A=\Phi(-c)$ and $B=\ldots$

*$x>c$: show $A=\Phi(x)-\Phi(c)+\Phi(-c)$ and $B=\ldots$

Show then that in all cases, $A+B$ is always $\ldots$ and conclude.
Edit: this kind of construction provides a way to demonstrate uncorrelation does not imply independence: you will find $E(X_c)=0$. And, therefore, whereas $X$ and $Z$ are clearly dependent, we have
$$
\text{Cov}(X,Z)=E(XZ)-E(X)E(Z)=E(X_c)-E(X)E(Z)=0-0E(Z)=0.
$$
There are easier constructions of course (e.g., take $Z=X^2$ instead.)


text:
Q: Double factorial identity Does anyone know a strategy for proving
$$
2\cdot(2k-3)!!=\sum_{i=1}^{k-1}(2i-3)!!(2(k-i)-3)!!\binom{k}{i}
$$
for $k\geq 2$? Note that $(-1)!!=1$. Hints would be most appreciated. Full solutions not so much.
I have considered induction but whereas the left hand side is multiplied by the next odd number in the induction step the right hand side becomes one term longer and each term is multiplied by a different factor.

A: First note that $$(2n-1)!!=\frac{(2n)!}{2^nn!}\;,$$ so that the desired identity can be written
$$\begin{align*}
\frac{2(2k-2)!}{2^{k-1}(k-1)!}&=\sum_{i=1}^{k-1}\left(\frac{(2i-2)!}{2^{i-1}(i-1)!}\cdot\frac{\big(2(k-i)-2\big)!}{2^{k-i-1}(k-i-1)!}\binom{k}i\right)\\\\
&=\frac1{2^{k-2}}\sum_{i=1}^{k-1}\frac{(2i-2)!(2k-2i-2)!k!}{i!(i-1)!(k-i)!(k-i-1)!}\\\\
&=\frac{k!}{2^{k-2}}\sum_{i=1}^{k-1}\left(\frac1i\binom{2(i-1)}{i-1}\cdot\frac1{k-i}\binom{2(k-i-1)}{k-i-1}\right)\\\\
&=\frac{k!}{2^{k-2}}\sum_{i=1}^{k-1}C_{i-1}C_{(k-2)-(i-1)}\\\\
&=\frac{k!}{2^{k-2}}\sum_{i=0}^{k-2}C_iC_{(k-2)-i}
\end{align*}$$
where $C_n$ is the $n$-th Catalan number. Now do a little simplification and apply a basic Catalan identity, and you'll have it.


text:
Q: How to print to a Bluetooth printer with ReactJS web app from phone I'm trying to implement print to a Bixolon Bluetooth POS printer with our ReactJS web app. I've implemented the print functionality with react-to-print - which works fine on PC, as the Bluetooth printer is detected with proper drivers installed. The problem is that the phone does not recognise this printer as printer when connected.
I can think of two solutions - but they might not be easy to implement. I could write an Java app which would listen to request of my React app and would trigger the print, or I could rewrite the project to React-Native and use react-native-bluetooch-escpos-printer
 (which would take way too much work as the project is already big).
I've also found react-native-web which, I think, should allow me to use react-native-bluetooch-escpos-printer
.
What would be the optimal solution here?


text:
Q: Problem adding textboxes dynamiclly in a relative layout I am having trouble dynamically adding a text box to my view. More specifically, the text-box-adder works, but the button I am trying to move below it does not. The original view is the first picture in the below hyperlink.
After the +/- button is pressed, it should add a text box between the second text box and the decide button, and then move the +/- button down so it is next to the new box. Instead, the second picture happens:
http://i.stack.imgur.com/mzBL3.png
My code looks like this:
EditText textBox2 = (EditText) findViewById(R.id.box2);

            RelativeLayout rel = (RelativeLayout) findViewById(R.id.mainlayout);

            Context context = getApplicationContext();
            EditText newText = new EditText(context);

            newText.setId(numBoxes);
            numBoxes++;

            LayoutParams p = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
            p.addRule(RelativeLayout.BELOW, bottomView.getId());
            p.addRule(RelativeLayout.ALIGN_RIGHT, bottomView.getId());
            newText.setWidth(220);
            newText.setHeight(LayoutParams.WRAP_CONTENT);
            newText.setLayoutParams(p);
            rel.addView(newText);
            bottomView = newText;
            ((TextView) bottomView).setText((CharSequence)bottomView.getTag());

            LayoutParams b = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
            Button goButton = (Button)findViewById(R.id.decide);
            b = (LayoutParams) goButton.getLayoutParams();
            b.addRule(RelativeLayout.BELOW, bottomView.getId());
            goButton.setLayoutParams(b);

            Button addButton = (Button)findViewById(R.id.addsub);
            b = (LayoutParams) addButton.getLayoutParams();
            b.addRule(RelativeLayout.RIGHT_OF, textBox2.getId());
            b.addRule(RelativeLayout.ALIGN_TOP, bottomView.getId());
            addButton.setLayoutParams(b);

Numboxes is just a counter so I can keep track of the boxes and name them accordingly, and bottomView is just the bottom-most text box.
I have searched all over the android development pages, and tried creating the new layout params. I also tried replacing the decide button with a text box, bu the same problem occurred. Please help.

A: For those that care, I'm part of this development team and we got our problem solved.
Here is the problem concept.
LayoutParams p = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);

In our layout, we're using a relative layout, thus the line should be:
 RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);

Assigning incompatible layout parameters causes problems.


text:
Q: The convergence of different metrics on the same space The following example is from my notes, and I would like clarification on some wider points connected to it, namely about extensions from what we understand metrics and metric spaces to be. It follows on from a previous question that I asked here: Changing of the limits of integration with the integral metric.
We have the integral metric on the space of continuous functions, $C([0,1])$,
$$d_{int}(f,g)=\int_{0}^1 |f(x)-g(x)|\,dx$$
And we are interested in the sequence of functions,
$$f_n(x) =
\begin{cases}
nx  & \text{for $0\le x \le \frac1n$} \\
1 & \text{for $x\ge \frac1n$}
\end{cases}$$
Setting $f(x):=1$, we move to show that $f_n\to f$ in $(C([0,1]),d_{int})$:
$$d_{int}(f_n,f)=\int_{0}^1 |f_n(x)-1|\,dx$$
$$=\int_{0}^{1/n} (1-nx)\,dx$$
$$=\frac1n-n\frac1{2n^2}$$
$$=\frac1{2n}$$
Thus, $d_{int}(f_n,f)\to 0$ as $n \to \infty$, and so $f_n \to f$ in $(C([0,1]),d_{int})$ as we wanted to show.
However, armed with a different metric, namely the uniform metric $d_u$, we notice that $f_n \not\to f$ in $(C([0,1]),d_{u})$.
The uniform metric on the interval $[0,1]$ is defined as,
$$d_u(f,g)=\sup_{x\in[0,1]}|f(x)-g(x)|$$
Now in my notes it says that since $f_n(0)=0$, it follows that,
$$\sup_{x\in [0,1]}|f_n(x)-f(x)|\ge|f_n(0)-f(0)|=1$$
So then, $d_u(f_n,f)\not\to0$ as $n\to0$.
Here are the points I am finding hard to come to grips with:

*

*What exactly do the integral metric and the uniform metric tell us about a space? I understand that metrics are notions of distance on a space, and understand the examples of the taxi-cab (Manhattan) metric and the Euclidean metric and can visualize them and so see how they are different and what they tell us. But what about the integral and uniform metrics; how can I visualize them and see how they are different? Am I correct in saying that the uniform metric returns the largest distance achieved between two functions?

*As seen in the example above, our sequence of functions $f_n$ converged to $f$ in $(C([0,1]),d_{inf})$ however, $f_n$ did not converge to $f$ in $(C([0,1])d_u)$. How is it that convergence is relative to the metric on the space? And furthermore, what is it that these convergences tells us, depending on the metric used?

A: The integral (also known as tha $L^1$ metric) and the uniform metric cannot be defined on any space. The uniform metric is defined on sets of bounded, real (or complex) valued functions defined on a set $X$. If $f,g\colon X\to\mathbb{R}$ are bounded, then
$$
d_\text{u}(f,g)=\max_{x\in X}|f(x)-g(x)|.
$$
It measures the greates difference between the values of the two functions.
For the integral metric to be defined, there must be a notion of integral defined on $X$, that is, $X$ shouldbe a measure space. In your example $X=[0,1]$, the measure is Lebesgue measure and
$$
d_\text{int}(f,g)=\int_0^1|f(x)-g(x)|\,dx.
$$
It measures the area between the graphs of the functions $f$ and $g$.
It is clear that $d_\text{int}(f,g)\le d_\text{u}(f,g)$. Thus, if $f_n$ converges to $f$ in the uniform metric, it also converges in the integral metric. But as your example shows, the converse is not true.The area bounded by the graph of $|f-g|$ can be very small. ant the maximum of $|f-g|$ very large.
Finally, in $\mathbb{R}^n$, both notions are equivalent:
$$
\max_{1\le i\le n}|x_i-y_i|\le\sum_{i=1}^n|x_i-y_i|\le n\max_{1\le i\le n}|x_i-y_i|.
$$


text:
Q: unique differentiable atlas making $F$ diffeomorphims Let $M$ be a differentiable manifold and $F:M\to N$ be a bijective mapping. If $M$ is a topological space, then $N$ admits a unique topology making $F$ a homeomorphism; it is easy prove that this topology could be:
$$T_N=\Big\{F(U):U\text{ is open in }M\Big\}$$
If $\mathfrak{A}_M=\{(U_\alpha,\varphi_\alpha)\}$ is a differentiable atlas in $M$, we can show that $\mathfrak{A}_N=\{(V_\alpha,\psi_\alpha)\}_{\alpha\in A}$ constitutes a differentiable atlas in $N$; with:
$$V_\alpha = F(U_\alpha)\qquad\text{ and }\qquad \psi_\alpha=\varphi_\alpha \circ F^{-1}$$
for any $\alpha \in A$.
How I can prove that $\mathfrak{A}_N$ is the unique differentiable atlas on $N$ that makes $F$ diffeomorphism?
If $I$ suppose $(W,\phi)$ local chart in $N$ such that $V_\alpha\cap W\ne \phi$ for some $\alpha \in A$, and I prove that $W$ and $V$ are compatibles, this implies that $\mathfrak{A}_N$ is unique by this way?
Many thanks!


text:
Q: Manhattan distance vs Euclidean distance Suppose that for two vectors A and B, we know that their Euclidean distance is less than d.
 What can I say about their Manhattan distance?

A: HINT: Pick a point $p$ and consider the points on the circle of radius $d$ centred at $p$. Which of them are furthest from $p$ in the Manhattan metric? Everything inside the circle is closer to $p$ in the Manhattan metric than those points.
Added: For the question in your comment take a look at this rough sketch:

Certainly $d_1<d_2$; how do $m_1$ and $m_2$ compare? (If you need numbers, those could be the points $\langle 1,0\rangle$ for $p_2$ and $\langle\frac35,\frac35\rangle$ for $p_1$, for instance.)

A: Hint:
$$
\overbrace{(\Delta x)^2+(\Delta y)^2}^{\begin{array}{c}\text{square of the}\\\text{ Euclidean distance}\end{array}}\le(\Delta x)^2+2|\Delta x\Delta y|+(\Delta y)^2=\overbrace{(|\Delta x|+|\Delta y|)^2}^{\begin{array}{c}\text{square of the}\\\text{ Manhattan distance}\end{array}}\tag{1}
$$
Furthermore, since the square of a real number is non-negative,
$$
(\Delta x)^2-2|\Delta x\Delta y|+(\Delta y)^2=(|\Delta x|-|\Delta y|)^2\ge0\tag{2}
$$
we can add $(|\Delta x|+|\Delta y|)^2$ to both sides of $(2)$ to get
$$
2\overbrace{\left[(\Delta x)^2+(\Delta y)^2\right]}^{\begin{array}{c}\text{square of the}\\\text{ Euclidean distance}\end{array}}\ge\overbrace{(|\Delta x|+|\Delta y|)^2}^{\begin{array}{c}\text{square of the}\\\text{ Manhattan distance}\end{array}}\tag{3}
$$

A: In $n$ dimensional space, Given a Euclidean distance $d$, the Manhattan distance $M$ is :

*

*Maximized when $A$ and $B$ are 2 corners of a hypercube

*Minimized when $A$ and $B$ are equal in every dimension but 1 (they lie along a line parallel to an axis)

In the hypercube case, let the side length of the cube be $s$.  Then $sn = M$ and $s^2 + s^2 + s^2 \dots = d^2$, so $n(M/n)^2 = d^2$, or $M = d\sqrt{n}$.
In the line case, $M = d$.
So given $d$, you can infer $d < M < d\sqrt{n}$.
And if you are only given that $d$ is the upper bound of the Euclidean distance, then you can only infer that $M < d\sqrt{n}$, and no lower bound can be inferred.


text:
Q: Matrix Multiplication(Python3.x) I would like to two integers which are receiving the user as a matrix;
For example:
m=int(input(enter the row number")
n=int(input("enter the column number:
A=input("enter your matrix: ")
print (A) #with column and row

How can i do this?


text:
Q: Stand-alone Cisco switch in BladeCenter is un-pingable After un-stacking a Cisco switch in my IBM blade center I can no longer ping the management IP I had configured on my management VLAN. The only item I see that changed is that the Bladecenter AMM added a internal Ethernet management port. There has been some discussion on reddit. Prior to un-stacking this VLAN interface was working.
I still haven't found a resolution that would explain why this isn't working or how to allow access over the current management VLAN. If possible I would like to keep L3 routing off on the switch.
As far as testing I have configured an access port and truck port native to the management VLAN. I connected a laptop with a static IP within the management VLAN range to these ports and was not able to ping or access the swith. When the switch is connected it does pass traffic, as expected, on all ports/VLANs. However I was still unable to ping or SSH the switch directly.
For testing purposes:

*

*I have configured an access port and truck port native to the management VLAN, I've configured a laptop with a IP in the management VLAN to connect to these test ports.

*I've devices on other VLAN are able to connect and pass traffic though this switch.

*The switch its self cannot ping other devices when using no source, the FE interface as source, or the management VLAN IP as the source.

*I've removed the management VLAN IP, and configured the FastEthernet port with the management VLAN IP.

*

*I suspect this doesn't work as I cannot set a VLAN onto the FastEthernet port

*I've removed the default gateway with, and without, the VLAN ID configured and with the FasEthernet port configured.

Here is a partial config
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname sw-7-tsting
!
boot-start-marker
boot-end-marker
!
enable secret ...
!
username ....
no aaa new-model
clock timezone EST -5 0
switch 1 provision ws-cbs3110g-s-i
system mtu routing 1500
!
!
ip domain-name abc.def
vtp mode transparent
!
!
crypto pki ...
!
spanning-tree mode rapid-pvst
spanning-tree extend system-id
spanning-tree pathcost method long
no spanning-tree vlan 1-4094
!
!
port-channel load-balance src-dst-ip
!
!
vlan internal allocation policy ascending
!
vlan N
 name traffic N
!
vlan NN
 name traffic NN
!
vlan NNN
 name traffic NNN
!
vlan XXX
 name network management
!
ip ssh time-out 60
ip ssh version 2
!
!
!
interface FastEthernet0
 ip address 192.168.x.x 255.255.255.0
!
interface GigabitEthernet1/0/17
 description used to test all vlans
 switchport trunk native vlan XXX
 switchport trunk allowed vlan N,NN,NNN,XXX
 switchport mode trunk
 switchport nonegotiate
!
interface GigabitEthernet1/0/18
 description used to test network VLAN XXX
 switchport access vlan XXX
 switchport mode access
 switchport nonegotiate
!
interface Vlan1
 no ip address
 shutdown
!
interface Vlan XXX
 ip address 10.XXX.200.236 255.255.255.0
!
ip default-gateway 10.XXX.200.1
ip http server
ip http secure-server
!
snmp-server community public RO
snmp-server host 10.XXX.200.30 version 2c public udp-port 161
!
line con 0
line vty 0 4
 login
 transport input ssh
line vty 5 15
 login
!
ntp server 129.6.15.30
end

A: I was eventually able to be able to ping/ssh into the switch. The issue was within the BladeCenter configuration. To addresses this I needed to

*

*Under I/O Modules > Configuration I made sure that the IP assiged to
the same IP range as the BladeCenter AMM modual

*I/O Modules > Configuration > Advanced Configuration > Advanced Setup you will need to Enable "External management over all ports"
and "Preserve new IP configuration on all resets"

*Removed all other VLAN interfaces

*Reload/ Reboot the switch. If you ping the switch during the boot sequence you may see a "Reply: Destination host unreachable"
from the AMM IP address untell the switch is back up.

If the previous steps did not work you may need to activate Protected Mode in I/O Modules > Admin/Power/Restart. After selecting "Perform action" the following message will be showed.
    You have selected to enable protected mode on I/O module(s) 10.
Protected mode allows you to limit the actions that an MM user can perform on an I/O module. Specifically, the following actions
cannot be performed on the MM user interfaces while an I/O module is in protected mode. These actions can only be performed
using the native management interface of the selected I/O module in protected mode.

Changing the I/O module IP configuration (IP address, subnet mask, gateway)

Resetting the I/O module settings to their factory defaults

Changing the I/O module external port settings

Changing the I/O module external management settings

Note that activating protected mode on an I/O module is a two step process. Once protected mode is enabled on this page, you
must access the native management interface of the selected I/O modules and activate protected mode there. After this second
step, protected mode becomes fully activated, and the actions listed above can no longer be performed on the MM user interfaces.
Also note that, once protected mode is fully active on an I/O module, it cannot be disabled using the MM user interfaces. It has
to be disabled on the I/O module's native management interface first.
If you want to enable protected mode on the selected I/O modules, click the "Enable Protected Mode" button. Otherwise click the
"Cancel" button.

Protection Mode to protect the network components from the BladeCenter AMM. If a switch is stacked this will be activated be default.


text:
Q: MySQL query for parent and child table I need help writing a mysql query. I have two tables, one parent, one child.
Parent table: garments
  `garment_id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `description` text,
  PRIMARY KEY (`garment_id`)

Child table: garment_images
 `id` int(11) NOT NULL AUTO_INCREMENT,
  `garment_id` int(11) NOT NULL,
  `filename` varchar(100) NOT NULL,
  `order` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)

I would like query all garments, and to show the first image for each item from the 'garment_images' table.

A: This should be fairly close:
SELECT G.*, (
    SELECT GI.id, GI.filename from garment_images as GI
       WHERE GI.garment_id = G.garment_id
       ORDER BY GI.order DESC
       LIMIT 1)
FROM garments as G

A: Split the problem:

*

*Retreive the first image id for every garment

*Put the data together

Step 1:
select gi.*
from
    garment_images as gi
    inner join (
        select min(id) as minId
        from garment_images
        group by garment_id
    ) as a on gi.garment_id = a.minId

I'll leave to you the second step (Hint: join the data from the query above with your garment table)

A: If "the first image" is the one with order = 1 (SQL Fiddle)
SELECT * from garments g JOIN garment_images gi
  ON g.garment_id = gi.garment_id
  WHERE gi.order = 1


text:
Q: scikit-image color.rgb2gray warning Related to this question and this discussion.
Unfortunately, my input images are in 2D grayscale.
Although my image processing script is still working fine, my IPython console is full of repeating warnings.
Can anyone help me:

*

*how to turn off the warning or

*how to solve it so that there is no more warning?

It is not clear how to do it (at least for a beginner like me).
Thanks!
version: scikit-image 0.17.2

A: To turn off the warnings, you can add the following lines:
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)

before you run the function in question.


text:
Q: Is this possible to do in RethinkDB I've used mongodb in the past and I want to use similar schema. I've tried to create it using PHP driver but it doesn't work as I expected. So my guesses were either rethinkdb does not support it or php driver is not capable to do this.
r\table('User')->insert([
        'username' => 'Something',
        'skills' => [
            'php' => 10,
            'html' => 15
        ]
        ])->run($conn)

result in RethinkDB administrator js client:
{
    "username":  "Something" ,
    "id":  "899a2693-dd94-4670-a496-05626a88d190" ,
    "skills": { }
}

What do you suggest and how should I do this?

A: It seems to work with PHP 5.4.13, RethinkDB 1.5.1 and the lastest version of php-rql.
r\table('User')->insert([
        'username' => 'Something',
        'skills' => [
            'php' => 10,
            'html' => 15
        ]
])->run($conn);

It gives the following results:
$result = r\db("test")->table("user")->run($conn);
print_r($result->toNative());

Array
(
    [0] => Array
        (
            [username] => Something
            [skills] => Array
                (
                    [php] => 10
                    [html] => 15
                )

            [id] => 2c66490f-72da-49ad-9692-a85366ce94ab
        )

)

And in the Data Explorer:
[

    {
        "username": "Something" ,
        "skills": {
            "php": 10 ,
            "html": 15
        } ,
        "id": "2c66490f-72da-49ad-9692-a85366ce94ab"
    }

]


text:
Q: Angular directive event not triggered in compile function I have tried alot but didn't got success, how can i trigger ng-click in such scenario where it is bind in compile function?
function() {
        return {
            restrict: 'EA',
            compile: function(element, attr) {
                return function(scope, element, attr) {
                    element.html('

');
                }
            },
            controller : function($scope){
                $scope.save = function(){
                    console.log('save');
                }
            }
        };
    }
])

A: Use the link and $compile to produce the results you require:
return {
            restrict: 'EA',
            link: function (scope, element) {
                element.html('
save
');
                $compile(element.contents())(scope);
            },
            controller: function ($scope) {
                $scope.save = function () {
                    console.log('save');
                }
            }
        }


text:
Q: how to implement BottomAppBar in android? how to implement BottomAppBar in android.
build.gradle
implementation 'com.google.android.material:material:1.0.0-beta01'

activity_main2.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<!--    <FrameLayout-->
<!--        android:id="@+id/frames"-->
<!--        android:layout_width="match_parent"-->
<!--        android:layout_height="wrap_content" />-->

    <com.google.android.material.bottomappbar.BottomAppBar
        android:id="@+id/bottom_app_bar"
        style="@style/Widget.MaterialComponents.BottomAppBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        app:menu="@menu/bottom_app_bar" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>

when i start for implement BottomAppBar Then give me this error in xml file:

when i run app then Force stop app and give this error :
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xxxx.xxxx, PID: 8698
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxxx.xxxx/com.xxxx.xxxx.Activity.HomeActivity}: android.view.InflateException: Binary XML file line #14 in com.xxxx.xxxx:layout/activity_home2: Binary XML file line #14 in com.xxxx.xxxx:layout/activity_home2: Error inflating class com.google.android.material.bottomappbar.BottomAppBar
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3448)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:237)
    at android.app.ActivityThread.main(ActivityThread.java:7807)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1047)
 Caused by: android.view.InflateException: Binary XML file line #14 in com.xxxx.xxxx:layout/activity_home2: Binary XML file line #14 in com.xxxx.xxxx:layout/activity_home2: Error inflating class com.google.android.material.bottomappbar.BottomAppBar
 Caused by: android.view.InflateException: Binary XML file line #14 in com.xxxx.xxxx:layout/activity_home2: Error inflating class com.google.android.material.bottomappbar.BottomAppBar

A: It's not an error - it's just view cannot be rendered by Android Studio, cause it doesn't know how to load this view. Moreover, you can build your application without any errors.
If you want make preview working - try click rebuild in Build settings of Android Studio. It should help to render a preview.

A: Update your theme of MaterialComponents
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

The latest version of Material Library is given here


text:
Q: Simple Trigonometry and algebra If $$\sec\theta = X + \frac{1}{4X},$$
then what is $${\sec\theta + \tan\theta}$$  in terms of  $X$?

A: $\displaystyle \sec\theta=X+\frac1{4X}$
$\displaystyle\implies\tan^2\theta= \sec^2\theta-1=\left(X+\frac1{4X}\right)^2-1=\left(X+\frac1{4X}\right)^2-4\cdot X\cdot\frac1{4X}=\left(X-\frac1{4X}\right)^2$
$\displaystyle\implies\tan\theta=\pm\left(X-\frac1{4X}\right)$

Let $\displaystyle \sec\theta+\tan\theta= y\iff \sec\theta-\tan\theta=\frac1y$
$\displaystyle\implies 2\sec\theta=y+\frac1y$
$\displaystyle\implies y+\frac1y=2\sec\theta=2\left(X+\frac1{4X}\right)$
Rearrange to form a Quadratic Equation in $y$ and solve

A: Change $sec\theta$ to $\frac{1}{cos\theta}$ and solve for $cos\theta$.  Then, use the Pythagorean Identity ($sin^2\theta + cos^2\theta = 1$) to solve for $sin\theta$.  You know that $tan\theta = \frac{sin\theta}{cos\theta}$, so you I'll let you take it from there.

A: If     secθ=X+(1/(4X)),You can find  (secθ+tanθ).
Since  $sin^2  θ+ cos^2  θ  = 1$
 you can find  tanθ , Because $1-sec^2 θ= tan^2 θ$.
So after finding $tan^2 θ$ ,get the square root of it. After that game is over . Find what u want.


text:
Q: How can i create a chart based on a TaskList? The problem is harder than it sounds. will try to describe it.
I have a HelpDesk Task list that consist of a such columns.
...... Title ..... | ... Assigned to |     Progress    |     Due Date    |  etc.

Printer problem    |      .Vadim.    |       50% .     |     15.03.10    |

Now i need to create some chart  that will take information from this task list, and give me such an info like: Technician Vadim has 10 tasks, 3 of them completed  50%, 7 comlited 100%.
Is it possible to do it? I've tried it with PKI, Indicators, without success.
Please i really need it. If you can show me the way or even direction where to dig, i can do it. Just tell me where and with whith tools i have to  do it.
I'm using Sharepoint enterprise server 2010, i've dashboard and share-point designer installed.
Thank you very much!

A: There are a number of charting packages available, as well as the .NET chart controls that you could utilize.
A pay for product with support
http://www.dundas.com/dashboard/features/sharepoint-dashboards.aspx
Free alternatives:
http://chartpart.codeplex.com/
http://charts4sharepoint.codeplex.com/
And if you don't have access or cant get a solution installed you can fall back on utilizing JavaScript / XML / XSLT.  Some links to get you started:
https://www.nothingbutsharepoint.com/sites/eusp/Pages/finally-dynamic-charting-in-wss-no-code-required.aspx
*they use Google charts in above example, but it can be modified and use Yahoo charts, JQuery charts, Fusion Charts, VisiFire charts, or other opensource/free charting tool.

A: I think you can easily achieve this OOB, following the diff options (only 4 is dependent on 3)

*

*Use the OOB Chart WebParts

*Can use Excel Services, access the data using the data connection/webservice

*Advanced Sol. : User PowerPivot and design a cube with slicers and dicers :)

*Advanced Sol. : Use the Power Pivot xls and Datasource into Performance Point and design amazing reports (I think this is an overkill, have to configure cache, security...etc)

A: You can create/customize SharePoint Gantt chart using SharePoint designer - http://www.indrasani.com/creating-gantt-chart-using-sharepoint-designer/

A: You can create/customize SharePoint Gantt chart using SharePoint designer - http://www.indrasani.com/?p=16


text:
Q: Errai 4.0 Beta 3 give this error "Encountered error when looking up JsType providers" I am getting this error in chrome console while debugging using Eclipse and SDBG. Beside this error, the web app and page is functioning well.
Any idea how to troubleshoot this?
[SyncBeanManager] Encountered error when looking up JsType providers for my.devs.web.client.local.page.Create
Where Create is
@Page
@Templated
public class Create extends Composite {
...
}

Full error:
13:05:49 FINE [Dash] Display create complaint form
ErraiConsoleLogHandler.java:79 13:05:49 FINE [Navigation] Navigating to Create at url: Create
ErraiConsoleLogHandler.java:79 13:05:49 FINE [SyncBeanManager] Looking up beans for my.devs.web.client.local.page.Create
ErraiConsoleLogHandler.java:79 13:05:49 FINE [SyncBeanManager] Encountered error when looking up JsType providers for my.devs.web.client.local.page.Create
ErraiConsoleLogHandler.java:79 com.google.gwt.core.client.JavaScriptException: (TypeError) : lai_g$(...).getProviders is not a function
    at Unknown.TypeError: lai_g$(Unknown@-1)
    at Unknown.Xfi_g$(erraiapp-0.js@21:82497)
    at Unknown.egi_g$(erraiapp-0.js@27:82593)
    at Unknown.dgi_g$(erraiapp-0.js@15:82584)
    at Unknown.bgi_g$(erraiapp-0.js@22:82566)
    at Unknown.cgi_g$(erraiapp-0.js@26:82572)
    at Unknown.agi_g$(erraiapp-0.js@24:82553)
    at Unknown.Xgi_g$(erraiapp-0.js@31:82860)
    at Unknown.PGi_g$(erraiapp-0.js@31:91245)
    at Unknown.pDi_g$(erraiapp-0.js@30:90073)
    at Unknown.qDi_g$(erraiapp-0.js@8:90086)
    at Unknown.sDi_g$(erraiapp-0.js@8:90099)
    at Unknown.rDi_g$(erraiapp-0.js@8:90091)
    at Unknown.gDi_g$(erraiapp-0.js@10:89962)
    at Unknown.k0i_g$(erraiapp-0.js@24:61969)
    at Unknown.l0i_g$(erraiapp-0.js@8:61963)
    at Unknown.t0i_g$(erraiapp-0.js@24:62021)
    at Unknown.lambda_0_g$(erraiapp-0.js@27:103)
13:05:49 FINE [SyncBeanManager] Looked up 1 beans: [[type=my.devs.web.client.local.page.Create, qualifiers=[@Default, @Any]]]
ErraiConsoleLogHandler.java:79 13:05:49 FINEST [TemplateUtil]

Test Create

 Create

ErraiConsoleLogHandler.java:79 13:05:49 FINER [TemplateUtil] Searching template for fields.
ErraiConsoleLogHandler.java:79 13:05:49 FINE [Create] Create construct ...
ErraiConsoleLogHandler.java:79 13:05:49 FINE [Create] Create constructed ...
ErraiConsoleLogHandler.java:79 13:05:49 FINE [Dash] Dash page hiden!

I am also getting another similar error but for LifecycleListenerRegistrar
[SyncBeanManager] Encountered error when looking up JsType providers for org.jboss.errai.ioc.client.lifecycle.api.LifecycleListenerRegistrar

> ErraiConsoleLogHandler.java:79 13:05:49 FINE [Dash] Display create complaint form
ErraiConsoleLogHandler.java:79 13:05:49 FINE [Navigation] Navigating to Create at url: Create
ErraiConsoleLogHandler.java:79 13:05:49 FINE [SyncBeanManager] Looking up beans for my.devs.web.client.local.page.Create
ErraiConsoleLogHandler.java:79 13:05:49 FINE [SyncBeanManager] Encountered error when looking up JsType providers for my.devs.web.client.local.page.Create
ErraiConsoleLogHandler.java:79 com.google.gwt.core.client.JavaScriptException: (TypeError) : lai_g$(...).getProviders is not a function
    at Unknown.TypeError: lai_g$(Unknown@-1)
    at Unknown.Xfi_g$(erraiapp-0.js@21:82497)
    at Unknown.egi_g$(erraiapp-0.js@27:82593)
    at Unknown.dgi_g$(erraiapp-0.js@15:82584)
    at Unknown.bgi_g$(erraiapp-0.js@22:82566)
    at Unknown.cgi_g$(erraiapp-0.js@26:82572)
    at Unknown.agi_g$(erraiapp-0.js@24:82553)
    at Unknown.Xgi_g$(erraiapp-0.js@31:82860)
    at Unknown.PGi_g$(erraiapp-0.js@31:91245)
    at Unknown.pDi_g$(erraiapp-0.js@30:90073)
    at Unknown.qDi_g$(erraiapp-0.js@8:90086)
    at Unknown.sDi_g$(erraiapp-0.js@8:90099)
    at Unknown.rDi_g$(erraiapp-0.js@8:90091)
    at Unknown.gDi_g$(erraiapp-0.js@10:89962)
    at Unknown.k0i_g$(erraiapp-0.js@24:61969)
    at Unknown.l0i_g$(erraiapp-0.js@8:61963)
    at Unknown.t0i_g$(erraiapp-0.js@24:62021)
    at Unknown.lambda_0_g$(erraiapp-0.js@27:103)
ErraiConsoleLogHandler.java:79 13:05:49 FINE [SyncBeanManager] Looked up 1 beans: [[type=my.devs.web.client.local.page.Create, qualifiers=[@Default, @Any]]]
ErraiConsoleLogHandler.java:79 13:05:49 FINEST [TemplateUtil]

Test Create

 Create

ErraiConsoleLogHandler.java:79 13:05:49 FINER [TemplateUtil] Searching template for fields.
ErraiConsoleLogHandler.java:79 13:05:49 FINE [Create] Create construct ...
ErraiConsoleLogHandler.java:79 13:05:49 FINE [Create] Create constructed ...
ErraiConsoleLogHandler.java:79 13:05:49 FINE [Dash] Dash page hiden!
ErraiConsoleLogHandler.java:79 13:05:49 FINE [SyncBeanManager] Looking up beans for org.jboss.errai.ioc.client.lifecycle.api.LifecycleListenerRegistrar
ErraiConsoleLogHandler.java:79 13:05:49 FINE [SyncBeanManager] Encountered error when looking up JsType providers for org.jboss.errai.ioc.client.lifecycle.api.LifecycleListenerRegistrar
ErraiConsoleLogHandler.java:79 com.google.gwt.core.client.JavaScriptException: (TypeError) : lai_g$(...).getProviders is not a function
    at Unknown.TypeError: lai_g$(Unknown@-1)
    at Unknown.Xfi_g$(erraiapp-0.js@21:82497)
    at Unknown.egi_g$(erraiapp-0.js@27:82593)
    at Unknown.dgi_g$(erraiapp-0.js@15:82584)
    at Unknown.bgi_g$(erraiapp-0.js@22:82566)
    at Unknown.cgi_g$(erraiapp-0.js@26:82572)
    at Unknown.agi_g$(erraiapp-0.js@24:82553)
    at Unknown.Xgi_g$(erraiapp-0.js@31:82860)
    at Unknown.oji_g$(erraiapp-0.js@12:83032)
    at Unknown.NDi_g$(erraiapp-0.js@20:90266)
    at Unknown.JFi_g$(erraiapp-0.js@24:90841)
    at Unknown.n_i_g$(erraiapp-0.js@16:91489)
    at Unknown.m_i_g$(erraiapp-0.js@8:91449)
    at Unknown.uDi_g$(erraiapp-0.js@27:90119)
    at Unknown.mDi_g$(erraiapp-0.js@12:89902)
    at Unknown.YDi_g$(erraiapp-0.js@24:90353)
    at Unknown.dhi_g$(erraiapp-0.js@17:82919)
    at Unknown.PGi_g$(erraiapp-0.js@223:91245)
    at Unknown.pDi_g$(erraiapp-0.js@30:90073)
    at Unknown.qDi_g$(erraiapp-0.js@8:90086)
    at Unknown.sDi_g$(erraiapp-0.js@8:90099)
    at Unknown.rDi_g$(erraiapp-0.js@8:90091)
    at Unknown.gDi_g$(erraiapp-0.js@10:89962)
    at Unknown.k0i_g$(erraiapp-0.js@24:61969)
    at Unknown.l0i_g$(erraiapp-0.js@8:61963)
    at Unknown.t0i_g$(erraiapp-0.js@24:62021)
    at Unknown.lambda_0_g$(erraiapp-0.js@27:103)
ErraiConsoleLogHandler.java:79 13:05:49 FINE [SyncBeanManager] Looked up 1 beans: [[type=org.jboss.errai.ioc.client.lifecycle.impl.LifecycleListenerRegistrarImpl, qualifiers=[@Default, @Any]]]
ErraiConsoleLogHandler.java:79 13:05:49 FINE [SyncBeanManager] Looking up beans for org.jboss.errai.ioc.client.lifecycle.api.LifecycleListenerRegistrar
ErraiConsoleLogHandler.java:79 13:05:49 FINE [SyncBeanManager] Encountered error when looking up JsType providers for org.jboss.errai.ioc.client.lifecycle.api.LifecycleListenerRegistrar
ErraiConsoleLogHandler.java:79 com.google.gwt.core.client.JavaScriptException: (TypeError) : lai_g$(...).getProviders is not a function
    at Unknown.TypeError: lai_g$(Unknown@-1)
    at Unknown.Xfi_g$(erraiapp-0.js@21:82497)
    at Unknown.egi_g$(erraiapp-0.js@27:82593)
    at Unknown.dgi_g$(erraiapp-0.js@15:82584)
    at Unknown.bgi_g$(erraiapp-0.js@22:82566)
    at Unknown.cgi_g$(erraiapp-0.js@26:82572)
    at Unknown.agi_g$(erraiapp-0.js@24:82553)
    at Unknown.Xgi_g$(erraiapp-0.js@31:82860)
    at Unknown.oji_g$(erraiapp-0.js@12:83032)
    at Unknown.nji_g$(erraiapp-0.js@8:83028)
    at Unknown.RDi_g$(erraiapp-0.js@64:90298)
    at Unknown.Oji_g$(erraiapp-0.js@29:83183)
    at Unknown.Nji_g$(erraiapp-0.js@8:83163)
    at Unknown.dhi_g$(erraiapp-0.js@17:82919)
    at Unknown.oji_g$(erraiapp-0.js@235:83032)
    at Unknown.NDi_g$(erraiapp-0.js@20:90266)
    at Unknown.JFi_g$(erraiapp-0.js@24:90841)
    at Unknown.n_i_g$(erraiapp-0.js@16:91489)
    at Unknown.m_i_g$(erraiapp-0.js@8:91449)
    at Unknown.uDi_g$(erraiapp-0.js@27:90119)
    at Unknown.mDi_g$(erraiapp-0.js@12:89902)
    at Unknown.YDi_g$(erraiapp-0.js@24:90353)
    at Unknown.dhi_g$(erraiapp-0.js@17:82919)
    at Unknown.PGi_g$(erraiapp-0.js@223:91245)
    at Unknown.pDi_g$(erraiapp-0.js@30:90073)
    at Unknown.qDi_g$(erraiapp-0.js@8:90086)
    at Unknown.sDi_g$(erraiapp-0.js@8:90099)
    at Unknown.rDi_g$(erraiapp-0.js@8:90091)
    at Unknown.gDi_g$(erraiapp-0.js@10:89962)
    at Unknown.k0i_g$(erraiapp-0.js@24:61969)
    at Unknown.l0i_g$(erraiapp-0.js@8:61963)
    at Unknown.t0i_g$(erraiapp-0.js@24:62021)
    at Unknown.lambda_0_g$(erraiapp-0.js@27:103)
ErraiConsoleLogHandler.java:79 13:05:49 FINE [SyncBeanManager] Looked up 1 beans: [[type=org.jboss.errai.ioc.client.lifecycle.impl.LifecycleListenerRegistrarImpl, qualifiers=[@Default, @Any]]]
ErraiConsoleLogHandler.java:79 13:05:49 FINE [Create] Create page shown!
ErraiConsoleLogHandler.java:79 13:05:49 FINE [Navigation] URL value changed to Create

Just to point out the pattern that all these errors happen between the following stages of page lifecycle
[Navigation] Navigating to Create at url: Create
{error when looking up JsType providers for page Create }
PostConstruct for Create page
PageHiding for the previous page called Dash
{error when looking up JsType providers for LifecycleListenerRegistrar}
{error when looking up JsType providers for LifecycleListenerRegistrar}
PageShown for Create page

Navigating to the other page called Dash, will just repeat the same pattern of error.
Not sure if this has something to do with above. But during initial loading/bootstrapping. I get this error too!
13:47:27 FINE [Container] Bean manager initialized in 116ms
ErraiConsoleLogHandler.java:7913:47:27 FINE [Container] Running post initialization runnables...
ErraiConsoleLogHandler.java:7913:47:27 FINE [Container] All post initialization runnables finished in 0ms
ErraiConsoleLogHandler.java:8313:47:27 INFO [Container] IOC bootstrapper successfully initialized in 239ms
ErraiConsoleLogHandler.java:83 13:47:27 INFO [InitVotes] wait for: org.jboss.errai.marshalling.client.api.MarshallerFramework
ErraiConsoleLogHandler.java:83 13:47:27 INFO [InitVotes] vote for: org.jboss.errai.marshalling.client.api.MarshallerFramework
ErraiConsoleLogHandler.java:83 13:47:27 INFO [ClientMessageBus] bus initialization started ...
ErraiConsoleLogHandler.java:83 13:47:27 INFO [InitVotes] wait for: org.jboss.errai.bus.client.api.ClientMessageBus
***Throwable.java:121 Uncaught Error: java.lang.ClassCastException
    at drb_g$.oC_g$ [as createError_0_g$] (Throwable.java:121)
    at drb_g$.yC_g$ [as initializeBackingError_0_g$] (Throwable.java:113)
    at drb_g$.fC_g$ (Throwable.java:61)
    at drb_g$.LC_g$ (Exception.java:25)
    at drb_g$.TC_g$ (RuntimeException.java:25)
    at drb_g$ (ClassCastException.java:23)
    at c7g_g$ (InternalPreconditions.java:141)
    at m7g_g$ (InternalPreconditions.java:129)
    at d6d_g$ (Cast.java:75)
    at Array.h9d_g$ (my_00046devs_00046web_00046ErraiAppJUnit__EntryMethodHolder.java:3)
    at initializeModules_0_g$ (ModuleUtils.java:44)
    at Qbc_g$ (Impl.java:239)
    at Tbc_g$ (Impl.java:298)
    at Impl.java:77
    at B8d_g$ (ModuleUtils.java:55)
    at NodeList.java:23
oC_g$ @ Throwable.java:121
yC_g$ @ Throwable.java:113
fC_g$ @ Throwable.java:61
LC_g$ @ Exception.java:25
TC_g$ @ RuntimeException.java:25
drb_g$ @ ClassCastException.java:23
c7g_g$ @ InternalPreconditions.java:141
m7g_g$ @ InternalPreconditions.java:129
d6d_g$ @ Cast.java:75
h9d_g$ @ my_00046devs_00046web_00046ErraiAppJUnit__EntryMethodHolder.java:3
initializeModules_0_g$ @ ModuleUtils.java:44
Qbc_g$ @ Impl.java:239
Tbc_g$ @ Impl.java:298
(anonymous) @ Impl.java:77
B8d_g$ @ ModuleUtils.java:55
(anonymous) @ NodeList.java:23***
ErraiConsoleLogHandler.java:83 13:47:27 INFO [ClientMessageBus] sending handshake message to remote bus
ErraiConsoleLogHandler.java:79 13:47:27 FINEST [HttpPollingHandler] [bus] HttpPollingHandler.transmit([CommandType=Asso

I am completely lost. Appreciate any help!
Note: I am running this using Eclipse GWT stuff which is the embedded jetty server. Not wildfly or jboss.


text:
Q: How to trigger an event ONLY if both dropdowns are selected? I have a dropdown select list on my page of class="TypeFilter".
I have a jQuery event that fires when a value in that list is selected.
$(".TypeFilter").change(function()
{
    // Extract value from TypeFilter and update page accordingly
));

I now have to add another list to the page, and I want to implement functionality which will prevent the .change(function() from running unless both are selected.
In both lists the first option in the list is some text instructing the user to select one of the items, so I was thinking of just writing some logic to test that both lists have a selected index greater than 0.
I think this is a touch unclean though, especially considering that other pages that have a TypeFilter use the same logic.
Is there any nifty functionality in jQuery that can do this?
edit I should specify that the user needs to be able to update the page by selecting either dropdown, so I can't put the onchange on the second element and test that the first element has a selected value, as suggested in one of the answers

A: If you bind the same event to all dropdowns, you can get a collection of all the dropdowns and check that all of them are selected. Example:
$('.Dropdown').change(function(){
  var elements = $('.Dropdown');
  if (
    elements.filter(function(){
      return this.selectedIndex > 0;
    }).length == elements.length
  ) {
    // all dropdowns are selected
  }
});

A: As you partly mention, put the onchange on the second element and test that the first element has a selected value before you fire off any logic.

A: Use bind instead, and as the eventdata, send a function that checks that either that both are selected or that the other is selected. Untested code:
function checker() {
    // test your conditions
}

$(".TypeFilter").bind('change', {test: checker}, function(event)
{
    if (event.data.test && event.data.test()) {
        // Extract value from TypeFilter and update page accordingly
    }
));

This way the other pages that use the same function will not notice any changes.


text:
Q: How do I get the triangle array outside so that I can use it I am storing some ID's to an array. The array is correctly populated, but I am not able to log it outside nor use it. I am slightly confused. Here is my code,
JavaScript
function storeTriangle() {
    var triangle = [];
    return function storePolygons() {
        for (var i = 0; i < 31; i++) {
            triangle[i] = s.select("#triangle36_" + (224 - i) + "_");
        }
    };
    storePolygons();
};
var polygons = storeTriangle();
polygons();

A:

function storeTriangle() {
        var triangle = [];
        return function() {
            for (var i = 0; i < 31; i++) {
                triangle[i] = s.select("#triangle36_" + (224 - i) + "_");
            }
          return triangle;
        };
    };
    var polygons = storeTriangle();
    var triangle=polygons();
console.info(triangle)


text:
Q: How do you say two or several things are about equivalent to each other in English? How do you say two or several things are about equivalent to each other in English?
For example, if I post a question here and receive two answers which seem equally good to me, and I don't know which one to choose, could I say:

These two answers are equally good.

or

These two answers are as good as each other.

What's the idiomatic expression of it?

A: I'm afraid your two options are not equally good. :)
Although "as good as each other" makes grammatical sense, we rarely compare things like that. We usually say "equally X" to say that they're equivalent.

Intuitively, I think the two forms have different purposes.
When you say "X is as good as Y", the purpose is to use Y as a point of comparison to tell how good X is.

Mmm! This cake is as good as the one you made for my 40th birthday. That one was amazing.
A cheetah can run sixty miles an hour. That's as fast as a car!

If this is the purpose, then it isn't helpful to say that two things are "as X as each other". Take "The sea is as black as night." The purpose is to use night to show how black the sea is. Night is your point of reference; you learn how black the sea is by considering how black night is.
So if I said, "The sea and night are as black as each other," we have a problem. "Each other" means that you learn how black the sea is by looking at the night... and you learn how black the night is by looking at the sea. That's a circular comparison, and not very helpful!

But the purpose of the word "equally" is the purpose you want.
"Equally" doesn't say how good two things are. It only tells you that they're equivalent.
It affirms that neither is faster or slower than the other — that there is no point choosing either one on the grounds of how good it is.
(You can also convey this message by saying that X is "no worse than" or "no better than" Y.)

Although Ngrams are not always useful, they can give us hints. Compare the rate of "equally good" vs. "as good as each other" in this Ngram. "Equally good" occurs 100-1,500x as often over various decades, which is such a high ratio that "as good as each other" is shown as a flat line by comparison.*

* Keep in mind that Ngrams are useful but not always definitive. See this discussion on ELU. It certainly doesn't mean there are zero occurrences of "as good as each other", and it also doesn't include similar wordings. For example, the classic children's book Onion John, which is full of idiomatic American English, says this in chapter 18: "Onion John could no more disappear out of Serenity, everyone agreed, than the courthouse could get up and wander off into the night. One was as much a fixed and regular part of town as the other."

Extra note
As a minor caveat, sometimes you will hear "as" used to mean "equally" to contrast with another comparative on the spur of the moment, and it will be stressed there. Here's an example:

—  "Would you say Amy is friendlier than Matthew?"
  — "Hmm... no, I'd say she's as friendly as Matthew. They're equally friendly."

If you want to say that she's not very friendly, you could say she's "only as friendly as Matthew" – but this makes Matthew the standard against which to measure Amy, consistent with the above.

A:
These two answers are equally good.

Strongly implies that both answers are good answers, say >=8 on a 10 scale, and are equal in that score.

These two answers are as good as each other.

Focuses more on that the answers are of equal score, but not necessarily good.  The actual value of the answer can be greatly inferred by the tone or mood of the speaker.

Henry's and Kate's proposals are as good as each other and I can't decide!

Implies they're both equal and good.

Your proposal is a good as his, and they're both garbage!

Implies they're both equally bad.


text:
Q: how to transform R dataframe to rows of indicator values I have a dataframe
A 2
B 4
C 3

and I would like to make a data frame with the following
A 0
A 1
B 0
B 0
B 0
B 1
C 0
C 0
C 1.

So for B, I want to make 4 rows and each one is 0 except for the last one which is 1. Similarly, for A, I'll have 2 rows and the first one has a 0 and the second one has a 1.
In general, if I have a row in the original table with X n, I want to return n rows in the new table with n-1 of them being X 0 and the final one as X 1.
Is there a way to do this in R? Or Python or SQL?

A: In R, we may use uncount to replicate the rows from the second column and replace the second column with binary by converting the first to logical column (duplicated)
library(tidyr)
library(dplyr)
df1 %>%
 uncount(v2) %>%
 mutate(v2 = +(!duplicated(v1, fromLast = TRUE)))

-output
 v1 v2
1  A  0
2  A  1
3  B  0
4  B  0
5  B  0
6  B  1
7  C  0
8  C  0
9  C  1

Or in Python
import pandas as pd
df1 = pd.DataFrame({"v1":["A", "B", "C"], "v2": [2, 4, 3]})
df2 = df1.reindex(df1.index.repeat(df1.v2))
df2['v2'] = (~df2.duplicated(subset = ['v2'], keep = "last")) + 0
df2
   v1   v2
0   A   0
0   A   1
1   B   0
1   B   0
1   B   0
1   B   1
2   C   0
2   C   0
2   C   1

data
df1 <- structure(list(v1 = c("A", "B", "C"), v2 = c(2L, 4L, 3L)),
class = "data.frame", row.names = c(NA,
-3L))

A: It's not that hard with base R...
d <- data.frame(x = LETTERS[1:3], n = c(2L, 4L, 3L))
d
##   x n
## 1 A 2
## 2 B 4
## 3 C 3

data.frame(x = rep.int(d$x, d$n), i = replace(integer(sum(d$n)), cumsum(d$n), 1L))
##   x i
## 1 A 0
## 2 A 1
## 3 B 0
## 4 B 0
## 5 B 0
## 6 B 1
## 7 C 0
## 8 C 0
## 9 C 1

A: # load package
library(data.table)

# set as data table
setDT(df)

# work
df1 <- df[rep(seq(.N), b), ][, c := 1:.N, a]

df1[, d := 0][b == c, d := 1][, b := d][, c('c', 'd') := NULL]

A: There is another way in python to replicate what @akrun did in R:
>>> from datar.all import f, tibble, uncount, mutate, duplicated, as_integer
>>> df1 = tibble(v1=list("ABC"), v2=[2, 4, 3])
>>> df1 >> uncount(f.v2) >> mutate(
...   v2=as_integer(~duplicated(f.v1, from_last=True))
... )
        v1       v2
  <object> <object>
0        A        0
1        A        1
2        B        0
3        B        0
4        B        0
5        B        1
6        C        0
7        C        0
8        C        1

I am the author of datar, which is backed by pandas.


text:
Q: Align text with link under thumbnail and align thumbnail at top left My code is below, at the bottom there is a thumbnail, I would like the download link and text to appear below the thumbnail, and have the thumbnail appear in the left top of the black background below the header/banner. Can someone help?
<body

    <img src="https://farm1.staticflickr.com/756/23511757696_469b593243_b.jpg"

              <input
type="button" value="Timeline"/>
      <input
type="button" value="Portfolio"/>
      <input
type="button" value="Shop Now"/>
      <input
type="button" value="Downloads"/>
      <input
type="button" value="About Me"/>

                           Download Photoshop Texture

A: HTML is a markup language, every tag is denoted with <> symbols and is closed with </> symbols. You have many improperly written tags. I went through the code, closing (or deleting) the one that were not closed.
So now you have a table with 4 rows in it, where the fourth one is the text below the thumbnail, with the link. You can play more with table cell () placement, but following the advice from Flignats, you should learn some basic HTML/CSS layouts and replace the current table layout.
Here are few additional notes regarding your code, if you get into it:

*

*use indentation that makes sense

*you are mixing inline CSS styles and HTML attributes, use CSS files instead

*scripts are usually placed before the closing body tag, so they don't interfere with loading elements

            <input type="button" value="Timeline" />

            <input type="button" value="Portfolio" />

            <input type="button" value="Shop Now" />

            <input type="button" value="Downloads" />

            <input type="button" value="About Me" />

        Download Photoshop Texture


text:
Q: Ray-square intersection 3D I know how to compute a ray-plane intersection, but how can I test if the intersection point is within a square on that plane? I was testing if the point was within a distance from the center of the square but I'm not sure if this is correct.

A: Here is a method that works for any convex polygon:
(see simplified version for squares at the end of answer)
Let p1,p2,p3,p4 denote the four vertices of your square and let q denote the intersection between the ray and the supporting plane. Let n denote
a vector normal to the supporting plane (take for instance the cross-product (p2-p1) x (p3-p1)).
To determine whether q is in the square, compute the following four quantities:
o1=orient(q,p1,p2,n)
o2=orient(q,p2,p3,n)
o3=orient(q,p3,p4,n)
o4=orient(q,p4,p1,n)

where
orient(a,b,c,n) =  [(b-a) x (c-a)] . n
x: cross product; .: dot product

If o1,o2,o3 and o4 have all the same sign, then q is in the square (p1,p2,p3,p4)
It also works for any convex polygon (p1,p2,p3,p4,...,pn)
How does it work:
If you were in 2D, you would compute:
o1 = det(p1-q, p2-q)
o2 = det(p2-q, p3-q)
o3 = det(p3-q, p4-q)
o4 = det(p4-q, p1-q)

where det(v1,v2) = (x1*y2)-(x2*y1) denotes the determinant between two vectors.
In English, if o1,o2,o3,o4 have the same sign, for instance positive, this means that the angle (p1,q,p2) makes a "left turn". If all angles (p1,q,p2), (p2,q,p3), (p3,q,p4) and (p4,q,p1) are left turns, then q is inside the polygon. Whenever it is outside, there is a side (pi,pj) such that (pi,q,pj) makes a "right turn".
Now if we are in an arbitrary plane in 3D, there is no longer such a thing as "left turn" and "right turn", but we can introduce the normal vector n, and test whether (q-p1, q-p2, n) is a positively or negatively oriented 3D basis (this is what orient() computes).
Special case for squares
Compute
X = (q-p1).(p2-p1) / ||(p2-p1)||
Y = (q-p1).(p3-p1) / ||(p3-p1)||

If X >= 0 && X <= 1 && Y >= 0 && Y <= 1 then q is in the square (see Mbo's answer).

A: Answer depends on how your square is defined.
If square is axis-aligned, it is enough to check that
(P.X >= Square.Left) and (P.X <= Square.Right) and
(P.Y >= Square.Top) and (P.Y <= Square.Bottom)

If square is rotated, make projections of point onto two neighbor edges and check that they are in edge range.


text:
Q: Display 6 Random Integers I'm trying to display 6 random integers with the following Python code:
#!"E:/PortablePython3.2.5.1/App/python.exe"

import random

print("Content-Type: text/html\n\n")

for k in range(6):
    r = random.randint(1, 75)

print("Winning Lotto Numbers: ", r)

I can get one random integer to display, but I'm having trouble displaying the remaing 5.

A: The problem is that in each iteration you are not printing anything. You are just assigning values to r. If you want to print a random integer in each iteration, then the print() call should be inside the for loop:
for k in range(6):
    r = random.randint(1, 75)
    print("Winning Lotto Numbers: ", r)

Notes:

*

*You can reduce your code by printing the number directly (without assigning it to a variable):
for k in range(6):
     print("Winning Lotto Numbers: ", random.randint(1, 75))

Edit:
To display "Winning Lotto Numbers: " only once, you can do:
print("Winning Lotto Numbers: ")

for k in range(6):
    print(random.randint(1, 75), end = ' ')

A: I'm guessing you need to generate a list of 6 random numbers and display them. Use a list comprehension like this:
nums = [random.randint(1, 75) for i in range(6)]
print "Winning Lotto numbers: %s" % ",".join([str(i) for i in nums])


text:
Q: filter image using if statements in GEE I want to filter several images from an ImageCollection according to the date and display them on the map. But when get the date property of an image, it prompts an error: img.get is not a function.
// s2Reduce is an ImageCollection
print('s2Reduce', s2Reduce)
// the specified date
var checkDate = '2020-01-03';

function checkImg(img){
  print(img)
  var formatDate= img.get('system:time_start');
  var flag = ee.Algorithms.IsEqual(checkDate, formatDate);
  img.evaluate(function (flag) {
      if (flag) {
        Map.addLayer(img.clip(bb), visualization, checkDate);
      }
  })
  return img;
}

s2Reduce.evaluate(function(s2Reduce){
  s2Reduce.features.map(checkImg)
})


text:
Q: Reuse transcoding outputs to generate multiple files with AvConv I am trying to find information about how to transcode a file into multiple outputs in one shot, but I don't seem to be able to. Most of the results I find describe the opposite: merging multiple files into one.
Here's the situation:
I have an IP webcam that takes a "dump" or raw capture (although I don't like to say 'raw' because it may be mistaken with the .raw format) that consists of two streams: An H264 video and a PCM audio.
I need to transcode that "raw/dump" capture into three MP4 files, two of them with audio and video (H264+AAC) and the third one with just the AAC audio; more specifically:

*

*A file at the same resolution than the original, ensuring it runs at
30 fps, has aac audio at 128kbps and the pixel format is yuv420p
(the "dumped" video stream's pixel fomat is yuvj420p, which makes
the stream in unplayable directly in Chrome... at least for now).

*A file with the same features as above, but half the resolution.

*A file containing just the AAC audio.

I have the command to get the first file working pretty well (although I someone has any comment for that one, it will be greately appreciated as well):
    /usr/bin/avconv "/home/borrajax/Videos/original.dump" \
    -acodec libvo_aacenc -ac 1 -ab 128k -ar 44100 \
    -vcodec libx264 -preset fast -r 30 -pix_fmt yuv420p \
    "/home/borrajax/Videos/transcoded.mp4"

Probably I could save some of the options, but the issue is that the camera's configuration can be modified, so I need to make sure that the resulting .mp4 has the format I need (that's why I specified so many)
My guess is that is probably good idea (I say "probably" because I don't know much anything about video encoding) trying to transcode the three files in one shot, re-using the transcoded data to save time.
For instance: the video with half the resolution of the original one will have exactly the same audio than the "big" one so there's no need to transcode it again. Obviously, same thing goes for the audio file. There shouldn't be a need to transcode three times. Also, maybe (and here, I don't know what will be better) I can also reuse the video stream. Since I need two videos with a different fps and pixel format than the original maybe it's worthy transcoding only once (like I'm already doing in the command above) and then grab that video stream that already has 30fps and yuv420p pixel format and just make its resolution half.
I guess it'll be a good idea to sum up... how can I chain (pipe?) multiple outputs with avconv, applying different options to each?
Using:

*

*Ubuntu 12.04 LTS

*avconv version 0.8.5-4:0.8.5-0ubuntu0.12.04.1

A: Probably the most efficient way to do this without duplicating effort would be with a script that does several things and then muxes the results to make the final files.
For example:

*

*transcode audio from original to AAC result in audio.aac
avconv -i <input> -c:a libfaac -vn audio.aac

*transcode video from original to full resolution in temp-full-vid.mp4
avconv -i <input> -c:v libx264 -pix_fmt yuv420p -preset fast -r 30 -an temp-full-vid.mp4

*transcode video from original to half resulution in temp-half-vid.mp4
avconv -i <input> -c:v libx264 -pix_fmt yuv420p -preset fast -r 30 -filter:v scale=-1:ih/2 -an temp-half-vid.mp4

*mux temp-full-vid.mp4 and audio.aac into full.mp4
avconv -i temp-full-vid.mp4 -i audio.aac -c copy -map 0 -map 1 full.mp4

*mux temp-half-vid.mp4 and audio.aac into half.mp4
avconv -i temp-half-vid.mp4 -i audio.aac -c copy -map 0 -map 1 half.mp4

*delete temp-full-vid.mp4 and temp-half-vid.mp4
This leaves you with the 3 files full.mp4, half.mp4, and audio.aac that you're looking for with no unnecessary redoing of transcoding.


text:
Q: Dataframe split rows into new columns - X, Y coordinates & Text I have text that is already in a Dataframe that typically looks like this:
Column
100,    1594, text & or numbers $124,345.56
108,    1805, _ _ _
254,    2000, (13,452,863)

There 4 spaces in between the first series of numbers and the second which are X, Y coordinates then the text.  How would I get it into a new data frame like this:
  Y       X   Text
100    1594   text & or numbers $124,345.56
108    1805   _ _ _
254    2000   (13,452,863)

A: This is one solution, given the input data you have supplied.
import pandas as pd

df = pd.DataFrame({'Column': ['100,    1594, text & or numbers $124,345.56',
                              '108,    1805, _ _ _',
                              '254,    2000, (13,452,863)']})

df_out = pd.DataFrame(df['Column'].str.split(', ').values.tolist(),
                      columns=['Y', 'X', 'Text'])

df_out[['Y', 'X']] = df_out[['Y', 'X']].apply(pd.to_numeric, downcast='integer')

#      Y     X                           Text
# 0  100  1594  text & or numbers $124,345.56
# 1  108  1805                          _ _ _
# 2  254  2000                   (13,452,863)


text:
Q: Runtime report designer tool for JAVA For Java Desktop Application
Is there a tool that would allow the user to customize his/her own reports such that the user would be able to:
1) End user would be able to drag & drop tables, select the fields etc
2) Join 2 or more tables & select the fields to be displayed
3) Create custom filters for the reports
4) Save the report template so that they can generate the created report in future without having to go through step 1 - 3
I

A: Yes, there are many tools. Use iReport.

A: Other option: eclipse BIRT http://www.eclipse.org/birt/phoenix/
Although I have used both (iReport and BIRT) and I feel iReport is easier

A: I would split your requirements into two features:

*

*1 and 2 (and probably 3): Query design

*4: Report template creation

For the first point, you can use a query designer tool like Active Query Builder, personally i've used the .NET version, but they have a Java version as well.
For the second point, this question suggest you use Dynamic Jasper, personally i've never used it, but it may be worth the shot, alternatively, you may be able to modify iReport to integrate it in your application or create your application around it, but it's not an easy feat (i've tried it before with little success), in any case, you must be fully aware of any licensing issues in your project, specially if you add open source and closed source software or libraries into the mix.

A: There is a business report controller for design time and run time named stimulsoft.
Demo is:
http://java.stimulsoft.com/
Online designer:
http://java.stimulsoft.com/designer.jsp


text:
Q: Why Mui button styles are not applying, when I set it to contained? After upgrading to the latest version of MUI, I have noticed that MUI buttons are not working correctly when I set the variant to contained.
      <div className="flex">
        <Button variant="contained" color="primary" fullWidth>
          Add
        </Button>
        <Button variant="contained" color="secondary" fullWidth>
          remove
        </Button>
        <Button variant="outlined" color="secondary" fullWidth>
          remove
        </Button>
      </div>

As you can see in the example, there is nothing wrong with my theme colors as the outlined button works as expected.
I am also using tailwindcss, but I don't think that should be related to it at all.
Edit:
After inspecting the button element, I see that @tailwind base causes this issue.
What do I do in this case, I think I need @tailwind base for my tailwind utilities?


text:
Q: DisconnectedContext was detected - Threadpool and Ping I'm attempting to create a multi-threaded application which will allow me to ping thousands of hosts, the results of the ping are written to a richtextbox.
After this application executes, once it's iterated through a thousand or so addresses, I'm presented with the following exception:
DisconnectedContext was detected
Message: Transition into COM context 0x4410e0 for this RuntimeCallableWrapper failed with the following error: System call failed. (Exception from HRESULT: 0x80010100 (RPC_E_SYS_CALL_FAILED)). This is typically because the COM context 0x4410e0 where this RuntimeCallableWrapper was created has been disconnected or it is busy doing something else. Releasing the interfaces from the current COM context (COM context 0x440f70). This may cause corruption or data loss. To avoid this problem, please ensure that all COM contexts/apartments/threads stay alive and are available for context transition, until the application is completely done with the RuntimeCallableWrappers that represents COM components that live inside them.
I'm not entirely sure what's causing this, I at first figured it was due to my not disposing Ping but I've since addressed that and the problem still persists.
If anyone has any information on this it would be greatly appreciated.
Thank you all.
public static void LogTextEvent(RichTextBox TextEventLog, Color TextColor, string EventText)
    {
        if (TextEventLog.InvokeRequired)
        {
            TextEventLog.BeginInvoke(new Action(delegate { LogTextEvent(TextEventLog, TextColor, EventText); }));
            return;
        }

        string nDateTime = DateTime.Now.ToString("hh:mm:ss tt") + " - ";

        // color text.
        TextEventLog.SelectionStart = TextEventLog.Text.Length;
        TextEventLog.SelectionColor = TextColor;

        // newline if first line, append if else.
        if (TextEventLog.Lines.Length == 0)
        {
            TextEventLog.AppendText(nDateTime + EventText);
            TextEventLog.ScrollToCaret();
            TextEventLog.AppendText(Environment.NewLine);
        }
        else
        {
            TextEventLog.AppendText(nDateTime + EventText + Environment.NewLine);
            TextEventLog.ScrollToCaret();
        }
    }

    private void button1_Click(object sender, EventArgs e)
    {
        string[] logFile = File.ReadAllLines("addrs.txt");
        var addresses = new List<string>(logFile);

        foreach (string ip in addresses)
        {
            // See http://stackoverflow.com/questions/4744630/unexpected-behaviour-for-threadpool-queueuserworkitem
            // for reason to use another variable in the loop
            string loopIp = ip;
            WaitCallback func = delegate
                {
                    if (PingIP(loopIp))
                    {
                        LogTextEvent(richTextBox1, Color.Green, "[ " + loopIp.ToUpper() + " ] - Ping Success");
                    }
                    else
                    {
                        LogTextEvent(richTextBox1, Color.Red, "[ " + loopIp.ToUpper() + " ] - Ping FAIL!");
                    }
                };

            ThreadPool.QueueUserWorkItem(func);
        }
    }

    public static bool PingIP(string IP)
    {
        bool result = false;
        var ping = new Ping();
        try
        {
            //var ping = new Ping();
            PingReply pingReply = ping.Send(IP);

            if (pingReply.Status == IPStatus.Success)
                result = true;
        }
        catch
        {
            result = false;
        }
        finally
        {
            ping.Dispose();
        }
        return result;
    }

A: AndyDing is mostly right... problem is with ScrollToCaret... this drove me mad...
I swapped
rtbox.Select(box.Text.Length, 0);
rtbox.ScrollToCaret();

with
rtbox.Focus();
rtbox.Select(rtbox.Text.Length, 0);

problem solved... In my situation swapping RichTextBox for TextBox was not possible... need different colors/alignment bla bla bla... but AndyDing got me on the right path.
Cheers

A: I encountered the similar "DisconnectedContext" failure, and spent one day to finally figure out the problem is induced by ScrollToCaret() of RichTextBox. I replaced it with a TextBox, which automatically scrolls down, so it even doesn't have a ScrollToCaret() method. Fortunately I don't really need those extra features provided by RichTextBox, a TextBox is just fine in my application. You can give a try.


text:
Q: Get package childs from a package In Eclipse, how can I get the package's children?
Consider this example:
+ org.stack
    org.stack.test
        - StackTest.java
    - Stack.java

When we do IPackageFragment.getChildren() in org.stack, the Eclipse JDT only returns the compilation unit (Java Files)! But I want all children of a package: all ICompilationUnits and all Packages.
In this example when I apply IPackageFragment.getChildren() in org.stack, I want the org.stack.test and the ICompilationUnit Stack.java...
How can I do this?

A: IPackageFragment is not the correct starting point. You have to ask a higher level for the packages:

IPackageFragment: A single package. It contains ICompilationUnits or IClassFiles, depending on whether the IPackageFragmentRoot is of type source or of type binary. Note that IPackageFragment are not organized as parent-children. E.g. net.sf.a is not the parent of net.sf.a.b. They are two independent children of the same IPackageFragmentRoot.

Have a look at this article about the AST

A: Here's some code that should be close to what you needed.  (Since we're a bit past 2011, I doubt it will help you much, but maybe it will help somebody else.) Doubtless it can stand some improvement.
Since it doesn't seem possible to directly recurse downward from the IPackageFragment (as mentioned by Kai), the basic idea is to get the higher level IPackageFragmentRoot and filter it's children based on the original fragment's path.
PackageFragment originFragment; // = org.stack's fragment
try {
    String fragmentPath = originFragment.getPath().toString();
    IJavaElement parent = originFragment.getParent();
    ArrayList<IJavaElement> allChildren =
            new ArrayList<IJavaElement>();

    if (parent instanceof IPackageFragmentRoot) {
        IPackageFragmentRoot root = (IPackageFragmentRoot)parent;
        IJavaElement[] rootChildren = root.getChildren();

        // originsFragments includes the origin and all package
        // fragments beneath it
        List<IJavaElement> originsFragments =
           Arrays.asList(rootChildren).stream()
            .filter(c -> c.getPath().toString().startsWith(fragmentPath))
            .collect(Collectors.toList());
        allChildren.addAll(originsFragments);

        // Gather the children of the package fragments
        for (IJavaElement o : originsFragments) {
            if (o instanceof IPackageFragment ) {
                IPackageFragment oFragment = (IPackageFragment)o;
                IJavaElement[] fChildren = oFragment.getChildren();
                allChildren.addAll(Arrays.asList(fChildren));
            }
        }
    }
} catch (JavaModelException e) {
    e.printStackTrace();
}

An alternative inelegant solution would be to start with the original fragment's path and then use Java's file and directory facilities to descend through the directory hierarchy.  Then, you can use IJavaProject's findPackageFragment(IPath path) to connect to the proper IPackageFragments.

A: you need to do it in a recursive way.
here's some pseudo code
findAllClasses(package, classesCollection) {
    for(Class c: package.getClasses)
        classesCollection.add(c.getResourcePath)
    if(package.hasChildPackages)
        for(Package p: packages)
            findAllClasses(p, classesCollection)
}