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
16,945,518
Finding the index of the value which is the min or max in Python
<p>I've got a structure of the form:</p> <pre><code>&gt;&gt;&gt; items [([[0, 1], [2, 20]], 'zz', ''), ([[1, 3], [5, 29], [50, 500]], 'a', 'b')] </code></pre> <p>The first item in each tuple is a list of ranges, and I want to make a generator that provides me the ranges in ascending order based on the starting index....
16,946,252
9
3
null
2013-06-05 16:46:55.027 UTC
5
2022-01-14 10:11:17.553 UTC
2017-09-17 22:57:04.47 UTC
null
55,075
null
340,947
null
1
40
python
70,233
<p>This works:</p> <pre><code>by_index = ([sub_index, list_index] for list_index, list_item in enumerate(items) for sub_index in list_item[0]) [item[1] for item in sorted(by_index)] </code></pre> <p>Gives:</p> <pre><code>[0, 1, 0, 1, 1] </code></pre> <p>In detail. The generator:</p> <pre><code>by_inde...
16,739,322
How to keep the shell window open after running a PowerShell script?
<p>I have a very short PowerShell script that connects to a server and imports the AD module. I'd like to run the script simply by double clicking, but I'm afraid the window immediately closes after the last line.</p> <p>How can I sort this out?</p>
24,620,771
6
1
null
2013-05-24 16:11:50.903 UTC
19
2021-01-29 05:12:11.22 UTC
2016-01-20 13:49:04.433 UTC
null
63,550
null
1,571,299
null
1
83
active-directory|powershell-2.0
136,197
<p>You basically have 3 options to prevent the PowerShell Console window from closing, that I describe <a href="http://blog.danskingdom.com/keep-powershell-console-window-open-after-script-finishes-running/" rel="noreferrer">in more detail on my blog post</a>.</p> <ol> <li><strong>One-time Fix:</strong> Run your scrip...
9,647,693
How to calculate average of a column and then include it in a select query in oracle?
<p>My table is--</p> <pre><code>create table mobile ( id integer, m_name varchar(20), cost integer ) </code></pre> <p>and the values are --</p> <pre><code>insert into mobile values(10,'NOkia',100); insert into mobile values(11,'Samsung',150); insert into mobile values(12,'Sony',120); </code></pre> <p>I know...
9,647,731
6
3
null
2012-03-10 15:39:43.073 UTC
5
2016-08-08 20:01:55.013 UTC
2013-11-24 01:44:39.37 UTC
null
508,666
null
1,252,001
null
1
6
sql|oracle
96,363
<p>Your group by is what aggregates your average, and it is grouping by the whole table (I am assuming you did this to allow the select for everything) Just move your avg into another subquery, remove the overarching group by and that should solve it. </p> <pre><code>SELECT id, m_name AS "Mobile Name", cost AS Price, ...
9,922,928
What does pss mean in /proc/pid/smaps
<p>I was confused about the <code>Pss</code> column in <code>/proc/pid/smaps</code>, so I wrote a program to test it:</p> <pre class="lang-c prettyprint-override"><code>void sa(); int main(int argc,char *argv[]) { int fd; sa(); sleep(1000); } void sa() { char *pi=new char[1024*1024*10]; for(int i=0;i...
9,923,021
1
0
null
2012-03-29 09:48:21.563 UTC
13
2022-03-26 18:37:40.813 UTC
2022-03-26 18:37:40.813 UTC
null
3,241,243
null
440,403
null
1
26
linux|memory|memory-management|linux-kernel
52,429
<p>Quoting from <a href="http://lwn.net/Articles/230975/" rel="noreferrer">lwn.net</a></p> <blockquote> <p>The "proportional set size" (PSS) of a process is the count of pages it has in memory, where each page is divided by the number of processes sharing it. So if a process has 1000 pages all to itself, and 1...
11,485,486
Regarding thread safety of servlet
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/3106452/how-do-servlets-work-instantiation-session-variables-and-multithreading">How do servlets work? Instantiation, session variables and multithreading</a> </p> </blockquote> <p>Is servlet is thread safe ..?...
11,485,565
1
0
null
2012-07-14 16:34:59.843 UTC
12
2019-04-22 18:39:42.857 UTC
2017-05-23 12:25:19.77 UTC
null
-1
null
1,508,454
null
1
12
java|multithreading|servlets|thread-safety
11,520
<p>Your question boils down to: <em>is calling a method from multiple threads on the same object thread safe</em>. And the answer is: <strong>it depends</strong>. If your object (let it be servlet) is stateless or has only <code>final</code> fields, this is completely thread safe. Local variables and parameters are loc...
12,005,526
Erase multiple packages using rpm or yum
<p>I was given access to a server with 50+ php rpms installed. I'm trying to remove them all.</p> <p>Basically, I'm trying to combine these two commands:</p> <pre><code>rpm -qa | grep 'php' </code></pre> <p>and</p> <pre><code>rpm --erase </code></pre> <p>I know a little about pipes and redirection, but I don't see...
22,312,983
5
0
null
2012-08-17 12:10:10.357 UTC
9
2020-04-05 20:11:43.66 UTC
2016-11-08 18:11:40.51 UTC
null
832,230
null
1,382,299
null
1
18
unix|rpm|yum
43,883
<h2>Using <code>yum</code></h2> <p>List and remove the indicated packages and all their dependencies, but with a <code>y/N</code> confirmation:</p> <pre><code>yum remove 'php*' </code></pre> <p>To bypass the confirmation, replace <code>yum</code> with <code>yum -y</code>.</p> <h2>Using <code>rpm</code></h2> <p>Thi...
11,555,418
why is the enhanced for loop more efficient than the normal for loop
<p>I read that the <em>enhanced for loop</em> is more efficient than the normal <em>for loop</em> here:</p> <p><a href="http://developer.android.com/guide/practices/performance.html#foreach" rel="noreferrer">http://developer.android.com/guide/practices/performance.html#foreach</a></p> <p>When I searched for the diffe...
11,555,489
7
6
null
2012-07-19 06:54:51.793 UTC
18
2018-02-11 13:17:29.397 UTC
2018-02-11 13:17:29.397 UTC
null
312,172
null
1,457,863
null
1
32
java|for-loop|foreach
40,391
<p>It's a bit of an oversimplification to say that the enhanced for loop is more efficient. It <em>can</em> be, but in many cases it's almost exactly the same as an old-school loop.</p> <p>The first thing to note is that for collections the enhanced for loop uses an <code>Iterator</code>, so if you manually iterate ov...
19,958,667
Stray start tag script
<p>I'm trying to get a tooltip from <a href="http://www.wowhead.com/hearthstone/tooltips">http://www.wowhead.com/hearthstone/tooltips</a> to work on my site but it doesn't work so I tried the W3C validator for answers and I got the following error:</p> <p>Error Line 88, Column 84: <strong>Stray start tag script</stron...
19,958,777
1
4
null
2013-11-13 16:08:12.193 UTC
5
2021-07-04 08:39:33.123 UTC
2014-08-08 15:23:35.733 UTC
null
50,447
null
2,988,514
null
1
49
javascript|html
47,832
<p>Validator gives that error when you've something outside <code>&lt;/body&gt;</code>.</p> <p>Just move your script tags inside <code>&lt;body&gt;</code>, or keep them in <code>&lt;head&gt;</code>. </p>
20,198,696
CORS request with IE11
<p>I have a CORS (cross origin resource sharing) request coming from my login page to the application site, on a different URL. I have a simple page I ping to determine if a user is already logged in, and if so, redirects them. Otherwise I show a login page. I use jQuery.</p> <p>This works great in safari, chrome, fir...
21,682,899
6
8
null
2013-11-25 16:54:33.43 UTC
11
2018-10-01 07:30:44.28 UTC
2013-11-25 19:32:05.687 UTC
null
980,857
null
980,857
null
1
26
jquery|cors|internet-explorer-11
83,015
<p>Changing the setting for "Access data sources across domains" to Enabled turns off cross-domain checks in IE and is horrifically unsafe. Instead, you need to ensure that the target 3rd-party resource sends a <a href="http://blogs.msdn.com/b/ieinternals/archive/2013/09/17/simple-introduction-to-p3p-cookie-blocking-fr...
3,898,750
installing MySQLdb for Python 2.6 on OSX
<p>I am trying to install MySQLdb for Python 2.6 as per these instructions:</p> <p><a href="http://www.tutorialspoint.com/python/python_database_access.htm" rel="noreferrer">http://www.tutorialspoint.com/python/python_database_access.htm</a></p> <p>When I get to this step: <code>$ python setup.py build</code> I get t...
3,898,766
4
0
null
2010-10-10 02:23:43.373 UTC
9
2016-08-22 05:30:07.047 UTC
2012-09-10 15:52:02.153 UTC
null
388,916
null
109,859
null
1
17
python|mysql|macos
20,053
<p>It's not looking for 'mysql', it's looking for 'mysql_config'. Try running 'which mysql_config' from bash. It probably won't be found. That's why the build isn't finding it either. Try running 'locate mysql_config' and see if anything comes back. The path to this binary needs to be either in your shell's $PATH envir...
3,942,880
Hibernate - AnnotationConfiguration deprecated
<p>I am using Hibernate in version 3.6.0 and the AnnotationConfiguration is marked as deprecated.</p> <p>Here is the the line in my HibernateUtil.java class:</p> <pre><code>sessionFactory = new AnnotationConfiguration().configure("/hib.cfg.xml").buildSessionFactory(); </code></pre> <p>What's the replacement for Anno...
3,942,913
4
0
null
2010-10-15 13:56:17.603 UTC
5
2017-12-01 12:05:08.177 UTC
2017-12-01 12:05:08.177 UTC
null
3,885,376
null
224,030
null
1
37
hibernate|annotations|deprecated
58,376
<p>"All functionality has been moved to Configuration": <a href="http://docs.jboss.org/hibernate/core/3.6/javadocs/org/hibernate/cfg/AnnotationConfiguration.html" rel="noreferrer">http://docs.jboss.org/hibernate/core/3.6/javadocs/org/hibernate/cfg/AnnotationConfiguration.html</a></p> <p>And here is Configuration:</p> ...
3,998,786
change list display link in django admin
<p>I am trying to change the link for an object in the django admin list display. Here is what I have so far:</p> <pre><code>class FooModelAdmin(admin.ModelAdmin): fields = ('foo','bar') list_display = ('foo_link','bar') def foo_link(self,obj): return u'&lt;a href="/foos/%s/"&gt;%s&lt;/a&gt;' % (o...
3,999,436
6
0
null
2010-10-22 16:14:26.2 UTC
9
2020-10-26 08:31:45.817 UTC
2010-10-22 17:34:39.71 UTC
null
95,472
null
95,472
null
1
28
django|django-admin|modeladmin
25,713
<p>The solution was to override the init and set the list_display_links to None e.g. </p> <pre><code>class FooModelAdmin(admin.ModelAdmin): fields = ('foo','bar') list_display = ('foo_link','bar') def foo_link(self,obj): return u'&lt;a href="/foos/%s/"&gt;%s&lt;/a&gt;' % (obj.foo,obj) foo_link...
3,458,461
Find file then cd to that directory in Linux
<p>In a shell script how would I find a file by a particular name and then navigate to that directory to do further operations on it?</p> <p>From here I am going to copy the file across to another directory (but I can do that already just adding it in for context.)</p>
3,458,564
11
0
null
2010-08-11 12:57:13.58 UTC
12
2019-12-28 11:04:02.663 UTC
2015-06-08 15:18:01.573 UTC
null
4,342,498
null
400,309
null
1
28
linux|shell|filesystems
34,155
<p>You can use something like:</p> <pre><code>pax[/home/pax]&gt; cd "$(dirname "$(find / -type f -name ls | head -1)")" pax[/usr/bin]&gt; _ </code></pre> <p>This will locate the first <code>ls</code> regular file then change to that directory.</p> <p>In terms of what each bit does:</p> <ul> <li>The find will start ...
3,565,368
Ternary operator ?: vs if...else
<p>In C++, is the ?: operator faster than if()...else statements? Are there any differences between them in compiled code?</p>
3,565,374
14
5
null
2010-08-25 11:34:12.937 UTC
21
2022-07-21 18:03:32.74 UTC
2015-11-03 06:28:11.823 UTC
null
15,727
null
427,135
null
1
89
c++|performance|conditional-operator
120,915
<p>Depends on your compiler, but on any modern compiler there is generally no difference. It's something you shouldn't worry about. Concentrate on the maintainability of your code.</p>
3,730,019
Why not use Double or Float to represent currency?
<p>I've always been told <em>never</em> to represent money with <code>double</code> or <code>float</code> types, and this time I pose the question to you: why? </p> <p>I'm sure there is a very good reason, I simply do not know what it is.</p>
3,730,040
16
5
null
2010-09-16 19:23:57.087 UTC
493
2022-08-09 06:25:04.86 UTC
2019-08-17 01:29:32.43 UTC
null
207,421
null
439,836
null
1
1,157
floating-point|currency
377,782
<p>Because floats and doubles cannot accurately represent the base 10 multiples that we use for money. This issue isn't just for Java, it's for any programming language that uses base 2 floating-point types.</p> <p>In base 10, you can write 10.25 as 1025 * 10<sup>-2</sup> (an integer times a power of 10). <a href="http...
3,429,959
Why is Eclipse's Android Device Chooser not showing my Android device?
<p>I am using the Android plugin for Eclipse, and when I try to run my program using a real device through the <em>Android Device Chooser</em>, my phone is not listed as a device. I have updated Eclipse, all of the Android packages, and the USB driver, but it still isn't showing up. My phone is running Android 2.1, whi...
3,470,439
19
3
null
2010-08-07 09:45:17.107 UTC
42
2015-07-23 12:34:10.577 UTC
2012-12-02 13:22:36.473 UTC
null
356,895
null
412,168
null
1
87
android|eclipse|adb
95,002
<p>I just had the same issue with the Motorola Droid. I had 3 devices and only 1 was detected in the ADB. The one that worked showed up in device manager as "android adb composite interface" and the 2 that did not work showed up as "android adb interface". In Windows 7 I did the following.</p> <ol> <li>Right Click Com...
7,716,004
Will Dart support the use of existing JavaScript libraries?
<p>I understand Dart compiles to JavaScript, and I read the <a href="http://www.dartlang.org/docs/spec/dartLangSpec.pdf" rel="noreferrer">Dart Language Spec</a> on Libraries, although I didn't see an answer there. Also a search on their <a href="https://groups.google.com/a/dartlang.org/group/misc/search?group=misc%C3%...
8,753,738
4
1
null
2011-10-10 16:44:52.887 UTC
21
2018-12-12 09:57:25.86 UTC
2011-10-18 22:10:43.32 UTC
null
213,269
null
298,240
null
1
111
javascript|libraries|dart
15,899
<p>The answer is now Yes! Dart now ships a JS-interop library to use existing JavaScript code with your Dart app. Learn more here: <a href="https://www.dartlang.org/articles/js-dart-interop/" rel="noreferrer">https://www.dartlang.org/articles/js-dart-interop/</a></p>
8,149,364
Android: Button click event
<p>I have 2 buttons in my xml file with RelativeLayout. In my class I have extended Dialog &amp; implemetned OnClickListener and also added OnClick(View v) method. But somehow the onClick code is never executed when the button is clicked. Can anyone help me find the problem with my code :</p> <pre><code>&lt;?xml versi...
8,151,780
8
1
null
2011-11-16 09:28:59.123 UTC
3
2014-11-15 05:56:32.99 UTC
2011-11-16 10:25:01.42 UTC
null
455,979
null
455,979
null
1
13
android|button|click|onclick
100,068
<p>Solution to my Problem :</p> <p>Instead of using AlertBuilder and AlertDialog, I just called the dialog as :</p> <pre><code> SettingDialog sd = new SettingDialog(this, mySettings); sd.show(); </code></pre> <p>And this worked well. All click events were handled within SettingDialog only. No changes were to be m...
8,007,108
Java Sorting based on Enum constants
<p>We have an enum </p> <pre><code>enum listE { LE1, LE4, LE2, LE3 } </code></pre> <p>Furthermore, we have a list that contains the strings <code>["LE1","LE2","LE3","LE4"]</code>. Is there a way to sort the list based on the enum defined order (not the natural <code>String</code> order).</p> <p>The s...
8,007,155
11
0
null
2011-11-04 09:23:48.707 UTC
11
2020-12-02 20:52:27.603 UTC
2017-07-20 17:39:47.787 UTC
null
3,745,896
null
227,100
null
1
61
java|sorting|enums
103,976
<p><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Enum.html" rel="noreferrer"><code>Enum&lt;E&gt;</code></a> implements <code>Comparable&lt;E&gt;</code> via the natural order of the enum (the order in which the values are declared). If you just create a list of the enum values (instead of strings) via ...
4,495,796
How much performance do you get out a Heroku dynos/workers?
<p>How much traffic can a site with 1 or 2 Dynos handle on <a href="http://heroku.com" rel="noreferrer">www.Heroku.com</a> and would increasing workers improve this? Any help on dynos/workers would be appreciated. </p>
4,495,871
3
0
null
2010-12-21 02:24:42.053 UTC
16
2013-05-08 15:16:47.43 UTC
null
null
null
null
444,021
null
1
37
ruby-on-rails|ruby|heroku|ruby-on-rails-3
10,257
<p>This <a href="http://benscheirman.com/2010/08/load-testing-our-heroku-app" rel="noreferrer">blog entry</a> may be of use. He does a great breakdown of the kind of bottlenecks heroku can run into, and how increasing dynos can help, and provides links and information to the <a href="https://devcenter.heroku.com/artic...
4,239,941
Difference between URL and URI?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/176264/whats-the-difference-between-a-uri-and-a-url">What&#39;s the difference between a URI and a URL?</a> </p> </blockquote> <p>Just to get it right:</p> <p>URI = Tells you in which hotel you should go to sl...
4,239,952
3
2
null
2010-11-21 19:44:11.503 UTC
10
2010-11-21 19:49:27.563 UTC
2017-05-23 12:18:01.347 UTC
null
-1
null
472,300
null
1
42
url|uri
67,785
<p>URI: Uniform Resource Identifier (URI) is a string of characters used to identify a name or a resource on the Internet. Such identification enables interaction with representations of the resource over a network (typically the World Wide Web) using specific protocols</p> <p>URL: In computing, a Uniform Resource Loc...
4,237,394
ASP.NET MVC 3 using Authentication
<p>How can I save something using FormsAuthentication? I don't want to store UserId through URL's.</p> <p>For example, now I have this code:</p> <pre><code>//UserController class: [HttpPost] public ActionResult LogOn(LogOnModel model, string returnUrl) { if (ModelState.IsValid) { if (repository.ValidateUser(model.Log...
4,692,843
4
0
null
2010-11-21 10:31:43.72 UTC
29
2012-04-23 19:07:56.963 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
513,723
null
1
22
authentication|asp.net-mvc-3
31,750
<p>Save the UserID in the UserData property of the FormsAuthentication ticket in the authorization cookie when the user logs on:</p> <pre><code>string userData = userID.ToString(); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, user.Email, DateTime.Now, DateTime.Now.AddMinutes(FormsAuthentica...
4,597,893
Specifically, how does fork() handle dynamically allocated memory from malloc() in Linux?
<p>I have a program with a parent and a child process. Before the fork(), the parent process called malloc() and filled in an array with some data. After the fork(), the child needs that data. I know that I could use a pipe, but the following code appears to work:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt...
4,597,931
4
0
null
2011-01-04 20:06:14.713 UTC
9
2021-08-18 18:21:42.943 UTC
2021-08-18 18:21:42.943 UTC
null
5,459,839
null
394,336
null
1
41
c|linux|malloc|fork|heap-memory
25,157
<p>Each page that is allocated for the process (be it a virtual memory page that has the stack on it or the heap) is copied for the forked process to be able to access it.</p> <p>Actually, it is not copied right at the start, it is set to Copy-on-Write, meaning once one of the processes (parent or child) try to modify...
4,145,605
std::vector needs to have dll-interface to be used by clients of class 'X<T> warning
<p>I'm trying to make my library exportable as a DLL but I'm getting a lot of these warnings for one specific class that uses std::vector:</p> <pre><code>template &lt;typename T&gt; class AGUI_CORE_DECLSPEC AguiEvent { typedef void (*AguiCallbackFptr)(T arg, AguiWidget* sender); std::vector&lt;AguiCallbackFptr&gt;...
4,145,722
4
1
null
2010-11-10 14:41:52.477 UTC
8
2018-05-01 11:05:46.35 UTC
null
null
null
null
146,780
null
1
62
c++|dll
68,848
<p>Exporting from a DLL is platform-specific. You will have to <a href="https://jeffpar.github.io/kbarchive/kb/168/Q168958/" rel="noreferrer">fix this for Windows</a> (basically use <code>declspec(dllexport/dllimport)</code> on the instantiated class template) and encapsulate the required code in your Windows-specific ...
4,397,755
MySQL: Curdate() vs Now()
<p>What is difference between MySQL <code>Curdate()</code> and <code>Now()</code>?</p>
4,397,776
4
0
null
2010-12-09 11:36:41.947 UTC
13
2017-10-31 10:50:09.333 UTC
2015-10-03 10:52:35.867 UTC
null
4,519,059
user529649
null
null
1
85
mysql|sql|datetime
119,975
<p>For questions like this, it is always worth taking a look in the manual first. <a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html" rel="noreferrer">Date and time functions in the mySQL manual</a></p> <p><code>CURDATE()</code> returns the DATE part of the current time. <a href="http://dev.m...
4,490,981
hibernate table does not exist error
<p>In configuration hibernate.cfg.xml, i add <code>&lt;property name="hibernate.hbm2ddl.auto"&gt;create&lt;/property&gt;</code> Hibernate do create table automatically when i run the application. However, i remove the table from database manually by running drop table sql. Then run the hibernate application again. Th...
4,491,322
10
2
null
2010-12-20 15:18:39.743 UTC
2
2020-09-23 05:25:46.8 UTC
2010-12-20 15:42:39.89 UTC
null
380,690
null
380,690
null
1
18
hibernate
43,426
<p>I don't believe using <code>create</code> will update an in-place schema to re-add the table that you dropped. Try:</p> <pre><code>&lt;property name="hibernate.hbm2ddl.auto"&gt;update&lt;/property&gt; </code></pre> <p>This is create a schema if one doesn't exist, and attempt to modify an existing one to match the ...
14,763,363
How to create equal height columns in pure CSS
<p>How to get your div to reach all the way down? How to fill up the vertical space of parent div? How to get equal length columns without using background images?</p> <p>I spent a couple days googling and dissecting code to understand how to accomplish equal length columns as easy and efficient as possible. This is t...
14,763,364
2
2
null
2013-02-07 23:51:43.677 UTC
10
2015-05-31 07:51:54.097 UTC
2015-05-31 07:51:54.097 UTC
null
891,052
null
891,052
null
1
13
css|css-float|html|multiple-columns
52,549
<p>One of the tricky things in modern web design is to create a two (or more) column layout where all the columns are of equal height. I set out on a quest to find a way to do this in pure CSS.</p> <p>You can easiest accomplish this by using a background image in a wrap-div that holds both of your columns (or the back...
14,614,512
Merging two tables with millions of rows in Python
<p>I am using Python for some data analysis. I have two tables, the first (let's call it 'A') has 10 million rows and 10 columns and the second ('B') has 73 million rows and 2 columns. They have 1 column with common ids and I want to intersect the two tables based on that column. In particular I want the inner join of ...
14,617,925
1
2
null
2013-01-30 21:51:56.04 UTC
9
2017-07-06 18:22:11.397 UTC
2017-07-06 18:16:47.173 UTC
null
63,550
null
2,027,051
null
1
13
python|join|merge|pandas|pytables
24,448
<p>This is a little pseudo codish, but I think should be quite fast.</p> <p>Straightforward disk based merge, with all tables on disk. The key is that you are not doing selection per se, just indexing into the table via start/stop, which is quite fast.</p> <p>Selecting the rows that meet a criteria in B (using A's id...
14,593,291
Xcode 4.6 zXing compile error after Xcode update (4H127)
<p>Different projects using ZXing have error after last Xcode update:</p> <p>Error messages are:</p> <ol> <li>private field 'cached_y_' is not used</li> <li>Private field 'bits_' is not used</li> <li>Private field 'cached_row_num_' is not used</li> <li>Private field 'dataHeight_' is not used</li> </ol> <p>Any compil...
14,703,794
4
6
null
2013-01-29 22:33:35.937 UTC
9
2013-02-22 07:31:08.73 UTC
2013-02-22 07:31:08.73 UTC
null
762,913
null
148,988
null
1
16
ios|xcode|ios-simulator|zxing|xcode4.6
7,043
<p>Just add this flag</p> <pre><code>-Wno-unused-private-field </code></pre> <p>under ZXingWidget target -> Build Settings -> Other Warning Flags. Click the + button and paste the flag, clean and build again.</p> <p><img src="https://i.stack.imgur.com/dTvXs.png" alt="How to set compiler flags"></p> <p>(No need to r...
14,871,272
Plotting using a CSV file
<p>I have a csv file which has 5 entries on every row. Every entry is whether a network packet is triggered or not. The last entry in every row is the size of packet. Every row = time elapsed in ms.</p> <p>e.g. row </p> <pre><code>1 , 0 , 1 , 2 , 117 </code></pre> <p>How do I plot a graph for e.g. where x axis is th...
14,871,346
2
0
null
2013-02-14 09:12:50.217 UTC
14
2018-07-26 00:02:55.55 UTC
2015-09-08 11:07:45.99 UTC
null
1,799,272
user494461
null
null
1
65
csv|graph|gnuplot
150,833
<p>This should get you started:</p> <pre><code>set datafile separator "," plot 'infile' using 0:1 </code></pre>
2,688,659
How do I create a UIViewController programmatically?
<p>I am working in a app where i have data in <code>UITableView</code>. It is like a drill down application. User will click on a row and will go to next page showing more records in a <code>UITableView</code>. But problem in my case is that i dont know upto how many level user can drill. The number of levels are not f...
2,688,774
2
0
null
2010-04-22 06:32:22.703 UTC
2
2012-05-31 06:40:51.353 UTC
2010-04-22 07:17:56.447 UTC
null
19,410
null
260,056
null
1
21
iphone|uitableview|uiviewcontroller
50,100
<pre><code>UIViewController *controller = [[UIViewController alloc] init]; controller.view = whateverViewYouHave; </code></pre> <p>Do you have your own view controller that you coded? In that case you probably don't need to set the view property as it has been set in IB if that is what you used. When you have your con...
2,632,425
How do I start Maven "compile" goal on save in Eclipse?
<p>I have a Maven project with JavaScript code. There is a special javascript compiler plugin connected to the compile goal in the pom.xml. So when I type "mvn compile" then the JavaScript sources in src/main/javascript are compiled (compressed and obfuscated) and saved into the target/classes directory. On the command...
2,633,133
2
0
null
2010-04-13 19:06:08.923 UTC
15
2015-11-04 13:13:58.093 UTC
2012-12-17 17:18:51.22 UTC
null
5,849
null
274,473
null
1
26
eclipse|maven-2|m2eclipse
57,448
<blockquote> <p>In the project preferences it is possible to configure a lifecycle mapping. But for some reason I can only add custom goals to "after clean" and "on resource changed". When I add the "compile" goal to the "resource changed" lifecycle mapping, then the JavaScript files are compiled when I change a reso...
2,847,575
How-To Integrate IIS 7 Web Deploy with MSBuild (TeamCity)
<p>How-To Integrate IIS 7 Web Deploy with MSBuild (TeamCity) ?</p>
5,305,223
2
0
null
2010-05-17 08:28:34.69 UTC
32
2019-08-04 16:51:44.363 UTC
null
null
null
null
50,974
null
1
41
.net|msbuild|teamcity
16,930
<p>Troy Hunt has an excellent <a href="http://www.troyhunt.com/2010/11/you-deploying-it-wrong-teamcity.html" rel="noreferrer">5-part blog series</a> that goes over this topic in detail.</p> <p>He has effectively compiled all of the other resources out there and turned them into a tutorial.</p> <p>It's the clearest (a...
2,812,622
Get Google Chrome's root bookmarks folder
<p>I'm trying to write a better bookmark manager in Chrome extensions. The problem is that there are no simple examples (that I can find) about how to actually use the <a href="https://developer.chrome.com/extensions/bookmarks" rel="noreferrer"><code>bookmarks</code> API</a>.</p> <p>I've looked at the example source (...
2,815,066
3
0
null
2010-05-11 16:42:51.537 UTC
12
2016-03-19 22:32:43.043 UTC
2016-03-19 22:32:43.043 UTC
null
934,239
null
344,286
null
1
9
javascript|google-chrome|google-chrome-extension|bookmarks
15,687
<p>Currently, there is no good way to find folders such as "Other Bookmarks" or "Bookmarks Bar" in the bookmarks API. You would have to iterate through all the bookmarks and find which node has those root folders and save its bookmark id. The bug is filed <a href="http://code.google.com/p/chromium/issues/detail?id=2133...
31,515,776
How can I catch UniqueKey Violation exceptions with EF6 and SQL Server?
<p>One of my tables have a unique key and when I try to insert a duplicate record it throws an exception as expected. But I need to distinguish unique key exceptions from others, so that I can customize the error message for unique key constraint violations.</p> <p>All the solutions I've found online suggests to cast ...
31,516,402
8
0
null
2015-07-20 11:50:30.763 UTC
19
2021-09-11 09:19:44.823 UTC
null
null
null
null
1,412,786
null
1
71
c#|sql-server|exception-handling|entity-framework-6|unique-key
72,813
<p>With EF6 and the <code>DbContext</code> API (for SQL Server), I'm currently using this piece of code:</p> <pre><code>try { // Some DB access } catch (Exception ex) { HandleException(ex); } public virtual void HandleException(Exception exception) { if (exception is DbUpdateConcurrencyException concurrencyEx) ...
49,900,629
Django serializer inherit and extend fields
<p>I have these 2 serializers:</p> <pre><code>class BasicSerializer(serializers.ModelSerializer): class Meta: model = MyModel fields = ('lengthy', 'touple', 'of', \ 'fields', 'like', '10', 'of', 'them') class AdvandedSerializer(BasicSerializer): additional_field = serializers.S...
49,901,198
2
0
null
2018-04-18 13:11:37.04 UTC
9
2018-04-18 13:42:06.62 UTC
null
null
null
null
4,507,367
null
1
53
django
18,802
<p>You can do:</p> <pre><code>class BasicSerializer(serializers.ModelSerializer): class Meta: model = MyModel fields = ('lengthy', 'touple', 'of', 'fields', 'like', '10', 'of', 'them') class AdvandedSerializer(BasicSerializer): additional_field = serializers.SerializerMethodField() def ...
42,821,330
Restore original text from Keras’s imdb dataset
<p>Restore original text from Keras’s imdb dataset</p> <p>I want to restore imdb’s original text from Keras’s imdb dataset.</p> <p>First, when I load Keras’s imdb dataset, it returned sequence of word index.</p> <p> <pre><code>&gt;&gt;&gt; (X_train, y_train), (X_test, y_test) = imdb.load_data() &gt;&gt;&gt; X_train...
44,891,281
9
0
null
2017-03-15 21:49:19.953 UTC
7
2021-03-13 22:24:13.21 UTC
2017-07-12 08:30:30.7 UTC
null
5,974,433
null
7,233,229
null
1
40
python|machine-learning|neural-network|nlp|keras
15,113
<p>Your example is coming out as gibberish, it's much worse than just some missing stop words.</p> <p>If you re-read the docs for the <code>start_char</code>, <code>oov_char</code>, and <code>index_from</code> parameters of the [<code>keras.datasets.imdb.load_data</code>](<a href="https://keras.io/datasets/#imdb-movie...
27,389,954
How to re-send external tester invitations on Apple's TestFlight service
<p>Is there a way to re-send an invitation to an external tester on Apple's TestFlight Beta Testing service?</p> <p>(I am referring to facility for external beta testing accessed via iTunes Connect, not to the standalone TestFlight service that has been provided since before Apple acquired it.)</p> <p>Within iTunes C...
27,390,153
5
0
null
2014-12-09 22:20:13.19 UTC
18
2017-04-29 13:01:30.663 UTC
null
null
null
null
577,888
null
1
101
ios|app-store-connect|testflight
66,928
<p>Try removing the tester and re-adding them:</p> <p>Click the 'edit' button at to top-right of the testers table, and remove the tester:</p> <p><img src="https://i.stack.imgur.com/1Goto.png" alt="enter image description here"></p> <p>Then add them back. This should resend the invite email.</p> <p>// UPDATE: The i...
39,156,293
Jackson deserialize extra fields as Map
<p>I'm looking to deserialize any unknown fields in a JSON object as entries in a <code>Map</code> which is a member of a POJO.</p> <p>For example, here is the JSON:</p> <pre><code>{ &quot;knownField&quot; : 5, &quot;unknownField1&quot; : &quot;926f7c2f-1ae2-426b-9f36-4ba042334b68&quot;, &quot;unknownField2&quot;...
40,926,692
1
0
null
2016-08-25 23:35:56.98 UTC
8
2021-01-30 18:52:27.073 UTC
2021-01-30 18:52:27.073 UTC
null
294,317
null
2,133,111
null
1
45
java|json|jackson|deserialization
14,903
<p>There is a feature and an annotation exactly fitting this purpose. </p> <p>I tested and it works with UUIDs like in your example:</p> <pre><code>class MyUUIDClass { public int knownField; Map&lt;String, UUID&gt; unknownFields = new HashMap&lt;&gt;(); // Capture all other fields that Jackson do not ma...
2,692,048
What are the differences between plug-ins, features, and products in Eclipse RCP?
<p>What are the differences? What gets used for which purpose?</p>
2,692,822
1
0
null
2010-04-22 15:14:11.093 UTC
32
2019-11-01 17:59:04.7 UTC
2013-11-06 15:56:04.56 UTC
null
2,282,562
null
66,686
null
1
79
eclipse|plugins|rcp|product
32,756
<p>As the <strong><a href="http://www.vogella.com/articles/EclipseRCP/article.html" rel="noreferrer">RCP tutorial</a></strong> details</p> <blockquote> <p>Plugins are the smallest deployable and installable software components of Eclipse.</p> <p>Each plugin can define extension-points which define possibilities for fun...
50,764,572
How can I test a .tflite model to prove that it behaves as the original model using the same Test Data?
<p>I have generated a .tflite model based on a trained model, I would like to test that the tfilte model gives the same results as the original model.</p> <p>Giving both the same test data and obtaining the same result.</p>
51,987,281
3
0
null
2018-06-08 16:08:34.517 UTC
7
2020-06-12 22:22:13.003 UTC
2018-06-08 20:13:44.93 UTC
null
606,314
null
9,899,807
null
1
30
python|tensorflow|tensorflow-lite
28,989
<p>You may use <strong><em>TensorFlow Lite Python interpreter</em></strong> to test your tflite model. </p> <p>It allows you to feed input data in python shell and read the output directly like you are just using a normal tensorflow model. </p> <p>I have answered this question <a href="https://stackoverflow.com/a/5...
42,029,347
Position a SceneKit object in front of SCNCamera's current orientation
<p>I would like to create a new SceneKit node when the user taps the screen, and have it appear directly in front of the camera at a set distance. For testing, this will be a SCNText reads reads "you tapped here". It should also be at right angles to the line of sight - that is, "face on" to the camera.</p> <p>So, giv...
50,657,180
5
0
null
2017-02-03 17:02:17.593 UTC
18
2021-06-16 01:14:18.283 UTC
2017-05-23 12:10:05.507 UTC
null
-1
null
1,469,457
null
1
18
swift3|scenekit
26,176
<p><strong>(Swift 4)</strong></p> <p>Hey, you can use this simpler function if you want to put the object a certain position relative to another node (e.g. the camera node) and also in the same orientation as the reference node:</p> <pre><code>func updatePositionAndOrientationOf(_ node: SCNNode, withPosition position: ...
24,753,893
How to set editor theme in IntelliJ Idea
<p>I'm trying to change the editor color schemes in IntelliJ Idea 13.1.3 community edition to a darker theme. I downloaded a theme from a website [Editor's note: the website has since been replaced with spam, and has been edited out] and imported settings through <code>File-&gt;Import Settings...</code>. The jar import...
24,765,954
6
0
null
2014-07-15 08:57:04.51 UTC
5
2021-01-30 10:19:20.307 UTC
2021-01-30 10:19:01.053 UTC
null
6,296,561
null
3,836,923
null
1
75
intellij-idea|themes|editor
143,386
<p>OK I found the problem, I was checking in the wrong place which is for the whole IDE's look and feel at <code>File-&gt;Settings-&gt;Appearance</code></p> <p>The correct place to change the editor appearance is through <code>File-&gt;Settings-&gt;Editor-&gt;Colors &amp;Fonts</code> and then choose the scheme there. T...
24,873,485
Using onBlur with JSX and React
<p>I am trying to create a password confirmation feature that renders an error only after a user leaves the confirmation field. I'm working with Facebook's React JS. This is my input component:</p> <pre><code>&lt;input type="password" placeholder="Password (confirm)" valueLink={this.linkState('password2')}...
24,874,979
1
0
null
2014-07-21 19:50:31.223 UTC
6
2016-02-08 03:19:48.857 UTC
2016-02-08 03:19:48.857 UTC
null
1,434,116
null
3,862,066
null
1
42
html|reactive-programming|reactjs|onblur
153,449
<p>There are a few problems here.</p> <p>1: onBlur expects a callback, and you are calling <code>renderPasswordConfirmError</code> and using the return value, which is null.</p> <p>2: you need a place to render the error.</p> <p>3: you need a flag to track "and I validating", which you would set to true on blur. You...
23,795,926
Share sessions between php and node
<p>Is there an recent guide (or example code) to using node, express, and redis/predis to share PHPSESSID?</p> <p>I've found several tutorials 1-2 years old and they are all either using old versions express or not using express.</p> <p>Express cookie parser is also deprecated.</p> <p><a href="https://simplapi.wordp...
23,796,095
2
0
null
2014-05-22 00:22:08.56 UTC
8
2019-08-26 16:46:15.563 UTC
2017-05-23 10:30:49.21 UTC
null
-1
null
1,156,785
null
1
2
node.js|express|redis|session-cookies
10,788
<p><strong>For node (and Express 4.x):</strong></p> <p>Start with the example from <a href="https://github.com/expressjs/session" rel="noreferrer">express-session</a>, but use <a href="https://github.com/visionmedia/connect-redis" rel="noreferrer">connect-redis</a> as your session store instead.</p> <p>Example code:<...
56,892,691
How to show HTML or Markdown in a SwiftUI Text?
<p>How can I set a SwiftUI <code>Text</code> to display rendered HTML or Markdown?</p> <p>Something like this: </p> <pre><code>Text(HtmlRenderedString(fromString: "&lt;b&gt;Hi!&lt;/b&gt;")) </code></pre> <p>or for MD: </p> <pre><code>Text(MarkdownRenderedString(fromString: "**Bold**")) </code></pre> <p>Perhaps I...
56,895,086
9
0
null
2019-07-04 18:09:47.677 UTC
10
2022-09-05 03:42:11.203 UTC
2019-07-05 11:02:47.523 UTC
null
11,636,607
null
11,636,607
null
1
30
html|swift|text|markdown|swiftui
22,204
<p><code>Text</code> can just display <code>String</code>s. You can use a <code>UIViewRepresentable</code> with an <code>UILabel</code> and <code>attributedText</code>.</p> <p>Probably attributedText text support will come later for <code>SwiftUI.Text</code>.</p>
49,652,453
Is it possible to emulate the notch from the Huawei P20 with Android Studio
<p>Huawei's P20 has an iPhone X like notch on the top of the screen. Can this "notch" be emulated in Android Studio so it is possible to test how an app is rendered on it without owning a P20? I looked in the settings and it is possible to select a "skin" in the Hardware profile but Huawei's P20 is not part of it.</p>
52,872,669
4
0
null
2018-04-04 13:35:33.36 UTC
6
2020-10-14 17:08:38.93 UTC
null
null
null
null
2,652,054
null
1
44
android|android-studio
24,572
<p>Follow the screen shots.</p> <p><strong>first make sure 9.0 (api 28) run in your Emulater or testing device.</strong></p> <ol> <li>Open System settings.</li> </ol> <p><a href="https://i.stack.imgur.com/WPVQg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WPVQg.png" alt="enter image description here" /></a...
38,777,701
"ISO C++ forbids forward references to 'enum' types" when specifying enum underlying type
<p>Given the program:</p> <pre><code>enum E : int { A, B, C }; </code></pre> <p><code>g++ -c test.cpp</code> works just fine. However, <code>clang++ -c test.cpp</code> gives the following errors:</p> <pre><code>test.cpp:1:6: error: ISO C++ forbids forward references to 'enum' types enum E : int ^ test.cpp:1:8:...
38,777,702
1
7
null
2016-08-04 21:29:39.16 UTC
4
2022-08-09 20:20:15.077 UTC
2022-07-23 05:52:56.273 UTC
null
21,501
null
21,501
null
1
38
c++|clang
19,934
<p>Specifying the underlying type for an enum is a C++11 language feature. To get the code to compile, you must add the switch <code>-std=c++11</code>. This works for both GCC and Clang.</p> <p>For enums in C++03, the underlying integral type is implementation-defined, unless the values of the enumerator cannot fit in...
7,177,004
adding two arraylists into one
<p>I want to check branchList whether has same element or not, if same put branchList and tglList element separate arraylist and put that arraylist into another arraylist, </p> <p>The result I want is BranchList1 have 2 arraylist where 1st arraylist contain for element '1' and 2nd arraylist contain element '2' and Tgl...
7,177,220
1
5
null
2011-08-24 14:18:59.96 UTC
3
2017-11-13 05:31:23.967 UTC
2017-11-13 05:31:23.967 UTC
null
1,009,479
null
438,159
null
1
12
java|arraylist
60,364
<p>I didn't thoroughly read through your code (and I don't quite get what you're asking for), but if you want to merge (add the elements of) <code>branchList</code> and <code>tglList</code> to <code>TglList1</code>, try this:</p> <pre><code>TglList1.addAll(branchList); TglList1.addAll(tglList); </code></pre> <p>After...
7,139,466
Get difference of arrays in Ruby
<blockquote> <p><strong>Possible Duplicate:</strong><br /> <a href="https://stackoverflow.com/questions/80091/diff-a-ruby-string-or-array">diff a ruby string or array</a></p> </blockquote> <p>I have an old array: <code>[1, 2, 3, 4, 5]</code>, and new: <code>[1, 2, 4, 6]</code></p> <p>How to get difference with Ruby: t...
7,139,479
1
0
null
2011-08-21 16:17:48.377 UTC
5
2020-11-13 16:12:10.083 UTC
2020-11-13 16:12:10.083 UTC
null
967,621
null
531,272
null
1
50
arrays|ruby
38,476
<pre><code>irb(main):001:0&gt; a = [1, 2, 3, 4, 5] =&gt; [1, 2, 3, 4, 5] irb(main):002:0&gt; b = [1, 2, 4, 6] =&gt; [1, 2, 4, 6] irb(main):003:0&gt; a - b =&gt; [3, 5] irb(main):005:0&gt; b - a =&gt; [6] irb(main):006:0&gt; </code></pre>
22,663,484
get "ERROR: Can't get master address from ZooKeeper; znode data == null" when using Hbase shell
<p>I installed Hadoop2.2.0 and Hbase0.98.0 and here is what I do :</p> <pre><code>$ ./bin/start-hbase.sh $ ./bin/hbase shell 2.0.0-p353 :001 &gt; list </code></pre> <p>then I got this:</p> <pre><code>ERROR: Can't get master address from ZooKeeper; znode data == null </code></pre> <p>Why am I getting this error ?...
22,670,992
8
0
null
2014-03-26 14:06:06.527 UTC
6
2019-04-07 07:29:45.167 UTC
2014-06-30 08:34:28.67 UTC
null
2,376,945
null
3,463,279
null
1
14
shell|hadoop|hbase
61,918
<p>If you just want to run HBase without going into Zookeeper management for standalone HBase, then remove all the <code>property</code> blocks from <code>hbase-site.xml</code> except the property block named <code>hbase.rootdir</code>. </p> <p>Now run <code>/bin/start-hbase.sh</code>. HBase comes with its own Zookeep...
39,168,390
Use ItExpr.IsNull<TValue> rather than a null argument value, as it prevents proper method lookup
<p>I am trying to write a unit test where I need to set up a protected method. I am using Moq for this setup.</p> <pre><code>_innerHandler.Protected() .Setup&lt;Task&lt;HttpResponseMessage&gt;&gt;("SendAsync", It.IsAny&lt;HttpRequestMessage&gt;(), It.IsAny&lt;CancellationToken&gt;()) .Returns...
39,169,044
1
0
null
2016-08-26 14:14:20.313 UTC
null
2016-08-26 14:50:46.033 UTC
2016-08-26 14:50:46.033 UTC
null
5,233,410
null
2,546,997
null
1
38
c#|unit-testing|moq
5,342
<p>When setting up an <code>IProtectedMock</code>, you should use <code>Moq.Protected.ItExpr</code> instead of <code>Moq.It</code>.</p> <p>Here is the corrected implementation of what I was trying to do in my question:</p> <pre><code>_innerHandler.Protected() .Setup&lt;Task&lt;HttpResponseMessage&gt;&gt;...
49,832,787
LiveData prevent receive the last value when start observing
<p>Is it possible to prevent <code>LiveData</code> receive the last value when start observing? I am considering to use <code>LiveData</code> as events.</p> <p>For example events like show message, a navigation event or a dialog trigger, similar to <code>EventBus</code>.</p> <p>The problem related to communication be...
55,212,795
14
7
null
2018-04-14 14:56:33.353 UTC
17
2022-03-23 01:17:21.65 UTC
2021-01-02 18:06:15.203 UTC
null
5,827,565
null
5,827,565
null
1
52
android|android-livedata|android-architecture-components|android-viewmodel|mutablelivedata
61,563
<p>I`m using this EventWraper class from Google Samples inside MutableLiveData</p> <pre><code>/** * Used as a wrapper for data that is exposed via a LiveData that represents an event. */ public class Event&lt;T&gt; { private T mContent; private boolean hasBeenHandled = false; public Event( T content) ...
3,186,333
What is the benefit of using NginX for Node.js?
<p>From what I understand Node.js doesnt need NginX to work as a http server (or a websockets server or any server for that matter), but I keep reading about how to use NginX instead of Node.js internal server and cant find of a good reason to go that way</p>
3,186,487
3
2
null
2010-07-06 12:57:36.907 UTC
5
2017-05-12 14:33:38.477 UTC
2017-03-06 07:52:00.037 UTC
null
363,217
null
363,217
null
1
29
nginx|node.js
5,534
<p>Here <a href="http://developer.yahoo.com/yui/theater/video.php?v=dahl-node" rel="noreferrer">http://developer.yahoo.com/yui/theater/video.php?v=dahl-node</a> Node.js author says that Node.js is still in development and so there may be security issues that NginX simply hides.<br> On the other hand, in case of a heavy...
2,501,723
CSS "color" vs. "font-color"
<p>Anyone know why CSS provides <code>color</code> for text, but does not have <code>font-color</code> or <code>text-color</code>?</p> <p>Seems very counter-intuitive, kind of like <code>text-decoration: underline</code> rather than <code>font-style</code> or something related to fonts.</p> <p>Does anyone know why/ho...
2,501,800
3
4
null
2010-03-23 16:28:37.727 UTC
21
2019-04-15 23:01:32.573 UTC
2016-02-07 00:10:04.33 UTC
null
3,853,934
null
89,161
null
1
138
css
361,230
<p>I would think that one reason could be that the color is applied to things other than font. For example:</p> <pre><code>div { border: 1px solid; color: red; } </code></pre> <p>Yields both a red font color and a red border.</p> <p>Alternatively, it could just be that the W3C's CSS standards are completely...
924,449
How to create a simple c# http monitor/blocker?
<p>I was reading that question (<a href="https://stackoverflow.com/questions/226784/how-to-create-a-simple-proxy-in-c">How to create a simple proxy in C#?</a>) that is near of my wishes.</p> <p>I simply want develop a c# app that, by example, monitors Firefox, IE, etc and logs all navigated pages. Depending of the vis...
967,782
2
0
null
2009-05-29 04:58:32.487 UTC
10
2017-09-12 08:13:47.917 UTC
2017-05-23 12:01:25.433 UTC
null
-1
null
48,729
null
1
8
c#|http|monitoring|blocking
29,762
<p>I’ll answer appropriate for a parent: ala "Parental Controls"</p> <p>You can start out with a proxy server when the kids are less than about 10 years old. After that, they will figure out how to get around the proxy (or run their own client applications that bypass the proxy). In the early teen years, you can use r...
993,409
Basic HTTP Authentication on iPhone
<p>I'm trying to get a small twitter client running and I ran into a problem when testing API calls that require authentication.</p> <p>My password has special characters in it, so when I try to use the following code it doesn't work.</p> <pre><code>NSString *post = [NSString stringWithFormat:@"status=%@", [status st...
993,421
2
0
null
2009-06-14 18:23:00.923 UTC
23
2014-01-28 05:38:50.05 UTC
2009-06-25 22:54:50.44 UTC
null
52,963
null
59,877
null
1
13
iphone|objective-c|httpwebrequest|http-authentication
19,300
<p>Two things. Firstly you have to use the async methods rather than the synchronous/class method.</p> <pre><code>NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:req] cachePolicy:NSURLRequestUseProtocolCachePolicy ...
1,054,937
Programmatically send to front/back elements created from interface builder
<p>In interface builder, there are layout options to send to back or send to front any elements such as <code>UIButton</code>, <code>UIImage</code>, <code>UILabel</code> etc...</p> <p>Now, I would like to do the same at runtime, programmatically.</p> <p>Is there an easy way to do that?</p> <p>I do not want to create...
1,054,946
2
0
null
2009-06-28 13:27:08.493 UTC
32
2017-08-21 12:46:59.627 UTC
2017-05-28 02:22:46.987 UTC
null
947,934
null
117,330
null
1
84
cocoa-touch|interface-builder|z-axis
78,577
<p>There are a number of methods of <code>UIView</code> that allow you to modify the view hierarchy.</p> <ul> <li><a href="https://developer.apple.com/documentation/uikit/uiview/1622541-bringsubview" rel="noreferrer"><code>bringSubviewToFront:</code></a></li> <li><a href="https://developer.apple.com/documentation/uiki...
2,498,599
Can some hacker steal a web browser cookie from a user and login with that name on a web site?
<p>Reading this question, <a href="https://stackoverflow.com/questions/2448720/different-users-get-the-same-cookie-value-in-aspxanonymous">Different users get the same cookie - value in .ASPXANONYMOUS</a></p> <p>and search for a solution, I start thinking, <strong>if it is possible for some one to really steal the coo...
2,505,406
5
1
null
2010-03-23 09:09:54.57 UTC
23
2019-12-07 16:34:16.763 UTC
2019-12-07 16:34:16.763 UTC
null
1,033,581
null
159,270
null
1
31
asp.net|security|cookies|forms-authentication
29,703
<blockquote> <p>Is it possible to steal a cookie and authenticate as an administrator?</p> </blockquote> <p>Yes it is possible, if the Forms Auth cookie is not encrypted, someone could hack their cookie to give them elevated privileges or if SSL is not require, copy someone another person's cookie. However, there ...
2,778,247
How do I construct a Django reverse/url using query args?
<p>I have URLs like <a href="http://example.com/depict?smiles=CO&amp;width=200&amp;height=200" rel="noreferrer">http://example.com/depict?smiles=CO&amp;width=200&amp;height=200</a> (and with several other optional arguments)</p> <p>My urls.py contains:</p> <pre><code>urlpatterns = patterns('', (r'^$', 'cansmi.ind...
2,778,275
6
1
null
2010-05-06 03:31:05.07 UTC
14
2019-08-29 11:03:12.25 UTC
2014-08-03 00:10:11.963 UTC
null
8,331
null
64,618
null
1
40
django|url|query-string|reverse
44,032
<p>Your regular expresion has no place holders (that's why you are getting NoReverseMatch):</p> <pre><code>url(r'^depict$', cyclops.django.depict, name="cyclops-depict"), </code></pre> <p>You could do it like this:</p> <pre><code>{% url cyclops-depict %}?smiles=CO&amp;width=200&amp;height=200 </code></pre> <p><a hr...
2,699,534
How to convert int* to int
<p>Given a pointer to <code>int</code>, how can I obtain the actual <code>int</code>?</p> <p>I don't know if this is possible or not, but can someone please advise me?</p>
2,699,545
7
2
null
2010-04-23 14:54:47.627 UTC
5
2020-04-13 09:21:40.653 UTC
2015-12-04 11:23:59.23 UTC
null
4,850,040
null
268,247
null
1
22
c++|pointers
66,416
<p>Use the * on pointers to get the variable pointed (dereferencing).</p> <pre><code>int val = 42; int* pVal = &amp;val; int k = *pVal; // k == 42 </code></pre> <p>If your pointer points to an array, then dereferencing will give you the first element of the array.</p> <p>If you want the "value" of the pointer, that...
2,429,045
iFrame src change event detection?
<p>Assuming I have no control over the content in the iframe, is there any way that I can detect a src change in it via the parent page? Some sort of onload maybe?</p> <p>My last resort is to do a 1 second interval test if the iframe src is the same as it was before, but doing this hacky solution would suck.</p> <p>I...
2,429,058
7
2
null
2010-03-11 22:07:46.053 UTC
61
2020-03-20 17:30:21.897 UTC
null
null
null
null
174,621
null
1
230
javascript|jquery|iframe|onload
311,311
<p>You may want to use the <code>onLoad</code> event, as in the following example:</p> <pre><code>&lt;iframe src="http://www.google.com/" onLoad="alert('Test');"&gt;&lt;/iframe&gt; </code></pre> <p>The alert will pop-up whenever the location within the iframe changes. It works in all modern browsers, but may not work...
2,511,315
Method for finding memory leak in large Java heap dumps
<p>I have to find a memory leak in a Java application. I have some experience with this but would like advice on a methodology/strategy for this. Any reference and advice is welcome. </p> <p>About our situation:</p> <ol> <li>Heap dumps are larger than 1 GB</li> <li>We have heap dumps from 5 occasions.</li> <li>We don...
2,511,709
8
6
null
2010-03-24 20:53:27.69 UTC
31
2021-12-14 20:15:15.223 UTC
null
null
null
null
226,174
null
1
35
java|methodology|enterprise|legacy-code|memory-leaks
38,523
<p>It's almost impossible without some understanding of the underlying code. If you understand the underlying code, then you can better sort the wheat from chaff of the zillion bits of information you are getting in your heap dumps.</p> <p>Also, you can't know if something is a leak or not without know why the class is...
2,645,009
binary protocols v. text protocols
<p>does anyone have a good definition for what a binary protocol is? and what is a text protocol actually? how do these compare to each other in terms of bits sent on the wire? </p> <p>here's what wikipedia says about binary protocols:</p> <p>A binary protocol is a protocol which is intended or expected to be read by...
2,645,168
9
1
null
2010-04-15 12:06:07.777 UTC
59
2021-12-12 14:15:53.313 UTC
2018-12-11 17:03:56.453 UTC
null
165,071
null
317,416
null
1
114
text|binary|protocols
49,770
<p>Binary protocol versus text protocol isn't really about how binary blobs are encoded. The difference is really whether the protocol is oriented around data structures or around text strings. Let me give an example: HTTP. HTTP is a text protocol, even though when it sends a jpeg image, it just sends the raw bytes, no...
2,677,431
Where to install Android SDK on Mac OS X?
<p>Where should the Android SDK be installed on Mac OS X?</p>
43,797,501
13
3
null
2010-04-20 17:52:28.453 UTC
47
2021-10-08 14:02:08.14 UTC
2015-02-21 14:09:49.3 UTC
null
16,587
null
82,118
null
1
206
android|configuration|macos
212,028
<p>In <a href="https://brew.sh/" rel="nofollow noreferrer">homebrew</a> the <code>android-sdk</code> has migrated from <code>homebrew/core</code> to <code>homebrew/cask</code>.</p> <pre><code>brew tap homebrew/cask </code></pre> <p>and install <code>android-sdk</code> using</p> <pre><code>brew install android-sdk --cas...
25,340,847
Control the height in fluidRow in R shiny
<p>I am trying to build a layout for a <code>shiny</code> app. I have been looking at the application <a href="http://shiny.rstudio.com/articles/layout-guide.html" rel="noreferrer">layout guide</a> and did some google search but it seems the layout system in shiny has its limits.</p> <p>You can create something like t...
25,341,329
2
0
null
2014-08-16 13:57:19.83 UTC
11
2018-09-08 22:26:39.587 UTC
2015-07-19 10:00:06.66 UTC
null
2,901,002
null
3,947,186
null
1
36
r|layout|shiny
66,686
<p>The height of the rows is responsive and is determined by the height of the elements of the columns. As an example we use two elements in the first row with heights 200 and 100 pixels respectively. The row takes the maximum height of its elements. The second row has elements with heights 100 and 150 pixels respectiv...
10,844,641
How to change the path to php.ini in PHP CLI version
<p>The php that run on the webserver and the CLI version is not using the same php.ini file. If I do a command <code>php --ini</code>, it show this</p> <pre class="lang-none prettyprint-override"><code>Configuration File (php.ini) Path: C:\Windows Loaded Configuration File: C:\wamp\bin\php\php5.3.8\php.ini Sca...
10,844,817
6
0
null
2012-06-01 04:59:24.21 UTC
9
2022-07-21 09:04:30.387 UTC
2012-06-01 05:18:39.827 UTC
user212218
null
null
654,989
null
1
34
command-line-interface|php
64,476
<p>Per <a href="http://php.net/configuration.file" rel="noreferrer">http://php.net/configuration.file</a>:</p> <blockquote> <p>php.ini is searched for in these locations (in order):</p> <ul> <li>SAPI module specific location (PHPIniDir directive in Apache 2, -c command line option in CGI and CLI, php_ini parameter in N...
10,456,044
what is a good invalid IP address to use for unit tests?
<p>I am writing unit tests for a client library. I want to test connecting with an invalid port and an invalid ip. What is a good ip address to use that won't potentially be routed somewhere? I don't want to make any assumptions about the network the machine running the unit tests is on. LOCALHOST seems like a bad choi...
10,456,065
5
0
null
2012-05-04 20:57:05.533 UTC
15
2020-11-05 21:20:43.88 UTC
null
null
null
null
1,195,522
null
1
64
unit-testing|tcp|ip
38,194
<p>According to <a href="https://www.rfc-editor.org/rfc/rfc5737" rel="noreferrer">RFC 5737</a>:</p> <blockquote> <p>The blocks 192.0.2.0/24 (TEST-NET-1), 198.51.100.0/24 (TEST-NET-2), and 203.0.113.0/24 (TEST-NET-3) are provided for use in documentation.</p> </blockquote> <p>This means you can use pick an IP address fr...
5,666,523
iOS: Connect to Facebook without leaving the app for authorization
<p>I know that it was possible before the Graph API.</p> <p>I work on an iPhone app that may not be in the background (one of the requirements).<br> In addition there is a login screen on the app launching.<br> Therefore it is not suitable to go to background in order to authenticate to Facebook and then return to the...
5,666,558
2
0
null
2011-04-14 16:36:03.603 UTC
9
2011-09-02 13:16:12.05 UTC
null
null
null
null
246,119
null
1
7
iphone|ios|facebook|background|facebook-graph-api
6,585
<p>In Facebook.m </p> <pre><code>- (void)authorizeWithFBAppAuth:(BOOL)tryFBAppAuth safariAuth:(BOOL)trySafariAuth { NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: _appId, @"client_id", @"user_agent...
5,892,176
Getting cookies in a google chrome extension
<p>I am trying to get a cookie specifically from a domain using this code:</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; var ID; function getCookies(domain, name) { chrome.cookies.get({"url": domain, "name": name}, function(cookie) { ID = cookie.value; }); } getCookies("...
5,892,242
2
0
null
2011-05-05 03:02:38.567 UTC
10
2020-08-05 20:38:58.747 UTC
2015-11-15 22:16:03.5 UTC
null
516,476
null
516,476
null
1
18
javascript|google-chrome|google-chrome-extension
55,356
<p>Almost all Chrome API calls are asynchronous, so you need to use callbacks to run code in order:</p> <pre><code>function getCookies(domain, name, callback) { chrome.cookies.get({"url": domain, "name": name}, function(cookie) { if(callback) { callback(cookie.value); } }); } //usa...
60,365,440
How to programmatically use bootstrap icons in an angular project?
<p>Here is the <a href="https://icons.getbootstrap.com/#usage" rel="noreferrer">official bootstrap documentation</a> on the usage of their icons:</p> <p><a href="https://i.stack.imgur.com/N4z2R.png" rel="noreferrer"><img src="https://i.stack.imgur.com/N4z2R.png" alt="enter image description here"></a></p> <p>I'm tryi...
65,440,311
5
0
null
2020-02-23 18:28:08.387 UTC
5
2021-06-15 12:23:31.997 UTC
2020-02-23 19:18:37.213 UTC
null
8,652,920
null
8,652,920
null
1
31
angular|typescript|bootstrap-4|icons
39,084
<p>Quite old, but since I had the same problem and these answers where not helpful at all, here is the Solution I came up with.</p> <p>First install the bootstrap icons package (--save adds it to your dependencies as well):</p> <pre><code>$ npm i bootstrap-icons --save </code></pre> <p>Then add this line to your styles...
23,417,403
TypeError: argument of type 'NoneType' is not iterable
<p>I am making a Hangman game in Python. In the game, one python file has a function that selects a random string from an array and stores it in a variable. That variable is then passed to a function in another file. That function stores a users guess as a string in a variable, then checks to see if that guess is in th...
23,417,508
2
0
null
2014-05-01 22:01:52.687 UTC
10
2014-05-01 22:11:15.21 UTC
null
null
null
null
2,446,135
null
1
22
python|python-2.7
173,217
<p>If a function does not return anything, e.g.:</p> <pre><code>def test(): pass </code></pre> <p>it has an implicit return value of <code>None</code>.</p> <p>Thus, as your <code>pick*</code> methods do not return anything, e.g.:</p> <pre><code>def pickEasy(): word = random.choice(easyWords) word = str(...
52,431,764
Difference between OpenJDK and Adoptium/AdoptOpenJDK
<p>Due to recent <a href="https://www.oracle.com/technetwork/java/javase/eol-135779.html" rel="noreferrer">Oracle Java SE Support Roadmap</a> policy update (end of $free release updates from Oracle after March 2019 in particular), I've been searching for alternatives to Oracle Java. I've found that OpenJDK is an open-s...
52,431,765
2
1
null
2018-09-20 19:10:58.573 UTC
167
2022-06-08 17:31:12.877 UTC
2020-12-18 19:28:06.38 UTC
null
418,413
null
3,523,579
null
1
331
java|sdk|adoptopenjdk
197,710
<p>In short:</p> <ul> <li><strong>OpenJDK</strong> has multiple meanings and can refer to:</li> <li>free and open source implementation of the Java Platform, Standard Edition (Java SE)</li> <li><a href="//hg.openjdk.java.net" rel="noreferrer">open source repository</a> — the Java source code aka OpenJDK project</li> <l...
53,191,753
Get react-select selected option when using multi dropdown
<p>I have two working <a href="https://github.com/JedWatson/react-select/" rel="noreferrer">react-select</a> drop downs on my page, one that allows the user to select A or B, and one that allows them to choose multiple items from &quot;blue, yellow , red&quot;.</p> <p>When they have chosen these items, I want to use th...
53,192,114
3
0
null
2018-11-07 14:45:07.413 UTC
1
2020-07-06 13:49:34.603 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
10,618,834
null
1
13
javascript|reactjs|react-select
43,412
<p>You need to change the <code>handleChange</code> to deal with the <code>isMulti</code>. Here's an example:</p> <pre><code>import React, { Component } from 'react'; import { render } from 'react-dom'; import Select from 'react-select'; const options = [ { value: 'a', label: 'a' }, { value: 'b', label: 'b' }, ]; ...
46,717,693
Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory
<h2>The problem</h2> <p>Whenever I run my projects JUnit test (using JUnit 5 with Java 9 and Eclipse Oxygen 1.a) I encounter the problem that eclipse can't find any tests.</p> <h2>The description</h2> <p>Under the run configuration, eclipse can't even find the method which is annotated with @Test, but instead only s...
46,723,851
46
1
null
2017-10-12 19:44:33.89 UTC
20
2022-09-15 01:12:55.143 UTC
2021-03-26 13:41:26.623 UTC
null
236,247
null
6,307,084
null
1
126
java|eclipse|junit|junit5
261,664
<p>You ran into <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=525948" rel="noreferrer"><strong>Eclipse bug 525948</strong></a> which has already been fixed and which will be published in the upcoming release Oxygen.3 (4.7.3), March 21, 2018.</p> <p>As workaround, <strong>put your test code in a separate proje...
8,987,926
how to find which packets got dropped
<p>I'm getting thousands of dropped packages from a Broadcom Network Card:</p> <pre><code>eth1 Link encap:Ethernet HWaddr 01:27:B0:14:DA:FE UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:2746252626 errors:0 dropped:1151734 overruns:0 frame:0 TX packets:410950215...
22,710,199
3
0
null
2012-01-24 13:50:27.53 UTC
5
2015-06-08 07:48:31.96 UTC
null
null
null
null
1,165,144
null
1
11
linux|networking|broadcom
40,743
<p>(For the benefit of those that come to this via a search) I've seen the same problem (also with a bnx2 module, IIRC).</p> <p>You might try turning off the irqbalance service. In my case, it completely stopped the solution.</p> <p>Please also note that not so long ago, there were plenty of updates (RHEL 6) for irqb...
8,698,726
Constructor function vs Factory functions
<p>Can someone clarify the difference between a constructor function and a factory function in Javascript.</p> <p>When to use one instead of the other?</p>
8,699,045
9
0
null
2012-01-02 08:19:55.917 UTC
123
2022-02-03 12:29:35.647 UTC
null
null
null
null
256,895
null
1
180
javascript|oop
72,372
<p>The basic difference is that a constructor function is used with the <code>new</code> keyword (which causes JavaScript to automatically create a new object, set <code>this</code> within the function to that object, and return the object):</p> <pre><code>var objFromConstructor = new ConstructorFunction(); </code></p...
48,008,675
Run Docker on Ubuntu on Windows Subsystem for Linux
<p>I've tried to run Docker on WSL unsuccessfully. I've installed Docker on WSL following the steps given to <a href="https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/" rel="noreferrer">install Docker on Ubuntu</a> but when I execute <code>docker ps</code> I get the following error:</p> <pre><code>do...
48,008,676
11
0
null
2017-12-28 13:48:56.483 UTC
18
2022-01-25 16:06:25.787 UTC
2018-07-07 12:02:27.74 UTC
null
995,714
null
6,135,178
null
1
31
windows|docker|windows-subsystem-for-linux
42,169
<p>Finally, I could run Docker on WSL in an easy way: You need first to install and run Docker Engine on Windows and then just create a symbolic link on Ubuntu bash pointing to the Windows executable:</p> <pre><code>sudo ln -s /mnt/c/Program\ Files/Docker/Docker/resources/bin/docker.exe /usr/bin/docker </code></pre> ...
59,958,294
How do I Execute Terraform Actions Without the Interactive Prompt?
<p>How am I able to execute the following command:</p> <pre class="lang-sh prettyprint-override"><code>terraform apply #=&gt; . . . Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: </code></pre> <p><strong>without<...
59,958,372
2
0
null
2020-01-28 22:51:57.027 UTC
7
2022-08-21 19:34:59.697 UTC
2022-02-23 22:52:02.38 UTC
null
472,495
null
4,415,079
null
1
41
terraform
17,032
<pre class="lang-sh prettyprint-override"><code>terraform apply -auto-approve </code></pre> <p><a href="https://www.terraform.io/docs/commands/apply.html#auto-approve" rel="noreferrer">https://www.terraform.io/docs/commands/apply.html#auto-approve</a></p>
27,158,106
WebSocket with Sockjs & Spring 4 but without Stomp
<p>Is there a way to use WebSockets with SockJS client and Spring 4 server but not using STOMP?</p> <p>Based on this tutorial from Spring's website, I know how to set up a WebSocket based application using Stomp and Spring 4. On the client side, we have:</p> <pre><code> var socket = new SockJS('/hello'); ...
27,161,986
1
1
null
2014-11-26 20:15:28.943 UTC
33
2015-03-11 15:24:34.737 UTC
null
null
null
null
1,244,329
null
1
40
java|websocket|sockjs|spring-4
24,499
<p>Spring supports <code>STOMP</code> over <code>WebSocket</code> but the use of a subprotocol is <strong>not mandatory</strong>, you can deal with the raw websocket. When using a raw websocket, the message sent lacks of information to make Spring route it to a specific message handler method (we don't have any messagi...
4,922
Is this really widening vs autoboxing?
<p>I saw this in <a href="https://stackoverflow.com/a/4384/697449">an answer to another question</a>, in reference to shortcomings of the Java spec:</p> <blockquote> <p>There are more shortcomings and this is a subtle topic. Check <a href="http://kiranthakkar.blogspot.com/2007/05/method-overloading-with-new-features-of...
5,091
3
1
null
2008-08-07 16:30:32.18 UTC
null
2018-04-24 20:33:39.063 UTC
2020-06-20 09:12:55.06 UTC
Andy
-1
null
670
null
1
31
java|primitive|autoboxing
4,552
<p>In the first case, you have a widening conversion happening. This can be see when runinng the "javap" utility program (included w/ the JDK), on the compiled class:</p> <pre><code>public static void main(java.lang.String[]); Code: 0: iconst_ 5 1: istore_ 1 2: iload_ 1 3: i2l 4: invokestati...
1,254,512
Decrease line spacing in a TextBlock / FlowDocument
<p>Some fonts have a large amount of whitespace above and below the characters. Is there a way to correct for that, and tighten up the space between lines of a word-wrapped paragraph in WPF (in either a TextBlock or a FlowDocument)? Kind of like a negative margin between lines?</p> <p>There's a <code>LineHeight</code>...
1,441,087
3
0
null
2009-08-10 12:08:02.273 UTC
4
2014-08-08 15:09:37.24 UTC
null
null
null
null
87,399
null
1
45
wpf|fonts|word-wrap
20,268
<p>Set the <code>LineHeight</code> like before, but change the <code>LineStackingStrategy</code> to <code>BlockLineHeight</code></p>
252,906
How to get the list of open windows from xserver
<p>Anyone got an idea how to get from an Xserver the list of all open windows?</p>
252,911
3
0
null
2008-10-31 08:53:18.42 UTC
15
2020-05-13 20:40:35.493 UTC
2010-09-08 07:28:12.097 UTC
Paul
300,863
kender
4,172
null
1
52
x11|xserver
39,577
<p>From the CLI you can use</p> <pre><code>xwininfo -tree -root </code></pre> <p>If you need to do this within your own code then you need to use the <code>XQueryTree</code> function from the <code>Xlib</code> library.</p>
39,643,394
Swift-3 error: '-[_SwiftValue unsignedIntegerValue]: unrecognized selector
<p>Following code was perfectly worked with old swift. This is an extension of String</p> <pre><code>func stringByConvertingHTML() -&gt; String { let newString = replacingOccurrences(of: "\n", with: "&lt;br&gt;") if let encodedData = newString.data(using: String.Encoding.utf8) { let attributedOptions :...
39,644,620
3
0
null
2016-09-22 15:41:33.28 UTC
8
2018-08-13 23:23:41.413 UTC
2016-09-22 15:51:33.22 UTC
null
1,810,390
null
1,810,390
null
1
56
ios|xcode|exception|swift3
11,675
<p>I ran into the same problem:</p> <pre><code>let attributedOptions : [String: AnyObject] = [ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType as AnyObject, NSCharacterEncodingDocumentAttribute: String.Encoding.utf8 as AnyObject ] </code></pre> <p>Here the <code>String.Encoding...
41,990,250
What is cross-entropy?
<p>I know that there are a lot of explanations of what cross-entropy is, but I'm still confused.</p> <p>Is it only a method to describe the loss function? Can we use gradient descent algorithm to find the minimum using the loss function?</p>
41,990,932
3
2
null
2017-02-01 21:38:07.823 UTC
78
2021-06-26 02:06:44.6 UTC
2021-06-26 02:06:44.6 UTC
null
4,561,314
null
573,082
null
1
111
machine-learning|cross-entropy
61,494
<p>Cross-entropy is commonly used to quantify the difference between two probability distributions. In the context of machine learning, it is a measure of error for categorical multi-class classification problems. Usually the &quot;true&quot; distribution (the one that your machine learning algorithm is trying to match...
63,169,865
How to do multiprocessing in FastAPI
<p>While serving a FastAPI request, I have a CPU-bound task to do on every element of a list. I'd like to do this processing on multiple CPU cores.</p> <p>What's the proper way to do this within FastAPI? Can I use the standard <code>multiprocessing</code> module? All the tutorials/questions I found so far only cover I/...
63,171,013
1
0
null
2020-07-30 09:09:06.547 UTC
31
2021-08-22 04:12:40.927 UTC
2021-01-24 18:53:35.88 UTC
null
13,782,669
null
8,233,844
null
1
36
python|multiprocessing|python-asyncio|fastapi|uvicorn
25,306
<h2><code>async def</code> endpoint</h2> <p>You could use <a href="https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.run_in_executor" rel="noreferrer">loop.run_in_executor</a> with <a href="https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor" rel="noreferrer">ProcessPoolExe...
41,674,979
flex child is growing out of parent
<p>How to force the green boxes to be contained in the red one without setting a static height value and no absolute position?</p> <p>I want to shrink the content to fit into the parent.</p> <p>The content (video in this case) is allowed to shrink and scrollbars are allowed.</p> <p><div class="snippet" data-lang="js...
41,675,912
3
0
null
2017-01-16 11:07:13.35 UTC
14
2022-02-24 13:17:52.663 UTC
2017-01-16 12:01:56.713 UTC
null
3,597,276
null
1,055,015
null
1
72
html|css|flexbox
76,775
<h2>Solution #1 - Without Scroll</h2> <p>Instead of <code>flex: 1 0 auto</code> on the video container, just use <code>flex: 1</code>. This sizes the item based on available space, not the intrinsic height of the content.</p> <p>Then, because flex items cannot be smaller than the size of their content &ndash; <code>m...
6,244,307
concatenate two strings
<p>Let's say I have a string obtained from a cursor,this way:</p> <pre><code>String name = cursor.getString(numcol); </code></pre> <p>and another String like this one:</p> <pre><code>String dest=cursor.getString(cursor.getColumnIndexOrThrow(db.KEY_DESTINATIE)); </code></pre> <p>If finally I wanna obtain a String fr...
6,244,371
3
0
null
2011-06-05 16:41:35.003 UTC
2
2017-01-07 13:33:16.167 UTC
2016-07-16 04:32:32.997 UTC
null
3,329,664
null
778,076
null
1
19
android|string
118,466
<p>The best way in my eyes is to use the <code>concat()</code> method provided by the <code>String</code> class itself.</p> <p>The useage would, in your case, look like this:</p> <pre><code>String myConcatedString = cursor.getString(numcol).concat('-'). concat(cursor.getString(cursor.getColumnIndexOrThrow(db.K...
5,860,216
No expires header sent, content cached, how long until browser makes conditional GET request?
<p>Assume browser default settings, and content is sent without expires headers. </p> <ol> <li>user visits website, browser caches images etc. </li> <li>user does not close browser, or refresh page. </li> <li>user continues to surf site normally.</li> <li>assume the browse doesn't dump the cache for any reason. </li> ...
5,860,508
3
2
null
2011-05-02 17:21:31.353 UTC
6
2017-01-27 15:17:59.36 UTC
2014-01-23 20:48:42.15 UTC
null
2,642,204
null
332,751
null
1
35
caching|browser|cache-control
19,059
<p>HTTP/1.1 defines a selection of caching mechanisms; the <code>expires</code> header is merely one, there is also the <code>cache-control</code> header.</p> <p>To directly answer your question: for a resource returned with no <code>expires</code> header, you must consider the returned <code>cache-control</code> dire...
6,071,607
how can i use a helper in different views
<p>i am using refinery cms at the moment. I created an engine and with it some helpers in <code>app/helpers/admin/</code>. now i would like to use those helpers in my frontend view (ie. <code>app/views/myapp/index</code>) as well. but i can not...undefined methode error. what do i have to do short of copying the whole ...
6,071,741
3
1
null
2011-05-20 12:02:08.113 UTC
4
2012-12-04 12:17:04.973 UTC
null
null
null
null
762,693
null
1
37
ruby-on-rails|ruby|refinerycms
24,281
<p>In your <code>application_helper.rb</code>:</p> <pre><code>module ApplicationHelper include Admin::MyHelper end </code></pre> <p>This will import those helper methods into the <code>ApplicationHelper</code>, thus making them available in your views. You could do this in any of your helpers really.</p>
5,628,647
Geolocation APIs: SimpleGeo vs CityGrid vs PublicEarth vs Twitter vs Foursquare vs Loopt vs Fwix. How to retrieve venue/location information?
<p>We need to display meta information (e.g, address, name) on our site for various venues like bars, restaurants, and theaters.</p> <p>Ideally, users would type in the name of a venue, along with zip code, and we present the closest matches. </p> <p>Which APIs have people used for similar geolocation purposes? What ...
5,760,083
4
4
null
2011-04-11 23:13:02.297 UTC
15
2012-02-22 22:16:35.037 UTC
2011-04-19 17:29:22.54 UTC
null
144,088
null
144,088
null
1
8
facebook|api|geolocation|twitter
5,070
<p>Facebook Places is based on Factual. You can use Factual's API which is pretty good (and still free, I think?)</p> <p><a href="http://www.factual.com/topic/local" rel="noreferrer">http://www.factual.com/topic/local</a></p> <p>You can also use unauthenticated Foursquare as a straight places database. The data is ...
5,773,961
All possible permutations of a given String?
<p>How would I do this in Ruby?</p> <pre><code>p "abc".all_possible_permutations </code></pre> <p>Would return:</p> <pre><code>[ "abc", "acb", "bca", "bac", "cba", "cab", ] </code></pre> <h1>Edit</h1> <p>Thanks to Jakub Hampl:</p> <pre><code>class String def all_possible_permutations self.chars....
5,773,980
4
9
null
2011-04-24 23:34:53.617 UTC
10
2017-06-25 02:52:24.93 UTC
2011-11-09 10:46:19.023 UTC
null
6,444
null
139,089
null
1
27
ruby
15,610
<pre><code>%w[a b c].permutation.map &amp;:join </code></pre>
5,693,997
Android: How to create an "Ongoing" notification?
<p><img src="https://i.stack.imgur.com/QV4Kt.png" alt="enter image description here"></p> <p>Hello, How do i create the permanent notification like the first one for Battery Indicator?</p>
5,694,012
4
0
null
2011-04-17 14:10:13.11 UTC
23
2013-01-06 21:42:21.77 UTC
null
null
null
null
481,239
null
1
53
android|notifications
55,221
<p>Assign <code>Notification.FLAG_ONGOING_EVENT</code> flag to your <code>Notification</code>.</p> <p>Sample code:</p> <pre><code>yourNotification.flags = Notification.FLAG_ONGOING_EVENT; // Notify... </code></pre> <p>If you aren't familiar with the <code>Notification</code> API, read <a href="http://developer.andro...
6,295,481
Learning Algorithms
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/5282969/learning-efficient-algorithms">Learning efficient algorithms</a> </p> </blockquote> <p>I recently came across an problem that was solved by applying the correct algorithm: <a href="https://stackoverflow...
6,295,520
5
6
null
2011-06-09 15:35:58.807 UTC
10
2011-06-09 16:04:23.26 UTC
2017-05-23 10:28:59.593 UTC
null
-1
null
592,851
null
1
8
python|c|algorithm
3,238
<p>"Art of Computer Programming" by Donald Knuth is a Very Useful Book.</p>
34,428,952
If with multiple &&, || conditions Evaluation in java
<pre><code>if(a &amp;&amp; b || c || d || e) </code></pre> <p>whether it check <code>(a &amp;&amp; b)</code>, if <strong>a</strong> and <strong>b</strong> must be true always, then only allow inside ? or</p> <p><code>((a &amp;&amp; b) || a &amp;&amp; c || a &amp;&amp; d || a &amp;&amp; e))</code>, any of the conditio...
34,429,054
6
1
null
2015-12-23 05:02:25.943 UTC
3
2021-07-04 11:29:26.19 UTC
2015-12-23 05:30:50.837 UTC
null
1,997,093
null
4,675,067
null
1
8
java|if-statement
44,508
<p>If I understand you correctly, in the first part of your question, you are asking whether <code>a</code> and <code>b</code> must both be true for the entire expression <code>(a &amp;&amp; b || c || d || e)</code> to evaluate as true.</p> <p>The answer to that question is no. Java operators are such that <code>&amp;...
2,269,593
Best way to handle view and helper-only constants in Rails
<p>I have a constant that is only used in views, but it's used in different ways in different places. It's an array of option names, and is used for select boxes, but I also use this in other views to see if strings are found in this array, and respond accordingly.</p> <p>What's the best way to handle this to keep DR...
2,269,972
2
0
null
2010-02-15 23:08:57.237 UTC
9
2010-07-28 23:05:44.77 UTC
null
null
null
null
257,611
null
1
28
ruby-on-rails|view|constants|dry|helper
12,108
<p>You can define constants in helpers, but you will need to refer to them by their fully qualified name in your views.</p> <p>application_helper.rb</p> <pre><code>module ApplicationHelper MyConstant = "something" end </code></pre> <p>In any view:</p> <pre><code>&lt;%= ApplicationHelper::MyConstant %&gt; </code><...
1,363,527
Cannot convert '0000-00-00 00:00:00' to TIMESTAMP
<p>the field definition</p> <pre><code> /** Date. */ @Column(columnDefinition = "datetime") private Date date; </code></pre> <p>setter</p> <pre><code>public void setDate(final Date date) { DateFormat dfmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { this.date = dfmt.parse(dfmt.format(date))...
1,363,750
2
3
null
2009-09-01 16:49:23.42 UTC
4
2013-05-07 19:23:55.217 UTC
2012-03-06 08:06:31.333 UTC
null
411,951
null
87,383
null
1
29
java|hibernate|date|hql
32,768
<p>I'm going to take a wild guess here that you're using MySQL :-) It uses "zero dates" as <a href="http://dev.mysql.com/doc/refman/5.4/en/date-and-time-types.html" rel="noreferrer">special placeholder</a> - unfortunatelly, JDBC can not handle them by default.</p> <p>The solution is to specify "zeroDateTimeBehavior=co...
29,760,668
Conditionally iterate over one of several possible iterators
<p>I'm trying to switch behavior based on an <code>Option</code> input to a function. The idea is to iterate based on whether or not a given <code>Option</code> is present. Here's a minimal, if silly, example:</p> <pre><code>use std::iter; fn main() { let x: Option&lt;i64&gt; = None; // Repeat x 5 times if p...
29,760,740
4
0
null
2015-04-21 00:14:56.867 UTC
8
2020-02-21 12:03:44.103 UTC
2018-05-06 20:50:14.387 UTC
null
155,423
null
901,827
null
1
29
rust
5,617
<p>The most straightforward solution is to use a <em>trait object</em>:</p> <pre><code>use std::iter; fn main() { let mut a; let mut b; let x: Option&lt;i64&gt; = None; // Repeat x 5 times if present, otherwise count from 1 to 5 let iter: &amp;mut dyn Iterator&lt;Item = i64&gt; = match x { ...
5,710,568
markerClusterer on click zoom
<p>I just added a MarkerClusterer to my google map. It works perfectly fine.</p> <p>I am just wondering if there is any way of adjusting the zoom-in behaviour when the cluster is clicked. I would like to change the zoom level if possible.</p> <p>Is there any way of achieving this?</p> <p>Thanks</p>
5,718,739
5
0
null
2011-04-19 01:14:36.24 UTC
6
2019-07-26 17:19:47.163 UTC
2012-07-02 11:37:27.973 UTC
null
97,160
null
269,106
null
1
30
javascript|google-maps|zooming|google-maps-markers|markerclusterer
44,942
<p>I modified the clusterclick event as suggested:</p> <pre><code>/** * Triggers the clusterclick event and zoom's if the option is set. */ ClusterIcon.prototype.triggerClusterClick = function() { var markerClusterer = this.cluster_.getMarkerClusterer(); // Trigger the clusterclick event. google.maps.event.trigger(ma...
6,157,485
What are Content-Language and Accept-Language?
<p>I have seen the HTTP headers of <code>Content-Language</code> and <code>Accept-Language</code>, could someone explain what these are for and the difference between them? I have a multilingual site and wondering should I be setting both to the sites current selected language, by the user.</p>
6,157,546
6
2
null
2011-05-27 20:41:34.227 UTC
18
2022-04-26 08:59:28.113 UTC
2017-06-15 15:01:28.44 UTC
null
19,068
null
373,674
null
1
104
http-headers|request|response
119,428
<p><code>Content-Language</code>, an entity header, is used to describe the language(s) intended for the audience, so that it allows a user to differentiate according to the users' own preferred language. Entity headers are used in both, HTTP requests and responses.<sup><a href="https://developer.mozilla.org/en-US/docs...