HP ProLiant DL160 G6 fan conversion

Question: I came across this forum a back while looking for an answer to this question and found some excellent advise that I would like some additional info for.
I have purchased the above server in a 1U case however it's far to noisy for its location.  I have moved the motherboard into a 4u case and hoping to use active cooling, using 2 pwm fans using an official HP splitter with a 4 pin adaptation.
Now this server needs all 6 fan headers connected to the board to boot and making those connectors is fine, however 12 fans in a pc that won't really require them for airflow due to the new 4u case and the active cooling on the heatsinks.
My question is can I connect the wires together to make 1 single 4 pin pwm connector as 1 sensor wire is for input and the other is output as the fans from the server are back to back running 8k rpm each or will I have to have all 12 fans.
Happy to give more information if required I tried to add photos but I needed more rep to post.
Answer: An option, though definitely not exactly what you would call "proper" is to create a splitter with the yellow line split between multiple male connectors that then connect to the motherboard headers. A crude diagram is below:
<code>
       |--- <yellow line only> -- <motherboard accessory fan header 0>
       |
FAN ---|--- <passthrough red, black, yellow, and PWM> -- <motherboard CPU Fan header>
       |
       |--- <yellow line only> --<motherboard accessory fan header 1>
</code>
The yellow line is the sense wire and is used to detect the frequency of the fan rotation. By splitting this between the multiple headers, they will all detect the fan's rotational velocity, and thus allow your server to boot.
Now the other question is, even though you can do this, should you? It may be better to just snag some very quiet fans instead - which would be much easier to find since the case is now 4U.
Comment: Would love to however hp have made a 6 pin connector for the fan headers so they are not standard and I cannot find 6 pin fans to connect to them if you can find them I would be happy to use them. I am curious though as to what the issues faking the fans will cause proving everything stays in working temp, also here is the official fan connector that was advised by hp themselves http://i.ebayimg.com/images/g/wJ4AAOSwPgxVNekS/s-l300.jpg
Comment: Ah - that's a good point. A bit of Googling ran into this: http://www.silentpcreview.com/article1377-page9.html. To distill it quickly, HP only detects if there's a trickle voltage, not an actual frequency: `You can trick the Microserver into "seeing" an ordinary 4-pin PWM fan by connecting the Rotation Detect/Tachometer pin to the ground, and SHORT CIRCUIT THE GROUND pins from the fan connector.` http://www.silentpcreview.com/article1377-page9.html
Comment: I have seen that before and looking at it might be ok but since looking at the dl160 vs the dl180 (of which that is for) the pins for the fans on the dl180 are not all used however they are for the dl160 which I have only just seen. See link for the fans for the dl160 http://www.ebay.co.uk/itm/HP-Fan-Fan-for-DL320-G6-DL160-G6-DL320-G5p-SE316M1-DFTA0456B2H/152201855034?_trksid=p2047675.c100005.m1851&_trkparms=aid%3D222007%26algo%3DSIC.MBE%26ao%3D2%26asc%3D38661%26meid%3Db15d8ace5f2b4577868b24ca2eb25bb5%26pid%3D100005%26rk%3D3%26rkt%3D6%26sd%3D262699589959
Comment: and here is the fan for the dl180 http://www.ebay.co.uk/itm/519199-001-DL180-G6-FAN-ASSEMBLY-NEW-/272454358673?hash=item3f6f8b9691:g:kqYAAOSw5cNYLxud
now would I be right to assume that the hp fan splitter which is meant to run duplex fans that hp advised me to get for the dl160 should work even though its for the dl180 if so that pin out would work and exactly what I was looking for thank you
Comment: @StevenWilliams Were you able to find a solution? I am trying to do the same and I'm driving myself crazy.... I've tried all combinations and nothing....
Comment: @BrennenSmith I was able to connect all sensors to only one original fan set (2 fans stacked) with and extension cable inside of a box with foam to keep the sound away (is just inside of a box to create the signal for the server to not shut down)...... Now I was wondering if is there still one way to remove this last original fan? How can I still fake the signal ? Note: I just want to get rid off the original fans since now everything is running on noctua fans.
Answer: My solution to this was to get an ordinary 4 pin PWM case fan and connect the yellow tachometer pin to a breadboard. Each fan header on the DL160 G6 has 2 tachometer pins since there are two fans on one fan block. Since only 4 fan blocks are necessary for server to work without giving annoying POST messages, I took each of the two tachometer pins (pin 4 & 6) from each of the four fan headers (8 total pins) and plugged jumper in to them and connected them to breadboard. This allows the signal from one case fan to go into each fan header so the server booted just fine. This method is also good if one of the fans went bad and you need a quick solution. all of the other pins from the case fan such as power and PWM signal was plugged into one of the fan headers.
For reference:
Pin 1: 12V (optional), Pin 2: GND, Pin 3: 12V, Pin 4: Tachometer 1, Pin 5: PWM, Pin 6: Tachometer 2

HP ProLiant DL160 G6 fan conversion


How can it be proven using the Monotone Convergence Theorem that an integral and a limit can be interchanged?

Question: I am trying to prove that a limit can be interchanged with a double integral. This is what I am starting with:
$$\displaystyle\sum_{n=0}^{\infty}{\int_{0}^{1}\int_{0}^{1}(xy)^{n}}dxdy$$
I want to show, using only the Monotone Convergence Theorem, that the above is equal to
$$\int_{0}^{1}\int_{0}^{1}{\displaystyle\sum_{n=0}^{\infty}(xy)^n}dxdy$$
Is this possible? And if so, how can I show it?
Comment: You can certainly apply it with the measure $\mathrm d\mu(x,y)=\mathrm d x\mathrm dy$ on $(0,1)^2$ and the non-decreasing sequence of nonnegative functions $f_n(x,y)=\sum_{k=0}^n(xy)^k$.
Comment: Welcome to [math.se] SE. Take a [tour]. You'll find that simple "Here's the statement of my question, solve it for me" posts will be poorly received. What is better is for you to add context (with an [edit]): What you understand about the problem, what you've tried so far, *etc.*; something both to show you are part of the learning experience and to help us guide you to the appropriate help. You can consult [this link](https://math.meta.stackexchange.com/q/9959) for further guidance.
Answer: Yes, you can do that. Consider the sequence $$f_N :[0,1]\times[0,1]\longrightarrow\mathbb{R}, \text{ }(x,y)\longmapsto\sum\limits_{n=0}^N (xy)^n.$$
Then, for each $N\in\mathbb{N}_0$, the function $f_N$ is measurable and further satisfies $$0\leq f_N\leq f_{N+1}\leq+\infty,$$ i.e. the sequence is monotonically increasing.
So the Beppo Levi theorem about monotone convergence applies, and one gets that the pointwise limit function $f$  is again measurable and the limit can be interchanged with the integrals.


Jira comments and customfield rendering in vm file

Question: I need some help with my Search-Request-View Plugin, I can render most of the issue informations. However not the comments and the customfield. Normaly I would make a foreach and render each comments but in $issue.comments is nothing so I thought there must be another way to render it.
By the way I want to render my Issues on a Html Site.
For example I show you how I rendered my attachments in my issue:
##Attachments
    #if(!$!issue.attachments.empty)
        #foreach($attachment in $!issue.attachments)
            #set($attachmentUrl = "${requestContext.baseUrl}/secure/attachment/${attachment.id}/${urlcodec.encode($attachment.filename)}")

$urlcodec.encode($attachment.filename)

        #end
    #end

But this way the comments doesn't work.
And the costumFields I don't know how to render them, so I would appreciate your help, Thanks
Or does anyone know the variables I have to use or where I can find them?
(Like $issue.attachments for the attachments or $issue.priorityObject.nameTranslation for the priority)
I mostly find them randomly in the web and try out how they work but I couldn't find a documentation or something like this
Answer: I have solved it now, for others with the same problem here is my solution:
issueParams.put("comments", ComponentAccessor.getCommentManager().getComments(issue));
issueParams.put("links", ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId()));

Comments and Links do work this way and customFields I#m trying now but I think it should work this way too


How to make a custom compiler warning in Eclipse?

