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 ⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
21,817 | 1 | 22,497 | null | 154 | 106,884 | The topic says the most of it - what is the reason for the fact that static methods can't be declared in an interface?
```
public interface ITest {
public static String test();
}
```
The code above gives me the following error (in Eclipse, at least): "Illegal modifier for the interface method ITest.test(); only ... | Why can't I declare static methods in an interface? | CC BY-SA 2.5 | 0 | 2008-08-22T05:16:43.837 | 2019-02-21T11:20:23.583 | 2010-12-11T21:19:01.360 | 21,234 | 2,238 | [
"java",
"interface",
"methods",
"static"
] |
21,786 | 2 | null | 21,715 | 49 | null | I am generally in the camp of just using a List directly, unless for some reason I need to encapsulate the data structure and provide a limited subset of its functionality. This is mainly because if I don't have a specific need for encapsulation then doing it is just a waste of time.
However, with the aggregate initi... | null | CC BY-SA 2.5 | null | 2008-08-22T04:46:28.433 | 2009-07-17T17:49:58.787 | 2009-07-17T17:49:58.787 | 16,587 | 1,737,192 | null |
21,819 | 2 | null | 21,817 | 7 | null | Static methods are not instance methods. There's no instance context, therefore to implement it from the interface makes little sense.
| null | CC BY-SA 2.5 | null | 2008-08-22T05:18:15.767 | 2008-08-22T05:18:15.767 | null | null | 1,627 | null |
21,825 | 2 | null | 11,919 | 0 | null | I would suggest if you are going for a PHP and MySQL install to instead use [WAMP](http://www.wampserver.com/en/). It works great and is easy to add extensions and modify everything. I use it for work and love it.
| null | CC BY-SA 2.5 | null | 2008-08-22T05:19:48.183 | 2008-08-22T05:19:48.183 | null | null | 657 | null |
21,826 | 2 | null | 21,817 | 44 | null | The reason why you can't have a static method in an interface lies in the way Java resolves static references. Java will not bother looking for an instance of a class when attempting to execute a static method. This is because static methods are not instance dependent and hence can be executed straight from the class f... | null | CC BY-SA 2.5 | null | 2008-08-22T05:20:28.977 | 2008-08-22T05:20:28.977 | null | null | 2,257 | null |
21,828 | 2 | null | 11,919 | 0 | null | One of the IIS developers has an excellent walkthrough here:
[http://blogs.iis.net/bills/archive/2006/10/31/PHP-on-IIS.aspx](http://blogs.iis.net/bills/archive/2006/10/31/PHP-on-IIS.aspx)
However, for the love of god why?
| null | CC BY-SA 2.5 | null | 2008-08-22T05:21:11.173 | 2008-08-22T05:21:11.173 | null | null | 1,965 | null |
21,823 | 2 | null | 21,817 | 18 | null | I'll answer your question with an example. Suppose we had a Math class with a static method add. You would call this method like so:
```
Math.add(2, 3);
```
If Math were an interface instead of a class, it could not have any defined functions. As such, saying something like Math.add(2, 3) makes no sense.
| null | CC BY-SA 2.5 | null | 2008-08-22T05:19:16.793 | 2008-08-22T05:19:16.793 | null | null | 658 | null |
21,837 | 2 | null | 21,817 | 2 | null | An interface is used for polymorphism, which applies to Objects, not types. Therefore (as already noted) it makes no sense to have an static interface member.
| null | CC BY-SA 2.5 | null | 2008-08-22T05:27:15.870 | 2008-08-22T05:27:15.870 | null | null | 832 | null |
21,832 | 2 | null | 12,141 | 1 | null | > Updating all rows of the customer table because you forgot to add the where clause.
That was exactly i did :| . I had updated the password column for all users to a sample string i had typed onto the console. The worst part of it was i was accessing the production server and i was checking out some queries when i di... | null | CC BY-SA 2.5 | null | 2008-08-22T05:23:10.310 | 2008-08-22T05:23:10.310 | null | null | 2,245 | null |
21,841 | 2 | null | 19,517 | 1 | null | I'm not using it, but I've seen demos of it. It's very nice.
Boo has a lot of interesting extensibility points in parsing and interpreting the language itself that make it ideal for writing frameworks like Specter. The end result is much nicer looking than you'd be able to get with languages like C#.
Unfortunately, t... | null | CC BY-SA 2.5 | null | 2008-08-22T05:28:38.987 | 2008-08-22T05:28:38.987 | null | null | 1,554 | null |
21,843 | 2 | null | 21,388 | 7 | null | An other alternative would be (if your RDBMS supports it) to use columns of type array. While this breaks the normalization rules, it can be useful in situations like this. One database which I know about that has arrays is PostgreSQL.
| null | CC BY-SA 2.5 | null | 2008-08-22T05:32:46.497 | 2008-08-22T05:32:46.497 | null | null | 1,265 | null |
21,830 | 1 | 26,398 | null | 39 | 19,295 | From what information I could find, they both solve the same problems - more esoteric operations like array containment and intersection (&&, @>, <@, etc). However I would be interested in advice about when to use one or the other (or neither possibly).
The [PostgreSQL documentation](http://www.postgresql.org/docs/curr... | PostgreSQL: GIN or GiST indexes? | CC BY-SA 3.0 | 0 | 2008-08-22T05:22:39.610 | 2017-06-07T04:49:44.357 | 2014-03-29T03:31:52.273 | 168,868 | 1,265 | [
"postgresql",
"indexing",
"gwt-gin",
"gist-index"
] |
21,848 | 1 | 21,932 | null | 107 | 47,370 | There may be more than one way to ask this question, so here's a desciption of the problem. I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then branched from before I started my crap work. Practically this works fine, I just now have a ... | Switch branch names in git | CC BY-SA 2.5 | 0 | 2008-08-22T05:39:54.843 | 2012-08-18T18:28:45.933 | 2008-08-22T09:36:03.840 | 2,427 | 2,427 | [
"git",
"branch"
] |
21,851 | 2 | null | 21,652 | 0 | null | I tend to have less Exception types, although it's not really the OO way to do it. Instead I put an enum to my custom Exceptions, which classifies the Exception. Most of the time I have a custom base Exception, which holds on to a couple of members, which can be overridden or customized in derived Exception types.
A ... | null | CC BY-SA 2.5 | null | 2008-08-22T05:42:56.410 | 2008-08-22T05:42:56.410 | null | null | 198 | null |
21,858 | 2 | null | 21,652 | -1 | null | I would just go by
```
throw new exception("WhatCausedIt")
```
if you want to handle your exceptions, you could pass a code instead of "WhatCausedIt" an then react to the different answers with a switch statement.
| null | CC BY-SA 2.5 | null | 2008-08-22T05:48:25.447 | 2008-08-22T05:48:25.447 | null | null | 2,275 | null |
21,853 | 2 | null | 18,224 | 0 | null | On a freelance job I did, we set up three seperate enviroments.
- - -
The workflow was as followed:
1. Developer checks in changes to SourceControl.
2. CruiseControl builds and deploys the build to Dev.
3. Dev is QA'ed
4. After passing QA, a robocopy script is ran that deploys the Dev build to Test.
5. Test is UAT... | null | CC BY-SA 2.5 | null | 2008-08-22T05:44:28.700 | 2008-08-22T05:44:28.700 | null | null | 1,965 | null |
21,849 | 2 | null | 16,164 | 0 | null | Atom feed documents and Atom entry documents are used as the representation format for RESTful web services that follow the Atom Publication Protocol (AtomPub).
I personally have used syndication feeds to expose a sub-set of the Windows Event Log information so that I could subscribe and be notified of critical events... | null | CC BY-SA 2.5 | null | 2008-08-22T05:40:21.220 | 2008-08-22T05:40:21.220 | null | null | 2,029 | null |
21,873 | 2 | null | 5,473 | 148 | null | It is possible to recover it if Git hasn't garbage collected yet.
Get an overview of dangling commits with `fsck`:
```
$ git fsck --lost-found
dangling commit b72e67a9bb3f1fc1b64528bcce031af4f0d6fcbf
```
Recover the dangling commit with rebase:
```
$ git rebase b72e67a9bb3f1fc1b64528bcce031af4f0d6fcbf
```
| null | CC BY-SA 3.0 | null | 2008-08-22T06:11:27.810 | 2014-07-13T19:51:59.127 | 2014-07-13T19:51:59.127 | null | 473 | null |
21,877 | 1 | 21,887 | null | 13 | 31,666 | What I want to achieve is this. I want to give the user the ability to upload an image file, store the image in BLOB in SQL Server, and then use this image as a logo in other pages of the site.
I have done this by using
```
Response.Clear();
Response.ContentType = "image/pjpeg";
Response.BinaryWrite(imageCon... | Dynamically Rendering asp:Image from BLOB entry in ASP.NET | CC BY-SA 4.0 | 0 | 2008-08-22T06:14:06.600 | 2018-09-17T13:44:50.087 | 2018-09-17T13:44:50.087 | 2,761,106 | 932 | [
"asp.net"
] |
21,845 | 2 | null | 21,817 | -2 | null | Perhaps a code example would help, I'm going to use C#, but you should be able to follow along.
Lets pretend we have an interface called IPayable
```
public interface IPayable
{
public Pay(double amount);
}
```
Now, we have two concrete classes that implement this interface:
```
public class BusinessAccount : ... | null | CC BY-SA 2.5 | null | 2008-08-22T05:35:52.073 | 2008-08-22T05:35:52.073 | null | null | 1,965 | null |
21,883 | 2 | null | 21,877 | 0 | null | We actually just released some classes that help with exactly this kind of thing:
[http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=16449](http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=16449)
Specifically, check out the DatabaseImage sample.
| null | CC BY-SA 2.5 | null | 2008-08-22T06:22:01.667 | 2008-08-22T06:22:01.667 | null | null | 1,554 | null |
21,850 | 2 | null | 18,224 | 1 | null | I'll second the recommendation for [Capistrano](http://www.capify.org), though if you're looking for a GUI-based solution you could try the [Webistrano](http://blog.innerewut.de/webistrano/) front end. Clean, ssh-based, sane deployment and rollback semantics and easy scripting and extensibility via ruby.
| null | CC BY-SA 2.5 | null | 2008-08-22T05:40:29.787 | 2008-08-22T05:40:29.787 | null | null | 2,334 | null |
21,879 | 1 | 21,962 | null | 12 | 4,767 | I'm trying to reteach myself some long forgotten math skills. This is part of a much larger project to effectively "teach myself software development" from the ground up (the details are [here](http://www.appscanadian.ca/archives/cs-101-introduction-to-computer-science/) if you're interested in helping out).
My bigg... | Where can I find a "Math topic dependency tree" to assist my self-guided refresher on the subject? | CC BY-SA 2.5 | 0 | 2008-08-22T06:15:39.717 | 2015-06-18T00:53:15.307 | null | null | 1,588 | [
"math"
] |
21,882 | 2 | null | 21,870 | 2 | null | Take a look at [memcached](http://www.danga.com/memcached/). It is a really cool, fast and lightweight distributed caching system. There are APIs for several of the most popular languages, including C#. It may not serve well on the client side (unless of course the client is obtaining the cached data from a server o... | null | CC BY-SA 2.5 | null | 2008-08-22T06:21:15.930 | 2008-08-22T06:21:15.930 | null | null | 122 | null |
21,889 | 2 | null | 21,877 | 0 | null | Add the code to a handler to return the image bytes with the appropriate mime-type. Then you can just add the url to your handler like it is an image. For example:
```
<img src="myhandler.ashx?imageid=5">
```
Make sense?
| null | CC BY-SA 2.5 | null | 2008-08-22T06:26:21.267 | 2008-08-22T06:26:21.267 | null | null | 1,627 | null |
21,905 | 2 | null | 21,848 | 14 | null | Start on `master`, create a branch called `in-progress`, then reset `master` to an earlier commit.
```
$ git branch in-progress
$ git reset --hard HEAD^
```
| null | CC BY-SA 2.5 | null | 2008-08-22T06:51:10.037 | 2008-08-22T06:51:10.037 | null | null | 954 | null |
21,908 | 1 | null | null | 46 | 79,422 | I'm working on a web application that needs to prints silently -- that is without user involvement. What's the best way to accomplish this? It doesn't like it can be done with strictly with Javascript, nor Flash and/or AIR. The closest I've seen involves a Java applet.
I can understand why it would a Bad Idea for j... | "Silent" Printing in a Web Application | CC BY-SA 2.5 | 0 | 2008-08-22T06:59:56.490 | 2020-02-15T19:16:45.700 | 2020-02-15T19:16:45.700 | 1,839,439 | 181 | [
"browser",
"web-applications",
"printing"
] |
21,897 | 2 | null | 21,848 | 7 | null | This is relatively easy:
```
git checkout -b fake_master master # fake_master now points to the same commit as master
git branch -D master # get rid of incorrect master
git checkout -b master real_master # master now points to your actual master
git checkout master # optional -- switch on ... | null | CC BY-SA 2.5 | null | 2008-08-22T06:40:04.917 | 2008-08-22T06:40:04.917 | null | null | 784 | null |
21,887 | 2 | null | 21,877 | 18 | null | Add a 'Generic Handler' to your web project, name it something like Image.ashx. Implement it like this:
```
public class ImageHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
using(Image image = GetImage(context.Request.QueryString["ID"]))
{
context.Re... | null | CC BY-SA 2.5 | null | 2008-08-22T06:25:31.317 | 2008-08-22T06:25:31.317 | null | null | 1,710 | null |
21,915 | 2 | null | 21,749 | 1 | null | Is the dialog shown using ShowModal or just Show? You should probably set the PopupMode property correct of the your dialog. pmAuto would probably your best choice. Also see if you need to set the PopupParent property.
| null | CC BY-SA 2.5 | null | 2008-08-22T07:08:04.850 | 2008-08-22T07:08:04.850 | null | null | 1,242 | null |
21,909 | 2 | null | 21,564 | 46 | null | [annotate](http://jeroen.a-eskwadraat.nl/sw/annotate/annotate), available via that link or as `annotate-output` in the Debian `devscripts` package.
```
$ echo -e "a\nb\nc" > lines
$ annotate-output cat lines
17:00:47 I: Started cat lines
17:00:47 O: a
17:00:47 O: b
17:00:47 O: c
17:00:47 I: Finished with exitcode 0
``... | null | CC BY-SA 2.5 | null | 2008-08-22T07:00:51.607 | 2008-08-22T07:00:51.607 | null | null | 954 | null |
21,917 | 2 | null | 20,376 | -7 | null | We use Firebugs console.log, console.time and console.timeEnd (I think) a lot.
Firebug also has a built in profiler.
| null | CC BY-SA 2.5 | null | 2008-08-22T07:09:05.207 | 2008-08-22T07:09:05.207 | null | null | 1,538 | null |
21,916 | 2 | null | 21,908 | 0 | null | I have to be honest, I am kinda thinking out loud here.. But could it not be done with an applet or some sort (be it Java or whatever) that is given trusted permissions (such as that within the Intranet zone) or something?
May be worth investigating what permissions can be given to each zone?
Following a Google, I t... | null | CC BY-SA 2.5 | null | 2008-08-22T07:08:05.160 | 2008-08-22T07:08:05.160 | null | null | 832 | null |
21,870 | 1 | 984,076 | null | 29 | 13,414 | For a .NET component that will be used in both web applications and rich client applications, there seem to be two obvious options for caching: System.Web.Caching or the Ent. Lib. Caching Block.
- -
## System.Web.Caching
Is this safe to use outside of web apps? I've seen mixed information, but I think the answe... | System.Web.Caching vs. Enterprise Library Caching Block | CC BY-SA 2.5 | 0 | 2008-08-22T06:07:29.487 | 2013-06-14T14:44:02.807 | 2008-08-31T00:28:23.770 | 305 | 150 | [
"caching",
".net-2.0",
"memcached",
"enterprise-library"
] |
21,907 | 2 | null | 21,564 | 19 | null | Kieron's answer is the best one so far. If you have problems because the first program is buffering its out you can use the unbuffer program:
```
unbuffer <command> | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; }'
```
It's installed by default on most linux systems. If you need to build it yourself it is part ... | null | CC BY-SA 2.5 | null | 2008-08-22T06:56:48.323 | 2008-08-22T06:56:48.323 | null | null | 116 | null |
21,912 | 1 | 21,921 | null | 2 | 1,641 | Reading an article called in July's MSDN magazine, the author states that using an `Imports` in VB providing a path to schema in the current project will turn IntelliSense on for XElement. In the code provided, he uses statements like `xelement.@name` to retreive attributes values and so on.
I did not try this out my... | IntelliSense for XElement objects with XML schema | CC BY-SA 3.0 | null | 2008-08-22T07:07:17.643 | 2012-05-02T18:26:32.620 | 2012-05-02T18:26:32.620 | 298,281 | 920 | [
"c#",
"linq",
"xsd",
"linq-to-xml",
"vb.net-to-c#"
] |
21,926 | 2 | null | 20,910 | 30 | null | There's two questions here: Silverlight vs. Flash as platform and Silverlight vs. Flex as RIA framework.
The first question depends on your timeframe. Flash Player has over 95% reach, Silverlight has no way near that. However, Silverlight may get there, it is after all backed by Microsoft. If you aim to launch a site ... | null | CC BY-SA 2.5 | null | 2008-08-22T07:23:59.320 | 2008-08-22T07:23:59.320 | null | null | 1,109 | null |
21,918 | 2 | null | 21,908 | 2 | null | I wrote a python tsr that polled the server every so often (it pulled its polling frequency from the server) and would print out to label printer. Was relatively nice.
Once written in python, I used py2exe on it, then inno setup compiler, then put on intranet and had user install it.
It was not great, but it worked... | null | CC BY-SA 2.5 | null | 2008-08-22T07:12:30.283 | 2008-08-22T07:12:30.283 | null | null | 479 | null |
21,924 | 2 | null | 21,908 | 6 | null | Here are two code samples you can try:
:
```
<script>
function Print() {
alert ("THUD.. another tree bites the dust!")
if (document.layers)
{
window.print();
}
else if (document.all)
{
WebBrowser1.ExecWB(6, 1);
//use 6, 1 to prompt the print dialog or 6, 6 to omit it
//some websites also i... | null | CC BY-SA 2.5 | null | 2008-08-22T07:23:08.587 | 2008-08-22T07:31:41.157 | 2008-08-22T07:31:41.157 | 2,257 | 2,257 | null |
21,929 | 2 | null | 17,911 | 0 | null | The `Event.COMPLETE` handler really shouldn't be called unless the loader was fully loaded, it makes no sense. Have you confirmed that it is in fact not fully loaded (by looking at the `bytesLoaded` vs. `bytesTotal` values that you trace)? If the `Event.COMPLETE` event is dispatched before `bytesLoaded == bytesTotal` t... | null | CC BY-SA 2.5 | null | 2008-08-22T07:32:57.800 | 2008-08-22T07:32:57.800 | null | null | 1,109 | null |
21,927 | 2 | null | 20,047 | 10 | null | Before burning the house down to catch a fly with NOLOCK all over, you may want to take a look at that deadlock graph you should've captured with Profiler.
Remember that a deadlock requires (at least) 2 locks. Connection 1 has Lock A, wants Lock B - and vice-versa for Connection 2. This is an unsolvable situation, and... | null | CC BY-SA 2.5 | null | 2008-08-22T07:24:15.607 | 2008-08-22T07:24:15.607 | null | null | 2,199 | null |
21,934 | 1 | 21,964 | null | 66 | 21,111 | Python uses the reference count method to handle object life time. So an object that has no more use will be immediately destroyed.
But, in Java, the GC(garbage collector) destroys objects which are no longer used at a specific time.
Why does Java choose this strategy and what is the benefit from this?
Is this bette... | Why Java and Python garbage collection methods are different? | CC BY-SA 3.0 | 0 | 2008-08-22T07:35:26.703 | 2014-02-02T23:15:20.800 | 2013-03-10T23:27:26.813 | 1,337,136 | 1,556 | [
"java",
"python",
"garbage-collection"
] |
21,928 | 2 | null | 17,911 | 1 | null | Just a side note, this statement has no effect:
```
XML.ignoreWhitespace;
```
because `ignoreWhitespace` is a property. You have to set it to `true` like this:
```
XML.ingoreWhitespace = true;
```
| null | CC BY-SA 2.5 | null | 2008-08-22T07:27:47.190 | 2008-08-22T07:27:47.190 | null | null | 1,109 | null |
21,937 | 2 | null | 21,934 | 8 | null | I think the article "[Java theory and practice: A brief history of garbage collection](http://www.ibm.com/developerworks/java/library/j-jtp10283/)" from IBM should help explain some of the questions you have.
| null | CC BY-SA 2.5 | null | 2008-08-22T07:40:12.557 | 2008-08-22T07:40:12.557 | null | null | 2,257 | null |
21,942 | 2 | null | 21,938 | 5 | null | Well, I don't see any difference between catching a general exception or a specific one, except that when having multiple catch blocks, you can react differently depending on what the exception is.
In conclusion, you will catch both `IOException` and `NullPointerException` with a generic `Exception`, but the way your ... | null | CC BY-SA 4.0 | null | 2008-08-22T08:44:36.147 | 2019-02-20T03:18:10.290 | 2019-02-20T03:18:10.290 | 9,851,598 | 920 | null |
21,943 | 2 | null | 21,938 | 0 | null | I think a good guideline is to catch only specific exceptions from within a framework (so that the host application can deal with edge cases like the disk filling up etc), but I don't see why we shouldn't be able to catch all exceptions from our application code. Quite simply there are times where you don't want the ap... | null | CC BY-SA 2.5 | null | 2008-08-22T08:45:57.577 | 2008-08-22T08:45:57.577 | null | null | 615 | null |
21,946 | 2 | null | 21,938 | 0 | null | Most of the time catching a general exception is not needed. Of course there are situations where you don't have a choice, but in this case I think it's better to check why you need to catch it. Maybe there's something wrong in your design.
| null | CC BY-SA 2.5 | null | 2008-08-22T08:49:17.243 | 2008-08-22T08:49:17.243 | null | null | 718 | null |
21,932 | 2 | null | 21,848 | 147 | null | In addition to the other comments, you may find the -m (move) switch to git-branch helpful. You could rename your old master to something else, then rename your new branch to master:
```
git branch -m master crap_work
git branch -m previous_master master
```
| null | CC BY-SA 2.5 | null | 2008-08-22T07:33:28.983 | 2008-08-22T07:33:28.983 | null | null | 893 | null |
21,947 | 2 | null | 21,938 | 33 | null | Unless you are doing some logging and clean up code in the front end of your application, then I think it is bad to catch all exceptions.
My basic rule of thumb is to catch all the exceptions you expect and anything else is a bug.
If you catch everything and continue on, it's a bit like putting a sticking plaster ove... | null | CC BY-SA 2.5 | null | 2008-08-22T08:50:14.730 | 2008-08-22T08:50:14.730 | null | null | 1,075 | null |
21,921 | 2 | null | 21,912 | 4 | null | This post claims to have a link to a video that shows how to use VB9's XML Literals in C#. However, it only really discusses them and from what I can gather, you cannot use them in C#. [http://blogs.msdn.com/bethmassi/archive/2008/07/03/teched-panel-vb-xml-literals-for-c-developers.aspx](http://blogs.msdn.com/bethmassi... | null | CC BY-SA 2.5 | null | 2008-08-22T07:14:46.360 | 2008-08-22T07:23:23.267 | 2008-08-22T07:23:23.267 | 1,786 | 1,786 | null |
21,955 | 2 | null | 21,938 | 15 | null | Yes! (except at the "top" of your application)
By catching an exception and allowing the code execution to continue, you are stating that you know how do deal with and circumvent, or fix a particular problem. You are stating that this is . Catching Exception or SystemException means that you will catch problems like I... | null | CC BY-SA 2.5 | null | 2008-08-22T08:59:54.300 | 2008-08-22T08:59:54.300 | null | null | 1,820 | null |
21,950 | 2 | null | 21,938 | 117 | null | Obviously this is one of those questions where the only real answer is "it depends."
The main thing it depends on is where your are catching the exception. In general libraries should be more conservative with catching exceptions whereas at the top level of your program (e.g. in your main method or in the top of the ... | null | CC BY-SA 3.0 | null | 2008-08-22T08:53:55.470 | 2011-10-27T18:44:25.250 | 2011-10-27T18:44:25.250 | 47,773 | 2,168 | null |
21,948 | 2 | null | 21,938 | 3 | null | The point is twofold I think.
Firstly, if you don't know what exception has occurred how can you hope to recover from it. If you expect that a user might type a filename in wrong then you can expect a FileNotFoundException and tell the user to try again. If that same code generated a NullReferenceException and you sim... | null | CC BY-SA 2.5 | null | 2008-08-22T08:52:06.423 | 2008-08-22T08:52:06.423 | null | null | 1,908 | null |
21,885 | 2 | null | 21,877 | 9 | null | You can BASE64 encode the content of the image directly into the SRC attribute, however, I believe only Firefox will parse this back into an image.
What I typically do is a create a very lightweight HTTPHandler to serve the images:
```
using System;
using System.Web;
namespace Example
{
public class GetImage :... | null | CC BY-SA 2.5 | null | 2008-08-22T06:24:46.233 | 2008-08-22T06:30:10.400 | 2008-08-22T06:30:10.400 | 1,965 | 1,965 | null |
21,938 | 1 | 21,950 | null | 75 | 60,676 | Whilst analysing some legacy code with FXCop, it occurred to me is it really that bad to catch a general exception error within a try block or should you be looking for a specific exception. Thoughts on a postcard please.
| Is it really that bad to catch a general exception? | CC BY-SA 2.5 | 0 | 2008-08-22T07:41:13.223 | 2019-02-20T03:18:10.290 | null | null | 1,731 | [
"exception"
] |
21,963 | 2 | null | 8,472 | 1 | null | My suggestion would be an ASCII captcha it does not use an image, and it's programmer/geeky.
Here is a PHP implementation [http://thephppro.com/products/captcha/](http://thephppro.com/products/captcha/) this one is a paid.
There is a free, also PHP implementation, however I could not find an example -> [http://www.phpc... | null | CC BY-SA 2.5 | null | 2008-08-22T09:09:26.647 | 2008-08-22T09:09:26.647 | null | null | 115 | null |
21,964 | 2 | null | 21,934 | 54 | null | There are drawbacks of using reference counting. One of the most mentioned is circular references: Suppose A references B, B references C and C references B. If A were to drop its reference to B, both B and C will still have a reference count of 1 and won't be deleted with traditional reference counting. CPython (refer... | null | CC BY-SA 3.0 | null | 2008-08-22T09:10:06.943 | 2011-10-20T06:51:51.160 | 2011-10-20T06:51:51.160 | 2,260 | 2,260 | null |
21,961 | 1 | null | null | 4 | 5,175 | ```
>>> import time
>>> time.strptime("01-31-2009", "%m-%d-%Y")
(2009, 1, 31, 0, 0, 0, 5, 31, -1)
>>> time.mktime((2009, 1, 31, 0, 0, 0, 5, 31, -1))
1233378000.0
>>> 60*60*24 # seconds in a day
86400
>>> 1233378000.0 / 86400
14275.208333333334
```
`time.mktime` should return the number of seconds since the epoch. Sin... | Date/time conversion using time.mktime seems wrong | CC BY-SA 3.0 | null | 2008-08-22T09:06:43.707 | 2017-07-29T19:37:04.900 | 2017-07-27T16:22:08.853 | 812,786 | 2,427 | [
"python",
"datetime"
] |
21,958 | 2 | null | 20,084 | 2 | null | Just a quick update on this, I have not forgotten!
Just doing some more research, looks like I am on to a winner, just need to get the code sorted.
So far, I have the following:
- -
This behaviour appears to be able to be overridden (code pending) by creating a proxy class to act as the go-between for the serializ... | null | CC BY-SA 2.5 | null | 2008-08-22T09:00:51.940 | 2008-08-22T09:00:51.940 | null | null | 832 | null |
21,959 | 2 | null | 21,938 | 12 | null | In my opinion you should catch all exceptions you , but this rule applies to anything but your interface logic. All the way down the call stack you should probably create a way to catch all exceptions, do some logging/give user feedback and, if needed and possible, shut down gracefully.
Nothing is worse than an applic... | null | CC BY-SA 2.5 | null | 2008-08-22T09:02:18.850 | 2008-08-22T09:02:18.850 | null | null | 909 | null |
21,965 | 1 | 21,991 | null | 18 | 16,460 | Could somebody please do a rundown of how to programmatically encrypt a config-file in .NET, preferably in C#.
What I would like to do is do some kind of check on an application's startup to see if a section is unprotected, and if it is, then encrypt it. This for both settings and connection-strings.
Also if anyone c... | Programmatically encrypting a config-file in .NET | CC BY-SA 2.5 | 0 | 2008-08-22T09:12:54.830 | 2014-08-01T07:49:13.040 | 2008-09-26T18:48:51.827 | 2,134 | 2,429 | [
"c#",
".net",
"configuration",
"encryption",
"configuration-files"
] |
21,956 | 1 | 22,256 | null | 4 | 5,027 | I have two arrays of `System.Data.DataRow` objects which I want to compare.
The rows have two columns A and B. Column A is a key and I want to find out which rows have had their B column changed and which rows have been added or deleted.
| How do I compare two arrays of DataRow objects in PowerShell? | CC BY-SA 3.0 | null | 2008-08-22T09:00:26.250 | 2018-01-27T01:59:29.213 | 2016-07-05T05:21:25.147 | 4,311,889 | 966 | [
"arrays",
"powershell",
"comparison"
] |
21,969 | 2 | null | 21,965 | 4 | null | There is a good article from 4 guys about [Encrypting Configuration Information in ASP.NET 2.0 Applications](https://web.archive.org/web/20211029043331/https://aspnet.4guysfromrolla.com/articles/021506-1.aspx)
Hope this helps
| null | CC BY-SA 2.5 | null | 2008-08-22T09:15:30.457 | 2008-08-22T09:15:30.457 | null | null | 2,257 | null |
21,974 | 2 | null | 21,961 | 0 | null | Interesting. I don't know, but I did try this:
```
>>> now = time.mktime((2008, 8, 22, 11 ,17, -1, -1, -1, -1))
>>> tomorrow = time.mktime((2008, 8, 23, 11 ,17, -1, -1, -1, -1))
>>> tomorrow - now
86400.0
```
which is what you expected. My guess? Maybe some time correction was done since the epoch. This could be onl... | null | CC BY-SA 2.5 | null | 2008-08-22T09:22:08.317 | 2008-08-22T09:22:08.317 | null | null | 2,260 | null |
21,962 | 2 | null | 21,879 | 6 | null | Here's how my school did it:
```
base:
algebra
trigonometry
analytic geometry
track 1 track 2 track 3
calc 1 linear algebra statistics
calc 2 discrete math 1
calc 3 (multivariable) discrete math 2
... | null | CC BY-SA 2.5 | null | 2008-08-22T09:07:14.673 | 2008-09-16T03:48:56.197 | 2008-09-16T03:48:56.197 | 116 | 116 | null |
21,968 | 2 | null | 20,245 | 2 | null |
## I'd strongly recommend saving each request to some file.
This way, you can always go back to the actual contents of it later. You can thank me later, when you find that hostile-endian, koi-8 encoded, [...], whatever it was that stumped your parser...
| null | CC BY-SA 2.5 | null | 2008-08-22T09:15:17.430 | 2008-08-22T09:15:17.430 | null | null | 1,421 | null |
21,981 | 2 | null | 21,274 | 2 | null | I found [TinyMCE](http://tinymce.moxiecode.com) pretty easy to implement. And it's light on bandwidth usage too.
| null | CC BY-SA 2.5 | null | 2008-08-22T09:35:16.010 | 2008-08-22T09:35:16.010 | null | null | 1,897 | null |
21,982 | 2 | null | 21,908 | 0 | null | If it is just an internal application, then you can avoid printing from the browser, and send a printout directly from the server to the nearest printer to the user.
| null | CC BY-SA 2.5 | null | 2008-08-22T09:35:19.410 | 2008-08-22T09:35:19.410 | null | null | 380 | null |
21,975 | 2 | null | 21,961 | 8 | null | Short answer: Because of timezones.
The Epoch is in UTC.
For example, I'm on IST (Irish Standard Time) or UTC+1. [time.mktime()](https://docs.python.org/3/library/time.html#time.gmtime) is relative to my timezone, so on my system this refers to
```
>>> time.mktime((2009, 1, 31, 0, 0, 0, 5, 31, -1))
1233360000.0
```
... | null | CC BY-SA 3.0 | null | 2008-08-22T09:24:25.770 | 2017-07-29T19:37:04.900 | 2017-07-29T19:37:04.900 | 5,754,656 | 1,087 | null |
21,985 | 2 | null | 21,965 | 1 | null | @TK: a hashing algo can only be 'guessed', not reverse engineered. One can only reconstruct the input to a hash value by completely guessing the input (apart from collisions, that is) This can be done by a rainbow crack for example (see [an implementation of a rainbow cracker here](http://www.antsight.com/zsl/rainbowcr... | null | CC BY-SA 2.5 | null | 2008-08-22T09:39:04.517 | 2008-08-22T09:39:04.517 | null | null | 2,005 | null |
21,989 | 2 | null | 21,965 | 0 | null | I haven't used it myself, but the Microsoft Enterprise library has good encryption support that will possibly suit your needs:
[http://msdn.microsoft.com/en-us/library/cc309503.aspx](http://msdn.microsoft.com/en-us/library/cc309503.aspx)
| null | CC BY-SA 2.5 | null | 2008-08-22T09:44:50.230 | 2008-08-22T09:44:50.230 | null | null | 1,111 | null |
21,978 | 2 | null | 21,749 | 5 | null | I'd use this code... (Basically what Lars said)
```
dialog := TDialogForm.Create( parentForm );
dialog.PopupParent := parentForm;
dialog.PopupMode := pmExplicit;
dialog.ShowModal();
```
| null | CC BY-SA 2.5 | null | 2008-08-22T09:28:14.480 | 2008-08-22T09:28:14.480 | null | null | 1,008 | null |
21,991 | 2 | null | 21,965 | 13 | null | To summarize the answers and what I've found so far, here are some good links to answer this question:
- [Encrypting Configuration Information in ASP.NET 2.0 Applications - 4GuysFromRolla.com](https://web.archive.org/web/20211029043331/https://aspnet.4guysfromrolla.com/articles/021506-1.aspx)- [How To: Encrypt Configu... | null | CC BY-SA 3.0 | null | 2008-08-22T09:46:35.780 | 2014-08-01T07:49:13.040 | 2014-08-01T07:49:13.040 | 157,247 | 2,429 | null |
21,967 | 2 | null | 21,560 | 4 | null | I finally got Multisampling working with my wxWidgets OpenGL program. It's a bit messy right now, but here's how:
doesn't have support in their right now (latest version at this time is ). But, it's available as a patch and also through their daily snapshot. (The latter is heartening, since it means that the patch ... | null | CC BY-SA 2.5 | null | 2008-08-22T09:13:56.527 | 2008-08-22T09:13:56.527 | 2017-05-23T12:24:29.867 | -1 | 1,630 | null |
21,973 | 2 | null | 21,961 | 3 | null | ```
mktime(...)
mktime(tuple) -> floating point number
Convert a time tuple in local time to seconds since the Epoch.
```
local time... fancy that.
The time tuple:
```
The other representation is a tuple of 9 integers giving local time.
The tuple items are:
year (four digits, e.g. 1998)
month (1-12)
... | null | CC BY-SA 2.5 | null | 2008-08-22T09:21:55.697 | 2008-08-22T09:21:55.697 | null | null | 1,421 | null |
21,993 | 2 | null | 21,274 | 1 | null | Using fck for some tine now, after "free text box", or something like that. Had problems only once, when I put fck inside asp.net ajax updatepanel, but found fix on forums. Problem was solved in next release.
I would like to see some nice photo browser in it, because fck comes only with simple browser that displays fil... | null | CC BY-SA 2.5 | null | 2008-08-22T09:50:17.953 | 2008-08-22T09:50:17.953 | null | null | 1,407 | null |
21,992 | 1 | 22,005 | null | 3 | 1,976 | I'm looking for (arguably) the correct way to return data from a `XmlHttpRequest`. Options I see are:
- . Let the request format the data and return it in a usable format.
: easy to consume by the calling page.: Very rigid, stuck with a fixed layout.- . Let the request return XML, format it using XSLT on the calling ... | XmlHttpRequest return values | CC BY-SA 3.0 | null | 2008-08-22T09:47:15.997 | 2015-12-27T05:20:29.037 | 2015-12-27T05:20:29.037 | 1,317,053 | 909 | [
"javascript",
"ajax"
] |
21,997 | 2 | null | 21,992 | 0 | null | I think this sort of depends on the level of "ajaxyness" your app is going to have. If your front end is a "rich client", al'a gmail, I'd go with the JSON solution, as you'd have to solve the problem of having client side view generation anyway. If you're using ajax sparingly, to provide simple messages to the user, up... | null | CC BY-SA 2.5 | null | 2008-08-22T09:53:46.090 | 2008-08-22T09:53:46.090 | null | null | 1,920 | null |
21,995 | 2 | null | 21,938 | 3 | null | The problem with catching all exceptions is that you may be catching ones that you don't expect, or indeed ones that you should be catching. The fact is that an exception of any kind indicates that something has gone wrong, and you have to sort it out before continuing otherwise you may end up with data integrity prob... | null | CC BY-SA 2.5 | null | 2008-08-22T09:50:36.830 | 2008-08-22T09:50:36.830 | null | null | 886 | null |
22,001 | 1 | null | null | 5 | 1,221 | I'm learning objective-C and Cocoa. In the Apple tutorial I'm working through there's a side note that says:
> `IBOutlet` is a null-defined macro, which the C preprocessor removes at compile time.
I'm curious - what's a null-defined macro?
| What's a 'null defined macro'? | CC BY-SA 3.0 | null | 2008-08-22T09:55:47.880 | 2016-01-30T19:32:22.653 | 2016-01-30T19:32:22.653 | 4,370,109 | null | [
"objective-c",
"c-preprocessor"
] |
22,000 | 1 | 22,025 | null | 15 | 9,411 | I've created a map system for a game that runs on the principle of drawing the picture of the map from tiles. There are many reasons for this which I won't go into here but if you really want to know then I'm sure you can find out how to contact me ;)
I have [made the latest version live](http://woarl.com/board/rob.ph... | Table cells larger than they are meant to be | CC BY-SA 3.0 | null | 2008-08-22T09:55:34.057 | 2016-01-14T19:57:00.783 | 2015-11-20T11:39:49.157 | 3,218,692 | 1,384,652 | [
"html",
"css"
] |
22,003 | 2 | null | 22,001 | 8 | null | ```
#define IBOutlet
```
Whenever IBOutlet is used in program text, it will be replaced with nothing at all.
| null | CC BY-SA 2.5 | null | 2008-08-22T09:56:57.750 | 2008-08-22T09:56:57.750 | null | null | 893 | null |
21,987 | 1 | 23,285 | null | 6 | 3,667 | I am developing an application that controls an Machine.
When I receive an error from the Machine the users should be able to directly notice it, one way that is done is Flashing the tray on the taskbar. When the machine clears the error the tray should stop flashing.
There's one little annoyance using the `FlashWindow... | FlashWindowEx FLASHW_STOP still keeps taskbar colored | CC BY-SA 4.0 | 0 | 2008-08-22T09:42:41.047 | 2022-05-14T06:15:37.443 | 2022-03-31T14:08:03.487 | 850,848 | 2,090 | [
"c#",
"winapi",
"pinvoke"
] |
22,005 | 2 | null | 21,992 | 2 | null | If you're looking for a quick solution that should work with most available frameworks, I'd go for JSON. It's easy to start with and works.
If you're trying to build a larger application that you're going to extend (in terms of size or maybe your own API for 3rd party extensions) I'd go for XML. You could write a prox... | null | CC BY-SA 2.5 | null | 2008-08-22T09:59:15.437 | 2008-08-22T09:59:15.437 | 2017-05-23T12:24:47.530 | -1 | 834 | null |
21,983 | 2 | null | 21,870 | 3 | null | Bear in mind that the EntLib documentation specifically steers you towards the ASP.NET cache for ASP.NET applications. That's probably the strongest recommendation towards using it here. Plus the EntLib cache doesn't have dependencies, which for me is a big reason not to use it.
I don't think there's a technical limit... | null | CC BY-SA 2.5 | null | 2008-08-22T09:37:44.507 | 2008-08-22T09:37:44.507 | null | null | 1,738 | null |
22,002 | 2 | null | 21,992 | 0 | null | Different response format shouldn't be difficult to produce.
`JSON` works best for me, i like to keep `OO` in `js`, and don't know how to parse XML well :)
| null | CC BY-SA 3.0 | null | 2008-08-22T09:56:10.437 | 2013-01-24T10:06:40.107 | 2013-01-24T10:06:40.107 | 1,410,342 | 1,407 | null |
22,010 | 2 | null | 21,992 | 2 | null | I'd agree with John Topley - it depends on the application. There's a good article on quirksmode that discusses the advantages and disadvantages of each format that you might want to read: [http://www.quirksmode.org/blog/archives/2005/12/the_ajax_respon.html](http://www.quirksmode.org/blog/archives/2005/12/the_ajax_res... | null | CC BY-SA 2.5 | null | 2008-08-22T10:03:43.663 | 2008-08-22T10:03:43.663 | null | null | 1,904 | null |
22,011 | 1 | 22,044 | null | 2 | 346 | I'm toying with the idea of phasing in an ORM into an application I support. The app is not very structured with no unit tests. So any change will be risky. I'm obviously concerned that I've got a good enough reason to change. The idea is that there will be less boiler plate code for data access and there for greater p... | Switching to ORMs | CC BY-SA 2.5 | null | 2008-08-22T10:05:44.283 | 2012-08-11T16:11:08.667 | 2008-08-22T11:52:44.837 | 1,116 | 1,116 | [
"language-agnostic",
"orm"
] |
22,018 | 2 | null | 22,011 | 0 | null | I heard that TypeMock is often being used to refactor legacy code.
| null | CC BY-SA 2.5 | null | 2008-08-22T10:11:36.407 | 2008-08-22T10:11:36.407 | null | null | 2,374 | null |
22,014 | 2 | null | 22,011 | 0 | null | The rule for refactoring is. Do unit tests.
So maybe first you should place some unittests at least for the core/major things.
The ORM should be designed for decreasing boilerplate code. The time/trouble vs. ROI to be enterprisy is up to you to estimate :)
| null | CC BY-SA 3.0 | null | 2008-08-22T10:08:55.973 | 2012-08-11T16:10:59.023 | 2012-08-11T16:10:59.023 | 1,477,076 | 86 | null |
22,015 | 1 | null | null | 25 | 17,845 | I'm just looking for different opinions.
Do you consider OpenID a good "Single Sign On" solution?
The way it works seems to be a little bit confusing for an average user and there could be problems related to "putting all your eggs in the same basket".
Anyway, have anyone tried to implement his own OpenId solution wi... | OpenID as a Single Sign On option? | CC BY-SA 3.0 | 0 | 2008-08-22T10:09:02.823 | 2015-03-18T02:06:25.960 | 2015-03-18T02:06:25.960 | 1,266,242 | 2,249 | [
"openid",
"single-sign-on"
] |
22,012 | 1 | 22,026 | null | 21 | 12,647 | My application dynamically loads assemblies at runtime from specific subfolders. These assemblies are compiled with dependencies to other assemblies. The runtime trys to load these from the application directory. But I want to put them into the modules directory.
Is there a way to tell the runtime that the dlls are in... | Loading assemblies and its dependencies | CC BY-SA 3.0 | 0 | 2008-08-22T10:06:48.210 | 2012-08-11T16:16:13.293 | 2012-08-11T16:16:13.293 | 1,477,076 | 2,374 | [
"c#",
".net"
] |
21,999 | 1 | 22,793 | null | 10 | 12,941 | Anti aliasing [cannot be turned off](http://forums.msdn.microsoft.com/en-US/wpf/thread/1ad9a62a-d1a4-4ca2-a950-3b7bf5240de5) in WPF. But I want to remove the blurred look of WPF fonts when they are small.
One possibility would be to use a .net 2.0 component. This looks like it would lose the transparency capability a... | WPF Anti aliasing workaround | CC BY-SA 2.5 | 0 | 2008-08-22T09:54:43.793 | 2020-12-29T17:46:40.427 | 2008-08-23T10:56:16.930 | 91 | 1,013 | [
".net",
"wpf"
] |
22,016 | 2 | null | 22,000 | 1 | null | I haven't looked up the whole thing, but the problem lies somewhere in the style sheets.
If you copy out only the table part of it, it is displaying the map correctly.
If you remove the final `</span>` tag from this part, it is also working (however the page gets mixed):
```
<div class="inner"><span class="corners-t... | null | CC BY-SA 2.5 | null | 2008-08-22T10:09:20.153 | 2008-08-22T10:09:20.153 | null | null | 968 | null |
22,025 | 2 | null | 22,000 | 35 | null | I think you need to use `display: block` on your images. When images are `inline` there's a little extra space for the line spacing.
| null | CC BY-SA 3.0 | null | 2008-08-22T10:14:24.387 | 2013-06-01T02:37:04.037 | 2013-06-01T02:37:04.037 | 2,156,756 | 2,434 | null |
22,013 | 2 | null | 22,000 | 3 | null | I know this might sound bad, but you need to ensure there is no whitespace between then end of you `<img>` tag and the start of the end `</td>` tag.
i.e. The following will present the problem:
```
<td>
<img src="image.jpg"/>
</td>
```
And this will not:
```
<td><img src="image.jpg"/></td>
```
Hope that helps.
... | null | CC BY-SA 2.5 | null | 2008-08-22T10:08:45.960 | 2008-08-22T10:19:57.510 | 2008-08-22T10:19:57.510 | 1,908 | 1,908 | null |
22,021 | 2 | null | 21,961 | 2 | null | Phil's answer really solved it, but I'll elaborate a little more. Since the epoch is in UTC, if I want to compare other times to the epoch, I need to interpret them as UTC as well.
```
>>> calendar.timegm((2009, 1, 31, 0, 0, 0, 5, 31, -1))
1233360000
>>> 1233360000 / (60*60*24)
14275
```
By converting the time tuple... | null | CC BY-SA 2.5 | null | 2008-08-22T10:12:25.140 | 2008-08-22T10:12:25.140 | null | null | 2,427 | null |
22,028 | 2 | null | 22,015 | 1 | null | I think OpenID is far too confusing and clunky to force on any user, and I'm not even convinced it's solving an authentic problem. Having to register on each site I use has never struck me as a major issue. Particularly as it doesn't especially solve that problem; when I linked my OpenID to StackOverflow I had to fill... | null | CC BY-SA 2.5 | null | 2008-08-22T10:16:54.677 | 2008-08-22T10:16:54.677 | null | null | 2,131 | null |
22,019 | 2 | null | 20,047 | 3 | null | Q. Why are you storing the `AnswerCount` in the `Posts` table in the first place?
An alternative approach is to eliminate the "write back" to the `Posts` table by not storing the `AnswerCount` in the table but to dynamically calculate the number of answers to the post as required.
Yes, this will mean you're running a... | null | CC BY-SA 2.5 | null | 2008-08-22T10:12:06.187 | 2008-08-22T10:21:12.153 | 2008-08-22T10:21:12.170 | 993 | 993 | null |
22,029 | 2 | null | 22,012 | 1 | null | You can use the `<codeBase>` element found in the application configuration file. More information on "[Locating the Assembly through Codebases or Probing](http://msdn.microsoft.com/en-us/library/15hyw9x3.aspx)".
> Well, the loaded assembly doesn't have
an application configuration file.
Well if you know the specif... | null | CC BY-SA 2.5 | null | 2008-08-22T10:19:03.127 | 2008-08-22T10:30:00.230 | 2008-08-22T10:30:00.230 | 718 | 718 | null |