qid int64 4 8.14M | question stringlengths 20 48.3k | answers list | date stringlengths 10 10 | metadata list | input stringlengths 12 45k | output stringlengths 2 31.8k |
|---|---|---|---|---|---|---|
164,425 | <p>I am building a fun little app to determine if I should bike to work.</p>
<p>I would like to test to see if it is either Raining or Thunderstorm(ing).</p>
<pre><code>public enum WeatherType : byte
{ Sunny = 0, Cloudy = 1, Thunderstorm = 2, Raining = 4, Snowing = 8, MostlyCloudy = 16 }
</code></pre>
<p>I was think... | [
{
"answer_id": 164435,
"author": "MagicKat",
"author_id": 8505,
"author_profile": "https://Stackoverflow.com/users/8505",
"pm_score": 1,
"selected": false,
"text": "<p>use the FlagsAttribute. That will allow you to use the enum as a bit mask.</p>\n"
},
{
"answer_id": 164455,
... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18821/"
] | I am building a fun little app to determine if I should bike to work.
I would like to test to see if it is either Raining or Thunderstorm(ing).
```
public enum WeatherType : byte
{ Sunny = 0, Cloudy = 1, Thunderstorm = 2, Raining = 4, Snowing = 8, MostlyCloudy = 16 }
```
I was thinking I could do something like:
... | Your current code will say whether it's *exactly* "raining and thundery". To find out whether it's "raining and thundery and possibly something else" you need:
```
if ((currentWeather.Type & _badWeatherTypes) == _badWeatherTypes)
```
To find out whether it's "raining *or* thundery, and possibly something else" you n... |
164,427 | <p>I've made a Django site, but I've drank the Koolaid and I want to make an <em>IPhone</em> version. After putting much thought into I've come up with two options:</p>
<ol>
<li>Make a whole other site, like i.xxxx.com. Tie it into the same database using Django's sites framework.</li>
<li>Find some time of middlewa... | [
{
"answer_id": 164507,
"author": "Aaron",
"author_id": 11176,
"author_profile": "https://Stackoverflow.com/users/11176",
"pm_score": 5,
"selected": true,
"text": "<p>Rather than changing the template directories dynamically you could modify the request and add a value that lets your view... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24630/"
] | I've made a Django site, but I've drank the Koolaid and I want to make an *IPhone* version. After putting much thought into I've come up with two options:
1. Make a whole other site, like i.xxxx.com. Tie it into the same database using Django's sites framework.
2. Find some time of middleware that reads the user-agent... | Rather than changing the template directories dynamically you could modify the request and add a value that lets your view know if the user is on an iphone or not. Then wrap render\_to\_response (or whatever you are using for creating HttpResponse objects) to grab the iphone version of the template instead of the stand... |
164,460 | <p>The standalone flashplayer takes no arguments other than a .swf file when you launch it from the command line. I need the player to go full screen, no window borders and such. This can be accomplished by hitting ctrl+f once the program has started. I want to do this programmatically as I need it to launch into full ... | [
{
"answer_id": 164681,
"author": "bmdhacks",
"author_id": 14032,
"author_profile": "https://Stackoverflow.com/users/14032",
"pm_score": 1,
"selected": false,
"text": "<p>I've actually done this a long time ago, but it wasn't petty. What we did is use the <a href=\"http://sawfish.wikia.c... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11176/"
] | The standalone flashplayer takes no arguments other than a .swf file when you launch it from the command line. I need the player to go full screen, no window borders and such. This can be accomplished by hitting ctrl+f once the program has started. I want to do this programmatically as I need it to launch into full scr... | You can use a dedicated application which sends the keystroke to the window manager, which should then pass it to flash, if the window starts as being the active window on the screen. This is quite error prone, though, due to delays between starting flash and when the window will show up.
For example, your script coul... |
164,468 | <p>The IT department of a subsidiary of ours had a consulting company write them an ASP.NET application. Now it's having intermittent problems with mixing up who the current user is and has been known to show Joe some of Bob's data by mistake.</p>
<p>The consultants were brought back to troubleshoot and we were invit... | [
{
"answer_id": 164478,
"author": "Serafina Brocious",
"author_id": 4977,
"author_profile": "https://Stackoverflow.com/users/4977",
"pm_score": 4,
"selected": false,
"text": "<p>Rule of thumb: If you need to ask if a consultant knows what he's doing, he probably doesn't ;)</p>\n\n<p>And ... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12260/"
] | The IT department of a subsidiary of ours had a consulting company write them an ASP.NET application. Now it's having intermittent problems with mixing up who the current user is and has been known to show Joe some of Bob's data by mistake.
The consultants were brought back to troubleshoot and we were invited to liste... | I would agree. These guys seem quite incompetent.
(BTW, I'd check to see if in "SomeProprietarySessionManagementLookup," they're using static data. Saw this -- with behavior *exactly as you describe* on a project I inherited several months ago. It was a total head-slap moment when we finally saw it ... And wished we c... |
164,496 | <p>I've been reading about thread-safe singleton patterns here:</p>
<p><a href="http://en.wikipedia.org/wiki/Singleton_pattern#C.2B.2B_.28using_pthreads.29" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Singleton_pattern#C.2B.2B_.28using_pthreads.29</a></p>
<p>And it says at the bottom that the only safe way... | [
{
"answer_id": 164517,
"author": "1800 INFORMATION",
"author_id": 3146,
"author_profile": "https://Stackoverflow.com/users/3146",
"pm_score": -1,
"selected": false,
"text": "<p>There are many ways to do thread safe Singleton* initialization on windows. In fact some of them are even cross... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/986/"
] | I've been reading about thread-safe singleton patterns here:
<http://en.wikipedia.org/wiki/Singleton_pattern#C.2B.2B_.28using_pthreads.29>
And it says at the bottom that the only safe way is to use pthread\_once - which isn't available on Windows.
Is that the **only** way of guaranteeing thread safe initialisation?
... | If you are are using Visual C++ 2005/2008 you can use the double checked locking pattern, since "[volatile variables behave as fences](http://en.wikipedia.org/wiki/Double-checked_locking#Usage_in_Microsoft_Visual_C.2B.2B)". This is the most efficient way to implement a lazy-initialized singleton.
From [MSDN Magazine:]... |
164,575 | <p>I'm writing out XML files using the MSXML parser, with a wrapper I downloaded from here: <a href="http://www.codeproject.com/KB/XML/JW_CXml.aspx" rel="noreferrer">http://www.codeproject.com/KB/XML/JW_CXml.aspx</a>. Works great except that when I create a new document from code (so not load from file and modify), the... | [
{
"answer_id": 164610,
"author": "Martin Beckett",
"author_id": 10897,
"author_profile": "https://Stackoverflow.com/users/10897",
"pm_score": 0,
"selected": false,
"text": "<p>Unless the library has a format option then the only other way is to use XSLT, or an external pretty printer ( I... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11449/"
] | I'm writing out XML files using the MSXML parser, with a wrapper I downloaded from here: <http://www.codeproject.com/KB/XML/JW_CXml.aspx>. Works great except that when I create a new document from code (so not load from file and modify), the result is all in one big line. I'd like elements to be indented nicely so that... | Try this, I found this years ago on the web.
```
#include <msxml2.h>
bool FormatDOMDocument (IXMLDOMDocument *pDoc, IStream *pStream)
{
// Create the writer
CComPtr <IMXWriter> pMXWriter;
if (FAILED (pMXWriter.CoCreateInstance(__uuidof (MXXMLWriter), NULL, CLSCTX_ALL)))
{
return false;
}... |
164,585 | <p>I'm serializing an object in a C# VS2003 / .Net 1.1 application. I need it serialized without the processing instruction, however. The XmlSerializer class puts out something like this:</p>
<pre><code><?xml version="1.0" encoding="utf-16" ?>
<MyObject>
<Property1>Data</Property1>
<... | [
{
"answer_id": 164599,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": false,
"text": "<p>In 2.0, you would use <a href=\"http://msdn.microsoft.com/en-us/library/system.xml.xmlwritersettings.omitxmldeclar... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24222/"
] | I'm serializing an object in a C# VS2003 / .Net 1.1 application. I need it serialized without the processing instruction, however. The XmlSerializer class puts out something like this:
```
<?xml version="1.0" encoding="utf-16" ?>
<MyObject>
<Property1>Data</Property1>
<Property2>More Data</Property2>
</MyObje... | The following link will take you to a post where someone has a method of supressing the processing instruction by using an XmlWriter and getting into an 'Element' state rather than a 'Start' state. This causes the processing instruction to not be written.
[Suppress Processing Instruction](http://www.tech-archive.net/A... |
164,597 | <p>My server has both Subversion and Apache installed, and the Apache web directory is also a Subversion working copy. The reason for this is that the simple command <code>svn update /server/staging</code> will deploy the latest source to the staging server.</p>
<p>Apache public web directory: <code>/server/staging</c... | [
{
"answer_id": 164646,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 0,
"selected": false,
"text": "<p>I would set up <code>svnserve</code> which is a simple Subversion server using the <code>svn://</code> protocol. You c... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/326176/"
] | My server has both Subversion and Apache installed, and the Apache web directory is also a Subversion working copy. The reason for this is that the simple command `svn update /server/staging` will deploy the latest source to the staging server.
Apache public web directory: `/server/staging` *— (This is an SVN working ... | Directory Set Group ID
If the setgid bit on a directory entry is set, files in that directory will have the group ownership as the directory, instead of than the group of the user that created the file.
This attribute is helpful when several users need access to certain files. If the users work in a directory with th... |
164,621 | <p>I need to create reports in a C# .NET Windows app. I've got an SQL Server 2005 database, Visual Studio 2005 and am quite OK with creating stored procedures and datasets.</p>
<p>Can someone please point me in the right direction for creating reports? I just can't seem work it out. Some examples would be a good start... | [
{
"answer_id": 164666,
"author": "alexmac",
"author_id": 23066,
"author_profile": "https://Stackoverflow.com/users/23066",
"pm_score": 2,
"selected": false,
"text": "<p>Crystal is one possible option for creating reports. It has been around a long time and a lot of people seem to like it... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18854/"
] | I need to create reports in a C# .NET Windows app. I've got an SQL Server 2005 database, Visual Studio 2005 and am quite OK with creating stored procedures and datasets.
Can someone please point me in the right direction for creating reports? I just can't seem work it out. Some examples would be a good start, or a sim... | I have managed to make this work now.
**Brief Overview**
It works by having a 'data class' which is just a regular C# class containing variables and no code. This is then instantiated and filled with data and then placed inside an ArrayList. The ArrayList is bound to the report viewer, along with the name of the repo... |
164,630 | <p>My app open file in subdirectory of directory where it is executed, subdirectory is called <code>sample</code> and it contains files:</p>
<ul>
<li><code>example.raf</code> (example extension, non significant)</li>
<li><code>background.gif</code></li>
</ul>
<p><code>example.raf</code> contains relative path to <cod... | [
{
"answer_id": 164667,
"author": "Bob King",
"author_id": 6897,
"author_profile": "https://Stackoverflow.com/users/6897",
"pm_score": 1,
"selected": false,
"text": "<p>The OpenFileDialog is spitting out an absolute path behind the scenes.</p>\n\n<p>If you know the location of raf file yo... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | My app open file in subdirectory of directory where it is executed, subdirectory is called `sample` and it contains files:
* `example.raf` (example extension, non significant)
* `background.gif`
`example.raf` contains relative path to `background.gif` (in this case only file name cause the files is in same directory ... | Next code from my project ZipSolution (<http://zipsolution.codeplex.com/>)
shows how to resolve and create relative pathes in .net
```
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace ZipSolution
{
internal static class RelativePathDiscovery
{
/// <summary>... |
164,642 | <p>How do I create a grails war file so that it doesn't have the version number</p>
<p>(e.g. foo-0.1.war) </p>
<p>attached to the end when I execute the 'grails war' command?</p>
| [
{
"answer_id": 164702,
"author": "Instantsoup",
"author_id": 9861,
"author_profile": "https://Stackoverflow.com/users/9861",
"pm_score": 6,
"selected": true,
"text": "<p>I think you can specify the war name in the war command.</p>\n\n<pre><code>grails war foo.war\n</code></pre>\n\n<p>Als... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How do I create a grails war file so that it doesn't have the version number
(e.g. foo-0.1.war)
attached to the end when I execute the 'grails war' command? | I think you can specify the war name in the war command.
```
grails war foo.war
```
Also check the latest Grails documentation for where to set this as a configuration option. See the other answers for details. |
164,643 | <p>In my C# source code I may have declared integers as:</p>
<pre><code>int i = 5;
</code></pre>
<p>or</p>
<pre><code>Int32 i = 5;
</code></pre>
<p>In the currently prevalent 32-bit world they are equivalent. However, as we move into a 64-bit world, am I correct in saying that the following will become the same?</p... | [
{
"answer_id": 164650,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 7,
"selected": true,
"text": "<p>No. The C# specification rigidly defines that <code>int</code> is an alias for <code>System.Int32</code> with exactly ... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] | In my C# source code I may have declared integers as:
```
int i = 5;
```
or
```
Int32 i = 5;
```
In the currently prevalent 32-bit world they are equivalent. However, as we move into a 64-bit world, am I correct in saying that the following will become the same?
```
int i = 5;
Int64 i = 5;
``` | No. The C# specification rigidly defines that `int` is an alias for `System.Int32` with exactly 32 bits. Changing this would be a *major* breaking change. |
164,697 | <p>I am a little confused about null values and variables in .NET. (VB preferred)</p>
<p>Is there any way to check the "nullness" of ANY given variable regardless of whether it was an object or a value type? Or does my null check have to always anticipate whether it's checking a value type (e.g. System.Integer) or an ... | [
{
"answer_id": 164706,
"author": "Bob King",
"author_id": 6897,
"author_profile": "https://Stackoverflow.com/users/6897",
"pm_score": 2,
"selected": false,
"text": "<p>Value Types can't be null. It violates what it means to be a Value Type. You can wrap Value Types as Nullable(Of T) whic... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17235/"
] | I am a little confused about null values and variables in .NET. (VB preferred)
Is there any way to check the "nullness" of ANY given variable regardless of whether it was an object or a value type? Or does my null check have to always anticipate whether it's checking a value type (e.g. System.Integer) or an object?
... | Normal value types (booleans, ints, longs, float, double, enum and structs) are not nullable.
The default value for all value types is 0.
The CLR won't let you access variables unless they have been set. You may think this isn't always the case, but sometimes the CLR steps in and initializes them for you. At a method... |
164,714 | <p>I just want to know the best way to emulate a C# style enumeration in Ruby.</p>
| [
{
"answer_id": 164738,
"author": "Jonathan Lonowski",
"author_id": 15031,
"author_profile": "https://Stackoverflow.com/users/15031",
"pm_score": 2,
"selected": false,
"text": "<p>I don't think Ruby supports true enums -- though, there are still solutions available.</p>\n\n<p><a href=\"ht... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20714/"
] | I just want to know the best way to emulate a C# style enumeration in Ruby. | >
> Specifically, I would like to be able to perform logical tests against the set of values given some variable. Example would be the state of a window: "minimized, maximized, closed, open"
>
>
>
If you need the enumerations to map to values (eg, you need minimized to equal 0, maximised to equal 100, etc) I'd use... |
164,727 | <p>How do you return values or structures from a Popup window in Powerbuilder 9.0? The CloseWithReturn is only valid for Response windows and thus is not available. When I set a value to the Message.PowerObjectParm, the value becomes null when the Popup window closes. I need to use a Popup window so the user can click ... | [
{
"answer_id": 165584,
"author": "Doug Porter",
"author_id": 4311,
"author_profile": "https://Stackoverflow.com/users/4311",
"pm_score": 3,
"selected": true,
"text": "<p>You won't be able to accomplish this the way you are thinking. Since the window you are opening from the parent is no... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4466/"
] | How do you return values or structures from a Popup window in Powerbuilder 9.0? The CloseWithReturn is only valid for Response windows and thus is not available. When I set a value to the Message.PowerObjectParm, the value becomes null when the Popup window closes. I need to use a Popup window so the user can click bac... | You won't be able to accomplish this the way you are thinking. Since the window you are opening from the parent is not a Response window, the two aren't explicitly linked together.
But you could accomplish this by having a public instance variable in the parent window that is of the type of your custom structure. The... |
164,736 | <p>I am trying to call php-cgi.exe from a .NET program. I use RedirectStandardOutput to get the output back as a stream but the whole thing is very slow.</p>
<p>Do you have any idea on how I can make that faster? Any other technique?</p>
<pre><code> Dim oCGI As ProcessStartInfo = New ProcessStartInfo()
oCGI.Wo... | [
{
"answer_id": 164791,
"author": "Bob King",
"author_id": 6897,
"author_profile": "https://Stackoverflow.com/users/6897",
"pm_score": 4,
"selected": true,
"text": "<p>You can use the <a href=\"http://msdn.microsoft.com/en-us/library/system.diagnostics.process.outputdatareceived.aspx\" re... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1508/"
] | I am trying to call php-cgi.exe from a .NET program. I use RedirectStandardOutput to get the output back as a stream but the whole thing is very slow.
Do you have any idea on how I can make that faster? Any other technique?
```
Dim oCGI As ProcessStartInfo = New ProcessStartInfo()
oCGI.WorkingDirectory = "C:\... | You can use the [OutputDataReceived event](http://msdn.microsoft.com/en-us/library/system.diagnostics.process.outputdatareceived.aspx) to receive data as it's pumped to StdOut. |
164,751 | <p>I have a dialog that resizes. It also has a custom background which I paint in response to a WM_ERASEBKGND call (currently a simple call to FillSolidRect). </p>
<p>When the dialog is resized, there is tremendous flickering going on. To try and reduce the flickering I enumerate all child windows and add them to t... | [
{
"answer_id": 164766,
"author": "Frank Krueger",
"author_id": 338,
"author_profile": "https://Stackoverflow.com/users/338",
"pm_score": 2,
"selected": false,
"text": "<p>Double buffering is indeed the only way to make this work.</p>\n\n<p>Child controls will take care of themselves so l... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7442/"
] | I have a dialog that resizes. It also has a custom background which I paint in response to a WM\_ERASEBKGND call (currently a simple call to FillSolidRect).
When the dialog is resized, there is tremendous flickering going on. To try and reduce the flickering I enumerate all child windows and add them to the clipping ... | Assuming that "FillSolidRect" is the erase of your background then return TRUE from the WM\_ERASEBKGND.
To do the double buffering that you are almost doing in your code fragment, you will need to use CreateCompatibleBitmap and select that into your memDC. |
164,767 | <pre><code>$array = explode(".", $row[copy]);
$a = $array.length -1;
</code></pre>
<p>I want to return the last element of this array but all i get from this is -1.</p>
| [
{
"answer_id": 164781,
"author": "benzado",
"author_id": 10947,
"author_profile": "https://Stackoverflow.com/users/10947",
"pm_score": 0,
"selected": false,
"text": "<p>I think your second line should be more like:</p>\n\n<pre><code>$index = count($array) - 1;\n$a = $array[$index];\n</co... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
$array = explode(".", $row[copy]);
$a = $array.length -1;
```
I want to return the last element of this array but all i get from this is -1. | You can also use:
$a = end($array);
This also sets the arrays internal pointer to the end of the array, but it does get you the last element easily. |
164,789 | <p>I am trying to do a Windows Forms application in an MVP style and - not having done much with threading before - am getting all confused.</p>
<p>My UI is a set of very simple forms. Each of the forms implements an interface and contains a reference to a mediator class which lives in the Business Logic Layer and vi... | [
{
"answer_id": 164835,
"author": "Dillie-O",
"author_id": 71,
"author_profile": "https://Stackoverflow.com/users/71",
"pm_score": 2,
"selected": false,
"text": "<p>Have you looked into the <a href=\"http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx\" rel... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164789",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] | I am trying to do a Windows Forms application in an MVP style and - not having done much with threading before - am getting all confused.
My UI is a set of very simple forms. Each of the forms implements an interface and contains a reference to a mediator class which lives in the Business Logic Layer and vice versa.
S... | Have you looked into the [BackgroundWorker](http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx) class? It's great for doing a lot of the simplified processing in the background type procedures and gives events that can be listned to do have your GUI display progress. |
164,808 | <p>I've got an issue when accessing a web site, I can access it by using the NetBIOS name, but when accessing with the FQDN i get an error. </p>
<p>Any ideas on how to troubleshoot this?</p>
<p>(There is no DNS configured yet, we have modified the Hosts file to enter the related names and IP.)</p>
| [
{
"answer_id": 164907,
"author": "dragonmantank",
"author_id": 204,
"author_profile": "https://Stackoverflow.com/users/204",
"pm_score": 0,
"selected": false,
"text": "<p>Just to make sure, you have something like this</p>\n\n<pre><code>192.168.100.5 othermachine othermachine.mydomain.lo... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19159/"
] | I've got an issue when accessing a web site, I can access it by using the NetBIOS name, but when accessing with the FQDN i get an error.
Any ideas on how to troubleshoot this?
(There is no DNS configured yet, we have modified the Hosts file to enter the related names and IP.) | First, check the obvious: are there any typos in the file?
Next, test out the name resolution. Something simple like pinging the web server by it's FQDN will do. See if the right IP is mentioned.
* If you get "unknown host", your client's hosts file does not have an entry for the FQDN you entered (check for typos in ... |
164,839 | <p>Every time I try to create a new project or solution in visual studio (2005 and 2008), I get an error saying, "Project Creation failed." I even tried running vs in administrative mode, but I still get the same answer. Anyone have any suggestions, in short of uninstalling all of VS and reinstalling it?</p>
| [
{
"answer_id": 164860,
"author": "Forgotten Semicolon",
"author_id": 1960,
"author_profile": "https://Stackoverflow.com/users/1960",
"pm_score": 1,
"selected": false,
"text": "<p>It sounds like an Add-in behaving badly. Can you launch it in safe mode?</p>\n\n<pre><code>devenv.exe /SafeM... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21745/"
] | Every time I try to create a new project or solution in visual studio (2005 and 2008), I get an error saying, "Project Creation failed." I even tried running vs in administrative mode, but I still get the same answer. Anyone have any suggestions, in short of uninstalling all of VS and reinstalling it? | It sounds like an Add-in behaving badly. Can you launch it in safe mode?
```
devenv.exe /SafeMode
``` |
164,847 | <p>Vi and Vim allow for really awesome customization, typically stored inside a <code>.vimrc</code> file. Typical features for a programmer would be syntax highlighting, smart indenting and so on.</p>
<p><strong>What other tricks for productive programming have you got, hidden in your .vimrc?</strong></p>
<p>I am mos... | [
{
"answer_id": 164866,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 6,
"selected": false,
"text": "<p>This isn't in my .vimrc file, but yesterday I learned about the <code>]p</code> command. This pastes the contents of a... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7028/"
] | Vi and Vim allow for really awesome customization, typically stored inside a `.vimrc` file. Typical features for a programmer would be syntax highlighting, smart indenting and so on.
**What other tricks for productive programming have you got, hidden in your .vimrc?**
I am mostly interested in refactorings, auto clas... | You asked for it :-)
```
"{{{Auto Commands
" Automatically cd into the directory that the file is in
autocmd BufEnter * execute "chdir ".escape(expand("%:p:h"), ' ')
" Remove any trailing whitespace that is in the file
autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif
" Restore cursor position to ... |
164,858 | <p>The following snippet of C# code:</p>
<pre><code> int i = 1;
string result = String.Format("{0},{1},{2}", i++, i++, i++);
Console.WriteLine(result);
</code></pre>
<p>writes out: 1,2,3</p>
<p>Before I tried this in the compiler I was expecting the assignments to take place and then the evaluations, so my expe... | [
{
"answer_id": 164908,
"author": "Jacob Krall",
"author_id": 3140,
"author_profile": "https://Stackoverflow.com/users/3140",
"pm_score": 3,
"selected": true,
"text": "<p>The <strong>order of evaluation</strong> of arguments is strictly left-to-right in C#. When you evaluate the expressi... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164858",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] | The following snippet of C# code:
```
int i = 1;
string result = String.Format("{0},{1},{2}", i++, i++, i++);
Console.WriteLine(result);
```
writes out: 1,2,3
Before I tried this in the compiler I was expecting the assignments to take place and then the evaluations, so my expected output was: 1,1,1
So my que... | The **order of evaluation** of arguments is strictly left-to-right in C#. When you evaluate the expression `i++`, what happens is the value of `i` is calculated and pushed, then the value of `i` is incremented.
The ++ operator on System.Int32 is effectively a function with the special name `++` and the special syntax ... |
164,865 | <p>Here at work, we are working on a newsletter system that our clients can use. As an intern one of my jobs is to help with the smaller pieces of the puzzle. In this case what I need to do is scan the logs of the email server for bounced messages and add the emails and the reason the email bounced to a "bad email data... | [
{
"answer_id": 164892,
"author": "zigdon",
"author_id": 4913,
"author_profile": "https://Stackoverflow.com/users/4913",
"pm_score": 3,
"selected": false,
"text": "<p>I'm not sure what you want to put in @list? If the awk pipes one line per entry, you'll have that in $line, and you don't... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2128/"
] | Here at work, we are working on a newsletter system that our clients can use. As an intern one of my jobs is to help with the smaller pieces of the puzzle. In this case what I need to do is scan the logs of the email server for bounced messages and add the emails and the reason the email bounced to a "bad email databas... | Something like this would work:
```
while(<STDIN>) {
my $line = $_;
chomp($line);
my ($email,$reason) = split(/\|/, $line);
print "Email: $email\n";
print "Reason: $reason";
my $sth = $dbh->prepare(qq{INSERT INTO bademails VALUES(?, ?)});
$sth->execute($email, $reason); ... |
164,926 | <p>When displaying the value of a decimal currently with <code>.ToString()</code>, it's accurate to like 15 decimal places, and since I'm using it to represent dollars and cents, I only want the output to be 2 decimal places. </p>
<p>Do I use a variation of <code>.ToString()</code> for this?</p>
| [
{
"answer_id": 164932,
"author": "albertein",
"author_id": 23020,
"author_profile": "https://Stackoverflow.com/users/23020",
"pm_score": 11,
"selected": true,
"text": "<pre><code>decimalVar.ToString("#.##"); // returns ".5" when decimalVar == 0.5m\n</code></pre>\n<p>o... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1692/"
] | When displaying the value of a decimal currently with `.ToString()`, it's accurate to like 15 decimal places, and since I'm using it to represent dollars and cents, I only want the output to be 2 decimal places.
Do I use a variation of `.ToString()` for this? | ```
decimalVar.ToString("#.##"); // returns ".5" when decimalVar == 0.5m
```
or
```
decimalVar.ToString("0.##"); // returns "0.5" when decimalVar == 0.5m
```
or
```
decimalVar.ToString("0.00"); // returns "0.50" when decimalVar == 0.5m
``` |
164,927 | <p>What is the best way to find out if a primary key with a certain value already exists in a table?</p>
<p>I can think of:</p>
<pre><code>SELECT key FROM table WHERE key = 'value';
</code></pre>
<p>and count the results, or:</p>
<pre><code>SELECT SQL_CALC_FOUND_ROWS key FROM table WHERE key = 'value' LIMIT 1;
SELE... | [
{
"answer_id": 164942,
"author": "Jarod Elliott",
"author_id": 1061,
"author_profile": "https://Stackoverflow.com/users/1061",
"pm_score": 3,
"selected": true,
"text": "<p>I think either of your suggestions in the question are suitable.</p>\n\n<p>Depending on how you are using this thoug... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3740/"
] | What is the best way to find out if a primary key with a certain value already exists in a table?
I can think of:
```
SELECT key FROM table WHERE key = 'value';
```
and count the results, or:
```
SELECT SQL_CALC_FOUND_ROWS key FROM table WHERE key = 'value' LIMIT 1;
SELECT FOUND_ROWS();
``` | I think either of your suggestions in the question are suitable.
Depending on how you are using this though, you can potentially save time by doing an INSERT IGNORE, which allows you to insert a new row if the primary key doesn't exist. If it does exist, the error is ignored so you can continue as normal.
Other simil... |
164,964 | <p>I'm trying to determine the asymptotic run-time of one of my algorithms, which uses exponents, but I'm not sure of how exponents are calculated programmatically.</p>
<p>I'm specifically looking for the pow() algorithm used for double-precision, floating point numbers.</p>
| [
{
"answer_id": 164972,
"author": "Andru Luvisi",
"author_id": 5922,
"author_profile": "https://Stackoverflow.com/users/5922",
"pm_score": 1,
"selected": false,
"text": "<p>The usual approach, to raise a to the b, for an integer exponent, goes something like this:</p>\n\n<pre><code>result... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55/"
] | I'm trying to determine the asymptotic run-time of one of my algorithms, which uses exponents, but I'm not sure of how exponents are calculated programmatically.
I'm specifically looking for the pow() algorithm used for double-precision, floating point numbers. | I've had a chance to look at fdlibm's implementation. The comments describe the algorithm used:
```
* n
* Method: Let x = 2 * (1+f)
* 1. Compute and return log2(x) in two pieces:
* log2(x) = w1 + w2,
* where w1 has 53-24 = 29 bit trailing zeros.
* 2. Perform ... |
164,967 | <p>I have an Excel application in which I want to present the user with a list of the Data Source Names (ie: DSN's), whereby s/he can choose what data source to use.</p>
<p>Hopefully once I've got the list, I can easily access the DSN properties to connect to the appropriate database.</p>
<p>Please note, I do <em>not... | [
{
"answer_id": 165044,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 5,
"selected": true,
"text": "<p>The DSN entries are stored in the registry in the following keys.</p>\n\n<pre>HKEY_CURRENT_USER\\Software\\ODBC\\OD... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1354/"
] | I have an Excel application in which I want to present the user with a list of the Data Source Names (ie: DSN's), whereby s/he can choose what data source to use.
Hopefully once I've got the list, I can easily access the DSN properties to connect to the appropriate database.
Please note, I do *not* want to use a DSN-... | The DSN entries are stored in the registry in the following keys.
```
HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC Data Sources
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources
```
This contains the list of all defined DSN. This acts as an global index and the specific details for each DSN are stored in a... |
164,979 | <p>I'm after a regex that will validate a full complex UK postcode only within an input string. All of the uncommon postcode forms must be covered as well as the usual. For instance:</p>
<p><strong>Matches</strong></p>
<ul>
<li>CW3 9SS</li>
<li>SE5 0EG</li>
<li>SE50EG</li>
<li>se5 0eg</li>
<li>WC2H 7LT</li>
</ul>
<p... | [
{
"answer_id": 164992,
"author": "Dan",
"author_id": 230,
"author_profile": "https://Stackoverflow.com/users/230",
"pm_score": 5,
"selected": false,
"text": "<pre><code>^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$\n</code></pre>\n\... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777/"
] | I'm after a regex that will validate a full complex UK postcode only within an input string. All of the uncommon postcode forms must be covered as well as the usual. For instance:
**Matches**
* CW3 9SS
* SE5 0EG
* SE50EG
* se5 0eg
* WC2H 7LT
**No Match**
* aWC2H 7LT
* WC2H 7LTa
* WC2H
How do I solve this problem? | I'd recommend taking a look at the UK Government Data Standard for postcodes [link now dead; [archive of XML](http://webarchive.nationalarchives.gov.uk/+/http://www.cabinetoffice.gov.uk/media/291370/bs7666-v2-0-xsd-PostCodeType.htm), see [Wikipedia](http://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom#Validatio... |
164,981 | <p>I have a PHP script that uses the <code>system()</code> call to execute other (potentially long-running) programs (for interest: NCBI BLAST, phrap, primer3 and other programs for doing DNA sequence analysis and assembly).</p>
<p>I'm running under Windows XP, using the CLI version of PHP from a command prompt, or as... | [
{
"answer_id": 164992,
"author": "Dan",
"author_id": 230,
"author_profile": "https://Stackoverflow.com/users/230",
"pm_score": 5,
"selected": false,
"text": "<pre><code>^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$\n</code></pre>\n\... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a PHP script that uses the `system()` call to execute other (potentially long-running) programs (for interest: NCBI BLAST, phrap, primer3 and other programs for doing DNA sequence analysis and assembly).
I'm running under Windows XP, using the CLI version of PHP from a command prompt, or as a service. (In eithe... | I'd recommend taking a look at the UK Government Data Standard for postcodes [link now dead; [archive of XML](http://webarchive.nationalarchives.gov.uk/+/http://www.cabinetoffice.gov.uk/media/291370/bs7666-v2-0-xsd-PostCodeType.htm), see [Wikipedia](http://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom#Validatio... |
164,990 | <p>This is a continuation question from a previous question <a href="https://stackoverflow.com/questions/142237/integrating-external-sources-in-a-build.">I have asked</a></p>
<p>I now have a /externals directory in the root of my project tree. Inside this I have a reference to another project. I'm able to script the b... | [
{
"answer_id": 164992,
"author": "Dan",
"author_id": 230,
"author_profile": "https://Stackoverflow.com/users/230",
"pm_score": 5,
"selected": false,
"text": "<pre><code>^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$\n</code></pre>\n\... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1894/"
] | This is a continuation question from a previous question [I have asked](https://stackoverflow.com/questions/142237/integrating-external-sources-in-a-build.)
I now have a /externals directory in the root of my project tree. Inside this I have a reference to another project. I'm able to script the build of all my extern... | I'd recommend taking a look at the UK Government Data Standard for postcodes [link now dead; [archive of XML](http://webarchive.nationalarchives.gov.uk/+/http://www.cabinetoffice.gov.uk/media/291370/bs7666-v2-0-xsd-PostCodeType.htm), see [Wikipedia](http://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom#Validatio... |
164,996 | <p>Using C# in Visual Studio 2008 and stepping through a function in the debugger I get to the end of a function and am on the final curly brace } and about to return. Is there a way to find out what value the function is about to return?</p>
<p>This is necessary if the return value is calculated such as:</p>
<pre><c... | [
{
"answer_id": 165004,
"author": "MagicKat",
"author_id": 8505,
"author_profile": "https://Stackoverflow.com/users/8505",
"pm_score": 2,
"selected": false,
"text": "<p>You can put </p>\n\n<pre><code>(x.Func() > y.Func())\n</code></pre>\n\n<p>in a watch window to evaluate it, and see t... | 2008/10/02 | [
"https://Stackoverflow.com/questions/164996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] | Using C# in Visual Studio 2008 and stepping through a function in the debugger I get to the end of a function and am on the final curly brace } and about to return. Is there a way to find out what value the function is about to return?
This is necessary if the return value is calculated such as:
```
return (x.Func() ... | It's a little low level, but if you switch to disassembly then you can single step through the instructions and see what the return value is being set to. It is typically set in the @eax register.
You can place a breakpoint on the ret instructions and inspect the register at that point if you don't want to single step... |
165,025 | <p>In ASP.NET, I am exporting some data to Excel by simply binding a DataSet to a GridView and then setting the ContentType to Excel.</p>
<p>My ASPX page is very simple and looks like this:</p>
<pre><code><%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExamExportReport.aspx.cs" Inherits="Cabi.CamCentral.... | [
{
"answer_id": 165084,
"author": "azamsharp",
"author_id": 3797,
"author_profile": "https://Stackoverflow.com/users/3797",
"pm_score": 2,
"selected": false,
"text": "<p>Here is my code that works fine: </p>\n\n<pre><code>protected void Page_Load(object sender, EventArgs e)\n {\n ... | 2008/10/02 | [
"https://Stackoverflow.com/questions/165025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1436/"
] | In ASP.NET, I am exporting some data to Excel by simply binding a DataSet to a GridView and then setting the ContentType to Excel.
My ASPX page is very simple and looks like this:
```
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExamExportReport.aspx.cs" Inherits="Cabi.CamCentral.Web.Pages.Utility.ExamEx... | @azamsharp - I found the solution elsewhere while you were replying. :-) It turns out that removing the form tag entirely from the ASPX page is the trick, and the only way to do this is to override the VerifyRenderingInServerForm method as you are doing.
If you update your solution to include the fact that you need to... |
165,043 | <p>This is an excerpt of code from a class I am working with in Java (below). Obviously the code is defining a static variable named EPSILON with the data type double. What I don't understand is the "1E-14" part. What kind of number is that? What does it mean?</p>
<p>final double EPSILON = 1E-14;</p>
| [
{
"answer_id": 165051,
"author": "Owen",
"author_id": 11442,
"author_profile": "https://Stackoverflow.com/users/11442",
"pm_score": 3,
"selected": false,
"text": "<p>1E3 => 1000</p>\n\n<p>1E-1 => 0.1</p>\n\n<p>1E-2 => 0.01</p>\n\n<p>It's a way for writing 1 * 10<sup>-14</sup></p>\n"
},... | 2008/10/02 | [
"https://Stackoverflow.com/questions/165043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | This is an excerpt of code from a class I am working with in Java (below). Obviously the code is defining a static variable named EPSILON with the data type double. What I don't understand is the "1E-14" part. What kind of number is that? What does it mean?
final double EPSILON = 1E-14; | In your case, this is equivalent to writing:
```
final double EPSILON = 0.00000000000001;
```
except you don't have to count the zeros. This is called [scientific notation](http://en.wikipedia.org/wiki/Scientific_notation) and is helpful when writing very large or very small numbers. |
165,075 | <p>I'd like to map a reference to an object instead of the object value with an HashTable</p>
<pre><code>configMapping.Add("HEADERS_PATH", Me.headers_path)
</code></pre>
<p>that way when I'm going to retrieve the value of "HEADERS_PATH" I'll be able to assign a value to Me.headers_path</p>
<p>something like the " &a... | [
{
"answer_id": 165088,
"author": "Enrico Murru",
"author_id": 68336,
"author_profile": "https://Stackoverflow.com/users/68336",
"pm_score": 1,
"selected": false,
"text": "<p>make headers_path be a propriety (with set)</p>\n"
},
{
"answer_id": 165091,
"author": "Jorge Ferreira... | 2008/10/02 | [
"https://Stackoverflow.com/questions/165075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6367/"
] | I'd like to map a reference to an object instead of the object value with an HashTable
```
configMapping.Add("HEADERS_PATH", Me.headers_path)
```
that way when I'm going to retrieve the value of "HEADERS\_PATH" I'll be able to assign a value to Me.headers\_path
something like the " & " operator in C | I am assuming that *Me.headers\_path* is a System.String. Because **System.String** are immutable what you want cannot be achieved. But you can add an extra level of indirection to achieve a similar behavior.
>
> All problems in computer science can
> be solved by another level of
> indirection.
> *Butler Lampson*... |
165,082 | <p>I'm hand-maintaining an HTML document, and I'm looking for a way to automatically insert a link around text in a table. Let me illustrate:</p>
<pre><code><table><tr><td class="case">123456</td></tr></table>
</code></pre>
<p>I would like to automatically make every text in a TD w... | [
{
"answer_id": 165100,
"author": "Dan",
"author_id": 17121,
"author_profile": "https://Stackoverflow.com/users/17121",
"pm_score": 5,
"selected": true,
"text": "<p>Not in a manner that will work across browsers. You could, however, do that with some relatively trivial Javascript..</p>\n\... | 2008/10/02 | [
"https://Stackoverflow.com/questions/165082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19207/"
] | I'm hand-maintaining an HTML document, and I'm looking for a way to automatically insert a link around text in a table. Let me illustrate:
```
<table><tr><td class="case">123456</td></tr></table>
```
I would like to automatically make every text in a TD with class "case" a link to that case in our bug tracking syste... | Not in a manner that will work across browsers. You could, however, do that with some relatively trivial Javascript..
```
function makeCasesClickable(){
var cells = document.getElementsByTagName('td')
for (var i = 0, cell; cell = cells[i]; i++){
if (cell.className != 'case') continue
var caseId... |
165,092 | <p>Basically I wanted to do something like <code>git push mybranch to repo1, repo2, repo3</code></p>
<p>right now I'm just typing push many times, and if I'm in a hurry to the the pushing done, I just send them all to the background <code>git push repo1 & git push repo2 &</code></p>
<p>I'm just wondering if <... | [
{
"answer_id": 165131,
"author": "Adam Franco",
"author_id": 15872,
"author_profile": "https://Stackoverflow.com/users/15872",
"pm_score": 3,
"selected": false,
"text": "<p>What I do is have a single bare repository that lives in my home directory that I push to. The post-update hook in ... | 2008/10/02 | [
"https://Stackoverflow.com/questions/165092",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13989/"
] | Basically I wanted to do something like `git push mybranch to repo1, repo2, repo3`
right now I'm just typing push many times, and if I'm in a hurry to the the pushing done, I just send them all to the background `git push repo1 & git push repo2 &`
I'm just wondering if `git` natively supports what I want to do, or if... | You can have several URLs per remote in git, even though the `git remote` command did not appear to expose this last I checked. In `.git/config`, put something like this:
```
[remote "public"]
url = git@github.com:kch/inheritable_templates.git
url = kch@homeserver:projects/inheritable_templates.git
```
Now y... |
165,101 | <p>The following code:</p>
<pre><code>template <typename S, typename T>
struct foo {
void bar();
};
template <typename T>
void foo <int, T>::bar() {
}
</code></pre>
<p>gives me the error</p>
<pre><code>invalid use of incomplete type 'struct foo<int, T>'
declaration of 'struct foo<int, ... | [
{
"answer_id": 165153,
"author": "coppro",
"author_id": 16855,
"author_profile": "https://Stackoverflow.com/users/16855",
"pm_score": 7,
"selected": true,
"text": "<p>You can't partially specialize a function. If you wish to do so on a member function, you must partially specialize the e... | 2008/10/02 | [
"https://Stackoverflow.com/questions/165101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112/"
] | The following code:
```
template <typename S, typename T>
struct foo {
void bar();
};
template <typename T>
void foo <int, T>::bar() {
}
```
gives me the error
```
invalid use of incomplete type 'struct foo<int, T>'
declaration of 'struct foo<int, T>'
```
(I'm using gcc.) Is my syntax for partial specializati... | You can't partially specialize a function. If you wish to do so on a member function, you must partially specialize the entire template (yes, it's irritating). On a large templated class, to partially specialize a function, you would need a workaround. Perhaps a templated member struct (e.g. `template <typename U = T> ... |
165,106 | <p>I work with a lot of offsite developers and contractors. I ask them daily to send me a quick 5 minute status of their work for the day. I have to sometimes consolidate the status of individuals into teams and sometimes consolidate the status of a week, for end-of-period reporting to my clients.</p>
I want to learn:
... | [
{
"answer_id": 165134,
"author": "jasonbar",
"author_id": 15099,
"author_profile": "https://Stackoverflow.com/users/15099",
"pm_score": 0,
"selected": false,
"text": "<p>Just give them a template laid out in a format that you expect to see the data returned in. You may also consider inc... | 2008/10/02 | [
"https://Stackoverflow.com/questions/165106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16794/"
] | I work with a lot of offsite developers and contractors. I ask them daily to send me a quick 5 minute status of their work for the day. I have to sometimes consolidate the status of individuals into teams and sometimes consolidate the status of a week, for end-of-period reporting to my clients.
I want to learn:
* Item... | Use [Scrum](http://en.wikipedia.org/wiki/Scrum_(development)). Create the sprint backlog, have a spreadsheet with the tasks and a column for each day of the sprint. Ask people to fill out the hours worked on each task every day. Send daily report starting with the burndown chart for the sprint and then short two one li... |
165,140 | <p>Does SubSonic.SqlQuery have a between/and for date ranges? If not, what would be the best way to get a range.</p>
| [
{
"answer_id": 165234,
"author": "Forgotten Semicolon",
"author_id": 1960,
"author_profile": "https://Stackoverflow.com/users/1960",
"pm_score": 3,
"selected": true,
"text": "<p>Try something like this:</p>\n\n<pre><code>SqlQuery query = new SqlQuery().From(\"Table\")\n ... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165140",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13954/"
] | Does SubSonic.SqlQuery have a between/and for date ranges? If not, what would be the best way to get a range. | Try something like this:
```
SqlQuery query = new SqlQuery().From("Table")
.WhereExpression("Column")
.IsBetweenAnd("1/1/2008", "12/31/2008");
DataSet dataSet = query.ExecuteDataSet(); // Or whatever output you need
``` |
165,170 | <p>I want to display dates in the format: short day of week, short month, day of month without leading zero but including "th", "st", "nd", or "rd" suffix.</p>
<p>For example, the day this question was asked would display "Thu Oct 2nd".</p>
<p>I'm using Ruby 1.8.7, and <a href="http://ruby-doc.org/core/Time.html#meth... | [
{
"answer_id": 165202,
"author": "mwilliams",
"author_id": 23909,
"author_profile": "https://Stackoverflow.com/users/23909",
"pm_score": 7,
"selected": false,
"text": "<p>You can use active_support's ordinalize helper method on numbers. </p>\n\n<pre><code>>> 3.ordinalize\n=> \"3... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12887/"
] | I want to display dates in the format: short day of week, short month, day of month without leading zero but including "th", "st", "nd", or "rd" suffix.
For example, the day this question was asked would display "Thu Oct 2nd".
I'm using Ruby 1.8.7, and [Time.strftime](http://ruby-doc.org/core/Time.html#method-i-strft... | Use the ordinalize method from 'active\_support'.
```
>> time = Time.new
=> Fri Oct 03 01:24:48 +0100 2008
>> time.strftime("%a %b #{time.day.ordinalize}")
=> "Fri Oct 3rd"
```
Note, if you are using IRB with Ruby 2.0, you must first run:
```
require 'active_support/core_ext/integer/inflections'
``` |
165,175 | <p>I'm failing to understand exactly what the IF statement is doing, from what I can see it is checking if the variable <code>x</code> is equal to the int <code>0</code>. If this is <code>true</code> the ABSOLUTE value of the variable <code>y</code> is returned... this is when I lose the plot, why would the return stat... | [
{
"answer_id": 165180,
"author": "Airsource Ltd",
"author_id": 18017,
"author_profile": "https://Stackoverflow.com/users/18017",
"pm_score": 3,
"selected": false,
"text": "<p>It returns true if the absolute value of y is <= EPSILON, and false otherwise. The <= is evaluated before t... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm failing to understand exactly what the IF statement is doing, from what I can see it is checking if the variable `x` is equal to the int `0`. If this is `true` the ABSOLUTE value of the variable `y` is returned... this is when I lose the plot, why would the return statement then go on to include `<= ESPILON`? Surel... | Floating-point math is by its nature inaccurate, so rather than testing for equivalence (which is always a bad idea), instead the developer has chosen a small number (1x10^-14 in this case) as the acceptable tolerance for proximity to zero. The return statement returns a comparison, so what this will do is take the abs... |
165,188 | <p>I have some c(++) code that uses sprintf to convert a uint_64 to a string. This needs to be portable to both linux and Solaris.</p>
<p>On linux we use %ju, but there does not appear to be any equivalent on Solaris. The closest I can find is %lu, but this produces incorrect output. Some sample code:</p>
<pre><co... | [
{
"answer_id": 165199,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 0,
"selected": false,
"text": "<p>You can use <code>%llu</code> for long long. However, this is not very portable either, because <code>long long</code> is... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16977/"
] | I have some c(++) code that uses sprintf to convert a uint\_64 to a string. This needs to be portable to both linux and Solaris.
On linux we use %ju, but there does not appear to be any equivalent on Solaris. The closest I can find is %lu, but this produces incorrect output. Some sample code:
```
#include <stdio.h>
#... | If you have have inttypes.h available you can use the macros it provides:
```
printf( "%" PRIu64 "\n", val);
```
Not pretty (I seem to be saying that a lot recently), but it works. |
165,212 | <p>How can I check the umask of a program which is currently running?</p>
<p>[update: another process, not the current process.]</p>
| [
{
"answer_id": 165305,
"author": "Josh",
"author_id": 257,
"author_profile": "https://Stackoverflow.com/users/257",
"pm_score": 2,
"selected": false,
"text": "<p>If you're the current process, you can write a file to /tmp and check its setting. A better solution is to call umask(3) pass... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116/"
] | How can I check the umask of a program which is currently running?
[update: another process, not the current process.] | You can attach gdb to a running process and then call umask in the debugger:
```
(gdb) attach <your pid>
...
(gdb) call umask(0)
[Switching to Thread -1217489200 (LWP 11037)]
$1 = 18 # this is the umask
(gdb) call umask(18) # reset umask
$2 = 0
(gdb)
```
(note: 18 corresponds to a umask of `O22` in this example)
T... |
165,231 | <p>Although I played with it before, I'm finally starting to use <a href="http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard" rel="noreferrer">Dvorak (Simplified)</a> regularly. I've been in a steady relationship with Vim for several years now, and I'm trying to figure out the best way to remap the key bindings to... | [
{
"answer_id": 165252,
"author": "Adam Davis",
"author_id": 2915,
"author_profile": "https://Stackoverflow.com/users/2915",
"pm_score": 6,
"selected": true,
"text": "<p>I use one of the more <a href=\"http://vim.wikia.com/wiki/Change_cursor_movement_keys_for_Dvorak_layout\" rel=\"norefer... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3594/"
] | Although I played with it before, I'm finally starting to use [Dvorak (Simplified)](http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard) regularly. I've been in a steady relationship with Vim for several years now, and I'm trying to figure out the best way to remap the key bindings to suit my newfound Dvorak skills... | I use one of the more [common recommended keybindings](http://vim.wikia.com/wiki/Change_cursor_movement_keys_for_Dvorak_layout):
```
Dvorak it!
no d h
no h j
no t k
no n l
no s :
no S :
no j d
no l n
no L N
Added benefits
no - $
no _ ^
no N <C-w><C-w>
no T <C-w><C-r>
no H 8<Down>
no T 8<Up>
no D <C-w><C-r>
```
Movem... |
165,253 | <p>If I load the nextimg URL manually in the browser, it gives a new picture every time I reload. But this bit of code shows the same image every iteration of <code>draw()</code>.</p>
<p>How can I force myimg not to be cached?</p>
<pre><code><html>
<head>
<script type="text/javascript">
... | [
{
"answer_id": 165256,
"author": "Dan",
"author_id": 17121,
"author_profile": "https://Stackoverflow.com/users/17121",
"pm_score": 5,
"selected": false,
"text": "<p>The easiest way is to sling an ever-changing querystring onto the end:</p>\n\n<pre><code>var url = 'http://.../?' + escape(... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116/"
] | If I load the nextimg URL manually in the browser, it gives a new picture every time I reload. But this bit of code shows the same image every iteration of `draw()`.
How can I force myimg not to be cached?
```
<html>
<head>
<script type="text/javascript">
function draw(){
var canvas = document.get... | That actually sounds like a bug in the browser -- you could file at <http://bugs.webkit.org> if it's in Safari or <https://bugzilla.mozilla.org/> for Firefox. Why do i say potential browser bug? Because the browser realises it should not be caching on reload, yet it does give you a cached copy of the image when you req... |
165,346 | <p>I've been working on porting some of my Processing code over to regular Java in NetBeans. So far so well, most everything works great, except for when I go to use non-grayscale colors. </p>
<p>I have a script that draws a spiral pattern, and should vary the colors in the spiral based on a modulus check. The script ... | [
{
"answer_id": 170069,
"author": "extraneon",
"author_id": 24582,
"author_profile": "https://Stackoverflow.com/users/24582",
"pm_score": 3,
"selected": true,
"text": "<p>Have you considered adding debugging statements (System.out.println) and looking at the Java Console?</p>\n\n<p>There ... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13293/"
] | I've been working on porting some of my Processing code over to regular Java in NetBeans. So far so well, most everything works great, except for when I go to use non-grayscale colors.
I have a script that draws a spiral pattern, and should vary the colors in the spiral based on a modulus check. The script seems to h... | Have you considered adding debugging statements (System.out.println) and looking at the Java Console?
There may be a massive amount of output and definitive slowdown, but you can at least see what happens when nothing seems to happen.
What I do think is a logic error is the filling if statement; every iteratation you... |
165,355 | <p>I'm trying to produce just the day number in a WPF text block, without leading zeroes and without extra space padding (which throws off the layout). The first produces the day number with a space, the second produces the entire date. According to the <a href="http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx" re... | [
{
"answer_id": 165374,
"author": "Robert Paulson",
"author_id": 14033,
"author_profile": "https://Stackoverflow.com/users/14033",
"pm_score": 4,
"selected": true,
"text": "<p>See <a href=\"http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx\" rel=\"nofoll... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18482/"
] | I'm trying to produce just the day number in a WPF text block, without leading zeroes and without extra space padding (which throws off the layout). The first produces the day number with a space, the second produces the entire date. According to the [docs](http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx), 'd' sh... | See [here](http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx)
>
> d, %d
>
>
> The day of the month. Single-digit days do not have a leading zero. The application specifies "%d" if the format pattern is not combined with other format patterns.
>
>
>
Otherwise d is interpreted a... |
165,365 | <p>I am having fickle of problem in Oracle 9i</p>
<p>select 1"FirstColumn" from dual;</p>
<p>Oracle throwing error while executing above query. ORA-03001: unimplemented feature in my Production server.</p>
<p>The Same query is working fine in my Validation server. Both servers are with Oracle 9i</p>
<p>Any one have... | [
{
"answer_id": 165414,
"author": "Justin Cave",
"author_id": 10397,
"author_profile": "https://Stackoverflow.com/users/10397",
"pm_score": 1,
"selected": false,
"text": "<p>What is the full Oracle version on both servers? 9i is a marketing label-- are you comparing a 9.0.1.x database to... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am having fickle of problem in Oracle 9i
select 1"FirstColumn" from dual;
Oracle throwing error while executing above query. ORA-03001: unimplemented feature in my Production server.
The Same query is working fine in my Validation server. Both servers are with Oracle 9i
Any one have Idea what's wrong...? Is this ... | Try:
```
SELECT 1 AS "'FirstColumn'" FROM dual;
```
There is a similar question:
[Double Quotes in Oracle Column Aliases](https://stackoverflow.com/questions/56591/double-quotes-in-oracle-column-aliases) |
165,386 | <p>I have just started using Boost 1.36. These libraries would be very useful in reducing the amount of code needed in the unmanaged C++ software project that I am working on.</p>
<p>However when I tried to used these libraries my compile times increased ten fold. This would pretty much offset the productivity gains I... | [
{
"answer_id": 165391,
"author": "David Dibben",
"author_id": 5022,
"author_profile": "https://Stackoverflow.com/users/5022",
"pm_score": 4,
"selected": true,
"text": "<p>Have you tried using precompiled headers? That is including the boost headers in StdAfx.h or whatever header file you... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5398/"
] | I have just started using Boost 1.36. These libraries would be very useful in reducing the amount of code needed in the unmanaged C++ software project that I am working on.
However when I tried to used these libraries my compile times increased ten fold. This would pretty much offset the productivity gains I would rec... | Have you tried using precompiled headers? That is including the boost headers in StdAfx.h or whatever header file you use for precompiled headers? |
165,401 | <p>I'm looking for a way to validate the SQL schema on a production DB after updating an application version. If the application does not match the DB schema version, there should be a way to warn the user and list the changes needed.</p>
<p>Is there a tool or a framework (to use programatically) with built-in feature... | [
{
"answer_id": 165411,
"author": "Dan",
"author_id": 17121,
"author_profile": "https://Stackoverflow.com/users/17121",
"pm_score": 0,
"selected": false,
"text": "<p>Make a table and store your version number in there. Just make sure you update it as necessary. </p>\n\n<pre><code>CREATE T... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165401",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1363/"
] | I'm looking for a way to validate the SQL schema on a production DB after updating an application version. If the application does not match the DB schema version, there should be a way to warn the user and list the changes needed.
Is there a tool or a framework (to use programatically) with built-in features to do th... | Try this SQL.
- Run it against each database.
- Save the output to text files.
- Diff the text files.
```
/* get list of objects in the database */
SELECT name,
type
FROM sysobjects
ORDER BY type, name
/* get list of columns in each table / parameters for each stored procedure */
SELECT so.name,
... |
165,402 | <p>I need help on this following aspx code</p>
<p>aspx Code:</p>
<pre><code><asp:Label ID ="lblName" runat ="server" Text ="Name"></asp:Label>
<asp:TextBox ID ="txtName" runat ="server"></asp:TextBox>
</code></pre>
<p>Consider this is my aspx page content. I am going to populate the values fo... | [
{
"answer_id": 165409,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 3,
"selected": true,
"text": "<p>If you take the <strong><code>runat='server'</code></strong> out of the <code><label></code> element then it won... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22162/"
] | I need help on this following aspx code
aspx Code:
```
<asp:Label ID ="lblName" runat ="server" Text ="Name"></asp:Label>
<asp:TextBox ID ="txtName" runat ="server"></asp:TextBox>
```
Consider this is my aspx page content. I am going to populate the values for the TextBox only after the postback from server. But th... | If you take the **`runat='server'`** out of the `<label>` element then it won't be parsed as a server control. If you're not going to do anything with *`lblNames`* from the server then it is perfectly okay to leave it out. |
165,424 | <p>I have a ListBox which until recently was displaying a flat list of items. I was able to use myList.ItemContainerGenerator.ConainerFromItem(thing) to retrieve the ListBoxItem hosting "thing" in the list.</p>
<p>This week I've modified the ListBox slightly in that the CollectionViewSource that it binds to for its it... | [
{
"answer_id": 165431,
"author": "Jobi Joy",
"author_id": 8091,
"author_profile": "https://Stackoverflow.com/users/8091",
"pm_score": 0,
"selected": false,
"text": "<p>Try parsing the VisualTree up from the 'thing' until you reach a ListBoxItem type</p>\n"
},
{
"answer_id": 16912... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/615/"
] | I have a ListBox which until recently was displaying a flat list of items. I was able to use myList.ItemContainerGenerator.ConainerFromItem(thing) to retrieve the ListBoxItem hosting "thing" in the list.
This week I've modified the ListBox slightly in that the CollectionViewSource that it binds to for its items has gr... | You **have** to listen and react to the `ItemsGenerator.StatusChanged` Event and wait until the ItemContainers are generated before you can access them with ContainerFromElement.
---
Searching further, I've found [a thread in the MSDN forum](http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/8be8307b-83dd-4658-... |
165,443 | <p>I have a "span" element inside a "table" "td" element. The span tag has a Title.</p>
<p>I want to get the title of that span tag and pull it out to make it the "mouseover" tip for the "td" element.</p>
<p>For example:</p>
<p>I want to turn this:</p>
<pre><code><td>
<a href="#"><span id="test"... | [
{
"answer_id": 165449,
"author": "John Boker",
"author_id": 2847,
"author_profile": "https://Stackoverflow.com/users/2847",
"pm_score": 1,
"selected": false,
"text": "<p>something like:</p>\n\n<pre><code>$(\"span#test\").mouseover( function () {\n tip($(this).attr(\"title\"));\n}\n</co... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7644/"
] | I have a "span" element inside a "table" "td" element. The span tag has a Title.
I want to get the title of that span tag and pull it out to make it the "mouseover" tip for the "td" element.
For example:
I want to turn this:
```
<td>
<a href="#"><span id="test" title="Acres for each province">Acres</span></a>
<... | Based on your edit, you might check out jQuery's DOM traversal methods: <http://docs.jquery.com/Traversing>
Something along these lines (not tested, I don't claim it's syntactically correct, just general ideas here)...
```
$("td").each(function()
{
$(this).mouseover(function()
{
tip($(this).children("... |
165,445 | <p>I have a function that includes a file based on the string that gets passed to it i.e. the action variable from the query string. I use this for filtering purposes etc so people can't include files they shouldn't be able to and if the file doesn't exist a default file is loaded instead.
The problem is that when the... | [
{
"answer_id": 165448,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 3,
"selected": false,
"text": "<p><strong>Edit:</strong> Okay, I've re-read your question and I think I get what you're talking about now:<br>\nyou want some... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11753/"
] | I have a function that includes a file based on the string that gets passed to it i.e. the action variable from the query string. I use this for filtering purposes etc so people can't include files they shouldn't be able to and if the file doesn't exist a default file is loaded instead.
The problem is that when the fu... | **Edit:** Okay, I've re-read your question and I think I get what you're talking about now:
you want something like this to work:
```
// myInclude.php
$x = "abc";
// -----------------------
// myRegularFile.php
function doInclude() {
include 'myInclude.php';
}
$x = "A default value";
doInclude();
echo $x; ... |
165,455 | <p>Just wondering why people like case sensitivity in a programming language? I'm not trying to start a flame war just curious thats all.<br>
Personally I have never really liked it because I find my productivity goes down when ever I have tried a language that has case sensitivity, mind you I am slowly warming up/gett... | [
{
"answer_id": 165459,
"author": "Keng",
"author_id": 730,
"author_profile": "https://Stackoverflow.com/users/730",
"pm_score": 1,
"selected": false,
"text": "<p>It gives you more options.</p>\n\n<p>Bell\nbell\nBEll</p>\n\n<p>are all different.</p>\n\n<p>Besides, it drives the newbies th... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6335/"
] | Just wondering why people like case sensitivity in a programming language? I'm not trying to start a flame war just curious thats all.
Personally I have never really liked it because I find my productivity goes down when ever I have tried a language that has case sensitivity, mind you I am slowly warming up/getting ... | Consistency. Code is more difficult to read if "foo", "Foo", "fOO", and "fOo" are considered to be identical.
SOME PEOPLE WOULD WRITE EVERYTHING IN ALL CAPS, MAKING EVERYTHING LESS READABLE.
Case sensitivity makes it easy to use the "same name" in different ways, according to a capitalization convention, e.g.,
```
F... |
165,458 | <p>Which is the most correct code?</p>
<pre><code>if (HttpContext.Current.Response.Cookies[authCookieName] != null) {
HttpContext.Current.Response.Cookies[authCookieName].Value = "New Value";
}
</code></pre>
<p>or </p>
<pre><code>if (HttpContext.Current != null)
if (HttpContext.Current.Response != null)
... | [
{
"answer_id": 165462,
"author": "yfeldblum",
"author_id": 12349,
"author_profile": "https://Stackoverflow.com/users/12349",
"pm_score": 5,
"selected": true,
"text": "<p>If any one of HttpContext, HttpContext.Current, HttpContext.Current.Response, or Http.Current.Response.Cookies is null... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24395/"
] | Which is the most correct code?
```
if (HttpContext.Current.Response.Cookies[authCookieName] != null) {
HttpContext.Current.Response.Cookies[authCookieName].Value = "New Value";
}
```
or
```
if (HttpContext.Current != null)
if (HttpContext.Current.Response != null)
if (HttpContext.Current.Response.... | If any one of HttpContext, HttpContext.Current, HttpContext.Current.Response, or Http.Current.Response.Cookies is null, you're already in trouble. Let the exception happen and fix your web server. |
165,466 | <p>I think this is best asked in the form of a simple example. The following chunk of SQL causes a <em>"DB-Library Error:20049 Severity:4 Message:Data-conversion resulted in overflow"</em> message, but how come? </p>
<pre><code>declare @a numeric(18,6), @b numeric(18,6), @c numeric(18,6)
select @a = 1.000000, @b = 1.... | [
{
"answer_id": 168490,
"author": "Patrick Szalapski",
"author_id": 7453,
"author_profile": "https://Stackoverflow.com/users/7453",
"pm_score": 1,
"selected": false,
"text": "<p>This is just speculation, but could it be that the DBMS doesn't look at the dynamic value of your variables but... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1030/"
] | I think this is best asked in the form of a simple example. The following chunk of SQL causes a *"DB-Library Error:20049 Severity:4 Message:Data-conversion resulted in overflow"* message, but how come?
```
declare @a numeric(18,6), @b numeric(18,6), @c numeric(18,6)
select @a = 1.000000, @b = 1.000000, @c = 1.000000
... | I ran into the same problem the last time I tried to use Sybase (many years ago). Coming from a SQL Server mindset, I didn't realize that Sybase would attempt to coerce the decimals out -- which, mathematically, is what it **should** do. :)
From the [Sybase manual](http://manuals.sybase.com/onlinebooks/group-as/asg125... |
165,488 | <p>I am trying to install the starling gem on my Windows machine. But, whenever I try to install it I get this error:</p>
<pre><code>Building native extensions. This could take a while...
ERROR: Error installing starling:
ERROR: Failed to build gem native extension.
c:/ruby/bin/ruby.exe extconf.rb in... | [
{
"answer_id": 165721,
"author": "user6325",
"author_id": 6325,
"author_profile": "https://Stackoverflow.com/users/6325",
"pm_score": 0,
"selected": false,
"text": "<p>The install seems to be stuck on installing the eventmachine gem.\nThe easiest approach here may be to download and inst... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5004/"
] | I am trying to install the starling gem on my Windows machine. But, whenever I try to install it I get this error:
```
Building native extensions. This could take a while...
ERROR: Error installing starling:
ERROR: Failed to build gem native extension.
c:/ruby/bin/ruby.exe extconf.rb install starling ... | Gems is [somewhat broken](https://stackoverflow.com/questions/134581/gem-update-on-windows-is-it-broken) on Windows at present was at the time broken on Windows, but it's fixed now. The following workaround applies to the old One-Click Installer version of Ruby; you should really update to the new MinGW-based [RubyInst... |
165,495 | <p>How can I detect mouse clicks regardless of the window the mouse is in?</p>
<p>Perferabliy in python, but if someone can explain it in any langauge I might be able to figure it out.</p>
<p>I found this on microsoft's site:
<a href="http://msdn.microsoft.com/en-us/library/ms645533(VS.85).aspx" rel="noreferrer">http... | [
{
"answer_id": 166054,
"author": "Zebra North",
"author_id": 17440,
"author_profile": "https://Stackoverflow.com/users/17440",
"pm_score": 2,
"selected": false,
"text": "<p>The windows way of doing it is to handle the <code>WM_LBUTTONDBLCLK</code> message. </p>\n\n<p>For this to be sent... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165495",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24718/"
] | How can I detect mouse clicks regardless of the window the mouse is in?
Perferabliy in python, but if someone can explain it in any langauge I might be able to figure it out.
I found this on microsoft's site:
<http://msdn.microsoft.com/en-us/library/ms645533(VS.85).aspx>
But I don't see how I can detect or pick up t... | The only way to detect mouse events outside your program is to install a Windows hook using [SetWindowsHookEx](http://msdn.microsoft.com/en-us/library/ms644990(VS.85).aspx). The [pyHook](http://www.cs.unc.edu/Research/assist/developer.shtml) module encapsulates the nitty-gritty details. Here's a sample that will print ... |
165,551 | <p>I would like to know if there is an easy way to detect if the text on the clipboard is in ISO 8859 or UTF-8 ?</p>
<p>Here is my current code:</p>
<pre><code> COleDataObject obj;
if (obj.AttachClipboard())
{
if (obj.IsDataAvailable(CF_TEXT))
{
HGLOBAL hmem = obj.GetGlobalDat... | [
{
"answer_id": 165568,
"author": "Adam Davis",
"author_id": 2915,
"author_profile": "https://Stackoverflow.com/users/2915",
"pm_score": 0,
"selected": false,
"text": "<p>You could check to see obj.IsDataAvailable(CF_UNICODETEXT) to see if a unicode version of what's on the clipboard is a... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13676/"
] | I would like to know if there is an easy way to detect if the text on the clipboard is in ISO 8859 or UTF-8 ?
Here is my current code:
```
COleDataObject obj;
if (obj.AttachClipboard())
{
if (obj.IsDataAvailable(CF_TEXT))
{
HGLOBAL hmem = obj.GetGlobalData(CF_TEXT);
... | Check out the definition of CF\_LOCALE at [this Microsoft page](http://msdn.microsoft.com/en-us/library/ms649013(VS.85).aspx). It tells you the locale of the text in the clipboard. Better yet, if you use CF\_UNICODETEXT instead, Windows will convert to UTF-16 for you. |
165,571 | <p>I have a list of times in a database column (representing visits to a website).</p>
<p>I need to group them in intervals and then get a 'cumulative frequency' table of those dates.</p>
<p>For instance I might have:</p>
<pre><code>9:01
9:04
9:11
9:13
9:22
9:24
9:28
</code></pre>
<p>and i want to convert that into... | [
{
"answer_id": 165610,
"author": "ephemient",
"author_id": 20713,
"author_profile": "https://Stackoverflow.com/users/20713",
"pm_score": 1,
"selected": false,
"text": "<p>Create a table <code>periods</code> describing the periods you wish to divide the day up into.</p>\n\n<pre><code>SELE... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24727/"
] | I have a list of times in a database column (representing visits to a website).
I need to group them in intervals and then get a 'cumulative frequency' table of those dates.
For instance I might have:
```
9:01
9:04
9:11
9:13
9:22
9:24
9:28
```
and i want to convert that into
```
9:05 - 2
9:15 - 4
9:25 - 6
9:30 - ... | ```
create table accu_times (time_val datetime not null, constraint pk_accu_times primary key (time_val));
go
insert into accu_times values ('9:01');
insert into accu_times values ('9:05');
insert into accu_times values ('9:11');
insert into accu_times values ('9:13');
insert into accu_times values ('9:22');
insert in... |
165,575 | <p>I have the simple class using auto-implemented properies: </p>
<pre><code>Public Class foo
{
public foo() { }
public string BarName {get; set;}
}
</code></pre>
<p>I obviously use the variable BarName throughout my class and now need to add logic when the property value is set (it must be all upper case... | [
{
"answer_id": 165581,
"author": "Seth Petry-Johnson",
"author_id": 23632,
"author_profile": "https://Stackoverflow.com/users/23632",
"pm_score": 3,
"selected": false,
"text": "<p>You don't need to change anything. Auto-implemented properties are just syntactic sugar. The compiler is gen... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5836/"
] | I have the simple class using auto-implemented properies:
```
Public Class foo
{
public foo() { }
public string BarName {get; set;}
}
```
I obviously use the variable BarName throughout my class and now need to add logic when the property value is set (it must be all upper case, go figure). Does this mea... | >
> Does this mean that I need to now
> create a private variable for BarName
>
>
>
Yes
>
> and change the current BarName
> variable used throughout my class
>
>
>
Do not change the rest of the code in your class to use the new private variable you create. *BarName*, as a property, is intended to hide the... |
165,595 | <p>I have a Flex app that does a a fair amount of network traffic, it uses ExternalInterface to make some javascript calls (for SCORM), it loads XML files, images, video, audio and it has a series of modules that it could be loading at some point...</p>
<p>So the problem is - we now have a requirement where the user n... | [
{
"answer_id": 165680,
"author": "jdecuyper",
"author_id": 296,
"author_profile": "https://Stackoverflow.com/users/296",
"pm_score": -1,
"selected": false,
"text": "<p>Did you try to specify the authorized domain with:</p>\n\n<pre><code>System.security.allowDomain(\"www.yourdomain.com\")... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3435/"
] | I have a Flex app that does a a fair amount of network traffic, it uses ExternalInterface to make some javascript calls (for SCORM), it loads XML files, images, video, audio and it has a series of modules that it could be loading at some point...
So the problem is - we now have a requirement where the user needs to ru... | What you are trying to do is exactly the problem solved by AIR. You should really give it a try, it's not that hard to pick up. If you really really can't use AIR (you didn't specify why, so I assume it's just because you don't want to have to learn a new system), then modifying the security config file will solve the ... |
165,603 | <p>I was wondering if there was a way to get at the raw HTTP request data in PHP running on apache that doesn't involve using any additional extensions. I've seen the <a href="http://au2.php.net/http" rel="noreferrer">HTTP</a> functions in the manual, but I don't have the option of installing an extension in my environ... | [
{
"answer_id": 165623,
"author": "Owen",
"author_id": 4853,
"author_profile": "https://Stackoverflow.com/users/4853",
"pm_score": 4,
"selected": true,
"text": "<p>Do you mean the information contained in <code>$_SERVER</code>?</p>\n\n<pre><code>print_r($_SERVER);\n</code></pre>\n\n<p>Edi... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15004/"
] | I was wondering if there was a way to get at the raw HTTP request data in PHP running on apache that doesn't involve using any additional extensions. I've seen the [HTTP](http://au2.php.net/http) functions in the manual, but I don't have the option of installing an extension in my environment.
While I can access the i... | Do you mean the information contained in `$_SERVER`?
```
print_r($_SERVER);
```
Edit:
Would this do then?
```
foreach(getallheaders() as $key=>$value) {
print $key.': '.$value."<br />";
}
``` |
165,650 | <p>I need to add a tooltip/alt to a "td" element inside of my tables with jquery.</p>
<p>Can someone help me out?</p>
<p>I tried:</p>
<pre><code>var tTip ="Hello world";
$(this).attr("onmouseover", tip(tTip));
</code></pre>
<p>where I have verified that I am using the "td" as "this".</p>
<p>**Edit:**I am able to c... | [
{
"answer_id": 165651,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 5,
"selected": false,
"text": "<pre><code>$(this).mouseover(function() {\n tip(tTip);\n});\n</code></pre>\n\n<p>a better way might be to put <code>title</... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7644/"
] | I need to add a tooltip/alt to a "td" element inside of my tables with jquery.
Can someone help me out?
I tried:
```
var tTip ="Hello world";
$(this).attr("onmouseover", tip(tTip));
```
where I have verified that I am using the "td" as "this".
\*\*Edit:\*\*I am able to capture the "td" element through using the "... | you might want to have a look at <http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/> |
165,713 | <p>I need a function to return a suffix for days when displaying text like the "<code>th</code>" in "<code>Wednesday June 5th, 2008</code>".</p>
<p>It only need work for the numbers 1 through 31 (no error checking required) and English.</p>
| [
{
"answer_id": 165714,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 3,
"selected": false,
"text": "<p>The following function works for C:</p>\n\n<pre><code>char *makeDaySuffix (unsigned int day) {\n //if ((day < 1... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14860/"
] | I need a function to return a suffix for days when displaying text like the "`th`" in "`Wednesday June 5th, 2008`".
It only need work for the numbers 1 through 31 (no error checking required) and English. | Here is an alternative which should work for larger numbers too:
```
static const char *daySuffixLookup[] = { "th","st","nd","rd","th",
"th","th","th","th","th" };
const char *daySuffix(int n)
{
if(n % 100 >= 11 && n % 100 <= 13)
return "th";
return daySuffixLookup[n % 10];... |
165,723 | <p>I've noticed RAII has been getting lots of attention on Stackoverflow, but in my circles (mostly C++) RAII is so obvious its like asking what's a class or a destructor.</p>
<p>So I'm really curious if that's because I'm surrounded daily, by hard-core C++ programmers, and RAII just isn't that well known in general (... | [
{
"answer_id": 165731,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>It's sort of tied to knowing when your destructor will be called though right? So it's not entirely language-agnostic, give... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15124/"
] | I've noticed RAII has been getting lots of attention on Stackoverflow, but in my circles (mostly C++) RAII is so obvious its like asking what's a class or a destructor.
So I'm really curious if that's because I'm surrounded daily, by hard-core C++ programmers, and RAII just isn't that well known in general (including ... | For people who are commenting in this thread about RAII (resource acquisition is initialisation), here's a motivational example.
```
class StdioFile {
FILE* file_;
std::string mode_;
static FILE* fcheck(FILE* stream) {
if (!stream)
throw std::runtime_error("Cannot open file");
... |
165,729 | <p>The <code>end()</code> function in jQuery reverts the element set back to what it was before the last destructive change, so I can see how it's supposed to be used, but I've seen some code examples, eg: <a href="http://alistapart.com/articles/prettyaccessibleforms" rel="nofollow noreferrer">on alistapart</a> <em>(wh... | [
{
"answer_id": 165748,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 3,
"selected": false,
"text": "<p>That <code>end()</code> doesn't do anything. There's no point to coding like that. It will return <code>$('#myBox')... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | The `end()` function in jQuery reverts the element set back to what it was before the last destructive change, so I can see how it's supposed to be used, but I've seen some code examples, eg: [on alistapart](http://alistapart.com/articles/prettyaccessibleforms) *(which were probably from older versions of jQuery - the ... | That `end()` doesn't do anything. There's no point to coding like that. It will return `$('#myBox')` -- the example is pretty poor. More interesting is something like this:
```
$('#myBox').show ().children ('.myClass').hide ().end ().blink ();
```
Which will show `myBox`, hide the specified children, and then blink ... |
165,751 | <p>Let's just assume for now that you have narrowed down where the typical bottlenecks in your app are. For all you know, it might be the batch process you run to reindex your tables; it could be the SQL queries that runs over your effective-dated trees; it could be the XML marshalling of a few hundred composite object... | [
{
"answer_id": 165755,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 2,
"selected": false,
"text": "<ol>\n<li>Profile it</li>\n<li>Find the top line in the profiler, attempt to make it faster.</li>\n<li>Profile it</li>... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17205/"
] | Let's just assume for now that you have narrowed down where the typical bottlenecks in your app are. For all you know, it might be the batch process you run to reindex your tables; it could be the SQL queries that runs over your effective-dated trees; it could be the XML marshalling of a few hundred composite objects. ... | Two points:
1. Beware of the infamous "optimizing the idle loop" problem. (E.g. see the [optimization story](http://c2.com/cgi/wiki/wiki?OptimizationStories) under the heading "Porsche-in-the-parking-lot".) That is, just because a routine is taking a significant amount of time (as shown by your profiling), don't assum... |
165,783 | <p>It seems pretty common to want to let your javascript know a particular dom node corresponds to a record in the database. So, how do you do it?</p>
<p>One way I've seen that's pretty common is to use a class for the type and an id for the id:</p>
<pre><code><div class="thing" id="5">
<script> myThing ... | [
{
"answer_id": 165787,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 4,
"selected": false,
"text": "<pre><code><div class=\"thing\" id=\"myapp-thing-5\"/>\n\n// Get thing on the page for a particular ID\nvar myTh... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2653/"
] | It seems pretty common to want to let your javascript know a particular dom node corresponds to a record in the database. So, how do you do it?
One way I've seen that's pretty common is to use a class for the type and an id for the id:
```
<div class="thing" id="5">
<script> myThing = select(".thing#5") </script>
``... | Note that an ID cannot start with a digit, so:
```
<div class="thing" id="5">
```
is invalid HTML. See [What are valid values for the id attribute in HTML?](https://stackoverflow.com/questions/70579/what-is-a-valid-value-for-id-attributes-in-html#70586)
In your case, I would use ID's like `thing5` or `thing.5`. |
165,808 | <p>I'm looking for very simple obfuscation (like encrypt and decrypt but not necessarily secure) functionality for some data. It's not mission critical. I need something to keep honest people honest, but something a little stronger than <a href="http://en.wikipedia.org/wiki/ROT13" rel="noreferrer">ROT13</a> or <a href=... | [
{
"answer_id": 165826,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 1,
"selected": false,
"text": "<p>The namespace <code>System.Security.Cryptography</code> contains the <code>TripleDESCryptoServiceProvider</code> an... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232/"
] | I'm looking for very simple obfuscation (like encrypt and decrypt but not necessarily secure) functionality for some data. It's not mission critical. I need something to keep honest people honest, but something a little stronger than [ROT13](http://en.wikipedia.org/wiki/ROT13) or [Base64](http://en.wikipedia.org/wiki/B... | Other answers here work fine, but AES is a more secure and up-to-date encryption algorithm. This is a class that I obtained a few years ago to perform AES encryption that I have modified over time to be more friendly for web applications (e,g. I've built Encrypt/Decrypt methods that work with URL-friendly string). It a... |
165,828 | <p>I need to queue events and tasks for external systems in a reliable/transactional way. Using things like MSMQ or ActiveMQ look very seductive, but the transactional part becomes complicated (MSDTC, etc).</p>
<p>We could use the database (SQL Server 2005+, Oracle 9+) and achieve easier transactional support, but th... | [
{
"answer_id": 165835,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 1,
"selected": false,
"text": "<p><a href=\"http://quartznet.sourceforge.net/\" rel=\"nofollow noreferrer\">Quartz.Net</a> is an open source job sche... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10862/"
] | I need to queue events and tasks for external systems in a reliable/transactional way. Using things like MSMQ or ActiveMQ look very seductive, but the transactional part becomes complicated (MSDTC, etc).
We could use the database (SQL Server 2005+, Oracle 9+) and achieve easier transactional support, but the queuing p... | our system has 60 computers, each running 12 tasks (threads) which need to "get next job". All in all, it comes to 50K "jobs" per day. do the math of how many transactions per minute and realize task time is variable, so it is possible to get multiple "pop" events at the exact same time.
We had our first version using... |
165,866 | <p>I have Apache 2 running on a VPS server (running Debian). I recently changed the timezone on the server (using dpkg-reconfigure tzdata) from America/New_York to America/Los_Angeles to match my move across country. I have also rebooted the virtual machine since making the change.</p>
<p>However, the Apache process... | [
{
"answer_id": 165879,
"author": "nobody",
"author_id": 19405,
"author_profile": "https://Stackoverflow.com/users/19405",
"pm_score": 0,
"selected": false,
"text": "<p>Possibly some of the Apache worker processes were started before you changes the timezone, and some afterwards. Have you... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8265/"
] | I have Apache 2 running on a VPS server (running Debian). I recently changed the timezone on the server (using dpkg-reconfigure tzdata) from America/New\_York to America/Los\_Angeles to match my move across country. I have also rebooted the virtual machine since making the change.
However, the Apache processes seem to... | As it turns out, I had two Django projects running on this Apache instance, one of which I had fixed to point to America/Los\_Angeles, but the other I had left behind. Depending on which app was accessed first when a new Apache process was created, it would muck up the time zone! |
165,883 | <p>Suppose I have a class with some attributes. How is it best (in the Pythonic-OOP) sense to access these attributes ? Just like <code>obj.attr</code> ? Or perhaps write get accessors ?
What are the accepted naming styles for such things ?</p>
<p><strong>Edit:</strong>
Can you elaborate on the best-practices of nami... | [
{
"answer_id": 165892,
"author": "monkut",
"author_id": 24718,
"author_profile": "https://Stackoverflow.com/users/24718",
"pm_score": 2,
"selected": false,
"text": "<p>I think most just access them directly, no need for get/set methods.</p>\n\n<pre><code>>>> class myclass:\n... ... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165883",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8206/"
] | Suppose I have a class with some attributes. How is it best (in the Pythonic-OOP) sense to access these attributes ? Just like `obj.attr` ? Or perhaps write get accessors ?
What are the accepted naming styles for such things ?
**Edit:**
Can you elaborate on the best-practices of naming attributes with a single or dou... | The generally accepted way of doing things is just using simple attributes, like so
```
>>> class MyClass:
... myAttribute = 0
...
>>> c = MyClass()
>>> c.myAttribute
0
>>> c.myAttribute = 1
>>> c.myAttribute
1
```
If you do find yourself needing to be able to write getters and setters, then what you want to l... |
165,887 | <p>What's the easiest way to compute the amount of working days since a date? VB.NET preferred, but C# is okay.</p>
<p>And by "working days", I mean all days excluding Saturday and Sunday. If the algorithm can also take into account a list of specific 'exclusion' dates that shouldn't count as working days, that would ... | [
{
"answer_id": 165897,
"author": "Dave Neeley",
"author_id": 9660,
"author_profile": "https://Stackoverflow.com/users/9660",
"pm_score": 1,
"selected": false,
"text": "<p><a href=\"http://classicasp.aspfaq.com/date-time-routines-manipulation/how-do-i-count-the-number-of-business-days-bet... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17235/"
] | What's the easiest way to compute the amount of working days since a date? VB.NET preferred, but C# is okay.
And by "working days", I mean all days excluding Saturday and Sunday. If the algorithm can also take into account a list of specific 'exclusion' dates that shouldn't count as working days, that would be gravy. ... | This'll do what you want it to. It should be easy enough to convert to VB.NET, it's been too long for me to be able to do it though.
```
DateTime start = DateTime.Now;
DateTime end = start.AddDays(9);
IEnumerable<DateTime> holidays = new DateTime[0];
// basic data
int days = (int)(end - start).TotalDays;
int weeks = ... |
165,931 | <p>In a program I work on, I have a lot of code as follows:</p>
<pre><code>pthread_mutex_lock( &frame->mutex );
frame->variable = variable;
pthread_mutex_unlock( &frame->mutex );
</code></pre>
<p>This is clearly a waste of CPU cycles if the middle instruction can just be replaced with an atomic store... | [
{
"answer_id": 165948,
"author": "Mihai Limbășan",
"author_id": 14444,
"author_profile": "https://Stackoverflow.com/users/14444",
"pm_score": 4,
"selected": false,
"text": "<p>You could check the gcc documentation. For the current gcc version (4.3.2) it would be chapter 5.47 <a href=\"ht... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11206/"
] | In a program I work on, I have a lot of code as follows:
```
pthread_mutex_lock( &frame->mutex );
frame->variable = variable;
pthread_mutex_unlock( &frame->mutex );
```
This is clearly a waste of CPU cycles if the middle instruction can just be replaced with an atomic store. I know that gcc is quite capable of this,... | You could check the gcc documentation. For the current gcc version (4.3.2) it would be chapter 5.47 [Built-in functions for atomic memory access](http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Atomic-Builtins.html) - for other gcc versions please check your docs. It should be in chapter 5- Extensions to the C Language Fam... |
165,951 | <p>Say I have a third party Application that does background work, but prints out all errors and messages to the console. This means, that currently, we have to keep a user logged on to the server, and restart the application (double-click) every time we reboot.</p>
<p><em>Not so very cool.</em></p>
<p>I was kind of ... | [
{
"answer_id": 165955,
"author": "David Webb",
"author_id": 3171,
"author_profile": "https://Stackoverflow.com/users/3171",
"pm_score": 5,
"selected": true,
"text": "<p>Check out <a href=\"http://support.microsoft.com/kb/137890\" rel=\"noreferrer\"><code>srvany.exe</code></a> from the <a... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2260/"
] | Say I have a third party Application that does background work, but prints out all errors and messages to the console. This means, that currently, we have to keep a user logged on to the server, and restart the application (double-click) every time we reboot.
*Not so very cool.*
I was kind of sure, that there was an ... | Check out [`srvany.exe`](http://support.microsoft.com/kb/137890) from the [Resource Kit](http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en). This will let run anything as a service.
You can pass parameters in the service definition to your executable via `srva... |
165,987 | <p>My division has been tasked with recording the morning presentation audio for future use, using the built-in Windows Sound Recorder. Because of human nature, we don't always remember to start it on time. </p>
<p>Windows doesn't have a built-in equivalent to the Unix <strong>cron</strong> function. Besides installin... | [
{
"answer_id": 166000,
"author": "Treb",
"author_id": 22114,
"author_profile": "https://Stackoverflow.com/users/22114",
"pm_score": -1,
"selected": false,
"text": "<p>Start-Programs-Accessories-System Tools-Scheduled Tasks</p>\n"
},
{
"answer_id": 166147,
"author": "prakash",... | 2008/10/03 | [
"https://Stackoverflow.com/questions/165987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18676/"
] | My division has been tasked with recording the morning presentation audio for future use, using the built-in Windows Sound Recorder. Because of human nature, we don't always remember to start it on time.
Windows doesn't have a built-in equivalent to the Unix **cron** function. Besides installing a new software progra... | ```
set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep(100)
WshShell.Run "%SystemRoot%\system32\sndrec32.exe"
WScript.Sleep(100)
WshShell.AppActivate "Sound - Sound Recorder"
WScript.Sleep(100)
WshShell.SendKeys " "
WScript.Sleep(100)
```
Save the above text as RunSoundRecorder.vbs. This will star... |
166,004 | <p>I am facing a performance issue on a multi-core (8+) architecture with software written in C++ / VistualStudio / WindowsXP.</p>
<p>Suddenly I realized that I have no idea of the performances of my L1 and L2 cache and CPU->to->Memory bandwidth.</p>
<p>I have tested several tools (including VTune, Glowcode, etc, etc... | [
{
"answer_id": 166000,
"author": "Treb",
"author_id": 22114,
"author_profile": "https://Stackoverflow.com/users/22114",
"pm_score": -1,
"selected": false,
"text": "<p>Start-Programs-Accessories-System Tools-Scheduled Tasks</p>\n"
},
{
"answer_id": 166147,
"author": "prakash",... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166004",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20042/"
] | I am facing a performance issue on a multi-core (8+) architecture with software written in C++ / VistualStudio / WindowsXP.
Suddenly I realized that I have no idea of the performances of my L1 and L2 cache and CPU->to->Memory bandwidth.
I have tested several tools (including VTune, Glowcode, etc, etc) but all of them... | ```
set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep(100)
WshShell.Run "%SystemRoot%\system32\sndrec32.exe"
WScript.Sleep(100)
WshShell.AppActivate "Sound - Sound Recorder"
WScript.Sleep(100)
WshShell.SendKeys " "
WScript.Sleep(100)
```
Save the above text as RunSoundRecorder.vbs. This will star... |
166,033 | <p>What is meant by ‘value semantics’, and what is meant by ‘implicit pointer semantics’?</p>
| [
{
"answer_id": 166039,
"author": "David Pierre",
"author_id": 18296,
"author_profile": "https://Stackoverflow.com/users/18296",
"pm_score": 5,
"selected": true,
"text": "<p>Java is using implicit pointer semantics for Object types and value semantics for primitives.</p>\n\n<p>Value seman... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22076/"
] | What is meant by ‘value semantics’, and what is meant by ‘implicit pointer semantics’? | Java is using implicit pointer semantics for Object types and value semantics for primitives.
Value semantics means that you deal directly with values and that you pass copies around.
The point here is that when you have a value, you can trust it won't change behind your back.
With pointer semantics, you don't have a... |
166,044 | <p>When writing a batch file to automate something on a Windows box, I've needed to pause its execution for several seconds (usually in a test/wait loop, waiting for a process to start). At the time, the best solution I could find uses ping (I kid you not) to achieve the desired effect. I've found a better write-up of ... | [
{
"answer_id": 166053,
"author": "Daren Thomas",
"author_id": 2260,
"author_profile": "https://Stackoverflow.com/users/2260",
"pm_score": 2,
"selected": false,
"text": "<p>The <a href=\"https://en.wikipedia.org/wiki/Resource_Kit\" rel=\"nofollow noreferrer\">Resource Kit</a> has always i... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2193/"
] | When writing a batch file to automate something on a Windows box, I've needed to pause its execution for several seconds (usually in a test/wait loop, waiting for a process to start). At the time, the best solution I could find uses ping (I kid you not) to achieve the desired effect. I've found a better write-up of it ... | UPDATE
======
The `timeout` command, available from Windows Vista and onwards should be the command used, as described in another [answer](https://stackoverflow.com/a/5483958/6899) to this question. What follows here is an *old* answer.
### Old answer
If you have Python installed, or don't mind installing it (it has... |
166,051 | <p>So most Java resources when speaking of packages mention a <code>com.yourcompany.project</code> setup. However, I do not work for a company, and don't have a website. Are there any naming conventions that are common? An email address, perhaps?</p>
| [
{
"answer_id": 166069,
"author": "Stu Thompson",
"author_id": 2961,
"author_profile": "https://Stackoverflow.com/users/2961",
"pm_score": 5,
"selected": true,
"text": "<p>Use a top-level domain like 'bernard' or something else unique. The important part is that the domain is unique so ... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61/"
] | So most Java resources when speaking of packages mention a `com.yourcompany.project` setup. However, I do not work for a company, and don't have a website. Are there any naming conventions that are common? An email address, perhaps? | Use a top-level domain like 'bernard' or something else unique. The important part is that the domain is unique so that you avoid clashes, and not that it starts with a real Internet top-level domain like org or com. E.g.
```
import java.util.*;
import bernard.myProject.*;
import org.apache.commons.lang.*;
``` |
166,080 | <p>Am working on sybase ASE 15. Looking for something like this</p>
<pre><code>Select * into #tmp exec my_stp;
</code></pre>
<p>my_stp returns 10 data rows with two columns in each row.</p>
| [
{
"answer_id": 166172,
"author": "Valerion",
"author_id": 16156,
"author_profile": "https://Stackoverflow.com/users/16156",
"pm_score": -1,
"selected": false,
"text": "<p>Not sure about Sybase, but in SQL Server the following should work:</p>\n\n<p>INSERT INTO #tmp (col1,col2,col3...) ex... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21246/"
] | Am working on sybase ASE 15. Looking for something like this
```
Select * into #tmp exec my_stp;
```
my\_stp returns 10 data rows with two columns in each row. | In ASE 15 I believe you can use functions, but they're not going to help with multirow datasets.
If your stored proc is returning data with a "select col1,col2 from somewhere" then there's no way of grabbing that data, it just flows back to the client.
What you can do is insert the data directly into the temp table. ... |
166,083 | <p>I have the following preprocessor divective:</p>
<pre><code>#ifndef NDEBUG
#define TRACE printf
#else
#define TRACE(...)
#endif
</code></pre>
<p>and example of usage is:</p>
<pre><code>TRACE("TRACE: some parameter = %i\n", param);
</code></pre>
<p>In C all works perfectly well when I build both debug and release... | [
{
"answer_id": 166087,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 2,
"selected": true,
"text": "<p>You could do:</p>\n\n<pre><code>inline void TRACE(...) {}\n</code></pre>\n"
},
{
"answer_id": 166124,
"auth... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4378/"
] | I have the following preprocessor divective:
```
#ifndef NDEBUG
#define TRACE printf
#else
#define TRACE(...)
#endif
```
and example of usage is:
```
TRACE("TRACE: some parameter = %i\n", param);
```
In C all works perfectly well when I build both debug and release versions, but in C++ compiler emits the followin... | You could do:
```
inline void TRACE(...) {}
``` |
166,089 | <p>I'm interested: What is C#'s analog of <code>std::pair</code> in C++? I found <code>System.Web.UI.Pair</code> class, but I'd prefer something template-based.</p>
<p>Thank you!</p>
| [
{
"answer_id": 166094,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 10,
"selected": true,
"text": "<p>Tuples <a href=\"http://msdn.microsoft.com/en-us/library/system.tuple(v=vs.110).aspx\" rel=\"noreferrer\">are avai... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11256/"
] | I'm interested: What is C#'s analog of `std::pair` in C++? I found `System.Web.UI.Pair` class, but I'd prefer something template-based.
Thank you! | Tuples [are available since .NET4.0](http://msdn.microsoft.com/en-us/library/system.tuple(v=vs.110).aspx) and support generics:
```
Tuple<string, int> t = new Tuple<string, int>("Hello", 4);
```
---
In previous versions you can use `System.Collections.Generic.KeyValuePair<K, V>` or a solution like the following:
`... |
166,099 | <p>Starting new .NET projects always involves a bit of work. You have to create the solution, add projects for different tiers (Domain, DAL, Web, Test), set up references, solution structure, copy javascript files, css templates and master pages etc etc.</p>
<p>What I'd like is <strong>an easy way of cloning any given... | [
{
"answer_id": 166135,
"author": "Andre Bossard",
"author_id": 21027,
"author_profile": "https://Stackoverflow.com/users/21027",
"pm_score": 2,
"selected": false,
"text": "<p>As you already found out: Copy the .sln File and make sure the paths/guids match.</p>\n\n<p>Because the .sln are ... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1136215/"
] | Starting new .NET projects always involves a bit of work. You have to create the solution, add projects for different tiers (Domain, DAL, Web, Test), set up references, solution structure, copy javascript files, css templates and master pages etc etc.
What I'd like is **an easy way of cloning any given solution**.
I... | I have created a small application for this. It works just like the previously mentioned Solutionclone app, except that it is both a command line application as well as a WPF application.
Cloney copies a source folder to a target one, without any Git or Svn integration. It will also replace the old namespace everywher... |
166,113 | <p>If I want to call <code>Bar()</code> instead of <code>Foo()</code>, does <code>Bar()</code> return me a copy (additional overhead) of what Foo() returns, or it returns the same object which <code>Foo()</code> places on the temporary stack?</p>
<pre><code>vector<int> Foo(){
vector<int> result;
... | [
{
"answer_id": 166116,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 2,
"selected": false,
"text": "<p>Normally it returns a copy of the returned <code>vector<int></code>. However this highly depends on the opti... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20646/"
] | If I want to call `Bar()` instead of `Foo()`, does `Bar()` return me a copy (additional overhead) of what Foo() returns, or it returns the same object which `Foo()` places on the temporary stack?
```
vector<int> Foo(){
vector<int> result;
result.push_back(1);
return result;
}
vector<int> Bar(){ ... | Both may happen. However, most compiler will not do copy as soon as you optimize.
Your code indicate there should be a copy. However, the compiler is allowed to remove any copy that do not change the semantic and the program.
Note: This is why you should NEVER have a copy constructor that does anything but copying co... |
166,125 | <p>I'm currently trying to pass a mono threaded program to multithread. This software do heavy usage of "refCounted" objects, which lead to some issues in multithread. I'm looking for some design pattern or something that might solve my problem.</p>
<p>The main problem is object deletion between thread, normally delet... | [
{
"answer_id": 166137,
"author": "Len Holgate",
"author_id": 7925,
"author_profile": "https://Stackoverflow.com/users/7925",
"pm_score": 2,
"selected": false,
"text": "<p>Surely each thread simply needs to manage the reference counts correctly... That is, if ThreadA and ThreadB are both ... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1578/"
] | I'm currently trying to pass a mono threaded program to multithread. This software do heavy usage of "refCounted" objects, which lead to some issues in multithread. I'm looking for some design pattern or something that might solve my problem.
The main problem is object deletion between thread, normally deletion only d... | If the count is part of the object then you have an inherent problem if one thread can be trying to *increase* the reference count whilst another is trying to remove the *last* reference. There needs to be an extra value on the ref count for each globally accessible pointer to the object, so you can always safely incre... |
166,127 | <p>I have a web page where I'd like to remap Ctrl+N to a different behavior. I followed YUI's example of register Key Listeners and my function is called but Firefox still creates a new browser window. Things seem to work fine on IE7. How do I stop the new window from showing up?</p>
<p>Example:</p>
<pre><code>var kl... | [
{
"answer_id": 166376,
"author": "Gene",
"author_id": 22673,
"author_profile": "https://Stackoverflow.com/users/22673",
"pm_score": 0,
"selected": false,
"text": "<p>I'm just guessing here but I don't think it can be done.</p>\n\n<p>If it's possible it definitely shouldn't be. Generic ke... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166127",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/680/"
] | I have a web page where I'd like to remap Ctrl+N to a different behavior. I followed YUI's example of register Key Listeners and my function is called but Firefox still creates a new browser window. Things seem to work fine on IE7. How do I stop the new window from showing up?
Example:
```
var kl2 = new YAHOO.util.Ke... | The trick is the 'fn' function is whack.
Experimentally, you can see that the function type for fn takes two parameters. The first param actually contains the TYPE of event. The second one contains... and this is screwy: an array containing the codepoint at index 0 and the actual event object at index 1.
So changing ... |
166,132 | <p>I want to store the data returned by <code>$_SERVER["REMOTE_ADDR"]</code> in PHP into a DB field, pretty simple task, really. The problem is that I can't find any proper information about the maximum length of the <strong>textual representation</strong> of an IPv6 address, which is what a webserver provides through ... | [
{
"answer_id": 166143,
"author": "Gilles",
"author_id": 10024,
"author_profile": "https://Stackoverflow.com/users/10024",
"pm_score": 4,
"selected": false,
"text": "<p>Answered my own question: </p>\n\n<blockquote>\n <p>IPv6 addresses are normally written as eight groups of four hexadec... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10024/"
] | I want to store the data returned by `$_SERVER["REMOTE_ADDR"]` in PHP into a DB field, pretty simple task, really. The problem is that I can't find any proper information about the maximum length of the **textual representation** of an IPv6 address, which is what a webserver provides through `$_SERVER["REMOTE_ADDR"]`. ... | **45 characters**.
You might expect an address to be
```
0000:0000:0000:0000:0000:0000:0000:0000
```
>
> 8 \* 4 + 7 = 39
>
>
>
8 groups of 4 digits with 7 `:` between them.
But if you have an [IPv4-mapped IPv6 address](https://www.rfc-editor.org/rfc/rfc4291#section-2.5.5.2), the last two groups can be written... |
166,134 | <p>In PHP, which is quicker; using <code>include('somefile.php')</code> or querying a MySQL database with a simple <code>SELECT</code> query to get the same information?</p>
<p>For example, say you had a JavaScript autocomplete search field which needed 3,000 terms to match against. Is it quicker to read those terms i... | [
{
"answer_id": 166142,
"author": "Enrico Murru",
"author_id": 68336,
"author_profile": "https://Stackoverflow.com/users/68336",
"pm_score": -1,
"selected": false,
"text": "<p>I exactly don't know, but in my opinio using MySQL, even if can be slower, sould be used if the content is dynami... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21709/"
] | In PHP, which is quicker; using `include('somefile.php')` or querying a MySQL database with a simple `SELECT` query to get the same information?
For example, say you had a JavaScript autocomplete search field which needed 3,000 terms to match against. Is it quicker to read those terms in from another file using `inclu... | It depends. If your file is stored locally in your server and the database is installed in another machine, then the faster is to include the file.
Buuuuut, because it depends on your system it could be not true. I suggest to you to make a PHP test script and run it 100 times from the command line, and repeat the test... |
166,159 | <p>I recall there is a difference between some methods/properties called directly on the <a href="http://msdn.microsoft.com/en-us/library/system.data.datatable(VS.71).aspx" rel="noreferrer">DataTable</a> class, and the identically named methods/properties on the <a href="http://msdn.microsoft.com/en-us/library/system.d... | [
{
"answer_id": 166190,
"author": "Jaymz",
"author_id": 24761,
"author_profile": "https://Stackoverflow.com/users/24761",
"pm_score": 2,
"selected": false,
"text": "<p>AFAIK, the main difference between <code>datatable.clear</code> and <code>datatable.rows.clear</code>, is that <code>data... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5422/"
] | I recall there is a difference between some methods/properties called directly on the [DataTable](http://msdn.microsoft.com/en-us/library/system.data.datatable(VS.71).aspx) class, and the identically named methods/properties on the [DataTable.Rows](http://msdn.microsoft.com/en-us/library/system.data.datatable.rows(VS.7... | In .Net 1.1, `DataRowCollection.Clear` calls `DataTable.Clear`
However, in .Net 2.0, there is a difference.
If I understand the source correctly, `DataTable.Clear` will clear unattached rows (created using `DataTable.NewRow`) whereas DataRowCollection.Clear won't.
The difference is in `RecordManager.Clear` (source be... |
166,160 | <p>How can I scale the content of an iframe (in my example it is an HTML page, and is not a popup) in a page of my web site?</p>
<p>For example, I want to display the content that appears in the iframe at 80% of the original size.</p>
| [
{
"answer_id": 166271,
"author": "Alexandros Marinos",
"author_id": 24461,
"author_profile": "https://Stackoverflow.com/users/24461",
"pm_score": 0,
"selected": false,
"text": "<p>I do not think HTML has such functionality. The only thing I can imagine would do the trick is to do some se... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24765/"
] | How can I scale the content of an iframe (in my example it is an HTML page, and is not a popup) in a page of my web site?
For example, I want to display the content that appears in the iframe at 80% of the original size. | [Kip's solution](https://stackoverflow.com/questions/166160/how-can-i-scale-the-content-of-iframe/2224816#2224816) should work on Opera and Safari if you change the CSS to:
```
<style>
#wrap { width: 600px; height: 390px; padding: 0; overflow: hidden; }
#frame { width: 800px; height: 520px; border: 1px solid b... |
166,174 | <p>I have a list of objects, each containing an Id, Code and Description.</p>
<p>I need to convert this list into a Hashtable, using <strong>Description</strong> as the key and <strong>Id</strong> as the value.</p>
<p>This is so the Hashtable can then be serialised to JSON.</p>
<p>Is there a way to convert from List... | [
{
"answer_id": 166202,
"author": "Frank Krueger",
"author_id": 338,
"author_profile": "https://Stackoverflow.com/users/338",
"pm_score": 3,
"selected": false,
"text": "<p>If you have access to Linq, you can use the <a href=\"http://msdn.microsoft.com/en-us/library/bb549277.aspx\" rel=\"n... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4734/"
] | I have a list of objects, each containing an Id, Code and Description.
I need to convert this list into a Hashtable, using **Description** as the key and **Id** as the value.
This is so the Hashtable can then be serialised to JSON.
Is there a way to convert from List<Object> to Hashtable without writing a loop to go... | Let's assume that your List contains objects of type Foo (with an int Id and a string Description).
You can use Linq to turn that list into a Dictionary like this:
```
var dict = myList.Cast<Foo>().ToDictionary(o => o.Description, o => o.Id);
``` |
166,198 | <p>I'm writing a little debug app for a bit of kit we're developing and I'd like to roll it out to a few users to see if they can provoke any crashes. Does anyone know a way of effectively wrapping a wxPython app to catch any and all unhandled exceptions that would cause the app to crash?</p>
<p>Ideally I'd want to ca... | [
{
"answer_id": 166213,
"author": "Milan Babuškov",
"author_id": 14690,
"author_profile": "https://Stackoverflow.com/users/14690",
"pm_score": 1,
"selected": false,
"text": "<p>There are various ways. You can put a try..catch block in the wxApplication::OnInit, however, that would not alw... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15369/"
] | I'm writing a little debug app for a bit of kit we're developing and I'd like to roll it out to a few users to see if they can provoke any crashes. Does anyone know a way of effectively wrapping a wxPython app to catch any and all unhandled exceptions that would cause the app to crash?
Ideally I'd want to capture all ... | For logging standard output, you can use a stdout wrapper, such as this one:
```
from __future__ import with_statement
class OutWrapper(object):
def __init__(self, realOutput, logFileName):
self._realOutput = realOutput
self._logFileName = logFileName
def _log(self, text):
with open(s... |
166,210 | <p>I'll regularly get an extract from a DB/2 database with dates and timestaps formatted like this:</p>
<pre><code>2002-01-15-00.00.00.000000
2008-01-05-12.36.05.190000
9999-12-31-24.00.00.000000
</code></pre>
<p>Is there an easier way to convert this into the Excel date format than decomposing with substrings?</p>
... | [
{
"answer_id": 166216,
"author": "Matthew Scharley",
"author_id": 15537,
"author_profile": "https://Stackoverflow.com/users/15537",
"pm_score": 1,
"selected": false,
"text": "<p>I'm sure you could cook something up with Regex's if you really cared to. It wouldn't be any 'better' though, ... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15296/"
] | I'll regularly get an extract from a DB/2 database with dates and timestaps formatted like this:
```
2002-01-15-00.00.00.000000
2008-01-05-12.36.05.190000
9999-12-31-24.00.00.000000
```
Is there an easier way to convert this into the Excel date format than decomposing with substrings?
```
DB2date = DateValue(Left(a... | It's not clear if you talk about formula functions or VBA functions.
Formula functions
-----------------
Don't use the DateValue function, which expects a string; use the Date function, which expects numeric Year, Month, Day:
```
=DATE(INT(LEFT(A1,4)),INT(MID(A1,6,2)),INT(MID(A1,9,2)))
```
assuming that the date-a... |
166,217 | <p>I'm trying to create a named_scope that uses a join, but although the generated SQL looks right, the result are garbage. For example:</p>
<pre><code>class Clip < ActiveRecord::Base
named_scope :visible, {
:joins => "INNER JOIN series ON series.id = clips.owner_id INNER JOIN shows on shows.id = ser... | [
{
"answer_id": 166255,
"author": "MatthewFord",
"author_id": 21596,
"author_profile": "https://Stackoverflow.com/users/21596",
"pm_score": 3,
"selected": false,
"text": "<p>This is a bug:</p>\n\n<p><a href=\"http://rails.lighthouseapp.com/projects/8994/tickets/1077-chaining-scopes-with-d... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18666/"
] | I'm trying to create a named\_scope that uses a join, but although the generated SQL looks right, the result are garbage. For example:
```
class Clip < ActiveRecord::Base
named_scope :visible, {
:joins => "INNER JOIN series ON series.id = clips.owner_id INNER JOIN shows on shows.id = series.show_id",
... | The problem is that "SELECT \*" - the query picks up all the columns from clips, series, and shows, in that order. Each table has an id column, and result in conflicts between the named columns in the results. The last id column pulled back (from shows) overrides the one you want. You should be using a :select option w... |
166,221 | <p>I would like to upload a file asynchronously with jQuery. </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function () {
$("#uploadbutton").click(f... | [
{
"answer_id": 166267,
"author": "Mattias",
"author_id": 261,
"author_profile": "https://Stackoverflow.com/users/261",
"pm_score": 7,
"selected": false,
"text": "<p>Note: This answer is outdated, it is now possible to upload files using XHR.</p>\n\n<hr>\n\n<p>You cannot upload files usin... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2138/"
] | I would like to upload a file asynchronously with jQuery.
```js
$(document).ready(function () {
$("#uploadbutton").click(function () {
var filename = $("#file").val();
$.ajax({
type: "POST",
url: "addFile.do",
enctype: 'multipart/form-data',
... | With [HTML5](http://en.wikipedia.org/wiki/HTML5) you can make file uploads with Ajax and jQuery. Not only that, you can do file validations (name, size, and MIME type) or handle the progress event with the HTML5 progress tag (or a div). Recently I had to make a file uploader, but I didn't want to use [Flash](http://en.... |
166,231 | <p><a href="http://en.wikipedia.org/wiki/Tcl" rel="noreferrer">Tcl/Tk</a> is a simple way to script small GUIs.</p>
<p>Can anyone give a nice example with a <em>button</em> and a <em>text</em> widget. When the button is pressed should a shell command be executed and the output piped to the <em>text</em> widget.</p>
<... | [
{
"answer_id": 166247,
"author": "epatel",
"author_id": 842,
"author_profile": "https://Stackoverflow.com/users/842",
"pm_score": 2,
"selected": false,
"text": "<p>I can give a start...please suggest improvements. I.e I'd like it to scroll as the command is outputting</p>\n\n<pre><code>#... | 2008/10/03 | [
"https://Stackoverflow.com/questions/166231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/842/"
] | [Tcl/Tk](http://en.wikipedia.org/wiki/Tcl) is a simple way to script small GUIs.
Can anyone give a nice example with a *button* and a *text* widget. When the button is pressed should a shell command be executed and the output piped to the *text* widget.
If you have other nice and clean examples for useful tasks, plea... | Here's a more complete example using fileevents. This will auto-scroll all the time. For usability purposes you probably only want to auto-scroll if the bottom of the text is visible (ie: if the user hasn't moved the scrollbar) but I'll leave that as an exercise for the reader to keep this already long example from get... |