Question: I am experimenting with BoneCP as a connection pooling alternative to DBCP.  I added the bonecp-0.8.0rc-1.jar to my runtime classpath, and copy-n-pasted the code from their example page into my test driver:
Connection connection = null;
BoneCP connectionPool;
try {
    Class.forName(config.getDatabaseLogger().getJDBCDriver());

    BoneCPConfig boneConfig = configureBoneCP(config);

    connectionPool = new BoneCP(boneConfig);

    connection = connectionPool.getConnection();    // fetch a connection
} catch (SQLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (ClassNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

On the line that reads:
connectionPool = new BoneCP(boneConfig);

Eclipse (Juno) is giving me a compiler warning:

Resource leak: 'connectionPool' is never closed

It then gives me an option to "Add @SuppressWarnings 'resource' to newConnectionManager" (newConnectionManager() references the class this is contained in).
How is this possible? How does Eclipse know anything about a BoneCP object, and how does it know that it must be closed? Is this some kind of "custom warning" that ships with the BoneCP library? If so, how could I add/annotate code to my own projects to help warn downstream developers that they aren't using my libraries correctly?
Comment: Do you have the Javadoc for BoneCp ?
Comment: I've did the same thing but I cannot reproduce it.
Answer: How does Eclipse know anything about a BoneCP object,
                                  and how does it know that it must be closed?

Docs of eclipse says

Classes implementing the interface java.io.Closeable (since JDK 1.5) and java.lang.AutoCloseable (since JDK 1.7) are considered to represent external resources, which should be closed using method close(), when they are no longer needed.

The Eclipse Java compiler is able to analyze whether code using such types adheres to this policy.
objects do not directly represent an operating system resource. If the wrapped resource is closed, the wrapper doesn't need closing. Conversely, if a wrapper is closed this will include closing of the wrapped resource. The analysis has a second white list for detecting wrapper resources, and will recognize whether the underlying actual resource will be closed directly or indirectly via the wrapper. Either one suffices to silence warnings regarding resource leaks. The white list contains classes from java.io, java.util.zip, java.security, java.beans and java.sound.sampled.

Your BoneCP classe implements the interface java.io.Serializable ,this might be the reason.
Comment: [BoneCP](http://jolbox.com/bonecp/downloads/site/apidocs/com/jolbox/bonecp/BoneCP.html) didn't implements those interfaces.
Comment: ...but the warning is on the `BoneCP` instance (the connection pool), not the `java.sql.Connection` instance!
Comment: But [BoneCP](http://jolbox.com/bonecp/downloads/site/apidocs/index.html) doesn't implement either of them ?
Comment: what about `Connection`  interface  ???It has a method close()..how about that  ???
Comment: @Baadshah Read the following line there : *If a method returns a resource to its caller, it is not responsible for closing; **no problem is reported.*** :)
Comment: Edited my post with possible reason.Please feel free to edit or even vote to delete if you think this is not case OP is facing the issue.
Comment: @Baadshah You mean to say if a class implements `Serializable` , then it can potentially give this sort of warning ?
Comment: I understood in such way from that last paragraph..let me know if i am wrong . :)
Answer: The warning is caused by this statement:
connection = connectionPool.getConnection();

The method getConnection() returns a object of type java.sql.Connection which implements java.lang.AutoCloseable since Java 7. Eclipse generates this warning when it can not determine whether a resource which implements either java.io.Closeable or java.lang.AutoCloseable gets closed by all possible code paths.


Application Blocked by Java Security to run a JNLP File in OS X Sierra(10.12)

Question: I have tried to run a .jnlp file. But it is blocked by Java Security showing following message.
"Application Blocked by Java Security."
Java Version: Java 8 Update 102.
OS X: Sierra (10.12)
JNLP File Link: https://community.topcoder.com/tc?module=Static&d1=applet&d2=full-support
Comment: Not a programming question. Please move this to [su]
Answer: The java security settings are requiring that every jar in the jnlp file needs a valid and non expired (or with timestamp) certificate.
Checking a jar from your jnlp file with the jarsigner command
jarsigner -verify arena-client-7.1.3.jar

returns:
jar verified.

Warning:  This jar contains entries whose signer certificate has expired.
This jar contains entries whose certificate chain is not validated. This
jar contains signatures that does not include a timestamp. Without a
timestamp, users may not be able to validate this jar after the signer
certificate's expiration date (2016-03-26) or after any future revocation date.

And there is your problem.


Como executar uma aplicação Gtkmm C++ no Windows, sem MSYS2?

Question: Para utilizar(até aonde eu sei) as bibliotecas gráficas Gtkmm no Windows, eu tenho que instalar tais bibliotecas no MSYS2. Até ai tudo bem. Toda vez que faço a instalação e escrevo um arquivo C++ e compilo pelo g++ no MSYS2, é compilado tudo corretamente.
O problema é o seguinte: quando eu executo a aplicação pelo MSYS2, ou seja, ./programa.exe , a aplicação é executada corretamente. Mas quando eu não utilizo o MSYS2, ou seja, pego o mesmo executável programa.exe e abro ele com o duplo clique, é exibido uma mensagem de erro dizendo que falta dlls como libgtk-3.0-1.dll(e além de outras). Como posso resolver tal problema?
Desde já agradeço.

Acho que não será necessário. Achei na documentação oficial da Gnome os detalhes cruciais para o bom funcionamento do Gtk+ no Windows. Agradeço quem tiver a boa fé de me responder.
Link relativo: wiki.gnome.org/Attic/GtkmmOnWindows
Comment: Não editamos o título, marcamos a resposta correta
Answer: Pode ser usado o seguinte procedimento para obter as DLLs nescessárias:

Baixar Listdlls
Deixar sua aplicação rodando
Abrir a janela do PowerShell no local onde está o Listdlls.exe
Usar o comando ./Listdlls.exe nomedaaplicação.exe
Copiar todos os caminhos listados para um arquivo de texto
Excluir todas as linhas que contem "C:\WINDOWS*"  em seu arquivo de
texto
Deixar apenas as linhas que contem "C:\msys64* *.dll" em seu
arquivo de texto
Abrir Msys2 Shell
Usar $ cp colar_todos_os_caminhos_das_dlls caminho_de_destino

Cuidados antes de usar o comando $ cp. Em seu arquivo de texto, mudar "\" para "/"  nos caminhos e tirar as quebras de linhas.


What is the twig template name for a node edit form?

Question: In Drupal 8, what is the twig template name for a node edit form for a custom content type called for example "device".

For a default node we use node-edit-form.html.twig
So what is the edit template name for a custom content type ?

I would appreciate your help.
Thank you !
Answer: You could have a look at this comment. It suggests adding a theme suggestion like this:

This feels hacky, but it's the best I can come up with. First add this
  code to your admin .theme file (likely a sub-theme of Seven):
function NAMEOFTHEME_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
   if ($hook == 'node_edit_form') {
     if ($node = \Drupal::routeMatch()->getParameter('node')) {
      $content_type = $node->bundle();
     }
     else {
       $current_path = \Drupal::service('path.current')->getPath();
       $path_args = explode('/', $current_path);
       $content_type = $path_args[3];
     }
     $suggestions[] = 'node_edit_form__' . $content_type;
   }
 }

Next, create twig templates in your theme's template directory in the form
  of node-edit-form--NODE-TYPE-SEPARATED-WITH-DASHES.html.twig.
Comment: Approach looks pretty ok, but there is no reason for parsing the url like that, just get the node type with \Drupal::routeMatch()->getParameter('node_type') (not sure about node type, would have to look up the route to be certain)
Answer: Based on Neograph734's answer and Berdir his comment on it, the node type is indeed already available (no need get it out of the path). I would recommend to add the theme suggestion using:
/**
 * Implements hook_theme_suggestions_HOOK_alter() for node_edit_form.
 */
function example_theme_suggestions_node_edit_form_alter(array &$suggestions, array $variables) {
  $route_match = \Drupal::routeMatch();

  if ($node = $route_match->getParameter('node')) {
    // When editing an existing node, add the node's bundle as the theme hook
    // suggestion.
    $suggestions[] = $variables['theme_hook_original'] . '__' . $node->bundle();
  } elseif ($node_type = $route_match->getParameter('node_type')) {
    // When a new node is created, the node type (object) is provided.
    $suggestions[] = $variables['theme_hook_original'] . '__' . $node_type->id();
  }

  return $suggestions;
}

This allows you to write targeted Twig templates and/or pre-process functions. When your node type's machine name is device, your Twig template should be named node-edit-form--device.html.twig and your pre-process function example_preprocess_node_edit_form__device(&$variables), where example is the name of your theme (or module).
Answer: Here are the complete steps it took me to implement on D9.2.10

Create subtheme of admin theme seven
Install and enable new admin theme (note: enable through drop down)
create hook_theme_suggestions_HOOK_alter in new admin *.theme

/**
 * Implements hook_theme_suggestions_HOOK_alter() for node_edit_form.
 */
function NAMEOFTHEME_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
   if ($hook == 'node_edit_form') {
     if ($node = \Drupal::routeMatch()->getParameter('node')) {
      $content_type = $node->bundle();
     }
     else {
       $current_path = \Drupal::service('path.current')->getPath();
       $path_args = explode('/', $current_path);
       $content_type = $path_args[3];
     }
     $suggestions[] = 'node_edit_form__' . $content_type;
   }
 }

Copy seven's node-edit-form.html.twig to new subtheme's templates directory.
Create a node bundle specific override node-edit-form--BUNDLE-NAME.html.twig
Clear caches

Note: I did not need to override the theme for the form in a hook_form_alter for it to pick up node_edit_form.
Answer: If you want to theme a specific form, for example the edit form of a node type, then all you have to do is
/**
 * Implements hook_theme().
 */
function THEMENAME_theme($existing, $type, $theme, $path) {
  return [
    // form id (weather it's an edit node for or a new node form)
    'node_NODE_CONTENT_TYPE_edit_form' => [
      'render element' => 'form',
    ],
  ];
}

