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 stringdate 2008-07-31 21:42:52 2011-12-14 18:48:47 | LastActivityDate stringdate 2008-08-01 12:19:17 2023-03-05 04:40:26 | LastEditDate stringdate 2008-08-01 13:54:25 2023-03-05 03:12:45 ⌀ | LastEditorUserId int64 -1 21.3M ⌀ | OwnerUserId int64 -1 21.1M ⌀ | Tags listlengths 1 6 ⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7,275 | 2 | null | 7,272 | 2 | null | [The Sieve of Eratosthenes](http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes) is a decent algorithm:
>
1. Take the list of positive integers 2 to any given Ceiling.
2. Take the next item in the list (2 in the first iteration) and remove all multiples of it (beyond the first) from the list.
3. Repeat step two until ... | null | CC BY-SA 2.5 | null | 2008-08-10T18:17:41.770 | 2008-08-10T18:30:02.133 | 2008-08-10T18:30:02.133 | 145 | 145 | null |
7,280 | 2 | null | 7,277 | -1 | null | Yes, I think using a [CDATA](http://en.wikipedia.org/wiki/CDATA) block would protect the whitespace. Although some parser APIs allow you to preserve whitespace.
| null | CC BY-SA 2.5 | null | 2008-08-10T18:26:24.590 | 2008-08-10T18:26:24.590 | null | null | 758 | null |
7,271 | 2 | null | 5,727 | 12 | null | The complexities of pointers go beyond what we can easily teach. Having students point to each other and using pieces of paper with house addresses are both great learning tools. They do a great job of introducing the basic concepts. Indeed, learning the basic concepts is to successfully using pointers. However, i... | null | CC BY-SA 2.5 | null | 2008-08-10T18:09:16.887 | 2008-08-10T18:09:16.887 | null | null | 872 | null |
7,283 | 2 | null | 5,727 | 2 | null | I don't think that pointers themselves are confusing. Most people can understand the concept. Now how many pointers can you think about or how many levels of indirection are you comfortable with. It doesn't take too many to put people over the edge. The fact that they can be changed accidently by bugs in your progr... | null | CC BY-SA 2.5 | null | 2008-08-10T18:39:07.763 | 2008-08-10T18:39:07.763 | null | null | 791 | null |
7,274 | 2 | null | 7,252 | 128 | null | This is one of to do. Getting your people to .
Sometimes one of the best ways to help junior level programmers 'get it' and learn the right techniques from the seniors is to do a bit of pair programming.
Try this: on an upcoming project, pair the junior guy up with yourself or another senior programmer. They shoul... | null | CC BY-SA 3.0 | null | 2008-08-10T18:17:34.983 | 2015-07-01T14:40:36.170 | 2015-07-01T14:40:36.170 | 363,573 | 92 | null |
7,276 | 2 | null | 7,252 | 1 | null | If your colleague lacks experience writing tests maybe he or she is having difficulty testing beyond simple situations, and that is manifesting itself as inadequate testing. Here's what I would try:
- - - -
I wouldn't especially emphasize the shame/guilt factor. It is worth pointing out that testing is a widely adop... | null | CC BY-SA 2.5 | null | 2008-08-10T18:19:17.727 | 2008-08-10T18:19:17.727 | null | null | 878 | null |
7,284 | 1 | 7,320 | null | 685 | 287,095 | What does the expression "Turing Complete" mean?
Can you give a simple explanation, without going into too many theoretical details?
| What is Turing Complete? | CC BY-SA 3.0 | 0 | 2008-08-10T18:41:02.300 | 2023-01-25T07:25:55.780 | 2023-01-25T07:25:55.780 | 116 | 198 | [
"language-agnostic",
"theory",
"turing-machines",
"turing-complete"
] |
7,282 | 2 | null | 7,277 | 2 | null | I think the only real problem is that it makes the XML harder to read. e.g.
```
<Something>
<Contains>
<An>
<Address>15 Sample St
Example Bay
Some Country</Address>
</An>
</Contains>
</Something>
```
If pretty XML isn't a concern, I'd probably not worry about it, so long as it's ... | null | CC BY-SA 2.5 | null | 2008-08-10T18:29:36.380 | 2008-08-10T19:16:33.320 | 2008-08-10T19:16:33.320 | 872 | 872 | null |
7,277 | 1 | 7,292 | null | 8 | 4,196 | I'm generating some XML documents and when it comes to the address part I have fragments that look like this:
```
<Address>15 Sample St
Example Bay
Some Country</Address>
```
The XSLT that I have for converting this to XHTML has some funky recursive template to convert newline characters within strings to <br/> tags... | Is it "bad practice" to be sensitive to linebreaks in XML documents? | CC BY-SA 2.5 | 0 | 2008-08-10T18:20:38.130 | 2015-12-15T19:49:00.210 | 2008-09-26T20:20:08.893 | 2,134 | 755 | [
"xml",
"xslt",
"xhtml",
"whitespace",
"line-breaks"
] |
7,281 | 2 | null | 7,272 | 2 | null | For a given integer, the fastest primality check I know is:
>
1. Take a list of 2 to the square root of the integer.
2. Loop through the list, taking the remainder of the integer / current number If the remainder is zero for any number in the list, then the integer is not prime. If the remainder was non-zero for all ... | null | CC BY-SA 2.5 | null | 2008-08-10T18:26:43.063 | 2008-08-10T18:26:43.063 | null | null | 145 | null |
7,285 | 2 | null | 7,277 | 1 | null | It depends on how you're reading and writing the XML.
If XML is being generated automatically - if newlines or explicit flags are being parsed into - then there's nothing to worry about. Your input likely doesn't have any other XML in it so it's just cleaner to not mess with XML at all.
If tags are being worked wi... | null | CC BY-SA 2.5 | null | 2008-08-10T18:43:21.220 | 2008-08-10T18:43:21.220 | null | null | 853 | null |
7,287 | 1 | 7,296 | null | 9 | 1,947 | Lately I had to change some code on older systems where not all of the code has unit tests.
Before making the changes I want to write tests, but each class created a lot of dependencies and other anti-patterns which made testing quite hard.
Obviously, I wanted to refactor the code to make it easier to test, write the t... | How do you test/change untested and untestable code? | CC BY-SA 3.0 | 0 | 2008-08-10T18:49:53.920 | 2022-12-14T22:00:01.027 | 2016-03-07T16:52:14.380 | 233,076 | 573 | [
"unit-testing",
"refactoring",
"legacy"
] |
7,299 | 2 | null | 7,190 | 0 | null | Microsoft loosened it's constraint on the Testing Platform by including it in Visual Studio 2008 Professional and allowing for the tests to be run from the command line with Framework 3.5 installed. We did a crossover for a client recently and so far they have been able to run all the tests without the need for NUnit.
| null | CC BY-SA 2.5 | null | 2008-08-10T19:35:18.010 | 2008-08-10T19:35:18.010 | null | null | 146,270 | null |
7,298 | 2 | null | 7,211 | 6 | null | I've had to do similar things a few times. The easiest approach for me has been to write a script that pulls from one data source and produces an output for the new data source. Just do a `SELECT *` query for each table in your current database, and then dump all the rows into an `INSERT INTO` query for your new data... | null | CC BY-SA 2.5 | null | 2008-08-10T19:25:58.200 | 2008-08-10T19:25:58.200 | null | null | 872 | null |
7,302 | 2 | null | 7,180 | 0 | null | Silverlight is the answer and Moonlight will be the linux equivalent and available shortly. We have done some beta testing on moonlight and found it fairly stable at with most of the Silverlight work we do.
| null | CC BY-SA 2.5 | null | 2008-08-10T19:38:34.133 | 2008-08-10T19:38:34.133 | null | null | 146,270 | null |
7,303 | 2 | null | 7,174 | 2 | null | The SharePoint team is currently working on MOSS extensions for VS 2008 which will allow this type of functionality. This was available in VS 2005 with MOSS extensions, but has to be run off Windows Server with a full MOSS installation and the correct permissions set.
| null | CC BY-SA 2.5 | null | 2008-08-10T19:41:26.890 | 2008-08-10T19:41:26.890 | null | null | 146,270 | null |
7,300 | 2 | null | 7,277 | -1 | null | What you really should be doing is converting your XML to a format that preserves white-space.
So rather than seek to replace \n with <br /> you should wrap the whole block in a <pre>
That way, your address is functionally preserved (whether you include line breaks or not) and the XSTL can choose whether to preserve ... | null | CC BY-SA 2.5 | null | 2008-08-10T19:36:55.557 | 2008-08-10T19:36:55.557 | null | null | 905 | null |
7,286 | 2 | null | 773 | 840 | null | You have to first.
---
The part I didn't get is that in the example construction
```
groups = []
uniquekeys = []
for k, g in groupby(data, keyfunc):
groups.append(list(g)) # Store group iterator as a list
uniquekeys.append(k)
```
`k` is the current grouping key, and `g` is an iterator that you can use to... | null | CC BY-SA 4.0 | null | 2008-08-10T18:45:32.430 | 2020-07-29T20:57:41.707 | 2020-07-29T20:57:41.707 | 1,079,075 | 207 | null |
7,292 | 2 | null | 7,277 | 9 | null | It's generally considered bad practice to rely on linebreaks, since it's a fragile way to differentiate data. While most XML processors will preserve any whitespace you put in your XML, it's not guaranteed.
The real problem is that most applications that output your XML into a readable format consider all whitespac... | null | CC BY-SA 2.5 | null | 2008-08-10T19:05:08.930 | 2008-08-10T19:05:08.930 | null | null | 207 | null |
7,307 | 2 | null | 7,252 | 9 | null | Here's what I would do:
- First time out... "we're going to do this project jointly. I'm going to write the tests and you're going to write the code. Pay attention to how I write the tests, coz that's how we do things around here and that's what I'll expect of you."- Following that... "You're done? Great! First l... | null | CC BY-SA 2.5 | null | 2008-08-10T19:53:27.427 | 2008-08-10T19:53:27.427 | null | null | 116 | null |
7,314 | 2 | null | 7,272 | 0 | null | In your algorithm using the list from 2 to the root of the integer, you can improve performance by only testing odd numbers after 2. That is, your list only needs to contain 2 and all odd numbers from 3 to the square root of the integer. This cuts the number of times you loop in half without introducing any more comp... | null | CC BY-SA 2.5 | null | 2008-08-10T19:58:38.587 | 2008-08-10T19:58:38.587 | null | null | 940 | null |
7,296 | 2 | null | 7,287 | 6 | null | First of all, [here's a great article with tips on unit testing](http://devver.net/blog/2008/07/tips-for-unit-testing/). Secondly, I found a great way to avoid making tons of changes in old code is to just refactor it a little until you can test it. One easy way to do this is to make private members protected, and th... | null | CC BY-SA 2.5 | null | 2008-08-10T19:22:36.943 | 2008-08-10T19:22:36.943 | null | null | 122 | null |
7,323 | 2 | null | 7,272 | 0 | null | @theprise
If I were wanting to use an incrementing loop instead of an instantiated list (problems with memory for massive numbers...), what would be a good way to do that without building the list?
It doesn't seem like it would be cheaper to do a divisibility check for the given integer (X % 3) than just the check fo... | null | CC BY-SA 2.5 | null | 2008-08-10T20:18:27.690 | 2008-08-10T20:24:01.280 | 2008-08-10T20:24:01.280 | 145 | 145 | null |
7,320 | 2 | null | 7,284 | 508 | null | Here's the briefest explanation:
A Turing Complete system means a system in which a program can be written that will find an answer (although with no guarantees regarding runtime or memory).
So, if somebody says "my new thing is Turing Complete" that means in principle (although often not in practice) it could be used ... | null | CC BY-SA 4.0 | null | 2008-08-10T20:10:48.687 | 2020-12-31T20:19:57.107 | 2020-12-31T20:19:57.107 | 116 | 116 | null |
7,336 | 2 | null | 7,277 | 0 | null | I don't see what's wrong with `<Line>` tags.
Apparently, the visualization of the data is important to you, important enough to keep it in your data (via line breaks in your first example). Fine. Then really keep it, don't rely on "magic" to keep it for you. Keep every bit of data you'll need later on and can't deduce ... | null | CC BY-SA 3.0 | null | 2008-08-10T20:41:55.100 | 2015-12-15T19:49:00.210 | 2015-12-15T19:49:00.210 | 1,016,716 | 931 | null |
7,331 | 2 | null | 7,277 | -1 | null | I recommend you should either add the `<br/>` line breaks or maybe use line-break entity - `
`
| null | CC BY-SA 2.5 | null | 2008-08-10T20:35:18.577 | 2008-08-10T20:35:18.577 | null | null | 885 | null |
7,327 | 2 | null | 7,287 | 0 | null | I am not sure why would you say that unit tests are going be removed once refactoring is completed. Actually your unit-test suite should run after main build (you can create a separate "tests" build, that just runs the unit tests after the main product is built). Then you will immediately see if changes in one piece br... | null | CC BY-SA 2.5 | null | 2008-08-10T20:28:24.347 | 2008-08-10T20:28:24.347 | null | null | 885 | null |
7,345 | 2 | null | 6,530 | 0 | null | > I'm not in a position to modify the permissions on folders (especially outside of the virtual directory home folder), and don't already have an App_Data folder, so am a bit hesitant to go with that.
If you have a website, you clearly have a folder somewhere. Can you not add a (non-web-facing) subfolder? It seems l... | null | CC BY-SA 2.5 | null | 2008-08-10T20:57:21.433 | 2008-08-10T20:57:21.433 | null | null | 872 | null |
7,343 | 2 | null | 6,530 | 0 | null | I'm not in a position to modify the permissions on folders (especially outside of the virtual directory home folder), and don't already have an App_Data folder, so am a bit hesitant to go with that.
So for the moment I'm going with the CommonApplicationData Folder.
- -
| null | CC BY-SA 2.5 | null | 2008-08-10T20:52:20.973 | 2008-08-10T20:52:20.973 | null | null | 233 | null |
7,351 | 2 | null | 7,348 | 3 | null | Have a look at #ziplib (www.icsharpcode.com). It's GPL, but you can use it in closed-source, commercial applications. They don't say anything specifically on their page about using it with the Compact Framework, so you'd have to give it a test yourself (that said, it's pure C# without any external dependencies, so the ... | null | CC BY-SA 2.5 | null | 2008-08-10T21:04:56.690 | 2008-08-10T21:04:56.690 | null | null | 1,975,282 | null |
7,354 | 2 | null | 1,644 | 0 | null | Something I didn't see mentioned is [PCMag Radio](http://www.pcmag.com/category2/0,2806,2007098,00.asp). That's a more consumer tech-oriented show, but they do geek out fairly often, and the chatter is always interesting.
| null | CC BY-SA 2.5 | null | 2008-08-10T21:08:36.167 | 2008-08-10T21:08:36.167 | null | null | 1,975,282 | null |
7,348 | 1 | 7,351 | null | 9 | 7,756 | My requirements:
- - - -
I've seen the [Xceed Zip for CF](http://xceed.com/Zip_NET_CF_Intro.html) library. What other options are there?
| Zip library options for the Compact Framework? | CC BY-SA 2.5 | 0 | 2008-08-10T21:00:14.173 | 2011-03-08T13:07:51.157 | 2008-09-24T15:31:20.207 | 12,870 | 636 | [
"windows-mobile",
"compact-framework",
"zip",
"components"
] |
7,358 | 2 | null | 7,277 | 3 | null | What about using attributes to store the data, rather than text nodes:
```
<Address Street="15 Sample St" City="Example Bay" State="" Country="Some Country"/>
```
I know the use of attributes vs. text nodes is an often debated subject, but I've stuck with attributes 95% of the time, and haven't had any troubles beca... | null | CC BY-SA 2.5 | null | 2008-08-10T21:24:24.200 | 2008-08-10T21:24:24.200 | null | null | 803 | null |
7,364 | 1 | 7,455 | null | 88 | 143,544 | Does anyone know of a good method for editing PDFs in PHP? Preferably open-source/zero-license cost methods. :)
I am thinking along the lines of opening a PDF file, replacing text in the PDF and then writing out the modified version of the PDF?
On the front-end
| Edit PDF in PHP? | CC BY-SA 4.0 | 0 | 2008-08-10T21:58:24.913 | 2023-02-10T13:03:11.337 | 2023-02-10T13:03:11.337 | 18,461,576 | 277 | [
"php",
"pdf"
] |
7,356 | 2 | null | 7,277 | -2 | null | If you need your linebreaks preserved, use a CDATA block, as [tweakt said](https://stackoverflow.com/questions/7277/is-it-bad-practice-to-be-sensitive-to-linebreaks-in-xml-documents#7280)
Otherwise beware. Most of the time, the linebreaks will be preserved by XML software, but sometimes they won't, and you really don'... | null | CC BY-SA 2.5 | null | 2008-08-10T21:13:23.630 | 2008-08-10T21:13:23.630 | 2017-05-23T11:53:53.227 | -1 | 234 | null |
7,380 | 2 | null | 7,272 | -1 | null | If you're wanting to find a way of generating prime numbers, this have been covered in a [previous question](https://stackoverflow.com/questions/622/most-efficient-code-for-the-first-10000-prime-numbers#2753).
| null | CC BY-SA 2.5 | null | 2008-08-10T22:47:08.340 | 2011-04-05T18:34:47.393 | 2017-05-23T12:33:26.220 | -1 | 383 | null |
7,377 | 2 | null | 7,364 | -1 | null | We use [pdflib](http://www.pdflib.com/pdflib-gmbh/) to create PDF files from our rails apps. It has bindings for PHP, and a ton of other languages.
We use the commmercial version, but they also have a [free/open source version](http://www.pdflib.com/download/pdflib-family/pdflib-lite/) which has some limitations.
Unfor... | null | CC BY-SA 4.0 | null | 2008-08-10T22:41:00.023 | 2020-09-09T02:49:01.143 | 2020-09-09T02:49:01.143 | 549,372 | 234 | null |
7,385 | 2 | null | 7,244 | 17 | null | Darren, that would work if the types were specific enumerations - for general enumerations to work you have to cast them to ints (or more likely uint) to do the boolean math:
```
public static bool IsSet( this Enum input, Enum matchTo )
{
return ( Convert.ToUInt32( input ) & Convert.ToUInt32( matchTo ) ) != 0;
}
`... | null | CC BY-SA 2.5 | null | 2008-08-10T22:53:05.613 | 2008-08-10T22:53:05.613 | null | null | 193 | null |
7,367 | 1 | 7,399 | null | 11 | 3,954 | I'm looking for help setting a new default property value for an inherited control in Visual Studio:
```
class NewCombo : System.Windows.Forms.ComboBox
{
public NewCombo() { DropDownItems = 50; }
}
```
The problem is that the base class property `DropDownItems` has a 'default' attribute set on it that is a differe... | Visual Studio - new "default" property values for inherited controls | CC BY-SA 4.0 | 0 | 2008-08-10T22:06:49.670 | 2019-01-20T13:55:20.363 | 2019-01-20T13:55:20.363 | 567,854 | 945 | [
"c#",
".net",
"vb.net",
"visual-studio"
] |
7,387 | 2 | null | 7,287 | 3 | null | @valters
I disagree with your statement that tests shouldn't break the build. The tests should be an indication that the application doesn't have new bugs introduced for the functionality that is tested (and a found bug is an indication of a missing test).
If tests don't break the build, then you can easily run into... | null | CC BY-SA 2.5 | null | 2008-08-10T22:55:03.973 | 2008-08-10T22:55:03.973 | null | null | 122 | null |
7,399 | 2 | null | 7,367 | 5 | null | In your derived class you need to either override (or shadow using ) the property in question and then re-apply the default value attribute.
| null | CC BY-SA 2.5 | null | 2008-08-10T23:11:39.133 | 2008-08-10T23:11:39.133 | null | null | 608 | null |
7,394 | 2 | null | 7,252 | 21 | null | Have a code review before every commit (even if it's a 1 minute "I've changed this variable name"), and as part of the code review, review any unit tests.
Don't sign off on the commit until the tests are in place.
(Also - If his work wasn't tested - why was it in a production build in the first place? If it's not tes... | null | CC BY-SA 2.5 | null | 2008-08-10T22:59:14.383 | 2008-08-11T02:45:11.807 | 2008-08-11T02:45:11.807 | 943 | 943 | null |
7,402 | 2 | null | 7,364 | 3 | null | Zend Framework can load and edit existing PDF files. I think it supports revisions too.
I use it to create docs in a project, and it works great. Never edited one though.
Check out the doc [here](https://web.archive.org/web/20120822101532/http://framework.zend.com:80/manual/en/zend.pdf.create.html)
| null | CC BY-SA 4.0 | null | 2008-08-10T23:16:39.123 | 2020-06-24T22:15:29.750 | 2020-06-24T22:15:29.750 | 10,794,031 | 550 | null |
7,421 | 2 | null | 7,095 | 1 | null | Static constructor is guaranteed to be thread safe.
Also, check out the discussion on Singleton at DeveloperZen:
[http://web.archive.org/web/20160404231134/http://www.developerzen.com/2007/07/15/whats-wrong-with-this-code-1-discussion/](http://web.archive.org/web/20160404231134/http://www.developerzen.com/2007/07/15/wh... | null | CC BY-SA 4.0 | null | 2008-08-10T23:38:26.520 | 2020-06-25T03:49:18.773 | 2020-06-25T03:49:18.773 | 9,780,149 | 1,228,206 | null |
7,437 | 2 | null | 7,015 | 0 | null | @lomaxx
> @Derek & Mark: I wish there was a way to accept 2 answers. I'm going to have to end up going with Wolfbyte's solution because if I split the file into n sections there is the potential for a thread to come across a batch of "slow" transactions, however if I was processing a file where each process was guaran... | null | CC BY-SA 2.5 | null | 2008-08-11T00:02:20.607 | 2008-08-11T00:02:20.607 | null | null | 872 | null |
7,290 | 2 | null | 7,284 | 84 | null | From [wikipedia](http://en.wikipedia.org/wiki/Turing_completeness):
> Turing completeness, named after Alan
Turing, is significant in that every
plausible design for a computing
device so far advanced can be emulated
by a universal Turing machine — an
observation that has become known as
the Church-Turing ... | null | CC BY-SA 2.5 | null | 2008-08-10T18:59:06.460 | 2008-08-10T18:59:06.460 | null | null | 931 | null |
7,440 | 1 | 20,754 | null | 35 | 11,679 | The company I'm currently working for is using [Selenium](http://selenium.openqa.org/) for Uniting-Testing our User Interface. What do you use to Unit-Test your Web UI and how effective do you find it?
| What do you use to Unit-Test your Web UI? | CC BY-SA 2.5 | 0 | 2008-08-11T00:05:36.590 | 2018-06-28T11:10:56.510 | 2008-08-23T19:49:05.370 | 2,134 | 889 | [
"unit-testing",
"user-interface",
"selenium"
] |
7,398 | 1 | 26,994 | null | 9 | 1,760 | I haven't seen any questions relating to GNU autoconf/automake builds, but I'm hoping at least some of you out there are familiar with it. Here goes:
I have a project (I'll call it myproject) that includes another project (vendor). The vendor project is a standalone project maintained by someone else. Including a p... | How to avoid redefining VERSION, PACKAGE, etc | CC BY-SA 3.0 | null | 2008-08-10T23:10:53.190 | 2015-10-08T01:12:02.947 | 2015-10-08T01:10:35.300 | 67,579 | 737 | [
"c",
"linux",
"unix",
"autoconf",
"automake"
] |
7,458 | 2 | null | 6,957 | 4 | null | There's a [pretty good post](http://web.archive.org/web/20090227051320/http://xtalk.msk.su:80/%7Eott/en/writings/prog-checking/GooglePT.html) that I read a while back that outlines some testing and analysis of GPT in a variety of scenarios
| null | CC BY-SA 4.0 | null | 2008-08-11T00:53:54.403 | 2020-06-23T14:44:11.287 | 2020-06-23T14:44:11.287 | 9,780,149 | 493 | null |
7,459 | 2 | null | 7,348 | 1 | null | This looks like it may be a good option for you: [http://www.codeplex.com/DotNetZip](http://www.codeplex.com/DotNetZip). It seems small, has source and has a very open license (MS-PL).
| null | CC BY-SA 2.5 | null | 2008-08-11T00:58:27.170 | 2008-08-11T00:58:27.170 | null | null | 748 | null |
7,455 | 2 | null | 7,364 | 72 | null | If you are taking a 'fill in the blank' approach, you can precisely position text anywhere you want on the page. So it's relatively easy (if not a bit tedious) to add the missing text to the document. For example with Zend Framework:
```
<?php
require_once 'Zend/Pdf.php';
$pdf = Zend_Pdf::load('blank.pdf');
$page = $... | null | CC BY-SA 2.5 | null | 2008-08-11T00:49:58.077 | 2008-08-11T00:54:22.313 | 2008-08-11T00:54:22.313 | 486 | 486 | null |
7,451 | 2 | null | 7,252 | 2 | null | I second RodeoClown's comment about code reviewing every commit. Once he's done it a fair few times he'll get in the habit of testing stuff.
I don't know if you need to block commits like that though.
At my workplace everyone has free commit to everything, and all SVN commit messages (with diffs) are emailed to the te... | null | CC BY-SA 2.5 | null | 2008-08-11T00:35:42.693 | 2008-08-11T00:35:42.693 | null | null | 234 | null |
7,464 | 2 | null | 7,440 | 3 | null | We use Selenium Core, but are switching gradually to Selenium RC which is much nicer and easier to manage. We have written lots of custom code to make the tests run on our Continuous Integration servers, some of them in parallel suites to run faster.
One thing you'll find is that Selenium seems to restart the browser... | null | CC BY-SA 2.5 | null | 2008-08-11T01:11:07.833 | 2008-08-11T01:11:07.833 | null | null | null | null |
7,461 | 2 | null | 371 | 14 | null | one of my application's emails was constantly being tagged as spam. it was html with a single link, which i sent as html in the body with a text/html content type.
my most successful resolution to this problem was to compose the email so it looked like it was generated by an email client.
i changed the email to be a... | null | CC BY-SA 2.5 | null | 2008-08-11T00:59:26.203 | 2008-08-11T00:59:26.203 | null | null | 953 | null |
7,465 | 2 | null | 7,440 | 4 | null | We are using QuickTestPro. So far it is effective, but the browser selection is limited. The nicest part is the ability to record your browser's activity, and convert it into a scriptable set of steps. There is also a nice .Net addin so if you have any validation code you need to do for the different stages of your ... | null | CC BY-SA 2.5 | null | 2008-08-11T01:12:54.350 | 2008-08-11T01:12:54.350 | null | null | 733 | null |
7,463 | 2 | null | 6,633 | 3 | null | I wrote a [script](http://pastebin.com/f6f379371) using the built-in [Tokenizer](http://au.php.net/manual/en/ref.tokenizer.php) functions. Its pretty rough but it worked for the code base I was working on. I believe you could also use [CodeSniffer](http://pear.php.net/manual/en/package.php.php-codesniffer.php).
| null | CC BY-SA 2.5 | null | 2008-08-11T01:08:56.370 | 2008-08-11T01:08:56.370 | null | null | 486 | null |
7,467 | 2 | null | 7,224 | 4 | null | This is a Windows Forms application? I was able to make a very fat and thick scrollbar by adjusting the "Width" property of my scroll bar control.

Is your scroll bar something you have programmatic access to (i.e. it is a control you added to the form)?
| null | CC BY-SA 3.0 | null | 2008-08-11T01:24:00.240 | 2012-03-28T22:40:11.407 | 2012-03-28T22:40:11.407 | 1,219,121 | 308 | null |
7,466 | 2 | null | 7,031 | 1 | null | What we have done at my work is have a library the provides functions such as checking if the user is logged in. For example:
```
<?php
require_once 'Auth.php';
// output some html
if (isLoggedIn()) {
echo 'html for logged in user';
}
// rest of html
```
For pages that only authenicated users should see, the con... | null | CC BY-SA 2.5 | null | 2008-08-11T01:23:45.187 | 2008-08-11T01:23:45.187 | null | null | 486 | null |
7,474 | 2 | null | 7,472 | 5 | null | The best resource I've found for WPF data binding is [Bea Costa's blog](http://www.beacosta.com). Start from the first post and read forward. It's awesome.
| null | CC BY-SA 2.5 | null | 2008-08-11T01:38:49.727 | 2008-08-11T01:38:49.727 | null | null | 615 | null |
7,472 | 1 | 7,479 | null | 11 | 3,816 | Can anyone point me to a good resource (or throw me a clue) to show me how to do DataBinding to controls (ComboBox, ListBox, etc.) in WPF? I'm at a bit of a loss when all my WinForms niceities are taken away from me, and I'm not all that bright to start with...
| WPF Databinding | CC BY-SA 3.0 | 0 | 2008-08-11T01:34:34.773 | 2020-06-24T14:06:19.123 | 2013-01-29T12:25:02.847 | 1,369,235 | 856 | [
"wpf",
"data-binding"
] |
7,470 | 1 | null | null | 2 | 841 | After a couple of hours fighting with the [Gallery2](http://gallery.menalto.com/) [RSS module](http://codex.gallery2.org/Gallery2:Modules:rss) and getting only the message, "no feeds have yet been defined", I gave up. Based on [a Google search for "no feeds have yet been defined"](http://www.google.com/search?q=%22no+... | RSS feeds from Gallery2 | CC BY-SA 4.0 | null | 2008-08-11T01:32:16.090 | 2019-06-04T09:30:15.970 | 2019-06-04T09:30:15.970 | 6,556,397 | 150 | [
"php",
"web-applications"
] |
7,471 | 2 | null | 7,470 | 1 | null | My eventual (and hopefully temporary) solution to this problem was a Python CGI script. My script follows for anyone who might find it useful (despite the fact that this is a total hack).
```
#!/usr/bin/python
"""A CGI script to produce an RSS feed of top-level Gallery2 albums."""
#import cgi
#import cgitb; cgitb.... | null | CC BY-SA 2.5 | null | 2008-08-11T01:33:20.080 | 2008-08-11T01:33:20.080 | null | null | 150 | null |
7,476 | 2 | null | 7,272 | 2 | null | @akdom's question to me:
Looping would work fine on my previous suggestion, and you don't need to do any calculations to determine if a number is even; in your loop, simply skip every even number, as shown below:
```
//Assuming theInteger is the number to be tested for primality.
// Check if theInteger is divisible b... | null | CC BY-SA 2.5 | null | 2008-08-11T01:42:41.170 | 2008-08-11T01:42:41.170 | null | null | 940 | null |
7,475 | 2 | null | 7,472 | 3 | null | in code behind -- set the DataContext of your list box equal to the collection you're binding to.
```
private void OnInit(object sender, EventArgs e)
{
//myDataSet is some IEnumerable
// myListBox is a ListBox control.
// Set the DataContext of the ListBox to myDataSet
myListBox.DataContext = myDataSet;
}
``... | null | CC BY-SA 2.5 | null | 2008-08-11T01:40:55.993 | 2008-08-11T01:40:55.993 | null | null | 49 | null |
7,473 | 2 | null | 7,031 | 9 | null | In your menu file or w/e you put:
```
<? require 'auth.php' ?>
<ul>
<li><a href="">Home</a></li>
<li><a href="">Products</a></li>
<? if( loggedin() ): ?><li><a href="">Secret area</a></li><? endif; ?>
</ul>
```
Then in pages that require auth just do this:
```
<?php
require 'auth.php';
require_... | null | CC BY-SA 3.0 | null | 2008-08-11T01:35:58.187 | 2016-02-07T18:13:03.123 | 2016-02-07T18:13:03.123 | 2,921,691 | 795 | null |
7,478 | 2 | null | 6,530 | 0 | null | You could also log to the Windows Event log or to a table in a database. How often are people looking at the event log? If it's being examined on a regualr basis, writing to a table amkes the reporting back much easier as it's trivial to reverse the order and only show the last X events for the current time period. ... | null | CC BY-SA 2.5 | null | 2008-08-11T01:45:10.930 | 2008-08-11T01:45:10.930 | null | null | 206 | null |
7,479 | 2 | null | 7,472 | 3 | null | I find the tutorial videos at [Windows Client .Net](http://windowsclient.net/learn/videos_wpf.aspx) equally awesome. [Dot Net Rocks TV](http://web.archive.org/web/20190214014927/http://www.dnrtv.com:80/default.aspx?showNum=101) has also covered it some time ago.
| null | CC BY-SA 4.0 | null | 2008-08-11T01:45:45.297 | 2020-06-24T14:06:19.123 | 2020-06-24T14:06:19.123 | 9,780,149 | 952 | null |
7,481 | 2 | null | 7,260 | 5 | null | For windows [this](http://the.earth.li/~sgtatham/putty/0.53b/htmldoc/Chapter8.html) is a good introduction and guide
Here are some good ssh-agents for systems other than linux.
- [pageant](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)- [SSHKeychain](http://www.askbjoernhansen.com/2005/01/07/sshkeyc... | null | CC BY-SA 2.5 | null | 2008-08-11T02:01:00.040 | 2008-08-11T02:01:00.040 | null | null | 716 | null |
7,484 | 2 | null | 626 | 1 | null | The difference in behaviour with `return` is IMHO the most important difference between the 2. I also prefer lambda because it's less typing than Proc.new :-)
| null | CC BY-SA 2.5 | null | 2008-08-11T02:09:46.683 | 2008-08-11T02:09:46.683 | null | null | 234 | null |
7,486 | 2 | null | 7,231 | 2 | null | as [abfo says](https://stackoverflow.com/questions/7231/automatically-check-bounced-emails-via-pop3#7249), the POP3 protocol is super simple, getting the messages is a no brainer. Parsing the messages to get the failures is harder, and reliably parsing out which email caused the failure and why it failed is really har... | null | CC BY-SA 2.5 | null | 2008-08-11T02:22:13.990 | 2008-08-11T02:22:13.990 | 2017-05-23T12:19:33.570 | -1 | 430 | null |
7,477 | 1 | 7,523 | null | 129 | 160,521 | I'm currently working on an internal sales application for the company I work for, and I've got a form that allows the user to change the delivery address.
Now I think it would look much nicer, if the textarea I'm using for the main address details would just take up the area of the text in it, and automatically resiz... | How to autosize a textarea using Prototype? | CC BY-SA 4.0 | 0 | 2008-08-11T01:43:13.493 | 2020-03-09T14:10:06.593 | 2019-01-03T06:54:14.567 | 10,757,987 | 841 | [
"javascript",
"html",
"css",
"textarea",
"prototypejs"
] |
7,485 | 2 | null | 2,027 | 2 | null | PHP is also pass by value.
```
<?php
class Holder {
private $value;
public function __construct($value) {
$this->value = $value;
}
public function getValue() {
return $this->value;
}
}
function swap($x, $y) {
$tmp = $x;
$x = $y;
$y = $tmp;
}
$a = new Holder('a');
$b ... | null | CC BY-SA 2.5 | null | 2008-08-11T02:21:42.963 | 2008-08-11T02:21:42.963 | null | null | 486 | null |
7,483 | 2 | null | 879 | 62 | null | It seems a lot of people get confused by the way objects are passed to functions and what passing by reference means. Object are still passed by value, it's just the value that is passed in PHP5 is a reference handle. As proof:
```
<?php
class Holder {
private $value;
public function __construct($value) {
... | null | CC BY-SA 4.0 | null | 2008-08-11T02:09:30.133 | 2020-07-16T05:21:57.553 | 2020-07-16T05:21:57.553 | 10,325,630 | 486 | null |
7,491 | 2 | null | 6,430 | 1 | null | ```
object cell = myDataGrid[row, col];
```
| null | CC BY-SA 3.0 | null | 2008-08-11T02:59:12.670 | 2015-10-07T09:40:16.083 | 2015-10-07T09:40:16.083 | 3,374,591 | 785 | null |
7,490 | 2 | null | 7,440 | 6 | null | Well, if you've designed your application properly, you won't have scads of logic inside the UI anyway. It makes much more sense to separate the actual work getting done into units separate from the UI, and then test those.
If you do that, then the only code in the UI will be code that invokes the backend, so simply ... | null | CC BY-SA 2.5 | null | 2008-08-11T02:52:41.637 | 2008-08-11T02:52:41.637 | null | null | 1,975,282 | null |
7,489 | 1 | 13,384 | null | 8 | 2,423 | I've made many different seperate parts of a GUI system for the Nintendo DS, like buttons and textboxes and select boxes, but I need a way of containing these classes in one Gui class, so that I can draw everything to the screen all at once, and check all the buttons at once to check if any are being pressed. My questi... | How do I make a GUI? | CC BY-SA 3.0 | 0 | 2008-08-11T02:50:09.113 | 2017-12-17T03:51:26.807 | 2016-02-07T18:07:20.857 | 2,921,691 | 813 | [
"c++",
"user-interface"
] |
7,487 | 2 | null | 7,272 | 2 | null | A Rutgers grad student recently found a [recurrence relation that generates primes](http://www.cs.uwaterloo.ca/journals/JIS/VOL11/Rowland/rowland21.html). The difference of its successive numbers will generate either primes or 1's.
```
a(1) = 7
a(n) = a(n-1) + gcd(n,a(n-1)).
```
It makes a lot of crap that needs to ... | null | CC BY-SA 2.5 | null | 2008-08-11T02:31:36.093 | 2008-08-11T05:36:32.943 | 2008-08-11T05:36:32.943 | 157 | 157 | null |
7,488 | 2 | null | 328 | 88 | null | There are a couple of things to do in order to keep your session secure:
1. Use SSL when authenticating users or performing sensitive operations.
2. Regenerate the session id whenever the security level changes (such as logging in). You can even regenerate the session id every request if you wish.
3. Have sessions ti... | null | CC BY-SA 3.0 | null | 2008-08-11T02:38:06.737 | 2012-06-06T17:37:35.010 | 2012-06-06T17:37:35.010 | null | 486 | null |
7,499 | 2 | null | 7,231 | 6 | null | I have done a great deal of work handling bounce emails and there different types. If you want to be absolutely sure that the email your looking at is indeed a bounce of a specific kind I highly recommend getting a good filter. I have worked with [Boogie Tools](http://www.boogietools.com/) and it has worked very well. ... | null | CC BY-SA 2.5 | null | 2008-08-11T03:38:55.647 | 2008-08-11T03:38:55.647 | null | null | 567 | null |
7,498 | 2 | null | 7,492 | 0 | null | One more note, for our web application, I found that we had huge performance issues due to contention between threads over locks... so the moral was to think over the locking scheme very carefully. We ended up having worker threads to throttle too many requests using an asynchronous http handler, otherwise the applica... | null | CC BY-SA 2.5 | null | 2008-08-11T03:31:52.167 | 2008-08-11T03:31:52.167 | null | null | 122 | null |
7,497 | 2 | null | 7,492 | 37 | null | I've used [The Grinder](http://grinder.sourceforge.net/). It's open source, pretty easy to use, and very configurable. It is Java based and uses Jython for the scripts. We ran it against a .NET web application, so don't think it's a Java only tool (by their nature, any web stress tool should not be tied to the platf... | null | CC BY-SA 2.5 | null | 2008-08-11T03:27:15.250 | 2008-08-11T03:27:15.250 | null | null | 122 | null |
7,500 | 2 | null | 7,440 | 4 | null | We have been using [JSunit](https://github.com/pivotal/jsunit) for a while to do unit tests... it may not be the same kinds of tests you are talking about, but it is great for ensuring your JavaScript works as you expect.
You run it in the browser, and it can be set in an Ant build to be automatically run against a bu... | null | CC BY-SA 3.0 | null | 2008-08-11T03:43:10.863 | 2013-06-08T13:50:40.627 | 2013-06-08T13:50:40.627 | 938,089 | 122 | null |
7,492 | 1 | null | null | 252 | 169,394 | In the past, I used Microsoft Web Application Stress Tool and Pylot to stress test web applications. I'd written a simple home page, login script, and site walkthrough (in an ecommerce site adding a few items to a cart and checkout).
Just hitting the homepage hard with a handful of developers would almost always locat... | Performing a Stress Test on Web Application? | CC BY-SA 3.0 | 0 | 2008-08-11T03:00:26.957 | 2018-08-30T15:01:26.923 | 2017-10-25T14:52:17.603 | 1,000,551 | 556 | [
"web-applications",
"stress-testing",
"performance",
"webapplicationstresstool",
"pylot"
] |
7,511 | 2 | null | 7,489 | 0 | null | I think looking at the way other GUI toolkits have done it would be an excellent place to start. For C++ examples, I hear lots of good things about [Qt](http://trolltech.com/products/qt/). I haven't used it personally though. And of course WxWidgets as Nick mentioned.
| null | CC BY-SA 2.5 | null | 2008-08-11T04:21:49.663 | 2008-08-11T04:21:49.663 | null | null | 61 | null |
7,513 | 2 | null | 7,492 | 17 | null | I've used [JMeter](https://jmeter.apache.org/). Besides testing the web server you can also test your database backend, messaging services and email servers.
| null | CC BY-SA 4.0 | null | 2008-08-11T04:26:42.353 | 2018-05-10T06:37:16.260 | 2018-05-10T06:37:16.260 | 1,545,556 | 486 | null |
7,509 | 2 | null | 7,503 | 0 | null | Assuming that in your first example apps is an IEnumerable you could make use of the .Count and .FirstOrDefault properties to get the single item that you want to pass to SetForegroundWindow.
```
var apps = from app in Process.GetProcesses()
where app.ProcessName.Contains( "MyAppName" ) && app.MainWindowHandle != IntP... | null | CC BY-SA 2.5 | null | 2008-08-11T04:20:38.260 | 2008-08-11T04:20:38.260 | null | null | 231 | null |
7,506 | 2 | null | 7,489 | 0 | null | One useful strategy to keep in mind might be the [composite pattern](http://en.wikipedia.org/wiki/Composite_pattern). At a low level, it might allow you to treat all GUI objects (and collections of objects) more easily once built. But I have no idea what's involved in GUI framework design, so one place to find general ... | null | CC BY-SA 2.5 | null | 2008-08-11T04:11:02.087 | 2008-08-11T04:11:02.087 | null | null | null | null |
7,510 | 2 | null | 5,727 | 19 | null | I found Ted Jensen's "Tutorial on Pointers and Arrays in C" an excellent resource for learning about pointers. It is divided into 10 lessons, beginning with an explanation of what pointers are (and what they're for) and finishing with function pointers. [http://web.archive.org/web/20181011221220/http://home.netcom.com:... | null | CC BY-SA 4.0 | null | 2008-08-11T04:21:07.853 | 2020-06-22T19:44:00.327 | 2020-06-22T19:44:00.327 | 9,780,149 | 954 | null |
7,512 | 2 | null | 7,503 | 20 | null | @FryHard FirstOrDefault will work but remember that it returns null if none are found. This code isn't tested but should be close to what you want:
```
var app = Process.GetProcesses().FirstOrDefault(p => p.ProcessName.Contains("MyAppName") && p.MainWindowHandle != IntPtr.Zero);
if (app == null)
return;
SetForeg... | null | CC BY-SA 3.0 | null | 2008-08-11T04:25:07.333 | 2016-02-07T18:06:50.830 | 2016-02-07T18:06:50.830 | 2,921,691 | 615 | null |
7,517 | 1 | 25,741 | null | 8 | 3,463 | Is there a simple way to drop a group of interrelated tables in SQL Server? Ideally I'd like to avoid having to worry about what order they're being dropped in since I know the entire group will be gone by the end of the process.
| Dropping a group of tables in SQL Server | CC BY-SA 2.5 | 0 | 2008-08-11T04:32:01.000 | 2008-09-19T15:59:14.877 | 2008-08-18T16:15:08.987 | 116 | 797 | [
"sql",
"sql-server",
"database"
] |
7,482 | 2 | null | 7,252 | 16 | null | Imagine I am a mock programmer, named... Marco. Imagine I have graduated school not that long ago, and never really had to write tests. Imagine I work in a company that doesn't really enforce or asks for this. OK? good! Now imagine, that the company is switching to using tests, and they are trying to get me inline with... | null | CC BY-SA 2.5 | null | 2008-08-11T02:07:46.593 | 2008-08-11T02:12:53.417 | 2017-05-23T11:54:15.770 | -1 | 951 | null |
7,521 | 2 | null | 6,207 | 1 | null | We use the [Web Service Software Factory](http://www.codeplex.com/servicefactory), and we really like it because it makes it easier for developers to follow standards and appropriate patterns. The learning curve for us wasn't bad - a few hours per developer at most.
Other than that, there aren't any other pros & cons ... | null | CC BY-SA 2.5 | null | 2008-08-11T04:41:11.747 | 2008-08-11T04:41:11.747 | null | null | 781 | null |
7,516 | 2 | null | 3,088 | 1 | null | There have already been a bunch of great answers, but for an absolute beginner, I would wholeheartedly recommend [Hackety Hack](http://hacketyhack.net/). It was created by the unreasonably prolific [why_the_lucky_stiff](http://whytheluckystiff.net/) specifically to provide a BASIC/LOGO/Pascal-like environment for new p... | null | CC BY-SA 2.5 | null | 2008-08-11T04:30:31.143 | 2008-08-11T04:30:31.143 | null | null | null | null |
7,515 | 2 | null | 7,084 | 4 | null | My opinion is if you are depending on a minimum/maximum/specific size just assume that (say) an `unsigned int` is 32 bytes - use `uint32_t` instead (assuming your compiler supports C99).
| null | CC BY-SA 2.5 | null | 2008-08-11T04:29:28.650 | 2008-08-11T04:29:28.650 | null | null | 61 | null |
7,503 | 1 | 7,512 | null | 12 | 43,730 | I know almost nothing about linq.
I'm doing this:
```
var apps = from app in Process.GetProcesses()
where app.ProcessName.Contains( "MyAppName" ) && app.MainWindowHandle != IntPtr.Zero
select app;
```
Which gets me all the running processes which match that criteria.
But I don't know how to get the first o... | Linq to objects - select first object | CC BY-SA 2.5 | 0 | 2008-08-11T03:54:43.947 | 2016-02-07T18:06:50.830 | 2008-08-11T04:07:29.787 | 234 | 234 | [
"c#",
"linq",
"linq-to-objects"
] |
7,535 | 1 | 7,547 | null | 15 | 11,224 | What is the best way to use SQL Server 2008 as a development database, but ensure that the database is compatible with SQL Server 2005?
| SQL Server 2008 compatibility with SQL Server 2005 | CC BY-SA 2.5 | 0 | 2008-08-11T05:16:13.047 | 2014-11-25T16:52:46.730 | 2014-11-25T16:52:46.730 | 2,641,576 | 708 | [
"sql-server",
"sql-server-2008",
"sql-server-2005"
] |
7,536 | 2 | null | 7,525 | 0 | null | As far as I can tell your code is correct. Assuming exampleString is an std::string that has class scope like you describe, you ought to be able to initialize/assign it that way. Perhaps there is some other issue? Maybe a snippet of actual code would help put it in context.
Question: Is exampleString a pointer to a st... | null | CC BY-SA 2.5 | null | 2008-08-11T05:18:52.683 | 2008-08-11T05:26:12.107 | 2008-08-11T05:26:12.107 | 63 | 63 | null |
7,519 | 2 | null | 7,472 | 3 | null | And some more links, just in case the above didn't suffice:
[Windows Presentation Foundation - Data Binding How-to Topics](http://msdn.microsoft.com/en-us/library/ms752039.aspx)
- Approx 30 'How To' articles from MSDN.
"The topics in this section describe how to use data binding to bind elements to data from a varie... | null | CC BY-SA 2.5 | null | 2008-08-11T04:36:48.790 | 2008-08-11T04:40:11.310 | 2008-08-11T04:40:11.310 | 242 | 242 | null |
7,537 | 2 | null | 7,517 | 0 | null | I don't have access to SQL Server to test this, but how about:
```
DROP TABLE IF EXISTS table1, table2, table3 CASCADE;
```
| null | CC BY-SA 2.5 | null | 2008-08-11T05:19:48.547 | 2008-08-11T05:19:48.547 | null | null | 872 | null |
7,529 | 2 | null | 7,015 | 1 | null | Since the bottleneck will generally be in the processing and not the reading when dealing with files I'd go with the [producer-consumer](http://www.ddj.com/architect/184401751) pattern. To avoid locking I'd look at lock free lists. Since you are using C# you can take a look at Julian Bucknall's [Lock-Free List](http://... | null | CC BY-SA 2.5 | null | 2008-08-11T05:04:40.607 | 2008-08-11T05:04:40.607 | null | null | 342 | null |