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
11,042,218
C restore stdout to terminal
<p>I am working with a multi-thread program. </p> <p>First I redirect my stdout to a certain file. No problem there (I used <code>dup2(fd, 1)</code> where <code>fd</code> is the file descriptor for the file). </p> <p>Afterwards, I need to redirect my stdout to the terminal again.</p> <p>My first approach:</p> <pre>...
11,042,581
3
8
null
2012-06-14 22:27:39.123 UTC
13
2018-01-17 07:49:40.557 UTC
2018-01-17 07:49:40.557 UTC
null
212,378
null
1,418,069
null
1
28
c|stdout
40,950
<pre><code>#include &lt;unistd.h&gt; ... int saved_stdout; ... /* Save current stdout for use later */ saved_stdout = dup(1); dup2(my_temporary_stdout_fd, 1); ... do some work on your new stdout ... /* Restore stdout */ dup2(saved_stdout, 1); close(saved_stdout); </code></pre>
11,041,137
What is the difference between variable, parameter and field in JasperReports?
<p>I am a newbie to <em>JasperReports</em>, have been working on some small samples. It seems "Fields", "Parameters" and "Variables" are very commonly used to demonstrate dynamic data and looks much alike. So can I ask what's their difference specifically in <em>JasperReports</em>?</p> <p>I guess variable is something...
11,041,480
3
2
null
2012-06-14 20:50:25.83 UTC
11
2021-11-13 15:04:36.95 UTC
2016-06-18 11:43:11.043 UTC
null
876,298
null
1,233,359
null
1
32
jasper-reports
37,112
<p>From my personal experience with <code>JasperReports</code> i can deduce that you will be using Parameters and Fields the most. Parameters and fields are memory locations or values which you can populate from your code, i.e when you generate the report. </p> <p>What you would usually be doing is populating a param...
11,106,825
How to pass a null parameter with Dapper
<p>I have a stored procedure that has a parameter with no default value, but it can be null. But I can't figure out how to pass null with Dapper. I can do it just fine in ADO.</p> <pre><code>connection.Execute("spLMS_UpdateLMSLCarrier", new { **RouteId = DBNull.Value**, CarrierId = carrierID, UserId = userID, TotalRou...
11,106,904
1
1
null
2012-06-19 18:11:15.817 UTC
5
2012-06-19 18:17:38.903 UTC
2012-06-19 18:17:38.903 UTC
null
13,627
user1466918
null
null
1
45
dapper
34,642
<p>I think you should be able to do it by casting <code>null</code> to the appropiate type. Let's assume RouteId is an integer:</p> <pre><code>connection.Execute("spLMS_UpdateLMSLCarrier", new { RouteId = (int?)null, CarrierId = carrierID, UserId = userID, TotalRouteRateCarrierId = totalRouteRateCarrierId }, commandTy...
11,058,387
How do you add a computed column to a Table?
<p>How can I add a computed column to a table that already exists? S.O. has <a href="https://stackoverflow.com/q/5841876/456188">Computed Column Help - TSQL</a> but no information about adding them.</p>
11,058,389
1
0
null
2012-06-15 21:25:49.573 UTC
3
2014-01-06 15:19:05.647 UTC
2017-05-23 11:54:46.753 UTC
null
-1
null
456,188
null
1
69
tsql|ddl
94,031
<p>The syntax I was looking for is:</p> <pre><code>alter table TABLE_NAME add [column_name] as (**COLUMN-SQL**) </code></pre>
12,981,021
Are there any patterns in GoF?
<p>I'm currently learning for a Design Patterns exam (which will take place tomorrow...). In one of the "test exams" I found the following question: </p> <blockquote> <p>Jim Coplien said during the invited lecture that there is not even one design pattern in the GoF book. What is your opinion about this?</p> </blo...
24,664,544
2
4
null
2012-10-19 19:20:09.973 UTC
10
2014-07-11 14:58:28.113 UTC
2014-07-10 07:57:32.687 UTC
null
847,064
null
847,064
null
1
9
design-patterns
2,722
<h1>Patterns: The Notion is Grounded in Alexander's Work</h1> <p>The GoF claims to take its pattern inspiration from Christopher Alexander (as they say in the front matter of the book), who popularized the term in the broader field of design. To Alexander a pattern: is always an element of pattern language; contribute...
30,737,617
The type javax.servlet.ServletContext and javax.servlet.ServletException cannot be resolved
<p>I'm trying to include Spring Security to my web project, i'm following this tutorial <a href="http://docs.spring.io/spring-security/site/docs/current/guides/html5//helloworld.html" rel="noreferrer">http://docs.spring.io/spring-security/site/docs/current/guides/html5//helloworld.html</a></p> <p>I've done everything i...
30,739,587
5
5
null
2015-06-09 16:20:11.33 UTC
8
2020-01-09 06:42:00.263 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
4,068,310
null
1
35
java|maven|servlets|spring-security
82,891
<p>Just add the <a href="http://docs.oracle.com/javaee/7/api/javax/servlet/package-summary.html"><code>javax.servlet</code> API</a> to the compile time dependencies. You don't need to include it in the build, it's already provided by the target servlet container.</p> <p>Your current pom suggests that you're deploying ...
61,126,851
How can I use GPU on Google Colab after exceeding usage limit?
<p>I'm using Google Colab's free version to run my TensorFlow code. After about 12 hours, it gives an error message</p> <blockquote> <p>&quot;You cannot currently connect to a GPU due to usage limits in Colab.&quot;</p> </blockquote> <p>I tried factory resetting the runtime to use the GPU again but it does not work. Fu...
66,142,367
4
3
null
2020-04-09 17:31:36.057 UTC
6
2022-06-10 01:07:51.843 UTC
2022-05-13 11:40:03.75 UTC
null
11,483,646
null
8,444,367
null
1
31
gpu|google-colaboratory
77,244
<p>If you use GPU regularly, runtime durations will become shorter and shorter and disconnections more frequent. The cooldown period before you can connect to another GPU will extend from hours to days to weeks. Google tracks everything. They not only know your accounts' usage but also the usage of accounts that appear...
11,424,037
Do checkbox inputs only post data if they're checked?
<p>Is it standard behaviour for browsers to only send the checkbox input value data if it is checked upon form submission?</p> <p>And if no value data is supplied, is the default value always "on"?</p> <p>Assuming the above is correct, is this consistent behaviour across all browsers?</p>
11,424,089
12
0
null
2012-07-11 00:48:49.15 UTC
44
2019-07-24 13:59:54.993 UTC
2019-07-24 13:59:54.993 UTC
null
1,264,804
null
1,304,767
null
1
213
html|input|checkbox
295,380
<p>Yes, standard behaviour is the value is only sent if the checkbox is checked. This typically means you need to have a way of remembering what checkboxes you are expecting on the server side since not all the data comes back from the form.</p> <p>The default value is always "on", this should be consistent across bro...
16,677,378
Calculating the height of a binary tree
<p>I need help with the theory on calculating the height of a binary tree, typically the notation.</p> <p>I have read the following article:</p> <p><a href="https://stackoverflow.com/questions/575772/the-best-way-to-calculate-the-height-in-a-binary-search-tree-balancing-an-avl">Calculating height of a binary tree</a>...
16,677,580
10
6
null
2013-05-21 18:51:32.06 UTC
3
2021-06-06 05:39:50.477 UTC
2017-05-23 11:53:57.677 UTC
null
-1
null
1,582,478
null
1
13
data-structures|binary-tree
45,271
<p>I'll try to explain how this recursive algorithm works:</p> <pre><code>height(10) = max(height(5), height(30)) + 1 height(30) = max(height(28), height(42)) + 1 height(42) = 0 (no children) height(28) = 0 (no children) height(5) = max(height(4), height(8)) + 1 height(4) = 0 (no children) height(8) = 0 (no childre...
16,653,815
Horizontal stacked bar chart in Matplotlib
<p>I'm trying to create a horizontal stacked bar chart using <code>matplotlib</code> but I can't see how to make the bars actually stack rather than all start on the y-axis.</p> <p>Here's my testing code.</p> <pre><code>fig = plt.figure() ax = fig.add_subplot(1,1,1) plot_chart(df, fig, ax) ind = arange(df.shape[0]) ...
16,654,500
4
1
null
2013-05-20 16:17:20.673 UTC
6
2019-05-06 14:55:10.027 UTC
2013-05-20 16:43:15.233 UTC
null
1,706,564
null
1,706,564
null
1
14
python|matplotlib|pandas
54,742
<p>Since you are using pandas, it's worth mentioning that you can do stacked bar plots natively:</p> <pre><code>df2.plot(kind='bar', stacked=True) </code></pre> <p><em>See the <a href="http://pandas.pydata.org/pandas-docs/stable/visualization.html#bar-plots" rel="noreferrer">visualisation section of the docs</a>.</em...
16,786,787
Conversion array types
<p>I have in table column, which type is <code>CHARACTER VARYING[]</code> (that is array)</p> <p>I need concatenate existed rows whith other array</p> <p>This is my code:</p> <pre><code>UPDATE my_table SET col = array_cat(col, ARRAY['5','6','7']) </code></pre> <p>returned error: <code>function array_cat(charact...
16,787,209
1
0
null
2013-05-28 07:58:17.463 UTC
5
2013-05-28 08:21:32.953 UTC
null
null
null
null
1,609,729
null
1
23
postgresql|postgresql-9.2
44,543
<p>Cast to <code>varchar[]</code>:</p> <pre><code> &gt; SELECT ARRAY['5','6','7']::varchar[], pg_typeof( ARRAY['5','6','7']::varchar[] ); SELECT ARRAY['5','6','7']::varchar[], pg_typeof( ARRAY['5','6','7']::varchar[] ); array | pg_typeof ---------+--------------------- {5,6,7} | character varying[] </...
17,079,711
what is the difference between site_url() and base_url()?
<p>As I have read in some resources, <code>base_url()</code> and <code>site_url()</code> functions in <code>Codeigniter</code> are almost the same, although my version of Codeigniter (2.1.3) does not have a site_url() in its config.php file (in the config directory).</p> <p>Yet are there differences between them in any...
17,079,745
7
0
null
2013-06-13 05:18:45.393 UTC
14
2022-05-02 06:55:00.287 UTC
2022-05-02 06:55:00.287 UTC
null
18,676,264
null
1,764,442
null
1
44
php|codeigniter
87,534
<pre><code>echo base_url(); // http://example.com/website echo site_url(); // http://example.com/website/index.php </code></pre> <p>if you want a URL access to a resource (such as css, js, image), use <code>base_url()</code>, otherwise, <code>site_url()</code> is better.</p> <p>for a detailed reference Check this bo...
16,821,101
How to set up ES cluster?
<p>Assuming I have 5 machines I want to run an elasticsearch cluster on, and they are all connected to a shared drive. I put a single copy of elasticsearch onto that shared drive so all three can see it. Do I just start the elasticsearch on that shared drive on eall of my machines and the clustering would automatically...
16,821,222
4
1
null
2013-05-29 18:16:06.787 UTC
38
2020-08-16 18:18:37.297 UTC
2013-05-29 18:53:59.98 UTC
null
971,888
null
971,888
null
1
83
elasticsearch
107,839
<p>its super easy.</p> <p>You'll need each machine to have it's own copy of ElasticSearch (simply copy the one you have now) -- the reason is that each machine / node whatever is going to keep it's own files that are sharded accross the cluster.</p> <p>The only thing you really need to do is edit the config file to i...
16,678,072
Can we set a Git default to fetch all tags during a remote pull?
<p>I currently have a git remote setup like the following:</p> <pre><code>[remote "upstream"] url = &lt;redacted&gt; fetch = +refs/heads/*:refs/remotes/upstream/* </code></pre> <p>When I issue <code>git pull</code> on branch master, all remote heads are fetched into remotes/upstream, then remotes/upstream/mas...
16,678,319
7
2
null
2013-05-21 19:35:09.513 UTC
39
2021-11-17 04:49:32.843 UTC
2019-11-15 10:33:31.18 UTC
null
1,657,610
null
1,310,220
null
1
186
git
184,447
<p>You should be able to accomplish this by adding a refspec for tags to your local config. Concretely:</p> <pre><code>[remote "upstream"] url = &lt;redacted&gt; fetch = +refs/heads/*:refs/remotes/upstream/* fetch = +refs/tags/*:refs/tags/* </code></pre>
20,875,341
why golang is slower than scala?
<p>In this <a href="http://benchmarksgame.alioth.debian.org/u64/compare.php?lang=go&amp;lang2=scala" rel="noreferrer">test</a>, we can see that the performance of golang is sometimes much slower than scala. In my opinion, since the code of golang is compiled directly to c/c++ compatible binary code, while the code of s...
20,880,746
5
8
null
2014-01-02 02:08:43.127 UTC
9
2016-09-22 20:20:52.25 UTC
2016-09-22 20:20:52.25 UTC
null
73,955
null
547,524
null
1
25
performance|scala|go
33,658
<p>Here's what I think's going on in the four benchmarks where the go solutions are the slowest compared to the scala solutions.</p> <ol> <li><strong>mandelbrot</strong>: the scala implementation has its internal loop unrolled one time. It may be also that the JVM can vectorise the calculation like this, which I think...
20,695,333
Why does unitless line-height behave differently from percentage or em in this example?
<p>I'm perplexed by the behavior of the following CSS, also illustrated <a href="http://jsfiddle.net/Y7Jta/3/">in this fiddle</a>.</p> <pre><code>&lt;style type="text/css"&gt; p { font-size: 14px; } .percentage { line-height: 150%; } .em-and-a-half { line-height: 1.5em; } .decimal { line-height: 1.5...
20,818,206
4
13
2013-12-28 16:15:05.443 UTC
2013-12-20 02:29:44.2 UTC
23
2013-12-28 19:36:19.35 UTC
2013-12-28 16:27:17.57 UTC
null
1,486,915
null
1,486,915
null
1
58
html|css
15,254
<p>Based on clues in the proposed answers, I think the rendering behavior seen in these examples is counterintuitive, but correct, and mandated by the interaction of several rules in the spec, and the overall <a href="http://www.w3.org/TR/CSS21/box.html">CSS box model</a>.</p> <ol> <li><p>CSS calculates the leading L ...
4,498,585
How to select first and last <th> only?
<p>My table has <code>id="mytable"</code>. I'm trying to apply some CSS on the first and last <code>&lt;th&gt;</code> only. I tried this but it doesn't work.</p> <pre><code>#mytable th:first, #mytable th:last{ //css goes here } </code></pre>
4,498,596
2
0
null
2010-12-21 11:05:31.943 UTC
7
2017-06-17 20:57:22.623 UTC
2017-06-17 20:57:22.623 UTC
null
4,370,109
null
509,023
null
1
27
css|html-table
45,376
<pre><code>#mytable th:last-child, #mytable th:first-child { //css goes here } </code></pre>
26,702,757
Check if the given string follows the given pattern
<p>A friend of mine just had his interview at Google and got rejected because he couldn't give a solution to this question.</p> <p>I have my own interview in a couple of days and can't seem to figure out a way to solve it.</p> <p>Here's the question:</p> <blockquote> <p>You are given a pattern, such as [a b a b]. You a...
26,705,386
16
5
null
2014-11-02 18:24:16.07 UTC
15
2021-11-09 17:05:08.36 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
1,772,080
null
1
22
string|algorithm|dynamic-programming|graph-algorithm
18,555
<p>Don't you just need to translate the pattern to a regexp using backreferences, i.e. something like this (Python 3 with the "re" module loaded):</p> <pre><code>&gt;&gt;&gt; print(re.match('(.+)(.+)\\2\\1', 'catdogdogcat')) &lt;_sre.SRE_Match object; span=(0, 12), match='catdogdogcat'&gt; &gt;&gt;&gt; print(re.match...
9,870,417
magento set store id programmatically
<p>I am currently working on a magento site that is in 2 languages (French and Dutch). The approach I am taking is as follows:</p> <ul> <li>Create a folder in the web root (named nl)</li> <li>Import the index.php and .htaccess file to that folder</li> <li><p>In the index.php I modify the following line:</p> <pre><cod...
9,901,463
3
0
null
2012-03-26 10:22:40.82 UTC
5
2018-12-11 10:01:41.277 UTC
2018-12-11 10:01:41.277 UTC
null
1,033,581
null
660,298
null
1
10
php|magento|magento-1.4
47,400
<p>After hours of huffing and puffing i was able to figure out a way to set the store id programatically :)</p> <p>In the index.php file, (in your language specific folder), add the following:-</p> <pre><code>$store_id = 'your_store_id_here'; $mageRunCode = 'store view code'; $mageRunType = 'store'; Mage::app()-&gt;...
9,833,834
Android - ListView only show the first result
<p>I am working on an android app which interacts with Twitter using their search API. Everythings works well except that when I want to show the result using a ListView, only the first result is shown. </p> <pre><code>ArrayList&lt;TwitterJSONResults&gt; arrayList = new ArrayList&lt;TwitterJSONResults&gt;(data.getResu...
9,841,847
8
6
null
2012-03-23 03:32:21.083 UTC
6
2019-12-06 06:02:40.873 UTC
null
null
null
null
495,416
null
1
32
android|listview|element
35,147
<p>Don't put ListView inside of a ScrollView :)</p>
9,931,437
404 - A public action method X was not found on controller Y (ActionInvoker.InvokeAction returns false)
<p>This is NOT a duplicate question, and the problem is driving me crazy. I am getting the typical error "A public action method X was not found on controller Y" which returns a <code>404 Not Found</code>. The screenshot gives you a good idea:</p> <p><img src="https://i.stack.imgur.com/uWE7m.gif" alt="Visual Studio de...
9,932,926
2
4
null
2012-03-29 18:40:42.843 UTC
5
2014-04-30 22:08:07.257 UTC
2013-10-11 20:32:02.167 UTC
null
498,609
null
498,609
null
1
39
.net|asp.net-mvc|asp.net-mvc-3|.net-4.0
19,930
<p>The problem is that you're specifying both the <code>HttpGet</code> and <code>HttpPost</code> attributes. If you leave both of them off, the action accepts both POST and GET requests. My guess is that the <code>HttpGet</code> and <code>HttpPost</code> attributes don't signal to MVC to allow the corresponding reque...
9,702,795
Large github commit diff not shown
<p>This happens to me both with Compare view as well as standard commits that are large in the amount of files changed.</p> <p>The screenshot below is from a compare between two branches with 380 files changed. The files at the beginning of the diff log have their diffs visualized but at a certain point down the page ...
25,632,477
7
3
null
2012-03-14 13:18:44.227 UTC
7
2021-10-11 12:19:45.813 UTC
null
null
null
null
390,407
null
1
42
git|github|diff
24,612
<p>Adding <code>.patch</code> to the end of the URL somewhat helps. Removes the nice UI and comment functionality, of course.</p> <p>An example. If your pull request is: <a href="https://github.com/JustinTulloss/zeromq.node/pull/47" rel="noreferrer">https://github.com/JustinTulloss/zeromq.node/pull/47</a>, then the pa...
10,097,887
Using sessions & session variables in a PHP Login Script
<p>I have just finished creating an entire login and register systsem in PHP, but my problem is I haven't used any sessions yet. I'm kind of a newbie in PHP and I've never used sessions before. What I want to do is, after the user registers and fills out the login form, they will still stay on the same page. So, there ...
10,097,986
9
4
null
2012-04-10 23:24:18.557 UTC
36
2021-05-24 06:18:57.977 UTC
2016-12-17 06:09:31.22 UTC
null
2,145,800
null
1,325,291
null
1
49
php|session|authentication
256,076
<p>Hope this helps :)</p> <p>begins the session, you need to say this at the top of a page or before you call session code</p> <pre><code> session_start(); </code></pre> <p>put a user id in the session to track who is logged in</p> <pre><code> $_SESSION['user'] = $user_id; </code></pre> <p>Check if someone is log...
9,974,987
How to send an email with a file attachment in Android
<p>I want to attach .vcf file with my mail and send through the mail. But the mail is received on the address without the attachment.I have used the below code but the code for this and i don't know where i am wrong.</p> <pre><code>try { String filelocation="/mnt/sdcard/contacts_sid.vcf"; Intent intent...
9,975,439
5
0
null
2012-04-02 10:46:04.407 UTC
25
2020-09-17 17:23:04.79 UTC
2013-12-26 18:22:12.643 UTC
null
864,358
null
1,051,054
null
1
56
android|email|email-attachments|vcf-vcard
96,309
<p>Use the below code to send a file within a email.</p> <pre><code>String filename="contacts_sid.vcf"; File filelocation = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), filename); Uri path = Uri.fromFile(filelocation); Intent emailIntent = new Intent(Intent.ACTION_SEND); // set the type to '...
28,323,925
Push segue from UITableViewCell to ViewController in Swift
<p>I'm encountering problems with my UITableViewCells. I connected my UITableView to a API to populate my cells. </p> <p>Then I've created a function which grabs the <code>indexPath.row</code> to identify which JSON-object inside the array that should be sent to the <code>RestaurantViewController</code>. </p> <blockq...
28,428,558
9
17
null
2015-02-04 14:32:36.07 UTC
8
2020-11-14 14:00:12.173 UTC
2015-02-09 14:29:01.163 UTC
null
1,308,651
null
1,308,651
null
1
13
ios|iphone|uitableview|swift|uistoryboardsegue
35,154
<p>The problem is that you're not handling your data correctly. If you look into your <code>currentResponse</code> Array, you'll see that it holds NSDictionaries but in your <code>prepareForSegue</code> you try to cast a NSDictionary to a NSArray, which will make the app crash.</p> <p>Change the <code>data</code> varia...
7,820,162
Remove <div> using jQuery
<p>I have this HTML code:</p> <pre><code>&lt;div id="note_list"&gt; &lt;div class="note"&gt; Text 1 &lt;a href=""&gt;X&lt;/a&gt; &lt;/div&gt; &lt;div class="note"&gt; Text 2 &lt;a href=""&gt;X&lt;/a&gt; &lt;/div&gt; &lt;div class="note"&gt; Text 3 &lt;a href=""&gt;X&lt;/a&gt; &l...
7,820,191
3
1
null
2011-10-19 10:51:34.463 UTC
2
2018-09-24 13:55:39.24 UTC
2018-09-24 13:55:39.24 UTC
null
814,702
null
887,651
null
1
16
javascript|jquery
58,658
<pre><code>$(".note a").click(function(e) { e.preventDefault(); $(this).parent().remove(); }); </code></pre> <p>or instead of <code>remove()</code> you could use <code>slideUp()</code></p>
8,304,387
Android: How do I force the update of all widgets of a particular kind
<p>I have seen many questions along these lines, and I keep seeing the same answer over and over. I don't want to have to have a Service for every kind of widget my app has, especially seeing as my app already has 2 persistent services.</p> <p>Specifically, if one of my existing services sees that data has changed, I ...
8,304,682
3
0
null
2011-11-29 00:43:34.617 UTC
11
2016-10-06 00:45:23.24 UTC
2012-05-06 14:02:24.327 UTC
null
11,343
null
923,279
null
1
16
android|widget
29,257
<p>To force our widgets for a particular widget provider to be updated, we will need to do the following:</p> <ul> <li>Set up our provider to receive a specialized broadcast</li> <li>Send the specialized broadcast with: <ol> <li>All the current widget Id's associated with the provider</li> <li>The data to send</li> <l...
11,649,621
scott account locked in SQL Plus
<p>When I am trying to logging to Oracle Sql plus by entering 'scott' as username and 'tiger' as password, it shows 'the account is locked'. How to unlock 'scott' account. The screen shot of SQL Plus CLI is given below. </p> <p><img src="https://i.stack.imgur.com/0DiMc.png" alt="The screen shot is given below"></p>
11,650,536
6
0
null
2012-07-25 12:23:02.04 UTC
8
2021-01-25 16:49:31.52 UTC
2014-02-03 17:47:51.833 UTC
null
881,229
null
1,442,566
null
1
10
oracle11g|sqlplus
80,374
<p>Login in to your DB with user <code>SYS</code></p> <pre><code>SQL*Plus: Release 11.2.0.1.0 Production on Wed Jul 25 15:13:25 2012 Copyright (c) 1982, 2010, Oracle. All rights reserved. Enter user-name: sys as sysdba Enter password: </code></pre> <p>then issue</p> <pre><code>alter user scott account unlock; </c...
11,612,647
Raw image data from camera like "645 PRO"
<p>A time ago I already asked this question and I also got a good answer:</p> <blockquote> <p>I've been searching this forum up and down but I couldn't find what I really need. I want to get raw image data from the camera. Up till now I tried to get the data out of the imageDataSampleBuffer from that method ...
11,795,983
4
2
null
2012-07-23 12:34:30.3 UTC
9
2017-01-13 19:42:20.66 UTC
2017-05-23 12:32:08.41 UTC
null
-1
null
1,409,716
null
1
12
ios|image|opencv|camera|imagemagick
8,391
<p>I could solve it with OpenCV. Thanks to everyone who helped me.</p> <pre><code>void *baseAddress = CVPixelBufferGetBaseAddress(imageBuffer); cv::Mat frame(height, width, CV_8UC4, (void*)baseAddress); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documen...
11,532,989
Android: decrypt RSA text using a Public key stored in a file
<p>I've been several days trying to do it without success.</p> <p>There are plenty of similar questions here in StackOverflow and even two of them are exactly the same as mine but unanswered and unresolved: 1) <a href="https://stackoverflow.com/questions/7037780/convert-php-rsa-publickey-into-android-publickey">Conver...
11,541,406
4
7
null
2012-07-18 01:12:21.753 UTC
12
2012-08-23 23:12:55.047 UTC
2017-05-23 12:18:18.82 UTC
null
-1
null
1,062,587
null
1
18
android|rsa|encryption
21,050
<p>Finally solved!!! Drums, trumpets and a symphony of enchanting sounds!!!</p> <pre><code>public static byte[] decryptRSA(Context mContext, byte[] message) throws Exception { // reads the public key stored in a file InputStream is = mContext.getResources().openRawResource(R.raw.sm_public); BufferedReade...
11,495,842
How SurfaceHolder callbacks are related to Activity lifecycle?
<p>I've been trying to implement an application that requires camera preview on a surface. As I see the things, both activity and surface lifecycles consist of the following states:</p> <ol> <li>When I first launch my Activity: <code>onResume()-&gt;onSurfaceCreated()-&gt;onSurfaceChanged()</code></li> <li>When I leave...
13,671,391
5
1
null
2012-07-15 21:40:50.977 UTC
37
2016-06-25 07:43:56.727 UTC
null
null
null
null
1,527,426
null
1
73
android|camera|surfaceview
46,291
<p><strong>Edit:</strong> if the targetSDK is greater than 10, putting the app to sleep calls <code>onPause</code> <em>and</em> <code>onStop</code>. <a href="https://stackoverflow.com/a/25497907/1094605">Source</a> </p> <p>I looked at the lifecycle of both the Activity and the SurfaceView in a tiny camera app on my gi...
11,675,077
Measure the time it takes to execute a t-sql query
<p>I have two t-sql queries using SqlServer 2005. How can I measure how long it takes for each one to run? </p> <p>Using my stopwatch doesn't cut it.</p>
11,675,263
7
1
null
2012-07-26 17:49:59.587 UTC
67
2022-09-08 06:17:26.107 UTC
null
null
null
null
130,112
null
1
192
performance|sql-server-2005
254,444
<p>One simplistic approach to measuring the "elapsed time" between events is to just grab the current date and time.</p> <p>In SQL Server Management Studio</p> <pre><code>SELECT GETDATE(); SELECT /* query one */ 1 ; SELECT GETDATE(); SELECT /* query two */ 2 ; SELECT GETDATE(); </code></pre> <p>To calculate elapse...
4,022,535
How to have a "random" order on a set of objects with paging in Django?
<p>I have a model with 100 or so entries - the client would like these entries to appear in a 'random' order, but would also like paging in there.</p> <pre><code>def my_view(request): object_list = Object.objects.all().order_by('?') paginator = Paginator(object_list, 10) page = 1 # or whatever page we have dis...
4,027,044
4
0
null
2010-10-26 09:54:15.507 UTC
9
2016-06-21 06:15:58.34 UTC
null
null
null
null
214,841
null
1
16
django|django-models
9,717
<p>Exactly how random must these be? Does it have to be different for each user, or is it merely the <strong>appearance</strong> of randomness that is important?</p> <p>If it is the latter, then you can simply add a field called <code>ordering</code> to the model in question, and populate it with random integers.</p> ...
3,653,811
ICD-9 Code List in XML, CSV, or Database format
<p>I am looking for a complete list of ICD-9 Codes (Medical Codes) for Diseases and Procedures in a format that can be imported into a database and referenced programmatically. My question is basically exactly the same as <a href="https://stackoverflow.com/questions/1520257/looking-for-resources-for-icd-9-codes">Lookin...
3,761,425
4
1
null
2010-09-06 19:13:49.517 UTC
18
2016-01-18 12:27:39.657 UTC
2017-05-23 10:31:17.15 UTC
null
-1
null
66,231
null
1
33
database|medical
47,197
<p>After removing the RTF it wasn't too hard to parse the file and turn it into a CSV. My resulting parsed files containing all 2009 ICD-9 codes for Diseases and Procedures are here: <a href="http://www.jacotay.com/files/Disease_and_ProcedureCodes_Parsed.zip" rel="noreferrer">http://www.jacotay.com/files/Disease_and_Pr...
4,013,725
converting a canvas into bitmap image in android
<p>I am trying to develop an app on canvas,I am drawing a bitmap on the canvas. After drawing, I am trying to convert into bitmap image.</p> <p>Can anyone give me a suggestion?</p>
4,013,780
4
1
null
2010-10-25 10:37:08.793 UTC
13
2020-04-18 09:30:07.92 UTC
2020-04-18 09:30:07.92 UTC
null
5,446,749
null
486,301
null
1
53
android|bitmap|android-canvas
98,770
<p>Advice depends upon what you are trying to do.</p> <p>If you are concerned that your controls take a long time to draw, and you want to draw to a bitmap so you can blit the bitmap rather than re-drawing via a canvas, then you <em>don't</em> want to be double-guessing the platform - controls automatically cache thei...
3,677,338
How-to get the Application path using javascript
<p>If I have my application hosted in a directory. The application path is the directory name.</p> <p>For example</p> <p><code>http://192.168.1.2/AppName/some.html</code></p> <p>How to get using javascript the application name like in my case <code>/AppName</code>.</p> <p><code>document.domain</code> is returning t...
3,677,392
5
0
null
2010-09-09 14:06:43.547 UTC
3
2018-02-23 13:22:46.61 UTC
2010-09-09 14:14:00.663 UTC
null
137,348
null
137,348
null
1
12
javascript
40,635
<p>This will give you a result but would have to be modified if you have more levels (see commented code).</p> <pre><code>var path = location.pathname.split('/'); if (path[path.length-1].indexOf('.html')&gt;-1) { path.length = path.length - 1; } var app = path[path.length-2]; // if you just want 'three' // var app =...
3,374,591
CTFramesetterSuggestFrameSizeWithConstraints sometimes returns incorrect size?
<p>In the code below, <code>CTFramesetterSuggestFrameSizeWithConstraints</code> sometimes returns a <code>CGSize</code> with a height that is not big enough to contain all the text that is being passed into it. I did look at <a href="https://stackoverflow.com/questions/2707710/core-texts-ctframesettersuggestframesizewi...
3,376,983
7
0
null
2010-07-30 19:05:57.847 UTC
27
2022-07-19 08:55:46.16 UTC
2017-05-23 12:02:45.493 UTC
null
-1
null
294,974
null
1
14
iphone|xcode|core-graphics|core-text
11,621
<p><code>CTFramesetterSuggestFrameSizeWithConstraints()</code> is broken. I filed a bug on this a while back. Your alternative is to use <code>CTFramesetterCreateFrame()</code> with a path that is sufficiently high. Then you can measure the rect of the CTFrame that you get back. Note that you cannot use <code>CGFLOAT_M...
3,355,349
What does the word "semantic" mean in Computer Science context?
<p>I keep coming across the use of this word and I never understand its use or the meaning being conveyed.</p> <p>Phrases like...</p> <blockquote> <p>&quot;add semantics for those who read&quot;</p> <p>&quot;HTML5 semantics&quot;</p> <p>&quot;semantic web&quot;</p> <p>&quot;semantically correctly way to...&quot;</p> </...
3,355,473
7
4
null
2010-07-28 16:57:34.013 UTC
12
2016-08-11 18:38:57.29 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
196,921
null
1
36
definition|semantics
21,827
<p>Semantics are the meaning of various elements in the program (or whatever).</p> <p>For example, let's look at this code:</p> <pre><code>int width, numberOfChildren; </code></pre> <p>Both of these variables are integers. From the compiler's point of view, they are exactly the same. However, judging by the names, o...
3,955,688
How to debug Ruby scripts
<p>I copied the following Ruby code from the Internet and made a few changes but it doesn't work.</p> <p>What can I do to debug the program by myself?</p>
7,994,758
17
3
null
2010-10-17 23:01:54.747 UTC
46
2021-08-16 06:24:08.873 UTC
2020-02-26 22:24:04.433 UTC
null
128,421
null
38,765
null
1
169
ruby|debugging
179,231
<p>Use <a href="http://pryrepl.org/" rel="noreferrer">Pry</a> (<a href="https://github.com/pry/pry" rel="noreferrer">GitHub</a>).</p> <p>Install via:</p> <pre><code>$ gem install pry $ pry </code></pre> <p>Then add:</p> <pre><code>require 'pry'; binding.pry </code></pre> <p>into your program.</p> <p>As of <code>pry</co...
8,135,132
How to encode URL parameters?
<p>I am trying to pass parameters to a URL which looks like this:</p> <pre><code>http://www.foobar.com/foo?imageurl= </code></pre> <p>And I want to pass the parameters such as an image URL which is generated itself by another API, and the link for the image turns out as:</p> <pre><code>http://www.image.com/?username=un...
8,135,197
4
5
null
2011-11-15 10:48:10.647 UTC
9
2021-10-14 13:07:20.19 UTC
2020-08-02 21:08:19.703 UTC
null
2,430,549
null
362,271
null
1
156
javascript|url|encodeuricomponent
194,156
<p><strong>With PHP</strong></p> <pre><code>echo urlencode("http://www.image.com/?username=unknown&amp;password=unknown"); </code></pre> <p>Result</p> <pre><code>http%3A%2F%2Fwww.image.com%2F%3Fusername%3Dunknown%26password%3Dunknown </code></pre> <p><strong>With Javascript:</strong></p> <pre><code>var myUrl = "ht...
7,970,988
Print out the values of a (Mat) matrix in OpenCV C++
<p>I want to dump the values of a matrix in OpenCV to the console using cout. I quickly learned that I do not understand OpenvCV's type system nor C++ templates well enough to accomplish this simple task.</p> <p>Would a reader please post (or point me to) a little function or code snippet that prints a Mat?</p> <p>Re...
7,971,568
5
0
null
2011-11-01 18:22:36.7 UTC
11
2022-01-10 19:55:02.88 UTC
null
null
null
null
290,962
null
1
67
c++|opencv
121,600
<p>See the first answer to <a href="https://stackoverflow.com/questions/1844736/accesing-a-matrix-element-in-the-mat-object-not-the-cvmat-object-in-opencv-c">Accessing a matrix element in the &quot;Mat&quot; object (not the CvMat object) in OpenCV C++</a><br> Then just loop over all the elements in <code>cout &lt;&lt; ...
7,906,332
How to calculate combination and permutation in R?
<p>How one can calculate the number of combinations and permutations in R?</p> <p>The <a href="http://rss.acs.unt.edu/Rdoc/library/Combinations/html/00Index.html" rel="noreferrer">Combinations package</a> failed to install on Linux with the following message:</p> <pre><code>&gt; install.packages(&quot;Combinations&quot...
7,910,439
6
2
null
2011-10-26 16:41:57.03 UTC
24
2021-03-03 22:51:55.217 UTC
2021-01-04 16:31:15.407 UTC
null
6,646,912
Maxim Veksler
48,062
null
1
38
r|combinations
150,586
<p>You can use the <code>combinat</code> package with R 2.13:</p> <pre><code>install.packages("combinat") require(combinat) permn(3) combn(3, 2) </code></pre> <p>If you want to know the number of combination/permutations, then check the size of the result, e.g.:</p> <pre><code>length(permn(3)) dim(combn(3,2))[2] </c...
7,793,927
Message Queue vs Message Bus -- what are the differences?
<p>And are there any? To me, MB knows both subscribers and publishers and acts as a mediator, notifying subscribers on new messages (effectively a "push" model). MQ, on the other hand, is more of a "pull" model, where consumers pull messages off a queue.</p> <p>Am I completely off track here?</p>
7,836,610
7
0
null
2011-10-17 12:45:36.793 UTC
57
2020-07-02 09:39:03.793 UTC
2011-10-18 05:07:47.95 UTC
null
168,868
null
60,188
null
1
140
message-queue|message-bus
94,433
<p>By and large, when it comes to vendor software products, they are used interchangeably, and do not have the strong distinctions in terms of push or pull as you describe.</p> <p>The <em>BUS</em> vs. <em>QUEUE</em> is indeed somewhat a legacy concept, most recently stemming from systems like IBM MQ and Tibco Rendezvo...
8,263,891
Simple way to check if placeholder is supported?
<p>I want to use the <code>HTML5</code> <code>"placeholder"</code> attribute in my code if the user's browser supports it otherwise just print the field name on top of the form. But I only want to check whether placeholder is supported and not what version/name of browser the user is using.</p> <p>So Ideally i would w...
8,263,907
9
0
null
2011-11-25 00:57:16.817 UTC
6
2016-02-25 18:42:14.98 UTC
2011-11-25 01:08:59.267 UTC
null
648,927
null
648,927
null
1
53
javascript|html|placeholder
23,911
<pre><code>function placeholderIsSupported() { var test = document.createElement('input'); return ('placeholder' in test); } </code></pre> <p>I used a <a href="http://www.cssnewbie.com/cross-browser-support-for-html5-placeholder-text-in-forms/" rel="noreferrer">jQuery-ized version</a> as a starting point. (Jus...
4,679,080
phpMyadmin - Error #1064
<p>When trying to create this table in my db, I get an error:</p> <blockquote> <p>#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'unsigned NOT NULL default '0', PRIMARY KEY (reminder_id), KEY reminder_id (rem' at...
4,679,113
3
0
null
2011-01-13 10:34:40.393 UTC
null
2016-02-23 14:07:18.097 UTC
2011-01-13 10:58:01.157 UTC
null
466,826
null
447,208
null
1
2
mysql|phpmyadmin|mysql-error-1064
38,586
<p>The problem is that you're trying to define a text field (varchar) as being unsigned, which is something that can only apply to a numerical field.</p> <p>i.e.: "<code>reminder_date varchar(8) unsigned NOT NULL default '0',</code>" makes no sense.</p> <p>However, as the field is called "reminder_date", I'm guessin...
4,315,660
ALTER TABLE in Magento setup script without using SQL
<p><a href="https://stackoverflow.com/users/336905/jonathan-day">Jonathon Day</a> says</p> <blockquote> <p>"updates SHOULD NOT be in the form of SQL commands". I haven't come across any DDL or DML statments that cannot be executed via Magento's config structures.</p> </blockquote> <p>(In the question <a hre...
4,318,501
3
3
null
2010-11-30 15:54:46.293 UTC
60
2017-02-26 16:34:03.81 UTC
2017-05-23 12:26:09.273 UTC
null
-1
null
471,559
null
1
55
php|sql|magento|installation|entity-attribute-value
43,394
<p>You can use such methods within your setup script:</p> <ul> <li><p>Use <code>Varien_Db_Ddl_Table</code> class to create new tables, where you can configure all the fields, keys, relations in combination with <code>$this-&gt;getConnection()-&gt;createTable($tableObject)</code> Example:</p> <pre><code>/* @var $this ...
4,813,888
Get content of a cell given the row and column numbers
<p>I want to get the content of a cell given its row and column number. The row and column number are stored in cells (here B1,B2). I know the following solutions work, but they feel a bit hacky. </p> <p>Sol 1</p> <pre><code>=CELL("contents",INDIRECT(ADDRESS(B1,B2))) </code></pre> <p>Sol 2</p> <pre><code>=CELL("con...
4,814,166
3
1
null
2011-01-27 07:51:05.243 UTC
18
2018-02-26 15:31:37.16 UTC
2015-01-14 14:42:05.38 UTC
null
4,241,535
null
76,024
null
1
96
excel|excel-formula
556,675
<p>You don't need the CELL() part of your formulas:</p> <pre><code>=INDIRECT(ADDRESS(B1,B2)) </code></pre> <p>or </p> <pre><code>=OFFSET($A$1, B1-1,B2-1) </code></pre> <p>will both work. Note that both <code>INDIRECT</code> and <code>OFFSET</code> are volatile functions. Volatile functions can slow down calculation...
4,150,780
Removing underline from specific anchor tag
<p>Why does the following anchor tag has text underlined?</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-css lang-css prettyprint-override"><code>.pagerLink { background-color: #E4F5F8; border: 1px solid #C0DEE...
4,150,803
4
0
null
2010-11-11 01:50:13.657 UTC
0
2020-07-11 08:01:45.067 UTC
2020-07-11 08:01:45.067 UTC
null
6,904,888
null
167,520
null
1
15
css
71,612
<p>Probably because another style block has better <a href="http://www.webdesignfromscratch.com/html-css/css-inheritance-cascade/" rel="noreferrer">precedence</a> than your <code>pagerLink</code> class. Try:</p> <pre><code>.pagerLink { background-color: #E4F5F8; border: 1px solid #C0DEED; text-decoration:...
4,219,743
balancing an AVL tree (C++)
<p>I'm having the hardest time trying to figure out how to balance an AVL tree for my class. I've got it inserting with this:</p> <pre><code>Node* Tree::insert(int d) { cout &lt;&lt; "base insert\t" &lt;&lt; d &lt;&lt; endl; if (head == NULL) return (head = new Node(d)); else return insert(...
4,219,934
4
2
null
2010-11-18 21:25:48.733 UTC
9
2016-09-12 03:13:03.493 UTC
2010-11-20 08:33:02.357 UTC
null
459,950
null
459,950
null
1
20
c++|algorithm|data-structures|binary-tree|avl-tree
40,632
<p>You can measure the <code>height</code> of a branch at a given point to calculate the unbalance</p> <p><em>(remember a difference in height (levels) >= 2 means your tree is not balanced)</em> </p> <pre><code>int Tree::Height(TreeNode *node){ int left, right; if(node==NULL) return 0; left =...
4,635,680
What is the best way to get date and time in Clojure?
<p>I need to log some events on a Clojure Client-Server scenario, but it seems to me that Clojure does not provide a date/time function. Can any one confirm this or I am missing something here?! If I am correct then I need to use java interop, right?</p>
4,635,979
5
0
null
2011-01-08 19:23:49.57 UTC
6
2018-10-23 17:56:47.487 UTC
2016-03-16 17:39:52.92 UTC
null
425,313
null
487,855
null
1
45
java|datetime|clojure
40,260
<p>If all you need is to get the current time and date for your logger, then this function is OK:</p> <pre><code> (defn now [] (new java.util.Date)) </code></pre> <p>Now that you mentioned this, it would be useful to have support for immutable Date objects.</p>
4,203,634
Singleton with parameters
<p>I need a singleton class to be instantiated with some arguments. The way I'm doing it now is:</p> <pre><code>class SingletonExample { private SingletonExample mInstance; //other members... private SingletonExample() { } public SingletonExample Instance { get {...
4,203,775
6
7
null
2010-11-17 10:54:08.66 UTC
9
2022-09-14 10:53:54.853 UTC
2010-11-17 11:23:55.813 UTC
null
79,444
null
79,444
null
1
41
c#|design-patterns|parameters|singleton|arguments
70,163
<p>A Singleton with parameters smells fishy to me. </p> <p>Consider whateva's answer and the following code:</p> <pre><code>Singleton x = Singleton.getInstance("hello", "world"); Singleton y = Singleton.getInstance("foo", "bar"); </code></pre> <p>Obviously, x==y and y works with x's creation parameters, while y's cr...
4,535,782
Select count of rows in another table in a Postgres SELECT statement
<p>I don't know quite how to phrase this so please help me with the title as well. :)</p> <p>I have two tables. Let's call them <code>A</code> and <code>B</code>. The <code>B</code> table has a <code>a_id</code> foreign key that points at <code>A.id</code>. Now I would like to write a <code>SELECT</code> statement tha...
4,535,814
6
1
null
2010-12-26 23:05:36.12 UTC
16
2021-04-20 14:42:42.55 UTC
2010-12-27 00:32:01.853 UTC
user234932
null
user234932
null
null
1
73
sql|postgresql
100,650
<pre><code>SELECT A.*, (SELECT COUNT(*) FROM B WHERE B.a_id = A.id) AS TOT FROM A </code></pre>
4,149,462
iPhone Enterpise Deployment: Mobile Device Management
<p>I was reading up on iPhone in the enterprise and saw something about Mobile Device Management servers. As far as I can tell, there are a few 3rd party MDM vendors, but Apple says that one could implement their own.</p> <p>The iPhone Configuration Utility allows you to set up a Server URL, Check in URL, Topic, Ident...
11,074,375
7
0
null
2010-11-10 21:51:52.837 UTC
14
2018-04-13 11:10:13.8 UTC
null
null
null
null
1,603,984
null
1
13
iphone|enterprise|mdm
5,550
<p>The best document for iOS MDM implementation is <a href="https://media.blackhat.com/bh-us-11/Schuetz/BH_US_11_Schuetz_InsideAppleMDM_WP.pdf" rel="nofollow noreferrer">https://media.blackhat.com/bh-us-11/Schuetz/BH_US_11_Schuetz_InsideAppleMDM_WP.pdf</a>. You can get sufficient detail to implement iOS MDM. Refer this...
4,700,357
Comparing strings in Java
<p>Im trying to compare the values of two edittext boxes. What i would like is to just compare passw1 = passw2. As my code is now comparing two strings i have entered as i could not get to compare them.</p> <pre><code> final EditText passw1= (EditText) findViewById(R.id.passw1); final EditText passw2= (EditText) find...
4,700,411
9
0
null
2011-01-15 15:24:02.22 UTC
3
2022-08-22 05:03:02.617 UTC
2011-01-15 16:23:46.75 UTC
null
47,961
null
554,215
null
1
9
java|android|string
118,718
<p>[EDIT] I made a mistake earlier, because, to get the text, you need to use .getText().toString().</p> <p>Here is a full working example:</p> <pre><code>package com.psegina.passwordTest01; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; imp...
4,576,331
UIButton label text is being clipped
<p>I have a UIButton built in Interface Builder that has a default label. In Xcode, I'm changing the label text dynamically like so:</p> <pre><code>myButton.titleLabel.text = @"this is the new label"; </code></pre> <p>However, when the text updates, the new string is being clipped down to the same size as the origina...
4,581,917
9
0
null
2011-01-01 23:39:11.633 UTC
5
2022-04-16 08:46:25.5 UTC
2011-01-03 03:25:12.09 UTC
null
714
null
496,326
null
1
43
iphone|cocoa-touch|uibutton
33,081
<p>You should use <a href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIButton_Class/UIButton/UIButton.html#//apple_ref/doc/uid/TP40006815-CH3-SW7" rel="noreferrer">setTitle:forState:</a> to change the title of a <code>UIButton</code>. If you change the title yourself, the button has no indica...
4,108,313
How do I find the length of an array?
<p>Is there a way to find how many values an array has? Detecting whether or not I've reached the end of an array would also work.</p>
4,108,340
30
5
null
2010-11-05 17:15:54.193 UTC
165
2022-06-27 09:37:26.33 UTC
2011-11-30 13:20:01.94 UTC
null
497,934
null
497,934
null
1
671
c++|arrays
1,845,318
<p>If you mean a C-style array, then you can do something like:</p> <pre><code>int a[7]; std::cout &lt;&lt; &quot;Length of array = &quot; &lt;&lt; (sizeof(a)/sizeof(*a)) &lt;&lt; std::endl; </code></pre> <p>This doesn't work on pointers (i.e. it <strong>won't work for either of the following</strong>):</p> <pre><code>...
14,449,499
MVC 4 Intranet Authentication with Custom Roles
<p>I have spent some time searching and found a lot of confusing answers, so I will post here for clarification.</p> <p>I am using MVC4 VS2012 created an Intranet site using domain authentication. Everything works. However, to manage the users that have access to different areas of this webapp I prefer not to use AD...
14,466,907
1
0
null
2013-01-22 00:14:41.553 UTC
10
2015-08-05 10:15:16.95 UTC
2017-05-23 12:34:01.36 UTC
null
-1
null
1,757,668
null
1
15
asp.net-mvc-4|visual-studio-2012|security|intranet
12,850
<p>I'm using this configuration with SQL Server and MVC3.</p> <p>Web.config:</p> <pre><code>&lt;system.web&gt; &lt;roleManager enabled="true" defaultProvider="SqlRoleManager"&gt; &lt;providers&gt; &lt;clear /&gt; &lt;add name="SqlRoleManager" type="System.Web.Security.SqlRoleProvider" connectionStringName...
14,584,115
PHP strtotime +1 month adding an extra month
<p>I have a simple variable that adds one month to today:</p> <pre><code>$endOfCycle = date("Y-m", strtotime("+1 month")); </code></pre> <p>Today is January 2013, so I would expect to get back 2013-02 but I'm getting 2013-03 instead. I can't figure out why it's jumping to March.</p>
14,584,265
7
1
null
2013-01-29 13:30:14.74 UTC
4
2013-01-31 12:30:51.707 UTC
null
null
null
null
1,819,502
null
1
24
php|date|strtotime
124,418
<p>It's jumping to March because today is 29th Jan, and adding a month gives 29th Feb, which doesn't exist, so it's moving to the next valid date.</p> <p>This will happen on the 31st of a lot of months as well, but is obviously more noticable in the case of January to Feburary because Feb is shorter.</p> <p>If you're...
14,522,540
Close a MessageBox after several seconds
<p>I have a Windows Forms application VS2010 C# where I display a MessageBox for show a message. </p> <p>I have an okay button, but if they walk away, I want to timeout and close the message box after lets say 5 seconds, automatically close the message box.</p> <p>There are custom MessageBox (that inherited from Form...
14,522,952
15
7
null
2013-01-25 13:14:23.383 UTC
37
2022-05-17 03:35:14.21 UTC
2017-05-23 12:09:59.617 UTC
null
-1
null
206,730
null
1
93
c#|winforms|messagebox
198,881
<p>Try the following approach:</p> <pre><code>AutoClosingMessageBox.Show("Text", "Caption", 1000); </code></pre> <p>Where the <code>AutoClosingMessageBox</code> class implemented as following:</p> <pre><code>public class AutoClosingMessageBox { System.Threading.Timer _timeoutTimer; string _caption; AutoC...
35,703,556
What does it mean to squash commits in git?
<p>What does Squashing commits in git mean. How do I squash commits in Github?</p> <p>I'm new to Git and I requested to be assigned to a newcomer bug in coala-analyzer. I fixed the bug, and now I was asked to squash my commits. How do I do it? </p>
35,704,829
3
0
null
2016-02-29 15:40:26.78 UTC
58
2022-01-08 16:18:09.733 UTC
2018-11-07 15:55:44.233 UTC
null
636,987
null
5,589,746
null
1
214
git|github
121,722
<p>You can think of Git as an advanced database of snapshots of your working directory(ies). </p> <p>One very nice feature of Git is the ability to rewrite the history of commits.<br> The principal reason for doing this is that a lot of such history is relevant only for the developer who generated it, so it must be s...
25,719,319
Is it possible to make Font Awesome icons larger than 'fa-5x'?
<p>I am using this HTML code:</p> <pre><code>&lt;div class="col-lg-4"&gt; &lt;div class="panel"&gt; &lt;div class="panel-heading"&gt; &lt;div class="row"&gt; &lt;div class="col-xs-3"&gt; &lt;i class="fa fa-cogs fa-5x"&gt;&lt;/i&gt; &lt;/div&gt; &lt;div class="col-xs-9 text...
25,719,710
7
0
null
2014-09-08 07:31:01.617 UTC
9
2021-08-28 14:35:04.203 UTC
null
null
null
null
3,973,427
null
1
67
html|css|twitter-bootstrap|font-awesome
122,718
<p>Font awesome is just a font so you can use the font size attribute in your CSS to change the size of the icon.</p> <p>So you can just add a class to the icon like this:</p> <pre><code>.big-icon { font-size: 32px; } </code></pre>
43,469,241
Passing lambda instead of interface
<p>I have created an interface:</p> <pre><code>interface ProgressListener { fun transferred(bytesUploaded: Long) } </code></pre> <p>but can use it only as an anonymous class, not lambda</p> <pre><code>dataManager.createAndSubmitSendIt(title, message, object : ProgressListener { override fun transferred(bytesUpl...
43,470,351
5
0
null
2017-04-18 10:07:19.767 UTC
12
2022-06-01 19:36:00.937 UTC
2020-07-26 22:12:56.68 UTC
null
13,363,205
null
4,978,624
null
1
86
lambda|kotlin
25,985
<p>As @zsmb13 said, SAM conversions are only supported for Java interfaces.</p> <p>You could create an extension function to make it work though:</p> <pre><code>// Assuming the type of dataManager is DataManager. fun DataManager.createAndSubmitSendIt(title: String, message: String...
2,617,969
How can I change the images on an ImageButton in Android when using a OnTouchListener?
<p>I have the following code which creates an ImageButton and plays a sound when clicked:</p> <pre><code>ImageButton SoundButton1 = (ImageButton)findViewById(R.id.sound1); SoundButton1.setImageResource(R.drawable.my_button); SoundButton1.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, Mo...
2,617,986
2
0
null
2010-04-11 17:32:35.377 UTC
2
2013-09-03 12:34:36.007 UTC
2013-09-03 12:34:36.007 UTC
null
1,006,780
null
313,717
null
1
13
android|imagebutton
57,498
<p>I think the solution is simple: remove the <code>return true</code> from the ontouchlistener. Since that blocks all further operations that respond to touch and input. Make it <code>return false</code> too.</p> <p>This way it will allow other actions to also respond to the touch.</p>
2,571,232
Parse HTML with PHP's HTML DOMDocument
<p>I was trying to do it with "getElementsByTagName", but it wasn't working, I'm new to using DOMDocument to parse HTML, as I used to use regex until yesterday some kind fokes here told me that DOMEDocument would be better for the job, so I'm giving it a try :)</p> <p>I google around for a while looking for some expla...
2,571,242
2
0
null
2010-04-03 12:23:59.473 UTC
12
2016-01-22 01:18:27.01 UTC
null
null
null
null
138,541
null
1
22
php|html|parsing|domdocument
47,011
<p>If you want to get :</p> <ul> <li>The text</li> <li>that's inside a <code>&lt;div&gt;</code> tag with <code>class="text"</code></li> <li>that's, itself, inside a <code>&lt;div&gt;</code> with <code>class="main"</code></li> </ul> <p>I would say the easiest way is not to use <a href="http://fr.php.net/manual/en/domd...
2,937,120
How to get javascript object references or reference count?
<h2>How to get reference count for an object</h2> <ul> <li>Is it possible to determine if a javascript object has <strong>multiple references</strong> to it? </li> <li>Or if it has references <strong>besides the one I'm accessing it with</strong>? </li> <li>Or even just to get the <strong>reference count</strong> itse...
2,937,218
2
5
null
2010-05-30 00:45:49.19 UTC
15
2017-02-12 09:02:07.67 UTC
null
null
null
null
220,599
null
1
71
javascript|garbage-collection|reference
34,481
<p>No, no, no, no; and yes, if you really need to count references you will have to do it manually. JS has no interface to this, GC, or weak references.</p> <p>Whilst you <em>could</em> implement a manual reference-counted object list, it's questionable whether all the extra overhead (in performance terms but more imp...
30,098,942
javascript set all values in array of object
<p>Two part question about similar problems. I've got 2 different arrays,</p> <p><strong>array 1:</strong></p> <pre><code> array1 = [{ name : "users", checked : true }, { name : "active users", checked : false }, { name : "completions", checked : false }] </code></pre> <p>I wou...
30,099,032
4
1
null
2015-05-07 10:50:25.203 UTC
2
2018-04-19 06:16:46.55 UTC
null
null
null
null
4,219,258
null
1
26
javascript|arrays
51,980
<p>You can't do this without looping over the elements, however there are functional abstractions you can use instead of <code>for</code>:</p> <p>For array 1, you can use <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/map#Browser_compatability" rel="noreferrer">map</a></p>...
38,546,108
Django Aggregation - Expression contains mixed types. You must set output_field
<p>I'm trying to achive an Aggregation Query and that's my code:</p> <pre><code>TicketGroup.objects.filter(event=event).aggregate( total_group=Sum(F('total_sold')*F('final_price'))) </code></pre> <p>I have 'total_sold' and 'final_price' in TicketGroup object and all what I want to do is sum...
38,546,324
2
0
null
2016-07-23 20:23:57.777 UTC
10
2019-06-20 13:38:49.457 UTC
null
null
null
null
3,350,765
null
1
59
django|aggregate-functions|django-queryset|django-orm
30,129
<p>By <code>output_field</code> Django means to provide field type for the result of the <code>Sum</code>.</p> <pre><code>from django.db.models import FloatField, F total_group=Sum(F('total_sold')*F('final_price'), output_field=FloatField()) </code></pre> <p>should do the trick.</p>
49,615,857
Angular paramMap vs queryParamMap?
<p>What are the different paramMap and queryParamMap?</p> <p>Angular website says paramMap - An Observable that contains a map of the required and optional parameters specific to the route. The map supports retrieving single and multiple values from the same parameter.</p> <p>queryParamMap - An Observable that cont...
49,617,621
2
0
null
2018-04-02 17:32:33.853 UTC
4
2020-10-11 14:40:59.427 UTC
null
null
null
null
7,466,200
null
1
39
angular|routing
25,638
<p>ParamMap for routes like <code>user/:id</code>. <code>Id</code> param belongs only this route.</p> <p>QueryParamMap is for eg. <code>user/:id?tab=edit</code>. <code>Tab</code> is a global query param, it can be read from the ActivatedRoute in the user route's component as well as any of its ancestors.</p>
35,831,496
Key error when selecting columns in pandas dataframe after read_csv
<p>I'm trying to read in a CSV file into a pandas dataframe and select a column, but keep getting a key error.</p> <p>The file reads in successfully and I can view the dataframe in an iPython notebook, but when I want to select a column any other than the first one, it throws a key error.</p> <p>I am using this code:...
35,831,531
5
0
null
2016-03-06 19:30:52.2 UTC
16
2022-09-11 11:31:59.95 UTC
2020-06-14 05:49:15.373 UTC
null
1,883,468
null
1,883,468
null
1
49
python|csv|pandas
172,815
<p>use <code>sep='\s*,\s*'</code> so that you will take care of spaces in column-names:</p> <pre><code>transactions = pd.read_csv('transactions.csv', sep=r'\s*,\s*', header=0, encoding='ascii', engine='python') </code></pre> <p>alternatively you can make sure that you don't have unquoted sp...
34,848,505
How to make a loading animation in Console Application written in JavaScript or NodeJs?
<p>How to make a loading animation in Console Application written in JavaScript or NodeJs?</p> <p>Example animation or other animation.</p> <pre><code>1. -- 2. \ 3. | 4. / 5. -- </code></pre>
34,848,607
4
0
null
2016-01-18 06:31:05.81 UTC
11
2022-01-23 22:20:28.63 UTC
null
null
null
null
5,790,663
null
1
23
javascript|node.js
23,332
<p>Not really possible in browser console. In Node.js:</p> <pre><code>var twirlTimer = (function() { var P = ["\\", "|", "/", "-"]; var x = 0; return setInterval(function() { process.stdout.write("\r" + P[x++]); x &amp;= 3; }, 250); })(); </code></pre>
45,230,531
Programmatically change Redux-Form Field value
<p>When I use <code>redux-form</code> v7, I find there is no way to set the field value. Now in my <code>form</code>, I have two <code>select</code> component. The second's value will be clear when the first <code>select</code> component value changed.</p> <p>In class render:</p> <pre><code>&lt;div className={classNa...
45,231,071
1
0
null
2017-07-21 06:29:56.527 UTC
9
2021-01-26 22:54:07.267 UTC
2018-11-02 12:17:37.703 UTC
null
1,033,581
null
6,708,649
null
1
46
javascript|reactjs|redux|redux-form
57,445
<p>You can have the onChange logic in <code>this.handleSelectChange({ value, type: input.name })</code> and use <a href="http://redux-form.com/7.0.0/docs/api/Props.md/#-code-change-field-string-value-any-function-code-" rel="noreferrer"><code>change</code> action from redux-form</a></p> <p>According to the docs:</p> <b...
64,202,815
Getting issue in keychain: iPhone Distribution Certificate is not trusted
<p>I'm working on iOS enterprise application, now our iOS distribution certificate is expired and I'm creating new certificate using below steps:</p> <ol> <li>Create certificate sigining request from keychain access.</li> <li>Login with developer.apple.com and generate distribution certificate using certificate siginin...
64,209,916
6
0
null
2020-10-05 05:16:38.307 UTC
4
2022-06-21 14:14:43.293 UTC
null
null
null
null
1,806,232
null
1
34
ios|ios-enterprise
20,819
<p><a href="https://developer.apple.com/de/support/expiration/" rel="noreferrer">https://developer.apple.com/de/support/expiration/</a> should be the answer. Just install the certificate manually or upgrade to Xcode 11.4.1 or later. After upgrading to Xcode &gt;= 11.4.1 I had to open a Xcode project and had to wait few...
31,881,754
md-select can't set selected value
<p>I have a <code>md-select</code> set up as follows:</p> <pre><code>&lt;md-select placeholder="Category" ng-model="current.Category" flex &gt; &lt;md-option ng-repeat="item in categories" ng-value="{{item}}"&gt;{{item.Name}}&lt;/md-option&gt; &lt;/md-select&gt; </code></pre> <p><code>@scope.categories</code> val...
31,882,550
7
0
null
2015-08-07 15:44:08.383 UTC
6
2018-05-01 18:51:34.617 UTC
2015-08-07 16:34:33.203 UTC
null
3,201,696
null
2,501,497
null
1
24
angularjs|angular-material
48,218
<p>The documentation isn't explicit, but you should use <code>ng-selected</code>. I've created a <a href="http://codepen.io/anon/pen/VLRweg">codepen</a> to illustrate, but basically:</p> <pre><code>&lt;md-option ng-repeat="(index,item) in categories" ng-value="{{item}}" ng-selected="index == 1"&gt; ...
31,811,074
OpenStreetMap: get coordinates from address
<p>Is there any function in OpenStreetMap that gives you the coordinated from an address ?</p> <p>something like </p> <pre><code>http://router.project-osrm.org/locate?request=GetGeocoding&amp;nbaddresses=1&amp;outputFormat=json&amp;addresses_0=1240+Place+Jourdan+PARIS </code></pre>
31,818,027
1
0
null
2015-08-04 13:46:29.96 UTC
11
2015-08-04 19:50:33.02 UTC
2015-08-04 14:02:17.077 UTC
null
4,450,024
null
4,450,024
null
1
33
geolocation
40,801
<p>I have it, Nominatim is a tool to search OSM data by name and address and to generate synthetic addresses of OSM points (reverse geocoding).</p> <p><a href="http://nominatim.openstreetmap.org/search?q=135+pilkington+avenue,+birmingham&amp;format=json&amp;polygon=1&amp;addressdetails=1" rel="noreferrer">http://nomin...
27,989,762
Get this week's monday's date in Postgres?
<p>How can I get this week's monday's date in PostgreSQL?</p> <p>For example, today is 01/16/15 (Friday). This week's monday date is 01/12/15.</p>
27,990,193
4
0
null
2015-01-16 17:45:46.143 UTC
3
2020-09-14 05:50:46.297 UTC
null
null
null
null
1,360,959
null
1
33
postgresql
27,163
<pre><code>SELECT current_date + cast(abs(extract(dow FROM current_date) - 7) + 1 AS int); </code></pre> <p>works, although there might be more elegant ways of doing it.</p> <p>The general idea is to get the current day of the week, <code>dow</code>, subtract 7, and take the abs, which will give you the number of days ...
28,156,011
how to change editor behavior in intellij idea
<p>I have installed IntelliJIdea 14.0.2 just now. I do not know its default editor but it is opening my source files in <code>vi</code> option now. So, not letting me do default action like <code>Ctrl + v</code>, <code>Ctrl + d</code> which was present before and I used to like it.</p> <p>So, how to change this behavi...
28,158,198
4
0
null
2015-01-26 18:05:10.023 UTC
17
2019-03-13 19:46:05.34 UTC
2016-12-14 16:07:53.797 UTC
null
2,197,975
null
4,281,491
null
1
60
vim|intellij-idea|sublimetext|vi|ideavim
46,121
<p>If you don't need vi keybindings, uninstall the IdeaVIM plugin.</p>
28,071,459
compare 2 cells in excel by using vba
<p>I would like to compare 2 cells' value and see whether they are match or not. I know how to do it on excel but I dont' know how to put it vba code.</p> <p><strong>Input &amp; output:</strong></p> <ol> <li>The value of cell A1 is already in the excel.</li> <li>Manually enter a value in Cell B1.</li> <li>click on a ...
28,072,507
5
0
null
2015-01-21 15:55:18.31 UTC
1
2018-11-21 13:06:51.28 UTC
null
null
null
null
4,233,291
null
1
8
vba|excel
109,141
<p>You can use the IIF function in VBA. It is similar to the Excel IF</p> <pre><code>[c1] = IIf([a1] = [b1], "Yes", "No") </code></pre>
27,112,461
WooCommerce - send custom email on custom order status change
<p>I added a custom status <code>wc-order-confirmed</code>:</p> <pre><code>// Register new status function register_order_confirmed_order_status() { register_post_status( 'wc-order-confirmed', array( 'label' =&gt; 'Potvrzení objednávky', 'public' =&gt; true, 'exclude_from_search' =&gt; fals...
27,122,473
4
0
null
2014-11-24 19:18:47.3 UTC
10
2020-07-29 18:48:24.523 UTC
null
null
null
null
1,049,961
null
1
15
php|wordpress|woocommerce
41,290
<p>As Xcid's answer indicates, you need to register the email. </p> <p>In WC 2.2+ I believe you can do this via the following:</p> <pre><code>add_action( 'woocommerce_order_status_wc-order-confirmed', array( WC(), 'send_transactional_email' ), 10, 10 ); </code></pre> <p>I'd added a filter to WooCommerce 2.3, so when...
46,222,692
ASP.NET Core 2 Seed Database
<p>I've seen some of the similar examples on SO regarding this but I don't know enough about the language just yet to see what I'm doing wrong. I've cobbled together a demo to learn more but I'm having trouble seeding my database.</p> <p>I receive the following error:</p> <blockquote> <p>InvalidOperationException: Cann...
46,688,953
2
0
null
2017-09-14 15:11:02.937 UTC
11
2018-02-26 09:32:59.79 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
1,322,017
null
1
14
c#|asp.net|.net|.net-core-2.0
31,775
<p>In ASP.NET Core 2.0 the following changes are recommended. (Seeding in startup.cs works for Core 1.x. For 2.0 go into Program.cs, modify the Main method to do the following on application startup: Get a database context instance from the dependency injection container. Call the seed method, passing to it the context...
41,946,475
git: why can't I delete my branch after a squash merge?
<p>I have a git repo with <code>mainline</code> (equivalent to <code>master</code>) and some local feature branches. For example:</p> <pre><code>$ git branch * mainline feature1 feature2 feature3 </code></pre> <p>When I do the following, I am able to squash merge all of my edits in a feature branch into one co...
41,947,745
2
0
null
2017-01-30 22:24:05.75 UTC
11
2020-03-03 07:01:00.683 UTC
null
null
null
null
1,002,119
null
1
53
git|merge|git-merge
10,597
<p>This happens because Git doesn't know that the squash merge is "equivalent to" the various branch-specific commits. You must forcibly delete the branch, with <code>git branch -D</code> instead of <code>git branch -d</code>.</p> <p>(The rest of this is merely about <em>why</em> this is the case.)</p> <h3>Draw the ...
24,508,053
Difference between ng-model and data-ng-model
<p>I am new with the <strong>AngularJs</strong>. Can anyone say the difference between ng-model and data-ng-model?</p> <p><strong>With ng-model</strong></p> <pre><code>First Name : &lt;input type="text" ng-model="fname" id="fname"&gt; Second Name : &lt;input type="text" ng-model="lname" id="lname"&gt; </code></p...
24,508,309
6
0
null
2014-07-01 10:31:55.707 UTC
5
2022-03-03 16:24:06.95 UTC
2018-08-26 22:00:22.047 UTC
null
5,939,058
null
3,783,175
null
1
36
angularjs
35,624
<p>Best Practice: Prefer using the dash-delimited format (e.g. ng-bind for ngBind). <strong>If you want to use an HTML validating tool, you can instead use the data-prefixed version (e.g. data-ng-bind for ngBind).</strong> The other forms shown above are accepted for legacy reasons but we advise you to avoid them.</p>
10,757,963
how to loop through an array to find more than one pattern using perl regex?
<p>I'm trying to find two patterns within an array and put the results into another array.</p> <p>For example</p> <pre><code> $/ = "__Data__"; __Data__ #SCSI_test # put this line into @arrayNewLines kdkdkdkdkdkdkdkd dkdkdkdkdkdkdkdkd - ccccccccccccccc # put this line into @arrayNewLines </...
10,759,110
2
0
null
2012-05-25 16:17:14.48 UTC
null
2016-06-04 01:10:09.347 UTC
2012-05-25 16:21:16.69 UTC
null
176,569
null
1,169,845
null
1
2
perl
43,713
<p>That code does not print just <code>cccccc...</code>, it prints everything. Your problem is this line:</p> <pre><code>if($arrayOld[$i] =~ /^-(.*)/g or /\#(.*)/g) { </code></pre> <p>What you are doing here is first checking <code>$arrayOld[$i]</code> and then checking <code>$_</code>, because <code>/\#(.*)/</code> ...
21,362,301
Yii2: check exist ActiveRecord model in database
<p>How to check existence of model in DB? In Yii 1 version it was so <code>User::model()-&gt;exist()</code></p>
21,374,795
2
0
null
2014-01-26 10:30:07.217 UTC
2
2018-11-26 11:53:07.18 UTC
2014-05-23 20:24:46.27 UTC
null
724,036
null
1,491,378
null
1
26
php|yii2
41,098
<p>In Yii2 you can add <code>exists()</code> to your query chain:</p> <pre><code>User::find() -&gt;where( [ 'id' =&gt; 1 ] ) -&gt;exists(); </code></pre> <p>(The generated SQL looks like this: <code>SELECT 1 FROM `tbl_user` WHERE `id`=1</code>.) </p> <p>Here is <a href="https://github.com/yiisoft/yii2/blob/...
47,604,184
How to create a custom streaming data source?
<p>I have a custom reader for Spark Streaming that reads data from WebSocket. I'm going to try Spark Structured Streaming.</p> <p>How to create a streaming data source in Spark Structured Streaming?</p>
47,608,536
4
0
null
2017-12-02 03:10:59.39 UTC
14
2022-05-28 14:29:49.637 UTC
2018-10-27 12:57:08.847 UTC
null
1,560,062
null
2,134,595
null
1
13
apache-spark|spark-structured-streaming
8,410
<p>A streaming data source implements <a href="https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/Source.scala" rel="noreferrer">org.apache.spark.sql.execution.streaming.Source</a>.</p> <p>The scaladoc of <code>org.apache.spark.sql.execution.streaming.Source</c...
7,605,011
Why is 0 == "" true in JavaScript
<p>Why is <code>0 == ""</code> true in JavaScript? I have found a <a href="https://stackoverflow.com/questions/4567393/why-do-alert0-and-alertfalse-0-both-output-true-in-javascript">similar post here</a>, but why is a number 0 similar an empty string? Of course, <code>0 === ""</code> is false.</p>
7,605,024
1
9
null
2011-09-30 01:09:50.8 UTC
13
2012-07-23 00:12:11.147 UTC
2017-05-23 11:47:08.953 UTC
null
-1
null
356,726
null
1
35
javascript
15,207
<pre><code>0 == '' </code></pre> <p>The left operand is of the type Number.<br> The right operand is of the type String.</p> <p>In this case, the right operand is coerced to the type Number:</p> <pre><code>0 == Number('') </code></pre> <p>which results in</p> <pre><code>0 == 0 </code></pre> <hr> <p>From the <str...
2,936,598
MongoDB Schema Design - Real-time Chat
<p>I'm starting a project which I think will be particularly suited to MongoDB due to the speed and scalability it affords.</p> <p>The module I'm currently interested in is to do with real-time chat. If I was to do this in a traditional RDBMS I'd split it out into:</p> <ul> <li>Channel (A channel has many users)</li...
2,937,029
3
0
null
2010-05-29 21:02:38.86 UTC
11
2017-07-11 09:47:56.043 UTC
2017-09-22 18:01:22.247 UTC
null
-1
null
283,844
null
1
13
mongodb|rabbitmq|activemq|schema-design|nosql
13,548
<p>I used <a href="http://code.google.com/p/redis/" rel="nofollow noreferrer">Redis</a>, NGINX &amp; PHP-FPM for my chat project. Not super elegant, but it does the trick. There are a few pieces to the puzzle.</p> <ol> <li><p>There is a very simple PHP script that receives client commands and puts them in one massive ...
2,524,737
Fixed-size floating point types
<p>In the <code>stdint.h</code> (C99), <a href="http://www.boost.org/doc/libs/1_42_0/libs/integer/doc/html/boost_integer/cstdint.html" rel="noreferrer">boost/cstdint.hpp</a>, and <code>cstdint</code> (C++0x) headers there is, among others, the type <code>int32_t</code>.</p> <p>Are there similar fixed-size floating poi...
2,524,933
4
7
null
2010-03-26 16:07:46.027 UTC
10
2017-11-09 06:57:37.833 UTC
2017-04-30 01:46:02.81 UTC
Roger Pate
1,267,663
null
235,472
null
1
111
c++|c|boost|floating-point
59,149
<p>Nothing like this exists in the C or C++ standards at present. In fact, there isn't even a guarantee that <code>float</code> will be a binary floating-point format at all.</p> <p>Some compilers guarantee that the <code>float</code> type will be the IEEE-754 32 bit binary format. Some do not. In reality, <code>fl...
8,876
Evidence Based Scheduling Tool
<p>Are there any free tools that implement evidence-based scheduling like <a href="http://www.joelonsoftware.com/items/2007/10/26.html" rel="nofollow noreferrer">Joel talks about</a>? There is FogBugz, of course, but I am looking for a simple and free tool that can apply EBS on some tasks that I give estimates (and act...
8,882
2
6
null
2008-08-12 14:16:41.757 UTC
8
2013-09-27 20:20:26.243 UTC
2013-09-27 20:20:26.243 UTC
buyutec
277,932
buyutec
31,505
null
1
30
fogbugz
3,135
<p>FogBugz is free for up to 2 users by the way. As far I know this is the only tool that does EBS.</p> <p>See here <a href="http://www.workhappy.net/2008/06/get-fogbugz-for.html" rel="noreferrer">http://www.workhappy.net/2008/06/get-fogbugz-for.html</a></p>
2,864,796
EasyMock vs Mockito: design vs maintainability?
<p>One way of thinking about this is: if we care about the design of the code then EasyMock is the better choice as it gives feedback to you by its concept of expectations.</p> <p>If we care about the maintainability of tests (easier to read, write and having less brittle tests which are not affected much by change), ...
2,872,197
5
1
null
2010-05-19 10:50:38.81 UTC
20
2015-08-24 08:29:26.807 UTC
2013-06-13 22:32:33.627 UTC
null
843,804
null
238,012
null
1
57
easymock|mockito
33,338
<p>I'm an EasyMock developer so a bit partial but of course I've used EasyMock on large scale projects.</p> <p>My opinion is that EasyMock tests will indeed breaks once in a while. EasyMock forces you to do a complete recording of what you expect. This requires some discipline. You should really record what is expecte...
2,429,642
Why it's impossible to throw exception from __toString()?
<p>Why it's impossible to throw exception from __toString()?</p> <pre><code>class a { public function __toString() { throw new Exception(); } } $a = new a(); echo $a; </code></pre> <p>the code above produces this:</p> <pre><code>Fatal error: Method a::__toString() must not throw an exception in ...
2,429,735
6
1
null
2010-03-12 00:15:45.803 UTC
5
2019-06-28 11:19:41.26 UTC
2013-02-17 05:54:49.537 UTC
null
127,880
null
251,311
null
1
47
php|exception
19,957
<p>After a couple searches I found this, which says:</p> <blockquote> <p>Johannes explained that <strong>there is no way to ensure that an exception thrown during a cast to string would be handled correctly by the Zend Engine</strong>, and that this won't change unless large parts of the Engine are rewritten. He add...
2,762,778
Grab remaining text after last "/" in a php string
<p>So, lets say I have a <code>$somestring</code> thats holds the value "main/physician/physician_view".</p> <p>I want to grab just "physician_view". I want it to also work if the passed string was "main/physician_view" or "site/main/physician/physician_view". </p> <p>Hopefully my question makes sense. Any help wo...
2,762,807
7
1
null
2010-05-04 04:16:40.077 UTC
7
2017-01-24 20:19:25.833 UTC
null
null
null
null
160,797
null
1
56
php|string
50,580
<p>There are many ways to do this. I would probably use:</p> <pre><code>array_pop(explode('/', $string)); </code></pre>
3,161,816
Truncate a string to first n characters of a string and add three dots if any characters are removed
<p>How can I get the first n characters of a string in PHP? What's the fastest way to trim a string to a specific number of characters, and append '...' if needed?</p>
3,161,830
20
5
null
2010-07-01 21:28:19.95 UTC
77
2021-08-08 10:14:43.583 UTC
2021-03-03 03:36:42.34 UTC
null
2,943,403
null
376,947
null
1
360
php|string|ellipsis|truncation
491,867
<pre><code>//The simple version for 10 Characters from the beginning of the string $string = substr($string,0,10).'...'; </code></pre> <p>Update:</p> <p>Based on suggestion for checking length (and also ensuring similar lengths on trimmed and untrimmed strings):</p> <pre><code>$string = (strlen($string) &gt; 13) ? s...
45,635,726
KafkaAvroSerializer for serializing Avro without schema.registry.url
<p>I'm a noob to Kafka and Avro. So i have been trying to get the Producer/Consumer running. So far i have been able to produce and consume simple Bytes and Strings, using the following : Configuration for the Producer :</p> <pre><code> Properties props = new Properties(); props.put("bootstrap.servers", "localh...
45,637,006
5
1
null
2017-08-11 12:52:12.147 UTC
12
2020-07-06 03:33:32.94 UTC
2018-09-30 07:09:49.21 UTC
null
2,308,683
null
3,692,045
null
1
27
java|apache-kafka|avro|confluent-schema-registry
33,295
<p>Note first: <code>KafkaAvroSerializer</code> is not provided in vanilla apache kafka - it is provided by Confluent Platform. (<a href="https://www.confluent.io/" rel="noreferrer">https://www.confluent.io/</a>), as part of its open source components (<a href="http://docs.confluent.io/current/platform.html#confluent-s...
51,084,907
How to increase the connection limit for the Google Cloud SQL Postgres database?
<p>The number of connections for Google Cloud SQL PostgreSQL databases is relatively low. Depending on the plan this is somewhere between 25 and 500, while the limit for MySQL in Google Cloud SQL is between 250 and 4000, reaching 4000 very quickly.</p> <p>We currently have a number of trial instances for different cus...
55,479,093
2
0
null
2018-06-28 14:02:39.32 UTC
8
2019-05-20 23:43:11.177 UTC
2018-06-29 00:19:24.53 UTC
null
1,774,564
null
10,006,000
null
1
35
postgresql|google-cloud-platform|google-cloud-sql
26,840
<p>It looks like google just released this as a beta feature. When creating or editing a database instance, you can add a flag called <code>max_connections</code>, where you can enter a new limit between 14 and 262143 connections.</p> <p><a href="https://i.stack.imgur.com/sUyEn.png" rel="noreferrer"><img src="https://...
10,421,334
microdata schema.org: how to mix together schemas?
<p>hello I have a page ( <a href="http://schema.org/WebPage">http://schema.org/WebPage</a> ) that contains a review ( <a href="http://schema.org/Review">http://schema.org/Review</a> )</p> <p>the question are:</p> <ul> <li>how to deal with duplicate contents?</li> <li>is correct making elements belong to two or more s...
10,477,242
1
0
null
2012-05-02 20:39:31.147 UTC
14
2013-10-01 11:23:26.28 UTC
2012-05-05 15:26:39.987 UTC
null
1,252,794
null
1,252,794
null
1
14
html|seo|microdata|schema.org
5,610
<h2>Quick answers</h2> <ul> <li><em>how to deal with duplicate contents?</em> <ul> <li><strong>use the attribute itemref</strong></li> </ul> </li> <li><em>is correct making elements belong to two or more scopes?</em> <ul> <li><strong>Yes, this is what you use itemref for</strong></li> </ul> </li> <li><em>how to do this...
33,080,068
Running composer in a different directory than current
<p>I don't know if this question has been asked, because searching finds results mostly about moving the libraries installation directory.</p> <p>I have a globally installed composer command. Is there a way to run, for example, <code>composer install</code> in a different directory than current, i.e. to specify the di...
33,082,705
4
0
null
2015-10-12 11:32:41.41 UTC
14
2021-12-09 13:13:21.93 UTC
null
null
null
null
940,569
null
1
91
php|composer-php
72,597
<p>Try <code>composer install -h</code>. There you'll find an option <code>--working-dir</code> (or <code>-d</code>). And that's what you're looking for.</p> <p>Then run:</p> <pre><code>composer install --working-dir=/home/someuser/myproject </code></pre> <p>You can find more in <a href="https://getcomposer.org/doc/03-...
19,441,055
Why does Hadoop need classes like Text or IntWritable instead of String or Integer?
<p>Why does Hadoop need to introduce these new classes? They just seem to complicate the interface</p>
19,441,225
4
0
null
2013-10-18 03:22:56.42 UTC
13
2016-05-16 16:21:47.81 UTC
null
null
null
null
165,495
null
1
36
hadoop
28,371
<p>In order to handle the Objects in Hadoop way. For example, hadoop uses <code>Text</code> instead of java's <code>String</code>. The <code>Text</code> class in hadoop is similar to a java <code>String</code>, however, <code>Text</code> implements interfaces like <code>Comparable</code>, <code>Writable</code> and <cod...
32,502,830
delete the last row in a table using sql query?
<p>I am trying to delete the last record in the table named <strong>&quot;marks&quot;</strong> in the database using <strong>MySql query</strong>.<br /> The query I tried for this is as follows:</p> <pre><code>DELETE MAX(`id`) FROM `marks`; </code></pre> <p>There are 8 columns in the table. I want to delete the last co...
32,502,953
5
0
null
2015-09-10 13:09:56.853 UTC
4
2022-01-19 19:03:56.993 UTC
2022-01-19 19:03:56.993 UTC
null
5,411,817
null
4,277,736
null
1
16
mysql
67,796
<p>If <code>id</code> is auto-increment then you can use the following </p> <pre><code>delete from marks order by id desc limit 1 </code></pre>
34,268,406
Calling instance method on each object in array
<p>Let's assume this situation: I have an array of objects and I want call instance method on each one of them. I can do something like that:</p> <pre><code>//items is an array of objects with instanceMethod() available items.forEach { $0.instanceMethod() } </code></pre> <p>The same situation is with <code>map</code>...
34,269,544
3
0
null
2015-12-14 13:36:01.66 UTC
1
2021-01-12 23:34:02.507 UTC
2015-12-14 14:19:22.803 UTC
null
1,816,253
null
1,816,253
null
1
30
swift
14,805
<p>What you are doing in</p> <pre><code>items.forEach { $0.instanceMethod() } let mappedItems = items.map { $0.mappingInstanceMethod() } </code></pre> <p>is a clean and Swifty way. As explained in <a href="https://stackoverflow.com/questions/34049116/is-there-a-way-to-reference-instance-function-when-calling-sequence...
51,778,266
Digit only TextFormField in Flutter
<p>Im am working on an app that requires a price input in <code>¥</code> and as such has no decimal places. If we use <code>keyboardType: TextInputType.numberWithOptions()</code> we can get a number pad input. If we use <code>validator: (input) { }</code> we can check if input is valid but we cannot prevent it.</p> <...
51,778,460
4
0
null
2018-08-10 02:54:53.907 UTC
8
2021-04-12 10:19:26.687 UTC
2019-10-31 17:43:36.087 UTC
null
666,221
null
2,819,510
null
1
53
flutter|dart
53,476
<p>Yep, you can use the <code>inputFormatters</code> attribute and add the <code>WhitelistingTextInputFormatter.digitsOnly</code> expression</p> <pre><code> import 'package:flutter/services.dart'; TextFormField( ... inputFormatters: [WhitelistingTextInputFormatter.digitsOnly], ) </code>...