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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
34,948,627 | Does it make any difference to use unsafe inside or outside a loop? | <p>I never needed to use unsafe in the past, but now I need it to work with a pointer manipulating a bitmap.</p>
<p>I couldn't find any documentation that indicates otherwise, but I would like to understand better how unsafe works and if it makes any difference to use it inside or outside a loop.</p>
<p>Is it better ... | 34,948,949 | 2 | 5 | null | 2016-01-22 14:06:50.693 UTC | 2 | 2016-01-29 04:17:27.537 UTC | 2016-01-29 04:17:27.537 UTC | null | 256,431 | null | 752,842 | null | 1 | 65 | c#|unsafe | 2,251 | <p><code>unsafe</code> keyword is a marker that you use to tell the compiler that you know what you are doing. Its main purpose is similar to documenting your code: <code>unsafe</code> block shows parts of your code that you designate as unmanaged territory; there is no impact on the actual <em>execution</em> of code.<... |
41,194,200 | Django-filter with DRF - How to do 'and' when applying multiple values with the same lookup? | <p>This is a slightly simplified example of the filterset I'm using, which I'm using with the DjangoFilterBackend for Django Rest Framework. I'd like to be able to send a request to <code>/api/bookmarks/?title__contains=word1&title__contains=word2</code> and have results returned that contain both words, but curren... | 41,230,820 | 3 | 5 | null | 2016-12-17 00:22:02.487 UTC | 10 | 2021-03-15 11:40:51.84 UTC | 2016-12-17 09:19:22.34 UTC | null | 4,566,267 | null | 4,566,267 | null | 1 | 11 | python|django|django-rest-framework|django-filter|django-filters | 14,179 | <p>The main problem is that you need a filter that understands how to operate on multiple values. There are basically two options:</p>
<ul>
<li>Use <code>MultipleChoiceFilter</code> (not recommended for this instance)</li>
<li>Write a custom filter class</li>
</ul>
<p><strong>Using <code>MultipleChoiceFilter</code></... |
5,055,625 | Image Warping - Bulge Effect Algorithm | <p>Can any point to image warping algorithms? Specifically for bulge effect?</p> | 5,055,736 | 2 | 1 | null | 2011-02-20 06:28:22.217 UTC | 18 | 2015-10-21 02:47:59.223 UTC | 2014-04-19 07:36:24.187 UTC | null | 321,731 | null | 193,545 | null | 1 | 19 | image|algorithm|image-processing | 12,972 | <p>See if I understood what you want. Suppose your image coordinates go from 0 to 1. </p>
<p>If you do: </p>
<pre><code>r = Sqrt[(x - .5)^2 + (y - .5)^2]
a = ArcTan[x - .5, y - .5]
rn = r^2.5/.5
</code></pre>
<p>And then remap your pixels according to: </p>
<pre><code> x -> rn*Cos[a] + .5
y -> rn*Sin[... |
591,503 | I have a Rails task: should I use script/runner or rake? | <p>For <em>ad hoc</em> Rails tasks we have a few implementation alternatives, chief among which would seem to be:</p>
<pre><code>script/runner some_useful_thing
</code></pre>
<p>and:</p>
<pre><code>rake some:other_useful_thing
</code></pre>
<p>Which option should I prefer? If there's a clear favourite then when, if... | 591,912 | 8 | 0 | null | 2009-02-26 17:16:07.007 UTC | 18 | 2013-09-09 22:31:49.96 UTC | 2013-09-09 22:29:32.293 UTC | null | 128,421 | Mike Woodhouse | 1,060 | null | 1 | 71 | ruby-on-rails|ruby|rake | 34,377 | <p>The difference between them is that <code>script/runner</code> boots Rails whereas a Rake task doesn't unless you tell it to by making the task depend on <code>:environment</code>, like this:</p>
<pre><code>task :some_useful_task => :environment do
# do some useful task
end
</code></pre>
<p>Since booting Rail... |
304,883 | What do I use on linux to make a python program executable | <p>I just installed a linux system (Kubuntu) and was wondering if there is a program to make python programs executable for linux.</p> | 304,896 | 8 | 4 | null | 2008-11-20 10:27:57.65 UTC | 20 | 2022-08-19 11:13:35.27 UTC | 2012-06-16 09:05:00.38 UTC | ΤΖΩΤΖΙΟΥ | 667,810 | clinton | null | null | 1 | 107 | python|linux|file-permissions | 230,902 | <p>Just put this in the first line of your script :</p>
<pre><code>#!/usr/bin/env python
</code></pre>
<p>Make the file executable with</p>
<pre><code>chmod +x myfile.py
</code></pre>
<p>Execute with</p>
<pre><code>./myfile.py
</code></pre> |
194,157 | C# - How to get Program Files (x86) on Windows 64 bit | <p>I'm using:</p>
<pre><code>FileInfo(
System.Environment.GetFolderPath(
System.Environment.SpecialFolder.ProgramFiles)
+ @"\MyInstalledApp"
</code></pre>
<p>In order to determine if a program is detected on a users machine (it's not ideal, but the program I'm looking for is a right old kludge of a M... | 194,223 | 8 | 1 | null | 2008-10-11 14:53:12.563 UTC | 50 | 2019-12-25 12:14:50.373 UTC | 2016-09-29 21:23:49.737 UTC | null | 3,506,362 | null | 1,293,123 | null | 1 | 153 | c#|windows|file|64-bit | 153,574 | <p>The function below will return the x86 <code>Program Files</code> directory in all of these three Windows configurations:</p>
<ul>
<li>32 bit Windows</li>
<li>32 bit program running on 64 bit Windows</li>
<li>64 bit program running on 64 bit windows</li>
</ul>
<p> </p>
<pre><code>static string ProgramFilesx8... |
962,729 | Is it possible to disable jsessionid in tomcat servlet? | <p>Is it possible to turnoff jsessionid in the url in tomcat? the jsessionid seems not too search engine friendly.</p> | 962,757 | 9 | 0 | null | 2009-06-07 20:17:23.637 UTC | 39 | 2022-04-07 08:41:11.48 UTC | 2017-09-05 16:50:23.473 UTC | null | 4,823,977 | null | 101,890 | null | 1 | 69 | java|tomcat|servlets|jsessionid | 80,427 | <p>You can disable for just search engines using this filter, but I'd advise <strong>using it for all responses</strong> as it's worse than just search engine unfriendly. It exposes the session ID which can be used for certain security exploits (<a href="http://randomcoder.com/articles/jsessionid-considered-harmful" re... |
933,212 | Is it possible to guess a user's mood based on the structure of text? | <p>I assume a natural language processor would need to be used to parse the text itself, but what suggestions do you have for an algorithm to detect a user's mood based on text that they have written? I doubt it would be very accurate, but I'm still interested nonetheless.</p>
<p>EDIT: I am by no means an expert on li... | 959,162 | 10 | 12 | null | 2009-06-01 00:43:30.14 UTC | 59 | 2017-07-28 20:13:04.323 UTC | 2009-06-01 01:23:17.643 UTC | null | 31,516 | null | 31,516 | null | 1 | 56 | algorithm|nlp | 14,290 | <p>This is the basis of an area of natural language processing called <a href="http://en.wikipedia.org/wiki/Sentiment_analysis" rel="noreferrer">sentiment analysis</a>. Although your question is general, it's certainly not stupid - this sort of research is done by Amazon on the text in product reviews for example.</p>
... |
1,200,214 | How can I measure the speed of code written in PHP? | <p>How can I say which class of many (which all do the same job) execute faster? is there a software to measure that?</p> | 1,202,746 | 10 | 1 | null | 2009-07-29 13:20:45.783 UTC | 71 | 2019-12-24 19:59:53.86 UTC | 2014-11-11 21:01:50.16 UTC | null | 146,197 | null | 146,197 | null | 1 | 125 | php|testing|performance|measurement | 98,840 | <p>You have <em>(at least)</em> two solutions :</p>
<p>The quite "naïve" one is using microtime(true) tobefore and after a portion of code, to get how much time has passed during its execution ; other answers said that and gave examples already, so I won"t say much more.</p>
<p>This is a nice solution if you want to ... |
14,008 | Genetic Programming in C# | <p>I've been looking for some good genetic programming examples for C#. Anyone knows of good online/book resources? Wonder if there is a C# library out there for Evolutionary/Genetic programming?</p> | 1,030,053 | 12 | 0 | null | 2008-08-17 23:25:45.733 UTC | 37 | 2017-08-03 09:33:35.573 UTC | 2010-05-17 03:14:49.027 UTC | eed3si9n | 164,901 | Mac | 877 | null | 1 | 60 | c#|genetic-algorithm|genetic-programming|evolutionary-algorithm | 33,347 | <p>After developing <a href="http://code.google.com/p/evo-lisa-clone/" rel="noreferrer">my own Genetic Programming didactic application</a>, I found a complete Genetic Programming Framework called <a href="http://code.google.com/p/aforge/source/browse/#svn/trunk/Sources/Genetic" rel="noreferrer">AForge.NET Genetics</a>... |
473,782 | Inline functions in C#? | <p>How do you do "inline functions" in C#? I don't think I understand the concept. Are they like anonymous methods? Like lambda functions?</p>
<p><strong>Note</strong>: The answers almost entirely deal with the ability to <a href="http://en.wikipedia.org/wiki/Inline_expansion" rel="noreferrer">inline functions</a>, i.... | 8,746,128 | 14 | 2 | null | 2009-01-23 17:31:07.343 UTC | 58 | 2021-11-03 07:04:57.383 UTC | 2017-05-23 12:10:48.753 UTC | null | -1 | Dinah | 356 | null | 1 | 297 | c#|optimization|inline | 208,139 | <p>Finally in .NET 4.5, the CLR allows one to hint/suggest<sup>1</sup> method inlining using <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.methodimploptions%28v=VS.110%29.aspx" rel="noreferrer"><code>MethodImplOptions.AggressiveInlining</code></a> value. It is also available in the Mo... |
252,703 | What is the difference between Python's list methods append and extend? | <p>What's the difference between the list methods <code>append()</code> and <code>extend()</code>?</p> | 252,711 | 20 | 0 | null | 2008-10-31 05:55:36.407 UTC | 762 | 2022-08-26 02:01:17.767 UTC | 2019-05-21 17:18:17.983 UTC | null | 42,223 | Claudiu | 15,055 | null | 1 | 3,113 | python|list|data-structures|append|extend | 3,204,409 | <p><a href="https://docs.python.org/3/library/stdtypes.html#mutable-sequence-types" rel="noreferrer"><code>append</code></a> appends a specified object at the end of the list:</p>
<pre><code>>>> x = [1, 2, 3]
>>> x.append([4, 5])
>>> print(x)
[1, 2, 3, [4, 5]]
</code></pre>
<p><a href="https:... |
1,340,434 | Get to UIViewController from UIView? | <p>Is there a built-in way to get from a <code>UIView</code> to its <code>UIViewController</code>? I know you can get from <code>UIViewController</code> to its <code>UIView</code> via <code>[self view]</code> but I was wondering if there is a reverse reference?</p> | 1,340,470 | 29 | 1 | null | 2009-08-27 11:22:45.347 UTC | 88 | 2021-09-07 19:43:20.03 UTC | 2015-05-17 22:24:25.81 UTC | null | 106,435 | null | 101,438 | null | 1 | 198 | ios|objective-c|cocoa-touch|uiview|uiviewcontroller | 150,245 | <p>Since this has been the accepted answer for a long time, I feel I need to rectify it with a better answer.</p>
<p>Some comments on the need:</p>
<ul>
<li>Your view should not need to access the view controller directly.</li>
<li>The view should instead be independent of the view controller, and be able to work in ... |
203,090 | How do I get current date/time on the Windows command line in a suitable format for usage in a file/folder name? | <p>Update: Now that it's 2016 I'd use PowerShell for this unless there's a really compelling backwards-compatible reason for it, particularly because of the regional settings issue with using <code>date</code>. See @npocmaka's <a href="https://stackoverflow.com/a/19799236/8479">https://stackoverflow.com/a/19799236/8479... | 203,116 | 30 | 3 | null | 2008-10-14 22:25:34.303 UTC | 227 | 2022-09-24 16:57:17.717 UTC | 2020-11-26 19:53:53.723 UTC | Vlion | 5,047,996 | Rory | 8,479 | null | 1 | 607 | windows|datetime|batch-file|cmd | 1,588,576 | <p>See <em><a href="http://www.tech-recipes.com/rx/956/windows-batch-file-bat-to-get-current-date-in-mmddyyyy-format/" rel="noreferrer">Windows Batch File (.bat) to get current date in MMDDYYYY format</a></em>:</p>
<pre><code>@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f... |
273,209 | Are memory leaks ever ok? | <p>Is it ever acceptable to have a <a href="http://en.wikipedia.org/wiki/Memory_leak" rel="noreferrer">memory leak</a> in your C or C++ application?</p>
<p>What if you allocate some memory and use it until the very last line of code in your application (for example, a global object's destructor)? As long as the memory... | 273,287 | 50 | 5 | 2008-11-16 07:36:03.74 UTC | 2008-11-07 19:01:52.867 UTC | 77 | 2018-05-24 01:35:56.857 UTC | 2011-10-02 15:00:10.367 UTC | luke | 743,214 | Imbue | 3,175 | null | 1 | 238 | c++|c|memory-leaks | 37,505 | <p>No.</p>
<p>As professionals, the question we should not be asking ourselves is, "Is it ever OK to do this?" but rather "Is there ever a <em>good</em> reason to do this?" And "hunting down that memory leak is a pain" isn't a good reason.</p>
<p>I like to keep things simple. And the simple rule is that my program ... |
6,777,910 | SQL performance on LEFT OUTER JOIN vs NOT EXISTS | <p>If I want to find a set of entries in table A but not in table B, I can use either LEFT OUTER JOIN or NOT EXISTS. I've heard SQL Server is geared towards ANSI and in some case LEFT OUTER JOINs are far more efficient than NOT EXISTS. Will ANSI JOIN perform better in this case? and are join operators more efficient th... | 6,778,034 | 4 | 1 | null | 2011-07-21 14:43:02.903 UTC | 14 | 2017-07-27 15:58:20.857 UTC | null | null | null | null | 329,913 | null | 1 | 56 | sql|sql-server | 72,842 | <p>Joe's link is a good starting point. <a href="http://explainextended.com/2009/09/15/not-in-vs-not-exists-vs-left-join-is-null-sql-server/" rel="noreferrer">Quassnoi covers this too.</a></p>
<p><strong>In general,</strong> if your fields are properly indexed, OR if you expect to filter out more records (i.e. have a... |
6,385,243 | Is it possible to add index to a temp table? And what's the difference between create #t and declare @t | <p>I need to do a very complex query.
At one point, this query must have a join to a view that cannot be indexed unfortunately.
This view is also a complex view joining big tables.</p>
<p>View's output can be simplified as this:</p>
<pre><code>PID (int), Kind (int), Date (date), D1,D2..DN
</code></pre>
<p>where PI... | 6,385,272 | 5 | 0 | null | 2011-06-17 11:43:18.82 UTC | 2 | 2022-09-20 10:19:20.9 UTC | 2022-09-20 10:19:20.9 UTC | null | 799,759 | null | 787,287 | null | 1 | 25 | sql|sql-server|tsql|indexing|temp-tables | 137,443 | <p>It's not a complete answer but #table will create a temporary table that you need to drop or it will persist in your database. @table is a table variable that will not persist longer than your script.</p>
<p>Also, I think this post will answer the other part of your question.</p>
<p><a href="https://stackoverflow.... |
6,911,603 | Disassemble Java JIT compiled native bytecode | <p>Is there any way to do an assembly dump of the native code generated by the Java just-in-time compiler?</p>
<p>And a related question: Is there any way to use the JIT compiler without running the JVM to compile my code into native machine code?</p> | 6,911,796 | 5 | 4 | null | 2011-08-02 11:52:43.477 UTC | 5 | 2015-10-04 12:34:39.12 UTC | 2011-08-02 11:54:03.507 UTC | null | 276,052 | null | 811,001 | null | 1 | 29 | java|compiler-construction|jvm|jit | 3,801 | <p>Yes, <a href="https://wiki.openjdk.java.net/display/HotSpot/PrintAssembly" rel="nofollow">there is a way</a> to print the generated native code (requires OpenJDK 7).</p>
<p>No, there is no way to compile your Java bytecode to native code using the JDK's JIT and save it as a native executable.</p>
<p>Even if this w... |
6,792,275 | How to create custom window chrome in wpf? | <p>How can I create a basic custom window chrome for a WPF window, that doesn't include the close button and still a moveable and resizeable window?</p> | 6,792,677 | 5 | 3 | null | 2011-07-22 15:26:15.443 UTC | 42 | 2022-01-17 21:32:15.367 UTC | 2015-10-19 05:42:19.21 UTC | null | 2,771,704 | null | 416,056 | null | 1 | 45 | wpf|xaml|window | 76,400 | <p>You set your Window's <code>WindowStyle="None"</code>, then build your own window interface. You need to build in your own Min/Max/Close/Drag event handlers, but Resizing is still maintained.</p>
<p>For example:</p>
<pre><code><Window
WindowState="Maximized"
WindowStyle="None&quo... |
6,417,055 | Download files and store them locally with Phonegap/jQuery Mobile Android and iOS Apps | <p>I wrote an jQuery Mobile app and packaged it with Phonegap to iOS and Android apps.</p>
<p>At this point I am using locally stored json files to read data.</p>
<p>I would like to update these json files from time to time by downloading newer json files from a server.</p>
<p>How can I get the json from the server ... | 8,278,760 | 6 | 1 | null | 2011-06-20 20:26:40.833 UTC | 30 | 2017-02-22 07:12:24.493 UTC | null | null | null | null | 268,125 | null | 1 | 43 | android|ios|cordova|jquery-mobile | 96,173 | <p>This is how I solved it. First set the file paths, wich are different for Android and iOS</p>
<pre><code>var file_path;
function setFilePath() {
if(detectAndroid()) {
file_path = "file:///android_asset/www/res/db/";
//4 Android
} else {
file_path = "res//db//";
//4 apache/... |
6,598,945 | Detect if function is native to browser | <p>I am trying to iterate over all the globals defined in a website, but in doing so I am also getting the native browser functions. </p>
<pre><code>var numf=0; var nump=0; var numo=0;
for(var p in this) {
if(typeof(this[p]) === "function"){
numf+=1;
console.log(p+"()");
} else if(typeof p !... | 6,599,105 | 7 | 0 | null | 2011-07-06 15:26:38.227 UTC | 8 | 2022-08-02 08:29:02.117 UTC | null | null | null | null | 143,074 | null | 1 | 29 | javascript|global-variables | 8,221 | <p>You can call the inherited <code>.toString()</code> function on the methods and check the outcome. Native methods will have a block like <code>[native code]</code>.</p>
<pre><code>if( this[p].toString().indexOf('[native code]') > -1 ) {
// yep, native in the browser
}
</code></pre>
<hr>
<p>Update because a... |
6,700,717 | ArrayIndexOutOfBoundsException when using the ArrayList's iterator | <p>Right now, I have a program containing a piece of code that looks like this:</p>
<pre><code>while (arrayList.iterator().hasNext()) {
//value is equal to a String value
if( arrayList.iterator().next().equals(value)) {
// do something
}
}
</code></pre>
<p>Am I doing that right, as far as it... | 6,700,737 | 8 | 1 | null | 2011-07-14 22:29:32.347 UTC | 27 | 2016-02-18 00:30:06.7 UTC | 2016-02-18 00:30:06.7 UTC | null | 1,079,354 | null | 810,860 | null | 1 | 102 | java|arraylist|iterator|indexoutofboundsexception | 393,896 | <blockquote>
<p>Am I doing that right, as far as iterating through the Arraylist goes?</p>
</blockquote>
<p>No: by calling <code>iterator</code> twice in each iteration, you're getting new iterators all the time.</p>
<p>The easiest way to write this loop is using the <a href="http://download.oracle.com/javase/1,5.0... |
38,376,351 | No module named 'pandas' in Pycharm | <p>I read all the topics about, but I cannot solve my problem:</p>
<pre><code> Traceback (most recent call last):
File "/home/.../.../.../reading_data.py", line 1, in <module>
import pandas as pd
ImportError: No module named pandas
</code></pre>
<p>This is my environment:</p>
<p>Ubuntu 14.04</p>... | 38,382,116 | 4 | 1 | null | 2016-07-14 14:03:48.05 UTC | 1 | 2022-08-04 09:58:19.78 UTC | 2022-08-04 09:58:19.78 UTC | null | 4,685,471 | null | 6,478,396 | null | 1 | 15 | python|pandas|module|pycharm|sklearn-pandas | 88,930 | <p>Have you select the project interpreter for your current project?
<a href="https://www.jetbrains.com/help/pycharm/2016.1/configuring-python-interpreter-for-a-project.html" rel="noreferrer">https://www.jetbrains.com/help/pycharm/2016.1/configuring-python-interpreter-for-a-project.html</a></p>
<p>follow this link, ch... |
15,887,885 | Converting a one-item list to an integer | <p>I've been asked to accept a list of integers (x), add the first value and the last value in the list, and then return an integer with the sum. I've used the following code to do that, but the problem I have is that when I try to evaluate the sum it's actually a one-item list instead of an integer. I've tried to cast... | 15,887,903 | 4 | 1 | null | 2013-04-08 20:01:45.957 UTC | 3 | 2019-11-05 23:06:04.643 UTC | 2013-04-08 20:02:18.817 UTC | null | 830,012 | null | 1,883,103 | null | 1 | 16 | python | 48,357 | <h1>Use indexes</h1>
<p>You're slicing the list, which return lists. Here, you should use indexes instead:</p>
<pre><code>firstDigit = x[0]
lastDigit = x[-1]
</code></pre>
<hr>
<h1>Why is slicing wrong for you:</h1>
<p>When you do <code>x[0:1]</code>, you're taking the <strong>list of items</strong> from the begin... |
16,013,545 | How do I erase elements from STL containers? | <p>How do I erase elements from STL containers, having a specified <em>value</em>, or satisfying some <em>condition</em>?</p>
<p>Is there a single common or uniform way of doing that for different kinds of containers?</p> | 16,013,546 | 1 | 3 | null | 2013-04-15 11:03:13.68 UTC | 29 | 2014-06-14 10:11:42.84 UTC | 2014-02-10 11:00:55.34 UTC | null | 1,629,821 | null | 1,629,821 | null | 1 | 41 | c++|c++11|stl|std | 10,581 | <p>Unfortunately, there isn't a single <em>uniform</em> interface or pattern for erasing elements from STL containers.
But three behaviors emerge:</p>
<h2>std::vector Pattern</h2>
<p>To erase elements that fulfill a certain condition from a <strong><code>std::vector</code></strong>, a common technique is the so calle... |
16,037,165 | Displaying a number in Indian format using Javascript | <p>I have the following code to display in Indian numbering system. </p>
<pre><code> var x=125465778;
var res= x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
</code></pre>
<p>Am getting this output :<code>125,465,778</code>.</p>
<p>I need output like this: <code>12,54,65,778</code>.</p>
<p>Please help me to s... | 16,037,650 | 15 | 4 | null | 2013-04-16 12:32:32.073 UTC | 20 | 2021-12-24 11:00:58.087 UTC | 2016-06-08 08:36:08.043 UTC | null | 4,029,525 | null | 1,343,736 | null | 1 | 54 | javascript|jquery|number-systems | 78,000 | <p>For Integers:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code> var x=12345678;
x=x.toString();
var lastThree = x.substring(x.length-3);
var otherNumbers = x.... |
36,236,181 | How to remove title bar from the android activity? | <p>Can someone please help me with the issue.I want my activity as full screen and want to remove title from the screen.I have tried several ways but not able to remove it.</p>
<p>Activity Code :</p>
<pre><code>public class welcomepage extends Activity {
private Button btn;
EditText userName,passWord;
Da... | 46,709,914 | 8 | 9 | null | 2016-03-26 14:04:28.083 UTC | 23 | 2022-06-04 18:53:46.2 UTC | 2019-03-22 12:42:47.013 UTC | null | 6,296,561 | null | 3,959,477 | null | 1 | 62 | android|android-layout | 135,657 | <p>Try this: </p>
<p><strong><em>this.getSupportActionBar().hide();</em></strong></p>
<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try
{
this.getSupportActionBar().hide();
}
catch (NullPointerException e){}
setContentVi... |
10,276,074 | WPF - choose startup window based on some condition | <p>When running my program by clicking <code>Run</code> or pressing <code>Ctrl + F5</code>, is it possible to open different windows based on some check condition?</p>
<p>I.e if some condition is satisfied I wish to open a particular window, but if its not I want to open another window.</p>
<p>It should be like befor... | 10,276,293 | 4 | 3 | null | 2012-04-23 06:57:26.73 UTC | 9 | 2020-07-11 07:22:55.257 UTC | 2016-10-13 17:33:19.75 UTC | null | 4,671,754 | null | 942,533 | null | 1 | 36 | c#|.net|wpf|wpf-controls | 33,198 | <p>look into App.xaml</p>
<p>remove <code>StartupUri="MainWindow.xaml"</code></p>
<p>add <code>Startup="Application_Startup"</code> new event Handler</p>
<pre><code><Application x:Class="YourProject.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://sc... |
10,704,444 | Get File Path of A File In Your Current Project | <p>How do I programmically get the File Path of a File In my project?</p>
<pre><code> string fileContent = File.ReadAllText(LocalConstants.EMAIL_PATH);
</code></pre>
<p>The EMAIL_PATH I added to my project as a text file. This line of code throws an exception because by default it is looking in the system32 folder fo... | 10,704,508 | 3 | 4 | null | 2012-05-22 14:48:49.883 UTC | 1 | 2016-01-06 21:22:40.643 UTC | null | null | null | null | 245,926 | null | 1 | 16 | c# | 54,896 | <p>You could use <a href="http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx"><code>Path.Combine</code></a> and <a href="http://msdn.microsoft.com/en-us/library/system.appdomain.basedirectory.aspx"><code>AppDomain.CurrentDomain.BaseDirectory</code></a>:</p>
<pre><code>string fileName = "SampleFile.txt... |
10,396,552 | Do I need to re-use the same Akka ActorSystem or can I just create one every time I need one? | <p>Akka 2.x requires many commands to reference an <code>ActorSystem</code>. So, to create an instance of an actor <code>MyActor</code> you might say:</p>
<pre class="lang-scala prettyprint-override"><code>val system = ActorSystem()
val myActor = system.actorOf(Props[MyActor])
</code></pre>
<p>Because of the frequen... | 10,397,403 | 2 | 4 | null | 2012-05-01 10:39:00.887 UTC | 18 | 2016-03-19 04:33:52.133 UTC | null | null | null | null | 67,159 | null | 1 | 62 | scala|akka | 13,956 | <p>Creating an ActorSystem is very expensive, so you want to avoid creating a new one each time you need it. Also your actors should run in the same ActorSystem, unless there is a good reason for them not to. The name of the ActorSystem is also part the the path to the actors that run in it. E.g. if you create an actor... |
31,839,754 | How to change the check box (tick box) color to white in android XML | <p>Is there any way to change the check box (tick box) color to white in android XML. (I need white color tick box which contain black tick, as the preview I got in android studio inside my real device)</p>
<p>Here is my code for check box </p>
<pre><code><CheckBox
android:textSize="15sp"
android:textColo... | 31,840,734 | 7 | 2 | null | 2015-08-05 18:06:55.123 UTC | 1 | 2021-04-17 08:09:11.263 UTC | 2017-09-30 10:33:38.197 UTC | null | 5,650,328 | null | 1,528,623 | null | 1 | 20 | android|xml | 58,594 | <p>Set the <code>colorAccent</code> to your desired color:</p>
<pre><code><style name="AppTheme" parent="Theme.AppCompat">
<item name="colorAccent">#fff</item>
</style>
</code></pre>
<p>Or if you don't want to change your main theme, create a new theme and apply it only to the checkbox:</p... |
33,279,680 | What are the disadvantages of using Event sourcing and CQRS? | <p>Event sourcing and CQRS is great because it gets rids developers being stuck with one pre-modelled database which the developer has to work with for the lifetime of the application unless there is a big data migration project. CQRS and ES also has other benefits like scaling eventstore, audit log etc. that are alrea... | 33,305,980 | 5 | 9 | null | 2015-10-22 11:14:06.633 UTC | 23 | 2021-07-22 20:00:06.91 UTC | 2015-10-22 11:36:48.373 UTC | null | 1,378,771 | null | 1,378,771 | null | 1 | 58 | cqrs|event-sourcing | 19,643 | <p>Here is my take on this.</p>
<ol>
<li><p>CQRS + ES can make things a lot simpler in complex software systems by having rich domain objects, simple data models, history tracking, more visibility into concurrency problems, scalability and much more. It does require a different way thinking about the systems so it cou... |
56,661,844 | Error in Postman 500 Internal server error api | <p>i'm building an api using flask for a web
i already have a database and the GET request works but when i try POST it gives me This error</p>
<blockquote>
<p>500 INTERNAL SERVER ERROR</p>
</blockquote>
<p>This is the code i wrote</p>
<pre><code>#User_schema
class UserSchema(ma.Schema):
class Mata:
fields = ('... | 56,662,965 | 2 | 15 | null | 2019-06-19 07:03:54.643 UTC | null | 2021-03-05 10:08:04.013 UTC | 2019-06-19 08:41:40.913 UTC | null | 11,635,626 | null | 11,635,626 | null | 1 | 1 | python|json|api|flask|postman | 68,030 | <p>As shown in console the problem is that you are initializing a <code>User</code> object using constructor but in <code>User</code> class you have not defined any constructor.</p>
<p>Define a constructor like this</p>
<pre><code>class User(db.Model): ...
....
def __init__(self, username, email):
self.user... |
13,392,241 | How can I check if a localstorage variable is null or undefined? | <p>I have this code:</p>
<pre><code>var sideBar = localStorage.getItem('Sidebar');
</code></pre>
<p>I want to check if sideBar is defined and not null in an if statement. I am a bit confused I know there's a: <code>sideBar == undefined</code> and <code>sideBar != null</code> </p>
<p>but is there a good way for me to... | 13,392,335 | 7 | 1 | null | 2012-11-15 05:55:17.997 UTC | 5 | 2022-01-01 10:23:30.523 UTC | null | null | null | user1679941 | null | null | 1 | 21 | javascript | 52,318 | <p>best practice for checking if a variable is defined and not null:</p>
<pre><code>if (typeof sideBar !== 'undefined' && sideBar !== null)
</code></pre>
<p><strong>edited</strong> realized you're not checking if something is undefined, you're checking that it's defined, so edited again to answer your request... |
13,567,078 | What's wrong with single segment namespaces? | <p>I have read in several places that single segment namespaces are discouraged in clojure.</p>
<p>Indeed almost every library I've seen has (require 'lib.core) instead of (require 'lib).</p>
<p>Why?</p>
<hr>
<p>Edit: I am a bit stupid. Extra credit will be given for a concise example of how a single segment namesp... | 13,568,185 | 2 | 1 | null | 2012-11-26 14:40:40.017 UTC | 6 | 2012-11-26 15:42:40.93 UTC | 2012-11-26 15:28:34.367 UTC | null | 254,837 | null | 254,837 | null | 1 | 28 | clojure|namespaces | 3,056 | <p>Java discourages the use of the default package because you can't refer to anything in it from any other package. If you pre-compile a one-segment Clojure namespace, you'll get a Java class in the default package. If anyone at any time wants to use your library from Java, he will be stopped dead by this triviality. ... |
13,655,792 | How to stop (and restart) the Rails Server? | <p>I'm following the instructions here <a href="http://railsinstaller.org/mac">http://railsinstaller.org/mac</a> to get up and running with Rails on a Mac running OS X 10.8.2</p>
<p>At step 8 I'm asked to restart Rails server but how?</p>
<p>I'm assuming via a command line, but from within the already open ruby termi... | 13,655,800 | 6 | 0 | null | 2012-12-01 02:31:15.07 UTC | 10 | 2021-09-23 09:30:45.73 UTC | 2012-12-01 02:36:29.583 UTC | null | 249,543 | null | 1,837,174 | null | 1 | 32 | ruby-on-rails|command-line|terminal|restart | 113,639 | <p>Press <code>Ctrl+C</code></p>
<p>When you start the server it mentions this in the startup text.</p> |
3,392,956 | SQL - How to transpose? | <p>I have something similar to the following table:</p>
<pre><code>================================================
| Id | UserId | FieldName | FieldValue |
=====+========+===============+================|
| 1 | 100 | Username | John Doe |
|----+--------+---------------+----------------|
| 2 | ... | 3,392,962 | 2 | 1 | null | 2010-08-03 01:15:42.127 UTC | 11 | 2010-08-03 01:26:40 UTC | 2010-08-03 01:18:16.297 UTC | null | 135,152 | null | 253,976 | null | 1 | 30 | sql|mysql|database|pivot | 50,254 | <p>MySQL doesn't support ANSI PIVOT/UNPIVOT syntax, so that leave you to use:</p>
<pre><code> SELECT t.userid
MAX(CASE WHEN t.fieldname = 'Username' THEN t.fieldvalue ELSE NULL END) AS Username,
MAX(CASE WHEN t.fieldname = 'Password' THEN t.fieldvalue ELSE NULL END) AS Password,
MAX(CASE WH... |
9,188,447 | Visual Studio 2010 Service Pack 1 is not installing | <p>While installing Visual Studio 2010 Service Pack 1, I am getting this error:</p>
<blockquote>
<p>Installation did not succeed.
Microsoft Visual Studio 2010 Service Pack 1 has not been installed because: <br/>
Generic Trust Failure.</p>
</blockquote>
<p>How can I install Service Pack 1? I am using Windows&nbs... | 9,188,485 | 2 | 2 | null | 2012-02-08 05:51:20.66 UTC | 1 | 2016-09-15 21:41:32.107 UTC | 2015-07-31 16:22:50.987 UTC | null | 63,550 | null | 1,106,615 | null | 1 | 9 | visual-studio-2010|failed-installation | 45,039 | <p>This is the kind of error that can usually be fixed by the <a href="http://support.microsoft.com/kb/947821" rel="nofollow">System Update Readiness Tool</a>. Give it a shot and see if it solves it.</p> |
9,508,426 | How to connect from a VMware guest machine to the server installed on a Windows 7 host machine? | <p>How to connect from a VMware guest (virtual) machine to the server installed on the host (physical) machine? Things like typing "localhost" in the address bar of a browser in a guest machine don't work. My host machine's OS is Windows 7 64 bit with WMware Workstation installed on it, if it matters.</p>
<p>EDIT: The... | 9,508,536 | 4 | 2 | null | 2012-02-29 23:38:26.943 UTC | 5 | 2016-02-09 05:21:26.037 UTC | 2012-03-01 00:29:22.913 UTC | null | 944,687 | null | 944,687 | null | 1 | 11 | vmware|virtualization|virtual-machine|vmware-workstation | 58,995 | <p>If you use "Bridged" Network Connection (see Virtual Machine Settings: Network Adapter), your VM will be given an IP address on the same LAN as your host machine. At that point, you can just HTTP to your host's IP address, eg. <code>http://192.168.0.100</code></p>
<p>You can also do that with the other options, but... |
9,099,469 | MySQL SELECT LIKE or REGEXP to match multiple words in one record | <p>The field <code>table</code>.<code>name</code> contains 'Stylus Photo 2100' and with the following query</p>
<pre><code>SELECT `name` FROM `table` WHERE `name` LIKE '%Stylus 2100%'
</code></pre>
<p>I get no results. Of course i would if i searched</p>
<pre><code>SELECT `name` FROM `table` WHERE `name` LIKE '%Phot... | 9,099,540 | 7 | 2 | null | 2012-02-01 16:31:10.773 UTC | 20 | 2019-06-27 14:13:13.427 UTC | 2014-04-11 07:28:40.69 UTC | null | 1,835,606 | null | 953,788 | null | 1 | 79 | mysql|regex|select|sql-like | 200,666 | <p>Well if you know the order of your words.. you can use:</p>
<pre><code>SELECT `name` FROM `table` WHERE `name` REGEXP 'Stylus.+2100'
</code></pre>
<p>Also you can use:</p>
<pre><code>SELECT `name` FROM `table` WHERE `name` LIKE '%Stylus%' AND `name` LIKE '%2100%'
</code></pre> |
16,545,262 | Python: NameError: free variable 're' referenced before assignment in enclosing scope | <p>I have a strange NameError in Python 3.3.1 (win7).</p>
<p>The code:</p>
<pre><code>import re
# ...
# Parse exclude patterns.
excluded_regexps = set(re.compile(regexp) for regexp in options.exclude_pattern)
# This is line 561:
excluded_regexps |= set(re.compile(regexp, re.I) for regexp in options.exclude_pattern... | 16,545,619 | 3 | 3 | null | 2013-05-14 14:00:09.563 UTC | null | 2019-01-10 03:12:42.92 UTC | 2013-05-14 14:05:29.363 UTC | null | 623,685 | null | 623,685 | null | 1 | 20 | python | 41,796 | <p>Most likely, you are assigning to <code>re</code> (presumably inadvertently) at some point <em>below</em> line 561, but in the same function. This reproduces your error:</p>
<pre><code>import re
def main():
term = re.compile("foo")
re = 0
main()
</code></pre> |
16,535,630 | Sum values in foreach loop php | <pre><code>foreach($group as $key=>$value)
{
echo $key. " = " .$value. "<br>";
}
</code></pre>
<p>For example:</p>
<blockquote>
<p>doc1 = 8</p>
<p>doc2 = 7</p>
<p>doc3 = 1</p>
</blockquote>
<p>I want to count $value, so the result is 8+7+1 = 16. What should i do?</p>
<p>Thanks.</p> | 16,535,758 | 5 | 1 | null | 2013-05-14 05:17:58.31 UTC | 16 | 2013-05-14 07:06:28.01 UTC | 2013-05-14 05:44:03.22 UTC | null | 1,444,140 | null | 2,338,965 | null | 1 | 29 | php|foreach|count | 201,791 | <pre><code>$sum = 0;
foreach($group as $key=>$value)
{
$sum+= $value;
}
echo $sum;
</code></pre> |
16,504,231 | What is the meaning of "ReentrantLock" in Java? | <p>Reentrancy means that locks are acquired on a per-thread rather than per-invocation basis.</p>
<p>Since an intrinsic lock is held by a thread, doesn't it mean that a thread run once equals an invocation basis?</p>
<p>Thank you, it seems mean that: in a thread,if I get a lock <code>lockA</code> when process functio... | 16,504,266 | 6 | 4 | null | 2013-05-12 04:34:02.947 UTC | 24 | 2020-04-11 07:10:40.343 UTC | 2019-09-15 22:20:21.45 UTC | null | 801,894 | null | 1,059,465 | null | 1 | 46 | java|reentrancy | 17,419 | <blockquote>
<p>Reentrancy means that locks are acquired on a per-thread rather than per-invocation basis.</p>
</blockquote>
<p>That is a misleading definition. It is true (sort of), but it misses the real point.</p>
<p>Reentrancy means (in general CS / IT terminology) that you do something, and while you are stil... |
21,483,999 | Using atan2 to find angle between two vectors | <p>I understand that:</p>
<p><code>atan2(vector.y, vector.x)</code> = the angle between the <strong>vector and the X axis</strong>.</p>
<p>But I wanted to know how to get the angle between <strong>two vectors</strong> using atan2. So I came across this solution:</p>
<pre><code>atan2(vector1.y - vector2.y, vector1.x ... | 21,484,228 | 10 | 3 | null | 2014-01-31 15:41:40.033 UTC | 45 | 2022-07-20 08:45:18.407 UTC | 2019-08-05 19:34:49.363 UTC | null | 3,924,118 | null | 3,150,201 | null | 1 | 75 | math|vector|geometry | 141,814 | <pre><code> atan2(vector1.y - vector2.y, vector1.x - vector2.x)
</code></pre>
<p>is the angle between the <em>difference vector</em> (connecting vector2 and vector1) and the x-axis,
which is problably not what you meant.</p>
<p>The (directed) angle from vector1 to vector2 can be computed as</p>
<pre><code>angle = at... |
17,275,334 | What is a correct way to filter different loggers using python logging? | <h1>My purpose is to do a multi-module logging with hierarchical filtering</h1>
<p>the way it is proposed by <em>logging</em> author Vinay Sajip, at least as far as I guess ;-)</p>
<p>You can skip to "<strong>How I want it to work</strong>"</p>
<p><em>Unfortunately, I learned very quickly that working with logging f... | 17,276,457 | 1 | 2 | null | 2013-06-24 12:19:58.52 UTC | 19 | 2016-08-29 15:28:34.75 UTC | 2017-05-23 12:02:27.713 UTC | null | -1 | null | 544,463 | null | 1 | 34 | python|logging|filter | 25,051 | <p><strong>Solution</strong></p>
<p>Add the filter to the handler rather than the logger:</p>
<pre><code>handler.addFilter(logging.Filter('foo'))
</code></pre>
<hr>
<p><strong>Explanation</strong></p>
<p>In the flow chart diagram you posted, notice there are two diamonds:</p>
<ul>
<li>Does a filter attached to <s... |
12,291,523 | open new window with php code after form submits results | <p>here is the script that i been working on , it is supposed to integrate user and pass when opened</p>
<pre><code><?php
$name = $_POST['name']; // contain name of person
$pass = $_POST['pass']; // Email address of sender
$link = window.open(https://secure.brosix.com/webclient/?nid=4444&user=$name&pass=$... | 12,291,541 | 4 | 2 | null | 2012-09-06 00:34:50.137 UTC | 2 | 2022-02-05 15:25:17.723 UTC | null | null | null | null | 1,626,986 | null | 1 | 3 | php|forms|validation|popup|window | 97,150 | <p>Change your code to this</p>
<pre><code><?php
$name = $_POST['name']; // contain name of person
$pass = $_POST['pass']; // Email address of sender
$link = "<script>window.open('https://secure.brosix.com/webclient/? nid=4510&user=$name&pass=$pass&hideparams=1', 'width=710,height=555,left=16... |
5,214,543 | What is "stringification" in Perl? | <p>In the documentation for the CPAN module <a href="http://search.cpan.org/~drolsky/DateTime-0.66/lib/DateTime.pm#Formatters_And_Stringification" rel="noreferrer">DateTime</a> I found the following:</p>
<blockquote>
<p>Once you set the formatter, the
overloaded stringification method will
use the formatter.</p>... | 5,214,672 | 3 | 0 | null | 2011-03-07 00:24:49.123 UTC | 10 | 2014-01-08 13:07:54.987 UTC | 2014-01-08 13:07:54.987 UTC | null | 63,550 | null | 16,012 | null | 1 | 28 | perl | 10,590 | <p>"stringification" happens any time that perl needs to convert a value into a string. This could be to print it, to concatenate it with another string, to apply a regex to it, or to use any of the other string manipulation functions in Perl.</p>
<pre><code>say $obj;
say "object is: $obj";
if ($obj =~ /xyz/) {...}
s... |
4,999,144 | Aspect Oriented Programing (AOP) solutions for C# (.Net) and their features | <p>I would like to ask for 3 information here:</p>
<ol>
<li><p>There is <strong>no integrated solution</strong> for Aspect Oriented Programing (AOP) in C# (.Net) <strong>from Microsoft</strong> is that correct ? Is there any such solution under development or planned ?</p>
</li>
<li><p><strong>What solutions are there<... | 5,004,509 | 3 | 7 | null | 2011-02-15 01:35:35.663 UTC | 6 | 2014-07-31 12:59:54.537 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 311,865 | null | 1 | 30 | c#|.net|aop | 10,213 | <p>As Adam Rackis points out, Post# is the way to go, it is as close you will get to AspectJ on the .NET platform.</p>
<p>Main differences is obviously that AspecJ has language support for aspects while Post# is a post compile weaver for .NET assemblies.
(thus no language integration)</p>
<p>However, Post# can use jo... |
25,515,166 | Redis Daemon not creating a PID file | <p>The Redis startup script is supposed to create a pid file at startup, but I've confirmed all the settings I can find, and no pid file is ever created.</p>
<p>I installed redis by: </p>
<pre><code>$ yum install redis
$ chkconfig redis on
$ service redis start
</code></pre>
<p>In my config file (/etc/redis.conf) I ... | 25,529,443 | 11 | 2 | null | 2014-08-26 21:08:03.833 UTC | 15 | 2022-08-04 22:15:00.427 UTC | 2022-08-04 22:15:00.427 UTC | null | 9,431,571 | null | 2,456,552 | null | 1 | 43 | redis|centos|pid|monit|rhel6 | 64,708 | <p>Problem was that the user redis did not have permission to create the pid file (or directory it was in). Fix:</p>
<pre><code>sudo mkdir /var/run/redis
sudo chown redis /var/run/redis
</code></pre>
<p>Then I killed and restarted redis and sure enough, there was redis.pid</p> |
25,934,586 | Finding the amount of characters of all words in a list in Python | <p>I'm trying to find the total number of characters in the list of words, specifically this list:</p>
<pre><code>words = ["alpha","omega","up","down","over","under","purple","red","blue","green"]
</code></pre>
<p>I've tried doing: </p>
<pre><code>print "The size of the words in words[] is %d." % len(words)
</code><... | 25,934,600 | 3 | 3 | null | 2014-09-19 13:02:58.803 UTC | 3 | 2021-03-27 21:18:08.453 UTC | 2017-08-18 17:22:58.613 UTC | null | 7,992,467 | null | 4,056,643 | null | 1 | 8 | python|list | 55,453 | <p>You can use the <code>len</code> function within a list comprehension, which will create a list of lengths</p>
<pre><code>>>> words = ["alpha","omega","up","down","over","under","purple","red","blue","green"]
>>> [len(i) for i in words]
[5, 5, 2, 4, 4, 5, 6, 3, 4, 5]
</code></pre>
<p>Then simply ... |
25,466,030 | Make QWidget transparent | <p>I have a <code>QWidget</code>-based overlay widget which should paint some text and take place over the central widget of my application. The problem is that I can't set background of overlay widget to be transparent. What I already tried:</p>
<ol>
<li><code>setPalette(Qt::transparent);</code></li>
<li><code>setAtt... | 25,468,160 | 3 | 3 | null | 2014-08-23 20:23:24.28 UTC | 6 | 2017-12-01 11:53:13.973 UTC | null | null | null | null | 275,221 | null | 1 | 25 | c++|qt|qt4 | 41,983 | <p>My best guess to show an overlay widget, is convert the widget to a window, resize it to it's contents and move them to the desired position manually.</p>
<p>MainWindow Example, showing the overlay widget in the center of the video widget:</p>
<pre><code>Mwindow::Mwindow()
{
widget = new Widget(this);
}
void ... |
9,212,797 | How to get CSS selectors to work in the Developer Tools for Chrome 17? | <p>It appears that the search window of the Dev Tools in Chrome 17 no longer matches CSS selectors. Boo. I know I can use the JS console but it really, really helps me to see the matches within the context of the DOM. If anyone knows how I can still achieve this or alternatively, how to revert to a previous (i.e. th... | 9,212,970 | 4 | 4 | null | 2012-02-09 14:36:54.44 UTC | 12 | 2018-01-17 13:58:28.83 UTC | 2012-02-10 14:20:36.1 UTC | null | 106,224 | null | 1,025,695 | null | 1 | 38 | css|google-chrome|css-selectors|google-chrome-devtools | 49,948 | <p><del>I haven't been able to find any workaround to get CSS selectors working in the search bar again.</del> <a href="https://stackoverflow.com/a/10640999/106224">Rejoice, for they have returned!</a></p>
<p>In any case, you can still use <code>document.querySelectorAll()</code> with a selector in the JS console, the... |
9,362,286 | Why is the Fibonacci series used in agile planning poker? | <p>When estimating the relative size of user stories in agile software development the members of the team are supposed to estimate the size of a user story as being 1, 2, 3, 5, 8, 13, ... . So the estimated values should resemble the Fibonacci series. But I wonder, why?</p>
<p>The description of <a href="http://en.wi... | 24,885,067 | 6 | 4 | null | 2012-02-20 13:55:01.487 UTC | 32 | 2016-01-26 13:10:05.343 UTC | null | null | null | null | 179,014 | null | 1 | 96 | math|statistics|agile|agile-project-management | 132,073 | <p>The Fibonacci series is just one example of an exponential estimation scale. The reason an exponential scale is used comes from Information Theory.</p>
<p><strong>The information that we obtain out of estimation grows much slower than the precision of estimation. In fact it grows as a logarithmic function.</strong>... |
9,104,706 | How can I convert spaces to tabs in Vim or Linux? | <p>I've looked over several questions on Stack Overflow for how to convert spaces to tabs without finding what I need. There seem to be more questions about how to convert tabs to spaces, but I'm trying to do the opposite.</p>
<p>In <code>Vim</code> I've tried <code>:retab</code> and <code>:retab!</code> without luck,... | 9,105,889 | 10 | 4 | null | 2012-02-01 23:02:22.337 UTC | 116 | 2022-01-03 23:03:53.097 UTC | 2018-04-01 12:01:04.81 UTC | null | 3,772,866 | null | 288,032 | null | 1 | 216 | linux|vim|tabs|spaces | 165,159 | <p>Using Vim to expand all <em>leading</em> spaces (wider than <a href="http://vimdoc.sourceforge.net/htmldoc/options.html#%27tabstop%27" rel="noreferrer"><code>'tabstop'</code></a>), you were right to use <a href="http://vimdoc.sourceforge.net/htmldoc/change.html#:retab" rel="noreferrer"><code>retab</code></a> but fir... |
18,337,536 | Android Overriding onBackPressed() | <p>Is it possible to override <code>onBackPressed()</code> for only one activity ? </p>
<p>On back button click I want to call a dialog on a specific Activity, but in all other activities i want it to work as it worked before (going to previous activities).</p>
<p><strong>EDITED</strong></p>
<p>Thank you everyone fo... | 18,337,567 | 8 | 1 | null | 2013-08-20 14:23:45.593 UTC | 17 | 2019-08-02 09:14:18.753 UTC | 2019-04-14 23:34:52.303 UTC | null | 8,464,442 | null | 2,219,052 | null | 1 | 69 | android|android-intent|event-handling|overriding | 189,838 | <p>Yes. Only override it in that one <code>Activity</code> with</p>
<pre><code>@Override
public void onBackPressed()
{
// code here to show dialog
super.onBackPressed(); // optional depending on your needs
}
</code></pre>
<p>don't put this code in any other <code>Activity</code></p> |
27,556,504 | Why is operator""s hidden in a namespace? | <p>In order to use <code>operator""s</code> for <code>std::string</code> you have to do <code>using namespace std::string_literals</code>. But user-defined literals that don't begin with <code>_</code> are reserved, so possible conflict can't be an excuse. The other <code>operator""s</code> is from <code>std::chrono</c... | 27,556,595 | 1 | 5 | null | 2014-12-18 22:04:07.987 UTC | 5 | 2015-02-18 18:16:48.76 UTC | null | null | null | null | 4,375,981 | null | 1 | 28 | c++|c++14 | 3,138 | <p>There are actually two reasons why literals are put into namespaces:</p>
<ol>
<li>It is considered undesirable that users would use <code>using namespace std;</code> just to get hold of the corresponding literals. Having the literals declared in namespaces specific to these doesn't cause the problem.</li>
<li>Depen... |
15,040,838 | MVC JsonResult camelCase serialization | <p>I am trying to make my action return a JsonResult where all its properties are in camelCase. </p>
<p>I have a simply model:</p>
<pre><code>public class MyModel
{
public int SomeInteger { get; set; }
public string SomeString { get; set; }
}
</code></pre>
<p>And a simple controller action:</p>
<pre><code>... | 15,086,346 | 2 | 4 | null | 2013-02-23 13:03:46.047 UTC | 3 | 2022-03-17 14:17:25.927 UTC | 2022-03-17 14:17:25.927 UTC | null | 37,055 | null | 1,432,368 | null | 1 | 36 | json|asp.net-mvc|asp.net-mvc-3|serialization|camelcasing | 30,456 | <p>The Json functions of the Controller are just wrappers for creating JsonResults:</p>
<pre><code>protected internal JsonResult Json(object data)
{
return Json(data, null /* contentType */, null /* contentEncoding */, JsonRequestBehavior.DenyGet);
}
protected internal JsonResult Json(object data, string contentT... |
8,320,153 | How do I hide axes and ticks in matlab without hiding everything else | <p>I draw images to axes in my matlab UI, but I don't want the axes and ticks to be visible how do I prevent that, and also where do I make this call?</p>
<p>I do this</p>
<pre><code>imagesc(myImage,'parent',handles.axesInGuide);
</code></pre> | 8,320,276 | 2 | 0 | null | 2011-11-30 01:42:28.51 UTC | 0 | 2019-03-20 15:02:44.053 UTC | 2011-11-30 02:22:10.05 UTC | null | 261,842 | null | 261,842 | null | 1 | 19 | matlab | 101,074 | <pre><code>axis off;
</code></pre>
<p>Is this what you are looking for?</p>
<p>This is definitely somewhere else on this website and in the matlab documentation. Try typing </p>
<p><code>help plot</code></p>
<p>Or using the documentation on plotting!</p>
<p>edit: Now that you have shown what you are doing. (You do... |
8,798,745 | How to get html elements from an object tag? | <p>I'm using the object tag to load an html snippet within an html page.</p>
<p>My code looks something along these lines:</p>
<p><code><html><object data="/html_template"></object></html></code></p>
<p>As expected after the page is loaded some elements are added between the object tags.
I wa... | 46,527,064 | 8 | 3 | null | 2012-01-10 04:58:01.927 UTC | 4 | 2022-07-28 22:57:30.55 UTC | 2012-01-10 06:30:45.73 UTC | null | 421,323 | null | 421,323 | null | 1 | 30 | javascript|jquery|html | 71,743 | <p>No , it's not possible to get access to a cross-origin frame !</p> |
8,900,166 | What's the difference between lists enclosed by square brackets and parentheses in Python? | <pre><code>>>> x=[1,2]
>>> x[1]
2
>>> x=(1,2)
>>> x[1]
2
</code></pre>
<p>Are they both valid? Is one preferred for some reason?</p> | 8,900,189 | 7 | 3 | null | 2012-01-17 19:02:34.433 UTC | 64 | 2021-10-04 17:11:21.593 UTC | 2020-11-16 08:19:38.48 UTC | null | 7,878,602 | null | 1,150,778 | null | 1 | 206 | python|list|tuples | 201,631 | <p>Square brackets are <a href="http://docs.python.org/tutorial/datastructures.html#more-on-lists" rel="noreferrer">lists</a> while parentheses are <a href="https://docs.python.org/tutorial/datastructures.html#tuples-and-sequences" rel="noreferrer">tuples</a>.</p>
<p>A list is mutable, meaning you can change its conte... |
8,560,501 | android - save image into gallery | <p>i have an app with a gallery of images and i want that the user can save it into his own gallery.
I've created an option menu with a single voice "save" to allow that but the problem is...how can i save the image into the gallery?</p>
<p>this is my code:</p>
<pre><code>@Override
public boolean onOptionsIte... | 8,722,494 | 12 | 4 | null | 2011-12-19 11:15:18.603 UTC | 62 | 2022-01-11 20:31:42.41 UTC | 2022-01-11 20:31:42.41 UTC | null | 1,889,720 | null | 345,812 | null | 1 | 111 | java|android|imageview|gallery|save-image | 225,246 | <pre><code>MediaStore.Images.Media.insertImage(getContentResolver(), yourBitmap, yourTitle , yourDescription);
</code></pre>
<p>The former code will add the image at the end of the gallery. If you want to modify the date so it appears at the beginning or any other metadata, see the code below (Cortesy of S-K, <em>samk... |
30,794,083 | Android Navigation Bar covering viewpager content | <p>I can't stop the Systems Navigation Bar from covering up my content!</p>
<p><img src="https://i.stack.imgur.com/7XxMD.png" alt="enter image description here"></p>
<p>I am scrolled to the very bottom of the recyclerview but its getting hidden behind the navigation bar. Here is my XML layout.</p>
<pre><code><and... | 34,644,745 | 7 | 7 | null | 2015-06-12 01:40:33.043 UTC | 2 | 2019-04-12 11:47:39.013 UTC | null | null | null | null | 3,352,901 | null | 1 | 29 | android|android-fragments|android-viewpager|navigationbar | 10,661 | <p>I Figured it out. In my particular situation each of my fragments manage their own toolbar instance. I was calling setSupportActionBar() in the onViewCreated() method on my fragments. Moving this functionality into onCreateView() solved it. </p>
<pre><code> @Nullable
@Override
public View onCreateView(La... |
4,941,606 | Changing gradient background colors on Android at runtime | <p>I'm experimenting with Drawable backgrounds and have had no problems so far.</p>
<p>I'm now trying to change the gradient background color at runtime.</p>
<p>Unfortunately, there's no API to change it at runtime, it seems. Not even by trying to mutate() the drawable, as explained here: <a href="http://android-deve... | 4,943,888 | 5 | 0 | null | 2011-02-09 05:23:19.69 UTC | 15 | 2022-01-25 04:49:53.447 UTC | null | null | null | null | 215,768 | null | 1 | 28 | android|background|gradient|drawable | 34,348 | <p>Yes! Found a way!</p>
<p>Had to forget about XML, but here's how I did it:</p>
<p>On my getView() overloaded function (ListAdapter) I just had to:</p>
<pre><code> int h = v.getHeight();
ShapeDrawable mDrawable = new ShapeDrawable(new RectShape());
mDrawable.getPaint().setShader(new LinearGradient(0, 0,... |
5,047,798 | Which MinGW file to use as a C++ compiler | <p>I have just installed MinGW and in the bin folder I can see 7 .exe files that compile my program:</p>
<ol>
<li>c++.exe</li>
<li>g++.exe</li>
<li>mingw32-c++.exe</li>
<li>mingw32-g++.exe</li>
<li>gcc.exe</li>
<li>mingw32-gcc.exe</li>
<li>mingw32-gcc-4.4.1.exe</li>
</ol>
<p>My small program (testprog.cpp) compiles c... | 5,047,814 | 5 | 1 | null | 2011-02-18 23:54:03.967 UTC | 5 | 2022-06-28 15:19:53.91 UTC | 2012-12-01 04:46:41.82 UTC | null | 4,714 | null | 4,714 | null | 1 | 28 | c++|c|compiler-construction|mingw | 14,275 | <p>It's quite possible that they are all the same; either exact copies or symbolic links to one another. Try using the <code>--version</code> flag on each to see what you've got. On my MingGW installation here, each of those binaries differs (checked with <code>diff</code>), but they all output the same version infor... |
5,141,431 | Get input value after keydown/keypress | <p>I have an <code><input type="text"></code>, and I need to call a function after the text in the text box was changed (inluding actions performed during jQuery's keydown and keypress handlers).</p>
<p>If I call my function from the jQuery handler, I see the value (<code>e.target.value</code>) as it was before ... | 5,141,458 | 6 | 0 | null | 2011-02-28 11:36:10.727 UTC | 4 | 2020-01-21 11:32:36.197 UTC | 2019-08-20 16:36:52.697 UTC | null | 4,370,109 | null | 275,109 | null | 1 | 25 | javascript|jquery|jquery-events | 68,701 | <p>If I understand you right then something like this is the way u can do it</p>
<pre><code>$('input').bind('change keydown keyup',function (){
/// do your thing here.
// use $(this).val() instead e.target.value
});
</code></pre>
<p><strong>Updated</strong>: 03/05/13</p>
<p><strong>Please note</strong>: that ... |
5,327,668 | Calling toString on a javascript function returns source code | <p>I just found out that when you call toString() on a javascript function, as in <code>myFunction.toString()</code>, the source code of that function is returned.</p>
<p>If you try it in the Firebug or Chrome console it will even go as far as formatting it nicely for you, even for minimized javascript files.<br>
I do... | 5,328,782 | 6 | 2 | null | 2011-03-16 15:33:55.87 UTC | 9 | 2021-06-28 10:42:51.987 UTC | 2011-03-22 19:18:53.407 UTC | null | 93,356 | null | 93,356 | null | 1 | 37 | javascript|tostring | 46,631 | <p>It has some use for debugging, since it lets you see the code of the function. You can check if a function has been overwritten, and if a variable points to the right function.</p>
<p>It has some uses for obfuscated javascript code. If you want to do hardcore obfuscation in javascript, you can transform your whole c... |
5,417,727 | Get date object for the first/last day of the current year | <p>I need to get <code>date</code> objects for the first and last day in the current year.</p>
<p>Currently I'm using this code which works fine, but I'm curious if there's a nicer way to do it; e.g. without having to specify the month/day manually.</p>
<pre><code>from datetime import date
a = date(date.today().year,... | 5,417,911 | 6 | 8 | null | 2011-03-24 10:28:18.47 UTC | 10 | 2021-08-17 11:42:17.297 UTC | 2015-11-10 15:16:15.273 UTC | null | 298,479 | null | 298,479 | null | 1 | 65 | python|date | 55,262 | <p>The only real improvement that comes to mind is to give your variables more descriptive names than <code>a</code> and <code>b</code>.</p> |
5,323,818 | Condensed matrix function to find pairs | <p>For a set of observations:</p>
<pre><code>[a1,a2,a3,a4,a5]
</code></pre>
<p>their pairwise distances</p>
<pre><code>d=[[0,a12,a13,a14,a15]
[a21,0,a23,a24,a25]
[a31,a32,0,a34,a35]
[a41,a42,a43,0,a45]
[a51,a52,a53,a54,0]]
</code></pre>
<p>Are given in a condensed matrix form (upper triangular of the ab... | 5,323,902 | 7 | 0 | null | 2011-03-16 10:16:57.647 UTC | 11 | 2021-06-09 00:21:09.463 UTC | 2011-03-16 14:56:19.167 UTC | null | 188,368 | null | 188,368 | null | 1 | 10 | python|algorithm|math|statistics|scipy | 3,172 | <p>You may find <a href="http://docs.scipy.org/doc/numpy-1.5.x/reference/generated/numpy.triu_indices.html#numpy.triu_indices" rel="nofollow noreferrer">triu_indices</a> useful. Like,</p>
<pre><code>In []: ti= triu_indices(5, 1)
In []: r, c= ti[0][5], ti[1][5]
In []: r, c
Out[]: (1, 3)
</code></pre>
<p>Just notice th... |
5,001,488 | Zend Framework 1.11 with Doctrine 2 Integration | <p>Could someone explain in detail how to integrate Doctrine 2 and Zend Framework 1.11?</p> | 5,002,011 | 7 | 1 | null | 2011-02-15 08:53:30.6 UTC | 11 | 2014-05-27 11:37:54.057 UTC | 2011-02-15 09:22:33.123 UTC | null | 11,568 | null | 264,990 | null | 1 | 19 | php|zend-framework|orm|doctrine | 21,089 | <p>There is a great video by Jon Lebensold about integrating D2 and ZF: <a href="http://www.zendcasts.com/unit-testing-doctrine-2-entities/2011/02/">Unit Testing Doctrine 2</a> - don't be misleaded by the title :)</p> |
5,427,454 | How do I pipe or redirect the output of curl -v? | <p>For some reason the output always gets printed to the terminal, regardless of whether I redirect it via 2> or > or |. Is there a way to get around this? Why is this happening?</p> | 5,427,484 | 9 | 1 | null | 2011-03-25 01:03:47.363 UTC | 37 | 2022-05-12 12:39:41.623 UTC | null | null | null | null | 329,781 | null | 1 | 144 | linux|unix|curl | 266,020 | <p>add the <code>-s</code> (silent) option to remove the progress meter, then redirect stderr to stdout to get verbose output on the same fd as the response body</p>
<pre><code>curl -vs google.com 2>&1 | less
</code></pre> |
16,610,607 | Store XML Data in a mongodb collection | <p>I am still relatively new to NoSQL databases like mongodb, so excuse my ignorance.</p>
<p><strong>Background:</strong></p>
<p>Right now, I have a system that does the following:</p>
<ol>
<li>gathers system data from clients</li>
<li>outputs that info into an xml document</li>
<li>a perl script takes the data in t... | 16,613,296 | 4 | 0 | null | 2013-05-17 13:43:17.053 UTC | 2 | 2015-10-26 09:39:45.753 UTC | 2013-05-17 19:07:22.42 UTC | null | 843,443 | null | 843,443 | null | 1 | 7 | xml|mongodb | 46,554 | <p>When moving to a NoSQL document DB, the decision is highly influenced by <strong>how the data is read or used by the client/user</strong> as the data is mostly pre-aggregated/pre-joined based on the usage patterns. So, technically you can move to mongodb "technically" by just converting the data to json/bson instead... |
17,121,706 | using map(int, raw_input().split()) | <p>Though I like python very much, When I need to get multiple integer inputs in the same line, I prefer C/C++. If I use python, I use:</p>
<pre><code>a = map(int, raw_input().split())
</code></pre>
<p>Is this the only way or is there any pythonic way to do it? And does this cost much as far as time is considered? </... | 17,121,719 | 4 | 4 | null | 2013-06-15 08:35:09.073 UTC | 8 | 2018-09-06 13:59:41.597 UTC | 2013-06-15 08:46:09.837 UTC | null | 1,971,805 | null | 2,046,858 | null | 1 | 10 | python|map|raw-input | 90,485 | <p>If you're using map with built-in function then it can be slightly faster than LC:</p>
<pre><code>>>> strs = " ".join(str(x) for x in xrange(10**5))
>>> %timeit [int(x) for x in strs.split()]
1 loops, best of 3: 111 ms per loop
>>> %timeit map(int, strs.split())
1 loops, best of 3: 105 ms... |
12,097,726 | Ruby classes: initialize self vs. @variable | <p>Can someone explain the difference between initializing "self" and having @variables when defining classes?</p>
<p>Here's an example</p>
<pre><code>class Child < Parent
def initialize(self, stuff):
self.stuff = stuff
super()
end
end
</code></pre>
<p>So in this case, wouldn't I be able to replace <c... | 12,097,864 | 2 | 2 | null | 2012-08-23 18:15:19.117 UTC | 9 | 2012-08-23 21:40:09.77 UTC | 2012-08-23 18:17:49.303 UTC | null | 458,137 | null | 1,555,312 | null | 1 | 14 | ruby | 12,459 | <p>In general, no, <code>self.stuff = stuff</code> and <code>@stuff = stuff</code> are different. The former makes a method call to <code>stuff=</code> on the object, whereas the latter directly sets an instance variable. The former invokes a method which may be public (unless specifically declared private in the class... |
12,135,793 | Generating API tokens using node | <p>I am writing an app that will expose an API. The application allows people to create workspaces and add users to them. Each user will have a unique token. When they make an API call, they will use that token (which will identify them as that user using that workspace.</p>
<p>At the moment I am doing this:</p>
<pre... | 12,135,990 | 4 | 0 | null | 2012-08-27 03:05:38.1 UTC | 8 | 2021-09-13 00:40:36.597 UTC | 2017-07-02 18:22:04.93 UTC | null | 2,311,366 | null | 829,771 | null | 1 | 20 | node.js | 34,778 | <p>If you using mongodb just use ObjectId, othewise I recommend substack's <a href="https://github.com/substack/node-hat">hat</a> module.</p>
<p>To generate id is simple as </p>
<pre><code>var hat = require('hat');
var id = hat();
console.log(id); // 1c24171393dc5de04ffcb21f1182ab28
</code></pre> |
12,406,750 | Find an item in a generic list by specifying multiple conditions | <p>Most often we find generic list with code like:</p>
<pre><code>CartItem Item = Items.Find(c => c.ProductID == ProductID);
Item.Quantity = Quantity;
Item.Price = Price;
</code></pre>
<p>So the above code finds and updates with other data, but if I want to find by multiple conditions, then how do I write the code... | 12,406,785 | 5 | 2 | null | 2012-09-13 12:54:07.01 UTC | 8 | 2018-05-23 10:54:31.16 UTC | 2016-10-20 09:01:38.267 UTC | null | 63,550 | null | 508,127 | null | 1 | 22 | c#|linq|lambda | 89,180 | <p>Try this: </p>
<pre><code>CartItem Item = Items.Find(c => (c.ProductID == ProductID) && (c.ProductName == "ABS001"));
</code></pre> |
12,603,425 | Expand and collapse with angular js | <p>I am trying to figure out a way to do an expand and collapse using angular js. I haven't been able to find an elegant way to do this without manipulating dom objects in the controller (which is not the angular way). Currently I have a nice way to do it for a one layer expand and collapse. However when I start nestin... | 14,296,257 | 6 | 1 | null | 2012-09-26 13:57:23.723 UTC | 10 | 2017-12-06 10:57:11.83 UTC | 2012-09-27 16:04:26.17 UTC | null | 21,217 | null | 692,197 | null | 1 | 23 | javascript|expand|collapse|angularjs | 130,375 | <blockquote>
<p>The problem comes in by me not knowing how to send a unique identifier with an ng-click to only expand/collapse the right content.</p>
</blockquote>
<p>You can pass <code>$event</code> with ng-click (ng-dblclick, and ng- mouse events), then you can determine which element caused the event:</p>
<pre>... |
12,084,015 | iOS Push Notification - How to get the notification data when you click on the app icon instead of notification | <p>Similar to this question: <a href="https://stackoverflow.com/questions/6732427/how-do-i-access-remote-push-notification-data-on-applicationdidbecomeactive">How do I access remote push notification data on applicationDidBecomeActive?</a></p>
<p>But the different is how can you access the notification data when you a... | 12,084,129 | 4 | 2 | null | 2012-08-23 02:37:22.18 UTC | 20 | 2016-08-30 19:59:36.32 UTC | 2017-05-23 11:54:18.733 UTC | null | -1 | null | 365,256 | null | 1 | 37 | iphone|ios|xcode|push-notification|apple-push-notifications | 18,359 | <p>You can't get remote push payload by launching app from homescreen.</p>
<p>If the push data is important for app use, load it from your server after app launched.</p> |
12,600,214 | contentView not indenting in iOS 6 UITableViewCell prototype cell | <p>I am configuring a custom <code>UITableViewCell</code> using a prototype cell in a Storyboard. However, all the <code>UILabel</code>s (and other UI elements) do not seem to be added to the cell's <code>contentView</code>, instead being added to the <code>UITableViewCell</code> view directly. This creates issues when... | 12,657,891 | 6 | 2 | null | 2012-09-26 11:00:00.747 UTC | 33 | 2013-12-06 16:55:46.623 UTC | 2012-09-30 01:18:22.853 UTC | null | 257,314 | null | 257,314 | null | 1 | 40 | ios|uitableview|ios6 | 20,080 | <p>On further investigation (viewing the subview hierarchy of the cell) Interface Builder does place subviews within the cell's <code>contentView</code>, it just doesn't look like it.</p>
<p>The root cause of the issue was iOS 6 autolayout. When the cell is placed into editing mode (and indented) the <code>contentView... |
12,276,957 | Are there any non-twos-complement implementations of C? | <p><a href="https://stackoverflow.com/questions/3952123/representation-of-negative-numbers-in-c/3952262#3952262">As we all no doubt know</a>, the ISO C standard (and C++ as well, I think, though I'm more interested on the C side) allows three underlying representations of signed numbers:</p>
<ul>
<li>two's complement;... | 12,277,974 | 2 | 6 | null | 2012-09-05 07:58:52.633 UTC | 14 | 2016-11-10 08:56:24.593 UTC | 2017-05-23 12:09:57.707 UTC | null | -1 | null | 14,860 | null | 1 | 48 | c|language-lawyer|iso|negative-number|representation | 5,157 | <p>The most recent example I can find is the <a href="http://en.wikipedia.org/wiki/UNIVAC_1100/2200_series#UNISYS_2200_series" rel="noreferrer">UNISYS 2200</a> series, based on UNIVAC, with ones-complement arithmetic. The various models were produced between 1986 and 1997 but the OS was still in active development <a h... |
19,058,530 | change format from wav to mp3 in memory stream in NAudio | <p>Hi there iam trying to convert text to speech (wav) in the memorystream convert it to mp3 and then play it on the users page.so need i help what to do next? </p>
<p>here is my asmx code :</p>
<pre><code>[WebMethod]
public byte[] StartSpeak(string Word)
{
MemoryStream ms = new MemoryStream();
using (Syst... | 19,110,254 | 6 | 3 | null | 2013-09-27 19:21:10.463 UTC | 11 | 2021-06-01 06:59:39.54 UTC | null | null | null | null | 2,431,114 | null | 1 | 14 | c#|asp.net|audio|naudio | 33,780 | <p>You need an MP3 compressor library. I use Lame via the Yeti Lame wrapper. You can find code and a sample project <a href="http://www.codeproject.com/Articles/5901/C-MP3-Compressor" rel="nofollow noreferrer">here</a>.</p>
<p>Steps to get this working:</p>
<ol>
<li><p>Copy the following files from <code>MP3Compresso... |
24,001,410 | PHP: json_decode not working | <p>This does <strong>not</strong> work:</p>
<pre><code>$jsonDecode = json_decode($jsonData, TRUE);
</code></pre>
<p>However if I copy the string from <code>$jsonData</code> and put it inside the decode function manually it does work. </p>
<p>This <strong>works</strong>:</p>
<pre><code>$jsonDecode = json_decode('{"i... | 24,001,627 | 17 | 7 | null | 2014-06-02 18:57:52.943 UTC | 3 | 2022-09-19 13:40:10.697 UTC | 2014-06-02 19:20:18.207 UTC | null | 3,630,453 | null | 3,630,453 | null | 1 | 30 | php|json | 89,751 | <p>Most likely you need to strip off the padding from your decrypted data. There are 124 visible characters in your string but <code>var_dump</code> reports 144. Which means 20 characters of padding needs to be removed (a series of "\0" bytes at the end of your string).</p>
<p>Probably that's 4 "\0" bytes at the end ... |
3,594,143 | Dynamically set a hyperlink control's NavigateUrl property inline | <p>How can I dynamically set a stand alone(not in gridview) hyperlink control's NavigateUrl property inline in the aspx page?</p>
<p>I have tried to do the following, but it did not work.</p>
<pre><code><asp:HyperLink id="MyLink"
NavigateUrl="../mypage.aspx?id=<%= pageid %>"
runat="server">My Page<... | 3,594,162 | 3 | 0 | null | 2010-08-29 08:51:54.467 UTC | 3 | 2018-06-25 07:23:16.983 UTC | 2018-06-25 07:23:16.983 UTC | null | 584,518 | null | 32,892 | null | 1 | 15 | asp.net|.net|hyperlink|webforms | 80,544 | <p>You could do this in the codebehind:</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string pageid = "123";
MyLink.NavigateUrl = string.Format("../mypage.aspx?id={0}", pageid);
}
}
</code></pre>
<hr>
<p>UPDATE:</p>
<p>Now that @Marko Ivanovski ... |
3,935,900 | How to commit and rollback transaction in sql server? | <p>I have a huge script for creating tables and porting data from one server. So this sceipt basically has - </p>
<ol>
<li>Create statements for tables.</li>
<li>Insert for porting the data to these newly created tables.</li>
<li>Create statements for stored procedures. </li>
</ol>
<p>So I have this code but it does ... | 3,937,541 | 3 | 0 | null | 2010-10-14 17:36:10.387 UTC | 9 | 2014-10-15 17:10:26.57 UTC | 2010-10-14 17:54:01.263 UTC | null | 316,959 | null | 316,959 | null | 1 | 15 | sql-server-2008|transactions | 148,296 | <p>Don't use <code>@@ERROR</code>, use <code>BEGIN TRY/BEGIN CATCH</code> instead. See this article: <a href="http://rusanu.com/2009/06/11/exception-handling-and-nested-transactions/" rel="noreferrer">Exception handling and nested transactions</a> for a sample procedure:</p>
<pre><code>create procedure [usp_my_procedu... |
20,877,813 | Auto refresh images in HTML | <p>I am using following code</p>
<pre><code><html>
<script>
var newImage = new Image();
function updateImage() {
if(newImage.complete) {
newImage.src = document.getElementById("img").src;
var temp = newImage.src;
document.getElementById("img").src = newImage.src;
... | 20,877,972 | 4 | 5 | null | 2014-01-02 06:53:28.037 UTC | 9 | 2021-12-12 01:18:04.233 UTC | 2014-01-02 07:00:26.857 UTC | null | 2,919,232 | null | 2,919,232 | null | 1 | 13 | javascript|html | 70,659 | <p>try this</p>
<pre><code>function refresh(node)
{
var times = 3000; // gap in Milli Seconds;
(function startRefresh()
{
var address;
if(node.src.indexOf('?')>-1)
address = node.src.split('?')[0];
else
address = node.src;
node.src = address+"?time="+new Date().getTi... |
11,184,169 | Nested if else in Crystal Reports | <p>I want to nest if-else statements in Crystal Reports, but I don't know the necessary syntax. How can I arrange something like this:</p>
<pre><code>if table1.id <> "1" then
if table1.name <> "a" then
var1 := "Hello"
else
var1 := "Hi"
else
var1 := "Bye"
</code></pre> | 11,184,448 | 2 | 0 | null | 2012-06-25 06:06:31.377 UTC | 1 | 2022-03-24 00:31:52.927 UTC | 2015-09-25 17:15:42.023 UTC | null | 1,464,444 | null | 1,369,235 | null | 1 | 14 | syntax|if-statement|crystal-reports | 62,273 | <p>You can use parenthesises to avoid ambiguity within nested <code>if..else</code> structures:</p>
<pre><code>if {table1.id} <> 1 then
(if {table1.name} <> "a" then
var1 := "Hello"
else
var1 := "Hi";)
else
var1 := "Bye";
</code></pre> |
10,928,387 | Check file extension in Java | <p>I have to import data from an Excel file to database and to do this, I would like to check the extension of the chosen file.</p>
<p>This is my code:</p>
<pre><code>String filename = file.getName();
String extension = filename.substring(filename.lastIndexOf(".") + 1, filename.length());
String excel = "xls";
if (e... | 10,928,411 | 8 | 4 | null | 2012-06-07 08:37:29.577 UTC | 4 | 2017-01-19 14:10:20.32 UTC | 2016-04-18 12:08:01.11 UTC | null | 183,704 | null | 1,441,689 | null | 1 | 28 | java|string|if-statement | 54,136 | <p>following</p>
<pre><code>extension != excel
</code></pre>
<p>should be</p>
<pre><code>!excel.equals(extension)
</code></pre>
<p>or </p>
<pre><code>!excel.equalsIgnoreCase(extension)
</code></pre>
<hr>
<p><strong>See also</strong></p>
<ul>
<li><a href="https://stackoverflow.com/questions/767372/java-string-eq... |
48,116,753 | How to use Kotlin to find whether a string is numeric? | <p>I'd like to use a <code>when()</code> expression in Kotlin to return different values from a function. The input is a <code>String</code>, but it might be parsable to an <code>Int</code>, so I'd like to return the parsed <code>Int</code> if possible, or a <code>String</code> if it is not. Since the input is a <code>... | 48,116,988 | 7 | 9 | null | 2018-01-05 15:36:49.847 UTC | 5 | 2022-09-16 19:14:58.563 UTC | 2022-09-16 19:14:58.563 UTC | null | 2,756,409 | null | 1,041,282 | null | 1 | 47 | kotlin|types | 44,023 | <p><strong>Version 1 (using <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-int-or-null.html" rel="noreferrer"><code>toIntOrNull</code></a> and <code>when</code> when as requested)</strong></p>
<pre><code>fun String.intOrString(): Any {
val v = toIntOrNull()
return when(v) {
null -... |
12,862,637 | Perfect square or not? | <p>This is a code to check if a number is perfect square or not. Why does it work ?</p>
<pre><code>static bool IsSquare(int n)
{
int i = 1;
for (; ; )
{
if (n < 0)
return false;
if (n == 0)
return true;
n -= i;
i += 2;
}
}
</code></pre> | 12,862,677 | 1 | 0 | null | 2012-10-12 15:43:37.283 UTC | 15 | 2018-10-11 08:07:43.457 UTC | 2018-10-11 08:07:43.457 UTC | null | 1,033,581 | null | 1,170,733 | null | 1 | 12 | algorithm|perfect-square | 10,159 | <p>Because all perfect squares are sums of consecutive odd numbers:</p>
<ul>
<li>1 = 1</li>
<li>4 = 1 + 3</li>
<li>9 = 1 + 3 + 5</li>
<li>16 = 1 + 3 + 5 + 7</li>
</ul>
<p>and so on. Your program attempts to subtract consecutive odd numbers from <code>n</code>, and see if it drops to zero or goes negative.</p>
<p>You... |
13,023,405 | What is the difference between: Handle, Pointer and Reference | <p>How does a handle differ from a pointer to an object and also why can't we have a reference to a reference?</p> | 13,023,487 | 4 | 4 | null | 2012-10-23 04:03:38.83 UTC | 20 | 2012-10-23 04:16:38.327 UTC | null | null | null | null | 854,183 | null | 1 | 30 | c++|oop|pointers|reference|handle | 28,739 | <p>A handle is usually an <em>opaque</em> reference to an object. The type of the handle is unrelated to the element referenced. Consider for example a file descriptor returned by <code>open()</code> system call. The type is <code>int</code> but it represents an entry in the open files table. The actual data stored in ... |
12,810,346 | Alternative to using LIMIT keyword in a SubQuery in MYSQL | <p>I have a table TEST with the following columns : </p>
<pre><code>code_ver (VARCHAR)
suite (VARCHAR)
date (DATE)
</code></pre>
<p>Now I want to select 10 rows with a distinct value of c<code>ode_ver & code_ver NOT LIKE '%DevBld%' sorted by date desc.</code></p>
<p>So I wrote the following query:</p>
<pre><cod... | 12,811,825 | 6 | 1 | null | 2012-10-10 00:34:51.683 UTC | 4 | 2022-07-18 08:34:06.25 UTC | 2018-03-28 07:12:15.44 UTC | null | 3,876,565 | null | 1,450,521 | null | 1 | 36 | mysql|sql|database | 73,789 | <p>The error you are getting is not exactly because of the version of MySQL. I think all versions support that. You have to change the LIMIT 10 place and place it after ")". Let me know if it works for you. I ran the bellow one on mine and it works.</p>
<p>E.g.</p>
<pre><code>SELECT * FROM test where name IN (
... |
13,054,797 | How to prevent a webkit-scrollbar from pushing over the contents of a div? | <p>I'm using webkit-scrollbar and am running into styling issues as the webkit scrollbar is pushing the contents of a div to the left which causes the contents to overflow.</p>
<p>Notice</p>
<ul>
<li>1st box uses the default browser scrollbar and does not overflow (good)</li>
<li>2nd box uses the webkit scrollbar whi... | 13,470,337 | 4 | 1 | null | 2012-10-24 17:46:02.12 UTC | 4 | 2021-02-01 17:42:16.68 UTC | null | null | null | null | 149,080 | null | 1 | 36 | html|css|webkit | 38,258 | <p>Hm.. I can't think of a way to get the webkit scrollbar in overlay. One solution to stop the line breaking is to hide the scrollbar with </p>
<pre><code>.box2::-webkit-scrollbar {
height: 16px;
overflow: visible;
width: 16px;
display: none;
}
</code></pre>
<p>other you can set the width of your UL to the s... |
12,654,013 | How to make g++ search for header files in a specific directory? | <p>I have a project (a library) that is subdivided into a few directories with code in them. I'd like to to have g++ search for header files in the project's root directory, so I can avoid different include paths for same header files across multiple source files.</p>
<p>Mainly, the <code>root/</code> directory has su... | 12,654,056 | 4 | 1 | null | 2012-09-29 15:29:56.227 UTC | 26 | 2022-06-17 04:10:21.743 UTC | 2018-03-14 10:07:40.967 UTC | null | 719,263 | null | 924,313 | null | 1 | 56 | directory|g++|header-files|include-path | 151,469 | <p>A/code.cpp</p>
<pre><code>#include <B/file.hpp>
</code></pre>
<p>A/a/code2.cpp</p>
<pre><code>#include <B/file.hpp>
</code></pre>
<p>Compile using:</p>
<pre><code>g++ -I /your/source/root /your/source/root/A/code.cpp
g++ -I /your/source/root /your/source/root/A/a/code2.cpp
</code></pre>
<p>Edit:</p... |
13,219,634 | Easiest way to check for an index or a key in an array? | <p>Using:</p>
<pre><code>set -o nounset
</code></pre>
<ol>
<li><p>Having an indexed array like:</p>
<pre><code>myArray=( "red" "black" "blue" )
</code></pre>
<p>What is the shortest way to check if element 1 is set?<br>
I sometimes use the following:</p>
<pre><code>test "${#myArray[@]... | 13,221,491 | 11 | 0 | null | 2012-11-04 14:57:04.413 UTC | 31 | 2022-09-02 00:10:01.897 UTC | 2020-08-29 18:59:10 UTC | null | 4,518,341 | null | 1,032,370 | null | 1 | 112 | arrays|bash|indexing|key | 108,484 | <p>To check if the element is set (applies to both indexed and associative array)</p>
<pre><code>[ "${array[key]+abc}" ] && echo "exists"
</code></pre>
<p>Basically what <code>${array[key]+abc}</code> does is</p>
<ul>
<li>if <code>array[key]</code> is set, return <code>abc</code></li>
<li>if... |
12,686,927 | How to assert a type of an HTMLElement in TypeScript? | <p>I'm trying to do this:</p>
<pre><code>var script:HTMLScriptElement = document.getElementsByName("script")[0];
alert(script.type);
</code></pre>
<p>but it's giving me an error:</p>
<pre><code>Cannot convert 'Node' to 'HTMLScriptElement': Type 'Node' is missing property 'defer' from type 'HTMLScriptElement'
... | 12,687,137 | 14 | 2 | null | 2012-10-02 08:33:05.02 UTC | 34 | 2021-05-15 23:42:06.907 UTC | 2021-05-15 22:45:26.703 UTC | null | 11,407,695 | null | 204,555 | null | 1 | 226 | typescript|type-assertion|typescript-types|typescript-lib-dom | 240,023 | <p>TypeScript uses '<>' to surround casts, so the above becomes:</p>
<pre><code>var script = <HTMLScriptElement>document.getElementsByName("script")[0];
</code></pre>
<p>However, unfortunately you cannot do:</p>
<pre><code>var script = (<HTMLScriptElement[]>document.getElementsByName(id))[0];
</code><... |
17,128,904 | Styling Twitter's Bootstrap 3.x Buttons | <p><a href="http://www.getbootstrap.com/" rel="nofollow noreferrer">Twitter's Bootstrap 3</a> buttons are limited in colors. By default there will be <strike>5</strike> 7 colors (default primary, error, warning, info, success and link) See:</p>
<p><img src="https://i.stack.imgur.com/5099C.png" alt="enter image descrip... | 17,128,905 | 6 | 0 | null | 2013-06-15 23:35:01.413 UTC | 17 | 2015-03-23 12:06:06.75 UTC | 2017-05-23 12:02:05.063 UTC | null | -1 | null | 1,596,547 | null | 1 | 37 | css|twitter-bootstrap|less|twitter-bootstrap-3 | 66,995 | <p>Add extra colors to your less files and recompile. Also see <a href="https://stackoverflow.com/questions/10451317/twitter-bootstrap-customization-best-practices">Twitter Bootstrap Customization Best Practices</a>.
<strong>update</strong></p>
<p>As mentioned by @ow3n since v3.0.3 use:</p>
<pre><code>.btn-custom {
... |
17,060,039 | Split string at nth occurrence of a given character | <p>Is there a Python-way to split a string after the nth occurrence of a given delimiter?</p>
<p>Given a string:</p>
<pre><code>'20_231_myString_234'
</code></pre>
<p>It should be split into (with the delimiter being '_', after its second occurrence):</p>
<pre><code>['20_231', 'myString_234']
</code></pre>
<p>Or i... | 17,060,409 | 8 | 2 | null | 2013-06-12 07:36:01.2 UTC | 10 | 2021-08-26 07:32:01.847 UTC | 2013-06-12 07:47:40.727 UTC | null | 1,219,006 | null | 1,183,106 | null | 1 | 52 | python|string|split | 53,715 | <pre><code>>>> n = 2
>>> groups = text.split('_')
>>> '_'.join(groups[:n]), '_'.join(groups[n:])
('20_231', 'myString_234')
</code></pre>
<p>Seems like this is the most readable way, the alternative is regex)</p> |
17,089,250 | Difference com.sun.jersey and org.glassfish.jersey | <p>What is the difference between <code>com.sun.jersey</code> and <code>org.glassfish.jersey</code>?</p>
<p>Currently I have my REST service working on <code>com.sun.jersey</code> and I want to write tests, but I can't find a good tutorial for this (nothing seems to work). However, I can find good documentation about ... | 17,089,685 | 1 | 0 | null | 2013-06-13 14:09:39.15 UTC | 19 | 2015-09-23 09:37:22.5 UTC | 2015-09-23 09:37:22.5 UTC | null | 1,487,809 | null | 1,226,868 | null | 1 | 85 | java|glassfish|jersey|sun | 29,374 | <p>The only difference between com.sun.jersey and org.glassfish.jersey is that the package name was changed because Jersey team is now part of another organization (Glassfish).
Versions below 2 use package com.sun.jersey, versions above 2 use org.glassfish.jersey.
And yes, there are some differences between 1.x and 2.x... |
50,681,027 | Do Spring prototype beans need to be destroyed manually? | <p>I noticed that the <code>@PreDestroy</code> hooks of my prototype scoped Spring beans were not getting executed.</p>
<p>I have since read <a href="https://docs.spring.io/spring/docs/4.3.9.RELEASE/spring-framework-reference/html/beans.html#beans-factory-scopes-prototype" rel="noreferrer">here</a> that this is actual... | 50,686,240 | 2 | 6 | null | 2018-06-04 12:48:25.853 UTC | 11 | 2018-08-01 17:26:45.557 UTC | 2018-06-07 14:08:05.35 UTC | null | 5,618,307 | null | 5,618,307 | null | 1 | 33 | java|spring|garbage-collection|spring-bean|predestroy | 17,782 | <p>For the benefit of others, I will present below what I have gathered from my investigations:</p>
<p>As long as the prototype bean does not itself hold a reference to another resource such as a database connection or a session object, it will get garbage collected as soon as all references to the object have been re... |
10,016,475 | Create NSScrollView Programmatically in an NSView - Cocoa | <p>I have an NSView class which takes care of a Custom View created in the nib file. </p>
<p>Now I want to add an NSScrollView to the custom view, but I need to do it programmatically and not using Interface Builder (Embed Into Scroll View).</p>
<p>I have found this code:</p>
<pre><code>NSView *windowContentView = [... | 10,023,346 | 4 | 2 | null | 2012-04-04 17:42:20.987 UTC | 9 | 2021-11-27 12:26:40.637 UTC | 2019-01-21 11:54:11.673 UTC | null | 1,033,581 | null | 1,214,040 | null | 1 | 12 | objective-c|cocoa|nsscrollview | 11,006 | <p>This code fragment should demonstrate how to create an NSScrollView programmatically and use it to display any view, whether from a nib or from code. In the case of a nib generated view, you simply need to load the nib file to your custom view prior, and have an outlet to your custom view (outletToCustomViewLoadedF... |
9,781,214 | Parse output of spawned node.js child process line by line | <p>I have a PhantomJS/CasperJS script which I'm running from within a node.js script using <code>process.spawn()</code>. Since CasperJS doesn't support <code>require()</code>ing modules, I'm trying to print commands from CasperJS to <code>stdout</code> and then read them in from my node.js script using <code>spawn.stdo... | 9,781,295 | 7 | 1 | null | 2012-03-20 04:06:49.377 UTC | 15 | 2022-05-03 19:07:00.05 UTC | 2012-12-26 01:41:31.873 UTC | null | 527,702 | null | 1,150,652 | null | 1 | 23 | node.js|phantomjs | 27,116 | <p>Try this:</p>
<pre class="lang-javascript prettyprint-override"><code>cspr.stdout.setEncoding('utf8');
cspr.stdout.on('data', function(data) {
var str = data.toString(), lines = str.split(/(\r?\n)/g);
for (var i=0; i<lines.length; i++) {
// Process the line, noting it might be incomplete.
}
});
</code>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.