Dataset Viewer
Auto-converted to Parquet Duplicate
Id
int64
4
8.51M
PostTypeId
int64
1
7
AcceptedAnswerId
int64
7
75.5M
ParentId
int64
4
41.8M
Score
int64
-208
27.7k
ViewCount
int64
11
12.4M
Body
stringlengths
0
45k
Title
stringlengths
2
150
ContentLicense
stringclasses
3 values
FavoriteCount
int64
0
225
CreationDate
stringlengths
23
23
LastActivityDate
stringlengths
23
23
LastEditDate
stringlengths
23
23
LastEditorUserId
int64
-1
21.3M
OwnerUserId
int64
-1
21.1M
Tags
sequence
7
2
null
4
522
null
An explicit cast to `double` like this isn't necessary: ``` double trans = (double) trackBar1.Value / 5000.0; ``` Identifying the constant as `5000.0` (or as `5000d`) is sufficient: ``` double trans = trackBar1.Value / 5000.0; double trans = trackBar1.Value / 5000d; ```
null
CC BY-SA 4.0
null
2008-07-31T22:17:57.883
2019-10-21T14:03:54.607
2019-10-21T14:03:54.607
5,496,973
9
null
9
1
1,404
null
2,199
784,860
Given a `DateTime` representing a person's birthday, how do I calculate their age in years?
How do I calculate someone's age based on a DateTime type birthday?
CC BY-SA 4.0
0
2008-07-31T23:40:59.743
2023-02-02T18:38:32.613
2022-07-27T22:34:36.320
3,524,942
1
[ "c#", ".net", "datetime" ]
11
1
1,248
null
1,644
197,314
Given a specific `DateTime` value, how do I display relative time, like: - `2 hours ago`- `3 days ago`- `a month ago`
Calculate relative time in C#
CC BY-SA 4.0
0
2008-07-31T23:55:37.967
2022-09-05T11:26:30.187
2022-07-10T00:19:55.237
16,790,137
1
[ "c#", "datetime", "time", "datediff", "relative-time-span" ]
14
1
null
null
491
173,083
What is the difference between [Math.Floor()](http://msdn.microsoft.com/en-us/library/9a6a2sxy.aspx) and [Math.Truncate()](http://msdn.microsoft.com/en-us/library/system.math.truncate.aspx) in .NET?
Difference between Math.Floor() and Math.Truncate()
CC BY-SA 3.0
0
2008-08-01T00:59:11.177
2022-04-22T08:59:43.817
2017-02-25T17:42:17.810
6,495,084
11
[ ".net", "math" ]
6
1
31
null
319
23,465
I have an absolutely positioned `div` containing several children, one of which is a relatively positioned `div`. When I use a `percentage-based width` on the child `div`, it collapses to `0 width` on IE7, but not on Firefox or Safari. If I use `pixel width`, it works. If the parent is relatively positioned, the percen...
Why did the width collapse in the percentage width child element in an absolutely positioned parent on Internet Explorer 7?
CC BY-SA 4.0
0
2008-07-31T22:08:08.620
2021-01-29T18:46:45.963
2021-01-29T18:46:45.963
9,134,576
9
[ "html", "css", "internet-explorer-7" ]
12
2
null
11
347
null
Here's how I do it ``` var ts = new TimeSpan(DateTime.UtcNow.Ticks - dt.Ticks); double delta = Math.Abs(ts.TotalSeconds); if (delta < 60) { return ts.Seconds == 1 ? "one second ago" : ts.Seconds + " seconds ago"; } if (delta < 60 * 2) { return "a minute ago"; } if (delta < 45 * 60) { return ts.Minutes + " minut...
null
CC BY-SA 4.0
null
2008-07-31T23:56:41.303
2020-06-13T10:30:44.397
2020-06-13T10:30:44.397
238,419
1
null
13
1
null
null
701
277,780
Is there a standard way for a web server to be able to determine a user's timezone within a web page? Perhaps from an HTTP header or part of the `user-agent` string?
Determine a user's timezone
CC BY-SA 4.0
0
2008-08-01T00:42:38.903
2022-03-29T07:31:31.320
2020-12-03T03:37:56.313
584,192
9
[ "html", "browser", "timezone", "user-agent", "timezone-offset" ]
4
1
7
null
794
70,633
I want to assign the decimal variable "trans" to the double variable "this.Opacity". ``` decimal trans = trackBar1.Value / 5000; this.Opacity = trans; ``` When I build the app it gives the following error: > Cannot implicitly convert type decimal to double
How to convert Decimal to Double in C#?
CC BY-SA 4.0
0
2008-07-31T21:42:52.667
2022-09-08T05:07:26.033
2022-09-08T05:07:26.033
16,124,033
8
[ "c#", "floating-point", "type-conversion", "double", "decimal" ]
17
1
26
null
198
85,547
How do I store binary data in [MySQL](http://en.wikipedia.org/wiki/MySQL)?
Binary Data in MySQL
CC BY-SA 3.0
0
2008-08-01T05:09:55.993
2020-12-03T03:37:51.763
2020-12-03T03:37:51.763
584,192
2
[ "mysql", "database", "binary-data", "data-storage" ]
24
1
49
null
193
101,180
If I have a trigger before the update on a table, how can I throw an error that prevents the update on that table?
Throw an error preventing a table update in a MySQL trigger
CC BY-SA 4.0
0
2008-08-01T12:12:19.350
2021-01-29T12:57:17.153
2021-01-29T12:57:17.153
14,152,908
22
[ "mysql", "database", "triggers" ]
22
2
null
9
56
null
The best way that I know of because of leap years and everything is: ``` DateTime birthDate = new DateTime(2000,3,1); int age = (int)Math.Floor((DateTime.Now - birthDate).TotalDays / 365.25D); ```
null
CC BY-SA 4.0
null
2008-08-01T12:07:19.500
2020-02-29T01:31:43.697
2020-02-29T01:31:43.697
63,550
17
null
26
2
null
17
143
null
The answer by phpguy is correct but I think there is a lot of confusion in the additional details there. The basic answer is in a `BLOB` data type / attribute domain. is short for Binary Large Object and that column data type is specific for handling binary data. See [the relevant manual page for MySQL](http://dev....
null
CC BY-SA 3.0
null
2008-08-01T12:16:22.167
2016-06-02T05:55:17.060
2016-06-02T05:55:17.060
126,039
48
null
29
2
null
13
205
null
There are no HTTP headers that will report the clients timezone so far although it has been suggested to include it in the HTTP specification. If it was me, I would probably try to fetch the timezone using clientside JavaScript and then submit it to the server using Ajax or something.
null
CC BY-SA 2.5
null
2008-08-01T12:19:17.417
2008-08-01T12:19:17.417
null
null
19
null
31
2
null
6
160
null
The parent `div` needs to have a defined `width`, either in pixels or as a percentage. In Internet Explorer 7, the parent `div` needs a defined `width` for child percentage `div`s to work correctly.
null
CC BY-SA 3.0
null
2008-08-01T12:22:51.593
2016-03-19T06:10:52.170
2016-03-19T06:10:52.170
63,550
null
null
30
2
null
25
45
null
I've had no trouble using the BSD sockets API in C++, in GNU/Linux. Here's the sample program I used: ``` #include <sys/socket.h> int main() { return AF_INET; } ``` So my take on this is that z/OS is probably the complicating factor here, however, because I've never used z/OS before, much less programmed in it,...
null
CC BY-SA 2.5
null
2008-08-01T12:22:40.797
2008-08-01T12:22:40.797
null
null
13
null
16
1
12,446
null
157
87,526
How do you expose a LINQ query as an ASMX web service? Usually, from the business tier, I can return a typed `DataSet` or a `DataTable` which can be serialized for transport over ASMX. How can I do the same for a LINQ query? Is there a way to populate a typed `DataSet` or a `DataTable` via a LINQ query? ``` public st...
Filling a DataSet or a DataTable from a LINQ query result set
CC BY-SA 4.0
0
2008-08-01T04:59:33.643
2021-01-07T14:09:26.367
2021-01-07T14:09:26.367
-1
2
[ "c#", "linq", "web-services", ".net-3.5" ]
27
2
null
11
34
null
@jeff IMHO yours seems a little long. However it does seem a little more robust with support for "yesterday" and "years". But in my experience when this is used, the person is most likely to view the content in the first 30 days. It is only the really hardcore people that come after that. So, I usually elect to keep t...
null
CC BY-SA 4.0
null
2008-08-01T12:17:19.357
2020-07-18T04:19:14.303
2020-07-18T04:19:14.303
10,325,630
17
null
25
1
1,443,907
null
175
15,845
I'm having issues getting the C sockets API to work properly in C++ on z/OS. Although I am including `sys/socket.h`, I still get compile time errors telling me that `AF_INET` is not defined. Am I missing something obvious, or is this related to the fact that being on z/OS makes my problems much more complicated? I disc...
How to use the C socket API in C++ on z/OS
CC BY-SA 4.0
0
2008-08-01T12:13:50.207
2020-12-02T17:23:58.717
2020-12-02T17:23:58.717
792,066
23
[ "c++", "c", "sockets", "mainframe", "zos" ]
34
1
null
null
96
11,240
How do I forcefully unload a `ByteArray` from memory using ActionScript 3? I have tried the following: ``` // First non-working solution byteArray.length = 0; byteArray = new ByteArray(); // Second non-working solution for ( var i:int=0; i < byteArray.length; i++ ) { byteArray[i] = null; } ```
How to unload a ByteArray using Actionscript 3?
CC BY-SA 4.0
0
2008-08-01T12:30:57.630
2022-11-21T06:37:32.257
2020-12-02T17:21:52.303
792,066
null
[ "arrays", "actionscript-3", "apache-flex" ]
42
1
77
null
294
40,275
I am starting a new web application in PHP and this time around I want to create something that people can extend by using a plugin interface. How does one go about writing 'hooks' into their code so that plugins can attach to specific events?
Best way to allow plugins for a PHP application
CC BY-SA 3.0
0
2008-08-01T12:50:18.587
2021-05-29T06:04:39.960
2015-12-14T20:05:51.823
4,595,675
37
[ "php", "plugins", "architecture", "hook" ]
18
2
null
17
59
null
For a table like this: ``` CREATE TABLE binary_data ( id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY, description CHAR(50), bin_data LONGBLOB, filename CHAR(50), filesize CHAR(50), filetype CHAR(50) ); ``` Here is a PHP example: ``` <?php // store.php3 - by Florian Dittmer <dittmer@gmx.ne...
null
CC BY-SA 3.0
null
2008-08-01T05:12:44.193
2016-06-02T05:56:26.060
2016-06-02T05:56:26.060
126,039
null
null
33
2
null
14
559
null
`Math.Floor` rounds down, `Math.Ceiling` rounds up, and `Math.Truncate` rounds towards zero. Thus, `Math.Truncate` is like `Math.Floor` for positive numbers, and like `Math.Ceiling` for negative numbers. Here's the [reference](https://learn.microsoft.com/en-us/dotnet/api/system.math.truncate). For completeness, `Math.R...
null
CC BY-SA 4.0
null
2008-08-01T12:26:39.773
2022-04-22T08:57:37.830
2022-04-22T08:57:37.830
121,309
13
null
39
1
45
null
114
7,992
I am aware that in [.NET](http://en.wikipedia.org/wiki/.NET_Framework) there are three timer types (see [Comparing the Timer Classes in the .NET Framework Class Library](http://msdn.microsoft.com/en-us/magazine/cc164015.aspx)). I have chosen a threaded timer as the other types can drift if the main thread is busy, and ...
Reliable timer in a console application
CC BY-SA 4.0
0
2008-08-01T12:43:11.503
2020-12-10T16:48:40.317
2019-01-20T13:50:37.530
567,854
33
[ "c#", ".net", "vb.net", "timer" ]
51
2
null
36
24
null
Why don't you want to use triggers? They are a good thing if you use them correctly. If you use them as a way to enforce referential integrity that is when they go from good to bad. But if you use them for monitoring, they are not really considered taboo.
null
CC BY-SA 3.0
null
2008-08-01T13:07:52.810
2017-01-26T17:38:44.893
2017-01-26T17:38:44.893
3,735,690
17
null
44
2
null
39
23
null
Consider using a [ManualResetEvent](https://learn.microsoft.com/en-us/dotnet/api/system.threading.manualresetevent) to block the main thread at the end of its processing, and call `Reset()` on it once the timer's processing has finished. If this is something that needs to run continuously, consider moving this into a ...
null
CC BY-SA 4.0
null
2008-08-01T12:55:42.413
2019-12-24T11:07:38.933
2019-12-24T11:07:38.933
806,202
35
null
49
2
null
24
67
null
[Here is one hack](https://web.archive.org/web/20180330233216/http://www.brokenbuild.com/blog/2006/08/15/mysql-triggers-how-do-you-abort-an-insert-update-or-delete-with-a-trigger/) that may work. It isn't clean, but it looks like it might work: Essentially, you just try to update a column that doesn't exist.
null
CC BY-SA 4.0
null
2008-08-01T13:02:51.900
2019-05-15T01:15:24.680
2019-05-15T01:15:24.680
6,083,675
43
null
45
2
null
39
63
null
You can use something like `Console.ReadLine()` to block the main thread, so other background threads (like timer threads) will still work. You may also use an [AutoResetEvent](https://learn.microsoft.com/en-us/dotnet/api/system.threading.autoresetevent) to block the execution, then (when you need to) you can call Set(...
null
CC BY-SA 4.0
null
2008-08-01T12:56:37.920
2019-12-24T10:19:21.920
2019-12-24T10:19:21.920
5,407,188
39
null
36
1
352
null
153
74,269
How can I monitor an SQL Server database for changes to a table without using triggers or modifying the structure of the database in any way? My preferred programming environment is [.NET](http://en.wikipedia.org/wiki/.NET_Framework) and C#. I'd like to be able to support any [SQL Server 2000](http://en.wikipedia.org/...
Check for changes to an SQL Server table?
CC BY-SA 3.0
0
2008-08-01T12:35:56.917
2021-03-06T07:40:44.407
2016-11-30T07:50:37.517
2,571,493
32
[ "sql", "sql-server", "datatable", "rdbms" ]
58
2
null
48
66
null
Change the previous button type into a button like this: ``` <input type="button" name="prev" value="Previous Page" /> ``` Now the button would be the default, plus you could also add the `default` attribute to it so that your browser will highlight it like so: ``` <input type="submit" name="next" value="Next Pa...
null
CC BY-SA 4.0
null
2008-08-01T13:14:30.303
2019-07-14T14:28:03.340
2019-07-14T14:28:03.340
63,550
37
null
48
1
31,910
null
286
251,580
Let's say you create a wizard in an HTML form. One button goes back, and one goes forward. Since the button appears first in the markup when you press , it will use that button to submit the form. Example: ``` <form> <!-- Put your cursor in this field and press Enter --> <input type="text" name="field1" /> ...
Multiple submit buttons in an HTML form
CC BY-SA 4.0
0
2008-08-01T13:01:17.303
2022-07-22T04:53:16.983
2019-07-14T14:18:39.680
63,550
40
[ "html", "forms", "form-submit", "submit-button" ]
59
1
43,110
null
117
26,917
I have a `DataTable` with a `Name` column. I want to generate a collection of the unique names ordered alphabetically. The following query ignores the clause. ``` var names = (from DataRow dr in dataTable.Rows orderby (string)dr["Name"] select (string)dr["Name"]).Distinct(); ``` Why does the `orderby` n...
How do I get a distinct, ordered list of names from a DataTable using LINQ?
CC BY-SA 3.0
0
2008-08-01T13:14:33.797
2019-09-30T08:49:44.503
2018-01-30T16:56:45.910
3,919,949
45
[ "c#", "linq", ".net-3.5" ]
52
2
null
34
19
null
Have a look at this article [http://www.gskinner.com/blog/archives/2006/06/as3_resource_ma.html](http://www.gskinner.com/blog/archives/2006/06/as3_resource_ma.html) IANA actionscript programmer, however the feeling I'm getting is that, because the garbage collector might not run when you want it to. Hence [http://ww...
null
CC BY-SA 2.5
null
2008-08-01T13:08:59.127
2008-08-01T13:08:59.127
null
null
23
null
62
2
null
59
58
null
So your query will need to work like this ``` var names = (from DataRow dr in dataTable.Rows select (string)dr["Name"]).Distinct().OrderBy( name => name ); ```
null
CC BY-SA 3.0
null
2008-08-01T13:18:37.640
2014-08-19T23:17:56.597
2014-08-19T23:17:56.597
1,248,536
45
null
53
2
null
34
24
null
(I'm not positive about this, but...) AS3 uses a non-deterministic garbage collection which means that dereferenced memory will be freed up whenever the runtime feels like it (typically not unless there's a reason to run, since it's an expensive operation to execute). This is the same approach used by most modern garba...
null
CC BY-SA 4.0
null
2008-08-01T13:08:59.487
2020-07-23T22:42:04.643
2020-07-23T22:42:04.643
10,325,630
34
null
66
1
4,521
null
89
5,986
How do you page through a collection in LINQ given that you have a `startIndex` and a `count`?
Paging a collection with LINQ
CC BY-SA 3.0
0
2008-08-01T13:20:46.890
2018-04-08T18:47:49.823
2012-05-04T09:03:54.213
1,039,608
17
[ "linq", ".net-3.5" ]
61
1
null
null
52
4,186
Where can I find a list of all of the MIME types and the identifying characters for files? I have an upload form that is restricting uploads based on the extensions and identifying characters, but I cannot seem to find the types. Can anyone help?
Microsoft Office 2007 file type, Mime types and identifying characters
CC BY-SA 4.0
0
2008-08-01T13:17:20.640
2021-07-28T13:00:55.547
2019-12-16T11:47:55.443
5,044,304
null
[ "mime", "file-type", "office-2007" ]
56
2
null
48
60
null
Give your submit buttons the same name like this: ``` <input type="submit" name="submitButton" value="Previous Page" /> <input type="submit" name="submitButton" value="Next Page" /> ``` When the user presses and the goes to the server, you can check the value for `submitButton` on your server-side code which conta...
null
CC BY-SA 4.0
null
2008-08-01T13:10:16.473
2019-07-14T14:26:23.487
2019-07-14T14:26:23.487
63,550
39
null
60
2
null
34
15
null
Unfortunately when it comes to memory management in there isn't a whole lot you can do. ActionScript was designed to be easy to use (so they didn't want people to have to worry about memory management) The following is a workaround, instead of creating a `ByteArray` variable try this. ``` var byteObject:Object = new...
null
CC BY-SA 3.0
null
2008-08-01T13:14:40.007
2014-07-11T14:58:07.480
2014-07-11T14:58:07.480
2,354,564
41
null
68
2
null
66
65
null
It is very simple with the `Skip` and `Take` extension methods. ``` var query = from i in ideas select i; var paggedCollection = query.Skip(startIndex).Take(count); ```
null
CC BY-SA 3.0
null
2008-08-01T13:22:04.483
2012-05-04T09:04:26.523
2012-05-04T09:04:26.523
1,039,608
17
null
78
2
null
4
68
null
It sounds like `this.Opacity` is a double value, and the compiler doesn't like you trying to cram a decimal value into it.
null
CC BY-SA 3.0
null
2008-08-01T13:53:06.357
2012-10-14T11:54:40.347
2012-10-14T11:54:40.347
967,315
55
null
72
1
null
null
48
2,089
I want to format my existing comments as 'RDoc comments' so they can be viewed using `ri`. What are some recommended resources for starting out using RDoc?
How do I add existing comments to RDoc in Ruby?
CC BY-SA 3.0
null
2008-08-01T13:38:27.133
2016-12-30T06:56:18.310
2016-12-30T06:56:18.310
2,909,897
25
[ "ruby", "rdoc" ]
65
2
null
61
26
null
[Office 2007 MIME Types for IIS](http://www.bram.us/2007/05/25/office-2007-mime-types-for-iis/) - `.docm`- `.docx`- `.dotm`- `.dotx`- `.potm`- `.potx`- `.ppam`- `.ppsm`- `.ppsx`- `.pptm`- `.pptx`- `.xlam`- `.xlsb`- `.xlsm`- `.xlsx`- `.xltm`- `.xltx`
null
CC BY-SA 3.0
null
2008-08-01T13:20:44.283
2017-01-02T03:57:33.723
2017-01-02T03:57:33.723
5,898,312
35
null
76
2
null
42
20
null
I believe the easiest way would be to follow Jeff's own advice and have a look around the existing code. Try looking at WordPress, Drupal, Joomla, and other well-known PHP-based CMS to see how their API hooks look and feel. This way you can even get ideas you may have not thought of previously to make things a little m...
null
CC BY-SA 4.0
null
2008-08-01T13:44:35.843
2021-05-29T06:04:39.960
2021-05-29T06:04:39.960
11,277,894
50
null
73
2
null
25
24
null
@Jax: The `extern "C"` thing matters, very very much. If a header file doesn't have one, then (unless it's a C++-only header file), you would have to enclose your `#include` with it: ``` extern "C" { #include <sys/socket.h> // include other similarly non-compliant header files } ``` Basically, anytime where a C++ pr...
null
CC BY-SA 2.5
null
2008-08-01T13:40:16.443
2008-08-01T13:54:25.510
2008-08-01T13:54:25.510
13
13
null
71
2
null
19
80
null
Here's a general description of a technique for calculating pi that I learnt in high school. I only share this because I think it is simple enough that anyone can remember it, indefinitely, plus it teaches you the concept of "Monte-Carlo" methods -- which are statistical methods of arriving at answers that don't immed...
null
CC BY-SA 3.0
null
2008-08-01T13:37:59.723
2012-05-25T21:09:03.593
2012-05-25T21:09:03.593
63,550
49
null
81
2
null
34
15
null
I believe you have answered your own question. `System.totalMemory` gives you the total amount of memory being "used", not allocated. It is accurate that your application may only be using 20 MB, but it has 5 MB that is free for future allocations. I'm not sure whether the Adobe docs would shed light on the way that it...
null
CC BY-SA 4.0
null
2008-08-01T14:03:22.230
2020-07-24T05:51:27.653
2020-07-24T05:51:27.653
10,325,630
41
null
84
2
null
16
18
null
If you use a return type of `IEnumerable`, you can return your variable directly.
null
CC BY-SA 2.5
null
2008-08-01T14:10:55.757
2008-10-18T18:26:59.070
2008-10-18T18:26:59.070
5,469
60
null
85
1
154
null
131
68,466
What are the best practices around creating flat file database structures in PHP? A lot of more matured PHP flat file frameworks out there which I attempt to implement SQL-like query syntax which is over the top for my purposes in most cases. (I would just use a database at that point). Are there any elegant tricks o...
Flat file databases
CC BY-SA 4.0
0
2008-08-01T14:19:52.510
2022-03-07T02:25:38.080
2019-11-08T09:37:38.317
2,732,762
59
[ "php", "sql", "database", "flat-file" ]
82
2
null
36
16
null
Have a DTS job (or a job that is started by a windows service) that runs at a given interval. Each time it is run, it gets information about the given table by using the system [INFORMATION_SCHEMA](http://msdn.microsoft.com/en-us/library/ms186778.aspx) tables, and records this data in the data repository. Compare the d...
null
CC BY-SA 2.5
null
2008-08-01T14:06:28.560
2008-08-01T14:06:28.560
null
null
51
null
86
2
null
4
148
null
is for monetary calculations to preserve precision. is for scientific calculations that do not get affected by small differences. Since Double is a type that is native to the CPU (internal representation is stored in ), calculations made with Double perform better than Decimal (which is represented in internally).
null
CC BY-SA 4.0
null
2008-08-01T14:23:28.087
2020-12-23T23:14:39.570
2020-12-23T23:14:39.570
14,438,770
39
null
77
2
null
42
168
null
You could use an Observer pattern. A simple functional way to accomplish this: ``` <?php /** Plugin system **/ $listeners = array(); /* Create an entry point for plugins */ function hook() { global $listeners; $num_args = func_num_args(); $args = func_get_args(); if($num_args < 2) trigger...
null
CC BY-SA 4.0
null
2008-08-01T13:46:00.097
2020-02-27T07:45:37.470
2020-02-27T07:45:37.470
-1
40
null
79
1
62,853
null
50
11,396
The version of currently available through Aptana's automatic does not work with the newest version of Subversion. I see on the Subclipse website however that they have 1.4.2 out for Eclipse. So I added a [new remote update site](http://subclipse.tigris.org/update_1.4.x) to my Update manager. When I tried to install...
Getting Subclipse in Aptana to work with the newest release of Subversion
CC BY-SA 3.0
0
2008-08-01T13:56:33.837
2022-12-06T16:26:44.847
2016-03-10T03:47:08.200
415,755
58
[ "eclipse", "svn", "aptana", "subclipse" ]
89
2
null
79
7
null
I've had problems with JavaHL in Eclipse Ganymede, when it worked fine in Eclipse Europa. I'm not sure how Aptana is different, but try either upgrading JavaHL or switching to the pure-java SVNKit implementation within the Subclipse config.
null
CC BY-SA 2.5
null
2008-08-01T14:41:01.110
2008-08-01T14:41:01.110
null
null
null
null
87
2
null
85
13
null
One framework I'm considering would be for a blogging platform. Since just about any possible view of data you would want would be sorted by date, I was thinking about this structure: One directory per content node: ``` ./content/YYYYMMDDHHMMSS/ ``` Subdirectories of each node including ``` /tags /authors /c...
null
CC BY-SA 3.0
null
2008-08-01T14:26:22.793
2015-08-24T17:19:04.537
2015-08-24T17:19:04.537
4,551,041
59
null
93
2
null
88
4
null
From my experience, and from what I've read across the internet, the answer is "No," it is not guaranteed. It depends on CPU speed, operating system, flavor of Linux, etc.
null
CC BY-SA 2.5
null
2008-08-01T14:46:53.097
2008-08-01T15:01:13.003
2008-08-01T15:01:13.003
25
25
null
90
1
1,466,832
null
164
56,334
How do you [branch and merge](http://svnbook.red-bean.com/en/1.8/svn.branchmerge.html) with Apache Subversion using the TortoiseSVN client?
How do you branch and merge with TortoiseSVN?
CC BY-SA 3.0
0
2008-08-01T14:41:24.277
2017-08-24T17:01:23.503
2017-08-24T17:01:23.503
58
58
[ "svn", "tortoisesvn", "branch", "branching-and-merging" ]
92
2
null
90
15
null
[Version Control with Subversion](http://svnbook.red-bean.com/) A very good resource for source control in general. Not really TortoiseSVN specific, though.
null
CC BY-SA 2.5
null
2008-08-01T14:45:37.403
2008-08-01T14:45:37.403
null
null
61
null
80
1
124
null
54
6,530
I've written a database generation script in [SQL](http://en.wikipedia.org/wiki/SQL) and want to execute it in my [Adobe AIR](http://en.wikipedia.org/wiki/Adobe_Integrated_Runtime) application: ``` Create Table tRole ( roleID integer Primary Key ,roleName varchar(40) ); Create Table tFile ( fileID integer ...
SQLStatement.execute() - multiple queries in one statement
CC BY-SA 3.0
0
2008-08-01T13:57:07.033
2018-08-27T01:12:05.427
2017-04-28T13:42:44.903
3,641,067
26
[ "apache-flex", "actionscript-3", "air" ]
98
2
null
88
63
null
Maybe. But you have bigger problems. `gettimeofday()` can result in incorrect timings if there are processes on your system that change the timer (ie, ntpd). On a "normal" linux, though, I believe the resolution of `gettimeofday()` is 10us. It can jump forward and backward and time, consequently, based on the processes...
null
CC BY-SA 3.0
null
2008-08-01T14:53:47.497
2012-10-14T12:28:51.043
2012-10-14T12:28:51.043
967,315
2,089,740
null
88
1
98
null
106
44,472
I am porting a game, that was originally written for the Win32 API, to Linux (well, porting the OS X port of the Win32 port to Linux). I have implemented `QueryPerformanceCounter` by giving the uSeconds since the process start up: ``` BOOL QueryPerformanceCounter(LARGE_INTEGER* performanceCount) { gettimeofd...
Is gettimeofday() guaranteed to be of microsecond resolution?
CC BY-SA 4.0
0
2008-08-01T14:36:18.640
2020-02-24T11:08:48.197
2020-02-24T11:08:48.197
7,014,431
61
[ "linux", "winapi", "visual-c++", "unix", "timer" ]
107
2
null
104
13
null
I guess in a managed environment, a leak would be you keeping an unnecessary reference to a large chunk of memory around.
null
CC BY-SA 2.5
null
2008-08-01T15:19:25.900
2008-08-01T15:19:25.900
null
null
61
null
103
2
null
13
57
null
JavaScript is the easiest way to get the client's local time. I would suggest using an [XMLHttpRequest](http://en.wikipedia.org/wiki/XMLHttpRequest) to send back the local time, and if that fails, fall back to the timezone detected based on their IP address. As far as geolocation, I've used [MaxMind GeoIP](http://www....
null
CC BY-SA 4.0
null
2008-08-01T15:11:59.987
2018-10-13T13:07:16.667
2018-10-13T13:07:16.667
63,550
72
null
104
1
112
null
181
14,970
In .NET perspective: - [memory leak](https://en.wikipedia.org/wiki/Memory_leak)- - - -
Anatomy of a "Memory Leak"
CC BY-SA 4.0
0
2008-08-01T15:12:34.837
2018-06-08T15:37:29.390
2018-06-08T15:37:29.390
6,296,561
39
[ ".net", "performance", "memory-leaks", "com-interop" ]
111
2
null
108
39
null
I have been using the 64Bit version of TortoiseSVN for ages and I have never had issues with it on Windows 64Bit or Vista 64Bit. I am currently not aware of any other similiar SVN clients that do work on Vista. Is it possible the problem could lie within the configuration of TortoiseSVN or even the installation of Vist...
null
CC BY-SA 2.5
null
2008-08-01T15:27:23.093
2008-08-01T15:27:23.093
null
null
146,270
null
110
2
null
104
7
null
I will concur with Bernard as to in .net what a mem leak would be. You could profile your application to see its memory use, and determine that if its managing a lot of memory when it should not be you could say it has a leak. In managed terms I will put my neck on the line to say it does go away once the process is ...
null
CC BY-SA 3.0
null
2008-08-01T15:23:33.817
2015-11-30T21:14:09.740
2015-11-30T21:14:09.740
3,393,505
36
null
114
2
null
108
11
null
TortoiseSVN in combination with VisualSVN for Visual Studio.
null
CC BY-SA 3.0
null
2008-08-01T15:32:42.473
2013-11-07T16:52:15.250
2013-11-07T16:52:15.250
761,095
17
null
113
2
null
108
9
null
I'll second Diago's answer. I use TortoiseSVN on Vista x64 pretty heavily. I did upgrade directly from an older version to 1.5.2 though, and never used 1.5.1. Have you tried 1.5.2?
null
CC BY-SA 2.5
null
2008-08-01T15:32:11.337
2008-08-01T15:32:11.337
null
null
60
null
108
1
111
null
52
16,402
I've been using [TortoiseSVN](https://web.archive.org/web/20200229173754/http://tortoisesvn.tigris.org/) in a Windows environment for quite some time. It seems very feature-complete and nicely integrated into the Windows shell, and more importantly, it's fairly painless to teach to colleagues with little or no experie...
Best Subversion clients for Windows Vista (64bit)
CC BY-SA 4.0
0
2008-08-01T15:22:29.467
2020-05-25T17:18:11.487
2020-05-25T17:18:11.487
11,262,648
72
[ "windows", "svn", "64-bit" ]
116
2
null
108
6
null
I too get explorer crashes in Vista (I'm not in the 64Bit version though). I'm using Vista Super Saijen (or whatever they are calling the most expensive version). I'm not having any bugs with Tortoise. My explorer does, however, crash about every other day (sometimes multiple times a day if it's having an "off" day). ...
null
CC BY-SA 2.5
null
2008-08-01T15:34:43.873
2008-08-01T15:34:43.873
null
null
58
null
123
1
183
null
119
80,344
Is there an existing application or library in which will allow me to convert a `CSV` data file to `XML` file? The `XML` tags would be provided through possibly the first row containing column headings.
Java lib or app to convert CSV to XML file?
CC BY-SA 3.0
0
2008-08-01T16:08:52.353
2020-05-25T10:02:32.633
2015-10-27T09:34:09.503
2,553,431
78
[ "java", "xml", "csv", "data-conversion" ]
120
1
null
null
45
2,097
Does anyone have experience creating SQL-based ASP.NET site-map providers? I have the default XML file `web.sitemap` working properly with my Menu and SiteMapPath controls, but I'll need a way for the users of my site to create and modify pages dynamically. I need to tie page viewing permissions into the standard `AS...
ASP.NET Site Maps
CC BY-SA 4.0
0
2008-08-01T15:50:08.537
2020-09-21T19:13:30.407
2020-01-06T23:17:24.307
1,578,983
83
[ "sql", "asp.net", "xml", "sitemap" ]
19
1
531
null
351
67,439
I'm looking for the fastest way to obtain the value of π, as a personal challenge. More specifically, I'm using ways that don't involve using `#define` constants like `M_PI`, or hard-coding the number in. The program below tests the various ways I know of. The inline assembly version is, in theory, the fastest option,...
What is the fastest way to get the value of π?
CC BY-SA 4.0
0
2008-08-01T05:21:22.257
2022-10-19T20:48:46.340
2019-05-15T01:33:48.730
3,768,871
13
[ "performance", "algorithm", "language-agnostic", "unix", "pi" ]
99
2
null
88
9
null
> The actual resolution of gettimeofday() depends on the hardware architecture. Intel processors as well as SPARC machines offer high resolution timers that measure microseconds. Other hardware architectures fall back to the system’s timer, which is typically set to 100 Hz. In such cases, the time resolution will be le...
null
CC BY-SA 3.0
null
2008-08-01T14:55:08.477
2017-09-12T18:12:53.697
2017-09-12T18:12:53.697
6,761,181
25
null
124
2
null
80
20
null
I wound up using this. It is a kind of a hack, but it actually works pretty well. The only thing is you have to be very careful with your semicolons. : D ``` var strSql:String = stream.readUTFBytes(stream.bytesAvailable); var i:Number = 0; var strSqlSplit:Array = strSql.split(";"); for (i = 0; i < strSqlSplit....
null
CC BY-SA 4.0
null
2008-08-01T16:09:47.687
2018-08-27T01:12:05.427
2018-08-27T01:12:05.427
8,708,364
26
null
127
2
null
126
65
null
This has religious war potential, but it seems to me that if you're using a getter/setter, you should use it internally as well - using both will lead to maintenance problems down the road (e.g. somebody adds code to a setter that to run every time that property is set, and the property is being set internally w/o tha...
null
CC BY-SA 2.5
null
2008-08-01T16:13:47.600
2008-08-01T16:32:17.110
2008-08-01T16:32:17.110
35
35
null
128
2
null
126
20
null
It depends on how the property is used. For example, say you have a student object that has a name property. You could use your Get method to pull the name from the database, if it hasn't been retrieved already. This way you are reducing unnecessary calls to the database. Now let's say you have a private integer count...
null
CC BY-SA 2.5
null
2008-08-01T16:19:04.283
2008-08-01T16:19:04.283
null
null
26
null
133
2
null
123
4
null
This may be too basic or limited of a solution, but couldn't you do a [String.split()](https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split(java.lang.String)) on each line of the file, remembering the result array of the first line to generate the XML, and just spit each line's array data out with the ...
null
CC BY-SA 4.0
null
2008-08-01T16:31:43.430
2020-05-25T10:02:32.633
2020-05-25T10:02:32.633
11,262,648
59
null
135
2
null
129
8
null
Rolling your own PHP solution will certainly work though I'm not sure if there is a good way to automatically duplicate the schema from one DB to the other (maybe this was your question). If you are just copying data, and/or you need custom code anyway to convert between modified schemas between the two DB's, I would ...
null
CC BY-SA 2.5
null
2008-08-01T16:36:42.080
2008-08-01T16:36:42.080
null
null
72
null
129
1
null
null
90
96,578
I've been banging my head against `SQL Server 2005` trying to get a lot of data out. I've been given a database with nearly 300 tables in it and I need to turn this into a MySQL database. My first call was to use bcp but unfortunately it doesn't produce valid CSV - strings aren't encapsulated, so you can't deal with ...
How to export data from SQL Server 2005 to MySQL
CC BY-SA 3.0
0
2008-08-01T16:22:42.420
2020-07-29T02:35:05.697
2015-10-10T10:25:12.217
4,800,955
48
[ "mysql", "sql-server", "csv", "sql-server-2005", "bcp" ]
141
2
null
129
6
null
Another tool to try would be the [SQLMaestro suite](http://www.sqlmaestro.com). It is a little tricky nailing down the precise tool, but they have a variety of tools, both free and for purchase that handle a wide variety of tasks for multiple database platforms. I'd suggest trying the Data Wizard tool first for MySQL, ...
null
CC BY-SA 4.0
null
2008-08-01T16:47:54.927
2020-07-29T01:51:50.080
2020-07-29T01:51:50.080
10,325,630
71
null
109
1
2,585
null
68
6,074
Recently our site has been deluged with the resurgence of the [Asprox botnet](https://en.wikipedia.org/wiki/Asprox_botnet) [SQL injection](http://en.wikipedia.org/wiki/SQL_injection) attack. Without going into details, the attack attempts to execute SQL code by encoding the [T-SQL](http://en.wikipedia.org/wiki/Transact...
Decoding T-SQL CAST in C#/VB.NET
CC BY-SA 4.0
null
2008-08-01T15:23:05.190
2019-02-10T22:11:00.017
2019-01-20T13:49:56.720
567,854
71
[ "c#", "sql", "vb.net", "ascii", "hex" ]
139
2
null
126
14
null
> Am I just going overboard here? Perhaps ;) Another approach would be to utilize a private/protected method to actually do the getting (caching/db/etc), and a public wrapper for it that increments the count: PHP: ``` public function getName() { $this->incrementNameCalled(); return $this->_getName(); } pro...
null
CC BY-SA 2.5
null
2008-08-01T16:43:30.880
2008-08-01T16:43:30.880
null
null
72
null
142
2
null
126
6
null
Well, it seems with C# 3.0 properties' default implementation, the decision is taken for you; you HAVE to set the property using the (possibly private) property setter. I personally only use the private member-behind when not doing so would cause the object to fall in an less than desirable state, such as when initial...
null
CC BY-SA 2.5
null
2008-08-01T16:56:55.830
2008-08-01T16:56:55.830
null
null
42
null
143
2
null
126
5
null
As stated in some of the comments: Sometimes you should, sometimes you shouldn't. The great part about private variables is that you are able to see all the places they are used when you change something. If your getter/setter does something you need, use it. If it doesn't matter you decide. The opposite case could be...
null
CC BY-SA 2.5
null
2008-08-01T17:01:27.240
2008-08-01T17:01:27.240
null
null
86
null
145
1
null
null
60
5,254
Does anyone know of a good way to compress or decompress files and folders in C# quickly? Handling large files might be necessary.
Compressing / Decompressing Folders & Files
CC BY-SA 3.0
0
2008-08-01T17:13:08.933
2020-03-18T11:24:20.170
2018-12-25T14:13:03.880
9,752,662
87
[ "c#", ".net", "file", "compression" ]
134
1
206
null
39
1,433
I have a pretty standard table set-up in a current application using the [.NET](https://en.wikipedia.org/wiki/.NET_Framework) [XSD](https://en.wikipedia.org/wiki/XML_Schema_%28W3C%29) `DataSet` and `TableAdapter` features. My `contracts` table consists of some standard contract information, with a column for the `prima...
XSD DataSets and ignoring foreign keys
CC BY-SA 4.0
null
2008-08-01T16:33:38.183
2019-06-01T01:56:45.287
2019-06-01T01:56:45.287
10,221,765
71
[ ".net", "database", "xsd" ]
151
2
null
145
22
null
I've always used the SharpZip Library. [Here's a link](http://sharpdevelop.net/OpenSource/SharpZipLib/Download.aspx)
null
CC BY-SA 3.0
null
2008-08-01T17:30:56.277
2012-12-04T20:29:28.010
2012-12-04T20:29:28.010
1,525,840
44
null
148
2
null
146
7
null
Is the play link a link to the actual mp3 file or to some javascript code that pops up a player? If the latter, you can easily add your own logging code in there to track the number of hits to it. If the former, you'll need something that can track the web server log itself and make that distinction. My hosting plan...
null
CC BY-SA 2.5
null
2008-08-01T17:24:24.290
2008-08-01T17:24:24.290
null
null
71
null
149
2
null
145
10
null
As of .Net 1.1 the only available method is reaching into the java libraries. [Using the Zip Classes in the J# Class Libraries to Compress Files and Data with C#](https://learn.microsoft.com/en-us/archive/msdn-magazine/2003/june/using-jsharp-class-libraries-to-compress-files-and-data-with-csharp) Not sure if this has...
null
CC BY-SA 4.0
null
2008-08-01T17:28:24.253
2019-12-24T08:08:12.950
2019-12-24T08:08:12.950
951,001
80
null
147
2
null
42
36
null
The and method is the most commonly used, but there are other things you can do. Depending on the size of your app, and who your going to allow see the code (is this going to be a FOSS script, or something in house) will influence greatly how you want to allow plugins. kdeloach has a nice example, but his implement...
null
CC BY-SA 2.5
null
2008-08-01T17:23:43.777
2008-08-01T17:23:43.777
null
null
146,637
null
153
2
null
146
13
null
You could even set up an Apache .htaccess directive that converts *.mp3 requests into the querystring dubayou is working with. It might be an elegant way to keep the direct request and still be able to slipstream log function into the response.
null
CC BY-SA 2.5
null
2008-08-01T17:42:04.723
2008-08-01T17:42:04.723
null
null
59
null
126
1
127
null
105
23,701
What is the "purist" or "correct" way to access an object's properties from within an object method that is not a getter/setter method? I know that from outside of the object you should use a getter/setter, but from within would you just do: Java: ``` String property = this.property; ``` PHP: ``` $property = $thi...
How would you access Object properties from within an object method?
CC BY-SA 2.5
0
2008-08-01T16:10:30.337
2021-07-04T20:26:15.617
2010-01-20T08:27:13.130
202,431
58
[ "java", "php", "oop", "theory" ]
146
1
152
null
89
21,381
I have a website that plays mp3s in a flash player. If a user clicks 'play' the flash player automatically downloads an mp3 and starts playing it. Is there an easy way to track how many times a particular song clip (or any binary file) has been downloaded? --- > Is the play link a link to the actual mp3 file o...
How do I track file downloads
CC BY-SA 4.0
0
2008-08-01T17:14:58.337
2020-07-29T02:40:25.280
2019-06-04T09:25:21.993
6,556,397
30
[ "php", "apache", "logging", "download", "analytics" ]
155
2
null
108
8
null
I used to have lots of Explorer crashes (on 32-bit) caused by Tortoise. They seem to have gone away since I used the Include/Exclude path settings in the "Icon Overlays" configuration of TSVN. Constraining icon overlays to specific directories where I keep my source made this much more stable.
null
CC BY-SA 2.5
null
2008-08-01T17:47:54.727
2008-08-01T17:47:54.727
null
null
9
null
112
2
null
104
112
null
The best explanation I've seen is in Chapter 7 of the free [Foundations of Programming e-book](http://codebetter.com/karlseguin/2008/06/25/foundations-of-programming-ebook/). Basically, in a memory leak occurs when referenced objects are rooted and thus cannot be garbage collected. This occurs accidentally when you h...
null
CC BY-SA 4.0
null
2008-08-01T15:28:12.543
2018-05-14T20:34:56.370
2018-05-14T20:34:56.370
7,232,508
34
null
158
2
null
146
30
null
Use your httpd log files. Install [http://awstats.sourceforge.net/](http://awstats.sourceforge.net/)
null
CC BY-SA 3.0
null
2008-08-01T17:51:55.407
2012-05-07T01:43:59.980
2012-05-07T01:43:59.980
null
70
null
160
2
null
129
59
null
The best way that I have found is the [MySQL Migration Toolkit](http://www.mysql.com/products/tools/migration-toolkit/) provided by MySQL. I have used it successfully for some large migration projects.
null
CC BY-SA 2.5
null
2008-08-01T17:54:08.163
2008-08-01T17:54:08.163
null
null
17
null
163
1
170
null
101
9,425
Stack Overflow has a subversion version number at the bottom: > svn revision: 679 I want to use such automatic versioning with my `.NET Web Site/Application`, Windows Forms, WPD projects/solutions. How do I implement this?
How do I sync the SVN revision number with my ASP.NET web site?
CC BY-SA 3.0
0
2008-08-01T18:00:13.830
2020-05-25T03:59:07.680
2015-12-29T06:27:21.560
3,787,519
83
[ ".net", "asp.net", "svn", "versioning" ]
154
2
null
85
81
null
Well, what is the nature of the flat databases. Are they large or small. Is it simple arrays with arrays in them? if its something simple say userprofiles built as such: ``` $user = array("name" => "bob", "age" => 20, "websites" => array("example.com","bob.example.com","bob2.example.com"...
null
CC BY-SA 4.0
null
2008-08-01T17:45:06.513
2022-03-07T02:25:38.080
2022-03-07T02:25:38.080
146,637
146,637
null
152
2
null
146
43
null
The funny thing is I wrote a php media gallery for all my musics 2 days ago. I had a similar problem. I'm using [http://musicplayer.sourceforge.net/](http://musicplayer.sourceforge.net/) for the player. And the playlist is built via php. All music requests go to a script called xfer.php?file=WHATEVER ``` $filename = b...
null
CC BY-SA 4.0
null
2008-08-01T17:33:58.750
2020-07-29T02:40:25.280
2020-07-29T02:40:25.280
10,325,630
146,637
null
End of preview. Expand in Data Studio

YAML Metadata Warning:The task_categories "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other

StackOverflow Posts Markdown

StackOverflow Logo

Dataset Summary

This dataset contains all posts submitted to StackOverflow before the 14th of June 2023 formatted as Markdown text.
The dataset contains ~60 Million posts, totaling ~35GB in size and ~65 billion characters of text.
The data is sourced from Internet Archive StackExchange Data Dump.

Dataset Structure

Each record corresponds to one post of a particular type. Original ordering from the data dump is not exactly preserved due to parallelism in the script used to process the data dump. The markdown content of each post is contained in the Body field. The license for a particular post is contained in the ContentLicense field.

Data Fields

{
  Id: long,
  PostTypeId: long, // 1=Question, 2=Answer, 3=Orphaned tag wiki, 4=Tag wiki excerpt, 5=Tag wiki, 6=Moderator nomination, 7=Wiki Placeholder, 8=Privilige Wiki
  AcceptedAnswerId: long | null, // only present if PostTypeId=1
  ParentId: long | null, // only present if PostTypeId=2
  Score: long,
  ViewCount: long | null,
  Body: string | null,
  Title: string | null,
  ContentLicense: string | null,
  FavoriteCount: long | null,
  CreationDate: string | null,
  LastActivityDate: string | null,
  LastEditDate: string | null,
  LastEditorUserId: long | null,
  OwnerUserId: long | null,
  Tags: array<string> | null
}

Also consider the StackExchange Datadump Schema Documentation, as all fields have analogs in the original dump format.

How to use?

from datasets import load_dataset

# predownload full dataset
ds = load_dataset('mikex86/stackoverflow-posts', split='train')

# dataset streaming (will only download the data as needed)
ds = load_dataset('mikex86/stackoverflow-posts', split='train', streaming=True)

for sample in iter(ds): print(sample["Body"])

How is the text stored?

The original Data Dump formats the "Body" field as HTML, using tags such as <code>, <h1>, <ul>, etc. This HTML format has been converted to Markdown.

Markdown format

For reference, this post on StackOverflow is formatted as follows:

Title: Make React useEffect hook not run on initial render

According to the docs:

​> `componentDidUpdate()` is invoked immediately after updating occurs. This method is not called for the initial render.

We can use the new `useEffect()` hook to simulate `componentDidUpdate()`, but it seems like `useEffect()` is being ran after every render, even the first time. How do I get it to not run on initial render?

As you can see in the example below, `componentDidUpdateFunction` is printed during the initial render but `componentDidUpdateClass` was not printed during the initial render.

​`​`​`
function ComponentDidUpdateFunction() {
  const [count, setCount] = React.useState(0);
  React.useEffect(() => {
    console.log(""componentDidUpdateFunction"");
  });

  return (
    <div>
      <p>componentDidUpdateFunction: {count} times</p>
      <button
        onClick={() => {
          setCount(count + 1);
        }}
      >
        Click Me
      </button>
    </div>
  );
}
​`​`​`

rest of the post omitted for brevity

Details on the HTML to Markdown conversion

Using Jsoup, the original Body field was converted into a Jsoup Document. The child nodes (has special meaning in context of Jsoup) of this document were recursively traversed in a depth-first order.

Jsoup defines .text() as follows:

... the normalized, combined text of this element and all its children. Whitespace is normalized and trimmed. For example, given HTML <p>Hello <b>there</b> now! </p>, p.text() returns "Hello there now!"

Jsoup defines a Node as follows:

The base, abstract Node model. Elements, Documents, Comments etc are all Node instances.

Additionally the existence of the TextNode should be noted, which represents floating text inside an HTML document that is not itself an HTML element. Thus this text tag <p>Hello<code>World</code></p> would have two Jsoup child nodes TextNode(value="Hello") and Element(tag="code", value="World"). The value field of a TextNode contains the free standing text without any further treatment (no whitespace stripping, etc.)

Traversing Rules

  • When ecountering a html tag for which a rule exists, children are not further traversed, unless explicitly stated otherwise.

  • When encountering an <a> tag, [${element.text()}](${element.attr("href")}) is emitted.

  • When encountering an <h1> tag, \n# ${element.text()}\n\n is emitted.

  • When encountering an <h2> tag, \n## ${element.text()}\n\n is emitted.

  • When encountering an <h3> tag, \n### ${element.text()}\n\n is emitted.

  • When encountering an <h4> tag, \n#### ${element.text()}\n\n is emitted.

  • When encountering an <h5> tag, \n##### ${element.text()}\n\n is emitted.

  • When encountering an <h6> tag, \n###### ${element.text()}\n\n is emitted.

  • When encountering a <code> tag, `${element.text()}`is emitted

  • When encountering a <pre> tag and said element has a <code> child tag, ​`​`​`\n${element.text()}`\n​`​`​`\n is emitted.

  • When encountering a <pre> tag and said element does not have a <code> child tag, children are traversed further.

  • When encountering an <li> tag, - is emitted and children are traversed further.

  • When encountering a <blockquote> tag, > is emitted and children are traversed further.

  • When encountering an <hr> tag, \n---\n\n is emitted

  • When encountering an <img> tag, ![${element.attr("alt")}](${element.attr("src")}) is emitted.

  • When encountering a <table> tag

    • \n| is emitted
    • For each element of element.select("th")
      • ${element.text()} | is emitted
    • After the loop \n| is emitted
    • For each element of element.select("th")
      • For each character of the th.text()
        • - is emitted
      • After the loop over each character of th | is emitted
    • \n is emitted
    • For each element of element.select("tr") with more than one children of tag type td
      • | is emitted
      • For each element of element.select("td")
        • ${td.text()} | is emitted
      • After the loop over <td> elements, \n is emitted
    • After the loop over <tr> elements, \n is emitted
  • When encountering a jsoup TextNode, ${node.attr(node.nodeName())} (which is equivalent to accessing the private field node.value) is emitted.

Downloads last month
2,914

Space using mikex86/stackoverflow-posts 1