pid int64 2.28k 41.1M | label int64 0 1 | text stringlengths 1 28.3k |
|---|---|---|
24,724,434 | 0 | Sort array by delegate <p>I want to sort an array alphabetically using a delegate. The input is</p> <pre><code>"m", "a", "d", "f", "h" </code></pre> <p>but the output is</p> <pre><code> a a d f h </code></pre> <p>i.e. it is ordered alphabetically but the "m" is missing and with "a" doubled. What is the reason?</p> <p>S... |
38,087,254 | 0 | <p>I'm using BroadcastReceivers to solve these kind of problems to avoid problems related to the Android lifecicle.</p> <p>The basic idea of broadcast receiver is a publisher-subscriber, the interested fragmets should register with an appropriate intent filter to the events they're interested in and the activity shoul... |
23,072,844 | 0 | <p>You could check if the <code>#localVideo</code> element exists. Also, if they are the only elements in the <code>#A</code> element, you can remove them by calling <code>$('#A').empty();</code>.</p> <pre><code>$(document).ready(function() { $('#BtnOn').click(function() { if ($('#localVideo').length == 0) { $('#A').a... |
5,264,764 | 0 | JSF/Richfaces/A4j ==> component/field conversion and reRendering problem <p>I have an input field in a JSF Page like the following (maps to BigDecimal on backing bean)</p> <pre><code> <h:inputText disabled="#{volumeBean.grossVolumeDisabled}" id="grossVolume" size="10" validateOnExit="true" value="#{volumeBean.entere... |
12,367,606 | 0 | Powershell variable interrogation of date & time difference <p>Morning All,</p> <p>I have a variable as follows: <code>$machines = $user2,$name,$serial,$purchased</code> sample data stored in $machines is:</p> <pre><code>User1, Laptop1, xyz1234, 01/01/2010 </code></pre> <p>I am wanting to create a new variable called $... |
14,272,251 | 0 | <p>Firefox has a <strong>"text-only"</strong> zoom feature, unlike Chrome that lacks this feature.</p> <p>To make <strong>everything</strong> zoom in Firefox, <strong>remove</strong> the checkmark and Reset the zoom level.</p> <p><img src="https://i.stack.imgur.com/VSHLA.png" alt="enter image description here"></p> <p... |
4,747,750 | 0 | <p>Is there a larger context in which you are operating? In ASP.NET I've created a PerRequestLifetimeManager that returns the same object when it is requested multiple times during a single HTTP request.</p> <p><strong>EDIT:</strong> Here's an implementation if you're interested.</p> <pre><code>public class PerRequest... |
11,359,111 | 0 | How can I delete old translations? <p>I have noticed that when I change a word on a new action before submitting it to Facebook, it generates new translations. How can I delete old translations so that I don't need to translate them ?</p> <p>Thank you, Zoé</p> |
15,140,966 | 0 | <p>(I've tried to edit @false's <a href="http://stackoverflow.com/a/15140312/1545971">response</a>, but it was rejected)</p> <p><code>my_len_tail/2</code> is faster (in terms of both the number of inferences and actual time) than buldin <code>length/2</code> when generating a list, but has problem with <code>N in 1..2... |
15,385,693 | 0 | Fetch details of a ListItem in ListView from MySQL Database <p>I have successfully fetched a list from a database and binded it in a ListView. If I select an item from the listView if fetches the correct details of that item. If I select another list item from the listview, it brings the same same data of the previous ... |
23,498,695 | 0 | <p>You can't have multiple instances of the same <code>MockUp</code> subclass at the same time (each such mock-up would simply override the previous one when it got instantiated). Instead, add an <code>Invocation</code> parameter to your <code>@Mock</code> method, and then use the information it provides to distinguis... |
1,820,856 | 0 | <p>Well, you deserve a medal for putting that much time into this issue.</p> <p>I'd suggest these things:</p> <ol> <li>Make him read <em>Code Complete</em>. <ul> <li>Treat him like a senior programmer, but check every step he makes until you see good results.</li> <li>Don't take over or he won't learn. Let him make mi... |
30,765,246 | 0 | <p><code>natualHeight</code></p> <p>Look veeeeeeery closely at that word... =)</p> <p>It's probably just finding that <code>NaN</code> is neither less than nor greater than nor equal to <code>NaN</code>. (You have the same typo on naturalWidth too)</p> |
39,334,620 | 0 | Create Android Widget inside App <p>I'd like to link to my app widget configuration activity from inside my app. I know it's possible to launch the Android widget picker but can I bypass that step and let my users create a widget on their home screen from inside my app?</p> |
38,584,976 | 0 | How can i reload the URL automatically if session is expired? <p>I am using maven spring boot and spring security with java configuration. I have also created Security Configuration which extends <code>WebSecurityConfigurerAdapter</code>. </p> <p>Here what i need is once my session is expired then automatically reload ... |
15,016,371 | 0 | SQL adding two columns (datetime) <p>I have two columns that contains datetimes and i need two add them together somehow. I've tried using sum but that didnt work. Im using sqlserver 2008.</p> <p><strong>Columns</strong></p> <p><strong>loanPeriod</strong> = the loanperiod of the item </p> <p><strong>checkOutDate</stron... |
29,615,773 | 0 | <p>There are a few key points when doing this sort of thing (and these apply to languages other than Tcl too). Firstly, you should <strong>compute the delta</strong> from the span you want and the number of steps you want. Secondly, you should <strong>keep your incrementing and loop control using integers</strong> if ... |
37,385,489 | 0 | <ol> <li><p>No, nested collections as properties can not be used.</p></li> <li><p>The philosophy is simple: maximum decomposition of objects and relationships to effectively use graph algorithms as a tool of analysis. Using your example with food:</p> <ul> <li>Who eats the same foods for breakfast?</li> <li>Who was th... |
23,652,918 | 0 | <p>It may be that the space in the title is not being url encoded correctly. Try using <code>encodeURIComponent()</code> to solve this.</p> <pre><code>var link = '@Url.Action("accountPartial", "BillingProfile")?ln=' + ln + '&profileID=' + profileID + '&title=' + encodeURIComponent(title) + '&active=' + act... |
40,531,886 | 0 | Rectangle is not moving if i set the x y from another class. <p>Alright, so I got two classes here, the main and the keylistener class which i use to pass keyboard inputs to the main class.</p> <pre><code> import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.aw... |
38,854,818 | 0 | How twitter ios app is doing to push the profile page with a new UINavigationController <p>I wondering how Twiter is doing, in the ios app, to push a profile viewController with a new navbar or a new navigationController above the current viewController ?</p> <p><a href="https://i.stack.imgur.com/zKp9i.png" rel="nofoll... |
25,683,894 | 0 | <p>try with below code :-</p> <pre><code>if (Request.Cookies["AdminPrintModule"] != null) { HttpCookie cookie = Request.Cookies["AdminPrintModule"]; test = cookie["PrinterSetting2"].ToString(); } </code></pre> <p>Have a look at this document <a href="http://www.c-sharpcorner.com/uploadfile/annathurai/cookies-in-Asp-Ne... |
25,409,953 | 0 | Are there specific rules for defining a function in C? <p>I am writing a script that can process .c and .h files. Using regular expressions I am finding all functions within a given file. During my experiences with C I always defined functions in the following manner:</p> <pre><code>void foo(int a){ //random code } </c... |
33,274,822 | 0 | <p>First check the Gemfile is present in server or not.</p> <p>If present, then specify the location in your configuration file by adding below code.</p> <blockquote> <p><code>set :bundle_gemfile, "rails_code/Gemfile"</code></p> </blockquote> |
24,177,890 | 0 | Group by STRING and sum another field as you group <p>I just recently got a job maintaining an app that stores some products in a table. In the table there is the quantity of the product. There are a random number of records in the table so one product could have 1 to n records inside. Because I wasn't designing the ap... |
12,734,612 | 0 | <p>While your particular case concerns Windows Azure specific (the 4 minute timeout of LBs), the question is pure IIS / ASP.NET workwise. Anyway, I don't think it is possible to send "ping-backs" to the client while in AsyncController/AsyncPage. This is the whole idea of the AsyncPages/Controllers. The IIS leaves the ... |
1,014,515 | 0 | <p>An IronPython or IronRuby project can be compiled to a dll or executable just fine and will be 'real' executables in every way with the proviso that the person running them must have the relevant .Net framework and dependencies installed (dependencies may be present in the same directory by default instead but the ... |
39,345,374 | 0 | Open two tcp connection using TcpListener class on both side <p>I want to open tcp connection between two machine. I want to use the class TcpListener on the client side and on the server side and by this to have the option to make the two side 'talk' with the other by sending and receiving byte[]. </p> <p>That mean th... |
14,186,873 | 0 | What's the best practice to code shared enums between classes <pre><code>namespace Foo { public enum MyEnum { High, Low } public class Class1 { public MyEnum MyProperty { get; set; } } } </code></pre> <p><code>MyEnum</code> is declared outside <code>Class1</code> cause I need it here and in other classes</p> <p>Seems g... |
8,376,715 | 0 | colorbox new attribute for class ids <p>in colorbox there are two vars ;</p> <pre><code> // Abstracting the HTML and event identifiers for easy rebranding colorbox = 'colorbox', prefix = 'cbox', </code></pre> <p>Can I change these via a jquery function when i call colorbox.</p> <p>Thanks in advance.</p> |
17,177,976 | 0 | <p>I had the same issue.</p> <p>But I found another solution. I used the artisan worker as is, but I modified the 'watch' time. By default(from laravel) this time is hardcoded to zero, I've changed this value to 600 (seconds). See the file: 'vendor/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php' and in fun... |
4,045,883 | 0 | <p>You might want to get a command line to modify metadata. Some tools modify both native and XMP metadata.</p> <p>I wrote a blog on metadata editing a while ago: <a href="http://www.barcodeschool.com/2010/09/publishers-fix-the-metadata-in-the-pdf-file/" rel="nofollow">http://www.barcodeschool.com/2010/09/publishers-f... |
37,307,920 | 0 | <p>You should implement this in your SQL using a case statement.</p> <p><a href="https://dev.mysql.com/doc/refman/5.7/en/case.html" rel="nofollow">https://dev.mysql.com/doc/refman/5.7/en/case.html</a></p> <p>The above answers using the IF() function are correct, but in my opinion it is better to use the CASE-WHEN so a... |
29,623,571 | 0 | <pre><code>// Global Declaration Intent intent; String imageFileName,videoFileName; Uri uri; private void clickPhotoFromCamera() { intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); imageFileName = "JPEG_" + timeStamp + ".jpg"; File imag... |
35,520,933 | 0 | <p>It can be checked with this.</p> <pre><code>bool isLettersOnly = !word.Any(c => !char.IsLetter(c)); </code></pre> |
33,919,527 | 0 | smbclient: command not found <p>I would like to connect to a remote server with the <code>smbclient</code> command and pass some arguments to the script.</p> <p>Here is my command:</p> <pre><code>smbclient //$SERVER -c 'cd $PATH;get $FILE /tmp/$FILE' $PASS -U$PSEUDO -W domain </code></pre> <p>When I launch this command... |
14,211,086 | 0 | Enable animation with blend using property binding condition <p>I am working with blend 4, I am trying to play some StoryBoard using ControlStoryBoardAction with the contidion: if a specific Border Element in my UC has greater width then 250.</p> <p>I set the next configuration: <img src="https://i.stack.imgur.com/KGs2... |
15,329,227 | 0 | <p>public class twoTimes </p> <p>{</p> <pre><code> public static void main(String[] args) { for ( int i=1; i<11; i++)//; <----- Due to this it is not working { System.out.println("count is" + i); } } </code></pre> <p>}</p> |
5,226,456 | 0 | <p>Here's your problem:</p> <pre><code>.Where(s => s.ID == 1).FirstOrDefault(); </code></pre> <p>this will obviously return the same object on each iteration. And I'm guessing that theStat has an ID of 1, which is why it is updated.</p> |
39,179,867 | 0 | Laravel : Error messaging not working <p>Hello friends I have a form when i enter correct value and pressing submit button i am getting success message </p> <p>if i am entering wrong value then <strong>i am not getting error message please suugest something</strong></p> <p><strong>Controller</strong></p> <pre><code> if... |
28,697,204 | 0 | <pre><code>x = {"job" => 1, "big job" => 2, "super job" => 1, "work" => 2, "super big job" => 1} p x.sort_by{|x,|-x.split.size}.to_h #=> {"super big job"=>1, "big job"=>2, "super job"=>1, "work"=>2, "job"=>1} </code></pre> |
17,935,283 | 0 | How to get all the parent classes of a derived class in C# Reflection <p>It is weird that I was not able to find a similar question but this is what actually I want, finding all the parent classes of a derived class. </p> <p>I tested a code with a hope that it works for me :</p> <pre><code>void WriteInterfaces() { var ... |
2,854,088 | 0 | Serialize struct with pointers to NSData <p>I need to add some kind of archiving functionality to a Objective-C Trie implementation (<a href="http://github.com/nathanday/ndtrie" rel="nofollow noreferrer">NDTrie</a> on github), but I have very little experience with C and it's data structures.</p> <pre><code>struct trie... |
34,662,032 | 0 | <p>When working with HTTP content (which is the case of Safari and Mail app), you must not forget to handle its content type. The <a href="https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html" rel="nofollow">Uniform Type Identifier</a>... |
20,662,268 | 0 | <p>try to write <code>Range("c" & row).FormulaR1C1=temp</code></p> |
36,312,102 | 0 | <p>In your INSTALLED_APPS </p> <pre><code>INSTALLED_APPS = [ ..., 'HdfsstatsConfig', ] </code></pre> <p>in your views.py</p> <pre><code>from .viewcreator import Builder </code></pre> <p><strong>UPDATE, DJANGO IMPORTS</strong></p> <p>There are 3 ways to imports module in django </p> <p><strong>1. Absolute import:</stro... |
27,548,347 | 0 | <p>First, remove stuff that shouldn't be there:</p> <pre><code>$str = preg_replace('/[^PDL\d-]/i', '', $str); </code></pre> <p>That gives you the following normalised results:</p> <pre class="lang-none prettyprint-override"><code>D456789-1 D456789-1 D456789-1ldlddld </code></pre> <p>Then, attempt to match the data you... |
15,755,847 | 0 | <p>I presume you want the strings instead of the numerical values, correct?</p> <pre><code>s = '' for j in range(30, 0, -1): s += "{}/{} + ".format(31-j, j) print s[:-2] </code></pre> <p>Read <a href="http://docs.python.org/3/library/string.html#format-string-syntax" rel="nofollow">this documentation</a> to get a gras... |
29,487,821 | 0 | <p>You are using django 1.6.5, in this version migrations were not introduced so its may give you error on running migrations because django rest framework auth token migration tries to import migrations from django.db</p> <p>Upgrade your south package from 0.8.4 to 1.0.1 version that will solve your problem Please ch... |
7,613,322 | 0 | <p>I am trying to build a huge central for 9-patch images.</p> <p>Feel free to visit and grab whatever you need from there.</p> <p>As long as it is for building your android applications :)</p> <p><a href="http://android9patch.blogspot.com/">http://android9patch.blogspot.com/</a></p> |
23,475,818 | 0 | SpannableStringBuilder cannot be cast to android.text.SpannableString <p>I need to save data from <code>TextView</code> to and SQLite database in HTML format.</p> <p>I'm using this code to convert text from <code>TextView</code> to HTML-formatted string:</p> <pre><code>public static String htmlToString(TextView textvie... |
39,739,495 | 0 | <p>I think you need:</p> <pre><code>print (data[0].min(axis=1)) 0 3662.1 1 3660.0 2 3659.5 3 3660.0 4 3661.5 5 3662.6 6 3661.5 7 3660.0 8 3661.5 9 3662.1 10 3660.0 11 3661.0 12 3664.1 13 3664.1 14 3661.5 15 3661.0 ... ... </code></pre> <p>Maybe beter is omit <code>flow = pd.DataFrame(data)</code> and use:</p> <pre><co... |
8,308,369 | 0 | <p>You can store anything you like in localStorage provided the item stored is turned into a string, no problem in your case, and the total storage doesn't exceed 5Mb per site.</p> <p>You approach could something like this.</p> <ol> <li>When the page loads (use jQuery) check if the base HTML template is there</li> <li... |
20,248,466 | 0 | <p><code>Nancy.Testing</code> does not use any network communication at all. If you can think of a nice abstract then please let us know and we can talk and see if it's something we'd like to get into the package!</p> |
12,448,760 | 0 | <p>There are better ways to solve your problem. The typical protocol I use is:</p> <ul> <li>Register a window message using <a href="http://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCAQFjAA&url=http://msdn.microsoft.com/en-us/library/windows/desktop/ms644947%2... |
4,353,080 | 0 | Testing on a single-core PC with hyperthreading <p>If a multithreaded program runs safe on a single-core CPU with hyperthreading, will it also run safe on a dual-core CPU with hyperthreading? Concerning thread-safety etc.</p> <p>EDIT</p> <p>Ok, I try to be more specific. I mean the bad source code lines, where I will h... |
27,412,177 | 0 | custom pager for knockout arrayBinding <p>i need to make a custom pager like [<] 1 2 3 4 ... > for a knockout binding array with 5 items. The items are in an article cuote .</p> <p>I already tried with some examples aviables on internet, but i'm new in this matters so i didn't solve the issue.</p> <p>Can someone tel... |
7,034,090 | 0 | <p>The class is being applied by the date picker plug-in, probably using the <code>addClass</code> function. The plug-in, when it's initialized, probably creates a <code>DIV</code> (<code>id=;dp-popup'</code>) that has the necessary values for the current month. That <code>DIV</code> is hidden (<code>display:none</cod... |
36,002,165 | 0 | How do you reduce Vertex cover to Hamiltonian Cycle? <p><a href="http://i.stack.imgur.com/HH8Bp.jpg" rel="nofollow">This is the example the book uses</a></p> <p>The book I'm using is Introduction to Algorithms 3rd edition. Anyway they explain how to reduce Vertex Cover to Hamiltonian Cycle to prove Hamiltonian Cycle is... |
11,258,645 | 0 | <p>Judging on your "desired output" image, your usage of kmeans is wrong. The pixel coordinates should play no role in the clustering. You should only hand the color triplets to kmeans.</p> <pre><code>sample = cvCreateMat( image->height*image->width, 3, CV_32FC1 ); </code></pre> <p>…</p> <pre><code> for(j=0;j<... |
5,489,502 | 0 | How to get previous month and year relative to today, using strtotime and date? <p>I need to get previous month and year, relative to current date.</p> <p>However, see following example.</p> <pre><code>// Today is 2011-03-30 echo date('Y-m-d', strtotime('last month')); // Output: 2011-03-02 </code></pre> <p>This behavi... |
28,790,503 | 0 | Are there security measures against udp hole punching? <p>I want to establish an UDP communication between two peers, say Alice and Bob. Alice is behind a port restricted cone NAT (so that the same internal port gets mapped to the same external port even if the destination is changed), while Bob is behind a symmetric N... |
39,697,387 | 1 | Real-time Synchronize data between two python application <p>Im going to have two python scripts. one is server and another one is client. the server is used to get information from Network Devices like Router or Switch via SNMP. The client needs to get the data from server and output to users.</p> <p>My algorithm is t... |
10,645,240 | 0 | <p>Your first example you have no period before <code>'ui-state-highlight'</code> so you are trying to select elements with a TYPE of ui-state-highlight (as opposed to a type of DIV, INPUT, SELECT, etc)</p> <pre><code> $('ui-state-highlight') </code></pre> <p>Your second example you actually select elements with a cla... |
39,975,924 | 0 | <p>try this</p> <pre><code>Option Explicit Sub test() Dim j As Long Dim rng As Range, cell As Range Dim i As Long j = Application.InputBox("No. of rows to be inserted?", Type:=1) With Worksheets("REFS") '<-_| change "REFS" to your actual worksheet name i = 1 With .Range("D2", .Cells(.Rows.Count, "D").End(xlUp)) Do ... |
25,040,579 | 0 | Variables initialized as long ints in for loop cause crash <p>Using MinGW C compiler, this code crashes my program. NN has value 439470944 and NN and j are initialized as long-integers.</p> <pre><code>float *F=NULL; F = (float *)malloc(NN*sizeof(float)); for(j=0; j<NN;j++) F[j] = 0; // ensure F[] starts empty. </cod... |
37,314,219 | 0 | <p>First, of course, your application must declare that it is doing serial communication in the application manifest: </p> <pre><code><DeviceCapability Name="serialcommunication"> <Device Id="vidpid:xxxx xxxx"> <Function Type="name:serialPort"/> </Device> </DeviceCapability> </code></pre>... |
12,825,367 | 0 | <p>You should have no problem. Just add your own event handler using jQuery's API and you'll be set. From the jQuery Docs on <code>.on()</code>:</p> <blockquote> <p>As of jQuery 1.4, the same event handler can be bound to an element multiple times.</p> </blockquote> <pre><code>$('#myButton').on('click', myHandler) </c... |
12,061,689 | 0 | <p>Found it! <a href="http://dylanmarkow.com/blog/2012/05/06/load-order-with-rubymotion/" rel="nofollow">http://dylanmarkow.com/blog/2012/05/06/load-order-with-rubymotion/</a></p> |
33,201,579 | 0 | <p>Your additional field is inside an element with</p> <pre><code>ng-if="register" </code></pre> <p>ng-if is a directive that creates its own scope. So, when something is entered into the field <code><input ng-model="email" ...></code>, an email attribute is created and populated <strong>in the ng-if scope</stro... |
28,637,862 | 0 | <p>Have a look at DateDiff function: <a href="http://www.w3schools.com/vbscript/func_datediff.asp" rel="nofollow">http://www.w3schools.com/vbscript/func_datediff.asp</a>. Example:</p> <pre><code>diff = DateDiff("d", "02/19/2015", "02/20/2015") ' difference in days diff = DateDiff("h", "02/19/2015", "02/20/2015") ' dif... |
36,123,828 | 0 | Double from CoreData returns very small number <p>I am working on a diving application, and one of the feature is to store diving's rating as double into CoreData. The interface should be able to retrieve the double value from the coredata object and then display on screen. However, the problem I got from my code is th... |
4,758,750 | 0 | JQuery restart setInterval <p>Sorry to be a bore but having trouble restarting a setInterval with a toggle function. I get to stop it - when needed, but I cannot get it to restart when the toggle "closes"</p> <p>Here is my code </p> <p>Set the setInterval</p> <pre><code>var auto_refresh = setInterval( function() { $('.... |
13,330,043 | 0 | Git remote branches not listed <p>So I'm trying to create a remote branch so I can push updates to a project I'm doing to my Github account, but for whatever reason, my remote branches aren't being created.</p> <p>These are the commands I am running:</p> <pre><code>git remote add origin git@github.com:<username>/... |
27,875,459 | 0 | <p>No, there isn't. By the time the timeout function runs, the browser will have already submitted the form and be loading the new page. </p> <p>If you want to cancel the submission <em>conditionally</em> than the closest you could come would be to <em>always</em> prevent the default form behaviour and then conditiona... |
21,829,617 | 0 | Reducing multi-column xts to single column xts based on provided column indexes <p>I have an xts object with multiple columns of the same type. I have another xts object with integers that correspond to column positions in the first object. I would like to generate an third xts object that contains one column represent... |
13,031,499 | 0 | <p>Ok - here is a very basic working example of list indexing. The main change is to move the creation of the model from getModel() to prepare(). This is because getModel() is called for every value you need to set the list - so you end up re-creating your model each time overwriting the previous change.</p> <pre><cod... |
35,135,273 | 0 | <p>Using <a href="http://docs.aws.amazon.com/ssm/latest/APIReference/Welcome.html" rel="nofollow">Amazon EC2 Simple Systems Manager</a>, you can configure an SSM document to run a script on an instance, and pass that script a parameter. The Lambda instance would need to run the SSM send-command, targeting the instance... |
15,416,778 | 0 | <p>Like TGMCians says, a <code>Toast</code> will do the trick.</p> <p>If you want to write it to the LogCat instead, then you can use</p> <pre><code>Log.i(tag, message) </code></pre> <p>You can then view this in the LogCat in Eclipse by going to Window > Show View > Other > Android > LogCat</p> |
22,620,997 | 0 | <p><code>XML Tools</code> from the <code>Plugin Manager</code> can do the trick as well. Then once download the plugin, tick <code>Tag auto-close</code> in <code>Plugins > XML Tools</code></p> |
28,913,483 | 0 | <pre><code>$numdays = cal_days_in_month (CAL_GREGORIAN, $mon,$yr); for($i=1;$i<=$numdays;$i++) { if(date('N',strtotime($y.'-'.$m.'-'.$i))==7) $sun++; } </code></pre> <p>Sunday calculation after u calculate employee working days </p> <pre><code>$tot=$numdays-$sun-$emp_working_days;echo $tot; </code></pre> |
4,228,434 | 0 | <p>The reason your initial attempt is not working is that you're attempting to capitalize a symbol or a string that represents the field name and not the actual variable.</p> <p>You could do something like this and then the data would be capitalized before it's sent to the view.</p> <pre><code>@sexes = Sex.all @sexes ... |
30,777,456 | 0 | Trouble rebalancing the root node of an AVL tree <p>Hello guys i seem to be having trouble rebalancing the AVL tree. It balances everything else except the root node. I don't know why it doesn't balance the root node. When i pass values such as 50, 40, 30, 20, and 10. I get 50,30, 20, 10 and 40. 50 should not be the ro... |
21,810,681 | 0 | Android calls onNavigationItemSelected too late to guard against it <p>Even though I am a frequent reader, this is my first question on Stackoverflow, so be gentle. ;)</p> <p>I have an activity that can be navigated laterally using a view pager or an action bar drop down list. To achieve this, I have attached an OnPage... |
39,430,328 | 0 | How to set mongodb settings, like mongodb.debug in php.ini file? <p>How to set mongodb settings, like mongodb.debug in php.ini file?</p> <p>For example, here [ <a href="http://php.net/manual/en/mongodb.configuration.php#ini.mongodb.debug" rel="nofollow">http://php.net/manual/en/mongodb.configuration.php#ini.mongodb.deb... |
256,052 | 0 | <p>std::map's comparator isn't std::equal_to it's std::less, I'm not sure what the best way to short circuit a < compare so that it would be faster than the built in one.</p> <p>If there are always < 15 elems, perhaps you could use a key besides std::string?</p> |
9,871,134 | 0 | <p>Expose Action Classes as URLs if you want to save time and effort overheads.</p> <p>But, REST APIs would be your best bet in long term as they are scalable and if later on if you want users to update/create data through APIs.</p> |
15,606,677 | 0 | <p>This is another approach, using more iterables and more relying on defaults:</p> <pre><code>from itertools import imap, islice, izip def find_min_diff(iterable, sort_func=sorted): sorted_iterable = sort_func(iterable) return min(imap( lambda a, b: b - a, izip(sorted_iterable, islice(sorted_iterable, 1)), )) </code>... |
29,146,259 | 0 | <p>When you say:-</p> <pre><code>var _db = new PortOfTroyCustomers.Models.PortOfTroyContext(); </code></pre> <p>The compiler infers the type of the expression to the right of the assignment, this is known as implicit type in C#.</p> <p>Now, you are trying to assign, your query like this, we have <code>System.Data.Enti... |
4,372,354 | 0 | <p>The class of the <code>Like</code> button is <code>like_link stat_elem as_link</code>, but I'm not seeing any <code>#808080</code> deceleration. I'll post some working code once I find it.</p> |
3,841,348 | 0 | <p>Declare it right in your code there:</p> <pre><code>class Datastructure { private: struct Ship { // Constructor!!! Ship(); std::string s_class; std::string name; unsigned int length; } minShip, maxShip; std::vector<Ship> shipVector; public: Datastructure(); ~Datastructure(); }; </code></pre> <p>Then to define... |
11,767,557 | 0 | Scroll an NSTableView so that a row is centered <p>I want to programmatically scroll an NSTableView so that a particular row is centered. It's simple to scroll the NSTableView so that a particular row is visible:</p> <pre><code>[theTableView scrollRowToVisible:pos]; </code></pre> <p>However, usually the row in question... |
3,483,077 | 0 | Applying the Y-Combinator to a recursive function with two arguments in Clojure? <p>Doing the Y-Combinator for a single argument function such as factorial or fibonacci in Clojure is well documented: <a href="http://rosettacode.org/wiki/Y_combinator#Clojure" rel="nofollow noreferrer">http://rosettacode.org/wiki/Y_combi... |
26,130,776 | 0 | <p>From the API doc for <code>HTable</code>'s <code>flushCommits()</code> method: "Executes all the buffered Put operations". You should call this at the end of your <code>blah()</code> method -- it looks like they're currently being buffered but never executed or executed at some random time. </p> |
29,163,424 | 0 | <p>I think that this link could give you some hints about the design of RESTful services / Web API: <a href="https://templth.wordpress.com/2014/12/15/designing-a-web-api/" rel="nofollow">https://templth.wordpress.com/2014/12/15/designing-a-web-api/</a>.</p> <p>It's clear that not all Web services that claim to be REST... |
9,476,189 | 0 | <p>If you don't do any query then there is nothing to boost.</p> <p>A dismax query is nothing more than a query which matches in any one of several fields. You can boost a dismax query in the way that you specified, but you need to do the query to boost it.</p> <p>q.alt is only used when no query is specified.</p> |
20,559,990 | 0 | <p>The <a href="http://docs.oracle.com/javaee/6/api/javax/servlet/package-summary.html" rel="nofollow">Servlet API</a> provides a way to read the Request Parameters. For example,</p> <p><a href="http://docs.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html#getParameterNames%28%29" rel="nofollow"><code>ServletR... |
36,265,049 | 1 | Can't escape a while loop, Python 2.7 <p>For some reason i can't escape while loop , i tried debugging it, and looks like for loop is untouched and i don't understand why. (it's fraction of mine tictactoe game code)</p> <pre><code>users_main = [] computers_main = [] while True: computers_storage = [] users_storage = []... |
26,625,601 | 0 | <p>@user2009755, you need to create a master and slave file only in the master. And in configuration files in $HADOOP_HOME/etc/hadoop, make necessary changes to the URI pointing to the master node.<br><br>NOTE: Try to format the namenode and delete the tmp files (usually /tmp/*) but if you changed it in <code>core-sit... |
14,870,369 | 0 | tranpose only the two outer words of three <p>How to transpose "foo" and "bar" in "foo and bar" in emacs with the least number of key strokes?</p> <p>input:</p> <pre><code>foo and bar </code></pre> <p>output:</p> <pre><code>bar and foo </code></pre> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.