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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
18,690,814 | How to increment an object property value if it exists, else set the initial value? | <p>How might I add check to see if a key already exists, and if does, increment the value, and if it doesn't exist, then set the initial value?</p>
<p>Something like this pseudo-code:</p>
<pre><code>var dict = {};
var new_item = "Bill"
If new_item not in dict:
dict[new_item] = 1
else:
dict[new_item] += 1
</code></... | 18,690,820 | 7 | 4 | null | 2013-09-09 02:41:29.29 UTC | 15 | 2022-03-27 06:55:40.94 UTC | 2019-09-25 07:24:42.497 UTC | null | 875,915 | null | 1,813,867 | null | 1 | 46 | javascript | 25,174 | <pre><code>dict[key] = (dict[key] || 0) + 1;
</code></pre> |
18,686,469 | Sharing audio file | <p>I'm trying to make a button for sharing an audio file. This is not working. First I tried to send the file right from my raw folder without copying it to the card of the phone. That didn't solve my problem. The second thing I tried, is saving the file to the phone and then share it. The part that saves the file to t... | 18,687,297 | 9 | 0 | null | 2013-09-08 17:16:45.507 UTC | 8 | 2021-10-06 16:09:44.17 UTC | 2015-04-30 14:38:33.973 UTC | user2629955 | null | null | 2,254,797 | null | 1 | 12 | android|audio|share | 25,542 | <p>Oké, found out what I did wrong. For people who have the same problem, this is how I solved it:</p>
<p>I forgot to parse the String to an uri. Thats the only line of code I had to add. <code>Uri uri = Uri.parse(sharePath);</code></p>
<p>Here is the full rest:</p>
<pre><code> String sharePath = Environment.getE... |
15,106,690 | How does ampersand in the return type of a function declaration work? | <p>In this piece of code, why f() is declared as "double & f(..."? What does it mean and how does it work? I don't even know what to google to find the answer to my question. Please help.</p>
<pre><code>double a = 1, b = 2;
double & f (double & d) {
d = 4;
return b;
}
</code></pre>
<p>I know amper... | 15,106,932 | 3 | 4 | null | 2013-02-27 07:48:09.843 UTC | 9 | 2013-02-27 08:06:58.487 UTC | 2013-02-27 08:00:32.407 UTC | null | 228,632 | null | 228,632 | null | 1 | 27 | c++|function|function-declaration | 22,372 | <p>When the <code>&</code> operator is used in a declaration form, preceded by a type it doesn't mean "the address of" but a "reference to" which is essentially an automatically dereferenced pointer with disabled pointer arithmetic.</p>
<p>There are no references in C, so if you want to pass or return by reference... |
15,003,518 | Confused by the difference between let and let* in Scheme | <p>Can anyone explain the difference simply? I don't think I understand the concept from the textbooks/sites I have consulted.</p> | 15,003,605 | 2 | 3 | null | 2013-02-21 13:30:01.893 UTC | 8 | 2019-05-20 06:20:31.447 UTC | null | null | null | null | 2,095,626 | null | 1 | 29 | scheme|let | 11,384 | <p>If you use <code>let</code>, you can't reference <em>other</em> bindings which appear in the same <code>let</code> expression. </p>
<p>For example, this won't work:</p>
<pre><code>(let ((x 10)
(y (+ x 6))) ; error! unbound identifier: x
y)
</code></pre>
<p>But if you use <code>let*</code>, it is possible ... |
8,548,141 | Can a website know if I am running a userscript? | <p>Can, for example, Facebook.com run a version control script on my browser and find out if I am running altered HTML code with the use of a script?</p>
<p>Could that be done with a script that can read the HTML code in the cache and produce some kind of hash tag that is sent back to the server and compared with the ... | 8,548,311 | 2 | 3 | null | 2011-12-17 21:46:55.887 UTC | 19 | 2017-12-23 17:51:51.077 UTC | 2017-12-23 17:51:51.077 UTC | null | 331,508 | null | 1,069,986 | null | 1 | 22 | javascript|facebook|greasemonkey|userscripts|tampermonkey | 13,450 | <p>Yes, in theory, a site can deduce the presence of scripts in various situations.</p>
<p>This is not foolproof and usually is way too much trouble for the negligible "threat" to the site. (Then again, some webmasters can be obsessive-paranoids about such things. ;) )</p>
<p>Some methods, depending on what the scrip... |
8,746,860 | how to handle 'double opacity' of two overlapping divs | <p>I have two divs, both with 0.6 opacity. I need them to overlap but retain their opacity and not create a new combined opacity level. I can't use an image. </p>
<p>EDIT -- The little circle is supposed to have a canvas element in it. Not sure if pseudo-elements would be the best solution.</p>
<p>Is there anyway to ... | 8,747,361 | 5 | 5 | null | 2012-01-05 17:28:27.36 UTC | 10 | 2020-03-29 01:27:22.797 UTC | 2015-05-01 16:20:20.03 UTC | null | 1,811,992 | null | 607,306 | null | 1 | 35 | css|opacity|css-shapes | 24,398 | <hr />
<p><strong>SUMMARY:</strong></p>
<hr />
<p>Depending on what is needed it can be tricky but the basic approach is pretty straight forward.</p>
<hr />
<p>This approach is a little different from my first thought... but this has the same result.</p>
<ol>
<li>I made a black/transparent pattern for the circle and se... |
8,931,328 | How do I add my new User Control to the Toolbox or a new Winform? | <p>I have an existing library (not a Winforms application) that supplies some Winforms to a bona-fide Windows application. Within this library, I would like to create a User Control to group some controls together. To accomplish this, I <strong>right-clicked, Add, User Control</strong> and dragged some controls onto ... | 8,931,414 | 4 | 5 | null | 2012-01-19 18:29:36.03 UTC | 11 | 2020-02-21 19:39:58.277 UTC | 2015-02-12 16:13:22.15 UTC | null | 102,937 | null | 102,937 | null | 1 | 74 | c#|winforms|visual-studio-2008|user-controls | 137,864 | <p>Assuming I understand what you mean:</p>
<ol>
<li><p>If your <code>UserControl</code> is in a library you can add this to you Toolbox using </p>
<p>Toolbox -> right click -> <em>Choose Items</em> -> <kbd>Browse</kbd></p>
<p>Select your assembly with the <code>UserControl</code>.</p></li>
<li><p>If the <code>UserC... |
4,894,120 | What does "for(;;)" mean? | <p>In C/C++, what does the following mean?</p>
<pre><code>for(;;){
...
}
</code></pre> | 4,894,126 | 5 | 6 | null | 2011-02-04 02:56:48.967 UTC | 9 | 2022-08-16 06:33:01.383 UTC | 2018-09-08 19:49:15.867 UTC | null | 2,947,502 | null | 394,103 | null | 1 | 37 | c++|c|syntax|for-loop | 64,946 | <p>It's an infinite loop, equivalent to <code>while(true)</code>. When no termination condition is provided, the condition defaults to false (i.e., the loop will not terminate).</p> |
5,382,712 | Bash: How to tokenize a string variable? | <p>If I have a string variable who's value is <code>"john is 17 years old"</code> how do I tokenize this using spaces as the delimeter? Would I use <code>awk</code>?</p> | 5,382,824 | 5 | 0 | null | 2011-03-21 19:41:10.963 UTC | 11 | 2018-12-21 09:36:48.587 UTC | null | null | null | null | 172,350 | null | 1 | 51 | linux|bash | 96,732 | <p>Use the shell's automatic tokenization of unquoted variables:</p>
<pre><code>$ string="john is 17 years old"
$ for word in $string; do echo "$word"; done
john
is
17
years
old
</code></pre>
<p>If you want to change the delimiter you can set the <code>$IFS</code> variable, which stands for internal field separator. ... |
5,058,843 | what is cgi programming | <p>What is exactly meant by CGI programming . If I am writing a cgi program in 'C' ,</p>
<p>in that context , what does the 'cgi' mean ?</p>
<p>Is the servelt environment is an abstraction of classical cgi programming ?</p> | 5,058,873 | 6 | 1 | null | 2011-02-20 17:57:56.237 UTC | 7 | 2018-05-10 12:06:49.727 UTC | null | null | null | null | 478,395 | null | 1 | 25 | cgi | 40,505 | <p>Abbreviation of Common Gateway Interface, a specification for transferring information between a World Wide Web server and a CGI program. A CGI program is any program designed to accept and return data that conforms to the CGI specification. The program could be written in any programming language, including C, Perl... |
5,155,333 | Remove index.php From URL - Codeigniter 2 | <p>I am having trouble removing index.php from my URLs in Codeigniter. I've made a few websites with Codeigniter 1.7 and the .htaccess code I used doesn't work in 2.</p>
<p>I have tried using </p>
<pre><code><IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRul... | 5,156,116 | 7 | 7 | null | 2011-03-01 13:46:24.09 UTC | 8 | 2017-03-14 14:07:59.457 UTC | 2011-03-01 14:00:22.43 UTC | null | 442,326 | null | 442,326 | null | 1 | 30 | php|.htaccess|codeigniter | 42,157 | <p>Try the first code block you posted, but instead of /index.php try using /(site)/index.php (obv replacing (site) with whatever your site folder is named).</p> |
4,938,723 | What is the correct way to make my PyQt application quit when killed from the console (Ctrl-C)? | <p>What is the correct way to make my PyQt application quit when killed from the console (Ctrl-C)?</p>
<p>Currently (I have done nothing special to handle unix signals), my PyQt application ignores SIGINT (Ctrl+C). I want it to behave nicely and quit when it is killed. How should I do that?</p> | 4,939,113 | 8 | 5 | null | 2011-02-08 21:33:12.257 UTC | 20 | 2021-01-20 02:28:16.76 UTC | 2011-02-08 21:40:33.66 UTC | null | 164,171 | null | 164,171 | null | 1 | 79 | python|linux|qt|pyqt|signals | 48,792 | <blockquote>
<p><a href="http://docs.python.org/library/signal.html" rel="noreferrer">17.4. signal — Set handlers for asynchronous events</a></p>
<p>Although Python signal handlers are called asynchronously as far as the Python user is concerned, they can only occur between the “atomic” instructions of the Python inter... |
5,334,353 | When should I use composite design pattern? | <p>I don't understand <strong>when I should use composite design pattern</strong>.
<em>What kinds of benefits will I get from this design pattern?</em>
I visited <a href="http://www.dofactory.com" rel="noreferrer">this website</a> but it only tells me about the structure of the design pattern and not the scenarios in w... | 5,338,862 | 11 | 4 | null | 2011-03-17 02:48:34.077 UTC | 27 | 2022-01-29 19:57:44.9 UTC | 2016-10-06 21:41:57.013 UTC | null | 4,446,493 | null | 631,733 | null | 1 | 69 | design-patterns|composite | 47,004 | <p>Quoting from <a href="https://rads.stackoverflow.com/amzn/click/com/0201633612" rel="noreferrer" rel="nofollow noreferrer">Design Patterns</a>,</p>
<blockquote>
<p>Use the Composite pattern when</p>
<ul>
<li>you want to represent part-whole hierarchies of objects.</li>
<li>you want clients to be able ... |
5,163,785 | How do I get the last character of a string? | <p>How do I get the last character of a string?</p>
<pre><code>public class Main {
public static void main(String[] args) {
String s = "test string";
//char lastChar = ???
}
}
</code></pre> | 5,163,852 | 11 | 3 | null | 2011-03-02 05:34:16.49 UTC | 25 | 2021-11-09 05:12:38.233 UTC | 2020-08-05 09:15:29.283 UTC | user10539074 | null | null | 516,805 | null | 1 | 228 | java|string|substring | 708,465 | <p>The code:</p>
<pre><code>public class Test {
public static void main(String args[]) {
String string = args[0];
System.out.println("last character: " +
string.substring(string.length() - 1));
}
}
</code></pre>
<p>The output of <code>java Test abcdef</code>:</p>
<... |
16,661,231 | Get value of a select element with ajax | <p>I'm trying to get a value of a select element, but is returning <code>Array()</code></p>
<p>This is my html:</p>
<pre><code><select name="data[Attorney][empresa]" id="AttorneyEmpresa">
<option value="">Selecione</option>
<option value="3">Sotreq</option>
</select>
</code... | 16,661,259 | 3 | 2 | null | 2013-05-21 02:28:03.1 UTC | 2 | 2013-05-21 02:42:45.673 UTC | 2013-05-21 02:42:45.673 UTC | user1823761 | null | null | 1,785,897 | null | 1 | 4 | jquery|ajax | 65,502 | <p>Try this</p>
<pre><code>$(document).ready(function() {
$("#AttorneyEmpresa").change(function(){
$.ajax({
type: 'POST',
data: {keyname:$('#AttorneyEmpresa option:selected').val()}
});
});
});
</code></pre>
<p><a href="http://jsfiddle.net/a5gkq/" rel="noreferrer">DEMO... |
12,227,689 | Function within Function in R | <p>Can you please explain to me why the code complains saying that <code>Samdat</code> is not found?</p>
<p>I am trying to switch between models, so I declared a function that contains these specific models and I just need to call this function as one of the argument in the <code>get.f</code> function where the resamp... | 12,229,142 | 2 | 4 | null | 2012-09-01 12:25:58.363 UTC | 4 | 2012-09-01 20:27:51.763 UTC | 2012-09-01 20:12:25.423 UTC | null | 1,287,593 | null | 1,640,457 | null | 1 | 8 | r | 47,765 | <p>When you call</p>
<pre><code>get.f(10, Model=M1(), M=1)
</code></pre>
<p>your <code>M1</code> function is immediately called. It dies because inside the body of <code>M1</code> you are using <code>Samdat</code> which is only defined later, in the body of <code>get.f</code>.</p>
<p>Somehow, you need to call <code>... |
12,191,029 | Running two independent tasks simultaneously using threads | <p>I've studied lots of tutorials on threads in java but I'm unable to find my answer. </p>
<p>My question is: how to run two independent threads simultaneously? </p>
<p>My case is: I have two tasks; </p>
<ol>
<li>save some data to the database</li>
<li>send a push notification on a mobile device. </li>
</ol>
<p... | 12,191,090 | 2 | 3 | null | 2012-08-30 06:26:48.833 UTC | 12 | 2018-02-12 10:40:50.55 UTC | 2012-08-30 06:28:29.013 UTC | null | 992,484 | null | 634,958 | null | 1 | 11 | java|multithreading|threadpool | 48,968 | <pre><code>new Thread(new Runnable() {
public void run() {
System.out.println("Look ma, no hands");
}
}).start();
new Thread(new Runnable() {
public void run() {
System.out.println("Look at me, look at me...");
}
}).start();
</code></pre>
<p>Works just fine...</p>
<p>I'd prefer the us... |
12,195,225 | Step by step Google SSO (java)? | <p>I am lost in all my open browser tabs for Google single sign on :)</p>
<p>I already have an application which I would like to put on Google market place. And mandatory integration is Google SSO. I have built application on Struts2 with Spring. </p>
<p>So now I need some instructions how to make this integration. A... | 12,607,695 | 2 | 4 | null | 2012-08-30 10:51:37.847 UTC | 10 | 2012-09-26 18:01:09.737 UTC | 2012-09-04 13:42:12.667 UTC | null | 180,335 | null | 180,335 | null | 1 | 13 | java|oauth-2.0|single-sign-on | 7,660 | <p>I made with Apache's HttpClient. This is my solution and works perfectly for me.</p>
<p>First point to authorization url:</p>
<p><code>https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/userinfo.profile+https://www.googleapis.com/auth/userinfo.email&state=%2Fprofile&response_ty... |
12,369,639 | Tomcat won't stop or restart | <p>I tried stopping tomcat. It failed with this message: </p>
<ul>
<li>Tomcat did not stop in time. PID file was not removed.</li>
</ul>
<p>I then tried again and got this:</p>
<ul>
<li>PID file (/opt/tomcat/work/catalina.pid) found but no matching
process was found. Stop aborted.</li>
</ul>
<p>I then tried startin... | 12,369,918 | 15 | 3 | null | 2012-09-11 12:23:52.07 UTC | 11 | 2022-05-07 10:23:47.67 UTC | null | null | null | null | 999,353 | null | 1 | 29 | tomcat|catalina | 143,612 | <p>It seems Tomcat was actually stopped. I started it and it started fine. Thanks all.</p> |
12,316,365 | How can I display a holo-themed activity circle? | <p>I've tried to show an indeterminate activity circle like this one:</p>
<p><img src="https://i.stack.imgur.com/SuGXK.png" alt="enter image description here"></p>
<p>Here's the layout code:</p>
<pre><code><ProgressBar
android:id="@+id/progress"
style="@style/GenericProgressIndicator"
android:layout_w... | 12,318,820 | 3 | 0 | null | 2012-09-07 10:32:04.59 UTC | 12 | 2014-05-07 09:33:31.463 UTC | 2014-05-07 09:33:31.463 UTC | null | 304,151 | null | 304,151 | null | 1 | 35 | java|android|android-progressbar | 20,615 | <p>This really wasn't documented anywhere and I found it through some random article. Adding this styling attribute does the trick:</p>
<pre><code>style="?android:attr/progressBarStyleLarge"
</code></pre>
<p>The only reference to this on the developer documentation is <a href="http://developer.android.com/reference/a... |
12,639,030 | Get the list of stored procedures created and / or modified on a particular date? | <p>I want to find which stored procedure I've created and also I want to find which stored procedure I've modified in my SQL Server on a particular date like 27 september 2012 (27/09/2012).</p>
<p>Is there any query which will list these procedures that are created and also modified on this date?</p> | 12,639,068 | 5 | 0 | null | 2012-09-28 11:20:34.42 UTC | 7 | 2016-11-04 10:09:58.66 UTC | 2015-02-12 18:44:47.757 UTC | null | 2,686,013 | null | 777,702 | null | 1 | 47 | sql|sql-server|sql-server-2008|sql-server-2005 | 147,459 | <p>You can try this query in any given SQL Server database:</p>
<pre><code>SELECT
name,
create_date,
modify_date
FROM sys.procedures
WHERE create_date = '20120927'
</code></pre>
<p>which lists out the name, the creation and the last modification date - unfortunately, it doesn't record <strong>who</stro... |
12,496,959 | Summing values in a List | <p>I'm trying to write a scala function which will recursively sum the values in a list. Here is what I have so far : </p>
<pre><code> def sum(xs: List[Int]): Int = {
val num = List(xs.head)
if(!xs.isEmpty) {
sum(xs.tail)
}
0
}
</code></pre>
<p>I dont know how to sum the individual Int va... | 12,497,010 | 12 | 4 | null | 2012-09-19 14:33:49.557 UTC | 13 | 2020-04-08 13:42:04.613 UTC | 2012-09-19 17:33:45.157 UTC | null | 298,389 | null | 701,254 | null | 1 | 54 | scala | 97,931 | <p>Here's the the "standard" recursive approach:</p>
<pre><code>def sum(xs: List[Int]): Int = {
xs match {
case x :: tail => x + sum(tail) // if there is an element, add it to the sum of the tail
case Nil => 0 // if there are no elements, then the sum is 0
}
}
</code></pre>
<p>And, here's a tail-rec... |
19,031,861 | PendingIntent not opening Activity in Android 4.3 | <p>In my <code>Service</code>, I open up a notification on normal run, using this code:</p>
<pre><code>private final static NOTIFICATION_ID = 412434;
private void startNotification() {
NotificationCompat.Builder builder = new NotificationCompat.Builder(
this);
builder.setSmallIcon(R.drawable.notifi... | 19,166,954 | 2 | 5 | null | 2013-09-26 15:04:08.667 UTC | 10 | 2018-08-21 12:51:13.493 UTC | null | null | null | null | 471,436 | null | 1 | 32 | android|android-intent|android-notifications | 11,480 | <p>There seems to be an issue on some 4.3 devices. It can be resolved by providing a non 0 value to the <code>requestCode</code> parameter.</p>
<p>Example:</p>
<pre><code>PendingIntent.getActivity(this, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT);
</code></pre> |
43,095,886 | How to initialize a struct from a json object | <p>HI i am new to swift any idea . How to initialize a struct from a json object . i could not figure out how can i do it .</p>
<blockquote>
<p>{
"user": {
"name": "cruskuaka",
"email": "cristlika@gmail.com",
"phoneNo":"018833455"
},
"address": {
"house": "100",
"street": "B",
... | 43,121,890 | 1 | 10 | null | 2017-03-29 14:06:25.513 UTC | 9 | 2020-06-28 03:18:47.17 UTC | 2017-03-30 15:09:19.233 UTC | null | 2,303,865 | user7166107 | null | null | 1 | 8 | json|swift|swift3 | 8,036 | <p>edit/update: Swift 4 or later you can use Codable Protocol:</p>
<pre><code>struct Root: Codable {
let user: User
let address: Address
let deliveryInstruction, deliveryMethod: String
}
</code></pre>
<hr />
<pre><code>struct Address: Codable {
let house, street, addressId, fullAddress: String
let t... |
3,858,698 | How to read json response as name value pairs in JQuery | <p>I want to read json response as name and value pairs in my JQuery code. Here is my sample JSON response that I return from my java code:</p>
<pre><code>String jsonResponse = "{"name1":"value1", "name2:value2"};
</code></pre>
<p>in my JQuery, if I write <code>jsonResponse.name1</code>, I will get value as <code>"va... | 3,858,712 | 3 | 0 | null | 2010-10-04 20:03:11.203 UTC | 4 | 2013-10-22 11:41:59.717 UTC | null | null | null | null | 322,492 | null | 1 | 7 | json|jquery|getjson | 46,883 | <pre><code>success: function(responseData) {
for (var key in responseData) {
alert(responseData[key]);
}
}
</code></pre>
<p>It is important to note that the order in which the properties will be iterated is arbitrary and shouldn't be relied upon.</p> |
3,809,165 | Long-running computations in node.js | <p>I'm writing a game server in node.js, and some operations involve heavy computation on part of the server. I don't want to stop accepting connections while I run those computations -- how can I run them in the background when node.js doesn't support threads?</p> | 3,846,564 | 3 | 0 | null | 2010-09-28 01:55:06.837 UTC | 10 | 2010-10-06 21:42:02.04 UTC | null | null | null | null | 216,728 | null | 1 | 14 | multithreading|backgroundworker|node.js | 7,559 | <p>I can't vouch for either of these, personally, but if you're hell-bent on doing the work in-process, there have been a couple of independent implementations of the WebWorkers API for node, as listed on the node modules page:</p>
<ul><li>http://github.com/cramforce/node-worker</li>
<li>http://github.com/pgriess/node... |
3,881,209 | Keep absolute reference even when inserting rows in Excel 2007 | <p>I have a spreadsheet where I want cell formula to always look at a specific cell, even if rows or columns are inserted and the specific cell moves. Effectively, I always want to look at the 'top' cell of a table, even if new rows are inserted at the top of the table.</p>
<p>eg. Cell A2 has the formula[=$E$2]</p>
<... | 3,886,284 | 3 | 0 | null | 2010-10-07 11:34:19.93 UTC | 1 | 2020-10-25 22:33:38.553 UTC | 2015-06-27 18:00:11.047 UTC | null | 9,117 | null | 41,013 | null | 1 | 14 | excel|reference | 65,982 | <p>Try <code>=indirect("F2")</code>. This will work if you know that the top-right cell of the table is always going to be <code>$F$2</code>.</p> |
3,735,836 | How can I install Perl modules without root privileges? | <p>I am on a Linux machine where I have no root privileges. I want to install some packages through CPAN into my home directory so that when I run Perl, it will be able to see it.</p>
<p>I ran <code>cpan</code>, which asked for some coniguration options. It asked for some directory, which it suggested <code>~/perl</co... | 3,735,909 | 3 | 3 | null | 2010-09-17 13:45:42.583 UTC | 20 | 2022-05-11 00:43:22.65 UTC | 2022-05-11 00:43:22.65 UTC | null | 2,766,176 | null | 294,813 | null | 1 | 43 | perl|module|cpan | 38,307 | <p>See <a href="http://search.cpan.org/perldoc/local::lib#The_bootstrapping_technique" rel="noreferrer">local::lib</a>.</p>
<p>Once you have it installed, you can do:</p>
<blockquote>
<p><code>perl -MCPAN -Mlocal::lib -e 'CPAN::install(LWP)'</code></p>
</blockquote> |
3,360,160 | How do I create an COM visible class in C#? | <p>I using <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_2010" rel="nofollow noreferrer">Visual Studio 2010</a> (.NET 4). I need to create a <a href="http://en.wikipedia.org/wiki/Component_Object_Model" rel="nofollow noreferrer">COM</a> object (in C#) and have no idea how to get ... | 3,362,624 | 3 | 4 | null | 2010-07-29 07:04:33.95 UTC | 35 | 2022-07-05 11:02:54.097 UTC | 2019-01-21 19:00:47.94 UTC | null | 3,195,477 | null | 405,349 | null | 1 | 48 | visual-studio-2010|c#-4.0|com | 92,558 | <p>OK I found the solution and I'll write it here for the common good.</p>
<ol>
<li>Start VS2010 as administrator.</li>
<li>Open a class library project (exmaple - MyProject).</li>
<li>Add a new interface to the project (see example below).</li>
<li>Add a <code>using System.Runtime.InteropServices;</code> to the file</... |
22,944,063 | How do I add 1 hour to datetime SQL column data? | <p>I used this part of a query to create a table column for the date and time a row is added:</p>
<p><code>order_date datetime NOT NULL DEFAULT GETDATE()</code></p>
<p>and whenever a new row is created, the data for <code>order_date</code> is set to something like this:</p>
<p><code>Apr 8 2014 9:52AM</code></p>
<p>... | 22,944,217 | 2 | 6 | null | 2014-04-08 17:23:47.533 UTC | 2 | 2017-08-09 11:17:39.643 UTC | 2017-08-09 11:17:39.643 UTC | null | 2,004,562 | null | 2,888,761 | null | 1 | 11 | sql|sql-server|datetime|getdate|hour | 72,658 | <p>You should consider using <a href="http://msdn.microsoft.com/en-us/library/bb630289.aspx" rel="nofollow">DATETIMEOFFSET</a> as your daatype instead of DATETIME. </p>
<blockquote>
<p>Defines a date that is combined with a time of a day that has time
zone awareness and is based on a 24-hour clock.</p>
</blockquot... |
22,725,537 | Using Java 8's Optional with Stream::flatMap | <p>The new Java 8 stream framework and friends make for some very concise Java code, but I have come across a seemingly-simple situation that is tricky to do concisely.</p>
<p>Consider a <code>List<Thing> things</code> and method <code>Optional<Other> resolve(Thing thing)</code>. I want to map the <code>Thi... | 22,726,869 | 12 | 7 | null | 2014-03-29 00:42:01.5 UTC | 50 | 2022-05-17 06:59:48.06 UTC | 2022-05-17 06:59:48.06 UTC | null | 452,775 | null | 966,104 | null | 1 | 290 | java|lambda|java-8|java-stream | 218,604 | <h2>Java 9</h2>
<p><a href="https://docs.oracle.com/javase/9/docs/api/java/util/Optional.html#stream--" rel="noreferrer"><code>Optional.stream</code></a> has been added to JDK 9. This enables you to do the following, without the need of any helper method:</p>
<pre><code>Optional<Other> result =
things.stream(... |
22,566,307 | Javascript's equivalent of destruct in object model | <p>Since I've dealt in the past with javascript's funky "object model", I assume there is no such thing as a destructor. My searches were mildly unsuccessful, so you guys are my last hope. How do you execute stuff upon instance destruction?</p> | 22,566,518 | 4 | 11 | null | 2014-03-21 18:05:09.873 UTC | 3 | 2021-03-10 17:48:14.283 UTC | 2020-05-18 18:05:09.38 UTC | null | 2,415,293 | null | 2,415,293 | null | 1 | 50 | javascript|destructor | 66,918 | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects" rel="noreferrer">MDN</a> is a nice resource for JS.
No, there is nothing like calling a function when an object ceases.</p> |
26,081,543 | How to tell at runtime whether an iOS app is running through a TestFlight Beta install | <p>Is it possible to detect at runtime that an application has been installed through TestFlight Beta (submitted through iTunes Connect) vs the App Store? You can submit a single app bundle and have it available through both. Is there an API that can detect which way it was installed? Or does the receipt contain inform... | 26,113,597 | 6 | 5 | null | 2014-09-28 04:12:11.497 UTC | 63 | 2022-04-04 18:14:22.983 UTC | 2014-09-30 05:48:58.823 UTC | null | 236,264 | null | 236,264 | null | 1 | 161 | ios|testflight | 34,089 | <p>For an application installed through TestFlight Beta the receipt file is named <code>StoreKit/sandboxReceipt</code> vs the usual <code>StoreKit/receipt</code>. Using <code>[NSBundle appStoreReceiptURL]</code> you can look for sandboxReceipt at the end of the URL.</p>
<pre><code>NSURL *receiptURL = [[NSBundle mainBun... |
21,938,932 | How do I convert a numpy array into a pandas dataframe? | <p>I would like to have the 3 columns of a numpy array</p>
<pre><code>px[:,:,0]
px[:,:,1]
px[:,:,0]
</code></pre>
<p>into a pandas Dataframe.</p>
<p>Should I use?</p>
<pre><code>df = pd.DataFrame(px, columns=['R', 'G', 'B'])
</code></pre>
<p>Thank you</p>
<p>Hugo</p> | 21,940,107 | 1 | 6 | null | 2014-02-21 15:49:07.6 UTC | 6 | 2014-02-21 16:41:56.587 UTC | null | null | null | null | 678,321 | null | 1 | 16 | python|numpy|pandas | 57,186 | <p>You need to reshape your array first, try this:</p>
<pre><code>px2 = px.reshape((-1,3))
df = pd.DataFrame({'R':px2[:,0],'G':px2[:,1],'B':px2[:,2]})
</code></pre> |
11,013,237 | How to maximize and minimize a div | <p>How to maximize and minimize a div? Can I resize div according to as need?</p> | 11,013,402 | 1 | 4 | null | 2012-06-13 10:46:16.417 UTC | 4 | 2022-08-31 10:49:40.58 UTC | 2022-08-31 10:49:40.58 UTC | null | 4,370,109 | null | 1,453,372 | null | 1 | 9 | javascript|html | 47,575 | <p>I think you need something like this</p>
<p><a href="http://jsfiddle.net/miqdad/Qy6Sj/1/">http://jsfiddle.net/miqdad/Qy6Sj/1/</a></p>
<p>You can view the code in jsfiddle here is the code what I have done created a div with another div inside as title bar and content box</p>
<p><strong>html</strong></p>
<pre><co... |
11,144,916 | Eclipse console shows:'Failed to push selection: Read-only file system'when i try to push a file | <p>I am trying to push a file to the SD Card but its showing error in console 'failed to push selection: Read-only file system'.I am using DDMS perspective in Eclipse.I generated sdcard using mksdcard command.</p> | 14,293,973 | 7 | 0 | null | 2012-06-21 18:57:11.213 UTC | 5 | 2014-11-04 15:07:53.48 UTC | 2013-11-08 17:23:36.267 UTC | null | 1,190,809 | null | 1,190,809 | null | 1 | 30 | android|eclipse|mobile|sd-card | 37,123 | <p>Just go to</p>
<p><code>C:\Documents and Settings\<adminstrator>\.android\avd</code></p>
<p>take <code>'properties'</code> of your avd folder (there is a folder for each of the avd's)</p>
<p>uncheck <code>'Read only'</code> -> OK</p>
<p>This was the only thing that worked for me.</p>
<p>P.S: Some of these... |
11,376,304 | Right way to write JSON deserializer in Spring or extend it | <p>I am trying to write a custom JSON deserializer in Spring. I want to use default serializer for most part of fields and use a custom deserializer for few properties. Is it possible?
I am trying this way because, most part of properties are values, so for these I can let Jackson use default deserializer; but few prop... | 11,377,362 | 4 | 2 | null | 2012-07-07 15:36:20.747 UTC | 20 | 2021-09-22 13:37:37.23 UTC | 2017-03-10 17:15:57.143 UTC | null | 5,557,885 | null | 41,977 | null | 1 | 63 | java|json|spring|jackson|deserialization | 129,252 | <p>I've searched a lot and the best way I've found so far is on this <a href="https://www.sghill.net/how-do-i-write-a-jackson-json-serializer-deserializer.html" rel="noreferrer">article</a>:</p>
<p><strong>Class to serialize</strong></p>
<pre><code>package net.sghill.example;
import net.sghill.example.UserDeserializ... |
12,911,628 | Getting error : WebSphere MQ reason code 2538? | <p>I have WebSphere MQ and WebSphere Message Broker installed on Linux and when I execute <code>mqsicreateexecutiongroup</code> I get an error saying: </p>
<blockquote>
<p>BIP1046E: Unable to connect with the queue manager (Could not connect to queue manager 'NSPZPAI1' (MQ reason code 2538)). </p>
</blockquote>
<... | 12,915,613 | 2 | 0 | null | 2012-10-16 09:34:11.407 UTC | 1 | 2012-10-16 13:43:55.243 UTC | 2012-10-16 13:13:33.407 UTC | null | 214,668 | null | 1,746,125 | null | 1 | 7 | ibm-mq|messagebroker | 57,406 | <p>Don't start the listener by hand or script. If you have a modern queue manager, define a listener object like so:</p>
<pre><code>DEF LISTENER(LISTENER.1414) TRPTYPE(TCP) +
CONTROL(QMGR) PORT(1414) +
REPLACE
START LISTENER(LISTENER.1414)
</code></pre>
<p>The attribute <code>CONTROL(QMGR)</code... |
12,901,734 | what is the advantage of Singleton Design Pattern | <p>every one know how to write code for Singleton Design Pattern.say for example</p>
<pre><code>public class Singleton
{
// Private static object can access only inside the Emp class.
private static Singleton instance;
// Private empty constructor to restrict end use to deny creating the object. ... | 12,901,802 | 8 | 6 | null | 2012-10-15 18:27:16.267 UTC | 4 | 2021-08-15 08:19:28.43 UTC | 2012-10-16 05:21:50.86 UTC | null | 783,681 | null | 508,127 | null | 1 | 11 | c#|oop | 41,207 | <p>To assure only one and same instance of object every time.</p>
<p>Take a scenario, say for a Company application, there is only one CEO. If you want to create or access CEO object, you should return the same CEO object every time.</p>
<p>One more, after logging into an application, current user must return same ob... |
12,836,270 | MySQL trigger before Insert value Checking | <p>I have a table <code>staff</code> with <code>office</code> column. Currently the <code>office</code> column do not accept NULL values. The application persisting onto this table has a bug which meant that, when the staff has not been assigned an office, it tries inserting a NULL value onto the table.</p>
<p>I have ... | 12,837,521 | 3 | 1 | null | 2012-10-11 09:21:11.5 UTC | 4 | 2015-09-02 14:22:44.783 UTC | null | null | null | null | 340,390 | null | 1 | 16 | mysql|triggers | 51,964 | <p>First, alter the table to allow NULLs:</p>
<pre><code>ALTER TABLE Staff MODIFY office CHAR(40) DEFAULT "N/A";
</code></pre>
<p>(Change <code>CHAR(40)</code> to whatever is appropriate.) Then you could use as your trigger:</p>
<pre><code>CREATE TRIGGER staffOfficeNullReplacerTrigger
BEFORE INSERT
ON Staff
FOR ... |
12,694,162 | Windows authentication failing in IIS 7.5 | <p>I'm building a simple internal application for my company, and it requires Windows Authentication for security. All other authentication modes are disabled. I'm stuck in a situation where internet explorer prompts for credentials 3 times, then fails with this error:</p>
<blockquote>
<p>Not Authorized</p>
<p>... | 12,695,809 | 5 | 0 | null | 2012-10-02 16:14:11.63 UTC | 10 | 2015-07-15 18:55:47.077 UTC | null | null | null | null | 641,985 | null | 1 | 25 | iis-7|windows-server-2008|windows-authentication | 49,432 | <p>Just worked out the solution with the help of a coworker after 2 days of fighting with this issue. Here is what he wrote:</p>
<blockquote>
<p>There are 2 providers for Windows Authentication (Negotiate and NTLM).
When setting the Website Authentication to Windows Authentication,
while Windows Authentication i... |
12,745,186 | Passing parameters to a JDBC PreparedStatement | <p>I'm trying to make my validation class for my program. I already establish the connection to the MySQL database and I already inserted rows into the table. The table consists of <code>firstName</code>, <code>lastName</code> and <code>userID</code> fields. Now I want to select a specific row on the database through m... | 12,745,238 | 5 | 1 | null | 2012-10-05 11:21:49.63 UTC | 7 | 2020-08-19 10:47:23.467 UTC | 2020-08-19 10:47:23.467 UTC | null | 452,775 | null | 1,708,134 | null | 1 | 29 | java|mysql|jdbc | 142,247 | <p>You should use the <a href="http://docs.oracle.com/javase/7/docs/api/java/sql/PreparedStatement.html#setString%28int,%20java.lang.String%29" rel="noreferrer"><code>setString()</code></a> method to set the <code>userID</code>. This both ensures that the statement is formatted properly, and prevents <code>SQL injectio... |
12,903,069 | Simple rails rake task refuse to run with error "Don't know how to build task", why? | <p>I have this simple rake task which refuses to run. I just don't see why it looks correct. Who can pinpoint me to the probably very simple mistake I made? Thank you!</p>
<p><strong>/lib/tasks/reindex.rb:</strong></p>
<pre><code>namespace :db do
desc "Tire reindex profiles"
task :reindex => :environment do
... | 12,903,234 | 5 | 0 | null | 2012-10-15 19:57:55.157 UTC | 3 | 2019-02-18 15:26:14.09 UTC | 2016-02-15 08:23:32.927 UTC | null | 1,052,068 | null | 355,281 | null | 1 | 49 | ruby-on-rails|rake|rake-task | 51,371 | <p>Rename your file to <code>reindex.rake</code> and it should work.</p>
<p>Related: <a href="https://stackoverflow.com/questions/5334520/dont-know-how-to-build-task-dbpopulate">How to build task 'db:populate'</a></p> |
12,777,751 | HTML required readonly input in form | <p>I'm making a form. And on one <code>input</code> tag is an <code>OnClick</code> event handler, which is opening a popup, where you can choose some stuff, and then it autofills the <code>input</code> tag.</p>
<p>That input tag is also <code>readonly</code>, so only right data will be entered.</p>
<p>This is the cod... | 25,694,734 | 13 | 4 | null | 2012-10-08 08:17:46.47 UTC | 13 | 2021-02-17 06:20:10.897 UTC | 2012-10-08 08:46:26.83 UTC | null | 1,419,007 | null | 1,175,881 | null | 1 | 57 | forms|html|google-chrome|readonly|required-field | 79,015 | <p>I had same requirement as yours and I figured out an easy way to do this.
If you want a "readonly" field to be "required" also (which is not supported by basic HTML), and you feel too lazy to add custom validation, then just make the field read only using jQuery this way:</p>
<p><strong>IMPROVED<... |
16,823,790 | Android Studio don't know where is Java | <p>I am getting this error:</p>
<blockquote>
<p>Cannot run program "/usr/lib/jvm/java-1.7.0-openjdk-i386/bin/java" (in directory "/home/sergiy/.AndroidStudioPreview/system/compile-server"): error=2, No such file or directory</p>
</blockquote>
<p>This happens after i remove all JDK (Open and other). Some time before... | 16,824,891 | 2 | 5 | null | 2013-05-29 21:06:37.897 UTC | 2 | 2015-12-13 13:12:16.84 UTC | 2015-06-28 13:34:04.207 UTC | null | 472,495 | null | 1,589,840 | null | 1 | 30 | java|android|ubuntu|android-studio | 46,901 | <p>All done! I find it in File->Other Settings->Default Project Structure->SDKs. There I change JDK home path.</p> |
16,945,519 | When to use RedirectToAction and where to use RedirectToRouteResult? | <h2><strong>Question</strong></h2>
<p>In which context, I can use <code>RedirectToAction</code> and where to use <code>RedirectToRouteResult</code> ?</p>
<p>I have two Action Methods like below.</p>
<h2><strong>Approach - 1</strong></h2>
<pre><code>public class ActionResultTypesController : Controller
{
public ... | 16,948,815 | 3 | 1 | null | 2013-06-05 16:46:56.073 UTC | 7 | 2015-02-03 10:28:59.57 UTC | 2013-06-15 13:19:16.757 UTC | null | 727,208 | null | 2,445,839 | null | 1 | 38 | asp.net-mvc|asp.net-mvc-4 | 46,758 | <p>There isn't much difference between the two when using within the controller like you have in your example. </p>
<p>They both ultimately achieve the same goal. However, RedirectToRouteResult() is mostly used in an action filter type scenario <a href="https://stackoverflow.com/questions/5904976/how-do-i-redirect-use... |
17,120,513 | PhpStorm debugger not stopping at BreakPoints; keeps waiting for xdebug _SESSION_ | <p><a href="https://stackoverflow.com/questions/17130931/phpstorm-webmatrix-iisexpress-xdebug-remote-port-which-ports-to-put">Updated question : PhpStorm | WebMatrix (IISExpress) | Xdebug.remote_port | — Which Port(s) to put where?</a></p>
<hr>
<p>I'm running localhost web server on my Windows machine with WebMatrix ... | 28,309,951 | 16 | 14 | null | 2013-06-15 05:31:49.87 UTC | 12 | 2022-01-19 10:00:21.693 UTC | 2017-05-23 12:34:19.983 UTC | null | -1 | null | 1,266,650 | null | 1 | 50 | php|xdebug|phpstorm | 44,367 | <p>There was a syntax error in <code>php.ini</code>. There were extra <code>"</code>quotes<code>"</code> and <code>;</code>colons<code>;</code>.</p>
<p><img src="https://i.stack.imgur.com/Wijaa.png" alt="xdebug.remote_port"></p> |
17,046,518 | Comment out text in R Markdown (Rmd file) | <p>In an R Markdown (<code>.Rmd</code>) file, how do you comment out unused text? I'm not referring to the text in the R code chunk, but the general texts, like <strong>%</strong> in <strong>LaTex</strong> for example.</p> | 17,047,124 | 4 | 1 | null | 2013-06-11 14:24:00.243 UTC | 18 | 2021-05-13 07:57:50.04 UTC | 2018-10-11 08:53:25.443 UTC | null | 1,981,275 | null | 2,474,891 | null | 1 | 137 | r-markdown|knitr | 92,181 | <p>I think you should be able to use regular html comments:</p>
<pre><code><!-- regular html comment -->
</code></pre>
<p>Does this work for you?</p> |
62,815,733 | Refactor this method to reduce its Cognitive Complexity from 21 to the 15 allowed. How to refactor and reduce the complexity | <p>how to reduce the complexity of the given piece of code? I am getting this error in Sonarqube---> Refactor this method to reduce its Cognitive Complexity from 21 to the 15 allowed.</p>
<pre><code>this.deviceDetails = this.data && {...this.data.deviceInfo} || {};
if (this.data && this.data.devi... | 62,867,219 | 3 | 1 | null | 2020-07-09 13:15:12.807 UTC | 2 | 2022-09-01 16:54:50.313 UTC | 2022-06-04 06:09:10.273 UTC | null | 201,303 | null | 8,118,685 | null | 1 | 12 | javascript|angular|sonarqube|karma-jasmine|sonarlint | 76,007 | <p><strong>A little information on how cognitive complexity works and why you should keep it low</strong></p>
<p>First of all it is important to understand how "<em>Cognitive Complexity</em>" works as compared to "<em>Cyclomatic Complexity</em>". Cognitive complexity takes into account the complexit... |
10,202,427 | SELECT MySQL rows where today's date is between two DATE columns | <p>How can I get the rows in a table where today's date is between (inclusive) two DATE columns of that row?
For example, take these two columns of a table:</p>
<p><img src="https://i.stack.imgur.com/vVe8M.png" alt="enter image description here"></p>
<p>How could I get the first and second rows on the 10th of April, ... | 10,202,530 | 4 | 2 | null | 2012-04-18 03:36:58.29 UTC | 6 | 2020-11-09 08:38:53.607 UTC | null | null | null | null | 492,025 | null | 1 | 18 | mysql|select | 49,170 | <p>You will find a lot of people using between operator, but I prefer using a simple AND operator. </p>
<p>I do that because although the between operator IS inclusive, simple dates (2012-04-10) can be counted as being midnight, and will thus not be inclusive.</p>
<p>So this should work just fine and will always incl... |
9,989,414 | How to create a String with carriage returns? | <p>For a JUnit test I need a String which consists of multiple lines. But all I get is a single lined String. I tried the following:</p>
<pre><code> String str = ";;;;;;\n" +
"Name, number, address;;;;;;\n" +
"01.01.12-16.02.12;;;;;;\n" +
";;;;;;\n" +
... | 9,989,790 | 6 | 4 | null | 2012-04-03 08:08:02.647 UTC | 4 | 2016-03-22 20:06:28.42 UTC | null | null | null | null | 319,773 | null | 1 | 21 | java|string | 138,708 | <p>Thanks for your answers. I missed that my data is stored in a <code>List<String></code> which is passed to the tested method. The mistake was that I put the string into the first element of the ArrayList. That's why I thought the String consists of just one single line, because the debugger showed me only one ... |
9,752,760 | Slide Toggle for Android | <p>Anyone know of any open source implementation of a slide toggle for android. The default android toggle(<a href="http://developer.android.com/reference/android/widget/ToggleButton.html" rel="noreferrer">ToggleButton</a>) is not pretty. I am looking for anything similar to iOS. I should be able to implement one from ... | 9,752,821 | 4 | 7 | null | 2012-03-17 18:45:38.557 UTC | 12 | 2021-08-14 21:17:32.233 UTC | 2012-10-09 04:46:15.193 UTC | null | 892,771 | null | 892,771 | null | 1 | 30 | android | 48,031 | <p>iOS does not seem to have a "slide toggle", at least under that name, based on a Google search. And, you did not provide an image (or a link to an image) of what you want.</p>
<p>Android 4.0 added a <a href="http://developer.android.com/reference/android/widget/Switch.html" rel="noreferrer"><code>Switch</code></a> ... |
9,914,816 | What is an example of the simplest possible Socket.io example? | <p>So, I have been trying to understand Socket.io lately, but I am not a supergreat programmer, and almost every example I can find on the web (believe me I have looked for hours and hours), has extra stuff that complicates things. A lot of the examples do a bunch of things that confuse me, or connect to some weird dat... | 9,916,153 | 5 | 2 | null | 2012-03-28 20:03:53.31 UTC | 70 | 2020-01-27 14:06:53.887 UTC | null | null | null | null | 276,399 | null | 1 | 124 | node.js|socket.io | 174,538 | <p><strong>Edit:</strong> I feel it's better for anyone to consult the excellent <a href="http://socket.io/get-started/chat/" rel="noreferrer">chat example</a> on the Socket.IO getting started page. The API has been quite simplified since I provided this answer. That being said, here is the original answer updated smal... |
11,528,845 | How do I style the alert box with CSS? | <p>-- Update --i have read a lot on the subject tried a few scripts and needed help to find out what you can or cant do. Community answered it all and the following is a good starting point. (answers here extracted from community below, thank you)</p>
<ol>
<li><p>YOU CAN NOT OVERIDE DEFAULT STYLE OF ALERT. It is produ... | 11,528,905 | 5 | 5 | null | 2012-07-17 18:43:20.327 UTC | 2 | 2020-12-30 12:05:44.05 UTC | 2012-07-17 21:46:00.17 UTC | null | 1,460,917 | null | 1,460,917 | null | 1 | 7 | jquery|css | 49,009 | <p>Try <code>jQuery UI</code> located here: <a href="http://jqueryui.com/demos/dialog/" rel="noreferrer">http://jqueryui.com/demos/dialog/</a></p>
<p>They have a theme roller where you can style the dialog and modal boxes.</p>
<p>-- EDIT --</p>
<p>Answering your second question.</p>
<p>Check out the jsFiddle here: ... |
11,871,120 | Java time since the epoch | <p>In Java, how can I print out the time since the epoch given in seconds and nanoseconds in the following format :</p>
<pre><code>java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
</code></pre>
<p>My input is:</p>
<pre><code>long mnSeconds;
long mnNanoseconds;
</code></pre>
<p>Where the total of the two is th... | 11,871,217 | 6 | 1 | null | 2012-08-08 18:46:50.68 UTC | 1 | 2019-05-26 20:55:30.067 UTC | 2016-07-24 05:50:39.31 UTC | null | 1,276,636 | null | 1,585,643 | null | 1 | 15 | java|time|simpledateformat|epoch | 58,308 | <p>You can do this</p>
<pre><code>public static String format(long mnSeconds, long mnNanoseconds) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.");
return sdf.format(new Date(mnSeconds*1000))
+ String.format("%09d", mnNanoseconds);
}
</code></pre>
<p>e.g.</p>
<pre><code>2012-0... |
11,713,306 | How can I remove children in jQuery? | <p>In the following example</p>
<p><a href="http://jsfiddle.net/pDsGF/" rel="noreferrer">http://jsfiddle.net/pDsGF/</a></p>
<p>I want to remove just class 'child' from class 'parent'. I have tried</p>
<p><code>.remove($('parent').children('child'))</code></p>
<p>But it doesn't work</p> | 11,713,330 | 5 | 1 | null | 2012-07-29 21:56:29.513 UTC | 2 | 2017-11-23 14:00:07.997 UTC | null | null | null | null | 1,011,816 | null | 1 | 19 | jquery | 59,947 | <p>You need periods to get elements by class, for one. For two, that syntax isn't correct.</p>
<pre><code>$('.parent .child').remove();
</code></pre>
<p><a href="http://jsfiddle.net/pDsGF/4/">Here's a demo.</a></p> |
11,475,970 | Recover sa password | <p>I have a computer which was used by another employee.</p>
<p>SQL Server 2008 R2 was installed but I don't know the 'sa' password.</p>
<p>When I try to alter the login, it gives below error.</p>
<blockquote>
<p>Cannot alter the login 'sa', because it does not exist or you do not have permission.</p>
</blockquote... | 11,476,059 | 2 | 1 | null | 2012-07-13 18:09:30.33 UTC | 8 | 2021-12-28 02:27:09.337 UTC | 2012-07-13 18:18:15.137 UTC | null | 61,305 | null | 1,514,165 | null | 1 | 37 | sql|sql-server-2008-r2 | 151,265 | <p>The best way is to simply reset the password by connecting with a domain/local admin (so you may need help from your system administrators), but this only works if SQL Server was set up to allow local admins (these are now left off the default admin group during setup).</p>
<p>If you can't use this or other existing... |
11,601,692 | MySQL/Amazon RDS error: "you do not have SUPER privileges..." | <p>I'm attempting to copy my mysql database from an Amazon EC2 to an RDS:</p>
<p>I successfully did a <code>mysqldump</code> of my database into my root folder using this:</p>
<pre><code>root@ip-xx-xx-xx-xx:~# mysqldump my_database -u my_username -p > my_database.sql
</code></pre>
<p>Then I tried to transfer this... | 11,603,568 | 8 | 2 | null | 2012-07-22 15:49:44.71 UTC | 31 | 2022-04-08 15:28:06.263 UTC | 2020-06-15 02:10:16.7 UTC | null | 6,632,744 | null | 702,275 | null | 1 | 122 | mysql|amazon-ec2|amazon-web-services|amazon-rds|sql-grant | 122,086 | <p>Per <a href="http://getasysadmin.com/2011/06/amazon-rds-super-privileges/">http://getasysadmin.com/2011/06/amazon-rds-super-privileges/</a>, you need to set <code>log_bin_trust_function_creators</code> to 1 in <a href="https://console.aws.amazon.com/rds/">AWS console</a>, to load your dump file without errors.</p>
... |
11,599,666 | Get the value of checked checkbox? | <p>So I've got code that looks like this:</p>
<pre><code><input class="messageCheckbox" type="checkbox" value="3" name="mailId[]">
<input class="messageCheckbox" type="checkbox" value="1" name="mailId[]">
</code></pre>
<p>I just need Javascript to get the value of whatever checkbox is currently checked.</... | 11,599,728 | 13 | 4 | null | 2012-07-22 10:54:07.68 UTC | 59 | 2021-11-10 03:58:18.543 UTC | 2015-07-24 00:50:04.837 UTC | null | 2,498,017 | null | 1,195,812 | null | 1 | 244 | javascript|checkbox | 1,096,924 | <p><em>For modern browsers</em>:</p>
<pre><code>var checkedValue = document.querySelector('.messageCheckbox:checked').value;
</code></pre>
<p><em>By using <code>jQuery</code></em>:</p>
<pre><code>var checkedValue = $('.messageCheckbox:checked').val();
</code></pre>
<p><em>Pure javascript without <code>jQuery</code>... |
20,094,276 | IE11 is missing User Agent Style for main element (display: block;) | <p>Apparantly IE11 doesn't have a User Agent Style for <code><main></code> and therefor no <code>display: block;</code> on it. <strong>Why is there no User Agent Style?</strong> Is this a bug or on purpose?</p>
<p>Adding <code>display: block;</code> to the main element is enough, tho.</p> | 20,095,764 | 1 | 5 | null | 2013-11-20 11:09:10.59 UTC | 2 | 2014-01-03 13:55:05.5 UTC | 2014-01-03 13:55:05.5 UTC | null | 2,036,825 | null | 2,036,825 | null | 1 | 29 | html|internet-explorer|user-agent|internet-explorer-11 | 8,113 | <p>The <code>main</code> element is indeed not fully supported by IE11. Adding <code>main { display: block; }</code> to your CSS is the best solution for IE9+. You don't need to make conditional comments - since <code>display: block;</code> is the default behavior for <code>main</code> elements, it won't mess up anythi... |
20,224,446 | How to view and edit cacerts file? | <p>Using RAD 8.5 with WAS 8.5 runtime, I am getting an exception on my console:</p>
<p><code>The keystore located at "C:\IBM\Websphere85\jdk\jre\lib\security\cacerts" failed to load due to the following error: DerInputStream.getLength(): lengthTag=109, too big..</code></p>
<p>After searching for the error I got this ... | 20,483,171 | 2 | 6 | null | 2013-11-26 17:53:42.49 UTC | 4 | 2021-05-12 07:15:29.077 UTC | 2015-11-24 23:28:59.607 UTC | null | 1,505,120 | null | 1,054,245 | null | 1 | 15 | java|keystore|websphere-8|ibm-rad | 71,174 | <p>Here's a way to actually solve this problem without the need to view or edit the file.</p>
<blockquote>
<p>The default keyStore type is JKS and the WSKeyStore class assumes it to be a PKCS12 file which throws the above error. So we need to convert the cacerts file to .p12 format.</p>
</blockquote>
<p>Using the k... |
3,800,458 | Quickly getting the color of some pixels on the screen in Python on Windows 7 | <p>I need to get the color of some pixels on the screen or from the active window, and I need to do so <em><strong>quickly</strong></em>. I've tried using win32gui and ctypes/windll, but they're much too slow. Each of these programs gets the color of 100 pixels:</p>
<pre><code>import win32gui
import time
time.clock()
f... | 3,803,344 | 4 | 0 | null | 2010-09-27 00:40:04.897 UTC | 14 | 2021-02-07 15:30:49.467 UTC | 2021-02-07 15:30:49.467 UTC | null | 5,267,751 | null | 319,821 | null | 1 | 17 | python|windows-7|colors|screen|pixel | 80,800 | <p>I had this same exact problem, and solved it (<a href="https://stackoverflow.com/questions/3742731/java-how-to-draw-constantly-changing-graphics">in Java</a>, <a href="https://stackoverflow.com/questions/3743897/how-to-draw-constantly-changing-graphics">in C#</a>). The main idea behind the solution is GetPixel from ... |
3,375,789 | Plus (+) in MVC Argument causes 404 on IIS 7.0 | <p>I have an MVC route that is giving me hell on a staging server running IIS. I am running Visual Studio 2010's development server locally.</p>
<p>Here is a sample URL that actually works on my dev box:</p>
<pre><code>Root/CPUBoards/Full+Size
Results
Server Error404 - File or directory not found.
The resource you ... | 3,375,847 | 4 | 1 | null | 2010-07-30 22:20:34.45 UTC | 7 | 2020-04-28 13:56:17.957 UTC | 2010-07-30 22:24:20.91 UTC | null | 18,936 | null | 406,732 | null | 1 | 29 | asp.net-mvc-2|arguments|asp.net-mvc-routing | 6,126 | <p><code>+</code> only has the special meaning of being a space in <code>application/x-www-form-urlencoded</code> data such as the query string part of a URL.</p>
<p>In other parts of the URL like path components, <code>+</code> literally means a plus sign. So resolving <code>Full+Size</code> to the unencoded name <co... |
3,658,527 | Where/what level should logging code go? | <p>I'm wondering where logging code should go. For example, should my repository log it's own errors? Or should I log all errors from the UI/controller? Are there any general deisgn principles about this, or does anyone have link to a good article or somesuch.</p> | 3,659,000 | 5 | 0 | null | 2010-09-07 12:11:10.107 UTC | 10 | 2010-10-13 16:57:59.893 UTC | 2010-10-13 16:57:59.893 UTC | null | 265,143 | null | 207,752 | null | 1 | 18 | design-patterns|language-agnostic|logging|exception-handling | 3,722 | <p>Logging and tracing is (IMO) a fine art, knowing what to log and where takes experience.</p>
<p>I've found that the best (worst?) way of learning the art of logging is by experiencing the pain of attempting to diagnose issues with shoddy logging!</p>
<p>All I can offer you is some points of advice:</p>
<h2>Think ... |
3,982,663 | Falsey values in JavaScript | <p>I had an interesting interview question today that stumped me a little. I was asked about falsey values. So undefined, NaN, null, 0, and an empty string all evaluate to false. What is the reason this is useful to know in JavaScript? The only thing I can think of is instead of having to do this:</p>
<pre><code>if (m... | 3,982,928 | 6 | 5 | null | 2010-10-20 21:55:05.533 UTC | 7 | 2015-04-15 07:08:49.15 UTC | 2015-04-10 19:18:16.667 UTC | null | 63,550 | null | 392,572 | null | 1 | 28 | javascript | 29,945 | <p>One dangerous issue of falsey values you have to be aware of is when checking the presence of a certain property.</p>
<p>Suppose you want to test for the availability of a new property; when this property <em>can</em> actually have a value of <code>0</code> or <code>""</code>, you can't simply check for its availab... |
3,695,340 | Java "NoSuchMethodError" | <p>I'm getting: </p>
<pre><code>NoSuchMethodError: com.foo.SomeService.doSmth()Z
</code></pre>
<p>Am I understanding correctly that this <code>'Z'</code> means that return type of doSmth() method is boolean? If true, then that kind of method really does not exist because this method returns some Collection. But on th... | 3,695,376 | 7 | 3 | null | 2010-09-12 15:19:18.087 UTC | null | 2015-11-10 15:35:45.957 UTC | 2014-02-08 12:03:43.183 UTC | null | 1,693,859 | null | 223,610 | null | 1 | 28 | java|nosuchmethoderror | 50,434 | <p>Looks like method exists in classpath during compilation, but not during running of your application.</p>
<p>I don't think return type is a problem. If it was, it wouldn't compile. Compiler throws error when method call is ambiguous, and it is when two methods differ only by return type.</p> |
3,788,605 | #if DEBUG vs. Conditional("DEBUG") | <p>Which is better to use, and why, on a large project:</p>
<pre><code>#if DEBUG
public void SetPrivateValue(int value)
{ ... }
#endif
</code></pre>
<p>or</p>
<pre><code>[System.Diagnostics.Conditional("DEBUG")]
public void SetPrivateValue(int value)
{ ... }
</code></pre> | 3,788,719 | 8 | 7 | null | 2010-09-24 15:34:08.48 UTC | 150 | 2019-11-22 11:05:01.54 UTC | 2016-12-28 10:28:58.087 UTC | null | 3,926,461 | null | 100,988 | null | 1 | 481 | c#|debugging|preprocessor|debug-symbols | 324,616 | <p>It really depends on what you're going for:</p>
<ul>
<li><code>#if DEBUG</code>: The code in here won't even reach the IL on release.</li>
<li><code>[Conditional("DEBUG")]</code>: This code will reach the IL, however <em>calls</em> to the method will be omitted unless DEBUG is set when the caller is compiled.</li>
... |
7,784,067 | Compare date without time | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/1439779/how-to-compare-two-dates-without-the-time-portion">How to compare two Dates without the time portion?</a> </p>
</blockquote>
<p>How to compare date without time in java ?</p>
<pre><code>Date currentDat... | 7,784,110 | 4 | 3 | null | 2011-10-16 11:53:16.743 UTC | 4 | 2021-09-03 21:21:03.267 UTC | 2017-05-23 12:09:52.997 UTC | null | -1 | null | 508,377 | null | 1 | 12 | java|time | 49,439 | <p>Try compare dates changing to 00:00:00 its time (as this function do):</p>
<pre><code>public static Date getZeroTimeDate(Date fecha) {
Date res = fecha;
Calendar calendar = Calendar.getInstance();
calendar.setTime( fecha );
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0)... |
8,285,040 | Reference as class member initialization | <p>I want to initialize a property of a class that holds a reference to another class by passing such a reference as a parameter to the constructor. However I receive an error: </p>
<p>“'TaxSquare::bank' must be initialized in constructor base/member initializer list”.
What is wrong in the following code of the classe... | 8,285,051 | 4 | 0 | null | 2011-11-27 10:51:00.887 UTC | 10 | 2014-11-25 18:49:02.937 UTC | 2011-11-27 10:53:46.963 UTC | null | 635,608 | null | 954,724 | null | 1 | 24 | c++|constructor|reference | 33,946 | <p>You are attempting to assign to <code>bank</code>, not initialize it:</p>
<pre><code>TaxSquare::TaxSquare(int anID, int amount, Bank& theBank) : Square(anID)
{
// These are assignments
taxAmount = amount;
bank = theBank;
}
</code></pre>
<p><code>bank</code> is a reference, and therefore it must be ... |
7,709,022 | Is it ever useful to use Python's input over raw_input? | <p>I currently teach first year university students python, and I was surprised to learn that the seemingly innocuous <code>input</code> function, that some of my students had decided to use (and were confused by the odd behaviour), was hiding a call to <code>eval</code> behind it.</p>
<p>So my question is, why does t... | 7,710,959 | 4 | 2 | null | 2011-10-10 05:57:31.93 UTC | 3 | 2018-10-09 13:33:41.263 UTC | 2011-10-10 06:03:18.803 UTC | null | 497,043 | null | 698,732 | null | 1 | 32 | python|user-input|python-2.x | 5,050 | <p>Is it ever useful to use Python 2's input over raw_input?</p>
<p><strong>No.</strong></p>
<hr>
<p><code>input()</code> evaluates the code the user gives it. It puts the full power of Python in the hands of the user. With generator expressions/list comprehensions, <a href="http://docs.python.org/library/functions... |
8,288,859 | How do you remove the _<scala-version> postfix from artifacts built+published with simple-build-tool? | <p>I'm building a few Java-only projects using simple-build-tool. When I publish the artifacts from the projects using, say, sbt publish-local then the resulting artifacts have the Scala version appended to their name. With a Scala project this would make sense, but since these are Java only projects it doesn't. How... | 8,291,387 | 4 | 0 | null | 2011-11-27 20:42:10.543 UTC | 12 | 2017-07-14 15:04:54.34 UTC | null | null | null | null | 2,719 | null | 1 | 67 | scala|sbt | 14,162 | <p>After looking around how Artifact.artifactName is implemented and ultimately used it seems that the way to turn this off is to specify false for the crossPath setting. This is documented in one of the quick configuration examples on the xsbt wiki.</p>
<p><a href="http://www.scala-sbt.org/release/docs/Examples/Quic... |
8,212,373 | Firefox Web Console Disabled? | <p>How come I get this message from Firefox Web Console </p>
<blockquote>
<p>The Web Console logging API (console.log, console.info, console.warn, console.error) has been disabled by a script on this page</p>
</blockquote>
<p>The same webpage can print messages in Chrome Console but not Firefox. I opened the same w... | 8,212,837 | 4 | 2 | null | 2011-11-21 13:12:24.797 UTC | 17 | 2016-05-23 14:45:49.32 UTC | 2011-11-21 13:19:27.927 UTC | null | 519,413 | null | 150,254 | null | 1 | 133 | javascript|html|firefox | 58,040 | <p>This happens when the page itself defines a global variable called <code>console</code>, for example. If the page is browser-sniffing to decide whether to define it, the behavior could differ in different browsers.</p>
<p>In the case of Firefox it also happens when Firebug is installed and its console is enabled, ... |
8,348,144 | How to convert .jar or .class to .dex file? | <p>I'm going to edit the Opera Mini v6.5 server because it is blocked in our country.</p>
<p>Now I have unpacked the <code>.apk</code> file extracted <code>classes.Dex</code> then converted it via <code>dex2jar.bat</code>, now modified the server.</p>
<p>My problem is I want to repack the <code>.jar</code> or <c... | 14,101,543 | 5 | 0 | null | 2011-12-01 20:53:43.303 UTC | 10 | 2022-03-26 21:23:09.293 UTC | 2022-03-26 21:23:09.293 UTC | null | 1,076,264 | null | 1,076,264 | null | 1 | 19 | java|android|dex|dx | 53,818 | <p>Here is a solution that was helpful in my case... </p>
<p>Suppose .jar file sits in "c:\temp\in.jar". In command prompt window cd to ..\android-sdk\platform-tools.
To get .apk execute: </p>
<pre><code>dx --dex --output="c:\temp\app.apk" "c:\temp\in.jar"
</code></pre>
<p>To get .dex file execute:</p>
<pre><code>d... |
8,103,971 | "Sort Lines in Selection" for Xcode 4 | <p>I like Textmate's "Sort Lines in Selection" feature a lot. Is there something similar for Xcode 4? If not, what would be the best way to integrate such a feature (a plugin, Applescript, ...)?</p> | 8,104,750 | 5 | 0 | null | 2011-11-12 10:49:08.157 UTC | 9 | 2021-01-29 10:54:57.787 UTC | 2012-12-09 16:25:07.903 UTC | null | 353,652 | null | 353,652 | null | 1 | 20 | xcode|sorting|plugins|applescript|textmate | 4,900 | <p>You can do this with Automator:</p>
<ul>
<li>Start Automator and select either:<br>"Service" for macOS 10.7 or<br>"New Document" followed by "Quick Action" for macOS 11</li>
<li>Find and drag "Run Shell Script" into the workflow panel</li>
<li>Select "Output replaces sele... |
8,292,256 | Get Number of Rows returned by ResultSet in Java | <p>I have used a <code>ResultSet</code> that returns certain number of rows. My code is something like this:</p>
<pre><code>ResultSet res = getData();
if(!res.next())
{
System.out.println("No Data Found");
}
while(res.next())
{
// code to display the data in the table.
}
</code></pre>
<p>Is there any method t... | 8,292,323 | 14 | 1 | null | 2011-11-28 06:33:01.98 UTC | 23 | 2020-03-06 11:36:06.84 UTC | 2014-07-25 19:44:51.757 UTC | null | 445,131 | null | 871,307 | null | 1 | 75 | java|resultset | 273,577 | <p>You could use a <code>do ... while</code> loop instead of a <code>while</code> loop, so that <code>rs.next()</code> is called after the loop is executed, like this:</p>
<pre><code>if (!rs.next()) { //if rs.next() returns false
//then there are ... |
4,591,763 | Find paths in a binary search tree summing to a target value | <p>Given a binary search tree and a target value, find all the paths (if there exists more than one) which sum up to the target value. It can be any path in the tree. It doesn't have to be from the root.</p>
<p>For example, in the following binary search tree:</p>
<pre><code> 2
/ \
1 3
</code></pre>
<p>when th... | 4,592,412 | 3 | 3 | null | 2011-01-04 08:30:30.103 UTC | 18 | 2015-11-07 07:21:47.767 UTC | 2012-09-16 19:56:36.737 UTC | null | 387,076 | null | 547,198 | null | 1 | 18 | algorithm|data-structures|binary-tree | 13,019 | <p>Traverse through the tree from the root and do a post-order gathering of all path sums. Use a hashtable to store the possible paths rooted at a node and going down-only. We can construct all paths going through a node from itself and its childrens' paths.</p>
<p>Here is psuedo-code that implements the above, but st... |
4,799,816 | Return row of every n'th record | <p>How can I return every <em>nth</em> record from a sub query based on a numerical parameter that I supply?</p>
<p>For example, I may have the following query:</p>
<pre><code>SELECT
Id,
Key
FROM DataTable
WHERE CustomerId = 1234
ORDER BY Key
</code></pre>
<p><strong>e.g.</strong> </p>
<p>The subquery result ... | 4,799,880 | 3 | 2 | null | 2011-01-25 22:59:52.62 UTC | 5 | 2022-04-28 11:11:02.42 UTC | 2011-01-25 23:08:17.073 UTC | null | 225,239 | null | 225,239 | null | 1 | 50 | tsql|sql-server-2008 | 64,034 | <p>This is where <a href="http://msdn.microsoft.com/en-us/library/ms186734.aspx" rel="noreferrer"><code>ROW_NUMBER</code></a> can help. It requires an order-by clause but this is okay because an order-by is present (and required to guarantee a particular order).</p>
<pre><code>SELECT t.id, t.key
FROM
(
SELECT id, ... |
4,797,166 | Set default value of a password input so it can be read | <p>I want to have a password field which says "Password" in it before a user enters their password (so they know what the field is)</p>
<p>I'd rather just use Javascript, importing jQuery for this alone seems wasteful, but I have no idea how to. The images explain quite clearly:</p>
<p><em>What it looks like:</em></p... | 4,797,210 | 5 | 1 | null | 2011-01-25 18:04:40.98 UTC | 0 | 2015-06-19 22:35:58.003 UTC | null | null | null | null | 311,074 | null | 1 | 8 | javascript|html|forms | 42,090 | <p>Change your <code>password</code> input to be a simple input type <code>text</code>. Then, with JavaScript (or JQuery) on focus event, change it to be a input type <code>password</code>.</p>
<p>Here is a little untested sample with plain JavaScript (no JQUERY):</p>
<pre><code><html>
<head>
<scrip... |
4,709,655 | how to output every line in a file python | <pre><code> if data.find('!masters') != -1:
f = open('masters.txt')
lines = f.readline()
for line in lines:
print lines
sck.send('PRIVMSG ' + chan + " " + str(lines) + '\r\n')
f.close()
</code></pre>
<p>masters.txt has a list of nicknames, how... | 4,709,680 | 5 | 3 | null | 2011-01-17 03:03:34.807 UTC | 3 | 2017-02-02 10:04:49.247 UTC | 2011-01-17 03:55:50.213 UTC | null | 355,230 | null | 365,015 | null | 1 | 15 | python|file|input | 122,494 | <p>Firstly, as @l33tnerd said, <code>f.close</code> should be outside the for loop.</p>
<p>Secondly, you are only calling <code>readline</code> once, before the loop. That only reads the first line. The trick is that in Python, files act as iterators, so you can iterate over the file without having to call any methods... |
4,100,486 | Java: create a list of HashMaps | <p>I tried to create a list of maps. In the following code, I'm expecting to get </p>
<pre><code>[{start=1,text=ye}, {start=2,text=no}]
</code></pre>
<p>however, I only got</p>
<pre><code>[{start=2,text=no}, {start=2,text=no}]
</code></pre>
<p>How to avoid overriding the first map? Here is my code: </p>
<pre><co... | 4,100,507 | 6 | 0 | null | 2010-11-04 19:29:54.12 UTC | 4 | 2019-08-21 07:53:56.23 UTC | 2010-11-04 19:43:38.627 UTC | null | 311,884 | null | 311,884 | null | 1 | 13 | java|arraylist | 106,448 | <p>You need to create a new HashMap for every entry, instead of reusing the existing one. This would work:</p>
<pre><code>HashMap mMap = new HashMap();
mMap.put("start",1);
mMap.put("text","yes");
list.add(mMap);
mMap = new HashMap(); // create a new one!
mMap.put("start",2);
mMap.put("text","no");
list.add(mMap);
<... |
4,069,028 | Write string to output stream | <p>I have several output listeners that are implementing <code>OutputStream</code>.
It can be either a <code>PrintStream</code> writing to stdout or to a File, or it can be writing to memory or any other output destination; therefore, I specified <code>OutputStream</code> as (an) argument in the method.</p>
<p>Now, I h... | 4,069,104 | 6 | 1 | null | 2010-11-01 12:54:15.9 UTC | 30 | 2021-03-16 14:59:12.953 UTC | 2021-03-16 14:59:12.953 UTC | null | 40,342 | null | 232,666 | null | 1 | 156 | java|io|stream|outputstream | 389,424 | <p>Streams (<code>InputStream</code> and <code>OutputStream</code>) transfer <em>binary</em> data. If you want to write a string to a stream, you must first convert it to bytes, or in other words <em>encode</em> it. You can do that manually (as you suggest) using the <code>String.getBytes(Charset)</code> method, but yo... |
4,781,014 | Unordered List (<ul>) default indent | <p>Can anyone tell me why an unordered list has a default indent/padding applied to it? Can this be solved with a CSS Browser Reset?</p> | 4,781,061 | 8 | 1 | null | 2011-01-24 10:38:47.187 UTC | 4 | 2018-05-30 16:31:08.013 UTC | null | null | null | null | 478,144 | null | 1 | 32 | html|css | 116,685 | <p>It has a default indent/padding so that the bullets will not end up outside the list itself.</p>
<p>A CSS reset might or might not contain rules to reset the list, that would depend on which one you use.</p> |
4,573,483 | Netbeans Shortcut to Open File | <p>I remember seeing someone use a shortcut in NetBeans to open a dialog similar to phpStrom that can open files based on class names or is it file name. whats that?</p>
<p><img src="https://imgur.com/ShYAX.jpg" alt=""></p> | 4,573,532 | 10 | 5 | null | 2011-01-01 07:44:17.597 UTC | 15 | 2020-04-19 12:50:43.003 UTC | 2011-01-01 10:28:37.8 UTC | null | 30,453 | null | 292,291 | null | 1 | 46 | netbeans|keyboard-shortcuts|screenshot|openfiledialog|classname | 61,011 | <p><em>Updated</em></p>
<p>I'm fairly certain you are referring to the "Quick File Chooser" plugin. As someone else points out, though, there are several other candidates. I list them below...</p>
<p><strong><em>The Quick File Chooser Plugin</em></strong>:</p>
<p>By default <kbd>CTRL</kbd>-<kbd>SHIFT</kbd>-<kbd>O</k... |
4,054,662 | Displaying soft keyboard whenever AlertDialog.Builder object is opened | <p>My code for opening an input dialog reads as follows:</p>
<pre><code>final AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Dialog Title");
alert.setMessage("Request information");
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout... | 4,115,170 | 14 | 0 | null | 2010-10-29 18:12:13.707 UTC | 7 | 2019-04-14 02:33:11.32 UTC | 2017-05-23 10:30:01.317 UTC | null | -1 | null | 250,845 | null | 1 | 35 | android|keyboard|android-edittext|android-alertdialog | 32,918 | <p>With the encouragement of Mur Votema (see his answer above) I have answered my question by building a custom dialog based on the Dialog class. Unlike an alert based on AlertDialog.Builder such a custom dialog does accept the getWindow().setSoftInputMode(...) command and therefore allows the soft keyboard to be displ... |
14,639,561 | Set colspan/rowspan for a cell | <p>I have a table and I want to change <code>colspan</code>/<code>rowspan</code> property of a cell on runtime. Here is an example:</p>
<pre><code><html>
<head>
<script type="text/javascript">
function setColSpan() {
document.getElementById('myTable').rows[0].c... | 14,639,696 | 2 | 2 | null | 2013-02-01 04:07:09.28 UTC | 2 | 2018-02-24 20:07:49.737 UTC | 2018-02-24 20:07:49.737 UTC | null | 4,370,109 | null | 248,296 | null | 1 | 13 | javascript|html|html-table | 62,209 | <p>I think you need to delete the cell. Check with following code. What i did was removed the entire row and added new row with new column span</p>
<pre><code>function setColSpan() {
var table = document.getElementById('myTable');
table.deleteRow(0);
var row = table.insertRow(0);
var cell = row.insertC... |
14,660,938 | How can I get phone serial number (IMEI) | <p>I want to get phone serial number by programming to registration configuration of my application and number of users and phones that my app has been installed on them.</p>
<p>Can I get that?</p>
<p>and can I get phone model that my app has been installed on them?</p> | 14,661,104 | 5 | 3 | null | 2013-02-02 10:27:10.5 UTC | 5 | 2014-06-10 19:17:44.677 UTC | 2014-06-10 19:17:44.677 UTC | null | 881,229 | null | 1,793,650 | null | 1 | 17 | android | 107,167 | <p>pls refer this
<a href="https://stackoverflow.com/a/1972404/951045">https://stackoverflow.com/a/1972404/951045</a></p>
<pre><code> TelephonyManager mngr = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
mngr.getDeviceId();
</code></pre>
<p>add <code>READ_PHONE_STATE</code> permission to <code>And... |
14,577,568 | Is there a user-friendly Log4Net log files viewer? | <p>Is there any third party tool that can recognize Log4Net log file structure and show it in a user friendly way by providing search functionalities etc?</p> | 14,577,621 | 5 | 2 | null | 2013-01-29 07:17:16.453 UTC | 9 | 2019-05-03 14:06:30.693 UTC | 2013-09-11 15:20:23.607 UTC | null | 133 | null | 136,141 | null | 1 | 35 | .net|log4net | 41,273 | <p>Try <a href="https://sourceforge.net/projects/gamutlogviewer/" rel="noreferrer">GamutLogViewer</a>.</p>
<blockquote>
<p>GamutLogViewer© is log file, logfile, viewer that works with Log4J, Log4Net, NLog, and user defined formats including ColdFusion. It supports filtering, searching, highlighting and many other us... |
14,607,640 | Rotating a Vector in 3D Space | <p>I am making an android project in opengl es that uses accelerometer to calculate change in specific axes and my aim is to rotate my spacecraft-like object's movement vector. The problem is that i can't understand the math behind rotation matrices. Default movement vector is 0,1,0 , means +y, so the object looks upwa... | 14,609,567 | 2 | 1 | null | 2013-01-30 15:31:42.387 UTC | 61 | 2022-08-22 05:01:42.997 UTC | 2014-12-26 05:02:08.173 UTC | null | 183,120 | null | 1,248,401 | null | 1 | 70 | math|vector|3d|rotation|linear-algebra | 239,569 | <p>If you want to rotate a vector you should construct what is known as a <a href="http://en.wikipedia.org/wiki/Rotation_matrix" rel="nofollow noreferrer">rotation matrix</a>.</p>
<h1>Rotation in 2D</h1>
<p>Say you want to rotate a vector or a point by θ, then <a href="http://en.wikipedia.org/wiki/Polar_coordinates" re... |
2,878,447 | Tutorial: Simple WCF XML-RPC client | <p><strong>Update: I have provided complete code example in answer below.</strong></p>
<p>I have built my own little custom XML-RPC server, and since I'd like to keep things simple, on both server and client side, what I would like to accomplish is to create a simplest possible client (in C# preferably) using WCF.</p>... | 2,881,059 | 2 | 0 | null | 2010-05-20 22:54:10.143 UTC | 11 | 2016-02-03 17:16:00.733 UTC | 2013-08-15 14:45:22.66 UTC | user1228 | null | null | 267,491 | null | 1 | 14 | c#|wcf|client|xml-rpc | 30,293 | <p>Inspired by Doobi's answer, I looked up some more info (examples) on the subject, and came up with the following findings.</p>
<p>Steps to create simple WCF XML-RPC client:</p>
<ol>
<li>Download XML-RPC for WCF from this page: <a href="http://vasters.com/clemensv/PermaLink,guid,679ca50b-c907-4831-81c4-369ef7b85839... |
1,457,131 | PHP PDO prepared statements | <p>I was told today that I should really be using PDO and prepared statements in my application. Whilst I understand the benefits, I am struggling to understand how I implement them into my workflow. Aside from the fact that it makes code much cleaner, should I have a specific database class which houses all my prepare... | 1,457,157 | 1 | 0 | null | 2009-09-21 22:01:50.777 UTC | 6 | 2022-05-10 12:06:05.68 UTC | 2012-09-03 21:13:07.583 UTC | null | 569,101 | null | 170,488 | null | 1 | 38 | php|mysql|pdo | 48,648 | <p>There are two great examples on the <a href="https://www.php.net/manual/en/pdo.prepare.php" rel="nofollow noreferrer">pdo::prepare()</a> documentation.</p>
<p>I have included them here and simplified them a bit.</p>
<p>This one uses <code>?</code> parameters. <code>$dbh</code> is basically a PDO object. And what you... |
21,876,286 | Download CSV file via Rest | <p>Using OpenCSV, I can successfully create a CSV file on disc, but what I really need is to allow users download the CSV with a download button, I don't need to save on disk, just download. Any ideas? </p>
<pre><code>@GET
@Path("/downloadCsv")
public Object downloadCsv() {
CSVWriter writer;
FileWrit... | 21,876,743 | 3 | 0 | null | 2014-02-19 09:33:16.823 UTC | 6 | 2019-01-29 12:48:58.997 UTC | 2014-02-19 10:17:02.737 UTC | null | 379,028 | null | 379,028 | null | 1 | 7 | java|rest|csv|opencsv | 49,002 | <p>To force "save as", you need to set the content disposition HTTP header in the response. It should look like this:</p>
<pre><code>Content-Disposition: attachment; filename="whatever.csv"
</code></pre>
<p>It looks like you're using JAX-RS. This <a href="https://stackoverflow.com/questions/4621748/how-to-set-respo... |
40,272,600 | Is there a DynamoDB max partition size of 10GB for a single partition key value? | <p>I've read lots of DynamoDB docs on designing partition keys and sort keys, but I think I must be missing something fundamental.</p>
<p>If you have a bad partition key design, what happens when the data for a SINGLE partition key value exceeds 10GB?</p>
<p>The 'Understand Partition Behaviour' section states:</p>
<... | 40,277,185 | 1 | 0 | null | 2016-10-26 21:44:24.91 UTC | 10 | 2022-04-17 07:07:38.28 UTC | null | null | null | null | 364,098 | null | 1 | 36 | amazon-web-services|amazon-dynamodb|primary-key-design | 10,598 | <p><em>TL;DR</em> - items can be split even if they have the same partition key value by including the range key value into the partitioning function.</p>
<hr>
<p>The long version:</p>
<p>This is a very good question, and it is addressed in the documentation <a href="http://docs.aws.amazon.com/amazondynamodb/latest/... |
38,564,080 | Remove Event Listener On Unmount React | <p>I had higher order component in react like this:</p>
<pre><code>export default function (InnerComponent) {
class InfiniteScrolling extends React.Component {
constructor(props){
super(props);
}
componentDidMount() {
window.addEventListener('scroll', this.onScroll... | 38,564,123 | 4 | 0 | null | 2016-07-25 09:26:38.57 UTC | 12 | 2020-11-23 14:35:35.593 UTC | null | null | null | null | 576,682 | null | 1 | 56 | javascript|reactjs | 82,745 | <p><code>.bind</code> always creates a new function so you need to do like below, so it adds and removes the same function.</p>
<pre><code> constructor(props){
super(props);
this.onScroll = this.onScroll.bind(this); //bind function once
}
componentDidMount() {
window.addEventListene... |
38,649,501 | Labeling boxplot in seaborn with median value | <p>How can I label each boxplot in a seaborn plot with the median value?</p>
<p>E.g.</p>
<pre><code>import seaborn as sns
sns.set_style("whitegrid")
tips = sns.load_dataset("tips")
ax = sns.boxplot(x="day", y="total_bill", data=tips)
</code></pre>
<p>How do I label each boxplot with the median or average value?</p> | 38,649,932 | 3 | 0 | null | 2016-07-29 02:13:10.457 UTC | 10 | 2022-05-06 05:44:44.477 UTC | null | null | null | null | 308,827 | null | 1 | 33 | python|matplotlib|seaborn | 54,329 | <p>I love when people include sample datasets!</p>
<pre><code>import seaborn as sns
sns.set_style("whitegrid")
tips = sns.load_dataset("tips")
box_plot = sns.boxplot(x="day",y="total_bill",data=tips)
medians = tips.groupby(['day'])['total_bill'].median()
vertical_offset = tips['total_bill'].median() * 0.05 # offset ... |
31,605,932 | How to make a owl carousel with arrows instead of next previous | <p>Yesterday I presented a website to a customer. I always use Owl carousel since it's responsive. The client, however, hated the previous, next words, and wanted to change them to arrows. </p>
<p>So hence I updated my script. js file. It was very easy to do and I wanted to share it. </p>
<pre><code>$(document).ready... | 31,605,933 | 6 | 0 | null | 2015-07-24 08:41:50.707 UTC | 10 | 2020-04-26 15:33:00.917 UTC | 2020-04-26 15:33:00.917 UTC | null | 1,979,115 | null | 3,806,549 | null | 1 | 29 | javascript|jquery|carousel | 204,576 | <p>This is how you do it in your <code>$(document).ready()</code> function with FontAwesome Icons:</p>
<pre><code> $( ".owl-prev").html('<i class="fa fa-chevron-left"></i>');
$( ".owl-next").html('<i class="fa fa-chevron-right"></i>');
</code></pre> |
35,315,726 | Plotly: How to display charts in Spyder? | <p>Since November 2015, plotly is Open-Source and available for python. <a href="https://plot.ly/javascript/open-source-announcement/" rel="noreferrer">https://plot.ly/javascript/open-source-announcement/</a></p>
<p>When trying to do some plots offline, these work in iPython Notebook (version 4.0.4)
But if I try to ru... | 35,393,328 | 2 | 0 | null | 2016-02-10 12:46:51.4 UTC | 6 | 2021-11-16 06:30:20.017 UTC | 2021-10-25 09:30:37.29 UTC | null | 3,437,787 | null | 5,235,265 | null | 1 | 25 | python|python-2.7|plotly|spyder|plotly-python | 51,746 | <p>importing plot instead iplot (and changing the last line from iplot(fig) to plot(fig) resolved the problem, at least in python 3: </p>
<pre><code>from plotly.offline import download_plotlyjs, init_notebook_mode, plot
from plotly.graph_objs import *
init_notebook_mode()
trace0 = Scatter(
x=[1, 2, 3, 4],
y=... |
28,008,775 | How do I get the current x and y position so that I can use GCRectMake? | <p>I have this code inside an animation:</p>
<pre><code>image.frame = CGRectMake(x: x, y: y, width, height)
</code></pre>
<p>I need to get the x and y coordinates of an image. I found this Objective-C code:</p>
<pre><code>CGPoint origin = imageView.frame.origin;
</code></pre>
<p>Once I find the x and y position of ... | 28,008,868 | 1 | 0 | null | 2015-01-18 10:41:59.97 UTC | 8 | 2018-06-01 10:40:39.697 UTC | 2016-06-08 05:22:52.447 UTC | null | 1,135,714 | null | 1,135,714 | null | 1 | 32 | ios|swift|cgrectmake | 82,787 | <p>Do you mean you want this?</p>
<pre><code>var frm: CGRect = imageView.frame
frm.origin.x = frm.origin.x - 50
frm.origin.y = frm.origin.y - 50
frm.size.width = frm.size.width + 500
frm.size.height = frm.size.height + 500
imageView.frame = frm
</code></pre> |
40,420,240 | Grouped Bar graph Pandas | <p>I have a table in a pandas <code>DataFrame</code> named <code>df</code>:</p>
<pre><code>+--- -----+------------+-------------+----------+------------+-----------+
|avg_views| avg_orders | max_views |max_orders| min_views |min_orders |
+---------+------------+-------------+----------+------------+-----------+
| 2... | 40,421,601 | 2 | 3 | null | 2016-11-04 10:22:55.38 UTC | 8 | 2021-09-12 17:51:07.343 UTC | 2021-09-12 17:51:07.343 UTC | null | 7,758,804 | null | 6,803,114 | null | 1 | 25 | python|pandas|matplotlib | 65,135 | <p>Using pandas:</p>
<pre><code>import pandas as pd
groups = [[23,135,3], [123,500,1]]
group_labels = ['views', 'orders']
# Convert data to pandas DataFrame.
df = pd.DataFrame(groups, index=group_labels).T
# Plot.
pd.concat(
[df.mean().rename('average'), df.min().rename('min'),
df.max().rename('max')],
... |
50,824,617 | Angular Material table Sizing/Scroll | <p>I have an Angular Material table with many columns. It is wider than the screen. When I scroll, the table rows extend past the edge of the table container.</p>
<p>See this StackBlitz project. <a href="https://stackblitz.com/edit/angular-r6xdgk" rel="noreferrer">https://stackblitz.com/edit/angular-r6xdgk</a> Use ... | 50,824,892 | 4 | 0 | null | 2018-06-12 19:37:37.26 UTC | 4 | 2021-06-21 12:27:22.197 UTC | null | null | null | null | 6,019,611 | null | 1 | 17 | angular|angular-material | 66,882 | <p>Add </p>
<pre><code>.example-container {
overflow-x: scroll;
}
</code></pre>
<p>To the app.component.css to fix the top bar.
The bottom will need a similar styling. You can't use width:100% because it is technically outside the table. So it can not pick up the width automatically.</p> |
20,909,118 | The remote server returned an error: (415) Unsupported Media Type | <p>I try to upload a text file from <strong>WPF RESTful client to ASP .NET MVC WebAPI 2 website</strong>.</p>
<p><strong>Client code</strong></p>
<pre><code>HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("http://localhost:22678/api/Account/UploadFile?fileName=test.txt&description=MyDesc1");
reque... | 20,909,515 | 2 | 0 | null | 2014-01-03 17:14:42.343 UTC | 2 | 2014-01-03 18:00:06.133 UTC | null | null | null | null | 196,919 | null | 1 | 7 | c#|asp.net-web-api|httpwebrequest|media-type | 58,186 | <p>+1 on what Radim has mentioned above...As per your action Web API model binding notices that the parameter <code>fileContents</code> is a complex type and by default assumes to read the request body content using the formatters. (note that since <code>fileName</code> and <code>description</code> parameters are of <... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.