qid
int64
4
8.14M
question
stringlengths
20
48.3k
answers
list
date
stringlengths
10
10
metadata
list
input
stringlengths
12
45k
output
stringlengths
2
31.8k
92,258
<p>With my multiproject pom I get an error while running release:prepare. There is nothing fancy about the project setup and every release-step before runs fine. The error I get is:</p> <pre> [INFO] ------------------------------------------------------------------------ [ERROR] BUILD FAILURE [INFO] ------...
[ { "answer_id": 92330, "author": "Roland Schneider", "author_id": 16515, "author_profile": "https://Stackoverflow.com/users/16515", "pm_score": 0, "selected": false, "text": "<p>As far as I know it is a bug in Subversion 1.5 and not directly related with maven. However a workaround the fi...
2008/09/18
[ "https://Stackoverflow.com/questions/92258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16515/" ]
With my multiproject pom I get an error while running release:prepare. There is nothing fancy about the project setup and every release-step before runs fine. The error I get is: ``` [INFO] ------------------------------------------------------------------------ [ERROR] BUILD FAILURE [INFO] --------------...
This issue is addressed in the latest version of the [maven-release-plugin](http://maven.apache.org/plugins/maven-release-plugin/). Add this to your POM to pull it in. ``` <build> <pluginManagement> <plugins> <plugin> <artifactId>maven-release-plugin</artifactId> <version>2.0-beta-9</versio...
92,287
<p>I am trying to write a C# client to a server that is written in Java. The server expects a 4 byte (DataInputStread readInt() in Java) message header followed by the actual message.</p> <p>I am absolutely new to C#, how can I send this message header over to the Java Server? I tried it several ways (mostly trial and...
[ { "answer_id": 92309, "author": "workmad3", "author_id": 16035, "author_profile": "https://Stackoverflow.com/users/16035", "pm_score": 2, "selected": false, "text": "<p>It's simple, but have you checked endianness? It could easily be a mismatch between the endianness you have sent the da...
2008/09/18
[ "https://Stackoverflow.com/questions/92287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am trying to write a C# client to a server that is written in Java. The server expects a 4 byte (DataInputStread readInt() in Java) message header followed by the actual message. I am absolutely new to C#, how can I send this message header over to the Java Server? I tried it several ways (mostly trial and error wit...
It is, as other posters have pointed out, down to endianness. The Java [DataInputStream](http://java.sun.com/j2se/1.4.2/docs/api/java/io/DataInputStream.html) expects the data to be [big-endian](http://en.wikipedia.org/wiki/Endianness) (network byte order). Judging from the Mono documentation (for equivalents like [Bi...
92,328
<p>Within an event, I'd like to put the focus on a specific TextBox within the ListViewItem's template. The XAML looks like this:</p> <pre><code>&lt;ListView x:Name="myList" ItemsSource="{Binding SomeList}"&gt; &lt;ListView.View&gt; &lt;GridView&gt; &lt;GridViewColumn&gt; &lt;Gr...
[ { "answer_id": 92765, "author": "Abe Heidebrecht", "author_id": 9268, "author_profile": "https://Stackoverflow.com/users/9268", "pm_score": 4, "selected": false, "text": "<p>As others have noted, The myBox TextBox can not be found by calling FindName on the ListView. However, you can ge...
2008/09/18
[ "https://Stackoverflow.com/questions/92328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4918/" ]
Within an event, I'd like to put the focus on a specific TextBox within the ListViewItem's template. The XAML looks like this: ``` <ListView x:Name="myList" ItemsSource="{Binding SomeList}"> <ListView.View> <GridView> <GridViewColumn> <GridViewColumn.CellTemplate> ...
To understand why `ContainerFromItem` didn't work for me, here some background. The event handler where I needed this functionality looks like this: ``` var item = new SomeListItem(); SomeList.Add(item); ListViewItem = SomeList.ItemContainerGenerator.ContainerFromItem(item); // returns null ``` After the `Add()` the...
92,362
<p><strong>Has anyone found a way to run Selenium RC / Selenium Grid tests, written in C# in parallel?</strong></p> <p>I've currently got a sizable test suite written using Selenium RC's C# driver. Running the entire test suite takes a little over an hour to complete. I normally don't have to run the entire suite so i...
[ { "answer_id": 96318, "author": "Jeff Martin", "author_id": 13100, "author_profile": "https://Stackoverflow.com/users/13100", "pm_score": 0, "selected": false, "text": "<p>I don't know if no answer counts as an answer but I'd say you have researched everything and you really came up with...
2008/09/18
[ "https://Stackoverflow.com/questions/92362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6112/" ]
**Has anyone found a way to run Selenium RC / Selenium Grid tests, written in C# in parallel?** I've currently got a sizable test suite written using Selenium RC's C# driver. Running the entire test suite takes a little over an hour to complete. I normally don't have to run the entire suite so it hasn't been a concern...
I am working on this very thing and have found [Gallio](http://www.gallio.org/) latest can drive mbUnit tests in parallel. You can drive them against a single [Selenium Grid](http://selenium-grid.seleniumhq.org/) hub, which can have several remote control servers listening. I'm using the [latest nightly from Gallio](...
92,376
<p>Is there any way that I can programmatically create (and I guess access) hidden folders on a storage device from within c#?</p>
[ { "answer_id": 92397, "author": "Tom Ritter", "author_id": 8435, "author_profile": "https://Stackoverflow.com/users/8435", "pm_score": 8, "selected": true, "text": "<pre><code>using System.IO; \n\nstring path = @\"c:\\folders\\newfolder\"; // or whatever \nif (!Directory.Exists(path)) \n...
2008/09/18
[ "https://Stackoverflow.com/questions/92376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1816/" ]
Is there any way that I can programmatically create (and I guess access) hidden folders on a storage device from within c#?
``` using System.IO; string path = @"c:\folders\newfolder"; // or whatever if (!Directory.Exists(path)) { DirectoryInfo di = Directory.CreateDirectory(path); di.Attributes = FileAttributes.Directory | FileAttributes.Hidden; } ```
92,396
<p>I've always wondered this - why can't you declare variables after a case label in a switch statement? In C++ you can declare variables pretty much anywhere (and declaring them close to first use is obviously a good thing) but the following still won't work:</p> <pre><code>switch (val) { case VAL: // This w...
[ { "answer_id": 92408, "author": "Mark Ingram", "author_id": 986, "author_profile": "https://Stackoverflow.com/users/986", "pm_score": 5, "selected": false, "text": "<p>The whole switch statement is in the same scope. To get around it, do this:</p>\n\n<pre><code>switch (val)\n{\n case ...
2008/09/18
[ "https://Stackoverflow.com/questions/92396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9236/" ]
I've always wondered this - why can't you declare variables after a case label in a switch statement? In C++ you can declare variables pretty much anywhere (and declaring them close to first use is obviously a good thing) but the following still won't work: ``` switch (val) { case VAL: // This won't work int...
`Case` statements are only **labels**. This means the compiler will interpret this as a jump directly to the label. In C++, the problem here is one of scope. Your curly brackets define the scope as everything inside the `switch` statement. This means that you are left with a scope where a jump will be performed further...
92,413
<p>I have a SQL Server 2000, C# &amp; ASP.net web app. We want to control access to it by using Active Directory groups. I can get authentication to work if the group I put in is a 'Global' but not if the group is 'Universal'. </p> <p>How can I make this work with 'Universal' groups an well? Here's my authorization...
[ { "answer_id": 92919, "author": "jliszka", "author_id": 9767, "author_profile": "https://Stackoverflow.com/users/9767", "pm_score": 1, "selected": false, "text": "<p>Depending on your Active Directory topology, you might have to wait for the Universal Group membership to replicate around...
2008/09/18
[ "https://Stackoverflow.com/questions/92413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/730/" ]
I have a SQL Server 2000, C# & ASP.net web app. We want to control access to it by using Active Directory groups. I can get authentication to work if the group I put in is a 'Global' but not if the group is 'Universal'. How can I make this work with 'Universal' groups an well? Here's my authorization block: ``` <a...
Turns out I needed to use the "Pre Win2000" id not the regular one.
92,427
<p>Based on a simple test I ran, I don't think it's possible to put an inline &lt;style&gt; tag into an ASP.NET server control. The style did not end up rendering to the output HTML. Even if it was possible, I'm sure it is bad practice to do this.</p> <p>Is it possible to do this? I can see it being useful for quick...
[ { "answer_id": 92444, "author": "Vaibhav", "author_id": 380, "author_profile": "https://Stackoverflow.com/users/380", "pm_score": 1, "selected": false, "text": "<p>I think you will have to add it as an attribute to the server control... for it to render to HTML.</p>\n\n<p>So basically (i...
2008/09/18
[ "https://Stackoverflow.com/questions/92427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2470/" ]
Based on a simple test I ran, I don't think it's possible to put an inline <style> tag into an ASP.NET server control. The style did not end up rendering to the output HTML. Even if it was possible, I'm sure it is bad practice to do this. Is it possible to do this? I can see it being useful for quick prototypes that j...
According to [www.w3schools.com](http://www.w3schools.com/TAGS/tag_style.asp): > > The style element goes in the head section. If you want to include a style sheet in your page, you should define the style sheet externally, and link to it using `<link>`. > > > So it's not a good idea to include style elements (e....
92,438
<p>I use to run</p> <pre><code>$s =~ s/[^[:print:]]//g; </code></pre> <p>on Perl to get rid of non printable characters. </p> <p>In Python there's no POSIX regex classes, and I can't write [:print:] having it mean what I want. I know of no way in Python to detect if a character is printable or not. </p> <p>What wou...
[ { "answer_id": 92441, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 2, "selected": false, "text": "<p>The best I've come up with now is (thanks to the python-izers above) </p>\n\n<pre><code>def filter_non_printable(s...
2008/09/18
[ "https://Stackoverflow.com/questions/92438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5190/" ]
I use to run ``` $s =~ s/[^[:print:]]//g; ``` on Perl to get rid of non printable characters. In Python there's no POSIX regex classes, and I can't write [:print:] having it mean what I want. I know of no way in Python to detect if a character is printable or not. What would you do? EDIT: It has to support Uni...
Iterating over strings is unfortunately rather slow in Python. Regular expressions are over an order of magnitude faster for this kind of thing. You just have to build the character class yourself. The *unicodedata* module is quite helpful for this, especially the *unicodedata.category()* function. See [Unicode Charact...
92,452
<p>I've been working on this for a few days now, and I've found several solutions but none of them incredibly simple or lightweight. The problem is basically this: We have a cluster of 10 machines, each of which is running the same software on a multithreaded ESB platform. I can deal with concurrency issues between t...
[ { "answer_id": 92521, "author": "Clinton Pierce", "author_id": 8173, "author_profile": "https://Stackoverflow.com/users/8173", "pm_score": -1, "selected": false, "text": "<p>Back in the day, we'd use a specific \"lock server\" on the network to handle this. Bleh.</p>\n\n<p>Your database...
2008/09/18
[ "https://Stackoverflow.com/questions/92452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7567/" ]
I've been working on this for a few days now, and I've found several solutions but none of them incredibly simple or lightweight. The problem is basically this: We have a cluster of 10 machines, each of which is running the same software on a multithreaded ESB platform. I can deal with concurrency issues between thread...
you might want to consider using [Hazelcast](http://www.hazelcast.com) distributed locks. Super lite and easy. ``` java.util.concurrent.locks.Lock lock = Hazelcast.getLock ("mymonitor"); lock.lock (); try { // do your stuff }finally { lock.unlock(); } ``` Hazelcast - Distributed Queue, Map, Set, List, Lock
92,456
<p>I have a legacy C++ module that offers encryption/decryption using the openssl library (DES encryption). I'm trying to translate that code into java, and I don't want to rely on a DLL, JNI, etc... C++ code looks like:</p> <pre><code>des_string_to_key(reinterpret_cast&lt;const char *&gt;(key1), &amp;initkey); des_st...
[ { "answer_id": 92547, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 0, "selected": false, "text": "<p>The algorithms should match; if you're getting different results it may have to do with the way you're handling the keys...
2008/09/18
[ "https://Stackoverflow.com/questions/92456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17647/" ]
I have a legacy C++ module that offers encryption/decryption using the openssl library (DES encryption). I'm trying to translate that code into java, and I don't want to rely on a DLL, JNI, etc... C++ code looks like: ``` des_string_to_key(reinterpret_cast<const char *>(key1), &initkey); des_string_to_key(reinterpret_...
I'm not an OpenSSL expert, but I'd guess the C++ code is using DES in CBC mode thus needing an IV (that's what the initKey probably is, and that's why you think you need two keys). If I'm right, you need to change your Java code to use DES in CBC mode too, then the Java code too will require an encryption key and an IV...
92,504
<p>I'm trying to create a self signed certificate for use with Apache Tomcat 6. Every certificate I can make always results in the browser connecting with AES-128. The customer would like me to demonstrate that I can create a connection at AES-256.</p> <p>I've tried java's keytool and openssl. I've tried with a var...
[ { "answer_id": 93095, "author": "delfuego", "author_id": 16414, "author_profile": "https://Stackoverflow.com/users/16414", "pm_score": 1, "selected": false, "text": "<p>danivo, so long as the server's cert is capable of AES encryption, the level of encryption between the browser and the ...
2008/09/18
[ "https://Stackoverflow.com/questions/92504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17583/" ]
I'm trying to create a self signed certificate for use with Apache Tomcat 6. Every certificate I can make always results in the browser connecting with AES-128. The customer would like me to demonstrate that I can create a connection at AES-256. I've tried java's keytool and openssl. I've tried with a variety of param...
Okie doke, I think I just figured this out. As I said above, the key bit of knowledge is that the cert doesn't matter, so long as it's generated with an algorithm that supports AES 256-bit encryption (e.g., RSA). Just to make sure that we're on the same page, for my testing, I generated my self-signed cert using the f...
92,514
<p>Is there any way to create a ODBC DSN with C#?</p> <p>Maybe a P/invoke?</p>
[ { "answer_id": 92538, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 1, "selected": false, "text": "<p>Following resources might be helpful:</p>\n\n<p>MSDN:</p>\n\n<p><a href=\"http://support.microsoft.com/kb/310988\" rel=\"nofol...
2008/09/18
[ "https://Stackoverflow.com/questions/92514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1098074/" ]
Is there any way to create a ODBC DSN with C#? Maybe a P/invoke?
You can use Registry classes to write the dsn info in the registry, under ``` HKLM\Software\ODBC\ODBC.INI\ODBC Data Sources ``` You'll need to check what values are needed for you ODBC driver.
92,522
<p>What is the best way to issue a http get in VB.net? I want to get the result of a request like <a href="http://api.hostip.info/?ip=68.180.206.184" rel="noreferrer">http://api.hostip.info/?ip=68.180.206.184</a> </p>
[ { "answer_id": 92529, "author": "Dario Solera", "author_id": 16026, "author_profile": "https://Stackoverflow.com/users/16026", "pm_score": 1, "selected": false, "text": "<p>You should try the <a href=\"http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx\" rel=\"nofollo...
2008/09/18
[ "https://Stackoverflow.com/questions/92522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4221/" ]
What is the best way to issue a http get in VB.net? I want to get the result of a request like <http://api.hostip.info/?ip=68.180.206.184>
In VB.NET: ``` Dim webClient As New System.Net.WebClient Dim result As String = webClient.DownloadString("http://api.hostip.info/?ip=68.180.206.184") ``` In C#: ``` System.Net.WebClient webClient = new System.Net.WebClient(); string result = webClient.DownloadString("http://api.hostip.info/?ip=68.180.206.184"); ``...
92,533
<p>Based on <a href="https://stackoverflow.com/questions/6209/split-a-string-ignoring-quoted-sections#6243">"Split a string by spaces in Python"</a>, which uses <em>shlex.split</em> to split a string with quotes smartly, I would be interested in hearing about other common tasks solved by non-obvious standard library fu...
[ { "answer_id": 92548, "author": "William Keller", "author_id": 17095, "author_profile": "https://Stackoverflow.com/users/17095", "pm_score": 2, "selected": false, "text": "<p>I found struct.unpack to be a godsend for unpacking binary data formats after I learned of it!</p>\n" }, { ...
2008/09/18
[ "https://Stackoverflow.com/questions/92533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15842/" ]
Based on ["Split a string by spaces in Python"](https://stackoverflow.com/questions/6209/split-a-string-ignoring-quoted-sections#6243), which uses *shlex.split* to split a string with quotes smartly, I would be interested in hearing about other common tasks solved by non-obvious standard library functions. If this tu...
I was quite surprised to learn that you could use the bisect module to do a very fast binary search in a sequence. It's documentation doesn't say anything about it: > > This module provides support for maintaining a list in sorted order without having to sort the list after each insertion. > > > The usage is very...
92,540
<p>In a WinForms 2.0 C# application, what is the typical method used for saving and restoring form position and size in an application?</p> <p>Related, is it possible to add new User scoped application settings AT RUNTIME? I totally see how to add settings at design time, that's not a problem. But what if I want to cre...
[ { "answer_id": 93211, "author": "Stormenet", "author_id": 2090, "author_profile": "https://Stackoverflow.com/users/2090", "pm_score": 0, "selected": false, "text": "<p>You could create a base form class with common functionality such as remembering the position and size and inherit from ...
2008/09/18
[ "https://Stackoverflow.com/questions/92540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
In a WinForms 2.0 C# application, what is the typical method used for saving and restoring form position and size in an application? Related, is it possible to add new User scoped application settings AT RUNTIME? I totally see how to add settings at design time, that's not a problem. But what if I want to create one a...
``` private void Form1_Load( object sender, EventArgs e ) { // restore location and size of the form on the desktop this.DesktopBounds = new Rectangle(Properties.Settings.Default.Location, Properties.Settings.Default.Size); // restore form's window state this.WindowState = ( FormWindowState ...
92,546
<p>When refactoring away some <code>#defines</code> I came across declarations similar to the following in a C++ header file:</p> <pre><code>static const unsigned int VAL = 42; const unsigned int ANOTHER_VAL = 37; </code></pre> <p>The question is, what difference, if any, will the static make? Note that multiple inc...
[ { "answer_id": 92568, "author": "Jim Buck", "author_id": 2666, "author_profile": "https://Stackoverflow.com/users/2666", "pm_score": 0, "selected": false, "text": "<p>Static prevents another compilation unit from externing that variable so that the compiler can just \"inline\" the variab...
2008/09/18
[ "https://Stackoverflow.com/questions/92546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9236/" ]
When refactoring away some `#defines` I came across declarations similar to the following in a C++ header file: ``` static const unsigned int VAL = 42; const unsigned int ANOTHER_VAL = 37; ``` The question is, what difference, if any, will the static make? Note that multiple inclusion of the headers isn't possible d...
The `static` means that there will be one copy of `VAL` created for each source file it is included in. But it also means that multiple inclusions will not result in multiple definitions of `VAL` that will collide at link time. In C, without the `static` you would need to ensure that only one source file defined `VAL` ...
92,613
<p>I have some code which is supposed to display a short message. Here's the pertinent code:</p> <pre><code>DATA SEGMENT 'DATA' MSG DB 0AH, 0DH, 'Hello, Adam', '$' CHAR DB 00H DATA ENDS CODE SEGMENT 'CODE' PRINT_MSG: MOV AH, 09H ;Command to print string of characters MOV DX, OFFSET MSG ;Mov addre...
[ { "answer_id": 92708, "author": "Nils Pipenbrinck", "author_id": 15955, "author_profile": "https://Stackoverflow.com/users/15955", "pm_score": 2, "selected": false, "text": "<p>My guess is that your DS does not point to your data-segment.</p>\n\n<p>Int21 Function 0x09 takes the string fr...
2008/09/18
[ "https://Stackoverflow.com/questions/92613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13790/" ]
I have some code which is supposed to display a short message. Here's the pertinent code: ``` DATA SEGMENT 'DATA' MSG DB 0AH, 0DH, 'Hello, Adam', '$' CHAR DB 00H DATA ENDS CODE SEGMENT 'CODE' PRINT_MSG: MOV AH, 09H ;Command to print string of characters MOV DX, OFFSET MSG ;Mov address of message i...
My guess is that your DS does not point to your data-segment. Int21 Function 0x09 takes the string from DS:DX. Remember that DX is only a 16 bit register. To access data outside the 16 bit range you have to use segment registers. These are called DS and ES for data, CS for code and SS for the stack (there are FS and ...
92,620
<p>I came back today to an old script I had for logging into Gmail via SSL. The script worked fine last time I ran it (several months ago) but now it dies immediately with:</p> <pre><code>&lt;urlopen error The read operation timed out&gt; </code></pre> <p>If I set the timeout (no matter how long), it dies even more i...
[ { "answer_id": 93401, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>www.google.com is not accessible by HTTPS. It redirects to insecure HTTP. To get to mail, you should be going go <a href=\...
2008/09/18
[ "https://Stackoverflow.com/questions/92620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4300/" ]
I came back today to an old script I had for logging into Gmail via SSL. The script worked fine last time I ran it (several months ago) but now it dies immediately with: ``` <urlopen error The read operation timed out> ``` If I set the timeout (no matter how long), it dies even more immediately with: ``` <urlopen e...
``` import socket socket.setdefaulttimeout(30000) sock = socket.socket() sock.connect(('www.google.com', 443)) ssl = socket.ssl(sock) ssl.server() --> '/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com' ``` It works just fine. I can't reproduce your error.
92,689
<p>I am writing a Composite control, which contains a listview to display a table of items. Normally when using a ListView in Asp.NET I would define the templates in the code-forward.</p> <pre><code>&lt;asp:ListView runat="server" ID="ArticleList"&gt; &lt;LayoutTemplate&gt; &lt;div class="ContentContainer"...
[ { "answer_id": 93348, "author": "paudirac", "author_id": 15554, "author_profile": "https://Stackoverflow.com/users/15554", "pm_score": 2, "selected": false, "text": "<p>Could this link be of some help? <a href=\"http://web.archive.org/web/20120414044008/http://iridescence.no/post/Using-T...
2008/09/18
[ "https://Stackoverflow.com/questions/92689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1837197/" ]
I am writing a Composite control, which contains a listview to display a table of items. Normally when using a ListView in Asp.NET I would define the templates in the code-forward. ``` <asp:ListView runat="server" ID="ArticleList"> <LayoutTemplate> <div class="ContentContainer"> <div runat="ser...
The trick is to subscribe to the databinding event of the itemplaceholder in the ItemTemplate. The complete solution: ``` public class FibonacciControl : CompositeControl { public FibonacciControl() { // .... } protected override void CreateChildControls() { base.CreateChildContr...
92,696
<p>I have a couple databases on a shared SQL Server 2005 cluster instance, that I would like performance metrics on. I have some processes that run for a very long time and suspect that code inefficiencies, rather than insufficient hardware are to blame.</p> <p>I would like some way to get these performance metrics so...
[ { "answer_id": 93348, "author": "paudirac", "author_id": 15554, "author_profile": "https://Stackoverflow.com/users/15554", "pm_score": 2, "selected": false, "text": "<p>Could this link be of some help? <a href=\"http://web.archive.org/web/20120414044008/http://iridescence.no/post/Using-T...
2008/09/18
[ "https://Stackoverflow.com/questions/92696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5885/" ]
I have a couple databases on a shared SQL Server 2005 cluster instance, that I would like performance metrics on. I have some processes that run for a very long time and suspect that code inefficiencies, rather than insufficient hardware are to blame. I would like some way to get these performance metrics so that I ca...
The trick is to subscribe to the databinding event of the itemplaceholder in the ItemTemplate. The complete solution: ``` public class FibonacciControl : CompositeControl { public FibonacciControl() { // .... } protected override void CreateChildControls() { base.CreateChildContr...
92,698
<p>I'm looking for an Access 2007 equivalent to SQL Server's COALESCE function.</p> <p>In SQL Server you could do something like:</p> <p><strong>Person</strong></p> <pre><code>John Steve Richard </code></pre> <p><strong>SQL</strong></p> <pre><code>DECLARE @PersonList nvarchar(1024) SELECT @PersonList = COALESCE(@P...
[ { "answer_id": 92878, "author": "Nick Craver", "author_id": 13249, "author_profile": "https://Stackoverflow.com/users/13249", "pm_score": 0, "selected": false, "text": "<p>I think Nz is what you're after, syntax is <code>Nz(variant, [if null value])</code>. Here's the documentation link:...
2008/09/18
[ "https://Stackoverflow.com/questions/92698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3742/" ]
I'm looking for an Access 2007 equivalent to SQL Server's COALESCE function. In SQL Server you could do something like: **Person** ``` John Steve Richard ``` **SQL** ``` DECLARE @PersonList nvarchar(1024) SELECT @PersonList = COALESCE(@PersonList + ',','') + Person FROM PersonTable PRINT @PersonList ``` Which ...
Here is a sample User Defined Function (UDF) and possible usage. Function: ``` Function Coalsce(strSQL As String, strDelim, ParamArray NameList() As Variant) Dim db As Database Dim rs As DAO.Recordset Dim strList As String Set db = CurrentDb If strSQL <> "" Then Set rs = db.OpenRecordset(strSQL) ...
92,699
<p>I have a table called OffDays, where weekends and holiday dates are kept. I have a table called LeadTime where amount of time (in days) for a product to be manufactured is stored. Finally I have a table called Order where a product and the order date is kept.</p> <p>Is it possible to query when a product will be ...
[ { "answer_id": 92722, "author": "Joel Martinez", "author_id": 5416, "author_profile": "https://Stackoverflow.com/users/5416", "pm_score": 1, "selected": false, "text": "<p>Just calculate it in application code ... much easier and you won't have to write a really ugly query in your sql</p...
2008/09/18
[ "https://Stackoverflow.com/questions/92699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2581/" ]
I have a table called OffDays, where weekends and holiday dates are kept. I have a table called LeadTime where amount of time (in days) for a product to be manufactured is stored. Finally I have a table called Order where a product and the order date is kept. Is it possible to query when a product will be finished man...
You can generate a table of working days in advance. ``` WDId | WDDate -----+----------- 4200 | 2008-01-08 4201 | 2008-01-09 4202 | 2008-01-12 4203 | 2008-01-13 4204 | 2008-01-16 4205 | 2008-01-17 ``` Then do a query such as ``` SELECT DeliveryDay.WDDate FROM WorkingDay OrderDay, WorkingDay DeliveryDay, LeadTime, O...
92,720
<p>I have a web page that includes a bunch of images. Sometimes the image isn't available, so a broken image is displayed in the client's browser.</p> <p>How do I use jQuery to get the set of images, filter it to broken images then replace the src?</p> <hr/> <p>--I thought it would be easier to do this with jQuery, ...
[ { "answer_id": 92819, "author": "Prestaul", "author_id": 5628, "author_profile": "https://Stackoverflow.com/users/5628", "pm_score": 11, "selected": true, "text": "<p>Handle the <code>onError</code> event for the image to reassign its source using JavaScript:</p>\n\n<pre><code>function i...
2008/09/18
[ "https://Stackoverflow.com/questions/92720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17702/" ]
I have a web page that includes a bunch of images. Sometimes the image isn't available, so a broken image is displayed in the client's browser. How do I use jQuery to get the set of images, filter it to broken images then replace the src? --- --I thought it would be easier to do this with jQuery, but it turned out m...
Handle the `onError` event for the image to reassign its source using JavaScript: ``` function imgError(image) { image.onerror = ""; image.src = "/images/noimage.gif"; return true; } ``` ``` <img src="image.png" onerror="imgError(this);"/> ``` Or without a JavaScript function: ``` <img src="image.png"...
92,781
<p>I'm looking to have text display vertically, first letter at the bottom, last letter at the top, within a JLabel. Is this possible?</p>
[ { "answer_id": 92805, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 3, "selected": false, "text": "<p>You can do it by messing with the paint command, sort of like this:</p>\n\n<pre><code>public class JVertLabel extends JC...
2008/09/18
[ "https://Stackoverflow.com/questions/92781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16538/" ]
I'm looking to have text display vertically, first letter at the bottom, last letter at the top, within a JLabel. Is this possible?
I found this page: <http://www.java2s.com/Tutorial/Java/0240__Swing/VerticalLabelUI.htm> when I needed to do that. I don't know if you want the letters 'standing' on each other or all rotated on their side. ``` /* * The contents of this file are subject to the Sapient Public License * Version 1.0 (the "License"); y...
92,792
<p>I have a user control which is loaded in the page dynamically using the following code in Init of the Page.</p> <pre><code>Dim oCtl As Object oCtl = LoadControl("~/Controls/UserControl1.ascx") oCtl.Id = "UserControl11" PlaceHolder1.Controls.Clear() PlaceHolder1.Controls.Add(oCtl) </code></pre> <p>The user control...
[ { "answer_id": 92810, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 1, "selected": false, "text": "<p>A few questions:</p>\n\n<ol>\n<li>At what point in the page lifecycle do you load the control?</li>\n<li>Where is th...
2008/09/18
[ "https://Stackoverflow.com/questions/92792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a user control which is loaded in the page dynamically using the following code in Init of the Page. ``` Dim oCtl As Object oCtl = LoadControl("~/Controls/UserControl1.ascx") oCtl.Id = "UserControl11" PlaceHolder1.Controls.Clear() PlaceHolder1.Controls.Add(oCtl) ``` The user control also contains a button an...
You have to ensure that the control exists on the page prior to .NET entering the "Postback event handling" step of the page lifecycle. Since the control is added dynamically you have to ensure that on every post back you recreate that control so that it can find the control to fire the event.
92,802
<p>I have a Bash shell script in which I would like to pause execution until the user presses a key. In DOS, this is easily accomplished with the <code>pause</code> command. Is there a Linux equivalent I can use in my script?</p>
[ { "answer_id": 92813, "author": "Jim", "author_id": 8427, "author_profile": "https://Stackoverflow.com/users/8427", "pm_score": 10, "selected": true, "text": "<p><code>read</code> does this:</p>\n\n<pre><code>user@host:~$ read -n1 -r -p \"Press any key to continue...\" key\n[...]\nuser@h...
2008/09/18
[ "https://Stackoverflow.com/questions/92802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4362/" ]
I have a Bash shell script in which I would like to pause execution until the user presses a key. In DOS, this is easily accomplished with the `pause` command. Is there a Linux equivalent I can use in my script?
`read` does this: ``` user@host:~$ read -n1 -r -p "Press any key to continue..." key [...] user@host:~$ ``` The `-n1` specifies that it only waits for a single character. The `-r` puts it into raw mode, which is necessary because otherwise, if you press something like backslash, it doesn't register until you hit th...
92,820
<pre><code>class A : IFoo { } ... A[] arrayOfA = new A[10]; if(arrayOfA is IFoo[]) { // this is not called } </code></pre> <p>Q1: Why is <code>arrayOfA</code> not an array of <code>IFoos</code>?</p> <p>Q2: Why can't I cast <code>arrayOfA</code> to <code>IFoo[]</code>?</p>
[ { "answer_id": 92856, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": -1, "selected": false, "text": "<p>You could try</p>\n\n<pre><code>if (arrayofA[0] is IFoo) {.....}\n</code></pre>\n\n<p>which sort of answers your q...
2008/09/18
[ "https://Stackoverflow.com/questions/92820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7529/" ]
``` class A : IFoo { } ... A[] arrayOfA = new A[10]; if(arrayOfA is IFoo[]) { // this is not called } ``` Q1: Why is `arrayOfA` not an array of `IFoos`? Q2: Why can't I cast `arrayOfA` to `IFoo[]`?
`arrayOfA` **is** `IFoo[]`. There must be something else wrong with your program. You seem to have mocked up some code to show the problem, but in fact your code (see below) works as you expect. Try updating this question with the real code - or as close to real as you can - and we can take another look. ``` using ...
92,841
<p>I am using CodeDom to generate dynamic code based on user values. One of those values controls what the name of the class I'm generating is. I know I could sterilize the name based on language rules about valid class names using regular expressions, but I'd like to know if there is a specific method built into the f...
[ { "answer_id": 92958, "author": "Zach", "author_id": 8720, "author_profile": "https://Stackoverflow.com/users/8720", "pm_score": 2, "selected": false, "text": "<p>I found an answer to my question. I can call</p>\n\n<pre><code>CodeCompiler.ValidateIdentifiers(class1);\n</code></pre>\n\n<p...
2008/09/18
[ "https://Stackoverflow.com/questions/92841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8720/" ]
I am using CodeDom to generate dynamic code based on user values. One of those values controls what the name of the class I'm generating is. I know I could sterilize the name based on language rules about valid class names using regular expressions, but I'd like to know if there is a specific method built into the fram...
An easy way to determine if a string is a valid identifier for a class or variable is to call the static method ``` System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(string value) ```
92,847
<p>How do I make an array shorter in Perl? I read some webpages indicating that I can assign:</p> <pre><code>$#ARRAY = 42; </code></pre> <p>I read that the use of $# is deprecated. I need a solution that will work for an array of arrays, too. This didn't work:</p> <pre><code>$#$ARRAY[$i] = 42; </code></pre>
[ { "answer_id": 92865, "author": "moonshadow", "author_id": 11834, "author_profile": "https://Stackoverflow.com/users/11834", "pm_score": 0, "selected": false, "text": "<p>$#{$ARRAY[$i]} = 42;</p>\n" }, { "answer_id": 92883, "author": "Leon Timmermans", "author_id": 4727, ...
2008/09/18
[ "https://Stackoverflow.com/questions/92847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4454/" ]
How do I make an array shorter in Perl? I read some webpages indicating that I can assign: ``` $#ARRAY = 42; ``` I read that the use of $# is deprecated. I need a solution that will work for an array of arrays, too. This didn't work: ``` $#$ARRAY[$i] = 42; ```
I'm not aware of assigning `$#ARRAY` being deprecated; `perldoc perldata` from 5.10.0 certainly says nothing about it. It is the fastest way to truncate an array. If you want something a little more readable, use `splice`: ``` splice @ARRAY, 43; ``` (Note `43` instead of `42` - `$#ARRAY` gets you the last index of ...
92,860
<p>What is best practises for communicating events from a usercontrol to parent control/page i want to do something similar to this:</p> <pre><code>MyPage.aspx: &lt;asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceholder" runat="server"&gt; &lt;uc1:MyUserControl ID="MyUserControl1" runat="server" ...
[ { "answer_id": 92930, "author": "Matias Nino", "author_id": 17235, "author_profile": "https://Stackoverflow.com/users/17235", "pm_score": 2, "selected": false, "text": "<p>1) Declare a Public event in the user control</p>\n\n<p>2) Issue a RaiseEvent where appropriate inside the user cont...
2008/09/18
[ "https://Stackoverflow.com/questions/92860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15555/" ]
What is best practises for communicating events from a usercontrol to parent control/page i want to do something similar to this: ``` MyPage.aspx: <asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceholder" runat="server"> <uc1:MyUserControl ID="MyUserControl1" runat="server" OnSomeEvent="MyUserCo...
You would want to create an event on the control that is subscribed to in the parent. See [OdeToCode](http://www.odetocode.com/code/94.aspx) for an example. Here is the article for longevity sake: Some user controls are entirely self contained, for example, a user control displaying current stock quotes does not need...
92,862
<p>In Ruby, like in many other OO programming languages, operators are overloadable. However, only certain character operators can be overloaded.</p> <p>This list may be incomplete but, here are some of the operators that cannot be overloaded: </p> <pre><code>!, not, &amp;&amp;, and, ||, or </code></pre>
[ { "answer_id": 92905, "author": "Farrel", "author_id": 7889, "author_profile": "https://Stackoverflow.com/users/7889", "pm_score": 5, "selected": true, "text": "<p>Methods are overloadable, those are part of the language syntax.</p>\n" }, { "answer_id": 92922, "author": "Joe ...
2008/09/18
[ "https://Stackoverflow.com/questions/92862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1167846/" ]
In Ruby, like in many other OO programming languages, operators are overloadable. However, only certain character operators can be overloaded. This list may be incomplete but, here are some of the operators that cannot be overloaded: ``` !, not, &&, and, ||, or ```
Methods are overloadable, those are part of the language syntax.
92,928
<p>In Python for *nix, does <code>time.sleep()</code> block the thread or the process?</p>
[ { "answer_id": 92953, "author": "finnw", "author_id": 12048, "author_profile": "https://Stackoverflow.com/users/12048", "pm_score": 5, "selected": false, "text": "<p>Just the thread.</p>\n" }, { "answer_id": 92986, "author": "Zach Burlingame", "author_id": 2233, "auth...
2008/09/18
[ "https://Stackoverflow.com/questions/92928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17732/" ]
In Python for \*nix, does `time.sleep()` block the thread or the process?
It blocks the thread. If you look in Modules/timemodule.c in the Python source, you'll see that in the call to `floatsleep()`, the substantive part of the sleep operation is wrapped in a Py\_BEGIN\_ALLOW\_THREADS and Py\_END\_ALLOW\_THREADS block, allowing other threads to continue to execute while the current one slee...
92,936
<p>I want to use small flex charts with just 3 labels, for example a chart over the past 2 hours , with 3 horizontal label, as shown below:</p> <pre><code> | | | 9:46 10:46 11:46 </code></pre> <p>(of course, there are more than 3 values to display!)</p> <p>I have been told this is not trivial...
[ { "answer_id": 104491, "author": "defmeta", "author_id": 10875, "author_profile": "https://Stackoverflow.com/users/10875", "pm_score": 2, "selected": false, "text": "<p>Take a look in the online <a href=\"http://livedocs.adobe.com/flex/3/langref/index.html\" rel=\"nofollow noreferrer\">F...
2008/09/18
[ "https://Stackoverflow.com/questions/92936", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to use small flex charts with just 3 labels, for example a chart over the past 2 hours , with 3 horizontal label, as shown below: ``` | | | 9:46 10:46 11:46 ``` (of course, there are more than 3 values to display!) I have been told this is not trivial, but how would you do it? Also...
Take a look in the online [Flex Language Guide](http://livedocs.adobe.com/flex/3/langref/index.html) at the [AxisRenderer](http://livedocs.adobe.com/flex/3/langref/mx/charts/AxisRenderer.html) class. It also has some helpful sample code and output.
92,971
<p>I'm trying to detect the size of the screen I'm starting emacs on, and adjust the size and position the window it is starting in (I guess that's the frame in emacs-speak) accordingly. I'm trying to set up my .emacs so that I always get a "reasonably-big" window with it's top-left corner near the top-left of my scree...
[ { "answer_id": 93005, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<pre><code>(setq initial-frame-alist\n (append '((width . 263) (height . 112) (top . -5) (left . 5) (font . \"4.System V...
2008/09/18
[ "https://Stackoverflow.com/questions/92971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6402/" ]
I'm trying to detect the size of the screen I'm starting emacs on, and adjust the size and position the window it is starting in (I guess that's the frame in emacs-speak) accordingly. I'm trying to set up my .emacs so that I always get a "reasonably-big" window with it's top-left corner near the top-left of my screen. ...
If you want to change the size according to resolution you can do something like this (adjusting the preferred width and resolutions according to your specific needs): ``` (defun set-frame-size-according-to-resolution () (interactive) (if window-system (progn ;; use 120 char wide window for largeish displays...
92,984
<p>A friend of mine and I were having a discussion regarding currying and partial function application in Javascript, and we came to very different conclusions as to whether either were achievable. I came up with this implementation of <code>Function.prototype.curry</code>, which was the basis of our discussion:</p> <...
[ { "answer_id": 93191, "author": "Zach", "author_id": 9128, "author_profile": "https://Stackoverflow.com/users/9128", "pm_score": 0, "selected": false, "text": "<p>You should check out <a href=\"http://www.svendtofte.com/code/curried_javascript/\" rel=\"nofollow noreferrer\">Curried JavaS...
2008/09/18
[ "https://Stackoverflow.com/questions/92984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11109/" ]
A friend of mine and I were having a discussion regarding currying and partial function application in Javascript, and we came to very different conclusions as to whether either were achievable. I came up with this implementation of `Function.prototype.curry`, which was the basis of our discussion: ``` Function.protot...
Technically you're creating a brand new function that calls the original function. So if my understanding of partially applied functions is correct, this is not a partially applied function. A partially applied function would be closer to this (note that this isn't a general solution): ``` vindaloo.curry = function(a)...
93,039
<p>In what segment (.BSS, .DATA, other) of an executable file are static variables stored so that they don't have name collision? For example:</p> <pre><code> foo.c: bar.c: static int foo = 1; static int foo = 10; void fooTest() { void barTest() { static int bar = 2; ...
[ { "answer_id": 93079, "author": "Seb Rose", "author_id": 12405, "author_profile": "https://Stackoverflow.com/users/12405", "pm_score": 5, "selected": false, "text": "<p>The storage location of the data will be implementation dependent.</p>\n\n<p>However, the meaning of <strong>static</st...
2008/09/18
[ "https://Stackoverflow.com/questions/93039", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10703/" ]
In what segment (.BSS, .DATA, other) of an executable file are static variables stored so that they don't have name collision? For example: ``` foo.c: bar.c: static int foo = 1; static int foo = 10; void fooTest() { void barTest() { static int bar = 2; sta...
Where your statics go depends on whether they are *zero-initialized*. *zero-initialized* static data goes in [.BSS (Block Started by Symbol)](http://en.wikipedia.org/wiki/.bss), *non-zero-initialized* data goes in [.DATA](http://en.wikipedia.org/wiki/Data_segment)
93,056
<p>this should be simple...could someone provide me a simple code sample that has an aspx page hosting both a silverlight app (consisting of, say a button) and an iframe (pointing to, say stackoverflow.com). The silverlight app and iframe could be in separate div's, the same div, whatever. </p> <p>Everything I've trie...
[ { "answer_id": 93637, "author": "Ola Karlsson", "author_id": 10696, "author_profile": "https://Stackoverflow.com/users/10696", "pm_score": 2, "selected": false, "text": "<p>Hmm, sound a bit odd, a quick google gave me <a href=\"http://silverlight.net/forums/p/21584/75457.aspx\" rel=\"nof...
2008/09/18
[ "https://Stackoverflow.com/questions/93056", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6419/" ]
this should be simple...could someone provide me a simple code sample that has an aspx page hosting both a silverlight app (consisting of, say a button) and an iframe (pointing to, say stackoverflow.com). The silverlight app and iframe could be in separate div's, the same div, whatever. Everything I've tried so far l...
Hmm, sound a bit odd, a quick google gave me [this top result](http://silverlight.net/forums/p/21584/75457.aspx) which talks about using an Iframe and Silverlight on the same page, without problems. Also a quick test with the following code: ``` <%@ Page Language="C#" AutoEventWireup="true" %> <%@ Register Assembly=...
93,100
<p>We all know that prepared statements are one of the best way of fending of SQL injection attacks. What is the best way of creating a prepared statement with an "IN" clause. Is there an easy way to do this with an unspecified number of values? Take the following query for example.</p> <pre><code>SELECT ID,Column1...
[ { "answer_id": 93184, "author": "DevelopingChris", "author_id": 1220, "author_profile": "https://Stackoverflow.com/users/1220", "pm_score": 1, "selected": false, "text": "<p>If you would like to pass an array, you will need a function in sql that can turn that array into a sub-select.</p...
2008/09/18
[ "https://Stackoverflow.com/questions/93100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1862/" ]
We all know that prepared statements are one of the best way of fending of SQL injection attacks. What is the best way of creating a prepared statement with an "IN" clause. Is there an easy way to do this with an unspecified number of values? Take the following query for example. ``` SELECT ID,Column1,Column2 FROM MyT...
Here you go - first create the following function... ``` Create Function [dbo].[SeparateValues] ( @data VARCHAR(MAX), @delimiter VARCHAR(10) ) RETURNS @tbldata TABLE(col VARCHAR(10)) As Begin DECLARE @pos INT DECLARE @prevpos INT SET @pos = 1 SET @prevpos = 0 WHILE @pos > 0 ...
93,105
<p>Need a function that takes a character as a parameter and returns true if it is a letter.</p>
[ { "answer_id": 93108, "author": "raven", "author_id": 4228, "author_profile": "https://Stackoverflow.com/users/4228", "pm_score": 3, "selected": false, "text": "<p>This was part of the code posted by <a href=\"https://stackoverflow.com/users/4007/rpetrich\">rpetrich</a> in response to a ...
2008/09/18
[ "https://Stackoverflow.com/questions/93105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4228/" ]
Need a function that takes a character as a parameter and returns true if it is a letter.
Seanyboy's `IsCharAlphaA` [answer](https://stackoverflow.com/questions/93105/whats-the-best-way-to-determine-if-a-character-is-a-letter-in-vb6/93299#93299) is close. The best method is to use the W version like so: ``` Private Declare Function IsCharAlphaW Lib "user32" (ByVal cChar As Integer) As Long Public Property ...
93,128
<p>I'm importing a MySQL dump and getting the following error.</p> <pre><code>$ mysql foo &lt; foo.sql ERROR 1153 (08S01) at line 96: Got a packet bigger than 'max_allowed_packet' bytes </code></pre> <p>Apparently there are attachments in the database, which makes for very large inserts.</p> <hr> <p>This is on my ...
[ { "answer_id": 93165, "author": "GHad", "author_id": 11705, "author_profile": "https://Stackoverflow.com/users/11705", "pm_score": 6, "selected": false, "text": "<p>This can be changed in your <code>my.ini</code> file (on Windows, located in \\Program Files\\MySQL\\MySQL Server) under th...
2008/09/18
[ "https://Stackoverflow.com/questions/93128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13989/" ]
I'm importing a MySQL dump and getting the following error. ``` $ mysql foo < foo.sql ERROR 1153 (08S01) at line 96: Got a packet bigger than 'max_allowed_packet' bytes ``` Apparently there are attachments in the database, which makes for very large inserts. --- This is on my local machine, a Mac with MySQL 5 ins...
You probably have to change it for both the client (you are running to do the import) AND the daemon mysqld that is running and accepting the import. For the client, you can specify it on the command line: ``` mysql --max_allowed_packet=100M -u root -p database < dump.sql ``` Also, **change the my.cnf or my.ini fil...
93,150
<p>The Query Optimizer is estimating that the results of a join will have only one row, when the actual number of rows is 2000. This is causing later joins on the dataset to have an estimated result of one row, when some of them go as high as 30,000.</p> <p>With a count of 1, the QO is choosing a loop join/index seek ...
[ { "answer_id": 93182, "author": "Danimal", "author_id": 2757, "author_profile": "https://Stackoverflow.com/users/2757", "pm_score": 0, "selected": false, "text": "<p>can't you prod the QO with a well-placed query hint?</p>\n" }, { "answer_id": 114811, "author": "Chris Smith",...
2008/09/18
[ "https://Stackoverflow.com/questions/93150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9073/" ]
The Query Optimizer is estimating that the results of a join will have only one row, when the actual number of rows is 2000. This is causing later joins on the dataset to have an estimated result of one row, when some of them go as high as 30,000. With a count of 1, the QO is choosing a loop join/index seek strategy f...
Although the statistics were up to date, the scan percentage wasn't high enough to provide accurate information. I ran this on each of the base tables that was having a problem to update all the statistics on a table by scanning all the rows, not just a default percentage. ``` UPDATE STATISTICS <table> WITH FULLSCAN, ...
93,162
<p>Apparently you can easily obtain a client IP address in WCF 3.5 but not in WCF 3.0. Anyone know how?</p>
[ { "answer_id": 93437, "author": "Paul Mrozowski", "author_id": 3656, "author_profile": "https://Stackoverflow.com/users/3656", "pm_score": 7, "selected": false, "text": "<p>This doesn't help you in 3.0, but I can just see people finding this question and being frustrated because they are...
2008/09/18
[ "https://Stackoverflow.com/questions/93162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3856/" ]
Apparently you can easily obtain a client IP address in WCF 3.5 but not in WCF 3.0. Anyone know how?
It turns out you can, so long as (a) your service is being hosted in a Web Service (obviously) and (b) you enable AspNetCompatibility mode, as follows: ``` <system.serviceModel> <!-- this enables WCF services to access ASP.Net http context --> <serviceHostingEnvironment aspNetCompatibilityE...
93,171
<p>I have a bowling web application that allows pretty detailed frame-by-frame information entry. One thing it allows is tracking which pins were knocked down on each ball. To display this information, I make it look like a rack of pins:</p> <pre>o o o o o o o o o o</pre> <p>Images are used to represent the pin...
[ { "answer_id": 93189, "author": "Paul Whelan", "author_id": 3050, "author_profile": "https://Stackoverflow.com/users/3050", "pm_score": 2, "selected": false, "text": "<p>Why not have an image for all possible outcomes for the pins? No Messing with layouts for browsers an image is an imag...
2008/09/18
[ "https://Stackoverflow.com/questions/93171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/96/" ]
I have a bowling web application that allows pretty detailed frame-by-frame information entry. One thing it allows is tracking which pins were knocked down on each ball. To display this information, I make it look like a rack of pins: ``` o o o o o o o o o o ``` Images are used to represent the pins. So, for th...
You could try the css "nowrap" option in the containing div. ```css {white-space: nowrap;} ``` Not sure how widely that is supported.
93,208
<p>I'd like to automatically generate database scripts on a regular basis. Is this possible.</p>
[ { "answer_id": 93282, "author": "Orion Adrian", "author_id": 7756, "author_profile": "https://Stackoverflow.com/users/7756", "pm_score": 4, "selected": true, "text": "<p>To generate script for an object you have to pass up to six parameters:</p>\n\n<pre><code>exec proc_genscript \n @S...
2008/09/18
[ "https://Stackoverflow.com/questions/93208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'd like to automatically generate database scripts on a regular basis. Is this possible.
To generate script for an object you have to pass up to six parameters: ``` exec proc_genscript @ServerName = 'Server Name', @DBName = 'Database Name', @ObjectName = 'Object Name to generate script for', @ObjectType = 'Object Type', @TableName = 'Parent table name for index and trigger', @...
93,214
<p>Given the code from the <a href="http://railscasts.com/episodes/75" rel="nofollow noreferrer">Complex Form part III</a> how would you go about testing the virtual attribute?</p> <pre><code> def new_task_attributes=(task_attributes) task_attributes.each do |attributes| tasks.build(attributes) end end...
[ { "answer_id": 93393, "author": "Jason Wadsworth", "author_id": 11078, "author_profile": "https://Stackoverflow.com/users/11078", "pm_score": 3, "selected": true, "text": "<p>It looks as if new_task_attributes= is expecting an array of hashes, but you're passing it a hash. Try this:</p>\...
2008/09/18
[ "https://Stackoverflow.com/questions/93214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1681/" ]
Given the code from the [Complex Form part III](http://railscasts.com/episodes/75) how would you go about testing the virtual attribute? ``` def new_task_attributes=(task_attributes) task_attributes.each do |attributes| tasks.build(attributes) end end ``` I am currently trying to test it like this:...
It looks as if new\_task\_attributes= is expecting an array of hashes, but you're passing it a hash. Try this: ``` def test_adding_task_to_project p = Project.new new_tasks_attributes = [{ "name" => "paint fence"}] p.new_tasks_attributes = (new_tasks_attributes) p.save assert p.tasks.length == 1 end ```
93,222
<p>I recently received an email from my girlfriend that spamassassin marked as spam, mostly because spamassassin detected a tracker ID... except there wasn't one. I'd like to know what triggered it, so that I can report a sensible bug.</p>
[ { "answer_id": 93393, "author": "Jason Wadsworth", "author_id": 11078, "author_profile": "https://Stackoverflow.com/users/11078", "pm_score": 3, "selected": true, "text": "<p>It looks as if new_task_attributes= is expecting an array of hashes, but you're passing it a hash. Try this:</p>\...
2008/09/18
[ "https://Stackoverflow.com/questions/93222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15371/" ]
I recently received an email from my girlfriend that spamassassin marked as spam, mostly because spamassassin detected a tracker ID... except there wasn't one. I'd like to know what triggered it, so that I can report a sensible bug.
It looks as if new\_task\_attributes= is expecting an array of hashes, but you're passing it a hash. Try this: ``` def test_adding_task_to_project p = Project.new new_tasks_attributes = [{ "name" => "paint fence"}] p.new_tasks_attributes = (new_tasks_attributes) p.save assert p.tasks.length == 1 end ```
93,231
<p>I'm having a problem debugging an Eclipse Application from Eclipse. When I launch the Debug Configuration, the Eclipse Application starts up and then stops repeatedly. It shows the splash screen and then disappears. This is the farthest it gets before restarting:</p> <pre><code>MyDebugConfiguration [Eclipse Appl...
[ { "answer_id": 93393, "author": "Jason Wadsworth", "author_id": 11078, "author_profile": "https://Stackoverflow.com/users/11078", "pm_score": 3, "selected": true, "text": "<p>It looks as if new_task_attributes= is expecting an array of hashes, but you're passing it a hash. Try this:</p>\...
2008/09/18
[ "https://Stackoverflow.com/questions/93231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7648/" ]
I'm having a problem debugging an Eclipse Application from Eclipse. When I launch the Debug Configuration, the Eclipse Application starts up and then stops repeatedly. It shows the splash screen and then disappears. This is the farthest it gets before restarting: ``` MyDebugConfiguration [Eclipse Application] or...
It looks as if new\_task\_attributes= is expecting an array of hashes, but you're passing it a hash. Try this: ``` def test_adding_task_to_project p = Project.new new_tasks_attributes = [{ "name" => "paint fence"}] p.new_tasks_attributes = (new_tasks_attributes) p.save assert p.tasks.length == 1 end ```
93,264
<p>I have created a foreign key (in SQL Server) by:</p> <pre><code>alter table company add CountryID varchar(3); alter table company add constraint Company_CountryID_FK foreign key(CountryID) references Country; </code></pre> <p>I then run this query:</p> <pre><code>alter table company drop column CountryID; </code...
[ { "answer_id": 93292, "author": "Mike", "author_id": 1115144, "author_profile": "https://Stackoverflow.com/users/1115144", "pm_score": 9, "selected": true, "text": "<p>Try</p>\n\n<pre><code>alter table company drop constraint Company_CountryID_FK\n\n\nalter table company drop column Coun...
2008/09/18
[ "https://Stackoverflow.com/questions/93264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1638/" ]
I have created a foreign key (in SQL Server) by: ``` alter table company add CountryID varchar(3); alter table company add constraint Company_CountryID_FK foreign key(CountryID) references Country; ``` I then run this query: ``` alter table company drop column CountryID; ``` and I get this error: > > *Msg 5074...
Try ``` alter table company drop constraint Company_CountryID_FK alter table company drop column CountryID ```
93,274
<p>What is the <em>definitive</em> way to mimic the CSS property min-width in Internet Explorer 6? Is it better not to try?</p>
[ { "answer_id": 93286, "author": "Darren Kopp", "author_id": 77, "author_profile": "https://Stackoverflow.com/users/77", "pm_score": 0, "selected": false, "text": "<p>do your css tag as _Width: 500px or whatever.</p>\n" }, { "answer_id": 93296, "author": "kch", "author_id"...
2008/09/18
[ "https://Stackoverflow.com/questions/93274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4241/" ]
What is the *definitive* way to mimic the CSS property min-width in Internet Explorer 6? Is it better not to try?
```css foo { min-width: 100px } // for everyone * html foo { width: 100px } // just for IE ``` (or serve a separate stylesheet to IE using [conditional comments](http://www.quirksmode.org/css/condcom.html))
93,277
<p>I have a rails form with a datetime_select field. When I try to submit the form, I get the following exception:</p> <pre><code>ActiveRecord::MultiparameterAssignmentErrors in WidgetsController#update 1 error(s) on assignment of multiparameter attributes </code></pre> <p>If it's a validation error, why don't I see...
[ { "answer_id": 93327, "author": "Jason Wadsworth", "author_id": 11078, "author_profile": "https://Stackoverflow.com/users/11078", "pm_score": 5, "selected": true, "text": "<p>It turns out that rails uses something called Multi-parameter assignment to transmit dates and times in small par...
2008/09/18
[ "https://Stackoverflow.com/questions/93277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11078/" ]
I have a rails form with a datetime\_select field. When I try to submit the form, I get the following exception: ``` ActiveRecord::MultiparameterAssignmentErrors in WidgetsController#update 1 error(s) on assignment of multiparameter attributes ``` If it's a validation error, why don't I see an error on the page? T...
It turns out that rails uses something called Multi-parameter assignment to transmit dates and times in small parts that are reassembled when you assign params to the model instance. My problem was that I was using a datetime\_select form field for a date model field. It apparently chokes when the multi-parameter magi...
93,294
<p>So I have a nasty stack overflow I have been trying to track down / solve for the past 8 hours or so, and I'm at the point where i think i need advice. </p> <p>The details: Interestingly enough this code runs fine when called in the context of our regular winforms application -- but I am tasked with writing a web-...
[ { "answer_id": 93367, "author": "Mike Dimmick", "author_id": 6970, "author_profile": "https://Stackoverflow.com/users/6970", "pm_score": 1, "selected": false, "text": "<p>You need some decent symbols for the CLR. Set <code>_NT_SYMBOL_PATH</code> (in WinDBG, use File/Symbol File Path) so ...
2008/09/18
[ "https://Stackoverflow.com/questions/93294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17784/" ]
So I have a nasty stack overflow I have been trying to track down / solve for the past 8 hours or so, and I'm at the point where i think i need advice. The details: Interestingly enough this code runs fine when called in the context of our regular winforms application -- but I am tasked with writing a web-based versi...
I thought I'd post back here with the resolution to this in case someone else runs into it. The replies above were all helpful, and pointed out why i might be overflowing the stack -- but the thing that I still couldn't come to grips with was why the exact same code ran fine in our winforms app. What I eventually dis...
93,335
<p>Does anyone know of a good tool to generate the WSDL for a service contract written in C# (i.e. set of methods that are tagged as "[OperationContract]" using WCF)? All the tools I've found work the other way around: create code stubs from a WSDL. I don't want to have to hand-jam a WSDL file. I've found tools for ...
[ { "answer_id": 93368, "author": "blowdart", "author_id": 2525, "author_profile": "https://Stackoverflow.com/users/2525", "pm_score": 3, "selected": false, "text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/aa702581.aspx\" rel=\"nofollow noreferrer\">svcutil</a> or just host it...
2008/09/18
[ "https://Stackoverflow.com/questions/93335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59910/" ]
Does anyone know of a good tool to generate the WSDL for a service contract written in C# (i.e. set of methods that are tagged as "[OperationContract]" using WCF)? All the tools I've found work the other way around: create code stubs from a WSDL. I don't want to have to hand-jam a WSDL file. I've found tools for php an...
Easiest thing to do is host the service with a base address setup, and then just hit it from a browser with "?wsdl" appended to the end. Here's an example of a service configuration with a base address specified. Note this goes in the `<configuration><services>` element in your config: ``` <service name="MyService...
93,353
<p>I need to make a random list of permutations. The elements can be anything but assume that they are the integers 0 through x-1. I want to make y lists, each containing z elements. The rules are that no list may contain the same element twice and that over all the lists, the number of times each elements is used i...
[ { "answer_id": 93465, "author": "PierreBdR", "author_id": 7136, "author_profile": "https://Stackoverflow.com/users/7136", "pm_score": 0, "selected": false, "text": "<p>Ok, one way to approximate that:</p>\n\n<p>1 - shuffle your list</p>\n\n<p>2 - take the y first elements to form the nex...
2008/09/18
[ "https://Stackoverflow.com/questions/93353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4454/" ]
I need to make a random list of permutations. The elements can be anything but assume that they are the integers 0 through x-1. I want to make y lists, each containing z elements. The rules are that no list may contain the same element twice and that over all the lists, the number of times each elements is used is the ...
This could be improved, but it seems to do the job (Python): ``` import math, random def get_pool(items, y, z): slots = y*z use_each_times = slots/len(items) exceptions = slots - use_each_times*len(items) if (use_each_times > y or exceptions > 0 and use_each_times+1 > y): raise Excep...
93,357
<p><strong>I want to read the contents of a URL but don't want to "hang" if the URL is unresponsive. I've created a BufferedReader using the URL...</strong></p> <pre><code>URL theURL = new URL(url); URLConnection urlConn = theURL.openConnection(); urlConn.setDoOutput(true); BufferedReader urlReader = new BufferedRead...
[ { "answer_id": 93418, "author": "jsight", "author_id": 1432, "author_profile": "https://Stackoverflow.com/users/1432", "pm_score": 5, "selected": true, "text": "<p>I think URLConnection.setReadTimeout is what you are looking for.</p>\n" }, { "answer_id": 93452, "author": "Pet...
2008/09/18
[ "https://Stackoverflow.com/questions/93357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13930/" ]
**I want to read the contents of a URL but don't want to "hang" if the URL is unresponsive. I've created a BufferedReader using the URL...** ``` URL theURL = new URL(url); URLConnection urlConn = theURL.openConnection(); urlConn.setDoOutput(true); BufferedReader urlReader = new BufferedReader(newInputStreamReader(urlC...
I think URLConnection.setReadTimeout is what you are looking for.
93,408
<p>I saw some code like the following in a JSP</p> <pre><code>&lt;c:if test="&lt;%=request.isUserInRole(RoleEnum.USER.getCode())%&gt;"&gt; &lt;li&gt;user&lt;/li&gt; &lt;/c:if&gt; </code></pre> <p>My confusion is over the "=" that appears in the value of the <code>test</code> attribute. My understanding was that a...
[ { "answer_id": 93469, "author": "Sindri Traustason", "author_id": 1113, "author_profile": "https://Stackoverflow.com/users/1113", "pm_score": 2, "selected": false, "text": "<p>Attributes in JSP tag libraries in general can be either static or resolved at request time. If they are resolv...
2008/09/18
[ "https://Stackoverflow.com/questions/93408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
I saw some code like the following in a JSP ``` <c:if test="<%=request.isUserInRole(RoleEnum.USER.getCode())%>"> <li>user</li> </c:if> ``` My confusion is over the "=" that appears in the value of the `test` attribute. My understanding was that anything included within `<%= %>` is printed to the output, but sure...
All that the `test` attribute looks for to determine if something is true is the string "true" (case in-sensitive). For example, the following code will print "Hello world!" ``` <c:if test="true">Hello world!</c:if> ``` The code within the `<%= %>` returns a boolean, so it will either print the string "true" or "fal...
93,415
<p>I use <a href="http://files.emacsblog.org/ryan/elisp/maxframe.el" rel="noreferrer">maxframe.el</a> to maximize my Emacs frames.</p> <p>It works great on all three major platforms, except on my dual-head Mac setup (Macbook Pro 15-inch laptop with 23-inch monitor). </p> <p>When maximizing an Emacs frame, the frame e...
[ { "answer_id": 93428, "author": "EfForEffort", "author_id": 14113, "author_profile": "https://Stackoverflow.com/users/14113", "pm_score": 2, "selected": false, "text": "<p>Does customising `mf-max-width' work? Its documentation:</p>\n\n<pre><code>\"*The maximum display width to support....
2008/09/18
[ "https://Stackoverflow.com/questions/93415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13747/" ]
I use [maxframe.el](http://files.emacsblog.org/ryan/elisp/maxframe.el) to maximize my Emacs frames. It works great on all three major platforms, except on my dual-head Mac setup (Macbook Pro 15-inch laptop with 23-inch monitor). When maximizing an Emacs frame, the frame expands to fill the width of *both* monitors a...
I quickly scanned the reference that you provided to `maxframe.el` and *I don't think* that you're using the same technique that I use. Does the following code snippet help you? ``` (defun toggle-fullscreen () "toggles whether the currently selected frame consumes the entire display or is decorated with a window bo...
93,423
<p>I have the following code:</p> <pre><code> String inputFile = "somefile.txt"; FileInputStream in = new FileInputStream(inputFile); FileChannel ch = in.getChannel(); ByteBuffer buf = ByteBuffer.allocateDirect(BUFSIZE); // BUFSIZE = 256 /* read the file into a buffer, 256 byte...
[ { "answer_id": 93521, "author": "Burkhard", "author_id": 12860, "author_profile": "https://Stackoverflow.com/users/12860", "pm_score": 0, "selected": false, "text": "<p>Yes, it is Unicode.</p>\n\n<p>If you have 14 Chars in your File, you only get 7 '?'.</p>\n\n<p>Solution pending. Still ...
2008/09/18
[ "https://Stackoverflow.com/questions/93423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10675/" ]
I have the following code: ``` String inputFile = "somefile.txt"; FileInputStream in = new FileInputStream(inputFile); FileChannel ch = in.getChannel(); ByteBuffer buf = ByteBuffer.allocateDirect(BUFSIZE); // BUFSIZE = 256 /* read the file into a buffer, 256 bytes at a time */...
You have to know what the encoding of the file is, and then decode the ByteBuffer into a CharBuffer using that encoding. Assuming the file is ASCII: ``` import java.util.*; import java.io.*; import java.nio.*; import java.nio.channels.*; import java.nio.charset.*; public class Buffer { public static void main(Str...
93,439
<p>Is there any website/service which will enable me to add RSS subscription to any website?</p> <p>This is for my company I work. We have a website which displays company related news. These news are supplied by an external agency and they gets updated to our database automatically. Our website picks up random/new ne...
[ { "answer_id": 93459, "author": "Mark Ingram", "author_id": 986, "author_profile": "https://Stackoverflow.com/users/986", "pm_score": 2, "selected": false, "text": "<p>Your question is a little difficult to understand. Are you trying to generate the RSS for others to consume, or are you ...
2008/09/18
[ "https://Stackoverflow.com/questions/93439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12178/" ]
Is there any website/service which will enable me to add RSS subscription to any website? This is for my company I work. We have a website which displays company related news. These news are supplied by an external agency and they gets updated to our database automatically. Our website picks up random/new news and dis...
If you have the data in your database, creating one yourself is fairly straight forward - there's a simple tutorial [here](http://www.downes.ca/cgi-bin/page.cgi?post=56). Once you've set up a feed, in the <head> of your page, you put text like: ``` <link rel="alternate" title="RSS Feed" href="http://www.example....
93,462
<p>when an SQL Server Express DB is 'in recovery', you are unable to connect using SQL Authentication. </p> <p>Is there a simple way of determining the stat of the DB prior to connecting to it? (Using .Net)</p>
[ { "answer_id": 93594, "author": "Andy Irving", "author_id": 8553, "author_profile": "https://Stackoverflow.com/users/8553", "pm_score": 2, "selected": false, "text": "<pre><code>SELECT DATABASEPROPERTYEX ('master', 'STATUS') AS 'Status';\n</code></pre>\n\n<p>Replace 'master' with your da...
2008/09/18
[ "https://Stackoverflow.com/questions/93462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
when an SQL Server Express DB is 'in recovery', you are unable to connect using SQL Authentication. Is there a simple way of determining the stat of the DB prior to connecting to it? (Using .Net)
``` SELECT DATABASEPROPERTYEX ('master', 'STATUS') AS 'Status'; ``` Replace 'master' with your database name
93,472
<p>Is it possible to use DateTimePicker (Winforms) to pick both date and time (in the dropdown)? How do you change the custom display of the picked value? Also, is it possible to enable the user to type the date/time manually?</p>
[ { "answer_id": 93606, "author": "Nescio", "author_id": 14484, "author_profile": "https://Stackoverflow.com/users/14484", "pm_score": 6, "selected": false, "text": "<p>Unfortunately, this is one of the many misnomers in the framework, or at best a violation of SRP. <br></p>\n\n<p>To use t...
2008/09/18
[ "https://Stackoverflow.com/questions/93472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5363/" ]
Is it possible to use DateTimePicker (Winforms) to pick both date and time (in the dropdown)? How do you change the custom display of the picked value? Also, is it possible to enable the user to type the date/time manually?
Set the Format to Custom and then specify the format: ``` dateTimePicker1.Format = DateTimePickerFormat.Custom; dateTimePicker1.CustomFormat = "MM/dd/yyyy hh:mm:ss"; ``` or however you want to lay it out. You could then type in directly the date/time. If you use MMM, you'll need to use the numeric value for the mo...
93,511
<p>How to get a counter inside xsl:for-each loop that would reflect the number of current element processed.<br> For example my source XML is</p> <pre><code>&lt;books&gt; &lt;book&gt; &lt;title&gt;The Unbearable Lightness of Being &lt;/title&gt; &lt;/book&gt; &lt;book&gt; &lt;title&gt;Narci...
[ { "answer_id": 93553, "author": "redsquare", "author_id": 6440, "author_profile": "https://Stackoverflow.com/users/6440", "pm_score": 8, "selected": true, "text": "<p><code>position()</code>. E.G.:</p>\n\n<pre><code>&lt;countNo&gt;&lt;xsl:value-of select=\"position()\" /&gt;&lt;/countNo&...
2008/09/18
[ "https://Stackoverflow.com/questions/93511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3241/" ]
How to get a counter inside xsl:for-each loop that would reflect the number of current element processed. For example my source XML is ``` <books> <book> <title>The Unbearable Lightness of Being </title> </book> <book> <title>Narcissus and Goldmund</title> </book> <book> ...
`position()`. E.G.: ``` <countNo><xsl:value-of select="position()" /></countNo> ```
93,541
<p>I have a custom user control with a textbox on it and I'd like to expose the baseline (of the text in the textbox) snapline outside of the custom control. I know that you create a designer (inherited from ControlDesigner) and override SnapLines to get access to the snaplines, but I'm wondering how to get the text b...
[ { "answer_id": 95013, "author": "BenR", "author_id": 18039, "author_profile": "https://Stackoverflow.com/users/18039", "pm_score": 2, "selected": false, "text": "<p>You're on the right track. You will need to override the SnapLines property in your designr and do something like this:</p...
2008/09/18
[ "https://Stackoverflow.com/questions/93541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2848/" ]
I have a custom user control with a textbox on it and I'd like to expose the baseline (of the text in the textbox) snapline outside of the custom control. I know that you create a designer (inherited from ControlDesigner) and override SnapLines to get access to the snaplines, but I'm wondering how to get the text basel...
I just had a similar need, and I solved it like this: ``` public override IList SnapLines { get { IList snapLines = base.SnapLines; MyControl control = Control as MyControl; if (control == null) { return snapLines; } IDesigner designer = TypeDescriptor.CreateDesigner( ...
93,569
<p>For example, if I declare a long variable, can I assume it will always be aligned on a "sizeof(long)" boundary? Microsoft Visual C++ online help says so, but is it standard behavior?</p> <p>some more info:</p> <p>a. It is possible to explicitely create a misaligned integer (*bar):</p> <blockquote> <p>char foo[5...
[ { "answer_id": 93585, "author": "Michael Burr", "author_id": 12711, "author_profile": "https://Stackoverflow.com/users/12711", "pm_score": 0, "selected": false, "text": "<p>Yes, all types are always aligned to at least their alignment requirements.</p>\n\n<p>How could it be otherwise?</p...
2008/09/18
[ "https://Stackoverflow.com/questions/93569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12291/" ]
For example, if I declare a long variable, can I assume it will always be aligned on a "sizeof(long)" boundary? Microsoft Visual C++ online help says so, but is it standard behavior? some more info: a. It is possible to explicitely create a misaligned integer (\*bar): > > char foo[5] > > > int \* bar = (int \*)(&...
As others have mentioned, this isn't part of the standard and is left up to the compiler to implement as it sees fit for the processor in question. For example, VC could easily implement different alignment requirements for an ARM processor than it does for x86 processors. Microsoft VC implements what is basically cal...
93,578
<p>I cannot use the Resource File API from within a file system plugin due to a PlatSec issue:</p> <pre><code>*PlatSec* ERROR - Capability check failed - Can't load filesystemplugin.PXT because it links to bafl.dll which has the following capabilities missing: TCB </code></pre> <p>My understanding of the issue is th...
[ { "answer_id": 94169, "author": "MathewI", "author_id": 17938, "author_profile": "https://Stackoverflow.com/users/17938", "pm_score": 3, "selected": true, "text": "<p>The Symbian file server has the following capabilities:</p>\n\n<pre><code>TCB ProtServ DiskAdmin AllFiles PowerMgmt CommD...
2008/09/18
[ "https://Stackoverflow.com/questions/93578", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8565/" ]
I cannot use the Resource File API from within a file system plugin due to a PlatSec issue: ``` *PlatSec* ERROR - Capability check failed - Can't load filesystemplugin.PXT because it links to bafl.dll which has the following capabilities missing: TCB ``` My understanding of the issue is that: File system plugins a...
The Symbian file server has the following capabilities: ``` TCB ProtServ DiskAdmin AllFiles PowerMgmt CommDD ``` So any DLL being loaded into the file server process must have at least these capabilities. There is no way around this, short of writing a new proxy process as you allude to. However, there is a more fu...
93,583
<p>In a asp.net web application, I want to write to a file. This function will first get data from the database, and then write out the flat file.</p> <p>What can I do to make sure only 1 write occurs, and once the write occurrs, the other threads that maybe want to write to the file don't since the write took place....
[ { "answer_id": 93597, "author": "Gishu", "author_id": 1695, "author_profile": "https://Stackoverflow.com/users/1695", "pm_score": 2, "selected": false, "text": "<p>Synchronize your writing code to lock on a shared object so that only one thread gets inside the block. Others wait till the...
2008/09/18
[ "https://Stackoverflow.com/questions/93583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1368/" ]
In a asp.net web application, I want to write to a file. This function will first get data from the database, and then write out the flat file. What can I do to make sure only 1 write occurs, and once the write occurrs, the other threads that maybe want to write to the file don't since the write took place. I want to...
Synchronize your writing code to lock on a shared object so that only one thread gets inside the block. Others wait till the current one exits. ``` lock(this) { // perform the write. } ``` Update: I assumed that you have a shared object. If these are different processes on the same machine, you'd need something li...
93,590
<p>I have a question about using streams in .NET to load files from disk. I am trying to pinpoint a performance problem and want to be sure it's where I think it is.</p> <pre><code>Dim provider1 As New MD5CryptoServiceProvider Dim stream1 As FileStream stream1 = New FileStream(FileName, FileMode.Open, FileAccess.Rea...
[ { "answer_id": 93644, "author": "MichaelT", "author_id": 288629, "author_profile": "https://Stackoverflow.com/users/288629", "pm_score": 0, "selected": false, "text": "<p>Yes content of the file will be read then you run ComputeHash method and not when you just open a FileStream.</p>\n\n...
2008/09/18
[ "https://Stackoverflow.com/questions/93590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3059/" ]
I have a question about using streams in .NET to load files from disk. I am trying to pinpoint a performance problem and want to be sure it's where I think it is. ``` Dim provider1 As New MD5CryptoServiceProvider Dim stream1 As FileStream stream1 = New FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Re...
FileStream simply exposes an IO.Stream around a file object, and uses buffers. It doesn't read the entire file in the constructor (the file could be larger than RAM). The performance issue is most likely in the hashing, and you can perform some simple benchmarks to prove whether it's because of file IO or the algorit...
93,625
<p>I have a list with two <code>&lt;div&gt;</code>s in every <code>&lt;li&gt;</code> and I want to float them one next to the other and I want the <code>&lt;li&gt;</code> to take the whole availabe space. How do I do it?</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;style...
[ { "answer_id": 93646, "author": "workmad3", "author_id": 16035, "author_profile": "https://Stackoverflow.com/users/16035", "pm_score": -1, "selected": false, "text": "<pre><code>li{width:100%;}\n.a{}\n.b{float: left;}\n</code></pre>\n\n<p>That should do as required from my knowledge of C...
2008/09/18
[ "https://Stackoverflow.com/questions/93625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17781/" ]
I have a list with two `<div>`s in every `<li>` and I want to float them one next to the other and I want the `<li>` to take the whole availabe space. How do I do it? ``` <html> <head> <title></title> <style type="text/css"> body { } ul { } ...
```css *{ margin: 0; padding: 0;} li{ width: 100%: display: block; } li:after{ clear: both; } div.a{ width: 49%; float: left; } div.b{ width: 49%; float: left; } ``` Should do the trick.
93,638
<p>I have a WPF app with many list based controls in a window, which all are bound to different CollectionViews.</p> <p>At the window level is there a way to get the current selected item for the currently in focus list based control? I know I can do this with some fairly trivial code by looking for the in focus elem...
[ { "answer_id": 95031, "author": "Andy", "author_id": 3857, "author_profile": "https://Stackoverflow.com/users/3857", "pm_score": 1, "selected": false, "text": "<p>I don't think that there is a property like you specify, but as an alternative you could register a ClassHandler for the List...
2008/09/18
[ "https://Stackoverflow.com/questions/93638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a WPF app with many list based controls in a window, which all are bound to different CollectionViews. At the window level is there a way to get the current selected item for the currently in focus list based control? I know I can do this with some fairly trivial code by looking for the in focus element but doe...
I don't think that there is a property like you specify, but as an alternative you could register a ClassHandler for the ListBox.SelectionChanged event in your Window class: ``` EventManager.RegisterClassHandler(typeof(ListBox), ListBox.SelectionChanged, new SelectionChangedEventHandler(this.OnListBoxSelectionChan...
93,650
<p>How do you apply stroke (outline around text) to a textblock in xaml in WPF?</p>
[ { "answer_id": 94235, "author": "Tim Erickson", "author_id": 8787, "author_profile": "https://Stackoverflow.com/users/8787", "pm_score": 1, "selected": false, "text": "<p>In Blend you could convert the TextBlock to a Path, and then use the normal Stroke properties. But I'm assuming you ...
2008/09/18
[ "https://Stackoverflow.com/questions/93650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3798/" ]
How do you apply stroke (outline around text) to a textblock in xaml in WPF?
Below is my more idiomatically WPF, full-featured take on this. It supports pretty much everything you'd expect, including: * all font related properties including stretch and style * text alignment (left, right, center, justify) * text wrapping * text trimming * text decorations (underline, strike through etcetera) ...
93,653
<p>I've got a stored procedure in my database, that looks like this</p> <pre><code>ALTER PROCEDURE [dbo].[GetCountingAnalysisResults] @RespondentFilters varchar AS BEGIN @RespondentFilters = '''8ec94bed-fed6-4627-8d45-21619331d82a, 114c61f2-8935-4755-b4e9-4a598a51cc7f''' DECLARE @SQL nvarchar(600) SET @SQL = ...
[ { "answer_id": 93701, "author": "Jeremiah Peschka", "author_id": 11780, "author_profile": "https://Stackoverflow.com/users/11780", "pm_score": 1, "selected": false, "text": "<p>It looks like you don't have closing quotes around your @RespondentFilters <pre>'8ec94bed-fed6-4627-8d45-216193...
2008/09/18
[ "https://Stackoverflow.com/questions/93653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16003/" ]
I've got a stored procedure in my database, that looks like this ``` ALTER PROCEDURE [dbo].[GetCountingAnalysisResults] @RespondentFilters varchar AS BEGIN @RespondentFilters = '''8ec94bed-fed6-4627-8d45-21619331d82a, 114c61f2-8935-4755-b4e9-4a598a51cc7f''' DECLARE @SQL nvarchar(600) SET @SQL = 'SELECT * ...
You need single quotes around each GUID in the list ``` @RespondentFilters = '''8ec94bed-fed6-4627-8d45-21619331d82a'', ''114c61f2-8935-4755-b4e9-4a598a51cc7f''' ```
93,672
<p>Is there a 7-Zip command-line switch that prevents the filenames from echoing to the screen as they are added to the archive?</p>
[ { "answer_id": 93702, "author": "freespace", "author_id": 8297, "author_profile": "https://Stackoverflow.com/users/8297", "pm_score": 1, "selected": false, "text": "<p>If it doesn't have one, you can still redirect the output using <code>&gt;</code> into a file, then deleting the file af...
2008/09/18
[ "https://Stackoverflow.com/questions/93672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7519/" ]
Is there a 7-Zip command-line switch that prevents the filenames from echoing to the screen as they are added to the archive?
Not built in, but if you add ``` <7z command here> 2>&1 NUL ``` to the end of your command-line, it will redirect all the output into the null device and stops it echoing to the screen. This is the MS-DOS equivalent of ``` 2>&1 /dev/null ``` in Linux and Unix systems.
93,695
<p>My users would like to be able to hit <kbd>Ctrl</kbd>+<kbd>S</kbd> to save a form. Is there a good cross-browser way of capturing the <kbd>Ctrl</kbd>+<kbd>S</kbd> key combination and submit my form?</p> <p>App is built on Drupal, so jQuery is available.</p>
[ { "answer_id": 93836, "author": "Jim", "author_id": 8427, "author_profile": "https://Stackoverflow.com/users/8427", "pm_score": 8, "selected": true, "text": "<pre><code>$(window).keypress(function(event) {\n if (!(event.which == 115 &amp;&amp; event.ctrlKey) &amp;&amp; !(event.which =...
2008/09/18
[ "https://Stackoverflow.com/questions/93695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1902010/" ]
My users would like to be able to hit `Ctrl`+`S` to save a form. Is there a good cross-browser way of capturing the `Ctrl`+`S` key combination and submit my form? App is built on Drupal, so jQuery is available.
``` $(window).keypress(function(event) { if (!(event.which == 115 && event.ctrlKey) && !(event.which == 19)) return true; alert("Ctrl-S pressed"); event.preventDefault(); return false; }); ``` Key codes can differ between browsers, so you may need to check for more than just 115.
93,716
<p>How can I hide the title bar from a Windows Form but still have a Resizing Frame?</p>
[ { "answer_id": 93721, "author": "Brian Gillespie", "author_id": 6151, "author_profile": "https://Stackoverflow.com/users/6151", "pm_score": 5, "selected": true, "text": "<p>Setting FormBorderStyle = None will remove the title bar (at both design and\nrun time) - and also remove your abil...
2008/09/18
[ "https://Stackoverflow.com/questions/93716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6151/" ]
How can I hide the title bar from a Windows Form but still have a Resizing Frame?
Setting FormBorderStyle = None will remove the title bar (at both design and run time) - and also remove your ability to resize the form. If you need a border you can set: ``` ControlBox = false Text = "" ```
93,720
<p><strong>How do I represent an aggregation relation between two classes in UML, such that each class has a link to the other class's interface, not the implementing class?</strong></p> <p>E.g. I have a class Foo that implements iFoo, and Bar that implements iBar. Foo should have a member variable of type iBar, and B...
[ { "answer_id": 93721, "author": "Brian Gillespie", "author_id": 6151, "author_profile": "https://Stackoverflow.com/users/6151", "pm_score": 5, "selected": true, "text": "<p>Setting FormBorderStyle = None will remove the title bar (at both design and\nrun time) - and also remove your abil...
2008/09/18
[ "https://Stackoverflow.com/questions/93720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16399/" ]
**How do I represent an aggregation relation between two classes in UML, such that each class has a link to the other class's interface, not the implementing class?** E.g. I have a class Foo that implements iFoo, and Bar that implements iBar. Foo should have a member variable of type iBar, and Bar should have a member...
Setting FormBorderStyle = None will remove the title bar (at both design and run time) - and also remove your ability to resize the form. If you need a border you can set: ``` ControlBox = false Text = "" ```
93,728
<p>I want to do the following imports in a class.</p> <pre><code>import org.eclipse.jdt.core.dom.*; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.internal.compiler.ClassFile; import org.eclipse.jdt.internal.compiler.CompilationResult; ...
[ { "answer_id": 93820, "author": "delfuego", "author_id": 16414, "author_profile": "https://Stackoverflow.com/users/16414", "pm_score": 2, "selected": false, "text": "<p>Unless I'm misunderstanding you, you just need to include the JDT JAR files on your classpath; they're all available in...
2008/09/18
[ "https://Stackoverflow.com/questions/93728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5915/" ]
I want to do the following imports in a class. ``` import org.eclipse.jdt.core.dom.*; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.internal.compiler.ClassFile; import org.eclipse.jdt.internal.compiler.CompilationResult; import org.e...
I think I found an easier way to do this: * right-click on your project in the Package Explorer; * choose "Build Path..."; * choose "Configure Build Path"; * choose the Libraries tab; * click the "Add Variable..." button; * in the list box, choose the "ECLIPSE\_HOME" entry, and then click the "Extend" button; * in the...
93,744
<p>For the life of me, I can't remember how to set, delete, toggle or test a bit in a bitfield. Either I'm unsure or I mix them up because I rarely need these. So a "bit-cheat-sheet" would be nice to have.</p> <p>For example: </p> <pre><code>flags = flags | FlagsEnum.Bit4; // Set bit 4. </code></pre> <p>or</p> <pr...
[ { "answer_id": 93780, "author": "workmad3", "author_id": 16035, "author_profile": "https://Stackoverflow.com/users/16035", "pm_score": 1, "selected": false, "text": "<p>C++ operations are: &amp; | ^ ~ (for and, or, xor and not bitwise operations). Also of interest are >> and &lt;&lt;, wh...
2008/09/18
[ "https://Stackoverflow.com/questions/93744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15328/" ]
For the life of me, I can't remember how to set, delete, toggle or test a bit in a bitfield. Either I'm unsure or I mix them up because I rarely need these. So a "bit-cheat-sheet" would be nice to have. For example: ``` flags = flags | FlagsEnum.Bit4; // Set bit 4. ``` or ``` if ((flags & FlagsEnum.Bit4)) == Fla...
**I did some more work on these extensions - [You can find the code here](http://hugoware.net:4000/blog/enumeration-extensions-2-0)** I wrote some extension methods that extend System.Enum that I use often... I'm not claiming that they are bulletproof, but they have helped... *Comments removed...* ``` namespace Enum...
93,767
<p>I am using the mootools based Rokbox plugin, on one of my sites, and I can't figure out how to close it with javascript.</p> <p>I triggered the click event on the close button, but that did not work.</p> <p>I found the code in the rokbox source that is used to add the click listener</p> <pre><code>this.closeButto...
[ { "answer_id": 94526, "author": "Aeon", "author_id": 13289, "author_profile": "https://Stackoverflow.com/users/13289", "pm_score": 1, "selected": false, "text": "<p>The <code>this</code> likely refers to the rokbox instance; I don't think you need to worry about it, you're interested in ...
2008/09/18
[ "https://Stackoverflow.com/questions/93767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am using the mootools based Rokbox plugin, on one of my sites, and I can't figure out how to close it with javascript. I triggered the click event on the close button, but that did not work. I found the code in the rokbox source that is used to add the click listener ``` this.closeButton.addEvent('click',function(...
The `this` likely refers to the rokbox instance; I don't think you need to worry about it, you're interested in the code that runs on the click event. The salient part looks to be the following: ``` self.swtch=false; self.close(e); ``` `self` most likely refers to the rokbox instance, again, so assuming you instanti...
93,770
<p>For deployment reasons, I am trying to use IJW to wrap a C# assembly in C++ instead of using a COM Callable Wrapper. </p> <p>I've done it on other projects, but on this one, I am getting an EEFileLoadException. Any help would be appreciated!</p> <p>Managed C++ wrapper code (this is in a DLL):</p> <pre><code>ext...
[ { "answer_id": 94320, "author": "Adam Tegen", "author_id": 4066, "author_profile": "https://Stackoverflow.com/users/4066", "pm_score": 4, "selected": false, "text": "<p>The first issue is to make sure the Debugger type is set to mixed. Then you get useful exceptions.</p>\n" }, { ...
2008/09/18
[ "https://Stackoverflow.com/questions/93770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4066/" ]
For deployment reasons, I am trying to use IJW to wrap a C# assembly in C++ instead of using a COM Callable Wrapper. I've done it on other projects, but on this one, I am getting an EEFileLoadException. Any help would be appreciated! Managed C++ wrapper code (this is in a DLL): ``` extern "C" __declspec(dllexport) ...
The problem was where the DLLs were located. * c:\dlls\managed.dll * c:\dlls\wrapper.dll * c:\exe\my.exe I confirmed this by copying managed.dll into c:\exe and it worked without issue. Apparently, the CLR won't look for managed DLLs in the path of the unmanaged DLL and will only look for it where the executable is. ...
93,832
<p>What is the preferred way to open a URL from a thick client application on Windows using C# and the .NET framework? I want it to use the default browser.</p>
[ { "answer_id": 93862, "author": "Matthias Meid", "author_id": 17713, "author_profile": "https://Stackoverflow.com/users/17713", "pm_score": 2, "selected": false, "text": "<p>I'd use the <a href=\"https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.start#System_Diagnos...
2008/09/18
[ "https://Stackoverflow.com/questions/93832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17891/" ]
What is the preferred way to open a URL from a thick client application on Windows using C# and the .NET framework? I want it to use the default browser.
The following code surely works: ``` Process.Start("http://www.yoururl.com/Blah.aspx"); ``` It opens the default browser (technically, the default program that handles HTTP URIs).
93,839
<p>If you have binary strings (literally String objects that contain only 1's and 0's), how would you output them as bits into a file?</p> <p>This is for a text compressor I was working on; it's still bugging me, and it'd be nice to finally get it working. Thanks!</p>
[ { "answer_id": 93889, "author": "Tomer Gabel", "author_id": 11558, "author_profile": "https://Stackoverflow.com/users/11558", "pm_score": 4, "selected": true, "text": "<p>Easiest is to simply take 8 consecutive characters, turn them into a byte and output that byte. Pad with zeros at the...
2008/09/18
[ "https://Stackoverflow.com/questions/93839", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6833/" ]
If you have binary strings (literally String objects that contain only 1's and 0's), how would you output them as bits into a file? This is for a text compressor I was working on; it's still bugging me, and it'd be nice to finally get it working. Thanks!
Easiest is to simply take 8 consecutive characters, turn them into a byte and output that byte. Pad with zeros at the end if you can recognize the end-of-stream, or add a header with length (in bits) at the beginning of the file. The inner loop would look something like: ``` byte[] buffer = new byte[ ( string.length...
93,853
<p>I have seen this problem arise in many different circumstances and would like to get the best practices for fixing / debugging it on StackOverflow.</p> <p>To use a real world example this occurred to me this morning:</p> <pre><code>expected announcement.rb to define Announcement </code></pre> <p>The class worked ...
[ { "answer_id": 94243, "author": "Joe Van Dyk", "author_id": 17076, "author_profile": "https://Stackoverflow.com/users/17076", "pm_score": 5, "selected": true, "text": "<p>That is a tricky one. </p>\n\n<p>What generally works for me is to run \"script/console production\" on the producti...
2008/09/18
[ "https://Stackoverflow.com/questions/93853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4748/" ]
I have seen this problem arise in many different circumstances and would like to get the best practices for fixing / debugging it on StackOverflow. To use a real world example this occurred to me this morning: ``` expected announcement.rb to define Announcement ``` The class worked fine in development, testing *and...
That is a tricky one. What generally works for me is to run "script/console production" on the production server, and type in: `Announcement` That will usually give you a better error message. But you said you already tried that?
93,888
<p>By default the session expiry seems to be 20 minutes. </p> <p>Update: I do not want the session to expire until the browser is closed.</p> <p>Update2: This is my scenario. User logs into site. Plays around the site. Leaves computer to go for a shower (>20 mins ;)). Comes back to computer and <em>should</em> be abl...
[ { "answer_id": 93907, "author": "Thomas Jespersen", "author_id": 8547, "author_profile": "https://Stackoverflow.com/users/8547", "pm_score": 1, "selected": false, "text": "<p>This is default. When you have a session, it stores the session in a \"Session Cookie\", which is automatically d...
2008/09/18
[ "https://Stackoverflow.com/questions/93888", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17404/" ]
By default the session expiry seems to be 20 minutes. Update: I do not want the session to expire until the browser is closed. Update2: This is my scenario. User logs into site. Plays around the site. Leaves computer to go for a shower (>20 mins ;)). Comes back to computer and *should* be able to play around. He clo...
If you want to extend the session beyond 20 minutes, you change the default using the IIS admin or you can set it in the web.config file. For example, to set the timeout to 60 minutes in web.config: ``` <configuration> <system.web> <sessionState timeout="60" /> ... other elements omitted ... </system.web> ...
93,932
<p>We are getting an error in a VB6 application that sends data back and forth over TCP sockets. We get a runtime error "out of string space". Has anyone seen this or have any thoughts on why this would happen? It seems like we are hitting some VB6 threshhold so any other thoughts would be helpful as well.</p>
[ { "answer_id": 94043, "author": "Robit", "author_id": 17026, "author_profile": "https://Stackoverflow.com/users/17026", "pm_score": 2, "selected": false, "text": "<p>Text found on MSDN:</p>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library/aa264524(VS.60).aspx\" rel=\"nofollow nore...
2008/09/18
[ "https://Stackoverflow.com/questions/93932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
We are getting an error in a VB6 application that sends data back and forth over TCP sockets. We get a runtime error "out of string space". Has anyone seen this or have any thoughts on why this would happen? It seems like we are hitting some VB6 threshhold so any other thoughts would be helpful as well.
As others have pointed out, every string concatenation in VB will allocate a new string and then copy the data over and then de-allocate the original once it can. In a loop this can cause issues. To work around this you can create a simple StringBuilder class like this one: ``` Option Explicit Private data As String...
93,976
<p>How do you check if a one-character String is a letter - including any letters with accents?</p> <p>I had to work this out recently, so I'll answer it myself, after the recent VB6 question reminded me.</p>
[ { "answer_id": 93979, "author": "Peter Hilton", "author_id": 2670, "author_profile": "https://Stackoverflow.com/users/2670", "pm_score": 6, "selected": true, "text": "<p>Just checking if a letter is in A-Z because that doesn't include letters with accents or letters in other alphabets.</...
2008/09/18
[ "https://Stackoverflow.com/questions/93976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2670/" ]
How do you check if a one-character String is a letter - including any letters with accents? I had to work this out recently, so I'll answer it myself, after the recent VB6 question reminded me.
Just checking if a letter is in A-Z because that doesn't include letters with accents or letters in other alphabets. I found out that you can use the regular expression class for 'Unicode letter', or one of its case-sensitive variations: ``` string.matches("\\p{L}"); // Unicode letter string.matches("\\p{Lu}"); // Un...
93,983
<p>How can I take the string <code>foo[]=1&amp;foo[]=5&amp;foo[]=2</code> and return a collection with the values <code>1,5,2</code> in that order. I am looking for an answer using regex in C#. Thanks</p>
[ { "answer_id": 94009, "author": "jjnguy", "author_id": 2598, "author_profile": "https://Stackoverflow.com/users/2598", "pm_score": 1, "selected": false, "text": "<p>I don't know C#, but...</p>\n\n<p>In java:</p>\n\n<pre><code>String[] nums = String.split(yourString, \"&amp;?foo[]\");\n</...
2008/09/18
[ "https://Stackoverflow.com/questions/93983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17872/" ]
How can I take the string `foo[]=1&foo[]=5&foo[]=2` and return a collection with the values `1,5,2` in that order. I am looking for an answer using regex in C#. Thanks
In C# you can use capturing groups ``` private void RegexTest() { String input = "foo[]=1&foo[]=5&foo[]=2"; String pattern = @"foo\[\]=(\d+)"; Regex regex = new Regex(pattern); foreach (Match match in regex.Matches(input)) { Console.Out.WriteLine(match.Grou...
93,989
<p>In .NET, what's the best way to prevent multiple instances of an app from running at the same time? And if there's no "best" technique, what are some of the caveats to consider with each solution?</p>
[ { "answer_id": 94005, "author": "Aaron Jensen", "author_id": 11229, "author_profile": "https://Stackoverflow.com/users/11229", "pm_score": 2, "selected": false, "text": "<p><a href=\"http://en.csharp-online.net/Application_Architecture_in_Windows_Forms_2.0\" rel=\"nofollow noreferrer\">h...
2008/09/18
[ "https://Stackoverflow.com/questions/93989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5682/" ]
In .NET, what's the best way to prevent multiple instances of an app from running at the same time? And if there's no "best" technique, what are some of the caveats to consider with each solution?
Use Mutex. One of the examples above using GetProcessByName has many caveats. Here is a good article on the subject: <http://odetocode.com/Blogs/scott/archive/2004/08/20/401.aspx> ``` [STAThread] static void Main() { using(Mutex mutex = new Mutex(false, "Global\\" + appGuid)) { if(!mutex.WaitOne(0, false...
94,011
<p>Here is my problem: I've got a dialog with some parameters that the user can change (via a spinner for example). Each time one of these parameters is changed, I launch a thread to update a 3D view according to the new parameter value. If the user changes another value (or the same value again by clicking many times...
[ { "answer_id": 94031, "author": "Dave L.", "author_id": 3093, "author_profile": "https://Stackoverflow.com/users/3093", "pm_score": 3, "selected": false, "text": "<p>The thread that is updating the 3D view should periodically check some flag (use a <code>volatile boolean</code>) to see i...
2008/09/18
[ "https://Stackoverflow.com/questions/94011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2612/" ]
Here is my problem: I've got a dialog with some parameters that the user can change (via a spinner for example). Each time one of these parameters is changed, I launch a thread to update a 3D view according to the new parameter value. If the user changes another value (or the same value again by clicking many times on...
Try interrupt() as some have said to see if it makes any difference to your thread. If not, try destroying or closing a resource that will make the thread stop. That has a chance of being a little better than trying to throw Thread.stop() at it. If performance is tolerable, you might view each 3D update as a discrete ...
94,023
<p>I came across a controller in an older set of code (Rails 1.2.3) that had the following in a controller:</p> <pre><code>class GenericController &gt; ApplicationController # filters and such model :some_model </code></pre> <p>Although the name of the model does not match the name of the model, is there any ...
[ { "answer_id": 94040, "author": "Joe Van Dyk", "author_id": 17076, "author_profile": "https://Stackoverflow.com/users/17076", "pm_score": 1, "selected": false, "text": "<p>Yes, that is something that has disappeared in later versions of Rails. There is no need to specify it.</p>\n" },...
2008/09/18
[ "https://Stackoverflow.com/questions/94023", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13710/" ]
I came across a controller in an older set of code (Rails 1.2.3) that had the following in a controller: ``` class GenericController > ApplicationController # filters and such model :some_model ``` Although the name of the model does not match the name of the model, is there any reason to specify this? Or is...
This had to do with dependency injection. I don't recall the details. By now it's just a glorified `require`, which you don't need because rails auto-requires files for missing constants.
94,037
<p>How can I convert a character to its ASCII code using JavaScript?</p> <p>For example:</p> <blockquote> <p>get 10 from &quot;\n&quot;.</p> </blockquote>
[ { "answer_id": 94049, "author": "Jim", "author_id": 8427, "author_profile": "https://Stackoverflow.com/users/8427", "pm_score": 12, "selected": true, "text": "<pre><code>\"\\n\".charCodeAt(0);\n</code></pre>\n" }, { "answer_id": 9539389, "author": "Mohsen", "author_id": 6...
2008/09/18
[ "https://Stackoverflow.com/questions/94037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4465/" ]
How can I convert a character to its ASCII code using JavaScript? For example: > > get 10 from "\n". > > >
``` "\n".charCodeAt(0); ```
94,053
<p>For ASP.Net application deployment what type of information (if any) are you storing in the machine.config? </p> <p>If you're not using it, how are you managing environment specific configuration settings that may change for each environment?</p> <p>I'm looking for some "best practices" and the benefits/pitfalls o...
[ { "answer_id": 94152, "author": "Jesse C. Slicer", "author_id": 3312, "author_profile": "https://Stackoverflow.com/users/3312", "pm_score": 2, "selected": false, "text": "<p>I use machine.config for not just ASP.NET, but for overall config as well. I implemented a hash algorithm (Tiger)...
2008/09/18
[ "https://Stackoverflow.com/questions/94053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
For ASP.Net application deployment what type of information (if any) are you storing in the machine.config? If you're not using it, how are you managing environment specific configuration settings that may change for each environment? I'm looking for some "best practices" and the benefits/pitfalls of each. We're abo...
We are considering using machine.config to add one key for the environment, and then have one section in the web.config which is excactly the same for all environments. This way we can do a "real" XCopy deployment. E.g. in the machine.config for every computer (local dev workstations, stage servers, build servers, pro...
94,074
<p>I'm using wget to connect to a secure site like this:</p> <p><code>wget -nc -i inputFile</code></p> <p>where inputeFile consists of URLs like this:</p> <p><code><a href="https://clientWebsite.com/TheirPageName.asp?orderValue=1.00&amp;merchantID=36&amp;programmeID=92&amp;ref=foo&amp;Ofaz=0" rel="nofollow noreferre...
[ { "answer_id": 94100, "author": "Kent Fredric", "author_id": 15614, "author_profile": "https://Stackoverflow.com/users/15614", "pm_score": 3, "selected": false, "text": "<ol>\n<li><p>Try forging your UserAgent</p>\n\n<pre><code>-U \"Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-GB; rv:1.9...
2008/09/18
[ "https://Stackoverflow.com/questions/94074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm using wget to connect to a secure site like this: `wget -nc -i inputFile` where inputeFile consists of URLs like this: `<https://clientWebsite.com/TheirPageName.asp?orderValue=1.00&merchantID=36&programmeID=92&ref=foo&Ofaz=0>` This page returns a small gif file. For some reason, this is taking around 2.5 minute...
1. Try forging your UserAgent ``` -U "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-GB; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1" ``` 2. Disable Ceritificate Checking ( slow ) ``` --no-check-certificate ``` 3. Debug whats happening by enabling verbostity ``` -v ``` 4. Eliminate need for DNS lookups: Hardcode...
94,123
<p>I'm working on a webapp, and every so often we run into situations where pages will load without applying CSS. This problem has shown up in IE6, IE7, Safari 3, and FF3.</p> <p>A page refresh will always fix the problem.</p> <p>There are 3 CSS files loaded, all within the same style block using @import:</p> <pre><...
[ { "answer_id": 94166, "author": "Joe Van Dyk", "author_id": 17076, "author_profile": "https://Stackoverflow.com/users/17076", "pm_score": -1, "selected": false, "text": "<p>Use ab or httperf or curl or something to repeatedly load the CSS files from the webserver. Perhaps it's not consi...
2008/09/18
[ "https://Stackoverflow.com/questions/94123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17887/" ]
I'm working on a webapp, and every so often we run into situations where pages will load without applying CSS. This problem has shown up in IE6, IE7, Safari 3, and FF3. A page refresh will always fix the problem. There are 3 CSS files loaded, all within the same style block using @import: ``` <STYLE type="text/css">...
I've had a similar thing happen that I was able to fix by including a base style sheet first using the "link rel" method rather than "@import". i.e. move your [base css file] inclusion to: ``` <link rel="stylesheet" href="[base css file]" type="text/css" media="screen" /> ``` and put it before the others.
94,141
<p>I have the following script, where the first and third <code>document.writeline</code> are static and <strong>the second is generated</strong>:</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; document.write("&lt;script language='javascript' type='text/javascript' src='before.js'&gt;&lt;\/...
[ { "answer_id": 94328, "author": "Prestaul", "author_id": 5628, "author_profile": "https://Stackoverflow.com/users/5628", "pm_score": 1, "selected": false, "text": "<p>Slides 25/26 of <a href=\"http://sites.google.com/site/io/even-faster-web-sites\" rel=\"nofollow noreferrer\">this presen...
2008/09/18
[ "https://Stackoverflow.com/questions/94141", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4979/" ]
I have the following script, where the first and third `document.writeline` are static and **the second is generated**: ``` <script language="javascript" type="text/javascript"> document.write("<script language='javascript' type='text/javascript' src='before.js'><\/sc" + "ript>"); document.write("<script language='jav...
I've found an answer more to my liking: ``` <script language="javascript" type="text/javascript"> document.write("<script language='javascript' type='text/javascript' src='before.js'><\/sc" + "ript>"); document.write("<script defer language='javascript' type='text/javascript'>alert('during');<\/sc" + "ript>"); documen...
94,153
<p>I am attempting to use the 'tempfile' module for manipulating and creating text files. Once the file is ready I want to save it to disk. I thought it would be as simple as using 'shutil.copy'. However, I get a 'permission denied' IOError:</p> <pre><code>&gt;&gt;&gt; import tempfile, shutil &gt;&gt;&gt; f = tempfile...
[ { "answer_id": 94206, "author": "Hans Sjunnesson", "author_id": 8683, "author_profile": "https://Stackoverflow.com/users/8683", "pm_score": 3, "selected": false, "text": "<p>You could always use <em>shutil.copyfileobj</em>, in your example:</p>\n\n<pre><code>new_file = open('bar.txt', 'r...
2008/09/18
[ "https://Stackoverflow.com/questions/94153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
I am attempting to use the 'tempfile' module for manipulating and creating text files. Once the file is ready I want to save it to disk. I thought it would be as simple as using 'shutil.copy'. However, I get a 'permission denied' IOError: ``` >>> import tempfile, shutil >>> f = tempfile.TemporaryFile(mode ='w+t') >>> ...
The file you create with `TemporaryFile` or `NamedTemporaryFile` is automatically removed when it's closed, which is why you get an error. If you don't want this, you can use `mkstemp` instead (see the docs for [tempfile](https://docs.python.org/3/library/tempfile.html#tempfile.mkstemp)). ``` >>> import tempfile, shut...
94,154
<p>I'm trying to configure the Quick Launch menu to only display the ancestors and descendant nodes of the currently select node. The menu also needs to display all the childern of the root node. More simply:</p> <p>Given a site map of:</p> <p><strong>RootSite</strong></p> <p>---<strong>SubSite1</strong> = navigatio...
[ { "answer_id": 98428, "author": "Nat", "author_id": 13813, "author_profile": "https://Stackoverflow.com/users/13813", "pm_score": 1, "selected": false, "text": "<p>I personally don't like the html that the default menu provides (table based layout).\nFortunately the SharePoint team has r...
2008/09/18
[ "https://Stackoverflow.com/questions/94154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9711/" ]
I'm trying to configure the Quick Launch menu to only display the ancestors and descendant nodes of the currently select node. The menu also needs to display all the childern of the root node. More simply: Given a site map of: **RootSite** ---**SubSite1** = navigation set at "Display the current site, the navigation...
I followed @Nat's guidance into the murky world Sharepoint webparts to achieve the behavior I described above. My approach was to roll my own version of the [MossMenu webpart](http://blogs.msdn.com/ecm/archive/2006/12/02/customizing-the-wss-3-0-moss-2007-menu-control-mossmenu-source-code-released.aspx "MossMenu webpart...
94,161
<p>I'm working on a project that will be distributed with GNU autoconf/automake, and I have a set of bash scripts which call awk scripts. I would like the bash scripts to end up in the $PATH, but not the awk scripts. How should I insert these into the project? Should they be put in with other binaries?</p> <p>Also,...
[ { "answer_id": 94259, "author": "terminus", "author_id": 9232, "author_profile": "https://Stackoverflow.com/users/9232", "pm_score": 3, "selected": true, "text": "<p>Add something like this to Makefile.am</p>\n\n<pre><code>scriptsdir = $(prefix)/bin\nscripts_DATA = awkscript1 awkscript2\...
2008/09/18
[ "https://Stackoverflow.com/questions/94161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17925/" ]
I'm working on a project that will be distributed with GNU autoconf/automake, and I have a set of bash scripts which call awk scripts. I would like the bash scripts to end up in the $PATH, but not the awk scripts. How should I insert these into the project? Should they be put in with other binaries? Also, is there a w...
Add something like this to Makefile.am ``` scriptsdir = $(prefix)/bin scripts_DATA = awkscript1 awkscript2 ``` In this case it will install awkscript in $(prefix)/bin (you can also use $(bindir)). Note: Dont forget that the first should be named name + dir (scripts -> scriptsdir) and the second should be name + \_D...
94,171
<p>In C#.Net WPF During UserControl.Load -></p> <p>What is the best way of showing a whirling circle / 'Loading' Indicator on the UserControl until it has finished gathering data and rendering it's contents?</p>
[ { "answer_id": 95143, "author": "dcstraw", "author_id": 10391, "author_profile": "https://Stackoverflow.com/users/10391", "pm_score": 5, "selected": true, "text": "<p>I generally would create a layout like this:</p>\n\n<pre><code>&lt;Grid&gt;\n &lt;Grid x:Name=\"MainContent\" IsEnable...
2008/09/18
[ "https://Stackoverflow.com/questions/94171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/352728/" ]
In C#.Net WPF During UserControl.Load -> What is the best way of showing a whirling circle / 'Loading' Indicator on the UserControl until it has finished gathering data and rendering it's contents?
I generally would create a layout like this: ``` <Grid> <Grid x:Name="MainContent" IsEnabled="False"> ... </Grid> <Grid x:Name="LoadingIndicatorPanel"> ... </Grid> </Grid> ``` Then I load the data on a worker thread, and when it's finished I update the UI under the "MainContent" grid and ena...
94,177
<p>I have the following XAML: </p> <pre><code>&lt;TextBlock Text="{Binding ElementName=EditListBox, Path=SelectedItems.Count}" Margin="0,0,5,0"/&gt; &lt;TextBlock Text="items selected"&gt; &lt;TextBlock.Style&gt; &lt;Style TargetType="{x:Type TextBlock}"&gt; &lt;Style.Triggers&gt; ...
[ { "answer_id": 94690, "author": "Alan Le", "author_id": 1133, "author_profile": "https://Stackoverflow.com/users/1133", "pm_score": 5, "selected": true, "text": "<p>The DataTrigger is firing but the Text field for your second TextBlock is hard-coded as \"items selected\" so it won't be a...
2008/09/18
[ "https://Stackoverflow.com/questions/94177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2284/" ]
I have the following XAML: ``` <TextBlock Text="{Binding ElementName=EditListBox, Path=SelectedItems.Count}" Margin="0,0,5,0"/> <TextBlock Text="items selected"> <TextBlock.Style> <Style TargetType="{x:Type TextBlock}"> <Style.Triggers> <DataTrigger Binding="{Binding ElementNam...
The DataTrigger is firing but the Text field for your second TextBlock is hard-coded as "items selected" so it won't be able to change. To see it firing, you can remove Text="items selected". Your problem is a good candidate for using a **ValueConverter** instead of **DataTrigger**. Here's how to create and use the Va...
94,263
<p>When constructing an ArgumentException, a couple of the overloads take a string that is the invalid argument's parameter name. I figure it would be nice to not have to remember to update this ctor param whenever I change the method's param name. Is there a simple way to do this using reflection?</p> <p><strong>Upda...
[ { "answer_id": 94300, "author": "Brian", "author_id": 1750627, "author_profile": "https://Stackoverflow.com/users/1750627", "pm_score": 3, "selected": true, "text": "<p>You can use either Modules or RSL.</p>\n\n<p>RSLs have the advantage of getting cached by flash rather than the browser...
2008/09/18
[ "https://Stackoverflow.com/questions/94263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8705/" ]
When constructing an ArgumentException, a couple of the overloads take a string that is the invalid argument's parameter name. I figure it would be nice to not have to remember to update this ctor param whenever I change the method's param name. Is there a simple way to do this using reflection? **Update:** thanks to ...
You can use either Modules or RSL. RSLs have the advantage of getting cached by flash rather than the browser so they stick around longer. Modules are easier to create and use. I have used modules and had issues with modules failing to load (code needs to handle that case). I haven't tried RSLs yet. Here is some doc...