Then create a twig file node-NODE-CONTENT-TYPE-edit-form.html.twig
and theme it like so:
{{ form.field_MACHINE_NAME_OF_FIELD }}
{{ form.field_MACHINE_NAME_OF_FIELD2 }}
...
{# this prints out the submit button #}
{{ form.actions }}
{# you need to have this for the form to work properly #}
{{ form|without('name', 'field_MACHINE_NAME_OF_FIELD2', 'field_MACHINE_NAME_OF_FIELD3') }}


restrict a field's content based on a selected taxonomy term

Question: I have a content type with a number field and a field for a taxonomy. I'd like that, when the user creates a node of this particular content type, the value that appears in the number field changes to a preset depending on the taxonomy term chosen.
For example, The taxonomy term is a restaurant and the number field is a price, if the user chooses an specific restaurant the price changes depending on the restaurant chosen.
Comment: one price per taxonomy term?
Comment: yes, although in this case most taxonomy terms would have a price of 0
Answer: option 1:
use a hook_form_FORM_ID_alter MYMODULE_form_node_form_alter(&$form, $form_state) to add an ajax functionality on the taxonomy change event and populates the number field default value depending on the form_state taxonomy value.
option 2:
Add your own javascript with taxonomy terms mapped to number values and when the taxonomy term changes, change the number values to the mapped value. This is pretty much same as above without requiring ajax.


Supersolvable groups and sylow towers

Question: Is it true that a supesolvable group has a sylow tower? How can I construct the tower kwowing than there's a principal serier with factors of prime order?
Can anyone help me with an hint or an idea?
Thanks to everyone for the help!
Answer: I think you can obtain this from the fact that a finite supersoluble group $G$ has a normal subgroup of order a power of the largest prime $p$ dividing its order. Then you argue by induction.
To prove this fact, start with a minimal normal subgroup $N$ of $G$ of order a prime $q$ - the existence of such an $N$ comes from the definition of a supersoluble group.
If $q = p$, you are done. If $q < p$, proceed by induction on the order of $G$, so that there is a normal subgroup $M/N$ of $G/N$, of order $p^{a} > 1$, for some $a$.
Clearly $M = N P$, where $P$ is a subgroup of $G$ of order $p^{a}$. Since the automorphism group of $N$ has order $q - 1 < p$, we have that $P$ centralizes $N$. Therefore $M = N \times P$, hence $P$ is characteristic in $M$, and thus normal in $G$.
Answer: Here is an outline proof. Let $G$ be a finite supersolvable group and let $p$ be the largest prime dividing $|G|$. We claim that $G$ has a normal cyclic subgroup $N$ of order $p$, and a normal Sylow $p$-subgroup. If we can prove that then the existence of the Sylow tower is easily proved by induction.
Let $N$ be a normal subgroup of $G$ of prime order $q$. If $q=p$ we are done. If $q \ne p$, then by induction $G/N$ has a normal cyclic subgroup $M/N$ of order $p$ and, since $p>q$, we have $M = P \times N$ with $P \unlhd G$ normal cyclic of order $p$.
Comment: This proof must be in *The Book*, then ;-)
Comment: @Derek Holt thank you very much!
Comment: @Andreas thank you very much!

Supersolvable groups and sylow towers


C++ nested classes accessibility

Question: Given the following code without considering friendship between two classes:
class OutSideClass
{
...
public:
    int i_pub;
protected:
    int i_pro;
private:
    int i_pri;

    class InSideClass
    {
        ...
        public:
            int j_pub;
        protected:
            int j_pro;
        private:
            int j_pri;
    };
};

Question 1> Is it true that OutSideClass can ONLY access public members of InSideClass
Question 2> Is it true that InSideClass can access all members of OutSideClass
Please correct me if my understanding is not correct.
Answer:
Question 1> Is it true that OutSideClass can ONLY access public members of InSideClass

Yes

Question 2> Is it true that InSideClass can access all members of OutSideClass

No, in C++03. Yes, in C++11.

The Standard text is very clear about this:
The C++ Standard (2003) says in $11.8/1 [class.access.nest],

The members of a nested class have no special access to members of an
  enclosing class, nor to classes or functions that have granted
  friendship to an enclosing class; the usual access rules (clause 11)
  shall be obeyed. The members of an enclosing class have no special
  access to members of a nested class; the usual access rules (clause
  11) shall be obeyed.

However, the Standard quotation has one defect. It says the nested classes don't have access to private members of the enclosing class. But in C++11, it has been corrected: in C++11, nested classes do have access to private members of the enclosing class (though the enclosing class still doesn't have access to private members of the nested classes).
See this Defect Report :

45. Access to nested classes
Comment: based on your answer, it seems that all my answers are correct in the latest C++ standard?
Comment: @q0987. Yes (in C++0x Standard). :-)
Answer: As @Nawaz points out, in C++03 nested classes do not have special access rights to members of the enclosing class. However, this limitation is easy to get around by declaring the nested class as a friend.
class OutSideClass
{
...

    class InSideClass
    {
        ...
    };
    friend class InSideClass;
};

Comment: It seems that when I do this, InSideClass can't reference the member variables of OutSideClass by name?
Comment: @OrangeSherbet Can you create a [mcve] that shows the problem?
Comment: I see now you were talking about C++03. Also I see the question was only about access. In any case, I think it's worth pointing out that a nested `InnerClass` can only access a non-static member variable of `OuterClass` by reference `&` to a specific instance of `OuterClass` so that noobs like me don't try to break the rules of C++.
Answer: All that nested classes do in C++ is put the inner class in the namespace of the outer class.  To instantiate an instance of InSideClass from a member function of OutSideClass, I'd just do
InSideClass *instance = new InSideClass();

If InsideClass was public and I wanted to instantiate InSideClass from a function that is not a member of OutSideClass, I'd type:
OutSideClass::InSideClass *instance = new OutSideClass::InSideClass();

InSideClass and OutSideClass are otherwise entirely separate, unlike in other languages like Java.
Comment: as mentioned elsewhere, as of C++11, that is _not_ all they do. the nested class is also implicitly granted `friend` access to the enclosing class. this is codified as of C++11 but i think was informally done by various compilers before then.
Answer: There are no special access priveleges for the nested class to an enclosing class.
Comment: @q0987: C++0x is latest. C++03 means the C++ language standardized in 2003. And so, C++0x mostly like to be C++11, as this year it will released.
Comment: Which one is the latest one? C++03 or C++0x?

C++ nested classes accessibility


Width and Height Don't Match Screen Pixels

Question: I have been doing Winforms for the last 10 months. Our company is considering switching to WPF. I am having issue with setting the Height and Width of the WPF to match the pixels on the screen. I want the height to be 1080 and width to be 1920 because that is my screen resolution. In Winforms it works perfect because it goes based on screen resolution, so is this not the case for WPF?
<code><Title="Application"
   Height="1080"
   Width="1920"
   WindowStyle="ThreeDBorderWindow"
   WindowStartupLocation="CenterScreen"
   WindowState="Maximized"
   HorizontalAlignment="Center"
   VerticalAlignment="Center"
   SizeToContent="Height">
