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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1,399,605 | How can I make my layout scroll both horizontally and vertically? | <p>I am using a TableLayout. I need to have both horizontal and vertical scrolling for this layout. By default I am able to get vertical scrolling in the view but horizontal scrolling is not working.</p>
<p>I am using Android SDK 1.5 r3. I have already tried <code>android:scrollbars="horizontal"</code>.</p>
<p>I hav... | 1,409,629 | 8 | 0 | null | 2009-09-09 13:11:21.503 UTC | 27 | 2022-02-15 14:43:19.547 UTC | 2013-03-27 19:24:03.017 UTC | null | 1,401,895 | null | 152,867 | null | 1 | 75 | android|android-widget|android-scrollview | 125,144 | <p>I was able to find a simple way to achieve both scrolling behaviors.</p>
<p>Here is the xml for it:</p>
<pre><code><ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:scrollbars=... |
1,853,284 | What's the difference between the message passing and shared memory concurrency models? | <p>Correct me if I'm wrong, but I'm surprised this hasn't been asked before on here ...</p> | 1,853,317 | 10 | 0 | null | 2009-12-05 20:04:31.457 UTC | 33 | 2020-05-14 11:29:04.807 UTC | null | null | null | null | 1,348 | null | 1 | 58 | concurrency|shared-memory|message-passing | 83,046 | <p>It's a pretty simple difference. In a shared memory model, multiple workers all operate on the same data. This opens up a lot of the concurrency issues that are common in parallel programming.</p>
<p>Message passing systems make workers communicate through a messaging system. Messages keep everyone seperated, so... |
1,979,957 | Maven dependency for Servlet 3.0 API? | <p>How can I tell Maven 2 to load the Servlet 3.0 API?</p>
<p>I tried:</p>
<pre class="lang-xml prettyprint-override"><code><dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0</version>
<scope>provided</scop... | 1,980,718 | 11 | 3 | null | 2009-12-30 12:29:40.633 UTC | 81 | 2020-11-05 23:18:20.763 UTC | 2012-09-26 13:24:31.74 UTC | null | 384,674 | null | 238,134 | null | 1 | 236 | java|maven-2|servlets|jakarta-ee | 283,344 | <blockquote>
<p>I'd prefer to only add the Servlet API as dependency, </p>
</blockquote>
<p>To be honest, I'm not sure to understand why but never mind...</p>
<blockquote>
<p><a href="https://stackoverflow.com/users/2362/brabster">Brabster</a> separate dependencies have been replaced by Java EE 6 Profiles. Is the... |
1,538,523 | How to get an ASP.NET MVC Ajax response to redirect to new page instead of inserting view into UpdateTargetId? | <p>I am using the Ajax.BeginForm to create a form the will do an ajax postback to a certain controller action and then if the action is successful, the user should get redirected to another page (if the action fails then a status message gets displayed using the AjaxOptions UpdateTargetId).</p>
<pre><code>using (Ajax.... | 7,070,055 | 15 | 0 | null | 2009-10-08 15:23:09 UTC | 30 | 2021-01-29 01:14:12.82 UTC | 2019-04-26 11:53:45.633 UTC | null | 9,020,340 | null | 21,579 | null | 1 | 93 | c#|ajax|asp.net-mvc|asp.net-mvc-ajax | 152,831 | <p>You can use <code>JavascriptResult</code> to achieve this.</p>
<p>To redirect:</p>
<pre><code>return JavaScript("window.location = 'http://www.google.co.uk'");
</code></pre>
<p>To reload the current page:</p>
<pre><code>return JavaScript("location.reload(true)");
</code></pre>
<p>Seems the simplest option.</p> |
2,150,078 | How to check visibility of software keyboard in Android? | <p>I need to do a very simple thing - find out if the software keyboard is shown. Is this possible in Android?</p> | 4,737,265 | 45 | 12 | null | 2010-01-27 20:39:30.22 UTC | 278 | 2022-01-09 20:50:06.89 UTC | 2016-07-03 07:03:03.263 UTC | null | 6,343,685 | null | 243,225 | null | 1 | 553 | android|visibility|android-softkeyboard | 299,942 | <p><strong>NEW ANSWER</strong> <em>added Jan 25th 2012</em></p>
<p>Since writing the below answer, someone clued me in to the existence of <a href="http://developer.android.com/reference/android/view/ViewTreeObserver.html" rel="noreferrer">ViewTreeObserver</a> and friends, APIs which have been lurking in the SDK since... |
33,701,823 | Chrome Mobile color bar theme-color meta tag not working | <p>I'm trying to implement the <code>theme-color</code> meta tag but I can't see it working in my Motorola smartphone with Chrome and Android Lollipop. </p>
<p>I started with a <code>theme-color</code> tag then I wrote the other tags, but have had no success at all.</p>
<pre><code><meta name="theme-color" content=... | 52,778,270 | 6 | 5 | null | 2015-11-13 21:11:46.927 UTC | 3 | 2022-03-09 14:38:50.02 UTC | 2018-11-09 18:14:12.49 UTC | null | 397,817 | null | 3,489,993 | null | 1 | 31 | html|google-chrome | 23,131 | <h2>Always check actual browsers versions.</h2>
<p>Here is table of supporting this meta tag.
<a href="https://caniuse.com/#feat=meta-theme-color" rel="nofollow noreferrer">https://caniuse.com/#feat=meta-theme-color</a></p>
<p><a href="https://i.stack.imgur.com/UFHZo.jpg" rel="nofollow noreferrer"><img src="https://i.s... |
8,923,174 | OpenGL VAO best practices | <p>Im facing an issue which I believe to be VAO-dependant, but Im not sure..</p>
<p>I am not sure about the correct usage of a VAO, what I used to do during GL initialization was a simple</p>
<pre><code>glGenVertexArrays(1,&vao)
</code></pre>
<p>followed by a</p>
<pre><code>glBindVertexArray(vao)
</code></pre>
... | 8,923,298 | 4 | 2 | null | 2012-01-19 08:42:55.417 UTC | 45 | 2014-10-24 12:28:36.633 UTC | 2014-07-21 21:07:15.27 UTC | null | 1,642,975 | null | 815,129 | null | 1 | 83 | opengl|opengl-3|vao | 46,676 | <p>VAOs act similarly to VBOs and textures with regard to how they are bound. Having a single VAO bound for the entire length of your program will yield no performance benefits because you might as well just be rendering without VAOs at all. In fact it may be slower depending on how the implementation intercepts vertex... |
18,192,114 | How to use vertical align in bootstrap | <p>Simple problem: How do I vertically align a col within a col using bootstrap? Example here (I want to vertically align child1a and child1b): </p>
<p><a href="http://bootply.com/73666">http://bootply.com/73666</a></p>
<p>HTML</p>
<pre><code><div class="col-lg-12">
<div class="col-lg-6 col-md-6 col-12 c... | 19,154,569 | 8 | 1 | null | 2013-08-12 16:31:41.033 UTC | 18 | 2017-05-10 13:24:47.017 UTC | 2013-08-12 17:32:08.94 UTC | null | 2,274,357 | null | 2,429,989 | null | 1 | 51 | css|twitter-bootstrap|twitter-bootstrap-3 | 240,324 | <pre><code>.parent {
display: table;
table-layout: fixed;
}
.child {
display:table-cell;
vertical-align:middle;
text-align:center;
}
</code></pre>
<p><code>table-layout: fixed</code> prevents breaking the functionality of the col-* classes.</p> |
17,902,483 | Show values from a MySQL database table inside a HTML table on a webpage | <p>I want to retrieve the values from a database table and show them in a html table in a page.
I already searched for this but I couldn't find the answer, although this surely is something easy (this should be the basics of databases lol). I guess the terms I've searched are misleading.
The database table name is tick... | 17,902,527 | 9 | 4 | null | 2013-07-27 21:08:40.19 UTC | 49 | 2022-01-14 15:13:51.313 UTC | 2018-04-24 17:47:56.683 UTC | null | 4,370,109 | null | 2,601,086 | null | 1 | 52 | php|mysql|database|html-table | 651,800 | <p>Example taken from W3Schools: <a href="http://www.w3schools.com/php/php_mysql_select.asp" rel="noreferrer">PHP Select Data from MySQL</a></p>
<pre><code><?php
$con=mysqli_connect("example.com","peter","abc123","my_db");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysql... |
18,103,769 | How can I obtain the cube root in C++? | <p>I know how to obtain the <em>square root</em> of a number using the <code>sqrt</code> function.</p>
<p>How can I obtain the <em>cube root</em> of a number?</p> | 18,103,837 | 9 | 15 | null | 2013-08-07 12:46:23.243 UTC | 6 | 2022-05-08 21:27:39.367 UTC | 2013-08-07 13:52:02.65 UTC | null | 560,648 | null | 2,654,303 | null | 1 | 33 | c++ | 69,628 | <p><code>sqrt</code> stands for "square root", and "square root" means raising to the power of <code>1/2</code>. There is no such thing as "square root with root 2", or "square root with root 3". For <a href="http://en.wikipedia.org/wiki/Nth_root" rel="noreferrer">other roots</a>, you change the first word; <strong>in ... |
6,557,794 | How to access value of map with a key if key was not found in scala? | <p>Assume I have </p>
<pre><code>var mp = Map[String,String]()
.....
val n = mp("kk")
</code></pre>
<p>The above will throw runtime error in case key "kk" did not exist.</p>
<p>I expected n will be null in case key did not exist. I want n to be null if key did not exist.</p>
<p>What is the proper way to handle th... | 6,557,829 | 3 | 1 | null | 2011-07-02 15:13:31.717 UTC | 4 | 2018-05-15 18:13:32.907 UTC | null | null | null | null | 821,764 | null | 1 | 25 | scala | 43,231 | <p>First of all, you probably don't really want null, as that's almost always a sign of bad coding in Scala. What you want is for n to be of type Option[String], which says that the value is either a String or is missing. The right way to do that is with the .get() method on you map</p>
<pre><code>val n = mp.get("k... |
6,403,737 | Fixed Button below a scrollable ListView | <p>I have a scrollable ListView with items (like in <a href="http://developer.android.com/resources/tutorials/views/hello-listview.html">http://developer.android.com/resources/tutorials/views/hello-listview.html</a>). I am using an <code>ArrayAdapter</code> for the items and use it as a parameter in <code>setListAdapte... | 6,404,148 | 3 | 0 | null | 2011-06-19 16:48:33.86 UTC | 11 | 2017-01-17 00:21:46.807 UTC | null | null | null | null | 603,841 | null | 1 | 30 | android|listview | 34,356 | <p>If your activity extends ListActivity then you need something like this:</p>
<pre><code><LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView android:id="@android:id/list"
android:layou... |
6,585,373 | Django multiple and dynamic databases | <p>I've been evaluating django and wondered if the following is possible. I've already looked at the regular multiple database docs so please don't point me to that because this use case isn't mentioned as far as i can make out. If i'm wrong i take it back :)</p>
<p>I want one main database in which most of my app's m... | 11,292,526 | 3 | 3 | null | 2011-07-05 15:41:59.16 UTC | 28 | 2022-01-30 07:10:18.43 UTC | null | null | null | null | 148,508 | null | 1 | 44 | django|django-database | 19,360 | <p>I will open with "<a href="https://docs.djangoproject.com/en/dev/topics/settings/#altering-settings-at-runtime" rel="noreferrer">You should not edit settings at runtime</a>".</p>
<p>Having said that, I have exactly this same issue, where I want to create a unique database for each user. The reason for doing this is... |
6,587,712 | django url patterns with 2 parameters | <p>This is simple and obvious but I can't get it right:</p>
<p>I have the following view function declared in urls.py</p>
<pre><code> (r'^v1/(\d+)$', r'custom1.views.v1'),
</code></pre>
<p>originally I was passing a single parameter to the view function v1.
I want to modify it to pass 2 parameters. How do I declare... | 6,587,781 | 4 | 0 | null | 2011-07-05 19:17:08.323 UTC | 1 | 2020-05-07 18:29:53.907 UTC | null | null | null | null | 773,389 | null | 1 | 16 | django | 42,389 | <p>I believe each group in the regex is passed as a parameter (and you can name them if you want):</p>
<pre><code>(r'^v1/(\d+)/(\d+)/$', r'custom1.views.v1')
</code></pre>
<p>Check out the examples at: <a href="https://docs.djangoproject.com/en/dev/topics/http/urls/" rel="noreferrer">https://docs.djangoproject.com/en... |
36,212,901 | VS 2015 Razor Autocomplete/Intellisense dropdown hides immediately after dropdown | <p>In VS 2015, only when in Razor (.cshtml) files, roughly half of the time the autocomplete/suggestion list/intellisense doesn't work correctly (sorry, not sure the actual term... when you type an object and hit <code>.</code> and the list of properties and methods shows to select from)</p>
<p>The behavior is that wh... | 38,750,315 | 8 | 3 | null | 2016-03-25 01:55:21.01 UTC | 12 | 2017-08-24 09:22:22.917 UTC | 2016-07-22 19:12:54.29 UTC | null | 4,155,665 | null | 4,155,665 | null | 1 | 43 | razor|visual-studio-2015|intellisense | 4,457 | <p>I haven't found the root cause, but in all cases, <code>CTRL+SPACE</code> works. This isn't the best, but light years better than nothing at all.</p>
<p>(this shortcut is not one I've used in the past, so this is likely standard behavior, but...) If you're at the dot <code>Model.</code> and autocomplete list disa... |
18,727,186 | How to load classes based on pretty URLs in MVC-like page? | <p>I would like to ask for some tips, on how solve this problem. I'm trying to build my own MVC website. I learned the basics of the URL.</p>
<pre><code>http://example.com/blog/cosplay/cosplayer-expo-today
</code></pre>
<p>blog -> the controller<br/>cosplay -> the method in controller<br/>cosplayer-expo-today ->varia... | 19,309,893 | 2 | 5 | null | 2013-09-10 19:21:36.42 UTC | 18 | 2017-11-30 16:57:05.39 UTC | 2013-12-06 11:44:04.363 UTC | null | 727,208 | user2432700 | null | null | 1 | 6 | php|.htaccess|url-routing | 6,239 | <blockquote>
<p><sub><strong>FYI:</strong> There are several things that you are doing wrong. I will try to go through each of them and explain the problems, the misconceptions and the possible solution(s).</sub></p>
</blockquote>
<h2>The autoloading and routing are separate things.</h2>
<p>From the look of you pos... |
27,507,678 | In angular $http service, How can I catch the "status" of error? | <p>I'm reading a book called, "Pro Angular JS".
However, I have a question about how to catch a status of error.</p>
<p>What I coded is :</p>
<pre><code>$http.get(dataUrl)
.success(function (data){
$scope.data.products = data;
})
.error(function (error){
$scope.data.error=error;
co... | 27,507,822 | 6 | 4 | null | 2014-12-16 15:08:53.29 UTC | 11 | 2017-08-28 09:45:22.05 UTC | 2017-08-28 09:45:22.05 UTC | user8317956 | null | null | 3,868,638 | null | 1 | 48 | javascript|angularjs | 110,452 | <p>Your arguments are incorrect, error doesn't return an object containing status and message, it passed them as separate parameters in the order described below.</p>
<p>Taken from the <a href="https://docs.angularjs.org/api/ng/service/$http">angular docs</a>:</p>
<ul>
<li>data – {string|Object} – The response body t... |
5,027,403 | Vim show strange  characters over putty | <p>When I am editing a file in Vim I have some lines with a bunch
of  displayed.</p>
<p>I have already checked the encoding with </p>
<pre><code>:set encoding
</code></pre>
<p>It says utf8</p>
<pre><code>encoding=utf8
</code></pre>
<p>Anybody knows where this is comming from and how to stop
this behaviour?</p>
... | 5,027,543 | 2 | 1 | null | 2011-02-17 09:59:29.577 UTC | 10 | 2011-02-18 00:13:08.107 UTC | null | null | null | null | 231,982 | null | 1 | 27 | vim|encoding|character|putty | 19,230 | <p>Make sure that PuTTY is set for UTF-8 as well. You can do this under Window -> Translation -> Remote Character Set. You may need to choose a font that supports a reasonable portion of the Unicode range as well -- Terminal isn't necessarily going to cut it.</p> |
787,776 | Find free disk space in python on OS/X | <p>I'm looking for the number of free bytes on my HD, but have trouble doing so on python.</p>
<p>I've tried the following:</p>
<pre><code>import os
stat = os.statvfs(path)
print stat.f_bsize * stat.f_bavail
</code></pre>
<p>But, on OS/X it gives me a 17529020874752 bytes, which is about about 1.6 TB, which would b... | 787,832 | 7 | 1 | null | 2009-04-24 22:17:32.313 UTC | 10 | 2015-07-19 10:57:34.693 UTC | 2015-01-01 00:10:29.36 UTC | null | 1,505,120 | null | 80,911 | null | 1 | 25 | python|diskspace | 33,614 | <p>Try using <code>f_frsize</code> instead of <code>f_bsize</code>.</p>
<pre><code>>>> s = os.statvfs('/')
>>> (s.f_bavail * s.f_frsize) / 1024
23836592L
>>> os.system('df -k /')
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/disk0s2 116884912 92792320 23836592 8... |
1,096,862 | Print directly from browser without print popup window | <p>As it said in the subject I've to create a feature for a web-based application that will allow users to send print directly without prompting any dialog boxe just make the print i.e click and print, simple! but not for me :(. </p>
<p>Please, suggest what would be the best option and how should I write it up (techno... | 1,124,848 | 7 | 4 | null | 2009-07-08 08:40:55.717 UTC | 12 | 2013-06-06 03:31:41.857 UTC | 2009-07-22 05:26:22.173 UTC | null | 134,743 | null | 134,743 | null | 1 | 25 | browser|printing|activex|client-side | 175,191 | <blockquote>
<p>I couldn't find solution for other
browsers. When I posted this question, IE was on the
higher priority and gladly I found
one for it. If you have a solution
for other browsers (firefox, safari, opera) please do share here.
Thanks.</p>
</blockquote>
<p>VBSCRIPT is much more convenient than ... |
1,002,073 | an array of strings as a jQuery selector? | <p>I have an array of strings that are valid jQuery selectors (i.e. IDs of elements on the page): </p>
<pre><code>["#p1", "#p2", "#p3", "#p4", "#p5"]
</code></pre>
<p>I want to select elements with those IDs into a jQuery array. This is probably elementary, but I can't find anything online. I could have a for-loop wh... | 1,002,099 | 7 | 0 | null | 2009-06-16 15:03:05.313 UTC | 10 | 2022-08-27 15:52:58.257 UTC | 2017-05-23 11:54:39.773 UTC | null | -1 | null | 65,232 | null | 1 | 34 | javascript|jquery | 33,466 | <p>Well, there's 'join':</p>
<pre><code>["#p1", "#p2", "#p3", "#p4", "#p5"].join(", ")
</code></pre>
<p>EDIT - Extra info:</p>
<p>It is possible to select an array of elements, problem is here you don't have the elements yet, just the selector strings. Any way you slice it you're gonna have to execute a search like ... |
560,811 | How To Use DateTimePicker In WPF? | <p>I have no idea how to use the DateTimePicker control in WPF. It is not available in the Toolbox.</p> | 560,824 | 8 | 0 | null | 2009-02-18 12:14:24.377 UTC | 6 | 2021-09-19 08:17:38.767 UTC | 2012-05-10 13:55:35.917 UTC | John | 72,882 | Saransh | null | null | 1 | 26 | wpf|datetimepicker | 113,085 | <p><strong>Please Note:</strong> The following answer only applied to WPF under the 3.5 Framework as NET 4.0 runtime has it's own <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.datepicker.aspx" rel="nofollow noreferrer">datetime control</a>.</p>
<p>By default WPF 3.5 does not come with a date... |
80,084 | In Javascript, why is the "this" operator inconsistent? | <p>In JavaScript, the "this" operator can refer to different things under different scenarios. </p>
<p>Typically in a method within a JavaScript "object", it refers to the current object.</p>
<p>But when used as a callback, it becomes a reference to the calling object.</p>
<p>I have found that this causes problems i... | 80,127 | 8 | 1 | null | 2008-09-17 04:46:25.487 UTC | 28 | 2018-11-15 19:30:14.077 UTC | 2008-09-17 05:13:28.073 UTC | JasonBunting | 1,790 | Chris | null | null | 1 | 30 | javascript | 11,707 | <p>In JavaScript, <code>this</code> always refers to the object invoking the function that is being executed. So if the function is being used as an event handler, <code>this</code> will refer to the node that fired the event. But if you have an object and call a function on it like:</p>
<pre><code>myObject.myFunction... |
535,056 | How to get started with version control and PHP | <p>I have absolutely no idea about version control. Only that it can be very useful in many ways. </p>
<p>I have found a few related questions but none that start from the absolute beginning.</p>
<p>I am the only developer at my work using Mac OS X and traditionally just been using FTP.</p>
<p>Can anyone help me wit... | 535,244 | 9 | 2 | null | 2009-02-11 01:21:04.037 UTC | 14 | 2014-07-18 00:50:20.813 UTC | 2014-07-18 00:50:20.813 UTC | alex | 31,671 | alex | 31,671 | null | 1 | 35 | php|version-control | 23,110 | <p>Yes, try it out, it's worth it. And the language you are using doesn't matter. It's working great with PHP for me and it will for you too.</p>
<p><strong>Benefits</strong></p>
<p>If you are the only developer, it is indeed easier to go without version control. However, you will find great benefits to using a versi... |
140,550 | What is the best way to store a large amount of text in a SQL server table? | <p>What is the best way to store a large amount of text in a table in SQL server?</p>
<p>Is varchar(max) reliable?</p> | 140,558 | 9 | 0 | null | 2008-09-26 16:28:22.07 UTC | 4 | 2022-09-22 16:17:53.997 UTC | 2008-09-26 16:55:40.583 UTC | Rich B | 5,640 | Bruno | 17,648 | null | 1 | 51 | sql-server | 109,583 | <p>In SQL 2005 and higher, VARCHAR(MAX) is indeed the preferred method. The TEXT type is still available, but primarily for backward compatibility with SQL 2000 and lower.</p> |
433,302 | Convert a String to Variable | <p>I've got a multidimensional associative array which includes an elements like</p>
<pre><code>$data["status"]
$data["response"]["url"]
$data["entry"]["0"]["text"]
</code></pre>
<p>I've got a strings like:</p>
<pre><code>$string = 'data["status"]';
$string = 'data["response"]["url"]';
$string = 'data["entry"]["0"][... | 433,316 | 10 | 0 | null | 2009-01-11 17:52:30.64 UTC | 11 | 2022-01-04 17:09:27.223 UTC | 2011-05-25 11:21:02.04 UTC | null | 560,648 | Gilean | 6,305 | null | 1 | 20 | php|arrays|string|variables | 81,947 | <p>Quick and dirty: </p>
<pre><code>echo eval('return $'. $string . ';');
</code></pre>
<p>Of course the input string would need to be be sanitized first.</p>
<p>If you don't like quick and dirty... then this will work too and it doesn't require eval which makes even me cringe.</p>
<p>It does, however, make assumpt... |
175,881 | SQL Server Express 2008 Install Side-by-side w/ SQL 2005 Express Fails | <p>When I try to install a new instance of SQL Server 2008 Express on a development machine with SQL 2005 Express already up and running, the install validation fails because the "SQL 2005 Express tools" are installed and I'm told to remove them.</p>
<p><strong>What exactly does that mean?</strong> </p>
<p>After rea... | 175,894 | 10 | 1 | null | 2008-10-06 19:46:38.027 UTC | 11 | 2014-12-14 23:35:23.087 UTC | 2008-10-07 13:59:20.69 UTC | marc | 12,260 | marc | 12,260 | null | 1 | 41 | sql-server | 101,993 | <p>Although you should have no problem running a 2005 instance of the database engine beside a 2008 instance, The tools are installed into a shared directory, so you can't have two versions of the tools installed. Fortunately, the 2008 tools are backwards-compatible. As we speak, I'm using SSMS 2008 and Profiler 2008 t... |
805,720 | Newbie teaching self python, what else should I be learning? | <p>I'm a newbie to programming. I had 1 semester of computer science (we used java). I got an A in the course and was able to do everything assigned, however I'm not sure I really understood it. I ignored the text and learned by looking at sample programs and then trial and error. I was ahead of the class except for t... | 805,775 | 11 | 0 | null | 2009-04-30 07:08:06.503 UTC | 9 | 2013-10-22 08:10:45.693 UTC | 2009-08-05 18:40:39.41 UTC | null | 120,888 | null | 98,312 | null | 1 | 10 | python|theory | 3,411 | <p>My recommendation is always to start at the high level of abstraction. You don't need to know how logic gates work and how you can use them to build a CPU -- it's cool stuff, but it's cool stuff that makes a <em>lot</em> more sense once you've messed around at the higher levels. Python is therefore an excellent ch... |
409,256 | Working with byte arrays in C# | <p>I have a byte array that represents a complete TCP/IP packet. For clarification, the byte array is ordered like this:</p>
<p>(IP Header - 20 bytes)(TCP Header - 20 bytes)(Payload - X bytes)</p>
<p>I have a <code>Parse</code> function that accepts a byte array and returns a <code>TCPHeader</code> object. It looks... | 409,269 | 11 | 2 | null | 2009-01-03 16:00:03.28 UTC | 4 | 2018-01-29 02:01:21.873 UTC | 2011-05-26 18:27:22.053 UTC | Matt Davis | 50,776 | Matt Davis | 51,170 | null | 1 | 13 | c#|.net|networking|.net-3.5|bytearray | 44,010 | <p>A common practice you can see in the .NET framework, and that I recommend using here, is specifying the offset and length. So make your Parse function also accept the offset in the passed array, and the number of elements to use.</p>
<p>Of course, the same rules apply as if you were to pass a pointer like in C++ - ... |
1,068,881 | jQuery remove HTML table column | <p>I have a HTML table like this: </p>
<pre><code><table border="1">
<tbody>
<tr>
<td><a href="#" class="delete">DELETE ROW</a>COL 1</td>
<td><a href="#" class="delete">DELETE COL</a>COL 2</td>
<td>&... | 1,068,902 | 11 | 0 | null | 2009-07-01 12:25:57.007 UTC | 12 | 2016-09-29 16:01:36.123 UTC | 2016-09-29 16:01:36.123 UTC | null | 4,370,109 | null | 56,409 | null | 1 | 24 | jquery|html-table | 73,105 | <p>After a few years, it's probably time to update the answer on this question.</p>
<pre><code>// Listen for clicks on table originating from .delete element(s)
$("table").on("click", ".delete", function ( event ) {
// Get index of parent TD among its siblings (add one for nth-child)
var ndx = $(this).parent()... |
127,477 | Detecting WPF Validation Errors | <p>In WPF you can setup validation based on errors thrown in your Data Layer during Data Binding using the <code>ExceptionValidationRule</code> or <code>DataErrorValidationRule</code>.</p>
<p>Suppose you had a bunch of controls set up this way and you had a Save button. When the user clicks the Save button, you need ... | 4,650,392 | 11 | 0 | null | 2008-09-24 14:22:10.7 UTC | 53 | 2022-09-01 19:33:29.767 UTC | 2015-04-22 11:17:24.12 UTC | null | 1,468,295 | Kevin Berridge | 4,407 | null | 1 | 120 | wpf|validation|data-binding | 66,921 | <p>This post was extremely helpful. Thanks to all who contributed. Here is a LINQ version that you will either love or hate.</p>
<pre><code>private void CanExecute(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = IsValid(sender as DependencyObject);
}
private bool IsValid(DependencyObject obj)
{
/... |
664,432 | How do I programmatically change file permissions? | <p>In Java, I'm dynamically creating a set of files and I'd like to change the file permissions on these files on a linux/unix file system. I'd like to be able to execute the Java equivalent of <code>chmod</code>. Is that possible Java 5? If so, how?</p>
<p>I know in Java 6 the <code>File</code> object has <code>setR... | 664,443 | 11 | 1 | null | 2009-03-19 23:21:21.833 UTC | 37 | 2021-02-03 14:55:50.183 UTC | 2018-05-09 08:43:17.253 UTC | Roy Rico | 1,685,157 | Roy Rico | 1,580 | null | 1 | 143 | java|filesystems | 210,477 | <p>Full control over file attributes is available in Java 7, as part of the "new" New IO facility (<a href="http://jcp.org/en/jsr/detail?id=203" rel="noreferrer">NIO.2</a>). For example, POSIX permissions can be set on an existing file with <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#setP... |
201,893 | WARNING: UNPROTECTED PRIVATE KEY FILE! when trying to SSH into Amazon EC2 Instance | <p>I'm working to set up Panda on an Amazon EC2 instance.
I set up my account and tools last night and had no problem using SSH to interact with my own personal instance, but right now I'm not being allowed permission into Panda's EC2 instance.
<a href="http://pandastream.com/docs/getting_started" rel="noreferrer">Gett... | 217,729 | 12 | 5 | null | 2008-10-14 16:31:01.35 UTC | 49 | 2022-01-12 17:33:01.347 UTC | 2013-02-28 08:03:04.117 UTC | Stu Thompson | 650,722 | Bryan Woods | 2,293 | null | 1 | 237 | ssh|amazon-web-services|amazon-ec2|chmod | 220,917 | <blockquote>
<p>I've chmoded my keypair to 600 in order to get into my personal instance last night,</p>
</blockquote>
<p>And this is the way it is supposed to be. </p>
<p>From the <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html" rel="noreferrer">EC2 documentation</a> we ha... |
463,642 | How can I convert seconds into (Hour:Minutes:Seconds:Milliseconds) time? | <p>How can I convert seconds into (Hour:Minutes:Seconds:Milliseconds) time?</p>
<p>Let's say I have 80 seconds; are there any specialized classes/techniques in .NET that would allow me to convert those 80 seconds into (00h:00m:00s:00ms) format like <code>Convert.ToDateTime</code> or something?</p> | 463,668 | 13 | 0 | null | 2009-01-21 00:10:42.95 UTC | 57 | 2022-04-06 22:40:29.04 UTC | 2022-04-06 22:40:29.04 UTC | null | 17,142,802 | John Gates | null | null | 1 | 339 | c#|datetime | 392,195 | <p>For <strong>.Net <= 4.0</strong> Use the TimeSpan class.</p>
<pre><code>TimeSpan t = TimeSpan.FromSeconds( secs );
string answer = string.Format("{0:D2}h:{1:D2}m:{2:D2}s:{3:D3}ms",
t.Hours,
t.Minutes,
t.Seconds,
t.Milliseconds);
</code></pre>
... |
1,063,497 | Hidden Features of Erlang | <p>In the spirit of:</p>
<ul>
<li>Hidden Features of C#</li>
<li>Hidden Features of Java</li>
<li>Hidden Features of ASP.NET</li>
<li>Hidden Features of Python</li>
<li>Hidden Features of HTML</li>
<li>and other Hidden Features questions</li>
</ul>
<p>What are the hidden features of Erlang that every Erlang developer... | 1,064,479 | 17 | 3 | 2009-07-28 16:20:36.093 UTC | 2009-06-30 12:52:10.173 UTC | 59 | 2011-02-28 11:17:02.14 UTC | 2009-12-14 21:11:38.693 UTC | null | 13,531 | null | 64,253 | null | 1 | 17 | erlang|hidden-features | 10,482 | <p>The magic commands in the shell. The full list is in <a href="http://www.erlang.org/doc/man/shell.html" rel="nofollow noreferrer">the manual</a>, but the ones I use most are:</p>
<ul>
<li>f() - forget all variables</li>
<li>f(X) - forget X</li>
<li>v(42) - recall result from line 42</li>
<li>v(-1) - recall result ... |
122,407 | What's the nearest substitute for a function pointer in Java? | <p>I have a method that's about ten lines of code. I want to create more methods that do exactly the same thing, except for a small calculation that's going to change one line of code. This is a perfect application for passing in a function pointer to replace that one line, but Java doesn't have function pointers. W... | 122,414 | 22 | 6 | null | 2008-09-23 17:20:10.7 UTC | 119 | 2020-09-07 11:54:54.703 UTC | 2012-07-09 16:47:43.637 UTC | null | 1,288 | Bill the Lizard | 1,288 | null | 1 | 306 | java|closures|function-pointers | 91,211 | <p>Anonymous inner class</p>
<p>Say you want to have a function passed in with a <code>String</code> param that returns an <code>int</code>.<br>
First you have to define an interface with the function as its only member, if you can't reuse an existing one.</p>
<pre><code>interface StringFunction {
int func(String... |
436,014 | Why should I use templating system in PHP? | <p>Why should I use templating system in PHP?</p>
<p>The reasoning behind my question is: PHP itself is feature rich templating system, why should I install another template engine?</p>
<p>The only two pros I found so far are:</p>
<ol>
<li>A bit cleaner syntax (sometimes)</li>
<li>Template engine is not usually powe... | 436,055 | 25 | 4 | null | 2009-01-12 16:37:12.68 UTC | 27 | 2020-01-04 13:30:56.893 UTC | 2016-12-21 14:48:50.59 UTC | JS | 53,864 | JS | 53,864 | null | 1 | 61 | php|smarty|template-engine | 13,592 | <p>Yes, as you said, if you don't force yourself to use a templating engine inside PHP ( the templating engine ) it becomes easy to slip and stop separating concerns. </p>
<p><strong>However</strong>, the same people who have problems separating concerns end up generating HTML and feeding it to smarty, or executing P... |
6,647,166 | How do I pattern match arrays in Scala? | <p>My method definition looks as follows</p>
<pre><code>def processLine(tokens: Array[String]) = tokens match { // ...
</code></pre>
<p>Suppose I wish to know whether the second string is blank</p>
<pre><code>case "" == tokens(1) => println("empty")
</code></pre>
<p>Does not compile. How do I go about doing thi... | 6,647,649 | 4 | 1 | null | 2011-07-11 07:49:04.99 UTC | 10 | 2014-01-29 23:58:07.08 UTC | 2011-07-11 19:10:48.243 UTC | null | 65,299 | null | 144,152 | null | 1 | 74 | scala | 41,004 | <p>If you want to pattern match on the array to determine whether the second element is the empty string, you can do the following:</p>
<pre><code>def processLine(tokens: Array[String]) = tokens match {
case Array(_, "", _*) => "second is empty"
case _ => "default"
}
</code></pre>
<p>The <code>_*</code> bin... |
6,833,558 | Replace Console.WriteLine in NUnit | <p>I haven't done much with NUnit before, but I just wanted to dump some text to a window in a console type fashion. For example:</p>
<pre class="lang-cs prettyprint-override"><code>Console.WriteLine("... some information...");
</code></pre>
<p>That won't work of course because NUnit is driving things.</p>
<p... | 6,833,590 | 5 | 0 | null | 2011-07-26 16:43:56.19 UTC | 8 | 2022-05-12 15:18:25.3 UTC | 2020-12-30 00:08:47.57 UTC | null | 1,402,846 | null | 685,711 | null | 1 | 60 | c#|.net|debugging|nunit | 57,610 | <p>You can see the console output. You just have to select the "Text Output" tab in the NUnit GUI runner.</p>
<p><img src="https://i.stack.imgur.com/vIjTv.png" alt="Enter image description here" /></p>
<p>If you are using the ReSharper test runner, the console output should be displayed. Ensure that the test ... |
6,754,919 | JSON.stringify function | <p>I have an object that has some properties and methods, like so:</p>
<pre><code>{name: "FirstName",
age: "19",
load: function () {},
uniq: 0.5233059714082628}
</code></pre>
<p>and I have to pass this object to another function. So I tried to use JSON.stringify(obj) but the load function (which of course isn't empty... | 6,755,006 | 6 | 2 | null | 2011-07-19 22:34:07.193 UTC | 14 | 2021-10-08 14:26:26.013 UTC | 2015-09-30 12:34:27.137 UTC | null | 3,154,233 | null | 848,941 | null | 1 | 42 | javascript|json|object | 46,684 | <p>Why exactly do you want to stringify the object? JSON doesn't understand functions (and it's not supposed to). If you want to pass around objects why not do it one of the following ways?</p>
<pre><code>var x = {name: "FirstName", age: "19", load: function () {alert('hai')}, uniq: 0.5233059714082628};
function y(ob... |
6,747,176 | How can I remove a background-image attribute? | <p>I have this code :</p>
<pre><code>if (pansel.val() == "1")
$(#myDiv).css('background-image', 'url(/private_images/guida_check_category.jpg)');
else
$(#myDiv).css({ 'background-color': '#ffffff' });
</code></pre>
<p>and I see that, when I apply the background-image, the follow code :</p>
<pre><code>$(... | 6,747,190 | 7 | 0 | null | 2011-07-19 12:33:11.973 UTC | null | 2020-06-28 19:08:59.32 UTC | null | null | null | null | 365,251 | null | 1 | 21 | jquery|css | 74,776 | <p>Try this:</p>
<pre><code>if (pansel.val() == "1")
$("#myDiv").css('background-image', 'url(/private_images/guida_check_category.jpg)');
else {
$("#myDiv").css({ 'background-color': '#ffffff' });
$("#myDiv").css('background-image', 'none');
}
</code></pre> |
6,800,894 | Django returns 403 error when sending a POST request | <p>when I'm using following Python code to send a POST request to my Django website I'm getting 403: Forbidden error.</p>
<pre><code>url = 'http://www.sub.example.com/'
values = { 'var': 'test' }
try:
data = urllib.urlencode(values, doseq=True)
req = urllib2.Request(url, data)
response = urllib2.urlopen(re... | 6,801,207 | 7 | 4 | null | 2011-07-23 14:04:54.67 UTC | 11 | 2022-07-05 09:12:08.527 UTC | 2022-07-05 09:12:08.527 UTC | null | 1,145,388 | null | 855,472 | null | 1 | 49 | python|django|http-status-code-403|http-post | 83,268 | <p>Does the view that you are posting to have a Django Form on it? If so, I wonder if it's giving a csrf error. I think that manifests itself as a 403. In that case, you'd need to add the {{ csrf_token }} tag. Just a thought. </p> |
6,980,906 | Android Color Picker | <p>I am looking for a Color Picker framework which can return color HEX on selection.</p>
<p>I have looked at <a href="https://github.com/danielnilsson9/color-picker-view" rel="noreferrer">this</a> wondering if there is some other library I can use.</p> | 6,981,145 | 8 | 0 | null | 2011-08-08 10:39:06.453 UTC | 21 | 2021-06-12 09:50:29.373 UTC | 2015-08-19 08:54:36.817 UTC | null | 1,196,908 | null | 155,196 | null | 1 | 48 | java|android|colors|picker | 132,975 | <p>try this open source projects that might help you</p>
<p><a href="https://github.com/QuadFlask/colorpicker" rel="noreferrer">https://github.com/QuadFlask/colorpicker</a></p> |
6,825,943 | Difference between Console.Read() and Console.ReadLine()? | <p>I'm new to this field and I'm very confused: what is the real difference between <code>Console.Read()</code> and <code>Console.ReadLine()</code>?</p> | 6,825,957 | 12 | 3 | null | 2011-07-26 06:05:49.843 UTC | 17 | 2021-04-15 06:56:51.25 UTC | 2014-01-29 13:51:36.71 UTC | null | 114,770 | null | 709,458 | null | 1 | 38 | c#|input|console|inputstream | 200,295 | <p><a href="http://msdn.microsoft.com/en-us/library/system.console.read.aspx" rel="noreferrer"><code>Console.Read()</code></a> reads only the next character from standard input,
and <a href="http://msdn.microsoft.com/en-us/library/system.console.readline.aspx" rel="noreferrer"><code>Console.ReadLine()</code></a> reads... |
6,811,372 | How to code a BAT file to always run as admin mode? | <p>I have this line inside my BAT file:</p>
<pre><code>"Example1Server.exe"
</code></pre>
<p>I would like to execute this in Administrator mode. How to modify the bat code to run this as admin?</p>
<p>Is this correct? Do I need to put the quotes?</p>
<pre><code>runas /user:Administrator invis.vbs Example1Server.exe... | 6,811,394 | 12 | 2 | null | 2011-07-25 02:51:29.8 UTC | 53 | 2022-02-10 12:17:18.74 UTC | 2011-07-25 02:59:25.157 UTC | null | 192,173 | null | 192,173 | null | 1 | 181 | windows|batch-file | 806,918 | <p>You use <code>runas</code> to launch a program as a specific user:</p>
<pre><code>runas /user:Administrator Example1Server.exe
</code></pre> |
6,745,919 | UITableViewCell subview disappears when cell is selected | <p>I'm implementing a color-chooser table view where the user can select amongst, say, 10 colors (depends on the product). The user can also select other options (like hard drive capacity, ...).</p>
<p>All color options are inside their own tableview section.</p>
<p>I want to display a little square on the left of th... | 27,717,607 | 20 | 3 | null | 2011-07-19 10:45:07.3 UTC | 47 | 2022-07-30 07:32:20.887 UTC | null | null | null | null | 526,547 | null | 1 | 177 | iphone|ios|uitableview | 57,475 | <p><code>UITableViewCell</code> changes the background color of all sub views when cell is selected or highlighted ,You can Solve this problem by overriding Tableview cell's <code>setSelected:animated</code> and <code>setHighlighted:animated</code> and resetting view background color.</p>
<p><strong>In Objective C :</... |
38,263,406 | What are differences between SystemJS and Webpack? | <p>I'm creating my first Angular application and I would figure out what is the role of the module loaders.
Why we need them?
I tried to search and search on Google and I can't understand why we need to install one of them to run our application?</p>
<p>Couldn't it be enough to just use <code>import</code> to load st... | 38,263,593 | 3 | 2 | null | 2016-07-08 09:36:18.147 UTC | 91 | 2021-11-29 23:31:06.057 UTC | 2021-11-29 23:31:06.057 UTC | null | 1,205,871 | null | 2,516,399 | null | 1 | 234 | javascript|angular|webpack|node-modules|systemjs | 98,625 | <p>If you go to the SystemJS Github page, you will see the description of the tool:</p>
<blockquote>
<p>Universal dynamic module loader - loads ES6 modules, AMD, CommonJS and global scripts in the browser and NodeJS.</p>
</blockquote>
<p>Because you use modules in TypeScript or ES6, you need a module loader. In the... |
15,874,366 | Could not load file or assembly 'System.Web.Razor' or one of its dependencies | <p>I used Umbraco 4.11.6 in my website(web application).My website is worked in localhost(tested from Visual studio 2012 and IIS(v7)) but when I run it from internet space I got an error.
The error was:</p>
<h2>Could not load file or assembly 'System.Web.Razor' or one of its dependencies. The located assembly's manife... | 15,887,969 | 6 | 3 | null | 2013-04-08 08:18:00.247 UTC | 4 | 2020-04-03 14:56:57.797 UTC | 2013-04-08 08:29:52.5 UTC | null | 1,817,640 | null | 1,817,640 | null | 1 | 26 | c#|asp.net|asp.net-mvc|deployment|umbraco | 67,560 | <p>Quite a few ways to fix this:</p>
<ol>
<li><p>Install MVC on the web server (which is not always possible).</p></li>
<li><p>In visual studio you can set dlls to copy to local on build, see the following article (please note MVC dlls have changed names slightly but it gives you the process)
<a href="http://haacked.c... |
35,817,558 | Why does C# allow making an override async? | <p>In C#, when you override a method, it is permitted to make the override async when the original method was not. This seems like poor form. </p>
<p>The problem that makes me wonder is this: I was brought in to assist with a load test problem. At around 500 concurrent users, the login process would break down into a ... | 35,818,404 | 3 | 21 | null | 2016-03-05 17:48:08.23 UTC | 2 | 2017-07-24 21:06:37.13 UTC | 2017-07-24 20:59:37.613 UTC | null | 1,459,996 | null | 8,513 | null | 1 | 45 | c#|async-await | 22,258 | <p>When the base class (or interface) declares a virtual method that returns a Task, you can override it as long as you return Task. The <code>async</code> keyword is just a hint to the compiler to transform your method into a state machine. Although the compiler does it's black magic on your method, the compiled meth... |
10,321,393 | jquery function on toggleClass complete? | <p>How can I do a function once a toggleClass has completed? I've tried the following but with no luck:</p>
<pre><code>$("#loader").toggleClass('fadeOut', function () {
alert('a');
});
</code></pre> | 10,321,923 | 2 | 3 | null | 2012-04-25 18:15:24.78 UTC | 12 | 2018-07-05 15:09:59.647 UTC | 2012-04-25 18:20:39.943 UTC | null | 572,939 | null | 1,013,512 | null | 1 | 32 | jquery | 37,625 | <p>jQuery has a promise method that returns a promise that resolves after all running animations on selected elements are complete. At that point, you can bind to it's done method.</p>
<pre><code>$("#loader").toggleClass('fadeOut',600).promise().done(function(){
console.log('a');
});
</code></pre>
<p><a href="htt... |
10,805,589 | Convert JSON date string to Python datetime | <p>When translating dates to JSON, javascript is saving dates in this format:</p>
<pre><code>2012-05-29T19:30:03.283Z
</code></pre>
<p>However, I am not sure how to get this into a python datetime object. I've tried these:</p>
<pre><code># Throws an error because the 'Z' isn't accounted for:
datetime.datetime.strpti... | 10,805,633 | 3 | 3 | null | 2012-05-29 19:40:21.783 UTC | 9 | 2022-07-21 16:39:18.12 UTC | 2017-05-28 03:54:29.42 UTC | null | 832,230 | null | 84,131 | null | 1 | 50 | python|json|datetime|date|iso | 50,649 | <p>Try the following format:</p>
<pre><code>%Y-%m-%dT%H:%M:%S.%fZ
</code></pre>
<p>For example:</p>
<pre><code>>>> datetime.datetime.strptime('2012-05-29T19:30:03.283Z', '%Y-%m-%dT%H:%M:%S.%fZ')
datetime.datetime(2012, 5, 29, 19, 30, 3, 283000)
</code></pre>
<p>The <code>Z</code> in the date just means tha... |
10,419,530 | Multi line preprocessor macros | <p>How to make multi line preprocessor macro? I know how to make one line:</p>
<pre><code>#define sqr(X) (X*X)
</code></pre>
<p>but I need something like this:</p>
<pre><code>#define someMacro(X)
class X : public otherClass
{
int foo;
void doFoo();
};
</code></pre>
<p>How can I get thi... | 10,419,556 | 7 | 3 | null | 2012-05-02 18:25:57.503 UTC | 24 | 2022-08-22 17:12:43.53 UTC | 2015-10-23 14:09:52.69 UTC | null | 2,246,488 | null | 1,023,753 | null | 1 | 97 | c++|c|c-preprocessor | 92,479 | <p>You use <code>\</code> as a line continuation escape character.</p>
<pre><code>#define swap(a, b) { \
(a) ^= (b); \
(b) ^= (a); \
(a) ^= (b); \
}
</code></pre>
<p>EDIT: As @abelenky pointed out in the comments, th... |
10,520,772 | In R, how to get an object's name after it is sent to a function? | <p>I am looking for the reverse of <code>get()</code>.</p>
<p>Given an object name, I wish to have the character string representing that object extracted directly from the object.</p>
<p>Trivial example with <code>foo</code> being the placeholder for the function I am looking for.</p>
<pre><code>z <- data.frame(... | 10,520,832 | 5 | 4 | null | 2012-05-09 17:05:40.323 UTC | 46 | 2022-09-16 15:08:48.667 UTC | 2015-11-09 02:30:26.743 UTC | null | 3,576,984 | null | 742,447 | null | 1 | 169 | r | 67,320 | <p>The old deparse-substitute trick:</p>
<pre><code>a<-data.frame(x=1:10,y=1:10)
test<-function(z){
mean.x<-mean(z$x)
nm <-deparse(substitute(z))
print(nm)
return(mean.x)}
test(a)
#[1] "a" ... this is the side-effect of the print() call
# ... you could have done something... |
24,990,554 | How to include a font .ttf using CSS? | <p>I have a problem with my code. Because I want to include a global font for my page and I downloaded a .ttf file. And I include it in my main CSS but my font wont change.</p>
<p>Here's my simple code:</p>
<pre><code>@font-face {
font-family: 'oswald';
src: url('/font/oswald.regular.ttf');
}
html, body, div... | 24,990,647 | 4 | 8 | null | 2014-07-28 07:39:22.1 UTC | 43 | 2022-09-01 06:17:02.477 UTC | 2014-07-28 07:49:50.763 UTC | null | 2,706,036 | null | 2,706,036 | null | 1 | 191 | html|css | 369,877 | <p>Only providing .ttf file for webfont won't be good enough for cross-browser support. The best possible combination at present is using the combination as :</p>
<pre class="lang-css prettyprint-override"><code>@font-face {
font-family: 'MyWebFont';
src: url('webfont.eot'); /* IE9 Compat Modes */
src: url(... |
46,629,170 | Firestore security rule get() not work | <h1>The solution is in the end of the post. Check it out.</h1>
<h1>Решение проблемы в конце поста. Дочитайте.</h1>
<p>just a simple question: whats wrong with this and why this is not working?</p>
<p>Trying to get access with user who has role 'admin' in users section to the <strong>/titles/{anyTitle}</strong> but s... | 46,681,577 | 5 | 11 | null | 2017-10-08 08:45:57.677 UTC | 10 | 2020-04-08 08:15:34.513 UTC | 2017-10-13 09:14:16.563 UTC | null | 8,740,159 | null | 8,740,159 | null | 1 | 17 | firebase|firebase-security|google-cloud-firestore | 9,993 | <p>I contacted to the Firebase support to report that bug and they gave me a temporary solution on this. It seems that they are having a bug in their systems on the security rules side. They say that the documentation is ok, but for now we should workaround this way:</p>
<pre><code>get(path).data.field == true || get(... |
33,854,103 | Why were Javascript `atob()` and `btoa()` named like that? | <p>In Javascript, <code>window.atob()</code> method decodes a <em>base64</em> string and <code>window.btoa()</code> method encodes a <code>string</code> into <em>base64</em>.</p>
<p>Then why weren't they named like <code>base64Decode()</code> and <code>base64Encode()</code>?
<code>atob()</code> and <code>btoa()</code>... | 33,854,127 | 5 | 6 | null | 2015-11-22 11:11:59.28 UTC | 46 | 2022-01-21 17:49:37.95 UTC | 2018-10-06 08:54:55.25 UTC | null | 4,510,033 | null | 4,510,033 | null | 1 | 396 | javascript | 105,685 | <p>The <code>atob()</code> and <code>btoa()</code> methods allow authors to transform content to and from the base64 encoding.</p>
<blockquote>
<p>In these APIs, for mnemonic purposes, the "b" can be considered to
stand for "binary", and the "a" for "ASCII". In practice, though, for
primarily historical reasons,... |
33,431,953 | How is conditional_wait() implemented at the kernel and hardware/assembly level? | <p>I understand that the thread that waits on a conditional variable, atomically releases the lock and goes to sleep until is waken by a conditional signal from another thread (when a particular condition is met). After it wakes up, it atomically re-acquires the lock (somehow magically) and updates as required and unlo... | 33,438,201 | 1 | 10 | null | 2015-10-30 08:50:51.257 UTC | 10 | 2018-07-04 17:19:11.81 UTC | 2015-10-30 12:42:40.067 UTC | null | 2,733,779 | null | 2,733,779 | null | 1 | 20 | c|multithreading|linux-kernel|synchronization|mutex | 4,162 | <p>On a high level (and since you are asking this question, high level is what you need) it is not that complicated. First, you need to know the layers of responsibility. There are basically 3 layers:</p>
<ul>
<li>Hardware level - usually something which can be coded in a single ASM instruction</li>
<li>Kernel level -... |
13,294,468 | Alter column in SQL Server | <p>What is correct syntax for an <code>ALTER</code> statement to add a default value to an existing column?</p>
<p>I can add new column with no errors:</p>
<pre><code>ALTER TABLE tb_TableName ADD Record_Status varchar(20)
</code></pre>
<p>But If I try to alter existing column to apply default value by using the foll... | 13,294,539 | 3 | 0 | null | 2012-11-08 17:31:26.913 UTC | 3 | 2018-05-01 12:31:44.177 UTC | 2012-11-08 18:22:35.58 UTC | null | 13,302 | null | 201,889 | null | 1 | 29 | sql|sql-server-2008 | 107,661 | <p>I think you want this syntax:</p>
<pre><code>ALTER TABLE tb_TableName
add constraint cnt_Record_Status Default '' for Record_Status
</code></pre>
<p>Based on some of your comments, I am going to guess that you might already have <code>null</code> values in your table which is causing the alter of the column to <... |
13,593,900 | How to get around lack of covariance with IReadOnlyDictionary? | <p>I'm trying to expose a read-only dictionary that holds objects with a read-only interface. Internally, the dictionary is write-able, and so are the objects within (see below example code). My problem is that IReadOnlyDictionary doesn't support covariant conversions because of the reason outlined in the question <a h... | 13,602,918 | 5 | 0 | null | 2012-11-27 21:59:17.617 UTC | 3 | 2017-11-15 04:39:59.937 UTC | 2017-05-23 12:17:09.54 UTC | null | -1 | null | 306,918 | null | 1 | 32 | c#|.net|dictionary|readonly|covariance | 6,936 | <p>You could write your own read-only wrapper for the dictionary, e.g.:</p>
<pre><code>public class ReadOnlyDictionaryWrapper<TKey, TValue, TReadOnlyValue> : IReadOnlyDictionary<TKey, TReadOnlyValue> where TValue : TReadOnlyValue
{
private IDictionary<TKey, TValue> _dictionary;
public ReadOn... |
13,629,507 | Celery: How to ignore task result in chord or chain? | <p>I'm using celery, I have several tasks which needed to be executed in order.</p>
<p>For example I have this task:</p>
<pre><code>@celery.task
def tprint(word):
print word
</code></pre>
<p>And I want to do something like this:</p>
<pre><code>>>> chain(tprint.s('a') | tprint.s('b'))()
</code></pre>
<... | 13,788,495 | 4 | 1 | null | 2012-11-29 15:51:06.267 UTC | 9 | 2016-10-10 09:37:18.083 UTC | 2012-12-04 08:58:13.163 UTC | null | 543,492 | null | 543,492 | null | 1 | 43 | python|asynchronous|task|celery | 17,618 | <p>There is a built-in functionality to ignore result in chaining and others - immutable subtask. You can use .si() shortcut instead of .s() or .subtask(immutable=True)</p>
<p>More details here: <a href="http://docs.celeryproject.org/en/master/userguide/canvas.html#immutability">http://docs.celeryproject.org/en/master... |
13,357,765 | Does ConfigurationManager.AppSettings[Key] read from the web.config file each time? | <p>I'm wondering how the <code>ConfigurationManager.AppSettings[Key]</code> works.</p>
<p>Does it read from the physical file each time I need a key? If so, should I be reading all the app settings of my web.config in a cache and then read from it?</p>
<p>Or does ASP.NET or IIS load the web.config file only once at app... | 13,358,044 | 3 | 0 | null | 2012-11-13 08:48:01.473 UTC | 10 | 2020-06-25 14:03:14.45 UTC | 2020-06-25 14:03:14.45 UTC | null | 5,405,967 | null | 133,212 | null | 1 | 76 | c#|asp.net|web-config|configurationmanager | 33,346 | <p>It gets cached, on first access of a property, so it does not read from the physical file each time you ask for a value. This is why it is necessary to restart an Windows app (or <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.refreshsection.aspx" rel="noreferrer">Refresh</... |
51,951,641 | Swagger..Unable to render this definition The provided definition does not specify a valid version field | <blockquote>
<p>Unable to render this definition The provided definition does not
specify a valid version field.</p>
<p>Please indicate a valid Swagger or OpenAPI version field. Supported
version fields are swagger: "2.0" and those that match openapi: 3.0.n
(for example, openapi: 3.0.0).</p>
</blockquote>... | 51,952,309 | 10 | 4 | null | 2018-08-21 15:05:22.4 UTC | 1 | 2022-08-17 13:33:52.603 UTC | null | null | null | null | 6,345,993 | null | 1 | 31 | javascript|api|swagger | 67,438 | <p>Your <a href="https://github.com/HaiderMalik12/build-and-secure-restful-api/blob/master/src/config/swagger.json" rel="noreferrer">API definition</a> is missing the OpenAPI/Swagger version number, in this case <code>"swagger": "2.0"</code>. Add it at the beginning, like so:</p>
<pre><code>{
"swagger": "2.0",
... |
24,062,123 | MongoDB Syntax Error Unexpected Token | <p>I am new to MongoDB. I am just following tutorialspoint.com for learning mongoDB. </p>
<p>I executed these two commands exactly as given :</p>
<pre><code>db.test.save( { a: 1 } )
db.test.find(){ "_id" : ObjectId(5879b0f65a56a454), "a" : 1 }
</code></pre>
<p>I am getting error SyntaxError: Unexpected Token {</p>
... | 24,063,747 | 3 | 2 | null | 2014-06-05 13:53:55.69 UTC | 0 | 2018-11-17 20:45:48.28 UTC | 2014-06-05 15:13:33.367 UTC | null | 3,276,627 | null | 2,844,579 | null | 1 | 4 | mongodb|syntax | 54,103 | <p>Your query:</p>
<pre><code> test.find() { "_id" : ObjectId(5879b0f65a56a454), "a" : 1 }
</code></pre>
<p>Correct query:</p>
<pre><code> test.find( { "_id" : ObjectId("5879b0f65a56a454"), "a" : 1 })
</code></pre>
<p>you need to include curly braces in the round brackets like ({}) second thing enclose id in quotes... |
24,049,020 | NSNotificationCenter addObserver in Swift | <p>How do you add an observer in Swift to the default notification center? I'm trying to port this line of code that sends a notification when the battery level changes.</p>
<pre><code>[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(batteryLevelChanged:) name:UIDeviceBatteryLevelDidChangeNot... | 24,049,111 | 16 | 3 | null | 2014-06-04 23:02:04.91 UTC | 147 | 2022-08-05 06:16:13.567 UTC | 2017-04-09 16:23:30.577 UTC | null | 2,303,865 | null | 284,714 | null | 1 | 442 | ios|swift|nsnotificationcenter | 384,851 | <p>It's the same as the Objective-C API, but uses Swift's syntax.</p>
<p><strong>Swift 4.2 & Swift 5:</strong></p>
<pre><code>NotificationCenter.default.addObserver(
self,
selector: #selector(self.batteryLevelChanged),
name: UIDevice.batteryLevelDidChangeNotification,
object: nil)
</code></pre>
<... |
9,614,109 | How to calculate an angle from points? | <p>I want to get a simple solution to calculate the angle of a line (like a pointer of a clock).</p>
<p>I have 2 points:</p>
<pre><code>cX, cY - the center of the line.
eX, eY - the end of the line.
The result is angle (0 <= a < 360).
</code></pre>
<p>Which function is able to provide this value?</p> | 9,614,122 | 5 | 2 | null | 2012-03-08 07:16:55.15 UTC | 10 | 2018-11-13 14:37:36.443 UTC | 2012-03-08 07:19:37.523 UTC | null | 814,761 | null | 362,214 | null | 1 | 64 | javascript|function|coordinates|angle | 82,254 | <p>You want the arctangent:</p>
<pre><code>dy = ey - cy
dx = ex - cx
theta = arctan(dy/dx)
theta *= 180/pi // rads to degs
</code></pre>
<p>Erm, note that the above is obviously not compiling Javascript code. You'll have to look through documentation for the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaS... |
9,224,056 | Android Bitmap to Base64 String | <p>How do I convert a large Bitmap (photo taken with the phone's camera) to a Base64 String?</p> | 9,224,180 | 7 | 2 | null | 2012-02-10 07:08:20.843 UTC | 32 | 2020-02-20 12:01:21.193 UTC | 2018-10-15 20:45:54.463 UTC | null | 3,623,128 | null | 1,187,193 | null | 1 | 162 | android|bitmap|base64|android-bitmap | 144,538 | <p>use following method to convert bitmap to byte array:</p>
<pre><code>ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
byte[] byteArray = byteArrayOutputStream .toByteArray();
</code></pre>
<p>to encode base64 from b... |
16,437,872 | fxml combobox, get the selected value into javafx | <p>how can i catch the selected value of a fxml combobox and implement it into a javafx class?</p>
<p>i gave the combobox the fx:id "sample" and created a button with onAction="#test" and tried .getValue and .getPromptText.</p>
<pre><code>@FXML private ComboBox<String> Sample;
@FXML protected void test( Action... | 16,455,891 | 4 | 0 | null | 2013-05-08 10:04:55.727 UTC | 1 | 2020-09-19 14:11:55.033 UTC | null | null | null | null | 2,361,460 | null | 1 | 14 | combobox|javafx|fxml | 89,227 | <p>I think the code you have in your question should work as long as the case of the combobox identifier in the code matches that of your fxml <code>fx:id</code>.</p>
<p>I modified this <a href="https://gist.github.com/jewelsea/3062859">JavaFX fxml combo box selection demonstration app</a> to add a button with an onAc... |
16,383,776 | Detect in-app browser (WebView) with PHP / Javascript | <p>I developed an app for iOS and Android which accesses an HTML file from my webserver using the in-app browser (Webview).</p>
<p>I don't want that a user can access this file without using the app. Is there a possibility to detect, if the user is accessing the file with the app or directly via a browser on this smar... | 16,383,808 | 3 | 2 | null | 2013-05-05 10:56:04.103 UTC | 8 | 2020-02-18 17:41:43.463 UTC | 2013-05-05 12:13:45.7 UTC | null | 2,165,970 | null | 2,165,970 | null | 1 | 19 | php|javascript|android|ios|xcode | 33,615 | <p>I'm not sure about Android, but when you're using the iOS SDK's <code>UIWebView</code>, it sends the name and version of your app as part of the user agent (<code>YourApp/1.0</code>).</p>
<p>You can then use PHP to check if your in-app webview is being used or not:</p>
<pre><code>if (strpos($_SERVER['HTTP_USER_AGE... |
16,310,588 | How to clean completely select2 control? | <p>I'm working with the awesome <a href="http://ivaynberg.github.io/select2/" rel="noreferrer">select2 control</a>.</p>
<p>I'm trying to clean and disable the select2 with the content too so I do this:</p>
<pre><code>$("#select2id").empty();
$("#select2id").select2("disable");
</code></pre>
<p>Ok, it works, but if i... | 19,546,463 | 11 | 1 | null | 2013-04-30 23:31:16.74 UTC | 5 | 2022-05-24 07:58:56.653 UTC | 2018-03-01 20:23:52.58 UTC | null | 5,731,992 | null | 1,709,738 | null | 1 | 51 | javascript|jquery|jquery-ui|jquery-select2 | 92,924 | <p>Why all this trouble???</p>
<p>use: </p>
<pre><code> $('#sel').select2('data', null);
</code></pre> |
16,149,803 | Working with big data in python and numpy, not enough ram, how to save partial results on disc? | <p>I am trying to implement algorithms for 1000-dimensional data with 200k+ datapoints in python. I want to use numpy, scipy, sklearn, networkx, and other useful libraries. I want to perform operations such as pairwise distance between all of the points and do clustering on all of the points. I have implemented working... | 16,633,274 | 1 | 3 | null | 2013-04-22 14:36:25.78 UTC | 39 | 2021-07-20 16:22:28 UTC | 2021-07-20 16:22:28 UTC | null | 2,452,869 | null | 1,469,829 | null | 1 | 67 | python|arrays|numpy|scipy|bigdata | 40,374 | <p>Using <code>numpy.memmap</code> you create arrays directly mapped into a file:</p>
<pre><code>import numpy
a = numpy.memmap('test.mymemmap', dtype='float32', mode='w+', shape=(200000,1000))
# here you will see a 762MB file created in your working directory
</code></pre>
<p>You can treat it as a conventional ar... |
16,195,871 | How do I see the current encoding of a file in Sublime Text? | <p>How do I see the current encoding of a file in Sublime Text?</p>
<p>This seems like a pretty simple thing to do but searching has not yielded much. Any pointers would be appreciated!</p> | 20,657,899 | 6 | 1 | null | 2013-04-24 15:20:41.08 UTC | 70 | 2018-05-30 04:01:53.773 UTC | 2018-01-30 19:36:16.19 UTC | null | 1,787,434 | null | 583,834 | null | 1 | 372 | encoding|sublimetext2 | 238,869 | <p>Since this thread is a popular result in google search, here is the way to do it for sublime text 3 build 3059+:
in user preferences, add the line:</p>
<pre><code>"show_encoding": true
</code></pre> |
16,522,111 | Python syntax for "if a or b or c but not all of them" | <p>I have a python script that can receive either zero or three command line arguments. (Either it runs on default behavior or needs all three values specified.)</p>
<p>What's the ideal syntax for something like:</p>
<pre><code>if a and (not b or not c) or b and (not a or not c) or c and (not b or not a):
</code></pr... | 16,522,194 | 15 | 9 | null | 2013-05-13 12:30:20.82 UTC | 28 | 2022-02-25 02:58:07.867 UTC | 2015-09-07 01:35:40.06 UTC | null | 1,832,942 | null | 1,779,735 | null | 1 | 142 | python|if-statement | 267,048 | <p>If you mean a minimal form, go with this:</p>
<pre><code>if (not a or not b or not c) and (a or b or c):
</code></pre>
<p>Which translates the title of your question.</p>
<p>UPDATE: as correctly said by Volatility and Supr, you can apply De Morgan's law and obtain equivalent:</p>
<pre><code>if (a or b or c) and ... |
16,244,969 | How to tell git to ignore individual lines, i.e. gitignore for specific lines of code | <p><code>.gitignore</code> can ignore whole files, but is there a way to ignore specific lines of code while coding?</p>
<p>I frequently and repeatedly add the same debug lines in a project, only to have to remember to remove them before committing. I'd like to just keep the lines in the code and have git disregard th... | 16,244,970 | 2 | 8 | null | 2013-04-26 20:47:17.183 UTC | 88 | 2020-05-20 07:32:38.337 UTC | null | null | null | null | 234,593 | null | 1 | 229 | git|gitignore|ignore | 85,560 | <p>This is how you can kind of do it with <a href="https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html#_tt_filter_tt" rel="noreferrer">git filters</a>:</p>
<ol>
<li>Create/Open gitattributes file:
<ul>
<li><code><project root>/.gitattributes</code> (will be committed into repo)<br>
OR</li>
<li><... |
15,392,423 | java.lang.IllegalStateException on response.SendRedirect("Location") | <p>I am a beginner in the world of Java EE. I have been trying to create a simple login System using Servlets and JSP following the guide provided here <a href="http://come2niks.com/?p=1589" rel="noreferrer">http://come2niks.com/?p=1589</a>.
This is how my doPost() look like.</p>
<pre><code>@Override
protected void d... | 15,392,646 | 3 | 2 | null | 2013-03-13 17:34:05.203 UTC | 2 | 2013-03-17 09:09:08.947 UTC | 2013-03-17 09:09:08.947 UTC | null | 472,792 | null | 1,306,343 | null | 1 | 6 | jakarta-ee|servlets | 57,915 | <p>I think before you call <code>sendRedirect()</code> the response is getting committed. It means the server has already flush the headers to the client. This will usually happen when either the response buffer has reached max size or someone has called flush() explicitly.</p>
<p>Since the response is already committe... |
22,238,368 | How can I require at least one checkbox be checked before a form can be submitted? | <p>I have a list of multiple check boxes. The user can check all of them, but at least one should be checked to allow form submission. How can I enforce that requirement?</p>
<pre><code><p>Box Set 1</p>
<ul>
<li><input name="BoxSelect[]" type="checkbox" value="Box 1" required><label... | 22,238,811 | 11 | 2 | null | 2014-03-06 23:27:03.72 UTC | 11 | 2022-06-14 11:20:13.85 UTC | 2019-10-28 19:59:54.69 UTC | null | 2,756,409 | null | 2,110,210 | null | 1 | 49 | html|css|validation|checkbox | 168,641 | <p>Here's an example using jquery and your html.</p>
<pre><code><html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function () {
$('#checkBtn').click(f... |
21,708,339 | Avoid Jackson serialization on non fetched lazy objects | <p>I have a simple controller that return a User object, this user have a attribute coordinates that have the hibernate property FetchType.LAZY.</p>
<p>When I try to get this user, I always have to load all the coordinates to get the user object, otherwise when Jackson try to serialize the User throws the exception:</... | 21,760,361 | 15 | 6 | null | 2014-02-11 17:07:14.193 UTC | 62 | 2021-05-27 16:48:57.387 UTC | 2016-05-11 14:59:38.367 UTC | null | 1,426,227 | null | 1,416,034 | null | 1 | 93 | java|spring|hibernate|serialization|jackson | 89,786 | <p>I finally found the solution! thanks to indybee for giving me a clue.</p>
<p>The tutorial <a href="http://blog.pastelstudios.com/2012/03/12/spring-3-1-hibernate-4-jackson-module-hibernate/">Spring 3.1, Hibernate 4 and Jackson-Module-Hibernate</a> have a good solution for Spring 3.1 and earlier versions. But since v... |
17,620,405 | The annotation @Index is disallowed for this location | <p>When trying to use the <code>@Index</code> annotation from <code>javax.persistence</code>, Eclipse gives me this error.</p>
<p>I'm using it right before a <code>java.util.Date</code> field, inside a class annotated with <code>@Entity</code>.</p>
<p>Before, I was using <code>org.hibernate.annotations.Index</code> i... | 17,620,465 | 3 | 0 | null | 2013-07-12 17:12:25.38 UTC | 4 | 2017-11-13 09:02:32.93 UTC | 2017-11-13 09:02:32.93 UTC | null | 4,813,586 | null | 2,004,857 | null | 1 | 30 | java|jpa|hibernate-annotations | 23,481 | <p>The JPA Index annotation can only be used as part of another annotation like <code>@Table</code>, <code>@SecondaryTable</code>, etc. (see the See Also section in the <a href="http://docs.oracle.com/javaee/7/api/javax/persistence/Index.html" rel="noreferrer">javadoc</a>):</p>
<pre><code>@Table(indexes = { @Index(...... |
18,321,244 | Is C++11 atomic<T> usable with mmap? | <p>I want to add network control of a handful of parameters used by a service (daemon) running on a Linux embedded system. There's no need for procedure calls, each parameter can be polled in a very natural way. Shared memory seems a nice way to keep networking code out of the daemon, and limit shared access to a car... | 19,937,333 | 2 | 8 | null | 2013-08-19 19:07:47.19 UTC | 15 | 2013-11-12 18:41:27.567 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 103,167 | null | 1 | 34 | c++|multithreading|c++11|shared-memory|atomic | 6,893 | <p>I'm two months late, but I'm having the exact same problem right now and I think I've found some sort of an answer. The short version is that it should work, but I'm not sure if I'd depend on it.</p>
<p>Here's what I found:</p>
<ul>
<li><p>The C++11 standard defines a new memory model, but it has no notion of OS-l... |
23,430,395 | Glob search files in date order? | <p>I have this line of code in my python script. It searches all the files in in a particular directory for * cycle *.log. </p>
<pre><code>for searchedfile in glob.glob("*cycle*.log"):
</code></pre>
<p>This works perfectly, however when I run my script to a network location it does not search them in order and instea... | 23,430,865 | 6 | 4 | null | 2014-05-02 14:21:18.977 UTC | 10 | 2018-03-25 13:05:34.41 UTC | null | null | null | null | 3,524,351 | null | 1 | 42 | python|date|search|glob | 52,607 | <p>To sort files by date:</p>
<pre><code>import glob
import os
files = glob.glob("*cycle*.log")
files.sort(key=os.path.getmtime)
print("\n".join(files))
</code></pre>
<p>See also <a href="https://docs.python.org/3/howto/sorting.html">Sorting HOW TO</a>.</p> |
23,420,795 | Why would a button click event cause site to reload in a Bootstrap form? | <p>I'm using <strong>jQuery</strong>'s <code>show()</code> and <code>hide()</code> functions on <code>divs</code> in order to <em>code</em> or <em>simulate</em> different consecutive form sections.</p>
<p>I've made a button that hides a <code>div</code> when it's clicked. What's strange is that once the button is clic... | 23,420,958 | 8 | 4 | null | 2014-05-02 04:33:56.86 UTC | 4 | 2021-05-06 16:51:23.963 UTC | 2014-05-02 05:03:42.013 UTC | null | 742,560 | null | 742,560 | null | 1 | 36 | javascript|jquery|html | 40,129 | <p>A <code><button></code> tag uses Submit behavior by default. Thus your page submits the form when the button is clicked and this looks like a page refresh itself. To work around this you can either use an <code>input</code> tag</p>
<pre><code><input type="button" class="btn btn-primary btnSeccion" id="btnS... |
43,224,012 | .NET Core SDK versions - which to uninstall? | <p>I have the following versions of .NET Core SDKs installed on my machine:</p>
<p><a href="https://i.stack.imgur.com/kPQYJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/kPQYJ.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/BxJn0.png" rel="noreferrer"><img src="https://i.sta... | 43,225,707 | 4 | 3 | null | 2017-04-05 07:00:03.747 UTC | 7 | 2021-12-14 11:43:27.62 UTC | null | null | null | null | 589,558 | null | 1 | 31 | asp.net-core|.net-core | 26,549 | <p>First of all, this is the page I find the most useful to understand the complicated versioning of .NET CORE: <a href="https://github.com/dotnet/core/blob/master/release-notes/download-archive.md" rel="noreferrer">https://github.com/dotnet/core/blob/master/release-notes/download-archive.md</a></p>
<p>Then, something... |
43,074,144 | Vue.js Input field loses its focus after entry of one character | <p>I have a view with an input field, which can be multiplicated by a given button. The problem is that after any entry of a char, the focus of the input field is lost. You have to click again to enter another char.</p>
<p>Do someone have a clue what could be the problem?</p>
<p>My model:</p>
<pre><code>'model': [
... | 43,095,557 | 1 | 4 | null | 2017-03-28 15:47:55.38 UTC | 8 | 2017-03-31 13:28:25.93 UTC | 2017-03-31 13:28:25.93 UTC | null | 3,219,606 | null | 5,436,452 | null | 1 | 40 | javascript|focus|vue.js | 14,799 | <p>The problem is that you are using a changing value as <code>key</code>. Vue expects <code>key</code> to indicate a unique identifier for the item. When you change it, it becomes a new item and must be re-rendered.</p>
<p>In the snippet below, I have two loops, both using the same data source. The first is keyed the... |
9,154,671 | Distinction between processes and threads in Linux | <p>After reading up on <a href="https://stackoverflow.com/questions/807506/threads-vs-processes-in-linux">this answer</a> and "Linux Kernel Development" by Robert Love and, subsequently, on the <code>clone()</code> system call, I discovered that processes and threads in Linux are (almost) indistinguishable to the kerne... | 9,154,725 | 3 | 3 | null | 2012-02-06 01:22:10.563 UTC | 13 | 2017-03-09 05:57:50.313 UTC | 2017-05-23 11:54:06.34 UTC | null | -1 | null | 402,390 | null | 1 | 20 | c|linux|multithreading | 10,096 | <p>These confusions all stem from the fact that the kernel developers originally held an irrational and wrong view that threads could be implemented almost entirely in userspace using kernel processes as the primitive, as long as the kernel offered a way to make them share memory and file descriptors. This lead to the ... |
9,620,278 | How do I make calls to a REST API using C#? | <p>This is the code I have so far:</p>
<pre><code> public class Class1
{
private const string URL = "https://sub.domain.com/objects.json?api_key=123";
private const string DATA = @"{""object"":{""name"":""Name""}}";
... | 17,459,045 | 17 | 3 | null | 2012-03-08 15:35:01.27 UTC | 190 | 2022-02-03 18:39:16.84 UTC | 2021-01-30 21:54:29.867 UTC | null | 285,795 | null | 356,849 | null | 1 | 423 | c#|.net|rest|.net-4.5 | 1,353,423 | <p>The ASP.NET Web API has replaced the <a href="https://en.wikipedia.org/wiki/Windows_Communication_Foundation" rel="noreferrer">WCF</a> Web API previously mentioned.</p>
<p>I thought I'd post an updated answer since most of these responses are from early 2012, and this thread is one of the top results when doing a Go... |
18,228,324 | I need to generate uuid for my rails application. What are the options(gems) I have? | <p>I use
Rails 3.0.20 and
ruby 1.8.7 (2011-06-30 patchlevel 352)</p>
<p>Please suggest me the best plugin to generate guid.</p> | 18,228,453 | 4 | 3 | null | 2013-08-14 09:44:25.133 UTC | 13 | 2022-05-27 06:40:24.263 UTC | null | null | null | null | 948,299 | null | 1 | 110 | ruby-on-rails|ruby|ruby-on-rails-3|guid|uuid | 82,368 | <p>There are plenty of options, I recommend not to add additional dependencies and use <code>SecureRandom</code> which is builtin:</p>
<pre><code>SecureRandom.uuid #=> "1ca71cd6-08c4-4855-9381-2f41aeffe59c"
</code></pre>
<p>See other possible formats <a href="https://apidock.com/rails/ActiveSupport/SecureR... |
18,234,378 | Using sed to split a string with a delimiter | <p>I have a string in the following format:</p>
<p><code>string1:string2:string3:string4:string5</code></p>
<p>I'm trying to use <code>sed</code> to split the string on <code>:</code> and print each sub-string on a new line. Here is what I'm doing:</p>
<p><code>cat ~/Desktop/myfile.txt | sed s/:/\\n/</code> </p>
<... | 18,234,407 | 6 | 1 | null | 2013-08-14 14:22:55.637 UTC | 18 | 2019-01-07 06:43:28.67 UTC | null | null | null | null | 1,492,471 | null | 1 | 62 | linux|bash|sed|string-split | 214,328 | <p>To split a string with a delimiter with GNU sed you say:</p>
<pre><code>sed 's/delimiter/\n/g' # GNU sed
</code></pre>
<p>For example, to split using <code>:</code> as a delimiter:</p>
<pre><code>$ sed 's/:/\n/g' <<< "he:llo:you"
he
llo
you
</code></pre>
<p>Or with a non-GNU sed:</p>
<pre><code>$ s... |
15,313,469 | Java Keyboard Keycodes list | <p>Can anybody provide me with the Key Code integer list for individual keys used on the Keyboard for the KeyEvent class in java?</p>
<p>I want to create a dropdown list of all the keyboard keys for the user to select. I need the list specific to Keyboard. The VK constants does not help in this case because I need a '... | 15,313,498 | 5 | 0 | null | 2013-03-09 17:04:29.203 UTC | 5 | 2021-07-02 09:10:07.73 UTC | 2017-05-23 12:16:43.803 UTC | null | -1 | null | 1,440,535 | null | 1 | 9 | java|applet|keylistener|keyevent | 111,334 | <p><a href="http://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyEvent.html" rel="noreferrer">KeyEvent</a> class has static fields with these values.</p>
<p>For example, <code>KeyEvent.VK_A</code> represent "A" key.</p>
<p>To get the fields names you can use reflection:</p>
<pre><code>Field[] fields = java.awt... |
15,249,492 | How to organize resources (styles, ...) in a complex WPF scenario? | <p>How can WPF resources - including styles, templates, etc. - be organized, so that I can use them across Windows, Pages or even Projects. What options do I have to achieve maximum re-usability of my resources and a maintainable structure (for example one file per Template)? </p>
<p>For example: I am creating a WPF a... | 15,249,742 | 3 | 1 | null | 2013-03-06 14:09:16.957 UTC | 8 | 2017-06-01 12:27:52.34 UTC | 2013-03-07 09:11:52.613 UTC | null | 645,104 | null | 367,593 | null | 1 | 17 | c#|wpf|templates|styles | 10,142 | <p>I usually create a seperate styling project, which I reference from the projects, which I want to style. The styling project has a fixed structure like this:</p>
<p><img src="https://i.stack.imgur.com/YmGpQ.png" alt="Styling project"></p>
<p>For every control, I create a styling <code>ResourceDictionary</code>. Fo... |
15,283,523 | Reshaping a 1-d array to a multidimensional array | <p>Taking into consideration the entire C++11 standard, is it possible for any conforming implementation to succeed the first assertion below but fail the latter?</p>
<pre><code>#include <cassert>
int main(int, char**)
{
const int I = 5, J = 4, K = 3;
const int N = I * J * K;
int arr1d[N] = {0};
... | 15,284,276 | 2 | 6 | null | 2013-03-07 23:01:37.59 UTC | 12 | 2021-03-20 22:15:48.127 UTC | 2013-03-07 23:50:07.62 UTC | null | 2,008,149 | null | 2,008,149 | null | 1 | 19 | c++|c++11|multidimensional-array|language-lawyer | 5,225 | <p><strong>Update 2021-03-20:</strong></p>
<p>This same question was <a href="https://www.reddit.com/r/cpp_questions/comments/m9a7fs/reinterpret_a_1d_array_as_a_2d_array/" rel="nofollow noreferrer">asked on Reddit</a> recently and it was pointed out that my original answer is flawed because it does not take into accoun... |
15,379,860 | "Close Others" command shortcut in Sublime Text 2 | <p>I am trying to add a shortcut for "Close Others" tabs, but can't seem to find the command, here is what I am trying:</p>
<pre><code>{ "keys": ["super+alt+w"], "command": "close_others" }
</code></pre>
<p><kbd>Cmd</kbd>+<kbd>Option</kbd>+<kbd>W</kbd> - sort of like <kbd>Cmd</kbd>+<kbd>Option</kbd>+<kbd>H</kbd> in O... | 15,380,759 | 2 | 0 | null | 2013-03-13 08:03:45.863 UTC | 9 | 2015-01-30 13:07:32.84 UTC | 2017-05-23 12:09:37.75 UTC | null | -1 | null | 166,484 | null | 1 | 21 | command|keyboard-shortcuts|sublimetext2|sublimetext | 5,373 | <p>The command is <code>close_others_by_index</code>. Unfortunately, it takes arguments that cannot be passed via a simple key binding.</p>
<p>To make it work, you have to create a plugin. <code>Tools/New Plugin...</code>:</p>
<pre class="lang-py prettyprint-override"><code>import sublime_plugin
class CloseOthersCom... |
15,200,362 | When to use Single method Interfaces in Java | <p>I have seen in many libraries like <code>Spring</code> which use a lot of interfaces with <strong>single methods</strong> in them like <code>BeanNameAware</code>, etc. </p>
<p>And the implementer class will implement many interfaces with single methods.</p>
<p>In what scenarios does it make sense to keep single me... | 15,200,760 | 5 | 0 | null | 2013-03-04 11:21:21.437 UTC | 9 | 2017-12-21 06:50:21.953 UTC | null | null | null | null | 1,719,067 | null | 1 | 24 | java|oop|design-patterns|interface | 15,999 | <p>With Java 8, keeping the single method interface is quite useful, since single method interfaces will allow the usage of closures and "function pointers". So, whenever your code is written against a single method interface, the client code may hand in a closure or a method (which must have a compatible signature to ... |
15,109,958 | Understanding convertPoint:toView: | <p>I do not quite understand the method <code>convertPoint:toView:</code>.</p>
<p>In Apple's documentation it is written that</p>
<blockquote>
<p><code>convertPoint:toView:</code></p>
<p>Converts a point from the receiver’s coordinate system to that of the
specified view.</p>
<pre><code>- (CGPoint)convertPo... | 15,114,612 | 1 | 6 | null | 2013-02-27 10:39:45.57 UTC | 14 | 2015-12-18 06:10:30.883 UTC | 2015-12-18 06:10:30.883 UTC | null | 603,977 | null | 2,024,727 | null | 1 | 46 | ios|cocoa-touch|uiview|geometry | 22,399 | <p>Every UIView has its own coordinates system. So if you have a UIView_1 that contains another UIView_2, they both have a point (10,10) within them.</p>
<p>convertPoint:toView: allows the developer to take a point in one view and convert the point to another view coordinate system.</p>
<p>Example:
view1 contains... |
15,300,572 | Saving lists to txt file | <p>I'm trying to save a list to a text file.</p>
<p>This is my code:</p>
<pre><code>public void button13_Click(object sender, EventArgs e)
{
TextWriter tw = new StreamWriter("SavedLists.txt");
tw.WriteLine(Lists.verbList);
tw.Close();
}
</code></pre>
<p>This is what I get in the text file:</p>
<blockqu... | 15,300,618 | 3 | 3 | null | 2013-03-08 18:13:16.233 UTC | 6 | 2016-05-13 13:29:04.853 UTC | 2013-03-08 18:28:35.927 UTC | null | 1,159,478 | null | 2,061,451 | null | 1 | 75 | c#|list | 166,326 | <p>Assuming your Generic List is of type String:</p>
<pre><code>TextWriter tw = new StreamWriter("SavedList.txt");
foreach (String s in Lists.verbList)
tw.WriteLine(s);
tw.Close();
</code></pre>
<p>Alternatively, with the using keyword:</p>
<pre><code>using(TextWriter tw = new StreamWriter("SavedList.txt"))
{
... |
7,735,635 | Real example of TryUpdateModel, ASP .NET MVC 3 | <p>I can't understand, how to use TryUpdateModel and save the MVC architecture at the same time.</p>
<p>If I am not mistaken, work with datacontexts must be in the Model. So, such code</p>
<pre><code>var db=new TestEverybody();//it is class, which was generated by EntityFramework
var currentTesting=db.Testing.(t =&g... | 7,777,059 | 2 | 3 | null | 2011-10-12 05:26:27.037 UTC | 37 | 2011-10-15 09:45:34.097 UTC | null | null | null | null | 352,130 | null | 1 | 30 | asp.net-mvc|model|controller | 41,493 | <p>Since the OP asked, here's an example of the ViewModel pattern, or as I like to call it - ASP.NET MVC done properly.</p>
<p>So why use a view specific model</p>
<ol>
<li>You should only pass the information to your view that it needs.</li>
<li>Often you'll need to add additional view-meta-data (such as title/descr... |
65,134,181 | Why does a Java string comparison behave different in Java 15 and Java 11? | <p>Please consider the following class:</p>
<pre><code>class Eq {
public static void main(String[] args) {
System.out.println("" == ".".substring(1));
}
}
</code></pre>
<p>The example is supposed to show that multiple copies of the empty string may exist in memory. I still have an old OpenJD... | 65,134,318 | 1 | 4 | null | 2020-12-03 21:08:52.89 UTC | 4 | 2021-01-04 11:25:37.857 UTC | 2021-01-04 11:25:37.857 UTC | null | 1,109,583 | null | 1,109,583 | null | 1 | 28 | java|string|memory|equality | 1,825 | <p>This is mentioned in the <a href="https://www.oracle.com/java/technologies/javase/15-relnote-issues.html#JDK-8240094" rel="noreferrer">JDK 15 Release Notes</a>.</p>
<p>It was changed as requested by JDK-8240094:</p>
<blockquote>
<p><strong><a href="https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8240094" re... |
5,445,847 | List available COM ports | <p>I have a very small code that shows available COM ports.</p>
<p>My question is:</p>
<p>Is there an easy way to have the program to run in the tray and only popup when a new COM port is available and is it possible to add the name for the COM port that you can see in device manager ec "USB serial port"?</p>
<p>I o... | 5,446,366 | 4 | 0 | null | 2011-03-26 22:42:56.233 UTC | 5 | 2018-04-17 16:44:49.737 UTC | null | null | null | null | 302,935 | null | 1 | 20 | c#|windows|forms | 77,317 | <p>Take a look at <a href="https://stackoverflow.com/questions/1081871/how-to-find-available-com-ports">this question</a>. It uses WMI to find available COM ports. You could keep track of what COM ports exist, and only notify about new ones.</p> |
5,010,191 | Using DataContractSerializer to serialize, but can't deserialize back | <p>I have the following 2 functions:</p>
<pre><code>public static string Serialize(object obj)
{
DataContractSerializer serializer = new DataContractSerializer(obj.GetType());
MemoryStream memoryStream = new MemoryStream();
serializer.WriteObject(memoryStream, obj);
return Encoding.UTF8.GetString(memor... | 5,010,376 | 4 | 0 | null | 2011-02-15 22:20:22.573 UTC | 29 | 2012-01-02 08:30:55.23 UTC | null | null | null | null | 431,937 | null | 1 | 66 | c#|c#-4.0|xml-serialization|datacontractserializer | 109,231 | <p>Here is how I've always done it:</p>
<pre><code> public static string Serialize(object obj) {
using(MemoryStream memoryStream = new MemoryStream())
using(StreamReader reader = new StreamReader(memoryStream)) {
DataContractSerializer serializer = new DataContractSerializer(obj.GetType(... |
4,953,272 | How to match exact "multiple" strings in Python | <p>I've got a list of exact patterns that I want to search in a given string. Currently I've got a real bad solution for such a problem.</p>
<pre><code>pat1 = re.compile('foo.tralingString')
mat1 = pat1.match(mystring)
pat2 = re.compile('bar.trailingString')
mat2 = pat2.match(mystring)
if mat1 or mat2:
# Do what... | 4,953,289 | 5 | 0 | null | 2011-02-10 04:09:48.693 UTC | 7 | 2011-02-10 04:28:51.423 UTC | 2011-02-10 04:17:11.267 UTC | null | 1,678,010 | null | 1,678,010 | null | 1 | 19 | python|regex | 61,476 | <p>You could do a trivial regex that combines those two:</p>
<pre><code>pat = re.compile('foo|bar')
if pat.match(mystring):
# Do whatever
</code></pre>
<p>You could then expand the regex to do whatever you need to, using the <code>|</code> separator (which means <em>or</em> in regex syntax)</p>
<p><strong>Edit:<... |
5,144,110 | Concatenating a variable and a string literal without a space in PowerShell | <p>How can I write a variable to the console without a space after it? There are problems when I try:</p>
<pre><code>$MyVariable = "Some text"
Write-Host "$MyVariableNOSPACES"
</code></pre>
<p>I'd like the following output:</p>
<pre><code>Some textNOSPACES
</code></pre> | 5,149,170 | 7 | 1 | null | 2011-02-28 15:43:37.053 UTC | 9 | 2020-01-14 13:59:16.147 UTC | 2017-06-05 21:58:48.4 UTC | null | 63,550 | null | 111,327 | null | 1 | 56 | string|powershell | 87,813 | <p>Another option and possibly the more canonical way is to use curly braces to delineate the name:</p>
<pre><code>$MyVariable = "Some text"
Write-Host "${MyVariable}NOSPACES"
</code></pre>
<p>This is particular handy for paths e.g. <code>${ProjectDir}Bin\$Config\Images</code>. However, if there is a <code>\</code> a... |
5,431,413 | Difference between protocol and delegates? | <p>What is the difference between a <code>protocol</code> and a <code>delegate</code>?</p>
<p>and,</p>
<p>How can we declare <code>variables</code> in a <code>protocol class</code>?</p> | 5,431,545 | 7 | 0 | null | 2011-03-25 10:48:41.647 UTC | 38 | 2020-06-10 21:17:13.7 UTC | 2019-08-19 12:15:59.453 UTC | null | 5,175,709 | null | 649,317 | null | 1 | 58 | ios|objective-c|delegates|protocols | 59,965 | <p>A protocol, declared with the (<code>@protocol</code> syntax in Objective-C) is used to declare a set of methods that a class "adopts" (declares that it will use this protocol) will implement. This means that you can specify in your code that, "you don't care which class is used as long as it implements a particular... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.