qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
122,175
<p>I'm trying to setup some friendly URLs on a SharePoint website. I know that I can do the ASP.Net 2.0 friendly URLs using RewritePath, but I was wondering if it was possible to make use of the System.Web.Routing that comes with ASP.NET 3.5 SP1. </p> <p>I think I've figured out how to get my route table loaded, but I'm not clear on what method to use to get the correct IHttpHandler to pass out.</p> <p>Thanks!</p>
[ { "answer_id": 127897, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "var route = new Route(\"blah/{*path}\", new MyRouteHandler());\nRouteTable.Routes.Add(route);\n\npublic class MyRouteHandler :...
2008/09/23
[ "https://Stackoverflow.com/questions/122175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10893/" ]
122,192
<p>I have a list control in GTK+ (a <code>gtk.TreeView</code> with one column), with "find-as-you type" enabled (so typing any text will open a small search field for searching through the list entries). Now, if the user enters some search text like "abc", should I search only for entries <em>starting</em> with "abc", or should I search for entries that contain "abc" somewhere in their text?</p> <p>(links to relevant Human Interface Guidelines appreciated)</p>
[ { "answer_id": 122246, "author": "Wayne", "author_id": 8236, "author_profile": "https://Stackoverflow.com/users/8236", "pm_score": 0, "selected": false, "text": "Shining, The - King, Stephen\nThe Shining - Stephen King\nKing, Stephen - The Shining\n" }, { "answer_id": 122907, ...
2008/09/23
[ "https://Stackoverflow.com/questions/122192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2148773/" ]
122,208
<p>In C++, what's the easiest way to get the local computer's IP address and subnet mask?</p> <p>I want to be able to detect the local machine's IP address in my local network. In my particular case, I have a network with a subnet mask of 255.255.255.0 and my computer's IP address is 192.168.0.5. I need to get these had two values programmatically in order to send a broadcast message to my network (in the form 192.168.0.255, for my particular case)</p> <p>Edit: Many answers were not giving the results I expected because I had two different network IP's. <a href="https://stackoverflow.com/questions/122208/get-the-ip-address-of-local-computer#122235">Torial</a>'s code did the trick (it gave me both IP addresses).</p> <p>Edit 2: Thanks to <a href="https://stackoverflow.com/questions/122208/get-the-ip-address-of-local-computer#122225">Brian R. Bondy</a> for the info about the subnet mask.</p>
[ { "answer_id": 122225, "author": "Brian R. Bondy", "author_id": 3153, "author_profile": "https://Stackoverflow.com/users/3153", "pm_score": 4, "selected": false, "text": "//Example: b1 == 192, b2 == 168, b3 == 0, b4 == 100\nstruct IPv4\n{\n unsigned char b1, b2, b3, b4;\n};\n\nbool ge...
2008/09/23
[ "https://Stackoverflow.com/questions/122208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4880/" ]
122,215
<p>In my tests I need to test what happens when an OracleException is thrown (due to a stored procedure failure). I am trying to setup Rhino Mocks to </p> <pre><code>Expect.Call(....).Throw(new OracleException()); </code></pre> <p>For whatever reason however, OracleException seems to be sealed with no public constructor. What can I do to test this?</p> <p><strong>Edit:</strong> Here is exactly what I'm trying to instantiate:</p> <pre><code>public sealed class OracleException : DbException { private OracleException(string message, int code) { ...} } </code></pre>
[ { "answer_id": 122231, "author": "Matt Howells", "author_id": 16881, "author_profile": "https://Stackoverflow.com/users/16881", "pm_score": 2, "selected": false, "text": "new OracleException()\n" }, { "answer_id": 122469, "author": "George Mauer", "author_id": 5056, "...
2008/09/23
[ "https://Stackoverflow.com/questions/122215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
122,229
<p>I'm the only developer supporting a website that's a mix of classic asp and .NET. I had to add some .net pages to a classic asp application. This application requires users to login. The login page, written in classic asp, creates a cookie that .net pages use to identify the logged in user and stores information in session vars for the other classic asp pages to use. In classic asp the cookie code is as follows:</p> <pre><code>response.cookies("foo")("value1") = value1 response.cookies("foo")("value2") = value2 response.cookies("foo").Expires = DateAdd("N", 15, Now()) response.cookies("foo").Path = "/" </code></pre> <p>In the .NET codebehind Page_Load code, I check for the cookie using the code below.</p> <blockquote> <p>if(!IsPostBack) {<br> if(Request.Cookies["foo"] != null) { ... } else { //redirect to cookie creation page, cookiefoo.asp } }</p> </blockquote> <p>The vast majority of the time this works with no problems. However, we have some users that get redirected to a cookie creation page because the Page_Load code can't find the cookie. No matter how many times the user is redirected to the cookie creation page, the referring page still can find the cookie, foo. The problem is happening in IE7 and I've tried modifying the privacy and cookie settings in the browser but can't seem to recreate the problem the user is having.</p> <p>Does anyone have any ideas why this could be happening with IE7?</p> <p>Thanks.</p>
[ { "answer_id": 2906948, "author": "Toby Artisan", "author_id": 243992, "author_profile": "https://Stackoverflow.com/users/243992", "pm_score": 1, "selected": false, "text": "Page.Response.Redirect(\"~/alpha\");\n" }, { "answer_id": 63600916, "author": "Pedro Rodrigues", "...
2008/09/23
[ "https://Stackoverflow.com/questions/122229", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9809/" ]
122,238
<p>JSF is setting the ID of an input field to <code>search_form:expression</code>. I need to specify some styling on that element, but that colon looks like the beginning of a pseudo-element to the browser so it gets marked invalid and ignored. Is there anyway to escape the colon or something?</p> <pre><code>input#search_form:expression { ///... } </code></pre>
[ { "answer_id": 122266, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 8, "selected": true, "text": "input#search_form\\:expression { ///...}\n" }, { "answer_id": 122268, "author": "Wayne", "author_id": 82...
2008/09/23
[ "https://Stackoverflow.com/questions/122238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4893/" ]
122,239
<p>Within a table cell that is vertical-align:bottom, I have one or two divs. Each div is floated right.<br> Supposedly, the divs should not align to the bottom, but they do (which I don't understand, but is good).<br> However, when I have two floated divs in the cell, they align themselves to the same top line.<br> I want the first, smaller, div to sit all the way at the bottom. Another acceptable solution is to make it full height of the table cell.</p> <p>It's difficult to explain, so here's the code:</p> <blockquote> <pre><code>&lt;style type="text/css"&gt; table { border-collapse: collapse; } td { border:1px solid black; vertical-align:bottom; } .h { float:right; background: #FFFFCC; } .ha { float:right; background: #FFCCFF; } &lt;/style&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;div class="ha"&gt;@&lt;/div&gt; &lt;div class="h"&gt;Title Text&lt;br /&gt;Line 2&lt;/div&gt; &lt;/td&gt; &lt;td&gt; &lt;div class="ha"&gt;@&lt;/div&gt; &lt;div class="h"&gt;Title Text&lt;br /&gt;Line 2&lt;br /&gt;Line 3&lt;/div&gt; &lt;/td&gt; &lt;td&gt; &lt;div class="h"&gt;Title Text&lt;br /&gt;Line 2&lt;/div&gt; &lt;/td&gt; &lt;td&gt; &lt;div class="h"&gt;Title Text&lt;br /&gt;Line 2&lt;/div&gt; &lt;/td&gt; &lt;td&gt; &lt;div class="h"&gt;Title Text&lt;br /&gt;Line 2&lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;div class="d"&gt;123456789&lt;/div&gt; &lt;/td&gt; &lt;td&gt; &lt;div class="d"&gt;123456789&lt;/div&gt; &lt;/td&gt; &lt;td&gt; &lt;div class="d"&gt;123456789&lt;/div&gt; &lt;/td&gt; &lt;td&gt; &lt;div class="d"&gt;123456789&lt;/div&gt; &lt;/td&gt; &lt;td&gt; &lt;div class="d"&gt;123456789&lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> </blockquote> <p>Here are the problems:</p> <ol> <li>Why does the @ sign sit at the same level as the yellow div?</li> <li>Supposedly vertical-align doesn't apply to block elements (like a floated div) 1. But it does!</li> <li>How can I make the @ sit at the bottom or make it full height of the table cell?</li> </ol> <p>I am testing in IE7 and FF2. Target support is IE6/7, FF2/3.</p> <p><strong>Clarification:</strong> The goal is to have the red @ on the bottom line of the table cell, <em>next</em> to the yellow box. Using clear on either div will put them on different lines. Additionally, the cells can have variable lines of text - therefore, <em>line-height</em> will not help.</p>
[ { "answer_id": 122263, "author": "PhiLho", "author_id": 15459, "author_profile": "https://Stackoverflow.com/users/15459", "pm_score": 0, "selected": false, "text": "clear: both" }, { "answer_id": 127277, "author": "Tom Ritter", "author_id": 8435, "author_profile": "ht...
2008/09/23
[ "https://Stackoverflow.com/questions/122239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8435/" ]
122,253
<p>After installing a third-party SDK, it very discourteously makes one if its templates the default item in "Add New Item..." dialog in Visual Studio 2005. This is also the case for all other similar dialogs - "Add Class...", "Add User Control..." etc.</p> <p>Is there a way to change this behavior?</p>
[ { "answer_id": 122270, "author": "Asaf R", "author_id": 6827, "author_profile": "https://Stackoverflow.com/users/6827", "pm_score": -1, "selected": false, "text": "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\\n" }, { "answer_id": 246281, "author": "Charles Anderson"...
2008/09/23
[ "https://Stackoverflow.com/questions/122253", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15497/" ]
122,254
<p>I have a class that defines the names of various session attributes, e.g.</p> <pre><code>class Constants { public static final String ATTR_CURRENT_USER = "current.user"; } </code></pre> <p>I would like to use these constants within a JSP to test for the presence of these attributes, something like:</p> <pre><code>&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; &lt;%@ page import="com.example.Constants" %&gt; &lt;c:if test="${sessionScope[Constants.ATTR_CURRENT_USER] eq null}"&gt; &lt;%-- Do somthing --%&gt; &lt;/c:if&gt; </code></pre> <p>But I can't seem to get the sytax correct. Also, to avoid repeating the rather lengthy tests above in multiple places, I'd like to assign the result to a local (page-scoped) variable, and refer to that instead. I believe I can do this with <code>&lt;c:set&gt;</code>, but again I'm struggling to find the correct syntax.</p> <p><strong>UPDATE:</strong> Further to the suggestion below, I tried:</p> <pre><code>&lt;c:set var="nullUser" scope="session" value="${sessionScope[Constants.ATTR_CURRENT_USER] eq null}" /&gt; </code></pre> <p>which didn't work. So instead, I tried substituting the literal value of the constant. I also added the constant to the content of the page, so I could verify the constant's value when the page is being rendered</p> <pre><code>&lt;c:set var="nullUser" scope="session" value="${sessionScope['current.user'] eq null}" /&gt; &lt;%= "Constant value: " + WebHelper.ATTR_CURRENT_PARTNER %&gt; </code></pre> <p>This worked fine and it printed the expected value "current.user" on the page. I'm at a loss to explain why using the String literal works, but a reference to the constant doesn't, when the two appear to have the same value. Help.....</p>
[ { "answer_id": 122863, "author": "Matt N", "author_id": 20605, "author_profile": "https://Stackoverflow.com/users/20605", "pm_score": -1, "selected": false, "text": "<c:set var=\"nullUser\" \n scope=\"session\" \n value=\"${sessionScope[Constants.ATTR_CURRENT_USER] eq null}\" />\n\...
2008/09/23
[ "https://Stackoverflow.com/questions/122254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
122,267
<p>(using the IMAP commands, not with the assistance of any other mail package)</p>
[ { "answer_id": 122296, "author": "Sec", "author_id": 20555, "author_profile": "https://Stackoverflow.com/users/20555", "pm_score": 5, "selected": true, "text": "a login a s\nb select source\nc copy 1 othermbox\nd store 1 +flags (\\Deleted)\ne expunge\n" }, { "answer_id": 3156528,...
2008/09/23
[ "https://Stackoverflow.com/questions/122267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/116/" ]
122,271
<p>when putting a ScrollViewer inside a window(not keeping all the window's size) inside the ScrollViewer there's (with other stuff) a WinFormsHost and a control inside (let's say a DateTimePicker). when scrolling, the inner winforms control keeps being visible when there's no longer a reason (it's outside of the scrolling region), so it "floats" above what's outside of the ScrollViewer</p> <p>any solutions for that?</p>
[ { "answer_id": 2638614, "author": "Kamilos", "author_id": 177156, "author_profile": "https://Stackoverflow.com/users/177156", "pm_score": -1, "selected": false, "text": "VerticalScrollBarVisibility=\"Auto\"\n" }, { "answer_id": 40342629, "author": "Ron16", "author_id": 30...
2008/09/23
[ "https://Stackoverflow.com/questions/122271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21243/" ]
122,273
<p>Does anyone have any code examples on how to create controllers that have parameters other than using a Dependency Injection Container? </p> <p>I see plenty of samples with using containers like StructureMap, but nothing if you wanted to pass in the dependency class yourself.</p>
[ { "answer_id": 122361, "author": "Ben Scheirman", "author_id": 3381, "author_profile": "https://Stackoverflow.com/users/3381", "pm_score": 5, "selected": true, "text": "public ProductController() : this( new Foo() )\n{\n //the framework calls this\n}\n\npublic ProductController(IFoo foo...
2008/09/23
[ "https://Stackoverflow.com/questions/122273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17902/" ]
122,276
<p>I want to be able to quickly check whether I both have sudo access and my password is already authenticated. I'm not worried about having sudo access specifically for the operation I'm about to perform, but that would be a nice bonus.</p> <p>Specifically what I'm trying to use this for is a script that I want to be runnable by a range of users. Some have sudo access. All know the root password.</p> <p>When they run my script, I want it to use sudo permissions without prompting for a password if that is possible, and otherwise to fall back to asking for the <em>root</em> password (because they might not have sudo access).</p> <p>My first non-working attempt was to fork off <code>sudo -S true</code> with STDIN closed or reading from /dev/null. But that still prompts for the password and waits a couple of seconds.</p> <p>I've tried several other things, including waiting 0.3sec to see whether it succeeded immediately, but everything I try ends up failing in some situation. (And not because my timeout is too short.) It's difficult to figure out what goes on, because I can't just strace like I normally would.</p> <p>One thing I <em>know</em> doesn't work is to close STDIN or attach it to a pipe before running <code>sudo -S true</code>. I was hoping that would make the password prompt immediately fail, but it still prompts and behaves strangely. I think it might want a terminal.</p>
[ { "answer_id": 122329, "author": "Oli", "author_id": 12870, "author_profile": "https://Stackoverflow.com/users/12870", "pm_score": -1, "selected": false, "text": "getent group admin | grep $particular_user\n" }, { "answer_id": 1677127, "author": "bobomastoras", "author_id...
2008/09/23
[ "https://Stackoverflow.com/questions/122276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14528/" ]
122,277
<p>I switched from Perl to Python about a year ago and haven't looked back. There is only <i>one</i> idiom that I've ever found I can do more easily in Perl than in Python:</p> <pre><code>if ($var =~ /foo(.+)/) { # do something with $1 } elsif ($var =~ /bar(.+)/) { # do something with $1 } elsif ($var =~ /baz(.+)/) { # do something with $1 } </code></pre> <p>The corresponding Python code is not so elegant since the if statements keep getting nested:</p> <pre><code>m = re.search(r'foo(.+)', var) if m: # do something with m.group(1) else: m = re.search(r'bar(.+)', var) if m: # do something with m.group(1) else: m = re.search(r'baz(.+)', var) if m: # do something with m.group(2) </code></pre> <p>Does anyone have an elegant way to reproduce this pattern in Python? I've seen anonymous function dispatch tables used, but those seem kind of unwieldy to me for a small number of regular expressions...</p>
[ { "answer_id": 122294, "author": "Thomas Wouters", "author_id": 17624, "author_profile": "https://Stackoverflow.com/users/17624", "pm_score": 4, "selected": false, "text": "r = re.compile(r'(?P<cmd>foo|bar|baz)(?P<data>.+)')\n\ndef do_foo(data):\n ...\n\ndef do_bar(data):\n ...\n\n...
2008/09/23
[ "https://Stackoverflow.com/questions/122277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20789/" ]
122,301
<p>Is there an easy way to get a conflict summary after running a <code>cvs update</code>? </p> <p>I work on a large project and after doing some work I need to do an update. The list of changes coming back from the cvs update command is several pages long and I'd like to see only the list of conflicts (starts with 'C') repeated at the end of the cvs update command output.</p> <p>The solution needs to work from the command line.</p> <p>If my normal output is:</p> <pre><code>M src/file1.txt M src/file2.txt cvs server: conflicts found ... C src/file3.txt M src/file4.txt M src/file5.txt </code></pre> <p>I want my new output to be:</p> <pre><code>M src/file1.txt M src/file2.txt cvs server: conflicts found ... C src/file3.txt M src/file4.txt M src/file5.txt Conflict Summary: C src/file3.txt </code></pre> <p>I want this to be a single command (possibly a short script or alias) that outputs the normal cvs output as it happens followed by a summary of conflicts.</p>
[ { "answer_id": 169551, "author": "Jonathan Leffler", "author_id": 15168, "author_profile": "https://Stackoverflow.com/users/15168", "pm_score": 3, "selected": true, "text": "tmp=${TMPDIR:-/tmp}/cvsupd.$$\ntrap \"rm -f $tmp; exit 1\" 0 1 2 3 13 15\ncvs update \"$@\" | tee $tmp\nif grep -s...
2008/09/23
[ "https://Stackoverflow.com/questions/122301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6180/" ]
122,302
<p>According to select name from system_privilege_map System has been granted:</p> <pre><code>SELECT ANY TABLE </code></pre> <p>...and lots of other * ANY TABLES.</p> <p>Plainly running</p> <pre><code>select * from the_table; select * from the_table; </code></pre> <p>...nets the given response:</p> <blockquote> <p>ERROR at line 1: ORA-00942: table or view does not exist</p> </blockquote> <p>I can log in as that user and run the same command just fine.</p> <p>I'm running under the assumption I should be able to run queries (select in this case) agaisnt a general user's DB table. Is my assumption correct, and if so, how do I do it?</p>
[ { "answer_id": 122309, "author": "Tony Andrews", "author_id": 18747, "author_profile": "https://Stackoverflow.com/users/18747", "pm_score": 4, "selected": true, "text": "select * from some_user.the_table;\n" }, { "answer_id": 122310, "author": "cagcowboy", "author_id": 19...
2008/09/23
[ "https://Stackoverflow.com/questions/122302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
122,313
<p>I'm getting confused with the include/exclude jargon, and my actual SVN client doesn't seem to have (or I've been unable to find it easily) a simple option to add or remove a certain type of files for version control.</p> <p>Let's say for example I've added the entire Visual Studio folder, with its solutions, projects, debug files, etc., but I only want to version the actual source files. What would be the simplest way to do that?</p>
[ { "answer_id": 122330, "author": "Max Cantor", "author_id": 16034, "author_profile": "https://Stackoverflow.com/users/16034", "pm_score": 3, "selected": false, "text": "~/.subversion/config" }, { "answer_id": 122331, "author": "Prody", "author_id": 21240, "author_prof...
2008/09/23
[ "https://Stackoverflow.com/questions/122313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6992/" ]
122,316
<p>In C# we can define a generic type that imposes constraints on the types that can be used as the generic parameter. The following example illustrates the usage of generic constraints:</p> <pre><code>interface IFoo { } class Foo&lt;T&gt; where T : IFoo { } class Bar : IFoo { } class Simpson { } class Program { static void Main(string[] args) { Foo&lt;Bar&gt; a = new Foo&lt;Bar&gt;(); Foo&lt;Simpson&gt; b = new Foo&lt;Simpson&gt;(); // error CS0309 } } </code></pre> <p>Is there a way we can impose constraints for template parameters in C++.</p> <hr> <p>C++0x has native support for this but I am talking about current standard C++.</p>
[ { "answer_id": 122386, "author": "Daniel Spiewak", "author_id": 9815, "author_profile": "https://Stackoverflow.com/users/9815", "pm_score": 6, "selected": false, "text": "template <class T>\nint compute_length(T *value)\n{\n return value->length();\n}\n" }, { "answer_id": 1224...
2008/09/23
[ "https://Stackoverflow.com/questions/122316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6508/" ]
122,327
<p>How do I find the location of my <code>site-packages</code> directory?</p>
[ { "answer_id": 122340, "author": "Daryl Spitzer", "author_id": 4766, "author_profile": "https://Stackoverflow.com/users/4766", "pm_score": 9, "selected": false, "text": "python -c \"from distutils.sysconfig import get_python_lib; print(get_python_lib())\"\n" }, { "answer_id": 122...
2008/09/23
[ "https://Stackoverflow.com/questions/122327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4766/" ]
122,348
<p>I have a command which includes an includegraphics command - I can pass an image to my command, and it will do some standard formatting for me before actually including the image. Some of the images that I'm including via this command are smaller than \textwidth, while some are larger. I'd like to scale the larger images down to \textwidth, while not scaling the smaller images up - this means I can't just do </p> <pre><code>\includegraphics[width=\textwidth]{img} </code></pre> <p>Is there a way to specify a maxwidth? Or, can I get the width of the image somehow so I can do something like </p> <pre><code>\ifthenelse{\imagewidth &gt; \textwidth}{% \includegraphics[width=\textwidth]{img}}{% \includegraphics{img}} </code></pre>
[ { "answer_id": 123184, "author": "ChrisN", "author_id": 3853, "author_profile": "https://Stackoverflow.com/users/3853", "pm_score": 6, "selected": true, "text": "\\newlength{\\imgwidth}\n\\settowidth{\\imgwidth}{\\includegraphics{img}}\n" }, { "answer_id": 5732912, "author": ...
2008/09/23
[ "https://Stackoverflow.com/questions/122348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1322/" ]
122,362
<p>If I am trying to determine the read speed of a drive, I can code a routine to write files to a filesystem and then read those files back. Unfortunately, this doesn't give an accurate read speed because Windows does disk read caching. </p> <p>Is there a way to flush the disk read cache of a drive in C# / .Net (or perhaps with Win32 API calls) so that I can read the files directly from the drive without them being cached?</p>
[ { "answer_id": 128523, "author": "Pretzel", "author_id": 21244, "author_profile": "https://Stackoverflow.com/users/21244", "pm_score": 4, "selected": false, "text": " [DllImport(\"kernel32\", SetLastError=true)]\n static extern unsafe SafeFileHandle CreateFile(\n string File...
2008/09/23
[ "https://Stackoverflow.com/questions/122362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21244/" ]
122,367
<p>Can I simulate in C#/C++ code <kbd>Control</kbd>+<kbd>Alt</kbd>+<kbd>Delete</kbd> sequence in Vista? When UAC enabled/disabled? How it is done in XP?</p> <p>Can you provide a code sample that works in Vista?</p>
[ { "answer_id": 47656659, "author": "fdioff", "author_id": 2027913, "author_profile": "https://Stackoverflow.com/users/2027913", "pm_score": 0, "selected": false, "text": "HDESK desktop = OpenDesktopW(L\"Winlogon\", 0, TRUE,\n DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_ENUMERA...
2008/09/23
[ "https://Stackoverflow.com/questions/122367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20257/" ]
122,400
<p>I'm not asking about general syntactic rules for file names. I mean gotchas that jump out of nowhere and bite you. For example, trying to name a file "COM&lt;n&gt;" on Windows?</p>
[ { "answer_id": 122427, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 3, "selected": false, "text": "gzip -9vf -- -mydashedfilename\n" }, { "answer_id": 122429, "author": "Branan", "author_id": 13894, ...
2008/09/23
[ "https://Stackoverflow.com/questions/122400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3474/" ]
122,404
<p>I used to often find myself coping a piece of code from a website/Word document etc only to discover that when doing Paste I would end up with the desired code plus some extra HTML tags/text, basically extra formatting information.</p> <p>To get rid of that extra ballast I would paste the text to the Notepad and then copy it again and then paste to the desired destination. </p> <p>Pretty recently I discovered a simple and free tool for Windows called <a href="http://www.stevemiller.net/puretext/" rel="noreferrer">PureText</a> that allows me to cut the Notepad step. It basically adds an extra keyboard shortcut e.g WinKey + V that will do the Paste action without formatting; just pure text. I find it very handy.</p> <p>I was wondering what approach would you use yourselves? Are they any better/easier to use tools around?</p>
[ { "answer_id": 132761, "author": "eugensk", "author_id": 17495, "author_profile": "https://Stackoverflow.com/users/17495", "pm_score": 2, "selected": false, "text": "ctrl-escape,arrdown,enter,shift-f4,$,enter\nshift-insert,ctrl-insert,alt-backspace,\nf10,enter\n" }, { "answer_id"...
2008/09/23
[ "https://Stackoverflow.com/questions/122404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3241/" ]
122,407
<p>I have a method that's about ten lines of code. I want to create more methods that do exactly the same thing, except for a small calculation that's going to change one line of code. This is a perfect application for passing in a function pointer to replace that one line, but Java doesn't have function pointers. What's my best alternative?</p>
[ { "answer_id": 122414, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 9, "selected": true, "text": "String" }, { "answer_id": 122470, "author": "rcreswick", "author_id": 3446, "author_profile": "https://St...
2008/09/23
[ "https://Stackoverflow.com/questions/122407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1288/" ]
122,422
<p>Is there any way to change the default datatype when importing an Excel file into Access? (I'm using Access 2003, by the way).</p> <p>I know that I sometimes have the freedom to assign any datatype to each column that is being imported, but that could only be when I'm importing non-Excel files. </p> <p><strong>EDIT:</strong> To be clear, I understand that there is a step in the import process where you are allowed to change the datatype of the imported column. </p> <p>In fact, that's what I'm asking about. For some reason - maybe it's always Excel files, maybe there's something else - I am sometimes not allowed to change the datatype: the dropdown box is grayed out and I just have to live with whatever datatype Access assumes is correct.</p> <p>For example, I just tried importing a large-ish Excel file (<strong>12000+ rows, ~200 columns</strong>) in Access where column #105 (or something similar) was filled with mostly numbers (codes: <code>1=foo, 2=bar</code>, etc), though there are a handful of alpha codes in there too (A=boo, B=far, etc). Access assumed it was a <code>Number</code> datatype (even after I changed the <code>Format</code> value in the Excel file itself) and so gave me errors on those alpha codes. If I had been allowed to change the datatype on import, it would have saved me some trouble.</p> <p>Am I asking for something that Access just won't do, or am I missing something? Thanks.</p> <p><strong>EDIT:</strong> There are two answers below that give useful advice. Saving the Excel file as a CSV and then importing that works well and is straightforward like <a href="https://stackoverflow.com/questions/122422/change-datatype-when-importing-excel-file-into-access#122588">Chris OC</a> says. The advice for saving an import specification is very helpful too. However, I chose the registry setting answer by <a href="https://stackoverflow.com/questions/122422/change-datatype-when-importing-excel-file-into-access#122504">DK</a> as the "Accepted Answer". I liked it as an answer because it's a <em>one-time-only step</em> that can be used to solve my major problem (having Access incorrectly assign a datatype). In short, this solution doesn't allow me to change the datatype myself, but it makes Access accurately guess the datatype so that there are fewer issues.</p>
[ { "answer_id": 122504, "author": "DK.", "author_id": 16886, "author_profile": "https://Stackoverflow.com/users/16886", "pm_score": 3, "selected": true, "text": "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Jet\\4.0\\Engines\\Excel]\n\"TypeGuessRows\"=dword:00000000\n" }, { "answer_i...
2008/09/23
[ "https://Stackoverflow.com/questions/122422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3930756/" ]
122,424
<p>Right now, we are using Perforce for version control. It has the handy feature of a strictly increasing change number that we can use to refer to builds, eg "you'll get the bugfix if your build is at least 44902".</p> <p>I'd like to switch over to using a distributed system (probably git) to make it easier to branch and to work from home. (Both of which are perfectly possible with Perforce, but the git workflow has some advantages.) So although "tributary development" would be distributed and not refer to a common revision sequencing, we'd still maintain a master git repo that all changes would need to feed into before a build was created.</p> <p>What's the best way to preserve strictly increasing build ids? The most straightforward way I can think of is to have some sort of post-commit hook that fires off whenever the master repo gets updated, and it registers (the hash of) the new tree object (or commit object? I'm new to git) with a centralized database that hands out ids. (I say "database", but I'd probably do it with git tags, and just look for the next available tag number or something. So the "database" would really be .git/refs/tags/build-id/.)</p> <p>This is workable, but I'm wondering if there is an easier, or already-implemented, or standard/"best practice" way of accomplishing this.</p>
[ { "answer_id": 122673, "author": "webmat", "author_id": 6349, "author_profile": "https://Stackoverflow.com/users/6349", "pm_score": 2, "selected": false, "text": "git tag" }, { "answer_id": 123594, "author": "CB Bailey", "author_id": 19563, "author_profile": "https://...
2008/09/23
[ "https://Stackoverflow.com/questions/122424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14528/" ]
122,445
<p>I'm implementing charts using <a href="http://www.ziya.liquidrail.com/" rel="nofollow noreferrer">The Ziya Charts Gem</a>. Unfortunately, the documentation isn't really helpful or I haven't had enough coffee to figure out theming. I know I can set a theme using</p> <pre><code>chart.add(:theme, 'whatever') </code></pre> <p>Problem: I haven't found any predefined themes, nor have I found a reference to the required format. </p>
[ { "answer_id": 122491, "author": "Matthias Winkelmann", "author_id": 4494, "author_profile": "https://Stackoverflow.com/users/4494", "pm_score": 0, "selected": false, "text": "svn co svn://rubyforge.org/var/svn/liquidrail/samples/charting \n" }, { "answer_id": 122795, "author...
2008/09/23
[ "https://Stackoverflow.com/questions/122445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4494/" ]
122,451
<p>My ClickOnce application uses a third party tool that requires the Visual C++ 2005 redistributable. The third party tool will not work if only the VC++ 2008 redistributable is installed. However, in Visual Studio 2008, the ClickOnce prerequisites do not allow a version to be specified for the VC++ redistributable; it will add a VC++ 2008 prerequisite, which makes sense most of the time. However, in this situation, an earlier version is required. ClickOnce is required, so merge modules are out of the question. Any ideas of how to specify the version?</p>
[ { "answer_id": 154033, "author": "codeConcussion", "author_id": 1321, "author_profile": "https://Stackoverflow.com/users/1321", "pm_score": 4, "selected": true, "text": "_" }, { "answer_id": 25278441, "author": "Der_Meister", "author_id": 991267, "author_profile": "ht...
2008/09/23
[ "https://Stackoverflow.com/questions/122451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19357/" ]
122,463
<p>I have an XML file that starts like this:</p> <pre><code>&lt;Elements name="Entities" xmlns="XS-GenerationToolElements"&gt; </code></pre> <p>I'll have to open a lot of these files. Each of these have a different namespace but will only have one namespace at a time (I'll never find two namespaces defined in one xml file).</p> <p>Using XPath I'd like to have an automatic way to add the given namespace to the namespace manager. So far, i could only get the namespace by parsing the xml file but I have a XPathNavigator instance and it should have a nice and clean way to get the namespaces, right?</p> <p>-- OR --</p> <p>Given that I only have one namespace, somehow make XPath use the only one that is present in the xml, thus avoiding cluttering the code by always appending the namespace.</p>
[ { "answer_id": 123005, "author": "JeniT", "author_id": 6739, "author_profile": "https://Stackoverflow.com/users/6739", "pm_score": 8, "selected": true, "text": "namespace::" }, { "answer_id": 289120, "author": "Dimitre Novatchev", "author_id": 36305, "author_profile":...
2008/09/23
[ "https://Stackoverflow.com/questions/122463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20335/" ]
122,483
<p>In crontab, I can use an asterisk to mean every value, or "*/2" to mean every even value.</p> <p>Is there a way to specify every <strong>odd</strong> value? (Would something like "1+*/2" work?)</p>
[ { "answer_id": 122496, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 2, "selected": false, "text": "1-23/2\n" }, { "answer_id": 122499, "author": "zigdon", "author_id": 4913, "author_profile": "https...
2008/09/23
[ "https://Stackoverflow.com/questions/122483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4465/" ]
122,514
<p>I have already posted something similar <a href="https://stackoverflow.com/questions/118051/c-grid-binding-not-update">here</a> but I would like to ask the question more general over here.</p> <p>Have you try to serialize an object that implement INotifyPropertyChanged and to get it back from serialization and to bind it to a DataGridView? When I do it, I have no refresh from the value that change (I need to minimize the windows and open it back).</p> <p>Do you have any trick? </p>
[ { "answer_id": 179462, "author": "Scott Weinstein", "author_id": 25201, "author_profile": "https://Stackoverflow.com/users/25201", "pm_score": 3, "selected": true, "text": "DataContractSerializer" } ]
2008/09/23
[ "https://Stackoverflow.com/questions/122514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
122,523
<p>Howdy, I have a DataRow pulled out of a DataTable from a DataSet. I am accessing a column that is defined in SQL as a float datatype. I am trying to assign that value to a local variable (c# float datatype) but am getting an InvalidCastExecption </p> <pre><code>DataRow exercise = _exerciseDataSet.Exercise.FindByExerciseID(65); _AccelLimit = (float)exercise["DefaultAccelLimit"]; </code></pre> <p>Now, playing around with this I did make it work but it did not make any sense and it didn't feel right. </p> <pre><code>_AccelLimit = (float)(double)exercise["DefaultAccelLimit"]; </code></pre> <p>Can anyone explain what I am missing here?</p>
[ { "answer_id": 33133446, "author": "dubrowgn", "author_id": 4704196, "author_profile": "https://Stackoverflow.com/users/4704196", "pm_score": 0, "selected": false, "text": "exercise[\"DefaultAccelLimit\"]" } ]
2008/09/23
[ "https://Stackoverflow.com/questions/122523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1048/" ]
122,571
<p>Right now I'm making an extremely simple website- about 5 pages. Question is if it's overkill and worth the time to integrate some sort of database mapping solution or if it would be better to just use plain old JNDI. I'll have maybe a dozen things I need to read/write from the database. I guess I have a basic understanding of these technologies but it would still take a lot of referring to the documentation. Anyone else faced with the decision before?</p> <p>EDIT: Sorry, I should've specified JNDI to lookup the DB connection and JDBC to perform the operations.</p>
[ { "answer_id": 122888, "author": "OscarRyz", "author_id": 20654, "author_profile": "https://Stackoverflow.com/users/20654", "pm_score": 5, "selected": true, "text": "+findById( id ): Employee\n+insert( Employee ) \n+update( Employee )\n+delete( Employee ) \n+findAll():List<Employee>\n" ...
2008/09/23
[ "https://Stackoverflow.com/questions/122571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17614/" ]
122,582
<p>I'm using a lat/long SRID in my PostGIS database (-4326). I would like to find the nearest points to a given point in an efficient manner. I tried doing an</p> <pre><code>ORDER BY ST_Distance(point, ST_GeomFromText(?,-4326)) </code></pre> <p>which gives me ok results in the lower 48 states, but up in Alaska it gives me garbage. Is there a way to do real distance calculations in PostGIS, or am I going to have to give a reasonable sized buffer and then calculate the great circle distances and sort the results in the code afterwards?</p>
[ { "answer_id": 123166, "author": "nathaniel", "author_id": 11947, "author_profile": "https://Stackoverflow.com/users/11947", "pm_score": 2, "selected": false, "text": "ALTER function [dbo].[getCoordinateDistance]\n (\n @Latitude1 decimal(16,12),\n @Longitude1 decimal(16,12),\n ...
2008/09/23
[ "https://Stackoverflow.com/questions/122582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3333/" ]
122,593
<p>Is it possible to throw an exception in a JSP without using scriptlet code?</p>
[ { "answer_id": 122608, "author": "Swati", "author_id": 12682, "author_profile": "https://Stackoverflow.com/users/12682", "pm_score": 0, "selected": false, "text": "<c:out value=\"${1/0}\" />\n" } ]
2008/09/23
[ "https://Stackoverflow.com/questions/122593", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
122,607
<p>I need to consume an external web service from my VB6 program. I want to be able to deploy my program without the SOAP toolkit, if possible, but that's not a requirement. I do not have the web service source and I didn't create it. It is a vendor-provided service.</p> <p>So outside of the SOAP toolkit, what is the best way to consume a web service from VB6?</p>
[ { "answer_id": 122645, "author": "Martin", "author_id": 1529, "author_profile": "https://Stackoverflow.com/users/1529", "pm_score": 2, "selected": false, "text": " set SoapObj = GetObject\n (\"soap:wsdl=http://www.xmethods.net/sd/TemperatureService.wsdl\")\n WScript.Echo \"Fair...
2008/09/23
[ "https://Stackoverflow.com/questions/122607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7565/" ]
122,616
<p>Is there a clean, preferably standard method of trimming leading and trailing whitespace from a string in C? I'd roll my own, but I would think this is a common problem with an equally common solution.</p>
[ { "answer_id": 122721, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 9, "selected": true, "text": "// Note: This function returns a pointer to a substring of the original string.\n// If the given string was allocated...
2008/09/23
[ "https://Stackoverflow.com/questions/122616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14463/" ]
122,639
<p>I have a temp table with the exact structure of a concrete table <code>T</code>. It was created like this: </p> <pre><code>select top 0 * into #tmp from T </code></pre> <p>After processing and filling in content into <code>#tmp</code>, I want to copy the content back to <code>T</code> like this: </p> <pre><code>insert into T select * from #tmp </code></pre> <p>This is okay as long as <code>T</code> doesn't have identity column, but in my case it does. Is there any way I can ignore the auto-increment identity column from <code>#tmp</code> when I copy to <code>T</code>? My motivation is to avoid having to spell out every column name in the Insert Into list. </p> <p>EDIT: toggling identity_insert wouldn't work because the pkeys in <code>#tmp</code> may collide with those in <code>T</code> if rows were inserted into <code>T</code> outside of my script, that's if <code>#tmp</code> has auto-incremented the pkey to sync with T's in the first place. </p>
[ { "answer_id": 122661, "author": "Jasmine", "author_id": 5255, "author_profile": "https://Stackoverflow.com/users/5255", "pm_score": 1, "selected": false, "text": "set identity_insert on\n" }, { "answer_id": 122699, "author": "Cade Roux", "author_id": 18255, "author_p...
2008/09/23
[ "https://Stackoverflow.com/questions/122639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10088/" ]
122,641
<p>I have email addresses encoded with HTML character entities. Is there anything in .NET that can convert them to plain strings?</p>
[ { "answer_id": 122650, "author": "Daniel Schierbeck", "author_id": 20321, "author_profile": "https://Stackoverflow.com/users/20321", "pm_score": 3, "selected": false, "text": "Server.HtmlDecode" }, { "answer_id": 122658, "author": "Quintin Robinson", "author_id": 12707, ...
2008/09/23
[ "https://Stackoverflow.com/questions/122641", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7883/" ]
122,649
<p>I'm looking for a simple, easy to understand algorithm to alphabetically sort an array of characters in C.</p>
[ { "answer_id": 122671, "author": "dacracot", "author_id": 13930, "author_profile": "https://Stackoverflow.com/users/13930", "pm_score": 0, "selected": false, "text": "int[] bubble(int a[])\n {\n for (int i = a.length; --i>=0; )\n {\n for (int j = 0; j<i; j++)\n ...
2008/09/23
[ "https://Stackoverflow.com/questions/122649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6992/" ]
122,690
<p>I've been too lax with performing DB backups on our internal servers. </p> <p>Is there a simple command line program that I can use to backup certain databases in SQL Server 2005? Or is there a simple VBScript? </p>
[ { "answer_id": 122705, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 3, "selected": false, "text": "Use Master\n\nDeclare @ToExecute VarChar(8000)\n\nSelect @ToExecute = Coalesce(@ToExecute + 'Backup Database ' + [Name] + '...
2008/09/23
[ "https://Stackoverflow.com/questions/122690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/338/" ]
122,695
<p>For example, I have an ASP.NET form that is called by another aspx:</p> <pre><code>string url = "http://somewhere.com?P1=" + Request["param"]; Response.Write(url); </code></pre> <p>I want to do something like this:</p> <pre><code>string url = "http://somewhere.com?P1=" + Request["param"]; string str = GetResponse(url); if (str...) {} </code></pre> <p>I need to get whatever Response.Write is getting as a result or going to url, manipulate that response, and send something else back.</p> <p>Any help or a point in the right direction would be greatly appreciated.</p>
[ { "answer_id": 122707, "author": "John Sheehan", "author_id": 1786, "author_profile": "https://Stackoverflow.com/users/1786", "pm_score": 3, "selected": false, "text": "WebClient client = new WebClient();\nstring response = client.DownloadString(url);\n" } ]
2008/09/23
[ "https://Stackoverflow.com/questions/122695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20682/" ]
122,714
<p>When I try the following lookup in my code:</p> <pre><code>Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); return (DataSource) envCtx.lookup("jdbc/mydb"); </code></pre> <p>I get the following exception:</p> <pre><code>java.sql.SQLException: QueryResults: Unable to initialize naming context: Name java:comp is not bound in this Context at com.onsitemanager.database.ThreadLocalConnection.getConnection (ThreadLocalConnection.java:130) at ... </code></pre> <p>I installed embedded JBoss following the JBoss <a href="http://wiki.jboss.org/wiki/Tomcat5.5.x?action=e&amp;windowstate=normal&amp;mode=view" rel="nofollow noreferrer">wiki instructions</a>. And I configured Tomcat using the "Scanning every WAR by default" deployment as specified in the <a href="http://wiki.jboss.org/wiki/EmbeddedAndTomcat" rel="nofollow noreferrer">configuration wiki page</a>.</p> <p>Quoting the config page:</p> <blockquote> <p>JNDI</p> <p>Embedded JBoss components like connection pooling, EJB, JPA, and transactions make extensive use of JNDI to publish services. Embedded JBoss overrides Tomcat's JNDI implementation by layering itself on top of Tomcat's JNDI instantiation. There are a few > reasons for this:</p> <ol> <li>To avoid having to declare each and every one of these services within server.xml</li> <li>To allow seemeless integration of the java:comp namespace between web apps and EJBs.</li> <li>Tomcat's JNDI implementation has a few critical bugs in it that hamper some JBoss components ability to work</li> <li>We want to provide the option for you of remoting EJBs and other services that can > be remotely looked up</li> </ol> </blockquote> <p>Anyone have any thoughts on how I can configure the JBoss naming service which according to the above quote is overriding Tomcat's JNDI implementation so that I can do a lookup on java:comp/env? </p> <p>FYI - My environment Tomcat 5.5.9, Seam 2.0.2sp, Embedded JBoss (Beta 3), </p> <p>Note: I do have a -ds.xml file for my database connection properly setup and accessible on the class path per the instructions.</p> <p>Also note: I have posted this question in embedded Jboss forum and seam user forum. </p>
[ { "answer_id": 6264195, "author": "Kirijav", "author_id": 787306, "author_profile": "https://Stackoverflow.com/users/787306", "pm_score": 1, "selected": false, "text": "<mbean code=\"org.jboss.naming.NamingAlias\" name=\"jboss.jmx:alias=testDatasource\">\n <attribute name=\"FromName\"...
2008/09/23
[ "https://Stackoverflow.com/questions/122714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5917/" ]
122,728
<p>I have a dilemma, I'm using Java and Oracle and trying to keep queries on PL/SQL side. Everything is OK, until I have these complex queries which may and may not have conditions. <br></p> <p>It's not hard in Java to put together <code>WHERE</code> clause with conditions, but it's not nice. And on PL/SQL side I also found out that the only possibility for <code>dynamic queries</code> is string manipulations like</p> <pre><code>IF inputname IS NOT NULL THEN query := query ||' and NAME=' || inputname; END IF; </code></pre> <p>Now I'm thinking, I'm leaving query in PL/SQL and sending <code>WHERE</code> clause with function parameter. Any good recommendations or examples please?</p>
[ { "answer_id": 122759, "author": "Kyle Burton", "author_id": 19784, "author_profile": "https://Stackoverflow.com/users/19784", "pm_score": 1, "selected": false, "text": "String selectQuery =\n (new SelectQuery())\n .addColumns(t1Col1, t1Col2, t2Col1)\n .addJoin(SelectQuery.JoinType.IN...
2008/09/23
[ "https://Stackoverflow.com/questions/122728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13114/" ]
122,736
<p>I have a stored procedure that consists of a single select query used to insert into another table based on some minor math that is done to the arguments in the procedure. Can I generate the plan used for this query by referencing the procedure somehow, or do I have to copy and paste the query and create bind variables for the input parameters?</p>
[ { "answer_id": 122817, "author": "Mike McAllister", "author_id": 16247, "author_profile": "https://Stackoverflow.com/users/16247", "pm_score": 4, "selected": true, "text": "alter session set tracefile_identifier = 'something-unique'\nalter session set sql_trace = true;\nalter session set...
2008/09/23
[ "https://Stackoverflow.com/questions/122736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9940/" ]
122,741
<p>OK, I have been working on a random image selector and queue system (so you don't see the same images too often).</p> <p>All was going swimmingly (as far as my crappy code does) <strong>until</strong> I got to the random bit. I wanted to test it, but how do you test for it? There is no <code>Debug.Assert(i.IsRandom)</code> (sadly) :D</p> <p>So, I got my brain on it after watering it with some tea and came up with the following, I was just wondering if I could have your thoughts?</p> <ul> <li>Basically I knew the <strong>random</strong> bit was the problem, so I ripped that out to a delegate (which would then be passed to the objects constructor).</li> <li>I then created a class that pretty much performs the same logic as the <em>live</em> code, but remembers the value selected in a private variable.</li> <li>I then threw that delegate to the live class and tested against that:</li> </ul> <p>i.e.</p> <pre><code>Debug.Assert(myObj.RndVal == RndIntTester.ValuePassed); </code></pre> <p>But I couldn't help but think, <strong>was I wasting my time?</strong> I ran that through lots of iterations to see if it fell over at any time etc.</p> <p>Do you think I was wasting my time with this? Or could I have got away with:</p> <p><img src="https://imgs.xkcd.com/comics/random_number.png" alt="Awesome Random Number Generator" /></p> <p><a href="https://stackoverflow.com/questions/122741/testing-for-random-value-thoughts-on-this-approach#122765">GateKiller's answer</a> reminded me of this:</p> <p><img src="https://www.random.org/analysis/dilbert.jpg" alt="Dilbert Random" /></p> <h2>Update to Clarify</h2> <ul> <li><strong>I should add that I basically never want to see the same result more than X number of times from a pool of Y size.</strong></li> <li>The addition of the test container basically allowed me to see if any of the previously selected images were &quot;randomly&quot; selected.</li> <li>I guess technically the thing here being tested in not the RNG (since I never wrote that code) but the fact that am I expecting <em>random</em> results from a limited pool, and I want to track them.</li> </ul>
[ { "answer_id": 122854, "author": "erickson", "author_id": 3474, "author_profile": "https://Stackoverflow.com/users/3474", "pm_score": 3, "selected": false, "text": "Item[] foo = …\nfor (int idx = foo.size(); idx > 1; --idx) {\n /* Pick random number from half-open interval [0, idx) */\n...
2008/09/23
[ "https://Stackoverflow.com/questions/122741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/832/" ]
122,749
<p>I've been creating snapins with the new MMC 3.0 classes and C#. I can't seem to find any examples of how to get rid of the "Console Root" node when creating the *.msc files. I looked through the examples in the SDK, but I can't seem to find anything for this.</p> <p>I have seen other snapins that do what I want, but I can't tell what version of MMC they are using.</p>
[ { "answer_id": 494402, "author": "Mark", "author_id": 37923, "author_profile": "https://Stackoverflow.com/users/37923", "pm_score": 4, "selected": true, "text": "New Window from Here" } ]
2008/09/23
[ "https://Stackoverflow.com/questions/122749", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12829/" ]
122,752
<p>I've seen <a href="https://stackoverflow.com/questions/55622/best-tools-for-working-with-docbook-xml-documents">Best tools for working with DocBook XML documents</a>, but my question is slightly different. Which is the currently recommended formatting toolchain - as opposed to editing tool - for XML DocBook?</p> <p>In Eric Raymond's <a href="https://rads.stackoverflow.com/amzn/click/com/0131429019" rel="nofollow noreferrer" rel="nofollow noreferrer">'The Art of Unix Programming'</a> from 2003 (an excellent book!), the suggestion is XML-FO (XML Formatting Objects), but I've since seen suggestions here that indicated that XML-FO is no longer under development (though I can no longer find that question on StackOverflow, so maybe it was erroneous).</p> <p>Assume I'm primarily interested in Unix/Linux (including MacOS X), but I wouldn't automatically ignore Windows-only solutions.</p> <p>Is <a href="http://xmlgraphics.apache.org/fop/" rel="nofollow noreferrer">Apache's FOP</a> the best way to go? Are there any alternatives?</p>
[ { "answer_id": 122922, "author": "Gustavo Carreno", "author_id": 8167, "author_profile": "https://Stackoverflow.com/users/8167", "pm_score": 5, "selected": true, "text": "AC_INIT(Makefile.in)\n\nFOP=fop.sh\nHHC=hhc\nXSLTPROC=xsltproc\n\nAC_ARG_WITH(fop, [ --with-fop Where to find Apach...
2008/09/23
[ "https://Stackoverflow.com/questions/122752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15168/" ]
122,763
<p>I have a dict, that looks like this:</p> <pre><code>{ 'foo': { 'opt1': 1, 'opt2': 2, }, 'foo/bar': { 'opt3': 3, 'opt4': 4, }, 'foo/bar/baz': { 'opt5': 5, 'opt6': 6, } } </code></pre> <p>And I need to get it to look like:</p> <pre><code>{ 'foo': { 'opt1': 1, 'opt2': 2, 'bar': { 'opt3': 3, 'opt4': 4, 'baz': { 'opt5': 5, 'opt6': 6, } } } } </code></pre> <p>I should point out that there can and will be multiple top-level keys ('foo' in this case). I could probably throw something together to get what i need, but I was hoping that there is a solution that's more efficient.</p>
[ { "answer_id": 122785, "author": "Armin Ronacher", "author_id": 19990, "author_profile": "https://Stackoverflow.com/users/19990", "pm_score": 4, "selected": true, "text": "def nest(d):\n rv = {}\n for key, value in d.iteritems():\n node = rv\n for part in key.split('/...
2008/09/23
[ "https://Stackoverflow.com/questions/122763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18866/" ]
122,767
<p>How can I mount a floppy image file using cygwin. I would like to mount the image, copy a file to the mounted drive, and then unmount it from the command line. </p> <p>I know you can use <a href="http://chitchat.at.infoseek.co.jp/vmware/vfd.html#beta" rel="nofollow noreferrer">Virtual Floppy Drive</a> in windows, but is there a way to do this in Cygwin?</p>
[ { "answer_id": 56815490, "author": "fjardon", "author_id": 657700, "author_profile": "https://Stackoverflow.com/users/657700", "pm_score": 1, "selected": false, "text": "./configure" } ]
2008/09/23
[ "https://Stackoverflow.com/questions/122767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415/" ]
122,772
<p>When I try to display the contents of a LOB (large object) column in SQL*Plus, it is truncated. How do I display the whole thing?</p>
[ { "answer_id": 122776, "author": "Anonymoose", "author_id": 2391, "author_profile": "https://Stackoverflow.com/users/2391", "pm_score": 7, "selected": true, "text": "SQL> set long 30000\nSQL> show long\nlong 30000\n" }, { "answer_id": 7272671, "author": "Kevin O'Donnell", ...
2008/09/23
[ "https://Stackoverflow.com/questions/122772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2391/" ]
122,778
<p>Under VS's external tools settings there is a "Use Output Window" check box that captures the tools command line output and dumps it to a VS tab.</p> <p>The question is: <em>can I get the same processing for my program when I hit F5?</em></p> <p><strong>Edit:</strong> FWIW I'm in C# but if that makes a difference to your answer then it's unlikely that your answer is what I'm looking for.</p> <p>What I want would take the output stream of the program and transfer it to the output tab in VS using the same devices that output redirection ('|' and '>') uses in the cmd prompt.</p>
[ { "answer_id": 123067, "author": "Mark", "author_id": 4405, "author_profile": "https://Stackoverflow.com/users/4405", "pm_score": 2, "selected": true, "text": "void my_printf(const char *format, ...)\n{\n char buf[2048];\n\n // get the arg list and format it into a string\n va_s...
2008/09/23
[ "https://Stackoverflow.com/questions/122778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1343/" ]
122,781
<p>I have a page in my desktop app, and I've implemented simple grab-and-pan. It works great.</p> <p>When you are panning in this way and you are release, the page stops dead where you dropped it.</p> <p>I'd like it to continue slightly with some momentum, and stop eventually. Rather like the 'throw' in the iPhone UI, I guess.</p> <p>I'm not really chasing perfection, just a very crude simple sense of being able to 'throw' that page.</p>
[ { "answer_id": 123067, "author": "Mark", "author_id": 4405, "author_profile": "https://Stackoverflow.com/users/4405", "pm_score": 2, "selected": true, "text": "void my_printf(const char *format, ...)\n{\n char buf[2048];\n\n // get the arg list and format it into a string\n va_s...
2008/09/23
[ "https://Stackoverflow.com/questions/122781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15721/" ]
122,782
<p>I'm looking to have two versions of BOOST compiled into a project at the same time. Ideally they should be usable along these lines:</p> <pre><code>boost_1_36_0::boost::shared_ptr&lt;SomeClass&gt; someClass = new SomeClass(); boost_1_35_0::boost::regex expression("[0-9]", boost_1_35_0::boost::regex_constants::basic); </code></pre>
[ { "answer_id": 122843, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 1, "selected": false, "text": "objcopy" }, { "answer_id": 123233, "author": "Eclipse", "author_id": 8701, "author_profile": "htt...
2008/09/23
[ "https://Stackoverflow.com/questions/122782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8701/" ]
122,799
<p>There is no summary available of the big O notation for operations on the most common data structures including arrays, linked lists, hash tables etc.</p>
[ { "answer_id": 17410009, "author": "Mobiletainment", "author_id": 1265240, "author_profile": "https://Stackoverflow.com/users/1265240", "pm_score": 6, "selected": false, "text": "+----------------------+----------+------------+----------+--------------+\n| | Insert ...
2008/09/23
[ "https://Stackoverflow.com/questions/122799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340748/" ]
122,815
<p>I'm looking for a groovy equivalent on .NET <a href="http://boo.codehaus.org/" rel="nofollow noreferrer">http://boo.codehaus.org/</a></p> <p>So far Boo looks interesting, but it is statically typed, yet does include some of the metaprogramming features I'd be looking for.</p> <p>Can anyone comment on the experience of using Boo and is it worth looking into for more than hobby purposes at a 1.0 Version? </p> <p><em>Edit</em>: Changed BOO to Boo</p>
[ { "answer_id": 17410009, "author": "Mobiletainment", "author_id": 1265240, "author_profile": "https://Stackoverflow.com/users/1265240", "pm_score": 6, "selected": false, "text": "+----------------------+----------+------------+----------+--------------+\n| | Insert ...
2008/09/23
[ "https://Stackoverflow.com/questions/122815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1129162/" ]
122,821
<p>I've got a Sharepoint WebPart which loads a custom User Control. The user control contains a Repeater which in turn contains several LinkButtons. </p> <p>In the RenderContent call in the Webpart I've got some code to add event handlers:</p> <pre><code> ArrayList nextPages = new ArrayList(); //populate nextPages .... AfterPageRepeater.DataSource = nextPages; AfterPageRepeater.DataBind(); foreach (Control oRepeaterControl in AfterPageRepeater.Controls) { if (oRepeaterControl is RepeaterItem) { if (oRepeaterControl.HasControls()) { foreach (Control oControl in oRepeaterControl.Controls) { if (oControl is LinkButton) { ((LinkButton)oControl).Click += new EventHandler(PageNavigateButton_Click); } } } } } </code></pre> <p>The function PageNavigateButton_Click is never called however. I can see it being added as an event handler in the debugger however.</p> <p>Any ideas? I'm stumped how to do this. </p>
[ { "answer_id": 122948, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 4, "selected": true, "text": "protected override void OnLoad(EventArge e)\n { base.OnLoad(e);\n EnsureChildControls();\n\n var linkButtons = from c...
2008/09/23
[ "https://Stackoverflow.com/questions/122821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21299/" ]
122,826
<p>Suppose you have a fairly large (~2.2 MLOC), fairly old (started more than 10 years ago) Windows desktop application in C/C++. About 10% of modules are external and don't have sources, only debug symbols.</p> <p>How would you go about reducing application's memory footprint in half? At least, what would you do to find out where memory is consumed?</p>
[ { "answer_id": 123054, "author": "Doug T.", "author_id": 8123, "author_profile": "https://Stackoverflow.com/users/8123", "pm_score": 0, "selected": false, "text": "Object arrayOfObjs[MAX_THAT_WILL_EVER_BE_USED];\n" } ]
2008/09/23
[ "https://Stackoverflow.com/questions/122826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20310/" ]
122,834
<p>Suppose there are two scripts Requester.php and Provider.php, and Requester requires processing from Provider and makes an http request to it (Provider.php?data="data"). In this situation, Provider quickly finds the answer, but to maintain the system must perform various updates throughout the database. Is there a way to immediately return the value to Requester, and then continue processing in Provider. </p> <p>Psuedo Code</p> <pre><code>Provider.php { $answer = getAnswer($_GET['data']); echo $answer; //SIGNAL TO REQUESTER THAT WE ARE FINISHED processDBUpdates(); return; } </code></pre>
[ { "answer_id": 122966, "author": "Michał Niedźwiedzki", "author_id": 2169, "author_profile": "https://Stackoverflow.com/users/2169", "pm_score": 0, "selected": false, "text": "ProviderCore" }, { "answer_id": 122997, "author": "William OConnor - csevb10", "author_id": 1008...
2008/09/23
[ "https://Stackoverflow.com/questions/122834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8880/" ]
122,853
<p>I want to get the size of an http:/.../file before I download it. The file can be a webpage, image, or a media file. Can this be done with HTTP headers? How do I download just the file HTTP header?</p>
[ { "answer_id": 122874, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 5, "selected": false, "text": "Content-Length" }, { "answer_id": 122984, "author": "mdb", "author_id": 8562, "author_profile": "...
2008/09/23
[ "https://Stackoverflow.com/questions/122853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
122,855
<p>Anyone know if it is possible to write an app that uses the Java Sound API on a system that doesn't actually have a hardware sound device?</p> <p>I have some code I've written based on the API that manipulates some audio and plays the result but I am now trying to run this in a server environment, where the audio will be recorded to a file instead of played to line out.</p> <p>The server I'm running on has no sound card, and I seem to be running into roadblocks with Java Sound not being able to allocate any lines if there is not a Mixer that supports it. (And with no hardware devices I'm getting no Mixers.)</p> <p>Any info would be much appreciated -</p> <p>thanks.</p>
[ { "answer_id": 122874, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 5, "selected": false, "text": "Content-Length" }, { "answer_id": 122984, "author": "mdb", "author_id": 8562, "author_profile": "...
2008/09/23
[ "https://Stackoverflow.com/questions/122855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8063/" ]
122,856
<p>Is there a built in dll that will give me a list of links from a string. I want to send in a string with valid html and have it parse all the links. I seem to remember there being something built into either .net or an unmanaged library.</p> <p>I found a couple open source projects that looked promising but I thought there was a built in module. If not I may have to use one of those. I just didn't want an external dependency at this point if it wasn't necessary.</p>
[ { "answer_id": 124524, "author": "Jacob Proffitt", "author_id": 1336, "author_profile": "https://Stackoverflow.com/users/1336", "pm_score": 3, "selected": false, "text": "<a>" } ]
2008/09/23
[ "https://Stackoverflow.com/questions/122856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1514/" ]
122,865
<p>I have a <code>div</code> and an <code>iframe</code> on the page the <code>div</code> has</p> <pre><code>z-index: 0; </code></pre> <p>the <code>iframe</code> has its content with a popup having a <code>z-index</code> of 1000</p> <pre><code>z-index: 1000; </code></pre> <p>However, the <code>div</code> still overshadows the popup in IE (but works fine in Firefox).</p> <p>Does anyone know what I can do?</p>
[ { "answer_id": 123199, "author": "Rich Adams", "author_id": 10018, "author_profile": "https://Stackoverflow.com/users/10018", "pm_score": 1, "selected": false, "text": "position: absolute;" } ]
2008/09/23
[ "https://Stackoverflow.com/questions/122865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2486/" ]
122,877
<p>So I've got some C code:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; /* putting one of the "char*"s here causes a segfault */ void main() { char* path = "/temp"; char* temp; strcpy(temp, path); } </code></pre> <p>This compiles, runs, and behaves as it looks. However, if one or both of the character pointers is declared as global variable, strcpy results in a segmentation fault. Why does this happen? Evidently there's an error in my understanding of scope.</p>
[ { "answer_id": 122885, "author": "terminus", "author_id": 9232, "author_profile": "https://Stackoverflow.com/users/9232", "pm_score": 3, "selected": false, "text": "temp = (char *)malloc(TEMP_SIZE);\n" }, { "answer_id": 122903, "author": "Martin York", "author_id": 14065,...
2008/09/23
[ "https://Stackoverflow.com/questions/122877", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12926/" ]
122,882
<p>What is the proper technique to have <strong>ThreadA</strong> signal <strong>ThreadB</strong> of some event, without having <strong>ThreadB</strong> sit blocked waiting for an event to happen?</p> <p>i have a background thread that will be filling a shared List&lt;T&gt;. i'm trying to find a way to asynchronously signal the "main" thread that there is data available to be picked up.</p> <hr> <p>i considered setting an event with an EventWaitHandle object, but i can't have my main thread sitting at an Event.WaitOne().</p> <hr> <p>i considered having a delegate callback, but a) i don't want the main thread doing work in the delegate: the thread needs to get back to work adding more stuff - i don't want it waiting while the delegate executes, and b) the delegate needs to be marshalled onto the main thread, but i'm not running a UI, i have no Control to .Invoke the delegate against.</p> <hr> <p>i considered have a delegate callback that simply starts a zero interval System.Windows.Forms.Timer (with thread access to the timer synchronized). This way the thread only needs to be stuck as it calls</p> <p><code>Timer.Enabled = true;</code></p> <p>but that seems like a hack.</p> <p>In the olden days my object would have created a hidden window and had the thread post messages to that hidden windows' HWND. i considered creating a hidden control, but i gather that you cannot .Invoke on a control with no handle created. Plus, i have no UI: my object could have been created on a web-server, service, or console, i don't want there to be a graphical control appearing - nor do i want to compile a dependency on System.Windows.Forms.</p> <hr> <p>i considered having my object expose an ISynchronizeInvoke interface, but then i would need to implement .Invoke(), and that's my problem.</p> <hr> <p>What is the proper technique to have thread A signal thread B of some event, without having thread B sit blocked waiting for an event to happen?</p>
[ { "answer_id": 123205, "author": "Leandro Oliveira", "author_id": 16610, "author_profile": "https://Stackoverflow.com/users/16610", "pm_score": 1, "selected": false, "text": "AutoResetEvent ev = new AutoResetEvent(false);\n...\nif(ev.WaitOne(0, false)) {\n // event happened\n}\nelse {\n...
2008/09/23
[ "https://Stackoverflow.com/questions/122882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
122,883
<p>Could someone please demystify interfaces for me or point me to some good examples? I keep seeing interfaces popup here and there, but I haven't ever really been exposed to good explanations of interfaces or when to use them.</p> <p>I am talking about interfaces in a context of interfaces vs. abstract classes.</p>
[ { "answer_id": 122941, "author": "Bob King", "author_id": 6897, "author_profile": "https://Stackoverflow.com/users/6897", "pm_score": 5, "selected": false, "text": "Public Interface IRollOver\n Sub RollOver()\nEnd Interface\n\nPublic Class Dog Implements IRollOver\n Public Sub Roll...
2008/09/23
[ "https://Stackoverflow.com/questions/122883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16820/" ]
122,902
<p>As someone who is only barely proficient in javascript, is jQuery right for me? Is there a better library to use? I've seen lots of posts related to jQuery and it seems to be the most effective way to incorporate javascript into ASP.NET applications.</p> <p>I've been out to <a href="http://jquery.com/" rel="noreferrer">jQuery's</a> site and have found the tutorials and other helpful information. Any other reference material (i.e books, blogs, etc.) would be helpful.</p> <p>Thanks!</p>
[ { "answer_id": 3312695, "author": "Nash", "author_id": 363842, "author_profile": "https://Stackoverflow.com/users/363842", "pm_score": 0, "selected": false, "text": " Many plug-Ins.\n\n Only 15KB on the client Side.\n\n Community is pretty huge to guide you.\n\n Easy to work with Ser...
2008/09/23
[ "https://Stackoverflow.com/questions/122902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19251/" ]
122,909
<p>I have a file. I want to get its contents into a blob column in my oracle database or into a blob variable in my PL/SQL program. What is the best way to do that?</p>
[ { "answer_id": 123017, "author": "cagcowboy", "author_id": 19629, "author_profile": "https://Stackoverflow.com/users/19629", "pm_score": 0, "selected": false, "text": "// Need as OracleConnection in mConnection\n\n// Set an EMPTY_BLOB()\nString update = \"UPDATE tablename\"+\n ...
2008/09/23
[ "https://Stackoverflow.com/questions/122909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13693/" ]
122,914
<p>Does anyone know any implementation of a templated cache of objects?</p> <ul> <li>You use a key to find object (the same as in std::map&lt;>)</li> <li>You specify a maximum number of objects that can be in the cache at the same time</li> <li>There are facilities to create an object not found in the cache</li> <li>There are facilities to know when an object is discarded from the cache</li> </ul> <p>For example : </p> <pre><code>typedef cache&lt;int, MyObj*&gt; MyCache; MyCache oCache; oCache.SetSize(1); oCache.Insert(make_pair(1, new MyObj()); oCache.Touch(1); MyObj* oldObj = oCache.Delete(1); ... </code></pre> <p>It can be as simple as a LRU or MRU cache.</p> <p>Any suggestions are welcomed!</p> <p>Nic</p>
[ { "answer_id": 35187400, "author": "Straw1239", "author_id": 3482801, "author_profile": "https://Stackoverflow.com/users/3482801", "pm_score": 1, "selected": false, "text": "template<typename K, typename V, typename Map = std::unordered_map<K, typename std::list<K>::iterator>>\nclass LRU...
2008/09/23
[ "https://Stackoverflow.com/questions/122914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18800/" ]
122,919
<p>I have this bit of javascript written with jQuery 1.2.5. It's contained inside the main function() of a plugin that I wrote. The plugin is a horizontal gallery scroller very similar to jCarousel. It does alot of auto calculating of widths and determines how many to scroll based on that and the size of the images, which is what all the calculations are that are going on.</p> <p>What my question is, how do I prevent this from firing off before a previous execution is finished. For instance, if I get a little click happy and just frantically mash down on <code>.digi_next</code>. Things don't go so well in the UI when that happens and I'd like to fix it :) I thought the answer might lie in <code>queue</code>, but all my attempts at using it haven't turned out anything worthwhile.</p> <pre><code> var self = this; $(".digi_next", this.container).click(function(){ var curLeft = $(".digi_container", self.container).css("left").split("px")[0]; var newLeft = (curLeft*1) - (self.containerPad + self.containerWidth) * self.show_photos; if (newLeft &lt; ((self.digi_gal_width - (self.containerPad + self.containerWidth) * self.show_photos)) * -1) { newLeft = ((self.digi_gal_width - (self.containerPad + self.containerWidth) * self.show_photos)) * -1; } $(".digi_container", self.container).animate({ left: newLeft + "px" }, self.rotateSpeed); }); </code></pre>
[ { "answer_id": 123091, "author": "Jim", "author_id": 8427, "author_profile": "https://Stackoverflow.com/users/8427", "pm_score": 4, "selected": true, "text": "var busy = false;\n$(\"...\").onclick(function() {\n if (busy) return false;\n busy = true;\n $(\"...\").animate(..., .....
2008/09/23
[ "https://Stackoverflow.com/questions/122919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13611/" ]
122,920
<p>I'd like to line up items approximately like this:</p> <pre><code>item1 item2 i3 longitemname i4 longitemname2 anotheritem i5 </code></pre> <p>Basically items of varying length arranged in a table like structure. The tricky part is the container for these can vary in size and I'd like to fit as many as I can in each row - in other words, I won't know beforehand how many items fit in a line, and if the page is resized the items should re-flow themselves to accommodate. E.g. initially 10 items could fit on each line, but on resize it could be reduced to 5.</p> <p>I don't think I can use an html table since I don't know the number of columns (since I don't know how many will fit on a line). I can use css to float them, but since they're of varying size they won't line up.</p> <p>So far the only thing I can think of is to use javascript to get the size of largest item, set the size of all items to that size, and float everything left.</p> <p>Any better suggestions?</p>
[ { "answer_id": 123405, "author": "cllpse", "author_id": 20946, "author_profile": "https://Stackoverflow.com/users/20946", "pm_score": 0, "selected": false, "text": "<ul style=\"float: left;\">\n <li>Short</li>\n <li>Loooong</li>\n <li>Even longer</li>\n</ul>\n<ul style=\"float: ...
2008/09/23
[ "https://Stackoverflow.com/questions/122920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13055/" ]
122,942
<p>I have a table <code>UserAliases</code> (<code>UserId, Alias</code>) with multiple aliases per user. I need to query it and return all aliases for a given user, the trick is to return them all in one column.</p> <p>Example:</p> <pre><code>UserId/Alias 1/MrX 1/MrY 1/MrA 2/Abc 2/Xyz </code></pre> <p>I want the query result in the following format:</p> <pre><code>UserId/Alias 1/ MrX, MrY, MrA 2/ Abc, Xyz </code></pre> <p>Thank you.</p> <p>I'm using SQL Server 2005.</p> <p>p.s. actual T-SQL query would be appreciated :)</p>
[ { "answer_id": 122980, "author": "CodeRedick", "author_id": 17145, "author_profile": "https://Stackoverflow.com/users/17145", "pm_score": 0, "selected": false, "text": "declare @result varchar(max)\n\n--must \"initialize\" result for this to work\nselect @result = ''\n\nselect @result = ...
2008/09/23
[ "https://Stackoverflow.com/questions/122942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3661/" ]
122,951
<p>I received the following exception when I was using the Regex class with the regular expression: (?'named a'asdf)</p> <pre><code>System.ArgumentException: parsing \"(?'named a'asdf)\" - Invalid group name: Group names must begin with a word character. </code></pre> <p>What is the problem with my regular expression?</p>
[ { "answer_id": 145351, "author": "hurst", "author_id": 10991, "author_profile": "https://Stackoverflow.com/users/10991", "pm_score": 2, "selected": false, "text": "(?<name> subexpression)" } ]
2008/09/23
[ "https://Stackoverflow.com/questions/122951", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12834/" ]
122,982
<p>Which checksum algorithm can you recommend in the following use case?</p> <p>I want to generate checksums of small JPEG files (~8 kB each) to check if the content changed. Using the filesystem's <em>date modified</em> is unfortunately not an option.<br/> The checksum <strong>need not</strong> be cryptographically strong but it should robustly indicate changes of any size.</p> <p>The second criterion is <strong>speed</strong> since it should be possible to process at least <em>hundreds</em> of images per second (on a modern CPU).</p> <p>The calculation will be done on a server with several clients. The clients send the images over Gigabit TCP to the server. So there's <strong>no disk I/O</strong> as bottleneck.</p>
[ { "answer_id": 5126944, "author": "Engin", "author_id": 264152, "author_profile": "https://Stackoverflow.com/users/264152", "pm_score": 3, "selected": false, "text": "static const uint32_t crctab[] = {\n 0x0,\n 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,\n 0x1a86...
2008/09/23
[ "https://Stackoverflow.com/questions/122982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4308/" ]
123,002
<p>So I've got maybe 10 objects each of which has 1-3 dependencies (which I think is ok as far as loose coupling is concerned) but also some settings that can be used to define behavior (timeout, window size, etc).</p> <p>Now before I started using an Inversion of Control container I would have created a factory and maybe even a simple ObjectSettings object for each of the objects that requires more than 1 setting to keep the size of the constructor to the recommended "less than 4" parameter size. I am now using an inversion of control container and I just don't see all that much of a point to it. Sure I might get a constructor with 7 parameters, but who cares? It's all being filled out by the IoC anyways.</p> <p>Am I missing something here or is this basically correct?</p>
[ { "answer_id": 142182, "author": "Lee", "author_id": 13943, "author_profile": "https://Stackoverflow.com/users/13943", "pm_score": 4, "selected": true, "text": "Number of constructor arguments Number of classes\n 0 57\n 1 ...
2008/09/23
[ "https://Stackoverflow.com/questions/123002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
123,003
<p>I need to determine the ID of a form field from within an action handler. The field is a part of a included facelets component and so the form will vary.</p> <p><strong>included.xhtml</strong> </p> <pre><code>&lt;ui:component&gt; &lt;h:inputText id="contained_field"/&gt; &lt;h:commandButton actionListener="#{backingBean.update}" value="Submit"/&gt; &lt;/ui:component&gt; </code></pre> <p><strong>example_containing.xhtml</strong></p> <pre><code>&lt;h:form id="containing_form"&gt; &lt;ui:include src="/included.xhtml"/&gt; &lt;/h:form&gt; </code></pre> <p>How may I determine the ID of the form in the <code>update</code> method at runtime? Or better yet, the ID of the input field directly.</p>
[ { "answer_id": 266221, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "public void update(javax.faces.event.ActionEvent ac) {\n javax.faces.component.UIComponent myCommand = ac.getComponent( )...
2008/09/23
[ "https://Stackoverflow.com/questions/123003", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4893/" ]
123,007
<p>I can't quite figure this out. Microsoft Access 2000, on the report total section I have totals for three columns that are just numbers. These <code>=Sum[(ThisColumn1)], 2, 3</code>, etc and those grand totls all work fine. </p> <p>I want to have another column that says <code>=Sum([ThisColumn1])+Sum([ThisColumn2]) + Sum([ThisColumn3])</code> but can't figure those one out. Just get a blank so I am sure there is an error.</p>
[ { "answer_id": 123022, "author": "Gordon Bell", "author_id": 16473, "author_profile": "https://Stackoverflow.com/users/16473", "pm_score": 3, "selected": true, "text": "=[GrandTotal1] + [GrandTotal2] + [GrandTotal3]\n" }, { "answer_id": 123032, "author": "Stephen Wrighton", ...
2008/09/23
[ "https://Stackoverflow.com/questions/123007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
123,057
<p>I have been having some issues with LINQ-To-SQL around memory usage. I'm using it in a Windows Service to do some processing, and I'm looping through a large amount of data that I'm pulling back from the context. Yes - I know I could do this with a stored procedure but there are reasons why that would be a less than ideal solution.</p> <p>Anyway, what I see basically is memory is not being released even after I call <code>context.SubmitChanges()</code>. So I end up having to do all sorts of weird things like only pull back 100 records at time, or create several contexts and have them all do separate tasks. If I keep the same <code>DataContext</code> and use it later for other calls, it just eats up more and more memory. Even if I call <code>Clear()</code> on the "<code>var tableRows</code>" array that the query returns to me, set it to null, and call <code>SYstem.GC.Collect()</code> - it still doesn't release the memory.</p> <p>Now I've read some about how you should use <code>DataContexts</code> quickly and dispose of them quickly, but it seems like their ought to be a way to force the context to dump all its data (or all its tracking data for a particular table) at a certain point to guarantee the memory is free.</p> <p>Anyone know what steps guarantee that the memory is released?</p>
[ { "answer_id": 123081, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 5, "selected": false, "text": "IDisposable" }, { "answer_id": 127583, "author": "Sam Schutte", "author_id": 146, "author_profile": "https...
2008/09/23
[ "https://Stackoverflow.com/questions/123057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/146/" ]
123,075
<p>How to do paging in Pervasive SQL (version 9.1)? I need to do something similar like:</p> <pre><code>//MySQL SELECT foo FROM table LIMIT 10, 10 </code></pre> <p>But I can't find a way to define offset.</p>
[ { "answer_id": 123168, "author": "Jasmine", "author_id": 5255, "author_profile": "https://Stackoverflow.com/users/5255", "pm_score": 0, "selected": false, "text": "create table #keys (rownum int identity(1,1), key varchar(10))\n\ninsert #keys (key)\nselect TOP 89 key from myTable ORDER B...
2008/09/23
[ "https://Stackoverflow.com/questions/123075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5468/" ]
123,078
<p>On destruction of a restful resource, I want to guarantee a few things before I allow a destroy operation to continue? Basically, I want the ability to stop the destroy operation if I note that doing so would place the database in a invalid state? There are no validation callbacks on a destroy operation, so how does one "validate" whether a destroy operation should be accepted?</p>
[ { "answer_id": 123190, "author": "Airsource Ltd", "author_id": 18017, "author_profile": "https://Stackoverflow.com/users/18017", "pm_score": 7, "selected": true, "text": "class Booking < ActiveRecord::Base\n has_many :booking_payments\n ....\n def destroy\n raise \"Cannot delete ...
2008/09/23
[ "https://Stackoverflow.com/questions/123078", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21317/" ]
123,080
<p>I know that this is somewhat subjective, but I wonder if there is a generally accepted standard for naming assemblies which contain some "core" functions.</p> <p>Let's say you got a larger Projects, with Assemblies like</p> <ul> <li>Company.Product.WebControls.dll</li> <li>Company.Product.Net.dll</li> <li>Company.Product.UserPages.dll</li> </ul> <p>and you have a Bunch of "Core" classes, like the Global Error Handler, the global Logging functionality etc.</p> <p>How would such an assembly generally named? Here are some things I had in mind:</p> <ul> <li>Company.Product.dll</li> <li>Company.Product.Core.dll</li> <li>Company.Product.Global.dll</li> <li>Company.Product.Administration.dll</li> </ul> <p>Now, while "just pick one and go on" will not cause Armageddon, I'd still like to know if there is an "accepted" way to name those assemblies.</p>
[ { "answer_id": 123150, "author": "Quintin Robinson", "author_id": 12707, "author_profile": "https://Stackoverflow.com/users/12707", "pm_score": 2, "selected": false, "text": "Root" }, { "answer_id": 146578, "author": "Seb Nilsson", "author_id": 2429, "author_profile":...
2008/09/23
[ "https://Stackoverflow.com/questions/123080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
123,088
<p><strong>C#6 Update</strong></p> <p>In <a href="https://msdn.microsoft.com/en-us/magazine/dn802602.aspx" rel="nofollow noreferrer">C#6 <code>?.</code> is now a language feature</a>:</p> <pre><code>// C#1-5 propertyValue1 = myObject != null ? myObject.StringProperty : null; // C#6 propertyValue1 = myObject?.StringProperty; </code></pre> <p>The question below still applies to older versions, but if developing a new application using the new <code>?.</code> operator is far better practice.</p> <p><strong>Original Question:</strong></p> <p>I regularly want to access properties on possibly null objects:</p> <pre><code>string propertyValue1 = null; if( myObject1 != null ) propertyValue1 = myObject1.StringProperty; int propertyValue2 = 0; if( myObject2 != null ) propertyValue2 = myObject2.IntProperty; </code></pre> <p>And so on...</p> <p>I use this so often that I have a snippet for it.</p> <p>You can shorten this to some extent with an inline if:</p> <pre><code>propertyValue1 = myObject != null ? myObject.StringProperty : null; </code></pre> <p>However this is a little clunky, especially if setting lots of properties or if more than one level can be null, for instance:</p> <pre><code>propertyValue1 = myObject != null ? (myObject.ObjectProp != null ? myObject.ObjectProp.StringProperty) : null : null; </code></pre> <p>What I really want is <code>??</code> style syntax, which works great for directly null types:</p> <pre><code>int? i = SomeFunctionWhichMightReturnNull(); propertyValue2 = i ?? 0; </code></pre> <p>So I came up with the following:</p> <pre><code>public static TResult IfNotNull&lt;T, TResult&gt;( this T input, Func&lt;T, TResult&gt; action, TResult valueIfNull ) where T : class { if ( input != null ) return action( input ); else return valueIfNull; } //lets us have a null default if the type is nullable public static TResult IfNotNull&lt;T, TResult&gt;( this T input, Func&lt;T, TResult&gt; action ) where T : class where TResult : class { return input.IfNotNull( action, null ); } </code></pre> <p>This lets me us this syntax:</p> <pre><code>propertyValue1 = myObject1.IfNotNull( x =&gt; x.StringProperty ); propertyValue2 = myObject2.IfNotNull( x =&gt; x.IntProperty, 0); //or one with multiple levels propertyValue1 = myObject.IfNotNull( o =&gt; o.ObjectProp.IfNotNull( p =&gt; p.StringProperty ) ); </code></pre> <p>This simplifies these calls, but I'm not sure about checking this sort of extension method in - it does make the code a little easier to read, but at the cost of extending object. This would appear on everything, although I could put it in a specifically referenced namespace.</p> <p>This example is a rather simple one, a slightly more complex one would be comparing two nullable object properties:</p> <pre><code>if( ( obj1 == null &amp;&amp; obj2 == null ) || ( obj1 != null &amp;&amp; obj2 != null &amp;&amp; obj1.Property == obj2.Property ) ) ... //becomes if( obj1.NullCompare( obj2, (x,y) =&gt; x.Property == y.Property ) ... </code></pre> <p>What are the pitfalls of using extensions in this way? Are other coders likely to be confused? Is this just abuse of extensions?</p> <hr> <p>I guess what I really want here is a compiler/language extension:</p> <pre><code>propertyValue1 = myObject != null ? myObject.StringProperty : null; //becomes propertyValue1 = myObject?StringProperty; </code></pre> <p>This would make the complex case far easier:</p> <pre><code>propertyValue1 = myObject != null ? (myObject.ObjectProp != null ? myObject.ObjectProp.StringProperty) : null //becomes propertyValue1 = myObject?ObjectProp?StringProperty; </code></pre> <p>This would only work for value types, but you could return nullable equivalents:</p> <pre><code>int? propertyValue2 = myObject?ObjectProp?IntProperty; //or int propertyValue3 = myObject?ObjectProp?IntProperty ?? 0; </code></pre>
[ { "answer_id": 123140, "author": "Swati", "author_id": 12682, "author_profile": "https://Stackoverflow.com/users/12682", "pm_score": 0, "selected": false, "text": "if( obj1.NullCompare( obj2, (x,y) => x.Property == y.Property ) \n" }, { "answer_id": 123496, "author": "James C...
2008/09/23
[ "https://Stackoverflow.com/questions/123088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/905/" ]
123,105
<p>Is there a window manager for <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_2008" rel="nofollow noreferrer">Visual&nbsp;Studio&nbsp;2008</a> like <a href="http://www.codeplex.com/VSWindowManager" rel="nofollow noreferrer">this one</a>. I really liked it, and that's all I used in <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_2005" rel="nofollow noreferrer">Visual&nbsp;Studio&nbsp;2005</a> and saw somewhere it is supposed to work in Visual&nbsp;Studio&nbsp;2008, but it doesn't. I have tried it on many installations of Visual&nbsp;Studio&nbsp;2008, and it doesn't remember any settings. I really liked being able to easily change window layout quickly. Right now I just manually import and export settings, but it's not an instant process.</p> <p>What do I have to do to make it work?</p>
[ { "answer_id": 338016, "author": "pettys", "author_id": 27846, "author_profile": "https://Stackoverflow.com/users/27846", "pm_score": 1, "selected": false, "text": "Sub DualMonitorConfiguration_Save()\n SaveWindowConfiguration(\"Dual Monitor Layout\")\nEnd Sub\n\nSub DualMonitorConfig...
2008/09/23
[ "https://Stackoverflow.com/questions/123105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14642/" ]
123,111
<p>I recently moved my website to a shared hosting solution at <a href="http://asmallorange.com" rel="nofollow noreferrer">asmallorange.com</a>, but I had to set my domain to use their provided nameservers in order for the site to properly resolve. I was determined to keep control of the domain's DNS but I could find no way to make my top level domain resolve to the shared location which was in the format of </p> <pre><code>server.asmallorange.com/~username </code></pre> <p>So I know I'm missing something here, my question is this: </p> <p><strong>What in their nameservers/DNS entry makes it possible for <em>server.sharedhost.com/~username</em> to serve as a top level domain? (ie. <a href="http://topleveldomain.com" rel="nofollow noreferrer">http://topleveldomain.com</a>)</strong></p>
[ { "answer_id": 123133, "author": "cjm", "author_id": 8355, "author_profile": "https://Stackoverflow.com/users/8355", "pm_score": 4, "selected": true, "text": "Host: topleveldomain.com" } ]
2008/09/23
[ "https://Stackoverflow.com/questions/123111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1339/" ]
123,114
<p>So I have logical entities (person, country, etc.), GUI elements / controls, data and navigation controllers / managers, then things like quad-trees and timers, and I always struggle with cleanly separating these things into logical namespaces.</p> <p>I usually have something like this:</p> <ul> <li>Leviathan.GUI.Controls</li> <li>Leviathan.GUI.Views</li> <li>Leviathan.Entities</li> <li>Leviathan.Controllers (data and other stuff)</li> <li>Leviathan.Helpers (trees and other stuff)</li> </ul> <p>Are there any good guides on this? I need to stop this mess.</p>
[ { "answer_id": 123138, "author": "Lou Franco", "author_id": 3937, "author_profile": "https://Stackoverflow.com/users/3937", "pm_score": 2, "selected": false, "text": "Company.Product.Tier.Sub.Sub\n" } ]
2008/09/23
[ "https://Stackoverflow.com/questions/123114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13466/" ]
123,127
<p>I am running my junit tests via ant and they are running substantially slower than via the IDE. My ant call is:</p> <pre><code> &lt;junit fork="yes" forkmode="once" printsummary="off"&gt; &lt;classpath refid="test.classpath"/&gt; &lt;formatter type="brief" usefile="false"/&gt; &lt;batchtest todir="${test.results.dir}/xml"&gt; &lt;formatter type="xml"/&gt; &lt;fileset dir="src" includes="**/*Test.java" /&gt; &lt;/batchtest&gt; &lt;/junit&gt; </code></pre> <p>The same test that runs in near instantaneously in my IDE (0.067s) takes 4.632s when run through Ant. In the past, I've been able to speed up test problems like this by using the junit fork parameter but this doesn't seem to be helping in this case. What properties or parameters can I look at to speed up these tests?</p> <p>More info:</p> <p>I am using the reported time from the IDE vs. the time that the junit task outputs. This is not the sum total time reported at the end of the ant run.</p> <p>So, bizarrely, this problem has resolved itself. What could have caused this problem? The system runs on a local disk so that is not the problem.</p>
[ { "answer_id": 140974, "author": "bsanders", "author_id": 22200, "author_profile": "https://Stackoverflow.com/users/22200", "pm_score": 2, "selected": false, "text": "<jvmarg>" }, { "answer_id": 377899, "author": "Risser", "author_id": 7773, "author_profile": "https:/...
2008/09/23
[ "https://Stackoverflow.com/questions/123127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6180/" ]
123,144
<p>I have a custom server control that loads data from a web service into a GridView. Works fine on my page. I want to be able to click on a row and pop a popupcontrol with more detail on the clicked row. I am using the client side events of the DevExpress gridview to handle the onclick. And from JavaScript I am calling a callbackpanel to access my custom server control to get properties to use in the popupcontrol. In the callback, the properties on my server control (which were previously set in order to display the data) are not set, yet any of the other standard controls on the page still have their property settings. Am I missing a setting in my customer server control that will persist my property settings into a callback?</p>
[ { "answer_id": 140974, "author": "bsanders", "author_id": 22200, "author_profile": "https://Stackoverflow.com/users/22200", "pm_score": 2, "selected": false, "text": "<jvmarg>" }, { "answer_id": 377899, "author": "Risser", "author_id": 7773, "author_profile": "https:/...
2008/09/23
[ "https://Stackoverflow.com/questions/123144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20581/" ]
123,154
<p>I'm working on a .NET WinForms app that needs to print a FEDEX shipping label. As part of the FedEx api, I can get raw label data for the printer. </p> <p>I just don't know how to send that data to the printer through .NET (I'm using C#). To be clear, the data is already pre formatted into ZPL (Zebra printer language) I just need to send it to the printer without windows mucking it up.</p>
[ { "answer_id": 123200, "author": "Austin Salonen", "author_id": 4068, "author_profile": "https://Stackoverflow.com/users/4068", "pm_score": 1, "selected": false, "text": "private void SendPrintJob(string job)\n{\n TcpClient client = null;\n NetworkStream ns = null;\n byte[] byte...
2008/09/23
[ "https://Stackoverflow.com/questions/123154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21325/" ]
123,159
<p>Has anyone done this? Basically, I want to use the html by keeping basic tags such as h1, h2, em, etc; clean all non http addresses in the img and a tags; and HTMLEncode every other tag. </p> <p>I'm stuck at the HTML Encoding part. I know to remove a node you do a "node.ParentNode.RemoveChild(node);" where node is the object of the class HtmlNode. Instead of removing the node though, I want to HTMLEncode it. </p>
[ { "answer_id": 123522, "author": "Derek Slager", "author_id": 18636, "author_profile": "https://Stackoverflow.com/users/18636", "pm_score": 1, "selected": false, "text": "node.AppendChild(new HtmlTextNode { Text = HttpUtility.HtmlEncode(nodeToDelete.OuterHtml) });\n" } ]
2008/09/23
[ "https://Stackoverflow.com/questions/123159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10352/" ]
123,181
<p>Is there a way to test if an object is a dictionary?</p> <p>In a method I'm trying to get a value from a selected item in a list box. In some circumstances, the list box might be bound to a dictionary, but this isn't known at compile time.</p> <p>I would like to do something similar to this:</p> <pre><code>if (listBox.ItemsSource is Dictionary&lt;??&gt;) { KeyValuePair&lt;??&gt; pair = (KeyValuePair&lt;??&gt;)listBox.SelectedItem; object value = pair.Value; } </code></pre> <p>Is there a way to do this dynamically at runtime using reflection? I know it's possible to use reflection with generic types and determine the key/value parameters, but I'm not sure if there's a way to do the rest after those values are retrieved.</p>
[ { "answer_id": 123191, "author": "Guvante", "author_id": 16800, "author_profile": "https://Stackoverflow.com/users/16800", "pm_score": 4, "selected": false, "text": "if (listBox.ItemsSource is IDictionary)\n{\n DictionaryEntry pair = (DictionaryEntry)listBox.SelectedItem;\n object ...
2008/09/23
[ "https://Stackoverflow.com/questions/123181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12999/" ]
123,188
<p>In C# when I am done entering the fields of a snippet, I can hit Enter to get to the next line. What is the equivalent Key in VB?</p> <p>Edit: I prefer not to use the mouse.</p>
[ { "answer_id": 123390, "author": "Nescio", "author_id": 14484, "author_profile": "https://Stackoverflow.com/users/14484", "pm_score": 3, "selected": true, "text": "private _$PropertyName$ As $PropertyType$\nPublic WriteOnly Property $PropertyName$() As $PropertyType$\n Set(ByVal valu...
2008/09/23
[ "https://Stackoverflow.com/questions/123188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14484/" ]
123,198
<p>How do I copy a file in Python?</p>
[ { "answer_id": 123212, "author": "Swati", "author_id": 12682, "author_profile": "https://Stackoverflow.com/users/12682", "pm_score": 13, "selected": true, "text": "shutil" }, { "answer_id": 123226, "author": "Airsource Ltd", "author_id": 18017, "author_profile": "http...
2008/09/23
[ "https://Stackoverflow.com/questions/123198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17693/" ]
123,216
<p>I can't make td "Date" to have fixed height. If there is less in Body section td Date element is bigger than it should be - even if I set Date height to 10% and Body height to 90%. Any suggestions?</p> <pre><code>&lt;tr&gt; &lt;td class="Author" rowspan="2"&gt; &lt;a href="#"&gt;Claude&lt;/a&gt;&lt;br /&gt; &lt;a href="#"&gt;&lt;img src="Users/4/Avatar.jpeg" style="border-width:0px;" /&gt;&lt;/a&gt; &lt;/td&gt; &lt;td class="Date"&gt; Sent: &lt;span&gt;18.08.2008 20:49:28&lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="Body"&gt; &lt;span&gt;Id lacinia lacus arcu non quis mollis sit. Ligula elit. Ultricies elit cursus. Quis ipsum nec rutrum id tellus aliquam. Tortor arcu fermentum nibh justo leo ante vitae fringilla. Pulvinar aliquam. Fringilla mollis facilisis.&lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>And my css for now is: </p> <pre><code>table.ForumThreadViewer td.Date { text-align: left; vertical-align: top; font-size: xx-small; border-bottom: solid 1 black; height: 20px; } table.ForumThreadViewer td.Body { text-align: left; vertical-align: top; border-top: solid 1 black; } table.ForumThreadViewer td.Author { vertical-align: top; text-align: left; } </code></pre> <p>It's working for FF but not for IE. :(</p>
[ { "answer_id": 123245, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 0, "selected": false, "text": ".Date {\n height: 50px;\n}\n" }, { "answer_id": 123248, "author": "roryf", "author_id": 270, "...
2008/09/23
[ "https://Stackoverflow.com/questions/123216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3182/" ]
123,235
<p>I was trying to remove all the lines of a file except the last line but the following command did not work, although file.txt is not empty.</p> <pre><code>$cat file.txt |tail -1 &gt; file.txt $cat file.txt </code></pre> <p>Why is it so?</p>
[ { "answer_id": 123249, "author": "Lewis Baumstark", "author_id": 12000, "author_profile": "https://Stackoverflow.com/users/12000", "pm_score": 0, "selected": false, "text": "$cat file.txt | tail -1 > anotherfile.txt\n" }, { "answer_id": 123260, "author": "Charles Duffy", ...
2008/09/23
[ "https://Stackoverflow.com/questions/123235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
123,236
<p>We have a customer requesting data in XML format. Normally this is not required as we usually just hand off an Access database or csv files and that is sufficient. However in this case I need to automate the exporting of proper XML from a dozen tables.</p> <p>If I can do it out of SQL Server 2005, that would be preferred. However I can't for the life of me find a way to do this. I can dump out raw xml data but this is just a tag per row with attribute values. We need something that represents the structure of the tables. Access has an export in xml format that meets our needs. However I'm not sure how this can be automated. It doesn't appear to be available in any way through SQL so I'm trying to track down the necessary code to export the XML through a macro or vbscript.</p> <p>Any suggestions?</p>
[ { "answer_id": 123282, "author": "ConroyP", "author_id": 2287, "author_profile": "https://Stackoverflow.com/users/2287", "pm_score": 0, "selected": false, "text": "Const acExportTable = 0\n\nSet objAccess = CreateObject(\"Access.Application\")\nobjAccess.OpenCurrentDatabase \"C:\\Scripts...
2008/09/23
[ "https://Stackoverflow.com/questions/123236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8345/" ]
123,239
<p>This is a sample (edited slightly, but you get the idea) of my XML file:</p> <pre><code>&lt;HostCollection&gt; &lt;ApplicationInfo /&gt; &lt;Hosts&gt; &lt;Host&gt; &lt;Name&gt;Test&lt;/Name&gt; &lt;IP&gt;192.168.1.1&lt;/IP&gt; &lt;/Host&gt; &lt;Host&gt; &lt;Name&gt;Test&lt;/Name&gt; &lt;IP&gt;192.168.1.2&lt;/IP&gt; &lt;/Host&gt; &lt;/Hosts&gt; &lt;/HostCollection&gt; </code></pre> <p>When my application (VB.NET app) loads, I want to loop through the list of hosts and their attributes and add them to a collection. I was hoping I could use the XPathNodeIterator for this. The examples I found online seemed a little muddied, and I'm hoping someone here can clear things up a bit.</p>
[ { "answer_id": 123275, "author": "kitsune", "author_id": 13466, "author_profile": "https://Stackoverflow.com/users/13466", "pm_score": 3, "selected": true, "text": "Dim doc As XmlDocument = New XmlDocument()\ndoc.Load(\"hosts.xml\")\nDim nodeList as XmlNodeList\nnodeList = doc.SelectNode...
2008/09/23
[ "https://Stackoverflow.com/questions/123239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5473/" ]
123,263
<p>I'm reading text from a flat file in c# and need to test whether certain values are dates. They could be in either YYYYMMDD format or MM/DD/YY format. What is the simplest way to do this in .Net?</p>
[ { "answer_id": 123294, "author": "Paul van Brenk", "author_id": 1837197, "author_profile": "https://Stackoverflow.com/users/1837197", "pm_score": 6, "selected": true, "text": "string[] formats = {\"yyyyMMdd\", \"MM/dd/yy\"};\nvar Result = DateTime.ParseExact(input, formats, CultureInfo.C...
2008/09/23
[ "https://Stackoverflow.com/questions/123263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20625/" ]
123,323
<p>How many messages does the queue for a standard window hold? What happens when the queue overflows?</p> <p>The documentation for <code>GetMessage</code> and relatives doesn't say anything about this, and <code>PeekMessage</code> only gives you a yes/no for certain classes of messages, not a message count.</p> <p><a href="http://msdn.microsoft.com/en-us/library/aa925082.aspx" rel="noreferrer">This page</a> says that the queues are implemented using memory-mapped files, and that there is no message count limit, but that page is about WinCE. Does this apply to desktop Win32 as well?</p>
[ { "answer_id": 123331, "author": "Corey Trager", "author_id": 9328, "author_profile": "https://Stackoverflow.com/users/9328", "pm_score": 5, "selected": true, "text": "PostMessage" } ]
2008/09/23
[ "https://Stackoverflow.com/questions/123323", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1319/" ]
123,334
<p>NOTE: I am not set on using VI, it is just the first thing that came to mind that might be able to do what I need. Feel free to suggest any other program.</p> <p>I have a form with nearly 100 fields that I would like to auto-fill with PHP. I know how to do the autofill, but I would like to avoid manually adding the needed text to 100 fields.</p> <p>Is there an automated way I can take the text:</p> <pre><code>&lt;input name="riskRating" id="riskRating" type="text" /&gt; </code></pre> <p>and change it to:</p> <pre><code>&lt;input name="riskRating" id="riskRating" type="text" value="&lt;?php echo $data['riskRating']; ?&gt;" /&gt; </code></pre> <p>Remember that I am wanting to do this to almost 100 fields. I am trying to avoid going to each field, pasting in the PHP code and changing the variable name manually.</p> <p>I'm hoping some VI guru out there knows off the top of his/her head.</p>
[ { "answer_id": 123373, "author": "Zsolt Botykai", "author_id": 11621, "author_profile": "https://Stackoverflow.com/users/11621", "pm_score": 2, "selected": false, "text": ":%s:\\(<input name=\"\\([^\"]\\+\\)\" id=\"[^\"]\\+\" type=\"text\" \\)/>:\\1value=\"<?php echo $data ['\\2']; ?>\" ...
2008/09/23
[ "https://Stackoverflow.com/questions/123334", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16292/" ]