</code>
When I place a dock panel three fourths of the way down on my designer. When I run the application it is at the bottom of my application but if I put it at the bottom it doesn't show and I assume its off the screen. How do I get the same behavior from winforms on this? When I set it on the bottom of my application it is on the bottom when I run it.
Comment: [Device Independent Pixels](https://msdn.microsoft.com/en-us/library/windows/desktop/ff684173(v=vs.85).aspx)
Comment: Are you trying to set width and height for WPF window?
Comment: go to the xaml and set `Height` and `Width` in your `UserControl`
Comment: @FirstStep I have it set as that. When I run the application the content is off the screen as if the XAML is making my page bigger then my screen resolution or the height and width i stated
Comment: Are you sure of your screen resolution and that they match? I am almost sure that xaml's Height and Width is the fix. Or just convert your MainWindows to full screen mode
Comment: Wouldn't [maximizing](http://stackoverflow.com/q/3121900/205233) be way easier than setting to a specific width and height if you want to cover the entire screen anyway?
Comment: height and with refers to the inner size, it does not take in account the borders and title bar
Comment: @Filburt I do maximize the window as you see in my line I posted
Comment: Sorry, I missed that part at the end of your code sample. The linked post and related posts suggest that you need to handle this on App startup - it will not work just from xaml as could be expected.
Comment: @Filburt I still get the same results when I set it in App.xaml.cs
Comment: WPF uses Device Independent Pixels to try and ensure applications look the same regardless of screen resolutions. Typically sizes are not hardcoded, but instead controls are arranged using different [Layout Panels](http://www.codeproject.com/Articles/30904/WPF-Layouts-A-Visual-Quick-Start), and controls are positioned relatively. If you really want to use the screen size in XAML though, [you can bind to the SystemParameters](http://stackoverflow.com/a/17416804/302677)
Answer: In WPF you're specifying size in Device-Indepdent Units (DIPs). 1 DIP = 1/96 inch.
To convert from DIPs to pixels or vice versa, you need to know your screen DPI setting (e.g. 96, 120).
pixels = (DIPs) * (DPI / 96)
DIPs = pixels / (DPI/96.0)
Comment: It makes sense as high-resolution displays with high DPI are readily available. Your Application will have the same "look" across devices and according to individual preferences (DPI settings relative to native resolution).
Comment: Why would Microsoft make this type of change? It makes sense on how Winforms is done but it makes no sense to change a industry standard to something that makes no sense at all.


How can i allow users to give different responses to content types other than comments?

Question: How can i allow users to give different responses to content types other than comments? for example if i want users to be able give blog posts a "like" or "thumbs up/down" or something similar?
Answer: You could try any of these modules (with quotes included from their project pages):

Fivestar:

... adds a clean, attractive voting widget to nodes and comments and any entity.

Rate:

... provides flexible voting widgets for nodes and comments ("The cck model for voting with Drupal").

Vote Up/Down:

... allows votes on some Drupal entities and provides the base for implementing votes on other entities.
Comment: Don't forget the https://drupal.org/project/flag module as well :)


Obtain youtube username from google Plus api - access token scope insufficientPermissions

Question: I'm trying to get Youtube username via google plus api. I use php Services from Plus ang YT api and I'm using symfony 2. Obtaining access token works ok, and i'm not going to put it here.
There is also no problem with google plus service, after authorization i'm getting all the information that i need. In YT case, i'm getting error :
insufficientPermissions error
So i check my access token scope in here:
https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=ACCESS_TOKEN
and scope of my Access token is only for Google Plus, i'm not able to force the google Api php clinet to make the YT scope aviable too.
Any ideas?
Here is my code :
<code>require_once '../src/google_api_php_client/src/Google_Client.php';
require_once '../src/google_api_php_client/src/contrib/Google_PlusService.php';
require_once '../src/google_api_php_client/src/contrib/Google_YouTubeService.php';

$client = new Google_Client();
$client->setScopes('https://www.googleapis.com/auth/youtube https://www.googleapis.com/auth/plus');

$youtube = new Google_YouTubeService($client);

if(!empty($allR['code'])){
    $client->setClientId('clientIDxxx');
    $client->setClientSecret('SecretXXX');
    $client->setRedirectUri('postmessage');
    $client->authenticate($allR['code']);
    $token = json_decode($client->getAccessToken());
}
</code>
Answer: First of all, make sure you enabled YouTube Data API v3 rom your devconsole.
Then instead of setting scopes, try setting client id and secret from devconsole.
<code>$client = new Google_Client();
$client->setClientId($OAUTH2_CLIENT_ID);
$client->setClientSecret($OAUTH2_CLIENT_SECRET);
$redirect = filter_var('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'],
    FILTER_SANITIZE_URL);
$client->setRedirectUri($redirect);

// YouTube object used to make all Data API requests.
$youtube = new Google_YoutubeService($client);

$plus = new $youtube = new Google_PlusService($client);
</code>


Why object won't stop moving in Zelle graphics?

Question: from graphics import *
win = GraphWin("Circle Race", 500, 500)

#red circle position
RcenterX = 50
RcenterY = 100
Rright = RcenterX+25
Rleft = RcenterY

# The Red circle
cr = Circle(Point(RcenterX,RcenterY), 25)
cr.setFill('red')
cr.setOutline('black')
cr.draw(win)

if RcenterX<=400:
    win.getMouse()
    cr.move(50 ,0)
elif RcenterX>300:
    win.getMouse()
    win.close()

I'm trying to move the red circle 50 pixels after each click, and stop when the right edge of the circle reaches 400.
But it keeps moving after it reaches 400?
How can I make it stop at 400?
Comment: what language/IDE/OS is this? add TAGs so the right people will read this
Comment: it is just python
Answer: Two basic changes: your if statement needs to be a while loop; you need to recalculate RcenterX, either by updating it yourself or interrogating your circle object:
from graphics import *

win = GraphWin("Circle Race", 500, 500)

# red circle position
RcenterX, RcenterY = 50, 100
Rradius = 25

# The Red circle
cr = Circle(Point(RcenterX, RcenterY), Rradius)
cr.setFill('red')
cr.setOutline('black')
cr.draw(win)

while cr.getCenter().getX() + Rradius/2 < 400:  # right edge stops at 400
    win.getMouse()
    cr.move(50, 0)

win.getMouse()
win.close()


How to determine what is causing Telerik RadGrid Error System.InvalidCastException

Question: While trying to programmatically bind (rebind) a RadGrid the InvalidCastException is thrown and looking into the message it only states Additional information: Specified cast is not valid. occurred. The grid is contained within a usercontrol that's in a RadMultiPage. The grid's datasource is bound upon the tab click. The following code gets the usercontrol and sets the datasource (the data is retrieved successfully).
How do I tell which binding is causing the exception?
  protected void OrderItemTabStrip_TabClick(object sender, RadTabStripEventArgs e)
    {
        if (e.Tab.Value == @"ValueHistory")
        {
            var controls = e.Tab.PageView.Controls;
            OrderHistoryAndVariance control;

            foreach (Control parent in controls)
            {
                if (parent.ID == "ValueHistory")
                {
                    foreach (Control child in parent.Controls)
                    {
                        if (child.ID == "OrderHistoryAndVariancecGrid")
                        {
                            ((RadGrid) child).DataSource = GetVarianceHistory();
                            try
                            {
                                ((RadGrid)child).Rebind();
                            }
                            catch (Exception exception)
                            {
                                //exception message doesn't indicate what failed
                                throw;
                            }

                        }

                        break;
                    }
                }
            }
        }

        e.Tab.PageView.Selected = true;
        e.Tab.Selected = true;
        e.Tab.Focus();

    }

The grid:
  <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrderHistoryAndVariance.ascx.cs" Inherits="DAME.UserInterface.App.OrderHistoryAndVariance" %>
  <telerik:radgrid id="OrderHistoryAndVariancecGrid" runat="server" allowsorting="False" gridlines="None" onitemdatabound="RadGrid1_ItemDataBound" style="font-weight: normal; font-size: 10pt; font-family: Calibri, Verdana, Arial; min-height: 80px;"
autogeneratecolumns="False" groupingenabled="False" DataMember="ValueHistoryViewModel">
        <MasterTableView ClientDataKeyNames="OrderId,OrderItemId" TableLayout="Fixed">
            <Columns>
                <telerik:GridTemplateColumn DataField="OrderId" HeaderText="ID" UniqueName="HyperLink">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="100px"  />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="100px" />
                    <ItemTemplate>
                        <asp:HyperLink ID="HyperLink11" Target="_new" Font-Bold="true" ForeColor="#FF6801" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "OrderId") + "." + DataBinder.Eval(Container.DataItem, "OrderItemId") %>'
                            NavigateUrl='<%# "~/App/OrderView.aspx?OrderId=" + DataBinder.Eval(Container.DataItem, "OrderId") +"&OrderItemId="+DataBinder.Eval(Container.DataItem, "OrderItemId")  %>'>HyperLink</asp:HyperLink>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="VendorID" UniqueName="VendorId">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="100px" />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="100px" />
                    <ItemTemplate>
                        <asp:Label ID="lblSameVednor" runat="server" Text='<%# (((int)Eval("VendorId")) == 0 ? "" : Eval("VendorId")) %>' Font-Bold="true" Font-Size="10px" ForeColor="#FF6801"
                            Visible='<%# IsSameVendor((int)Eval("VendorId")) %>'></asp:Label>
                        <asp:Label ID="lblDifferentVendor" runat="server" Text='<%# Eval("VendorId") %>' Font-Size="10px"
                            Visible='<%# !IsSameVendor((int)Eval("VendorId")) %>'></asp:Label>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
               <telerik:GridBoundColumn DataField="ClientName" HeaderText="Client">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="150px" />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="150px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ProductName" HeaderText="Product">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="150px"  />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="150px"  />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="InspectionType" HeaderText="Inspection Type">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="80px"  />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="80px"   />
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn HeaderText="Value" UniqueName="AppraisedValue">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="80px" />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="80px" />
                    <ItemTemplate>
                        <asp:Label ID="lblValue" runat="server" Text='<%# Eval("AppraisedValue") %>' Font-Size="Smaller"
                            Visible='<%# IsValueGreaterThanZero((Double)Eval("AppraisedValue")) %>'></asp:Label>

                        <asp:HyperLink ID="hypValue" runat="server" Text='<%# Eval("AppraisedValue") %>' Font-Size="Smaller" Font-Bold="true" Target="_blank"  ForeColor="#FF6801"
                            NavigateUrl='<%# "~/App/ViewDocument.aspx?DocumentID=" + DataBinder.Eval(Container.DataItem, "DocumentId")  %>'
                            onclick="javascript:w=window.open(this.href,'docpopup','width=700,height=700,resizable=yes,scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,copyhistory=no');return false;"
                            Visible='<%# !(IsValueGreaterThanZero((Double)Eval("AppraisedValue"))) %>'></asp:HyperLink>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="VarianceValue" HeaderText="Variance" UniqueName="VarianceValue">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="70px" />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="70px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="VariancePercent" HeaderText="% Var">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="70px" />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="70px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="PropertyType" HeaderText="Property Type">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="100px"  />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="100px"   />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="GLA" HeaderText="GLA">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="70px" />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="70px"  />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Bedrooms" HeaderText="Bed">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="50px" />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="50px"  />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Bathrooms" HeaderText="Bath">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="50px" />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="50px"  />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="PropertyCondition" HeaderText="Condition">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="100px"   />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="100px"   />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="AVMValueVariance" HeaderText="AVM Variance">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="80px"  />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="80px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ConfidenceScore" HeaderText="Confidence Score">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="80px"  />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="80px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="RiskLevel" HeaderText="Risk Level">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="80px" />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="80px"  />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="PropertyClassification" HeaderText="Property Classification">
                    <HeaderStyle  HorizontalAlign="Center" Font-Bold="true" Font-Size="Smaller" Width="80px" />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" Width="80px"  />
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings AllowKeyboardNavigation="false" EnableRowHoverStyle="True">
        <Scrolling AllowScroll="True" UseStaticHeaders="True"/>
            <Selecting AllowRowSelect="True" EnableDragToSelectRows="False"  />
            <ClientEvents OnKeyPress="OnKeyPress" />
        </ClientSettings>
        <PagerStyle Mode="NextPrevAndNumeric" Position="Bottom" PageSizeControlType="None" AlwaysVisible="true" />
        <GroupingSettings CaseSensitive="false" />
    </telerik:radgrid>

