I 'am trying to exit a Windows Forms Application with returning the proper exitcode to the attached Console. For Testing i created a simple windows form app with this program.cs. I did take a look at other similar questions here at stackoverflow, but couldn't find a solution so far..  if i test the app in a cmdbox with "ExitTest -test" it should return 84 as errorlevel instead of 0. How can i achieve this ?  I use this code:  using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Windows.Forms;  namespace ExitTest {     static class Program     {         private const int AttachParentProcess = -1;          [DllImport("kernel32.dll", SetLastError = true)]         private static extern bool AttachConsole(int dwProcessId);          [STAThread]         static int Main()         {             int returncode = 0;             if (Environment.GetCommandLineArgs().Length &gt; 1)             {                 // Attach Console to Gui                 AttachConsole(AttachParentProcess);                 Console.WriteLine("This is written to the console");                  //Test ExitCode                 returncode = 84;                  // Sent enter to prevent waiting of Console on Close                 SendKeys.SendWait("{ENTER}");                 Environment.ExitCode = returncode;             }             else             {                 Application.EnableVisualStyles();                 Application.SetCompatibleTextRenderingDefault(false);                 Application.Run(new Form1());              }             return returncode;         }     } }
I'm starting a Windows Forms application from the command promt and I need to get the exit codes that the windows forms application generates. The command promt starts the application and returns immediatly. But the application executes in the background. Is there a way to get the Exit codes?  Kind Regards  Christian.
The "I Get It" Reputation Problem I wrote a question about blocking certain characters in passwords. It became tremendously unpopular, and it seemed like everyone wanted to rain on my parade every day.  Eventually, I "got it," agreed completely with what people were saying to me, and just wanted to withdraw my question so that my reputation didn't slide even further downhill.  Unfortunately, the system is designed such that I can't withdraw my question or redeem myself. Instead, I just get daily reputation attacks. That's a terrible system, and it needs to be changed. Getting started with neural networks for forecasting How prove this two symmetric matrices $AB=0$ Let $A,B$ be real symmetric matrices, and for any $n\in \Bbb N^{+}$, and for all $x,y\in \Bbb R$, we have $$tr(xA+yB)^n=x^ntr(A^n)+y^ntr(B^n).$$  Show that $AB=0$.  My try:since $$(xA+yB)^n=x^nA^n+\binom{n}{1}x^{n-1}A^{n-1}yB+\cdots+\binom{n}{n-1}xA(yB)^{n-1}+y^nB^n$$ so $$tr\left(x^nA^n+\binom{n}{1}x^{n-1}A^{n-1}yB+\cdots+\binom{n}{n-1}xA(yB)^{n-1}+y^nB^n\right)=x^ntr(A^n)+y^ntr(B^n)$$  then  $$tr\left(\binom{n}{1}x^{n-1}A^{n-1}yB+\cdots+\binom{n}{n-1}xA(yB)^{n-1}\right)=0$$ so $$\binom{n}{1}x^{n-1}ytr(A^{n-1}B)+\cdots+\binom{n}{n-1}xy^{n-1}tr(AB^{n-1})=0$$ then I can't  I found this is a nice result, maybe this is an odd problem, and I can't solve it. Thank you. How do I find a command if I don't know its name? As a Unix beginner, I often find myself wanting to know the name of the command that achieves a particular function I'm after. How can I go about finding out the name of the command, given a description of what it does? I am trying to show that $a^{12} \equiv 1 \mod 32760$ for each $a \in \mathbb{Z}$ coprime to $32760$. I have found the prime decomposition $32760 = 2^3 \cdot 3^3 \cdot 5 \cdot 7 \cdot 13$ and determined $\phi(32760)$, where $\phi$ is the Euler's totient function. This gives me that $\phi (32760) = 8640$.   Using Euler's congruence, this gives that $a^{8640} \equiv 1 \mod 32760$, but this is still far from the result I want to show... I also know a consequence of Eulers congruence, which states that $e \equiv e' \mod \phi (n)$ implies that $a^e \equiv a^{e'} \mod n$, but I do not see how to use this...  Any hints would be appreciated.  $\textbf{EDIT:}$ I made a mistake in my primefactorization, it is edited now. How to change background-color on text links on hover but not image links I have a CSS rule like this:  a:hover { background-color: #fff; }   But this results in a bad-looking gap at the bottom on image links, and what's even worse, if I have transparent images, the link's background color can be seen through the image.  I have stumbled upon this problem many times before, but I always solved it using the quick-and-dirty approach of assigning a class to image links:  a.imagelink:hover { background-color: transparent; }   Today I was looking for a more elegant solution to this problem when I stumbled upon .  Basically what it suggests is using display: block, and this really solves the problem for non-transparent images. However, it results in another problem: now the link is as wide as the paragraph, although the image is not.  Is there a nice way to solve this problem, or do I have to use the dirty approach again?  Thanks, Can you deliver it [when,after] it [is | will be] assembled? Right now we are assembling a device. I am asking another person if he is can deliver it [after/when] we finish. What question construction is the most correct?  Can you deliver it after it is assembled?  Can you deliver it after it will be assembled?  Can you deliver it when it will be assembled?  Can you deliver it when it is assembled? First time this happens to me.  When I try to edit , the title part is immediately erased:   And when I click cancel, the title becomes invisible:     Actually, the revision history is incomplete:   It shows that the question was asked after the comments:   That's highly likely a result of an edition of the history by a moderator.    Google Chrome 62.0.3202.94 (Official Build) (64-bit) on macOS 10.13.2 (17C88). Why are Grothendieck's and Hartshorne's definitions of quasi-coherence equivalent? Hartshorne's Algebraic Geometry defines an $\mathcal O_X$-module $\mathscr F$ to be quasi-coherent if there is an open affine cover $(U_i=\operatorname{Spec} A_i)_{i\in\mathcal I}$ of $X$ such that each $\mathscr F\rvert_{U_i}$ is isomorphic to the sheaf of modules $\widetilde{M_i}$ associated to some $A_i$-module $M_i$. It is later proved that this is equivalent to the statement that for any open affine $U=\operatorname{Spec} A\subseteq X$, there exists an $A$-module $M$ with $\mathscr F\rvert_U\cong\widetilde M$.  On the other hand, Grothendieck's Éléments de Géométrie Algébrique defines $\mathscr F$ to be quasi-coherent if every point $x\in X$ admits an open neighborhood $U\subseteq X$ such that $\mathscr F\rvert_U$ is isomorphic to the cokernel of a morphism of free $\mathcal O_U$-modules.  Now I wonder how those definitions are equal. I tried proving it by myself, but both directions seem quite nontrivial to me... Any hints? Captured variable in a loop in C# I met an interesting issue about C#. I have code like below.  List&lt;Func&lt;int&gt;&gt; actions = new List&lt;Func&lt;int&gt;&gt;();  int variable = 0; while (variable &lt; 5) {     actions.Add(() =&gt; variable * 2);     ++ variable; }  foreach (var act in actions) {     Console.WriteLine(act.Invoke()); }   I expect it to output 0, 2, 4, 6, 8. However, it actually outputs five 10s.  It seems that it is due to all actions referring to one captured variable. As a result, when they get invoked, they all have same output.  Is there a way to work round this limit to have each action instance have its own captured variable? What I am trying to do is to set a date in my date field and also update the object. I am using the class below to do so which works just fine in my sanbox but in production I am getting this error:      System.LimitException: Too many query rows: 50001   public with sharing class updateObject{     public  List&lt;NRProducts__c&gt;  values;     public PageReference updateObject() {         values=[SELECT Refreshed_Date__c FROM NRProducts__c ];         for (NRProducts__c s :values){            s.Refreshed_Date__c =Date.today();          }          update values;         return null;                       }     }   VF Page:  &lt;apex:page showheader="false" controller="updateObject" sidebar="false"&gt; &lt;apex:form&gt;  &lt;apex:commandButton action="{!updateObject}" value="Update"/&gt; &lt;/apex:form&gt; &lt;/apex:page&gt; Rename profile folder on Windows 7/8 Is it recommended I enter the US only in the city where my university is situated? I'm an Indian student who will be beginning graduate school in the US. Before the start of my program, I want to visit my relatives who live in Atlanta, Georgia. Is it recommended that I enter US in the state my university is located in (Tucson) and then fly to visit my relatives, or is it okay to enter Atlanta? I ask the question with the current political climate in the US in mind.  Is it enough if I have a ticket to Tucson as proof that I am only planning a brief stay in Atlanta?  EDIT: I updated the question to include the cities I'm referring to. Both these cities have international airports. How to disable creation of desktop workspaces on macbook?   Somehow they get created when I don't need them. [OS: Mojave] How to know add/edit page in hook_form_alter? I want to know whether form is add/edit in hook_form_alter. In Drupal 7 we can get all these in hook_form_alter.  I tried like this in D7:  function MYMODULE_form_alter(&amp;$form, &amp;$form_state, $form_id) {   // Check pages(s) , don't use $_GET.     if (strpos($form['#action'], '/add/') !== FALSE) {       $page = 'add';     }     if (strpos($form['#action'], '/edit') !== FALSE) {       $page = 'edit';     } }   Here I am getting add/edit in D7. Whereas in D8 I am not getting any it in $form['#actions']. And i don't want to use $_GET. Is there any way to check add/edit page in hook_form_alter. What is the purpose of /home on a Mac? On Linux, (which I am used to), /home is the place where home folders live.  On a Mac, home is some kind of crazy mutant:  $ mount /dev/disk1 on / (hfs, local, journaled) devfs on /dev (devfs, local, nobrowse) map -hosts on /net (autofs, nosuid, automounted, nobrowse) map auto_home on /home (autofs, automounted, nobrowse)   Other than to be non-conformist, is there some purpose to this auto_home mount point?  Considering how it mucks up things that come right out of the box, there must be some wonderful thing that it accomplishes, but I can't figure out what that would be..... I read following in a web site ()     Lenses with maximum apertures of f2.8 allow the camera to use all high   precision sensors. In low light or other situations that are hostile   to autofocus, that’s a big deal. Lenses with a maximum aperture of   f4.0 use only the center focus sensor in its “high precision” mode,   and use the other sensors in their “horizontal line” only mode. Lenses   with a maximum aperture of f5.6 use all sensors in their   “horizontal-only” mode, and lenses with a maximum aperture of f8 use   only the center sensor point, and that with horizontal sensitivity   only.   I want to understand if this is completely true? I am raising this because recently I have purchased a Nikon 70-200 f/4 lens and would like to understand if I have made a wise investment, or, should I collect some more money and buy a 70-200 f/2.8 VR-II lens. Often I have a question, in a specific area (say Math SE or English SE) that is appropriate for the child meta of that site.   Then I realize it is not particular to the meta for that site but for Meta for all sites (like this question itself; I wanted a link to Meta Stack Exchange from meta.english, but realized no meta sites had such a link).  Wouldn't it be nice to have a link in all meta sites to Meta? How to create a meta-package that automatically installs other packages? I'd like to be able to create a package that doesnt contain any code or programs itself, but instead installs other packages that exist in the repositories onto a computer, sort of how the ubuntu-restricted-extras package does? I am learning basics of the category theory (CT).  I do understand that CT is a modern powerful framework to describe various branches of mathematics in a unified way.  I do admit that category's definition tells a lot about the whole thing and focuses on the most important properties, shadowing unnecessary details. However, the more I go forward, the more it feels like it should explicitly require a notion of morphisms equality (like it does with morphism composition). It feels so because equality or inequality of morphisms arises everywhere, since the very beginning: any commutative diagram eventually reduces to an equality of two different paths and many other things involve equality as well. Even composition is defined grounding upon an (implicit) equality!  I'll try to give an example of my concern. Consider $\mathbb{SET}$. Its objects are sets and morphisms are functions. Now, let's recall that functions are sets as well - to be more precise, a function $f : A \mapsto B$ is a subset of a $A \times B$ obeying certain properties, which I omit. Thus, one could argue that $f$ is both a morphism between objects $A, B \in Obj(\mathbb{SET})$ and an object defined as a set of pairs $\{ (a_1 \in A, b_1 \in B), ..., (a_n \in A, b_n \in B) \}$ and those are equal because both are essentially exactly the same thing.  I hope my concern is clear and I need some kind of "conceptual insight" from knowledgeable people to move forward. Please give me the right perspective.