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 ⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,657 | 2 | null | 2,647 | 194 | null | You may find the solution in [SQL User Defined Function to Parse a Delimited String](http://www.codeproject.com/KB/database/SQL_UDF_to_Parse_a_String.aspx) helpful (from [The Code Project](http://en.wikipedia.org/wiki/The_Code_Project)).
You can use this simple logic:
```
Declare @products varchar(200) = '1|20|3|343|... | null | CC BY-SA 3.0 | null | 2008-08-05T18:28:38.653 | 2016-12-02T02:42:41.990 | 2016-12-02T02:42:41.990 | 2,571,493 | 152 | null |
2,672 | 2 | null | 2,658 | 16 | null | The [Subversion Book](http://svnbook.red-bean.com/) is your best bet for learning the tool. There may be other quick-start tutorials out there, but the Book is the best single reference you'll find.
Git has some nice features, but you won't be able to appreciate them unless you've already used something more standard... | null | CC BY-SA 2.5 | null | 2008-08-05T18:36:48.370 | 2008-08-05T18:36:48.370 | null | null | 72 | null |
2,673 | 2 | null | 2,658 | 0 | null | Start using SVN for your actual work, but try to make time for fiddling around with Git and/or Mercurial. SVN is reasonably stable for production, but eventually you'll face a scenario where you'll a distributed SCM, by which time you'll be properly armed and the new systems will be mature enough.
| null | CC BY-SA 2.5 | null | 2008-08-05T18:38:00.973 | 2008-08-05T18:38:00.973 | null | null | 227 | null |
2,675 | 2 | null | 2,658 | 4 | null | My vote goes to Subversion. It's very powerful, yet easy to use, and has some great tools like [TortoiseSVN](http://tortoisesvn.tigris.org/).
But as others have said before me, JUST START USING IT. Source control is such an important part of the software development process. No "serious" software project should be ... | null | CC BY-SA 2.5 | null | 2008-08-05T18:39:20.597 | 2008-08-05T18:39:20.597 | null | null | 423 | null |
2,676 | 2 | null | 2,658 | 9 | null | For a friendly explanation of most of the basic concepts, see [A Visual Guide to Version Control](http://betterexplained.com/articles/a-visual-guide-to-version-control/). The article is very SVN-friendly.
| null | CC BY-SA 2.5 | null | 2008-08-05T18:39:23.310 | 2008-08-05T18:39:23.310 | null | null | 266 | null |
2,678 | 2 | null | 2,658 | 1 | null | Yup, SVN for preference unless you really need git's particular features. SVN is hard enough; It sounds like git is more complicated to live with. You can get hosted svn from people like [Beanstalk](http://www.beanstalkapp.com/) - unless you have in-house Linux people, I'd really recommend it. Things can go wrong horri... | null | CC BY-SA 2.5 | null | 2008-08-05T18:40:30.937 | 2008-08-05T18:40:30.937 | null | null | 137 | null |
2,671 | 2 | null | 2,647 | -1 | null | Well, mine isn't all that simpler, but here is the code I use to split a comma-delimited input variable into individual values, and put it into a table variable. I'm sure you could modify this slightly to split based on a space and then to do a basic SELECT query against that table variable to get your results.
```
--... | null | CC BY-SA 3.0 | null | 2008-08-05T18:36:15.923 | 2011-10-22T16:07:04.843 | 2011-10-22T16:07:04.843 | 63,550 | 71 | null |
2,668 | 2 | null | 2,658 | 82 | null | The most important thing about version control is:
Not using version control is a horrible idea. If you are not using version control, stop reading right now and start using it.
It is very easy to convert from
```
cvs<->svn<->git<->hg
```
It doesn't matter which one you choose. Just pick the easiest one for you to us... | null | CC BY-SA 2.5 | null | 2008-08-05T18:34:44.350 | 2009-08-11T20:37:16.440 | 2020-06-20T09:12:55.060 | -1 | 309,844 | null |
2,682 | 2 | null | 2,658 | 0 | null | > [superjoe30 writes](https://stackoverflow.com/questions/2658/#2674):> Related question (perhaps answers can be edited to answer this question as well):What about using source control on your own computer, if you're the sole programmer? Is >>this good practice? Are there related tips or tricks?
I use SVN for all of m... | null | CC BY-SA 2.5 | null | 2008-08-05T18:41:38.797 | 2008-08-05T19:07:42.070 | 2017-05-23T12:32:05.310 | -1 | 305 | null |
2,685 | 2 | null | 2,647 | 367 | null | I don't believe SQL Server has a built-in split function, so other than a UDF, the only other answer I know is to hijack the PARSENAME function:
```
SELECT PARSENAME(REPLACE('Hello John Smith', ' ', '.'), 2)
```
PARSENAME takes a string and splits it on the period character. It takes a number as its second argument... | null | CC BY-SA 3.0 | null | 2008-08-05T18:45:19.117 | 2015-11-02T10:05:50.853 | 2015-11-02T10:05:50.853 | 133 | 434 | null |
2,677 | 2 | null | 2,647 | 23 | null | Here is a UDF which will do it. It will return a table of the delimited values, haven't tried all scenarios on it but your example works fine.
```
CREATE FUNCTION SplitString
(
-- Add the parameters for the function here
@myString varchar(500),
@deliminator varchar(10)
)
RETURNS
@ReturnTable TABLE
(
... | null | CC BY-SA 2.5 | null | 2008-08-05T18:39:58.007 | 2008-08-05T18:51:07.610 | 2008-08-05T18:51:07.610 | 225 | 225 | null |
2,681 | 2 | null | 2,647 | 6 | null | Try this:
```
CREATE function [SplitWordList]
(
@list varchar(8000)
)
returns @t table
(
Word varchar(50) not null,
Position int identity(1,1) not null
)
as begin
declare
@pos int,
@lpos int,
@item varchar(100),
@ignore varchar(100),
@dl int,
@a1 int,
@a2 int,
@z1 int,
@z2 in... | null | CC BY-SA 2.5 | null | 2008-08-05T18:41:34.367 | 2008-08-05T18:41:34.367 | null | null | 357 | null |
2,690 | 2 | null | 2,688 | 0 | null | Which language you are using? It seems like pretty much all of them have built-in SQL escape functions that would be better to use.
For example, PHP has [mysql_real_escape_string](http://us2.php.net/manual/en/function.mysql-real-escape-string.php) and [addslashes](http://us2.php.net/manual/en/function.addslashes.php).... | null | CC BY-SA 4.0 | null | 2008-08-05T18:46:41.347 | 2021-10-25T11:33:28.697 | 2021-10-25T11:33:28.697 | 17,169,050 | 305 | null |
2,695 | 2 | null | 2,556 | 2 | null | I've looked at WorldPay and SecPay in the past; you need to know your onions to use them competently, I think - if you want really nice integration, at any rate.
| null | CC BY-SA 2.5 | null | 2008-08-05T18:49:46.830 | 2008-08-05T18:49:46.830 | null | null | 137 | null |
2,691 | 2 | null | 2,688 | 2 | null | I would also escape comments (double dash)
```
--
```
| null | CC BY-SA 2.5 | null | 2008-08-05T18:46:45.683 | 2008-08-05T18:46:45.683 | null | null | 383 | null |
2,687 | 2 | null | 2,639 | 3 | null | I've also been investigating wiki software for use as a KB, but it is tricky to find something that is easy to use for non-technical people. There are many wikis that attempt to provide WYSIWYG editing, but most of the software I've found generates nasty inefficient html markup from the WYSIWYG editor.
One notable ... | null | CC BY-SA 2.5 | null | 2008-08-05T18:45:29.960 | 2008-08-14T18:23:29.833 | 2008-08-14T18:23:29.833 | 327 | 327 | null |
2,693 | 2 | null | 2,688 | 0 | null | You're better off using prepared statements with placeholders. Are you using PHP, .NET...either way, prepared statements will provide more security, but I could provide a sample.
| null | CC BY-SA 2.5 | null | 2008-08-05T18:48:23.497 | 2008-08-05T18:48:23.497 | null | null | 34 | null |
2,696 | 2 | null | 2,688 | -1 | null | I am not sure if MySQL supports parameterized queries, if so, you should make an effort to go this route. This will ensure the users input can't do anything malicious.
Otherwise some "bad" characters in addition to what you mentioned would be semicolon (;) and comments (-- and /* */).
| null | CC BY-SA 4.0 | null | 2008-08-05T18:49:58.360 | 2021-10-25T11:34:30.053 | 2021-10-25T11:34:30.053 | 17,169,050 | 45 | null |
2,688 | 1 | 2,741 | null | 21 | 3,436 | When you execute a SQL query, you have to clean your strings or users can execute malicious SQL on your website.
I usually just have a function escape_string(blah), which:
- `\``\\`- `'``\'`
Is this adequate? Is there a hole in my code? Is there a library which can do this quickly and reliably for me?
I'd like to s... | What do I need to escape when sending a query? | CC BY-SA 3.0 | null | 2008-08-05T18:45:46.747 | 2021-10-25T11:34:30.053 | 2016-09-30T04:32:43.200 | 116 | 432 | [
"mysql",
"oracle",
"security"
] |
2,706 | 2 | null | 2,702 | 0 | null | GROUP BY also helps when you want to generate a report that will average or sum a bunch of data. You can GROUP By the Department ID and the SUM all the sales revenue or AVG the count of sales for each month.
| null | CC BY-SA 2.5 | null | 2008-08-05T19:00:39.557 | 2008-08-05T19:00:39.557 | null | null | 71 | null |
2,699 | 2 | null | 2,630 | 0 | null | While semi-related to your question, it does not entirely fit the Powershell NetCmdlets motif. But I wanted to post it anyhow as I use it daily and it may help others. Simply making shift-control-c key combo into displaying the visual studio command prompt.
| null | CC BY-SA 2.5 | null | 2008-08-05T18:53:44.950 | 2008-08-05T18:53:44.950 | null | null | 36 | null |
2,701 | 2 | null | 1,131 | 2 | null | > PDF has the disadvantage of requiring the Adobe Reader
I use [Foxit Reader](http://www.foxitsoftware.com/pdf/rd_intro.php) on Windows at home and at work. A lot smaller and very quick to open. Very handy when you are wondering what exactly a80000326.pdf is and why it is clogging up your documents folder.
| null | CC BY-SA 2.5 | null | 2008-08-05T18:55:00.440 | 2008-08-05T18:55:00.440 | null | null | 342 | null |
2,697 | 2 | null | 2,540 | 39 | null | The [Glib](http://library.gnome.org/devel/glib/stable/) library used on the Gnome project may also be some use. Moreover it is pretty well tested.
IBM developer works has a good tutorial on its use: [Manage C data using the GLib collections](https://www.ibm.com/developerworks/linux/tutorials/l-glib/)
| null | CC BY-SA 3.0 | null | 2008-08-05T18:50:09.453 | 2014-04-24T06:52:28.120 | 2014-04-24T06:52:28.120 | 512,251 | 199 | null |
2,708 | 2 | null | 2,658 | 3 | null | If you are on Mac OSX, I found http://www.versionsapp.com/">Versions to be an incredible (free) GUI front-end to SVN.
| null | CC BY-SA 2.5 | null | 2008-08-05T19:01:55.200 | 2008-08-05T19:01:55.200 | null | null | 25 | null |
2,707 | 2 | null | 2,702 | 3 | null | Group By forces the entire set to be populated before records are returned (since it is an implicit sort).
For that reason (and many others), never use a Group By in a subquery.
| null | CC BY-SA 2.5 | null | 2008-08-05T19:01:10.973 | 2008-08-05T19:01:10.973 | null | null | 414 | null |
2,713 | 2 | null | 2,711 | 2 | null | [http://www.csszengarden.com/](http://www.csszengarden.com/)
The images are not Creative Commons, but the CSS is.
| null | CC BY-SA 2.5 | null | 2008-08-05T19:10:49.130 | 2008-08-05T19:10:49.130 | null | null | 414 | null |
2,704 | 2 | null | 2,702 | 2 | null | Counting the number of times tags are used might be a google example:
```
SELECT TagName, Count(*)
AS TimesUsed
FROM Tags
GROUP BY TagName ORDER TimesUsed
```
If you simply want a distinct value of tags, I would prefer to use the `DISTINCT` statement.
```
SELECT DISTINCT TagName
FROM Tags
ORDER BY TagName ASC
```
| null | CC BY-SA 3.0 | null | 2008-08-05T18:58:35.067 | 2016-12-01T18:16:24.193 | 2016-12-01T18:16:24.193 | 2,571,493 | 383 | null |
2,702 | 1 | 2,736 | null | 32 | 49,200 | I know I need to have (although I don't know why) a `GROUP BY` clause on the end of a SQL query that uses any aggregate functions like `count`, `sum`, `avg`, etc:
```
SELECT count(userID), userName
FROM users
GROUP BY userName
```
When else would `GROUP BY` be useful, and what are the performance ramifications?
| How do I use T-SQL Group By | CC BY-SA 3.0 | 0 | 2008-08-05T18:55:35.963 | 2016-12-01T20:57:37.357 | 2016-12-01T20:57:37.357 | 73,226 | 357 | [
"sql",
"sql-server",
"group-by"
] |
2,711 | 1 | 2,763 | null | 26 | 7,180 | Let's aggregate a list of free quality web site design templates. There are a million of these sites out there, but most are repetitive and boring.
I'll start with [freeCSStemplates.org](http://www.freecsstemplates.org/)
I also think other sites should follow some sort of standards, for example here are freeCSStempl... | What sites offer free, quality web site design templates? | CC BY-SA 2.5 | 0 | 2008-08-05T19:08:47.543 | 2018-11-10T23:41:21.557 | 2018-11-10T23:41:21.557 | 397,817 | 45 | [
"css",
"templates"
] |
2,714 | 1 | 2,715 | null | 15 | 4,052 | I think most people know how to do this via the GUI (right click table, properties), but doing this in T-SQL totally rocks.
| I need to know how much disk space a table is using in SQL Server | CC BY-SA 2.5 | 0 | 2008-08-05T19:10:52.327 | 2021-10-25T11:30:47.637 | 2008-12-23T14:41:57.030 | 15,401 | 434 | [
"sql-server"
] |
2,720 | 2 | null | 2,709 | 3 | null | As for Linux, I know that Pidgin has to determine idle time to change your status to away after a certain amount of time. You might open the source and see if you can find the code that does what you need it to do.
| null | CC BY-SA 2.5 | null | 2008-08-05T19:14:47.560 | 2008-08-05T19:14:47.560 | null | null | 432 | null |
2,709 | 1 | null | null | 9 | 718 | In a environment, you can use the call in [Microsoft documentation](https://learn.microsoft.com/windows/desktop/api/winuser/nf-winuser-getlastinputinfo). Basically, this method returns the last tick that corresponds with when the user last provided input, and you have to compare that to the current tick to determine... | How can you tell when a user last pressed a key (or moved the mouse)? | CC BY-SA 4.0 | null | 2008-08-05T19:06:40.510 | 2019-12-16T11:51:05.903 | 2019-12-16T11:51:05.903 | 5,044,304 | 434 | [
"language-agnostic"
] |
2,716 | 2 | null | 2,711 | 0 | null | +1 for [Zen garden.](http://www.csszengarden.com/)
I like the resources at [inobscuro.com](http://inobscuro.com/)
| null | CC BY-SA 2.5 | null | 2008-08-05T19:11:45.383 | 2008-08-05T19:11:45.383 | null | null | 92 | null |
2,721 | 2 | null | 2,714 | 0 | null | Check out this, I know it works in 2005 ([Microsoft Documentation](https://learn.microsoft.com/sql/relational-databases/system-catalog-views/sys-database-files-transact-sql)):
Here is is for the pubs DB
```
select *
from pubs.sys.database_files
```
Returns the size and max_size.
| null | CC BY-SA 4.0 | null | 2008-08-05T19:16:19.133 | 2019-04-10T12:40:57.700 | 2019-04-10T12:40:57.700 | 8,320,555 | 225 | null |
2,715 | 2 | null | 2,714 | 13 | null | null | CC BY-SA 2.5 | null | 2008-08-05T19:11:11.453 | 2008-08-05T19:11:11.453 | null | null | 434 | null | |
2,724 | 2 | null | 2,711 | 3 | null | [The Open Design Community](http://www.opendesigns.org/) is a great resource.
| null | CC BY-SA 2.5 | null | 2008-08-05T19:19:03.513 | 2008-08-05T19:19:03.513 | null | null | 423 | null |
2,723 | 2 | null | 2,658 | 4 | null | At my current job, my predecessor did not use any kind of version control. There are just mountains of folders in at least 3 different places where he kept all of his projects. Any random project folder can be expected to find at least one folder name "project (OLD)" and one named "project"
With version control, you n... | null | CC BY-SA 2.5 | null | 2008-08-05T19:18:37.477 | 2008-08-05T19:18:37.477 | null | null | 30 | null |
2,731 | 2 | null | 2,711 | 0 | null | [http://www.opensourcetemplates.org/](http://www.opensourcetemplates.org/) has nice designs, just not enough selection.
| null | CC BY-SA 2.5 | null | 2008-08-05T19:25:06.307 | 2008-08-05T19:25:06.307 | null | null | 34 | null |
2,703 | 2 | null | 2,647 | 111 | null | First, create a function (using CTE, common table expression does away with the need for a temp table)
```
create function dbo.SplitString
(
@str nvarchar(4000),
@separator char(1)
)
returns table
AS
return (
with tokens(p, a, b) AS (
select
1... | null | CC BY-SA 3.0 | null | 2008-08-05T18:57:03.137 | 2016-07-07T11:07:35.630 | 2016-07-07T11:07:35.630 | 224 | 224 | null |
2,734 | 2 | null | 2,688 | 1 | null | A great thing to use in PHP is the [PDO](http://us2.php.net/pdo). It takes a lot of the guesswork out of dealing with securing your SQL (and all of your SQL stuff in general). It supports prepared statements, which go a long way towards thwarting SQL Injection Attacks.
A great primer on PDO is included in the book [Th... | null | CC BY-SA 2.5 | null | 2008-08-05T19:28:29.703 | 2008-08-05T19:28:29.703 | null | null | 58 | null |
2,712 | 2 | null | 2,639 | 10 | null | I second Luke's answer.
I can Recommend [Confluence](http://www.atlassian.com/software/confluence/) and here is why:
I tested extensively many commercial and free Wiki based solutions. Not a single one is a winner on all accounts, including confluence. Let me try to make your quest a little shorter by summarizing what... | null | CC BY-SA 2.5 | null | 2008-08-05T19:09:08.213 | 2008-08-05T19:21:20.607 | 2008-08-05T19:21:20.607 | 350 | 350 | null |
2,732 | 1 | 11,668,996 | null | 22 | 6,358 | Can anyone explain this behavior?
Running:
```
#!/bin/sh
echo "hello world" | read var1 var2
echo $var1
echo $var2
```
results in nothing being ouput, while:
```
#!/bin/sh
echo "hello world" > test.file
read var1 var2 < test.file
echo $var1
echo $var2
```
produces the expected output:
```
hello
world
```
Shoul... | Shell scripting input redirection oddities | CC BY-SA 2.5 | 0 | 2008-08-05T19:26:00.720 | 2021-03-27T14:59:27.747 | 2021-03-27T14:59:27.747 | 792,066 | 75 | [
"dash-shell"
] |
2,736 | 2 | null | 2,702 | 36 | null | To retrieve the number of widgets from each widget category that has more than 5 widgets, you could do this:
```
SELECT WidgetCategory, count(*)
FROM Widgets
GROUP BY WidgetCategory
HAVING count(*) > 5
```
The "having" clause is something people often forget about, instead opting to retrieve all their data to the cl... | null | CC BY-SA 3.0 | null | 2008-08-05T19:32:03.360 | 2012-11-27T13:33:37.513 | 2012-11-27T13:33:37.513 | 404 | 404 | null |
2,741 | 2 | null | 2,688 | 8 | null | For maximum security, performance, and correctness use prepared statements.
Here's how to do this with lots of examples in different languages, including PHP:
[https://stackoverflow.com/questions/1973/what-is-the-best-way-to-avoid-sql-injection-attacks](https://stackoverflow.com/questions/1973/what-is-the-best-way-to-... | null | CC BY-SA 2.5 | null | 2008-08-05T19:38:51.023 | 2008-08-05T19:38:51.023 | 2017-05-23T12:00:28.850 | -1 | 116 | null |
2,737 | 2 | null | 2,563 | 0 | null | I was wrestling with this problem several years ago (2004 I think). We ran into the problem that Firefox doesn't allow scripts to read the clipboard by default (but you can [grant access to the clipboard](http://support.mozilla.com/en-US/kb/Granting+JavaScript+access+to+the+clipboard)).
There's other ways of reading ... | null | CC BY-SA 2.5 | null | 2008-08-05T19:32:40.100 | 2008-08-05T19:32:40.100 | null | null | 434 | null |
2,752 | 2 | null | 2,688 | 0 | null | Use Prepared/Parameterized queries!
| null | CC BY-SA 2.5 | null | 2008-08-05T19:55:12.613 | 2008-08-05T19:55:12.613 | null | null | 415 | null |
2,750 | 1 | 2,761 | null | 11 | 3,177 | I'm wondering if it's a good idea to make in and , or elsewhere in the code.
This might surprise you be when it comes to and up the code, I think you should not make verifications in getters and setters, but in the code where you're your files or database. Am I wrong?
| Data verifications in Getter/Setter or elsewhere? | CC BY-SA 3.0 | 0 | 2008-08-05T19:51:29.220 | 2021-12-08T11:52:51.107 | 2015-10-18T15:15:56.547 | 4,370,109 | 435 | [
"optimization",
"setter",
"getter",
"verification"
] |
2,753 | 2 | null | 622 | 5 | null | I have adapted code found on the [CodeProject](http://www.codeproject.com/KB/recipes/highspeed_primenumbers.aspx) to create the following:
```
ArrayList primeNumbers = new ArrayList();
for(int i = 2; primeNumbers.Count < 10000; i++) {
bool divisible = false;
foreach(int number in primeNumbers) {
if(i... | null | CC BY-SA 2.5 | null | 2008-08-05T19:55:17.557 | 2008-08-07T11:51:14.803 | 2008-08-07T11:51:14.820 | 383 | 383 | null |
2,754 | 2 | null | 2,750 | 1 | null | Validation should be captured separately from getters or setters in a validation method. That way if the validation needs to be reused across multiple components, it is available.
When the setter is called, such a validation service should be utilized to sanitize input into the object. That way you know all informat... | null | CC BY-SA 2.5 | null | 2008-08-05T19:55:52.127 | 2008-08-05T20:05:26.757 | 2008-08-05T20:05:26.757 | 92 | 92 | null |
2,755 | 2 | null | 1,607 | 12 | null | My team scripts out all database changes, and commits those scripts to SVN, along with each release of the application. This allows for incremental changes of the database, without losing any data.
To go from one release to the next, you just need to run the set of change scripts, and your database is up-to-date, a... | null | CC BY-SA 2.5 | null | 2008-08-05T19:56:43.217 | 2008-08-05T19:56:43.217 | null | null | 423 | null |
2,742 | 1 | null | null | 50 | 12,919 | I'm interested in looking at Erlang and want to follow the path of least resistance in getting up and running.
At present, I'm planning on installing [Erlang R12B-3](http://www.erlang.org/download.html) and [Erlide](http://erlide.sourceforge.net/) ([Eclipse](http://www.eclipse.org/) plugin). This is largely a Google-r... | Setting up an Erlang development environment | CC BY-SA 2.5 | 0 | 2008-08-05T19:39:19.710 | 2021-10-25T11:28:29.650 | 2009-04-04T23:47:42.227 | 304 | 304 | [
"ide",
"erlang"
] |
2,756 | 1 | 2,762 | null | 10 | 84,670 | Even though I have a robust and fast computer (Pentium Dual Core 2.0 with 2Gb RAM), I'm always searching for lightweight software to have on it, so it runs fast even when many apps are up and running simultaneously.
On the last few weeks I've been migrating gradually to Linux and want to install a free lightweight yet... | Lightweight IDE for Linux | CC BY-SA 4.0 | 0 | 2008-08-05T19:57:11.827 | 2019-10-13T21:37:41.407 | 2019-10-13T21:37:41.407 | 3,002,139 | 431 | [
"php",
"c++",
"linux",
"ide"
] |
2,727 | 2 | null | 2,688 | 0 | null | In PHP, I'm using this one and I'll appreciate every comment about it :
```
function quote_smart($valeur)
{
if (get_magic_quotes_gpc())
$valeur = stripslashes($valeur);
if (!is_numeric($valeur))
$valeur = mysql_real_escape_string($valeur);
return $valeur;
}
$IdS = quote_smart($_P... | null | CC BY-SA 2.5 | null | 2008-08-05T19:21:49.090 | 2008-08-05T19:21:49.090 | null | null | 435 | null |
2,757 | 2 | null | 2,750 | 3 | null | From the perspective of having the most maintainable code, I think you should do as much validation as you can in the setter of a property. This way you won't be caching or otherwise dealing with invalid data.
After all, this is what properties are meant for. If all you have is a bunch of properties like...
```
publi... | null | CC BY-SA 2.5 | null | 2008-08-05T19:59:05.007 | 2008-08-07T21:44:40.113 | 2008-08-07T21:44:40.113 | 357 | 357 | null |
2,761 | 2 | null | 2,750 | 15 | null | Well, one of the reasons why classes usually contain private members with public getters/setters is exactly because they can verify data.
If you have a Number than can be between 1 and 100, i would definitely put something in the setter that validates that and then maybe throw an exception that is being caught by the c... | null | CC BY-SA 4.0 | null | 2008-08-05T19:59:39.157 | 2021-10-25T11:26:55.757 | 2021-10-25T11:26:55.757 | 17,169,050 | 91 | null |
2,762 | 2 | null | 2,756 | 18 | null | [gedit](http://projects.gnome.org/gedit/)
- - - -
| null | CC BY-SA 2.5 | null | 2008-08-05T19:59:59.640 | 2010-01-12T10:02:07.830 | 2010-01-12T10:02:07.830 | 39,321 | 432 | null |
2,760 | 2 | null | 2,750 | 3 | null | It depends.
Generally, code should fail fast. If the value can be set by multiple points in the code and you validate only on after retrieving the value, the bug appears to be in the code that does the update. If the setters validate the input, you know what code is trying to set invalid values.
| null | CC BY-SA 2.5 | null | 2008-08-05T19:59:13.010 | 2008-08-05T19:59:13.010 | null | null | 304 | null |
2,764 | 2 | null | 2,732 | 5 | null | It's because the pipe version is creating a subshell, which reads the variable into its local space which then is destroyed when the subshell exits.
Execute this command
```
$ echo $$;cat | read a
10637
```
and use pstree -p to look at the running processes, you will see an extra shell hanging off of your main shel... | null | CC BY-SA 2.5 | null | 2008-08-05T20:00:43.023 | 2008-08-05T20:00:43.023 | null | null | 116 | null |
2,767 | 1 | 75,338 | null | 211 | 137,024 | Can anyone recommend any good or for `Microsoft Visual Studio`?
Freebies are preferred, but if it is worth the cost then that's fine.
| Recommended add-ons/plugins for Microsoft Visual Studio | CC BY-SA 4.0 | 0 | 2008-08-05T20:02:33.033 | 2022-07-27T14:03:44.483 | 2019-12-13T07:34:22.503 | 11,383,441 | 396 | [
"visual-studio",
"plugins",
"add-on"
] |
2,771 | 2 | null | 2,767 | 98 | null | Not free, but [ReSharper](http://www.jetbrains.com/resharper/index.html) is definitely one recommendation.
| null | CC BY-SA 2.5 | null | 2008-08-05T20:05:27.630 | 2008-08-05T20:05:27.630 | null | null | 91 | null |
2,768 | 2 | null | 2,750 | 1 | null | You might wanna check out [Domain Driven Design](http://books.google.com/books?id=7dlaMs0SECsC), by Eric Evans. DDD has this notion of a Specification:
> ... explicit predicate-like VALUE
OBJECTS for specialized purposes. A
SPECIFICATION is a predicate that
determines if an object does or does
not satisfy some criteri... | null | CC BY-SA 2.5 | null | 2008-08-05T20:03:46.730 | 2021-12-08T11:52:51.107 | 2021-12-08T11:52:51.107 | 198 | 198 | null |
2,770 | 1 | 2,779 | null | 34 | 16,518 | When working on ASP.NET 1.1 projects I always used the Global.asax to catch all errors. I'm looking for a similar way to catch all exceptions in a Windows Forms user control, which ends up being a hosted IE control. What is the proper way to go about doing something like this?
| Global Exception Handling for winforms control | CC BY-SA 3.0 | 0 | 2008-08-05T20:05:22.077 | 2021-10-25T11:24:34.883 | 2012-05-04T10:03:24.793 | 1,039,608 | 447 | [
"winforms",
"error-handling",
"user-controls"
] |
2,763 | 2 | null | 2,711 | 12 | null | Check out:
- [Open Source Web Designs](http://www.oswd.org/)- [CSS Remix](http://cssremix.com/)- [Best Web Gallery](http://bestwebgallery.com/)- [CSS Based](http://www.cssbased.com/)- [CSS Beauty](http://www.cssbeauty.com/gallery/)- [CSS Genius](http://www.my3w.org)
| null | CC BY-SA 3.0 | null | 2008-08-05T20:00:14.223 | 2014-12-28T11:44:38.030 | 2014-12-28T11:44:38.030 | 4,399,449 | 415 | null |
2,765 | 1 | 2,774 | null | 9 | 743 | I am trying to learn the keyboard shortcuts in Visual Studio in order to be more productive. So I downloaded a document showing many of the default keybindings in Visual Basic when using the VS 2008 IDE from [Microsoft.](http://www.microsoft.com/downloads/details.aspx?familyid=255b8cf1-f6bd-4b55-bb42-dd1a69315833&disp... | Is there a keyboard shortcut to view all open documents in Visual Studio 2008 | CC BY-SA 3.0 | null | 2008-08-05T20:01:31.057 | 2014-12-16T18:26:15.847 | 2014-12-16T18:26:15.847 | 314,291 | 443 | [
"visual-studio",
"keyboard",
"shortcut"
] |
2,774 | 2 | null | 2,765 | 15 | null | This is a conflict between your graphics driver and Visual Studio. Go to your driver settings page (Control panel) and disable the display rotation shortcuts. With this conflict removed, the shortcut will work in Visual Studio.
| null | CC BY-SA 2.5 | null | 2008-08-05T20:08:23.490 | 2008-08-05T20:08:23.490 | null | null | 432 | null |
2,776 | 2 | null | 2,767 | 14 | null | If you use SVN for source control, definitely get VisualSVN. It enables TortoiseSVN interactions from within the Visual Studio IDE.
I also echo the Resharper comment. Retail price is a little steep, but if you're a student or otherwise educationally affiliated, it's actually pretty cheap.
| null | CC BY-SA 2.5 | null | 2008-08-05T20:09:00.557 | 2008-08-05T20:09:00.557 | null | null | 404 | null |
2,772 | 2 | null | 2,767 | 9 | null | [Clipboard Manager](http://www.csharper.net/blog/web_deployer_2005_version_1_0_0_2_available.aspx#new_clipboard_manager_upgrade_1_0_0_4.aspx)
Maintains your clipboard data through removal of lines, a few other nice items but that one alone makes me happy.
[Regionerate](http://www.rauchy.net/regionerate/)
While some ... | null | CC BY-SA 2.5 | null | 2008-08-05T20:05:49.440 | 2008-08-05T20:23:36.720 | 2008-08-05T20:23:36.720 | 36 | 36 | null |
2,779 | 2 | null | 2,770 | 24 | null | You need to handle the `System.Windows.Forms.Application.ThreadException` event for Windows Forms. This article really helped me: [http://bytes.com/forum/thread236199.html](http://bytes.com/forum/thread236199.html).
| null | CC BY-SA 3.0 | null | 2008-08-05T20:11:45.340 | 2012-05-04T10:11:37.397 | 2012-05-04T10:11:37.397 | 1,039,608 | 289 | null |
2,773 | 1 | 2,883 | null | 7 | 2,461 | I've followed this otherwise [excellent tutorial](http://howtoforge.com/ubuntu-8.04-server-install-xen-from-ubuntu-repositories) on getting Xen working with Ubuntu but am not able to get a console into my virtual machine (domU). I've got the `extra = '2 console=xvc0'` line in my /etc/xen/.cfg file like they say, but am... | Can't get a Console to VMs | CC BY-SA 3.0 | null | 2008-08-05T20:06:18.673 | 2012-05-22T16:20:35.610 | 2012-05-22T16:20:35.610 | 866,022 | 422 | [
"ubuntu",
"virtualization",
"xen"
] |
2,775 | 1 | 3,696,991 | null | 86 | 64,204 | Here's what I use:
```
SELECT CAST(FLOOR(CAST(getdate() as FLOAT)) as DATETIME)
```
I'm thinking there may be a better and more elegant way.
Requirements:
- - `datetime`
| How to remove the time portion of a datetime value (SQL Server)? | CC BY-SA 3.0 | 0 | 2008-08-05T20:08:38.653 | 2021-12-22T23:03:46.263 | 2016-03-01T14:49:10.200 | 5,903,382 | 434 | [
"sql-server",
"datetime",
"date-conversion"
] |
2,781 | 2 | null | 2,775 | 12 | null | Your `CAST`-`FLOOR`-`CAST` already seems to be the optimum way, at least on MS SQL Server 2005.
Some other solutions I've seen have a string-conversion, like `Select Convert(varchar(11), getdate(),101)` in them, which is slower by a factor of 10.
| null | CC BY-SA 3.0 | null | 2008-08-05T20:12:29.037 | 2012-05-04T10:02:28.710 | 2012-05-04T10:02:28.710 | 1,039,608 | 91 | null |
2,777 | 2 | null | 2,732 | 6 | null | Allright, I figured it out!
This is a hard bug to catch, but results from the way pipes are handled by the shell. Every element of a pipeline runs in a separate process. When the read command sets var1 and var2, is sets them it its own subshell, not the parent shell. So when the subshell exits, the values of var1 and ... | null | CC BY-SA 3.0 | null | 2008-08-05T20:09:15.377 | 2012-08-04T20:13:29.813 | 2012-08-04T20:13:29.813 | 667,820 | 306 | null |
2,769 | 2 | null | 2,767 | 8 | null | http://trolltech.com/products/qt/">Qt Cross-Platform Application Framework
Qt is a cross-platform application framework for desktop and embedded development. It includes an intuitive API and a rich C++ class library, integrated tools for GUI development and internationalization, and support for Java™ and C++ developme... | null | CC BY-SA 2.5 | null | 2008-08-05T20:04:25.403 | 2008-08-05T20:04:25.403 | null | null | 25 | null |
2,783 | 2 | null | 2,756 | 18 | null | emacs has been used by linux programmers for decades. It features syntax highlighting, it's fast, and there are a million tutorials out there you can find.
| null | CC BY-SA 2.5 | null | 2008-08-05T20:13:16.150 | 2008-08-05T20:13:16.150 | null | null | 306 | null |
2,780 | 1 | 2,789 | null | 25 | 13,120 | Let's say that we have an ARGB color:
```
Color argb = Color.FromARGB(127, 69, 12, 255); //Light Urple.
```
When this is painted on top of an existing color, the colors will blend. So when it is blended with white, the resulting color is `Color.FromARGB(255, 162, 133, 255);`
The solution should work like this:
```... | Converting ARBG to RGB with alpha blending | CC BY-SA 3.0 | 0 | 2008-08-05T20:12:20.487 | 2016-02-07T01:08:27.133 | 2012-05-04T10:00:52.640 | 1,039,608 | 45 | [
"c#",
"colors"
] |
2,787 | 2 | null | 2,756 | 0 | null | any of the popular editors can be turned into an ide.
I use Vi on the console and have used various gui editors over the years. This doesn't just go for linux I use Crimson Editor on windows as a C/python/z80asm ide.
| null | CC BY-SA 2.5 | null | 2008-08-05T20:15:40.123 | 2008-08-05T20:15:40.123 | null | null | 269 | null |
2,794 | 2 | null | 2,785 | -2 | null | Some object suppose the `.dispose()` method which forces the resource to be removed from memory.
| null | CC BY-SA 3.0 | null | 2008-08-05T20:21:17.317 | 2017-08-07T20:52:26.067 | 2017-08-07T20:52:26.067 | 1,704,458 | 383 | null |
2,786 | 1 | 2,944 | null | 33 | 7,772 | I started trying to play with Mono, mostly for fun at the moment. I first tried to use the Visual Studio plugin that will convert a csproj into a makefile, but there seemed to be no version available for Visual Studio 2005. I also read about the MonoDevelop IDE, which sounded nice. Unfortunately, there's no pre-fab Wi... | What's the best setup for Mono development on Windows? | CC BY-SA 3.0 | 0 | 2008-08-05T20:15:22.820 | 2022-01-18T10:29:02.217 | 2013-01-09T05:42:36.687 | 1,471,203 | 404 | [
"windows",
"mono"
] |
2,790 | 2 | null | 2,770 | 6 | null | If you're using VB.NET, you can tap into the very convenient ApplicationEvents.vb. This file comes for free with a VB.NET WinForms project and contains a method for handling [unhandled exceptions](http://msdn.microsoft.com/en-us/library/3a02k5s0(VS.80).aspx).
To get to this nifty file, it's "Project Properties >> App... | null | CC BY-SA 2.5 | null | 2008-08-05T20:16:26.127 | 2008-08-05T20:20:12.360 | 2008-08-05T20:20:12.360 | 308 | 308 | null |
2,791 | 2 | null | 4 | 71 | null | In my opinion, it is desirable to be as explicit as possible. This adds clarity to the code and aids your fellow programmers who may eventually read it.
In addition to (or instead of) appending a `.0` to the number, you can use `decimal.ToDouble()`.
Here are some examples:
```
// Example 1
double transparency = trackBa... | null | CC BY-SA 4.0 | null | 2008-08-05T20:18:30.677 | 2022-08-16T15:14:22.127 | 2022-08-16T15:14:22.127 | 63,550 | 446 | null |
2,797 | 2 | null | 2,785 | 13 | null | No don't null objects. You can check out [https://web.archive.org/web/20160325050833/http://codebetter.com/karlseguin/2008/04/28/foundations-of-programming-pt-7-back-to-basics-memory/](https://web.archive.org/web/20160325050833/http://codebetter.com/karlseguin/2008/04/28/foundations-of-programming-pt-7-back-to-basics-m... | null | CC BY-SA 4.0 | null | 2008-08-05T20:23:33.477 | 2020-11-19T06:38:22.913 | 2020-11-19T06:38:22.913 | -1 | 34 | null |
2,785 | 1 | 2,839 | null | 195 | 109,329 | Should you set all the objects to `null` (`Nothing` in VB.NET) once you have finished with them?
I understand that in .NET it is essential to dispose of any instances of objects that implement the `IDisposable` interface to release some resources although the object can still be something after it is disposed (hence ... | Setting Objects to Null/Nothing after use in .NET | CC BY-SA 3.0 | 0 | 2008-08-05T20:14:10.560 | 2020-11-19T06:38:22.913 | 2019-05-05T16:53:23.673 | 3,072,350 | 33 | [
"c#",
".net",
"vb.net",
"memory-management",
"null"
] |
2,798 | 1 | 2,803 | null | 24 | 10,824 | I've always been intrigued by Map Routing, but I've never found any good introductory (or even advanced!) level tutorials on it. Does anybody have any pointers, hints, etc?
I'm primarily looking for pointers as to how a map system is implemented (data structures, algorithms, etc).
| Map Routing, a la Google Maps? | CC BY-SA 3.0 | 0 | 2008-08-05T20:24:42.960 | 2016-11-20T00:28:03.443 | 2016-05-12T05:57:50.883 | 2,728,855 | 116 | [
"google-maps",
"google-maps-api-3",
"mapping",
"gis"
] |
2,800 | 2 | null | 2,767 | 52 | null | Whole Tomato's [Visual Assist X](http://www.wholetomato.com/). I absolutely swear by it. I would like to see a better plug in for [Lint](http://www.gimpel.com/) than [Visual Lint](http://www.riverblade.co.uk/products/visual_lint/index.html) by Riverblade, but since that will eventually be moved onto the build server I ... | null | CC BY-SA 2.5 | null | 2008-08-05T20:26:26.077 | 2008-08-05T20:26:26.077 | null | null | 342 | null |
2,803 | 2 | null | 2,798 | 15 | null | Take a look at the [open street map project](http://www.openstreetmap.org/) to see how this sort of thing is being tackled in a truely free software project using only user supplied and licensed data and have a [wiki containing stuff you might find interesting](http://wiki.openstreetmap.org/index.php/Main_Page).
A few... | null | CC BY-SA 2.5 | null | 2008-08-05T20:27:36.633 | 2008-08-05T20:27:36.633 | null | null | 269 | null |
2,808 | 2 | null | 2,804 | 2 | null | Depending on the scaling, the relative image pixel could be anywhere in a number of pixels. For example, if the image is scaled down significantly, pixel 2, 10 could represent 2, 10 all the way up to 20, 100), so you'll have to do the math yourself and take full responsibility for any inaccuracies! :-)
| null | CC BY-SA 2.5 | null | 2008-08-05T20:33:01.693 | 2008-08-05T20:33:01.693 | null | null | 192 | null |
2,809 | 1 | 2,842 | null | 11 | 2,766 | The table doesn't have a last updated field and I need to know when existing data was updated. So adding a last updated field won't help (as far as I know).
| SQL Server 2000: Is there a way to tell when a record was last modified? | CC BY-SA 3.0 | null | 2008-08-05T20:33:21.757 | 2012-05-04T09:52:07.767 | 2012-05-04T09:52:07.767 | 1,039,608 | 437 | [
"sql-server"
] |
2,807 | 2 | null | 2,785 | 5 | null | The only time you should set a variable to null is when the variable does not go out of scope and you no longer need the data associated with it. Otherwise there is no need.
| null | CC BY-SA 2.5 | null | 2008-08-05T20:32:48.153 | 2008-08-05T20:32:48.153 | null | null | 45 | null |
2,789 | 2 | null | 2,780 | 19 | null | It's called [alpha blending](http://en.wikipedia.org/wiki/Alpha_compositing).
In psuedocode, assuming the background color (blend) always has 255 alpha. Also assumes alpha is 0-255.
```
alpha=argb.alpha()
r = (alpha/255)*argb.r() + (1 - alpha/255)*blend.r()
g = (alpha/255)*argb.g() + (1 - alpha/255)*blend.g()
b = (al... | null | CC BY-SA 2.5 | null | 2008-08-05T20:16:03.583 | 2008-08-05T21:09:20.187 | 2008-08-05T21:09:20.187 | 2,089,740 | 2,089,740 | null |
2,810 | 2 | null | 2,809 | 0 | null | You can add a timestamp field to that table and update that timestamp value with an update trigger.
| null | CC BY-SA 2.5 | null | 2008-08-05T20:34:41.817 | 2008-08-05T20:34:41.817 | null | null | 39 | null |
2,801 | 2 | null | 2,563 | 3 | null | I'm currently using and we have the Excel copy/paste functionality working. dhtmlXGrid is the most full featured javascript grid package that I've found.
On their website, dhtmlXGrid claims to support [Clipboard functionality](http://dhtmlx.com/docs/products/docsExplorer/index.shtml?node=dhtmlxgrid&type=smpl) in the... | null | CC BY-SA 2.5 | null | 2008-08-05T20:27:23.810 | 2008-08-05T20:27:23.810 | null | null | 237 | null |
2,804 | 1 | 2,808 | null | 21 | 4,573 | I have an application that displays an image inside of a Windows Forms `PictureBox` control. The `SizeMode` of the control is set to `Zoom` so that the image contained in the `PictureBox` will be displayed in an aspect-correct way regardless of the dimensions of the `PictureBox`.
This is great for the visual appearan... | How should I translate from screen space coordinates to image space coordinates in a WinForms PictureBox? | CC BY-SA 3.0 | null | 2008-08-05T20:28:30.143 | 2012-05-04T09:53:41.417 | 2012-05-04T09:53:41.417 | 1,039,608 | 328 | [
"c#",
"winforms",
"picturebox"
] |
2,799 | 2 | null | 2,767 | 35 | null | [PowerCommands](http://www.visualstudiogallery.com/ExtensionDetails.aspx?ExtensionId=df3f0c30-3d37-4e06-9ef8-3bff3508be31) is a Microsoft-created plugin that offers a variety of new features that one would think probably should have been in Visual Studio in the first place.
These include
- - - - -
| null | CC BY-SA 2.5 | null | 2008-08-05T20:26:08.103 | 2008-08-05T20:26:08.103 | null | null | 308 | null |
2,806 | 2 | null | 2,767 | 18 | null | - [Resharper](http://www.jetbrains.com/resharper/index.html)- [Resharper MbUnit Test Runner Add-On](http://code.google.com/p/mbunit-resharper/)- [SQL Prompt](http://www.red-gate.com/Products/SQL_Prompt/index.htm)- [Ankh SVN 2.0](http://ankhsvn.open.collab.net/servlets/ProjectProcess?pageID=3794)- [TeamCity plug-in](htt... | null | CC BY-SA 2.5 | null | 2008-08-05T20:31:21.120 | 2008-08-05T20:31:21.120 | null | null | 307 | null |
2,813 | 2 | null | 2,785 | 7 | null | Also:
```
using(SomeObject object = new SomeObject())
{
// do stuff with the object
}
// the object will be disposed of
```
| null | CC BY-SA 2.5 | null | 2008-08-05T20:37:30.063 | 2008-08-05T20:37:30.063 | null | null | 415 | null |
2,815 | 1 | 2,819 | null | 19 | 7,302 | I would like to make a nightly cron job that fetches my stackoverflow page and diffs it from the previous day's page, so I can see a change summary of my questions, answers, ranking, etc.
Unfortunately, I couldn't get the right set of cookies, etc, to make this work. Any ideas?
Also, when the beta is finished, will ... | How to curl or wget a web page? | CC BY-SA 2.5 | 0 | 2008-08-05T20:38:59.293 | 2016-06-15T08:09:36.167 | 2012-05-08T04:27:10.757 | 116 | 116 | [
"http",
"curl"
] |
2,818 | 2 | null | 2,815 | 3 | null | Nice idea :)
I presume you've used wget's
```
--load-cookies (filename)
```
might help a little but it might be easier to use something like Mechanize (in Perl or python) to mimic a browser more fully to get a good spider.
| null | CC BY-SA 2.5 | null | 2008-08-05T20:43:31.733 | 2008-08-05T20:43:31.733 | null | null | 269 | null |
2,817 | 2 | null | 2,770 | 11 | null | Currently in my winforms app I have handlers for `Application.ThreadException`, as above, but also `AppDomain.CurrentDomain.UnhandledException`
Most exceptions arrive via the `ThreadException` handler, but the AppDomain has also caught a few in my experience
| null | CC BY-SA 4.0 | null | 2008-08-05T20:42:31.020 | 2021-10-25T11:24:34.883 | 2021-10-25T11:24:34.883 | 17,169,050 | 234 | null |
2,821 | 2 | null | 2,785 | 1 | null | There are some cases where it makes sense to null references. For instance, when you're writing a collection--like a priority queue--and by your contract, you shouldn't be keeping those objects alive for the client after the client has removed them from the queue.
But this sort of thing only matters in long lived col... | null | CC BY-SA 2.5 | null | 2008-08-05T20:46:08.033 | 2008-08-05T20:46:08.033 | null | null | 429 | null |
2,819 | 2 | null | 2,815 | 9 | null | Your status page is available now without logging in (click [logout](https://stackoverflow.com/users/logout?returnurl=%2fquestions%2f2815%2fhow-to-curl-or-wget-a-stackoverflow-page) and try it). When the beta-cookie is disabled, there will be nothing between you and your status page.
For wget:
```
wget --no-cookies -... | null | CC BY-SA 3.0 | null | 2008-08-05T20:43:52.017 | 2016-06-15T08:09:36.167 | 2017-05-23T11:46:21.563 | -1 | 30 | null |