id
int64
4
73.8M
title
stringlengths
10
150
body
stringlengths
17
50.8k
accepted_answer_id
int64
7
73.8M
answer_count
int64
1
182
comment_count
int64
0
89
community_owned_date
stringlengths
23
27
creation_date
stringlengths
23
27
favorite_count
int64
0
11.6k
last_activity_date
stringlengths
23
27
last_edit_date
stringlengths
23
27
last_editor_display_name
stringlengths
2
29
last_editor_user_id
int64
-1
20M
owner_display_name
stringlengths
1
29
owner_user_id
int64
1
20M
parent_id
null
post_type_id
int64
1
1
score
int64
-146
26.6k
tags
stringlengths
1
125
view_count
int64
122
11.6M
answer_body
stringlengths
19
51k
4,854,446
Save Accents in MySQL Database
<p><br/> I'm trying to save French accents in my database, but they aren't saved like they should in the DB.<br/>For example, a "é" is saved as "é".<br/>I've tried to set my files to "Unicode (utf-8)", the fields in the DB are "utf8_general_ci" as well as the DB itself.<br/>When I look at my data posted through AJAX w...
8,780,302
9
0
null
2011-01-31 18:13:58.63 UTC
9
2022-09-13 19:02:36.917 UTC
2014-04-14 02:01:25.317 UTC
null
857,004
null
585,106
null
1
27
php|mysql|character-encoding|diacritics
45,567
<p>Personally I solved the same issue by adding after the <strong>MySQL connection code</strong>:</p> <pre><code>mysql_set_charset("utf8"); </code></pre> <p>or for mysqli:</p> <pre><code>mysqli_set_charset($conn, "utf8"); </code></pre> <p>or the mysqli OOP equivalent:</p> <pre><code>$conn-&gt;set_charset("utf8"); ...
5,404,856
How to disable touch input to all views except the top-most view?
<p>I have a view with multiple subviews. When a user taps a subview, the subview expands in size to cover most of the screen, but some of the other subviews are still visible underneath.</p> <p>I want my app to ignore touches on the other subviews when one of the subviews is "expanded" like this. Is there a simple w...
5,404,950
12
0
null
2011-03-23 11:56:56 UTC
16
2021-08-16 15:42:57.507 UTC
2013-08-07 11:17:38.547 UTC
null
640,731
null
14,606
null
1
47
iphone|ios|cocoa-touch|uiview|user-interaction
84,967
<p>Hope this help...</p> <pre><code>[[yourSuperView subviews] makeObjectsPerformSelector:@selector(setUserInteractionEnabled:) withObject:[NSNumber numberWithBool:FALSE]]; </code></pre> <p>which will disable userInteraction of a view's immediate subviews..Then give userInteraction to the only view you wanted</p...
5,553,352
How do I check if file exists in Makefile so I can delete it?
<p>In the clean section of my <code>Makefile</code> I am trying to check if the file exists before deleting permanently. I use this code but I receive errors.</p> <p>What's wrong with it?</p> <pre class="lang-sh prettyprint-override"><code> if [ -a myApp ] then rm myApp fi </code></pre> <p>I get this error messa...
47,828,799
16
4
null
2011-04-05 14:17:35.547 UTC
29
2022-06-04 02:12:05.44 UTC
2022-03-29 07:25:32.903 UTC
null
2,226,755
null
245,416
null
1
175
makefile
256,735
<p>The second top answer mentions <code>ifeq</code>, however, it fails to mention that this <code>ifeq</code> must be at the same indentation level in the makefile as the name of the target, e.g., to download a file only if it doesn't currently exist, the following code could be used:</p> <pre class="lang-Makefile pret...
5,548,893
jQuery DataTables: Delay search until 3 characters been typed OR a button clicked
<p>Is there please an option to start the search only after 3 characters have been typed in?</p> <p>I have written a PHP-script for colleagues displaying 20,000 entries and they complain, that when typing a word, the first few letters cause everything to freeze.</p> <p>An alternative would be to have the search to be...
23,897,722
24
1
null
2011-04-05 07:59:48.887 UTC
33
2022-08-08 00:32:17.713 UTC
2017-11-16 08:00:45.69 UTC
null
165,071
null
165,071
null
1
88
jquery|datatables
85,794
<p>Solution for version 1.10 -</p> <p>After looking here for a complete answer and not finding one, I've written this (utilizing code from the documentation, and a few answers here).</p> <p>The below code works to delay searching until at least 3 characters are entered:</p> <pre><code>// Call datatables, and return ...
16,934,663
Displaying images from MySQL database in JSF datatable
<p>I have MySQL database which stores images in a <code>blob</code> column. I would like to show them in a PrimeFaces <code>&lt;p:dataTable&gt;</code>. How can I achieve this?</p>
16,940,909
2
4
null
2013-06-05 08:08:20.397 UTC
8
2015-07-18 08:24:28.023 UTC
2013-07-13 13:08:57.337 UTC
null
157,882
null
2,436,180
null
1
4
mysql|image|jsf|primefaces|datatable
13,932
<p>You can use <a href="http://www.primefaces.org/showcase/ui/dynamicImage.jsf" rel="nofollow noreferrer"><code>&lt;p:graphicImage&gt;</code></a> to display images stored in a <code>byte[]</code>, regardless of the <code>byte[]</code> source (DB, disk file system, network, etc). Simplest example is:</p> <pre class="la...
12,249,136
ReferenceError: google is not defined
<p>I use google map's api in my website to show couple of locations. Google Maps is working just fine in my local solution but not in my website. I changed this source</p> <pre><code>&lt;script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.5&amp;sensor=false"&gt; &lt;/script&gt; </code></pre> <p>...
12,284,981
4
0
null
2012-09-03 13:47:54.923 UTC
3
2021-07-05 14:13:02.13 UTC
2012-09-04 12:27:16.623 UTC
null
1,218,067
null
1,218,067
null
1
14
google-maps
106,790
<p>Owing to the fact that my website uses <strong>https</strong> for the connection, I can not use <a href="http://maps.google.com/maps/api/js?sensor=false" rel="nofollow noreferrer">http://maps.google.com/maps/api/js?sensor=false</a>. When I debug the whole page, this link says: Warning : <strong>The page index.html r...
12,504,954
How to start an Intent from a ResolveInfo
<p>I'm trying to make a custom launcher for android, and I'm trying to figure out how to launch a different application form mine. I figured the way to do it was intents, and I've found a post on it here:</p> <p><a href="https://stackoverflow.com/questions/2780102/open-another-application-from-your-own-intent">Open a...
12,511,404
2
0
null
2012-09-20 01:20:26.767 UTC
8
2013-06-02 23:08:00.327 UTC
2017-05-23 12:02:26.147 UTC
null
-1
null
1,123,960
null
1
26
android|android-intent|launcher
13,315
<p>Given a <code>ResolveInfo</code> named <code>launchable</code>:</p> <pre><code>ActivityInfo activity=launchable.activityInfo; ComponentName name=new ComponentName(activity.applicationInfo.packageName, activity.name); Intent i=new Intent(Intent.ACTION_MAIN); i.addCategory(Intent...
12,196,756
Significance level added to matrix correlation heatmap using ggplot2
<p>I wonder how one can add another layer of important and needed complexity to a matrix correlation heatmap like for example the p value after the manner of the significance level stars in addition to the R2 value (-1 to 1)?<br> It was NOT INTENDED in this question to put significance level stars OR the p values as te...
12,226,215
3
5
null
2012-08-30 12:22:25.6 UTC
20
2019-11-10 21:50:49.967 UTC
2018-02-23 00:43:09.5 UTC
null
8,270,343
null
1,288,722
null
1
30
r|ggplot2|correlation|heatmap|significance
21,988
<p>This is just an attempt to enhance towards the final solution, I plotted the stars here as indicator of the solution, but as I said the aim is to find a graphical solution that can speak better than the stars. I just used geom_point and alpha to indicate significance level but the problem that the NAs (that includes...
12,412,324
Python class returning value
<p>I'm trying to create a class that returns a value, not self.</p> <p>I will show you an example comparing with a list:</p> <pre><code>&gt;&gt;&gt; l = list() &gt;&gt;&gt; print(l) [] &gt;&gt;&gt; class MyClass: &gt;&gt;&gt; pass &gt;&gt;&gt; mc = MyClass() &gt;&gt;&gt; print mc &lt;__main__.MyClass instance at...
12,412,839
6
9
null
2012-09-13 18:14:08.44 UTC
18
2021-02-18 17:28:23.78 UTC
2015-05-12 19:01:40.883 UTC
null
562,769
null
1,669,442
null
1
34
python|class|return
237,308
<p>If what you want is a way to turn your class into kind of a list without subclassing <code>list</code>, then just make a method that returns a list:</p> <pre><code>def MyClass(): def __init__(self): self.value1 = 1 self.value2 = 2 def get_list(self): return [self.value1, self.value2...
12,162,657
Possible to print more than 100 rows of a data.table?
<p>The data.table has a nice feature that suppresses output to the head and tail of the table.</p> <p>Is it possible to view / print more than 100 rows at once?</p> <pre><code>library(data.table) ## Convert the ubiquitous "iris" data to a data.table dtIris = as.data.table(iris) ## Printing 100 rows is possible dtIris...
12,162,762
5
1
null
2012-08-28 15:31:50.347 UTC
11
2022-07-17 20:37:17.753 UTC
2022-07-17 20:37:17.753 UTC
null
1,161,484
null
573,778
null
1
51
r|printing|data.table|output-formatting
48,168
<p>The print method of <code>data.table</code> has an argument <code>nrows</code>:</p> <pre><code>args(data.table:::print.data.table) function (x, nrows = 100L, digits = NULL, ...) </code></pre> <p>You can use this to control how many rows get printed:</p> <pre><code>print(dtIris, nrow=105) ..... 99: 5.1 ...
12,125,880
changing default x range in histogram matplotlib
<p>I would like to change the default x range for the histogram plot. The range of the data is from 7 to 12. However, by default the histogram starts right at 7 and ends at 13. I want it to start at 6.5 and end at 12.5. However, the ticks should go from 7 to 12.How do I do it? </p> <pre><code>import asciitable import...
12,126,513
3
0
null
2012-08-25 21:42:57 UTC
9
2019-07-11 14:03:56.483 UTC
null
null
null
null
1,625,098
null
1
53
python|matplotlib|histogram|xrange
174,756
<pre><code>plt.hist(hmag, 30, range=[6.5, 12.5], facecolor='gray', align='mid') </code></pre>
3,592,212
Beginning Haskell - getting "not in scope: data constructor" error
<p>I'm going through the problems in the Haskell O'Reilly book. The problem I am working on is </p> <pre><code>Using the binary tree type that we defined earlier in this chapter, write a function that will determine the height of the tree. The height is the largest number of hops from the root to an Empty. For examp...
3,592,233
3
0
null
2010-08-28 19:56:14.567 UTC
5
2014-07-11 20:41:43.027 UTC
2011-06-20 16:22:11.487 UTC
null
329,700
null
329,700
null
1
22
haskell|scope
46,888
<p>Change</p> <pre><code>height (Tree node left right) </code></pre> <p>to</p> <pre><code>height (Node node left right) </code></pre> <p>That means the pattern matching works on the constructors of the <a href="http://en.wikipedia.org/wiki/Algebraic_data_type" rel="noreferrer">algebraic data type</a> (ADT). <code>...
22,845,574
How to dynamically do filtering in Java 8?
<p>I know in Java 8, I can do filtering like this :</p> <pre><code>List&lt;User&gt; olderUsers = users.stream().filter(u -&gt; u.age &gt; 30).collect(Collectors.toList()); </code></pre> <p>But what if I have a collection and half a dozen filtering criteria, and I want to test the combination of the criteria ?</p> <p...
22,855,465
2
5
null
2014-04-03 18:07:00.94 UTC
33
2014-04-08 00:17:47.477 UTC
2014-04-06 21:28:08.267 UTC
null
32,834
null
32,834
null
1
48
java|lambda|filtering|java-8
26,023
<p>Interesting problem. There are several things going on here. No doubt this could be solved in less than half a page of Haskell or Lisp, but this is Java, so here we go....</p> <p>One issue is that we have a variable number of filters, whereas most of the examples that have been shown illustrate fixed pipelines.</p>...
20,828,179
Angular unit-test controllers - mocking service inside controller
<p>I have the following situation:</p> <p><strong>controller.js</strong></p> <pre><code>controller('PublishersCtrl',['$scope','APIService','$timeout', function($scope,APIService,$timeout) { APIService.get_publisher_list().then(function(data){ }); })); </code></pre> <p><strong>controllerSpec.js</st...
20,830,042
1
3
null
2013-12-29 17:43:24.637 UTC
13
2016-07-21 17:11:18.93 UTC
2015-03-11 12:25:55.343 UTC
null
345,944
null
345,944
null
1
20
unit-testing|angularjs|karma-runner|karma-jasmine
27,603
<p>There are two ways (or more for sure).</p> <p>Imagining this kind of service (doesn't matter if it is a factory):</p> <pre><code>app.service('foo', function() { this.fn = function() { return &quot;Foo&quot;; }; }); </code></pre> <p>With this controller:</p> <pre><code>app.controller('MainCtrl', function($sco...
22,227,675
Why NuGet adds app.config with assemblyBinding to LIBRARY projects during a NuGet package update?
<p>Isn't this information necessary only in the executable's project?</p> <p>How to disable this file creation? </p> <p>NuGet 2.8</p> <p><strong>EDIT</strong></p> <p>Library projects were exceptions in NuGet 2.7, behavior changed in 2.8 by fixing this issue: <a href="http://nuget.codeplex.com/workitem/3827" rel="n...
22,228,738
3
5
null
2014-03-06 14:41:08.19 UTC
7
2020-04-23 18:22:02.333 UTC
2018-05-09 21:54:24.213 UTC
null
1,775,528
null
2,755,656
null
1
59
nuget
20,667
<p>Assembly binding redirects are as valid in a class library as they are in executable projects. </p> <p>Think about this; when building your application, how will the compiler know which version of referenced assemblies to use (for the class libraries)? </p> <p>Often this will work just fine, without the redirects,...
10,921,645
SSIS How to get part of a string by separator
<p>I need an SSIS expression to get the left part of a string before the separator, and then put the new string in a new column. I checked in derived column, it seems no such expressions. <code>Substring</code> could only return string part with fixed length. </p> <p>For example, with separator string <code>-</code> :...
10,929,122
4
1
null
2012-06-06 20:21:29.7 UTC
1
2019-03-24 20:27:57.987 UTC
2019-03-24 20:27:57.987 UTC
null
7,031,230
null
1,317,602
null
1
16
sql-server|ssis|expression|etl
79,929
<p>of course you can:</p> <p><img src="https://i.stack.imgur.com/iG6Tz.jpg" alt="enter image description here"></p> <p>just configure your derived columns like this:</p> <p><img src="https://i.stack.imgur.com/5QGAB.jpg" alt="enter image description here"></p> <p>Here is the expression to make your life easier:</p> ...
10,982,167
Find an XElement with a certain attribute name and value with LINQ
<pre><code>XDocument xDocument = XDocument.Load("..."); IEnumerable&lt;XElement&gt; elements = xDocument .Element("lfm") .Element("events") .Elements("event"); try { foreach (XElement elm in elements) { comm.Parameters.AddWithValue("extID", elm.Element("id").Value ?? ""); ...
10,982,276
2
2
null
2012-06-11 14:33:21.567 UTC
2
2017-10-02 12:43:07.657 UTC
2015-02-10 22:54:16.997 UTC
null
3,204,551
null
813,523
null
1
18
c#|xml|linq|xelement
45,496
<p>Try</p> <pre><code>XElement result = elm.Descendants("image") .FirstOrDefault(el =&gt; el.Attribute("size") != null &amp;&amp; el.Attribute("size").Value == "large"); if (result != null) { process result.Value ... } </code></pre> <p>Starting with C#6.0 (VS 2015), you can write:</p> ...
11,128,086
Simple Popularity Algorithm
<h2>Summary</h2> <p>As Ted Jaspers wisely pointed out, the methodology I described in the original proposal back in 2012 is actually a special case of an <a href="https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average" rel="nofollow noreferrer">exponential moving average</a>. The beauty of this approa...
51,670,966
5
2
null
2012-06-20 20:57:53.987 UTC
16
2019-09-10 07:15:17.6 UTC
2019-09-10 07:15:17.6 UTC
null
1,060,679
null
1,060,679
null
1
22
algorithm|popularity
11,594
<p>The proposed algorithm is a good approach, and is a special case of an <a href="https://en.wikipedia.org/wiki/Moving_average" rel="nofollow noreferrer">Exponential Moving Average</a> where alpha=0.5:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="sni...
10,949,730
Is it possible to for SQL Output clause to return a column not being inserted?
<p>I've made some modifications to my database and I need to migrate the old data to the new tables. For that, I need to fill a table (ReportOptions) taking the data from the original table (Practice), and fill a second intermediate table (PracticeReportOption).</p> <pre><code>ReportOption (ReportOptionId int PK, fiel...
10,950,418
2
2
null
2012-06-08 13:23:46.07 UTC
55
2020-01-19 01:15:42.14 UTC
2019-06-21 09:03:55.603 UTC
null
133
null
1,019,193
null
1
153
sql|sql-server
54,235
<p>You can do this by using <code>MERGE</code> instead of insert:</p> <p>so replace this</p> <pre><code>INSERT INTO ReportOption (field1, field2...) OUTPUT @ReportOption.PracticeId, --&gt; this is the field I don't know how to get inserted.ReportOptionId INTO @PracticeReportOption (PracticeId, ReportOptionId...
13,218,975
error mysql : Got a packet bigger than 'max_allowed_packet' bytes
<p>for import mysql database give me this error :</p> <pre><code>$ `mysql -u user -p password zxc_db &lt; zxc.sql` ERROR 1153 (08S01) at line 96: Got a packet bigger than 'max_allowed_packet' bytes </code></pre> <p>Please give me a best solution to solve it ? tanx .</p>
13,219,033
1
2
null
2012-11-04 13:33:56.393 UTC
2
2013-09-12 17:01:04.59 UTC
null
null
null
null
1,624,348
null
1
7
mysql|mysqldump|mysql-error-1064
40,252
<p>the best solution is " change mysql.cnf " debian : /etc/mysql/mysql.cnf change this line ==> <code>max_allowed_packet = 16M</code> to : <code>max_allowed_packet = 128M</code></p> <p>or add --max_allowed_packet=128M to your mysqldump command.</p> <pre><code>mysql --max_allowed_packet=128M -u user -ppass...
12,816,075
JavaFx GridPane - how to center elements
<p>I have a <code>GridPane</code> filled with 1-letter-labels.</p> <p>Here is an image:</p> <p><a href="https://i.stack.imgur.com/T5npB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T5npB.jpg" alt="image"></a> </p> <p>Here is the code:</p> <pre><code>int charSpacing = 1; int charsInWidth = 28; ...
12,816,318
3
0
null
2012-10-10 09:25:41.473 UTC
2
2019-08-25 13:24:46.67 UTC
2019-08-25 13:24:46.67 UTC
null
4,751,173
null
1,347,198
null
1
11
java|user-interface|positioning|javafx-2|gridpanel
56,311
<p>oh, that was easy. i did the alignment on the wrong place. adding this will do the job:</p> <pre><code>tmp[currArrPos].setAlignment(Pos.CENTER); </code></pre> <p>thanks anyway.</p>
13,050,003
Apply function to pandas DataFrame that can return multiple rows
<p>I am trying to transform DataFrame, such that some of the rows will be replicated a given number of times. For example:</p> <pre><code>df = pd.DataFrame({'class': ['A', 'B', 'C'], 'count':[1,0,2]}) class count 0 A 1 1 B 0 2 C 2 </code></pre> <p>should be transformed to:</p> <pre><co...
13,052,373
4
2
null
2012-10-24 13:14:11.267 UTC
9
2020-01-01 12:55:13.99 UTC
2019-01-04 11:05:12 UTC
null
4,909,087
null
74,342
null
1
21
python|pandas|dataframe
21,001
<p>You could use groupby:</p> <pre><code>def f(group): row = group.irow(0) return DataFrame({'class': [row['class']] * row['count']}) df.groupby('class', group_keys=False).apply(f) </code></pre> <p>so you get</p> <pre><code>In [25]: df.groupby('class', group_keys=False).apply(f) Out[25]: class 0 A 0 ...
13,082,149
In Xcode project target build settings, What is Mach-O Type?
<p>After getting tired of numerous Match-O linker error, I want to know that this thing means. Instead of trial and error solution, I would like to know the concept behind these things. Specifically I want to know the difference between :</p> <ol> <li>Executable</li> <li>Dynamic Library</li> <li>Bundle</li> <li>Static...
13,082,437
2
1
null
2012-10-26 06:50:58.953 UTC
13
2019-09-01 08:55:58.507 UTC
null
null
null
null
341,800
null
1
34
objective-c|ios|xcode|linker|llvm
17,353
<p><a href="http://en.wikipedia.org/wiki/Mach-O" rel="noreferrer">Mach-O</a>, short for Mach object file format, is a file format for executables, object code, shared libraries, dynamically-loaded code, and core dumps. For unix users this is like <code>a.out</code> but with improvements. This is the format used in Mac ...
12,758,088
Installer and Updater for a python desktop application
<p>I am building a desktop app with python and packaging it to an exe with Pyinstaller. I would like to ship my application with an installer and also provide automatic and silent updates to the software like Google Chrome, Dropbox or Github for Windows does.</p> <p>I have found the following software to be able to do...
12,823,983
4
4
null
2012-10-06 08:25:06.157 UTC
18
2015-07-18 03:41:21.073 UTC
2012-10-06 10:20:11.403 UTC
null
19,929
null
19,929
null
1
39
python|windows|nsis|auto-update|pyinstaller
10,770
<p>There is a suite of tools from the cloudmatrix guys that addresses that problem. </p> <p><a href="http://pypi.python.org/pypi/esky">esky</a> is an auto-update framework for frozen apps that is compatible with the common python "packaging" frameworks. <a href="http://pypi.python.org/pypi/signedimp/0.3.2">signedimp</...
12,765,833
Counting the number of True Booleans in a Python List
<p>I have a list of Booleans:</p> <pre><code>[True, True, False, False, False, True] </code></pre> <p>and I am looking for a way to count the number of <code>True</code> in the list (so in the example above, I want the return to be <code>3</code>.) I have found examples of looking for the number of occurrences of sp...
12,765,840
8
0
null
2012-10-07 03:12:41.943 UTC
15
2020-04-13 04:10:18.637 UTC
2015-06-01 11:23:16.853 UTC
null
1,173,112
null
1,702,140
null
1
187
python|list|boolean|counting
208,429
<p><code>True</code> is equal to <code>1</code>.</p> <pre><code>&gt;&gt;&gt; sum([True, True, False, False, False, True]) 3 </code></pre>
16,638,813
javax.security.auth.login.LoginException: No LoginModules configured for SomeLogin
<p>Well I'm trying to create JAAS authentication for my Servlet (running on Tomcat 7 in Eclipse), but I'm getting this error.</p> <p>He're's the complete stack trace: '`</p> <pre><code>INFO: Starting Servlet Engine: Apache Tomcat/7.0.32 Geg 19, 2013 9:53:08 PM org.apache.coyote.AbstractProtocol start INFO: Starting P...
16,643,919
4
2
null
2013-05-19 19:53:30.097 UTC
1
2015-07-28 19:47:51.637 UTC
2013-05-20 10:07:35.057 UTC
null
1,281,120
null
1,281,120
null
1
19
java|eclipse|authentication|tomcat|jaas
70,819
<p>According to <a href="http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html#JAASRealm">http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html#JAASRealm</a></p> <p>You should set up a login.config file for Java and tell Tomcat where to find it by specifying its location to the JVM, for instance by setting the e...
10,083,399
Change iframe attribute with jquery
<p>I have something like so:</p> <pre><code> &lt;iframe id="frame" width="200" height="150" src="http://www.youtube.com/embed/GiZGEFBGgKU?rel=0&amp; amp&amp;iv_load_policy=3;autoplay=1" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt; </code></pre> <p>And I want to change the width and height using jque...
10,083,740
5
0
null
2012-04-10 05:14:52.157 UTC
2
2018-04-04 21:25:20.143 UTC
null
null
null
null
984,734
null
1
13
javascript|jquery
42,590
<p>As Sarfraz already pointed out, the correct way to set the attribute for a jquery selector object is by using the <code>attr("attrName", "attrVal")</code>. The reason the <code>setAttribute</code> didn't work is something worth explaining, as I've hit my head against this point on more than one occasion:</p> <p>Wh...
10,242,766
atos and dwarfdump won't symbolicate my address
<p>I received a crash report via AirBrake.io that isn't symbolicated. Since the crash report is not in exactly the same format as an Apple crashlog I can't just drop it on XCode as usual, so I took the exact same build from my XCode archive tried to symbolicate it on the commandline. With the following result:</p> <pr...
10,280,230
6
0
null
2012-04-20 08:30:16.257 UTC
24
2018-04-11 12:44:22.6 UTC
null
null
null
null
586,489
null
1
14
ios|ipad|dwarf|symbolicate|airbrake
15,555
<p>First of all check if the dSYM is really the correct one for that app:</p> <pre><code>dwarfdump --uuid kidsapp.app/kidsapp dwarfdump --uuid kidsapp.app.dSYM </code></pre> <p>Both should return the same result.</p> <p>Next check if the dSYM has any valid content</p> <pre><code>dwarfdump --all kidsapp.app.dSYM </c...
9,717,159
Get iOS iTunes App Store ID of an app itself?
<p>Could an iOS app get the iTunes link of itself? Is there an API for this?</p>
11,626,157
3
2
null
2012-03-15 09:39:57.06 UTC
15
2020-08-07 10:16:44.03 UTC
2020-08-07 10:16:44.03 UTC
null
41,948
null
41,948
null
1
26
ios|api|app-store|itunes
48,793
<p>Here is the answer.</p> <ol> <li>The app requests <a href="http://itunes.apple.com/lookup?bundleId=com.clickgamer.AngryBirds" rel="noreferrer">http://itunes.apple.com/lookup?bundleId=com.clickgamer.AngryBirds</a></li> <li>Find the <code>"version": "2.1.0"</code> and <code>"trackId": 343200656</code> in the JSON res...
9,959,928
Double quotes vs single quotes in JavaScript
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/242813/when-to-use-double-or-single-quotes-in-javascript">When to Use Double or Single Quotes in JavaScript</a><br> <a href="https://stackoverflow.com/questions/8974026/are-there-differences-between-and">Are ther...
9,959,952
4
0
null
2012-03-31 21:39:31.287 UTC
5
2017-05-01 16:00:52.69 UTC
2017-05-23 10:31:39.507 UTC
null
-1
null
336,423
null
1
41
javascript|syntax|semantics
40,336
<p>The difference is that you don't need to escape single quotes in double quotes, or double quotes in single quotes. That is the only difference, if you do not count the fact that you must hold the Shift key to type <code>"</code>.</p>
9,766,608
zipWith analogue in Python?
<p>What is the analogue of Haskell's <a href="http://hackage.haskell.org/packages/archive/base/latest/doc/html/Prelude.html#v:zipWith" rel="noreferrer">zipWith</a> function in Python?</p> <pre><code>zipWith :: (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c] </code></pre>
9,766,647
6
2
null
2012-03-19 07:48:12.057 UTC
8
2017-08-24 20:54:56.943 UTC
2012-03-19 08:23:44.61 UTC
null
989,121
null
784,533
null
1
55
python|haskell
14,950
<p>You can create yours, if you wish, but in Python we mostly do </p> <pre><code>list_c = [ f(a,b) for (a,b) in zip(list_a,list_b) ] </code></pre> <p>as Python is not inherently functional. It just happens to support a few convenience idioms. </p>
9,682,206
Groovy different results on using equals() and == on a GStringImpl
<p>According to the <a href="http://groovy-lang.org/style-guide.html#_equals_and_code_code" rel="nofollow noreferrer">Groovy docs</a>, the <code>==</code> is just a &quot;clever&quot; <code>equals()</code> as it also takes care of avoiding <code>NullPointerException</code>:</p> <blockquote> <p>Java’s <code>==</code> is...
9,682,610
3
0
null
2012-03-13 10:24:03.913 UTC
9
2022-03-31 14:18:15.823 UTC
2021-02-10 21:52:26.477 UTC
null
1,108,305
null
849,775
null
1
62
groovy|operator-overloading|equals|gstring
58,266
<p>Nice question, the surprising thing about the code above is that</p> <pre><code>println "${'test'}".equals('test') </code></pre> <p>returns <code>false</code>. The other line of code returns the expected result, so let's forget about that.</p> <h2>Summary</h2> <pre><code>"${'test'}".equals('test') </code></pre> ...
9,909,086
Multiply TimeSpan in .NET
<p>How do I multiply a TimeSpan object in C#? Assuming the variable <code>duration</code> is a <a href="http://msdn.microsoft.com/en-us/library/system.timespan.aspx" rel="noreferrer">TimeSpan</a>, I would like, for example</p> <pre><code>duration*5 </code></pre> <p>But that gives me an error "operator * cannot be app...
9,909,126
9
0
null
2012-03-28 13:59:53.667 UTC
6
2021-12-22 20:55:51.547 UTC
2013-01-11 16:36:37.927 UTC
null
284,795
null
284,795
null
1
95
c#|.net|date|time|timespan
29,408
<p><a href="http://www.blackwasp.co.uk/TimespanMultiplication.aspx">From this article</a></p> <pre><code>TimeSpan duration = TimeSpan.FromMinutes(1); duration = TimeSpan.FromTicks(duration.Ticks * 12); Console.WriteLine(duration); </code></pre>
7,821,361
How to write Pagination logic?
<p>Can anyone provide some idea/logic to write the pagination logic for the search page i am working on? The information i have is <strong>total number of pages</strong> for that search- <strong>10 records per page</strong> also i am been sent the both the previous and next page number(no problem writing the logic all...
7,822,000
3
5
null
2011-10-19 12:33:18.18 UTC
12
2017-04-05 04:11:29.07 UTC
2011-10-19 12:46:19.667 UTC
null
724,238
null
724,238
null
1
8
java|pagination|velocity
71,823
<p>Here is how I would implement it: It is generally a good idea to create a Filter class that filters data and contains pagination related information for you. I use something like this:</p> <pre><code>public abstract class Filter{ /** Member identifier for the current page number */ private int currentPag...
11,648,748
Mount Android emulator images
<p>I am trying to analyse Android malware on an emulator with Android 2.1. I want to analyze the files permissions and fingerprints after the execution of the suspicious app. I know, I can use the <code>adb shell</code> to get this information, but I think I can't trust the information after the execution of e.g. a roo...
12,282,909
3
0
null
2012-07-25 11:31:17.957 UTC
9
2021-03-22 15:07:00.11 UTC
2021-03-22 14:09:47.527 UTC
null
340,175
null
1,136,474
null
1
15
android|image|emulation|mount
21,730
<p>You've already answered your own question but I'll expand a bit. The Android sdk comes with system images, for example:</p> <pre><code>$ cd android-sdk-linux/system-images/android-15/armeabi-v7a/ $ ls *.img ramdisk.img system.img userdata.img $ cd ~/.android/avd/&lt;img name&gt;.avd/ $ ls *.img cache.img sdcard...
11,487,646
Intellij Idea does not find my android device
<p>Hi I want to do some test app that uses sound recording, but it doesn't work in the emulator. I need to test it on my phone but every time I change the option to use USB, it never detects my Wildfire S ... which is connected and in USB debugging mode.</p> <p>It says "No USB Device Found".</p> <p>Using 11.1.2</p> ...
11,488,139
8
2
null
2012-07-14 21:51:28.713 UTC
1
2020-05-29 14:38:22.593 UTC
null
null
null
null
966,823
null
1
17
android|debugging|intellij-idea|adb
51,285
<p>Problem was solved by installing HTC Sync it installed the correct driver and allowed me to detect the device.</p>
11,979,156
Mobile Safari back button
<p>The issue I've found is very similar to <a href="https://stackoverflow.com/questions/24046/the-safari-back-button-problem">this question</a>, except that Safari on desktops seems to have resolved the issue. Essentially, the issue is this: when a client is browsing on mobile safari and the page executes a javascript ...
12,652,160
1
1
null
2012-08-16 00:32:29.697 UTC
21
2020-06-29 12:39:42.343 UTC
2020-06-29 12:39:42.343 UTC
null
619,978
null
1,124,703
null
1
37
javascript|safari
34,205
<p>This is caused by <a href="https://developer.mozilla.org/en-US/docs/Using_Firefox_1.5_caching" rel="noreferrer">back-forward cache</a>. It is supposed to save complete state of page when user navigates away. When user navigates back with back button page can be loaded from cache very quickly. This is different from ...
11,865,195
Using If/Else on a data frame
<p>I have a data set which looks something like</p> <pre><code>data&lt;-c(0,1,2,3,4,2,3,1,4,3,2,4,0,1,2,0,2,1,2,0,4) frame&lt;-as.data.frame(data) </code></pre> <p>I now want to create a new variable within this data frame. If the column "data" reports a number of 2 or more, I want it to have "2" in that row, and if ...
11,865,283
2
1
null
2012-08-08 13:07:37.233 UTC
12
2018-07-26 10:42:27.353 UTC
2017-05-23 12:34:24.807 UTC
null
-1
null
1,545,812
null
1
40
r
151,927
<p>Use <code>ifelse</code>:</p> <pre><code>frame$twohouses &lt;- ifelse(frame$data&gt;=2, 2, 1) frame data twohouses 1 0 1 2 1 1 3 2 2 4 3 2 5 4 2 ... 16 0 1 17 2 2 18 1 1 19 2 2 20 0 1 21 4 ...
11,523,918
Start a Function at Given Time
<p>How can I run a function in <em>Python</em>, at a given time?</p> <p>For example:</p> <pre><code>run_it_at(func, '2012-07-17 15:50:00') </code></pre> <p>and it will run the function <code>func</code> at 2012-07-17 15:50:00.</p> <p>I tried the <a href="http://docs.python.org/library/sched.html#scheduler-objects" ...
11,524,152
9
5
null
2012-07-17 13:49:25.277 UTC
29
2022-01-29 23:01:27.477 UTC
2022-01-29 23:01:27.477 UTC
null
3,750,257
null
685,395
null
1
53
python|time|scheduler
115,322
<p>Reading the docs from <a href="http://docs.python.org/py3k/library/sched.html" rel="noreferrer">http://docs.python.org/py3k/library/sched.html</a>:</p> <p>Going from that we need to work out a delay (in seconds)...</p> <pre><code>from datetime import datetime now = datetime.now() </code></pre> <p>Then use <code>d...
20,242,841
How to resolve java net ConnectException Connection refused connect even server is up
<p>I am using Httpurlconnection to send request from my jboss server to my device. The Device has been build up by cgi. </p> <p>When server sends request from multiple thread at a time to device, some thread got an exception as java.net.ConnectException: Connection refused. but the device is sending response to serve...
20,243,258
1
3
null
2013-11-27 12:42:50.27 UTC
1
2013-11-27 13:23:06.973 UTC
2013-11-27 12:54:34.09 UTC
null
2,902,100
null
2,902,100
null
1
2
java|sockets|httpurlconnection
39,372
<p>If a single thread connects fine, <em>every time</em>, but some threads running concurrently get this exception, then this is most likely due to a limited number of connections available. Can you change how many concurrent connections are available on the device? If not, then you can try limiting the number of thr...
20,292,692
Installing USB driver for Nexus 4 (with KitKat) on Windows 8 64-bit - "no compatible software driver"
<p>I'm desperately trying to install ADB USB drivers for my Nexus 4, which (as you might know) are required for any form of Android Development. You could also say, that they are the single most necessary tool used for Android programming, right? I have already often set up an Android Development Environment for my old...
27,651,449
2
8
null
2013-11-29 20:05:06.343 UTC
1
2015-02-17 20:21:05.663 UTC
2014-12-17 02:28:48.63 UTC
null
2,581,872
null
1,411,171
null
1
16
android|windows-8|windows-8.1|android-4.4-kitkat|nexus-4
63,882
<p>Enable Debug-Mode on the device. </p> <p><strong>Steps to enable debug mode:</strong> </p> <p>Before you do anything in order to develop on a Nexus 4 (at least in my experience), do the following: </p> <ul> <li>Open <strong>Settings</strong> App</li> <li>Navigate to <strong>About Phone</strong></li> <li>click <s...
3,421,469
How to test scientific software?
<p>I'm convinced that software testing indeed is very important, especially in science. However, over the last 6 years, I never have come across any scientific software project which was under regular tests (and most of them were not even version controlled). </p> <p>Now I'm wondering how you deal with software tests ...
3,421,596
4
2
null
2010-08-06 06:30:06.843 UTC
22
2019-10-04 09:41:17.457 UTC
2017-10-05 21:52:09.77 UTC
null
3,924,118
null
383,239
null
1
37
unit-testing|testing|scientific-computing
3,800
<p>I am also in academia and I have written quantum mechanical simulation programs to be executed on our cluster. I made the same observation regarding testing or even version control. I was even worse: in my case I am using a C++ library for my simulations and the code I got from others was pure spaghetti code, no inh...
3,705,591
Do I encode ampersands in <a href...>?
<p>I'm writing code that automatically generates HTML, and I want it to encode things properly.</p> <p>Say I'm generating a link to the following URL:</p> <pre><code>http://www.google.com/search?rls=en&amp;q=stack+overflow </code></pre> <p>I'm assuming that all attribute values should be HTML-encoded. (Please correc...
3,705,601
4
4
null
2010-09-14 01:36:43.09 UTC
26
2021-11-10 02:41:23.447 UTC
null
null
null
null
4,321
null
1
174
html
66,128
<p>Yes, it is. HTML entities are parsed inside HTML attributes, and a stray <code>&amp;</code> would create an ambiguity. That's why you should always write <code>&amp;amp;</code> instead of just <code>&amp;</code> inside <strong>all</strong> HTML attributes.</p> <p>That said, only <code>&amp;</code> and quotes <em>nee...
3,557,780
Add string to char array in C
<p>I have a C array called buf. Here is it's definition:</p> <p><code>char buf[1024];</code></p> <p>Now, my current code takes from <code>stdin</code> and uses <code>fgets()</code> to set that array, however I wish to use code to set it instead. Right now the line that sets buf looks like this:</p> <p><code>fgets(bu...
3,557,791
5
0
null
2010-08-24 14:54:17.453 UTC
4
2010-08-24 17:06:24.677 UTC
null
null
null
null
231,721
null
1
2
c|arrays|string|char|fgets
50,437
<p>Look for <code>sprintf</code>, for example here: <a href="http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/" rel="noreferrer">Cpp reference</a></p> <p>Edit:</p> <pre><code>sprintf(buf, "My string with args %d", (long) my_double_variable); </code></pre> <p>Edit 2:</p> <p>As suggested to avoid overflow (...
3,546,186
TINYINT vs ENUM(0, 1) for boolean values in MySQL
<p>Which one is better, Tinyint with 0 and 1 values or ENUM 0,1 in MyISAM tables and MySQL 5.1?</p>
3,546,296
5
1
null
2010-08-23 09:19:31.667 UTC
5
2019-12-30 08:30:50.82 UTC
2011-10-19 03:52:04.163 UTC
null
135,152
null
396,472
null
1
30
php|mysql|enums|tinyint
27,679
<p>You can use <code>BIT(1)</code> as mentioned in <a href="http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html" rel="noreferrer">mysql 5.1 reference</a>. i will not recommend <code>enum</code> or <code>tinyint(1)</code> as <code>bit(1)</code> needs only 1 bit for storing boolean value while <code>tinyint...
3,348,881
Offset viewable image in <img> tags the same way as for background-image
<p>Using plain &lt;img&gt; tags is it possible to offset the image in the same way as you can with CSS background-image and background-position?</p> <p>There are main images on the page and it makes little sense to have separate thumbnails when both will be loaded (thus increasing bandwidth). Some of the images are po...
57,960,751
5
0
null
2010-07-27 23:50:59.79 UTC
6
2019-09-16 16:11:48.65 UTC
2010-07-28 00:09:09.92 UTC
null
30,618
null
179,454
null
1
32
html|css
52,565
<p>This is an old question, but it was the first one that came up when I googled the question, so I thought I would mention the answer that, in my opinion, actually solves the original problem how to emulate <code>background-position</code> attribute. The answer I found is to use CSS attributes <code>object-position</c...
3,247,173
Can I see if a timer is still running?
<p>Simple question here that I can't seem to find an answer for: Once a <code>setTimeout</code> is set, is there any way to see if it's still, well, set?</p> <pre><code>if (!Timer) { Timer = setTimeout(DoThis,60000); } </code></pre> <p>From what I can tell, when you <code>clearTimeout</code>, the variable remains...
3,247,245
6
0
null
2010-07-14 14:32:47.93 UTC
10
2019-09-25 11:27:43.603 UTC
null
null
null
null
362,520
null
1
85
javascript|settimeout
113,305
<p>There isn't anyway to interact with the timer except to start it or stop it. I typically null the timer variable in the timeout handler rather than use a flag to indicate that the timer isn't running. There's a nice description on <a href="http://www.w3schools.com/js/js_timing.asp" rel="noreferrer">W3Schools</a> a...
3,623,739
Locate Git installation folder on Mac OS X
<p>I'm just curious, Where Git get installed (via DMG) on Mac OS X file system?</p>
7,089,778
11
3
null
2010-09-02 04:04:16.273 UTC
35
2020-10-09 14:29:01.147 UTC
null
null
null
null
394,868
null
1
124
git|macos
192,218
<p>The installer from <a href="http://git-scm.com/" rel="noreferrer">the git homepage</a> installs into <strong>/usr/local/git</strong> by default. See also <a href="https://stackoverflow.com/questions/4725389/how-to-get-started-with-git-on-mac/4725627#4725627" title="this answer">this answer</a>. However, if you insta...
3,547,388
PHP Swift mailer: Failed to authenticate on SMTP using 2 possible authenticators
<p>When I send an email with the PHP Swift mailer to this server: smtp.exchange.example.com like this:</p> <pre><code>// Load transport $this-&gt;transport = Swift_SmtpTransport::newInstance( self::$config-&gt;hostname, self::$config-&gt;port ) -&gt;setUsername(self::$config-&gt;username) ...
3,565,698
13
1
null
2010-08-23 12:14:06.703 UTC
7
2021-06-09 13:27:58.213 UTC
2013-12-27 16:10:07.707 UTC
null
367,456
null
219,434
null
1
25
php|authentication|smtp|swiftmailer
113,663
<p>Strange enough sending emails works again. We did not change anything and the host say they did not either. We think a server restarts or so. It is strange :S</p>
3,755,136
Pythonic way to check if a list is sorted or not
<p>Is there a pythonic way to check if a list is already sorted in <code>ASC</code> or <code>DESC</code></p> <pre><code>listtimestamps = [1, 2, 3, 5, 6, 7] </code></pre> <p>something like <code>isttimestamps.isSorted()</code> that returns <code>True</code> or <code>False</code>.</p> <p>I want to input a list of time...
3,755,251
27
0
null
2010-09-20 20:15:14.093 UTC
40
2022-07-17 08:15:39.19 UTC
2017-01-21 12:44:58.713 UTC
null
3,924,118
null
225,260
null
1
181
python|algorithm|list|sorting
157,380
<p>Here is a one liner:</p> <pre><code>all(l[i] &lt;= l[i+1] for i in range(len(l) - 1)) </code></pre> <p>If using Python 2, use <code>xrange</code> instead of <code>range</code>.</p> <p>For <code>reverse=True</code>, use <code>&gt;=</code> instead of <code>&lt;=</code>.</p>
7,865,654
Printing an array of characters
<p>I have an array of characters declared as:</p> <pre><code>char *array[size]; </code></pre> <p>When I perform a</p> <pre><code>printf("%s", array); </code></pre> <p>it gives me some garbage characters, why it is so?</p> <p><a href="http://www.cplusplus.com/reference/clibrary/cstdio/printf/" rel="noreferrer">http...
7,865,664
4
1
null
2011-10-23 10:43:24.807 UTC
null
2022-05-11 14:59:01.167 UTC
2022-05-11 14:59:01.167 UTC
null
5,784,757
null
247,814
null
1
6
c|c-strings
60,193
<p>Your array is not initialized, and also you have an array of pointers, instead of an array of char's. It should be <code>char* array = (char*)malloc(sizeof(char)*size);</code>, if you want an array of char's. Now you have a pointer to the first element of the array.</p>
8,078,892
Stop saving photos using Android native camera
<p>I am using native Android camera and save file to my application data folder (/mnt/sdcard/Android/data/com.company.app/files/Pictures/). At the same time anther copy of photo is saved to DCIM folder. </p> <p>This is my code:</p> <pre><code>Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); String formatt...
8,079,078
5
1
null
2011-11-10 11:36:28.113 UTC
12
2018-08-08 16:21:56.637 UTC
2011-11-10 14:24:48.013 UTC
null
776,234
null
776,234
null
1
13
android|native|android-camera|android-sdcard|android-camera-intent
16,398
<p>check this code.. </p> <pre><code>private void FillPhotoList() { // initialize the list! GalleryList.clear(); String[] projection = { MediaStore.Images.ImageColumns.DISPLAY_NAME }; for(int i=0;i&lt;projection.length;i++) Log.i("InfoLog","projection "+projection[0].toString()); ...
8,186,965
What do numbers using 0x notation mean?
<p>What does a <code>0x</code> prefix on a number mean?</p> <pre><code>const int shared_segment_size = 0x6400; </code></pre> <p>It's from a C program. I can't recall what it amounts to and particularly what the letter <code>x</code> means.</p>
8,186,974
5
3
null
2011-11-18 18:09:33.89 UTC
44
2020-05-16 21:35:11.697 UTC
2019-01-16 07:50:45.86 UTC
null
1,364,007
null
761,330
null
1
154
c|integer|hex|notation
160,294
<p>Literals that start with <code>0x</code> are hexadecimal integers. (base 16)</p> <p>The number <code>0x6400</code> is <code>25600</code>.</p> <pre><code>6 * 16^3 + 4 * 16^2 = 25600 </code></pre> <p>For an example including letters (also used in hexadecimal notation where A = 10, B = 11 ... F = 15)</p> <p>The num...
7,713,274
Java Immutable Collections
<p>From <a href="http://download.oracle.com/javase/6/docs/technotes/guides/collections/overview.html" rel="noreferrer">Java 1.6 Collection Framework documentation</a>:</p> <blockquote> <p>Collections that do not support any modification operations (such as <code>add</code>, <code>remove</code> and <code>clear</code>...
7,713,332
7
1
null
2011-10-10 13:12:41.683 UTC
42
2021-09-15 10:07:26.49 UTC
2020-03-16 06:37:44.767 UTC
null
757,695
null
311,455
null
1
126
java|collections|immutability
191,658
<p>Unmodifiable collections are usually read-only views (wrappers) of other collections. You can't add, remove or clear them, but the underlying collection can change.</p> <p>Immutable collections can't be changed at all - they don't wrap another collection - they have their own elements.</p> <p>Here's a quote from g...
7,921,840
OS X Cocoa Auto Layout hidden elements
<p>I am trying to use the new <a href="http://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AutolayoutPG/Articles/Introduction.html" rel="noreferrer">Auto Layout</a> in Lion because it seems quite nice. But I can not find good information about how to do things. For example:</p> <p>I have two...
9,429,379
8
2
null
2011-10-27 20:19:05.377 UTC
10
2018-07-17 04:20:22.447 UTC
null
null
null
null
63,779
null
1
29
macos|cocoa|osx-lion
7,537
<p>I don't think you could do it that way. If you made the layout for label 2 be based on a distance constraint from label 1, even if you made label 1 auto-collapse to zero height when it has no content, label 2 is still going to be that distance down, ie in:</p> <pre><code>+----------------+ | +------------+ | | + la...
4,132,044
Name database design notation you prefer and why?
<p>Which notation<strike>, methodology </strike> and tools for database designing, modeling, diagraming you prefer and why? Which notation, standards<strike>, methodology</strike> are the most broadly used and covered by different vendors?</p> <p>Which are standard and which are not? i.e. which are to stick with and wh...
4,140,309
3
5
null
2010-11-09 09:16:49.827 UTC
13
2021-08-18 22:56:37.847 UTC
2021-08-15 22:59:07.763 UTC
null
472,495
null
200,449
null
1
10
sql|database|language-agnostic|database-design|standards
5,448
<h2>Extended 11 Dec 10</h2> <p><strong>What does the question mean ?</strong></p> <p>Before answering the &quot;notation&quot; question, which is the small visible issue on the surface, we need to understand the issues that underpin it, which lead to the surface issues. Otherwise the relevance to the question is reduc...
4,576,271
Monopoly game in OOD?
<p>I found this interesting blog post via CodingHorror: <a href="http://weblog.raganwald.com/2006/06/my-favourite-interview-question.html">My Favorite Interview Question</a>. In a nutshell, he talks about the object-oriented design challenges of designing the game of Monopoly, with an emphasis on how to model the rules...
4,809,377
3
0
null
2011-01-01 23:19:31.93 UTC
23
2011-01-28 23:35:12.283 UTC
2011-01-26 21:47:54.227 UTC
null
90,723
null
195,578
null
1
24
oop|design-patterns|architecture
10,634
<p>Here's how I would design Monopoly. I've taken the liberty of assuming a dynamically-typed language since that makes everything easier. Ruby specifically.</p> <p>You have a simple <code>Game</code> object that's mostly a wrapper around an <code>Array</code> of size 40, plus some convenience methods. The <code>Ga...
4,463,035
How to force google closure compiler to keep "use strict"; in the compiled js code?
<p>If you're using the module pattern and have something like this:</p> <pre><code>(function () { "use strict"; // this function is strict... }()); </code></pre> <p>and compile the code using the Google Closure Compiler, the <code>"use strict";</code> directive will not make it into the compiled file.</p> <p>S...
4,582,220
5
0
null
2010-12-16 16:32:50.797 UTC
9
2019-07-30 20:46:52.66 UTC
null
null
null
null
86,302
null
1
32
javascript|google-closure|google-closure-compiler|ecmascript-5
8,664
<p>This isn't the greatest answer, but as far as I can tell this is a known issue or "feature" (depending on your perspective) of closure compiler. Here's a <a href="http://code.google.com/p/closure-compiler/issues/detail?id=69" rel="noreferrer">partial explanation</a> of some of the problems involved. A couple mention...
4,454,444
C++ libraries that implement Go goroutines or Go channels?
<p>I'm working with a medium-sized C++ code base which is currently entirely single-threaded. The time has come, however, to pursue concurrency and parallelism for performance gains. I'm very interested in the concurrency model of Google's Go programming language, with very lightweight goroutines and a system of commun...
4,455,814
6
4
null
2010-12-15 20:16:43.383 UTC
13
2022-01-20 06:07:22.71 UTC
2010-12-15 21:18:39 UTC
null
298,036
null
298,036
null
1
29
c++|concurrency|go
13,150
<p>If your aim is primarily speeding up compute things, Intel's <a href="https://www.threadingbuildingblocks.org/documentation/" rel="nofollow noreferrer">TBB</a> (Threading Building Blocks) is (IMHO) a better option than rolling your own inferior version from <code>boost::thread</code>.</p>
4,560,288
Python try/except: Showing the cause of the error after displaying my variables
<p>I'm not even sure what the right words are to search for. I want to display parts of the error object in an except block (similar to the err object in VBScript, which has Err.Number and Err.Description). For example, I want to show the values of my variables, then show the exact error. Clearly, I am causing a divi...
4,560,341
7
0
null
2010-12-30 05:43:26.963 UTC
15
2020-11-14 00:37:03.033 UTC
2015-08-18 09:27:58.087 UTC
null
3,001,761
null
160,245
null
1
44
python|exception-handling
85,799
<pre><code>try: 1 / 0 except Exception as e: print(e) </code></pre>
4,080,611
#1025 - Error on rename of './database/#sql-2e0f_1254ba7' to './database/table' (errno: 150)
<p>So I am trying to add a primary key to one of the tables in my database. Right now it has a primary key like this:</p> <pre><code>PRIMARY KEY (user_id, round_number) </code></pre> <p>Where user_id is a foreign key.</p> <p>I am trying to change it to this:</p> <pre><code>PRIMARY KEY (user_id, round_number, create...
4,081,101
7
1
null
2010-11-02 17:55:17.963 UTC
24
2018-07-01 19:28:34.863 UTC
2011-04-30 17:29:46.803 UTC
null
135,152
null
95,944
null
1
84
mysql|sql|phpmyadmin|innodb|mysql-error-1025
106,589
<p>There is probably another table with a foreign key referencing the primary key you are trying to change.</p> <p>To find out which table caused the error you can run <code>SHOW ENGINE INNODB STATUS</code> and then look at the <code>LATEST FOREIGN KEY ERROR</code> section.</p>
4,191,653
I want to restore the database with a different schema
<p>I have taken a dump of a database named <code>temp1</code>, by using the follwing command </p> <pre><code>$ pg_dump -i -h localhost -U postgres -F c -b -v -f pub.backup temp1 </code></pre> <p>Now I want to restore the dump in a different database called "db_temp" , but in that I just want that all the tables sh...
4,194,781
8
9
null
2010-11-16 06:20:18.277 UTC
22
2022-03-11 09:38:25.29 UTC
2018-03-22 06:53:44.24 UTC
null
263,268
null
283,501
null
1
83
postgresql|pg-dump|pg-restore
81,675
<p>There's no way in pg_restore itself. What you can do is use pg_restore to generate SQL output, and then send this through for example a sed script to change it. You need to be careful about how you write that sed script though, so it doesn't match and change things inside your data.</p>
4,224,476
Float:right reverses order of spans
<p>I have the HTML:</p> <pre><code>&lt;div&gt; &lt;span class="label"&gt;&lt;a href="/index/1"&gt;Bookmix Offline&lt;/a&gt;&lt;/span&gt; &lt;span class="button"&gt;&lt;a href="/settings/"&gt;Settings&lt;/a&gt;&lt;/span&gt; &lt;span class="button"&gt;&lt;a href="/export_all/"&gt;Export&lt;/a&gt;&lt;/span&gt...
4,224,500
16
2
null
2010-11-19 11:22:50.547 UTC
15
2019-09-21 13:41:08.003 UTC
2016-07-29 18:31:29.473 UTC
null
3,474,146
null
205,270
null
1
62
css
96,800
<p>The general solution to this problem is either to reverse the order of the right floated elements in the HTML, or wrap them in a containing element and float that to the right instead.</p>
14,819,994
get basic SQL Server table structure information
<p>I can get the number of columns in an SQL Server database with this:</p> <pre><code>SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'Address' </code></pre> <p>But is there any way (for an unknown number of columns) I can get the name and datatype and length of each column?</p>
14,820,046
6
7
null
2013-02-11 20:10:06.167 UTC
7
2018-07-06 11:51:51.237 UTC
2013-02-11 20:22:44.217 UTC
null
76,337
null
1,252,748
null
1
28
sql|sql-server
145,549
<p>Instead of using <code>count(*)</code> you can <code>SELECT *</code> and you will return all of the details that you want including <code>data_type</code>:</p> <pre><code>SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'Address' </code></pre> <p>MSDN Docs on <a href="http://msdn.microsoft.com/en-us/lib...
14,838,184
Error: $digest already in progress
<p>I'm getting this error while trying to call </p> <pre><code> function MyCtrl1($scope, $location, $rootScope) { $scope.$on('$locationChangeStart', function (event, next, current) { event.preventDefault(); var answer = confirm("Are you sure you want to leave this page?"); if (answ...
14,838,239
5
1
null
2013-02-12 17:23:57.477 UTC
11
2016-11-18 20:35:44.77 UTC
2013-02-12 17:29:42.113 UTC
null
1,426,157
null
1,426,157
null
1
32
javascript|angularjs|angularjs-directive
71,348
<p><strong>Duplicated: <a href="https://stackoverflow.com/questions/12729122/prevent-error-digest-already-in-progress-when-calling-scope-apply">Prevent error $digest already in progress when calling $scope.$apply()</a></strong></p> <p>That error you are getting means Angular's dirty checking is already in progress.</p...
14,663,397
How to use labels inside loops with AngularJS
<p>So I'm inside an <code>ng-repeat</code> like this:</p> <pre><code>&lt;li ng-repeat="x in xs"&gt; &lt;form&gt; &lt;label for="UNIQUELABEL"&gt;name&lt;/label&gt; &lt;input id="UNIQUELABEL"&gt; &lt;label for="ANOTHERUNIQUELABEL"&gt;name2&lt;/label&gt; &lt;input id="ANOTHERUNIQUELABEL"...
25,221,392
3
0
null
2013-02-02 15:29:22.08 UTC
7
2017-11-13 10:03:38.227 UTC
null
null
null
null
251,162
null
1
47
html|angularjs
23,712
<p>Since <code>ng-repeat</code> provides a new scope object on each iteration, I prefer using something like</p> <pre><code>&lt;li ng-repeat="x in xs"&gt; &lt;form&gt; &lt;label for="UNIQUELABEL{{::$id}}_1"&gt;name&lt;/label&gt; &lt;input id="UNIQUELABEL{{::$id}}_1"&gt; &lt;label for="UNIQUEL...
58,579,426
In useEffect, what's the difference between providing no dependency array and an empty one?
<p>I gather that the <code>useEffect</code> Hook is run after every render, if provided with an empty dependency array:</p> <pre class="lang-js prettyprint-override"><code>useEffect(() =&gt; { performSideEffect(); }, []); </code></pre> <p>But what's the difference between that, and the following?</p> <pre class="l...
58,579,462
3
0
null
2019-10-27 12:28:09.057 UTC
46
2022-06-16 22:32:27.007 UTC
2020-02-13 15:40:19.12 UTC
null
3,873,510
null
3,873,510
null
1
129
reactjs|react-hooks|use-effect
52,564
<p>It's not quite the same. </p> <ul> <li><p>Giving it an empty array acts like <code>componentDidMount</code> as in, it only runs once.</p></li> <li><p>Giving it no second argument acts as both <code>componentDidMount</code> and <code>componentDidUpdate</code>, as in it runs first on mount and then on every re-render...
38,844,103
cannot use ^xxx outside of match clauses
<p>This function:</p> <pre><code>defp entries(query, page_number, page_size) do offset = page_size * (page_number - 1) query |&gt; limit([_], ^page_size) # error |&gt; offset([_], ^offset) |&gt; Repo.all end </code></pre> <p>gives an exception:</p> <pre><code>cannot use ^pg_size outside of match clauses <...
38,844,355
4
0
null
2016-08-09 06:58:08.733 UTC
1
2019-09-27 11:45:21.393 UTC
2017-03-23 20:44:32.813 UTC
null
4,376
null
6,644,400
null
1
39
elixir|phoenix-framework|ecto
9,087
<p>This is most usually a sign that you haven't imported appropriate macros from <code>Ecto.Query</code>.</p>
40,391,566
Render Jinja after jQuery AJAX request to Flask
<p>I have a web application that gets dynamic data from <strong>Flask</strong> when a <strong>select</strong> element from HTML is changed. of course that is done via <strong>jquery ajax</strong>. No probs here I got that.</p> <p>The problem is, the dynamic data <strong>- that is sent by Flask -</strong>, is a list of...
40,392,035
2
0
null
2016-11-02 23:37:01.657 UTC
9
2016-11-03 12:30:08.153 UTC
null
null
null
null
7,091,942
null
1
7
jquery|python|ajax|flask|flask-sqlalchemy
10,025
<p>Okay, I got it.</p> <p>Simply, I made an external <strong>html</strong> file and added the required <strong>jinja</strong> template to it.</p> <pre><code>{% for object in object_list %} {{object.name}} {% endfor %} </code></pre> <p>then in my <strong>Flask</strong> file I literally returned the <strong>render_...
40,760,274
Add row to class diagram
<p>I am making a class diagram in draw.io, but I am completly new at it.</p> <p>I am using the UML>Class2 figure.</p> <p>The first three properties are part of the figure, but how do you get row number 4? </p> <p>I assume there must be something so the text gets attached to the current figures.</p>
40,815,539
4
0
null
2016-11-23 09:17:24.457 UTC
4
2021-11-10 07:02:12.28 UTC
null
null
null
null
2,854,001
null
1
72
draw.io
28,139
<p>Select one of the existing rows and duplicate (ctrl/cmd-d or right click, select duplicate).</p>
65,918,835
When should I use Android Jetpack Compose Surface composable?
<p>There's <a href="https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#surface" rel="noreferrer">Surface</a> composable in Jetpack Compose which represents a <a href="https://material.io/design/environment/surfaces.html" rel="noreferrer">material surface</a>. A surface allows you t...
65,918,836
3
0
null
2021-01-27 12:07:37.623 UTC
6
2022-07-19 03:50:42.69 UTC
null
null
null
null
4,858,777
null
1
41
android|android-jetpack|android-jetpack-compose
17,226
<p><a href="https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#surface" rel="noreferrer">Surface</a> composable makes the code easier as well as explicitly indicates that the code uses a <a href="https://material.io/design/environment/surfaces.html" rel="noreferrer">material surfac...
36,161,040
Xcode 7.3 crashing when debugging with breakpoints
<p>I just install the Xcode 7.3 version. I can't debug at all because it's crashing when I try to use a breakpoint while I'm debugging. I tried removing Derive Data, Reboot my macbook, reinstall pods... but unfortunately nothing is working. Is someone having the same issue?</p> <blockquote> <p>Process: ...
36,172,742
3
0
null
2016-03-22 17:17:19.277 UTC
7
2016-10-12 03:47:15.707 UTC
2016-10-12 03:47:15.707 UTC
null
1,373,798
null
921,789
null
1
42
xcode|xcode7|xcode8
6,205
<p>What solved it for me is setting the "Enable Clang Module Debugging" in Build Setting to NO.</p>
35,971,589
Angular 2 ngModelChange select option, grab a specific property
<p>I have a dropdown select form in angular 2. </p> <p>Currently: When I select an option the <code>option name</code> gets passed into my <code>onChange</code> function as <code>$event</code> </p> <p>Wanted: When I select an option I would like to pass <code>workout.id</code> into my <code>onChange</code> function. ...
35,971,617
2
0
null
2016-03-13 14:41:02.903 UTC
11
2017-08-25 05:47:46.3 UTC
null
null
null
null
4,178,623
null
1
33
angular
79,721
<pre><code>&lt;select class="form-control" [ngModel]="selectedWorkout" (ngModelChange)="onChange($event)"&gt; &lt;option *ngFor="#workout of workouts" [value]="workout.id"&gt;{{workout.name}}&lt;/option&gt; &lt;/select&gt; </code></pre> <p>OR</p> <pre><code>&lt;select class="form-control" [(ngModel)]="selectedWor...
28,926,612
PuTTY configuration equivalent to OpenSSH ProxyCommand
<p>I'm just trying to use PuTTY to get an SSH connection to my servers. These servers allow incoming SSH connection only from another specific server ("MySshProxyingServer" in example below).</p> <p>Using Linux this is no problem with the <code>ssh -W</code> command.</p> <p>In PuTTY I can't find the options to create...
28,937,185
2
0
null
2015-03-08 12:52:19.533 UTC
10
2021-05-28 15:30:18.98 UTC
2019-10-18 10:48:33.603 UTC
null
850,848
null
4,646,609
null
1
37
ssh|proxy|putty|portforwarding|openssh
45,625
<p>The equivalent in PuTTY is "local proxy command". You can use the <a href="https://the.earth.li/~sgtatham/putty/latest/htmldoc/Chapter7.html" rel="noreferrer"><code>plink.exe</code></a> with the <a href="https://the.earth.li/~sgtatham/putty/latest/htmldoc/Chapter3.html#using-cmdline-ncmode" rel="noreferrer"><code>-n...
44,482,788
Using a Set data structure in React's state
<p>Is it possible to use ES6's <code>Set</code> data structure in React?</p> <p>For example, if I have a checklist composed of distinct items, and I'd like to maintain each item's checked state. I'd like to write something like this:</p> <pre><code>export default class Checklist extends React.Component { constructo...
44,482,908
2
0
null
2017-06-11 10:30:12.86 UTC
10
2021-05-16 09:01:23.277 UTC
2017-06-11 10:37:09.487 UTC
null
1,989,647
null
1,989,647
null
1
63
javascript|reactjs
40,549
<p>Since react will identify state changes only if the state property was replaced, and not mutated (shallow compare), you'll have to create a new Set from the old one, and apply the changes to it.</p> <p>This is possible since <code>new Set(oldSet) !== oldSet</code>.</p> <p><div class="snippet" data-lang="js" data-hid...
22,506,624
How to make Octave use "gnuplot" instead of "fltk" by default?
<p>I'm using Octave 3.8 on Ubuntu 13.10 and "fltk" for graphics is not working well. So I always switch to "gnuplot" by commanding:</p> <pre><code>graphics_toolkit("gnuplot") </code></pre> <p>How can I configure Octave to use "gnuplot" by default?</p>
22,511,710
2
0
null
2014-03-19 12:58:54.317 UTC
8
2016-05-25 14:20:22.37 UTC
null
null
null
null
562,440
null
1
19
octave
33,344
<p>You add the command to your <code>.octaverc</code> file.</p> <p>For more info: <a href="http://www.gnu.org/software/octave/doc/interpreter/Startup-Files.html" rel="noreferrer">http://www.gnu.org/software/octave/doc/interpreter/Startup-Files.html</a></p>
27,049,294
Searchview doesn't work since app compat
<p>Since I implented app compat my searchview doesn't work anymore:</p> <pre><code> Process: com.laurenswuyts.witpa, PID: 26666 java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.SearchView.setSearchableInfo(android.app.SearchableInfo)' on a null object reference ...
27,049,368
11
0
null
2014-11-20 20:49:46.247 UTC
15
2022-05-09 19:11:59.56 UTC
null
null
null
null
1,827,512
null
1
64
java|android|search|menu|android-appcompat
31,020
<p>Try using the custom <code>app</code> namespace for your <code>actionViewClass</code> too:</p> <pre><code>app:actionViewClass="android.support.v7.widget.SearchView"/&gt; </code></pre>
34,357,617
Append 2D array to 3D array, extending third dimension
<p>I have an array <code>A</code> that has shape <code>(480, 640, 3)</code>, and an array <code>B</code> with shape <code>(480, 640)</code>.</p> <p>How can I append these two as one array with shape <code>(480, 640, 4)</code>? </p> <p>I tried <code>np.append(A,B)</code> but it doesn't keep the dimension, while the <c...
34,357,652
2
0
null
2015-12-18 14:15:10.053 UTC
6
2021-11-22 23:20:25.797 UTC
2015-12-18 14:31:05.1 UTC
null
3,923,281
null
5,600,651
null
1
38
python|arrays|numpy|append
69,198
<p>Use <a href="http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.dstack.html" rel="noreferrer"><code>dstack</code></a>:</p> <pre><code>&gt;&gt;&gt; np.dstack((A, B)).shape (480, 640, 4) </code></pre> <p>This handles the cases where the arrays have different numbers of dimensions and stacks the arrays ...
38,875,051
Declare an array in TypeScript
<p>I'm having trouble either declaring or using a boolean array in Typescript, not sure which is wrong. I get an <code>undefined</code> error. Am I supposed to use JavaScript syntax or declare a new Array object? </p> <p>Which one of these is the correct way to create the array?</p> <pre><code>private columns = boole...
38,875,301
5
1
null
2016-08-10 13:37:39.933 UTC
33
2022-06-21 03:01:20.2 UTC
null
null
null
user3325783
null
null
1
162
javascript|arrays|typescript
257,134
<p>Here are the different ways in which you can create an array of booleans in typescript:</p> <pre><code>let arr1: boolean[] = []; let arr2: boolean[] = new Array(); let arr3: boolean[] = Array(); let arr4: Array&lt;boolean&gt; = []; let arr5: Array&lt;boolean&gt; = new Array(); let arr6: Array&lt;boolean&gt; = Array...
53,253,350
How to show roles of user discord.js / userinfo command
<p>I'm trying to make a <code>userinfo</code> command, and I'm currently stuck on showing roles of the user.</p> <p>Here is my code:</p> <pre><code>const Discord = module.require('discord.js'); const moment = require('moment'); module.exports.run = async (bot, message, args) =&gt; { let user = message.mentions....
53,264,907
6
0
null
2018-11-11 21:21:29.43 UTC
2
2021-01-02 03:09:55.62 UTC
2020-05-26 11:37:56.203 UTC
null
12,825,713
null
10,637,682
null
1
5
javascript|bots|discord|discord.js
42,831
<p><a href="https://discord.js.org/#/docs/main/stable/class/User" rel="nofollow noreferrer"><code>User.roles</code></a> is <code>undefined</code> because that property doesn't exist: try using <a href="https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=roles" rel="nofollow noreferrer"><code>GuildMembe...
38,040,327
How to pass rustc flags to cargo?
<p>I am trying to disable dead code warnings. I tried the following</p> <pre><code>cargo build -- -A dead_code </code></pre> <blockquote> <p>➜ rla git:(master) ✗ cargo build -- -A dead_code error: Invalid arguments.</p> </blockquote> <p>So I am wondering how would I pass rustc arguments to cargo?</p>
38,040,431
2
0
null
2016-06-26 15:55:13.487 UTC
10
2022-02-14 22:27:06.703 UTC
null
null
null
null
944,430
null
1
32
rust|rust-cargo
27,412
<p>You can pass flags through Cargo by several different means:</p> <ul> <li><code>cargo rustc</code>, which only affects your crate and not its dependencies.</li> <li>The <a href="https://doc.rust-lang.org/cargo/reference/environment-variables.html" rel="noreferrer"><code>RUSTFLAGS</code></a> environment variable, wh...
37,800,605
Hadoop native libraries not found on OS/X
<p>I have downloaded <code>hadoop</code> source code from github and compiled with the <code>native</code> option:</p> <pre><code>mvn package -Pdist,native -DskipTests -Dtar -Dmaven.javadoc.skip=true </code></pre> <p>I then copied the <code>.dylib</code> files to the $HADOOP_HOME/lib </p> <pre><code>cp -p hadoop-c...
40,051,353
4
0
null
2016-06-13 23:16:10.067 UTC
11
2019-08-22 19:25:41.387 UTC
2019-08-22 19:25:41.387 UTC
null
985,906
null
1,056,563
null
1
17
macos|hadoop|hadoop-native-library
14,697
<p>To get this working on a fresh install of macOS 10.12, I had to do the following:</p> <ol> <li><p>Install build dependencies using <a href="http://brew.sh" rel="noreferrer">homebrew</a>:</p> <pre><code>brew install cmake maven openssl protobuf@2.5 snappy </code></pre></li> <li><p>Check out hadoop source code</p> ...
23,578,427
Changing primary key int type to serial
<p>Is there a way to change existing primary key type from int to serial without dropping the table? I already have a lot of data in the table and I don't want to delete it. </p>
23,578,612
2
0
null
2014-05-10 07:39:06.143 UTC
14
2017-02-15 09:55:34.423 UTC
2017-02-15 09:55:34.423 UTC
null
4,370,109
null
3,137,498
null
1
39
postgresql|primary-key|auto-increment
41,054
<p>Converting an int to a serial <a href="http://www.postgresql.org/docs/9.3/static/datatype-numeric.html#DATATYPE-SERIAL" rel="noreferrer">more or less only means adding a sequence default to the value</a>, so to make it a serial;</p> <ul> <li><p>Pick a starting value for the serial, greater than any existing value i...
42,632,711
How to call function on child component on parent events
<h2>Context</h2> <p>In Vue 2.0 the documentation and <a href="http://taha-sh.com/blog/understanding-components-communication-in-vue-20" rel="noreferrer">others</a> clearly indicate that communication from parent to child happens via props.</p> <h2>Question</h2> <p>How does a parent tell its child an event has happen...
45,463,576
11
1
null
2017-03-06 18:14:29.517 UTC
74
2022-07-15 20:21:45.833 UTC
2018-04-05 18:57:30.8 UTC
null
1,218,980
null
1,399,513
null
1
279
javascript|vue.js|event-handling|vuejs2
247,084
<p>Give the child component a <code>ref</code> and use <code>$refs</code> to call a method on the child component directly.</p> <p>html:</p> <pre><code>&lt;div id=&quot;app&quot;&gt; &lt;child-component ref=&quot;childComponent&quot;&gt;&lt;/child-component&gt; &lt;button @click=&quot;click&quot;&gt;Click&lt;/butto...
7,681,821
Passing objects to client in node + express + jade?
<p>I have a pretty heavyweight query on the server that results in a new page render, and I'd like to pass along some of the results of the query to the client (as a javascript array of objects). This is basically so I don't have to do a separate JSON query later to get the same content (which is mostly static). The da...
7,681,910
1
0
null
2011-10-07 00:00:27.447 UTC
23
2011-10-07 11:49:11.443 UTC
null
null
null
null
983,180
null
1
42
json|node.js|express|pug
27,549
<p>You can't inline a JS object like that, but you can <code>JSON.stringify</code> it before:</p> <pre><code>&lt;script type="text/javascript"&gt; var data = !{JSON.stringify(data)}; &lt;/script&gt; </code></pre>
22,568,354
Jersey ClientBuilder.newClient(): source not found
<p>I have an Java 64-bit Eclipse application with Eclipse running on Windows 7 Pro x64.</p> <p>I downloaded the <a href="https://jersey.java.net" rel="noreferrer">Jersey</a> bundle, jaxrs-ri-2.7.zip, for client RESTful API access.</p> <p>I added these external jars (Project | Build Path | Configure Build Path... | Li...
22,570,425
4
0
null
2014-03-21 19:56:13.437 UTC
4
2019-11-12 12:48:54.327 UTC
2014-03-21 23:08:01.093 UTC
null
2,769,729
null
2,769,729
null
1
18
java|eclipse|rest|jersey
46,576
<p>My guess is that "Source not found" simply is a message from Eclipse telling you it cannot debug into <code>Client oClient = ClientBuilder.newClient();</code> as you do not have the source code for the three jars attached in Eclipse. If you just run the program (without debugging) it might very well work. Read more ...
56,285,197
What is the difference between enterAnim & popEnterAnim & exitAnim & popExitAnim?
<p>What is the difference between animation tags in latest Navigation Architecture Component? I got confused with <code>enterAnim</code> &amp; <code>popEnterAnim</code>. Similarly, <code>exitAnim</code> &amp; <code>popExitAnim</code>.</p> <p>Any visual expansions is more than welcomed.</p>
56,285,404
3
0
null
2019-05-24 02:44:13.253 UTC
4
2022-01-11 08:22:45.353 UTC
null
null
null
null
8,412,192
null
1
51
android|android-animation|android-architecture-navigation
6,898
<p>The <a href="https://developer.android.com/guide/navigation/navigation-animate-transitions" rel="noreferrer">Animate transitions between destinations documentation</a> details the four types of animations:</p> <blockquote> <ul> <li>Entering a destination</li> <li>Exiting a destination</li> <li>Entering a de...
2,546,780
Python - animation with matplotlib.pyplot
<p>How can one create animated diagrams using popular matplotlib library? I am particularly interested in animated gifs.</p>
2,547,625
3
0
null
2010-03-30 16:16:12.61 UTC
9
2018-07-30 08:56:10.227 UTC
null
null
null
null
215,571
null
1
23
python|matplotlib
36,083
<p>The matplotlib docs provide an entire section of examples on <a href="http://matplotlib.sourceforge.net/examples/animation/index.html" rel="nofollow noreferrer">animation</a> (see this <a href="http://scipy-cookbook.readthedocs.io/items/Matplotlib_Animations.html" rel="nofollow noreferrer">scipy</a> tutorial also). ...
3,065,606
When did the idea of macros (user-defined code transformation) appear?
<p>I have read McCarthy's 1960 paper on LISP and found no reference to anything that's similar to user-defined macros or normal order evaluation. I was wondering when macros first appeared in programming language history (and also in Lisp history):</p> <ul> <li>When was the idea of user-defined code transformation (be...
3,068,177
3
0
null
2010-06-17 20:59:49.637 UTC
3
2019-05-15 05:13:20.913 UTC
2016-02-11 17:04:50.613 UTC
null
120,163
null
114,979
null
1
28
macros|lisp|scheme|history|racket
1,966
<p>From <a href="http://www.dreamsongs.com/Files/HOPL2-Uncut.pdf" rel="noreferrer">The Evolution of Lisp</a> (Steele/Gabriel):</p> <blockquote> <p>3.3 Macros</p> <p>Macros appear to have been introduced into Lisp by Timothy P. Hart in 1963 in a short MIT AI Memo [Hart, 1963],</p> </blockquote> <p>Timothy P. Hart, <a hr...
2,992,451
How to subtract a year from the datetime?
<p>How to subtract a year from current datetime using c#?</p>
2,992,457
3
0
null
2010-06-07 19:26:10.293 UTC
4
2016-12-29 14:43:22.757 UTC
null
null
null
null
144,842
null
1
97
c#
97,950
<pre><code>var myDate = DateTime.Now; var newDate = myDate.AddYears(-1); </code></pre>
2,513,415
How to fix access to the requested resource which has been denied in Tomcat?
<p>I want to enable form based authentication by using database as realm but I'm always getting that message whenever I try to authenticate as Tomcat manager in Tomcat 6. I have already created a table user_name and user_roles and mapped the username(blue) to admin and manager as role in user_roles table in mysql, but ...
2,514,501
4
2
null
2010-03-25 06:09:02.243 UTC
2
2015-04-10 15:00:47.44 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
247,902
null
1
6
tomcat|authentication|configuration|http-status-code-403|catalina
45,732
<p>I havent tried this myself. Can you try changing the auth-method in the <code>TOMCAT_HOME_DIR\webapps\manager\WEB-INF\web.xml</code> to point the auth-method set to FORM. The realm-name does not matter.</p> <pre><code>&lt;login-config&gt; &lt;auth-method&gt;FORM&lt;/auth-method&gt; &lt;realm-name&gt;Tomcat Man...
2,684,685
Project structure in TFS 2010
<p>We have just gotten TFS 2010 up and running. We will be migrating our source into TFS but I have a question on how to organize the code.</p> <p>TFS 2010 has a new concept of project collections so I have decided that different groups within our organization will get their own group. My team develops many differen...
2,782,463
4
0
null
2010-04-21 16:20:04.413 UTC
14
2020-07-09 10:33:08.233 UTC
2020-07-09 10:33:08.233 UTC
null
8,528,014
null
35,165
null
1
19
tfs|tfs-2010
9,386
<p>The best practice for this is to have everything that you need to build a solution under your Main/Trunk folder. We use the following format:</p> <pre><code> "Project 1" "DEV" (Folder) "Feature 1" (Branch) "Main" (Root branch) "Release" (Folder) "Release 1" (Branch) "RTM" (Folder) "...
3,033,859
Splitting every character of a string?
<p>I want to split a string into each single character. Eg: Splitting : <code>"Geeta" to "G", "e", "e" , "t", "a"</code> How can I do this? I want to split a string which don't have any separator Please help.</p>
3,033,867
4
0
null
2010-06-13 20:48:52.75 UTC
2
2019-04-21 20:33:04.027 UTC
2016-03-05 16:46:53.307 UTC
null
3,313,438
null
365,870
null
1
29
c#|string|split
76,606
<p><code>String.ToCharArray()</code></p> <p>From <a href="https://msdn.microsoft.com/en-us/library/ezftk57x(v=vs.110).aspx" rel="noreferrer">MSDN</a>:</p> <blockquote> <p>This method copies each character (that is, each Char object) in a string to a character array. The first character copied is at index zero of th...
2,685,413
What is the difference between a segmentation fault and a stack overflow?
<p>For example when we call say, a recursive function, the successive calls are stored in the stack. However, due to an error if it goes on infinitely the error is 'Segmentation fault' (as seen on GCC). </p> <p>Shouldn't it have been 'stack-overflow'? What then is the basic difference between the two? </p> <p>Btw, an...
2,685,434
4
4
null
2010-04-21 18:08:05.687 UTC
28
2014-01-26 02:22:23.597 UTC
2010-04-21 18:14:21.083 UTC
null
40,468
null
297,353
null
1
36
c|memory|stack|segmentation-fault|stack-overflow
13,761
<p>Stack overflow is [a] cause, segmentation fault is the result.</p> <hr> <p>At least on x86 and ARM, the "stack" is a piece of memory reserved for placing local variables and return addresses of function calls. When the stack is exhausted, the memory outside of the reserved area will be accessed. But the app did no...
2,360,965
What really is connection pooling?
<p>I have heard the term connection pooling and looked for some references by googling it... But can't get the idea when to use it....</p> <ul> <li><p>When should i consider using connection pooling?</p></li> <li><p>What are the advantages and disadvantagesof connection pooling?</p></li> </ul> <p>Any suggestion....</...
2,360,981
6
8
null
2010-03-02 04:48:58.247 UTC
10
2020-12-30 03:43:43.943 UTC
2010-03-02 04:56:11.007 UTC
null
207,556
null
207,556
null
1
24
asp.net|connection-pooling
6,664
<p>The idea is that you do not open and close a single connection to your database, instead you create a "pool" of open connections and then reuse them. Once a single thread or procedure is done, it puts the connection back into the pool and, so that it is available to other threads. The idea behind it is that typicall...
2,937,227
What does (function($) {})(jQuery); mean?
<p>I am just starting out with writing jQuery plugins. I wrote three small plugins but I have been simply copying the line into all my plugins without actually knowing what it means. Can someone tell me a little more about these? Perhaps an explanation will come in handy someday when writing a framework :)</p> <p>What...
2,937,256
6
3
null
2010-05-30 01:36:57.727 UTC
194
2020-06-17 13:08:58.253 UTC
2011-08-08 15:30:22.59 UTC
null
560,648
null
184,046
null
1
319
javascript|jquery
257,849
<p>Firstly, a code block that looks like <code>(function(){})()</code> is merely a function that is executed in place. Let's break it down a little.</p> <pre><code>1. ( 2. function(){} 3. ) 4. () </code></pre> <p>Line 2 is a plain function, wrapped in parenthesis to tell the runtime to return the function to the p...
2,487,844
Simple way to show the 'Copy' popup on UITableViewCells like the address book App
<p>Is there a simple way for subclasses of UITableViewCell to show the 'Copy' UIMenuController popup like in the Address book app (see screenshot), after the selection is held for a while?</p> <p><a href="https://i.stack.imgur.com/s1AAj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s1AAj.png" alt="...
2,488,237
7
0
null
2010-03-21 16:49:01.253 UTC
26
2021-04-12 14:05:23.893 UTC
2021-04-12 14:05:23.893 UTC
null
4,751,173
null
72,176
null
1
42
ios|objective-c|iphone|uitableview|pasteboard
21,994
<p>The method before iOS 5 is to get the UIMenuController's shared instance, set the target rect and view and call <code>-setMenuVisible:animated:</code>. Remeber to implement <code>-canPerformAction:withSender:</code> in your responder.</p> <hr> <p>The method after iOS 5 (previously available as undocumented feature...
2,724,864
What is the difference between C# and .NET?
<p>May I know what is the difference between C# and .NET? When I think of C#, right away I would say it is a .NET language, but when I search for job posts, they require candidates to have C# and .NET experience. Can someone give me an explanation?</p>
2,724,907
11
3
null
2010-04-27 20:31:22.273 UTC
57
2022-08-09 20:11:07.41 UTC
2013-07-17 17:08:09.697 UTC
null
555,544
null
64,398
null
1
270
c#|.net
401,460
<p>In addition to <a href="https://stackoverflow.com/a/2724872/10251345">Andrew's answer</a>, it is worth noting that:</p> <ul> <li>.NET isn't just a <strong>library</strong>, but also a <strong>runtime</strong> for executing applications.</li> <li>The knowledge of C# implies some knowledge of .NET (because the C# obje...
2,658,772
Vertical line using XML drawable
<p>I'm trying to figure out how to define a vertical line (1dp thick) to be used as a drawable.</p> <p>To make a horizontal one, it's pretty straightforward:</p> <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line"&gt; &lt;stroke android:width="1dp" android:color="#...
2,659,038
18
0
null
2010-04-17 14:57:01.76 UTC
59
2021-08-06 07:39:29.647 UTC
2013-12-30 13:51:24.66 UTC
null
56,285
null
55,583
null
1
183
android|android-layout|line|android-xml|android-drawable
269,115
<p>Instead of a shape, you could try a <code>View</code>:</p> <pre><code>&lt;View android:layout_width=&quot;1dp&quot; android:layout_height=&quot;match_parent&quot; android:background=&quot;#FF0000FF&quot; /&gt; </code></pre> <p>I have only used this for horizontal lines, but I would think it would work fo...
45,401,734
How to work with DTO in Spring Data REST projects?
<p>Spring Data REST automates exposing only domain object. But most often we have to deal with Data Transfer Objects. So how to do this in SDR way?</p>
45,401,735
1
0
null
2017-07-30 15:51:58.61 UTC
17
2017-07-30 15:51:58.61 UTC
null
null
null
null
5,380,322
null
1
18
spring|spring-data-rest|projection|dto
17,819
<p><strong>An approach of how to work with <a href="https://en.wikipedia.org/wiki/Data_transfer_object" rel="noreferrer">DTO</a> in <a href="https://projects.spring.io/spring-data-rest/" rel="noreferrer">Spring Data REST</a> projects</strong></p> <p><em>The working example is <a href="https://github.com/Cepr0/spring-d...