The viewmodel used for the datasource (it's a list):
   public class ValueHistoryViewModel
   {
        public int OrderId { get; set; }
        public int OrderItemId { get; set; }
        public DateTime? Date { get; set; }
        public decimal VariancePercent { get; set; } = 0M;
        public decimal VarianceValue { get; set; } = 0M;
        public bool IsCompletedOrder { get; set; }
        public bool VarianceApproved { get; set; }
        public decimal AppraisedValue { get; set; } = 0M;

        //VarianceHistoryData
        public string ProductName { get; set; }
        public string InspectionType { get; set; }
        public int VendorId { get; set; }
        public string ClientName { get; set; }
        public int? GLA { get; set; }
        public int Bedrooms { get; set; }
        public decimal Bathrooms { get; set; } = 0M;
        public string PropertyCondition { get; set; }
        public string YearBuilt { get; set; }
        public int? DocumentId { get; set; }
        public string PropertyClassification { get; set; }
        public decimal CAValue { get; set; } = 0M;
        public string RiskLevel { get; set; }
        public double ConfidenceScore { get; set; } = 0.00D;
        public decimal AVMValueVariance { get; set; } = 0M;
        public string PropertyType { get; set; }
      }

Answer: Ends up, it wasn't a telerik error at it, it was user bad casting. After changing to the following, all is working as expected.
FROM
  ((RadGrid)child).DataSource = GetVarianceHistory();
  ((RadGrid)child).Rebind();

TO
   var grid = (RadGrid)child;
   grid.DataSource = GetVarianceHistory();

   grid.Rebind();


Changing size of content in HorizontalScrollView when phone is rotated by overriding onConfigurationChanged

Question: Hello fellow Androiders...
I have a problem with resizing content in a HorizontalScrollView when the phone is rotated. I'm overriding onConfigurationChanged in my activity containing the HorizontalScrollView, since I want to handle the resizing myself. However, I'm having great problem finding where i should put the resizing of the content. The HorizontalScrollView it self has FILL_PARENT as width and a fixed height. The idea is that it should always fill the screen width-wise, while having several cells of content, each as wide as the HorizontalScrollView itself.
The content in my HorizontalScrollView consists of one LinearLayout (let's call it wrapperLayout) with several LinearLayouts inside it. When the phone rotates I simply want to change the width of all the LinearLayouts inside the wrapperLayout. This is easy to do and works great when I test the resizing code by putting it in onInterceptTouchEvent(MotionEvent ev), that is the views are resized just as they are supposed to when I touch the HorizontalScrollView.
The difficulty appears when I try to find a good spot to execute resizing code, so that the resizing happens automatically when the phone is rotated. I have tried all possible combinations of requestLayout, onSizeChanged, onLayout, onConfigurationChanged and a few others and varying their calls to super (if any) before and after the resizing code. I can not make this work (the views are not resized even though the resize code is executed) and it is really frustrating. I've done a lot of logging to make sure the HorizonalScrollView really has changed width before calling my resize code but to no avail.
Does anyone have any clue as to what is going on? What methods are called and in what order when I handle the onConfigurationChanged by myself like this?
Thanks in advance
Answer: Is there a reason you are not using the viewcontroller's orientation calls. i.e.
<code>// Override to allow orientations other than the default portrait orientation.
</code>
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
I think it might be easier.
Comment: Sorry, should have clarified: this is using android :)


Search API Panels Display and Contexts

Question: I am trying to build a page with Search API and Panels. I have created my search views with contexts, but I am unable to view any facets in my panel page.
My facets show up in regular blocks, but they don't show up in panels regions.
I have been able to find information regarding this issue from this Search API Issue. Apparently the order of the way the view is placed in panels is the problem, and if I re-order my facets and views in Panels, the facets show up properly.
In comment #28 of this issue, there is a way to set up a context to be able to display the facets anywhere on a panel page, but the wording is very confusing.

EclipseGc actually gave me a quick walkthrough on how to do this the
  "proper" way. It takes a bit more time and effort but its a lot more
  flexible and effective (plus it works without having to try and figure
  out the order of blocks like above). The basics of it are:

Create a context view for your display.
Go to contexts in your panel and add a view context with your view.
You will now have a new "view context" option when adding content
  to a region.
Choose view row (this is where it gets a bit more complexed as you
  have to manually build grids etc using regions and rows and so forth).
You can now add your facets using the miscellaneous content option
  in panels wherever you want in your panel!
I had to use to the default view exposed forms as the context view
  exposed forms didnt want to inherit the path. These can also go
  wherever and work!

What is a "context view" and how do I add it? It is a ctools context? Or is it a new context in views, or is is a context having to do with the contexts module?
Thanks for your help!
Answer: It's about time this got a proper answer. Here's that explained as a step-by-step:

Creating a Search API view. None of this will work unless, when you initially create the view, you choose one of the Search API options like "Show [Search Index]" and the appropriate index instead of "Show [Content]" in the drop down at the very start of the views creation process.
Giving it a Context view display. A "Context view" is a type of View Display like a "View block" or a "View page" or an "Attachment view" etc. Create one with the "Add" button at the top of the View edit page.
Load it as a Context in Panels or Page Manager. The thing that is special about Context views, is that systems built on cTools contexts (like Panels and Page Manager) can load the view early on in the process, and also, analyse it so they know what types of data to expect. In the Contexts page for your Page Manager page or Panel, add a context, choose Views, then find the right view.
Place each part of the view as Content. Because cTools is loading the View as a context, and because cTools knows what Views are and how to make sense of them, it knows exactly what elements of the view it's going to get. If it was a views block, all it can do is just dump the whole output of the block somewhere, but since it's taking the time in the Context stage to analyse and make sense of the View, it can figure out that it's going to get seperate rows, headers, footers, exposed fitlers, etc. When you go to Content in the Panels / Page Manager interface, you'll find a 'Views Context' vertical tab with various bits of your view in it. This is the "bit more complexed" bit the guy refers to. If you want, you can go nuts and build a complex, sophisticated grid display placing the Views Row content type lots of times with different limits and offsets, with the first row highlighted, then a column showing rows 2-5, then a column showing rows 6-10... Or you can just stick the 'Views row' content in without limits or offsets (plus Views Header and Views Footer if you're using them) and it'll work as normal.
Place the Facets, Current View block, etc. This is the important bit for the question. Because the View is loaded at the start of rendering the page, the search is loaded at the start of rendering the page, so order doesn't matter. If it was a Views block, it wouldn't be done until that block was rendered. So your facets and current search blocks can go anywhere.

All of this is a bit rough around the edges and might not work first time. If you're using Search API Spellcheck, don't forget to put it in the View Header then place the View Header in Panels / Page Manager. If your view gets its search terms using Contextual Filters instead of Exposed Filters, sometimes it just works, but you might sometimes need to set the argument manually and occassionally check and patch supplementary modules like Current Search Links and Search API Spellcheck depending on how the search is set up.

Search API Panels Display and Contexts


How to move the border when sorting in excel vba?

Question: I am going to sort the data base on the first column, however the border line did not move base on the sorted data.
Is it possible to move it using vba code?
Answer: Here is something like an idea. It is not the whole solution, but you can start from it and build your own, by removing the magic numbers etc...
Option Explicit

Public Sub SortingBorders()

    Dim rngMyRng    As Range
    Dim rngCell     As Range

    Set rngMyRng = Range("A1:A20")
    Call RemoveAllBorders(rngMyRng)

    For Each rngCell In rngMyRng
        If rngCell <> rngCell.Offset(1, 0) Then
            Range(rngCell.Offset(1, 0), rngCell.Offset(1, 5)).Borders(xlEdgeTop).LineStyle = xlContinuous
        End If
    Next rngCell

End Sub

Public Sub RemoveAllBorders(rngMyRng As Range)

    With rngMyRng
        .Borders(xlDiagonalDown).LineStyle = xlNone
        .Borders(xlDiagonalUp).LineStyle = xlNone
        .Borders(xlEdgeLeft).LineStyle = xlNone
        .Borders(xlEdgeTop).LineStyle = xlNone
        .Borders(xlEdgeBottom).LineStyle = xlNone
        .Borders(xlEdgeRight).LineStyle = xlNone
        .Borders(xlInsideVertical).LineStyle = xlNone
        .Borders(xlInsideHorizontal).LineStyle = xlNone
    End With

End Sub

This is what you get:

The solution goes around column 1 and puts a border only when the condition rngCell <> rngCell.Offset(1, 0) is true.
Comment: Thank you for the idea. It is not the solution but the idea is correct. It works fine. Thank you


Passing values of table data to javascript function

Question: I want to pass values of table row td to the javascript function onclick on the tooltip.
Please find the fiddle http://jsfiddle.net/0w9yo8x6/16/
When i mouse over on image in the row, tooltip is shown and when clicked on test on the tooltip, javascript function is invoked.I want to pass the value of the row to the javascript function whenever we click on the tooltip.Please suggest.
We can achieve this using td onclick event , but my scenario is different.when clicked on the tooltip the row on which we clicked that corresponding value should pass to javascript function.

 test

Data1

Data2

Data3

Comment: So when you click the tooltip, you want a function executed?
Answer: I'm guessing this is what you're talking about.
var display = function() {
  var tooltip = [Create Tooltip Element];
  // Style tooltip etc.
  tooltip.addEventListener("click", function() {
    test(this.parentNode.innerHTML); // Test parent's inner HTML.
  }, false);
}

Hope this helps, let me know if I've misunderstood.
Comment: I want to pass the value Data1/Data2/Data3 on which ever the row i click through tooltip to the javascript function test().Please see http://jsfiddle.net/0w9yo8x6/16/ .When mouse over on the image in the table tooltip is displayed, and when clicked on test it invokes javascript function test(), i want the  value to be printed in javascript function test(). thanks. @user3412847
Comment: Updated answer, would you like me to create a fiddle?
Answer: I believe this is what you are looking for I took the liberty of modifying your HTML a little bit. I added an id to the test and the display spans in your tooltip table. Here is the javascript tooltip
$(function() {
var rowData;
$(document).tooltip({
    items: "img, [data-title]",
    content: function () {
        var element = $(this);
        if (element.is("img"))
         {
             rowdata = element.attr("data-title");
             $(document).off('click', '#test');
             $(document).on('click', '#test', function() {
                 test(rowdata);
             });

             $(document).off('click', '#display');
             $(document).on('click', '#display', function() {
                 display(rowdata);
             });
         }

        return $(this).prop('title');
    },
    show: null,
    close: function (event, ui) {
        ui.tooltip.hover(

        function () {
            $(this).stop(true).fadeTo(1000, 1);
        },

        function () {
            $(this).stop(true).fadeOut(200, function () {
                $(this).remove();
            })
        });
    },
    position: {
        my: "left",
        at: "right"
    }
});
});

There are improvements you can make to the javascript but the essential idea is captured in the logic.


Any way to stretch background image

Question: I'm trying to create a counter similar to the one here. Which counts up by stretching/squeezing images.
But I'd rather use sprites than images for the numbers. The only problem is I cannot see a way to animate a background image stretching with javascript. I know there is the background-size css3 property, but that's not available to the jquery animate method and a bit strange.
Is there any other way I could accomplish this?
Is there a way to somehow use sprites with images instead of background-images?
Answer: You can wrap IMG tag with DIV with overflow=hidden and move it using position property. This is not very nice solution (too much elements), but it is what you need.
Comment: ay.. that's how it works on the example site, but the many image tags made it quite slow. I did it up using spans with sprites instead to try and relieve things somewhat, but it doesn't look as smooth bc the background image is just revealed rather than stretched
Comment: I am not sure if you understand me correctly. You will need exactly same amount of IMG tags as on the example site + you will need DIV wrapper for each. Using this technique, you can have all numbers (top, bottom parts) in one big image (sprites). I can make some example for you if you want.
Comment: oh maybe that is what i'm after.. you mean like absolutely positioned img inside the wrapper div?
Comment: Sorry for late reply. Yes, that is what I am talking about :)

Any way to stretch background image


How can i manage controller methods as per user role in laravel?

Question: public function __construct()
{
    $this->middleware('roles:Author')->only(['index','show','create']);
    $this->middleware('roles:User')->only(['index','show']);
}

In my controller i want access methods as per users role for e.g if user role is admin then he has to access all methods of controller, if user role is Author then he has access of index,create and show method and if role is User then he has only access of index and show method.
Comment: Check laravel document : http://www.laravel.com/docs/5.4/authorization
Comment: Do you use a package for role management?
Comment: @IvankaTodorova no i create pivot table for user role and checking role in model.
Answer: You can take a look at Gates (docs).
In your App\Providers\AuthServiceProvider add:
Gate::define('create-post', function ($user) {
    return $user->isAuthor(); //Here you should check the users role
});

And then in your controller's method create():
if (Gate::allows('create-post')) {
    // The current user can create posts...
}

The other two methods: index() and show() are available to both roles so there's no action required.
Comment: thanks for teaching new but i have to add this condition in each method of controller, and i want like manage from constructor so you have any idea which manage controller from constructor.


How to define a non-database relationship for the Views module

Question: Basically, I have an array of nids (node ids) stored in a $_SESSION variable, which is updated according to user actions (it holds a history of visited node pages).
Now, I would like to create a view which displays a list of nodes, filtered by nids given in a $_SESSION variable.
For example:
if $_SESSION['my_nids'] == [1,5,6]
=> I want to display nodes 1,5,6 in the view.
Storing the nids in a db table is not an option due to performance reasons.
Can someone point me how to create such a non-database relationship views handler?
Answer: You can use the views php module. And you can get the $_SESSION['my_nids'] with in view. Actually you can do anything there that can be done with PHP.
Please note that this will again have a performance hit if the code is large. for simple things you go this route.
Answer: You can just make a normal views field handler but give it a key/machine name that isn't a database table. This is explained in the Views advanced help.


OpenGL texture on sphere

Question: With this function I can create a sphere in OpenGL ES 1.0 for Android:
public Ball(GL10 gl, float radius)
{
    ByteBuffer bb = ByteBuffer.allocateDirect(40000);
    bb.order(ByteOrder.nativeOrder());

    sphereVertex = bb.asFloatBuffer();
    points = build();
}

private int build()
{
    double dTheta = STEP * Math.PI / 180;
    double dPhi = dTheta;

    int points = 0;

    for(double phi = -(Math.PI/2); phi <= Math.PI/2; phi+=dPhi)
    {
        for(double theta = 0.0; theta <= (Math.PI * 2); theta+=dTheta)
        {
            sphereVertex.put((float) (raduis * Math.sin(phi) * Math.cos(theta)));
            sphereVertex.put((float) (raduis * Math.sin(phi) * Math.sin(theta)));
            sphereVertex.put((float) (raduis * Math.cos(phi)));

            points++;
        }
    }

    sphereVertex.position(0);
    return points;
}

public void draw()
{
    texture.bind();

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, sphereVertex);

    gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points);
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}

