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 ⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
32,086 | 2 | null | 31,849 | 2 | null | I did a test where I listened for key up events on the stage and noticed that (on my Mac) I could capture control-c, control-v, etc. just fine, but anything involving command (the key) wasn't captured until I released the command key, and then ctrlKey was false (even though the docs says that ctrlKey should be true f... | null | CC BY-SA 2.5 | null | 2008-08-28T12:32:06.563 | 2008-08-28T12:32:06.563 | null | null | 1,109 | null |
32,131 | 2 | null | 28,756 | 0 | null | If you need to count and then loop you may be better off with a list.
If you're using count to check for members you can use `Any()` to avoid enumerating the entire collection.
| null | CC BY-SA 2.5 | null | 2008-08-28T12:49:57.147 | 2008-08-28T12:49:57.147 | null | null | 905 | null |
32,149 | 1 | 33,168 | null | 26 | 13,770 | Does anyone have a trusted Proper Case or PCase algorithm (similar to a UCase or Upper)? I'm looking for something that takes a value such as `"GEORGE BURDELL"` or `"george burdell"` and turns it into `"George Burdell"`.
I have a simple one that handles the simple cases. The ideal would be to have something that can... | Does anyone have a good Proper Case algorithm | CC BY-SA 3.0 | 0 | 2008-08-28T12:55:58.193 | 2021-08-31T03:02:26.017 | 2011-11-22T07:26:53.680 | 365,102 | 3,203 | [
"algorithm",
"string"
] |
32,148 | 2 | null | 9,033 | 24 | null | [true](http://msdn.microsoft.com/en-us/library/6x6y6z4d.aspx) and [false](http://msdn.microsoft.com/en-us/library/6292hy1k.aspx) operators are really weird.
More comprehensive example can be found [here](http://www.java2s.com/Tutorial/CSharp/0160__Operator-Overload/truefalseoperatorforComplex.htm).
[What’s the false ... | null | CC BY-SA 2.5 | null | 2008-08-28T12:55:57.850 | 2008-09-22T19:03:55.327 | 2017-05-23T12:34:51.197 | -1 | 2,361 | null |
32,158 | 2 | null | 32,151 | 0 | null | i believe [open office](http://www.openoffice.org/) can both open .html files and create .doc files
| null | CC BY-SA 2.5 | null | 2008-08-28T12:58:35.097 | 2008-08-28T13:30:19.780 | 2008-08-28T13:30:19.780 | 2,083 | 2,083 | null |
32,151 | 1 | 32,176 | null | 16 | 41,376 | Is there a way to export a simple HTML page to Word (.doc format, not .docx) without having Microsoft Word installed?
| Best way to export html to Word without having MS Word installed? | CC BY-SA 4.0 | 0 | 2008-08-28T12:57:11.840 | 2020-03-23T09:09:37.260 | 2020-03-23T09:09:12.010 | 1,442,180 | 3,396 | [
"html",
"ms-word"
] |
32,155 | 2 | null | 32,144 | 3 | null | You may have to be more specific about what a "novell server" is. From what I understand, Novell servers run some form of Suse linux. Sql Server is a windows only product.
My company, however, does have clients that run Novell networks, and we do run Sql Servers on their network. But they're hosted on a win box..... | null | CC BY-SA 2.5 | null | 2008-08-28T12:58:20.183 | 2008-08-28T12:58:20.183 | null | null | null | null |
32,146 | 2 | null | 32,087 | 0 | null | Scripting is a blast.
Personally I like to write some evil little batch files. You can find a command line program to do just about anything. I prefer Batch files mostly because they are portable from one machine to another with at most a zip with a few unix tools (SSED, GREP, GAWK). there is a commandline REG.Exe t... | null | CC BY-SA 2.5 | null | 2008-08-28T12:54:16.590 | 2008-08-28T12:54:16.590 | null | null | 2,818 | null |
32,160 | 2 | null | 31,794 | 0 | null | Visual Studio doesn't make it obvious which assembly reference you need to add. One way to find out would be to look up ConfigurationManager in the MSDN Library. At the top of the "about ConfigurationManager class" page it tells you which assembly and DLL the class is in.
| null | CC BY-SA 2.5 | null | 2008-08-28T12:58:50.587 | 2008-08-28T12:58:50.587 | null | null | 1,016 | null |
32,161 | 2 | null | 31,870 | 5 | null | Now that there's Unicode, it's generally counter-productive to use named character entities. I would recommend using the Unicode character for a non-breaking space instead of an entity, just for that reason. Alternatively, you could use the entity ` `;, instead of the named entity. Using named entities makes you... | null | CC BY-SA 2.5 | null | 2008-08-28T12:59:00.603 | 2008-08-28T12:59:00.603 | null | null | 207 | null |
32,159 | 2 | null | 32,059 | 0 | null | ```
select
page.content,
count(pageTag.tagID) as tagCount
from
page
inner join pageTag on page.ID = pageTag.pageID
where
pageTag.tagID in (1, 3, 8)
group by
page.content
order by
tagCount desc
```
That gives you the number of tags per each page; ordered by the higher number of tags
I... | null | CC BY-SA 2.5 | null | 2008-08-28T12:58:37.750 | 2008-08-28T13:14:55.247 | 2008-08-28T13:14:55.247 | 3,241 | 3,241 | null |
32,145 | 1 | null | null | 8 | 4,028 | I'm going to try something with the format of this question and I'm very open to suggestions about a better way to handle it.
I didn't want to just dump a bunch of code in the question so I've posted the code for the class on `refactormycode`.
[base class for easy class property handling](http://www.refactormycode.co... | Is this a reasonable way to handle getters/setters in a PHP class? | CC BY-SA 4.0 | 0 | 2008-08-28T12:54:09.570 | 2019-01-18T11:13:48.393 | 2019-01-18T11:13:48.393 | 567,854 | 305 | [
"php",
"oop"
] |
32,176 | 2 | null | 32,151 | 12 | null | If you have only simple HTML pages as you said, it can be opened with Word.
Otherwise, there are some libraries which can do this, but I don't have experience with them.
My last idea is that if you are using ASP.NET, try to add `application/msword` to the header and you can save it as a Word document (it won't be a r... | null | CC BY-SA 4.0 | null | 2008-08-28T13:03:33.900 | 2020-03-23T09:09:37.260 | 2020-03-23T09:09:37.260 | 1,442,180 | 968 | null |
32,173 | 1 | 32,473 | null | 3 | 6,955 | I'm trying to disable a bunch of controls with JavaScript (so that they post back values). All the controls work fine except for my radio buttons as they lose their value. In the below code which is called via a recursive function to disable all child controls the Second else (else if (control is `RadioButton`)) is nev... | Disable asp.net radiobutton with javascript | CC BY-SA 3.0 | 0 | 2008-08-28T13:03:20.857 | 2015-12-03T19:45:11.837 | 2015-12-03T19:45:11.837 | 3,393,505 | 2,808 | [
"c#",
"javascript",
"asp.net"
] |
32,183 | 2 | null | 32,151 | 1 | null | I presume from the "C#" tag you wish to achieve this programmatically.
Try [Aspose.Words for .NET](http://www.aspose.com/categories/file-format-components/aspose.words-for-.net-and-java/default.aspx).
| null | CC BY-SA 2.5 | null | 2008-08-28T13:05:15.143 | 2008-08-28T13:05:15.143 | null | null | 2,084 | null |
32,180 | 2 | null | 32,168 | 1 | null | C-style cast syntax, do not error check.
C++-style cast syntax, does some checking.
When using static_cast, even if it doesn't do checking, at least you know you should be carefull here.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:04:20.573 | 2008-08-28T13:04:20.573 | null | null | 2,566 | null |
32,175 | 1 | 32,196 | null | 38 | 32,642 | I'm trying to install a .NET service I wrote. As recommended by MSDN, I'm using InstallUtil. But I have missed how I can set the default service user on the command-line or even in the service itself. Now, when InstallUtil is run, it will display a dialog asking the user for the credentials for a user. I'm trying t... | Installing a .NET service using InstallUtil | CC BY-SA 2.5 | 0 | 2008-08-28T13:03:25.240 | 2018-06-03T06:29:24.237 | null | null | 2,494 | [
".net",
"windows-services",
"installutil"
] |
32,165 | 2 | null | 32,144 | 1 | null | SQL Server, although rooted in a Sybase/Unix/VMS background, is a native windows application. Apart from the compact edition (which runs on some Windows mobile platforms), SQL Server runs on Windows desktop and server operating systems.
More informaiton can be found at [wikipedia](http://en.wikipedia.org/wiki/Microsof... | null | CC BY-SA 2.5 | null | 2008-08-28T13:00:01.723 | 2008-08-28T13:00:01.723 | null | null | 1,521 | null |
32,168 | 1 | 32,224 | null | 37 | 17,779 | A question related to [Regular cast vs. static_cast vs. dynamic_cast](https://stackoverflow.com/questions/28002):
What cast syntax style do you prefer in C++?
- `(int)foo`- `static_cast<int>(foo)`- `int(foo)`
They may not translate to exactly the same instructions (do they?) but their effect should be the same (righ... | C++ cast syntax styles | CC BY-SA 2.5 | 0 | 2008-08-28T13:01:41.720 | 2016-12-23T14:48:58.503 | 2017-05-23T11:47:26.357 | -1 | 2,686 | [
"c++",
"coding-style",
"casting"
] |
32,189 | 2 | null | 32,149 | 1 | null | What programming language do you use? Many languages allow callback functions for regular expression matches. These can be used to propercase the match easily. The regular expression that would be used is quite simple, you just have to match all word characters, like so:
```
/\w+/
```
Alternatively, you can already ... | null | CC BY-SA 2.5 | null | 2008-08-28T13:06:28.917 | 2008-08-28T13:06:28.917 | null | null | 1,968 | null |
32,191 | 2 | null | 32,145 | 5 | null | The way I do it is the following:
```
class test {
protected $x='';
protected $y='';
function set_y ($y) {
print "specific function set_y\n";
$this->y = $y;
}
function __call($function , $args) {
print "generic function $function\n";
list ($name , $var ) = split ('... | null | CC BY-SA 3.0 | null | 2008-08-28T13:06:47.823 | 2011-11-28T23:20:49.430 | 2011-11-28T23:20:49.430 | 7,894 | 238 | null |
32,153 | 2 | null | 31,215 | 1 | null | If you are using C# 3.0, you can use [Object Initializers](http://msdn.microsoft.com/en-us/library/bb384062.aspx):
```
public Person()
{
}
public string Logon { get; set; }
public string Badge { get; set; }
```
You would call the constructor like this:
```
var p1 = new Person { Logon = "Steve" };
var p2 = new Pers... | null | CC BY-SA 3.0 | null | 2008-08-28T12:57:31.760 | 2011-11-08T18:50:09.967 | 2011-11-08T18:50:09.967 | 44,390 | 632 | null |
32,201 | 2 | null | 32,151 | 2 | null | While it is possible to make a ".doc" Microsoft Word file, it would probably be easier and more portable to make a ".rtf" file.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:08:50.330 | 2008-08-28T13:08:50.330 | null | null | 619 | null |
32,202 | 2 | null | 32,175 | 0 | null | Are you being asked for the account to run the service under, or for rights to install the service? For the second, installing as admin should prevent that from happening. For the first, you have to add a ServiceProcessInstaller to your Installer.
I believe the design surface for a service has a link to create a Pro... | null | CC BY-SA 2.5 | null | 2008-08-28T13:09:39.687 | 2008-08-28T13:09:39.687 | null | null | null | null |
32,194 | 2 | null | 32,168 | 15 | null | According to [Stroustrup](http://www.research.att.com/~bs/bs_faq2.html#static-cast):
> The "new-style casts" were introduced
to give programmers a chance to state
their intentions more clearly and for
the compiler to catch more errors.
So really, its for safety as it does extra compile-time checking.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:07:28.523 | 2008-08-28T13:07:28.523 | null | null | 2,009 | null |
32,203 | 2 | null | 32,173 | 0 | null | Off the top of my head, I think you have to check the "type" attribute of the checkbox to determine if it's a radio button.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:10:11.247 | 2008-08-28T13:10:11.247 | null | null | null | null |
32,171 | 2 | null | 32,151 | 1 | null | Well, there are many third party tools for this. I don't know if it gets any simpler than that.
Examples:
- [http://htmltortf.com/](http://htmltortf.com/)- [http://www.brothersoft.com/windows-html-to-word-2008-56150.html](http://www.brothersoft.com/windows-html-to-word-2008-56150.html)- [http://www.eprintdriver.com/t... | null | CC BY-SA 2.5 | null | 2008-08-28T13:02:29.457 | 2008-08-28T13:02:29.457 | null | null | 3,397 | null |
32,195 | 2 | null | 31,865 | 4 | null | Microsoft is walking a fine line. On one hand, they regularly send ActiveX killbits with Windows Update to remove/disable applications that have been misbehaving. On the other hand, the latest version of Sharepoint 2007 (can't speak for earlier versions) allows for Office documents to be opened by clicking a link in ... | null | CC BY-SA 2.5 | null | 2008-08-28T13:07:31.863 | 2008-08-28T13:07:31.863 | null | null | 2,470 | null |
32,198 | 1 | 32,242 | null | 4 | 3,431 | I am looking for any strategies people use when implementing server applications that service client TCP (or UDP) requests: design patterns, implementation techniques, best practices, etc.
Let's assume for the purposes of this question that the requests are relatively long-lived (several minutes) and that the traffic ... | How do you minimize the number of threads used in a tcp server application? | CC BY-SA 2.5 | 0 | 2008-08-28T13:07:57.307 | 2015-08-19T23:39:46.863 | 2008-09-14T15:14:36.830 | -1 | 1,219 | [
"multithreading",
"sockets",
"tcp",
"udp"
] |
32,217 | 2 | null | 32,085 | 4 | null | Generally in XSLT things aren't referred to as `Arrays`, since there is really no such thing in XSLT. The technical term is either `nodesets` (made up of zero or more nodes) or in XSLT 2.0 `sequences`.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:14:05.903 | 2008-08-28T13:14:05.903 | null | null | 1,908 | null |
32,218 | 2 | null | 32,145 | 2 | null | Yes that's right the variables have to be manually declared but i find that better since I fear a typo in the setter
```
$props2->setFristName('Mark');
```
will auto-generate a new property (FristName instead of FirstName) which will make debugging harder.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:14:11.800 | 2008-08-28T13:14:11.800 | null | null | 238 | null |
32,221 | 2 | null | 31,672 | 7 | null | As someone with experience in both FORTRAN (77 flavor although it has been a while since I used it seriously) and C/C++ the item to watch out for that immediately jumps to mind are arrays. FORTRAN arrays start with an index of 1 instead of 0 as they do in C/C++/Java. Also, memory arrangement is reversed. So incremen... | null | CC BY-SA 2.5 | null | 2008-08-28T13:14:58.193 | 2008-08-28T13:14:58.193 | null | null | 171 | null |
32,196 | 2 | null | 32,175 | 46 | null | I think I may have found it. In the service itself, the automatically created ServiceProcessInstaller component has a property "Account" which can be set to "LocalService", "LocalSystem", "NetworkService" or "User". It was defaulting to "User" which must have displayed the prompt.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:07:36.167 | 2008-08-28T13:07:36.167 | null | null | 2,494 | null |
32,222 | 2 | null | 32,144 | 2 | null | SQL Server is a Windows app. Novel is either one of:
Novell
or
Linux
Neither of these are windows :) It's like asking "why can't I run this Mac application on my windows box". Or "why will my petrol car not run on diesel?"
There are old version of Sybase, which SQL Server sprang from, which COULD run on Novell Netwa... | null | CC BY-SA 2.5 | null | 2008-08-28T13:15:45.023 | 2008-08-28T13:15:45.023 | null | null | 2,947 | null |
32,228 | 2 | null | 32,168 | 4 | null | Definitely C++-style. The extra typing will help prevent you from casting when you shouldn't :-)
| null | CC BY-SA 2.5 | null | 2008-08-28T13:17:26.207 | 2008-08-28T13:17:26.207 | null | null | 3,279 | null |
32,224 | 2 | null | 32,168 | 60 | null | It's best practice to use C-style casts for three main reasons:
- - -
As palm3D noted:
> I find C++-style cast syntax too verbose.
This is intentional, for the reasons given above.
The constructor syntax (official name: function-style cast) is semantically as the C-style cast and should be avoided as well (exce... | null | CC BY-SA 3.0 | null | 2008-08-28T13:16:18.267 | 2015-09-28T18:08:04.193 | 2015-09-28T18:08:04.193 | 3,852,968 | 1,968 | null |
32,231 | 1 | 32,297 | null | 3 | 511 | Are there any rapid Database protoyping tools that don't require me to declare a database schema, but rather create it based on the way I'm using my entities.
For example, assuming an empty database (pseudo code):
```
user1 = new User() // Creates the user table with a single id column
user1.firstName = "Allain" // ... | Adaptive Database | CC BY-SA 2.5 | null | 2008-08-28T13:18:23.567 | 2008-09-09T14:57:35.243 | null | null | 2,443 | [
"database",
"orm"
] |
32,232 | 2 | null | 20,376 | 10 | null | The Internet Explorer 8 beta (2) has a builtin Javascript profiler (in the developer toolbar). It's worth playing with at least...
| null | CC BY-SA 2.5 | null | 2008-08-28T13:19:26.513 | 2008-08-28T13:19:26.513 | null | null | 1,948 | null |
32,219 | 2 | null | 32,145 | 1 | null | I like having methods instead of just using public fields, as well, but my problem with PHP's default implementation (using __get() and __set()) or your custom implementation is that you aren't establishing getters and setters on a per-property basis. My problem with this is that adding "more logic later" requires that... | null | CC BY-SA 2.5 | null | 2008-08-28T13:14:25.543 | 2008-08-28T13:14:25.543 | null | null | 1,344 | null |
32,225 | 2 | null | 32,168 | 3 | null | I use static_cast for two reasons.
1. It's explicitly clear what's taking place. I can't read over that without realizing there's a cast going on. With C-style casts you eye can pass right over it without pause.
2. It's easy to search for every place in my code where I'm casting.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:16:29.983 | 2008-08-28T13:16:29.983 | null | null | 1,288 | null |
32,233 | 2 | null | 32,100 | 32 | null | In T-Sql there are two ways:
```
--filter out the max
select max( col )
from [table]
where col < (
select max( col )
from [table] )
--sort top two then bottom one
select top 1 col
from (
select top 2 col
from [table]
order by col) topTwo
order by col desc
```
In Microsoft SQL the first way is... | null | CC BY-SA 3.0 | null | 2008-08-28T13:19:30.587 | 2011-04-12T10:04:49.840 | 2011-04-12T10:04:49.840 | 905 | 905 | null |
32,193 | 2 | null | 23,217 | 2 | null | The origins of `javascript:` in an event handler is actually just an IE specific thing so that you can specify the language in addition to the handler. This is because `vbscript` is also a supported client side scripting language in IE. Here's an example of ["vbscript:"](http://www.visualbasicscript.com/m_50201/tm.htm)... | null | CC BY-SA 3.0 | null | 2008-08-28T13:07:28.273 | 2016-02-10T16:25:12.200 | 2016-02-10T16:25:12.200 | 92,701 | 2,828 | null |
32,227 | 1 | 39,350 | null | 2 | 1,496 | Suppose that I have a form that contains three 10 fields: field1..field10. I store the form data in one or more database tables, probably using 10 database columns.
Now suppose a few months later that I want to add 3 more fields. And in the future I may add/delete fields from this form based on changing requireme... | Data model for a extensible web form | CC BY-SA 2.5 | 0 | 2008-08-28T13:17:20.263 | 2010-01-21T13:15:26.630 | null | null | 3,401 | [
"database-design",
"forms"
] |
32,236 | 2 | null | 32,149 | 0 | null | a simple way to capitalise the first letter of each word (seperated by a space)
```
$words = explode(” “, $string);
for ($i=0; $i<count($words); $i++) {
$s = strtolower($words[$i]);
$s = substr_replace($s, strtoupper(substr($s, 0, 1)), 0, 1);
$result .= “$s “;
}
$string = trim($result);
```
in terms of catching the ... | null | CC BY-SA 2.5 | null | 2008-08-28T13:19:46.170 | 2008-08-28T13:19:46.170 | null | null | 2,083 | null |
32,242 | 2 | null | 32,198 | 6 | null | The modern approach is to make use of the operating system to multiplex many network sockets for you, freeing your application to only processing active connections with traffic.
Whenever you open a socket it's associated it with a selector. You use a single thread to poll that selector. Whenever data arrives, the sel... | null | CC BY-SA 3.0 | null | 2008-08-28T13:23:31.200 | 2015-08-19T23:39:46.863 | 2015-08-19T23:39:46.863 | 811 | 758 | null |
32,249 | 2 | null | 32,149 | -1 | null | You do not mention which language you would like the solution in so here is some pseudo code.
```
Loop through each character
If the previous character was an alphabet letter
Make the character lower case
Otherwise
Make the character upper case
End loop
```
| null | CC BY-SA 2.5 | null | 2008-08-28T13:24:49.120 | 2008-08-28T13:24:49.120 | null | null | 383 | null |
32,210 | 2 | null | 32,168 | 1 | null | C-style cast is the worst way to go. It's harder to see, ungreppable, conflates different actions that should not be conflated, and can't do everything that C++-style casts can do. They really should have removed C-style casts from the language.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:11:10.433 | 2008-08-28T13:11:10.433 | null | null | 2,131 | null |
32,257 | 2 | null | 32,246 | 1 | null | Have you thought about including links for different sites on the homepage? Google could follow those and index their content as well - in turn indexing the UK content.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:27:14.310 | 2008-08-28T13:27:14.310 | null | null | 2,025 | null |
32,246 | 1 | 32,263 | null | 0 | 222 | OK. This problem is doing my head in. And I don't know if there even IS a definitive answer.
We have a website, lets call it . It's a UK-based site, with UK based content. Google knows about it, and we have done a load of SEO on it. All is well.
, we are about to relaunch , so we now need mycompany.com/uk, mycompany.... | how to get the googlebot to get the correct GEOIPed content? | CC BY-SA 3.0 | null | 2008-08-28T13:24:09.013 | 2015-12-03T19:46:09.913 | 2015-12-03T19:46:09.913 | 3,393,505 | 2,947 | [
"seo",
"bots",
"google-search"
] |
32,258 | 2 | null | 31,800 | 1 | null | The answer from Ubiguchi had what I needed, except that I now think a redirect is the way to go, via the link to the HTTP 1.1 specifiction section on response codes. It turns out that I actually need a 301 redirect because the URI I'm redirecting to is more 'correct' and stable, and should therefore be used for future ... | null | CC BY-SA 2.5 | null | 2008-08-28T13:27:57.850 | 2008-08-28T13:27:57.850 | null | null | 2,670 | null |
32,241 | 1 | 32,429 | null | 8 | 3,434 | [Using this question](https://stackoverflow.com/questions/32149/does-anyone-have-a-good-proper-case-algorithm) as the base is there an alogrithm or coding example to change some text to Pascal or Camel casing.
For example:
```
mynameisfred
```
becomes
```
Camel: myNameIsFred
Pascal: MyNameIsFred
```
| Algorithm to format text to Pascal or camel casing | CC BY-SA 2.5 | null | 2008-08-28T13:23:07.863 | 2013-04-05T11:04:06.813 | 2017-05-23T11:45:26.253 | -1 | 1,075 | [
"algorithm",
"coding-style",
"camelcasing",
"pascalcasing"
] |
32,243 | 1 | 32,302 | null | 113 | 100,572 | The following PHP code snippet uses GD to resize a browser-uploaded PNG to 128x128. It works great, except that the transparent areas in the original image are being replaced with a solid color- black in my case.
Even though `imagesavealpha` is set, something isn't quite right.
What's the best way to preserve the tr... | Can PNG image transparency be preserved when using PHP's GDlib imagecopyresampled? | CC BY-SA 3.0 | 0 | 2008-08-28T13:23:33.320 | 2022-05-23T09:26:17.830 | 2013-04-04T15:34:49.957 | 1,612,146 | 1,820 | [
"php",
"png",
"transparency",
"gd",
"alpha"
] |
32,234 | 2 | null | 32,168 | 7 | null | Regarding this subject, I'm following the recommandations made by [Scott Meyers](http://en.wikipedia.org/wiki/Scott_Meyers) ([More Effective C++](https://rads.stackoverflow.com/amzn/click/com/020163371X), Item 2 : Prefer C++-style casts).
I agree that C++ style cast are verbose, but that's what I like about them : the... | null | CC BY-SA 2.5 | null | 2008-08-28T13:19:32.160 | 2008-08-28T13:19:32.160 | null | null | 2,796 | null |
32,267 | 2 | null | 32,168 | 1 | null | We currently use C-style casts everywhere. I asked the other [casting question](https://stackoverflow.com/questions/28002), and I now see the advantage of using static_cast instead, if for no other reason than it's "greppable" (I like that term). I will probably start using that.
I don't like the C++ style; it looks t... | null | CC BY-SA 2.5 | null | 2008-08-28T13:30:28.360 | 2008-08-28T13:30:28.360 | 2017-05-23T11:47:26.357 | -1 | 1,821 | null |
32,263 | 2 | null | 32,246 | 2 | null | As long as Google can find mycompany.com/uk and mycompany.com/au, it'll index all three versions of the site. Your domain's Google juice should apply to all three URLs just fine if they're on the same domain.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:29:38.330 | 2009-07-06T08:15:02.533 | 2009-07-06T08:15:02.533 | 23,354 | 1,902,010 | null |
32,273 | 2 | null | 31,287 | 0 | null | Thanks for all the answers. So RAM is the key.
As far as dual monitor capability, I found that I could use dual monitors, as long as one of those monitors was my actual machine. And that was what I wanted anyway.
Mike
| null | CC BY-SA 2.5 | null | 2008-08-28T13:32:39.587 | 2008-08-28T13:32:39.587 | null | null | 785 | null |
32,270 | 2 | null | 32,243 | 12 | null | I believe this should do the trick:
```
$srcImage = imagecreatefrompng($uploadTempFile);
imagealphablending($srcImage, false);
imagesavealpha($srcImage, true);
```
Someone in the PHP docs claims `imagealphablending` should be true, not false. YMMV.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:32:15.220 | 2008-08-28T13:32:15.220 | null | null | 1,902,010 | null |
32,260 | 1 | 32,336 | null | 951 | 648,452 | Instead of relying on my host to send an email, I was thinking of sending the email messages using my account. The emails are personalized emails to the bands I play on my show.
Is it possible to do it?
| Sending email in .NET through Gmail | CC BY-SA 4.0 | 0 | 2008-08-28T13:28:38.147 | 2022-12-18T11:37:20.933 | 2020-04-19T17:29:39.007 | 806,202 | 2,535 | [
"c#",
".net",
"email",
"smtp",
"gmail"
] |
32,277 | 2 | null | 32,241 | 0 | null | The only way to do that would be to run each section of the word through a dictionary.
"mynameisfred" is just an array of characters, splitting it up into my Name Is Fred means understanding what the joining of each of those characters means.
You could do it easily if your input was separated in some way, e.g. "my na... | null | CC BY-SA 2.5 | null | 2008-08-28T13:33:49.100 | 2008-08-28T13:33:49.100 | null | null | 986 | null |
32,281 | 2 | null | 29,624 | 0 | null | You could try cloning using the innerHTML method, or a mix:
```
var newItem = $(item).cloneNode(false);
newItem.innerHTML = $(item).innerHTML;
```
Also: I think cloneNode doesn't clone events, registered with addEventListener. But IE's attachEvent events cloned. But I might be wrong.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:34:50.797 | 2008-08-28T13:34:50.797 | null | null | 56 | null |
32,280 | 1 | 33,552 | null | 20 | 44,990 | I am in the middle of reading the excellent [Clean Code](https://rads.stackoverflow.com/amzn/click/com/0132350882)
One discussion is regarding passing nulls into a method.
```
public class MetricsCalculator {
public double xProjection(Point p1, Point p2) {
return (p2.x - p1.x) * 1.5;
}
}
...
calculato... | Passing null to a method | CC BY-SA 2.5 | 0 | 2008-08-28T13:34:40.313 | 2018-12-20T12:55:18.797 | null | null | 3,295 | [
"java",
"null",
"assert"
] |
32,223 | 2 | null | 27,581 | 88 | null | A clarification about the `obj.getClass() != getClass()`.
This statement is the result of `equals()` being inheritance unfriendly. The JLS (Java language specification) specifies that if `A.equals(B) == true` then `B.equals(A)` must also return `true`. If you omit that statement inheriting classes that override `equal... | null | CC BY-SA 3.0 | null | 2008-08-28T13:16:01.593 | 2014-08-12T19:54:24.783 | 2014-08-12T19:54:24.783 | 2,642,204 | 931 | null |
32,287 | 2 | null | 32,282 | 6 | null | [RegexBuddy](http://www.regexbuddy.com/) is a weapon of choice
| null | CC BY-SA 2.5 | null | 2008-08-28T13:36:45.693 | 2008-08-28T13:36:45.693 | null | null | 1,196 | null |
32,284 | 2 | null | 32,100 | 0 | null | See [How to select the nth row in a SQL database table?](https://stackoverflow.com/questions/16568).
Sybase SQL Anywhere supports:
```
SELECT TOP 1 START AT 2 value from table ORDER BY value
```
| null | CC BY-SA 2.5 | null | 2008-08-28T13:36:14.773 | 2008-08-28T13:36:14.773 | 2017-05-23T10:31:17.150 | -1 | 1,821 | null |
32,279 | 2 | null | 31,930 | 0 | null | I tried to remove the reportStream Attachment:
```
//if (reportStream != null)
//emailMessage.Attachments.Add(new Attachment(reportStream, reportName));
```
And now it works fine.
So it is something to do with the reportStream.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:33:52.047 | 2008-08-28T13:33:52.047 | null | null | 2,972 | null |
32,282 | 1 | 32,290 | null | 85 | 49,399 | How can I test the same regex against different regular expression engines?
| How can test I regular expressions using multiple RE engines? | CC BY-SA 3.0 | 0 | 2008-08-28T13:34:55.510 | 2014-06-16T10:06:01.133 | 2014-02-26T04:55:13.727 | 1,269,037 | 2,820 | [
"regex",
"testing"
] |
32,289 | 2 | null | 31,561 | 0 | null | I'm definitely aware that there are syntactic differences, though I'm certainly not fluent enough yet to automatically use them, making the code look much more similar currently ;-).
And I had a feeling your answer would be the case, but can always hope for a shortcut <_<.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:36:56.783 | 2008-08-28T13:36:56.783 | null | null | 3,326 | null |
32,288 | 2 | null | 32,282 | 16 | null | [RegexBuddy](http://www.regexbuddy.com/)
| null | CC BY-SA 2.5 | null | 2008-08-28T13:36:46.923 | 2008-08-28T13:36:46.923 | null | null | 2,083 | null |
32,255 | 2 | null | 32,198 | 0 | null | G'day,
I'd start by looking at the metaphor you want to use for your thread framework.
Maybe "leader follower" where a thread is listening for incoming requests and when a new request comes in it does the work and the next thread in the pool starts listening for incoming requests.
Or thread pool where the same threa... | null | CC BY-SA 2.5 | null | 2008-08-28T13:26:41.723 | 2008-08-28T13:26:41.723 | null | null | 2,974 | null |
32,291 | 2 | null | 32,282 | 1 | null | Regexbuddy does all this. [http://www.regexbuddy.com/](http://www.regexbuddy.com/)
| null | CC BY-SA 2.5 | null | 2008-08-28T13:37:36.237 | 2008-08-28T13:37:36.237 | null | null | 987 | null |
32,294 | 2 | null | 32,282 | 2 | null | [RegexBuddy](http://www.regexbuddy.com/) is great!!!
| null | CC BY-SA 2.5 | null | 2008-08-28T13:38:49.557 | 2008-08-28T13:38:49.557 | null | null | 3,201 | null |
32,292 | 2 | null | 32,282 | 1 | null | see the accepted answer to this question: [Learning Regular Expressions](https://stackoverflow.com/questions/4736/learning-regular-expressions#4741)
| null | CC BY-SA 2.5 | null | 2008-08-28T13:38:13.443 | 2008-08-28T13:38:13.443 | 2017-05-23T12:33:26.220 | -1 | 2,541 | null |
32,298 | 2 | null | 32,282 | 7 | null | [Rubular](http://www.rubular.com/) is free, easy to use and looks nice.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:39:31.987 | 2008-08-28T13:39:31.987 | null | null | 619 | null |
32,300 | 2 | null | 32,282 | 10 | null | I use Expresso ([www.ultrapico.com](http://www.ultrapico.com/)). It has a lot of nice features for the developer. The Regulator used to be my favorite, but it hasn't been updated in so long and I constantly ran into crashes with complicated RegExs.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:40:23.407 | 2008-08-28T13:40:23.407 | null | null | 2,626 | null |
32,303 | 2 | null | 30,281 | 15 | null | In our [JBoss Seam in Action presentation](http://www.lunatech-research.com/archives/2007/12/14/javapolis-2007-seam) at the Javapolis conference last year, my colleague and I said that 'Seam is the next Struts'. This needed some explanation, which I later wrote-up as [Seam is the new Struts](http://www.lunatech-researc... | null | CC BY-SA 2.5 | null | 2008-08-28T13:41:16.070 | 2008-09-01T22:17:56.097 | 2008-09-01T22:17:56.097 | 2,670 | 2,670 | null |
32,301 | 2 | null | 32,231 | 0 | null | May be not exactly responding to your question, but if you used [(N)Hibernate](http://www.hibernate.org) then you can automatically generate the database schema from your hbm mapping files.
Its not done directly from your code as you seem to be wanting but Hibernate Schema generation seems to work well for us
| null | CC BY-SA 2.5 | null | 2008-08-28T13:40:26.493 | 2008-08-28T13:40:26.493 | null | null | 2,839 | null |
32,302 | 2 | null | 32,243 | 215 | null | ```
imagealphablending( $targetImage, false );
imagesavealpha( $targetImage, true );
```
did it for me. Thanks ceejayoz.
note, the target image needs the alpha settings, not the source image.
Edit:
full replacement code. See also answers below and their comments. This is not guaranteed to be be perfect in any way, ... | null | CC BY-SA 3.0 | null | 2008-08-28T13:41:12.640 | 2014-01-27T20:54:31.007 | 2014-01-27T20:54:31.007 | 126,001 | 1,820 | null |
32,290 | 2 | null | 32,282 | 75 | null | The most powerful free online regexp testing tool is by far [http://regex101.com/](http://regex101.com/) - lets you select the RE engine (PCRE, JavaScript, Python), has a debugger, colorizes the matches, explains the regexp on the fly, can create permalinks to the regex playground.
Other online tools:
- [http://www.r... | null | CC BY-SA 3.0 | null | 2008-08-28T13:37:34.410 | 2014-02-26T05:27:47.913 | 2017-05-23T12:13:34.533 | -1 | 238 | null |
32,310 | 2 | null | 32,280 | 2 | null | I prefer the use of assertions.
I have a rule that I only use assertions in public and protected methods. This is because I believe the calling method should ensure that it is passing valid arguments to private methods.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:45:10.460 | 2008-08-28T13:45:10.460 | null | null | 1,969 | null |
32,312 | 2 | null | 2,154 | 4 | null | Even if you didn't want to actually in VS, you could create the project there and edit the files in another editor.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:45:26.373 | 2008-08-28T13:45:26.373 | null | null | 987 | null |
32,304 | 2 | null | 32,280 | 3 | null | > It doesn't really go into how you would enforce this restriction?
You enforce it by throwing an [ArgumentExcexception](http://msdn.microsoft.com/en-us/library/system.argumentexception.aspx) if they pass in null.
```
if (p1 == null || p2 == null) {
throw new IllegalArgumentException("Invalid argument for xProjec... | null | CC BY-SA 3.0 | null | 2008-08-28T13:42:07.863 | 2016-11-22T11:21:10.510 | 2016-11-22T11:21:10.510 | 7,193,519 | 2,773 | null |
32,311 | 2 | null | 32,144 | 2 | null | I'm not sure what you are asking. Are you looking for software to allow NetWare applications to talk to a SQL Server running on Windows? The wording of your original question implied that you want to run on the NetWare machine.
The question of why SQL Server doesn't support NetWare is best asked of Microsoft, but AFA... | null | CC BY-SA 2.5 | null | 2008-08-28T13:45:18.557 | 2008-08-28T13:45:18.557 | null | null | 1,821 | null |
32,254 | 2 | null | 32,149 | 4 | null | There's also this neat Perl script for title-casing text.
[http://daringfireball.net/2008/08/title_case_update](http://daringfireball.net/2008/08/title_case_update)
> ```
#!/usr/bin/perl
# This filter changes all words to Title Caps, and attempts to be clever
# about *un*capitalizing small words like a/an/the in... | null | CC BY-SA 3.0 | null | 2008-08-28T13:26:27.823 | 2017-12-07T22:59:44.760 | 2017-12-07T22:59:44.760 | 8,242,698 | 1 | null |
32,313 | 2 | null | 32,280 | 8 | null | General rule is if your method doesn't expect `null` arguments then you should throw [System.ArgumentNullException](http://msdn.microsoft.com/en-us/library/system.argumentnullexception.aspx). Throwing proper `Exception` not only protects you from resource corruption and other bad things but serves as a guide for users ... | null | CC BY-SA 3.0 | null | 2008-08-28T13:45:29.040 | 2017-12-27T12:24:40.490 | 2017-12-27T12:24:40.490 | 3,798,217 | 1,196 | null |
32,314 | 2 | null | 32,280 | 1 | null | @Chris Karcher I would say absolutely correct. The only thing I would say is check the params separately and have the exeption report the param that was null also as it makes tracking where the null is coming from much easier.
@wvdschel wow! If writing the code is too much effort for you, you should look into somethin... | null | CC BY-SA 2.5 | null | 2008-08-28T13:45:56.467 | 2008-08-28T14:56:18.637 | 2008-08-28T14:56:18.637 | 1,120 | 1,120 | null |
32,319 | 2 | null | 32,282 | 0 | null | RegExBuddy so far I concur with and endorse.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:47:26.867 | 2008-08-28T13:47:26.867 | null | null | 36 | null |
32,295 | 2 | null | 32,280 | 1 | null | I generally prefer not doing either, since it's just slowing things down. NullPointerExceptions are thrown later on anyway, which will quickly lead the user to discovering they're passing null to the method. I used to check, but 40% of my code ended up being checking code, at which point I decided it was just not worth... | null | CC BY-SA 3.0 | null | 2008-08-28T13:38:50.337 | 2015-10-23T11:30:57.640 | 2015-10-23T11:30:57.640 | 5,337,149 | 2,018 | null |
32,297 | 2 | null | 32,231 | 2 | null | [Google's Application Engine](http://code.google.com/appengine/) works like this. When you download the toolkit you get a local copy of the database engine for testing.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:39:17.120 | 2008-08-28T13:40:55.620 | 2008-08-28T13:40:55.620 | 383 | 1,219 | null |
32,324 | 2 | null | 15,334 | 4 | null | As noted by MDCore, [SnippetsEmu](http://www.vim.org/scripts/script.php?script_id=1318) is a popular Vim script that does just that and more. If you need only expanding (without moving back the caret), you can use the standard `:ab[breviate]` command.
```
:ab[breviate] [<expr>] {lhs} {rhs}
add abbreviation for... | null | CC BY-SA 3.0 | null | 2008-08-28T13:48:47.707 | 2017-05-16T00:04:29.333 | 2017-05-16T00:04:29.333 | 89,339 | 2,797 | null |
32,327 | 2 | null | 32,282 | 2 | null | I agree on RegExBuddy, but if you want free or when I'm working somewhere and not on my own system [RegExr](http://gskinner.com/RegExr/) is a great online (Flash) tool that has lots of pre-built regex segments to work with and does real-time pattern matching for your testing.
| null | CC BY-SA 2.5 | null | 2008-08-28T13:49:28.313 | 2008-08-28T13:49:28.313 | null | null | 194 | null |
32,305 | 2 | null | 32,280 | 1 | null | I agree or disagree with [wvdschel's post](https://stackoverflow.com/a/32295/3798217), it depends on what he's specifically saying.
In this case, sure, this method will crash on `null` so the explicit check here is probably not needed.
However, if the method simply stores the passed data, and there is some other meth... | null | CC BY-SA 3.0 | null | 2008-08-28T13:43:06.113 | 2017-12-27T11:57:05.423 | 2017-12-27T11:57:05.423 | 3,798,217 | 267 | null |
32,329 | 2 | null | 626 | 7 | null | [Closures in Ruby](https://innig.net/software/ruby/closures-in-ruby.html) is a good overview for how blocks, lambda and proc work in Ruby, with Ruby.
| null | CC BY-SA 4.0 | null | 2008-08-28T13:50:12.320 | 2018-08-08T06:19:51.517 | 2018-08-08T06:19:51.517 | 337,446 | null | null |
32,332 | 1 | 37,542 | null | 36 | 27,251 | This isn't a design question, really, though it may seem like it. (Well, okay, it's kind of a design question). What I'm wondering is why the C++ `std::fstream` classes don't take a `std::string` in their constructor or open methods. Everyone loves code examples so:
```
#include <iostream>
#include <fstream>
#include ... | Why don't the std::fstream classes take a std::string? | CC BY-SA 2.5 | 0 | 2008-08-28T14:07:00.207 | 2017-01-09T18:44:33.457 | 2008-11-02T03:16:53.383 | 3,153 | 61 | [
"c++",
"stl",
"file-io",
"stdstring"
] |
32,333 | 1 | 161,268 | null | 5 | 1,100 | Here's a perfect example of the problem: [Classifier gem breaks Rails](http://blog.teksol.info/2009/03/27/argumenterror-on-number-sum-when-using-classifier-bayes.html).
** Original question: **
One thing that concerns me as a security professional is that Ruby doesn't have a parallel of Java's package-privacy. That ... | How can I program defensively in Ruby? | CC BY-SA 2.5 | 0 | 2008-08-28T14:07:15.197 | 2009-04-08T13:48:11.633 | 2009-04-08T13:48:11.633 | 1,190 | 1,190 | [
"ruby",
"security",
"defensive-programming"
] |
32,335 | 2 | null | 32,144 | 4 | null | Your problem is your directory service, whether it's Microsoft's Active Directory or Novell's Directory Services (I think it's called).
Sounds to me like your DNS is broken if your clients can't resolve names to IP address.
| null | CC BY-SA 2.5 | null | 2008-08-28T14:07:36.787 | 2008-08-28T14:07:36.787 | null | null | 1,616 | null |
32,283 | 2 | null | 32,144 | 1 | null | Sorry to be prickly, but I'm not a noob: I know you can't install SQL Server on Linux. Do you guys have customers running Netware trying to connect to a SQL Server? That is what I am dealing with.
We have customers, mostly school systems, that use Netware as the "network OS" with many Windows workstations running the... | null | CC BY-SA 2.5 | null | 2008-08-28T13:36:00.077 | 2008-08-28T13:36:00.077 | 2017-05-23T12:34:56.773 | -1 | 470 | null |
32,342 | 2 | null | 32,041 | 0 | null | I would also highly recommend using a logging framework.
The `logger.IsDebugEnabled()` is not mandatory, it is just that it can be faster to check whether the system is in the debug level before logging.
Using a logging framework means you can configure logging levels on the fly without restarting the application.
Y... | null | CC BY-SA 3.0 | null | 2008-08-28T14:11:10.977 | 2013-03-03T05:17:55.130 | 2013-03-03T05:17:55.130 | -1 | 3,416 | null |
32,325 | 2 | null | 19,295 | 13 | null | I finally got this working with danb's help above.
This is my resource bundle class and resource bundle control class.
I used this code from @[danb]'s.
```
ResourceBundle bundle = ResourceBundle.getBundle("AwesomeBundle", locale, DbResourceBundle.getMyControl());
javax.servlet.jsp.jstl.core.Config.set(actionBeanCont... | null | CC BY-SA 2.5 | null | 2008-08-28T13:49:04.837 | 2008-09-08T21:56:09.097 | 2008-09-08T21:56:09.097 | 1,310 | 1,310 | null |
32,345 | 2 | null | 32,151 | 1 | null | If it's just HTML, all you need to do is change the extension to .doc and word will open it as if it's a word document. However, if there are images to include or javascript to run it can get a little more complicated.
| null | CC BY-SA 2.5 | null | 2008-08-28T14:12:06.323 | 2008-08-28T14:12:06.323 | null | null | 3,043 | null |
32,317 | 2 | null | 32,027 | 8 | null | This shouldn't be a particularly difficult excercise. We do some fairly similar stuff on one of my projects since half of it runs on Java using Ant to run relevant targets, and the other half is .Net (C#) for the UI. The projects get run on windows machines for development, but the servers (Java) run linux, but in the ... | null | CC BY-SA 2.5 | null | 2008-08-28T13:47:12.423 | 2010-10-23T08:47:26.017 | 2010-10-23T08:47:26.017 | 1,107 | 1,107 | null |