pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
35,730,089
0
<p>Since OS X 10.10, <code>NSStatusItem</code> has <code>button</code> property, which is a regular <code>NSView</code>-based control that conforms to <code>NSAccessibility</code> protocol and which allows to change <code>accessibilityTitle</code> property directly.</p> <p>On earlier versions of OS X, you can implemen...
19,140,817
0
Rails - ajax page partial update <p>I have my home.html.haml page rendering 3 partials:</p> <pre><code>%h1 Foo #foo1 = render partial: 'foo/foo', locals: {items: @foo1_items} #foo2 = render partial: 'foo/foo', locals: {items: @foo2_items} #foo3 = render partial: 'foo/foo', locals: {items: @foo3_items} </code></pre> <p>...
17,353,988
0
<p>I would say that the real reason is that try-with-resources isn't so much new JVM feature as it is a compile-time language feature. In this way, it is very much analogous to the "enhanced for statement" which requires a class that has implemented the Iterable interface (you have to name an instance of the implentin...
37,860,516
0
<p>If H:i:s is always two-digit, i.e. <code>14:05:15</code> then it will be ordered correctly.</p> <p>If it can contain one-digit in any part, i.e. <code>14:5:15</code>, then it will not be ordered correctly.</p>
22,893,051
0
<p>Like this</p> <pre><code>$(function() { $(window).on('resize', function() { $('.wrapper').css('margin-top', function() { return ($(document).height() - $(this).height()) / 2; }); }).trigger('resize'); }); </code></pre> <p><a href="http://jsfiddle.net/adeneo/sLVLt/2/" rel="nofollow"><strong>FIDDLE</strong></a></p>
1,867,590
0
<p>I've used Selector for the last couple years and found it perfectly stable. It's been at 0.8.11 for at least two years now. </p> <p>I would draw two conclusions from that: </p> <ol> <li><p>It could be basically unmaintained. If you find a bug in it or need a new feature, I wouldn't count on being able to get Luke A...
6,514,430
0
<p>According to <a href="http://stackoverflow.com/questions/1752701/how-to-convert-nsinteger-to-int">How to convert NSInteger to int</a>, <code>NSInteger</code> will always be at least 32 bits on every system/architecture, so yes, the answers to <a href="http://stackoverflow.com/questions/4738480/pass-two-integers-as-...
34,306,313
0
<p>You are passing $request->all() directly to the create method, in which case your HTML field's name should be same as the column names in your DB</p> <pre><code>&lt;div class="form-group"&gt; {!! Form::label('is_kids_friendly','Kids Friendly:') !!} {!! Form::radio('is_kids_friendly', 'true', null),'&amp;nbsp', 'Yes...
34,686,180
0
<p>The <code>finally</code> part is <em>always</em> executed before leaving the <code>try</code> block. <code>return 0</code> would leave the <code>try</code> block. So the <code>finally</code> part is executed first and returns 1.</p> <p><a href="https://docs.python.org/2/tutorial/errors.html#predefined-clean-up-acti...
2,993,423
0
<p>You may want to trim the string first, to avoid leading and trailing hyphens.</p> <pre><code>function hyphenSpace(s){ s= (s.trim)? s.trim(): s.replace(/^\s+|\s+$/g,''); return s.split(/\s+/).join('-'); } </code></pre>
18,673,292
0
<p>Remove <code>position:absolute;</code> for the logo.</p>
28,276,932
0
<p>Yes. It is a good idea, with the correct set-up. You'll be running code as if it was a virtual machine.</p> <p>The Dockerfile configurations to create a build system is not polished and will not expand shell variables, so pre-installing applications may be a bit tedious. On the other hand after building your own im...
3,377,450
0
<p>I found the solution here <a href="http://www.jamesnetherton.com/blog/2008/05/04/Converting-Unix-timestamp-values-in-ColdFusion/" rel="nofollow noreferrer">http://www.jamesnetherton.com/blog/2008/05/04/Converting-Unix-timestamp-values-in-ColdFusion/</a>. I needed to convert the start and end time in order to use in...
17,788,382
0
<p>You could try something like this in PowerShell to check that the named computer is in the OU or not:</p> <p><strong>Script:</strong></p> <pre><code>import-module activedirectory $OU = @() $CheckOU = "LaptopOU" $computerName = "Laptop12345" $user = get-adcomputer $computerName -Properties * $user.DistinguishedName ...
3,097,814
0
<pre><code>decltype(a-&gt;x) </code></pre> <p>This gives you the type of the member variable <code>A::x</code>, which is <code>double</code>.</p> <pre><code>decltype((a-&gt;x)) </code></pre> <p>This gives you the type of the expression <code>(a-&gt;x)</code>, which is an lvalue expression (hence why it is a const refe...
36,747,045
0
<p>First, you should really do</p> <pre><code>Car.prototype = Object.create(Vehicle.prototype); </code></pre> <p>The reasons are involved, but suffice to say that that's a better way to get a new object for your <code>Car</code> prototype and ensure that it inherits from the <code>Vehicle</code> prototype.</p> <p>Now,...
15,826,385
0
Can we query and fetch data from LIST between different subsites using CAML Query.? <p>Have LIST created under one site, can the same LIST be used to fetch data from other site using CAML Query.?</p> <p>eg:</p> <p>Consider a LIST "xxx" created under SitePages/AAA/Lists/</p> <p>Can i access the LIST "xxx" from other sit...
6,604,110
0
haml display address <pre><code>album/show.html.haml #comment_list= render :partial =&gt; 'shared/comments', :locals =&gt; { :commentable =&gt; @album } shared/_comments.html.haml #comments = commentable.comments.each do |comment| = comment.content display Hello #&lt;Comment:0x7f668f037710&gt; </code></pre> <p>why is a...
36,550,797
1
Could not parse the remainder: '((records_list.1.key.5)' from '((records_list.1.key.5)' <p>Obligatory "I am new to Django" here...</p> <p>In my views I am creating a list, called records_list. Inside that list, I have another list in the position [0] and a dictionary in the position [1], as follows:</p> <pre><code>reco...
9,103,275
0
Restricting results to only rows where one value appears only once <p>I have a query that is more complex than the example here, but which needs to only return the rows where a certain field doesn't appear more than once in the data set.</p> <pre><code>ACTIVITY_SK STUDY_ACTIVITY_SK 100 200 101 201 102 200 100 203 </cod...
28,410,479
0
<p>Here is something similar with good code example.</p> <p>// Set cursor as hourglass Cursor.Current = Cursors.WaitCursor;</p> <p>// Execute your time-intensive hashing code here...</p> <p>// Set cursor as default arrow Cursor.Current = Cursors.Default;</p> <p><a href="http://stackoverflow.com/questions/1568557/how-c...
34,355,813
0
<blockquote> <p>Is there any way to get a response without the target namespace?</p> </blockquote> <p>I hope not. A SOAP web service should have a well-defined, published interface and every response that it sends should conform to that interface. Usually, the interface is described by a WSDL document.</p> <blockquote...
35,916,897
0
OpenBUGS: Initializing the Model <p>I am having a problem in initializing the following model in OpenBUGS</p> <pre><code>model { #likelihood for (t in 1:n) { yisigma2[t] &lt;- 1/exp(theta[t]); y[t] ~ dnorm(0,yisigma2[t]); } #Priors mu ~ dnorm(0,0.1); phistar ~ dbeta(20,1.5); itau2 ~ dgamma(2.5,0.025); beta &lt;- exp(mu...
34,014,074
0
<p>Found how to get it:</p> <pre><code>from openerp.http import request ua = request.httprequest.environ.get('HTTP_USER_AGENT', '') </code></pre> <p>Note. <code>httprequest</code> seems to be deprecated. But for now I din't find another way to get user agent.</p>
24,134,264
0
GIT and GITLAB in Debian Wheezy <p>I'm news in git and gitlab. I've installed it from the officiel installation. Trying to push some project via sourcetree for example, I've this result</p> <pre><code>`git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream origin master:master Pushing to...
29,647,582
0
Enable smilies/emoticons in UCWA Chat application <p>I have built a web application which provides simple text chatting. I have used the UCWA API provided by Microsoft to implement this Instant Messaging chat application.</p> <p>My next step is to enable usage of smilies/emoticons in the chat application. I have gone t...
18,752,733
0
<p>Being from a SQL Server background, I've always created a trigger on the table to basically emulate IDENTITY functionality. Once the trigger is on, the SK is automatically generated from the sequence just like identity and you don't have to worry about it.</p>
17,810,487
0
An array disappears in "for" expression, <p>There's some code, and it's not working. </p> <pre><code>window.onload = function () { var div = document.getElementById ('main'); var img = div.children; var i = 1; //console.log(img[i]); for (var i=1; i != img.length; i++) { img[i].onclick = function () { console.log(img[i]...
3,471,880
0
JSF: How to refresh a page after download <p>I have a commandButton that will invoke a function to download a file (standard stuffs like <code>InputStream</code>, <code>BufferedOutputStream</code> ...) After download success, at the end of the function, I change some values of the current object and persist it into dat...
32,701,467
0
Undefined type error even with forward declaration <p>I was reading up on circular references and forward declarations. I do understand that it is not a good design practice to have implementations in a header file. However I was experimenting and could not understand this behavior.</p> <p>With the following code (cont...
6,024,101
0
<p>No, it's only a matter of readability. As your model grows you will probably get a very large configuration in OnModelCreating. As to make this more readable you break it up into separate configurations.</p>
3,482,879
0
Where are the functional gui users? <p>There has been a lot of research into ways of creating guis in a functional language. There is libraries for push/pull frp, arrow based frp and probably other superior research too. <a href="http://stackoverflow.com/questions/2672791/is-functional-gui-programming-possible">Many pe...
22,385,632
0
Javascript not changing background img in a span <p>I've recently tried to use some js code that i've used for ages to change a span's background colour on certain days, i'm now trying to use the js to change the background image instead but i'm having issues. The js is finding the element but rather than change to the...
40,413,461
0
<p>Create function to validate entered Number that return bool</p> <pre><code>bool isValidNumber = true; do{ Console.WriteLine("Enter the phone number to be added:"); string NewNumber = Console.ReadLine(); isValidNumber = isValidNumberCheck(NewNumber); }while(!isValidNumber); </code></pre>
29,391,302
0
Using custom user instead of ASP.NET IdentityUser <p>I'm new on ASP.NET Identity and trying to customize the identity which is provided while creating new MVC project.</p> <p>ASP.NET Identity automatically creates few tables for handle authentication and authorization itself.</p> <p>My main goal is just create Users ta...
14,380,143
0
Matching binary patterns in C <p>I'm currently developing a C program that needs to parse some bespoke data structures, fortunately I know how they are structured, however I'm not sure of how to implement my parser in C.</p> <p>Each of the structures are 32-bits in length, and each structure can be identified by it's b...
33,739,855
0
Modify method to show success/failed Message. AngularJS <p>I´m pretty new to angularJS and I cant seem to find a good way to show a SUCCESS or ERROR message for the return of my Save method.</p> <p>Heres the html code:</p> <pre><code>&lt;form role="form"&gt; &lt;div class="panel-body"&gt; &lt;div class="panel-body"&gt;...
28,369,745
0
<p>How do you parse JSON data? If you are using <a href="https://code.google.com/p/google-gson/" rel="nofollow">Gson</a>, you can use <a href="https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/GsonBuilder.html#disableHtmlEscaping%28%29" rel="nofollow">GsonBuilder.disableHtmlEscaping()</a>...
28,225,138
0
Not fully understanding how this closure works <p>I have an excerpt from <a href="http://stackoverflow.com/questions/111102/how-do-javascript-closures-work">How do JavaScript closures work?</a></p> <p>I am having a difficult time understanding closures. </p> <pre><code> &lt;button type="button" id="bid"&gt;Click Me!&lt...
31,725,967
0
<p>I'm pretty sure Excel doesn't like it when there's empty CellFormats(). I suggest you try to remove these two</p> <pre><code>new CellFormat() { }, new CellFormat() { }, </code></pre>
5,452,751
0
<p>You can't do this, it's up to the user.</p>
17,360,963
0
<pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; //#include &lt;stdbool.h&gt; int main() { int m,n,t,i; char a[]="National University"; char b[]="India"; char c[100]; char d[100]; m=strlen(a); n= strlen(b); if(m&gt;n) { t=m; // strcpy(&amp;c,&amp;a); for(i=0;i&lt;n;i++) d[i]=b[i]; for(i=0;i&lt;m-n;i++) d[...
27,024,243
0
<p>In my case, I was declaring a <code>const</code> in a header file, which worked fine when building and running on the device (iPhone 5), however when attempting to simulate a 4S, all of a sudden I had some 300 "duplicate symbols".</p> <p>It turns out I needed to also mark the <code>const</code> as <code>static</cod...
461,012
0
Performance Penalty (if any) in Using the 'var' Declaration in C# 3.0+ <p>Is there any performance penalty in using the var declaration in c# 3.0+? Resharper is constantly nagging me to use it liberally, and I want to know if there is any downside to it.</p>
30,110,401
0
<p>An iOS application doesn't receive any callbacks when it is about to be uninstalled, so it's not possible to do what you want.</p> <p>See this question <a href="http://stackoverflow.com/questions/6911361/detect-ios-application-about-to-delete">Detect iOS application about to delete?</a></p>
21,541,887
0
<p>There must have been an intermittent issue. This seems to be working now.</p>
20,434,378
0
<p>I disagree with the previous post. This is not a threading issue, this is an algorithm issue. The reason matlab, R, and octave wipe the floor with C++ libraries is because their C++ libraries use more complex, better algorithms. If you read the octave page you can find out what <em>they</em> do[1]: </p> <blockquote...
19,775,676
0
<p>The problem is because of this:</p> <pre><code>service.WaitForStatus(ServiceControllerStatus.Stopped, timeout); </code></pre> <p>This is happening because your service has not stopped within your <code>timeout</code>. You should either set your timeout higher, or don't set a timeout at all.</p>
21,800,348
0
<p>You are invoking the <code>finished</code> function, instead of passing it as an argument. To pass it, use </p> <pre><code>$.when.apply($, deferred).then(finished); </code></pre> <p>Instead of </p> <pre><code>$.when.apply($, deferred).then(finished()); </code></pre>
23,413,986
0
<p>Please, try to use the frame document onready event.</p> <pre><code> printData: function(printId) { $(window.frames[printId].document).ready(function() { window.frames[printId].focus(); window.frames[printId].print(); }); } </code></pre>
8,901,873
0
<p>This should do the trick</p> <pre><code>&lt;ObjectAnimationUsingKeyFrames x:Name="animation" Duration="0" Storyboard.TargetProperty="xmlnsAlias:VisualStateUtility.InitialState" Storyboard.TargetName="ExpanderButton"&gt; </code></pre> <p>Notice how a name is added to the animation, the parentheses are removed from t...
34,374,236
0
<p>You cannot call a trait method without specifying on which implementation you wish to call it. It doesn't matter that the method has a default implementation.</p> <p>An actual UFCS call looks like this:</p> <pre><code>trait FooPrinter { fn print() { println!("hello"); } } impl FooPrinter for () {} fn main () { &lt;...
1,766,973
0
<p>Warning: I may be totally misunderstanding you, but if all you want is a log file, why sweat?</p> <p>Put this in a bat file (change the path to your tools directory, and yourappname is of course your app's name):</p> <pre><code>cd "C:\devAndroid\Software\android-sdk-windows-1.6_r1\android-sdk-windows-1.6_r1\tools" ...
10,260,710
0
To rewrite a javascript to jQuery <p>I'm not a sharp jquery / javascript coder yet - so I hope that there is a kind soul out there, who can help me with rewriting a javascript into a jQuery script.</p> <p>The code looks like this:</p> <pre><code>&lt;script type="text/javascript"&gt; function update_delivery_address() {...
18,844,268
0
how to input symbols through JQuery <p>i'm using JQuery and aJax with PHP to insert some data to database </p> <p>but I have a small problem, when i insert data contain (&amp;) symbol .. database read the text before (&amp;) ..</p> <p>for example .. if the title is ( Sun &amp; Moon ) . it saves it as : (Sun) only .. ho...
39,427,221
0
Cs-Cart custom Payment button without iframe <p>I created a payment module for Cs-Cart 4, everything works well. However, loading my inline payment gateway(see paystack.com for demo) which loads a popup in an iframe is not aesthetically pleasing. </p> <p>Is there a way I can still use my custom payment button that load...
14,357,137
0
<p>I afraid I don't have an immediate solution. A quick search in Chrome forum showing that this issue appeared recently. You might need to wait for an upgrade of google browser.</p> <p><a href="http://code.google.com/p/chromium/issues/detail?id=116986" rel="nofollow">http://code.google.com/p/chromium/issues/detail?id...
10,630,061
0
<p>Without having to increase the asset size of your app, you could create a simple UIView.</p> <pre><code>UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow]; UIView *fullscreenShadow = [[UIView alloc] initWithFrame:keyWindow.bounds]; fullscreenShadow.backgroundColor = [UIColor blackColor]; fullscreen...
36,470,740
0
<p>Unfortunately, what you are trying to achieve is inherently unsafe as far as the compiler is concerned because you are creating <em>aliases</em> to <em>mutable</em> nodes. Two possible issues that the compiler will complain about:</p> <ul> <li>there is no proof that the node will not move, so the reference you take...
32,073,948
0
Jersey - Inject variable from filter as RequestScoped <p>I want to perform authentication in a filter before my resource method is called. Within this filter I would also like to retrieve the permissions of a user and pass it on through a RequestScoped @Inject annotation. </p> <pre><code>@Authenticated public class Aut...
18,053,943
0
Bxslider Ticker image spacing as a Wordpress plugin <p>I installed the BxSlider as a plugin for Wordpress and inserted the php script code to show above the footer on all pages.</p> <p>The images scroll perfectly across the page except I'm trying to reduce the spacing between the images to show more than one image per ...
2,301,346
0
<p>ASP.NET web sites emit HTML, CSS and javascript (just like other technologies), and as such should be readable by ALL browsers. The technology used to host the site should have little impact on its consumption by browser clients. </p> <p>The ony real concern is when non-conforming HTML or CSS is present and the web...
28,280,193
0
<p>You code compiles because it is valid code. It fails at runtime because you are asking it to do something illegal. According to <a href="https://msdn.microsoft.com/en-us/library/aa394146(v=vs.85).aspx" rel="nofollow">MSDN</a>:</p> <blockquote> <p><strong>SetSpeed</strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&...
32,201,889
0
<p>Your input is incorrect, it should be in the MathML namespace:</p> <pre><code>&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt; &lt;apply&gt;&lt;power&gt;&lt;/power&gt;&lt;ci&gt;x&lt;/ci&gt;&lt;cn&gt;2&lt;/cn&gt;&lt;/apply&gt; &lt;/math&gt; </code></pre> <p>Not directly related to your problem but there is a ...
40,999,904
0
<p>Try the below:</p> <pre><code>label.Text = dropdownlist.SelectedItem.Text; </code></pre> <p><code>SelectedItem</code> will set the label text to selected item text, example "Test".</p> <p>or this:</p> <pre><code>label.Text = dropdownlist.SelectedValue; </code></pre> <p><code>SelectedValue</code> will set the label ...
24,466,273
0
<p>Use this definition file : <a href="https://github.com/borisyankov/DefinitelyTyped/blob/master/slickgrid/SlickGrid.d.ts" rel="nofollow">https://github.com/borisyankov/DefinitelyTyped/blob/master/slickgrid/SlickGrid.d.ts</a></p> <p>And add the following in some <code>.d.ts</code> file to tell typescript about your r...
6,634,542
0
<p>The <code>:key =&gt; value</code> syntax only works for <code>=</code>, <code>IN</code>, and <code>BETWEEN</code> conditions (depending on whether <code>value</code> is atomic, an Array, or a Range). Anything else requires you to pass the SQL as a string:</p> <pre><code>Model.where("key LIKE ?", value) </code></pre...
36,388,783
0
<p>You can do like this.</p> <pre><code>public function index(Request $request) { // Handles requests such as ".../api/products?user_id=5&amp;price=500" $products = Product::where('user_id', $request-&gt;user_id)-&gt;where('price', '&lt;=', intval($request-&gt;price))-&gt;get(); return response()-&gt;json($products); ...
7,643,666
0
Having difficulty getting value to post from dynamic dropdown <p>G'day, I'm having a problem getting the right value to post on a form I've made. It is passing the ID but not the name. Here's my code:</p> <pre><code>&lt;td name="tech_userlogin" id="tech_userlogin" align="right" valign="top"&gt;&lt;select name="tech_use...
37,181,725
0
How to place 2 divs next to each others with fixed position and 100% Height <p>I'm trying to create 2 <code>div</code>s, one of them is the left sidebar and the other one is the body of the page where content shows up. What I'm trying to do is:</p> <ul> <li>make the sidebar div height 100% </li> <li>the body height 100...
13,845,678
0
<p>I'm not sure if this'll make a difference but it's worth a try...I never wrap service arguments with quotes:</p> <pre><code>arguments: [@doctrine.orm.entity_manager] </code></pre>
14,147,534
0
Can I run an app without GUI on Windows Phone 7, 7.5 and 8? <p>On WP 7 and WP 7.5 I have to develop the app on C#, nonetheless, on WP8 I can develop an app on native C++</p> <p>Assuming the corresponding programming language, I was wondering if it is possible to run a process or an app without GUI on Windows Phone 7, 7...
5,444,851
0
<p>I'm not sure if this would work/help, but you could specify something in your application web.xml.</p> <pre><code> &lt;security-constraint&gt; &lt;display-name&gt;Public access&lt;/display-name&gt; &lt;web-resource-collection&gt; &lt;web-resource-name&gt;PublicPages&lt;/web-resource-name&gt; &lt;description&gt;Publ...
38,550,112
0
<p>Currently you are applying both approach adding fragment and setting adapter remove one of them and for better use.</p> <p>Please follow <a href="https://github.com/codepath/android_guides/wiki/ViewPager-with-FragmentPagerAdapter" rel="nofollow">this</a> example to add fragment with view pager.</p>
28,918,508
0
<p>Actually, a method with signature <code>public static Image LoadImage(string path</code> isn't even an extension. It is just a static method, therefore to write this as you would like it simply change the class name:</p> <pre><code>public static class Image { public static Image LoadImage(string path) { using (Memo...
15,515,520
0
Convert Word document of MS WORD 2003 To Tiff images <p>I have a word document created using MS Office 2003.Now i developed a web application using ASP.net in which i used a file upload control to upload word document files.My requirement is to convert the uploaded word document to tiff/jpg and displayed in iframe.plea...
40,935,001
0
<p>I think the correct status code in this case is <code>400 Bad Request</code>. The entity you expect must always have a certain line-count, so if it doesn't have that line-count the entity is invalid.</p> <p>Generally validation problems are communicated as 400 errors.</p>
5,530,499
0
<p>Singular is a computer algebra system. Haskell is a programming language which computer algebra can be implemented within. You need to start simply and just learn basic Haskell syntax and concepts before trying to see the categorical/algebriac picture, especially since different elements can be implemented in diffe...
38,768,970
0
<p>After using the GPU, you should <a href="http://www.mathworks.com/help/distcomp/reset.html" rel="nofollow">reset the gpu</a> with <code>reset</code> which will </p> <pre><code>dev = gpuDevice(gpu_id); % Do lots of stuff reset(dev) </code></pre> <p>Or you could release the device using empty (<code>[]</code>) inputs...
3,893,863
0
JQuery how do I add new divs using .load? <p>This replaces the content in #message_here, each time. How do I get it to keep adding the content, by creating new divs for each message?</p> <pre><code> var last_mess_id = 1; $('#load_mess').click(function(){ $('#messages_here').load('ajax/get_message.php?last_mess_id='+las...
10,916,308
0
<p>here is another one :)</p> <pre><code>function flow(elem){ el = $(elem); el.fadeIn('slow').delay(3000).fadeOut('slow', function(){ nextElem = el.is(':last-child') ? el.siblings(':eq(0)') : el.next(); flow(nextElem); }); } $(document).ready(function(){ flow('span:eq(0)') }) </code></pre> <p><a href="http://jsfiddle....
18,196,196
0
<p>Not sure if I understand correctly, but it sounds like you're looking for <a href="http://knockoutjs.com/documentation/computedObservables.html" rel="nofollow">Computed Observables</a>:</p> <pre><code>self.AvailableItemTypes = ko.computed(function() { var selectedTypeIds = this.SelectedItemTypes().map(function(el) ...
16,511,578
0
<p>It's the order of operation. In <code>p = p * 4/3</code> the compiler is doing:</p> <pre><code>p = (p * 4)/3 </code></pre> <p>However in <code>p *= 4/3</code>, the compiler is doing:</p> <pre><code>p = p * (4/3) </code></pre> <p>4/3 is 1 on the computer because of integer division, so the second example is basicall...
9,702,801
0
<p>The easiest way to do this is the Linq using</p> <pre><code>var list = new[] { "a", "a", "b", "c", "d", "b" }; var grouped = list .GroupBy(s =&gt; s) .Select(g =&gt; new { Symbol = g.Key, Count = g.Count() }); foreach (var item in grouped) { var symbol = item.Symbol; var count = item.Count; } </code></pre>
7,127,980
0
<p>To skip lines that do not match those strings add a check:</p> <pre><code>if any(bool(x) for x in d, HD, HA, M): print ... output.write </code></pre> <p>Try running the script in a debugger:</p> <pre><code>$ python -m pdb your_script.py </code></pre> <p>and see what variables are there and what's wrong. Since PDB i...
14,708,698
0
<p>Keep it simple, son.</p> <pre><code>declare @date1 datetime declare @date2 datetime select @date1 = GETDATE(); select @date2 = '2013-02-02 14:05' select DATEDIFF(hh, @date2, @date1) Results ----------- 71 (1 row(s) affected) </code></pre>
14,127,792
0
<p>This must work for you</p> <pre><code>var resizeEntryHeight=function(){ $('.collectionPostContainer').each(function(){ $(this).css('height',$(this).width()+'px'); }); } $(document).ready(function(){ resizeEntryHeight(); $(window).resize(resizeEntryHeight()); }); </code></pre>
11,862,172
0
<p>Use UIDevice Macros - <a href="http://d3signerd.com/tag/uidevice/" rel="nofollow">http://d3signerd.com/tag/uidevice/</a></p> <p>Then you can write code like;</p> <pre><code>if ([DEVICE_TYPE isEqualToString:DEVICE_IPAD]) { } </code></pre> <p>or </p> <pre><code>if (IS_SIMULATOR &amp;&amp; IS_RETINA) { } </code></pre>
13,211,512
0
Android saving images <p>this application i'm working on is suppose to allow a user to take a photo, depending on whether the GPS is enabled or not, the image should be saved into 2 different folders. However, i can't seem to change the directory.</p> <pre><code> camIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);...
13,889,052
0
<p>Use <a href="http://php.net/manual/en/reserved.variables.server.php" rel="nofollow">$_SERVER['DOCUMENT_ROOT']</a> to find the root folder.</p> <pre><code>$dir = $_SERVER['DOCUMENT_ROOT']; // will return /home/vadar/Dropbox/ENELWebsite/public_html/ if(file_exists($dir)){ //just to make sure define('APP_DIR', $dir); ...
4,594,046
0
<p>Where i work we will never use a stringbuild becouse of the designer. We dont want the designer in the codebehind if he has to make a simple change. so keep the markup in the view and codebehind in the codebehind. </p> <p><strong>Edit</strong></p> <p>Other advantage of repeater is the change of cycle is much easier...
14,190,727
0
<p>When sharding you spread the data across different shards. The mongos process routes queries to shards it needs to get data from. As such you only need to look at the data a shard is holding. To quote from <a href="http://docs.mongodb.org/manual/core/sharding/#when-to-use-sharding" rel="nofollow">When to Use Shardi...
32,012,857
0
<p>If <code>"formname"</code> is the value of the name attribute of the form and <code>"name"</code> is the value of the name attribute of the input field (as per your example):</p> <pre><code>if( document.forms["formname"].elements["name"].value == "" ){ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ document.g...
29,984,885
0
<p>Its better to make use of DRUPAL for your development. </p>
25,685,544
0
<p>Try replacing the categories route, as create me be taken as a category</p> <pre><code>Route::get('projects/{cat}', ['as' =&gt; 'projects.category', 'uses' =&gt; 'ProjectsController@category']); Route::get('projects/{cat}', ['as' =&gt; 'projects.category', 'uses' =&gt; 'ProjectsController@category', 'except' =&gt; ...
22,383,108
0
Appengine: call endpoints of another module on the same server <p>I am working on an App Engine server which has currently 2 modules. I have the default module used for endpoints and the sync module. This second module is used for syncing my server with another. So my sync module gets data from other servers and has to...
11,868,768
0
<p>Use a running total.</p> <p>Have a single variable int "calories"</p> <p>Whenever you add a food item add them to calories and display</p> <p>whenever you remove a food item remove them from calories and display</p>
5,404,906
0
<p>illegalstate exception means am thinking that <strong>thread</strong> you are using is not correctly handling.. can you post your code..so can find where the exact exception happens</p>
5,633,371
0
Using a gitosis git repository with XCode 4 <p>Hi I've been trying to access my git repository from XCode 4.</p> <p>Everything works just fine using the command line tools. I can clone my repo using:</p> <pre><code>git clone git@example.com:somerepo.git </code></pre> <p>But in XCode, when trying to use:</p> <pre><code>...
13,892,367
0
<p>You can change the log in the y axis with the following:</p> <pre><code>plt.gca().set_yscale('linear') </code></pre> <p>Or press the L key when the figure is in focus.</p> <p>However, your <code>hist()</code> with <code>log=True</code> does not plot a logarithmic x axis. From the <a href="http://matplotlib.org/api/...