My problem now is that I want to use this texture for the sphere but then only a black ball is created (of course because the top right corner s black). I use this texture coordinates because I want to use the whole texture:
0|0    0|1    1|1    1|0

What do I have to do to use the texture correctly?
Answer: You will need to setup UV (texture Cords) for each point on the sphere that match up to the texture you provide. Here is a link to some information on UV mapping.
UV Mapping a Sphere
Answer: Just Download and use the code and you can change the image with the image you want
https://docs.google.com/file/d/0By5c3cOVKbFpVTFpUlFlV2pGVWM/edit?pli=1

OpenGL texture on sphere


Tableview scrolling lack of performance using cornerRadius, whats alternatives?

Question: I can't find a solution for my issue, so I hope some experts could help me.
I have tableview with lots of cells. For each cell I have an image view with rounded corners:
<code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UIImageView *exampleView;

...
exampleView.layer.cornerRadius =   5.f;
exampleView.clipsToBounds = YES;
[cell.contentView addSubview:exampleView];
...

}
</code>
Resulting in a big lack of scrolling performance issue - when using cornerRadius and clipsToBounds = YES, any alternative solutions?
(The rounded corner image view contains pictures, and if the corner isn't set. The scrolling is smooth. So the problem is here)
EDIT #1: to clarify that I have already read other posts:
<code>...
exampleView.frame = CGRectMake(5.0f,size.height-15.0f,30.0f,30.0f);
exampleView.layer.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5].CGColor;
exampleView.layer.cornerRadius = 5.0f;
exampleView.layer.borderWidth       =   0.3f;
exampleView.layer.borderColor       =   [UIColor blackColor].CGColor;
exampleView.layer.masksToBounds = NO;
exampleView.layer.shouldRasterize = YES;
//exampleView.clipsToBounds = NO;
[exampleView setImage: myImage ];
</code>
EDIT #2:
It's like myImage is lapping over the rounded corner view. How do I make the image fit the rounded corner view correct? or am I missing something?
Comment: I have read them, and it didn't helped me out.
Comment: possible duplicate of [UITABLEVIEW comes to a crawl when adding a UIABEL with cornerRadius to each cell](http://stackoverflow.com/questions/2256314/uitableview-comes-to-a-crawl-when-adding-a-uiabel-with-cornerradius-to-each-cell) and [UILabel layer cornerRadius negatively impacting performance](http://stackoverflow.com/questions/4735623/)
Comment: Really, because you won't get any different answers. Either use a rounded image in the first place or render a rounded image yourself and use that. Is it the same image every time, or a different one?
Comment: See my edit. Your first suggestion is overkill here. The second: Is it the correct way to make my rounded image?
Comment: It's like myImage is lapping over the rounded corner view. How do I make the image fit the rounded corner view correct?
Comment: @Jano See the accepted answer. This issue differs from the label examples !!!
Answer: Just change the following line
<code>  exampleView.layer.masksToBounds = YES;
</code>
To round out the corners in your imageView. See images below.
The tableview scrolling is a issue with view compositing. In addition to suggestions above, this will certainly help -
Set the opaque property of the UITableViewCell's contentView property, and backgroundView property. Go:
<code>  [cell.contentView setOpaque:YES];
  [cell.backgroundView setOpaque:YES];
</code>
This will help reduce the view compositing effort at the earliest possible stage.
There are additional, advanced, techniques which would require you to use asynchronous processing to process your images as you scroll. They may be overkill if the above techniques work.
Comment: Finally, you saved my day. I was pulling hair out today heh. Thank you so much. It works like a charm! :)


Primes in Gaussian integers proof mistake?

Question: I know the classification of primes involves remainders $\mod 3$, so what's the error in the reasoning below?
We know $N$ is multiplicative and that $N(\alpha)$ is a unit $\iff\alpha$ is a unit. Let $\alpha$ be irreducible. Writing $\alpha=\beta\gamma$ we know one of $\beta,\gamma$ is a unit, which is equivalent to one of $N(\beta),N(\gamma)$ being units. So the only reason $N(\alpha)$ can be reducible is if there's a presentation $N(\alpha)=a\cdot b$ not coming from an equation $\alpha=\beta\gamma$ in $\mathbb Z[i]$. But how can this be if $\mathbb Z$ is naturally embedded in $\mathbb Z[i]$?
Comment: Counterexamples   $2$, $3$.
Comment: What do you intend to prove/show ?
Comment: @SoumyaSinhaBabu $\alpha$ irreducible implies $N(\alpha)$ irreducible
Answer: While the codomain of the norm $N$ is $\mathbb N$, its image is comprised of the numbers which are sums of squares. Thus factorizations into products of elements in the image of $N$ do not cover all possible factorizations in $\mathbb N$ and the definition of irreducibility is not met.
As André Nicolas comments, just look at $3$: it is irreducible in $\mathbb Z[i]$ but $N(\alpha)=9=3^2$.


Adjust point size to individual variables using geom_point in R

Question: I would like to adjust the point size for individual variables.
I have tried to scale the values, but I'd like to scale them PER VARIABLE, so for each variable I see a small, medium and big cirle, instead of big circles on A and small on C. To see changes between experiments across variables A, B, C.
I'd like to keep the colour as an indicator of abundance overall as it is.
data <- tibble::tibble(
      value = c(4.07,   5.76,   2.87,4.94,  5.48,   6.75,1.53,  1.35,   1.32),
    Variable = rep(c(rep("A",3),rep("B",3), rep("C",3))),
    Experiment = rep(c(1:3),3))

data <- data %>%
  mutate(scaled_val = scale(value)) %>%
  ungroup()

data$Variable <- factor(data$Variable,levels=rev(unique(data$Variable)))

ggplot(data, aes(x = Experiment, y = Variable, label=NA)) +
    geom_point(aes(size = scaled_val, colour = value)) +
    geom_text(hjust = 1, size = 2) +
    # scale_size(range = c(1,3)) +
    theme_bw()+
  scale_color_gradient(low = "lightblue", high = "darkblue")

Comment: in your code, include `group_by`, i.e. `data %>% group_by(Variable) %>%
  mutate(scaled_val = scale(value))`
Answer: Decided to make my comment an answer. You need to group by variable before scaling.
library(tidyverse)
data <- tibble::tibble(
  value = c(4.07,   5.76,   2.87,4.94,  5.48,   6.75,1.53,  1.35,   1.32),
  Variable = rep(c(rep("A",3),rep("B",3), rep("C",3))),
  Experiment = rep(c(1:3),3))

