pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
21,452,002
0
<p>A comment does nothing (but your database driver might complain if there is not command at all):</p> <pre><code>/* Hello, world! */ </code></pre> <p>Unknown <a href="http://www.sqlite.org/pragma.html" rel="nofollow">PRAGMA</a> statements are ignored, and do not return anything:</p> <pre><code>PRAGMA testing_porpois...
25,689,156
0
<p>It should work fine if you remove the <code>;</code> at the end. (Tested)</p>
33,318,146
0
<p>Make change in your gruntfile.js</p> <p>htmlmin. files.src: ['<em>.html', '{,</em>/}*.html']and </p> <p>copy.dist.files.src:[ '<em>.{ico,png,txt}', '.htaccess', '</em>.html', '{,<em>/}</em>.html', 'images/{,<em>/}</em>.{webp}', 'styles/fonts/{,<em>/}</em>.*' ]</p> <p>In this way it is working for me.</p>
38,153,362
0
<p>In C a value of 0 means false and any other means true. Strings end in a null character with a value of 0. This while loop copies all the characters from s to d until the null (end of string) is reached.</p> <p>The assignment <code>*d++ = *s++</code> returns the same value as <code>*s++</code> is assigned to <code>...
8,610,479
0
<p>This loading message is generated by ShadowBox lightbox plugin because you have an error in your kjquery.js file at line 5, missing a <code>)</code> as Keith comented.</p> <p>As soon as you fix this error, all should work.</p>
18,583,439
0
<p>You need to simply tell it that the three corner symbols are different.</p> <pre><code> Scanner keys = new Scanner(System.in); int x = 0; int y = 0; public void getInput() { x = keys.nextInt(); y = keys.nextInt(); createart(); } public void createart() { System.out.print("00"); int counter = 0; while (counter &lt; ...
25,333,120
0
<p>There's 2 ways you could solve this that don't require your application code to be aware of your container.</p> <p>The first method, instead replacing the registered instance of <code>UserModel</code> with a new instance, you'd just update the registered instances properties to the new values. This is probably the ...
37,059,064
0
<p>In your env file, the value should not have any single or double quotes.</p>
33,842,179
0
<p>You have to use <code>then</code> method from fetchGraph or else return data from success method of <code>$http</code>.</p> <p>My recommendation, you can keep watch on the <code>self.items</code>. so whenever it change you can re-draw your graph.</p> <pre><code>$scope.$watch( "self.items", function () { //re-draw y...
28,346,534
0
Select count breaks in do-while loop <p>Where I work we need to register computers into a database, before we just used pen an paper, but I was asked to create an easier method. So I made a small local homepage.</p> <p>The computers are registered by a tag and number. The tag combined with the number must be unique, I ...
14,955,256
0
C# prevent excel file from getting modified <p>Hi I'm searching a way to <strong>prevent</strong> an <strong>excel file</strong> from being <strong>modified</strong>. I <strong>don't want to use hidden fields</strong>, where you have to place a calculated hashcode in.</p> <p>My program should be able to note that a fil...
24,145,737
0
<p>Something like this?</p> <p><img src="https://i.stack.imgur.com/WZMY9.png" alt="enter image description here"></p> <pre><code>&lt;Grid HorizontalAlignment="Center" VerticalAlignment="Center"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="25"/&gt; &lt;RowDefinition Height="Auto"/&gt; &lt;/Grid.RowDefiniti...
17,343,781
0
<p>Don't reinvent the wheel, building a custom testing software mini empire from scratch. Use SOAPUI open source version to test web services. It allows you to:</p> <ul> <li>generate SOAP tests from web service endpoint WSDL, saving manual labour</li> <li>avoid processing "pre-canned" SOAP strings and parsing files </...
34,092,263
0
Saving a field generated in ng-repeat in AngularJS <p>So, what I need here is to save a data in an array for every field generated in ng-repeat. My code looks something like this:</p> <pre><code>&lt;tr ng-repeat = "feature in filteredFeatures"&gt; &lt;td&gt;{{feature.name}}&lt;/td&gt; &lt;td&gt;&lt;input type="number" ...
18,374,019
0
<p>Hunspell is likely the most famous spell checker around:<br> <a href="http://hunspell.sourceforge.net/" rel="nofollow">http://hunspell.sourceforge.net/</a></p> <p>There are multiple versions of hunspell, but Aspell is an alternative:<br> <a href="http://aspell.net/" rel="nofollow">http://aspell.net/</a></p>
34,331,395
0
<p>Thanks for your question. It is possible to process multiple refunds (or rebates as we refer to them) against a single transaction. This isn't setup by default on your account, however. You can email your account manager and request that multiple rebates be enabled.</p> <p>Best,</p> <p>SeΓ‘n</p> <p><strong>Channel S...
7,438,268
0
elasticsearch boosting slowing query <p>this is a very novice question but I'm trying to understand how boosting certain elements in a document works. </p> <p>I started with this query, </p> <pre><code>{ "from": 0, "size": 6, "fields": [ "_id" ], "sort": { "_score": "desc", "vendor.name.stored": "asc", "item_name.store...
29,489,857
0
<p>As far as I know you can't build your custom transitions and use them like normal WinRT Transitions, that is, inside a TransitionCollection.</p> <pre><code>&lt;ListView.Transitions&gt; &lt;TransitionCollection&gt; &lt;myTransitions:PotatoeTransition/&gt; &lt;/TransitionCollection&gt; &lt;/ListView.Transitions&gt; <...
12,981,417
0
Why does svn authz need read access by default? <p>I need to give read/write access for a user to an exactly one repository.</p> <p>Why this doesn't work?</p> <pre><code>[groups] dev = dvolosnykh,sam [/ukk] ukk = rw [/] @dev = rw </code></pre> <p>Why should I add this?</p> <pre><code>[/] @dev = rw * = r # read access f...
31,563,017
0
anglularJs custom directive not loading <p>I am trying to create a custom directive in the below manor:</p> <p>my main html file:</p> <pre><code>&lt;body ng-app="boom"&gt; &lt;!--&lt;section ng-include="'data-table.html'"&gt;&lt;/section&gt;--&gt; &lt;data-table&gt;&lt;/data-table&gt; &lt;/body&gt; </code></pre> <p>my ...
40,995,374
0
<p>There is no such thing as "Abi64". Since you tagged the question MASM, we can guess that you're using the Windows platform, and clearly the "64" means that this is 64-bit code, so that does narrow down the possibilities tremendously. However, there are still two common calling conventions for 64-bit code on Windows...
19,110,774
0
Widevine Test content for player validation <p>I know that the Widevine DRM scheme is supported in the 4+ version of the Android devices. I have created a media player application, how do I validate my player for playback of Widevine evcrypted content.</p>
30,340,116
0
<p>The problem appears to go away when you go download and install the new command line tools for 6.3.2.</p>
9,825,691
0
<p>yuo can add a screen for enter a coupons.<br> and the user can go in there and insrert his code and if it is correct you can give him whatever you want.</p>
22,956,303
0
<p>The storyboard animation retains a reference to the item until the animation is complete.</p> <p>You should do the following:</p> <ol> <li>Move storyboards into resources, enabling you to access them from code behind.</li> <li>Create a field to reference the MyItem to be deleted.</li> <li>Set that field when "Delet...
35,574,206
0
<p>In fact, your issue is related to the content negotiation feature of HTTP (Conneg). This leverages two headers:</p> <ul> <li><code>Content-Type</code>: the format of the text payload of a request or a response. In your case, this header tells to the client the structure of the data you return.</li> <li><code>Accept...
10,847,039
0
<p>Here is the step by step procedure to get you started:</p> <p><strong>Step 1:</strong> Download Solr. It's just a zip file.</p> <p><strong>Step 2:</strong> Copy from your <code>SOLR_HOME_DIR/dist/apache-solr-1.3.0.war</code> to your tomcat webapps directory: <code>$CATALINA_HOME/webapps/solr.war</code> – Note the w...
28,513,071
0
<p>Try changing this line:</p> <pre><code>RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?(.*)$ </code></pre> <p>to</p> <pre><code>RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?([^/]+(?:/[^/]+|)) </code></pre> <p>So the regex will only attempt to capture as many as 2 virtual paths.</p>
11,647,017
0
<p>try this</p> <pre><code> header('Location: '.$nick.''); </code></pre>
19,267,010
0
<p>If you want a really real-time(around 200ms) response for your search application, for both the first time search query response and further suggested search response, Hadoop is not a good choice, not even Hive, HBase, or even Impala (or Apache Drill, Google Dremel like system). </p> <p>Hadoop is a batch processing...
40,665,526
0
<p>Not easily, the default size of a JLabel, JTextArea etc. is delegated to the "look and feel", this determines the size using the font metrics of the font, the size and the text. </p> <p>Thefore bigger font, bigger buttons.</p> <p>I'd advise you to just accept this, and use a layout manager that deals with the nicel...
151,059
0
<p>you're telling the system that whatever work would have been done in the finalizer has already been done, so the finalizer doesn't need to be called. From the .NET docs:</p> <blockquote> <p>Objects that implement the IDisposable interface can call this method from the IDisposable.Dispose method to prevent the garba...
15,594,360
0
<p>On a quick glance, I see a couple of instances of:</p> <pre><code>IF NEW.id_club = NULL ... </code></pre> <p>There may be more problems, I stopped looking there.<br> Nothing is <strong><em>ever</em></strong> the same as <code>NULL</code>. Use instead:</p> <pre><code>IF NEW.id_club <b>IS</b> NULL ...</code></pre> <p...
38,121,725
0
bootstrap accordion content very long <p>I have bootatrsp accordion in my site. in one accordion panel I have a lot of content. when I scroll down to read the rest of the content and then click the next panel, then the one above(wich is open) closes and move up. the rest of the panels move up with it and now I can't se...
29,892,790
0
<p>This is happening because in HTML you have multiple textareas with same <code>id</code> attribute that is <code>txtcomment</code>. You should try giving each textarea, comments anchor tag a unique id.</p> <p>use <code>id="txtComment.'.$row["id"].'"</code> and <code>id="leavecomment.'.$row["id"].'"</code></p> <block...
13,275,812
0
How to get, set and select elements with data attributes? <p>I'm having some trouble with data-attributes, I can't get anything to work for some reason so I must be doing something wrong:</p> <p>Set:</p> <pre><code>$('#element').data('data1', '1'); //Actually in my case the data is been added manually </code></pre> <p>...
7,015,264
0
I have an encrypted value, why wont it go into the varbinary field? <p>I just need to fix a couple of bad records. I am able to swap the month with the year and re-encrypt. But when I try and put it into the MS SQL SERVER varbinary field again it is getting truncated. What is the correct way to update the table with th...
8,740,204
0
<p>Try <a href="http://jasarien.com/?p=428" rel="nofollow">SBJSON</a> to parse the JSON in objective-C.</p> <p>You can get the SBJSON from <a href="https://github.com/stig/json-framework" rel="nofollow">here</a></p>
37,165,143
0
<p>Try processing the json data form the url using JsonSlulrper as follows:</p> <pre><code>def resp = new JsonSlurper().parseText(url.text) </code></pre> <p>Also in your HTML views/layouts, make sure you apply encoding:</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; ..........
23,367,655
0
Parse all HTML code <p>I need to copy all HTML code on the page.</p> <p>I do so:</p> <pre><code>URL url = new URL(testurl); URLConnection connection = url.openConnection(); connection.connect(); Scanner in = new Scanner(connection.getInputStream()); while(in.hasNextLine()) { htmlText=htmlText+in.nextLine(); } in.close(...
32,389,637
0
<p>Interface methods cannot have implementation before Java 8. Starting in Java 8 this is possible, but only with <a href="https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html" rel="nofollow">default methods</a> and static methods.</p> <blockquote> <p>In addition to default methods, you can define st...
2,457,248
0
<p>After rereading my original post I see it looks confusing as hell... what I ended up doing was; creating a second method getUserRecords that got a 'flag', I call getUserRecords from my first, getUser method and return a new object type with the flag included in the new object.</p>
27,028,708
0
<p>You can do this using scripting variable and using the <code>-v</code> option of <code>SQLCMD</code> utility. A small example from <a href="http://msdn.microsoft.com/en-us/library/ms188714.aspx" rel="nofollow"> MSDN Documentation</a></p> <p>Consider that the script file name is <code>testscript.sql</code>, <code>Co...
27,918,243
0
<p><code>List</code> implements <code>Iterable</code> and therefore is an <code>Iterable</code> (see <a href="https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:core.List" rel="nofollow">https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:core.List</a> just below the title)</p>
26,546,604
0
Winform viewing <p>Since I add an extra screen to my developpment laptop and set an extended desktop, the view of the forms change by the way it show in the picture below two form with same code in windows 8 <img src="https://i.stack.imgur.com/ipfl2.png" alt="Two winforms with same in windows 8"></p>
1,336,851
0
<p>From python <a href="http://docs.python.org/library/string.html" rel="nofollow noreferrer">docs</a>:</p> <blockquote> <p>Advanced usage: you can derive subclasses of Template to customize the placeholder syntax, delimiter character, or the entire regular expression used to parse template strings. To do this, you ca...
24,577,065
0
<p>Here You have two options. Either do this by subselects or once per save/update walk through all the information descriptions and update the missing languages with the texts from the default ones.</p> <p>The first solution could be:</p> <pre><code>SELECT id.information_id, id.language_id, id.description, CASE WHEN ...
32,920,293
0
The code is giving Multiple Marker at this line <p>This line giving errors I am not able to find any clue kindly help me..?? I have added all the related jar files then also its giving error please check code and help</p> <pre><code>Properties properties = System.getProperties(); properties.setProperty("mail.smtp.host"...
4,562,075
0
<p>unsigned = a none positive / negative number, so you couldnt have -1 as the "-" is a sign.</p> <p>zerofill = fill it with zeros by default. Not necessary as the column's already got the auto_increment / pk attributes</p> <p>key = index this column i.e. make SELECTS that search on this column faster.</p> <p>Ta </p>
24,728,787
0
<p>I posted a fix for this <a href="http://stackoverflow.com/a/24728537/2016196">here</a></p> <p>You can use this function to modify <code>JSON.stringify</code> to encode <code>arrays</code>, just post it near the beginning of your script (check the link above for more detail):</p> <pre><code>// Upgrade for JSON.strin...
34,248,084
0
<p>I think this tutorial will help you a lot to access Windows IoT device via PowerShell:<br/> <a href="https://www.hackster.io/AnuragVasanwala/windows-10-iot-core-setting-startup-app-887ed0" rel="nofollow">https://www.hackster.io/AnuragVasanwala/windows-10-iot-core-setting-startup-app-887ed0</a></p> <p>This article r...
24,192,384
0
<p>Instead of having multiple divs within the gray div, and checking whether a certain one is clicked or not, and then removing the clicked class, you could just use jQuery's <code>.html()</code> or <code>.text()</code> to set up the corresponding text within your gray div. Read about them more here: </p> <p><a href="...
25,186,839
0
<p>Well you cannot actually get session time with an AJAX request as the request it self will also reset the session timeout time. What you can do is get it when you are rendering the page in a js function and start a counter with <code>setTimeout</code> when and show your message pop when less then 30 seconds left.</...
38,405,091
0
Straighten and concatenate the individual grids from ndgrid <p>I'm trying to do the following in a general way:</p> <pre><code>x = {0:1, 2:3, 4:6}; [a,b,c] = ndgrid(x{:}); Res = [a(:), b(:), c(:)] Res = 0 2 4 1 2 4 0 3 4 1 3 4 0 2 5 1 2 5 0 3 5 1 3 5 0 2 6 1 2 6 0 3 6 1 3 6 </code></pre> <p>I believe I have to start th...
29,208,748
0
Some questions with the source of the libuv? <p>Recently,I read the source of libuv. There are some questions when read the QUEUE.h</p> <p><strong>Firstly:</strong> The macro define below:</p> <pre><code>typedef void *QUEUE[2]; #define QUEUE_NEXT(q) (*(QUEUE **) &amp;((*(q))[0])) #define QUEUE_PREV(q) (*(QUEUE **) &amp...
16,964,975
0
How to choose the right kernel functions <p>I have a very general question: how do I choose the right kernel function for SVM? I know the ultimate answer is try all the kernels, do out-of-sample validation, and pick the one with best classification result. But other than that, is there any guideline of trying the diffe...
7,228,982
0
<p>If you are using OS X hardware with an NVIDIA GPU, both <a href="http://www.culatools.com/" rel="nofollow">CULA</a> and <a href="http://www.accelereyes.com/" rel="nofollow">Jacket</a> includes SVD routines, and both are available for OS X (as far as I know). But I am not aware of anything similar for OpenCL.</p>
4,415,024
0
<p>This is an old question but you never really got an answer about run vs poll. </p> <p>io_service::run will keep running as long as there is something to do, such as waiting on a deadline timer or IO completion notification, etc. This is why there is the work object to keep run from exiting. </p> <p>io_service::poll...
14,858,239
0
<p>The error above occurs when you return certain objects (XML, Socket) from a function call, but the return values does not get assigned anywhere.</p> <pre><code>function test() { var xml = new XML('&lt;test /&gt;'); return xml; } test(); </code></pre> <p>The above will cause an error. To get around it you have to as...
30,642,633
0
How to sort Arraylist consisting of pojo class in java <p>I have POJO class Student like this</p> <pre><code>class Student { private int score; private String FirstName; //Getters and setters ................. } </code></pre> <p>I am creating ArrayList like this</p> <pre><code>public static void main(String[] args) { L...
589,655
0
<p>It says in the <a href="http://www.boost.org/users/faq.html" rel="nofollow noreferrer">Boost Faq</a>:</p> <blockquote> <p>What do the Boost version numbers mean? The scheme is x.y.z, where x is incremented only for massive changes, such as a reorganization of many libraries, y is incremented whenever a new library ...
27,452,005
0
<p>One possibility is that your <code>Stripe.rb</code> edits have not been loaded.</p> <ol> <li><p>Quit your server with <code>ctrl + c</code></p></li> <li><p><code>$ spring stop</code><br> => Spring stopped</p></li> <li><p><code>$ rails server</code></p></li> </ol>
35,309,518
0
<p>This is not a perfect solution, but at least gets you going. Probably this is caused by some bug in compass which leads to invalid <code>sass_path</code>. So set the <code>sass_path</code> manually like this: </p> <pre><code>project_type = :stand_alone # Set this to the root of your project when deployed: project_p...
1,689,242
0
Conditionally ignoring tests in JUnit 4 <p>OK, so the <code>@Ignore</code> annotation is good for marking that a test case shouldn't be run.</p> <p>However, sometimes I want to ignore a test based on runtime information. An example might be if I have a concurrency test that needs to be run on a machine with a certain n...
34,965,429
0
Giving VersionPress write permissions via ssh on bitnami WP ami running on EC2 instance <p>Thanks in advance for your patience and support helping me with this issue. I can normally work around most problems by reading online, but when it comes to linux and ssh I cant - it's too complex. No two explanations seem the sa...
18,543,228
0
Statically linking a C library with a Haskell library <p>I have a Haskell project that aims to create some C++ bindings. I've written the C wrappers and compiled them into a stand-alone statically linked library. </p> <p>I'd like to write the Haskell bindings to link statically to the C wrappers so that I don't have to...
36,125,312
0
<p>If you study the following simplified example you will understand why deleting elements of the array over which you are iterating caused the result you obtained.</p> <pre><code>s = "two lions" s = s.split("") puts "s.split=#{s}" for i in 0..s.length - 1 do puts "i=#{i}" str = s[i] puts " str=/#{str}/" if ["a","e","...
18,650,163
0
<p>index.php or index.html <em>should</em> be the default files loaded by your server when visiting a site, not home.html. Try clearing your cache. If that doesn't help it could be an issue in httpd.conf - but that sounds kind of extreme in this scenario.</p> <p>You can also look into using mod_rewrite in your .htacce...
9,957,399
0
<p>You can put condition on the rows that you want to fetch, the where clause is responsible for it. The columns that you want are to be specified in the select statement only, there is no way to specify which column to be selected. Once you have the results you can decide which columns to use, depending upon the valu...
6,363,825
0
TableViewer cell editor not working - SWT <p>I am trying to implement an editable table viewer in Eclipse SWT. I think I've done everything ok until now, problem is the table is not editable - nothing happens if I click on any row. </p> <p>I have registered some CellEditors with all my columns:</p> <pre><code>CellEdito...
27,820,681
0
illegal text-relocoation (direct reference) to (global,weak) for architecture i386 <p>Searching about shows this error in a number of mailing lists, but neither a general solution nor explanation is forthcoming.</p> <p>What does <code>illegal text-relocoation (direct reference) to (global,weak)</code> mean and how can ...
9,701,198
0
<p>The betterway to Achieve this effect is to measure speed/over/distance this formula will be easier and a lot less code.Doing it this way you wouldnt need any tween library's.</p> <pre><code> var MaskCenter=100; var speed=1/10; var distance=boxdummy.mouseX-MaskCenter; if(mouseX&lt;250){ box.x-=(distance*speed); } if...
10,739,574
0
<p>Have you considered a <a href="http://www.smashingmagazine.com/2008/05/06/25-wysiwyg-editors-reviewed/" rel="nofollow">WYSIWYG editor</a>? For example the editor in which you typed your question in this site is <a href="http://code.google.com/p/wmd/" rel="nofollow">WMD</a> and it allows to bold the text.</p>
32,065,980
0
Is there an alternate syntax to typedef function pointers? <p>For doing a typedef for a function pointer, we do something like this,</p> <pre><code>typedef int (*func) (char*); typedef struct{ char * name; func f1; } </code></pre> <p>As opposed to this, I came across a code, which I don't understand.</p> <pre><code>typ...
24,334,727
1
Is is possible to put a time.sleep(n) in a list comprehension? <p>Is it possible to put a <code>time.sleep(n)</code> in a list comprehension to print each item in the list with a delay between each print?</p> <pre><code>import random, time outside_lights = ['LED_fgate', 'LED_rgate', 'LED_mandoor', 'LED_garage', 'LED_ga...
22,323,217
0
mongo_client() fail with error MONGO_CONN_ADDR_FAIL <p>I want to use mongodb c driver in my project, I'm on Windows 7 so built it with command :</p> <blockquote> <p>scons --m32 --c99</p> </blockquote> <p>My problem is I can't make the <a href="http://api.mongodb.org/c/current/tutorial.html#connecting" rel="nofollow">Co...
10,207,141
0
Windows Phone 7 Play Vimeo Video <p>I am trying to get Vimeo videos to play in a windows 7 phone app, we need to online streaming specific video from vimeo in our Application. i have revieved following links but still i have not found any solution.</p> <ul> <li><a href="http://stackoverflow.com/questions/7521981/play-v...
7,012,138
0
ASP.NET web control panel for a desktop application <p>I'm working on a C# windows application but I'd like to create a website to be hosted on the same machine that could provide monitoring, other people on the network would be able to login and see the state of certain variables, maybe trigger methods to turn things ...
26,749,255
0
<p>Before using the "prompt" module, I used the ReadLine interface; sadly I had the same problem. However, the fix was simple:</p> <blockquote> <p>Remove the <code>rli.close();</code> and then run it.</p> <p>Then re-add the <code>rli.close();</code> and it works!</p> </blockquote> <p>Thanks mscdex for the input, thoug...
18,755,341
0
Handle $_GET requests with Clean URLs <p>I am have a clear URL based system so the categories will be shown like this </p> <pre><code>http://www.mysite.com/category/23/cat-name </code></pre> <p>Inside the categories page I have some sorting and pages options such as sorting by latests and lower price. Also, I have a pa...
16,483,488
0
jsf listener on fullcalendar <p>I want to use the FullCalendar jQuery Plugin with JSF.</p> <p>But how can I add an f:ajax listener to an e.g. eventClick of the FullCalendar?</p> <p>Here's the code where I want to add a listener to:</p> <pre><code>&lt;ui:define name="content"&gt; &lt;div id="calendar"&gt; &lt;f:ajax eve...
10,846,196
0
how is code for sending parameters to the JSON type URL? <p>hi all i am getting response like below URL but i have to pass NSString type parameters to the My required URL as like shown below how is code for sending request to the URL in iPhone? so plz give me any one for my request.</p> <h1>define kLatestKivaLoansURL [...
29,102,751
0
<p>Use single table inheritance of Post model</p> <pre><code> class class Post &lt; ActiveRecord::Base ..... end </code></pre> <p>Than inherit this Post model into these model.</p> <pre><code>class VideoPost &lt; Post end class ImagePost &lt; Post end </code></pre> <p>At migration you need to create a type column for ...
39,413,786
1
Can I make an ipywidget floatslider with a list of values? <p>I would like to make an ipywidget floatslider, but passing it a list of values, rather than a range and step. Is there a way to do this, or is making a dropdown widget the only option?</p>
36,355,248
0
<p>You need to quote the argument, and you should use single quotes, <code>'</code>, in order to stop your shell from attempting to evaluate anything inside it.</p> <p>What happens is that every ampersand, "&amp;", on your command line launches a background process.</p> <p>The first process is <code>./demo 1 https://w...
4,116,288
0
<p>Unless you have a compelling reason to use Axis I would rather stay with JAX-WS and JAXB. It's included in JDK 6 but could be used with JDK 5 as well. Supported in all modern Java EE containers (Websphere, Weblogic) but could be used in Servlet containers (Tomcat, Jetty) with just few jars from Reference Implementa...
19,335,973
0
<p>In base class, create abstract virtual method that returns some kind of "ID". (string, int, enum, whatever).</p> <p>In "save" method, write ID first, for all classes. You could embed ID writing into base class, so derived classes won't override this behavior.</p> <pre><code>typedef SomeType ClassId; class Serialize...
39,195,448
0
Getting Leaks Even After pthread_detach <p>I am trying to make self-cleanup thread code to release pthread_t resources if I terminate the whole program from a side thread using pthread_detach, but I am still getting memory leaks reports from valgrind with possibly lost bytes. Here is my sample code snippet:</p> <pre><c...
1,060,506
0
F# using sequence cache correctly <p>I'm trying to use Seq.cache with a function that I made that returns a sequence of primes up to a number N excluding the number 1. I'm having trouble figuring out how to keep the cached sequence in scope but still use it in my definition.</p> <pre><code>let rec primesNot1 n = {2 .. ...
529,098
0
Removing duplicate rows from table in Oracle <p>I'm testing something in Oracle and populated a table with some sample data, but in the process I accidentally loaded duplicate records, so now I can't create a primary key using some of the columns.</p> <p>How can I delete all duplicate rows and leave only one of them?</...
5,850,190
0
<p>A very crude way of doing it would be, simply subtracting the registration date from the current time, and get the total months from the number of days:</p> <pre><code>TimeSpan age = DateTime.Now - registrationDate; int months = (int) (age.TotalDays/30); </code></pre> <p>After a few years (about six or seven) you'l...
5,846,473
0
<p>Try put this code in your page</p> <pre><code>&lt;script type="text/javascript"&gt; Sys.Application.add_load(function () { Sys.Extended.UI.MaskedEditBehavior.prototype._MoveDecimalPos = function () { var e = this.get_element(); var wrapper = Sys.Extended.UI.TextBoxWrapper.get_Wrapper(e); var curpos = this._LogicFir...
26,612,737
1
Is there a way to append/extend a list with another list at a specific index in python? <p>In other words, I want to accomplish something like the following:</p> <pre><code>a = [1, 2, 3, 7, 8] b = [4, 5, 6] # some magic here to insert list b into list a at index 3 so that a = [1, 2, 3, 4, 5, 6, 7, 8] </code></pre>
15,459,922
0
How to run an Android app in IntelliJ Simulator <p>I installed IntelliJ 12 and Android SDK 10 and 17. I setup a simple "hello world" android app in IntelliJ. Then I run the app in emulator using IntelliJ. IntelliJ executes the following command:</p> <pre><code>"D:\Program Files\Android\android-sdk\tools\emulator.exe" -...
39,467,407
0
<p>One-liner direct computation (no Date object):</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function daysInMonth(m, y) {//m is 1-based, feb = 2 return 31 - (--m ^ 1? m %...
5,753,775
0
<p>Refer to this link. you will find many examples related to animation.</p> <p><a href="http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CAAnimation_class/Introduction/Introduction.html" rel="nofollow">http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CAAni...
26,766,682
0
<p>How about something like this?</p> <pre><code>string result = Regex.Replace(searchText, "(?s)^(\\d+/\\d+/\\d+ \\d+:\\d+:\\d+ [APM]{2}) (\\d+) (.*)$", ""); </code></pre> <p>This regex returns the date and time in the first group, the ID in the second and everything else (the message) in the last. </p> <p>The standar...
29,215,102
0
<p>Well, this is easy:</p> <pre><code>var DATES=[];for (var i=0;i&lt;mlength;DATES.push([]),i++); </code></pre> <p>Just push an empty array to <code>DATES</code> <code>mlength</code> number of times.</p>
7,905,816
0
<p>Here's my wild guess: <strong>cache</strong></p> <p>It could be that you can fit 2 rows of 2000 <code>double</code>s into the cache. Which is slighly less than the 32kb L1 cache. (while leaving room other necessary things)</p> <p>But when you bump it up to 2048, it uses the <strong><em>entire</em></strong> cache (a...
3,050,950
0
<p>I'm guessing that it has to do with using a keyword as a function name. I tried defining a function <code>print()</code> in a module just now for testing and got the same sort of error. Try changing the name of this function slightly and see if it fixes the problem.</p>