pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
13,222,849
0
NodeJS+Sequelize+Jade; Using the hasMany collection on an object <p>I'm working on a nodejs+sequelize+jade web-app to learn nodejs. Everything basic is quite clear but now I want to up the ante. I have object(table) called brand. The object product has a one-to-many relation with brand. What I like to do is to findAll ...
37,761,657
0
How can I make the image smaller width? Masonry <p>Basically not know how to change the width of the image so it looks like in design.</p> <p>I'm new to working with this library and I want to know how I can change my example to be like in design.</p> <p>The middle image is smaller than the other two. Also to be preser...
230,082
0
<p>Silverlight can do this (as can Flash, I'm sure). CSS3 will support it. But graphic text is the way to go right now.</p> <p>You can use any of several text-hiding techniques in CSS to show the text for accessible browsers, yet display the graphic (with text arranged vertically) for sighted users.</p>
32,798,639
0
<p>You need to use encodeURIComponent to do this.</p> <pre><code>encodeURIComponent('http://example.com/feed.xml&amp;0.1234') </code></pre> <p>will result in</p> <pre><code>http%3A%2F%2Fexample.com%2Ffeed.xml%260.1234 </code></pre> <p>and when appended to the end result you'll get</p> <pre><code>https://ajax.googleapi...
27,635,845
0
Hbase connection problems and failed to create table <p>I'm running a multi-node cluster; I'm using hadoop-1.0.3(on both), Hbase-0.94.2(on both) and zookeeper-3.4.6(only master) </p> <p>master:192.168.0.1 slave:192.168.0.2</p> <p>Hbase is not running perfectly and I faced problems while trying to create a table on hbas...
27,985,064
0
<p>In pure Python you can do this using a dictionary in <code>O(N)</code> time, the only time penalty is going to be the Python loop involved:</p> <pre><code>&gt;&gt;&gt; arr1 = np.array([7.2, 2.5, 3.9]) &gt;&gt;&gt; arr2 = np.array([[7.2, 2.5], [3.9, 7.2]]) &gt;&gt;&gt; indices = dict(np.hstack((arr1[:, None], np.ara...
16,220,490
0
If there a way I can inner join a MS Sql table to a MySql Table in one query using MySql? <p>I have 2 servers one servers runs Microsoft SQL Server and the other one is using MySql. </p> <p>I need to be able to inner join a table from MS SQL name it "A" to a table "B" located on a different server that uses MySql</p> <...
18,921,377
0
<p>Another alternative: RedGate has recently updated pricing on their Deployment manager tool: <a href="http://www.red-gate.com/delivery/deployment-manager/" rel="nofollow">http://www.red-gate.com/delivery/deployment-manager/</a></p> <p>If you have 5 projects or less, the tool appears to be free. </p>
22,302,102
0
<p>Try using regex as a lightweight solution.</p> <p>Try this regex (tested on <a href="http://regexpal.com/" rel="nofollow">http://regexpal.com/</a>):</p> <pre><code>src=\"([^\"]*)\" </code></pre> <p>And you could extract the string using captured group</p> <p>Sample code:</p> <pre><code>string input = "&lt;img alt=\...
14,584,006
0
<p>In dynamically loaded files using autoloaders, the file containing the function or class might not have loaded, so you need to check if it exists</p>
2,800,943
0
javascript form submission usng window.onload on background window <p>I have a form which submits certain values to third party... I am using windows.onload(); to submit that form, but as soon as the page is loaded the focus goes to new window... Is there a way to retain focus on my window only...</p>
8,276,845
1
python's scrapy doesn't seem to get data from all available URLs <p>I'm trying to scrape <a href="http://thesession.org" rel="nofollow noreferrer">thesession.org</a> to create a table of how many times each tune has been added to memeber's tunebooks so I can find some popular pieces to learn. I've started with the scra...
23,188,463
0
<p>try this:</p> <pre><code> $name = $_POST['name']; $email = $_POST['email']; $custom_field1 = $_POST['custom_field1']; $custom_field2 = $_POST['custom_field2']; $error = array(); if($name=='') { $error[] = 'Name are mandatory'; } if($email == '') { $error[] = 'Email are mandatory'; } if($custom_field1 == '') { $erro...
21,918,427
0
<p>It means if you try to serialize/deserialize more than 20 different types you will require a paid license. See the test in the source code <a href="https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.WebHost.Endpoints.Tests/LicenseUsageTests.cs#L55" rel="nofollow">here</a>. In this case 20 d...
32,968,242
0
<p>We have a project like this one before. You need an sdk (software development kit) to go to your device. Add that to your project references so you can communicate with it. And I believe there is a sample code in the SDK site that you could find in the case of your finger print reader which you could modify. <br/><...
26,324,565
0
<p>Yes, it is safe. From [6.5.9] of the C99 standard (emphasis mine):</p> <blockquote> <p><strong>Two pointers compare equal if and only if</strong> both are null pointers, <strong>both are pointers to the same</strong> object (including a pointer to an object and a subobject at its beginning) or <strong>function</str...
21,984,294
0
<p>I'm no expert in ActiveMQ, but I'm one of the developers of the HiveMQ MQTT broker, which is also written in Java. We have an OpenSource Plugin SDK, which allows to customize the authentication of clients and the authorization of clients to publish/subscribe to the broker. You can use a relational database or any o...
25,845,536
0
Trait to check if some specialization of template class is base class of specific class <p>There is <code>std::is_base_of</code> in modern STL. It allow us to determine whether the second parameter is derived from first parameter or if they are the same classes both or, otherwise, to determine is there no such relation...
32,172,238
0
<p>You already got it, you just needed to create the container for the output (the <code>numnights</code> element). </p> <p>Anyway the code is a little bit cleaner in this way:</p> <hr> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-...
23,627,627
0
C++ copy constructor, assignment 'operator=' <p>I'm trying to make a copy constructor or = operator. If I define a matrix named A, another as B and C and use the '=' operator as:</p> <p>A=B</p> <p>it performs well, However if i use like: </p> <p>A=B+C i get this error: no matching function for '='. </p> <p>The point is...
40,264,523
0
Why does 5/2 results in '2' even when I use a float? <p>I entered the following code (and had no compiling problems or anything):</p> <pre><code>float y = 5/2; printf("%f\n", y); </code></pre> <p>The output was simply: <code>2.00000</code></p> <p>My math isn't wrong is it? Or am I wrong on the / operator? It means divi...
11,829,740
0
<p>You can use one of the libraries which allow you to create and manipulate Excel files, like <a href="http://epplus.codeplex.com/" rel="nofollow">EPPlus</a> (open source) or <a href="http://www.aspose.com/" rel="nofollow">Aspose</a> (commercial). I have a positive experience with the latter.</p>
30,921,360
1
Creating graph vertices from numpy array <p>I have a numpy array full of values that I would like to create vertices from for every point in the array. I am using networkx as my graphing support method(documentation here: <a href="http://networkx.github.io/documentation/latest/tutorial/" rel="nofollow">http://networkx....
9,421,462
0
<p>Spring 3 introduced the Converter SPI which makes this quite easy. Have a look at 6.5 in the <a href="http://static.springsource.org/spring/docs/current/spring-framework-reference/html/validation.html#beans-beans-conversion" rel="nofollow">documentation</a> </p> <p>Taking source from the docs and putting in your co...
35,065,421
0
Evaluate all formulas in a Workbook object <p>I want to evaluate all formulas in a Workbook object. I know there are XSSFFormulaEvaluator and HSSFFormulaEvaluator for evaluating formulas in XSSFWorkbook and HSSFWorkbook. But the workbook object I have belongs to Workbook class.</p> <p>I can use something like this,</p>...
35,686,500
0
How to define member class operator based on the class parameters <p>Is it possible to define different = operators for different template arguments. Let's assume that I want to use different methods for converting arguments of different types:</p> <pre><code>template &lt;class T,class U&gt; class cTest { private: publ...
7,289,721
0
Using resources across classes? <p>I have a GameLoop class with a ParticleSystem object defined in it.</p> <p>The ParticleSystem contains an array of Particle objects - I don't want to have to load an image for each individual particle, id like to just be able to draw from a source image in the GameLoop class - how can...
20,021,366
0
Regex - matching a multiline block by noting the absence of a string and then inserting it <p>What a mouthful of a subject. </p> <p>So in essence I have a pattern I need to find in a file based on that pattern missing something.</p> <p>For example what I HAVE is:</p> <pre><code>Huge amounts of preceding code... someHea...
26,771,465
0
<p>It turned out to be a CORS issue. Opera 12.17 seems to be very restrictive when it comes to CORS. I moved the app and all the necessary resources into one domain and it works as it should. Note * this issue only happens with Opera 12.17 , later versions seem to work.</p>
3,796,740
0
<p>In this <a href="http://mindprod.com/jgloss/hashcode.html" rel="nofollow">link</a> it says that indeed the default hash code is the JVM address of the object, but if it is moved - the address stays consistent. I don't know how reliable this source is, but I am sure that the implementors of this method thought of th...
6,522,747
0
<p>A minor shuffle to trigger the <code>hide()</code> on the last callback for the <code>each()</code> you've got going should do the trick.</p> <pre><code>elsCheck = $(".treeclick", "#treegrid"); $("#expandAll").click(function(e){ $('#collapseExpandProgress').show(); elsCheck.each(function(i){ if ($(this).hasClass("t...
21,871,726
0
Accessing a jobjectarray in C++ <pre><code>JNIEXPORT void JNICALL Java_com_beantowngameshop_bingoshoot_api_ApslarHandler_sendEvent (JNIEnv *, jobject, jobjectArray); </code></pre> <p>The jobjectArray is object array of my java class that has two attributes </p> <p>1) A String 2) A Integer</p> <p>I want to iterate and r...
31,578,621
0
<p>The plain <code>for loop</code> way:</p> <pre><code>T max_e = std::numeric_limits&lt;T&gt;::min(); for(const auto&amp; v: vv) { for(const auto&amp; e: v) { max_e = std::max(max_e, e); } } </code></pre>
2,667,088
0
<p>Hmm its a good question.</p> <p>Anything that can be displayed can be rendered using an instance of <code>WriteableBitmap</code> and its <code>Render</code> method. You can access the output using the <code>Pixels</code> byte array property. </p> <p>However (assuming GPU acceleration is turned on and the content is...
19,308,956
0
<p>Thank you for your assistance. After many hours, I figured I had to use setTitle().</p>
4,894,964
0
Flash mp3 player throws Error 2032 - Thinking URLRequest is the culprit? <p>I am trying to set up an audio player for a website I am working on, and I keep running into this Error 2032. The .swf is located in my main folder along with my songlist file. The song files themselves are located in a subfolder called songs/<...
6,127,528
0
Converting from Windows 1252 to UTF8 in Java: null characters with CharsetDecoder/Encoder <p>I know it's a very general question but I'm becoming mad. </p> <p>I used this code:</p> <pre><code>String ucs2Content = new String(bufferToConvert, inputEncoding); byte[] outputBuf = ucs2Content.getBytes(outputEncoding); return...
20,852,884
0
PHP passing model as a function argument <p>I'm using the Laravel Framework and I've got <code>MyModel</code>.</p> <pre><code>namespace App\Models; use Illuminate\Support\Facades\DB; class MyModel extends \Eloquent { //Some stuff goes here } </code></pre> <p>I have made this function that group the data of an array. <s...
20,918,211
0
<pre><code>function mom_get_first_image() { global $post; if(preg_match_all('/&lt;img.+src=[\'"]([^\'"]+)[\'"].*&gt;/i', $post-&gt;post_content, $matches)) $first_img = $matches[1][0]; else $first_img = "images/logo.png"; return $first_img; } </code></pre>
12,456,714
0
google distance Matrix api v3 showing error <p>I am trying to calculate the rates of the taxi fare from the distance of two locations using google distance matrix app.</p> <p>I created a new project, enabled the Google Maps Api V2 &amp; V3 from the services, copied the api key from Simple API Access</p> <pre><code>&lt;...
22,447,369
0
Navigation Controller to View Controller Programmatically Not Working IOS7 <p>Hi in my application i have navigation controller with registration and I'm doing the validation for my registration form if user enter a invalid data in the registration form it should not move to the next view controller and if user give th...
32,368,447
1
Default the root view in cherrypy <p>In <a href="https://github.com/metaperl/metaperl-proxy">some source code</a> I am writing, I am able to make a request such as:</p> <pre><code>http://proxy.metaperl.org/index/bitgold-rw1 </code></pre> <p>And have it redirect successfully.</p> <p>However, I want to remove <code>index...
40,997,035
0
<p>@Joshua Blevins its nice to see you come to symfony and try its first ever beginners code.</p> <p>Here you have to change your <code>app.php</code> located in <strong>web</strong> folder of your project. Open and turn the false option to true, it will enable your project to run in production environment.</p> <p>Mor...
8,662,221
0
Collecting and identifying functions within an array in actionscript <p>So, I want to do something where I collect functions to be invoked later when a certain condition is met. E.g.</p> <pre><code>function doSomething(someArg:Object):void { if (conditionIsFalse){ operationsToDoWhenConditionIsTrue.push(function(){ doSo...
19,766,668
0
How to make a URL link to another state of the page? <p>I'd like to share a page in a state when the second link is active (e.g. "http:/ /mypage#green-color"). </p> <p>I tried to add to the second link <code>onClick="window.location='#green-color';"</code> attribute. It changes the URL in the browser's address window, ...
37,698,170
0
What is the actual pricing for AWS ECS? <p>AWS EC2 Container Service official webpage says:</p> <blockquote> <p>There is no additional charge for Amazon EC2 Container Service. You pay for AWS resources (e.g. EC2 instances or EBS volumes) you create to store and run your application.</p> </blockquote> <p>What does that ...
33,350,116
0
<p>I thank you all for the input. I was able to fix my errors. I re-iterate through each character and strip the punctuation and i kept creating new lists to add repeated words then keep a single occurrence. The response that I have seem to work but I was not introduced to the higher order programming as yet.</p> <p>H...
38,368,878
0
neo4j refresh pagination in cyper query <p>I have a news feed in my application and im using neo4j as database. I also use pagination with <code>SKIP</code> and <code>LIMIT</code> to pull more and more item from the database.</p> <p>Im looking for a way to "refresh" the pagination (pull to refresh. like facebook have w...
2,432,257
0
<p>Visual SourceSafe 2005 includes support for access over HTTP:</p> <blockquote> <p><strong>Remote Internet Access.</strong> This release of Visual SourceSafe introduces a new SourceSafe Internet plug-in for Visual Studio source control. The plug-in and its associated Web service enable remote Internet access to Visu...
25,894,194
0
<p>smallImageUrls, is inside matches that is inside the root, so you have to retrieve matches and, through it, smallImageUrls</p> <pre><code>JSONObject obj = new JSONObject(...); JSONArray matches = obj.optJSONArray("matches"); if (matches != null) { for (int i = 0; i &lt; matchesLenght; i++) { JSONObject objAtIndex =...
25,342,573
0
RESTful API to safeguard server and client from large datasets <p>I am working on designing a RESTful API and need second opinion on the design. I will be abstracting away the problem statement for better understanding.</p> <p>Consider a URI <code>/search?key1=value1&amp;key2=value2</code>, which can potentially return...
35,466,556
0
Filtering an object based on its values using lodash <p>How would I use lodash to get the following output ?</p> <pre><code>input = { 'property1' : true, 'property2' : false, 'property3' : false } // only pick those properties that have a false value output = ['property2', 'property3']; </code></pre> <p>I currently hav...
31,077,760
0
<p>if you just want a quick implementation i might recommend putting something like {{title}} in your html template, and configuring and using $rootScope.title to update this value from each of your controllers.</p> <p>implementation would be something like this plus the update to your template.</p> <pre class="lang-j...
11,134,993
0
Sumproduct with Substitute <p>I have a range, containing numeric values &amp; blank cells. Some of the numeric values will have * as suffix.</p> <pre><code>10* 5 7 9 25* 10 </code></pre> <p>When I do a SUM(A1:A8), I get result of 5+7+9+10 = 31, the required output. Now, I also require the total sum irrespective of * su...
37,844,112
0
<p>You can loop through the latlongs for the user and location off to a function that calculates distance based on the Haversine formula:</p> <p>In your controller, after loading your data:</p> <pre><code>angular.forEach(results, function(s) { store['dist'] = getDistanceInM(user_lat, user_lon, store['store_latitude'],...
27,542,562
0
<p>This replaces the last character of a url if it is a '/'</p> <pre><code>concat(LEFT(url, LENGTH(url)-1),replace(right(url, 1),'/','')) </code></pre>
28,439,200
0
Developing a testing tool <p>I am developing a testing tool. Is it possible to add JUnit functionality to a java application so that the application (itself) can run test cases against a specified java code. In a more specific way, the application takes a folder of test cases, and the code to be tested, it then runs th...
36,156,921
0
<p>Adding a space to the end of a string is as simple as just using <code>+</code>:</p> <pre><code>string = 'a' new_string = string + ' ' </code></pre> <p>So you just need to iterate each item in your list and append the space:</p> <pre><code>for string in sliced: print string + ' ' </code></pre> <p>So could just crea...
2,846,471
0
<p>Look at the Unicode <a href="http://www.fileformat.info/info/unicode/category/index.htm" rel="nofollow noreferrer">character categories</a>. You can match these in C# regular expressions with the character class syntax <code>\p{catname}</code>. So to match a lower-case letter, you would use <code>\p{Ll}</code>. You...
16,341,128
0
<p>I think I basically did what prodigitalson suggested...</p> <p>I <code>include()</code> a call to a php file that inserts a new shot(same query as in my question)</p> <p>Then I <code>include()</code> another call to another php file that selects this new row I just inserted and assigns each column of the result row...
5,634,487
0
If A extends B extends C, why can I cast to A but get a ClassCastException casting to C? <p>I am trying to read an ASN1 object using Bouncycastle on Android. I expect it to be a DERSequence, which in Bouncycastle is a subclass of ASN1Sequence, which is a subclass of ASN1Object.</p> <pre><code>import org.bouncycastle.as...
19,554,136
0
<p>Because the code you have posted is not the same that the code you are trying to compile.</p> <p>The following line</p> <pre><code>void function1(std::ostream&amp;, const std::string&amp;, double function2(const infocontainer&amp;, const std::string&amp;), const infocontainer, const infocontainer); </code></pre> <p...
20,814,433
0
<pre><code>strtr($str, ['&lt;' =&gt; '', '.' =&gt; '']); </code></pre> <p>This will probably outperform anything else, because it doesn't require you to iterate over anything in PHP.</p>
18,130,746
0
<p>Read each line one by one with <a href="http://en.cppreference.com/w/c/io/fgets" rel="nofollow"><code>fgets</code></a> then split them with <a href="http://en.cppreference.com/w/c/string/byte/strtok" rel="nofollow"><code>strtok</code></a> and parse with <a href="http://en.cppreference.com/w/c/string/byte/strtol" re...
4,497,541
0
<p>As far as operator <code>as</code> returns <code>null</code> in failure case, variable should be a class or nullable struct:</p> <p>Meanwhile <code>cast</code> requires nothing like that and you can cast struct on struct.</p>
12,237,281
0
<p>All the bottlenecks you posted seem to be from setting the BorderWidth property on your shapes. I'm guessing you do repainting or updating the layout of the shapes in BorderWidth. If you set BorderWidth on a container there will a lot of unnecessary repaints and layout changes which are kind of slow in WinForms (sp...
38,932,505
0
<p>Try this ;)</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>$(document).ready(function() { $('.bg-primary').on('click', function() { $('.' + $(this).attr('id')).slideToggle...
20,135,079
0
Fence plot (or Wall plot?) density plots in R or GNUPLOT <p>Hi I have some ensembles for stochastic simulations of a system. I would like to represent these data as histograms in a fence plot in a similar way to what is shown here:</p> <p><a href="http://stackoverflow.com/questions/9009154/3d-parametric-graph-in-gnuplo...
18,735,164
0
<p>After enabling Java 1.5 mode with Trex's answer, you can access the generic types of <code>fieldType</code> using </p> <pre><code>Type[] typeArguments = fieldType.asParameterizedType().typeArguments() </code></pre>
40,048,763
0
<p>You just had your logic wrong. This should work for you.</p> <pre><code>Do While E1 &lt; 4 OrElse E1 Mod 2 &lt;&gt; 0 E1 = CInt(Int((11 * Rnd()) + 1)) Loop Do While E1 Mod E2 &lt;&gt; 0 OrElse _ E2 = 1 OrElse _ E2 = 0 OrElse _ E1 = E2 E2 = CInt(Int((11 * Rnd()) + 1)) Loop </code></pre>
10,566,312
0
<p>Given that <code>$index</code> is an integer you could just break out of the loop:</p> <pre><code>foreach ($images as $index =&gt; $image) { echo '&lt;li&gt;&lt;a href="'.$image['XLargeURL'].'"&gt;&lt;img src="'.$image['TinyURL'].'" alt="thumbnail"/&gt;&lt;/li&gt;'; if ($index &gt;= 5) { break; } } </code></pre>
21,757,417
0
<p>There's no way that Exception <em>originated</em> from the code you posted. If <code>OnInit</code> is aprt of the stack trace, then the exception <em>has</em> to have been thrown from (or passed through) <code>InitializeComponent</code> or <code>base.OnInit(e)</code></p> <p>Run it in the debugger and see where the ...
8,072,716
0
How to fix "function not allowed" when using row_number() over a view? <pre><code>select * from ( select a.*,row_number() over() as rk from table1 tba ) as foo where rk between 11 and 20 </code></pre> <p>This works for database table. I am using a view which is a join of 2 tables. When i try to do rownum it is saying: ...
8,864,576
0
<p>I'm assuming you're using ajax to pull in your data from the php file. You'll need to call this function in the success callback of your ajax request.</p>
23,252,455
1
how to put data(id) in form (wtforms) and get it back on submit <p>I am new to wtforms, so I`ll really appreciate any help. </p> <p>I need to display books names and near each put "Delete" button. I`ve read <a href="http://wtforms.readthedocs.org/en/1.0.4/crash_course.html" rel="nofollow">wtforms crash course</a> but I...
39,931,184
0
<p>Change your last rule to this,</p> <pre><code># If the request is not for a valid directory RewriteCond %{REQUEST_FILENAME} !-d # If the request is not for a valid file RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([a-z]+)/$ home/index.php?nLang=$1 [L,QSA,NC] </code></pre> <p>That way it will only handle langua...
36,054,503
0
<p>You have to add it at the end and beginning also because <code>Join</code> will only <em>combine</em> two strings. Having said this when combining <code>"1"</code> and <code>"2"</code> with a speaterator of <code>','</code> you get <code>"1','2"</code> where the seperator is just added <em>between</em> the two elem...
40,658,544
0
<p>The compiler attempts to resolve implicits before eta-expansion of <code>from</code> into a function, so the type parameters of <code>from</code> are not yet inferred when you call it like this:</p> <pre><code>future.map(from) </code></pre> <p><code>compiles2</code> obviously works because you supply the type param...
584,287
0
<p>If you have a large pool of proxies you can use, then I suppose you could switch between them, but otherwise no, you generally can't just renew your IP address whenever you feel like it.</p> <p>You might want to look into <a href="http://www.torproject.org/" rel="nofollow noreferrer">Tor</a>, an anonymizing network...
19,113,717
1
playing midi sounds through pygame on raspberrypi <p>I'm trying to play midi sounds using pygame on my raspberrypi (without external midi devices), however I can't get anything to work.</p> <p>I have tried many examples: The following gives.</p> <pre><code>import pygame import time import pygame.midi pygame.midi.init()...
33,554,871
0
How to use/declare an unsigned Integer value in VHDL? <p>I'm trying to design a basic Vending machine on a Altera DE1-SoC Board. My question comes from trying to code the State Machine that will control the vending process. How do you track the $ value being added jumping between states? I think the code I'm trying to ...
40,322,536
0
How can I change the border thickness of an Android checkbox? <p>The default size of the android checkboxes were too small for my purposes, so I changed their overall size, however with their new size their borders now are horribly thick. </p> <p>In what way could I change the thickness? I quite like the default behavi...
5,109,018
0
<p>The nested lexical scope example that someone gave gives several benefits.</p> <ol> <li>"Safer" globals</li> <li>It is one method to embed DSL's into your program. </li> </ol> <p>I think that is a very good example of the differences between the two languages. Ruby is simply more flexible. Python can be flexible, b...
30,019,358
0
Android List View Scrolling Items Randomize <p>my ListView works fine except when I scroll fast some of the items are duplicated and in random order. It's kind of hard to explain but here's the beginning of my getView method.</p> <pre><code>@Override public View getView(final int position, View convertView, ViewGroup a...
10,133,796
0
<p>You can override <code>-[NSView viewWillMoveToSuperview:]</code> in a custom NSView subclass. This is simply a means for your class to be notified when its position in the view hierarchy is about to change. It doesn't have some deeper meaning other than what its name implies, but you can, of course, harness it to s...
33,740,324
0
GetMethodID for "getName" is returning NULL <p>I have been trying to print out the class name from a jclass object.</p> <p><code>jmethodID mid_getName = env-&gt;GetMethodID(point_class, "getName", "()Ljava/lang/String;");</code></p> <p>The <code>point_class</code> object is not NULL.</p> <p>I used this snippet from <a ...
21,881,417
0
<p>Try this.</p> <pre><code>&lt;?php include("connect.php"); if( isset($_GET['del']) ) { $id = (int)$_GET['del']; $sql = "DELETE termekek WHERE id = $id" ; echo "&lt;a href='admin.php'&gt;Back&lt;/a&gt;"; } ?&gt; </code></pre>
17,192,980
0
R submit to CRAN: which R version to build package? <p>I want to submit a package to CRAN. In the <a href="http://cran.r-project.org/web/packages/policies.html" rel="nofollow">CRAN repository policy</a> it states that <strong>"Packages for which R CMD check gives an ‘ERROR’ when a new R x.y.0 version is released will b...
33,098,343
0
<p>What about <code>set -v</code>?</p> <blockquote> <p><code>-v</code> Print shell input lines as they are read.</p> </blockquote> <p>The output seems to meet your expectation.</p> <pre><code>$ set -v $ ./command1 &gt; output1 ./command1 &gt; output1 sh: ./command1: No such file or directory $ ./command2 arg1 arg2 &gt...
557,593
0
<p><a href="http://www.gnuplot.info/" rel="nofollow noreferrer">GnuPlot</a> is a the old reliable answer here, easy graphing with lots of options. I believe there are python bindings but it's probably easier to export your data and run it through regular gnuplot. Here's an ancient <a href="http://parand.com/docs/gnupl...
18,356,882
0
<p>Call merge(), and use its returned value: it's the attached entity containing the values found in the detached entity passed as argument:</p> <pre><code>Foo modifiedAttachedFoo = session.merge(modifiedDetachedFoo); modifiedAttachedFoo.getLazyCollection().size(); // no problem: the entity is attached </code></pre>
29,378,657
0
<p>Change this line from your form element:</p> <pre><code>name="payment_amount" </code></pre> <p>to be an array:</p> <pre><code>name="payment_amount[]" </code></pre> <p>Then, modify your <code>foreach</code> to read as:</p> <pre><code>foreach ($_POST['payment_amount'] as $value) { echo $value . "&lt;br&gt;"; } </code...
40,258,608
1
python: extract and download an image from the body of the email <p>I am trying to read the content of the email. If an email contains an image in the <strong>BODY</strong> part I need to extract and save it in the local Here is the code for getting the body content</p> <pre><code>def get_body(id): res, mail_data = con...
27,332,767
0
<p>To quickly answer your question I will first provide solution.</p> <p>Although this is not best practice, and not helping you learn the right approach to design html structure and traverse the DOM in efficient and quick way, it will solve this specific problem.</p> <p>If it was all designed better, this might not r...
1,691,470
0
Edited most errors, Now Compiles, but does not Run, what am I doing wrong? <pre><code>#include &lt;cstdlib&gt; #include &lt;iomanip&gt; #include &lt;iostream&gt; #include &lt;string&gt; using std::cout; using std::cin; using std::endl; using std::string; using std::setprecision; using std::fixed; //function prototypes ...
4,043,455
0
Which costs more while looping; assignment or an if-statement? <p>Consider the following 2 scenarios:</p> <pre><code>boolean b = false; int i = 0; while(i++ &lt; 5) { b = true; } </code></pre> <p>OR</p> <pre><code>boolean b = false; int i = 0; while(i++ &lt; 5) { if(!b) { b = true; } } </code></pre> <p>Which is more "c...
33,004,021
0
<p>After reading through parse doc, I figured out that AppDelegate.m file should be updated like this for IOS 9:</p> <blockquote> <p>There's also two code changes you'll need to make. First, add the following to your application:didFinishLaunchingWithOptions: method, after you've initialized the Parse SDK.</p> <pre><c...
710,969
0
<p>This may be more than you need, here's the code for the class I use:</p> <pre><code>public class ControlColorAnimator { private const int INTERVAL = 100; private readonly decimal _alphaIncrement; private readonly decimal _blueIncrement; private readonly Color _endColor; private readonly decimal _greenIncrement; pri...
39,151,158
0
Most efficient way to evaluate cards for TexasHoldEm game? <p>So I am in the process of making a texas holdem game. I am stuck on how to evualte the hands to see what type of scoring each player has (Two Pair, Flush etc) </p> <p>EDIT: I only need to deal 5 cards to each player and compare those 5 cards. Its not a compl...
16,133,289
0
<p>Try updating the components code in your appController to add the authenticate values to the Auth array like this:</p> <pre><code>public $components = array( 'Session', 'DebugKit.Toolbar', 'Auth' =&gt; array( 'allow' =&gt; array('login','logout'), 'loginAction' =&gt; array('controller' =&gt; 'users', 'action' =&gt;...