I think my question is simple. I just need a little character check when I click in one button. If such textbox have more than one comma, I want a message: "Error. Please insert just one comma in the box." I was searching but have not found anything like this. Can someone help me? Thanks all in advance!
6643
I am doing something where I realised I wanted to count how many /s I could find in a string, and then it struck me, that there were several ways to do it, but couldn't decide on what the best (or easiest) was.  At the moment I'm going with something like:  string source = "/once/upon/a/time/"; int count = source.Length - source.Replace("/", "").Length;   But I don't like it at all, any takers?  I don't really want to dig out RegEx for this, do I?  I know my string is going to have the term I'm searching for, so you can assume that...  Of course for strings where length > 1,  string haystack = "/once/upon/a/time"; string needle = "/"; int needleCount = ( haystack.Length - haystack.Replace(needle,"").Length ) / needle.Length;
118444
i need comma in between my number  eg- 1000 --> 1,000  i m attaching the controller and vf page for this  public List&lt;BarData&gt; getOpportunityTarget(){     Integer CurrentMonth = Date.Today().Month();     Decimal total = 0.0;      TargetList = new List&lt;BarData&gt;();     if(MonthlyTargetMap.get(currentMonth) != null){         if(OpportunityList.size()&gt;0){                for(Opportunity objOpportunity : OpportunityList){                 if(objOpportunity.StageName == 'Approved' &amp;&amp; objOpportunity.Amount != null &amp;&amp; objOpportunity.closeDate.Month() == CurrentMonth){                     total += objOpportunity.Amount;                 }             }             TargetList.add(new BarData('Closed',total.setScale(0)));                     TargetList.add(new BarData('Target',MonthlyTargetMap.get(currentMonth).setScale(0)));                     }else{             TargetList.add(new BarData('Closed',0));                     TargetList.add(new BarData('Target',MonthlyTargetMap.get(currentMonth).setScale(0)));                     }     }                                         return TargetList;          Vf Page  &lt;div class="sections" &gt;                                    &lt;div class="graph-section"&gt;                                &lt;h2 align="center"&gt;Closed v/s Running Target &lt;/h2&gt;&lt;br/&gt;&lt;br/&gt;          &lt;apex:chart height="300" width="400" data="{!OpportunityTarget}"&gt;             &lt;apex:axis type="Numeric" position="left" fields="data" grid="true" minimum="0" /&gt;             &lt;apex:axis type="Category" position="bottom" fields="name"&gt;                 &lt;apex:chartLabel rotate="315" font="bold 13px Helvetica"/&gt;             &lt;/apex:axis&gt;             &lt;apex:barSeries orientation="vertical" axis="left" xField="name" yField="data" colorSet="#99ccff"&gt;                 &lt;apex:chartTips height="20" width="150" /&gt;                 &lt;apex:chartLabel field="data" display="outside" orientation="horizontal" font="bold 12px Helvetica" /&gt;                                                 &lt;/apex:barSeries&gt;         &lt;/apex:chart&gt;                                                 &lt;/div&gt; &lt;/div&gt;
11336
How do you create a simple, custom rule using the jQuery Validate plugin (using ) that doesn't use a regex?  For example, what function would create a rule that validates only if at least one of a group of checkboxes is checked?
56302
I don't think I'm going any more crazy than normal, but I'm surprised I can't see any other meta mention so far. This started happening recently on at least SO and ubuntu.SE, and occurs in at least IE and Firefox. So I'm guessing it's a deliberate feature not [bug]. But I'm not keen.  It's not standard in any browser for a &lt;textarea&gt; to submit when Enter is pressed; the behaviour to me seems spooky and undesirable. I've already accidentally-commented more than once and had to delete the comment and drag the text back into editing.  (I realise you can't actually have a newline in a comment, but I've often used newlines to separate thoughts I'm editing together into a comment, or maybe bits to overflow into a subsequent comment. I don't really want to have to break out the text editor to get this ability.)  May I have my Enter key back please Sir?
37488
This works just fine:      protected void txtTest_Load(object sender, EventArgs e)     {         if (sender is TextBox) {...}      }   Is there a way to check if sender is NOT a TextBox, some kind of an equivalent of != for "is"?  Please, don't suggest moving the logic to ELSE{} :)
122159
Is there a way to have a statement across multiple lines without the underscore character?  It is really annoying in multi-line strings such as SQL statements, and especially  queries.  Beside from the ugliness and difficulty when changing a line (nothing lines up anymore), you can't use comments in the middle of the multi-line statement.  Examples of my daily personal hell.  dim results = from a in articles _               where a.articleID = 4 _ ' articleID     - Nope, can't do this               select a.articleName   dim createArticle as string = _     "Create table article " &amp; _     "    (articleID int " &amp; _     "    ,articleName varchar(50) " &amp; _     "    )"
244
How does the comma operator work in C++?  For instance, if I do:  a = b, c;     Does a end up equaling b or c?   (Yes, I know this is easy to test - just documenting on here for someone to find the answer quickly.)  Update:  This question has exposed a nuance when using the comma operator.  Just to document this:  a = b, c;    // a is set to the value of b!  a = (b, c);  // a is set to the value of c!   This question was actually inspired by a typo in code.  What was intended to be  a = b; c = d;   Turned into  a = b,    //  &lt;-  Note comma typo! c = d;
39060
Whenever I try to insert " or ' I have to validate it by space, otherwise strange things happen as with ' followed by an a becomes áinstead of just 'a, similar behaviour with double quotes. I find this annoying and want to disable it. How do I do that?
56034
I doubt I am the only one who has come up with this solution, but if you have a better one please post it here. I simply want to leave this question here so I and others can search it later.   I needed to tell whether a valid date had been entered into a text box and this is the code that I came up with. I fire this when focus leaves the text box.  try {     DateTime.Parse(startDateTextBox.Text); } catch {     startDateTextBox.Text = DateTime.Today.ToShortDateString(); }
19393
How to restrict the maximum number of characters that can be entered into an HTML &lt;textarea&gt;? I'm looking for a cross-browser solution.
117305
I have a textbox in Javascript. When I enter '0000.00' in the textbox, I want to know how to convert that to only having one leading zero, such as '0.00'.
63165
What I'm looking for is a one click enable/disable or toggle in some form. The closest I've come is manually editing a cell to enter a 0 or 1, but I'm hoping there's a nicer pattern.  I know there's no checkbox functionality in a Google Sheets but is there a way to get equivalent functionality somehow?
50758
As you know, we can enable the spell checker on single line text boxes in the following way:    We have to enable it every time for checking words.  How can we enable it forever, so it doesn't need to be enabled each time?
92162
Is there a way to create a keyboard shortcut that would input a short defined sequence of characters into whatever text field is currently active?  Is it maybe possible to achieve this with AppleScript or Automator?
64668
I have been looking around to turn off &quot;CMD + , (comma)&quot; opening password manager in Safari but there appears to be no option to do so (maybe I missed it). The same shortcut is used as subscript shortcut in Google Docs and it is really annoying during essays. Does anyone knows how to do such thing? Thank you beforehand! -It is marked as duplicate but the answer is not relevant.
108847
If I type ' (single quote, next to the &lt;enter&gt; button) in the terminal and then press enter it drops to a &gt; prompt.  What exactly is this, what's it used for, and what type of commands can I enter here?    I can &lt;Ctrl-C&gt; out of it but that's all I got.
58125
I am trying to create a command that the user can enter keys for values. How can I create one, for example:   \myparbox[width=50,height=10,color=blue, align=left -10px]{}