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
49,064,209
Getting "[archiver] unsupported version (1.13) in file header" when running pg_restore
<p>I just upgraded to postgres 10.2 on mac os which matches 10.2 on heroku. I'm trying to download a copy of the database and restore it locally. Before the upgrade the restore would work fine.</p> <p>I run</p> <pre><code>pg_restore --verbose --clean --no-acl --no-owner -h localhost -d database_name backup.dump </c...
49,064,959
14
0
null
2018-03-02 07:03:01.977 UTC
19
2021-01-14 15:25:55.7 UTC
2018-03-12 16:01:30 UTC
null
1,685,157
null
177,489
null
1
172
postgresql|heroku|pg-restore
106,274
<p>You need to upgrade your local postgres to get the last security patch from the 2018-03-01, like <code>Heroku</code> did the 1st march. You need one of the last releases <code>10.3</code>, <code>9.6.8</code>, <code>9.5.12</code>, <code>9.4.17</code>, and <code>9.3.22</code>. </p> <p>The security patch can be found ...
19,500,332
Spring Security and JSON Authentication
<p>I've an application in spring/spring-mvc that totally uses JSON communications. Now I need to authenticate my application with spring security 3 (that uses LdapAuthenticationProvider) via JSON.</p> <p>The default spring seurity submit form requires a POST like this:</p> <pre><code>POST /myapp/j_spring_security_che...
19,501,060
8
0
null
2013-10-21 16:51:37.853 UTC
22
2018-10-26 10:17:53.557 UTC
2017-05-23 12:10:26.62 UTC
null
-1
null
2,186,777
null
1
37
json|spring|spring-mvc|spring-security
58,915
<p>You can write your own security filter that will parse your JSON.</p> <p><a href="http://docs.spring.io/spring-security/site/docs/3.0.x/reference/core-web-filters.html" rel="noreferrer">http://docs.spring.io/spring-security/site/docs/3.0.x/reference/core-web-filters.html</a></p> <p>You can use the BasicAuthenticat...
48,872,042
How do I get a pod's (milli)core CPU usage with Prometheus in Kubernetes?
<p>I run a <code>v1.9.2</code> custom setup of Kubernetes and scrape various metrics with Prometheus <code>v2.1.0</code>. Among others, I scrape the <code>kubelet</code> and <code>cAdvisor</code> metrics.</p> <p>I want to answer the question: "<em>How much of the CPU resources defined by <code>requests</code> and <cod...
48,872,951
2
0
null
2018-02-19 18:21:37.017 UTC
13
2022-03-30 09:00:25.35 UTC
null
null
null
null
1,853,162
null
1
17
kubernetes|prometheus
13,481
<p>We're using the <code>container_cpu_usage_seconds_total</code> metric to calculate Pod CPU usage. This metrics contains the total amount of CPU seconds consumed <em>by container by core</em> (this is important, as a Pod may consist of multiple containers, each of which can be scheduled across multiple cores; however...
42,229,149
How to update multiple items in a DynamoDB table at once
<p>I'm using DynamoDB and I need to update a specific attribute on multiple records. Writing my requirement in pseudo-language I would like to do an update that says "update table <em>persons</em> set relationshipStatus = 'married' where personKey IN (key1, key2, key3, ...)" (assuming that personKey is the KEY in my D...
42,229,801
5
0
null
2017-02-14 14:49:23.177 UTC
9
2022-05-06 06:48:34.287 UTC
2017-09-22 18:01:22.247 UTC
null
-1
null
1,210,718
null
1
42
amazon-web-services|amazon-dynamodb|nosql
69,679
<p>As you noted, DynamoDB does not support a batch update operation. You would need to query for, and obtain the keys for all the records you want to update. Then loop through that list, updating each item one at a time.</p>
37,136,679
How to convert a list of enity object to page object in Spring MVC (JPA)?
<p>I have a <code>List</code> of entities. How do I convert it to <code>Page</code> Object using Spring MVC 4 and Spring Data JPA?</p>
37,137,170
6
0
null
2016-05-10 11:04:03.153 UTC
13
2021-12-10 17:50:10.223 UTC
2021-06-16 17:59:20.17 UTC
null
5,968,171
null
5,968,171
null
1
67
java|spring-mvc|pagination|spring-data
101,963
<p>There is a <a href="http://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/domain/PageImpl.html" rel="noreferrer"><code>Page</code> implementation</a> for that:</p> <pre><code>final Page&lt;Something&gt; page = new PageImpl&lt;&gt;(theListOfSomething); </code></pre>
20,551,566
Display current date and time without punctuation
<p>For example, I want to display current date and time as the following format:</p> <pre><code>yyyymmddhhmmss </code></pre> <p>How do I do that? It seems like most date format comes with <code>-</code>, <code>/</code>, <code>:</code>, etc.</p>
20,551,593
5
0
null
2013-12-12 18:39:57.723 UTC
22
2018-08-11 17:06:19.193 UTC
2018-08-11 17:06:19.193 UTC
null
6,862,601
null
1,454,510
null
1
131
bash|shell|date
124,460
<p>Here you go:</p> <pre><code>date +%Y%m%d%H%M%S </code></pre> <p>As <code>man date</code> says near the top, you can use the <code>date</code> command like this:</p> <blockquote> <pre><code>date [OPTION]... [+FORMAT] </code></pre> </blockquote> <p>That is, you can give it a format parameter, starting with a <code...
19,125,091
Pandas Merge - How to avoid duplicating columns
<p>I am attempting a merge between two data frames. Each data frame has two index levels (date, cusip). In the columns, some columns match between the two (currency, adj date) for example.</p> <p>What is the best way to merge these by index, but to not take two copies of currency and adj date.</p> <p>Each data fram...
19,125,531
10
0
null
2013-10-01 20:16:26.607 UTC
55
2022-06-10 11:58:51.027 UTC
null
null
null
null
1,911,092
null
1
145
python|pandas
218,433
<p>You can work out the columns that are only in one DataFrame and use this to select a subset of columns in the merge.</p> <pre><code>cols_to_use = df2.columns.difference(df.columns) </code></pre> <p>Then perform the merge (note this is an index object but it has a handy <code>tolist()</code> method).</p> <pre><cod...
18,909,649
What is the RWS Monad and when is it used
<p>I ran across the RWS Monad and its MonadTransformer while looking up something in the mtl library. There is no real documentation there, and I was wondering what this is and where it gets used.</p> <p>I've gotten as far as finding that RWS is an acronym fro Reader, Writer, State and that is is a stack of those thr...
18,911,314
2
0
null
2013-09-20 05:45:56.063 UTC
7
2013-09-20 07:36:22.763 UTC
null
null
null
null
163,177
null
1
29
haskell|monad-transformers
4,427
<p>The most practical reason for this is for testability and for more precise type signatures.</p> <p>The key strength of haskell is how well you can specify what a function does through the type system. Compare the c#/java type:</p> <pre><code>public int CSharpFunction(int param) { ... </code></pre> <p>with a haske...
49,057,054
Adding an Alias to a Microsoft O365 Group
<p>Wanted to add an answer to what I learned after researching and succeeding with this issue.</p> <p>I have a Microsoft O365 account where I run my business. I am using Microsoft Teams so my executive team can see information and emails specific to that function. For instance, Human Resources. That team is setup t...
49,057,055
5
2
null
2018-03-01 19:10:28.937 UTC
8
2019-10-22 23:15:41.7 UTC
null
null
null
null
1,544,175
null
1
8
powershell|office365|microsoft-teams
34,649
<p>There is a link that describes how to use PowerShell to add an alias:</p> <p><a href="https://answers.microsoft.com/en-us/msoffice/forum/msoffice_o365admin-mso_password-mso_o365b/add-additional-smtp-aliases-to-office-365-groups/b017e4b9-a0e2-4295-a40e-9ca2ec359965?auth=1" rel="noreferrer">Add Additional SMTP Aliase...
27,484,126
Adjust icon size of Floating action button (fab)
<p><img src="https://i.stack.imgur.com/N4Jzt.png" alt="Floating button"> The new floating action button should be <strong>56dp x 56dp</strong> and the icon inside it should be <strong>24dp x 24dp</strong>. So the space between icon and button should be <strong>16dp</strong>.</p> <pre><code>&lt;ImageButton android:...
27,484,368
14
1
null
2014-12-15 12:28:27.427 UTC
33
2021-09-30 21:33:42.543 UTC
2020-08-03 12:03:16.593 UTC
null
7,585,388
null
1,502,079
null
1
210
android|material-design|floating-action-button|material-components-android|android-icons
229,281
<p>As your content is 24dp x 24dp you should use <a href="https://github.com/google/material-design-icons/blob/master/content/drawable-hdpi/ic_add_black_24dp.png">24dp icon</a>. And then set <code>android:scaleType="center"</code> in your ImageButton to avoid auto resize.</p>
21,861,366
.NET StringBuilder preappend a line
<p>I know that the <code>System.Text.StringBuilder</code> in .NET has an <code>AppendLine()</code> method, however, I need to pre-append a line to the beginning of a <code>StringBuilder</code>. I know that you can use <code>Insert()</code> to append a string, but I can't seem to do that with a line, is there a next lin...
21,861,395
2
1
null
2014-02-18 17:41:07.02 UTC
2
2014-02-18 18:06:51.297 UTC
2014-02-18 17:44:50.81 UTC
null
120,753
null
1,066,445
null
1
28
c#|.net|vb.net|stringbuilder
28,200
<blockquote> <p>is there a next line character I can use?</p> </blockquote> <p>You can use <a href="http://msdn.microsoft.com/en-us/library/system.environment.newline%28v=vs.110%29.aspx"><code>Environment.NewLine</code></a></p> <blockquote> <p>Gets the newline string defined for this environment.</p> </blockquote...
21,722,375
Object of class mysqli_result could not be converted to string
<p>I am getting the error:</p> <blockquote> <p>Object of class mysqli_result could not be converted to string</p> </blockquote> <p>This is my code:</p> <pre><code>$result = mysqli_query($con, &quot;SELECT classtype FROM learn_users WHERE username='abcde'&quot;); echo &quot;my result &lt;a href='data/$result.php'&gt;My...
21,722,416
5
2
null
2014-02-12 08:26:28.763 UTC
12
2022-07-12 10:55:45.85 UTC
2021-04-05 15:24:23.75 UTC
null
2,756,409
null
3,206,635
null
1
31
php|mysqli
247,591
<p><strong>The <code>mysqli_query()</code> method returns an object resource to your <code>$result</code> variable, not a string.</strong></p> <p>You need to loop it up and then access the records. You just can't directly use it as your <code>$result</code> variable.</p> <pre><code>while ($row = $result-&gt;fetch_assoc...
42,508,640
Facebook-passport with JWT
<p>I've been using <strong>Passport</strong> on my server for user authentication. When a user is signing in locally (using a username and password), the server sends them a <strong>JWT</strong> which is stored in localstorage, and is sent back to server for every api call that requires user authentication.</p> <p>No...
48,851,674
3
2
null
2017-02-28 12:20:49.477 UTC
10
2021-01-22 17:34:59.527 UTC
null
null
null
null
7,324,798
null
1
32
node.js|mongodb|passport.js|passport-facebook|express-jwt
9,759
<p>The best solution I found for that problem would be to redirect to the expected page with a cookie which holds the JWT.</p> <p>Using <code>res.json</code> would only send a json response and would not redirect. That's why the other suggested answer here would not solve the problem I encountered.</p> <p>So my solut...
33,058,590
Pandas Dataframe: Replacing NaN with row average
<p>I am trying to learn pandas but I have been puzzled with the following. I want to replace NaNs in a DataFrame with the row average. Hence something like <code>df.fillna(df.mean(axis=1))</code> should work but for some reason it fails for me. Am I missing anything, is there something wrong with what I'm doing? Is it...
33,058,777
6
1
null
2015-10-10 20:21:04.6 UTC
7
2022-04-16 18:26:05.437 UTC
2022-03-08 11:04:17.52 UTC
user7864386
null
null
5,431,734
null
1
29
python|pandas|dataframe|missing-data
24,244
<p>As commented the axis argument to fillna is <a href="https://github.com/pydata/pandas/issues/4514" rel="nofollow noreferrer">NotImplemented</a>.</p> <pre><code>df.fillna(df.mean(axis=1), axis=1) </code></pre> <p><em>Note: this would be critical here as you don't want to fill in your nth columns with the nth row aver...
33,290,564
Callback function syntax in Swift
<p>I am attempting pass a function to another function and then have the passed function executed passing to it a variable.</p> <p>Here is my code:</p> <pre><code>func showStandardPrompt(prompt:String,view: UIViewController,numberInput: Bool, callback: (()-&gt;(String))?) { let alert = UIAlertController(title: "I...
33,290,780
5
1
null
2015-10-22 20:54:05.887 UTC
13
2020-06-11 07:51:50.947 UTC
2015-10-23 00:00:27.807 UTC
null
77,567
null
2,630,240
null
1
45
ios|swift|function|callback
101,829
<p>Rob's answer is correct, though I'd like to share an example of a simple working callback / completion handler, you can download an example project below and experiment with the <code>getBoolValue</code>'s input.</p> <h2>Swift 5:</h2> <pre><code>func getBoolValue(number : Int, completion: (Bool)-&gt;()) { if n...
33,141,091
Is it good to replace broadcast receiver with Greenrobot Eventbus for triggering event based functions and data transfer from service to activity?
<p>I have implemented a service, where I handle the state changes(connect, disconnect, onServiceDiscoverd, onCharacteristicChange etc) and receiving data from another device through gatt Server.</p> <p>My question is, Can the events be handled efficiently using <strong>Greenrobot Eventbus</strong> replacing broadcast ...
36,842,172
3
2
null
2015-10-15 06:10:18.267 UTC
9
2019-03-14 16:18:44.283 UTC
null
null
null
null
2,018,343
null
1
19
android|android-service|bluetooth-lowenergy|android-broadcast|greenrobot-eventbus
8,066
<p>Unlike LocalBroadcastManager, EventBus is more simple to use. You only go via 3 steps:</p> <p>1- Create an event class. A simple Java class that represent the response when the action occur.</p> <p>2- Register the event bus as a subscriber in your Activity onCreate method</p> <pre><code> EventBus.getDefault().r...
9,143,561
Git "You have not concluded your merge" and nothing to commit?
<p>Whenever I try to push in Git I get this:</p> <pre><code>You have not concluded your merge (MERGE_HEAD exists). Please, commit your changes before you can merge. </code></pre> <p>Running <code>git status</code> I get:</p> <pre><code># On branch master nothing to commit (working directory clean) </code></pre> <p>...
9,143,629
3
0
null
2012-02-04 18:59:24.75 UTC
18
2019-05-27 08:54:50.29 UTC
null
null
null
null
283,055
null
1
76
git
91,096
<p>Okay I finally found answer: <code>git commit -m "Test"</code> apparently fixed this. The result was an empty commit with no changes whatsoever. Even Github shows an empty commit, but it works.</p>
29,826,442
mkdir command not found in bash script
<p>I don't know why I get error while running this simple script:</p> <pre><code>#!/bin/bash read -p "Please enter directory name: " DIR read -p "Please enter the path: " PATH mkdir -p "$PATH/$DIR" </code></pre> <pre><code>line 7: mkdir: command not found </code></pre>
29,826,572
2
2
null
2015-04-23 14:27:08.22 UTC
2
2015-04-23 15:32:40.443 UTC
2015-04-23 14:29:06.96 UTC
null
418,066
null
2,515,498
null
1
25
bash|mkdir
46,055
<p>Don't use the variable <code>PATH</code>. This variable contains a list of directories to search for executable programs. Since you're replacing it, the script can no longer find the <code>mkdir</code> program.</p> <p>In general, avoid using variables that are all uppercase, these are often used as parameters for t...
31,202,996
Assigning multiple styles on an HTML element
<p>I'm just starting out with HTML and I'm having a trouble assigning multiple styles to a text. I'd like to create a title with two properties:</p> <ol> <li>Centered</li> <li>Font: Tahoma</li> </ol> <p>I have tried this one:</p> <pre><code>&lt;h2 style="text-align:center";"font-family:tahoma"&gt;TITLE&lt;/h2&gt; </...
31,203,184
4
1
null
2015-07-03 09:14:51.373 UTC
13
2022-03-04 02:54:18.727 UTC
2021-03-29 13:18:06.127 UTC
null
2,756,409
null
5,077,133
null
1
49
html|css
230,539
<p>In HTML the style attribute has the following syntax:</p> <pre><code>style=&quot;property1:value1;property2:value2&quot; </code></pre> <p>so in your case:</p> <pre><code>&lt;h2 style=&quot;text-align:center;font-family:tahoma&quot;&gt;TITLE&lt;/h2&gt; </code></pre> <p>Hope this helps.</p>
30,972,578
Route parameter with slash "/" in URL
<p>I know you can apply a wildcard in the route attribute to allow <code>/</code> such as date input for example:</p> <pre><code>[Route("orders/{*orderdate}")] </code></pre> <p>The problem with wildcard is only applicable to the last paramter in URI. How do I solve the issue if want to have the following URI:</p> <p...
30,994,100
4
1
null
2015-06-22 05:23:27.7 UTC
6
2022-09-22 15:29:44.19 UTC
2016-04-29 05:41:28.247 UTC
null
41,956
null
4,321,946
null
1
50
c#|url|asp.net-web-api|asp.net-web-api-routing|attributerouting
56,054
<p><em>@bet..</em> I think the <code>genericUriParserOptions</code> is no longer applicable to .net 4.5 or later.. </p> <p>Also as suggested by <em>@JotaBe</em>, you might need to correctly decode the url request. In most case the <code>%2F</code> will be automatically translated to a slash <code>'/'</code>. So if ...
10,657,908
HTML onClick go to another div
<p>I have a button on my webpage which when onClick I want it to show another div. However when I click the button it will flash in the url that it went to the correct div but then it will immediately redirect back to the main div, #home. </p> <p>Code for button:</p> <pre><code>&lt;input type="button" class="flip" va...
10,658,087
2
1
null
2012-05-18 18:28:42.457 UTC
4
2021-08-15 17:22:30.353 UTC
null
null
null
null
1,220,013
null
1
1
javascript|html
56,497
<p>looks like your form has </p> <pre><code> action="" </code></pre> <p>or</p> <pre><code> action="#home" </code></pre> <p>instead of onclick call a function</p> <pre><code> onclick="mylinkfunction()" </code></pre> <p>...</p> <pre><code> &lt;script type-"text/javascript"&gt; function...
10,710,193
How to preserve insertion order in HashMap?
<p>I'm using a <code>HashMap</code>. When I iterate over the map, the data is returned in (often the same) random order. But the data was inserted in a specific order, and I need to preserve the insertion order. How can I do this?</p>
10,710,205
2
1
null
2012-05-22 21:08:23.26 UTC
92
2021-12-15 11:47:21.577 UTC
2019-01-24 16:31:48.95 UTC
null
10,607,772
null
1,055,279
null
1
556
java|hashmap
417,482
<p><a href="http://docs.oracle.com/javase/6/docs/api/java/util/LinkedHashMap.html" rel="noreferrer"><code>LinkedHashMap</code></a> is precisely what you're looking for.</p> <p>It is exactly like <code>HashMap</code>, except that when you iterate over it, it presents the items in the insertion order.</p>
22,999,487
Update the average of a continuous sequence of numbers in constant time
<p>How can you add and subtract numbers in an average without having to iterate through the entire list?</p> <p>This can be very useful in many situations. For example to continuously calculate the average of the last X values in a stream, adding two averages together, and updating a rating based on a new user vote.</...
22,999,488
2
1
null
2014-04-10 21:36:25.66 UTC
9
2021-11-08 09:45:40.013 UTC
2019-03-06 15:15:18.753 UTC
null
1,706,816
null
1,706,816
null
1
19
performance|math|iteration|time-complexity|average
13,516
<p>It is indeed possible to manipulate single values in an average in constant time, O(1).</p> <p>The following function adds a number to an average. <code>average</code> is the current average, <code>size</code> is the current number of values in the average, and <code>value</code> is the number to add to the average:...
31,845,421
How to convert dictionary to array
<p>I want to convert my dictionary to an array, by showing each <code>[String : Int]</code> of the dictionary as a string in the array.</p> <p>For example:     </p> <pre><code>var myDict: [String : Int] = ["attack" : 1, "defend" : 5, "block" : 12] </code></pre> <p>     I'm aware of <code>myDict.keys.array</code> and...
31,845,495
5
1
null
2015-08-06 01:34:02.583 UTC
8
2020-09-15 13:42:09.217 UTC
2015-08-06 02:00:11.62 UTC
null
1,630,618
null
4,143,556
null
1
46
ios|arrays|swift|dictionary
70,870
<p>You can use a for loop to iterate through the dictionary key/value pairs to construct your array:</p> <pre><code>var myDict: [String : Int] = ["attack" : 1, "defend" : 5, "block" : 12] var arr = [String]() for (key, value) in myDict { arr.append("\(key) \(value)") } </code></pre> <p><strong>Note:</strong> Di...
31,275,672
How to install dwm in Arch Linux
<p>I installed <a href="https://en.wikipedia.org/wiki/Dwm" rel="nofollow noreferrer">dwm</a> 6.0 using the file provided <a href="http://dwm.suckless.org/" rel="nofollow noreferrer">here</a> and then...</p> <pre><code># make install # dwm </code></pre> <p>But running &quot;dwm&quot; gives error: &quot;<em>dwm: cannot o...
58,160,362
1
3
null
2015-07-07 17:39:05.607 UTC
10
2022-02-10 00:18:59.973 UTC
2022-02-10 00:15:47.877 UTC
null
63,550
null
4,487,401
null
1
6
linux|archlinux|window-managers|dwm
30,074
<p>First, you will need to install X server and Git (as root)</p> <pre><code>pacman -S xorg-xinit xorg git </code></pre> <p>Change directory to <em>/usr/src</em> because you want this to apply to all users:</p> <pre><code>cd /usr/src </code></pre> <p>As root, clone suckless software such as dwm (window manager), st (re...
17,985,216
Simpler way to draw a circle with tkinter?
<p>Drawing a circle on a <code>tkinter Canvas</code> is usually done by the <code>create_oval</code> method. However, supplying the bounding box is often a confusing way to think about drawing a circle. It's not particularly difficult to come up with a shortcut for it, but I couldn't find anyone else doing something si...
17,985,217
2
0
null
2013-08-01 04:19:40.14 UTC
9
2022-08-17 08:16:23.107 UTC
2021-08-09 17:56:20.79 UTC
null
355,230
null
1,086,127
null
1
29
python|tkinter|geometry
106,826
<p>Here's a trick known as <a href="https://stackoverflow.com/questions/5626193/what-is-monkey-patching">monkey patching</a> where we actually add a member to the <code>tkinter</code>/<code>Tkinter</code> class <code>Canvas</code>. Below is a fully-functioning program (Python 2.7 and 3.x), of which the third paragraph ...
41,003,470
npm install the exact package version specified in package.json
<p>Currently, If I run <code>npm install</code>, it installs the updated version of already installed packages. How can I install the exact version as specified in the <code>package.json</code> file?</p>
41,003,507
3
2
null
2016-12-06 19:39:12.607 UTC
10
2022-07-16 20:04:05.813 UTC
2019-03-28 17:06:39.397 UTC
null
2,942,471
null
2,179,380
null
1
96
javascript|node.js|meteor|npm|npm-install
96,740
<p>That behavior is really driven by the one specifying the versions in the package.json. If the version number looks like "1.0.0", without any other symbols, the exact version (1.0.0) should be installed.</p> <p>So what you could do is simply modify the package.json and run a <code>npm install</code> then. Be sure to...
2,229,341
Mercurial Server on Apache/Windows
<p>I'm searching for info to setup a Mercurial Server for Windows (7 or XP) with an Apache (xampp if it is useful to know it) with the Push Model, just like in <a href="https://stackoverflow.com/questions/740075/mercurial-server">this question</a> but my team is composed of 5 to 8 (unsolvent) guys who are each one work...
2,235,343
3
3
null
2010-02-09 13:30:35.727 UTC
9
2017-06-19 10:08:51.903 UTC
2017-05-23 12:09:10.833 UTC
null
-1
null
76,832
null
1
5
windows|apache|mercurial
7,967
<p>I used the <a href="https://www.mercurial-scm.org/wiki/HgWebDirStepByStep" rel="nofollow noreferrer">HgWebDir instructions</a>:</p> <p>Here is my httpd.conf piece for the mercurial sites (slightly edited):</p> <pre><code>&lt;VirtualHost *:88&gt; ServerName hg.example.com DocumentRoot c:/apache_sites/hg ...
1,464,919
What is unexpected T_VARIABLE in PHP?
<p>I get this PHP error:</p> <blockquote> <p>Parse error: syntax error, unexpected T_VARIABLE</p> </blockquote> <p>From this line:</p> <pre><code>$list[$i][$docinfo['attrs']['@groupby']] = $docinfo['attrs']['@count']; </code></pre> <p>Is there anything wrong with this line?</p>
1,464,941
3
1
null
2009-09-23 09:26:46.403 UTC
17
2020-04-23 10:35:31.783 UTC
2014-08-07 20:24:48.29 UTC
null
445,131
null
104,015
null
1
96
php|syntax-error
321,640
<p>There might be a semicolon or bracket missing a line before your pasted line.</p> <p>It seems fine to me; every string is allowed as an array index.</p>
8,971,160
What is the exhaustive list of all "android.intent.action" actions available in the Android SDK?
<p>Hi fellows,</p> <p>I'd like to know if there is some exhaustive reference of all Intent actions defined in the standard Android SDK ? I'm thinking of the full "android.intent.action.someaction" names, not the restricted list of conveniently aliased actions defined in the Intent class, e.g Intent.ACTION_VIEW, Intent...
8,986,165
4
1
null
2012-01-23 11:51:57.433 UTC
19
2017-09-12 13:08:49.857 UTC
2012-01-24 11:37:22.873 UTC
null
1,160,527
null
1,160,527
null
1
34
android|android-intent|action
42,382
<p>Hey I think I answered my own question :)</p> <p>In my Android SDK directory, under /platforms/android-x/data (x being the API level) I've found several very interesting files:</p> <ul> <li>activity_actions.txt</li> <li>broadcast_actions.txt</li> <li>categories.txt</li> <li>features.txt</li> <li>widgets.txt</li> <...
19,433,366
Running java in package from command line
<p>I have read the previously posted questions. Some are vague and none solved my problem so I am forced to ask again.</p> <p>I have two simple classes,</p> <pre><code>package One; import One.Inner.MyFrame; public class test { public static void main(String args[]) { MyFrame f= new MyFrame(); } } ...
19,433,387
5
1
null
2013-10-17 17:28:14.047 UTC
12
2018-07-22 21:06:26.493 UTC
2017-09-07 14:41:22.98 UTC
null
330,315
null
2,756,339
null
1
40
java|command-line|package|classpath|javac
108,176
<p>You'd run it as:</p> <pre><code>java One.Test </code></pre> <p>... but from the <em>root</em> directory (<code>basic</code>), <em>not</em> from the <code>One</code> directory. You always specify the <em>fully-qualified</em> class name.</p> <p>Oh, and package names in Java should be lower-case, so it should be <co...
19,719,911
Getting user-space stack information from perf
<p>I'm currently trying to track down some phantom I/O in a PostgreSQL build I'm testing. It's a multi-process server and it isn't simple to associate disk I/O back to a particular back-end and query.</p> <p>I thought Linux's <code>perf</code> tool would be ideal for this, but I'm struggling to capture block I/O perfo...
19,720,446
1
1
null
2013-11-01 02:30:44.167 UTC
10
2014-02-04 12:48:51.24 UTC
2013-11-01 05:01:25.01 UTC
null
398,670
null
398,670
null
1
11
c|linux|linux-kernel|perf
8,431
<p>OK, looks like there are several parts to this:</p> <ul> <li><p>I'm on x86_64, where most distros build with <code>-fomit-frame-pointer</code> by default, and <code>perf</code> can't follow the stack without frame pointers;</p></li> <li><p>.... unless it's a newer version built with <code>libunwind</code> support, ...
635,565
"Walk" JSON response and populate form fields -- more efficient approach?
<p>I know there is a far more elegant/efficient way of doing this (in php I would use foreach) but with jQuery how can I walk the var/val pairs of a JSON response and populate form fields with the same id's as the field names in the JSON response?</p> <p>Here is my JSON response:</p> <pre><code>[{"field":"svendor_nam...
635,575
4
0
null
2009-03-11 17:31:22.803 UTC
10
2010-10-28 16:48:28.547 UTC
null
null
null
Nicholas Kreidberg
59,975
null
1
7
jquery|json
9,113
<p>You can get rid of all "if" statements by replacing your $.each with this:</p> <pre><code>$.each(data, function(i, item){ $("#"+item.field).val(item.value); }); </code></pre>
624,854
static_cast with boost::shared_ptr?
<p>What is the equivalent of a <code>static_cast</code> with <code>boost::shared_ptr</code>?</p> <p>In other words, how do I have to rewrite the following </p> <pre><code>Base* b = new Derived(); Derived* d = static_cast&lt;Derived*&gt;(b); </code></pre> <p>when using <code>shared_ptr</code>?</p> <pre><code>boost::...
624,858
4
1
null
2009-03-09 02:47:21.667 UTC
23
2014-08-12 09:52:31.09 UTC
2014-08-12 09:52:31.09 UTC
Kristo
31,317
null
60,628
null
1
73
c++|boost|shared-ptr|static-cast
43,446
<p>Use <code>boost::static_pointer_cast</code>:</p> <pre><code>boost::shared_ptr&lt;Base&gt; b(new Derived()); boost::shared_ptr&lt;Derived&gt; d = boost::static_pointer_cast&lt;Derived&gt;(b); </code></pre>
40,100,176
Can dask parralelize reading fom a csv file?
<p>I'm converting a large textfile to a hdf storage in hopes of a faster data access. The conversion works allright, however reading from the csv file is not done in parallel. It is really slow (takes about 30min for a 1GB textfile on an SSD, so my guess is that it is not IO-bound). </p> <p>Is there a way to have it r...
40,107,654
2
1
null
2016-10-18 05:27:31.93 UTC
15
2019-05-24 14:26:13.51 UTC
null
null
null
null
1,692,072
null
1
32
python|csv|pandas|dask
25,730
<p>Yes, dask.dataframe can read in parallel. However you're running into two problems:</p> <h3>Pandas.read_csv only partially releases the GIL</h3> <p>By default dask.dataframe parallelizes with threads because most of Pandas can run in parallel in multiple threads (releases the GIL). Pandas.read_csv is an exceptio...
22,221,277
Bash, grep between two lines with specified string
<p>Example:</p> <pre><code>a43 test1 abc cvb bnm test2 kfo </code></pre> <p>I need all lines between test1 and test2. Normal grep does not work in this case. Do you have any propositions?</p>
22,222,219
8
1
null
2014-03-06 10:12:49.417 UTC
22
2020-01-06 22:57:20.537 UTC
null
null
null
null
3,162,968
null
1
68
regex|bash|grep
92,875
<blockquote> <p>Print from <code>test1</code> to <code>test2</code> (Trigger lines included)</p> </blockquote> <pre><code>awk '/test1/{f=1} /test2/{f=0;print} f' awk '/test1/{f=1} f; /test2/{f=0}' awk '/test1/,/test2/' </code></pre> <p> <pre><code>test1 abc cvb bnm test2 </code></pre> <hr> <blockquote> <p>Pr...
23,517,139
java.lang.ClassCastException: com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl cannot be cast to javax.net.ssl.HttpsURLConnection
<p>I tried this code in my Netbeans 7.4 and it works without problem</p> <pre><code>import java.io.IOException; import java.net.URL; import javax.net.ssl.HttpsURLConnection; public class JavaApplication148 { public static void main(String[] args) throws IOException { URL url = new URL("https://redmine.ack...
23,518,852
4
2
null
2014-05-07 11:55:22.537 UTC
4
2021-10-29 09:45:43.19 UTC
2014-05-10 10:50:08 UTC
null
2,854,908
null
2,854,908
null
1
17
java|eclipse|maven|netbeans|classnotfoundexception
62,752
<p>The solution is to change this line </p> <pre><code>URL url = new URL("https://redmine.xxx.cz/time_entries.xml"); </code></pre> <p>into this line</p> <pre><code>URL url = new URL(null, "https://redmine.xxx.cz/time_entries.xml", new sun.net.www.protocol.https.Handler()); </code></pre>
42,754,388
Uncaught (in promise) TypeError: Failed to fetch and Cors error
<p>having a problem with getting data back from database. I am trying my best to explain the problem.</p> <p>1.If I leave "mode":"no-cors" inside the code below, then I can get data back from server with Postman, but not with from my own server. Thinking it has to be my client side error</p> <ol start="2"> <li>When I...
42,754,558
7
5
null
2017-03-12 23:21:35.84 UTC
14
2022-07-21 00:25:27.693 UTC
2017-03-12 23:28:59.587 UTC
null
4,177,642
null
4,177,642
null
1
45
javascript|node.js|cors
277,341
<p>Adding <code>mode:'no-cors'</code> to the request header guarantees that no response will be available in the response</p> <p>Adding a "non standard" header, line <code>'access-control-allow-origin'</code> will trigger a OPTIONS preflight request, which your server must handle correctly in order for the POST reques...
25,654,805
Keep inner interface method names in proguard
<p>Lets say I have..</p> <pre><code>public class SomeClass { public interface someInterface { public void firstMethod(String variable); public void secondMethod(String variable); public void thirdMethod(); } } </code></pre> <p>and I do..</p> <pre><code>-keep,includedescriptorc...
25,711,830
3
1
null
2014-09-03 22:47:26.253 UTC
5
2019-10-21 13:35:29.89 UTC
2014-09-04 00:16:34.943 UTC
null
1,154,026
null
1,154,026
null
1
28
java|android|proguard
17,361
<p>ProGuard uses the naming convention of Java bytecode, as seen in class file names and stacktraces. Therefore:</p> <pre><code>-keep public interface com.somepackage.SomeClass$someInterface {*;} </code></pre>
30,554,953
How to animate FloatingActionButton of new Design Support Library
<p>I am using a TabLayout with 5 different fragments. On 3 of these fragments a <code>android.support.design.widget.FloatingActionButton</code> should appear. Right now I simply set the visibility of the FAB when the tab changes, but I would like to have an animation, where the FAB comes in and out. How can I achieve t...
30,576,441
5
1
null
2015-05-31 07:28:47.62 UTC
9
2015-08-16 20:09:03.443 UTC
2015-05-31 09:57:27.64 UTC
null
2,619,912
null
4,496,411
null
1
15
android|android-animation|floating-action-button|android-design-library
21,551
<p>Because I did not want to extend the <code>FloatingActionButton</code>, I made it this way:</p> <pre><code>FloatingActionButton createButton; // ... Animation makeInAnimation = AnimationUtils.makeInAnimation(getBaseContext(), false); makeInAnimation.setAnimationListener(new Animation.AnimationListener() { @Ov...
65,919,460
The author primary signature's timestamp found a chain building issue: UntrustedRoot: self signed certificate in certificate chain
<p>While doing a docker build on my .NET Core project, I got the following error on all my NuGets:</p> <blockquote> <p>80.19 /app/GradingTool.Tests/GradingTool.Tests.csproj : error NU3028: Package 'Microsoft.EntityFrameworkCore 5.0.0' from source 'https://api.nuget.org/v3/index.json': The author primary signature's tim...
65,926,394
9
6
null
2021-01-27 12:44:37.603 UTC
6
2021-09-17 08:51:56.65 UTC
2021-01-29 06:16:55.127 UTC
null
1,402,846
null
10,667,460
null
1
96
.net|docker|ssl|.net-core|nuget
19,965
<p>In the Dockerfile file, I changed from</p> <pre><code>FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim </code></pre> <p>to</p> <pre><code>FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine </code></pre> <p>This worked for me!</p>
13,922,415
How do I setup Oracle ODBC drivers on RHEL 6/Linux
<p>I need to setup Oracle ODBC drivers on RHEL 6 to connect to an Oracle data source residing on a remote Windows machine. </p> <p>I have taken the following steps:<br> [1] Installed oracle-instanceclient-basic<br> [2] Set environment variables: ORACLE_HOME and LD path<br> [3] Created /etc/oracle/TNSnames.ora and conf...
13,935,571
2
1
null
2012-12-17 21:23:49.19 UTC
8
2015-01-15 04:05:31.693 UTC
2014-10-02 12:55:27.813 UTC
null
3,776,858
null
862,163
null
1
5
linux|oracle|odbc|drivers|rhel6
46,234
<pre><code>yum install unixODBC rpm -ivh oracle-instantclient-basic-10.2.0.3-1.i386.rpm #downloaded on http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html unzip instantclient-odbc-linux32-10.2.0.3-20061115.zip #downloaded on http://www.oracle.com/technology/software/tech/oci/instantcl...
25,387,951
Curious issue with Oracle UNION and ORDER BY
<p>The following query is <a href="http://sqlfiddle.com/#!4/d41d8/34078">perfectly valid</a> in pretty much every database (give or take a <code>dual</code> dummy table), including Oracle:</p> <pre><code>select 'A' as x from dual union all select 'B' from dual order by x asc </code></pre> <p>Returning:</p> <pre...
25,390,187
2
3
null
2014-08-19 15:58:37.99 UTC
4
2014-08-20 06:23:01.58 UTC
2014-08-20 06:23:01.58 UTC
null
521,799
null
521,799
null
1
31
sql|oracle|oracle11g|sql-order-by|union-all
8,166
<p>This doesn't really answer the question, but it seems to be a parser bug (or 'feature') rather than a language requirement.</p> <p>According to My Oracle Support, this seems to have been raised as bug 14196463 but closed with no resolution. It's also mentioned in <a href="https://community.oracle.com/thread/3561546...
48,550,955
MVC bootstrap navbar not working after running NuGet updates
<p>An MVC app broke after we updated all the NuGet packages. After trying everything I created a new MVC app, updated the NuGet packages and the basic navbar...</p> <pre><code>&lt;div class="navbar navbar-inverse navbar-fixed-top"&gt; &lt;div class="container"&gt; &lt;div class="navbar-header"&gt; ...
48,630,895
15
6
null
2018-01-31 20:31:56.757 UTC
29
2021-06-21 08:09:20.003 UTC
2018-01-31 20:39:40.093 UTC
null
1,956,080
null
1,956,080
null
1
55
twitter-bootstrap|asp.net-mvc-5|nuget-package
39,977
<p>Finally, I managed my HTML and yours. There're a lot of changes in Bootstrap 4 in compare to version 3. Regarding your markup, you have to change:</p> <ol> <li>"Navbar-inverse" to "Navbar-dark" and use color "bg-dark".</li> <li>Add few attributes to button, as "aria-controls", "aria-expanded", "aria-label" and "dat...
39,245,967
How to unselect options in select using jquery
<p>Below is my HTML. I have given multiple <code>option</code> elements in the <code>select</code> tag.</p> <pre><code>&lt;select class="car" multiple size="3"&gt; &lt;option value="volvo"&gt;Volvo&lt;/option&gt; &lt;option value="saab"&gt;Saab&lt;/option&gt; &lt;option value="opel"&gt;Opel&lt;/option&gt; ...
39,246,137
2
4
null
2016-08-31 09:37:40.7 UTC
1
2022-02-24 18:10:23.637 UTC
2016-08-31 09:42:32.38 UTC
null
519,413
null
5,437,218
null
1
8
javascript|jquery|html
43,707
<p>Set the <code>selected</code> property to <code>false</code>: <code>$(selector).prop('selected', false)</code>.</p> <p>I have added a button and attached a click event to be able to demonstrate.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet...
26,829,295
Getting the coordinates from the location I touch the touchscreen
<p>I try to get the coordinates from the location where I hit the touchscreen to do put a specific UIImage at this point.</p> <p>How can I do this?</p>
26,829,360
6
1
null
2014-11-09 14:34:23.01 UTC
6
2019-07-18 09:22:13.157 UTC
2017-04-18 20:34:12.287 UTC
null
559,745
null
3,945,472
null
1
29
swift|coordinates|touchscreen
47,588
<p>In a <code>UIResponder</code> subclass, such as <code>UIView</code>:</p> <pre><code>override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { let touch = touches.anyObject()! as UITouch let location = touch.locationInView(self) } </code></pre> <p>This will return a <code>CGPoint</code> in view...
7,402,264
Primefaces onclick and onsuccess differences
<p>I have the following situation:</p> <p>after clicking a button, some business logic is done and after it is done, a new tab with a report should be visible.</p> <pre><code>&lt;p:commandButton value="this button" update="growlMain" actionListener="#{myBean.businesslogic}" onstart=...
7,995,756
3
1
null
2011-09-13 12:59:33.843 UTC
9
2017-09-12 14:52:03.767 UTC
null
null
null
null
767,502
null
1
17
jsf|primefaces
58,927
<p>I have noticed that onsuccess for PrimeFaces command button does not work. The oncomplete however works and does the needful even if there is an error , such as in my case shows a success dialog even if there is an error in my business logic. Tried to use onsuccess but doesn't work. You could try oncomplete as below...
7,054,708
Track events using Chrome javascript debugger
<p>I don't have a specific use case here, but occasionally I have been either helping out someone on SO or seen a cool javascript effect on a website and been curious about the code that drives it. However, the event that drives the code may not be immediately obvious. If I can't find the event handler then it can be r...
7,054,733
3
0
null
2011-08-14 02:56:12.303 UTC
10
2015-08-25 19:59:20.267 UTC
null
null
null
null
510,314
null
1
33
javascript|debugging|google-chrome-devtools
39,557
<p>yes there is!</p> <p>find the element that is being reloaded and right click, choose inspect from context menu, then right click the html of the element (in the bottom firebugish pane), in the context menu there are options to:</p> <ul> <li>break on subtree modifications </li> <li>break on attributes modifications...
7,342,084
jQuery/Javascript - How to wait for manipulated DOM to update before proceeding with function
<p>What I'm trying to do is to update a simple div to say "Processing..." before executing a CPU-intensive script (it takes 3-12 seconds to run, no AJAX) then update the div to say "Finished!" when done. </p> <p>What I'm seeing is the div never gets updated with "Processing...". If I set a breakpoint immediately after...
7,342,127
4
3
null
2011-09-08 01:01:27.263 UTC
6
2019-08-26 13:58:44.233 UTC
2012-07-30 12:36:26.407 UTC
null
250,259
null
933,802
null
1
35
javascript|jquery|dom|high-load
32,636
<p>set it to processing, then do a setTimeout to prevent the cpu intensive task from running until after the div has been updated.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" &gt;&lt;/script&gt; &...
1,728,978
Recommendations (and Differences) between different Ruby on Rails Production Web Servers
<p>Very soon I plan on deploying my first Ruby on Rails application to a production environment and I've even picked a webhost with all the managed server and Capistrano goodness you'd expect from a RoR provider.</p> <p>The provider allows for Mongrel, Thin, Passenger &amp; FastCGI web servers, which seems very flexib...
1,729,055
4
1
null
2009-11-13 12:37:13.16 UTC
12
2019-05-08 13:06:37.19 UTC
2009-11-13 14:27:36.763 UTC
null
1,450
null
11,194
null
1
16
ruby-on-rails|webserver|passenger|fastcgi|mongrel
6,241
<p><strong>Short answer</strong></p> <p>Go with Apache/Nginx + Passenger. Passenger <a href="http://www.modrails.com/documentation.html" rel="nofollow noreferrer">is fast</a>, reliable, easy to configure and deploy. Passenger has been adopted by a large number of big Rails applications, including <a href="http://www.s...
10,399,614
Accessing value inside nested dictionaries
<p>I am new to python and need help in solving an issue:</p> <p>I have a dictionary like </p> <pre><code>tmpDict = {'ONE':{'TWO':{'THREE':10}}} </code></pre> <p>Do we have any other way to access THREE's value other than doing </p> <pre><code>tmpDict['ONE']['TWO']['THREE'] </code></pre> <p>?</p>
10,399,718
5
2
null
2012-05-01 15:03:20.25 UTC
12
2018-08-24 09:23:09.73 UTC
2017-10-30 06:29:46.48 UTC
null
4,099,593
null
1,076,582
null
1
43
python|dictionary
145,178
<p>You can use the get() on each dict. Make sure that you have added the None check for each access. </p>
10,355,411
IE10 - CSS animation not working
<p>I have a scale animation that worked in IE10 for about a day and then stopped. I didn't make any changes and am not sure what would happen to break it. </p> <p>Does anyone have any ideas? When I look in the IE dev tools it's not picking up the animation name, but is picking up all the other properties.</p> <p>Here...
10,358,822
2
3
null
2012-04-27 17:46:06.943 UTC
null
2020-12-30 14:19:51.003 UTC
2012-06-04 14:01:57.173 UTC
null
54,680
null
389,809
null
1
6
animation|css|internet-explorer-10
53,506
<p>Apparently the help link I was following isn't correct. When I change it to -ms-animation: move97 0.2s, it works. This is what I had originally and it did NOT work, so I changed it to what's shown above, which did. </p> <p>Help link I followed: <a href="http://msdn.microsoft.com/library/ie/hh673530.aspx" rel="noref...
7,433,575
Cannot create a session after the response has been committed
<p>Opening the JSF page gives me the following exception:</p> <blockquote> <p>Caused by: java.lang.IllegalStateException: Cannot create a session after the response has been committed</p> </blockquote> <p>Here is the JSF code:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:/...
7,619,888
5
1
null
2011-09-15 15:40:02.417 UTC
5
2022-07-30 12:26:29.837 UTC
2011-09-17 04:17:05.59 UTC
null
157,882
null
811,750
null
1
18
jsf|mojarra
69,797
<p>[SOLVED]</p> <p>It took days to diagnose this problem, but finally I am able to solve this problem. </p> <p>It was actually <code>@ViewScoped</code> and it has a managed property DAO object which was not serialized. So after view is rendered, facelets also produce this exception, but JSF view already rendered and ...
7,058,507
Fixed aspect ratio View
<p>How would I go implementing a fixed aspect ratio <code>View</code>? I'd like to have items with 1:1 aspect ratio in a <code>GridView</code>. I think it's better to subclass the children than the <code>GridView</code>?</p> <p>EDIT: I assume this needs to be done programmatically, that's no problem. Also, I don't wan...
10,772,572
10
4
null
2011-08-14 17:34:38.537 UTC
22
2022-05-24 06:31:50.85 UTC
2016-07-19 00:17:04.49 UTC
null
1,318,479
null
706,690
null
1
51
android|view|aspect-ratio|viewgroup
55,931
<p>I implemented FixedAspectRatioFrameLayout, so I can reuse it and have any hosted view be with fixed aspect ratio:</p> <pre><code>public class FixedAspectRatioFrameLayout extends FrameLayout { private int mAspectRatioWidth; private int mAspectRatioHeight; public FixedAspectRatioFrameLayout(Context conte...
7,665,540
TCPDF ERROR: [Image] Unable to get image
<p>I'm using <strong>TCPDF</strong> with Drupal's <em>print</em> module to generate PDF of articles, &amp; ending up with following error message when I click the link to generate PDF:</p> <p><code>TCPDF ERROR: [Image] Unable to get image: http://localhost/pathToDrupal/themes/bartik/logo.png</code></p> <p>The Image e...
7,665,966
13
0
null
2011-10-05 17:57:26.427 UTC
4
2019-08-18 10:15:29.423 UTC
null
null
null
null
493,329
null
1
25
php|tcpdf
86,878
<p>Apparently the "fopen"-wrappers are not used by TCPDF.</p> <p>If you supply the URL of an image, TCPDF tries to download it with cURL into the "cache"-directory where your TCPDF-installation is stored (you have to check what the <code>K_PATH_CACHE</code>-constant contains to be sure). </p> <p>So I guess you have ...
13,994,507
How do you send a custom header in a CORS preflight OPTIONS request?
<p>I am trying to send a CORS request for a JSON payload. I control both the server and the client.</p> <p>I'm following along here: <a href="https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS?redirectlocale=en-US&amp;redirectslug=HTTP_access_control" rel="nofollow noreferrer">https://developer.mozilla.o...
13,997,235
1
4
null
2012-12-21 17:22:46.97 UTC
9
2022-07-18 01:19:39.09 UTC
2022-07-18 01:19:39.09 UTC
null
1,161,484
null
203,619
null
1
32
jquery|cors|xmlhttprequest
44,403
<p>Your problem isn't with jquery, it's in <a href="http://www.w3.org/TR/cors/" rel="noreferrer">how CORS works</a>. Your beforeSend callback was probably working as expected... but browsers won't send custom headers in preflight requests, no matter what. This is by design; the purpose of the preflight request is to ...
14,245,692
Are *.tlb files ever used at runtime?
<p>I'm working on a product that exposes some .NET API through COM interop. As a part of the build we generate *.tlb files for all such assemblies and deliver them as a part of a separate SDK package. Our customers can install the SDK on top of our product and create applications that use our COM API.</p> <p>Do we nee...
14,246,694
2
0
null
2013-01-09 20:16:47.393 UTC
6
2021-08-12 19:01:14.75 UTC
2013-01-09 20:45:26.96 UTC
null
176,848
null
176,848
null
1
40
.net|com
18,842
<p>Yes, that's possible. Especially in the case of .NET, you should not omit registering the type library because you cannot predict how the client code is going to use your server.</p> <p>They are not particularly common but there are two cases:</p> <ul> <li><p>When the client code calls your [ComVisible] method and ...
13,932,946
Transparent text cut out of background
<p>Is there any way to make a <strong>transparent text cut out of a background</strong> effect like the one in the following image, with CSS?<br> It would be sad to lose all precious SEO because of images replacing text.</p> <p><img src="https://i.stack.imgur.com/V6Bu7.png" alt="Transparent text cut out of background"...
13,933,418
14
6
null
2012-12-18 12:24:09.253 UTC
47
2022-05-31 03:37:10.49 UTC
2016-01-22 10:44:47.163 UTC
null
1,811,992
null
853,990
null
1
103
css|svg|fonts|css-shapes
102,729
<p>It's possible with css3 but it's not supported in all browsers</p> <p>With background-clip: text; you can use a background for the text, but you will have to align it with the background of the page</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snipp...
69,975,792
Error: [Home] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>
<p>Hello fellow friends I am trying to create my own app but facing issues after updating the react-router-dom to 6.02 I am getting this error</p> <blockquote> <p>Error: [Home] is not a Route component. All component children of Routes must be a Route or &lt;React.Fragment&gt;</p> </blockquote> <p>the code is the follo...
69,975,860
6
7
null
2021-11-15 14:13:48.927 UTC
6
2022-04-01 11:28:50.11 UTC
null
null
null
null
15,721,007
null
1
31
reactjs
33,701
<p><code>&lt;Route path=&quot;/&quot; element={&lt;Home /&gt;} /&gt; </code></p> <p><a href="https://reactrouter.com/docs/en/v6/upgrading/v5" rel="noreferrer">Migrating to v6</a></p>
30,170,400
which(vector1 < vector2)
<p>Let's make a small example first, that computes in R:</p> <pre><code>x&lt;- c(1,3,1,4,2) max(which(x&lt;2)) [1] 3 </code></pre> <p>Now, I would like to do this not just for one value 2, but for many values simultaneously. It should give me something like that:</p> <pre><code>max(which(x&lt;c(1,2,3,4,5,6))) [1] ...
30,171,117
5
6
null
2015-05-11 14:30:44.053 UTC
3
2021-01-20 15:31:58.687 UTC
2021-01-20 15:31:58.687 UTC
null
4,032,703
null
4,887,688
null
1
31
r|max|simultaneous
1,418
<p>Find the max index of each value seen in <code>x</code>:</p> <pre><code>xvals &lt;- unique(x) xmaxindx &lt;- length(x) - match(xvals,rev(x)) + 1L </code></pre> <p>Rearrange</p> <pre><code>xvals &lt;- xvals[order(xmaxindx,decreasing=TRUE)] xmaxindx &lt;- xmaxindx[order(xmaxindx,decreasing=TRUE)] # 2 4 1 3...
19,821,426
"New" Excel.Application vs Excel.Application
<p>I am seeking clarification on the impact of "New" on the objects and the script.</p> <p>My understanding is that if I need to perform actions on an excel document and the application is closed then I should use New Excel.Application.</p> <p>If I keep this application active (through an object such as a Workbook fo...
19,822,626
2
3
null
2013-11-06 19:50:13.8 UTC
null
2015-10-26 23:15:56.273 UTC
2015-10-26 23:15:56.273 UTC
user4039065
null
null
2,830,928
null
1
7
vba|excel|instance|excel.application
43,443
<p>The excel application can have several workbooks open at once so you don't need to instancing a new one. If you from inside excel you should not need to reference the application to open workbooks. You might wish to create several workbook instances e.g.</p> <pre><code>Dim wbWorkbookA As Workbook Dim wbWorkbookB As...
56,262,515
How to handle dependencies array for custom hooks in react
<p>I'm creating a custom hook and would like to define an optional param so that I can pass in extra dependencies when needed. My code looks like the following snippet:</p> <pre><code>import { useEffect } from 'react'; function useCustomHook(param1, extraDeps) { useEffect(() =&gt; { // do something with param1 ...
67,802,751
6
8
null
2019-05-22 17:59:19.573 UTC
5
2022-07-14 01:10:09.07 UTC
2019-05-22 20:16:43.083 UTC
null
1,783,403
null
1,783,403
null
1
34
reactjs|react-hooks
17,244
<p>I've found a useful alternative to the solutions proposed here. As mentioned <a href="https://www.reddit.com/r/reactjs/comments/dgbn15/pass_a_dependency_array_to_a_custom_hook/f3az9nh?utm_source=share&amp;utm_medium=web2x&amp;context=3" rel="noreferrer">in this Reddit topic</a>, the React team apparently recommends ...
1,279,681
mod_rewrite: replace underscores with dashes
<p>I'm revealing my embarrassing ignorance of REGEX-fu here, but: I currently have a website where a load of the articles' URLs are written as "article_name", whilst the newer ones are written as "article-name".</p> <p>I want to move all of them to using dashes, so is there a regular expression I could use to rewrite ...
1,279,758
5
0
null
2009-08-14 19:17:36.523 UTC
13
2011-01-12 10:31:57.147 UTC
null
null
null
null
50,189
null
1
20
regex|mod-rewrite
29,867
<p>First you must achieve consistency in the existing URLs. Basically, you have to normalize all existing names to always use dashes. Ok, you've done that.</p> <p>We're starting with the following assumption:</p> <p>The URL is roughly of the form:</p> <pre> http://example.com/articles/what-ever/really-doesnt_matter/...
622,481
Django + Ajax
<p>So, I am just starting to use jQuery with one of my Django projects, but I have a pretty noobie question.</p> <p>In a django view you have to return an HttpResponse object from the view, but sometimes I don't need to return anything. For instance, I might just be updating the database via ajax and don't need to se...
622,525
5
0
null
2009-03-07 20:50:59.783 UTC
11
2010-05-30 13:07:36.48 UTC
null
null
null
Nate
74,474
null
1
21
jquery|django
4,203
<p>An HTTP response is more than sending content to the browser. A response is associated with a status code and several HTTP headers. Additionally, a response may contain a body (actual content).</p> <p>I think it's OK to sent an HttpResponse object with no body. That is:</p> <pre><code>return HttpResponse() </code>...
451,922
how do I grep through a mysql database?
<p>Looking for a nifty helper function/method for grepping through all defined tables, columns, stored procedures, etc, for a MySql database.</p> <p>I had something similar for SQL Server.</p>
451,957
5
1
null
2009-01-16 20:42:43.567 UTC
9
2019-01-09 15:25:20.903 UTC
null
null
null
someguy
39,529
null
1
23
mysql|grep
39,870
<p>In the INFORMATION_SCHEMA database:</p> <pre><code>select * from columns WHERE TABLE_NAME LIKE '%tablename%' AND COLUMN_NAME LIKE '%columnname%' </code></pre> <p>More info here: <a href="http://dev.mysql.com/doc/refman/5.0/en/information-schema.html" rel="noreferrer">http://dev.mysql.com/doc/refman/5.0/en/informat...
1,200,562
Difference in JSON objects using Javascript/JQuery
<p>I have two JSON objects in Javascript, identical except for the numerical values. It looks like this:</p> <pre><code>var data = { "eth0":{"Tx":"4136675","Rx":"13232319"}, "eth1":{"Tx":"4","Rx":"0"}, "lo":{"Tx":"471290","Rx":"471290"} } var old = { "eth0":{"Tx":"4136575","Rx":"13232219"}, "eth1":{"Tx":"4"...
1,200,865
6
3
null
2009-07-29 14:14:02.717 UTC
14
2021-01-13 01:08:04.39 UTC
null
null
null
null
147,150
null
1
18
javascript|jquery|json
25,261
<p>You can iterate through the parent and child object properties:</p> <pre><code>var diff = {}; for(var p in data){ if (old.hasOwnProperty(p) &amp;&amp; typeof(data[p]) == 'object'){ diff[p] = {}; for(var i in data[p]){ if (old[p].hasOwnProperty(i)){ diff[p][i] = data[p][i] - old[p][i]; ...
918,990
C# - Capturing the Mouse cursor image
<h2>BACKGROUND</h2> <ul> <li>I am writing a screen capture application</li> <li>My code is based derived from this project: <a href="http://www.codeproject.com/KB/cs/DesktopCaptureWithMouse.aspx?display=Print" rel="noreferrer">http://www.codeproject.com/KB/cs/DesktopCaptureWithMouse.aspx?display=Print</a></li> <li>Not...
1,020,819
6
2
null
2009-05-28 02:53:53.4 UTC
13
2021-12-22 22:50:53.913 UTC
2021-12-22 22:50:53.913 UTC
null
4,294,399
null
13,477
null
1
32
c#|icons|screenshot|mouse-cursor
25,612
<p>While I can't explain exactly why this happens, I think I can show how to get around it.</p> <p>The ICONINFO struct contains two members, hbmMask and hbmColor, that contain the mask and color bitmaps, respectively, for the cursor (see the MSDN page for <a href="http://msdn.microsoft.com/en-us/library/ms929934.aspx"...
813,529
Documentation-generator for Objective-C?
<p>Is there a generally-accepted documentation generator for Objective-C (similar to RDoc for Ruby)? I've seen Doxygen and ObjcDoc, and am wondering which is most widely used.</p>
813,791
6
0
null
2009-05-01 22:15:52.46 UTC
21
2018-12-12 11:08:45.263 UTC
2009-06-04 01:35:46.813 UTC
null
99,646
null
99,646
null
1
49
objective-c|documentation
21,314
<p><a href="http://www.doxygen.nl" rel="nofollow noreferrer">Doxygen</a> is probably the most widely used option. Because it's not just for ObjC (doxygen supports many other languages), the development is lively and the community quite strong. <a href="http://developer.apple.com/opensource/tools/headerdoc.html" rel="no...
836,601
What's the difference between [NSNull null] and nil?
<p>Here's a context where I have seen that:</p> <pre><code>NSMutableArray *controllers = [[NSMutableArray alloc] init]; for (unsigned i = 0; i &lt; kNumberOfPages; i++) { [controllers addObject:[NSNull null]]; } </code></pre> <p>why not nil in that place?</p>
836,624
6
1
null
2009-05-07 19:39:05.75 UTC
11
2018-03-15 11:44:37.263 UTC
2014-01-24 13:27:34.307 UTC
null
1,698,467
null
62,553
null
1
50
objective-c|cocoa-touch|cocoa|null|nsnull
31,002
<p>Directly from <a href="https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/NumbersandValues/Articles/Null.html" rel="noreferrer">Apple</a>:</p> <blockquote> <p>The NSNull class defines a singleton object you use to represent null values in situations where nil is prohibited as a value (typi...
233,328
How do I print the full value of a long string in gdb?
<p>I want to print the full length of a C-string in GDB. By default it's being abbreviated, how do I force GDB to print the whole string?</p>
233,339
6
0
null
2008-10-24 12:36:01.353 UTC
129
2018-04-20 09:17:32.577 UTC
2011-10-06 21:11:12.36 UTC
therefromhere
8,331
therefromhere
8,331
null
1
436
c++|c|string|debugging|gdb
242,574
<pre><code>set print elements 0 </code></pre> <p><a href="http://ftp.gnu.org/old-gnu/Manuals/gdb-5.1.1/html_node/gdb_57.html#IDX353" rel="noreferrer">From the GDB manual</a>: </p> <blockquote><code>set print elements </code><i><code>number-of-elements</code></i></blockquote> <blockquote> Set a limit on how many elem...
31,172,003
Java - Write hashmap to a csv file
<p>I have a hashmap with a String key and String value. It contains a large number of keys and their respective values.</p> <p>For example:</p> <pre><code>key | value abc | aabbcc def | ddeeff </code></pre> <p>I would like to write this hashmap to a csv file such that my csv file contains rows as below:</p> <pre><code>...
31,196,047
6
2
null
2015-07-01 21:27:34.393 UTC
4
2021-04-26 04:22:09.68 UTC
2021-04-25 09:07:05.703 UTC
null
6,296,561
null
3,469,521
null
1
12
java|csv|hashmap|supercsv
45,823
<p>As your question is asking how to do this using Super CSV, I thought I'd chime in (as a maintainer of the project).</p> <p>I initially thought you could just iterate over the map's entry set using <code>CsvBeanWriter</code> and a name mapping array of <code>"key", "value"</code>, but this doesn't work because <code...
31,078,710
How to obtain Telegram chat_id for a specific user?
<p>How to obtain user <code>chat_id</code> in Telegram bot API? The documentation says:</p> <blockquote> <p>Integer | Unique identifier for the message recipient — User or GroupChat id</p> </blockquote>
31,081,941
10
3
null
2015-06-26 17:16:30.9 UTC
19
2022-07-24 02:52:02.893 UTC
2019-04-14 13:26:10.507 UTC
null
3,592,207
null
3,592,207
null
1
77
telegram-bot
257,582
<p>The message updates you receive via <code>getUpdates</code> or your webhook will contain the chat ID for the specific message. It will be contained under the <code>message.chat.id</code> key.</p> <p>This seems like the only way you are able to retrieve the chat ID. So if you want to write something where the bot in...
31,205,599
ASP.NET Web API : Correct way to return a 401/unauthorised response
<p>I have an MVC webapi site that uses OAuth/token authentication to authenticate requests. All the relevant controllers have the right attributes, and authentication is working ok. </p> <p>The problem is that not all of the request can be authorised in the scope of an attribute - some authorisation checks have to be ...
31,206,850
9
3
null
2015-07-03 11:20:16.833 UTC
12
2022-07-27 19:39:49.953 UTC
2015-07-03 12:02:50.63 UTC
null
55,847
null
1,324,393
null
1
142
c#|asp.net-mvc|authorization
192,597
<p>You should be throwing a <a href="https://msdn.microsoft.com/en-us/library/system.web.http.httpresponseexception.aspx"><code>HttpResponseException</code></a> from your API method, not <a href="https://msdn.microsoft.com/en-us/library/system.web.httpexception.aspx"><code>HttpException</code></a>:</p> <pre><code>thro...
20,985,252
Detect when application is idle in Android
<p>I am developing an application that will be running in Kiosk Mode. In this application, if the user didn't do anything in the application within 5 minutes, the application will show a screen saver that is the logo of the application. </p> <p>My question is, <strong>how can I code on detecting IDLE within 5 minutes?...
20,985,418
4
4
null
2014-01-08 01:13:23.083 UTC
9
2020-01-13 09:21:04.253 UTC
null
null
null
null
2,503,743
null
1
13
android
16,827
<p>I think you could use <a href="http://developer.android.com/reference/android/app/Activity.html#dispatchTouchEvent(android.view.MotionEvent)" rel="nofollow noreferrer">http://developer.android.com/reference/android/app/Activity.html#dispatchTouchEvent(android.view.MotionEvent)</a> and <a href="http://developer.andro...
44,297,430
Generate War file using Maven
<p>I have a maven pom as follows:</p> <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;group...
44,304,948
3
2
null
2017-06-01 02:13:43.78 UTC
2
2019-02-14 14:51:15.573 UTC
2017-06-01 02:32:46.24 UTC
user177800
null
null
547,198
null
1
25
java|maven|tomcat
92,902
<p>First you must define your project with as packaging of war type:</p> <pre><code>&lt;groupId&gt;...&lt;/groupId&gt; &lt;artifactId&gt;...&lt;/artifactId&gt; &lt;version&gt;...&lt;/version&gt; &lt;packaging&gt;war&lt;/packaging&gt; </code></pre> <p>Then you will need to use the maven plugin to generate the war when...
17,944,061
how to use number picker with dialog
<p>I want to use a number picker for the purpose of getting the discount percentage from the user. once the user enters the sale price, i want a dialog box to appear asking for the discount percentage. I cannot find a way to integrate the numberpicker in the dialog.</p>
17,944,205
4
1
null
2013-07-30 10:05:09.493 UTC
6
2018-06-01 02:08:14.407 UTC
null
null
null
null
2,432,126
null
1
22
android|dialog|numberpicker
52,763
<p>I have made a small demo of NumberPicker. This may not be perfect but you can use and modify the same. </p> <p>Use a custom dialog and set the number picker. </p> <p>More info @</p> <p><a href="http://developer.android.com/reference/android/widget/NumberPicker.html" rel="noreferrer">http://developer.android.co...
33,441,873
AWS error - sudo: unable to resolve host ip-10-0-xx-xx
<p>I launched a new <code>aws</code> instance. My private ip is <code>ip-10-0-xx-xx</code> as per amazon console. Everytime when I do a sudo command, I get the following error </p> <pre><code>sudo: unable to resolve host ip-10-0-xx-xx </code></pre> <p>How can I rectify this error? </p>
33,442,052
11
3
null
2015-10-30 17:40:13.66 UTC
12
2022-07-19 17:55:32.38 UTC
null
null
null
null
826,610
null
1
75
amazon-web-services|sudo
61,448
<p><strong>You should enable the DNS hostnames on your VPC</strong>: <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-dns.html#vpc-dns-updating" rel="nofollow noreferrer">http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-dns.html#vpc-dns-updating</a></p> <p><em>If for some reason, you cannot e...
23,102,193
org.springframework.beans.NotWritablePropertyException: Invalid property 'adminEmails' of bean class
<p>I got stuck on this error given below:</p> <p><strong>Stack Trace</strong></p> <pre><code>Apr 16, 2014 12:21:23 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [beans.xml] Exception in thread "main" org.springframework...
23,102,342
4
2
null
2014-04-16 06:58:18.533 UTC
null
2022-04-15 09:56:23.353 UTC
2014-11-24 16:26:36.583 UTC
null
3,885,376
null
3,257,643
null
1
8
java|spring
51,789
<p>In <code>beans.xml</code> you are trying to set the field <code>adminEmails</code> of <code>CollectionsWithProps</code>. However the class doesn't have that field, it has the <code>emails</code> field.</p> <p>Either fix <code>beans.xml</code> to use emails instead of <code>adminEmails</code>, or fix the source code...
2,082,064
How to install Doxygen GUI on Ubuntu?
<p>I can't figure out how to install the Doxygen GUI (doxywizard) on Ubuntu. Where can I get it?</p>
2,082,095
5
0
null
2010-01-17 18:19:51.22 UTC
4
2016-07-07 13:26:30.607 UTC
2016-07-07 13:26:30.607 UTC
null
895,245
null
217,649
null
1
19
doxygen|doxywizard
45,918
<p>In Debian the package is called doxygen-gui. It must be the same in Ubuntu, so try <code>sudo apt-get install doxygen-gui</code>.</p> <p>Edit : apparently, doxygen-gui doesn't exist in Karmic. Try any other repo ? <a href="http://packages.ubuntu.com/search?keywords=doxygen-gui" rel="noreferrer">http://packages.ubun...
1,402,112
How do I check if the key pressed on a form field is a digit (0 - 9)?
<p>I'm using the <code>onkeyup</code> event on a form field in JavaScript, and I'm wanting to check if the key the key pressed is a numeric digit - i.e. 0 - 9, so I can then do something with the input.</p> <pre><code>&lt;input type=&quot;text&quot; onkeyup=&quot;&quot; /&gt; </code></pre> <p>Would I need to use Regex ...
1,402,138
6
0
null
2009-09-09 21:07:25 UTC
3
2021-08-13 14:25:51.163 UTC
2020-12-10 21:14:35.237 UTC
null
4,370,109
null
1,692
null
1
17
javascript|dom-events
39,064
<p>See these:</p> <ul> <li><a href="https://stackoverflow.com/questions/469357/html-text-input-allow-only-numeric-input">HTML Text Input allow only Numeric input</a></li> <li><a href="https://stackoverflow.com/questions/724217/allow-digits-only-for-inputs">allow digits only for inputs</a></li> </ul>
2,060,382
How would one check for installed MATLAB toolboxes in a script/function?
<p>How would one check for installed MATLAB toolboxes in a script/function? (checking toolbox versions would also be good!) This could provide a quick and useful error message when someone attempts to run a script without a required toolbox.</p> <p>A quick, albeit rough, solution that comes to mind is parsing the te...
2,061,547
6
0
null
2010-01-13 21:23:58.157 UTC
15
2018-04-10 15:44:50.197 UTC
2011-11-14 15:25:22.717 UTC
null
97,160
null
15,286
null
1
35
matlab
95,074
<p>One drawback to the <a href="https://www.mathworks.com/help/matlab/ref/ver.html" rel="nofollow noreferrer"><code>ver</code></a> function is that it only tells you what's <em>installed</em>, not what has an <em>available license</em>. It's possible to have a toolbox installed and no license to use it (or all the avai...
1,510,869
Does the C preprocessor strip comments or expand macros first?
<p>Consider this (horrible, terrible, no good, very bad) code structure:</p> <pre><code>#define foo(x) // commented out debugging code // Misformatted to not obscure the point if (a) foo(a); bar(a); </code></pre> <p>I've seen two compilers' preprocessors generate different results on this code:</p> <pre><code>if (a...
1,510,919
6
4
null
2009-10-02 17:26:58.87 UTC
6
2016-06-30 19:24:27.393 UTC
2016-06-30 19:24:27.393 UTC
null
3,204,551
null
90,002
null
1
63
c|comments|c-preprocessor|c99
30,791
<p>Unfortunately, the original <a href="http://eli-project.sourceforge.net/c_html/c.html" rel="noreferrer">ANSI C Specification</a> specifically excludes any Preprocessor features in section 4 ("This specification describes only the C language. It makes no provision for either the library or the preprocessor.").</p> <...
2,065,928
Maven 2 assembly with dependencies: jar under scope "system" not included
<p>I am using maven-assembly plugin to create a jar of my application, including its dependencies as follows:</p> <pre><code>&lt;assembly&gt; &lt;id&gt;macosx&lt;/id&gt; &lt;formats&gt; &lt;format&gt;tar.gz&lt;/format&gt; &lt;format&gt;dir&lt;/format&gt; &lt;/formats&gt; &lt;dependencySet...
2,068,101
7
2
null
2010-01-14 17:01:44.153 UTC
34
2019-12-11 16:20:28.36 UTC
null
null
null
null
227,103
null
1
68
maven-2|maven-plugin|maven-assembly-plugin
78,808
<p>I'm not surprised that system scope dependencies are not added (after all, dependencies with a system scope must be explicitly provided by definition). Actually, if you really don't want to put that dependency in your local repository (for example because you want to distribute it as part of your project), this is w...
1,432,961
How do I make HttpURLConnection use a proxy?
<p>If I do this...</p> <pre><code>conn = new URL(urlString).openConnection(); System.out.println("Proxy? " + conn.usingProxy()); </code></pre> <p>it prints</p> <pre><code>Proxy? false </code></pre> <p>The problem is, I am behind a proxy. Where does the JVM get its proxy information from on Windows? How do I set thi...
1,433,296
7
0
null
2009-09-16 13:28:16.973 UTC
58
2021-09-03 23:52:17.063 UTC
null
null
null
null
974
null
1
157
java|windows|http|proxy
299,975
<p>Since java 1.5 you can also pass a <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/net/Proxy.html" rel="noreferrer">java.net.Proxy</a> instance to the <a href="http://docs.oracle.com/javase/7/docs/api/java/net/URL.html#openConnection%28java.net.Proxy%29" rel="noreferrer"><code>openConnection(proxy)</code>...
1,414,769
Turn off Visual Studio Attach security warning when debugging IIS
<p>When using Visual Studio 2008 or 2010, every time you attach to IIS w3wp.exe you get the Attach Security Warning:</p> <p><a href="https://i.stack.imgur.com/ENVEG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ENVEGm.png" alt="Attach Security Warning" /></a></p> <p>How do you turn this of?</p> <p>...
2,026,878
11
1
null
2009-09-12 09:59:33.393 UTC
46
2022-02-09 13:21:24.927 UTC
2022-02-09 13:21:24.927 UTC
null
1,366,033
null
162,325
null
1
164
visual-studio-2010|visual-studio|visual-studio-2008|iis|iis-7
37,842
<p>Also found in the article mentioned by Tzury, but to sum up the answers in this thread:</p> <p><strong>Make sure Visual Studio is not running when changing the registry key or it will be overwritten on exit with the old value</strong></p> <p><strong>Visual Studio 2022</strong>: Follow <a href="https://www.davici.nl...
1,625,249
Android: How to bind spinner to custom object list?
<p>In the user interface there has to be a spinner which contains some names (the names are visible) and each name has its own ID (the IDs are not equal to display sequence). When the user selects the name from the list the variable currentID has to be changed.</p> <p>The application contains the ArrayList</p> <p>Whe...
1,626,016
17
0
null
2009-10-26 14:45:09.143 UTC
65
2021-06-29 07:24:41.383 UTC
null
null
null
null
22,996
null
1
150
android|adapter|spinner
246,019
<p>You can <a href="https://stackoverflow.com/questions/1587028/android-configure-spinner-to-use-array">look at this answer</a>. You can also go with a custom adapter, but the solution below is fine for simple cases.</p> <p>Here's a re-post:</p> <p>So if you came here because you want to have both labels and values i...
1,749,966
C# - how to determine whether a Type is a number
<p>Is there a way to determine whether or not a given .Net Type is a number? For example: <code>System.UInt32/UInt16/Double</code> are all numbers. I want to avoid a long switch-case on the <code>Type.FullName</code>.</p>
1,750,024
21
2
null
2009-11-17 16:15:04.82 UTC
27
2022-09-22 20:07:44.7 UTC
2019-01-19 22:31:47.043 UTC
null
4,574
null
55,373
null
1
134
c#|.net|types
111,689
<p><strike>Try this:</p> <pre><code>Type type = object.GetType(); bool isNumber = (type.IsPrimitiveImple &amp;&amp; type != typeof(bool) &amp;&amp; type != typeof(char)); </code></pre> <blockquote> <p>The primitive types are Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Char, Double,and S...
41,900,387
Mapping column names to random forest feature importances
<p>I am trying to plot feature importances for a random forest model and map each feature importance back to the original coefficient. I've managed to create a plot that shows the importances and uses the original variable names as labels but right now it's ordering the variable names in the order they were in the data...
41,900,730
4
4
null
2017-01-27 18:09:10.027 UTC
10
2020-01-03 04:58:07.153 UTC
2017-01-27 18:25:03.627 UTC
null
7,117,564
null
7,117,564
null
1
15
python|pandas
36,206
<p>A sort of generic solution would be to throw the features/importances into a dataframe and sort them before plotting:</p> <pre><code>import pandas as pd %matplotlib inline #do code to support model #"data" is the X dataframe and model is the SKlearn object feats = {} # a dict to hold feature_name: feature_importan...
6,399,898
Is the typedef-name optional in a typedef declaration?
<p>I was quite surprised when I saw the following code compile without errors or warnings in g++-4.2:</p> <pre><code>typedef enum test { one }; </code></pre> <p>My assumption was that if you used the <code>typedef</code> keyword it would require an extra identifier as in:</p> <pre><code>typedef enum test { one } tes...
6,399,998
3
7
null
2011-06-19 00:56:47.123 UTC
9
2011-06-19 10:38:26.72 UTC
2011-06-19 01:30:07.96 UTC
null
36,565
null
36,565
null
1
36
c++|c|typedef
38,673
<p>It is a degenerate syntax that is allowed but provides no benefit. Most modern compilers can be provoked into emitting a warning about it; by default, they may not. Without the typedef name, the keyword <code>typedef</code> is superfluous; in your example, it is completely equivalent to:</p> <pre><code>enum test ...
6,434,865
Passing an object to HTML attributes
<p>How to pass an object to HTML attributes? For example I have the following code:</p> <pre><code>var attrs = new { id = "myid", style = "color: Red;" }; </code></pre> <p>How to convert attrs to string like this to embed them into an HTML markup: </p> <pre><code>id="myid" style="color: Red;" </code></pre> <p>Thank...
6,434,991
3
1
null
2011-06-22 04:22:10.787 UTC
13
2014-08-22 14:33:45.437 UTC
2013-07-11 10:18:31.323 UTC
null
930,252
null
463,650
null
1
43
c#|asp.net|html|asp.net-mvc-3
59,826
<p>This functionality is, surprisingly enough, provided by the <a href="http://msdn.microsoft.com/en-us/library/system.web.routing.routevaluedictionary.aspx"><code>RouteValueDictionary</code></a> class:</p> <pre><code>IDictionary&lt;string, object&gt; htmlAttributes = new RouteValueDictionary(attrs); </code></pre> <p...
23,689,647
How do I replace <NA> values with zeros in R?
<p>I have a data.frame and some columns have <code>NA</code> values. I want to replace the <code>&lt;NA&gt;</code>s with zeros. How I do this?</p> <p>Actually, mydate, shown here, isn't my original data. the original is too large to show here. </p> <pre><code>mydata = read.spss('mydata.sav', use.value.labels = TRUE, ...
23,689,782
1
3
null
2014-05-15 22:19:48.417 UTC
3
2016-07-13 09:15:25.423 UTC
2016-07-13 09:15:25.423 UTC
null
1,505,504
null
3,642,673
null
1
5
r|import
52,952
<p>For practically any data structure <code>X</code> containing numerics, use </p> <pre><code>X[is.na(X)] &lt;- 0 </code></pre> <p>Your question seems slightly discombobulated though - you have indicated that you mean <code>&lt;NA&gt;</code> not NA, without explaining what <em>type</em> <code>&lt;NA&gt;</code> is.</p...
15,934,724
FieldSet background color
<p>I am trying to set a background color for a fieldset in Telerik with the below code. </p> <p>Can someone point me in right direction, or have any other ideas?</p> <pre><code>.RadForm_Office2007.rfdFieldset fieldset { border: solid 1px #080808; background-color:yellow !important; } &lt;telerik:RadFor...
15,934,784
2
0
null
2013-04-10 19:29:45.767 UTC
null
2020-11-27 11:00:50.063 UTC
2019-09-18 20:36:42.01 UTC
null
6,495,157
null
1,046,415
null
1
3
css|telerik|form-designer
39,667
<p>You can set the background color as</p> <pre><code>&lt;fieldset style="float: left; width: 280px; background-color:red;"&gt; </code></pre> <p>you can use color codes for setting background color like this</p> <pre><code>&lt;fieldset style="float: left; width: 280px; background-color:#999999;"&gt; </code></pre> <...
16,043,140
ProgressDialog: change text size
<p>I create a ProgressDialog from java code:</p> <pre><code>mProgressDialog = ProgressDialog.show(this, ..., ... , true); </code></pre> <p>I want to change the message text size and its color how can I do it?</p>
16,045,641
3
0
null
2013-04-16 17:16:16.837 UTC
10
2015-10-26 07:46:53.16 UTC
null
null
null
null
2,064,262
null
1
9
android
13,075
<p>You can use a spannable string and set the color and size for the spannable string. Use the spannable string to set text color and size.</p> <p><strong>Note</strong>: Make sure the font size is not too large to fit in the screen</p> <p>activity_main.xml </p> <pre><code>&lt;RelativeLayout xmlns:android="http://s...
1,115,876
Autocompletion in Vim
<p>In a nutshell, I'm searching for a <strong>working</strong> autocompletion feature for the Vim editor. I've <a href="https://stackoverflow.com/questions/24109/c-ide-for-linux/24119#24119">argued before</a> that Vim completely replaces an IDE under Linux and while that's certainly true, it lacks one important feature...
14,764,809
7
5
null
2009-07-12 11:38:19.04 UTC
134
2019-09-19 18:17:45.227 UTC
2017-05-23 11:55:19.593 UTC
null
-1
null
1,968
null
1
263
c++|vim|ide|autocomplete
123,312
<p>Try <a href="https://github.com/ycm-core/YouCompleteMe" rel="noreferrer">YouCompleteMe</a>. It uses Clang through the libclang interface, offering semantic C/C++/Objective-C completion. It's much like clang_complete, but substantially faster and with fuzzy-matching.</p> <p>In addition to the above, YCM also provide...
1,116,116
Major game components
<p>I am in the process of developping a game, and after two months of work (not full time mind you), I have come to realise that our specs for the game are lacking a lot of details. I am not a professional game developper, this is only a hobby.</p> <p>What I would like to receive help or advices for is this: <strong>W...
1,116,211
7
0
null
2009-07-12 14:25:07.343 UTC
9
2015-04-26 04:07:06.05 UTC
2010-09-29 18:20:07.843 UTC
null
2,535
null
108,301
null
1
9
components
3,899
<p>I don't know if this is any help, but I have been reading articles from <a href="http://www.gamasutra.com/" rel="nofollow noreferrer">http://www.gamasutra.com/</a> for many years. </p> <p>I don't have a perfect set of tools from the beginning, but your list covers most of the usual trouble for RUNNING the game. But...
767,912
Riddle: The Square Puzzle
<p>Last couple of days, I have refrained myself from master's studies and have been focusing on this (seemingly simple) puzzle: </p> <hr> <p>There is this 10*10 grid which constitutes a square of 100 available places to go. The aim is to start from a corner and traverse through all the places with respect to some si...
772,644
7
6
null
2009-04-20 11:41:59.11 UTC
13
2022-01-02 20:00:05.533 UTC
2022-01-02 20:00:05.533 UTC
null
772,868
null
82,049
null
1
21
python|knights-tour
5,480
<p>Eventually, I have come up with the modified Python code to overcome the problem. I've tun the code for a couple of hours and it has already found half a million solutions in a couple of hours.<br> The full set of solutions still require a total exhaustive search, i.e. to let the program run until it finishes with a...
1,027,395
Detecting Outlook autoreply/out-of-office emails
<p>Been googling for this and haven't found anything ...</p> <p>Does anybody know if there is a way, given an Outlook email item, to detect whether it was sent by the "Out Of Office Assistant"? Is there any property that Outlook sets on the object, or any header information, that identifies an email as such? I was h...
1,027,576
7
1
null
2009-06-22 14:04:42.933 UTC
12
2021-12-20 15:57:41.58 UTC
2020-06-24 07:47:53.557 UTC
null
100,297
null
65,712
null
1
32
vba|outlook|email-headers
36,739
<p>There is a header field (<a href="http://www.iana.org/assignments/auto-submitted-keywords/auto-submitted-keywords.xhtml" rel="noreferrer">http://www.iana.org/assignments/auto-submitted-keywords/auto-submitted-keywords.xhtml</a>) but it seems that MS Outlook does not set it (at least, not Outlook 2003). I guess that...
226,420
C#: How to create an attribute on a method triggering an event when it is invoked?
<p>Is there a way in C# or .NET in general to create an attribute on a method which triggers an event when the method is invoked? Ideally, I would be able to run custom actions before and after the invocation of the method.</p> <p>I mean something like this:</p> <pre><code>[TriggersMyCustomAction()] public void DoSom...
226,440
7
2
null
2008-10-22 15:54:57.003 UTC
16
2020-04-08 06:42:00.707 UTC
2018-06-26 11:57:08.157 UTC
DrJokepu
1,016,343
DrJokepu
8,954
null
1
41
c#|.net|events|methods|attributes
46,263
<p>The only way I know how to do this is with <a href="https://www.postsharp.net/" rel="noreferrer">PostSharp</a>. It post-processes your IL and can do things like what you asked for.</p>
1,302,243
Selecting a float in MySQL
<p>I am trying to do a <code>SELECT</code> match on a table based upon an identifier and a price, such as:</p> <pre><code>SELECT * FROM `table` WHERE `ident`='ident23' AND `price`='101.31'; </code></pre> <p>The above returns zero rows, while if you remove the <code>price='101.31'</code> bit it returns the correct row...
1,302,270
8
0
null
2009-08-19 19:48:51.667 UTC
5
2018-09-27 09:31:44.23 UTC
2009-08-19 19:52:57.29 UTC
null
53,114
null
130,417
null
1
27
php|mysql|floating-point|database
52,520
<p>Casting to a decimal worked for me:</p> <pre><code>SELECT * FROM table WHERE CAST(price AS DECIMAL) = CAST(101.31 AS DECIMAL); </code></pre> <p>However, you may want to consider just making the <code>price</code> column a DECIMAL in the first place. DECIMAL is generally considered to be the best type to use when ...
316,166
How do I include a common file in VBScript (similar to C #include)?
<p>VBScript doesn't appear to have a way to include a common file of functions.</p> <p>Is there a way to achieve this?</p>
316,491
8
1
2008-11-25 05:43:24.523 UTC
2008-11-25 02:23:31.603 UTC
16
2017-05-13 20:55:26.05 UTC
2009-07-15 06:12:51.75 UTC
null
113,116
Pax
14,860
null
1
47
vbscript|include
90,757
<p>The "Windows Script Host" framework (if ya want to call it that), offers an XML wrapper document that adds functionality over regular vbs files. One of which is the ability to include external script files of both the VBscript and Jscript flavors. I never got very deep into it, but I think it would do what you're wa...