Is it possible to call javaScript from &lt;apex:commandButton&gt; ...?
I have a custom search page for use in Customer Portal.  VF Page:    &lt;form name="frmSearch"&gt;      &lt;input type="text" name="keyword" id="keyword" value="{!portalSearchModel.searchTerm}" onkeypress="return noenter(event);" style="width:25%; height:25px;margin:0; padding: 0px 6px 0px;" placeholder="What are you looking for?" /&gt;      &lt;input type="button" id="btnSearch" name="btnSearch" value="Search" onclick="searchTerm()" class="go-we3" /&gt;   &lt;/form&gt;   &lt;script type='text/javascript'&gt;       function searchTerm(){         var searchTerm = document.getElementById("keyword").value;          var url="/apex/PortalSearch?s="+searchTerm;          window.location = url;          return false;     }          &lt;/script&gt;   Is there a way to call this apex method in Controller on button click along with the JavaScript?      public void logSearchTerm(){         portalSearchModel.searches();         Search_Log__c sl = new Search_Log__c();          sl.search_term__c = portalSearchModel.searchTerm;         sl.user__c = UserInfo.getUserId();              insert sl;  }
Is voting to balance in the spirit of the site? The other day I saw an answer which was ok. Not great but not bad. So no reason to upvote or downvote. However the answer already had a single downvote. I felt this was unfair so upvoted the answer to keep it at what I felt was a fair score. It wasn't until afterward that it occurred to me that I should have perhaps solely voted on the content of the answer.  Is this a reasonable reason for an upvote or should I have left the answer alone? How can I prevent URLDownloadToFile from retrieving from the cache? I am using URLDownloadToFile to retrieve a file from a website. Subsequent calls return the original file rather than an updated version.  I assume it is retrieving a cached version. Rule of thumb for number of bootstrap samples Is there a way to use the formatter that comes with eclipse, outside of eclipse?  I would like to format some java files using my formatter.xml file that I have configured using eclipse.  Does anyone have any code examples that would allow me to do this?  I would also like to use this standalone, so the specific jars that are used would be nice. Windows 10 changes UEFI boot order every time I have an HP 500-413nl (a desktop) and Windows 10 keeps changing the boot order in UEFI/BIOS every time, so that if I want to boot Ubuntu 16.10 (64-bit) I always have to press F10, thus entering the BIOS setup and changing boot order…  Is there a workaround for my PC? What should I do? I'm a little desperate.  P.S.: I have already disabled "Secure boot" and "Fast/quick boot" in the BIOS and "Fast startup" in Windows options / Control panel. I would like to print a document with text on lined paper like a notebook like   However, I would like to be able to edit the line colours.  I would like to put the header/title in the blank white space. Is there a way to do the document above without using the background jpg?  The document is also multiple pages.   I have looked at this question too and would like to have lines only and not a grid.   Thanks! How does one restrict number of allowed types in Java generic type Is it possible to upgrade a BGA 1224 CPU? For as long as I can remember I have avoided using switch statement fall-through. Actually, I can't remember it ever entering my consciousness as a possible way to do things as it was drilled into my head early on that it was nothing more than a bug in the switch statement. However, today I ran across some code that uses it by design, which got me immediately wondering what everyone in the community thinks about switch statement fall-through. Is it something that a programming language should explicitly not allow (like C# does, though it supplies a workaround) or is it a feature of any language that is powerful enough to leave in the programmer's hands? Edit: I wasn't specific enough to what I meant by fall-through. I use this type a lot:     switch(m_loadAnimSubCt){         case 0:         case 1:             // Do something             break;         case 2:         case 3:         case 4:             // Do something             break;    }  However, I'm concerned about something like this.    switch(m_loadAnimSubCt){         case 0:         case 1:             // Do something, but fall through to the other cases             // after doing it.          case 2:         case 3:         case 4:             // Do something else.             break;    }  This way whenever the case is 0, 1 it will do everything in the switch statement. I've seen this by design and I just don't know if I agree that switch statements should be used this way. I think the first code example is very useful and safe. The second seems kind of dangerous. Given a real, skew-symmetric matrix $\mathbf{A}\in\mathbb{R}^{m\times m}$, and a nonzero vector $X\in\mathbb{R}^{m}$, classify the scalar $\lambda$ (real, complex, imaginary, etc.) in the eigenvalue equation $$ \mathbf{A}X = \lambda X $$  The matrix $\mathbf{A}$ is skew symmetric if $\mathbf{A}^{T}=-\mathbf{A}$.  My try : I am new to matrices , so can not get a idea how to deal with it , Any hint will help When to capitalize the name of a season Which sentence uses the correct capitalization for the name of the season?     I will travel in the summer of 2013.   or     I will travel in the Summer of 2013. Virtualbox: OS cannot use the new extended disk space (.vdi) I bought a Minecraft account for my little brother for Christmas, and I'd like to play with him on my server every now and then. If I log in while he's on, however, it kicks him off since we have the same username. Is there any way to change my username so that I can play with him, or anything I can do so that we can both play together using this account on my server?  I'm open to anything that could let us play, whether it be username changes, server property changes, etc. We all know that speed of gravitational waves (GW) and that of light in space are exactly the same (= $c$).  We also know that space is medium for GW.   Does that mean space is also the medium for light?  Because both of them are waves, and speed of a wave is property of the medium.   Is there any other way to justify the identical speed of the two? Finding what's using all the space in *nix Which sequence of commands will tell me which files are the largest starting from a particular directory, including all sub directories? I want to know where all the space went.  Preferably just with regular unix'y commands.  If possible, try to keep it compatible with Sun OS 5.10 (perhaps in addition to regular Linux answers, not as a replacement, to keep it as general as possible.) Why can't energy be created or destroyed? PHP PCRE (regex) doesn't support UTF-8? what does the ldapadd error: "additional info: objectClass: value #2invalid per syntax mean? What Android emulators are available? I will like to know some of the android emulators that work really well with Ubuntu 11.10 and above. I want to try 'whatsapp' on Ubuntu through an android emulator. Thanks in advance Evaluate $6^{433} \pmod {21}$ and a proving question Question 1: Denote $a \mod b$ as $a \% b$, where $a$ and $b$ are some integers  Evaluate 12^32475 % 21    The following is what I tried:    12^32475 % 21 = (12^3 % 21)^10825 % 21 = 6^10825 % 21 = ... = 6^433 % 21   But how to continue ?  Question 2:  I don't understand this: n-1= -1 mod n. Where is this from? And does this line become the next line?    Context: my class is discrete math for computer science. So far for related topics, it covers modular inverse, (extended) GCD algorithm, Fermat's Little Theorem and Chinese Remainder Theorem (CRT).