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
17,492,167
Group query results by month and year in postgresql
<p>I have the following database table on a Postgres server: </p> <pre><code>id date Product Sales 1245 01/04/2013 Toys 1000 1245 01/04/2013 Toys 2000 1231 01/02/2013 Bicycle 50000 456461 01/01/2014 Bananas 4546 </code></pre> <p>I would like to create a query that gives ...
17,492,310
7
0
null
2013-07-05 15:18:24.213 UTC
50
2021-09-24 05:59:09.193 UTC
2013-07-05 20:17:43.46 UTC
null
2,019,415
null
2,554,248
null
1
221
sql|postgresql
203,144
<pre><code>select to_char(date,'Mon') as mon, extract(year from date) as yyyy, sum("Sales") as "Sales" from yourtable group by 1,2 </code></pre> <p>At the request of Radu, I will explain that query:</p> <p><code>to_char(date,'Mon') as mon,</code> : converts the "date" attribute into the defined format o...
26,028,700
Write to Client UDP Socket in Go
<p>I'm looking for a good solution for a client/server communication with UDP sockets in Go language.</p> <p>The examples I found on the Internet show me how to send data to the server, but they do not teach how to send them back to the client.</p> <p>To demonstrate, my program does the following:</p> <p>My client p...
26,032,240
3
3
null
2014-09-25 00:39:18.14 UTC
7
2022-01-06 03:06:56.8 UTC
2014-09-25 02:07:04.157 UTC
null
4,017,302
null
3,381,662
null
1
22
sockets|go|udp|gob
50,357
<p>Check the below samples for client/server communication over UDP. The sendResponse routine is for sending response back to client.</p> <p><strong>udpclient.go</strong></p> <pre><code>package main import ( &quot;fmt&quot; &quot;net&quot; &quot;bufio&quot; ) func main() { p := make([]byte, 2048) ...
23,300,953
When debugging in device with ART enabled, android app is slow
<p>i dont know why but a week ago when i am debugging my app in android studio, the app in device is very slow, but if a generate the APK or use the play (Not debug) option works fine..</p> <p>Anyone have idea why? I think i didnt any change in sdk or in the app to do it this..</p>
23,301,174
1
9
null
2014-04-25 18:57:04.19 UTC
5
2014-10-16 11:30:32.467 UTC
2014-06-03 18:29:23.197 UTC
null
168,868
null
988,283
null
1
28
android|debugging|art-runtime
8,872
<p>When ART is enabled, the device cannot ensure the compiled code matches the bytecode instructions. It therefore cannot step through instructions and therefore lines.</p> <p>This forces the device to fallback to a very slow interpreter, which possibly doesn't even JIT-compile.</p> <p>For faster debugging, switch ba...
4,980,348
When SVN fails to merge and Mercurial succeeds
<p>Before it comes up, I've already looked at several threads on this topic, including these:</p> <ul> <li><p><a href="https://stackoverflow.com/questions/2475831/merging-hg-git-vs-svn/2486662#2486662">Merging: Hg/Git vs. SVN</a></p></li> <li><p><a href="https://stackoverflow.com/questions/4592740/mercurial-compared-t...
4,981,277
3
5
null
2011-02-12 20:11:03.36 UTC
9
2012-03-06 21:07:37.197 UTC
2017-05-23 11:44:22.297 UTC
null
-1
null
614,513
null
1
19
svn|mercurial|merge|branching-and-merging
1,200
<p>As far as I know, anyone who says Mercurial tracks moving code around in less than file-sized chunks is just wrong. It <em>does</em> track file renames independently from code changes, so if Dave renames a file and Helen changes something in the file, it can automerge that, but as far as I know, Subversion can do t...
5,197,035
"Gift App" from inside the app
<p>I noticed that on the latest angry birds update they added a feature to gift your app from inside the app.</p> <p>Up till now I knew you can gift paid apps from the iTunes itself. Does anybody know what link should I use to access this mechanism from inside the app itself?</p> <p>Thanks!</p>
5,199,511
3
1
null
2011-03-04 17:19:07.39 UTC
32
2015-11-26 10:35:12.25 UTC
2015-11-26 10:35:12.25 UTC
null
1,505,120
null
172,637
null
1
49
ios|objective-c|iphone|ipad
9,630
<p>If you watch what happens when you click that button, you can see that it initially makes a request to a redirect script on www.angrybirds.com:</p> <p><a href="http://www.angrybirds.com/redirect.php?device=iphone&amp;product=angrybirds&amp;type=purchasegift" rel="noreferrer">http://www.angrybirds.com/redirect.php?d...
4,977,252
Why an unnamed namespace is a "superior" alternative to static?
<p>The section $7.3.1.1/2 from the C++ Standard reads:</p> <blockquote> <p>The use of the static keyword is deprecated when declaring objects in a namespace scope; the unnamed-namespace provides <strong>a superior alternative.</strong></p> </blockquote> <p>I don't understand why an unnamed namespace is consid...
4,977,525
3
11
null
2011-02-12 09:04:17.867 UTC
60
2017-04-30 14:31:35.413 UTC
2017-05-23 11:46:49.27 UTC
null
-1
null
415,784
null
1
110
c++|namespaces|standards|iso
41,735
<ul> <li>As you've mentioned, namespace works for anything, not just for functions and objects.</li> <li>As Greg has pointed out, <code>static</code> means too many things already.</li> <li>Namespaces provide a uniform and consistent way of controlling visibility at the global scope. You don't have to use different too...
5,135,900
Stack around the variable ' ' was corrupted
<pre><code>void GameBoard::enterShips() { char location[1]; int ships = 0; int count = 1; while(ships &lt; NUM_SHIPS) { cout &lt;&lt; "Enter a location for Ship " &lt;&lt; count &lt;&lt; ": "; cin &gt;&gt; location; cout &lt;&lt; endl; Grid[location[0]][location[1]]...
5,135,934
4
1
null
2011-02-27 20:57:48.167 UTC
1
2011-02-28 06:58:26.24 UTC
2011-02-27 20:58:55.783 UTC
null
36,384
null
636,824
null
1
8
c++
70,421
<p>You are prompting the memory address of <code>location</code> array to your user. You should ask location indices separately:</p> <pre><code>void GameBoard::enterShips() { int location[2]; int ships = 0; int count = 1; while(ships &lt; NUM_SHIPS) { cout &lt;&lt; "Enter a location for Sh...
18,746,569
Force div element to stay in same place, when page is scrolled
<p>I created a <code>div</code> element, that I placed all the way on the right of my site. The only problem is that its at the top of the site, so if i scroll down it remains there.</p> <p>How can I force it to remain in the same part of the page, when page is being scrolled?</p> <p>This is, what I've managed to fig...
18,746,597
5
3
null
2013-09-11 16:30:22.943 UTC
11
2021-03-23 07:51:55.37 UTC
2015-01-20 21:02:30.063 UTC
null
1,469,208
null
330,396
null
1
41
css|html
135,844
<p>Change <code>position:absolute</code> to <code>position:fixed;</code>.</p> <p>Example can be found <a href="http://jsfiddle.net/HE5SF/2/" rel="noreferrer">in this jsFiddle</a>.</p>
18,390,266
How can we truncate float64 type to a particular precision?
<pre><code>package main import ( "fmt" "strconv" ) func main() { k := 10/3.0 i := fmt.Sprintf("%.2f", k) f,_ := strconv.ParseFloat(i, 2) fmt.Println(f) } </code></pre> <p>I had to write the program above to decrease the precision of a go float64 variable to 2. In this case I was using bo...
18,418,551
12
6
null
2013-08-22 20:29:57.793 UTC
10
2022-03-04 13:26:30.433 UTC
2020-02-26 15:53:13.203 UTC
null
13,860
null
1,089,354
null
1
74
floating-point|go
113,681
<p>You don't need any extra code ... its as simple as </p> <pre><code>import ( "fmt" ) func main() { k := 10 / 3.0 fmt.Printf("%.2f", k) } </code></pre> <p><a href="http://play.golang.org/p/Ek0if-tlvX" rel="noreferrer">Test Code</a> </p>
15,280,722
Android Camera Capture using FFmpeg
<p>Am tryin' to take the preview frame generated by the android camera and pass the <code>data[]</code> to ffmpeg input pipe to generate a flv video. The command that I used was : </p> <pre><code>ffmpeg -f image2pipe -i pipe: -f flv -vcodec libx264 out.flv </code></pre> <p>I've also tried to force the input format to...
15,290,723
1
2
null
2013-03-07 20:07:24.99 UTC
8
2013-03-08 11:15:13.94 UTC
null
null
null
null
1,712,427
null
1
9
android|ffmpeg|android-camera
10,383
<p>Kinda got it working perfectly... The mistake that seemed to be happenin' was related to the <code>vcodec</code> of the image stream. Seems that ffmpeg has no provision to decode <code>NV21</code> format images or image stream. For that had to convert the <code>NV21</code> format preview frame to <code>JPEG</code> a...
14,962,459
HTML divs, how to wrap content?
<p>I have 3 div's like on this image: </p> <p><img src="https://i.stack.imgur.com/uPxjk.png" alt="enter image description here"></p> <p>div1 has fixed width but variable height, so what I would like is that if div1 height is bigger that the div2 height, the div3 stays under div2 and on the right of the div1, like her...
14,963,002
10
3
null
2013-02-19 16:28:21.947 UTC
9
2016-04-12 15:12:16.29 UTC
2014-04-08 14:22:53.903 UTC
null
340,390
null
1,018,270
null
1
15
html|css
99,009
<p>As CSS doesn't provide anything for that job yet, you will have to use Javascript.</p> <p>I would firstly create a page like on your first picture. Then I would use</p> <pre><code>$("#div").height() </code></pre> <p>, which returns the height of your div and compare this to your second div's height:</p> <pre><co...
43,479,464
How to Import a Single Lodash Function?
<p>Using webpack, I'm trying to import <a href="https://lodash.com/docs/4.17.4#isEqual" rel="noreferrer">isEqual</a> since <code>lodash</code> seems to be importing everything. I've tried doing the following with no success:</p> <pre><code>import { isEqual } from 'lodash' import isEqual from 'lodash/lang' import isE...
43,479,515
10
3
null
2017-04-18 18:16:43.16 UTC
31
2022-02-12 15:57:13.48 UTC
2019-01-15 08:24:38.763 UTC
null
1,253,156
null
4,852,449
null
1
190
javascript|lodash
125,380
<p>You can install <code>lodash.isequal</code> as a single module without installing the whole <em>lodash</em> package like so:</p> <pre><code>npm install --save lodash.isequal </code></pre> <p>When using ECMAScript 5 and CommonJS modules, you then import it like this:</p> <pre><code>var isEqual = require('lodash.is...
7,974,102
Is it possible to pass-through parameter values in Moq?
<p>I need to mock <code>HttpResponseBase.ApplyAppPathModifier</code> in such a way that the parameter <code>ApplyAppPathModifier</code> is called with is automatically returned by the mock.</p> <p>I have the following code:</p> <pre><code>var httpResponseBase = new Mock&lt;HttpResponseBase&gt;(); httpResponseBase.Set...
7,974,112
2
2
null
2011-11-01 23:19:59.207 UTC
4
2011-11-01 23:32:13.683 UTC
2011-11-01 23:32:13.683 UTC
null
169
null
169
null
1
31
c#|testing|mocking|moq
12,030
<p>Use <code>It</code>:</p> <pre><code>It.Is&lt;MyClass&gt;(mc=&gt;mc == myValue) </code></pre> <p>Here you can check the expectation: the value you expect to receive. In terms of return, just return value you need.</p> <pre><code>var tempS = string.Empty; var httpResponseBase = new Mock&lt;HttpResponseBase&gt;(); h...
8,122,592
Which book(s) to learn sockets programming and TCP network communication?
<p>I will do a few small projects over the next few months and need some books (preferably) or URLs to learn some basic concepts.</p> <p>In general one PC or embedded device (which varies by project) collects some user input or data from an external hardware device and transmits it to a remote PC which will enter it i...
8,122,888
2
2
null
2011-11-14 13:53:44.263 UTC
29
2011-11-14 20:35:48.307 UTC
null
null
null
null
192,910
null
1
36
sockets|tcp|network-programming|scada
35,158
<p>This is <em>the</em> book to learn TCP/IP, doesn't matter what language you will be using:</p> <p><a href="http://www.kohala.com/start/tcpipiv1.html" rel="noreferrer"><strong>W. Richard Stevens, TCP/IP Illustrated, Volume 1: The Protocols</strong></a></p> <p>The following is the C network programmer's bible, highl...
14,536,139
How to input a string in a 2d array in C?
<p>If i want to take an input in a 2d array with each string in one row, and the next in the other(i.e. change the row on pressing enter). How can i do that in C. C doesnt seem to have convenient "String" Handling. I obviously mean doing so without the use of getchar().</p>
14,536,859
3
1
null
2013-01-26 10:40:15.42 UTC
3
2013-01-27 06:09:47.813 UTC
null
null
null
null
1,803,855
null
1
2
c|string|multidimensional-array
67,676
<pre><code>#include&lt;stdio.h&gt; main() { char student_name[5][25]; int i; for(i=0;i&lt;5;i++) { printf("\nEnter a string %d: ",i+1); scanf(" %[^\n]",student_name[i]); } } </code></pre> <p>u can read strings using 2d array without using getchar() by putting space in scanf(" %[^\n]...
8,797,597
Timezone Strategy
<p>I am building a MVC 3 application where the users may not be in the same time zone, so my intent was to store everything in UTC and convert from UTC to local time in the views and localtime to UTC on submissions.</p> <p>Doing some browsing though there doesn't seem to be a lot of good solutions to this. To be hones...
8,860,537
4
5
null
2012-01-10 01:41:42.66 UTC
12
2012-01-14 18:05:52.447 UTC
2012-01-14 18:05:52.447 UTC
null
474,904
null
474,904
null
1
22
c#|javascript|asp.net-mvc-3|timezone|utc
5,919
<p>You could handle the problem of converting UTC to user local time by using website-wide DisplayTemplate for DateTime. </p> <p>From your Views you would use @Html.DisplayFor(n => n.MyDateTimeProperty)</p> <p>The second problem is tougher to tackle. To convert from user local time to UTC you could override the <str...
5,410,745
How can I get a list of the items stored in html 5 local storage from javascript?
<p>How can I get a list of the items stored in html 5 local storage from javascript?</p>
5,410,827
6
0
null
2011-03-23 19:44:31.183 UTC
15
2021-01-05 19:38:55.663 UTC
2011-03-23 19:54:54.463 UTC
null
476,945
null
243,494
null
1
50
javascript|html
66,176
<p>From <a href="http://diveintohtml5.info/storage.html" rel="noreferrer">HTML5 reference</a>: </p> <blockquote> <p>Like other JavaScript objects, you can treat the localStorage object as an associative array. Instead of using the getItem() and setItem() methods, you can simply use square brackets.</p> </b...
5,158,790
Should I use a data.frame or a matrix?
<p>When should one use a <code>data.frame</code>, and when is it better to use a <code>matrix</code>?</p> <p>Both keep data in a rectangular format, so sometimes it's unclear.</p> <p>Are there any general rules of thumb for when to use which data type?</p>
5,159,049
6
1
null
2011-03-01 18:36:16.523 UTC
61
2018-10-25 06:39:46.707 UTC
2016-03-23 14:21:54.937 UTC
null
3,576,984
null
639,884
null
1
161
r|matrix|dataframe|r-faq
94,818
<p>Part of the answer is contained already in your question: You use data frames if columns (variables) can be expected to be of different types (numeric/character/logical etc.). Matrices are for data of the same type. </p> <p>Consequently, the choice matrix/data.frame is only problematic if you have data of the same ...
5,379,794
is Java HashSet thread-safe for read only?
<p>If I have an instance of an HashSet after I ran it through Collections.unmodifiableSet(), is it thread-safe?</p> <p>I'm asking this since Set documentation states that it's not, but I'm only performing read operations.</p>
5,379,832
7
1
null
2011-03-21 15:25:21.46 UTC
8
2014-02-19 01:13:12.99 UTC
null
null
null
null
109,318
null
1
33
java|concurrency|hashset
38,721
<p>From the Javadoc:</p> <blockquote> <p>Note that this implementation is not synchronized. If multiple threads access a hash set concurrently, and at least one of the threads modifies the set, it must be synchronized externally</p> </blockquote> <p>Reading doesn't modify a set, therefore you're fine.</p>
4,857,855
Extending Devise SessionsController to authenticate using JSON
<p>I am trying to build a rails API for an iphone app. Devise works fine for logins through the web interface but I need to be able to create and destroy sessions using REST API and I want to use JSON instead of having to do a POST on the sessions controller and having to parse the HTML and deal with a redirect.</p> <...
4,975,442
7
1
null
2011-02-01 00:59:38.623 UTC
49
2014-06-08 21:51:02.353 UTC
2011-07-31 16:21:52.47 UTC
null
38,795
null
576,108
null
1
48
ruby-on-rails|ruby|authentication|devise
31,140
<p>This is what finally worked.</p> <pre><code>class Api::V1::SessionsController &lt; Devise::SessionsController def create respond_to do |format| format.html { super } format.json { warden.authenticate!(:scope =&gt; resource_name, :recall =&gt; "#{controller_path}#new") r...
4,973,000
Adding sub-directory to "View/Shared" folder in ASP.Net MVC and calling the view
<p>I'm currently developing a site using ASP.Net MVC3 with Razor. Inside the "View/Shared" folder, I want to add a subfolder called "Partials" where I can place all of my partial views (for the sake of organizing the site better.</p> <p>I can do this without a problem as long as I always reference the "Partials" folde...
4,996,869
7
0
null
2011-02-11 19:07:32.15 UTC
18
2017-04-18 13:36:51.753 UTC
null
null
null
null
613,536
null
1
51
asp.net|asp.net-mvc|asp.net-mvc-2|asp.net-mvc-3|razor
44,250
<p>Solved this. To add the "Shared/Partials" sub directory I created to the list of locations searched when trying to locate a Partial View in Razor using:</p> <pre><code>@Html.Partial("{NameOfView}") </code></pre> <p>First create a view engine with RazorViewEngine as its base class and add your view locations as fol...
5,025,941
Is there a way to get a <button> element to link to a location without wrapping it in an <a href ... tag?
<p>Just wondering if there is a way to get a HTML <code>&lt;button&gt;</code> element to link to a location without wrapping it in an <code>&lt;a href...</code> tag?</p> <p>Button currently looks like:</p> <pre><code>&lt;button&gt;Visit Page Now&lt;/button&gt; </code></pre> <p>What I would prefer <strong>not</strong...
5,025,990
9
4
null
2011-02-17 06:57:10.76 UTC
31
2021-04-25 16:26:15.637 UTC
2015-02-01 16:30:46.04 UTC
null
3,204,551
null
605,812
null
1
57
javascript|html|button|hyperlink
298,967
<p>Inline Javascript:</p> <pre><code>&lt;button onclick="window.location='http://www.example.com';"&gt;Visit Page Now&lt;/button&gt; </code></pre> <p>Defining a function in Javascript:</p> <pre><code>&lt;script&gt; function visitPage(){ window.location='http://www.example.com'; } &lt;/script&gt; &lt;...
4,862,178
Remove rows with all or some NAs (missing values) in data.frame
<p>I'd like to remove the lines in this data frame that:</p> <p>a) <strong>contain <code>NA</code>s across all columns.</strong> Below is my example data frame. </p> <pre><code> gene hsap mmul mmus rnor cfam 1 ENSG00000208234 0 NA NA NA NA 2 ENSG00000199674 0 2 2 2 2 3 ENSG0000022...
4,862,502
17
0
null
2011-02-01 11:52:31.15 UTC
432
2022-02-08 16:11:28.137 UTC
2018-08-12 12:32:28.28 UTC
null
2,204,410
null
525,563
null
1
1,039
r|dataframe|filter|missing-data|r-faq
2,160,968
<p>Also check <a href="http://stat.ethz.ch/R-manual/R-patched/library/stats/html/complete.cases.html" rel="noreferrer"><code>complete.cases</code></a> :</p> <pre><code>&gt; final[complete.cases(final), ] gene hsap mmul mmus rnor cfam 2 ENSG00000199674 0 2 2 2 2 6 ENSG00000221312 0 1 ...
41,676,054
How to add fonts to create-react-app based projects?
<p>I'm using <a href="https://github.com/facebook/create-react-app" rel="noreferrer">create-react-app</a> and prefer not to <code>eject</code>.</p> <p>It's not clear where fonts imported via @font-face and loaded locally should go. </p> <p>Namely, I'm loading</p> <pre><code>@font-face { font-family: 'Myriad Pro Re...
41,678,350
12
5
null
2017-01-16 12:04:46.833 UTC
108
2022-09-11 04:50:59.97 UTC
2018-09-18 18:43:06.933 UTC
null
3,951,782
null
48,062
null
1
357
css|reactjs|fonts|webpack|create-react-app
398,244
<p>There are two options:</p> <h3>Using Imports</h3> <p>This is the suggested option. It ensures your fonts go through the build pipeline, get hashes during compilation so that browser caching works correctly, and that you get compilation errors if the files are missing.</p> <p>As <a href="https://facebook.github.io/cr...
12,080,087
How to test the done and fail Deferred Object by using jasmine
<p>Here is the code about the javascript submit request (1).<br> Here is the test about mocking the ajax request by using jasmine (2).</p> <p>I would like to mock the server behaviour. Any ideas?<br> See the comment in (1) and (2) for more details. </p> <p>P.S.:<br> Actually in both case the done and the fail Defe...
12,435,465
3
3
null
2012-08-22 19:26:50.073 UTC
8
2013-02-13 04:54:50.767 UTC
2012-09-14 06:04:27.85 UTC
null
1,113,216
null
1,113,216
null
1
28
javascript|jquery|post|jasmine
19,697
<p>We actually ran into the same problem, trying to test Deferred objects that represent AJAXed template scripts for on-the-fly templating. Our testing solution involves using the <a href="https://github.com/pivotal/jasmine-ajax">Jasmine-Ajax</a> library in conjunction with Jasmine itself.</p> <p>So probably it will b...
12,190,147
Customize dot with image of UIPageControl at index 0 of UIPageControl
<p>I'm a new learner of ios programming. I have tried to search with another example and more questions at stackoverflow but it's not my goal. I want to set an image of dot at index 0 of UIPageControl as similar as iPhone search homescreen. Have any way to do it ? Please explain me with some code or another useful lin...
12,190,526
11
2
null
2012-08-30 04:58:02.48 UTC
13
2021-06-15 20:04:24.683 UTC
null
null
null
null
1,524,903
null
1
31
iphone|ios
57,944
<p>Try this link:-</p> <p>Answer with GrayPageControl:- <a href="https://stackoverflow.com/questions/3409319/is-there-a-way-to-change-page-indicator-dots-color">Is there a way to change page indicator dots color</a></p> <p>It is really good and reliable.I also have used this code.</p> <p>You might have to do some mo...
12,548,312
Find all subsets of length k in an array
<p>Given a set <code>{1,2,3,4,5...n}</code> of n elements, we need to find all subsets of length k . </p> <p>For example, if n = 4 and k = 2, the <code>output</code> would be <code>{1, 2}, {1, 3}, {1, 4}, {2, 3}, {2, 4}, {3, 4}</code>.</p> <p>I am not even able to figure out how to start. We don't have to use the inb...
12,548,381
15
1
null
2012-09-22 22:50:04.343 UTC
10
2022-04-19 23:11:10.017 UTC
2021-01-24 09:35:24.59 UTC
null
1,048,572
null
971,683
null
1
40
arrays|algorithm|subset|powerset
57,245
<p>Recursion is your friend for this task.</p> <p>For each element - "guess" if it is in the current subset, and recursively invoke with the guess and a smaller superset you can select from. Doing so for both the "yes" and "no" guesses - will result in all possible subsets. <br>Restraining yourself to a certain length...
12,304,553
TCPDF Save file to folder?
<p>I'm using TCPDF to print a receipt and then send it to customer with phpMailer, but I have a problem: </p> <p><strong>I have no idea how to save the file into a pdf.</strong></p> <p>I've tried this:</p> <pre><code>// reset pointer to the last page $pdf-&gt;lastPage(); //Close and output PDF document $pdf-&gt;Out...
12,304,671
12
2
null
2012-09-06 16:37:31.727 UTC
12
2021-10-24 18:46:11.643 UTC
null
null
null
user1537415
null
null
1
41
php|tcpdf
127,037
<p>try this</p> <pre><code>$pdf-&gt;Output('kuitti'.$ordernumber.'.pdf', 'F'); </code></pre>
19,112,031
Difference between korn and bash shell
<p>I am completely new to Unix. Presently, I have been asked to learn about both <strong>KornShell (ksh)</strong> and <strong>Bash shell</strong>. Can some one please give me a short overview about the two? </p> <p>Is the term "<strong>shell</strong>" synonymous to "<strong>terminal</strong>"? </p> <p>I understand th...
19,112,167
2
4
null
2013-10-01 09:01:35.127 UTC
2
2014-01-06 17:40:50.533 UTC
2014-01-06 17:40:50.533 UTC
null
228,080
null
539,085
null
1
19
bash|shell|unix|scripting|ksh
41,976
<p>Post from UNIX.COM</p> <p><strong>Shell features</strong></p> <p>This table below lists most features that I think would make you choose one shell over another. It is not intended to be a definitive list and does not include every single possible feature for every single possible shell. A feature is only considere...
3,754,798
IF ELSE problem COMMAND BATCH
<p>I have problem about IF ELSE in Command Batch script...</p> <p>In Notepad:<br> Code:</p> <pre><code>:CHECKACCOUNT if /I "%user%"=="insertusername" ( GOTO :ACCOUNT ) ELSE ( GOTO :CHECKPASSACCT ) :CHECKPASSACCT if /I "%pass%"=="insertpassword" ( GOTO :ACCOUNT ) ELSE ( GOTO :COUNTER ) </code></pre> <p>In COMMAND:<b...
3,754,830
4
0
null
2010-09-20 19:25:26.107 UTC
2
2017-03-09 15:53:46.663 UTC
2010-09-20 20:03:43.033 UTC
null
453,089
null
453,089
null
1
9
scripting|batch-file|command|windows-server
96,837
<p>You can simplify this down to:</p> <pre><code>:CHECKACCOUNT if /I "%user%"=="insertusername" GOTO ACCOUNT GOTO CHECKPASSACCT :CHECKPASSACCT if /I "%pass%"=="insertpassword" GOTO ACCOUNT GOTO COUNTER </code></pre> <p>The <code>ELSE</code> statements aren't needed. Since the <code>IF</code> block will jump somewhe...
3,539,274
How do I scale my Scala REST application that uses Akka?
<p>I have a Scala application using Akka that receives REST requests, makes some operations against a database, and responds with some information to the client. As it is, my db operations take a long time and my REST-enabled actor is unable to respond to new requests in the meantime, even though I could run lots of op...
4,503,332
4
1
null
2010-08-21 22:24:47.22 UTC
10
2014-10-08 12:25:20.383 UTC
2014-10-08 12:25:20.383 UTC
null
819,887
null
309,224
null
1
12
scala|rest|jersey|akka|scalability
3,506
<p>While I realize this thread is 4+ months stale now, it's worth noting that Akka has a new HTTP module implementation that transfers the request into an actor efficiently. This approach leverages the asynchronous servlet API (also works with Jetty continuations) to enable the suspended request to be passed through t...
22,483,214
Regex - check if input still has chances to become matching
<p>We've got such regexp:</p> <pre><code>var regexp = /^one (two)+ three/; </code></pre> <p>So only string like <code>"one two three"</code> or <code>"one two three four"</code> or <code>"one twotwo three"</code> etc. will match it.</p> <p>However, if we've got string like</p> <p><code>"one "</code> - is still <em>...
41,580,048
10
5
null
2014-03-18 15:03:14.293 UTC
10
2020-07-18 16:07:32.63 UTC
2014-09-02 12:00:53.44 UTC
null
2,446,799
null
2,446,799
null
1
29
javascript|regex
5,981
<p>This is a regex feature known as <em>partial matching</em>, it's available in several regex engines such as PCRE, Boost, Java but <em>not</em> in JavaScript.</p> <p><a href="https://stackoverflow.com/a/22489941/3764814">Andacious's answer</a> shows a very nice way to overcome this limitation, we just need to automat...
22,523,575
How to insert json array into mysql database
<p>Hi I'm trying to insert the json array into my MySQL database. I'm passing the data form my iphone there i have converted the data into json format and I'm passing the data to my server using the url its not inserting into my server.</p> <p>This is my json data.</p> <blockquote> <p>[{"name":"0","phone":"dsf","ci...
22,523,620
6
7
null
2014-03-20 04:32:27.503 UTC
9
2022-01-21 13:16:38.14 UTC
2014-03-20 04:41:12.297 UTC
null
3,427,551
null
3,427,551
null
1
16
php|mysql|arrays|json
97,785
<pre><code> $json = file_get_contents('php://input'); $obj = json_decode($json,true); </code></pre> <p>I think you are passing the wrong variable. You should pass <code>$json</code> in <code>json_decode</code> as shown above.</p>
20,723,100
Why can only a superuser CREATE EXTENSION hstore, but not on Heroku?
<p>When I attempt to enable hstore on my database:</p> <pre><code>=&gt; CREATE EXTENSION IF NOT EXISTS hstore; ERROR: permission denied to create extension "hstore" HINT: Must be superuser to create this extension. </code></pre> <p>My user is not a superuser, but <em>is</em> the owner of the database.</p> <p>Accor...
20,745,157
3
4
null
2013-12-21 20:12:26.767 UTC
5
2021-08-03 02:21:27.47 UTC
2013-12-21 20:26:16.67 UTC
null
4,937
null
4,937
null
1
36
postgresql|heroku|hstore
25,854
<p>The hstore extension creates functions that call code from an external dynamic object, which requires superuser privilege. That's why creating the hstore extension requires superuser privilege.</p> <p>As for Heroku, it is my understanding that they are running with a special extension whitelisting module, which al...
10,946,624
Finding IP Address for IPhone
<p>I am working on IPhone. I want to know how to find a ip address of a iphone through USB/3G not on wifi. I am aware of seeing IP if it is connected through WiFI.(Going through settings and looking under Wifi) But i need IP through USB / 3G. what i did means i used personal hotspot and i connected my iphone to PC thro...
19,556,018
5
0
null
2012-06-08 09:52:46.377 UTC
null
2019-07-25 20:52:58.7 UTC
null
null
null
null
966,874
null
1
8
iphone|ip
98,005
<p>Unfortunately the responses are not completely correct. In a 3G/4G network every device gets an IP address, but THAT's NOT the IP address that you see when going to sites like www.whatismyip.com. That's the address that the Telco presents to the external world, not the device IP address. </p> <p>Telcos such AT&amp...
10,875,750
Left/right padding for Button.setCompoundDrawablesWithIntrinsicBounds()?
<p>I'm trying to set a left icon on a button with:</p> <pre><code>setCompoundDrawablesWithIntrinsicBounds(R.drawable.foo, 0, 0, 0); </code></pre> <p>but the icon is placed flush up against the left edge of my button, and the text string. Is there a way to specify some left/right padding on the supplied icon so that i...
10,875,862
2
0
null
2012-06-04 02:37:24.543 UTC
3
2016-01-19 15:49:02.387 UTC
null
null
null
null
291,701
null
1
26
android
53,322
<p>I believe what you're looking for is <a href="http://developer.android.com/reference/android/widget/TextView.html#attr_android%3adrawablePadding" rel="noreferrer"><code>android:drawablePadding</code></a></p> <p>Here's an example of using <code>drawablePadding</code> along with <code>paddingLeft</code> and <code>pad...
10,943,088
numpy.max or max ? Which one is faster?
<p>In python, which one is faster ? </p> <pre><code>numpy.max(), numpy.min() </code></pre> <p>or</p> <pre><code>max(), min() </code></pre> <p>My list/array length varies from 2 to 600. Which one should I use to save some run time ?</p>
10,943,451
4
2
null
2012-06-08 04:31:55.497 UTC
5
2022-01-26 11:42:56.24 UTC
null
null
null
null
891,373
null
1
44
python|numpy|runtime|max|min
55,376
<p>Well from my timings it follows if you already have numpy array <code>a</code> you should use <code>a.max</code> (the source tells it's the same as <code>np.max</code> if <code>a.max</code> available). But if you have built-in list then most of the time takes <em>converting</em> it into np.ndarray => that's why <cod...
11,278,995
Why doesn't NSOrderedSet inherit from NSSet?
<p>Surely an ordered set is a more-specific case of a set, so why does <code>NSOrderedSet</code> inherit from <code>NSObject</code> rather than <code>NSSet</code>?</p>
11,279,208
1
4
null
2012-07-01 01:41:53.43 UTC
14
2012-07-01 02:48:19.093 UTC
null
null
null
null
461,492
null
1
51
objective-c|ios|nsset|nsorderedset
5,746
<p>I went through the interface of <code>NSSet</code> and you're right, ordered sets appear to satisfy the <a href="http://en.wikipedia.org/wiki/Liskov_substitution_principle" rel="noreferrer">Liskov substitution principle</a> and could therefor inherit from <code>NSSet</code>.</p> <p>There is one little method that b...
11,140,163
Plotting a 3d cube, a sphere and a vector in Matplotlib
<p>I search how to plot something with less instruction as possible with Matplotlib but I don't find any help for this in the documentation.</p> <p>I want to plot the following things:</p> <ul> <li>a wireframe cube centered in 0 with a side length of 2</li> <li>a "wireframe" sphere centered in 0 with a radius of 1</l...
11,156,353
3
1
null
2012-06-21 14:15:43.44 UTC
53
2020-09-02 15:16:33.497 UTC
2019-07-17 12:49:32.93 UTC
null
7,851,470
null
882,932
null
1
96
python|matplotlib|3d|geometry
145,729
<p>It is a little complicated, but you can draw all the objects by the following code:</p> <pre><code>from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np from itertools import product, combinations fig = plt.figure() ax = fig.gca(projection='3d') ax.set_aspect("equal") # draw ...
12,725,265
Is it possible to use a for loop in <select> in html? and how?
<p>I am trying to use a for loop in html but i dont even know if this is possible. Is it? and if yes how? I dont want to use php. only html and javascript. </p> <p>this is my goal: i have a file containing .txt files. i want to count the number of txt files and when i get the number i want to send it to where i will...
12,734,637
7
4
null
2012-10-04 10:27:54.893 UTC
2
2022-07-13 08:05:37.627 UTC
2012-10-04 10:40:32.113 UTC
null
1,438,482
null
1,438,482
null
1
6
javascript|html
44,777
<p>Lots of answers.... here is another approach <strong>NOT</strong> using document.write OR innerHTML OR jQuery.... </p> <p>HTML</p> <pre><code>&lt;select id="foo"&gt;&lt;/select&gt; </code></pre> <p>JS</p> <pre><code>(function() { // don't leak var elm = document.getElementById('foo'), // get the select ...
12,694,569
how to cleanly remove ndb properties
<p>in my app i need to remove a few of my models properties.<br> i checked out <a href="https://developers.google.com/appengine/articles/update_schema" rel="noreferrer">this link</a> but the first issue is that the properties are on a <code>polymodel</code> and there is no way im going to switch to an <code>expando</co...
12,701,172
1
0
null
2012-10-02 16:40:50.383 UTC
11
2012-10-03 02:32:46.257 UTC
2012-10-02 20:52:43.453 UTC
null
258,564
null
258,564
null
1
15
python|google-app-engine|app-engine-ndb|polymodel
4,622
<p>If you want to update all your entities the recommended approach is a map/reduce job that reads and rewrites all entities; however it may not be worth it, depending on how much data you have -- the map/reduce isn't free either.</p> <p>Also be sure you test the map/reduce job on a small subset of the data. It is re...
12,760,709
Missing Localized Screenshots Error on itunes
<p>I have selected Default Language as "Australian English" as Default language. When I am submitting the binary it showing as rejected"Red Icon" with status "Missing Localized Screenshots". The application is in only single language. I have added screen shots also the application is only for iphone.</p> <p>When I am ...
12,760,736
11
0
null
2012-10-06 14:33:22.06 UTC
3
2016-08-17 13:51:56.68 UTC
null
null
null
null
905,517
null
1
28
iphone|ios|binary|itunes
16,596
<p>Check if you have screenshots for iPhone 5. I had this same error, when screenshots for iP5 were missing.</p>
12,927,027
UICollectionView flowLayout not wrapping cells correctly
<p>I have a <code>UICollectionView</code> with a FLowLayout. It will work as I expect most of the time, but every now and then one of the cells does not wrap properly. For example, the the cell that should be on in the first "column" of the third row if actually trailing in the second row and there is just an empty spa...
13,389,461
12
0
null
2012-10-17 04:18:06.78 UTC
53
2021-09-28 04:47:54.463 UTC
2018-09-17 10:52:49.927 UTC
null
1,033,581
null
377,384
null
1
79
ios|ios6|uicollectionview|uicollectionviewcell
45,700
<p>There is a bug in UICollectionViewFlowLayout's implementation of layoutAttributesForElementsInRect that causes it to return TWO attribute objects for a single cell in certain cases involving section insets. One of the returned attribute objects is invalid (outside the bounds of the collection view) and the other is ...
13,180,543
What is AssemblyInfo.cs used for?
<p>My question is pretty basic. What I'd like to know is what is the <code>AssemblyInfo.cs</code> file used for?</p>
13,180,570
6
1
null
2012-11-01 15:43:00.54 UTC
16
2020-12-31 04:13:28.037 UTC
2020-12-31 04:13:28.037 UTC
null
3,728,901
null
991,788
null
1
136
.net
103,157
<blockquote> <p>AssemblyInfo.cs contains information about your assembly, like name, description, version, etc. You can find more details about its content reading the comments that are included in it.</p> <p>If you delete it, your assembly will be compiled with no information, i.e., in the Details tab of ...
16,639,484
How to convert integer into categorical data in R?
<p>My data set has 8 variables and one of them is categorical but R thinks that it is integer (0's and 1's). What I have to do inorder to covert it into categorical?</p> <pre><code>&gt; str(mydata) 'data.frame': 117 obs. of 8 variables: $ PRICE: int 2050 2080 2150 2150 1999 1900 1800 1560 1450 1449 ... $ SQFT : ...
16,639,537
1
0
null
2013-05-19 21:07:24.327 UTC
7
2017-08-09 15:16:25.27 UTC
2013-05-19 21:21:40.167 UTC
null
1,315,767
null
233,286
null
1
28
r|type-conversion
107,574
<p>Have a look at <code>?as.factor</code>. In your case </p> <pre><code>mydata$COR &lt;- as.factor(mydata$COR) </code></pre>
17,035,609
Most Efficient Multipage RequireJS and Almond setup
<p>I have multiple pages on a site using RequireJS, and most pages have unique functionality. All of them share a host of common modules (jQuery, Backbone, and more); all of them have their own unique modules, as well. I'm wondering what is the best way to optimize this code using <a href="https://github.com/jrburke/r....
17,385,513
5
1
null
2013-06-11 02:22:57.593 UTC
29
2015-06-01 02:54:07 UTC
2013-06-29 00:13:56.147 UTC
null
2,284,669
null
2,284,669
null
1
34
optimization|compression|requirejs|r.js|almond
10,003
<p>I think you've answered your own question pretty clearly. </p> <p>For production, we do - as well as most companies I've worked with <strong>option 3</strong>.</p> <p>Here are advantages of solution 3, and why I think <strong>you should use it</strong>:</p> <ul> <li>It utilizes the <strong>most caching</strong>, ...
16,788,068
Hibernate: make database only if not exists
<p>I want Hibernate make database file (SQLite), but only if not exists.</p> <p>Now in hibernate.cfg.xml I have this line:</p> <pre><code>&lt;property name="hibernate.hbm2ddl.auto"&gt;create&lt;/property&gt; </code></pre> <p>The problem is that database file is been creating in all the time, even the file exists.</p...
16,788,284
2
4
null
2013-05-28 09:06:48.337 UTC
4
2013-05-28 09:17:38.013 UTC
null
null
null
null
1,819,402
null
1
34
java|hibernate
45,964
<p>Try switching the value to <code>update</code></p> <pre><code>&lt;property name="hibernate.hbm2ddl.auto"&gt;update&lt;/property&gt; </code></pre>
17,091,300
Linux: Set permission only to directories
<p>I have to change the permissions of the <code>htdocs</code> directory in apache to a certain group and with certain read/write/execute.</p> <p>The directories need to have 775 permissions and the files need to have 664.</p> <p>If I do a recursive 664 to the <code>htdocs</code>, then all files and directories will ...
17,091,359
7
0
null
2013-06-13 15:40:41.6 UTC
21
2021-09-06 00:12:52.923 UTC
2013-07-26 14:49:25.267 UTC
null
445,131
null
995,655
null
1
37
linux|bash|directory|chmod
37,898
<p>Use find's <code>-type</code> option to limit actions to files and directories. Use the <code>-o</code> option to specify alternate actions for different types, so you only have to run <code>find</code> once, rather than separately for each type.</p> <pre><code>find htdocs -type f -exec chmod 664 {} + -o -type d -e...
25,569,865
How to escape curly braces in a format string in Rust
<p>I want to write this</p> <pre><code>write!(f, "{ hash:{}, subject: {} }", self.hash, self.subject) </code></pre> <p>But since curly braces have special meaning for formatting it's clear that I can't place the outer curly braces like that without escaping. So I tried to escape them.</p> <pre><code>write!(f, "\{ ha...
25,570,140
1
4
null
2014-08-29 13:59:02.72 UTC
4
2018-10-08 12:41:34.967 UTC
null
null
null
null
288,703
null
1
103
string-formatting|rust
28,569
<p>You might be reading some out of date docs (e.g. for Rust 0.9)</p> <p>As of Rust 1.0, <a href="https://doc.rust-lang.org/std/fmt/index.html#escaping" rel="noreferrer">the way to escape <code>{</code> and <code>}</code> is with another <code>{</code> or <code>}</code></a></p> <pre><code>write!(f, "{{ hash:{}, subje...
25,827,160
Importing correctly with pytest
<p>I just got set up to use pytest with Python 2.6. It has worked well so far with the exception of handling "import" statements: I can't seem to get pytest to respond to imports in the same way that my program does.</p> <p>My directory structure is as follows:</p> <pre><code>src/ main.py util.py test/ ...
25,828,036
6
5
null
2014-09-13 20:02:50.083 UTC
10
2022-08-07 02:23:07.843 UTC
2014-09-15 03:52:48.877 UTC
null
988,441
null
988,441
null
1
88
python|import|pytest
69,169
<p><strong><em>import</em></strong> looks in the following directories to find a module:</p> <ol> <li>The <strong>home directory</strong> of the program. This is the directory of your root script. When you are running pytest your home directory is where it is installed (/usr/local/bin probably). No matter that you are...
26,476,391
How to auto-load MySQL on startup on OS X Yosemite / El Capitan
<p>After upgrading OS X my install of MySQL stopped loading on startup.</p> <p>This <a href="http://dev.mysql.com/doc/mysql-macosx-excerpt/5.5/en/macosx-installation-startupitem.html" rel="noreferrer">walk-through on MySQL</a> says: </p> <blockquote> <p>"The Startup Item installation adds a variable MYSQLCOM=-YES- ...
26,492,593
5
7
null
2014-10-20 23:06:38.39 UTC
37
2017-10-30 07:44:29.107 UTC
2016-02-17 22:46:24.257 UTC
null
922,522
null
922,522
null
1
77
mysql|macos|osx-yosemite|startup|osx-elcapitan
60,862
<p><strong>This is what fixed it:</strong></p> <p>First, create a new file: /Library/LaunchDaemons/com.mysql.mysql.plist</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;KeepAlive&lt;/key&gt; &lt;true /&gt; &lt;key&gt;Label&lt;/key&gt; &...
9,660,445
Detect iPhone Volume Button Up Press?
<p>Is there a notification that I can listen to that will tell me when an iPhone's volume is turned <strong>up</strong>? </p> <p>I know about the <code>AVSystemController_SystemVolumeDidChangeNotification</code>, but it is essential that the notification only be triggered when the volume has been turned up, not up or ...
10,155,141
4
0
null
2012-03-12 00:48:33.667 UTC
9
2017-10-06 23:34:48.697 UTC
2012-10-30 14:37:02.117 UTC
null
299,797
null
817,946
null
1
13
iphone|objective-c|ios|volume|avsystemcontroller
15,538
<p>There is no documented way to to this, but you can use this workaround. Register for <code>AVSystemController_SystemVolumeDidChangeNotification</code> notification and add an <code>MPVolumeView</code> which will prevent the system volume view from showing up.</p> <pre><code>MPVolumeView *volumeView = [[MPVolumeView...
10,085,951
Scala ~> (tilde greater than) operator
<p>I have the following scala class definition (found in a paper), modeling categories:</p> <pre><code>trait Category[~&gt;[_, _]] { def compose[A, B, C] (f: B ~&gt; C) (g: A ~&gt; B) : A ~&gt; C def id[A]: A ~&gt; A } </code></pre> <p>can someone explain me what the '~>' means in the Category ...
10,086,051
2
0
null
2012-04-10 09:11:39.757 UTC
8
2019-05-06 19:59:00.36 UTC
null
null
null
null
601,960
null
1
28
scala|operators
8,947
<p><code>~&gt;</code> is just the placeholder-name for the type-parameter of <code>Category</code>. Like the <code>T</code> in <code>class Option[T]</code>.</p> <p>Additionally, Scala syntax allows you to write <code>B ~&gt; C</code> as a shorthand for <code>~&gt;[B, C]</code>.</p> <p>Maybe things get clearer, if you...
9,657,691
Xcode: Dragging a Project to a Workspace shows tiny .xcodeproj file in Project Navigator. What's wrong?
<p><strong>Setup</strong>:</p> <p>Xcode 4.3.1 (or 5.x)<br> OS X 10.7.3</p> <p>I have reproduced this issue on two separate late-model Macs with this setup.</p> <p><strong>Steps</strong>:</p> <ol> <li>Create a new Mac "Cocoa Application" Xcode Project. <code>File &gt; New &gt; Project…</code> Name it "MyApp".</li> <...
9,657,780
1
6
null
2012-03-11 18:31:58.967 UTC
8
2013-11-21 00:07:37.05 UTC
2013-11-21 00:07:37.05 UTC
null
34,934
null
34,934
null
1
39
xcode|macos
12,965
<p>Be sure you don't have the project already open in another window. Xcode only lets you open a project one time. I've made this mistake a lot when working on a framework then trying to add it to an application.</p> <p>Simply close the project you're trying to drag in's window and everything will be happy.</p>
9,899,113
Get request.session from a class-based generic view
<p>Is there a way to get <code>request.session</code> from inside a class-based view? </p> <p>For instance, I have </p> <pre><code>from django.views.generic.edit import FormView class CreateProfileView(FormView): def form_valid(self, form): # --&gt; would like to save form contents to session here ...
9,899,170
1
0
null
2012-03-27 23:22:44.96 UTC
8
2013-03-12 19:30:55.987 UTC
null
null
null
null
1,161,906
null
1
39
django|django-views
29,399
<p>You have access to <code>self.request</code> from anywhere within the class (and therefore <code>self.request.session</code>)</p> <p><a href="https://docs.djangoproject.com/en/dev/topics/class-based-views/generic-display/#dynamic-filtering">https://docs.djangoproject.com/en/dev/topics/class-based-views/generic-disp...
10,242,501
How to find a substring in a field in Mongodb
<p>How can I find all the objects in a database with where a field of a object contains a substring?</p> <p>If the field is A in an object of a collection with a string value:</p> <p>I want to find all the objects in the db "database" where A contains a substring say "abc def".</p> <p>I tried: </p> <pre><code>db.da...
10,244,062
6
1
null
2012-04-20 08:08:34.163 UTC
10
2021-04-13 06:50:49.257 UTC
2017-09-22 18:01:22.247 UTC
null
-1
null
713,087
null
1
73
mongodb|nosql
98,992
<p>Instead of this:</p> <pre><code>db.database.find({A: {$regex: '/^*(abc def)*$/''}}) </code></pre> <p>You should do this:</p> <pre><code>db.database.find({A: /abc def/i }) </code></pre> <p>^* is not actually valid syntax as ^ and $ are anchors and not something that is repeatable. You probably meant ^.* here. But...
8,087,736
How do you make a dynamically-sized data table?
<p>I am using Excel 2010.</p> <p>I have a "monthly" data table that looks similar to this:</p> <pre><code>MonthBegin InventoryExpenses Overhead TotalSales TotalSalesIncome TotalProfit July-11 $1,500 $4,952 89 $7,139 $687 August-11 $2,200 $4,236 105 ...
8,149,620
3
2
null
2011-11-10 23:14:20.547 UTC
null
2016-11-09 13:58:35.893 UTC
2016-11-09 13:58:35.893 UTC
null
4,370,109
null
120,888
null
1
5
excel|datatable|excel-formula
56,778
<p>You can't <strong>dynamically</strong> add a new row with formula only.</p> <p>Here is a VBA event procedure that will do the trick. You need to put in the <code>Workbook module</code></p> <pre><code>Option Explicit Private Sub Workbook_Open() Dim lo As ListObject Dim iTot As Long Set lo = ListObjects("MyTable") ...
7,912,180
Plotting multiple lines from a data frame in R
<p>I am building an R function to plot a few lines from a data table, I don't understand why this is not working?</p> <pre><code>data = read.table(path, header=TRUE); plot(data$noop); lines(data$noop, col="blue"); lines(data$plus, col="green"); </code></pre> <p>I am reading the data from a file I has which is formatt...
7,913,639
3
2
null
2011-10-27 05:57:20.773 UTC
3
2013-03-29 18:31:32.023 UTC
2013-03-29 18:31:32.023 UTC
null
697,568
null
546,427
null
1
6
r|graph|plot
70,336
<p>Have a look at the ggplot2 package</p> <pre><code>library(ggplot2) library(reshape) data &lt;- data.frame(time = seq(0, 23), noob = rnorm(24), plus = runif(24), extra = rpois(24, lambda = 1)) Molten &lt;- melt(data, id.vars = "time") ggplot(Molten, aes(x = time, y = value, colour = variable)) + geom_line() </code><...
11,808,432
C++- error C2144 syntax error : 'int' should be preceded by ';'
<p>I'm trying to compile this C++ code:</p> <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include &lt;string.h&gt; #include "general_configuration.h" #include "helper_functions.h" #define LINE_LEN 80 // file_with_as_ext returns 1 if the input has .as extension int file_with_as_ext(char* input) { ...
11,808,543
3
5
null
2012-08-04 11:51:29.157 UTC
2
2019-04-08 08:59:04.857 UTC
2019-04-08 08:59:04.857 UTC
null
2,527,795
null
1,363,226
null
1
6
c++
39,723
<p>First, the code you have posted begins with a stray backtick. If that's really in your code, you should remove it.</p> <p>Second, the compiler would be happier, and emit fewer warnings, if you ended your function with the line</p> <pre><code>return 0; // unreachable </code></pre> <p>This is good C++ style and is...
11,498,366
How to create an UI or a widget that sits on top of all applications in Android?
<p>Can I create an UI or a widget in Android that will sit on top of all applications? There are applications that have widgets like this. One example has a camera icon on top of all the applications that, when clicked, will capture the screen. </p>
11,498,612
2
0
null
2012-07-16 05:03:36.6 UTC
11
2017-05-15 21:58:56.853 UTC
2017-05-15 21:58:56.853 UTC
null
5,992,240
null
450,431
null
1
8
android|android-windowmanager
5,232
<p>If you want to just display something, you can display it on top of everything even the lockscreen.</p> <p>If you want something to be clickable, you can display it on top of anything except the lockscreen.</p> <p>Here's a sample, modify to your needs:</p> <p>Create a service and do the following:</p> <pre><code...
11,551,079
Programmatically adding Label to Windows Form (Length of label?)
<p>In my code, i create a label with the following:</p> <pre><code>Label namelabel = new Label(); namelabel.Location = new Point(13, 13); namelabel.Text = name; this.Controls.Add(namelabel); </code></pre> <p>The string called name is defined before this, and has a length of around 50 characters. However, only the fir...
11,551,100
4
1
null
2012-07-18 22:07:36.167 UTC
2
2021-08-29 10:28:40.083 UTC
null
null
null
null
1,116,831
null
1
12
c#|.net|label|windows-forms-designer
52,466
<p>Try adding the AutoSize property:</p> <pre><code>namelabel.AutoSize = true; </code></pre> <p>When you place a label on a form with the design editor, this property defaults to true, but if you create the label in code like you did, the default is false.</p>
11,924,452
Iterating over basic “for” loop using Handlebars.js
<p>I’m new to Handlebars.js and just started using it. Most of the examples are based on iterating over an object. I wanted to know how to use handlebars in basic for loop.</p> <p>Example.</p> <pre><code>for(i=0 ; i&lt;100 ; i++) { create li's with i as the value } </code></pre> <p>How can this be achieved?</p>
11,924,998
5
0
null
2012-08-12 17:59:11.607 UTC
25
2020-11-24 14:25:24.773 UTC
2016-06-14 10:20:41.087 UTC
null
313,106
null
1,184,100
null
1
82
handlebars.js
100,317
<p>There's nothing in Handlebars for this but you can add your own helpers easily enough.</p> <p>If you just wanted to do something <code>n</code> times then:</p> <pre><code>Handlebars.registerHelper('times', function(n, block) { var accum = ''; for(var i = 0; i &lt; n; ++i) accum += block.fn(i); ...
11,799,159
trying to align html button at the center of the my page
<p>I'm trying to align an HTML button exactly at the centre of the page irrespective of the browser used. It is either floating to the left while still being at the vertical centre or being somewhere on the page like at the top of the page etc.. </p> <p>I want it to be both vertically and horizontally be centered. Her...
11,799,200
9
1
null
2012-08-03 15:53:37.3 UTC
21
2021-07-15 19:12:34.083 UTC
2019-10-07 19:44:10.133 UTC
null
2,756,409
null
1,455,116
null
1
118
html|css|button|alignment|vertical-alignment
1,006,015
<p>Here's your solution: <a href="http://jsfiddle.net/7Laf8/" rel="noreferrer">JsFiddle</a></p> <p>Basically, place your button into a div with centred text:</p> <pre><code>&lt;div class="wrapper"&gt; &lt;button class="button"&gt;Button&lt;/button&gt; &lt;/div&gt; </code></pre> <p>With the following styles:</p> ...
11,997,032
How to get box-shadow on left & right sides only
<p>Any way to get box-shadow on left &amp; right (horizontal?) sides only with no hacks or images. I am using:</p> <pre><code>box-shadow: 0 0 15px 5px rgba(31, 73, 125, 0.8); </code></pre> <p>But it gives shadow all around.</p> <p>I have no borders around the elements.</p>
11,997,074
16
0
null
2012-08-16 23:49:59.47 UTC
81
2021-11-10 13:22:56.23 UTC
null
null
null
null
731,043
null
1
242
html|css
338,952
<blockquote> <p><strong>NOTE:</strong> I suggest checking out <a href="https://stackoverflow.com/a/17323375/605707">@Hamish's answer</a> below; it doesn't involve the imperfect "masking" in the solution described here.</p> </blockquote> <hr> <p>You can get close with multiple box-shadows; one for each side</p> <pr...
3,638,887
What's the difference between self and window?
<p>I have a JavaScript that deals with with detection whether the page is in frames or not. I used top.frames[] etc. and everything works fine. </p> <p>In this script I noticed that I can use "window" or "self" interchangeably and everything still works. Is "window" same as "self" when used in HTML page?</p>
3,638,982
4
1
null
2010-09-03 19:21:13.883 UTC
4
2019-08-20 04:52:09.077 UTC
null
null
null
null
14,690
null
1
51
javascript|window
19,800
<p>From <em>Javascript: The Definitive Guide</em>:</p> <blockquote> <p>The Window object defines a number of properties and methods that allow you to manipulate the web browser window. It also defines properties that refer to other important objects, such as the <code>document</code> property for the Do...
3,801,431
Python: any way to perform this "hybrid" split() on multi-lingual (e.g. Chinese & English) strings?
<p>I have strings that are multi-lingual consist of both languages that use whitespace as word separator (English, French, etc) and languages that don't (Chinese, Japanese, Korean).</p> <p>Given such a string, I want to separate the English/French/etc part into words using whitespace as separator, and to separate the ...
3,801,846
5
2
null
2010-09-27 06:02:58.47 UTC
12
2018-08-01 01:52:52.303 UTC
2012-05-05 16:37:35.367 UTC
null
1,079,354
null
86,073
null
1
12
python|string|unicode|multilingual|cjk
5,800
<p>I thought I'd show the regex approach, too. It doesn't feel right to me, but that's mostly because all of the language-specific i18n oddnesses I've seen makes me worried that a regular expression might not be flexible enough for all of them--but you may well not need any of that. (In other words--overdesign.)</p> ...
3,223,899
PHP eval and capturing errors (as much as possible)
<p><strong><em>Disclaimer</strong>; I'm fully aware of the pitfalls and "evils" of eval, including but not limited to: performance issues, security, portability etc.</em></p> <p><strong>The problem</strong></p> <p>Reading the PHP manual on eval...</p> <blockquote> <p>eval() returns NULL unless return is called ...
3,224,985
6
3
null
2010-07-11 17:01:42.46 UTC
10
2021-08-18 11:07:32.42 UTC
2010-07-11 17:36:21.907 UTC
null
314,056
null
314,056
null
1
33
php|exception|parsing|eval
28,793
<p>I've found a good alternative/answer to my question.</p> <p>First of, let me start by saying that nikic's suggestion works when I set error_reporting(E_ALL); notices are shown in PHP output, and thanks to OB, they can be captured.</p> <p>Next, I've found this very useful code:</p> <pre><code>/** * Check the synt...
3,550,337
WITH (NOLOCK) vs SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
<p>Could someone give me some guidance on when I should use <code>WITH (NOLOCK)</code> as opposed to <code>SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED</code></p> <p>What are the pros/cons of each? Are there any unintended consequences you've run into using one as opposed to the other?</p>
3,550,398
6
0
null
2010-08-23 18:05:07.963 UTC
43
2015-07-09 17:44:44.117 UTC
2014-07-18 09:22:52.307 UTC
null
27,825
null
195,583
null
1
131
sql|sql-server|sql-server-2005
148,617
<p>They are the same thing. If you use the <code>set transaction isolation level</code> statement, it will apply to all the tables in the connection, so if you only want a <code>nolock</code> on one or two tables use that; otherwise use the other. </p> <p>Both will give you dirty reads. If you are okay with that, then...
3,592,079
Minimum window width in string x that contains all characters of string y
<p>Find minimum window width in string <code>x</code> that contains all characters of another string <code>y</code>. For example:</p> <pre><code>String x = "coobdafceeaxab" String y = "abc" </code></pre> <p>The answer should be 5, because the shortest substring in <code>x</code> that contains all three letters of <co...
3,592,224
7
3
null
2010-08-28 19:10:41.047 UTC
18
2017-08-31 14:33:14.503 UTC
2017-08-31 14:33:14.503 UTC
null
10,265,365
null
203,091
null
1
20
algorithm
7,602
<p><strong>time: O(n) (One pass)<br> space: O(k)</strong></p> <p>This is how I would do it:<br> Create a hash table for all the characters from string Y. (I assume all characters are different in Y). </p> <p>First pass:<br> Start from first character of string X.<br> update hash table, for exa: for key 'a' enter lo...
3,502,530
Using Visual Studio project properties effectively for multiple projects and configurations
<p>I have always used Visual Studios built in GUI support for configuring my projects, often using property sheets so that several projects will use a common set.</p> <p>One of my main gripes with this is managing multiple projects, configurations and platforms. If you just do everything with the main GUI (right click...
3,503,738
7
1
null
2010-08-17 12:48:44.89 UTC
59
2021-12-21 15:48:37.14 UTC
2015-01-12 16:01:52.947 UTC
null
11,343
null
6,266
null
1
70
c++|visual-studio-2010|visual-studio|build|projects-and-solutions
37,251
<p>I just found out somthing I didnt think was possible (it is not exposed by the GUI) that helps make property sheet far more useful. The "Condition" attribute of many of the tags in the project property files and it can be used in the .props files as well!</p> <p>I just put together the following as a test and it wo...
3,567,835
$(this).val() not working to get text from span using jquery
<p>Giving this html, i want to grab "August" from it when i click on it:</p> <pre><code>&lt;span class="ui-datepicker-month"&gt;August&lt;/span&gt; </code></pre> <p>i tried </p> <pre><code>$(".ui-datepicker-month").live("click", function () { var monthname = $(this).val(); alert(monthname); }); </code></pre...
3,567,845
7
0
null
2010-08-25 15:55:01.683 UTC
18
2019-10-10 02:32:48.953 UTC
2019-10-10 02:32:48.953 UTC
null
85,950
null
4,653
null
1
110
jquery|html
270,499
<p>Instead of <a href="http://api.jquery.com/val/" rel="noreferrer"><code>.val()</code></a> use <a href="http://api.jquery.com/text/" rel="noreferrer"><code>.text()</code></a>, like this:</p> <pre><code>$(".ui-datepicker-month").live("click", function () { var monthname = $(this).text(); alert(monthname); });...
3,626,752
Key existence check in HashMap
<p>Is checking for key existence in HashMap always necessary?</p> <p>I have a HashMap with say a 1000 entries and I am looking at improving the efficiency. If the HashMap is being accessed very frequently, then checking for the key existence at every access will lead to a large overhead. Instead if the key is not pres...
3,626,779
11
1
null
2010-09-02 11:45:16.013 UTC
68
2022-06-14 07:58:22.5 UTC
2010-09-02 11:53:09.52 UTC
null
150,505
null
150,505
null
1
355
java|hashmap
577,870
<p>Do you ever store a null value? If not, you can just do:</p> <pre><code>Foo value = map.get(key); if (value != null) { ... } else { // No such key } </code></pre> <p>Otherwise, you <em>could</em> just check for existence if you get a null value returned:</p> <pre><code>Foo value = map.get(key); if (value ...
4,116,001
Android Lock Screen Widget
<p>A few users have been asking me Android lock screen widgets for my app - I believe they want a widget that stays on their lock screens and allows them to interact with the app.</p> <p>I haven't been able to find any official documentation for this - the only thing I found was apps that will take home screen widgets...
4,666,109
3
7
null
2010-11-07 00:57:40.653 UTC
68
2016-09-07 15:09:40.547 UTC
2012-10-16 01:57:08.17 UTC
null
1,665,345
null
106,095
null
1
79
android|android-widget|lockscreen
78,671
<p>Lock screen interaction is difficult. Android allows basic operations with two window flags (FLAG_SHOW_WHEN_LOCKED and FLAG_DISMISS_KEYGUARD). FLAG_SHOW_WHEN_LOCKED works pretty consistently in that it will show on top of the lock screen even when security is enabled (the security isn't bypassed, you can't switch to...
4,228,739
VS2010 + Oracle driver: ORA-12154: TSN:could not resolve the connect identifier specified
<p>I am using:</p> <ul> <li>Visual Studio 2010</li> <li>.Net Framework Data Provider for Oracle</li> <li>Oracle Developer Tools for Visual Studio (from Oracle's website)</li> </ul> <p>I tried installing 'Oracle Developer Tools for Visual Studio' and created tnsnames.ora and sqlnet.ora files in my C:\app\ [my username...
7,919,008
4
0
null
2010-11-19 19:40:21.553 UTC
null
2015-06-19 20:28:12.293 UTC
null
null
null
null
386,806
null
1
3
.net|visual-studio|oracle|driver
40,497
<p>The best solution I found was to use the Oracle Data Access Client library, and include the entire TNS names entry in the connection string. This allows the project to be easily published to a web server, ClickOnce, etc. </p> <p>Here are the steps necessary to set up the Oracle driver working in your project:</p> ...
4,255,308
Building a multidimensional array in vb.net
<p>I'm trying to build up a multidimensional array which will hold two bits of info for each record in a database e.g. id, description.</p> <p>This is what I am currently doing.</p> <pre><code>Dim mArray(,) As String Dim i As Integer = 0 While cmdReader.Read() mArray(i,0) = cmdReader.Item("id") mArray(i,1) = ...
4,255,327
5
0
null
2010-11-23 10:58:47.49 UTC
3
2018-11-21 11:14:43.993 UTC
null
null
null
null
189,154
null
1
10
vb.net|multidimensional-array|while-loop
89,763
<p>Why not rather make use of <a href="http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx" rel="noreferrer">List Class</a> and <a href="http://msdn.microsoft.com/en-us/library/xfhwa508.aspx" rel="noreferrer">Dictionary Class</a></p> <p>You can rather then create a List of Dictionaries, with the key and value both s...
4,200,172
C, socket programming: Connecting multiple clients to server using select()
<p>I'm trying to make a server that can be connected to by multiple clients. Here's my code so far:</p> <p>Client:</p> <pre><code>int main(int argc, char **argv) { struct sockaddr_in servaddr; int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (sock == -1) perror("Socket"); bzero((void *) &amp;servad...
4,200,467
5
0
null
2010-11-16 23:41:04.82 UTC
9
2018-02-11 19:42:16.033 UTC
2015-01-01 01:03:20.923 UTC
null
4,186,297
null
506,678
null
1
13
c|sockets|network-programming|client|select-function
39,734
<p>Two issues in your code:</p> <ul> <li><p>You should do <code>recv(i, ...)</code> instead of <code>recv(clientsock[i], ...)</code></p></li> <li><p>After that you do not check if <code>recv()</code> failed, and therefore <code>printf()</code> prints out the uninitialised buffer <code>message</code>, hence the garbage...
4,614,331
Using volatile keyword with mutable object
<p>In Java, I understand that <code>volatile</code> keyword provides visibility to variables. The question is, if a variable is a reference to a mutable object, does <code>volatile</code> also provide visibility to the members inside that object?</p> <p>In the example below, does it work correctly if multiple threads a...
4,629,148
5
2
null
2011-01-06 11:19:52.74 UTC
8
2022-06-23 07:19:18.92 UTC
2022-06-23 07:19:18.92 UTC
null
168,986
null
277,422
null
1
32
java|concurrency|volatile|mutable
11,049
<p>This is sort of a side note explanation on some of the details of volatile. Writing this here because it is too much for an comment. I want to give some examples which show how volatile affects visibility, and how that changed in jdk 1.5.</p> <p>Given the following example code:</p> <pre><code>public class MyCla...
4,664,229
Here document as an argument to bash function
<p>Is it possible to pass a here document as a bash function argument, and in the function have the parameter preserved as a multi-lined variable?</p> <p>Something along the following lines:</p> <pre><code>function printArgs { echo arg1="$1" echo -n arg2= cat &lt;&lt;EOF $2 EOF } printArgs 17 &lt;&lt;EOF 18 19 EOF <...
4,665,893
5
0
null
2011-01-12 00:26:12.907 UTC
7
2018-01-31 07:08:27.357 UTC
null
null
null
null
572,058
null
1
48
bash|function|shell|arguments|heredoc
17,721
<p>If you're not using something that will absorb standard input, then you will have to supply something that does it:</p> <pre><code>$ foo () { while read -r line; do var+=$line; done; } $ foo &lt;&lt;EOF a b c EOF </code></pre>
4,743,115
How do I use bitwise operators on a "double" on C++?
<p>I was asked to get the internal binary representation of different types in C. My program currently works fine with 'int' but I would like to use it with "double" and "float". My code looks like this:</p> <pre><code>template &lt;typename T&gt; string findBin(T x) { string binary; for(int i = 4096 ; i &gt;= 1; i/=2)...
4,743,141
6
3
null
2011-01-20 03:16:51.53 UTC
2
2019-08-20 01:55:27.143 UTC
2011-01-20 03:28:09.89 UTC
null
501,557
null
521,806
null
1
9
c++|bitwise-operators
40,893
<p>Succinctly, you don't.</p> <p>The bitwise operators do not make sense when applied to <code>double</code> or <code>float</code>, and the standard says that the bitwise operators (<code>~</code>, <code>&amp;</code>, <code>|</code>, <code>^</code>, <code>&gt;&gt;</code>, <code>&lt;&lt;</code>, and the assignment vari...
4,087,839
OnEditorActionListener called twice with same eventTime on SenseUI keyboard
<p>On just one phone I am testing on (HTC Incredible, Android 2.2, Software 3.21.605.1), I am experiencing the following behavior.</p> <p>The onEditorAction event handler is being called twice (immediately) when the Enter key on the Sense UI keyboard is pressed.</p> <p>The KeyEvent.getEventTime() is the same for both...
4,903,973
6
2
null
2010-11-03 14:06:23.23 UTC
1
2019-07-16 08:58:28.983 UTC
2011-02-16 16:53:00.68 UTC
null
293,483
null
293,483
null
1
33
android
9,691
<p>As mitch said, you have to check the event action:</p> <pre><code>public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (event == null || event.getAction() != KeyEvent.ACTION_DOWN) return false; // do your stuff return true; } </code></pre> <p>This snippet works on both...
4,060,405
Is it possible to reference one CSS rule within another?
<p>For example if I have the following HTML:</p> <pre><code>&lt;div class="someDiv"&gt;&lt;/div&gt; </code></pre> <p>and this CSS:</p> <pre><code>.opacity { filter:alpha(opacity=60); -moz-opacity:0.6; -khtml-opacity: 0.6; opacity: 0.6; } .radius { border-top-left-radius: 15px; border-top-rig...
4,060,413
6
4
null
2010-10-30 19:53:52.303 UTC
12
2020-04-10 17:41:02.61 UTC
2014-05-19 18:06:28.213 UTC
null
106,224
null
491,928
null
1
114
css
176,424
<p>No, you cannot reference one rule-set from another.</p> <p>You can, however, reuse selectors on multiple rule-sets within a stylesheet <em>and</em> use multiple selectors on a single rule-set (by <a href="http://www.w3.org/TR/CSS21/selector.html#grouping" rel="noreferrer">separating them with a comma</a>). </p> <p...
4,295,681
Evil samples of subtly broken C++ code
<p>I need some samples of bad C++ code that will illustrate violation of good practices. I wanted to come up with my own examples, but I am having a hard time coming up with examples that are <em>not contrived, and where a trap is not immediately obvious</em> (it's harder than it seems).</p> <p>Examples would be somet...
4,295,704
8
8
null
2010-11-28 06:23:40.463 UTC
23
2010-11-28 18:57:23.13 UTC
null
null
null
null
23,643
null
1
40
c++
11,283
<p><a href="http://en.wikipedia.org/wiki/Most_vexing_parse" rel="noreferrer">The most vexing parse</a> is an amazingly counterintuitive result of the way C++ parses things like this:</p> <pre><code>// Declares a function called "myVector" that returns a std::vector&lt;float&gt;. std::vector&lt;float&gt; myVector(); /...
4,661,557
PIL rotate image colors (BGR -> RGB)
<p>I have an image where the colors are BGR. How can I transform my PIL image to swap the B and R elements of each pixel in an efficient manner?</p>
4,661,652
13
0
null
2011-01-11 19:06:16.837 UTC
22
2022-03-08 21:22:01.993 UTC
null
null
null
null
15,055
null
1
71
python|colors|python-imaging-library
122,235
<p>Assuming no alpha band, isn't it as simple as this?</p> <pre><code>b, g, r = im.split() im = Image.merge("RGB", (r, g, b)) </code></pre> <p>Edit:</p> <p>Hmm... It seems PIL has a few bugs in this regard... <code>im.split()</code> doesn't seem to work with recent versions of PIL (1.1.7). It may (?) still work wit...
4,653,236
Unable to start debugging on the web server. Could not start ASP.NET debugging VS 2010, II7, Win 7 x64
<p>I am running Visual Studio 2010 (as Admin), IIS 7 on Windows 7 x64. I am able to run the ASP.NET web site in IIS 7 without debugging just fine, but when I press F5 to debug it, I get:</p> <blockquote> <p>Unable to start debugging on the web server. Could not start ASP.NET debugging. More information may be availa...
4,685,878
31
6
null
2011-01-11 01:07:10.657 UTC
32
2015-09-17 18:30:47.013 UTC
2012-05-30 08:09:29.88 UTC
null
41,956
null
114,472
null
1
92
asp.net|.net|visual-studio-2010|iis-7|visual-studio-debugging
199,030
<p>Turns out that the culprit was the IIS <strong>Url Rewrite</strong> module. I had defined a rule that redirected calls to <strong>Default.aspx</strong> (which was set as the <strong>start page of the web site</strong>) to the root of the site so that I could have a canonical home URL. However, apparently VS had a pr...
14,794,556
Excel VBA - Pass a Row of Cell Values to an Array and then Paste that Array to a Relative Reference of Cells
<p>Using Excel (2010) VBA, I am trying to copy (pass) a constant range of cells (whose values recalculate) to an array. Then I am trying to pass that array to a new range of cells, directly below it. After I have done this, I want to again copy (pass) the constant range's new values to the array, and pass these new v...
14,794,645
4
2
null
2013-02-10 03:58:29.99 UTC
3
2017-07-22 22:03:33.373 UTC
null
null
null
null
1,352,561
null
1
10
arrays|excel|vba
107,080
<p>You are off slightly on a few things here, so hopefully the following helps.</p> <p>Firstly, you don't need to select ranges to access their properties, you can just specify their address etc. Secondly, unless you are manipulating the values within the range, you don't actually need to set them to a variant. If y...
14,539,992
Pandas Drop Rows Outside of Time Range
<p>I am trying to go through every row in a DataFrame index and remove all rows that are not between a certain time.</p> <p>I have been looking for solutions but none of them separate the Date from the Time, and all I want to do is drop the rows that are outside of a Time range.</p>
14,540,509
3
0
null
2013-01-26 18:15:35.187 UTC
8
2021-03-11 13:19:31.977 UTC
null
null
null
null
546,624
null
1
18
python|pandas
20,013
<p>You can use the <a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.between_time.html" rel="noreferrer"><code>between_time</code></a> function directly:</p> <pre><code>ts.between_time(datetime.time(18), datetime.time(9), include_start=False, include_end=False) </code></pre> <hr> <p><e...
14,642,985
Type safety: Unchecked cast from Object to List<MyObject>
<p>I have a ListView listing a custom object (let's say <code>MyObject</code>).</p> <p>I want to filter it dynamically through an <code>EditText</code> so I had to implement a <code>getFilter()</code> with a publishResults method: </p> <pre><code>@Override protected void publishResults(CharSequence constraint, Filter...
14,645,590
4
1
null
2013-02-01 09:16:12 UTC
4
2016-03-24 01:19:36.76 UTC
2015-12-15 01:31:31.803 UTC
null
51,683
null
1,178,445
null
1
26
android|listview|casting|filter|custom-object
55,175
<p>Well, I finally managed to find a solution.</p> <p>Just as @Medo42 said:</p> <blockquote> <p>Another option is to check for and cast to List as the instanceof error suggests. Then you can iterate over the elements in the list and check if they are actually all instances of MyObject, and copy them to a new ...
14,760,496
UICollectionView automatically scroll to bottom when screen loads
<p>I'm trying to figure out how to scroll all the way to the bottom of a UICollectionView when the screen first loads. I'm able to scroll to the bottom when the status bar is touched, but I'd like to be able to do that automatically when the view loads as well. The below works fine if I want to scroll to the bottom whe...
14,763,881
9
2
null
2013-02-07 20:35:06.67 UTC
5
2021-01-14 22:24:23.287 UTC
2013-02-10 01:26:26.48 UTC
null
1,429,262
null
1,253,907
null
1
34
ios|objective-c|uiscrollview|uicollectionview
39,287
<p>Just to elaborate on my comment.</p> <p>viewDidLoad is called before elements are visual so certain UI elements cannot be manipulated very well. Things like moving buttons around work but dealing with subviews often does not (like scrolling a CollectionView).</p> <p>Most of these actions will work best when called...
14,386,994
Chrome >=24 - how to dock devtools to the right?
<p>I like docking devtools to the right. I remember how happy I was when I first saw that option when I realized I no longer have to split screen and position windows manually.</p> <p>Recent versions of chrome that option seems to be missing. Even on my installs where I already have devtools on the right the option is...
14,387,041
1
3
null
2013-01-17 19:52:14.607 UTC
15
2015-10-22 04:39:45.087 UTC
null
null
null
null
5,056
null
1
112
google-chrome-devtools
22,502
<p>If you click and hold on the icon in the top right next to the close icon (Undock into separate window button), you are given the option to dock it to the right. See screenshot:</p> <p><img src="https://i.imgur.com/fM5wwzU.png" alt="Dock to right"></p> <p>Starting in Chrome 41, you are able to use <kbd>Ctrl</kbd> ...
14,846,920
Collections.emptyMap() vs new HashMap()
<p>What are some of the situations where I can use <code>Collections.emptyMap()</code> ? The Documentation says I can use this method if I want my collection to be immutable. </p> <p><strong>Why would I want an immutable empty collection? What is the point?</strong></p>
14,846,960
9
4
null
2013-02-13 05:23:59.663 UTC
26
2015-06-15 10:49:43.813 UTC
2013-02-14 04:43:05.33 UTC
null
942,391
null
571,718
null
1
156
java|collections
59,421
<p>From <strong>Effective Java</strong>, <strong>Item #43</strong> - <code>"Return empty arrays or collections, not null"</code> demonstrates returning an empty collection and perhaps even demonstrates using these <code>emptyList()</code>, <code>emptySet()</code>, and <code>emptyMap()</code> methods on the Collections...
45,615,621
Spark column string replace when present in other column (row)
<p>I would like to remove strings from <code>col1</code> that are present in <code>col2</code>:</p> <pre><code>val df = spark.createDataFrame(Seq( ("Hi I heard about Spark", "Spark"), ("I wish Java could use case classes", "Java"), ("Logistic regression models are neat", "models") )).toDF("sentence", "label") </code><...
45,615,779
2
0
null
2017-08-10 13:48:44.98 UTC
2
2018-04-23 11:41:39.51 UTC
null
null
null
null
4,666,785
null
1
13
scala|apache-spark|user-defined-functions
50,039
<p>You could simply use <code>regexp_replace</code></p> <pre><code>df5.withColumn("sentence_without_label", regexp_replace($"sentence" , lit($"label"), lit("" ))) </code></pre> <p>or you can use simple udf function as below </p> <pre><code>val df5 = spark.createDataFrame(Seq( ("Hi I heard about Spark", "Spark"), ...
2,743,866
Scala return type for tuple-functions
<p>I want to make a scala function which returns a scala tuple.</p> <p>I can do a function like this:</p> <pre><code>def foo = (1,"hello","world") </code></pre> <p>and this will work fine, but now I want to tell the compiler what I expect to be returned from the function instead of using the built in type inference ...
2,744,040
2
2
null
2010-04-30 10:38:01.89 UTC
6
2017-03-24 19:11:24.437 UTC
2013-08-06 20:39:29.59 UTC
user212218
null
null
238,100
null
1
43
function|scala|types|return|tuples
45,925
<pre><code>def foo : (Int, String, String) = (1, "Hello", "World") </code></pre> <p>The compiler will interpret the type <code>(Int, String, String)</code> as a <code>Tuple3[Int, String, String]</code></p>
1,921,627
Multiple insert/update statements inside trigger?
<p>Just a quick question that no doubt someone out there will know the answer to.</p> <p>I need to be able to do multiple insert/updates within a trigger. Every attempt ends with failure :(</p> <pre><code>DROP TRIGGER IF EXISTS `Insert_Article`// CREATE TRIGGER `Insert_Article` AFTER INSERT ON `Article` FOR EACH ROW...
1,921,657
1
0
null
2009-12-17 13:00:02.767 UTC
8
2009-12-17 13:03:51.927 UTC
null
null
null
null
55,859
null
1
24
mysql|database|triggers
41,381
<p>From the docs: <a href="http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html" rel="noreferrer">Create Trigger Syntax</a></p> <blockquote> <p>trigger_stmt is the statement to execute when the trigger activates. If you want to execute multiple statements, use the BEGIN ... END compound statement con...
21,813,122
Changing content of class using Javascript
<p>I started reading JavaScript in W3schools and testing out/changing few things in the examples they give so I can see what is doing what but didn't manage to identify the syntax, yet.</p> <p>Below is the original code to change p tag content, <em>the <a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_int...
21,813,274
3
0
null
2014-02-16 15:23:12.22 UTC
2
2019-01-31 07:16:13.947 UTC
2019-01-31 07:16:13.947 UTC
null
7,473,844
null
3,104,214
null
1
13
javascript|html|onclick|tags
54,626
<p>Your x - is array of elements. try to use loop:</p> <pre><code>&lt;body&gt; &lt;p class="demo"&gt;JavaScript can change the content of an HTML element.&lt;/p&gt; &lt;p class="demo"&gt;Yolo&lt;/p&gt; &lt;button type="button" onclick="myFunction()"&gt;Click Me!&lt;/button&gt; &lt;script&gt; function...
26,777,083
How to implement REST token-based authentication with JAX-RS and Jersey
<p>I'm looking for a way to enable token-based authentication in Jersey. I am trying not to use any particular framework. Is that possible?</p> <p>My plan is: A user signs up for my web service, my web service generates a token, sends it to the client, and the client will retain it. Then the client, for each request, w...
26,778,123
2
0
null
2014-11-06 10:26:27.133 UTC
574
2021-09-22 20:57:49.053 UTC
2021-09-22 20:57:49.053 UTC
null
2,756,409
null
4,120,466
null
1
503
java|rest|authentication|jax-rs|jersey-2.0
393,793
<h2>How token-based authentication works</h2> <p>In token-based authentication, the client exchanges <em>hard credentials</em> (such as username and password) for a piece of data called <em>token</em>. For each request, instead of sending the hard credentials, the client will send the token to the server to perform aut...
38,610,723
How to insert a pandas dataframe to an already existing table in a database?
<p>I'm using <code>sqlalchemy</code> in pandas to query postgres database and then insert results of a transformation to another table on the same database. But when I do <code>df.to_sql('db_table2', engine)</code> I get this error message: <code>ValueError: Table 'db_table2' already exists.</code> I noticed it want t...
38,610,751
2
0
null
2016-07-27 10:43:23.417 UTC
17
2019-12-24 08:33:28.193 UTC
2018-01-22 21:51:18.19 UTC
null
395,857
null
1,102,806
null
1
52
python|database|pandas|dataframe
115,030
<p>make use of <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_sql.html" rel="noreferrer">if_exists</a> parameter:</p> <pre><code>df.to_sql('db_table2', engine, if_exists='replace') </code></pre> <p>or</p> <pre><code>df.to_sql('db_table2', engine, if_exists='append') </code></pre> ...
40,391,717
react-native-keyboard-aware-scroll-view not working properly
<p>I am trying to use the react-native-keyboard-aware-scroll-view so the keyboard doesn't cover my inputs. </p> <p>For some reason it always thinks there is a keyboard active I guess because it always compresses everything.</p> <p>Attached is a picture of what is happening as well as the code. Any chance anyone has ...
40,410,908
11
0
null
2016-11-02 23:52:25.333 UTC
2
2022-09-11 22:10:31.46 UTC
2016-11-03 00:04:19.96 UTC
null
6,726,798
null
6,726,798
null
1
12
android|ios|user-interface|reactjs|react-native
43,578
<p>I solved this problem by using another lib. Not sure why the react-native-keyboard-aware-scroll-view doesn't work but if you implement the react-native-keyboard-aware-view you shouldn't have any problems. </p> <p><a href="https://www.npmjs.com/package/react-native-keyboard-aware-view" rel="noreferrer">https://ww...
65,985,507
Why shouldn't I use catch() to handle errors in React useEffect API calls?
<p>On this page of the React docs:</p> <p><a href="https://reactjs.org/docs/faq-ajax.html" rel="noreferrer">https://reactjs.org/docs/faq-ajax.html</a></p> <p>A code comment says...</p> <blockquote> <p>Note: it's important to handle errors here instead of a catch() block so that we don't swallow exceptions from actual b...
65,989,940
2
0
null
2021-01-31 23:54:51.563 UTC
5
2021-02-01 13:12:21.697 UTC
2021-02-01 00:06:20.463 UTC
null
6,243,352
null
9,274,894
null
1
33
reactjs|react-hooks|use-effect
8,540
<p>It is a copy-and-paste error of the example's author. The first example uses the component state of a class based component: <code>this.setState()</code> causes a synchronous re-render (or at least this was the case with react v15.0 in 2016, not sure if it holds true today). Therefore the warning comment and the use...
36,095,496
Angular 2: How to write a for loop, not a foreach loop
<p>Using Angular 2, I want to duplicate a line in a template multiple times. Iterating over an object is easy, <code>*ngFor=&quot;let object of objects&quot;</code>. However, I want to run a simple <code>for</code> loop, not a <code>foreach</code> loop. Something like (pseudo-code):</p> <pre><code>{for i = 0; i &lt; 5;...
38,249,801
11
0
null
2016-03-18 22:47:19.253 UTC
9
2022-08-01 14:50:33.42 UTC
2020-10-03 03:58:59.297 UTC
null
3,357,958
null
3,357,958
null
1
83
angular|angular2-template
269,612
<p>You can instantiate an empty array with a given number of entries if you pass an <code>int</code> to the <code>Array</code> constructor and then iterate over it via <code>ngFor</code>.</p> <p><strong>In your component code :</strong></p> <pre><code>export class ForLoop { fakeArray = new Array(12); } </code></pre...
45,842,167
How to use DatePickerDialog in Kotlin?
<p>In Java an DatePickerDialog can be use such as:</p> <pre><code>final Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); DatePickerDialog dpd = new DatePickerDialog(getActivity(),new DatePickerDialog.OnDateSetListener() {...
45,844,018
7
0
null
2017-08-23 14:11:32 UTC
6
2020-06-07 22:05:57.147 UTC
null
null
null
null
8,006,185
null
1
46
kotlin|datepickerdialog
62,209
<p>It would look something like this:</p> <pre><code>val c = Calendar.getInstance() val year = c.get(Calendar.YEAR) val month = c.get(Calendar.MONTH) val day = c.get(Calendar.DAY_OF_MONTH) val dpd = DatePickerDialog(activity, DatePickerDialog.OnDateSetListener { view, year, monthOfYear, dayOfMonth -&gt; // Disp...