data <- data %>%group_by(Variable)%>%
  mutate(scaled_val = scale(value)) %>%

  ungroup()

data$Variable <- factor(data$Variable,levels=rev(unique(data$Variable)))

ggplot(data, aes(x = Experiment, y = Variable, label=NA)) +
  geom_point(aes(size = scaled_val, colour = value)) +
  geom_text(hjust = 1, size = 2) +
  # scale_size(range = c(1,3)) +
  theme_bw()+
  scale_color_gradient(low = "lightblue", high = "darkblue")
#> Warning: Removed 9 rows containing missing values (geom_text).

Created on 2020-04-22 by the reprex package (v0.3.0)
Comment: @Ecg the frame size eventually depends on the viewport size, or the file size when saving. For complete control, you could use coord_ratio or coord_fixed
Comment: Thanks! Could we also bring the datapoints together, decreasing the overall frame size? I tried using + *scale_x_discrete(expand=c(1,0))* but the frame is stilll big and the x-labels disappear.


Tools to create drums backing track for non-drummer

Question: I am looking for a comfortable way to create a drums backing track in order to use them in my recordings.
currently I have 2 options (since I am not a drummer)

drum machine - very mechanic and boring. (unless there is a professional drum machine I'm not aware of)
taking midi tracks from known songs, using drum plugins and incorporating it in to the recording software to make the drum track. - This is fine, but it limits me to that song.

I'd like a program that will let me build a drum track by the song structure (chorus, variable beats) without me having to know how to drum..
Band-in-a-box does that for the entire song, is there such a thing for drums only?
Comment: You might want to rephrase the title of this question, since "best" is such a subjective term, and those kind of questions are discouraged on SE. From reading your question, perhaps "Tools to help create drum tracks for non-drummer", or "Non-drummer learning to program drum tracks"?
Comment: I listen to MIDI files which I like then copy part/s of the drum tracks into my tracks. This way you can extract four bars from one place then loop them for a verse, then extract four bars from somewhere else (or from another file) and make them the chorus. You can also *listen* to the drum parts and edit them to what you want - I generally remove notes for an intro.
Answer: Sounds like you are already somewhat familiar with Band in a Box.  It will do exactly what you want - and the more up-to-date versions have "RealDrums", which are sampled snippets played by real human drummers on real drums that can be arranged into song tracks.  They come in a variety of styles, with more being released every once in a while.  Just mute the other tracks (piano, guitar, strings, etc) and you'll have just the drum track you were looking for.  And then do the "save to wav" thing and it BiaB will "print" your drums to a WAV file that you can import into any other sequencer as your drum track.  I do this all the time, and RealDrums sound pretty good.
Answer: I found this website that has backing tracks for lots of popular songs.  What's great about it is that you can customize the track by picking which instruments and vocals that you want as part of the track.
The songs are covers.
http://www.karaoke-version.com/custombackingtrack/
Answer: Cubase, Sonar or any other DAW will let you use drum samples - the better ones will also let you place a basic beat automatically, which you can then edit by dropping in the drum beats you want.
It starts off a bit like hard work, but copying and pasting speeds things up, and the DAW's which have the ability to allow a bit of groove to your beats can sound remarkably good.
Good drum samples are easy to get hold of, with free ones in music magazines etc.
Additionally, some of the newer drum machines are pretty smart - even my electronic metronome is better for writing entire backing tracks on than drum machines of 15 years ago - it handles fills, intros, breakdowns, variable tempo and outros!
Comment: Will try and find that out - I'm not suggesting you use it for what you want to do, as it would be too fiddly for that, but I have a couple of basic 3 minute tracks programmed into mine to practice accuracy and speed.
Answer: ToonTrack EZ Drummer and Superior Drummer
They have large libraries of acoustic drumming in many different musical styles, played by real human drummers, so you can arrange a complete song structure and generate a drum track to go with it.
Answer: For GNU/Linux there is "Hydrogen", the "advanced drum machine for GNU/Linux".  When I needed something nicer than a metronome for practising "Take Five" (for which my arranger does not really offer a suitable hardwired style and it's so bothersome to hand-enter one) which I could persuade to swing the off-beats, that's what I took.
Most distributions have it in their repositories.  It does not run through Midi (I think one can export to it, though) but comes with its own drum samples.
Answer: Frooty Loops Studio allows point-and-click placing of your own personalized drum patterns on a virtual 'pianola' style sheet, or select a style & pattern from presets. Then copy/paste to extend duration, editing afterwards as required. Footnote: A pro musician recently told me he 'hates' these electronic-generated drumkits, which he calls'Chinese Drums'. Most likely referring to the 'Artificial' electronic synthesis. :)
Answer: If you want a generic beat with 'fills' at the turn-rounds, maybe a modified style for the middle 8, a stock ending ...  use the drum track from Band-in-a-box or one of the other programs that have been mentioned.   If you want a drum track that exactly drives YOUR song, use the Drum Edit page of any sequencer, where you can place drum sounds precisely where you want them.
I often use a combination of the two, especially when turning out utility backing tracks.   Set up the structure in BiaB or similar, import the MIDI into my sequencer, edit it.  The basic pattern will probably be fine for large stretches of the music.  There will be stops, featured rhythms etc. that need to be specific to THIS song - edit them in.   The automatic programs are fond of putting a drum fill at the turn-round into a new section - but often there's a vocal pick-up too.  Make sure they don't fight each other.  Ultimately, if you want the optimum drum part for YOUR song, YOU have to write it, though a program might be able to do some of the grunt work for you.


Class Diagram with no Link

Question: After downloading a repository of a java software (http://sourceforge.net/projects/gcs-java/) I used Enterprise Architect in order to create some class diagrams for me, example:

From another question I posted, my understanding is that each arrow shows a 'has' relationship, which basically shows how objects can hold instances of other objects. However, what about these objects that have no links to others? All these objects inside the class diagram are part of the same class, so does the fact that there are no links just simply mean that they handle a method that is isolated and does not effect any of the other objects?
Answer: The arrow represent association.  To implement has relationship (aggregation), you use diamond in the owner side.  That standalone class do not have line because you do not have other classes that are associated to them.  Ex: ScrollToSelection class use Outline class but you don't have Outline class in your diagram.
Comment: So, can I still include the standalone class inside the class diagram?

Class Diagram with no Link


Keeping unused elements?

Question: I keep a lot of unused elements that I don't bother to delete such as blocks, content types, views, taxonomies etc. Is there any speed benefit of deleting these unused elements? If so which ones?
Comment: About which ones to delete, just remove the ones you don't use.
Answer: It could help, yes. Your site will be faster, and easier to manage.

less elements means Drupal uses less memory
with less elements, it takes less time to read them all (unused elements are still active)

Keeping unused elements?


Fixing/hiding Path Based Vulnerabilities in WordPress

Question: I have a WordPress site that I manage. I recently received a Qualys vulnerability security scan (non-authenticated scan) that has a large number of "Path Based Vulnerability" findings. Almost all of the paths listed follow this format:

https://www.example.com/search/SomeString

https://www.example.com/search/1/feed/rss2

Some examples include:

https://www.example.com/search/errors

https://www.example.com/search/admin
https://www.example.com/search/bin

When I go to these URL's, I get an appropriate search page response stating, for example, "Search for Admin produced no results".
But, if I go to https://www.example.com/search/ without a string parameter, I get a 404 error (custom error page) stating the page could not be found. All this works like I would expect it to.  No sensitive data/pages are being shown.
An example of the Qualys finding is:

150004 Path-Based Vulnerability URL:
https://www.example.com/search/1/feed/rss2/ Finding #
8346060(130736429) Severity Confirmed Vulnerability - Level 2 Unique #
redacted Group Path Disclosure Detection Date 22 Mar 2021 18:16
GMT-0400 CWE CWE-22 OWASP A5 Broken Access Control WASC WASC-15
APPLICATION MISCONFIGURATION WASC-16 DIRECTORY INDEXING WASC-17
IMPROPER FILESYSTEM PERMISSIONS CVSS V3 Base 5.3 CVSS V3 Temporal5
CVSS V3 Attack VectorNetwork
Details
Threat A potentially sensitive file, directory, or directory listing was discovered on the Web server.
Impact The contents of this file or directory may disclose sensitive information.
Solution Verify that access to this file or directory is permitted. If necessary, remove it or apply access controls to it.
Detection Information
Parameter No param has been required for detecting the information.
Authentication In order to detect this vulnerability, no authentication has been required.
Access Path Here is the path followed by the scanner to reach the exploitable URL: https://www.example.com
https://www.example.com/?s=1
Payloads
<code>#1
#1 Request
GET https://www.example.com/search/tools/
Referer: https://www.example.com
Cookie: [removed in case its sensitive];
caosLocalGa= [removed in case its sensitive];
Host: https://www.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1
</code>
Safari/605.1.15
Accept: /

Based on the findings, this seems to be a false positive.  But, my CIO insists that I prove it as such.  First, is there any documentations on this that might be helpful?  Second, does anyone know of any updates to WP that could hide/remove these findings?
Answer: (I'd comment, but my rep isn't high enough.)
I can partially answer this, as I fighting the same battle right now with a different web app. If you run the request in a browser with the developer tools on, I'll bet you'll see the response code from the server is 200 even though it is actually doing a redirect.
The scanner sees the response code is OK and based on that, the request succeeded as is when it really didn't. You have to give it a different response code when doing a "silent" redirect.


RxJava: How to subscribe to the events of a different class

Question: I have a question about how to conceptually create an Observer and link it to another class: I currently have a class called Simulation that is supposed to create TransactionCreated objects and publish them as events. Another class called TransactionReceiver is supposed to be an Observer of every event that is published by the Simulation class and work with them.
The main method is included in the Simulation class and starts by creating an event in a static context and publishing it which works. My question would be how I am supposed to connect the TransactionReceiver as an Observer and let it subscribe to those events by receiving them in a method and work with those received objects? Do I need to create another class that would include the main method and create a Simulation and TransactionReceiver object that are then linked together as Observable and Observer? How would that look like?
And if I would extend that system with several different classes would they all have to be linked together through one class that connects Observers and Observables?
Answer: Your app should only have one main method.
Conceptually, this should be where you do the initial setup of Simulation and TransactionReceiver, so perhaps you could move it to a separate class to help you visualise how things should work. You could try something like below:
class Application {
   private Simulation simulation;
   private TransactionReceiver transactionReceiver;

   public Application() {
       simulation = new Simulation(/* params here*/);
       transactionReceiver = new TransactionReceiver(/*params here*/);
   }

   public void go() {
       simulation.simulate().subscribe(transactionCreated -> transactionReceiver.doSomething(transactionCreated);
   }

   public static final main(String[] args) {
       Application application = new Application();
       application.go();
   }
}

Eventually as you get more fluent you could think about adding a dependency-injection framework like Guice or Dagger.
This will help you with managing the dependencies of the classes that you need to use throughout your application.
So you would end up with a more simple Application - it would just set up the DI-framework and then you can use the classes how you want to.
UPDATE:
If you want to communicate between two different classes, you will need to use methods:
class Simulation {
    public Observable<TransactionCreated> simulate() {
        // use PublishSubject or whatever
    }
}

Comment: Thank you I already thought that it had to be connected like that structurally, but I wasn't sure. The only question in that regard is though how RxJava connects to that, because as far as I'm concerned you can't subscribe to classes. This is my problem because I am inputting data into a method (createTransaction in Simulation) and its returns an Observable in that method. How do I publish that so that the Receiver gets it?
Comment: @PWiese I updated my answer - you will have to write methods for the objects to communicate with each other


What does a "repeat" symbol on the chord section mean?

Question: In the following picture, there's a "repeat" symbol on the chord section.

I know the meaning of repeat symbols in the measures, but I don't know what it means in the chord section.
Does it mean to repeat the chord, i.e. Fmaj7 from the second bar?
Answer: It's confusing because it's unnecessary.  A chord persists until the next one is stated or there's an obvious stop.
Comment: Some picking or strum patterns may play the start of a chord differently from a continuation; repeating the chord symbol would indicate that it should be played as though it was a new chord.
Comment: Yes that is why I was confused.
Comment: I can imagine a use for explicitly stating a repeated chord. For example, it might emphasise that the player should re-play the chord rather than leaving it on sustain. Or it might discourage chord substitutions on beat 1. But IMHO such rigidity is inappropriate for _The Girl From Ipanema_, so I would leave it out here.
Answer: Yes, this just means to repeat the chord.
It might seem like a needless abbreviation in this case, but some chords can get to be pretty long, in which case this notation is quicker.
Comment: It's unnecessary to repeat the symbol OR to have the repeat sign.
Answer: The repeat is referring to the Fmaj7 chord sign, not the dots. As it's on top of the stave, it just means repeat the previous chord. And with one slash, it most likely tells that the Fmaj7 is only for that bar, although there could be another identical sign saying the following bar is also Fmaj7.
Comment: If it was a 2 or 4 bar repeat symbol, it wouldn't be positioned there.
Comment: True. But it could be three!
Comment: Sorry, no cigar again!   If 3-bar repeats existed, there would be 3 bars of data follwed by the symbol over the mid-point of the NEXT 3 bars.


Are Euler angle figures wrong?

Question: In the typical Euler angle figure one sees three angles represented as turns along three orthogonal axis. If I understand correctly, Euler angles parameterize a rotation with an order. Meaning that once the first rotation is done (say for Roll) then the second one  won't be along any of the axis typically shown in the figures. Is this correct or I'm missing something?
Answer: Say we apply first roll, then pitch, then yaw. (I don't know whether that's conventional, but that's not important.)
After applying, say, $5^\circ$ roll, it is time to apply pitch. We now have a choice to make: Do we apply pitch around the old, horizontal $y$-axis ("world axis"), or the new one that's $5^\circ$ slanted ("local / body axis")? It doesn't really matter which one we pick, but we have to pick one. Say we apply it to the new $y$-axis. Then we apply yaw, and to be consistent we apply it to the new $z$-axis.
Here is a little bit of magic for you: this gives the exact same end result as applying each of them in the reverse order and choosing to apply it to the old axes.
So in the end, there is no reason to labor too much over whether to use the new or the old axes. Which is to say, don't think too hard about whether you want the red lines in your figure to follow the anatomy of the plane or not. Because choosing which of the six orders to apply roll, pitch and yaw will swallow that choice anyways. So just pick one of the two. But be consistent, please. Don't use the old $y$-axis but the new $z$-axis.
Comment: Some people use the terms "body axis" and "world axis" to describe the distinction between whether you apply rotations to the "old" axes or the "new" axes.
Comment: @DavidK Right you are. I added those terms.

Are Euler angle figures wrong?


How to jump/hide first index ? with flutter

Question: I have a streambuilder with ListView who display a list of data by date but I try to not show the current date or the first index from the list. So I don't found how to jump to never show this index
 StreamBuilder<List<Todo4>>(
              stream: FirebaseFirestore.instance
                  .collection('$current_id:vote_stories')
                  .orderBy("date", descending: true)
                  .snapshots()
                  .transform(Utils.transformer(Todo4.fromJson)),
              builder: (context, snapshot) {
                switch (snapshot.connectionState) {
                  case ConnectionState.waiting:
                    return Center(child: CircularProgressIndicator());
                  default:
                    if (snapshot.hasError) {
                      return buildText('Something Went Wrong Try later');
                    } else {
                      final todos4 = snapshot.data;
                      final provider = Provider.of<TodosProvider>(context);
                      provider.setTodos4(todos4);
                      return    SizedBox(
                          height: MediaQuery.of(context).size.height / 2,
                          child:

                          todos4.isEmpty
                              ? Center(
                            child: Text(
                              'Pas de suite',
                              style: TextStyle(fontSize: 20),
                            ),
                          )
                              :
                          ListView.separated(
                            padding: EdgeInsets.all(16),

                            physics: BouncingScrollPhysics(),
                            scrollDirection:  Axis.vertical,
                            separatorBuilder: (context, index) => Container(width: 8,height:8),
                          itemCount: todos4.length,
                            itemBuilder: (context, index) {

                              final todo4 = todos4[index];

                              return ClipRRect(
                                  borderRadius: BorderRadius.circular(16),
                                  child:  GestureDetector(
                                    child:  Container(
                                      width: MediaQuery.of(context).size.width / 1.2,
                                      height: MediaQuery.of(context).size.height / 2,

                                      color: Colors.white,
                                      padding: EdgeInsets.all(20),
                                      child: Column(
                                        children: [
                                          Text(
                                            "${todo4.suite}",
                                            style: TextStyle(fontSize: 20, height: 1.5),
                                          ),

                                        ],
                                      ),
                                    ),
                                  )
                              );
                            }

                          )

                      );
                    }
                }
              },
            ),

Answer: I think something simple like these might do the trick inside the ListView
                            itemBuilder: (context, index) {
                        if(index==0)return SizedBox.shrink();
                              final todo4 = todos4[index];


Sides of non-right triangle

Question:
Given a non-right triangle with vertex $C = 91^{\circ}, \
\overline{AC} =39.9 \ cm, \ \overline{BC} = 32.6 \ cm$, find
a) $\overline{AB}$
b) $m\measuredangle A$
c) $m\measuredangle B$

I was able to find the length of $\overline{AB}$, which I labeled $c$
\begin{align*} c=& \ \sqrt{32.6^2+39.9^2-2(32.6*39.9)\cos(91^\circ)}
\\ c =& \ 51.9 \ cm
\end{align*}
but I'm having a hard time finding the angle measures of $A$ and $B$,
here's my attempt:
a)
\begin{align*} \frac{32.6}{\sin A} =& \frac{51.9}{\sin 91^\circ} \\ \\ \sin A =& \frac{32.6 \sin 91^\circ}{51.9} \\
\end{align*}
So given some theta A, we get the vertical length $0.63$ radians. To find A, I used
\begin{align*} \arcsin (0.63) \approx 0.68 \ \text{rad}
\end{align*}
So I figured I just needed to convert this to degree measure, getting me  $$m\measuredangle A \approx 38.96^\circ$$
b) using the fact that the sum of angle measures of a triangle is $180^\circ$, I tried to solve for angle $B$ using
\begin{align*} 38.96^\circ + 51.9^\circ + m\measuredangle B \approx& \ 180^\circ \\ m\measuredangle B \approx& \ 89.14^\circ
\end{align*}
but I'm getting marked wrong for both answers b) and c). What am I doing wrong?
Comment: since you've found the first result correct as c=51.9, it seems the approximation is to truncate. If that is the case, then the value for angle A that you've got as 38.96 can not be correct because you can not obtain a 4-digit precision using numbers in 3-digit precision. Should be either 38.8 or 38.9. Then third angle is deducted by difference from 180.
Answer: Side length $c \approx 51.9$ is ok.
The triangle side lengths are close to the right triangle of sides $ 30,40,50$  in proportion.
$$ \angle A ( \approx 38.96^{\circ})+ \angle B^{\circ} + 91 ^{\circ} = 180^{\circ}\rightarrow \angle B\approx 50.04 ^{\circ} $$
Comment: You are mixing the 4-digit precision of the angle A to obtain a 3-digit precision of the angle B. However, using your numbers the answer is 50.04 and you approximate that to 50.2
Comment: Thanks, shall change it. Only indicated the single step required.
Answer: On the last answer you are using 51.9, which is the length of side c, instead of the correct value of 91 degrees.
As for calculating the angle A, I am guessing that it is marked wrong because of an insufficient explanation. You indeed show that $sin(A) = 0.63$, but this does not always imply that $ A = 38.96 $ degrees.

Sides of non-right triangle