qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
190,738 | <p>With the following piece of code:</p>
<pre><code>typedef struct
{
char fileName[ 1024];
time_t deleteTime;
} file_item_t;
....
....
setEntry(char *fileName)
{
file_item_t file;
memset( &file, 0x00, sizeof( file_item_t ));
memcpy( file.fileName,
fileName,
sizeof( file.fileName ) - 1 );
...
...
</code></pre>
<p>When the function is called, it runs OK on a SPARC machine but segfaults on an i386 both running Solaris 10.
<code>fileName</code> is a nul-terminated string about 30 chars let's say.
It appears that an attempt to read beyond the range of the <code>fileName</code> using <code>memcpy()</code> triggers a segmentation fault on some systems.</p>
<p>It's legacy code and easily correctable. But what I would like to know is about the underlying characteristics that can result in this failing or not.
Is it related to read violation on the stack? Some boundary crossing?
It is related to memory segmentation and is it just a case of chance (depending on how memory segmentation/paging is done by memory management and OS.) that it can fail or not.</p>
| [
{
"answer_id": 190744,
"author": "Timbo",
"author_id": 1810,
"author_profile": "https://Stackoverflow.com/users/1810",
"pm_score": 1,
"selected": false,
"text": "fileName"
},
{
"answer_id": 191710,
"author": "ephemient",
"author_id": 20713,
"author_profile": "https://... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190738",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
190,740 | <p>I thought I understood what the default method does to a hash... </p>
<p>Give a default value for a key if it doesn't exist:</p>
<pre><code>irb(main):001:0> a = {}
=> {}
irb(main):002:0> a.default = 4
=> 4
irb(main):003:0> a[8]
=> 4
irb(main):004:0> a[9] += 1
=> 5
irb(main):005:0> a
=> {9=>5}
</code></pre>
<p>All good.</p>
<p>But if I set the default to be a empty list, or empty hash, I don't understand it's behaviour at <strong>all</strong>....</p>
<pre><code>irb(main):001:0> a = {}
=> {}
irb(main):002:0> a.default = []
=> []
irb(main):003:0> a[8] << 9
=> [9] # great!
irb(main):004:0> a
=> {} # ?! would have expected {8=>[9]}
irb(main):005:0> a[8]
=> [9] # awesome!
irb(main):006:0> a[9]
=> [9] # unawesome! shouldn't this be [] ??
</code></pre>
<p>I was hoping/expecting the same behaviour as if I had used the ||= operator...</p>
<pre><code>irb(main):001:0> a = {}
=> {}
irb(main):002:0> a[8] ||= []
=> []
irb(main):003:0> a[8] << 9
=> [9]
irb(main):004:0> a
=> {8=>[9]}
irb(main):005:0> a[9]
=> nil
</code></pre>
<p>Can anyone explain what is going on?</p>
| [
{
"answer_id": 190801,
"author": "Aaron Hinni",
"author_id": 12086,
"author_profile": "https://Stackoverflow.com/users/12086",
"pm_score": 7,
"selected": true,
"text": "Hash.default"
},
{
"answer_id": 190832,
"author": "Simon Howard",
"author_id": 24806,
"author_profi... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26094/"
] |
190,748 | <p>You can, obviously, put a variable declaration in a for loop:</p>
<pre><code>for (int i = 0; ...
</code></pre>
<p>and I've noticed that you can do the same thing in if and switch statements as well:</p>
<pre><code>if ((int i = f()) != 0) ...
switch (int ch = stream.get()) ...
</code></pre>
<p>But when I try to do the same thing in a while loop:</p>
<pre><code>while ((int ch = stream.get()) != -1) ...
</code></pre>
<p>The compiler (VC++ 9.0) does not like it at all.</p>
<p>Is this compliant behavior? Is there a reason for it?</p>
<p><strong>EDIT</strong>: I found I can do this:</p>
<pre><code>while (int ch = stream.get() != -1) ...
</code></pre>
<p>but because of precedence rules, that's interpreted as:</p>
<pre><code>while (int ch = (stream.get() != -1)) ...
</code></pre>
<p>which is not what I want.</p>
| [
{
"answer_id": 190768,
"author": "workmad3",
"author_id": 16035,
"author_profile": "https://Stackoverflow.com/users/16035",
"pm_score": 4,
"selected": false,
"text": "label:\n{ //start of condition scope\n T t = x;\n if (t) {\n statement\n goto label;\n }\n}\n"
}... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4086/"
] |
190,755 | <p>Any suggestion how I can document my Perl code? What do you use and what tools are available to help me?</p>
<p>Which module do you use to convert pod to html?</p>
| [
{
"answer_id": 190903,
"author": "brian d foy",
"author_id": 2766176,
"author_profile": "https://Stackoverflow.com/users/2766176",
"pm_score": 7,
"selected": true,
"text": "-m"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/190755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10523/"
] |
190,759 | <p>I'm looking for way to PHP to detect if a script was run from a manual invocation on a shell (me logging in and running it), or if it was run from the crontab entry.</p>
<p>I have various maintenance type scripts written in php that i have set to run in my crontab. Occasionally, and I need to run them manually ahead of schedule or if something failed/broken, i need to run them a couple times.</p>
<p>The problem with this is that I also have some external notifications set into the tasks (posting to twitter, sending an email, etc) that I DONT want to happen everytime I run the script manually.</p>
<p>I'm using php5 (if it matters), its a fairly standard linux server environment.</p>
<p>Any ideas?</p>
| [
{
"answer_id": 190778,
"author": "Till",
"author_id": 2859,
"author_profile": "https://Stackoverflow.com/users/2859",
"pm_score": 3,
"selected": false,
"text": "$_ENV"
},
{
"answer_id": 190790,
"author": "Adam Hopkinson",
"author_id": 12280,
"author_profile": "https:/... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/314/"
] |
190,775 | <p>I need to take a paragraph of text and extract from it a list of "tags". Most of this is quite straight forward. However I need some help now stemming the resulting word list to avoid duplicates. Example: Community / Communities</p>
<p>I've used an implementation of Porter Stemmer algorithm (I'm writing in PHP by the way):</p>
<p><a href="http://tartarus.org/~martin/PorterStemmer/php.txt" rel="noreferrer">http://tartarus.org/~martin/PorterStemmer/php.txt</a></p>
<p>This works, up to a point, but doesn't return "real" words. The example above is stemmed to "commun".</p>
<p>I've tried "Snowball" (suggested within another Stack Overflow thread).</p>
<p><a href="http://snowball.tartarus.org/demo.php" rel="noreferrer">http://snowball.tartarus.org/demo.php</a></p>
<p>For my example (community / communities), Snowball stems to "communiti".</p>
<p><strong>Question</strong></p>
<p>Are there any other stemming algorithms that will do this? Has anyone else solved this problem?</p>
<p><em>My current thinking is that I could use a stemming algorithm to avoid duplicates and then pick the shortest word I encounter to be the actual word to display.</em></p>
| [
{
"answer_id": 615251,
"author": "Kaarel",
"author_id": 12547,
"author_profile": "https://Stackoverflow.com/users/12547",
"pm_score": 6,
"selected": false,
"text": "morpha"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/190775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15318/"
] |
190,776 | <p>How do you build and use dynamic sql in a MySQL stored procedure?</p>
| [
{
"answer_id": 190962,
"author": "Jason Stevenson",
"author_id": 13368,
"author_profile": "https://Stackoverflow.com/users/13368",
"pm_score": 7,
"selected": true,
"text": "mysql> PREPARE stmt FROM \n -> 'select count(*) \n -> from information_schema.schemata \n -> where schema_... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3747/"
] |
190,813 | <p>Does anyone know if dbunit has the power to export specific data from multiple tables at once based on a sql statement, as can be done by using dbunit's QueryDataSet class to export data from a single table based on a sql statement, <a href="http://www.dbunit.org/faq.html#extract" rel="nofollow noreferrer">as can been seen here</a>.</p>
<p>James</p>
| [
{
"answer_id": 47978860,
"author": "Ilya Tkachev",
"author_id": 6318650,
"author_profile": "https://Stackoverflow.com/users/6318650",
"pm_score": 0,
"selected": false,
"text": "QueryDataSet partialDataSet = new QueryDataSet(connection);\npartialDataSet.addTable(tableName1, \"select * fro... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
190,818 | <p>I want to create an <code>NSOpenPanel</code> that can select any kind of file, so I do this</p>
<pre><code>NSOpenPanel* panel = [NSOpenPanel openPanel];
if([panel runModalForTypes:nil] == NSOKButton) {
// process files here
}
</code></pre>
<p>which lets me select all files <em>except</em> symbolic links.<br>
They're simply not selectable and the obvious <code>setResolvesAliases</code><br>
does nothing.</p>
<p>What gives?</p>
<p><b>Update 1:</b> I did some more testing and found that this strangeness<br>
is present in Leopard (10.5.5) but not in Tiger (10.4.8). </p>
<p><b>Update 2:</b> The code above can select mac aliases (persistent path<br>
data that lives in the resource fork) but not symlinks (files created with ln -s).</p>
| [
{
"answer_id": 191978,
"author": "Mecki",
"author_id": 15809,
"author_profile": "https://Stackoverflow.com/users/15809",
"pm_score": 1,
"selected": false,
"text": "NSOpenPanel * panel = [NSOpenPanel openPanel];\n[panel setCanChooseDirectories:YES];\nif ([panel runModalForTypes:nil] == NS... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190818",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22147/"
] |
190,819 | <p>For a new project with Flash I was looking for something along the lines of standard libraries for basic programming needs, along the lines of Python or Ruby standard libraries. But the only thing I found was a dead project on Sourceforge.</p>
<p>Thus is there no standard library for flash? Does everyone reinvent the wheel each time?</p>
| [
{
"answer_id": 190856,
"author": "hasseg",
"author_id": 4111,
"author_profile": "https://Stackoverflow.com/users/4111",
"pm_score": 2,
"selected": false,
"text": "flash.*"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/190819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15124/"
] |
190,830 | <p>I am responsible for the User Interface of an application written completely in Visual C++ using MFC and some third-part controls. I would like to use C# (WinForms or even better WPF) to improve the application look&feel.</p>
<p>I would like some advices about how to do it. Links, articles, examples...</p>
<p>Right now the user interface is isolated in a single project and I don't want to compile the whole module with CLR. So how do I have to manage that from the architectural point of view?</p>
<p>I have already looked at the Internet for the subject and read MSDN information. I would like more detailed information...is it convinient? pros/cons? have you used this approach successfully in a "big" application?
I don't want to compile the whole ui project with CLR...can I just have all the .NET code in a isolated project and call it from the ui project? what's the best way to do it?</p>
<p>Thanks in advance.</p>
| [
{
"answer_id": 190856,
"author": "hasseg",
"author_id": 4111,
"author_profile": "https://Stackoverflow.com/users/4111",
"pm_score": 2,
"selected": false,
"text": "flash.*"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/190830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14053/"
] |
190,833 | <p>I want to intercept a request in a filter/servlet and add a few parameters to it. However, the request does not expose a 'setParameter' method and the parameter map when manipulated throws an error saying it is locked. Is there an alternative I can try?</p>
| [
{
"answer_id": 190859,
"author": "Panagiotis Korros",
"author_id": 19331,
"author_profile": "https://Stackoverflow.com/users/19331",
"pm_score": 3,
"selected": false,
"text": "public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, Se... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16485/"
] |
190,840 | <p>I have found some libraries or web services in PHP that does the job. The problem is that the conversion is done when the page is fully loaded, I would like to <strong>convert the page to PDF</strong> <strong>after some content dynamically added via AJAX</strong> in onload event. </p>
<p>Thank you very much,
Omar</p>
| [
{
"answer_id": 190889,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 3,
"selected": false,
"text": "document.getElementsByTagName('html')[0].innerHTML"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/190840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26779/"
] |
190,852 | <p>See code: </p>
<pre><code>var file1 = "50.xsl";
var file2 = "30.doc";
getFileExtension(file1); //returns xsl
getFileExtension(file2); //returns doc
function getFileExtension(filename) {
/*TODO*/
}
</code></pre>
| [
{
"answer_id": 190864,
"author": "p4bl0",
"author_id": 12043,
"author_profile": "https://Stackoverflow.com/users/12043",
"pm_score": 2,
"selected": false,
"text": "return filename.replace(/\\.([a-zA-Z0-9]+)$/, \"$1\");\n"
},
{
"answer_id": 190878,
"author": "Tom",
"author... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2138/"
] |
190,876 | <p>I have a few combo-boxes and double spin boxes on my Qt Dialog. Now I need a "ResetToDefault" item on a menu that comes up when you right click on the widget (spin box or combo box).</p>
<p>How do i get it. Is there some way I can have a custom menu that comes up on right click or Is there a way i can add items to the menu that comes on right click.</p>
| [
{
"answer_id": 190895,
"author": "PierreBdR",
"author_id": 7136,
"author_profile": "https://Stackoverflow.com/users/7136",
"pm_score": 4,
"selected": true,
"text": "addAction"
},
{
"answer_id": 191228,
"author": "David Dibben",
"author_id": 5022,
"author_profile": "ht... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11212/"
] |
190,890 | <p>does it matter at all what order the <code><link></code> or <code><script></code> or <code><meta></code> tags are in in the <code><head></head></code>?</p>
<p>(daft question but one of those things i've never given any thought to until now.)</p>
| [
{
"answer_id": 190899,
"author": "Joe Lencioni",
"author_id": 18986,
"author_profile": "https://Stackoverflow.com/users/18986",
"pm_score": 5,
"selected": false,
"text": "h1 { color: #f00; }\n"
},
{
"answer_id": 190902,
"author": "Adhip Gupta",
"author_id": 384,
"auth... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26107/"
] |
190,908 | <p>When you tap a row in a <code>UITableView</code>, the row is highlighted and selected. Is it possible to disable this so tapping a row does nothing?</p>
| [
{
"answer_id": 191245,
"author": "Martin Gordon",
"author_id": 2481,
"author_profile": "https://Stackoverflow.com/users/2481",
"pm_score": 11,
"selected": false,
"text": "UITableViewCell"
},
{
"answer_id": 1062825,
"author": "user41806",
"author_id": 41806,
"author_pr... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2183/"
] |
190,912 | <p>I've run into a problem where I'm getting two printouts of my /etc/motd file on Gentoo Linux. sshd is doing one of the printouts, and I can toggle that by configuring /etc/ssh/sshd_config, but I can't find out who's printing the second copy. I can't disable sshd from printing out the motd due to an audit requirement. I'm running the bash shell, for what it's worth</p>
<p>Any ideas who's printing the second copy? I don't think it's bash, as when I change /etc/passwd to use /bin/ksh for my shell, I still get the motd displayed.</p>
<p>It's not /etc/issue, as that contains the string "This is \n (\s \m \r) (\l)", which is printed only when you're sitting in front of the machine.</p>
| [
{
"answer_id": 682647,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "session required pam_env.so\n#session optional pam_lastlog.so\nsession include sy... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9816/"
] |
190,914 | <p>I have a DataGridView which shows the content of a DataTable.</p>
<p>I want to set the backcolor of a row based on the value of a cell in this row.</p>
<p>Note that the cell in question is in a column which is not displayed in the DataGridView (Visible=False).</p>
| [
{
"answer_id": 190932,
"author": "Jason Stevenson",
"author_id": 13368,
"author_profile": "https://Stackoverflow.com/users/13368",
"pm_score": 2,
"selected": false,
"text": "protected void Page_Load(object sender, EventArgs e)\n{\n GridView g1 = new GridView();\n g1.RowDataBound +=... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15928/"
] |
190,915 | <p>I am writing a UDF for Excel 2007 which I want to pass a table to, and then reference parts of that table in the UDF. So, for instance my table called "Stock" may look something like this:</p>
<blockquote>
<p>Name Cost Items in Stock</p>
<p>Teddy Bear £10 10</p>
<p>Lollipops 20p 1000</p>
</blockquote>
<p>I have a UDF which I want to calculate the total cost of all the items left in stock (the actual example is much more complex which can't really be done without very complex formula)</p>
<p>Ideally the syntax of for the UDF would look something like</p>
<pre><code>TOTALPRICE(Stock)
</code></pre>
<p>Which from what I can work out would mean the UDF would have the signature</p>
<pre><code>Function TOTALPRICE(table As Range) As Variant
</code></pre>
<p>What I am having trouble with is how to reference the columns of the table and iterate through them. Ideally I'd like to be able to do it referencing the column headers (so something like table[Cost]).</p>
| [
{
"answer_id": 190968,
"author": "Mike Woodhouse",
"author_id": 1060,
"author_profile": "https://Stackoverflow.com/users/1060",
"pm_score": 2,
"selected": true,
"text": "Public Function TotalPrice(table As Range) As Variant\n\nDim row As Long, col As Long\nDim total As Double\n\n For ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/214/"
] |
190,936 | <p>When I type 'from' (in a <a href="http://en.wikipedia.org/wiki/Language_Integrated_Query" rel="nofollow noreferrer">LINQ</a> query) after importing <a href="http://msdn.microsoft.com/en-us/library/system.linq.aspx" rel="nofollow noreferrer">System.Linq namespace</a>, it is understood as a keyword. How does this magic happen?</p>
<p>Is 'from' a extension method on some type?</p>
| [
{
"answer_id": 190948,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": true,
"text": "var qry = from cust in db.Customers\n where cust.IsActive\n select cust;\n"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/190936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26788/"
] |
190,937 | <p>I'm looking for a way to create an "it will look cool" effect for a full screen WPF application I'm working on - a "screen glint" effect that animates or moves across the whole screen to give off a shiny display experience. I'm thinking of creating a large rectangle with a highlighted-gradient and transparent background, which could be animated across the screen. Any ideas how this can be done effectively in XAML?</p>
| [
{
"answer_id": 218326,
"author": "Johan Danforth",
"author_id": 6415,
"author_profile": "https://Stackoverflow.com/users/6415",
"pm_score": 4,
"selected": true,
"text": "<Window\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microso... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190937",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6415/"
] |
190,940 | <p>I've just set up a new build server with the Windows 2008 .NET 3.5 SDK, and for some reason it hasn't installed c:\Program Files\Common Files\Microsoft Shared\TextTemplating so I can't run t4 templates on it. I had a look at the install options in add/remove programs and every single option is checked. </p>
<p>Any ideas why it is missing? Any ideas how to get it back?</p>
| [
{
"answer_id": 218326,
"author": "Johan Danforth",
"author_id": 6415,
"author_profile": "https://Stackoverflow.com/users/6415",
"pm_score": 4,
"selected": true,
"text": "<Window\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microso... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2086/"
] |
190,956 | <p>Just wanted to get an idea for ways (web) developers get round the short fall of (most) WYSIWYG editors, whereby the users that are editing the text aren't always HTML literate enough to produce good/great results.</p>
<p>In the past we have resigned ourselves to either locking down the editor or simply not supplying one.</p>
<p>What are other peoples experiences?</p>
| [
{
"answer_id": 218326,
"author": "Johan Danforth",
"author_id": 6415,
"author_profile": "https://Stackoverflow.com/users/6415",
"pm_score": 4,
"selected": true,
"text": "<Window\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microso... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17540/"
] |
190,963 | <p><a href="https://stackoverflow.com/questions/189925/password-encryption-in-iphone-apps">This question discusses encrypting data on the iPhone</a> using the crypt() function. As an alternative, is there a keychain on the iPhone and if so, what code would I use to access it in order to store login details and then retrieve them for us in an application?</p>
| [
{
"answer_id": 7314271,
"author": "AlBeebe",
"author_id": 172361,
"author_profile": "https://Stackoverflow.com/users/172361",
"pm_score": 3,
"selected": false,
"text": "#import <Security/Security.h>\n\n// -------------------------------------------------------------------------\n-(NSStri... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2183/"
] |
190,988 | <p>I have to use the <strong>XMLHttp object in classic ASP</strong> in order to send some data to another server via HTTP from server to server:</p>
<pre><code>sURL = SOME_URL
Set oXHttp = Server.CreateObject("Msxml2.XMLHTTP")
oXHttp.open "POST", sURL, false
oXHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset:ISO-8859-1;"
sPost = SOME_FORM_DATA
oXHttp.send(sPost)
</code></pre>
<p>I've been told (by the maintainer of the consuming server) that, depending on whether I use this code from Windows Server 2000 (IIS 5) or Windows Server 2003 (IIS 6), he gets <strong>Latin-1</strong> (Windows 2000 Server) or <strong>UTF-8</strong> (Windows Server 2003) encoded data.</p>
<p>I didn't find any property or method to set the character set of data I have to send. Does it depend on some Windows configuration or scripting (asp) settings?</p>
| [
{
"answer_id": 7314271,
"author": "AlBeebe",
"author_id": 172361,
"author_profile": "https://Stackoverflow.com/users/172361",
"pm_score": 3,
"selected": false,
"text": "#import <Security/Security.h>\n\n// -------------------------------------------------------------------------\n-(NSStri... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6461/"
] |
190,996 | <p>I am working on a collection MATLAB, Java, and C/C++ components that all inter-operate, but have distinctly different compilation/installation steps. We currently don't compile anything for MATLAB, use maven2 for our Java build and unit tests, and use autotools for our C/C++ build and unit tests.</p>
<p>I would like to move everything to a single build and unit test system, using maven2, but have not been able to find a plugin that will allow the C/C++ codestream to remain autotools-based and simply wrap it in a maven build. Having to rip out autotools support and recreate all the dependencies in maven is most likely a deal-breaker, so I'm looking for a way for maven and autotools to play nicely together, rather than having to choose between the two.</p>
<p>Is this possible or even desirable? Are there resources out there that I have overlooked?</p>
| [
{
"answer_id": 7314271,
"author": "AlBeebe",
"author_id": 172361,
"author_profile": "https://Stackoverflow.com/users/172361",
"pm_score": 3,
"selected": false,
"text": "#import <Security/Security.h>\n\n// -------------------------------------------------------------------------\n-(NSStri... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5840/"
] |
190,999 | <p>I just started experimenting with SVG in web pages, and I discovered that it is only possible to add SVG images into HTML using <code><object /></code> tags, not <code><img /></code> like I would have expected. Most of the time, I add graphics to web pages through CSS because they are part of the presentation of the site, not the content.</p>
<p>I know it is possible to apply CSS <em>to</em> SVG, but is it possible to add a vector image to an HTML element using purely CSS?</p>
| [
{
"answer_id": 191012,
"author": "Neall",
"author_id": 619,
"author_profile": "https://Stackoverflow.com/users/619",
"pm_score": 2,
"selected": false,
"text": ".putapicturehere:before {\n content: url(mysvgfile.svg);\n}\n"
},
{
"answer_id": 1042791,
"author": "Erik Dahlström... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/392/"
] |
191,004 | <p>I'm trying to dynamically hide certain DIV's when a print (or print preview) occurs from the browser.</p>
<p>I can easily differentiate statically by having two style sheets, one for normal and one for print media:
</p>
<p>But I need to go one step further and hide some elements dynamically when the print style sheet becomes active during a print based upon certain criteria</p>
<p>One way to easily solve it would be to handle a DOM event for handling print / printview, then I could just use jQuery to change the display:none on the classes that need to be hidden, but I can't find a DOM print event!!</p>
<p>Anyone know what the solution is?</p>
| [
{
"answer_id": 191234,
"author": "Marcus Downing",
"author_id": 1000,
"author_profile": "https://Stackoverflow.com/users/1000",
"pm_score": 2,
"selected": false,
"text": "<div id='div19' class='noprint'>\n ...\n</div>\n"
},
{
"answer_id": 192872,
"author": "Grant Wagner",
... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191004",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26793/"
] |
191,010 | <pre><code>dir(re.compile(pattern))
</code></pre>
<p>does not return pattern as one of the lists's elements. Namely it returns:</p>
<pre><code>['__copy__', '__deepcopy__', 'findall', 'finditer', 'match', 'scanner', 'search', 'split', 'sub', 'subn']
</code></pre>
<p>According to the manual, it is supposed to contain </p>
<blockquote>
<p>the object's attributes' names, the
names of its class's attributes, and
recursively of the attributes of its
class's base classes.</p>
</blockquote>
<p>It says also that</p>
<blockquote>
<p>The list is not necessarily complete.</p>
</blockquote>
<p>Is there a way to get the <strong>complete</strong> list? I always assumed that dir returns a complete list but apparently it does not...</p>
<p>Also: is there a way to list only attributes? Or only methods?</p>
<p><em>Edit: this is actually a bug in python -> supposedly it is fixed in the 3.0 branch (and perhaps also in 2.6)</em></p>
| [
{
"answer_id": 191029,
"author": "PierreBdR",
"author_id": 7136,
"author_profile": "https://Stackoverflow.com/users/7136",
"pm_score": 8,
"selected": true,
"text": "getattr"
},
{
"answer_id": 191679,
"author": "Moe",
"author_id": 3051,
"author_profile": "https://Stack... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/985/"
] |
191,013 | <p>Is it possible to have an anonymous type implement an interface?</p>
<p>I've got a piece of code that I would like to work, but don't know how to do this.</p>
<p>I've had a couple of answers that either say no, or create a class that implements the interface construct new instances of that. This isn't really ideal, but I'm wondering if there is a mechanism to create a thin dynamic class on top of an interface which would make this simple.</p>
<pre><code>public interface DummyInterface
{
string A { get; }
string B { get; }
}
public class DummySource
{
public string A { get; set; }
public string C { get; set; }
public string D { get; set; }
}
public class Test
{
public void WillThisWork()
{
var source = new DummySource[0];
var values = from value in source
select new
{
A = value.A,
B = value.C + "_" + value.D
};
DoSomethingWithDummyInterface(values);
}
public void DoSomethingWithDummyInterface(IEnumerable<DummyInterface> values)
{
foreach (var value in values)
{
Console.WriteLine("A = '{0}', B = '{1}'", value.A, value.B);
}
}
}
</code></pre>
<p>I've found an article <a href="http://channel8.msdn.com/Posts/Adding-some-dynamic-to-C-interface-wrapping/" rel="noreferrer">Dynamic interface wrapping</a> that describes one approach. Is this the best way of doing this?</p>
| [
{
"answer_id": 191124,
"author": "ICR",
"author_id": 214,
"author_profile": "https://Stackoverflow.com/users/214",
"pm_score": 4,
"selected": false,
"text": "public class Test\n{\n class DummyInterfaceImplementor : IDummyInterface\n {\n public string A { get; set; }\n ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5932/"
] |
191,020 | <p>How do I set the initial width of a QDockWidget?</p>
<p>I have implemented the sizeHint function but what next?</p>
| [
{
"answer_id": 191078,
"author": "Marius",
"author_id": 1585,
"author_profile": "https://Stackoverflow.com/users/1585",
"pm_score": 3,
"selected": false,
"text": "void Applicotion::readSettings() {\n QSettings settings(\"Company Name\", \"Application Name\");\n settings.beginGroup(\"Li... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24459/"
] |
191,023 | <p>When Windows Internet Properties -> Connections -> LAN Settings -> Automatic Configuration is set to "Automatically detect settings" how does Windows actually determine/discover what the settings are? Is it a network broadcast or some kind of targeted query to a server configured somewhere in the registry, or something else?</p>
| [
{
"answer_id": 191041,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 7,
"selected": true,
"text": "GET http://wpad/wpad.dat"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/191023",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5193/"
] |
191,039 | <p>In deploying to a new (Solaris 9) environment recently, one of the steps was to copy a set of files and directories to their new location and then to apply the group UID bit (using "chmod -R g+s") to all files in the directory tree giving a mode of -rwxr-s--- to everything. The result was that none of our shell scripts would execute unless they were individually opened and re-saved. I should add that we had earlier set g+s on the target parent folder prior to copying files; this had set the initial mode on all the new directories to drwxr-s--- but the files had a mode of -rwxr-x---</p>
<p>Having eventually discovered which step caused the problem, we were able to cut out that step and proceed.</p>
<p>I would like, however, to understand what the "s" bit means when applied to directories and files, in the hope that this will explain why we had the problem in the first place.</p>
| [
{
"answer_id": 191782,
"author": "ephemient",
"author_id": 20713,
"author_profile": "https://Stackoverflow.com/users/20713",
"pm_score": 3,
"selected": false,
"text": "g+s"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/191039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26790/"
] |
191,056 | <p>I want a checkbox on a web page. When I click it, it sends an ajax request to the server. When the server replies, I want the checkbox to change. I can fix everything except the fact that the checkbox immediately changes state when clicked. </p>
| [
{
"answer_id": 191100,
"author": "tloach",
"author_id": 14092,
"author_profile": "https://Stackoverflow.com/users/14092",
"pm_score": 0,
"selected": false,
"text": "checkbox.checked=NOT checkbox.checked"
},
{
"answer_id": 192704,
"author": "Parand",
"author_id": 13055,
... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
191,062 | <p>Could someone please explain to me how the current python webframworks fit together?</p>
<p>The three I've heard of are CherryPy, TurboGears and Pylons. However I'm confused because TurboGears seems to use CherryPy as the 'Controller' (although isn't CherryPy a framework in in it's own right?), and TurbGears 2 is going to be built on top of Pylons (which I thought did the same thing?).</p>
| [
{
"answer_id": 58336089,
"author": "Babu Reddy",
"author_id": 2016203,
"author_profile": "https://Stackoverflow.com/users/2016203",
"pm_score": 0,
"selected": false,
"text": "from fastapi import FastAPI\n\napp = FastAPI()\n\n\n@app.get(\"/\")\ndef read_root():\n return {\"Hello\": \"W... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191062",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
191,066 | <p>I am working on a Software Project that needs to be translated into 30 languages. This means that changing any string incurs into a relatively high cost. Additionally, translation does not happen overnight, because the translation package needs to be worked by different translators, so this might take a while.</p>
<p>Adding new features is cumbersome somehow. We can think up all the Strings that will be needed before we actually code the UI, but sometimes still we need to add new strings because of bug fixes or because of an oversight.</p>
<p>So the question is, how do you manage all this process? Any tips in how to ease the impact of translation in the software project? How to rule the strings, instead of having the strings rule you?</p>
<p>EDIT: We are using Java and all Strings are internationalized using Resource Bundles, so the problem is not the internationalization per-se, but the management of the strings.</p>
| [
{
"answer_id": 277508,
"author": "Elijah",
"author_id": 33611,
"author_profile": "https://Stackoverflow.com/users/33611",
"pm_score": 2,
"selected": false,
"text": "\npublic final class l7d {\n...normal junk\n\n/**\n * Reference to the localized strings resource bundle.\n */\npublic stat... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2309/"
] |
191,070 | <p>What code generation tools are built-in to vs.net 2008 or are officially available via Microsoft?</p>
<p>I know of:</p>
<ul>
<li>Entity Framework</li>
<li>sqlmetal</li>
</ul>
<p>What else is there?</p>
<p>Ideally i'm looking for something that will generate from an existing database schema.</p>
| [
{
"answer_id": 277508,
"author": "Elijah",
"author_id": 33611,
"author_profile": "https://Stackoverflow.com/users/33611",
"pm_score": 2,
"selected": false,
"text": "\npublic final class l7d {\n...normal junk\n\n/**\n * Reference to the localized strings resource bundle.\n */\npublic stat... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
191,082 | <p>Ok sorry this might seem like a dumb question but I cannot figure this thing out :</p>
<p>I am trying to parse a string and simply want to check whether it only contains the following characters : '0123456789dD+ '</p>
<p>I have tried many things but just can't get to figure out the right regex to use!</p>
<pre><code>
Regex oReg = new Regex(@"[\d dD+]+");
oReg.IsMatch("e4");
</code></pre>
<p>will return true even though e is not allowed...
I've tried many strings, including Regex("[1234567890 dD+]+")...</p>
<p>It always works on <a href="http://regexpal.com/" rel="nofollow noreferrer">Regex Pal</a> but not in C#...</p>
<p>Please advise and again i apologize this seems like a very silly question</p>
| [
{
"answer_id": 191104,
"author": "Manu",
"author_id": 2133,
"author_profile": "https://Stackoverflow.com/users/2133",
"pm_score": 4,
"selected": true,
"text": "@\"^[0-9dD+ ]+$\"\n"
},
{
"answer_id": 191110,
"author": "Coincoin",
"author_id": 42,
"author_profile": "htt... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25152/"
] |
191,093 | <p>As recently as several years ago, the developers actually made the builds that went to clients. This was obviously a disaster for reasons too numerous to list.</p>
<p>Then when we started to learn the errors of our ways, we looked for a way to auto-build the entire application on a dedicated build machine. The culture at that time was very averse to bringing in outside tools, so we built our own autobuild system by writing a VB app.</p>
<p>This worked fine for a while, until the project's structure started to change, new projects were added, and we needed to build the application in different ways. Then then weaknesses of our hand-rolled autobuilder became apparent and, over time, increasingly onerous. This disease has progressed now to the point where QA (who owns our build process) can't even maintain the autobuilder because it requires more and more programming skill. Every time we add a project or change something in an existing project, it consumes more developer time just to make it work. There have been days when we were unable to produce a build because the system was broken.</p>
<p>I'm now in a position where I can change this process, and I'm looking to scrap the entire system and put something else in it's place. My goals are:</p>
<ul>
<li>Have an autobuild system that can run with zero human interaction at a specific time every day. It should be able to gather all the source code, compile all the apps, create the setups, put the finished products on a network share, and possibly trigger the automated testing system to kick in (we use QTP).</li>
<li>The autobuild system should be flexible enough to easily adapt to changes in the project without rrequiring a major overhaul.</li>
<li>It should be simple enough so that QA can own the system and not require developer resources to make changes to how builds are made.</li>
</ul>
<p>What are your experiences? Can you recommend an autobuild system? Should I have different goals?</p>
| [
{
"answer_id": 191244,
"author": "Ben Straub",
"author_id": 1319,
"author_profile": "https://Stackoverflow.com/users/1319",
"pm_score": 2,
"selected": false,
"text": "build"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/191093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241536/"
] |
191,143 | <p>I'm getting ready to start a new project and I've been researching the entity framework. My question is what is the best strategy for validating the entities? Other projects I've worked on have used attributes for most of the validation, but obviously this is not possible in the entity framework. Is the only way to do this by handling the partial methods in the property setters? All advice is much appreciated.</p>
| [
{
"answer_id": 4176794,
"author": "Rob",
"author_id": 133250,
"author_profile": "https://Stackoverflow.com/users/133250",
"pm_score": 1,
"selected": false,
"text": "public abstract class ValidationObjectContext : ObjectContext{\n ...\n\n public override int SaveChanges(SaveOptions ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17744/"
] |
191,153 | <p>What are your usage of delegates in C#?</p>
| [
{
"answer_id": 191219,
"author": "Santiago Palladino",
"author_id": 12791,
"author_profile": "https://Stackoverflow.com/users/12791",
"pm_score": 0,
"selected": false,
"text": "storage.Store(conditions, Download(item))\n"
},
{
"answer_id": 191226,
"author": "Marc Gravell",
... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24975/"
] |
191,157 | <p>What exactly is the difference between the <code>window.onload</code> event and the <code>onload</code> event of the <code>body</code> tag? when do I use which and how should it be done correctly?</p>
| [
{
"answer_id": 191221,
"author": "Dr. Bob",
"author_id": 12182,
"author_profile": "https://Stackoverflow.com/users/12182",
"pm_score": 1,
"selected": false,
"text": "<body onload=\"\">"
},
{
"answer_id": 191227,
"author": "Mark Biek",
"author_id": 305,
"author_profile... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2133/"
] |
191,159 | <p>You'd like to call a stored proc on MS SQL that has a parameter type of TIMESTAMP within T-SQL, not ADO.NET using a VARCHAR value (e.g. '0x0000000002C490C8').</p>
<p>What do you do?</p>
<p>UPDATE:
This is where you have a "Timestamp" value coming at you but exists only as VARCHAR. (Think OUTPUT variable on another stored proc, but it's fixed already as VARCHAR, it just has the value of a TIMESTAMP). So, unless you decide to build Dynamic SQL, how can you programmatically change a value stored in VARCHAR into a valid TIMESTAMP?</p>
| [
{
"answer_id": 191169,
"author": "John Rudy",
"author_id": 14048,
"author_profile": "https://Stackoverflow.com/users/14048",
"pm_score": 2,
"selected": false,
"text": "EXEC usp_MyProc @myParam=0x0000000002C490C8\n"
},
{
"answer_id": 220226,
"author": "6eorge Jetson",
"aut... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/307/"
] |
191,160 | <p>I am creating a new build process for a DotNet project which is to be held in Subversion.</p>
<p>For each dll/exe that I compile (via Nant) I would like to include 2 additional attibutes in the dlls that are built.</p>
<p>I already understand the workings of the 'asminfo' nant task. But I need help retrieving the information which I hope to embed in my binaries.</p>
<p>The build will always happen from a full working copy (checked out by the build process itself.) and will therefore always have an .svn directory available.</p>
<p>The attributes I want to add are RepositoryVersion and RepositoryPath. (I understand that these are not the names this information goes by in svn)</p>
<p>In order to do this I will need to extract the RepositoryVersion and RepositoryPath represented by the working copy folder that the BuildFile sits within.</p>
<p><strong>How do I extract this information from any given .svn folder into the 2 nant variables?</strong> </p>
| [
{
"answer_id": 191199,
"author": "EggyBach",
"author_id": 15475,
"author_profile": "https://Stackoverflow.com/users/15475",
"pm_score": 3,
"selected": true,
"text": "<xmlpeek file=\"out.xml\" xpath=\"/info/entry/url\" property=\"svn.url\" />\n"
},
{
"answer_id": 191238,
"auth... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11356/"
] |
191,179 | <p>How can I find the font that the user has set in their Windows Display Properties using C# in .NET?</p>
<p>I want to display a form using the fonts that the user has selected. The fonts I want are those selected in the Windows Display Properties form for 3D-objects, menus and window title bars. But I cannot find a way to access them. There is a <code>System.Windows.Forms.Control.DefaultFont</code> property but that is returning the Windows default font (which is, I think, MS Sans Serif on XP).</p>
| [
{
"answer_id": 191199,
"author": "EggyBach",
"author_id": 15475,
"author_profile": "https://Stackoverflow.com/users/15475",
"pm_score": 3,
"selected": true,
"text": "<xmlpeek file=\"out.xml\" xpath=\"/info/entry/url\" property=\"svn.url\" />\n"
},
{
"answer_id": 191238,
"auth... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26808/"
] |
191,201 | <p>I do all my coding in vim and am quite happy with it (so, please, no "use a different editor" responses), but have an ongoing annoyance in that the smartindent feature wants to not indent comments beginning with # at all. e.g., I want</p>
<pre><code> # Do something
$x = $x + 1;
if ($y) {
# Do something else
$y = $y + $z;
}
</code></pre>
<p>instead of vim's preferred</p>
<pre><code># Do something
$x = $x + 1;
if ($y) {
# Do something else
$y = $y + $z;
}
</code></pre>
<p>The only ways I have been able to prevent comments from being sent to the start of the line are to either insert and delete a character on the line before hitting # (a nuisance to have to remember to do every time) or turn off smartindent entirely (losing automatic indentation increase/decrease as I open/close braces).</p>
<p>How can I set vim to maintain my indentation for comments instead of sending them to the start of the line?</p>
| [
{
"answer_id": 191230,
"author": "Ben Hoffstein",
"author_id": 4482,
"author_profile": "https://Stackoverflow.com/users/4482",
"pm_score": 3,
"selected": false,
"text": "set cindent\nset cinkeys=0{,0},!^F,o,O,e \" default is: 0{,0},0),:,0#,!^F,o,O,e\n"
},
{
"answer_id": 191267,
... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18914/"
] |
191,206 | <p>I need to programmatically get a list of running applications as shown in the "Applications" tab inside the Windows Task Manager using PowerShell or VBScript.</p>
<p>All I could find so far is how to list processes using VBScript and WMI.</p>
| [
{
"answer_id": 191343,
"author": "stahler",
"author_id": 26811,
"author_profile": "https://Stackoverflow.com/users/26811",
"pm_score": 4,
"selected": true,
"text": "Set Word = CreateObject(\"Word.Application\")\nSet Tasks = Word.Tasks\nFor Each Task in Tasks\n If Task.Visible Then Wscr... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191206",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26810/"
] |
191,208 | <p>I have a table in SQL server that has the normal tree structure of Item_ID, Item_ParentID.
Suppose I want to iterate and get all CHILDREN of a particular Item_ID (at any level).</p>
<p>Recursion seems an intuitive candidate for this problem and I can write an SQL Server function to do this. </p>
<p>Will this affect performance if my table has many many records?
How do I avoid recursion and simply query the table? Please any suggestions?</p>
| [
{
"answer_id": 191220,
"author": "JosephStyons",
"author_id": 672,
"author_profile": "https://Stackoverflow.com/users/672",
"pm_score": 0,
"selected": false,
"text": "SELECT\n SOME_FIELDS\nFROM\n MASTER_TABLE MT\n ,CHILD_TABLE CT\nWHERE CT.PARENT_ID = MT.ITEM_ID\n"
},
{
"answer... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13370/"
] |
191,209 | <p>By default, copying from the command prompt will prompt you to overwrite files that already exist in the target location.</p>
<p>You can add "/Y" to say "Yes to all" replacements.</p>
<p>But how can you say "No to all" ?</p>
<p>In other words, I want to copy everything from one directory that does <strong>not</strong> already exist in the target.</p>
<p>The closest thing I see is the XCOPY argument to only copy things after a specific mod-datetime.</p>
| [
{
"answer_id": 191239,
"author": "Adam Davis",
"author_id": 2915,
"author_profile": "https://Stackoverflow.com/users/2915",
"pm_score": 3,
"selected": false,
"text": "2.3 By comparison with the file in destination\n\n The switches in this group select files based on the\n compari... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/672/"
] |
191,215 | <p>How do I stop a Java process gracefully in Linux and Windows?</p>
<p>When does <code>Runtime.getRuntime().addShutdownHook</code> get called, and when does it not?</p>
<p>What about finalizers, do they help here?</p>
<p>Can I send some sort of signal to a Java process from a shell?</p>
<p>I am looking for preferably portable solutions.</p>
| [
{
"answer_id": 191961,
"author": "jsight",
"author_id": 1432,
"author_profile": "https://Stackoverflow.com/users/1432",
"pm_score": 7,
"selected": true,
"text": "SIGTERM"
},
{
"answer_id": 208809,
"author": "Ma99uS",
"author_id": 20390,
"author_profile": "https://Stac... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20390/"
] |
191,233 | <p>Often WinDbg will enter a state where it is <strong>*Busy*</strong> performing an operation. </p>
<p>Often this is due to some mistake I made trying to <em>dt some_variable_itll_never_find</em> or setting a break point somewhere without symbols or the 1000's of other mistakes I make fumbling around this tool.</p>
<p><strong>Is there a way to cancel the current operation?</strong></p>
| [
{
"answer_id": 9576204,
"author": "EdChum",
"author_id": 704848,
"author_profile": "https://Stackoverflow.com/users/704848",
"pm_score": 4,
"selected": false,
"text": "Ctrl+Break \n"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/191233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3655/"
] |
191,248 | <p>I'm experimenting with <a href="http://en.wikipedia.org/wiki/Latent_Dirichlet_allocation" rel="noreferrer">Latent Dirichlet Allocation</a> for topic disambiguation and assignment, and I'm looking for advice.</p>
<ol>
<li>Which program is the "best", where best is some combination of easiest to use, best prior estimation, fast</li>
<li>How do I incorporate my intuitions about topicality. Let's say I think I know that some items in the corpus are really in the same category, like all articles by the same author. Can I add that into the analysis?</li>
<li>Any unexpected pitfalls or tips I should know before embarking?</li>
</ol>
<p>I'd prefer is there are R or Python front ends for whatever program, but I expect (and accept) that I'll be dealing with C. </p>
| [
{
"answer_id": 71241775,
"author": "Платформа Игр",
"author_id": 17389005,
"author_profile": "https://Stackoverflow.com/users/17389005",
"pm_score": 0,
"selected": false,
"text": "def plot_top_words(model, feature_names, n_top_words, title):\nfig, axes = plt.subplots(2, 5, figsize=(30, 1... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15842/"
] |
191,250 | <p>I have the following code fragment that starts a <a href="http://en.wikipedia.org/wiki/Google_Earth" rel="nofollow noreferrer">Google Earth</a> process using a hardcoded path:</p>
<pre><code>var process =
new Process
{
StartInfo =
{
//TODO: Get location of google earth executable from registry
FileName = @"C:\Program Files\Google\Google Earth\googleearth.exe",
Arguments = "\"" + kmlPath + "\""
}
};
process.Start();
</code></pre>
<p>I want to programmatically fetch the installation location of <em>googleearth.exe</em> from somewhere (most likely the registry).</p>
| [
{
"answer_id": 191281,
"author": "Iain",
"author_id": 5993,
"author_profile": "https://Stackoverflow.com/users/5993",
"pm_score": 2,
"selected": false,
"text": "Process.Start(kmlPath);\n"
},
{
"answer_id": 194238,
"author": "ICR",
"author_id": 214,
"author_profile": "... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5993/"
] |
191,253 | <p>I have a client who is still using Visual Studio 6 for building production systems. They write multi-threaded systems that use STL and run on mutli-processor machines. </p>
<p>Occasionally when they change the spec of or increase the load on one of their server machines they get 'weird' difficult to reproduce errors... </p>
<p>I know that there are several issues with Visual Studio 6 development and I'd like to convince them to move to Visual Stuio 2005 or 2008 (they have Visual Studio 2005 and use it for some projects). </p>
<p>The purpose of this question is to put together a list of known issues or reasons to upgrade along with links to where these issues are discussed or reported. It would also be useful to have real life 'horror stories' of how these issues have bitten you.</p>
| [
{
"answer_id": 191303,
"author": "Ben Straub",
"author_id": 1319,
"author_profile": "https://Stackoverflow.com/users/1319",
"pm_score": 0,
"selected": false,
"text": "/clr"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/191253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7925/"
] |
191,260 | <p>We've recently completed phase 1 of a ASP.Net website in English and French. We went with using resource files to store language specific strings, but because the site used ASP.Net AJAX and javascript heavily we rigged up a solution to pass the right files through the ASP.Net pipeline where we could catch "tokens" and replace them with the appropriate text pulled from the resource files. </p>
<p>This is the second project I've been involved in that had these kinds of challenges, the first one stored the text strings in a database, and instead of ASP.Net AJAX, it used the AJAX tools that come with the Prototype library and put all Javascript into aspx files so that the tokens could be replaced on the way out.</p>
<p>What I'm wondering is, has anyone else encountered a similar scenario? What approach did you take? What lessons were learned? How did you deal with things like internationalized date formats?</p>
| [
{
"answer_id": 191754,
"author": "Joe Scylla",
"author_id": 25771,
"author_profile": "https://Stackoverflow.com/users/25771",
"pm_score": 2,
"selected": true,
"text": "<script scr=\"var/scripts/en_GB-76909c49e9222ec2bb2f45e0a3c8baef80deb665.js\"></script>\n"
},
{
"answer_id": 115... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22152/"
] |
191,291 | <p>How would you manually trigger additional team builds from a team build? For example, when we were in CC.Net other builds would trigger if certain builds were successful. The second build could either be projects that use this component or additional, long running test libraries for the same component. </p>
| [
{
"answer_id": 191898,
"author": "Martin Woodward",
"author_id": 6438,
"author_profile": "https://Stackoverflow.com/users/6438",
"pm_score": 3,
"selected": true,
"text": " <Target Name=\"AfterEndToEndIteration\">\n\n <GetBuildProperties TeamFoundationServerUrl=\"$(TeamFoundationServe... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18264/"
] |
191,306 | <p>I want to force the current execution line to a specific line in the same function, possibly skipping intermediate lines. All my old school debuggers had this feature, but I can't find it in eclipse. Is there a way to do it without changing code?</p>
| [
{
"answer_id": 42689490,
"author": "Ciro Santilli OurBigBook.com",
"author_id": 895245,
"author_profile": "https://Stackoverflow.com/users/895245",
"pm_score": 0,
"selected": false,
"text": "i = 1"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/191306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12386/"
] |
191,312 | <p>If you launch Emacs using the <code>-nw</code> flag to force a console session (rather than an X session if you have X windows running), how do you get to the menu?</p>
<p>There are some items held in the menus that are infrequently-enough used on my part that I don't recall the escape or control sequence to do them.</p>
| [
{
"answer_id": 191344,
"author": "JesperE",
"author_id": 13051,
"author_profile": "https://Stackoverflow.com/users/13051",
"pm_score": 2,
"selected": false,
"text": "M-x menu-bar-mode\n"
},
{
"answer_id": 191377,
"author": "Chris Conway",
"author_id": 1412,
"author_pr... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4418/"
] |
191,329 | <p>I am working through a book which gives examples of Ranges being converted to equivalent arrays using their "to_a" methods</p>
<p>When i run the code in irb I get the following warning</p>
<pre><code> warning: default `to_a' will be obsolete
</code></pre>
<p>What is the the correct alternative to using to_a?</p>
<p>are there alternate ways to populate an array with a Range?</p>
| [
{
"answer_id": 191357,
"author": "Daniel Lucraft",
"author_id": 11951,
"author_profile": "https://Stackoverflow.com/users/11951",
"pm_score": 6,
"selected": false,
"text": "irb> (1..4).to_a\n=> [1, 2, 3, 4]\n"
},
{
"answer_id": 191373,
"author": "Richard Turner",
"author_... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24773/"
] |
191,335 | <p>Is there a way to generate random number on Windows by reading from a file or pseudo file or character special file, the way that can be done on Linux by reading from <a href="http://en.wikipedia.org/wiki/Urandom#Linux" rel="nofollow noreferrer">/dev/random</a>? Not asking about various crypto API, but whether there is in Windows something akin to the Linux way.</p>
| [
{
"answer_id": 20825047,
"author": "cxxl",
"author_id": 1045800,
"author_profile": "https://Stackoverflow.com/users/1045800",
"pm_score": 1,
"selected": false,
"text": "rand_s()"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/191335",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5764/"
] |
191,339 | <p>I have a <code>DataGridView</code> bound to a <code>DataView</code>. The grid can be sorted by the user on any column.</p>
<p>I add a row to the grid by calling NewRow on the <code>DataView</code>'s underlying <code>DataTable</code>, then adding it to the <code>DataTable</code>'s Rows collection. How can I select the newly-added row in the grid?</p>
<p>I tried doing it by creating a <code>BindingManagerBase</code> object bound to the <code>BindingContext</code> of the <code>DataView</code>, then setting <code>BindingManagerBase.Position = BindingManagerBase.Count</code>. This works if the grid is not sorted, since the new row gets added to the bottom of the grid. However, if the sort order is such that the row is not added to the bottom, this does not work.</p>
<p>How can I reliably set the selected row of the grid to the new row?</p>
| [
{
"answer_id": 209841,
"author": "Brendan Kendrick",
"author_id": 13473,
"author_profile": "https://Stackoverflow.com/users/13473",
"pm_score": 0,
"selected": false,
"text": "Dim myRecentItemID As Integer = 3\n\nFor Each row As GridViewRow In gvIndividuals.Rows\n Dim drv As DataRowVie... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3012/"
] |
191,342 | <p>Is there a succinct way to retrieve a random record from a sql server table? </p>
<p>I would like to randomize my unit test data, so am looking for a simple way to select a random id from a table. In English, the select would be "Select one id from the table where the id is a random number between the lowest id in the table and the highest id in the table." </p>
<p>I can't figure out a way to do it without have to run the query, test for a null value, then re-run if null.</p>
<p>Ideas?</p>
| [
{
"answer_id": 191348,
"author": "Sklivvz",
"author_id": 7028,
"author_profile": "https://Stackoverflow.com/users/7028",
"pm_score": 8,
"selected": true,
"text": "SELECT TOP 1 * FROM table ORDER BY NEWID()\n"
},
{
"answer_id": 191498,
"author": "Sklivvz",
"author_id": 702... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10693/"
] |
191,351 | <p>I am trying to rename all the files present in a Windows directory using <strong>FOR</strong> command as follows at the command prompt:</p>
<pre><code>for %1 in (*.*) do ren %1 test%1
</code></pre>
<p>E.g. This renames a file <strong>enc1.ctl</strong> to <strong>testenc1.ctl</strong> <strong>enc2.ctl</strong> to <strong>testenc2.ctl</strong> </p>
<p>Thats not what i want. What i want is
<strong>enc1.ctl</strong> renamed to <strong>test1.ctl</strong> <strong>enc2.ctl</strong> renamed to <strong>test2.ctl</strong> </p>
<p>How do i do that?</p>
<hr>
<p>@Akelunuk:
Thanks, that w kind of works but i have files names as </p>
<p><strong>h263_enc_random_pixels_1.ctl , h263_enc_random_pixels_2.ctl</strong> which i want to rename to</p>
<p><strong>test1.ctl and test2.ctl</strong> respectively </p>
<p>Then how?</p>
| [
{
"answer_id": 191420,
"author": "David Nehme",
"author_id": 14167,
"author_profile": "https://Stackoverflow.com/users/14167",
"pm_score": 2,
"selected": true,
"text": "for /L %1 in (1,1,10) do ren enc%1.ctl test%1.ctl\n"
},
{
"answer_id": 191451,
"author": "akalenuk",
"a... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2759376/"
] |
191,359 | <p>I need to convert a bunch of files to utf-8 in Python, and I have trouble with the "converting the file" part.</p>
<p>I'd like to do the equivalent of:</p>
<pre><code>iconv -t utf-8 $file > converted/$file # this is shell code
</code></pre>
<p>Thanks!</p>
| [
{
"answer_id": 191403,
"author": "DzinX",
"author_id": 18745,
"author_profile": "https://Stackoverflow.com/users/18745",
"pm_score": 7,
"selected": true,
"text": "import codecs\nBLOCKSIZE = 1048576 # or some other, desired size in bytes\nwith codecs.open(sourceFileName, \"r\", \"your-sou... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2797/"
] |
191,364 | <p>Trying to debug an issue with a server and my only log file is a 20GB log file (with no timestamps even! Why do people use <code>System.out.println()</code> as logging? In production?!)</p>
<p>Using grep, I've found an area of the file that I'd like to take a look at, line 347340107.</p>
<p>Other than doing something like</p>
<pre><code>head -<$LINENUM + 10> filename | tail -20
</code></pre>
<p>... which would require <code>head</code> to read through the first 347 million lines of the log file, is there a quick and easy command that would dump lines 347340100 - 347340200 (for example) to the console?</p>
<p><strong>update</strong> I totally forgot that grep can print the context around a match ... this works well. Thanks!</p>
| [
{
"answer_id": 191397,
"author": "itsmatt",
"author_id": 7862,
"author_profile": "https://Stackoverflow.com/users/7862",
"pm_score": 5,
"selected": false,
"text": "tail -n +347340107 filename | head -n 100\n"
},
{
"answer_id": 191440,
"author": "mweerden",
"author_id": 42... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191364",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4249/"
] |
191,368 | <p>I can reset FPU's CTRL registers with this:</p>
<p><a href="http://support.microsoft.com/kb/326219" rel="nofollow noreferrer">http://support.microsoft.com/kb/326219</a></p>
<p>But how can I save current registers, and restore them later?</p>
<p>It's from .net code..</p>
<p>What I'm doing, is from Delphi calling an .net dll as an COM module. Checking the <kbd>Ctrl</kbd> registers in delphi yield one value, checking with controlfp in the .net code gives another value.
What I need, is in essential is to do this:</p>
<pre><code>_controlfp(_CW_DEFAULT, 0xfffff);
</code></pre>
<p>So my floatingpoint calculations in the .net code does not crash, but I want to restore the <kbd>Ctrl</kbd> registers when returning.</p>
<p>Maybe I don't? Maybe Delphi is resetting them when needed?
I blogged about this problem <a href="http://blog.neslekkim.net/2008/10/fpu-issues-when-interoping-delphi-and.html" rel="nofollow noreferrer">here</a>.</p>
| [
{
"answer_id": 191454,
"author": "Shog9",
"author_id": 811,
"author_profile": "https://Stackoverflow.com/users/811",
"pm_score": 3,
"selected": false,
"text": "_controlfp()"
},
{
"answer_id": 198658,
"author": "Jim",
"author_id": 22722,
"author_profile": "https://Stac... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3308/"
] |
191,376 | <p>I am still trying to wrap my head around design patterns and for the second time I'm coming up against the same problem that seems to be crying out for a pattern solution. </p>
<p>I have an accounts system with multiple account types. We have restaurant, hotel, service_provider, and consumer account types. Im sure there will be more business account types in the future, and of course there's a global administrator account.</p>
<p>So what I'm wondering is how to implement the switching of account types. Eg. each account will have one or more profiles, but the profile will be different depending on the account type. What kind class relationships should I use here to deal with the multiple types of account - polymorphism or inheritance?</p>
<p>It seems like maybe there should be an abstract base Profile class that the other profiles should extend, but I'm not sure how to implement that (eg a join table between profile types and account types?).</p>
<p>It also feels like an opportunity to implement the factory pattern, I'm just not sure really how to go about it.</p>
<p>Any ideas please?</p>
<pre><code>*
*
</code></pre>
<p><em>Edited to provide some examples as suggested:</em></p>
<pre><code>Account -> hasMany -> Users
Account -> belongsTo -> AccountType
Account -> hasOne -> Profile
</code></pre>
<p>The profile is different depending on what type of account it is, eg an account of type restaurant will have a menu, a wine list etc, an account of type hotel will have room types, amenities, an account of type consumer will have personal tastes, home country etc.</p>
<p>The question was what design pattern would best implement these relationships. </p>
<p>Hope thats clearer, thanks!</p>
| [
{
"answer_id": 192666,
"author": "Steven A. Lowe",
"author_id": 9345,
"author_profile": "https://Stackoverflow.com/users/9345",
"pm_score": 0,
"selected": false,
"text": "User <<--> Account\nAccount <<--> AccountType\nAccount <--> Profile\nProfile <<--> ProfileType\n"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/191376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
191,383 | <p>For PHP</p>
<p>I have a date I want line wrapped.</p>
<p>I have $date = '2008-09-28 9:19 pm';
I need the first space replaced with a br
to become </p>
<pre><code>2008-09-28<br>9:19 pm
</code></pre>
<p>If it wasn't for that second space before PM, I would just str_replace() it. </p>
| [
{
"answer_id": 192666,
"author": "Steven A. Lowe",
"author_id": 9345,
"author_profile": "https://Stackoverflow.com/users/9345",
"pm_score": 0,
"selected": false,
"text": "User <<--> Account\nAccount <<--> AccountType\nAccount <--> Profile\nProfile <<--> ProfileType\n"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/191383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13704/"
] |
191,390 | <p>I'm about to inherit a rather large Java enterprise project that has a large amount of third party dependencies. There is at least seventy JARs included and some of them would seem to be unused e.g. spring.jar which I know isn't used.</p>
<p>It seems that over the years as various developers have touched upon the code base they have all tried out new project-of-the-month type libraries.</p>
<p><strong>How does one go about getting rid of these?</strong> Within reason of course, as clearly some dependencies are helpful to not have to re-invent the wheel. </p>
<p>I'm obviously interested in java based projects but I'm welcome to answers across languages that people think will be helpful.</p>
| [
{
"answer_id": 191672,
"author": "Adam Crume",
"author_id": 25498,
"author_profile": "https://Stackoverflow.com/users/25498",
"pm_score": 1,
"selected": false,
"text": "[Opened C:\\Program Files\\Java\\jre1.6.0_04\\lib\\rt.jar]\n[Loaded java.util.regex.Pattern$Single from C:\\Program Fil... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1915/"
] |
191,399 | <p>How do I change the Read-only file attribute for each file in a folder using c#?</p>
<p>Thanks</p>
| [
{
"answer_id": 191423,
"author": "Jeffrey L Whitledge",
"author_id": 10174,
"author_profile": "https://Stackoverflow.com/users/10174",
"pm_score": 4,
"selected": false,
"text": "foreach (string fileName in System.IO.Directory.GetFiles(path))\n{\n System.IO.FileInfo fileInfo = new Syst... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
191,400 | <p>I have around 25 worksheets in my workbook (Excel spreadsheet).
Is there a way I can protect all the 25 worksheets in single click ? or this feature is not available and I will have to write a VBA code to accomplish this. I need very often to protect all sheets and unprotect all sheets and doing individually is time consuming</p>
| [
{
"answer_id": 191416,
"author": "Ben Hoffstein",
"author_id": 4482,
"author_profile": "https://Stackoverflow.com/users/4482",
"pm_score": 5,
"selected": true,
"text": "Dim ws as Worksheet\nDim pwd as String\n\npwd = \"\" ' Put your password here\nFor Each ws In Worksheets\n ws.Protec... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17266/"
] |
191,404 | <p>I have been asking myself this question for a long time now. Thought of posting it. C# doesn't support Multiple Inheritance(this is the fact). All classes created in C# derive out of 'Object' class(again a fact).</p>
<p>So if C# does not support Multiple inheritance, then how are we able to extend a class even though it already extends Object class?</p>
<p>Illustating with an example: </p>
<ol>
<li>class A : object - Class A created.</li>
<li>class B : object - Class B created.</li>
<li>class A : B - this again is supported. What happens to the earlier association to object.</li>
</ol>
<p>We are able to use object class methods in A after step 3. So is the turned to multi level inheritance. If that is the case, then</p>
<ol>
<li>class A : B</li>
<li>class C : B</li>
<li>class A : C - I must be able to access class B's methods in A. Which is not the case?</li>
</ol>
<p>Can anyone please explain?</p>
| [
{
"answer_id": 191450,
"author": "David Basarab",
"author_id": 2469,
"author_profile": "https://Stackoverflow.com/users/2469",
"pm_score": 0,
"selected": false,
"text": "public class A : B\n{\n\n}\n\npublic class B : C\n{\n public int BProperty { get; set; }\n}\n\npublic class C\n{\n ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21995/"
] |
191,413 | <p>I'm just starting to wean myself from ASP.NET UpdatePanels. I'm using jQuery and jTemplates to bind the results of a web service to a grid, and everything works fine. </p>
<p>Here's the thing: I'm trying to show a spinner GIF while the table is being refreshed (à la UpdateProgress in ASP.NET) I've got it all working, except that the spinner is frozen. To see what's going on, I've tried moving the spinner out from the update progress div and out on the page where I can see it the whole time. It spins and spins until the refresh starts, and stays frozen until the refresh is done, and then starts spinning again. Not really what you want from a 'please wait' spinner!</p>
<p>This is in IE7 - haven't had a chance to test in other browsers yet. Any thoughts? Is the ajax call or the client-side databinding so resource-intensive that the browser is unable to tend to its animated GIFs?</p>
<h3>Update</h3>
<p>Here's the code that refreshes the grid. Not sure if this is synchronous or asynchronous.</p>
<pre><code>updateConcessions = function(e) {
$.ajax({
type: "POST",
url: "Concessions.aspx/GetConcessions",
data: "{'Countries':'ga'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
applyTemplate(msg);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
}
});
}
applyTemplate = function(msg) {
$('div#TemplateTarget').setTemplate($('div#TemplateSource').html());
$('div#TemplateTarget').processTemplate(msg);
}
</code></pre>
<h3>Update 2</h3>
<p>I just checked the <a href="http://docs.jquery.com/Ajax/jQuery.ajax#options" rel="noreferrer">jQuery documentation</a> and the <code>$.ajax()</code> method is asynchronous by default. Just for kicks I added this</p>
<pre><code>$.ajax({
async: true,
...
</code></pre>
<p>and it didn't make any difference.</p>
| [
{
"answer_id": 191677,
"author": "David",
"author_id": 26144,
"author_profile": "https://Stackoverflow.com/users/26144",
"pm_score": 3,
"selected": false,
"text": "setTimeout(\"document.images['BusyImage'].src=document.images['BusyImage'].src\",10);\n"
},
{
"answer_id": 191761,
... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239663/"
] |
191,421 | <p>I am using SQL Server 2005. I want to constrain the values in a column to be unique, while allowing NULLS.</p>
<p>My current solution involves a unique index on a view like so:</p>
<pre><code>CREATE VIEW vw_unq WITH SCHEMABINDING AS
SELECT Column1
FROM MyTable
WHERE Column1 IS NOT NULL
CREATE UNIQUE CLUSTERED INDEX unq_idx ON vw_unq (Column1)
</code></pre>
<p>Any better ideas? </p>
| [
{
"answer_id": 191729,
"author": "onedaywhen",
"author_id": 15354,
"author_profile": "https://Stackoverflow.com/users/15354",
"pm_score": 6,
"selected": false,
"text": "CREATE TABLE dupNulls (\npk int identity(1,1) primary key,\nX int NULL,\nnullbuster as (case when X is null then pk el... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20959/"
] |
191,428 | <p>Is it possible to change the language of system messages from PostgreSQL?</p>
<p>In MSSQL for instance this is possible with the SQL statement <a href="http://msdn.microsoft.com/en-us/library/ms174398.aspx" rel="noreferrer">SET LANGUAGE</a>.</p>
| [
{
"answer_id": 191958,
"author": "Milen A. Radev",
"author_id": 15785,
"author_profile": "https://Stackoverflow.com/users/15785",
"pm_score": 6,
"selected": false,
"text": "SET lc_messages TO 'en_US.UTF-8';\n"
},
{
"answer_id": 36998716,
"author": "user1",
"author_id": 23... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3565/"
] |
191,429 | <p>I'm trying to use <a href="http://www.glish.com/css/9.asp" rel="nofollow noreferrer">this</a> layout with two 50% column width instead. But it seems that when the right columns reaches its 'min-width', it goes under the left column. Is there any way to use the 'shim' technique to set a min-width to the wrapper so both columns stop resizing. Thus, eliminating the problem of the right column finding itself under the left column.</p>
<p>My page is as follows.</p>
<pre><code><style type="text/css">
#left {
float: left;
width: 50%;
}
.minwidth {
width: 500px;
height: 0;
line-height: 0;
}
</style>
<div id="wrapper">
<div id="left">
left
</div>
<div id="right">
right
</div>
<div class="minwidth">&nbsp;</div>
</div>
</code></pre>
<p>The issue with that is the left column will stop resizing, but the right column will go below the left column and keep resizing. Basically, the effect that I want is once the wrappers width goes bellow, that both left, and right columns also stop resizing. Putting the shim in both left and right columns did not work either.</p>
<p>Is there possibly another way of going abouts getting two 50% width columns and using a shim to properly set a min width?</p>
<p>Thank you.</p>
<p>Edit: The whitespace in the minwidth class is actually &nbsp but it got converted. ;)</p>
| [
{
"answer_id": 191540,
"author": "Robert K",
"author_id": 24950,
"author_profile": "https://Stackoverflow.com/users/24950",
"pm_score": 1,
"selected": false,
"text": ".left, .right { width:50%; float: left; }\n.right { float: right; }\n.minwidth { min-width: 500px; display: block; height... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25371/"
] |
191,463 | <p>This seems like the most basic question in the world, but damned if I can find an answer.</p>
<p>Is there a keyboard shortcut, either native to Visual Studio or through Code Rush or other third-party plug-in, to wrap the current selection with an HTML tag? I'm tired of typing the opening tag, cutting the misplaced closing tag to the clipboard, moving the cursor, and pasting it at the end where it belongs.</p>
<p><strong>Update:</strong> <a href="http://screencast.com/t/pesxOgON" rel="noreferrer">This is how TextMate handles surrounding a selection with a tag</a>. Frankly, I'm stunned that Visual Studio doesn't seem to have a similar feature. Creating a macro or snippet for every conceivable tag I might want to use seems absurd.</p>
| [
{
"answer_id": 2879206,
"author": "Bradley Mountford",
"author_id": 302103,
"author_profile": "https://Stackoverflow.com/users/302103",
"pm_score": 6,
"selected": false,
"text": "ctrl-k"
},
{
"answer_id": 5512631,
"author": "Chao",
"author_id": 300996,
"author_profile... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1923/"
] |
191,482 | <p>I'm trying to build a similar 'slider' as demoed here <a href="http://ui.jquery.com/repository/real-world/product-slider/" rel="nofollow noreferrer">http://ui.jquery.com/repository/real-world/product-slider/</a> but I'm trying to use interior divs inside of the list items (<code><li></code>). it seems as if this demo breaks if you're not using an image or block element (<code><p></code>,<code><div></code>,etc.)</p>
<p>Anyone have any quick solutions to this? I basically want to use text and possibly images inside of a <code><div></code> instead of using images.</p>
<p>I did find jCarousel which seems as if it works, but I was looking for something a little more lightweight? Any ideas?</p>
| [
{
"answer_id": 196871,
"author": "Rudi",
"author_id": 22830,
"author_profile": "https://Stackoverflow.com/users/22830",
"pm_score": 2,
"selected": false,
"text": " <div class=\"sliderGallery\">\n <div class=\"div-that-gets-cropped\">\n <div class=\"text-and-ima... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8534/"
] |
191,483 | <p>I want to check the login status of a user through an ajax request. Depending wether the user is logged in I want to display either the username/password input or the username. Currently the request is sent on body.onload and a prgoress indicator is shown until the response arrives. Is there a better way?</p>
<hr>
<p>Let's assume that the requirements state that there should be no direct server side processing.</p>
| [
{
"answer_id": 191516,
"author": "Neall",
"author_id": 619,
"author_profile": "https://Stackoverflow.com/users/619",
"pm_score": 0,
"selected": false,
"text": "$(document).ready(function() {\n // The DOM is fully loaded now, but images might still be loading.\n});\n"
},
{
"answe... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2133/"
] |
191,490 | <p>I want to display the results of a searchquery in a website with a title and a short description. The short description should be a small part of the page which holds the searchterm. What i want to do is:
1 strip tags in page
2 find first position of seachterm
3 from that position, going back find the beginning (if there is one) of that sentence.
4 Start at the found position in step 3 and display ie 200 characters from there</p>
<p>I need some help with step 3. I think i need an regex that finds the first capital or dot...</p>
| [
{
"answer_id": 191543,
"author": "acrosman",
"author_id": 24215,
"author_profile": "https://Stackoverflow.com/users/24215",
"pm_score": 1,
"selected": false,
"text": "$offset = stripos( strrev(substr($string, $searchlocation)), '.');\n$startloc = $searchlocation - $offset;\n$finalstring ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21238/"
] |
191,493 | <p>I often need to design a dialog in Delphi/C++Builder that allows various properties of an object to be modified, and the code to use it typically looks like this.</p>
<pre><code>Dialog.Edit1.Text := MyObject.Username;
Dialog.Edit2.Text := MyObject.Password;
// ... many more of the same
if (Dialog.ShowModal = mrOk)
begin
MyObject.Username := Dialog.Edit1.Text;
MyObject.Password := Dialog.Edit2.Text;
// ... again, many more of the same
end;
</code></pre>
<p>I also often need similar code for marshalling objects to/from xml/ini-files/whatever.</p>
<p>Are there any common idioms or techniques for avoiding this kind of simple but repetitive code?</p>
| [
{
"answer_id": 191610,
"author": "akalenuk",
"author_id": 25459,
"author_profile": "https://Stackoverflow.com/users/25459",
"pm_score": 0,
"selected": false,
"text": "if (Dialog.ShowModal = mrOk) \nbegin\n with MyObject do\n begin\n Username := Dialog.Edit1.Text;\n Password := Di... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1737/"
] |
191,503 | <p>I'm using the following code to loop through a directory to print out the names of the files. However, not all of the files are displayed. I have tried using <strong>clearstatcache</strong> with no effect.</p>
<pre><code> $str = '';
$ignore = array('.', '..');
$dh = @opendir( $path );
if ($dh === FALSE)
{
// error
}
$file = readdir( $dh );
while( $file !== FALSE )
{
if (in_array($file, $ignore, TRUE)) { break; }
$str .= $file."\n";
$file = readdir( $dh );
}
</code></pre>
<p>Here's the contents of the directory right now:</p>
<pre><code>root.auth test1.auth test2.auth test3.auth test5.auth
</code></pre>
<p>However, test5.auth does not appear. If I rename it to test4.auth it does not appear. If I rename it to test6.auth it <strong>does</strong> appear. This is reliable behaviour - I can rename it several times and it still won't show up unless I rename it to test6.auth.</p>
<p>What on earth could be happening?</p>
<p>I'm running Arch Linux (kernel 2.6.26-ARCH) with PHP Version 5.2.6 and Apache/2.2.9 with Suhosin-Patch. My filesystem is ext3 and I'm running fam 2.6.10.</p>
| [
{
"answer_id": 191535,
"author": "Jacco",
"author_id": 22674,
"author_profile": "https://Stackoverflow.com/users/22674",
"pm_score": 2,
"selected": true,
"text": "break"
},
{
"answer_id": 191545,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackov... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/840/"
] |
191,528 | <p>I found this:</p>
<p><a href="http://www.evolt.org/failover-database-connection-with-php-mysql" rel="nofollow noreferrer">http://www.evolt.org/failover-database-connection-with-php-mysql</a></p>
<p>and similar examples. But is there a better way?</p>
<p>I am thinking along the lines of the <a href="http://www.microsoft.com/technet/prodtechnol/sql/bestpractice/implappfailover.mspx#EMD" rel="nofollow noreferrer">Automatic Failover Client</a> in the MS SQL Native Client.</p>
| [
{
"answer_id": 191581,
"author": "Till",
"author_id": 2859,
"author_profile": "https://Stackoverflow.com/users/2859",
"pm_score": 2,
"selected": false,
"text": "if (fails) { connect to another }"
},
{
"answer_id": 191835,
"author": "Toxygene",
"author_id": 8428,
"auth... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/419/"
] |
191,536 | <p>I've seen a fair share of ungainly XML->JSON code on the web, and having interacted with Stack's users for a bit, I'm convinced that this crowd can help more than the first few pages of Google results can.</p>
<p>So, we're parsing a weather feed, and we need to populate weather widgets on a multitude of web sites. We're looking now into Python-based solutions.</p>
<p>This public <a href="http://rss.weather.com/weather/rss/local/14607?cm_ven=LWO&cm_cat=rss&par=LWO_rss" rel="noreferrer">weather.com RSS feed</a> is a good example of what we'd be parsing (<em>our actual weather.com feed contains additional information because of a partnership w/them</em>).</p>
<p>In a nutshell, how should we convert XML to JSON using Python?</p>
| [
{
"answer_id": 191617,
"author": "Dan Lenski",
"author_id": 20789,
"author_profile": "https://Stackoverflow.com/users/20789",
"pm_score": 7,
"selected": true,
"text": "json"
},
{
"answer_id": 3884849,
"author": "pykler",
"author_id": 469480,
"author_profile": "https:/... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191536",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22491/"
] |
191,549 | <p>We have a custom collection of objects that we bind to a listbox control. When an item is added to the list the item appears in the listbox, however when one selects the item the currency manager position will not go to the position. Instead the currency manager position stays at the existing position. The listbox item is high lighted as long as the mouse is press however the cm never changes position.</p>
<p>If I copy one of the collection objects the listbox operates properly.</p>
<p>One additional note the collection also has collections within it, not sure if this would be an issue.</p>
| [
{
"answer_id": 191639,
"author": "Joel B Fant",
"author_id": 22211,
"author_profile": "https://Stackoverflow.com/users/22211",
"pm_score": 0,
"selected": false,
"text": "ListBox"
},
{
"answer_id": 191643,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile":... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7950/"
] |
191,592 | <p>I'm working on a simple 2D game engine in Java, and having no trouble with FSEM, buffer strategies, and so on; my issue is with the mouse cursor. In windowed mode, I can hide the mouse cursor, no problem, by using setCursor() from my JFrame to set a wholly-transparent cursor. However, after a call to device.setFullScreenWindow(this) to go into FSEM, the mouse cursor comes back, and subsequent calls to setCursor() to set it back to my blank cursor have no effect. Calling device.setFullScreenWindow(null) allows me to get rid of the cursor again - it's only while I'm in FSEM that I can't get rid of it.</p>
<p>I'm working under JDK 6, target platform is JDK 5+.</p>
<p><strong>UPDATE:</strong> I've done some more testing, and it looks like this issue occurs under MacOS X 10.5 w/Java 6u7, but not under Windows XP SP3 with Java 6u7. So, it could possibly be a bug in the Mac version of the JVM.</p>
| [
{
"answer_id": 192829,
"author": "seisyll",
"author_id": 21815,
"author_profile": "https://Stackoverflow.com/users/21815",
"pm_score": 0,
"selected": false,
"text": " Toolkit toolkit = Toolkit.getDefaultToolkit();\n Dimension dim = toolkit.getBestCursorSize(1,1);\n transCursor = toolkit.... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7426/"
] |
191,609 | <p>Where would you write an error log file, say <code>ErrorLog.txt</code>, in Windows? Keep in mind the path would need to be open to basic users for file write permissions.</p>
<p>I know the eventlog is a possible location for writing errors, but does it work for "user" level permissions?</p>
<p>EDIT: I am targeting Windows 2003, but I was posing the question in such a way as to have a "General Guideline" for where to write error logs.<br>
As for the EventLog, I have had issues before in an ASP.NET application where I wanted to log to the Windows event log, but I had security issues causing me heartache. (I do not recall the issues I had, but remember having them.)</p>
| [
{
"answer_id": 191625,
"author": "Lou Franco",
"author_id": 3937,
"author_profile": "https://Stackoverflow.com/users/3937",
"pm_score": 5,
"selected": true,
"text": "Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)\n"
},
{
"answer_id": 191667,
"author... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1048/"
] |
191,614 | <p>We have a fairly large code base, 400K LOC of C++, and code duplication is something of a problem. Are there any tools which can effectively detect duplicated blocks of code?</p>
<p>Ideally this would be something that developers could use during development rather than just run occasionally to see where the problems are. It would also be nice if we could integrate such a tool with CruiseControl to give a report after each check in. </p>
<p>I had a look at <a href="http://www.iam.unibe.ch/~scg/Research/Duploc/index.html" rel="noreferrer">Duploc</a> some time ago, it showed a nice graph but requires a smalltalk environment to use it, which makes running it automatically rather difficult.</p>
<p>Free tools would be nice, but if there are some good commercial tools I would also be interested.</p>
| [
{
"answer_id": 314808,
"author": "user39039",
"author_id": 39039,
"author_profile": "https://Stackoverflow.com/users/39039",
"pm_score": 4,
"selected": false,
"text": "<project name=\"duplicatecheck\" default=\"cpd\">\n\n<property name=\"files.dir\" value=\"dir containing your sources\"/... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5022/"
] |
191,640 | <p>I wish to search a database table on a nullable column. Sometimes the value I'm search for is itself NULL. Since Null is equal to nothing, even NULL, saying</p>
<pre><code>where MYCOLUMN=SEARCHVALUE
</code></pre>
<p>will fail. Right now I have to resort to</p>
<pre><code>where ((MYCOLUMN=SEARCHVALUE) OR (MYCOLUMN is NULL and SEARCHVALUE is NULL))
</code></pre>
<p>Is there a simpler way of saying that?</p>
<p>(I'm using Oracle if that matters)</p>
| [
{
"answer_id": 191646,
"author": "DCookie",
"author_id": 8670,
"author_profile": "https://Stackoverflow.com/users/8670",
"pm_score": 2,
"selected": false,
"text": "WHERE NVL(mycolumn,'NULL') = NVL(searchvalue,'NULL')\n"
},
{
"answer_id": 191648,
"author": "JosephStyons",
... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12725/"
] |
191,641 | <p>I am attempting to have a ReportHandler service to handle report creation. Reports can have multiple, differing number of parameters that could be set. In the system currently there are several different methods of creating reports (MS reporting services, html reports, etc) and the way the data is generated for each report is different. I am trying to consolidate everything into ActiveReports. I can't alter the system and change the parameters, so in some cases I will essentially get a where clause to generate the results, and in another case I will get key/value pairs that I must use to generate the results. I thought about using the factory pattern, but because of the different number of query filters this won't work. </p>
<p>I would love to have a single ReportHandler that would take my varied inputs and spit out report. At this point I'm not seeing any other way than to use a big switch statement to handle each report based on the reportName. Any suggestions how I could solve this better?</p>
| [
{
"answer_id": 194062,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "public class ReportContainer{\n public ReportContainer ( IReportEngine reportEngine, IStorageEngine storage, IDeliver... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24908/"
] |
191,642 | <p>I'm architecting a new app at the moment, with a high read:write ratio. At my current employer we have lots of denormalised data on our tables for performance reasons. Is it better practice to have totally 3NF tables and then use indexed views to do all the denormalisation? Should I run queries against the tables or views?</p>
<p>An example of some of the things I am interested are aggregates of columns child tables (e.g. having user post count stored somewhere).</p>
| [
{
"answer_id": 194062,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "public class ReportContainer{\n public ReportContainer ( IReportEngine reportEngine, IStorageEngine storage, IDeliver... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2086/"
] |
191,644 | <p>I've googled around a bit, but maybe I didn't put the correct magik incantation into the search box. </p>
<p>Does anyone know how to get output parameters from a stored procedure in Python? I'm using pymssql to call a stored procedure, and I'm not sure of the correct syntax to get the output parameter back. I don't think I can use any other db modules since I'm running this from a Linux box to connect to a mssql database on a MS Server.</p>
<pre><code>import pymssql
con = pymssql.connect(host='xxxxx',user='xxxx',password='xxxxx',database='xxxxx')
cur = con.cursor()
query = "EXECUTE blah blah blah"
cur.execute(query)
con.commit()
con.close()
</code></pre>
| [
{
"answer_id": 192032,
"author": "Milen A. Radev",
"author_id": 15785,
"author_profile": "https://Stackoverflow.com/users/15785",
"pm_score": 2,
"selected": false,
"text": "cur.callproc('my_stored_proc', (first_param, second_param, an_out_param))\n"
},
{
"answer_id": 198358,
... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13380/"
] |
191,652 | <p>I work a lot with serial communications with a variety of devices, and so I often have to analyze hex dumps in log files. Currently, I do this manually by looking at the dumps, looking at the protocol spec, and writing down the results. However, this is tedious and error-prone, especially whem messages contain hundreds of bytes and contain mixtures of big-endian and little-endian data, ASCII, Unicode, compression, CRCs, . . . .</p>
<p>I have written a few Python scripts to assist with the more common cases. But there are lots of protocols to deal with, and it doesn't make sense to spend the time writing a custom script unless I know I'll have a lot of dumps to analyze.</p>
<p>What I'd like is some sort of utility that can automate this activity. So, for example, if I have a textual hex dump like this:</p>
<pre><code>7e ff 00 7b 00 13 86 04
00 41 42 43 44 56 ef 7e
</code></pre>
<p>and some sort of description of the message format, like this:</p>
<pre><code># Field Size Byte Order Output Format
Flag 1 hex
Address 1 hex
Control 1 hex
DataType 1 decimal
LineIndex 1 decimal
PollAddress 2 msb hex
DataSize 2 lsb decimal
Data (DataSize) ascii
CRC 2 lsb hex
Flag 1 hex
</code></pre>
<p>I'd get output like this:</p>
<pre><code>Flag 0x7e
Address 0xff
Control 0x00
DataType 123
LineIndex 0
PollAddress 0x1386
DataSize 4
Data "ABCD"
CRC 0xef56
Flag 0x7e
</code></pre>
<p>Hardware-based protocol analyzers often have fancy features for doing this kind of thing, but I need to work with textual log files.</p>
<p>Does any such utility or library exist?</p>
<hr>
<p>Some good answers have come up since I set up the bounty. I guess bounties work!</p>
<p>Wireshark and HexEdit both look promising; I'll take a look at those, and will proabably award the bounty to whichever one suits my needs. But I'm still open to other ideas.</p>
| [
{
"answer_id": 519616,
"author": "Zac Thompson",
"author_id": 58549,
"author_profile": "https://Stackoverflow.com/users/58549",
"pm_score": 1,
"selected": false,
"text": "bash$ tclsh\n% binary scan [binary format H* 7eff007b00138604004142434456ef7e] \\\n H2H2H2ccH4sa4h4H2 \\\n flag1 ad... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1175/"
] |
191,690 | <p>I have a table, we'll call <code>Users</code>. This table has a single primary key defined in SQL Server - an autoincrement <code>int ID</code>.</p>
<p>Sometimes, my LINQ queries against this table fail with an <code>"Index was outside the range"</code> error - even the most simplest of queries. The query itself doesn't use any indexers.</p>
<p>For example: </p>
<pre><code>User = Users.Take(1);
</code></pre>
<p>or</p>
<pre><code>IEnumerable<Users> = Users.ToList();
</code></pre>
<p>Both of the queries threw the same error. Using the debugger Visualizer to look at the generated query - I copy and paste the query in SQL and it works fine. I also click "execute" on the visualizer and it works fine. But executing the code by itself throws this error. I don't implement any of the partial methods on the class, so nothing is happening there. If I restart my debugger, the problem goes away, only to rear it's head again randomly a few hours later. More critically, I see this bug in my error logs from the app running in production. </p>
<p>I do a ton of LINQ in my app, against a dozen or so different entities in my database, but I only see this problem on queries related to a specific entity in my table. Some googling has suggested that this problem might be related to an incorrect relationship specified between my model and another entity, but I don't have <em>any</em> relationships with this object. It seems to be working 95% of the time, it's just the other 5% that fail.</p>
<p>I have completely deleted the object from the designer, and re-added it from a "refreshed" server browser, and that did not fix the problem.</p>
<p>Any ideas what's going on here?</p>
<p>Here's the full error message and stack trace:</p>
<blockquote>
<p>Index was out of range. Must be non-negative and less than the size of
the collection. Parameter name: index at
System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query,
QueryInfo queryInfo, IObjectReaderFactory factory, Object[]
parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object
lastResult) at
System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query,
QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[]
userArguments, ICompiledSubQuery[] subQueries) at
System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression
query) at
System.Data.Linq.Table<code>1.System.Linq.IQueryProvider.Execute[TResult](Expression
expression) at
System.Linq.Queryable.FirstOrDefault[TSource](IQueryable</code>1 source,
Expression`1 predicate) at MyProject.FindUserByType(String typeId)</p>
</blockquote>
<p>EDIT: As requested, below is a copy of the table schema.</p>
<pre><code>CREATE TABLE [dbo].[Container](
[ID] [int] IDENTITY(1,1) NOT NULL,
[MarketCode] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Description] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Capacity] [int] NOT NULL,
[Volume] [float] NOT NULL
CONSTRAINT [PK_Container] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
</code></pre>
<p>EDIT: The stack trace shows <code>FirstOrDefault</code>, but I duplicated the error using both <code>Take()</code> and <code>ToList()</code>. The stack trace is identical between all of these, simply interchangnig <code>FirstOrDefault/Take/ToList</code>. The move down the stack to <code>SqlProvider.Execute</code> is in fact identical. </p>
| [
{
"answer_id": 35437037,
"author": "Nick Niebling",
"author_id": 1095493,
"author_profile": "https://Stackoverflow.com/users/1095493",
"pm_score": 0,
"selected": false,
"text": "using(var ctx = new LinqDataContext())\n{\n List<Task> tasks = new List<Task>();\n for(int i=0;i<1000;i+... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17803/"
] |
191,691 | <p>I have come across numerous arguments against the inclusion of multiple inheritance in C#, some of which include (philosophical arguments aside):</p>
<ul>
<li>Multiple inheritance is too complicated and often ambiguous</li>
<li>It is unnecessary because interfaces provide something similar</li>
<li>Composition is a good substitute where interfaces are inappropriate</li>
</ul>
<p>I come from a C++ background and miss the power and elegance of multiple inheritance. Although it is not suited to all software designs there are situations where it is difficult to deny it's utility over interfaces, composition and similar OO techniques.</p>
<p>Is the exclusion of multiple inheritance saying that developers are not smart enough to use them wisely and are incapable of addressing the complexities when they arise?</p>
<p>I personally would welcome the introduction of multiple inheritance into C# (perhaps C##).</p>
<hr>
<p><strong>Addendum</strong>: I would be interested to know from the responses who comes from a single (or procedural background) versus a multiple inheritance background. I have often found that developers who have no experience with multiple inheritance will often default to the multiple-inheritance-is-unnecessary argument simply because they do not have any experience with the paradigm.</p>
| [
{
"answer_id": 191738,
"author": "Chris Cudmore",
"author_id": 18907,
"author_profile": "https://Stackoverflow.com/users/18907",
"pm_score": 5,
"selected": false,
"text": "class foo : bar, baz\n"
},
{
"answer_id": 192179,
"author": "Qwertie",
"author_id": 22820,
"auth... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191691",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199234/"
] |
191,692 | <p>Is there a method to get all of the .aspx files in my website? Maybe iterate through the site's file structure and add to an array?</p>
| [
{
"answer_id": 191702,
"author": "Shawn Miller",
"author_id": 247,
"author_profile": "https://Stackoverflow.com/users/247",
"pm_score": 4,
"selected": true,
"text": "Directory.GetFiles(HttpContext.Current.Server.MapPath(@\"/\"), \"*.aspx\", SearchOption.AllDirectories);\n"
}
] | 2008/10/10 | [
"https://Stackoverflow.com/questions/191692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25515/"
] |
191,704 | <p>I want to use regular expressions (Perl compatible) to be able to find a pattern surrounded by two other patterns, but not include the strings matching the surrounding patterns in the match.</p>
<p>For example, I want to be able to find occurrences of strings like:</p>
<blockquote>
<p>Foo Bar Baz</p>
</blockquote>
<p>But only have the match include the middle part:</p>
<blockquote>
<p>Bar</p>
</blockquote>
<p>I know this is possible, but I can't remember how to do it.</p>
| [
{
"answer_id": 191724,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 3,
"selected": false,
"text": "\"Foo (Bar) Baz\"\n"
},
{
"answer_id": 191727,
"author": "Tomalak",
"author_id": 18771,
"author_... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4849/"
] |
191,732 | <p>I'm passing /file:c:\myfile.doc and I'm getting back "/file:c:\myfile.doc" instead of "C:\myfile.doc", could someone please advise where I am going wrong?</p>
<pre><code> if (entry.ToUpper().IndexOf("FILE") != -1)
{
//override default log location
MyFileLocation = entry.Split(new char[] {'='})[1];
}
</code></pre>
| [
{
"answer_id": 191743,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 3,
"selected": false,
"text": " if (entry.ToUpper().IndexOf(\"FILE:\") == 0)\n {\n //override default log location\n MyFileLocat... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
191,740 | <p>I'm using SqlServer for the first time, and in every single one of our create procedure scripts there is a block of code like below to remove the procedure if it already exists:</p>
<pre><code>IF EXISTS (SELECT *
FROM information_schema.routines
WHERE routine_name = 'SomeProcedureName'
AND routine_type = 'PROCEDURE'
BEGIN
DROP PROCEDURE SomeProcedureName
END
//then the procedure definition
</code></pre>
<p>To stop cutting and pasting this boilerplate code in every file I would like to put this code in its own stored procedure so that instead the scripts would look like this:</p>
<pre><code>DropIfRequired('SomeProcedureName')
//then the procedure definition
</code></pre>
<p>My attempt at a solution is:</p>
<pre><code>CREATE PROCEDURE DropIfRequired
(
@procedureName varchar
)
AS
IF EXISTS (SELECT * FROM information_schema.routines
WHERE routine_name = @procedureName
AND routine_type = 'PROCEDURE')
BEGIN
DROP PROCEDURE @procedureName
END
</code></pre>
<p>But I then get the following error:</p>
<p>Msg 102, Level 15, State 1, Procedure DeleteProcedure, Line 10
Incorrect syntax near '@procedureName'.</p>
<p>Any ideas how to do what I want?</p>
| [
{
"answer_id": 191753,
"author": "StingyJack",
"author_id": 16391,
"author_profile": "https://Stackoverflow.com/users/16391",
"pm_score": 2,
"selected": false,
"text": "EXEC( 'DROP PROCEDURE ''' + @procName + '''') ( all single quotes)\n"
},
{
"answer_id": 191793,
"author": "... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24063/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.