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
36,522,313
Large number of errors during Gradle build after upgrading to Android Studio 2.0
<p>Recently, I upgraded Android Studio from version 1.5 to 2.0 but since then I observe that the number of errors and warnings has increased. Most of the errors do not make sense. Can someone please help:</p> <pre><code>AGPBI: {"kind":"error","text":"warning: Ignoring InnerClasses attribute for an anonymous inner clas...
36,523,016
7
5
null
2016-04-09 20:29:37.7 UTC
15
2017-07-04 16:24:57.813 UTC
2016-04-29 02:24:41.51 UTC
null
445,131
null
3,900,531
null
1
59
android|android-studio
24,466
<p>You can get rid of the meaningless warnings and errors by deleting the <code>.idea</code> folder that Android Studio 1.5 created and importing the the project into Android Studio 2.0 as a gradle project. It will recreate the <code>.idea</code> folder automatically.</p>
14,335,966
How to programatically export crystal report as PDF in VB.NET
<pre><code>Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Imports CrystalDecisions.Web Imports CrystalDecisions.ReportSource Imports CrystalDecisions.CrystalReports Imports System.IO Imports System.Net Imports System.Net.Mail Public Class Form1 Dim cryRpt As New ReportDocument Privat...
14,354,329
3
3
null
2013-01-15 10:42:02.73 UTC
2
2018-12-04 18:04:24.223 UTC
null
null
null
user1622535
null
null
1
5
.net|vb.net|crystal-reports
39,649
<p>Finally found the solution from <a href="https://stackoverflow.com/questions/12486925/crystal-reports-how-to-set-database-credentials">here</a></p> <p>The only thing is, I need to set Database credentials at runtime for the Crystal Report to work fine.</p> <pre><code>cryRpt.SetDatabaseLogon("user", "password", "se...
14,054,120
Adding elements to a list in R (in nested lists)
<p>I have a nested list l3 as:</p> <pre><code>l1&lt;- as.list(c(1,2,3,4,5)) l1 l2&lt;- as.list(c(6,7,8,9,10)) l2 l3&lt;- list(l1,l2) l3 </code></pre> <p>l3 shows as:</p> <pre><code>&gt; l3 [[1]] [[1]][[1]] [1] 1 [[1]][[2]] [1] 2 [[1]][[3]] [1] 3 [[1]][[4]] [1] 4 [[1]][[5]] [1] 5 [[2]] [[2]][[1]] [1] 6 [[2]]...
14,054,360
2
1
null
2012-12-27 11:43:09.437 UTC
4
2012-12-27 12:09:04.29 UTC
null
null
null
null
1,847,296
null
1
6
r|list
46,009
<p>It works with <code>append</code> and <code>list</code>:</p> <pre><code>append(l3, list(l4)) </code></pre> <p>The result:</p> <pre><code>&gt; str(append(l3, list(l4))) List of 3 $ :List of 5 ..$ : num 1 ..$ : num 2 ..$ : num 3 ..$ : num 4 ..$ : num 5 $ :List of 5 ..$ : num 6 ..$ : num 7 ..$ : nu...
54,953,917
`npm audit` keeps returning "Your configured registry (https://registry.npmjs.org/) does not support audit requests.". How do I make it work again?
<p>Here is the error I get:</p> <pre><code>npm ERR! code ENOAUDIT npm ERR! audit Your configured registry (https://registry.npmjs.org/) does not support audit requests. </code></pre> <p>with the log file:</p> <pre><code>0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', ...
59,493,573
9
6
null
2019-03-02 00:02:39.67 UTC
3
2021-11-11 07:12:16.58 UTC
null
null
null
null
1,859,251
null
1
29
javascript|node.js|npm|npm-audit
23,859
<p>Try running <code>npm update</code> and then <code>npm audit</code>. This should fix the problem.</p>
31,361,571
Yii2 : How to write distinct SQL query?
<p>I want to implement following SQL queries in Yii 2 but with no success.</p> <p>This should give total number of unique company names:</p> <pre class="lang-sql prettyprint-override"><code>SELECT count(DISTINCT(company_name)) FROM clients </code></pre> <p>And this should display <code>company_name</code> with <code...
31,482,645
4
11
null
2015-07-11 20:34:57.013 UTC
3
2018-08-26 11:27:14.813 UTC
2018-08-26 11:22:37.727 UTC
null
5,812,455
null
4,682,302
null
1
29
php|mysql|yii2
65,401
<p>Answering my own question I got following working solutions:</p> <p><strong>Got the count for unique <code>company_name</code>:</strong></p> <pre><code>$my = (new yii\db\Query()) -&gt;select(['company_name',]) -&gt;from('create_client') -&gt;distinct() -&gt;count(); echo $my; </code></pre> <p><str...
26,599,798
if-else flow in promise (bluebird)
<p>This is a short version of my code.</p> <pre><code>var Promise = require('bluebird'); var fs = Promise.promisifyAll(require("fs")); if (conditionA) { fs.writeFileAsync(file, jsonData).then(function() { return functionA(); }); } else { functionA(); } </code></pre> <p>Both conditions call <code>functionA<...
26,600,424
3
1
null
2014-10-28 02:05:24.613 UTC
10
2016-09-26 11:42:54.46 UTC
null
null
null
null
1,427,309
null
1
40
node.js|promise|bluebird
26,110
<p>I think you're looking for</p> <pre><code>(conditionA ? fs.writeFileAsync(file, jsonData) : Promise.resolve()) .then(functionA); </code></pre> <p>which is short for</p> <pre><code>var waitFor; if (conditionA) waitFor = fs.writeFileAsync(file, jsonData); else waitFor = Promise.resolve(undefined); // w...
6,814,629
how to get selected item of combo box
<p>i'm using lwuit with j2me . how to get combo box selected item or index? i found the function for <a href="http://lwuit.java.net/javadocs/com/sun/lwuit/ComboBox.html#setSelectedIndex%28int%29" rel="noreferrer">setSelectedIndex</a> but not for getting the selected.</p>
6,826,224
2
0
null
2011-07-25 10:18:35.437 UTC
2
2022-06-01 09:25:29.397 UTC
null
null
null
null
166,476
null
1
7
java-me|combobox|lwuit
81,896
<p>Use this code :</p> <pre><code>comboBox.getSelectionModel().getSelectedIndex(); </code></pre> <p>To return the current selected offset in the list.</p> <pre><code>comboBox.getSelectionModel().getSelectedItem(); </code></pre> <p>To return the current selected item in the list or null for no selection</p>
55,499,175
How to fix 'Error: querySrv EREFUSED' when connecting to MongoDB Atlas?
<p>I am new to MongoDB 4.0.6 and tried to implement it into my website using Node/Express.js, but when I try to connect to <code>mongodb+srv://${process.env.MONGOUSER}:${process.env.MONGOPASS}@main-03xkr.mongodb.net/main</code> I'm getting this error:</p> <blockquote> <p>{ Error: querySrv EREFUSED _mongodb._tcp.main...
55,639,024
16
2
null
2019-04-03 15:43:44.593 UTC
6
2022-05-11 07:29:37.767 UTC
2019-04-03 17:56:04.477 UTC
null
5,698,355
null
5,698,355
null
1
35
node.js|mongodb|express|mongoose|mongodb-atlas
68,028
<p>If you're encountering this error try to use the older connection string for Node.js 2.2.12 or later:</p> <pre><code>mongodb://&lt;username&gt;:&lt;password&gt;@main-shard-00-00-03xkr.mongodb.net:27017,main-shard-00-01-03xkr.mongodb.net:27017,main-shard-00-02-03xkr.mongodb.net:27017/main?ssl=true&amp;replicaSet=Mai...
7,405,009
How can I install a driver using InnoSetup?
<p>I'd like to install a driver for a serial port using InnoSetup. I have the inf file, and I can install the driver manually through device manager, but I'd like to be able to include the driver in my installer so that users don't have to go through the trouble of installing the driver themselves.</p>
7,409,448
3
1
null
2011-09-13 16:07:58.07 UTC
11
2018-01-12 12:01:11.417 UTC
null
null
null
null
18,480
null
1
13
windows|driver|inno-setup
17,870
<p>See <a href="http://msdn.microsoft.com/en-us/library/aa376957%28v=vs.85%29.aspx">InstallHinfSection</a> on MSDN. The documentation also mentions how to invoke an installation by calling 'Rundll32.exe'. Probably you'll end up with something like this:</p> <pre><code>[Files] .. Source: "driver\my_x86driver.inf"; Dest...
7,025,437
addEventListener in jQuery
<blockquote> <p><strong>Possible Duplicate:</strong><br /> <a href="https://stackoverflow.com/questions/2398099/jquery-equivalent-of-javascripts-addeventlistener-method">jQuery equivalent of JavaScript's addEventListener method</a></p> </blockquote> <p>Also from a very good jQuery tutorial on : <a href="http://itunes....
7,025,511
4
7
null
2011-08-11 11:59:04.617 UTC
null
2022-01-13 18:01:23.74 UTC
2022-01-13 18:01:23.74 UTC
null
4,370,109
null
866,855
null
1
9
javascript|jquery|dom-events|addeventlistener
74,661
<p>Try this</p> <pre><code>// Setting the third argument to false will attach a function // that prevents the default action from occurring and // stops the event from bubbling. $("#element1").bind("click", doSomething2, false); </code></pre>
1,964,234
Sorting an array related to another array
<p>I have two arrays, <code>x</code> and <code>y</code>, where y is the value of the tens of every element in <code>x</code>. Now, I want to sort <code>y</code>. But, the order of <code>y</code> will be different of <code>x</code>'s. So, I can't tell after sorting which element in <code>y</code> was related to, for ins...
1,964,290
4
1
null
2009-12-26 20:09:08.707 UTC
2
2020-05-01 08:22:10.763 UTC
2020-05-01 08:14:40.367 UTC
null
1,364,007
null
61,250
null
1
34
c#|arrays
25,240
<p><code>Array.Sort</code> has <a href="http://msdn.microsoft.com/en-us/library/85y6y2d3.aspx" rel="noreferrer">an overload</a> that accepts <strong>two</strong> arrays; one for the keys, and one for the items. The items of <strong>both</strong> are sorted according to the <code>keys</code> array:</p> <pre><code>int[]...
10,797,912
How to position a Bootstrap popover?
<p>I'm trying to position a Bootstrap popover for a trigger that sits on the far top-right corner of a 960px wide web page.</p> <p>Ideally, I'd position it on the bottom and move the arrow with CSS (so the arrow is on the top-right of the popover). Unfortunately the 'placement':'bottom' positioning is not enough, sinc...
12,486,312
10
2
null
2012-05-29 11:07:16.83 UTC
15
2019-04-09 09:16:03.85 UTC
2019-04-04 17:14:05.7 UTC
null
2,756,409
null
722,850
null
1
56
javascript|css|twitter-bootstrap|css-position|popover
145,629
<p>This works. Tested.</p> <pre><code>.popover { top: 71px !important; left: 379px !important; } </code></pre>
54,785,148
Destructuring dicts and objects in Python
<p>In Javascript, I can use <a href="https://medium.com/podiihq/destructuring-objects-in-javascript-4de5a3b0e4cb" rel="noreferrer">destructuring</a> to extract properties I want from a javascript objects in one liner. For example:</p> <pre class="lang-js prettyprint-override"><code>currentUser = { &quot;id&quot;: 24,...
63,600,600
8
10
null
2019-02-20 11:22:10.367 UTC
6
2022-04-17 11:16:14.57 UTC
2021-09-02 08:02:54.533 UTC
null
8,384,910
null
7,707,677
null
1
51
python
36,667
<p>You can use <a href="https://docs.python.org/3/library/operator.html" rel="noreferrer"><code>operator</code></a> module from standard library as follows:</p> <pre><code>from operator import attrgetter id, email, gender, username = attrgetter('id', 'email', 'gender', 'username')(current_user) print(id, email, gender,...
26,200,070
$_SERVER['REQUEST_URI'] returns full URL instead of path to script
<p>My PHP app is not working because of $_SERVER['REQUEST_URI'] returns the full url to the script instead of a relative path. </p> <p><strong>My environment:</strong><br> Windows 7 64 bit.<br> XAMPP Version 1.8.2<br> PHP Version 5.4.16<br> Apache Version Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.16 </p> <p><str...
26,239,141
3
1
null
2014-10-05 06:00:56.847 UTC
null
2016-09-15 18:22:52.34 UTC
2014-10-05 07:26:23.94 UTC
null
3,069,697
null
583,879
null
1
2
php|apache|request-uri
53,005
<p>I finally got it working.<br> Here is the steps i did ( i don't know why it is effected, but it is working now ). </p> <ol> <li>Install PHP Fastcgi on xampp, i follow this steps: <a href="https://commaster.net/content/installing-php-fastcgi-and-zend-opcache-xampp-windows" rel="nofollow">https://commaster.net/conte...
26,308,167
C# WebRequest GET/POST
<p>So I thought it's time for me to learn C#, be easy with me guys, I'm very new to this.</p> <p>I'm trying to create a very simple application (I'm using Windows Forms Application). My goal is:</p> <ol> <li>Using "GET" method, get the web page</li> <li>Read a text field (this value changes every time that the user i...
26,308,209
3
1
null
2014-10-10 21:18:46.813 UTC
5
2018-03-06 15:31:29.24 UTC
2014-10-10 22:23:40.667 UTC
null
3,800,799
null
3,800,799
null
1
2
c#|webrequest
41,391
<h2>Reading data with GET</h2> <blockquote> <p>Please refer to this answer: <a href="https://stackoverflow.com/questions/1048199/easiest-way-to-read-from-a-url-into-a-string-in-net">Easiest way to read from a URL into a string in .NET</a></p> </blockquote> <pre><code>using(WebClient client = new WebClient()) { ...
7,189,676
Passing form variables through URL
<p>What I want to accomplish is logging in to a website by simply typing in the form variables in the URL.</p> <p>HTML code:</p> <pre><code> &lt;form action="httpclient.html" onsubmit="return checkSubmit();" method="post" target="_parent" name="frmHTTPClientLogin"&gt; &lt;input type="hidden" name="m...
7,189,743
5
1
null
2011-08-25 11:36:31.38 UTC
1
2019-02-27 21:44:37.33 UTC
2011-08-25 11:42:56.687 UTC
null
834,613
null
834,613
null
1
3
html|forms|url|http-post|http-get
64,761
<p>If you want to type the Querystring in for the username and password, you need to do this in the address field of your browser:</p> <pre><code>http://10.100.56.55/?username=name&amp;password=pass </code></pre> <p>EDIT: You need to find out where the form is going and what it's doing. For this, you need to check wh...
7,265,718
fork() child and parent processes
<p>I am trying to create a program that uses fork() to create a new process. The sample output should look like so:</p> <p>This is the child process. My pid is 733 and my parent's id is 772.<br> This is the parent process. My pid is 772 and my child's id is 773.</p> <p>This is how I coded my program:</p> <pre><code>...
7,265,749
5
1
null
2011-09-01 03:03:13.603 UTC
9
2018-04-25 03:41:57.963 UTC
2011-09-01 03:46:40.01 UTC
null
728,168
null
728,168
null
1
8
c|fork|parent
140,123
<p>Start by reading the <a href="http://linux.die.net/man/2/fork">fork man page</a> as well as the <a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/getppid.html">getppid</a> / <a href="http://linux.die.net/man/2/getpid">getpid</a> man pages.</p> <p>From fork's</p> <blockquote> <p>On success, the PI...
7,580,288
How to determine whether T is a value type or reference class in generic?
<p>I have a generic method behavior of which depends on T is reference type or value type. It looks so:</p> <pre><code>T SomeGenericMethod &lt;T&gt; (T obj) { if (T is class) //What condition I must write in the brackets? //to do one stuff else //if T is a value type like struct, int, enum and etc. //to do a...
7,580,347
5
0
null
2011-09-28 08:23:37.9 UTC
6
2020-02-06 16:24:42.233 UTC
null
null
null
null
958,593
null
1
58
c#|.net|generics
22,611
<p>You can use the <a href="http://msdn.microsoft.com/en-us/library/58918ffs.aspx" rel="noreferrer"><code>typeof</code> operator</a> with generic types, so <code>typeof(T)</code> will get the <a href="http://msdn.microsoft.com/en-us/library/42892f65.aspx" rel="noreferrer"><code>Type</code></a> reference corresponding t...
7,069,076
Split column at delimiter in data frame
<p>I would like to split one column into two within at data frame based on a delimiter. For example,</p> <pre><code>a|b b|c </code></pre> <p>to become</p> <pre><code>a b b c </code></pre> <p>within a data frame.</p> <p>Thanks!</p>
7,069,385
6
1
null
2011-08-15 18:37:19.35 UTC
51
2021-04-27 13:11:31.967 UTC
null
null
null
null
580,530
null
1
128
r|dataframe
320,317
<p>@Taesung Shin is right, but then just some more magic to make it into a <code>data.frame</code>. I added a "x|y" line to avoid ambiguities:</p> <pre><code>df &lt;- data.frame(ID=11:13, FOO=c('a|b','b|c','x|y')) foo &lt;- data.frame(do.call('rbind', strsplit(as.character(df$FOO),'|',fixed=TRUE))) </code></pre> <p>O...
7,351,205
Where to find "gmp.h"?
<p>I am installing a library, and got this error message:</p> <pre><code>xxxx@ubuntu$ make (cd num; make all) make[1]: Entering directory `/home/xxxx/num' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/home/xxxx/num' (cd itv; make all) make[1]: Entering directory `/home/xxxx/itv' gcc -Wcast-qual -...
7,351,295
7
0
null
2011-09-08 16:11:24.673 UTC
12
2020-07-17 08:05:09.9 UTC
2011-09-08 18:01:55.167 UTC
null
702,977
null
702,977
null
1
74
c|makefile
103,039
<p>you need to install libgmp3-dev </p> <p>depends on your linux </p> <pre><code>yum install libgmp3-dev apt-get install libgmp3-dev </code></pre>
7,361,135
How to change color and font on ListView
<p>I am trying to change my font(color and size) and the back ground on my ListView. I want to change it with code lines not on xml. my list view looks like: the xml:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_wid...
7,361,323
9
2
null
2011-09-09 11:45:26.56 UTC
10
2016-12-07 10:06:55.66 UTC
2011-09-09 12:22:04.677 UTC
null
68,805
null
844,039
null
1
21
android|listview|fonts
110,669
<p>You need to create a CustomListAdapter. </p> <pre><code>public class CustomListAdapter extends ArrayAdapter &lt;String&gt; { private Context mContext; private int id; private List &lt;String&gt;items ; public CustomListAdapter(Context context, int textViewResourceId , List&lt;String&gt; list ) ...
7,666,977
Syntax highlighting for Jade in Sublime Text 2?
<p>I just started using Sublime Text 2 on Mac. I also just started using <a href="http://jade-lang.com" rel="noreferrer">Jade</a> for my views in Node.js, and am wondering if there is a way to add syntax highlighting for Jade into Sublime Text 2.</p>
7,693,609
9
0
null
2011-10-05 19:58:06.877 UTC
39
2017-05-28 15:20:51.577 UTC
2015-12-21 19:26:41.8 UTC
null
5,017,283
null
115,182
null
1
146
editor|sublimetext2|pug|syntax-highlighting|sublimetext
50,793
<p>Sublime Text 2 supports Textmate syntax definition files. There is a Jade Textmate bundle at <a href="https://github.com/miksago/jade-tmbundle" rel="nofollow noreferrer">https://github.com/miksago/jade-tmbundle</a>. </p> <p>Install by creating a new folder in your Sublime Text "Packages" folder, call the new folder...
7,508,044
Android Fragment no view found for ID?
<p>I have a fragment I am trying to add into a view.</p> <pre><code>FragmentManager fragMgr=getSupportFragmentManager(); feed_parser_activity content = (feed_parser_activity)fragMgr .findFragmentById(R.id.feedContentContainer); FragmentTransaction xaction=fragMgr.beginTransaction();...
8,158,916
40
3
null
2011-09-21 23:53:19.81 UTC
62
2021-10-22 07:14:27.167 UTC
2013-11-09 23:03:28.227 UTC
null
356,895
null
867,895
null
1
335
android|android-fragments|illegalargumentexception
334,202
<p>I was having this problem too, until I realized that I had specified the wrong layout in <code>setContentView()</code> of the <code>onCreate()</code> method of the FragmentActivity.</p> <p>The id passed into <code>FragmentTransaction.add()</code>, in your case <code>R.id.feedContentContainer</code>, must be a child...
14,169,834
Spring 3.1 Environment does not work with user property files
<p>I am doing this..</p> <pre><code>AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(context); xmlReader .loadBeanDefinitions(new ClassPathResource("SpringConfig.xml")); PropertySourcesPlaceholderConfigurer pr...
14,170,198
4
0
null
2013-01-05 07:52:15.347 UTC
9
2014-10-24 23:19:00.06 UTC
null
null
null
null
1,364,959
null
1
18
java|spring
19,912
<p>PropertySourcesPlaceholderConfigurer reads property files directly(as it was done by PropertyPlaceholderConfigurer in Spring 3.0 times), it's just a postprocessor which does not change the way properties are used in the Spring context - in this case properties are only available as bean definition placeholders. </p>...
14,241,696
How to get rid of space between divs when display inline-block and stacked horizontally?
<p>I have three divs horizontally stacked side by side to one another and these divs are set to display: inline-block. However, I have noticed that even with using some sort of CSS reset they produce a small 4px distance between each other? Why does this occur? Is there a way to globally get rid of this from happening ...
14,241,813
5
2
null
2013-01-09 16:25:10.343 UTC
10
2018-02-22 10:01:32.217 UTC
2013-01-09 16:26:13.013 UTC
null
1,558,311
null
1,460,983
null
1
31
html|css
39,617
<p>This is caused by the fact your browser will render the DIV's inline and as with words, they are separated by spaces.</p> <p>The width of the space is determined by the font-size, hence an easy trick is to set the font-size of your containing element to 0 and then reset the font-size in your inline divs.</p> <pre ...
13,887,704
What's the point of the Prototype design pattern?
<p>So I'm learning about design patterns in school. Today I was told about the 'Prototype' design pattern. </p> <p>I must be missing something, because I don't see the benefits from it. I've seen people online say it's faster than using <code>new</code> but this doesn't make sense; at some point, regardless of how the...
13,887,737
7
1
null
2012-12-14 23:30:41.66 UTC
21
2021-06-23 05:17:35.343 UTC
2016-08-14 18:03:58.133 UTC
null
1,371,329
null
1,905,391
null
1
73
design-patterns|prototype-pattern
26,051
<p>The Prototype pattern is a creation pattern based on cloning a pre-configured object. The idea is that you pick an object that is configured for either the default or in the ballpark of some specific use case and then you clone this object and configure to your exact needs.</p> <p>The pattern is useful to remove a...
43,531,602
Bulk Update in Entity Framework Core
<p>I pull a bunch of timesheet entries out of the database and use them to create an invoice. Once I save the invoice and have an Id I want to update the timesheet entries with the invoice Id. Is there a way to bulk update the entities without loading them one at a time?</p> <pre><code>void SaveInvoice(Invoice invoice...
43,531,693
6
1
null
2017-04-20 23:39:26.873 UTC
2
2022-02-05 10:53:54.87 UTC
2019-11-11 07:40:18.107 UTC
null
5,170,364
null
1,679,126
null
1
12
c#|.net|entity-framework|entity-framework-core
39,839
<p>If <code>TimeEntry</code> has an association to <code>Invoice</code> (check the navigation properties), you can probably do something like this:</p> <pre><code>var timeEntries = context.TimeEntries.Where(t =&gt; timeEntryIds.Contains(te.Id)).ToArray(); foreach(var timeEntry in timeEntries) invoice.TimeEntries....
29,864,642
Is Objects.requireNonNull less efficient than the old way?
<p>Since JDK 7 I've been happily using the method it introduced to reject <code>null</code> values which are passed to a method which cannot accept them:</p> <pre><code>private void someMethod(SomeType pointer, SomeType anotherPointer) { Objects.requireNonNull(pointer, "pointer cannot be null!"); Objects.requi...
29,864,679
9
6
null
2015-04-25 11:37:12.47 UTC
14
2020-12-01 15:39:23.15 UTC
2015-12-09 16:02:37.243 UTC
null
3,233,595
null
1,515,834
null
1
67
java|performance|null
36,916
<p>Let's look at the implementation of <code>requireNonNull</code> in Oracle's JDK:</p> <pre><code>public static &lt;T&gt; T requireNonNull(T obj) { if (obj == null) throw new NullPointerException(); return obj; } </code></pre> <p>So that's <strong>very simple</strong>. The JVM (Oracle's, anyway) incl...
9,538,247
CSS background disappears when using float:left
<p>This is my html:</p> <pre><code>&lt;div class="header_wrapper"&gt; &lt;div class="main_nav"&gt; &lt;div&gt;TEst&lt;/div&gt; &lt;div&gt;TEst&lt;/div&gt; &lt;div&gt;TEst&lt;/div&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>As you can see I w...
9,538,268
4
1
null
2012-03-02 18:08:57.21 UTC
10
2012-03-02 18:42:55.07 UTC
2012-03-02 18:42:55.07 UTC
null
246,246
null
401,025
null
1
21
html|css|css-float
47,188
<p>Adding <code>overflow:auto;</code> to main_nav brings the background back.</p>
32,622,899
ITMS-90535 Unable to publish iOS app with latest Google Signin SDK
<p><a href="https://i.stack.imgur.com/htwqK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/htwqK.png" alt="Error ITMS-90535 : Unexpected CFBundleExecutable Key Google Sigin"></a></p> <p>I'm using xcode 7 GM seed and installed latest Google Signin SDK through cocoapods <code>pod "Google/SignIn</code> . I ge...
32,645,052
6
3
null
2015-09-17 05:02:37.017 UTC
16
2016-07-06 16:27:46.123 UTC
null
null
null
null
311,701
null
1
67
ios|xcode7|google-signin
26,797
<p>Find <code>CFBundleExecutable</code> key , remove this key from Google Signin SDK's info.plist. You can delete all other <code>CFBundleExecutable</code> if error occurs on multiple bundles</p>
19,694,130
Page height to 100% of viewport?
<p>I'll start by saying that I am very very new to web development as a whole and that this is my very first responsive site so please be gentle and bear this in mind, I am the definition of the word noob at this stage. Having searched for an answer for a while and having no luck I'm hoping that someone here could help...
19,695,231
4
2
null
2013-10-30 21:27:27.847 UTC
11
2019-10-20 02:11:58.413 UTC
null
null
null
null
2,939,109
null
1
33
html|css|height
86,724
<p>I have made you a basic set up to show how you would style this. The best way that I have found to set the height to 100%is with the use of jQuery/Javascript. You can find the height of the window and then input that into the css with the use of it.</p> <p>The way this works is the <code>var wH = $(window).height()...
19,322,421
From where do I reference a missing assembly (System.Net.Http.Formatting)?
<p>In my Visual Studio 2013 RC project, I'm getting this err msg:</p> <blockquote> <p>"<em>The type 'System.Net.Http.Formatting.MediaTypeFormatter' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToke...
22,346,641
6
3
null
2013-10-11 15:58:03.913 UTC
9
2022-02-16 21:29:21.213 UTC
2015-04-29 13:11:54.263 UTC
null
888,472
null
875,317
null
1
58
.net-assembly|visual-studio-debugging|visual-studio-2013|system.net|mediatypeformatter
75,289
<p>I had the same problem. I used <a href="http://www.nuget.org/packages/Microsoft.AspNet.WebApi.Client/" rel="noreferrer">Microsoft Asp Net WebApi Client 4.0.20710</a> and it worked for me.</p> <p>Type the following command into Tools > Library Package Manager > Package Manager Console:</p> <pre><code>Install-Packag...
34,051,747
Get Environment Variable from Docker Container
<p>What's the simplest way to get an environment variable from a docker container <em>that has not been declared in the Dockerfile</em>?</p> <p>For instance, an environment variable that has been set through some <code>docker exec container /bin/bash</code> session?</p> <p>I can do <code>docker exec container env | g...
34,052,766
12
3
null
2015-12-02 19:51:30.567 UTC
49
2022-07-20 17:16:37.997 UTC
2015-12-02 19:59:30.053 UTC
null
4,463,660
null
4,463,660
null
1
198
bash|docker|environment-variables
276,905
<p>The proper way to run <code>echo "$ENV_VAR"</code> inside the container so that the variable substitution happens in the container is:</p> <pre><code>docker exec &lt;container_id&gt; bash -c 'echo "$ENV_VAR"' </code></pre>
24,855,515
Debug Error -Abort() Has Been Called
<p>I'm trying to enter a number,n and get the least super lucky number that is more than or equal to n. Super lucky: it's decimal representation contains equal amount of digits 4 and 7. For example, numbers 47, 7744, 474477 are super lucky and 4, 744, 467 are not.</p> <p>Here's my code</p> <pre><code> #include&l...
24,855,641
3
2
null
2014-07-20 22:29:28.937 UTC
3
2016-10-13 22:28:22.95 UTC
null
null
null
null
3,697,826
null
1
15
c++|abort
90,322
<p>There are couple of issues:</p> <ol> <li><p>When you call <code>superLucky</code> from <code>main</code>, <code>s</code> is empty. <code>stoi(s)</code> throws an exception when <code>s</code> is empty.</p></li> <li><p>The check <code>s.size() &gt; 10</code> is not robust. It is platform dependent. You can use a <co...
866,070
NullReferenceException was unhandled, Object Reference not set to an instance of an object
<p>Whenever I run my program, I get: NullReferenceException was unhandled, Object Reference not set to an instance of an object.</p> <p>When I start the program, I have a form appear called MaxScore where the user enters the max score and presses OK. In the OK event, I call a method from MainForm to update the maxGame...
866,216
5
1
null
2009-05-14 22:00:24.827 UTC
1
2013-01-14 07:11:30.227 UTC
2009-05-14 22:28:36.88 UTC
null
49,549
null
49,549
null
1
3
c#|exception|reference|null|instance
49,073
<p>Did you remove: <code>InitializeComponent();</code> from the constructor?</p> <p>If you are using the designer to build the form UI, Visual Studio builds a method in the background (Class.designer.cs) to initialize the controls. If you don't call <code>InitializeComponent()</code> before you access the UI elements...
713,634
Passing a delegate with two parameters as a parameter function
<p>I have a sequence of functions that look very similar but for a single line, like the following two (but I have many more of them):</p> <pre><code>private static int HowManyHoursInTheFirstYear(IList&lt;T&gt; samples) { DateTime firstDate = samples[0].Date; int count = 0; while (count &lt; samples.Count...
713,651
5
1
null
2009-04-03 11:57:51.427 UTC
6
2012-06-11 15:26:58.767 UTC
2012-06-11 15:26:58.767 UTC
Stefano
41,071
Stefano
85,556
null
1
23
c#|delegates
46,088
<p>You're almost there! The <code>comparer</code> delegate parameter is just like any other function: <strong>You still need to pass the appropriate arguments to invoke it.</strong> In your case, that's going to mean this change:</p> <pre><code>while (count &lt; samples.Count &amp;&amp; comparer(samples[count].Date, f...
1,030,270
Race conditions in django
<p>Here is a simple example of a django view with a potential race condition:</p> <pre><code># myapp/views.py from django.contrib.auth.models import User from my_libs import calculate_points def add_points(request): user = request.user user.points += calculate_points(user) user.save() </code></pre> <p>Th...
10,987,224
6
3
null
2009-06-23 01:53:37.477 UTC
32
2021-06-28 08:01:08.547 UTC
2014-03-15 11:04:57.393 UTC
null
992,887
null
121,112
null
1
46
python|database|django|locking|race-condition
22,951
<p>Django 1.4+ supports <a href="https://docs.djangoproject.com/en/stable/ref/models/querysets/#django.db.models.query.QuerySet.select_for_update" rel="nofollow noreferrer">select_for_update</a>, in earlier versions you may execute raw SQL queries e.g. <code>select ... for update</code> which depending on underlying DB...
1,194,656
Appending to an ObjectOutputStream
<p>Is it not possible to append to an <code>ObjectOutputStream</code>?</p> <p>I am trying to append to a list of objects. Following snippet is a function that is called whenever a job is finished.</p> <pre><code>FileOutputStream fos = new FileOutputStream (preferences.getAppDataLocation() + "history" , tru...
1,195,078
6
5
null
2009-07-28 14:51:03.06 UTC
29
2019-10-18 08:13:00.42 UTC
2011-10-15 16:54:46.93 UTC
null
213,269
null
89,904
null
1
61
java|serialization|append|objectoutputstream|objectinputstream
66,526
<p>Here's the trick: subclass <code>ObjectOutputStream</code> and override the <code>writeStreamHeader</code> method:</p> <pre><code>public class AppendingObjectOutputStream extends ObjectOutputStream { public AppendingObjectOutputStream(OutputStream out) throws IOException { super(out); } @Override prot...
268,384
PRINT statement in T-SQL
<p>Why does the PRINT statement in T-SQL seem to only sometimes work? What are the constraints on using it? It seems sometimes if a result set is generated, it becomes a null function, I assumed to prevent corrupting the resultset, but could it's output not go out in another result set, such as the row count?</p>
268,419
6
1
null
2008-11-06 11:43:09.227 UTC
24
2021-07-07 04:21:58.943 UTC
null
null
null
ProfK
8,741
null
1
86
sql-server|tsql
307,462
<p>So, if you have a statement something like the following, you're saying that you get no 'print' result?</p> <pre>select * from sysobjects PRINT 'Just selected * from sysobjects'</pre> <p>If you're using SQL Query Analyzer, you'll see that there are two tabs down at the bottom, one of which is "Messages" and that's...
590,159
Does a locked object stay locked if an exception occurs inside it?
<p>In a c# threading app, if I were to lock an object, let us say a queue, and if an exception occurs, will the object stay locked? Here is the pseudo-code:</p> <pre><code>int ii; lock(MyQueue) { MyClass LclClass = (MyClass)MyQueue.Dequeue(); try { ii = int.parse(LclClass.SomeString); } catch ...
590,174
6
5
null
2009-02-26 11:31:13.513 UTC
20
2015-04-22 08:18:14.89 UTC
2012-08-16 09:16:08.55 UTC
null
512,251
Khadaji
55,520
null
1
91
c#|.net|multithreading|exception|locking
44,696
<p>First; have you considered TryParse?</p> <pre><code>in li; if(int.TryParse(LclClass.SomeString, out li)) { // li is now assigned } else { // input string is dodgy } </code></pre> <p>The lock will be released for 2 reasons; first, <code>lock</code> is essentially:</p> <pre><code>Monitor.Enter(lockObj); try...
1,244,788
<embed> vs. <object>
<p>Which is the right/best tag to use in my HTML file when I want to display the Adobe PDF viewer?</p> <p>Right now I'm using the code below, but there are weird side effects (e.g. it seems to steal the starting focus that I've set to another <code>&lt;input&gt;</code> text box; it doesn't seem to play real well with ...
1,244,854
6
2
null
2009-08-07 13:47:21.687 UTC
74
2021-07-25 19:30:48.35 UTC
2019-08-09 15:58:15.937 UTC
null
3,345,644
null
106,357
null
1
189
html|pdf|embed-tag
229,366
<p><a href="http://www.webmasterworld.com/forum104/659.htm" rel="noreferrer">OBJECT vs. EMBED - why not always use embed?</a></p> <blockquote> <p>Bottom line: OBJECT is Good, EMBED is Old. Beside's IE's PARAM tags, any content between OBJECT tags will get rendered if the browser doesn't support OBJECT's referred plu...
42,345,254
Excel Solver Password: what is it and where can it be acquired/bought?
<p>I've been exploring VBA and excel and I've been writing a few basic codes around the Excel Solver. However robust the Excel Solver may appear, it's just not fast enough for my optimization problem (one iteration takes 20 minutes).</p> <p>I've been looking around and speaking with more experienced programmers, and t...
42,345,506
3
4
null
2017-02-20 12:59:42.79 UTC
6
2020-10-08 14:11:27.447 UTC
null
null
null
null
7,593,090
null
1
8
excel|vba|passwords|solver
43,960
<p>You can use this password to unlock the SOLVER.XLAM project;</p> <p>Wildebeest!!</p>
30,899,163
How do I use multiple consumers in Kafka?
<p>I am a new student studying Kafka and I've run into some fundamental issues with understanding multiple consumers that articles, documentations, etc. have not been too helpful with so far. </p> <p>One thing I have tried to do is write my own high level Kafka producer and consumer and run them simultaneously, publis...
30,899,709
3
3
null
2015-06-17 18:10:24.507 UTC
13
2020-05-01 17:09:19.617 UTC
2020-05-01 17:09:19.617 UTC
null
4,157,124
null
5,013,133
null
1
40
java|apache-kafka
58,748
<p>I think your problem lies with the auto.offset.reset property. When a new consumer reads from a partition and there's no previous committed offset, the auto.offset.reset property is used to decide what the starting offset should be. If you set it to "largest" (the default) you start reading at the latest (last) me...
18,021,972
Cannot access a disposed object error
<p>I am getting the error message <strong>Cannot access a disposed object. Object name: 'ApplicationProperties'.</strong> when I tryo to re-open a form after closing it. I have noticed this is from exiting forms, and exiting is <strong>"Disposing"</strong> of them, so I have put the following code in all of my accept b...
18,022,077
4
8
null
2013-08-02 16:33:23.253 UTC
5
2014-12-29 12:29:25.797 UTC
2013-08-02 18:32:49.84 UTC
null
2,505,594
null
2,505,594
null
1
10
c#|winforms
45,828
<p>Try this in your <code>FormClosing</code> event:</p> <pre><code> private void ApplicationProperties_FormClosing(object sender, FormClosingEventArgs e) { //Hiding the window, because closing it makes the window unaccessible. this.Hide(); this.Parent = null; e.Cancel = true; //hides...
46,636,255
firebase.firestore() is not a function when trying to initialize Cloud Firestore
<p>When I try to initialize Firebase Cloud Firestore, I ran into the following error: </p> <blockquote> <p>Uncaught TypeError: <strong>WEBPACK_IMPORTED_MODULE_0_firebase</strong>.firestore is not a function</p> </blockquote> <p>I installed firebase with <code>npm install firebase --save</code> previously.</p> <pre...
50,684,682
29
7
null
2017-10-08 21:27:14.88 UTC
17
2022-07-31 20:52:13.413 UTC
2018-10-13 22:08:58.907 UTC
null
1,640,892
null
8,020,389
null
1
90
javascript|firebase|google-cloud-firestore
127,516
<p>I fixed it by importing multiple libraries: <code>firebase</code> and <code>firebase/firestore</code>. That's because the <code>firebase</code> core library does not include the firestore library.</p> <pre><code>import firebase from 'firebase/app'; import 'firebase/firestore'; </code></pre>
1,596,963
Read a file from server with SSH using Python
<p>I am trying to read a file from a server using SSH from Python. I am using Paramiko to connect. I can connect to the server and run a command like <code>cat filename</code> and get the data back from the server but some files I am trying to read are around 1 GB or more in size.</p> <p>How can I read the file on the...
1,597,750
6
0
null
2009-10-20 20:04:00.13 UTC
20
2022-03-22 23:04:52.627 UTC
2019-04-01 10:10:07.26 UTC
null
850,848
null
178,437
null
1
45
python|ssh|paramiko
128,954
<p><a href="https://docs.paramiko.org/en/stable/api/sftp.html" rel="noreferrer">Paramiko's <code>SFTPClient</code> class</a> allows you to get a file-like object to read data from a remote file in a Pythonic way.</p> <p>Assuming you have an open <code>SSHClient</code>:</p> <pre><code>sftp_client = ssh_client.open_sft...
2,054,022
Is it unnecessary to put super() in constructor?
<p>Isn't this one automatically put by the compiler if I don't put it in a subclass's constructor?</p> <p>That means I don't even need to care about it? In some articles they put it out.</p> <p>And if I've got one constructor with arguments, will this be the constructor, or does it take a constructor without argument...
2,054,040
6
0
null
2010-01-13 02:42:58.453 UTC
60
2018-12-07 22:35:00.543 UTC
2015-09-15 06:59:02.173 UTC
null
966,185
null
206,446
null
1
184
java|constructor|super
102,400
<p>Firstly some terminology:</p> <ul> <li><strong>No-args constructor:</strong> a constructor with no parameters;</li> <li><strong>Accessible no-args constructor:</strong> a no-args constructor in the superclass visible to the subclass. That means it is either public or protected or, if both classes are in the same pa...
2,129,123
Rearrange columns using cut
<p>I am having a file in the following format</p> <pre> Column1 Column2 str1 1 str2 2 str3 3 </pre> <p>I want the columns to be rearranged. I tried below command</p> <blockquote> <p>cut -f2,1 file.txt</p> </blockquote> <p>The command doesn't reorder the columns. Any idea why its not working?</p>
2,129,133
9
0
null
2010-01-24 22:17:40.023 UTC
28
2021-11-27 13:13:52.583 UTC
2021-11-27 13:13:52.583 UTC
null
276,052
null
207,335
null
1
160
shell|csv|cut
139,491
<p>For the <code>cut(1)</code> man page:</p> <blockquote> <p>Use one, and only one of -b, -c or -f. Each LIST is made up of one range, or many ranges separated by commas. Selected input is written in the same order that it is read, and is written exactly once.</p> </blockquote> <p>It re...
33,636,796
Chrome / Safari not filling 100% height of flex parent
<p>I want to have a vertical menu with a specific height.</p> <p>Each child must fill the height of the parent and have middle-aligned text.</p> <p>The number of children is random, so I have to work with dynamic values.</p> <p>Div <code>.container</code> contains a random number of children (<code>.item</code>) tha...
33,644,245
5
3
null
2015-11-10 18:16:27.727 UTC
118
2020-03-05 06:14:52.18 UTC
2016-07-11 02:58:07.39 UTC
null
3,597,276
null
1,021,122
null
1
290
css|google-chrome|webkit|flexbox
218,827
<h2>Solution</h2> <p>Use nested flex containers.</p> <p>Get rid of percentage heights. Get rid of table properties. Get rid of <code>vertical-align</code>. Avoid absolute positioning. <em>Just stick with flexbox all the way through.</em></p> <p>Apply <code>display: flex</code> to the flex item (<code>.item</code>), ...
8,582,344
Does C# have IsNullOrEmpty for List/IEnumerable?
<p>I know generally empty List is more prefer than NULL. But I am going to return NULL, for mainly two reasons</p> <ol> <li>I have to check and handle null values explicitly, avoiding bugs and attacks.</li> <li>It is easy to perform <code>??</code> operation afterwards to get a return value.</li> </ol> <p>For strings...
8,582,374
11
2
null
2011-12-20 21:41:30.26 UTC
14
2022-06-02 21:05:54.36 UTC
2015-07-23 23:32:50.52 UTC
null
2,751,851
null
939,713
null
1
72
c#|ienumerable|isnullorempty
90,313
<p>nothing baked into the framework, but it's a pretty straight forward extension method.</p> <p><a href="http://danielvaughan.org/posts/.net/collections/2010/04/18/IEnumerable-IsNullOrEmpty/" rel="noreferrer">See here</a></p> <pre><code>/// &lt;summary&gt; /// Determines whether the collection is null or contain...
8,474,104
Android Fragment lifecycle over orientation changes
<p>Using the compatibility package to target 2.2 using Fragments.</p> <p>After recoding an activity to use fragments in an app I could not get the orientation changes/state management working so I've created a small test app with a single FragmentActivity and a single Fragment.</p> <p>The logs from the orientation ch...
8,678,705
7
2
null
2011-12-12 12:10:46.467 UTC
56
2017-03-22 12:32:56.76 UTC
2013-09-18 13:41:41.263 UTC
null
422,060
null
633,280
null
1
126
android|android-activity|android-fragments|orientation
103,577
<p>You're layering your Fragments one on top of the other.</p> <p>When a config change occurs the old Fragment adds itself to the new Activity when it's recreated. This is a massive pain in the rear most of the time.</p> <p>You can stop errors occurring by using the same Fragment rather than recreating a new one. Sim...
6,985,222
how to clear whole database in Rails seeds.rb
<p>What is the best way to accomplish this? As for now I'm using:</p> <pre><code>Role.delete_all User.delete_all ... </code></pre> <p>but how to clear habtm talbes? Like roles_users</p> <h2>Updated Answer</h2> <p>I think ream88 response answers my question most precisely, but probably the bestidea is to follow core...
6,985,839
3
0
null
2011-08-08 16:25:18.5 UTC
11
2016-09-25 09:13:10.393 UTC
2011-08-09 14:10:47.283 UTC
null
229,695
null
229,695
null
1
26
ruby-on-rails
24,345
<p>I definitely agree with @coreyward's answer, but if you really want to clear all tables inside your <code>seeds.rb</code> file, this snippet will do the job:</p> <pre><code>ActiveRecord::Base.establish_connection ActiveRecord::Base.connection.tables.each do |table| next if table == 'schema_migrations' # MySQL ...
6,796,974
Force Download an Image Using Javascript
<p>I want to know if there is any way to make a script using Javascript/jQuery to download (open a download dialog) a image so the browser won't just show it.</p>
6,799,284
4
3
null
2011-07-22 22:57:54.807 UTC
15
2016-12-09 03:31:50.803 UTC
2014-12-29 21:27:53.483 UTC
null
87,015
null
126,353
null
1
19
javascript|jquery|file-io|force-download
101,444
<p>You need to use server-side scripting for this. <a href="https://stackoverflow.com/search?q=force%20download%20script">Search on stackoverflow</a>.</p> <p>Alternately, your server might allow you to alter headers dynamically via configuration.</p> <h3>Apache solution with mod_headers</h3> <p>Place your downloadab...
23,665,056
AngularJS : Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource
<p>here is my code :</p> <pre><code>angular.module('option') .factory('optionListService', ['$resource', function($resource) { return $resource(HOST+'option/action/:id', {}, { 'get': {method:'GET'}, 'save': {method:'POST'}, 'query': {method:'GET', isArray:true}, ...
23,665,430
4
3
null
2014-05-14 21:01:59.74 UTC
15
2017-07-02 08:01:46.733 UTC
null
null
null
null
2,822,643
null
1
17
apache|angularjs
60,001
<p>Add those headers on the server side:</p> <pre><code>Access-Control-Request-Headers: X-Requested-With, accept, content-type Access-Control-Allow-Methods: GET, POST </code></pre> <p>If still not working post the details of the preflight <code>OPTIONS</code> request which the browser is sending.</p> <p><strong>Why ...
18,351,198
What are the uses of the exec command in shell scripts?
<p>Can anyone explain what are the uses of the exec command in shell scripting with simple examples?</p>
18,351,547
2
2
null
2013-08-21 07:22:49.933 UTC
110
2017-03-19 20:40:38.68 UTC
2014-11-24 16:51:00.613 UTC
null
33,204
null
2,400,564
null
1
284
shell|unix|exec
339,780
<p>The <code>exec</code> built-in command mirrors functions in the kernel, there are a family of them based on <code>execve</code>, which is usually called from C.</p> <p><code>exec</code> replaces the current program in the current process, without <code>fork</code>ing a new process. It is not something you would us...
40,122,162
Entity Framework Core - Lazy Loading
<p>Bowing to my Visual Studios request, I started my latest project using Entity Framework Core (1.0.1)</p> <p>So writing my database models as I always have using the 'virtual' specifier to enable lazy loading for a List. Though when loading the parent table it appears that the child list never loads.</p> <p><strong...
40,143,716
7
6
null
2016-10-19 04:30:34.167 UTC
9
2019-09-10 22:05:55.15 UTC
2016-12-27 08:52:36.607 UTC
null
1,478,537
null
5,073,958
null
1
49
c#|entity-framework-core
68,113
<p>So it appears that EF Core does not currently support lazy loading. Its coming but may be a while off. </p> <p>For now if anyone else comes across this problem and is struggling. Below is a demo of using <strong>Eager loading</strong> which is what for now you have to use.</p> <p>Say before you had a person object...
5,282,242
Spring AOP: Getting parameters of the pointcut annotation
<p>Consider I have defined the following aspect:</p> <pre><code>@Aspect public class SampleAspect { @Around(value="@annotation(sample.SampleAnnotation)") public Object display(ProceedingJoinPoint joinPoint) throws Throwable { // ... } } </code></pre> <p>and the annotation</p> <pre><code>public @...
5,296,145
2
1
null
2011-03-12 11:36:16.9 UTC
12
2019-08-13 17:39:30.36 UTC
null
null
null
null
164,165
null
1
28
spring|aop|spring-aop
27,095
<p>Change the advice signature to </p> <pre><code>@Around(value="@annotation(sampleAnnotation)") public Object display(ProceedingJoinPoint joinPoint, SampleAnnotation sampleAnnotation ) throws Throwable { // ... } </code></pre> <p>and you will have access to the value in the annotation.</p> <p>See <a href="http:...
975,982
User Defined Type (UDT) as parameter in public Sub in class module (VB6)
<p>I've tried to solve this problem, but can't find any solution. I have a UDT defined in a normal module, and wanted to use it as parameter in a <code>Public Sub</code> in a Class Module. I then get a compile error:</p> <blockquote> <p>Only public user defined types defined in public object modules can be used as p...
978,983
7
0
null
2009-06-10 14:37:11.547 UTC
12
2018-01-03 18:24:55.887 UTC
2017-02-24 17:27:20.493 UTC
null
481,061
null
74,415
null
1
17
vba|vb6|user-defined-types
47,785
<blockquote> <p>So is there any way to have a public UDT used as a parameter in a public sub in a class?</p> </blockquote> <p>In a word, no. The closest you can come with just Classic VB code would be to create a class that replicates the UDT and use that instead. There are definitely advantages there, but you...
1,254,366
Problem installing RMagick rubygem on Centos 5
<p>I'm having problems installing the RMagick rubygem on Centos 5. I've followed the steps detailed in <a href="http://rmagick.rubyforge.org/install2-linux.html" rel="noreferrer">http://rmagick.rubyforge.org/install2-linux.html</a> but when I try:</p> <pre><code>sudo gem install rmagick </code></pre> <p>the result is...
1,257,925
7
0
null
2009-08-10 11:22:33.643 UTC
9
2013-02-01 06:33:39.667 UTC
null
null
null
null
2,167,959
null
1
17
rubygems|rmagick|centos5
23,669
<p>So I've finally managed to install version 1.15.17 of the rmagick rubygem! Here's what I did:</p> <ol> <li>Uninstalled ImageMagick 6.5.4-9 and the delegate libraries that I had installed from source</li> <li><code>sudo yum install ImageMagick</code></li> <li><code>sudo yum install ImageMagick-devel</code></li> <li...
274,639
How To Create a Quick Minimal Firefox Extension?
<p>What the minimum basic setup required to begin developing a Firefox extension?</p>
384,933
7
3
null
2008-11-08 11:35:40.6 UTC
19
2014-07-23 01:03:21.803 UTC
2011-07-02 18:57:50.91 UTC
Balaji Sowmyanarayanan
188,760
labs
35,738
null
1
19
firefox|xul
4,609
<p>Step 1: Use the <a href="https://addons.mozilla.org/en-US/developers/tools/builder" rel="nofollow noreferrer">Add-on Builder</a> to generate all the necessary files.</p> <p>Step 2: Extract the downloaded files into your development area.</p> <p>Step 3: Create a text file in your profile's extensions folder named a...
901,224
Listening for input without focus in Java
<p>I'm making a small program in Java using the Robot class. The program takes over the mouse. while in the course of debugging if it starts acting in a way that I don't want it's hard to quit the program, since I can't move the mouse over to the terminate button in eclipse, and I can't use hotkeys to hit it because th...
904,448
7
0
null
2009-05-23 09:44:37.187 UTC
9
2021-01-10 16:59:23.013 UTC
null
null
null
null
63,791
null
1
25
java|keylistener
40,267
<p>This is not a trivial problem and Java doesn't give you a way to do it elegantly. You can use a solution like banjollity suggested but even that won't work all the time if your errant mouse clicks open another fullsized window currently open in your taskbar for example. </p> <p>The fact is, Java by default gives de...
385,912
Ruby: Object.to_a replacement
<p>I need to convert a passed in argument (single object or collection) to an Array. I don't know what the argument is. If it is an Array already, I want to leave it, otherwise create a one-element array from it. I'm looking to <strong>allow both <code>method(:objs =&gt; obj)</code> and <code>method(:objs =&gt; [obj1, ...
386,705
7
0
null
2008-12-22 10:06:09.13 UTC
8
2011-07-22 18:12:53.523 UTC
2011-07-22 18:01:50.697 UTC
Daniel Beardsley
211,563
Daniel Beardsley
13,216
null
1
28
ruby
21,946
<p>Use the method <a href="http://www.ruby-doc.org/core/classes/Kernel.html#M005989" rel="noreferrer">Kernel#Array</a>:</p> <pre><code>Array([1,2,3]) #=&gt; [1, 2, 3] Array(123) #=&gt; [123] </code></pre> <p>Yes it may look like a class at first but this is actually a method that starts with a capital letter.</p>
539,797
How should I do integer division in Perl?
<p>What is a good way to <strong>always</strong> do integer division in Perl?</p> <p>For example, I want:</p> <pre><code>real / int = int int / real = int int / int = int </code></pre>
539,805
7
0
null
2009-02-12 02:44:20.783 UTC
9
2022-02-17 00:24:08.993 UTC
2009-02-12 02:54:50.603 UTC
Rich B
5,640
Bryan Denny
396
null
1
63
perl|integer-division
120,169
<p>You can cast ints in Perl:</p> <pre><code>int(5/1.5) = 3; </code></pre>
125,341
How do you do Impersonation in .NET?
<p>Is there a simple out of the box way to impersonate a user in .NET?</p> <p>So far I've been using <a href="http://www.codeproject.com/KB/cs/zetaimpersonator.aspx" rel="noreferrer">this class from code project</a> for all my impersonation requirements.</p> <p>Is there a better way to do it by using .NET Framework?<...
125,356
7
1
null
2008-09-24 03:55:09.147 UTC
109
2022-08-09 14:32:39.88 UTC
2012-10-11 14:47:56.437 UTC
b.ashwin
743
b.ashwin
1,909
null
1
149
c#|.net|impersonation
290,376
<p>Here is some good overview of .NET impersonation concepts.</p> <ul> <li><a href="https://web.archive.org/web/20150613031724/http://michiel.vanotegem.nl/2006/07/windowsimpersonationcontext-made-easy/" rel="noreferrer">Michiel van Otegem: WindowsImpersonationContext made easy</a></li> <li><a href="http://msdn.microso...
568,657
Is it ever ok to store password in plain text in a php variable or php constant?
<p>As per question, is it safe to store passwords on php pages such as</p> <pre><code>$password = 'pa$$w0rd'; </code></pre> <p>If the users can't see it, it's safe, right?</p> <p>EDIT: Some people actually suggested using hash, however, there would be a problem with database server connection password, wouldn't it?<...
568,681
8
0
null
2009-02-20 08:02:28.663 UTC
8
2010-12-01 14:47:56.677 UTC
2009-05-07 09:12:52.493 UTC
Hao Wooi Lim
31,728
Hao Wooi Lim
31,728
null
1
31
php|security|passwords
31,078
<p>The short answer is both No, and It Depends.</p> <p>It's almost never a good idea to store passwords in plain text, especially in a web accessible location, if for <strong>no</strong> other reason than a simple server misconfiguration or an echo in the wrong place could expose it to the world.</p> <p>If you MUST s...
516,730
What does the Visual Studio "Any CPU" target mean?
<p>I have some confusion related to the .NET platform build options in Visual Studio 2008.</p> <p>What is the "Any CPU" compilation target, and what sort of files does it generate? I examined the output executable of this "Any CPU" build and found that they are the x86 executables (who would not see that coming!). So,...
516,740
8
3
null
2009-02-05 16:43:26.713 UTC
147
2021-05-26 08:29:44.807 UTC
2019-11-11 15:16:56.697 UTC
JPunyon
63,550
galets
14,395
null
1
557
.net|visual-studio-2008|build|64-bit
254,840
<p>An <strong>AnyCPU</strong> assembly will JIT to 64-bit code when loaded into a 64-bit process and 32 bit when loaded into a 32-bit process.</p> <p>By limiting the CPU you would be saying: <em>There is something being used by the assembly (something likely unmanaged) that requires 32 bits or 64 bits.</em></p>
1,236,148
HTML CSS How to stop a table cell from expanding
<p>I have a table which is built with the contents coming from a returned dataset. What I want to do is stop a 'description' cell from expanding over 280px wide, no matter what the content length (its s string). I have tried:</p> <pre><code>&lt;td align="left" valign="top" style="overflow:hidden;" nowrap="nowrap" wi...
1,236,163
8
0
null
2009-08-05 22:43:23.073 UTC
13
2021-03-18 08:36:30.47 UTC
2017-01-10 19:51:20.807 UTC
null
322,020
null
109,614
null
1
47
html|css
135,742
<p>It appears that your HTML syntax is incorrect for the table cell. Before you try the other idea below, confirm if this works or not... You can also try adding this to your table itself: table-layout:fixed.. .</p> <pre><code>&lt;td style="overflow: hidden; width: 280px; text-align: left; valign: top; whitespace: ...
311,062
caching JavaScript files
<p>Which is the best method to make the browser use cached versions of js files (from the serverside)?</p>
312,696
8
0
null
2008-11-22 08:05:37.563 UTC
27
2021-09-30 08:08:31.66 UTC
2008-11-22 08:19:16.1 UTC
Ken
20,074
Vasil
7,883
null
1
55
javascript|http|caching
158,048
<p>Have a look at Yahoo! tips: <a href="https://developer.yahoo.com/performance/rules.html#expires" rel="nofollow noreferrer">https://developer.yahoo.com/performance/rules.html#expires</a>. </p> <p>There are also tips by Google: <a href="https://developers.google.com/speed/docs/insights/LeverageBrowserCaching" rel="no...
437,897
What are unit testing and integration testing, and what other types of testing should I know about?
<p>I've seen other people mention several types of testing on Stack Overflow.</p> <p>The ones I can recall are unit testing and integration testing. Especially unit testing is mentioned a lot. What exactly is unit testing? What is integration testing? What other important testing techniques should I be aware of? </p...
437,903
9
3
null
2009-01-13 03:43:31.087 UTC
27
2020-07-09 08:15:48.067 UTC
2009-01-13 06:10:29.447 UTC
Norman Ramsey
41,661
Daniel
51,133
null
1
44
unit-testing|testing|integration-testing
30,546
<p>Off the top of my head:</p> <ul> <li><strong>Unit testing</strong> in the sense of "testing the smallest isolatable unit of an application"; this is typically a method or a class, depending on scale.</li> <li><strong>Integration testing</strong></li> <li><strong>Feature testing</strong>: this may cut across units, ...
481,312
Why is design-by-contract not so popular compared to test-driven development?
<p>You may think this question is like <a href="https://stackoverflow.com/questions/394591/design-by-contract-and-test-driven-development">this</a> question asked on StackOverflow earlier. But I am trying to look at things differently.</p> <p>In TDD, we write tests that include different conditions, criteria, verifica...
481,392
9
4
null
2009-01-26 20:57:44.09 UTC
18
2018-04-03 12:20:55.737 UTC
2017-07-29 15:19:59.727 UTC
null
3,924,118
Perpetualcoder
37,494
null
1
46
unit-testing|tdd|design-by-contract
13,337
<p>The main problem with DBC is that in the vast majority of cases, either the contract cannot be formally specified (at least not conveniently), or it cannot be checked with current static analysis tool. Until we get past this point for mainstream languages (not Eiffel), DBC will not give the kind of assurance that pe...
244,453
Best documentation for Boost:asio?
<p>The documentation available on the <a href="http://www.boost.org/doc/libs/1_36_0/doc/html/boost_asio.html" rel="noreferrer">boost website</a> is... limited.</p> <p>From what I've been able to read, the general consensus is that it is simply difficult to find good documentation on the boost::asio library.</p> <p>Is...
244,583
9
0
null
2008-10-28 19:11:03.9 UTC
93
2019-04-15 18:58:51.027 UTC
2008-11-02 23:54:57.473 UTC
Head Geek
12,193
michalmocny
29,701
null
1
147
c++|boost|boost-asio
60,948
<p>First, I've been using Boost.Asio for quite a while already -- and I share your concern. To address your question:</p> <ul> <li>There really is very scarce documentation about Boost.Asio aside from the introduction and tutorial. I am not the author, but this is mostly because there are just too many things to docum...
88,582
Structure of a PDF file?
<p>For a small project I have to parse pdf files and take a specific part of them (a simple chain of characters). I'd like to use python to do this and I've found several libraries that are capable of doing what I want in some ways.</p> <p>But now after a few researches, I'm wondering what is the real structure of a p...
88,595
12
0
null
2008-09-17 23:11:33.757 UTC
45
2020-05-04 19:39:18.15 UTC
null
null
null
Valentin Jacquemin
11,544
null
1
81
pdf
114,887
<p>Here is a link to Adobe's reference material</p> <p><a href="http://www.adobe.com/devnet/pdf/pdf_reference.html" rel="noreferrer">http://www.adobe.com/devnet/pdf/pdf_reference.html</a></p> <p>You should know though that PDF is only about presentation, not structure. Parsing will not come easy.</p>
751,522
How to change identity column values programmatically?
<p>I have a MS SQL 2005 database with a table <code>Test</code> with column <code>ID</code>. <code>ID</code> is an identity column. </p> <p>I have rows in this table and all of them have their corresponding ID auto incremented value.</p> <p>Now I would like to change every ID in this table like this:</p> <p><code>ID...
1,188,102
13
0
null
2009-04-15 12:43:47.93 UTC
27
2019-03-05 07:40:58.25 UTC
2019-03-05 07:40:58.25 UTC
null
10,877,860
null
38,940
null
1
160
sql-server|sql-server-2005|tsql|identity|sql-server-2005-express
324,187
<p>You need to </p> <pre><code>set identity_insert YourTable ON </code></pre> <p>Then delete your row and reinsert it with different identity.</p> <p>Once you have done the insert don't forget to turn identity_insert off</p> <pre><code>set identity_insert YourTable OFF </code></pre>
1,183,903
Regex using javascript to return just numbers
<p>If I have a string like "something12" or "something102", how would I use a regex in javascript to return just the number parts?</p>
1,183,906
13
0
null
2009-07-26 06:34:32.043 UTC
28
2021-01-12 08:56:17.23 UTC
2018-02-08 21:07:29.913 UTC
null
431,053
null
40,568
null
1
173
javascript|regex
295,192
<p>Regular expressions:</p> <pre class="lang-js prettyprint-override"><code>var numberPattern = /\d+/g; 'something102asdfkj1948948'.match( numberPattern ) </code></pre> <p>This would return an Array with two elements inside, '102' and '1948948'. Operate as you wish. If it doesn't match any it will return null.</p> ...
331,536
Windows threading: _beginthread vs _beginthreadex vs CreateThread C++
<p>What's a better way to start a thread, <code>_beginthread</code>, <code>_beginthreadx</code> or <code>CreateThread</code>?</p> <p>I'm trying to determine what are the advantages/disadvantages of <code>_beginthread</code>, <code>_beginthreadex</code> and <code>CreateThread</code>. All of these functions return a th...
331,567
17
1
null
2008-12-01 17:20:57.13 UTC
62
2020-08-08 09:50:47.23 UTC
2017-05-09 03:02:14.623 UTC
Kiril Gantchev
7,659,995
Kiril Gantchev
28,760
null
1
139
c++|c|multithreading|winapi
101,164
<p><code>CreateThread()</code> is a raw Win32 API call for creating another thread of control at the kernel level.</p> <p><code>_beginthread()</code> &amp; <code>_beginthreadex()</code> are C runtime library calls that call <code>CreateThread()</code> behind the scenes. Once <code>CreateThread()</code> has returned, ...
6,361,312
Negative regex for Perl string pattern match
<p>I have this regex:</p> <pre><code>if($string =~ m/^(Clinton|[^Bush]|Reagan)/i) {print "$string\n"}; </code></pre> <p>I want to match with Clinton and Reagan, but not Bush.</p> <p>It's not working.</p>
6,363,029
5
3
null
2011-06-15 16:50:13.123 UTC
27
2017-08-12 14:09:18.597 UTC
2017-08-12 14:09:18.597 UTC
null
63,550
null
120,457
null
1
51
regex|perl
161,005
<p>Sample text:</p> <blockquote> <p>Clinton said<br> Bush used crayons<bR> Reagan forgot<br></p> </blockquote> <p>Just omitting a Bush match:</p> <pre><code>$ perl -ne 'print if /^(Clinton|Reagan)/' textfile Clinton said Reagan forgot </code></pre> <p>Or if you really want to specify:</p> <pre><code>$ perl -...
6,818,978
Dialect not getting set in hibernate
<p>I am using Hibernate 3 and MySQL5.5.</p> <p>I am a newbie to hibernate and I am getting the below Exception</p> <pre><code>Exception in thread "main" org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection available at org.hibernate.dialect.resolver.DialectFactory.buildDialect(Dial...
6,819,137
6
3
null
2011-07-25 16:01:06.42 UTC
1
2015-12-09 00:19:55.74 UTC
2011-07-25 16:53:55.74 UTC
null
102,040
null
102,040
null
1
7
hibernate|dialect
57,008
<p>Either your first or second line should work. The second way, with just "dialect" is the way shown in the <a href="http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/session-configuration.html#configuration-xmlconfig">Hibernate reference</a>. If you're still getting that error, it suggests you may have so...
6,570,779
Why should I use applicative functors in functional programming?
<p>I'm new to Haskell, and I'm reading about functors and applicative functors. Ok, I understand functors and how I can use them, but I don't understand why <strong>applicative</strong> functors are useful and how I can use them in Haskell. Can you explain to me with a simple example why I need applicative functors?</p...
6,571,286
7
2
2012-05-24 22:51:15.51 UTC
2011-07-04 11:21:40.343 UTC
18
2017-04-27 03:50:53.363 UTC
2012-05-24 22:51:15.51 UTC
null
283,240
null
274,299
null
1
82
haskell|functional-programming|functor
18,107
<p><a href="http://www.soi.city.ac.uk/~ross/papers/Applicative.html" rel="noreferrer">Applicative functors</a> are a construction that provides the midpoint between functors and <a href="http://en.wikipedia.org/wiki/Monad_%28functional_programming%29" rel="noreferrer">monads</a>, and are therefore more widespread than ...
6,761,415
How to set a cookie for another domain
<p>Say I have a website called <code>a.com</code>, and when a specific page of this site is loaded, say page link, I like to set a cookie for another site called <code>b.com</code>, then redirect the user to <code>b.com</code>. </p> <p>I mean, on load of <code>a.com/link</code> I want to set a cookie for <code>b.com</...
6,761,443
11
2
null
2011-07-20 11:51:12.557 UTC
52
2020-10-14 15:51:42.6 UTC
2016-07-26 06:18:30.9 UTC
null
4,273,915
null
851,784
null
1
215
javascript|cookies|redirect
286,498
<p>You cannot set cookies for another domain. Allowing this would present an enormous security flaw.</p> <p>You need to get b.com to set the cookie. If a.com redirect the user to <code>b.com/setcookie.php?c=value</code></p> <p>The setcookie script could contain the following to set the cookie and redirect to the corr...
45,304,810
Angular Form validation on child components
<p>I've written a dynamic form in which there is a main part and sub parts based on a type that's selected in the main part (widget.type). Showing and hiding the sub parts is done with an ngSwitch.</p> <p>HTML of the form looks like this:</p> <pre><code>&lt;form class="widget-form cc-form" (ngSubmit)="saveChanges()" ...
57,859,420
3
6
null
2017-07-25 13:28:12.49 UTC
9
2019-09-10 05:56:55.387 UTC
null
null
null
null
1,859,954
null
1
16
forms|angular|typescript|angular-components
21,116
<p>For future googlers,</p> <p>I had a similar issue to this, albeit with fewer child components and after digging through @penleychan's aforementioned thread on the subject I found a little gem that solved this for me without the need to implement a custom directive.</p> <pre><code>import { ControlContainer, NgForm ...
15,929,686
How to decode unicode HTML by JavaScript?
<p>How to use JavaScript to decode from:</p> <pre><code>\u003cb\u003estring\u003c/b\u003e </code></pre> <p>to</p> <pre><code>&lt;b&gt;string&lt;/b&gt; </code></pre> <p>(I searched in internet, there are some site with same question, such as: <a href="https://stackoverflow.com/questions/4692882/javascript-html-decod...
15,929,722
2
0
null
2013-04-10 15:08:19.83 UTC
8
2021-08-10 20:37:15.443 UTC
2017-05-23 12:02:03.663 UTC
null
-1
null
1,560,697
null
1
12
javascript|unicode|decode
41,615
<pre><code>decodeURIComponent('\u003cb\u003estring\u003c/b\u003e'); // "&lt;b&gt;string&lt;/b&gt;" </code></pre> <p>Edit - I would delete the above answer if I could.</p> <p>The original question is a bit ambiguous.</p> <p><code>console.log('\u003cb\u003estring\u003c/b\u003e');</code> will already yield <code>&lt;...
15,648,711
angular js adding two numbers issue
<p>I have this code using angular js:</p> <pre><code>&lt;!DOCTYPE html &gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Untitled Page&lt;/title&gt; &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt...
15,648,744
7
0
null
2013-03-26 22:36:20.46 UTC
null
2017-03-13 10:14:57.657 UTC
null
null
null
null
1,238,850
null
1
15
javascript|angularjs
47,511
<p>If that is indeed the case then what is happening is the values that are being passed in for x and y are being treated as strings and concatenated. What you should do is convert them to numbers using <code>parseInt</code></p> <pre><code>return parseInt($scope.x) + parseInt($scope.y); </code></pre> <p>or if you pre...
15,521,451
How to navigate in JSF? How to make URL reflect current page (and not previous one)
<p>I am currently learning JSF and was rather amazed and puzzled when I realized that whenever we use <code>&lt;h:form&gt;</code>, the standard behavior of JSF is to always show me the URL of the <em>previous</em> page in the browser, as opposed to the URL of the <em>current</em> page. </p> <p>I understand that this h...
15,523,045
1
1
null
2013-03-20 10:51:13.17 UTC
51
2018-10-31 10:35:19.707 UTC
2015-01-30 09:08:01.65 UTC
null
157,882
null
1,290,182
null
1
59
jsf|url|redirect|navigation
48,478
<p>Indeed, JSF as being a form based application targeted MVC framework submits the POST form to the very same URL as where the page with the <code>&lt;h:form&gt;</code> is been requested form. You can confirm it by looking at the <code>&lt;form action&gt;</code> URL of the generated HTML output. This is in web develop...
15,952,663
Find the PID of a process that uses a port on Windows
<p>My service crash on startup with the classic:</p> <pre><code>java.rmi.server.ExportException: Listen failed on port: 9999 </code></pre> <p>How can I find the process for killing it?</p>
15,952,726
7
2
null
2013-04-11 15:21:17.447 UTC
66
2019-10-26 17:58:41.97 UTC
2019-04-06 16:52:15.053 UTC
null
63,550
null
2,135,045
null
1
135
port
344,621
<p>Just open a command shell and type (saying your port is 123456):</p> <pre><code>netstat -a -n -o | find "123456" </code></pre> <p>You will see everything you need.</p> <p>The headers are:</p> <pre><code> Proto Local Address Foreign Address State PID TCP 0.0.0.0:37 0.0.0...
35,926,381
Change highlight text color in Visual Studio Code
<p>Right now, it is a faint gray overlay, which is hard to see. Any way to change the default color?</p> <p><a href="https://i.stack.imgur.com/qmrOL.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/qmrOL.jpg" alt="enter image description here"></a></p>
35,929,462
8
5
null
2016-03-10 20:17:05.99 UTC
63
2021-07-02 09:31:28.643 UTC
null
null
null
null
2,128,937
null
1
213
visual-studio-code
122,549
<p><strong>Update</strong> <a href="https://stackoverflow.com/a/43605752/285212">See @Jakub Zawiślak's answer for VScode 1.12+</a></p> <hr> <p><strong>Old answer</strong></p> <p>Visual Studio Code calls this selection highlighting and unfortunately, I don't think the color is customizable currently. Themes can cont...
10,577,374
Mysql command not found in OS X 10.7
<p>I cant get my mysql to start on os x 10.7. It is located in <code>/usr/local/mysql/bin/mysql</code></p> <p>I get command not found when I type <code>mysql --version</code> in the terminal.</p> <p>I tried this <a href="https://stackoverflow.com/questions/8195418/cant-access-mysql-from-command-line-mac">can&#39;t ...
10,577,432
17
4
null
2012-05-14 03:59:56.63 UTC
77
2021-03-07 18:57:29.423 UTC
2017-05-23 11:47:24.983 UTC
null
-1
null
1,022,672
null
1
198
mysql
478,878
<p>This is the problem with your $PATH: </p> <p><code>/usr/local//usr/local/mysql/bin/private/var/mysql/private/var/mysql/bin</code>. </p> <p><code>$PATH</code> is where the shell searches for command files. Folders to search in need to be separated with a colon. And so you want <code>/usr/local/mysql/bin/</code> in ...
10,810,798
Cropping image with transparency in iPhone
<p>I am working on Jigsaw type of game where i have two images for masking, I have implemented this code for masking</p> <pre><code>- (UIImage*) maskImage:(UIImage *)image withMaskImage:(UIImage*)maskImage { CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGImageRef maskImageRef = [maskImage CGIma...
10,846,014
1
5
null
2012-05-30 06:07:36.053 UTC
17
2015-02-23 13:21:43.017 UTC
2012-06-11 11:49:05.143 UTC
null
392,924
null
392,924
null
1
23
iphone|uiimage|transparency
5,656
<p><strong>UPDATE 2</strong></p> <p>I became really curious to find a better way to create a Jigsaw puzzle, so I spent two weekends and created a demo project of <a href="https://github.com/GuntisTreulands/JigsawDemo" rel="noreferrer">Jigsaw puzzle</a>.</p> <p>It contains:</p> <ul> <li>provide column/row count and i...
13,762,992
Log Structured Merge Tree in Hbase
<p>I am working on Hbase. I have query regarding how Hbase store the data in sorted order with LSM.</p> <p>As per my understanding, Hbase use LSM Tree for data transfer in large scale data processing. when Data comes from client, it store in-memory sequentially first and than sort and store as B-Tree as Store file. Th...
13,763,821
2
0
null
2012-12-07 12:20:16.457 UTC
9
2017-02-22 11:10:38.813 UTC
2012-12-07 12:38:40.25 UTC
null
1,295,365
null
1,295,365
null
1
6
hadoop|hbase|hive|hdfs
14,622
<p>You can take a look at this two articles that describe exactly what you want</p> <p><a href="http://blog.cloudera.com/blog/2012/06/hbase-io-hfile-input-output/" rel="noreferrer">http://blog.cloudera.com/blog/2012/06/hbase-io-hfile-input-output/</a></p> <p><a href="http://blog.cloudera.com/blog/2012/06/hbase-write-...
13,295,600
multiple one-to-many relations ResultSetExtractor
<p>Let's say I have an object with two different one-to-many relations. Much like:</p> <p><code>Customer 1&lt;-&gt;M Brands</code> and <code>Customer 1&lt;-&gt;M Orders</code></p> <p>And let's say that the my object <code>Customer</code> has two lists related to those two objects.</p> <p>I've read this example: <a h...
13,583,889
4
8
null
2012-11-08 18:41:44.767 UTC
11
2012-11-28 07:11:14.87 UTC
null
null
null
null
930,928
null
1
8
java|spring|jdbc|jdbctemplate|spring-jdbc
30,230
<p>From your question, I assume that you have three tables; Customer, Brands, Orders. If you want to fetch the Brands and Orders properties of the Customer to your customer object, where there is no relationship between Brands and Orders, what I suggest is to use a UNION query. Something like this:</p> <pre><code>TBL_...
13,614,157
Get text of selected items in a ListBox
<p>I'm trying to show the selected items of listBox1 in a Message Box here's the code:</p> <pre><code>int index; string item; foreach (int i in listBox1 .SelectedIndices ) { index = listBox1.SelectedIndex; item = listBox1.Items[index].ToString (); groupids = item; MessageBox.Show(groupids); } </code>...
13,614,192
4
0
null
2012-11-28 20:52:07.22 UTC
3
2018-10-02 16:22:45.243 UTC
2012-11-28 20:54:04.313 UTC
null
27,414
null
1,849,107
null
1
10
c#|winforms
81,231
<p>The <code>i</code> in the foreach loop has the index you need. You're using <code>listBox1.SelectedIndex</code> which only has the first one. So item should be:</p> <pre><code>item = listBox1.Items[i].ToString (); </code></pre>
13,410,874
how to display background color in outlook 2010 html email?
<p>My problem is related to Microsoft Outlook 2010. Actually I want to publish my HTML newsletter in Outlook 2010, but the main problem which I am facing is styling problem it's not showing color and all when the newsletter is published in Outlook 2010. please help me out if you know how to set color and css style in O...
13,410,985
5
1
null
2012-11-16 05:14:17.94 UTC
6
2020-08-26 02:15:15.69 UTC
null
null
null
null
1,828,621
null
1
29
html|css|outlook-2010
66,075
<p>This method works across email clients:</p> <pre><code>&lt;table bgcolor="#3399ff" style="background:#3399ff;"&gt;&lt;tr&gt;&lt;td&gt;test&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; </code></pre>
13,325,519
jQuery: trigger a hover event from another element
<p>When you hover over one <code>&lt;div&gt;</code>, I want an <code>&lt;a&gt;</code> on a separate part of the page to be "hovered" on also.</p> <pre><code>&lt;div class="initiator"&gt; &lt;/div&gt; &lt;div&gt; &lt;a class="receiver href="#"&gt;Touch the div and I get hovered!&lt;/a&gt; &lt;/div&gt; </code></pre> ...
13,325,647
4
1
null
2012-11-10 19:50:46.383 UTC
8
2014-12-26 20:30:24.027 UTC
null
null
null
null
1,001,938
null
1
32
javascript|jquery|html|hover|bind
79,184
<p>Try this:</p> <pre><code>$('.initiator').on('mouseenter mouseleave', function(e) { $('.receiver').trigger(e.type); }) </code></pre> <p>It will apply the same triggers for the receiver as the initiator receives for both mouseenter and mouseleave. Note that:</p> <pre><code>.hover(over, out) </code></pre> <p>i...
13,387,742
Compare two objects with .equals() and == operator
<p>I constructed a class with one <code>String</code> field. Then I created two objects and I have to compare them using <code>==</code> operator and <code>.equals()</code> too. Here's what I've done:</p> <pre><code>public class MyClass { String a; public MyClass(String ab) { a = ab; } publi...
13,387,787
16
4
null
2012-11-14 21:35:08.39 UTC
35
2022-07-23 14:43:28.517 UTC
2017-02-01 12:20:48.4 UTC
null
4,823,977
null
1,798,371
null
1
90
java|class|object|methods|equals
423,959
<p><code>==</code> compares object references, it checks to see if the two operands point to the same object (not <em>equivalent</em> objects, the <strong>same</strong> object).</p> <p>If you want to compare strings (to see if they contain the same characters), you need to compare the strings using <code>equals</code>...
13,604,720
SQL Server database restore error: specified cast is not valid. (SqlManagerUI)
<p>I am using SQL Server 2008 R2 Standard (version 10.50.1600.1) for my production website and SQL Server Express edition with Advanced Services (v10.50.1600.1) for my localhost as a database.</p> <p>Few days back my SQL Server crashed and I had to install a new 2008 R2 Express version on my localhost. It worked fine...
13,604,946
4
5
null
2012-11-28 12:07:02.16 UTC
8
2018-06-20 10:08:21.12 UTC
2014-09-24 06:02:35.037 UTC
null
1,122,748
null
1,122,748
null
1
93
sql-server|sql-server-2008|database-restore
435,911
<p>The GUI can be fickle at times. The error you got when using T-SQL is because you're trying to overwrite an existing database, but did not specify to overwrite/replace the existing database. The following might work:</p> <pre><code>Use Master Go RESTORE DATABASE Publications FROM DISK = 'C:\Publications_backup_20...
13,433,799
Why doesn't nodelist have forEach?
<p>I was working on a short script to change <code>&lt;abbr&gt;</code> elements' inner text, but found that <code>nodelist</code> does not have a <code>forEach</code> method. I know that <code>nodelist</code> doesn't inherit from <code>Array</code>, but doesn't it seem like <code>forEach</code> would be a useful metho...
27,024,188
10
1
null
2012-11-17 19:05:47.697 UTC
28
2020-07-15 00:01:24.513 UTC
2016-12-25 09:17:47.077 UTC
null
24,468
null
871,980
null
1
105
javascript|arrays|dom|foreach
71,852
<h2>NodeList now has forEach() in all major browsers</h2> <p>See <a href="https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach" rel="noreferrer">nodeList forEach() on MDN</a>.</p> <h2>Original answer</h2> <p>None of these answers explain <em>why</em> NodeList doesn't inherit from Array, thus allowing it to...
13,362,490
Difference between Lookup() and Dictionary(Of list())
<p>I'm trying to wrap my head around which data structures are the most efficient and when / where to use which ones.</p> <p>Now, it could be that I simply just don't understand the structures well enough, but how is an <code>ILookup(of key, ...)</code> different from a <code>Dictionary(of key, list(of ...))</code>?</...
13,362,570
6
1
null
2012-11-13 14:28:21.2 UTC
38
2018-05-03 12:52:39.513 UTC
2012-11-13 14:35:46.853 UTC
null
1,159,478
null
1,693,085
null
1
209
c#|.net|vb.net|linq
76,587
<p>Two significant differences:</p> <ul> <li><code>Lookup</code> is immutable. Yay :) (At least, I believe the concrete <code>Lookup</code> class is immutable, and the <code>ILookup</code> interface doesn't provide any mutating members. There <em>could</em> be other mutable implementations, of course.)</li> <li>When y...
3,319,805
Detecting call state in iOS4
<p>I would like to know if there is a possibility to detect if the user is in call from an application that is currently in background.</p> <p>Or, receive a notification when the call is ended if the call was initiated from my app.</p> <p>Or, even more than that - is there a possibility to detect which app is in fore...
3,320,212
2
2
null
2010-07-23 15:42:29.197 UTC
14
2016-06-06 02:45:00.283 UTC
2012-01-24 12:35:53.86 UTC
null
113,079
null
246,119
null
1
10
iphone|ios4|core-telephony
14,619
<p>In <code>CTCallCenter</code>, there is a method, <code>callEventHandler</code> that you can pass a block that will get called when call events happen. In this block, you'll be passed a <code>CTCall</code> object, and can get the <code>callState</code>. So, you can get a notification when a call is initiated or ende...
3,352,741
Fortran assignment on declaration and SAVE attribute gotcha
<p>In fortran 95, if you assign a variable at declaration</p> <pre><code>integer :: var = 0 </code></pre> <p>it is equivalent to</p> <pre><code>integer, save :: var = 0 </code></pre> <p>and the variable is therefore preserved after routine execution (is equivalent to <code>static</code> in C speak) and does not get...
3,353,485
2
3
null
2010-07-28 12:21:19.91 UTC
10
2010-07-28 16:10:35.153 UTC
null
null
null
null
78,374
null
1
21
fortran
5,744
<p>I don't think that there is some rationale behind such behavior.</p> <p>But as far as I know, Stefano, you used wrong terminology. In your code <strong>there is no assignment statement</strong> only variable (var) initialization using initialization expression (0).</p> <pre><code>integer :: var = 0 ! type declarat...
3,585,533
Cucumber and Capybara, clicking a non-link or button element
<p>I am trying to test an inplace editor using Cucumber/Capybara/Selenium stack, but my problem is that the editor is activated by clicking a div and not a link or button. I can not seem to figure out how to get Capybara to do this. Is there a way of doing this?</p>
3,889,673
2
0
null
2010-08-27 15:08:32.297 UTC
12
2018-03-16 15:36:51.76 UTC
null
null
null
null
134,482
null
1
46
selenium|cucumber|integration-testing|webdriver|capybara
17,112
<p>You can click on an element via <a href="http://rdoc.info/github/jnicklas/capybara/master/Capybara/Node/Element#click-instance_method" rel="noreferrer"><code>Capybara::Element.click</code></a>. I add the following for this in my <code>web_steps.rb</code> to click on divs.</p> <pre><code>When /^(?:|I )click within "...
3,599,318
Hibernate query.list() method is returning empty list instead of null value
<p>When there are no rows, both <code>query.list()</code> and <code>criteria.list()</code> are returning <em>empty</em> list instead of a <code>null</code> value.</p> <p>What is the reason behind this?</p>
3,599,343
2
1
null
2010-08-30 09:48:17.513 UTC
9
2020-02-20 18:18:32.63 UTC
2020-02-20 18:18:32.63 UTC
null
814,702
null
324,900
null
1
51
java|hibernate|collections|nullpointerexception|return-value
51,320
<p>The reason is not to force null checks in client code, in consistency with <a href="http://www.amazon.co.uk/Effective-Java-Second-Joshua-Bloch/dp/0321356683" rel="noreferrer">Effective Java 2nd Edition</a>, Item 43: <strong>Return empty arrays or collections, not nulls</strong>.</p> <p>This makes the client code si...