qid
int64
4
8.14M
question
stringlengths
20
48.3k
answers
list
date
stringlengths
10
10
metadata
list
input
stringlengths
12
45k
output
stringlengths
2
31.8k
359,887
<p>I am building a search box (input field) which should make a server call to filter a grid with the text being inserted on it but I need to make this in an smart way, I need to fire the server call only if the user has stopped. Right now I'm trying to implement it, but if someone knows how to do it I'll be very plea...
[ { "answer_id": 359908, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 6, "selected": true, "text": "<ol>\n<li>When a key is pressed:\n\n<ol>\n<li>Check if there's an existing timer - stop it if there is one</li>\n<li>start a ti...
2008/12/11
[ "https://Stackoverflow.com/questions/359887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33205/" ]
I am building a search box (input field) which should make a server call to filter a grid with the text being inserted on it but I need to make this in an smart way, I need to fire the server call only if the user has stopped. Right now I'm trying to implement it, but if someone knows how to do it I'll be very pleased...
1. When a key is pressed: 1. Check if there's an existing timer - stop it if there is one 2. start a timer. 2. When the timer expires, call the server method. ``` var searchTimeout; document.getElementById('searchBox').onkeypress = function () { if (searchTimeout != undefined) clearTimeout(searchTimeout); se...
359,891
<p>I've hit upon a problem with WSADuplicateSocket, which I'm using to duplicate a socket for use by a different process. It works find when both processes are running under the same Windows user, but fails with error code 10022 (WSAEINVAL) when they are running under different users.</p> <p>Specifically, the process ...
[ { "answer_id": 359908, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 6, "selected": true, "text": "<ol>\n<li>When a key is pressed:\n\n<ol>\n<li>Check if there's an existing timer - stop it if there is one</li>\n<li>start a ti...
2008/12/11
[ "https://Stackoverflow.com/questions/359891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35090/" ]
I've hit upon a problem with WSADuplicateSocket, which I'm using to duplicate a socket for use by a different process. It works find when both processes are running under the same Windows user, but fails with error code 10022 (WSAEINVAL) when they are running under different users. Specifically, the process calling WS...
1. When a key is pressed: 1. Check if there's an existing timer - stop it if there is one 2. start a timer. 2. When the timer expires, call the server method. ``` var searchTimeout; document.getElementById('searchBox').onkeypress = function () { if (searchTimeout != undefined) clearTimeout(searchTimeout); se...
359,894
<p>I'm using an image component that has a FromBinary method. Wondering how do I convert my input stream into a byte array</p> <pre><code>HttpPostedFile file = context.Request.Files[0]; byte[] buffer = new byte[file.ContentLength]; file.InputStream.Read(buffer, 0, file.ContentLength); ImageElement image = ImageElemen...
[ { "answer_id": 359984, "author": "Wolfwyrd", "author_id": 15570, "author_profile": "https://Stackoverflow.com/users/15570", "pm_score": 9, "selected": true, "text": "<p>Use a BinaryReader object to return a byte array from the stream like:</p>\n\n<pre><code>byte[] fileData = null;\nusing...
2008/12/11
[ "https://Stackoverflow.com/questions/359894", "https://Stackoverflow.com", "https://Stackoverflow.com/users/461880/" ]
I'm using an image component that has a FromBinary method. Wondering how do I convert my input stream into a byte array ``` HttpPostedFile file = context.Request.Files[0]; byte[] buffer = new byte[file.ContentLength]; file.InputStream.Read(buffer, 0, file.ContentLength); ImageElement image = ImageElement.FromBinary(b...
Use a BinaryReader object to return a byte array from the stream like: ``` byte[] fileData = null; using (var binaryReader = new BinaryReader(Request.Files[0].InputStream)) { fileData = binaryReader.ReadBytes(Request.Files[0].ContentLength); } ```
359,895
<p>I'm seeing a lot of Javascript errors in IE8 on pages which worked fine in IE7 (and Firefox, Chrome, and Safari). I know that IE made some changes to things like Javascript security. Some of these don't give clear error messages - things like cross-domain violations can end up throwing very vague exceptions.</p> <p...
[ { "answer_id": 359980, "author": "Jon Galloway", "author_id": 5, "author_profile": "https://Stackoverflow.com/users/5", "pm_score": 2, "selected": false, "text": "<p>I found a few lists here: <a href=\"http://social.msdn.microsoft.com/forums/en-US/iewebdevelopment/thread/772e4b07-29e1-49...
2008/12/11
[ "https://Stackoverflow.com/questions/359895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5/" ]
I'm seeing a lot of Javascript errors in IE8 on pages which worked fine in IE7 (and Firefox, Chrome, and Safari). I know that IE made some changes to things like Javascript security. Some of these don't give clear error messages - things like cross-domain violations can end up throwing very vague exceptions. Let's mak...
I can verify that the ones posted by "unique\_username" are accurate! (quote) Actually a TON of stuff has changed. First off, it REALLY matters what mode you are in. In IE8, there are 3 (THREE) modes. * IE5 Quirks - your page has no doctype, page renders like IE5 did * IE 7 Standards Mode - you have a doctype, but e...
359,903
<p>Kind of a weird question, but. I need to have a list of strings i need to make sure that every string in that list is the same.</p> <p>E.g:</p> <pre><code>a = ['foo', 'foo', 'boo'] #not valid b = ['foo', 'foo', 'foo'] #valid </code></pre> <p>Whats the best way to go about doing that?</p> <p>FYI, i don't know how...
[ { "answer_id": 359945, "author": "Jordan Parmer", "author_id": 20133, "author_profile": "https://Stackoverflow.com/users/20133", "pm_score": 4, "selected": true, "text": "<p>Use list.count to get the number of items in a list that match a value. If that number doesn't match the number o...
2008/12/11
[ "https://Stackoverflow.com/questions/359903", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34395/" ]
Kind of a weird question, but. I need to have a list of strings i need to make sure that every string in that list is the same. E.g: ``` a = ['foo', 'foo', 'boo'] #not valid b = ['foo', 'foo', 'foo'] #valid ``` Whats the best way to go about doing that? FYI, i don't know how many strings are going to be in the lis...
Use list.count to get the number of items in a list that match a value. If that number doesn't match the number of items, you know they aren't all the same. ``` if a.count( "foo" ) != len(a) ``` Which would look like... ``` if a.count( a[0] ) != len(a) ``` ...in production code.
359,905
<p>I have a UserControl Library solution which has the following </p> <p>UserControl ---UserControl project</p> <pre><code> ---UserControl Test Project </code></pre> <p>IN my test project, I am able to add my usercontrol to the tool box. When i drag it and drop it in my forms, it fails. I put in logging and f...
[ { "answer_id": 359940, "author": "Joe", "author_id": 13087, "author_profile": "https://Stackoverflow.com/users/13087", "pm_score": 0, "selected": false, "text": "<p>Do you need the config file at design time? If not, you could change your code to test if it is running at design time, so...
2008/12/11
[ "https://Stackoverflow.com/questions/359905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38230/" ]
I have a UserControl Library solution which has the following UserControl ---UserControl project ``` ---UserControl Test Project ``` IN my test project, I am able to add my usercontrol to the tool box. When i drag it and drop it in my forms, it fails. I put in logging and found out that my usercontrol reads a c...
Beware, I have found the DesignMode property to be unreliable where you have a control on another control on a form (say). It only seems to work for controls placed directly on the design surface.
359,907
<p>I have a UINavigationController containing an UIViewController initialized with a UIView.</p> <p>The UINavigationController also has a UINavigationBar as usual.</p> <p>Previously when I positioned a new element in the UIView at 0,0 using</p> <pre><code>CGRectMake(0,0,height,width); </code></pre> <p>It would posi...
[ { "answer_id": 360284, "author": "Airsource Ltd", "author_id": 18017, "author_profile": "https://Stackoverflow.com/users/18017", "pm_score": 2, "selected": true, "text": "<p>There is a whole (very useful) thread on things that 2.2 broke over on the Apple dev forums. It includes this issu...
2008/12/11
[ "https://Stackoverflow.com/questions/359907", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33604/" ]
I have a UINavigationController containing an UIViewController initialized with a UIView. The UINavigationController also has a UINavigationBar as usual. Previously when I positioned a new element in the UIView at 0,0 using ``` CGRectMake(0,0,height,width); ``` It would position it directly beneath the UINavigatio...
There is a whole (very useful) thread on things that 2.2 broke over on the Apple dev forums. It includes this issue (though without any fix). I've seen it mentioned elsewhere as well. It's worth checking it out <https://devforums.apple.com/message/12297#12297> (link fixed)
359,918
<p>I used this code to upload the picture. I got this code from stackoverflow. I am still unable to upload the image. I changed the db connection settings in table settings 2. I made the table but I am not sure whether the properties of the table I created are correct.</p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;title...
[ { "answer_id": 360284, "author": "Airsource Ltd", "author_id": 18017, "author_profile": "https://Stackoverflow.com/users/18017", "pm_score": 2, "selected": true, "text": "<p>There is a whole (very useful) thread on things that 2.2 broke over on the Apple dev forums. It includes this issu...
2008/12/11
[ "https://Stackoverflow.com/questions/359918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40975/" ]
I used this code to upload the picture. I got this code from stackoverflow. I am still unable to upload the image. I changed the db connection settings in table settings 2. I made the table but I am not sure whether the properties of the table I created are correct. ``` <html> <head><title>Store Some Binary File to a ...
There is a whole (very useful) thread on things that 2.2 broke over on the Apple dev forums. It includes this issue (though without any fix). I've seen it mentioned elsewhere as well. It's worth checking it out <https://devforums.apple.com/message/12297#12297> (link fixed)
359,921
<p>I've got a test class in a module that extends another test class in one of its dependency modules. How can I import the dependency's test code into the test scope of the dependent module?</p> <p>To illiterate, I've got two modules, "module-one" being a dependency of "module-two". <code>SubTestCase</code> is a subc...
[ { "answer_id": 360122, "author": "krosenvold", "author_id": 23691, "author_profile": "https://Stackoverflow.com/users/23691", "pm_score": 4, "selected": true, "text": "<p>Usually this is solved by building and deploying modulename-test.jar files in addition to the regular modulename.jar ...
2008/12/11
[ "https://Stackoverflow.com/questions/359921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4893/" ]
I've got a test class in a module that extends another test class in one of its dependency modules. How can I import the dependency's test code into the test scope of the dependent module? To illiterate, I've got two modules, "module-one" being a dependency of "module-two". `SubTestCase` is a subclass of `TestCase`. ...
Usually this is solved by building and deploying modulename-test.jar files in addition to the regular modulename.jar file. You deploy these to repos like regular artifacts. This is not totally flawless, but works decently for code artifacts. Then you would add test scoped dependencies to the test-jars to other modules...
359,931
<p>EDIT: I found out that I can get it to compile if I cast the IMetadataType object to the TMetadata type. Why do I need to do this?</p> <p>EDIT #2: The "Values" property is a .NET dictionary of type &lt;TMetadata, TData&gt;.</p> <p>I have this generic method:</p> <pre><code>private void FillMetadata&lt;TMetadat...
[ { "answer_id": 360085, "author": "Caleb Huitt - cjhuitt", "author_id": 9876, "author_profile": "https://Stackoverflow.com/users/9876", "pm_score": 2, "selected": false, "text": "<p>I've used libsigc++ before, and it was pretty straightforward. I don't think it would have much in the way...
2008/12/11
[ "https://Stackoverflow.com/questions/359931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44626/" ]
EDIT: I found out that I can get it to compile if I cast the IMetadataType object to the TMetadata type. Why do I need to do this? EDIT #2: The "Values" property is a .NET dictionary of type <TMetadata, TData>. I have this generic method: ``` private void FillMetadata<TMetadata, TData> (Metadata<TMetadata, TData...
First, try with boost::signal anyway. Don't assume it will not be fast enough until you try in your specific case that is your application If it's not efficient enough, maybe something like [FastDelegate](http://www.codeproject.com/KB/cpp/FastDelegate.aspx) will suit your needs? (i did'nt try it but heard it was a nic...
359,957
<p>I'm trying to find out the last time a computer came out of standby/hibernate. I know I could get this by watching Win32_PowerManagementEvent, but that doesn't work in this instance as I need something I can poll - any ideas? It doesn't have to be WMI, I'm just assuming that's the place it would be.</p> <p>Thanks!<...
[ { "answer_id": 360157, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>Actually, as it usually happens, I figured this out as soon as I posted it.</p>\n\n<p>So, to watch for when a computer come...
2008/12/11
[ "https://Stackoverflow.com/questions/359957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to find out the last time a computer came out of standby/hibernate. I know I could get this by watching Win32\_PowerManagementEvent, but that doesn't work in this instance as I need something I can poll - any ideas? It doesn't have to be WMI, I'm just assuming that's the place it would be. Thanks!
Actually, as it usually happens, I figured this out as soon as I posted it. So, to watch for when a computer comes out of standby, which is EventType 7 in Win32\_PowerManagementEvent I used Powershell. ``` Register-WmiEvent -query "Select * From Win32_PowerManagementEvent where EventType=7" -messagedata "Power Manag...
359,959
<p>When parsing HTML for certain web pages (most notably, any windows live page) I encounter a lot of URL’s in the following format.</p> <p>http\x3a\x2f\x2fjs.wlxrs.com\x2fjt6xQREgnzkhGufPqwcJjg\x2fempty.htm</p> <p>These appear to be partially UTF8 escaped strings (\x2f = /, \x3a=:, etc …). Is there a .Net API that ...
[ { "answer_id": 360281, "author": "leppie", "author_id": 15541, "author_profile": "https://Stackoverflow.com/users/15541", "pm_score": -1, "selected": false, "text": "<p>Did you try <a href=\"http://msdn.microsoft.com/en-us/library/system.web.httputility.urldecode.aspx\" rel=\"nofollow no...
2008/12/11
[ "https://Stackoverflow.com/questions/359959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23283/" ]
When parsing HTML for certain web pages (most notably, any windows live page) I encounter a lot of URL’s in the following format. http\x3a\x2f\x2fjs.wlxrs.com\x2fjt6xQREgnzkhGufPqwcJjg\x2fempty.htm These appear to be partially UTF8 escaped strings (\x2f = /, \x3a=:, etc …). Is there a .Net API that can be used to tra...
What you posted is not valid HTTP. As such, of course `HttpUtility.UrlDecode()` won't work. But irrespective of that, you can turn this back into normal text like this: ``` string input = @"http\x3a\x2f\x2fjs.wlxrs.com\x2fjt6xQREgnzkhGufPqwcJjg\x2fempty.htm"; string output = Regex.Replace(input, @"\\x([0-9a-f][0-9a-f]...
359,986
<p>I have a multilingual ASP.NET site; one of the languages is Arabic (ar-SA). To switch between cultures, I use this code: </p> <pre><code>Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Name) Thread.CurrentThread.CurrentUICulture = New CultureInfo(Name) </code></pre> <p>When displaying the d...
[ { "answer_id": 360170, "author": "Herb Caudill", "author_id": 239663, "author_profile": "https://Stackoverflow.com/users/239663", "pm_score": 5, "selected": true, "text": "<h2>Answer:</h2>\n<p>Turns out the ar-SA culture is the only one to use the Hijiri calendar; all the other Arabic cu...
2008/12/11
[ "https://Stackoverflow.com/questions/359986", "https://Stackoverflow.com", "https://Stackoverflow.com/users/239663/" ]
I have a multilingual ASP.NET site; one of the languages is Arabic (ar-SA). To switch between cultures, I use this code: ``` Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Name) Thread.CurrentThread.CurrentUICulture = New CultureInfo(Name) ``` When displaying the date of an article, for exa...
Answer: ------- Turns out the ar-SA culture is the only one to use the Hijiri calendar; all the other Arabic cultures use Gregorian. Here are the different date formats in Arabic (a bit messed up because WMD doesn't support seem to support RTL text). ``` ar-AE 11 ديسمبر 2008 ar-BH 11 ديسمبر 2008 ar-DZ 11 ديسمبر 200...
359,992
<p>In my Symbian S60 application, my Options menu works as expected. But the Exit button does nothing.</p> <p>I am developing with Carbide and have used the UI Designer to add items to the options menu.</p> <p>Does anyone know how to enable the exit button, or why else it might not work?</p> <p>Thanks!</p>
[ { "answer_id": 360032, "author": "Kasprzol", "author_id": 5957, "author_profile": "https://Stackoverflow.com/users/5957", "pm_score": 3, "selected": true, "text": "<p>Are you handling (in your <code>appui::HandleCommandL</code>) command ids <code>EEikCmdExit</code> and <code>EAknSoftkeyE...
2008/12/11
[ "https://Stackoverflow.com/questions/359992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33604/" ]
In my Symbian S60 application, my Options menu works as expected. But the Exit button does nothing. I am developing with Carbide and have used the UI Designer to add items to the options menu. Does anyone know how to enable the exit button, or why else it might not work? Thanks!
Are you handling (in your `appui::HandleCommandL`) command ids `EEikCmdExit` and `EAknSoftkeyExit?` ``` if ( aCommand == EAknSoftkeyExit || aCommand == EEikCmdExit ) { Exit(); } ```
360,007
<p>I'm trying to deploy <a href="http://code.google.com/p/elmah/" rel="nofollow noreferrer">elmah</a>. For inexplicable reasons, I'm getting an error: .axd files are explicitly forbidden. I've already fixed what I can control (my web.config) and solutions requiring collaboration from the system admin are <em>not</em>...
[ { "answer_id": 361800, "author": "leppie", "author_id": 15541, "author_profile": "https://Stackoverflow.com/users/15541", "pm_score": 1, "selected": false, "text": "<p>Good to see you got the answer :)</p>\n\n<p>The axd extension is normally used in the cases where only .NET 1.1 or earli...
2008/12/11
[ "https://Stackoverflow.com/questions/360007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33264/" ]
I'm trying to deploy [elmah](http://code.google.com/p/elmah/). For inexplicable reasons, I'm getting an error: .axd files are explicitly forbidden. I've already fixed what I can control (my web.config) and solutions requiring collaboration from the system admin are *not* available (such as editing machine web.config or...
The answer is to change the web.config to look like this: ``` <add verb="POST,GET,HEAD" path="elmah.ashx" type="Elmah.ErrorLogPageFactory, Elmah" /> ``` In fact, some source on the web say, unless you are microsoft you shouldn't name any handlers axd lest you have a name conflict with a future version of ASP.NET.
360,013
<p>I'm curious if it's possible to intercept the default methods of 'Edit' mode on a UITableView. Typically you get a free 'delete' button if you side swipe a UITableViewCell that has delegate methods associated with it. I'd like to change the delete to some other, arbitrary selector. Instead of deleting the cell, I'd ...
[ { "answer_id": 365099, "author": "Lily Ballard", "author_id": 582, "author_profile": "https://Stackoverflow.com/users/582", "pm_score": 2, "selected": false, "text": "<p>There is a property on UITableViewCell called <code>editAction</code> which is documented as letting you change the ac...
2008/12/11
[ "https://Stackoverflow.com/questions/360013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40882/" ]
I'm curious if it's possible to intercept the default methods of 'Edit' mode on a UITableView. Typically you get a free 'delete' button if you side swipe a UITableViewCell that has delegate methods associated with it. I'd like to change the delete to some other, arbitrary selector. Instead of deleting the cell, I'd jus...
Editing is implemented as a method on your UITableView’s delegate object. In your table controller, have whatever control activates editing call this: ``` [tableView setEditing: YES animated: YES]; ``` Then, make sure that your delegate object implements this: ``` - (void)tableView:(UITableView *)tableView commitEd...
360,016
<p>Today our virtual W2003 server storing our SVN repository (too) became very-very busy. It turned out that it had only 88KB free space left on the C: drive. Not that good. Due to access problems, the only way we could reboot it by killing the busy processes from task manager (McAffee, SqlServer, services.exe) and the...
[ { "answer_id": 365099, "author": "Lily Ballard", "author_id": 582, "author_profile": "https://Stackoverflow.com/users/582", "pm_score": 2, "selected": false, "text": "<p>There is a property on UITableViewCell called <code>editAction</code> which is documented as letting you change the ac...
2008/12/11
[ "https://Stackoverflow.com/questions/360016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24451/" ]
Today our virtual W2003 server storing our SVN repository (too) became very-very busy. It turned out that it had only 88KB free space left on the C: drive. Not that good. Due to access problems, the only way we could reboot it by killing the busy processes from task manager (McAffee, SqlServer, services.exe) and then g...
Editing is implemented as a method on your UITableView’s delegate object. In your table controller, have whatever control activates editing call this: ``` [tableView setEditing: YES animated: YES]; ``` Then, make sure that your delegate object implements this: ``` - (void)tableView:(UITableView *)tableView commitEd...
360,024
<p>I'd like to set a connection string programmatically, with absolutely no change to any config files / registry keys.</p> <p>I have this piece of code, but unfortunately it throws an exception with "the configuration is read only".</p> <pre><code>ConfigurationManager.ConnectionStrings.Clear(); string connectionStri...
[ { "answer_id": 360052, "author": "Robert S.", "author_id": 7565, "author_profile": "https://Stackoverflow.com/users/7565", "pm_score": 1, "selected": false, "text": "<p>You could put it in a resources file instead. It won't have the built-in features of the ConfigurationManager class, bu...
2008/12/11
[ "https://Stackoverflow.com/questions/360024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11236/" ]
I'd like to set a connection string programmatically, with absolutely no change to any config files / registry keys. I have this piece of code, but unfortunately it throws an exception with "the configuration is read only". ``` ConfigurationManager.ConnectionStrings.Clear(); string connectionString = "Server=myserver...
I've written about this in a [post on my blog](http://davidgardiner.blogspot.com/2008/09/programmatically-setting.html). The trick is to use reflection to poke values in as a way to get access to the non-public fields (and methods). eg. ``` var settings = ConfigurationManager.ConnectionStrings[ 0 ]; var fi = typeof(...
360,030
<p>I have a Java method which returns an array of doubles. I would then like to store these values in individual variables in the calling function. Is there an elegant way of doing this in Java.</p> <p>I could write it as this:</p> <pre><code>double[] returnValues = calculateSomeDoubles(); double firstVar = returnVa...
[ { "answer_id": 360060, "author": "OscarRyz", "author_id": 20654, "author_profile": "https://Stackoverflow.com/users/20654", "pm_score": 1, "selected": false, "text": "<p>The only way would be using reflection, granted you know upfront how many items method \"calculateSomeDouble\" will r...
2008/12/11
[ "https://Stackoverflow.com/questions/360030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/277/" ]
I have a Java method which returns an array of doubles. I would then like to store these values in individual variables in the calling function. Is there an elegant way of doing this in Java. I could write it as this: ``` double[] returnValues = calculateSomeDoubles(); double firstVar = returnValues[0]; double secon...
Basically no, this isn't possible. You'll have to return an object that contains the values. ``` MyObject myObject = calculateMyObject(); ```
360,036
<p>Is there any way to split a long string of HTML after N words? Obviously I could use:</p> <pre><code>' '.join(foo.split(' ')[:n]) </code></pre> <p>to get the first n words of a plain text string, but that might split in the middle of an html tag, and won't produce valid html because it won't close the tags that ha...
[ { "answer_id": 360099, "author": "recursive", "author_id": 44743, "author_profile": "https://Stackoverflow.com/users/44743", "pm_score": 2, "selected": false, "text": "<p>I've heard that <a href=\"http://www.crummy.com/software/BeautifulSoup/\" rel=\"nofollow noreferrer\">Beautiful Soup<...
2008/12/11
[ "https://Stackoverflow.com/questions/360036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3408/" ]
Is there any way to split a long string of HTML after N words? Obviously I could use: ``` ' '.join(foo.split(' ')[:n]) ``` to get the first n words of a plain text string, but that might split in the middle of an html tag, and won't produce valid html because it won't close the tags that have been opened. I need to...
Take a look at the [truncate\_html\_words](http://code.djangoproject.com/browser/django/trunk/django/utils/text.py) function in django.utils.text. Even if you aren't using Django, the code there does exactly what you want.
360,063
<p>I often run into code that has to perform lots of checks and ends up being indented at least five or six levels before really doing anything. I am wondering what alternatives exist.</p> <p>Below I've posted an example of what I'm talking about (which isn't actual production code, just something I came up with off ...
[ { "answer_id": 360070, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 5, "selected": true, "text": "<p>See <a href=\"http://www.codinghorror.com/blog/archives/000486.html\" rel=\"nofollow noreferrer\">Flattening Arrow Code<...
2008/12/11
[ "https://Stackoverflow.com/questions/360063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18511/" ]
I often run into code that has to perform lots of checks and ends up being indented at least five or six levels before really doing anything. I am wondering what alternatives exist. Below I've posted an example of what I'm talking about (which isn't actual production code, just something I came up with off the top of ...
See [Flattening Arrow Code](http://www.codinghorror.com/blog/archives/000486.html) for help. > > 1. Replace conditions with guard > clauses. > 2. Decompose conditional blocks into > seperate functions. > 3. Convert negative checks into > positive checks. > > >
360,088
<p>I am planning a fresh installation of <strong>SQL Server 2005</strong> on a new machine, which I have to order. I know that <strong>tempdb tuning</strong> is very important to the overall <strong>performance</strong> of the SQL Server instance.</p> <p>I've read that it's best practice to create as many tempdb files...
[ { "answer_id": 360146, "author": "DCNYAM", "author_id": 30419, "author_profile": "https://Stackoverflow.com/users/30419", "pm_score": 2, "selected": false, "text": "<p>From what I've read, it's best to put tempDB on it's own physical disk (or array). For maximum speed, you could put in ...
2008/12/11
[ "https://Stackoverflow.com/questions/360088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6461/" ]
I am planning a fresh installation of **SQL Server 2005** on a new machine, which I have to order. I know that **tempdb tuning** is very important to the overall **performance** of the SQL Server instance. I've read that it's best practice to create as many tempdb files as you have CPU's (or cores?). Is that correct? ...
*Here is what I researched myself from a variety of sources.* In order to optimize tempdb performance pay attention to physical disk configuration, file configuration, as well as some settings within the database. **Physical disk configuration** tempdb should reside on its **own dedicated physical disks**. This all...
360,111
<p>I have an array of different type objects and I use a BinaryWriter to convert each item to its binary equivalent so I can send the structure over the network.</p> <p>I currently do something like </p> <pre><code>for ( i=0;i&lt;tmpArrayList.Count;i++) { object x=tmpArrayList[i]; if (x.GetType() == typeof(byt...
[ { "answer_id": 360121, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": false, "text": "<p>No. The cast has to be known at compile-time, but the actual type is only known at execution time.</p>\n\n<p>Note, ho...
2008/12/11
[ "https://Stackoverflow.com/questions/360111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32958/" ]
I have an array of different type objects and I use a BinaryWriter to convert each item to its binary equivalent so I can send the structure over the network. I currently do something like ``` for ( i=0;i<tmpArrayList.Count;i++) { object x=tmpArrayList[i]; if (x.GetType() == typeof(byte)) { wrt.Write...
Here is a solution for BinaryWriter that uses reflection. This basically scans BinaryWriter for methods named Write that takes exactly one parameter, then builds a dictionary of which method handles which type, then for each object to write, finds the right method and calls it on the writer. Dirty, and you should pro...
360,116
<p><strong>Update 1:</strong><br> Cannot reproduce this on a co-worker's computer (same setup as mine) so I assume this is a problem with my workstation and not a general one. </p> <p>I'd appreciate it if someone would close this question as I don't have enough reputation to do it myself. </p> <p>@MatthewMartin. Th...
[ { "answer_id": 360121, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": false, "text": "<p>No. The cast has to be known at compile-time, but the actual type is only known at execution time.</p>\n\n<p>Note, ho...
2008/12/11
[ "https://Stackoverflow.com/questions/360116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41089/" ]
**Update 1:** Cannot reproduce this on a co-worker's computer (same setup as mine) so I assume this is a problem with my workstation and not a general one. I'd appreciate it if someone would close this question as I don't have enough reputation to do it myself. @MatthewMartin. Thanks for your comments :-) --- ...
Here is a solution for BinaryWriter that uses reflection. This basically scans BinaryWriter for methods named Write that takes exactly one parameter, then builds a dictionary of which method handles which type, then for each object to write, finds the right method and calls it on the writer. Dirty, and you should pro...
360,134
<p>I am using master page on some pages. And that master page is loading the user control. So I want to disable or enable user control on some page load which has master page. </p> <hr> <p>Is there anyway can I disable User control on master page Page_load()</p> <hr> <pre><code>&lt;div class="ucTabCtrl" &gt; &...
[ { "answer_id": 360149, "author": "Steven Behnke", "author_id": 42588, "author_profile": "https://Stackoverflow.com/users/42588", "pm_score": 0, "selected": false, "text": "<p>You want to disable it on the child page? You could do something like this in the Page_Load() method:</p>\n\n<pr...
2008/12/11
[ "https://Stackoverflow.com/questions/360134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21918/" ]
I am using master page on some pages. And that master page is loading the user control. So I want to disable or enable user control on some page load which has master page. --- Is there anyway can I disable User control on master page Page\_load() --- ``` <div class="ucTabCtrl" > <uc1:TLTabControl ID="ctrlname...
Your question is kinda hard to understand, but i think what you are looking for is something like this: ``` public partial class Site1 : System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { if (Page is WebForm1 || Page is WebForm2) { webUserControl11.Vis...
360,158
<p>I'm using VBA in Excel 2003 to apply validation to apply validation to a given range of cells from a named list. The user can then select from a dropdown list of values.</p> <p>Edit: Here's how I'm setting the validation, given a named range called 'MyLookupList'</p> <pre><code> With validatedRange.Validati...
[ { "answer_id": 360750, "author": "DJ.", "author_id": 10492, "author_profile": "https://Stackoverflow.com/users/10492", "pm_score": 2, "selected": false, "text": "<p>Well you could just build the validation list given the validation range (assuming it's not too large)</p>\n\n<pre><code>Di...
2008/12/11
[ "https://Stackoverflow.com/questions/360158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1354/" ]
I'm using VBA in Excel 2003 to apply validation to apply validation to a given range of cells from a named list. The user can then select from a dropdown list of values. Edit: Here's how I'm setting the validation, given a named range called 'MyLookupList' ``` With validatedRange.Validation .Delet...
Well you could just build the validation list given the validation range (assuming it's not too large) ``` Dim sValidationList As String Dim iRow As Integer 'build comma-delimited list based on validation range With oValidationRange For iRow = 1 To .Rows.Count sValidationList = sValidationList & .Cells(...
360,161
<p>Im trying to get a completly data copy from a gridview, itryed clone(), tryed cast DataView from DataSouce, but always get nulls or cant get the data, please exists a way to copy data from gridview, modified it and then reload it? or modifyng directly some rows in the gridview? thanks in advance!</p>
[ { "answer_id": 360227, "author": "Phil Corcoran", "author_id": 45381, "author_profile": "https://Stackoverflow.com/users/45381", "pm_score": 0, "selected": false, "text": "<p>What exactly is it you're trying to do with the data? Also is it a datagrid or a dataview and in what framework? ...
2008/12/11
[ "https://Stackoverflow.com/questions/360161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1388553/" ]
Im trying to get a completly data copy from a gridview, itryed clone(), tryed cast DataView from DataSouce, but always get nulls or cant get the data, please exists a way to copy data from gridview, modified it and then reload it? or modifyng directly some rows in the gridview? thanks in advance!
You can try using the OnRowDataBound attribute to do something like this ``` protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { //HeaderStuff } if (e.Row.RowType == DataControlRowType.DataRow) { ObjectTye ...
360,167
<p>I'd like to host custom items in a ToolBar in an ItemsControl. However, the buttons I add are rendered below the toolbar and as regular buttons rather than in the ToolBar with the ToolBar look and feel.</p> <p>This can be reproduced with a few lines of Xaml (I've excluded the default content). The custom ItemsCon...
[ { "answer_id": 360371, "author": "Micah", "author_id": 17744, "author_profile": "https://Stackoverflow.com/users/17744", "pm_score": 2, "selected": false, "text": "<p>set the style on the button like this:</p>\n\n<pre><code>Style=\"{DynamicResource {x:Static ToolBar.ButtonStyleKey}}\"\n<...
2008/12/11
[ "https://Stackoverflow.com/questions/360167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1807/" ]
I'd like to host custom items in a ToolBar in an ItemsControl. However, the buttons I add are rendered below the toolbar and as regular buttons rather than in the ToolBar with the ToolBar look and feel. This can be reproduced with a few lines of Xaml (I've excluded the default content). The custom ItemsControl: ``` <...
set the style on the button like this: ``` Style="{DynamicResource {x:Static ToolBar.ButtonStyleKey}}" ```
360,195
<p>I'm trying to run a c++ 2d array (pretty simple file) and it works but an error (at least I think it's an error) appears on the end.</p> <p>The code for the array is;</p> <pre><code>int myArray[10][10]; for (int i = 0; i &lt;= 9; ++i){ for (int t = 0; t &lt;=9; ++t){ myArray[i][t] = i+t; //This will ...
[ { "answer_id": 360226, "author": "Jimmy", "author_id": 4435, "author_profile": "https://Stackoverflow.com/users/4435", "pm_score": 4, "selected": true, "text": "<p>The error is not in the code you posted. do you have another cout afterwards?</p>\n\n<p>the 0x22.... looks like a memory add...
2008/12/11
[ "https://Stackoverflow.com/questions/360195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33061/" ]
I'm trying to run a c++ 2d array (pretty simple file) and it works but an error (at least I think it's an error) appears on the end. The code for the array is; ``` int myArray[10][10]; for (int i = 0; i <= 9; ++i){ for (int t = 0; t <=9; ++t){ myArray[i][t] = i+t; //This will give each element a value ...
The error is not in the code you posted. do you have another cout afterwards? the 0x22.... looks like a memory address, so specifically you might have a line that reads cout << myArray; somewhere.
360,201
<p>I am looking for a way to clean up the mess when my top-level script exits.</p> <p>Especially if I want to use <code>set -e</code>, I wish the background process would die when the script exits.</p>
[ { "answer_id": 360249, "author": "Oli", "author_id": 12870, "author_profile": "https://Stackoverflow.com/users/12870", "pm_score": -1, "selected": false, "text": "<p>So script the loading of the script. Run a <code>killall</code> (or whatever is available on your OS) command that execute...
2008/12/11
[ "https://Stackoverflow.com/questions/360201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1277510/" ]
I am looking for a way to clean up the mess when my top-level script exits. Especially if I want to use `set -e`, I wish the background process would die when the script exits.
To clean up some mess, `trap` can be used. It can provide a list of stuff executed when a specific signal arrives: ``` trap "echo hello" SIGINT ``` but can also be used to execute something if the shell exits: ``` trap "killall background" EXIT ``` It's a builtin, so `help trap` will give you information (works w...
360,208
<p>I have an interface that defines some methods I would like certain classes to implement.</p> <pre> public interface IMyInterface { MethodA; MethodB; } </pre> <p>Additionally I would like all classes implementing this interface to be serializable. If I change the interface definition to implement ISerializa...
[ { "answer_id": 360213, "author": "Cristian Libardo", "author_id": 16526, "author_profile": "https://Stackoverflow.com/users/16526", "pm_score": 0, "selected": false, "text": "<p>You could write a custom FxCop rule and validate check-ins against it.</p>\n" }, { "answer_id": 360327...
2008/12/11
[ "https://Stackoverflow.com/questions/360208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30132/" ]
I have an interface that defines some methods I would like certain classes to implement. ``` public interface IMyInterface { MethodA; MethodB; } ``` Additionally I would like all classes implementing this interface to be serializable. If I change the interface definition to implement ISerializable as below....
Thanks for the replies. It would be nice to be able to force classes derived from an interface to implement serialization without this then forcing them to custom serialize but it doesn't seem to be possible.
360,216
<p>I would like to display certain meta data fields in the edit form based on the value of a fields. </p> <p>Example: Users upload a document to the Doclib to be approved by there manager. They are allowed to change the meta data Name,Case No, Location until the item is approved by the manager. Once the item is approv...
[ { "answer_id": 366929, "author": "Toni Frankola", "author_id": 15626, "author_profile": "https://Stackoverflow.com/users/15626", "pm_score": 2, "selected": true, "text": "<p>This can be easily solved with SharePoint Designer.</p>\n\n<ul>\n<li>You will need to modify <strong>EditForm.aspx...
2008/12/11
[ "https://Stackoverflow.com/questions/360216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2282/" ]
I would like to display certain meta data fields in the edit form based on the value of a fields. Example: Users upload a document to the Doclib to be approved by there manager. They are allowed to change the meta data Name,Case No, Location until the item is approved by the manager. Once the item is approved I would...
This can be easily solved with SharePoint Designer. * You will need to modify **EditForm.aspx** for your list * Hide the default **ListFormWebPart** (Do not delete it!) * Insert custom edit item form ([more details...](http://office.microsoft.com/en-us/sharepointdesigner/HA101191111033.aspx)) Custom form will look ex...
360,219
<p>I want to skip to the first line that contains "include".</p> <pre><code>&lt;&gt; until /include/; </code></pre> <p>Why does this not work?</p>
[ { "answer_id": 360243, "author": "Robert Gamble", "author_id": 25222, "author_profile": "https://Stackoverflow.com/users/25222", "pm_score": 4, "selected": true, "text": "<p>The match operator defaults to using <code>$_</code> but the <code>&lt;&gt;</code> operator doesn't store into <co...
2008/12/11
[ "https://Stackoverflow.com/questions/360219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44511/" ]
I want to skip to the first line that contains "include". ``` <> until /include/; ``` Why does this not work?
The match operator defaults to using `$_` but the `<>` operator doesn't store into `$_` by default unless it is used in a while loop so nothing is being stored in `$_`. From `perldoc perlop`: ``` I/O Operators ... Ordinarily you must assign the returned value to a variable, but there is one situation wh...
360,232
<p>Building on <a href="https://stackoverflow.com/questions/318553/getting-emacs-to-untabify-when-saving-files">Getting Emacs to untabify when saving certain file types (and only those file types)</a> , I'd like to run a hook to untabify my C++ files when I start modifying the buffer. I tried adding hooks to untabify t...
[ { "answer_id": 360396, "author": "Alex B", "author_id": 6180, "author_profile": "https://Stackoverflow.com/users/6180", "pm_score": 1, "selected": false, "text": "<p>Here is what I added to my emacs file to untabify on load:</p>\n\n<pre><code>(defun untabify-buffer ()\n \"Untabify curre...
2008/12/11
[ "https://Stackoverflow.com/questions/360232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45425/" ]
Building on [Getting Emacs to untabify when saving certain file types (and only those file types)](https://stackoverflow.com/questions/318553/getting-emacs-to-untabify-when-saving-files) , I'd like to run a hook to untabify my C++ files when I start modifying the buffer. I tried adding hooks to untabify the buffer on l...
Take a look at the variable "before-change-functions". Perhaps something along this line (warning: code not tested): ``` (add-hook 'before-change-functions (lambda (&rest args) (if (not (buffer-modified-p)) (untabify (point-min) (point-max))))) ```
360,234
<p>I want to read an specific xml node and its value for example</p> <pre><code>&lt;customers&gt; &lt;name&gt;John&lt;/name&gt; &lt;lastname&gt;fetcher&lt;/lastname&gt; &lt;/customer&gt; </code></pre> <p>and my code behind should be some thing like this (I don't know how it should be though):</p> <pre><code>Response.Wr...
[ { "answer_id": 360250, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "<p>Which version of .NET are you using? If you're using .NET 3.5 and can use LINQ to XML, it's as simple as:</p>\n\n<pre...
2008/12/11
[ "https://Stackoverflow.com/questions/360234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44852/" ]
I want to read an specific xml node and its value for example ``` <customers> <name>John</name> <lastname>fetcher</lastname> </customer> ``` and my code behind should be some thing like this (I don't know how it should be though): ``` Response.Write(xml.Node["name"].Value) ``` As I said it is just an example bec...
The most basic answer: Assuming "xml" is an XMLDocument, XMLNodeList, XMLNode, etc... ``` Response.Write(xml.SelectSingleNode("//name").innerText) ```
360,254
<p>If I try to use a closure on an event handler the compiler complains with :</p> <p>Incompatible types: "method pointer and regular procedure"</p> <p>which I understand.. but is there a way to use a clouser on method pointers? and how to define if can?</p> <p>eg : </p> <pre><code>Button1.Onclick = procedure( send...
[ { "answer_id": 388690, "author": "Hans-Eric", "author_id": 39348, "author_profile": "https://Stackoverflow.com/users/39348", "pm_score": 3, "selected": false, "text": "<p>An excellent question. </p>\n\n<p>As far as I know, it's not possible to do in current version of Delphi. This is muc...
2008/12/11
[ "https://Stackoverflow.com/questions/360254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45439/" ]
If I try to use a closure on an event handler the compiler complains with : Incompatible types: "method pointer and regular procedure" which I understand.. but is there a way to use a clouser on method pointers? and how to define if can? eg : ``` Button1.Onclick = procedure( sender : tobject ) begin ... end; ``` ...
``` @Button1.OnClick := pPointer(Cardinal(pPointer( procedure (sender: tObject) begin ((sender as TButton).Owner as TForm).Caption := 'Freedom to anonymous methods!' end )^ ) + $0C)^; ``` [works](http://codenoid.blogspot.com/2011/04/anonymous-methods-as-events-in-delphi.html) in Delphi 2010
360,265
<p><a href="http://leepoint.net/notes-java/data/expressions/22compareobjects.html" rel="nofollow noreferrer">http://leepoint.net/notes-java/data/expressions/22compareobjects.html</a></p> <blockquote> <p>It turns out that defining equals() isn't trivial; in fact it's moderately hard to get it right, especially in...
[ { "answer_id": 360301, "author": "OscarRyz", "author_id": 20654, "author_profile": "https://Stackoverflow.com/users/20654", "pm_score": 1, "selected": false, "text": "<p>Mmhh </p>\n\n<p>In some scenarios you can make the object unmodifiable ( read-only ) and have it created from a single...
2008/12/11
[ "https://Stackoverflow.com/questions/360265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
<http://leepoint.net/notes-java/data/expressions/22compareobjects.html> > > It turns out that defining equals() > isn't trivial; in fact it's moderately > hard to get it right, especially in > the case of subclasses. The best > treatment of the issues is in > Horstmann's Core Java Vol 1. > > > If equals() mu...
> > If equals() must always be overridden, > then what is a good approach for not > being cornered into having to do > object comparison? > > > You are mistaken. You should override equals as seldom as possible. --- All this info comes from [Effective Java, Second Edition](http://java.sun.com/docs/books/effec...
360,277
<p>So for viewing a current object's state at runtime, I really like what the Visual Studio Immediate window gives me. Just doing a simple</p> <pre><code>? objectname </code></pre> <p>Will give me a nicely formatted 'dump' of the object. </p> <p><strong>Is there an easy way to do this in code, so I can do somethin...
[ { "answer_id": 360302, "author": "Ricardo Villamil", "author_id": 19314, "author_profile": "https://Stackoverflow.com/users/19314", "pm_score": 3, "selected": false, "text": "<p>You could use reflection and loop through all the object properties, then get their values and save them to th...
2008/12/11
[ "https://Stackoverflow.com/questions/360277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19020/" ]
So for viewing a current object's state at runtime, I really like what the Visual Studio Immediate window gives me. Just doing a simple ``` ? objectname ``` Will give me a nicely formatted 'dump' of the object. **Is there an easy way to do this in code, so I can do something similar when logging?**
You could base something on the ObjectDumper code that ships with the [Linq samples](http://code.msdn.microsoft.com/csharpsamples/Release/ProjectReleases.aspx?ReleaseId=8). Have also a look at the answer of this [related question](https://stackoverflow.com/questions/852181/c-printing-all-properties-of-an-object) to ...
360,289
<p>I a have a multithread application (MIDAS) that makes uses of windows messages to communicate with itself.</p> <p>MAIN FORM</p> <p>The main form receives windows messages sent by the RDM LogData(‘DataToLog’) </p> <p>Because windows messages are used they have the following attributes </p> <ol> <li>Received messa...
[ { "answer_id": 360303, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>Option 1: Custom Message Queue</p>\n\n<p>You can build a custom message queue, and push messages to the queue, sort the que...
2008/12/11
[ "https://Stackoverflow.com/questions/360289", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17560/" ]
I a have a multithread application (MIDAS) that makes uses of windows messages to communicate with itself. MAIN FORM The main form receives windows messages sent by the RDM LogData(‘DataToLog’) Because windows messages are used they have the following attributes 1. Received messages are Indivisible 2. Received me...
Use Named Pipes. If you don't know how to use them, then now is the time to learn. With named pipes, you can send any type of data structure (as long as both the server and the client know what that data structure is). I usually use an array of records to send large collections of info back and forth. Very handy. I u...
360,338
<p>As the question states, i am a C#/Java programmer who is interested in (re)learning C++. As you know C#/Java have a somewhat strict project file structure (especially Java). I find this structure to be very helpful and was wondering if it is a) good practice to do a similar structure in a C++, b) if so, what is the ...
[ { "answer_id": 360372, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 3, "selected": true, "text": "<p>I find the structure of java projects quite nice. I do it like this (root is the root directory)</p>\n\n<...
2008/12/11
[ "https://Stackoverflow.com/questions/360338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18811/" ]
As the question states, i am a C#/Java programmer who is interested in (re)learning C++. As you know C#/Java have a somewhat strict project file structure (especially Java). I find this structure to be very helpful and was wondering if it is a) good practice to do a similar structure in a C++, b) if so, what is the bes...
I find the structure of java projects quite nice. I do it like this (root is the root directory) *root/include/foo/bar/baz.hpp* becomes ``` namespace foo { namespace bar { // declare/define the stuff (classes, functions) here } } // foo::bar ``` in code. I keep the source in *root/src/foo/bar/baz.cpp* . If ...
360,362
<p>How can I pass a null constuctor argument using Castle Windsor? I thought the following would work</p> <pre><code>&lt;parameters&gt; &lt;repository&gt;null&lt;/repository&gt; &lt;message&gt;null&lt;/message&gt; &lt;/parameters&gt;` </code></pre>
[ { "answer_id": 360386, "author": "BigJump", "author_id": 8542, "author_profile": "https://Stackoverflow.com/users/8542", "pm_score": 1, "selected": false, "text": "<p>Wouldn't it better to simply have an additional public constructor that doesn't take these parameters, then you wouldn't ...
2008/12/11
[ "https://Stackoverflow.com/questions/360362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How can I pass a null constuctor argument using Castle Windsor? I thought the following would work ``` <parameters> <repository>null</repository> <message>null</message> </parameters>` ```
If you want them to be null, it means that they are non-essential dependencies. By having them as ctor arguments you suggest otherwise. You should redesign your class to have another constructor that takes only essential dependencies, if you wish that they not change throughout the lifetime of an object (be readonly), ...
360,368
<p>There must be an easy way to do this, but somehow I can wrap my head around it. The best way I can describe what I want is a lambda function for a class. I have a library that expects as an argument an uninstantiated version of a class to work with. It then instantiates the class itself to work on. The problem is th...
[ { "answer_id": 360403, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 2, "selected": false, "text": "<p>This is sort of cheating, but you could give your Multiply class a <code>__call__</code> method that returns itself:</...
2008/12/11
[ "https://Stackoverflow.com/questions/360368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27478/" ]
There must be an easy way to do this, but somehow I can wrap my head around it. The best way I can describe what I want is a lambda function for a class. I have a library that expects as an argument an uninstantiated version of a class to work with. It then instantiates the class itself to work on. The problem is that ...
There's no need for lambda at all. lambda is just syntatic sugar to define a function and use it at the same time. Just like any lambda call can be replaced with an explicit def, we can solve your problem by creating a real class that meets your needs and returning it. ``` class Double: def run(self,x): ...
360,373
<p>I remember seeing in a sample a while ago that it is possible to break up a windsor configuration file into multiple ones and reference them from the app.config in a way that they get parsed automatically.</p> <p>Of course I didn't bookmark it and now I can't find it and my Windsor.Config.xml file is creeping up on...
[ { "answer_id": 360393, "author": "gcores", "author_id": 40256, "author_profile": "https://Stackoverflow.com/users/40256", "pm_score": 0, "selected": false, "text": "<p>You can break the castle configuration into several files <a href=\"http://castleproject.org/container/documentation/tru...
2008/12/11
[ "https://Stackoverflow.com/questions/360373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
I remember seeing in a sample a while ago that it is possible to break up a windsor configuration file into multiple ones and reference them from the app.config in a way that they get parsed automatically. Of course I didn't bookmark it and now I can't find it and my Windsor.Config.xml file is creeping up on 600 lines...
I think you mean using includes: <http://www.castleproject.org/container/documentation/v1rc3/usersguide/includes.html> All you need to do is specify an include node with the Uri that will be used to create the proper Resource. For example, the following will use the FileResource: The file is relative to the configur...
360,378
<p>This relates to Composite Application Guidance for WPF, or Prism.</p> <p>I have one "MainRegion" in my shell. My various modules will be loaded into this main region. I can populate a list of available modules in a menu and select them to load. On the click of the menu I do:</p> <pre><code>var module = moduleEnume...
[ { "answer_id": 367033, "author": "ligaz", "author_id": 6409, "author_profile": "https://Stackoverflow.com/users/6409", "pm_score": 0, "selected": false, "text": "<p>You should have a ContentControl that will be your region. Then you will need to add all your modules to this region. When ...
2008/12/11
[ "https://Stackoverflow.com/questions/360378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28029/" ]
This relates to Composite Application Guidance for WPF, or Prism. I have one "MainRegion" in my shell. My various modules will be loaded into this main region. I can populate a list of available modules in a menu and select them to load. On the click of the menu I do: ``` var module = moduleEnumerator.GetModule(modul...
You don't actually activate the module. You activate a view in a region. Take a read of this [article](http://compositewpf.codeplex.com/Thread/View.aspx?ThreadId=42862). The Initialize method is only called the once for any module. The fact that you are seeing a view in the module being activated when you call LoadMod...
360,392
<p>We are scheduling a task programatically. However, the executable to be scheduled could be installed in a path that has spaces. ie c:\program Files\folder\folder\folder program\program.exe</p> <p>When we provide this path as a parameter to the Tasjk Scheduler it fails to start because it cannot find the executable....
[ { "answer_id": 360470, "author": "Aditya Mukherji", "author_id": 25990, "author_profile": "https://Stackoverflow.com/users/25990", "pm_score": 0, "selected": false, "text": "<p>you could replace program files with progra~1<br>\nand folder program to folder~1 (1st 6 letters and ~1) to get...
2008/12/11
[ "https://Stackoverflow.com/questions/360392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42518/" ]
We are scheduling a task programatically. However, the executable to be scheduled could be installed in a path that has spaces. ie c:\program Files\folder\folder\folder program\program.exe When we provide this path as a parameter to the Tasjk Scheduler it fails to start because it cannot find the executable. It obviou...
It appears that you're using schtasks.exe - it took me longer to figure that out than to find an answer! More details please! :) I found an answer with [a quick google search](http://tinyurl.com/6z6m8j) Try this code: ``` string args = "/CREATE /RU SYSTEM /SC " + taskSchedule + " /MO " + taskModifier + " /SD " + task...
360,402
<p>I have a csv imported into my Hyperion v8.3 bqy file. I have some custom columns and a pivot already created. I just want to refresh the data. In the past, I would hit Process Current and it would direct me to my computer and I could select the csv file to update from. Now it will not do that. It doesn't go to...
[ { "answer_id": 360470, "author": "Aditya Mukherji", "author_id": 25990, "author_profile": "https://Stackoverflow.com/users/25990", "pm_score": 0, "selected": false, "text": "<p>you could replace program files with progra~1<br>\nand folder program to folder~1 (1st 6 letters and ~1) to get...
2008/12/11
[ "https://Stackoverflow.com/questions/360402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a csv imported into my Hyperion v8.3 bqy file. I have some custom columns and a pivot already created. I just want to refresh the data. In the past, I would hit Process Current and it would direct me to my computer and I could select the csv file to update from. Now it will not do that. It doesn't go to my compu...
It appears that you're using schtasks.exe - it took me longer to figure that out than to find an answer! More details please! :) I found an answer with [a quick google search](http://tinyurl.com/6z6m8j) Try this code: ``` string args = "/CREATE /RU SYSTEM /SC " + taskSchedule + " /MO " + taskModifier + " /SD " + task...
360,409
<p>I have a XML File like that</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;Configurations&gt; &lt;EmailConfiguration&gt; &lt;userName&gt;xxxx&lt;/userName&gt; &lt;password&gt;xxx&lt;/password&gt; &lt;displayName&gt;xxxxx&lt;/display...
[ { "answer_id": 360518, "author": "NerdFury", "author_id": 6146, "author_profile": "https://Stackoverflow.com/users/6146", "pm_score": 4, "selected": true, "text": "<pre><code>public class Options\n{\n public string UserName { get; set; }\n public string Password { get; set; }\n ...
2008/12/11
[ "https://Stackoverflow.com/questions/360409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44852/" ]
I have a XML File like that ``` <?xml version="1.0" encoding="utf-8" ?> <Configurations> <EmailConfiguration> <userName>xxxx</userName> <password>xxx</password> <displayName>xxxxx</displayName> <hostAddress>xxxx</hostAddress> ...
``` public class Options { public string UserName { get; set; } public string Password { get; set; } public string DisplayName { get; set; } public string HostAddress { get; set; } public bool SSL { get; set; } public string Port { get; set; } public bool LogEnable { get; set; } public ...
360,421
<p>Is there a way to define styles for a combination of classes? For example, I'd like my HTML to look like this, but the output to render in the appropriate color:</p> <pre><code>&lt;span class="red"&gt;Red Text&lt;/span&gt;&lt;br/&gt; &lt;span class="green"&gt;Green Text&lt;/span&gt;&lt;br/&gt; &lt;span class="red ...
[ { "answer_id": 360450, "author": "ieure", "author_id": 45224, "author_profile": "https://Stackoverflow.com/users/45224", "pm_score": 4, "selected": true, "text": "<p>You can select on multiple classes:</p>\n\n<pre><code>span.red.green { color: yellow; }\n</code></pre>\n\n<p>That will app...
2008/12/11
[ "https://Stackoverflow.com/questions/360421", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3420/" ]
Is there a way to define styles for a combination of classes? For example, I'd like my HTML to look like this, but the output to render in the appropriate color: ``` <span class="red">Red Text</span><br/> <span class="green">Green Text</span><br/> <span class="red green">Yellow Text</span><br/> ``` **Edit:** The abo...
You can select on multiple classes: ``` span.red.green { color: yellow; } ``` That will apply to any span element with red and green classes. Which may not be what you want, since it will also apply to, say: ``` <span class="red green blue">white</span> ``` Note that this doesn’t work right in IE 6.
360,422
<p>I'm trying to use reflection to get a property from a class. Here is some sample code of what I'm seeing:</p> <pre><code> using System.Reflection; namespace ConsoleApplication { class Program { static void Main(string[] args) { PropertyInfo[] tmp2 = typeof(TestClass).GetProperti...
[ { "answer_id": 360427, "author": "Andrew Rollings", "author_id": 40410, "author_profile": "https://Stackoverflow.com/users/40410", "pm_score": 5, "selected": true, "text": "<p>Add <code>BindingFlags.Instance</code> to the <code>GetProperty</code> call.</p>\n\n<p>EDIT: In response to comm...
2008/12/11
[ "https://Stackoverflow.com/questions/360422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8169/" ]
I'm trying to use reflection to get a property from a class. Here is some sample code of what I'm seeing: ``` using System.Reflection; namespace ConsoleApplication { class Program { static void Main(string[] args) { PropertyInfo[] tmp2 = typeof(TestClass).GetProperties(); ...
Add `BindingFlags.Instance` to the `GetProperty` call. EDIT: In response to comment... The following code returns the property. Note: It's a good idea to actually make your property do something before you try to retrieve it (VS2005) :) ``` using System.Reflection; namespace ConsoleApplication { class Program ...
360,431
<p>For this dropdownlist in HTML:</p> <pre><code>&lt;select id="countries"&gt; &lt;option value="1"&gt;Country&lt;/option&gt; &lt;/select&gt; </code></pre> <p>I would like to open the list (the same as left-clicking on it). Is this possible using JavaScript (or more specifically jQuery)?</p>
[ { "answer_id": 360448, "author": "Andreas Grech", "author_id": 44084, "author_profile": "https://Stackoverflow.com/users/44084", "pm_score": 2, "selected": false, "text": "<p>It is not possible for javascript to \"click\" on an element (u can trigger the attached <code>onclick</code> eve...
2008/12/11
[ "https://Stackoverflow.com/questions/360431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/343/" ]
For this dropdownlist in HTML: ``` <select id="countries"> <option value="1">Country</option> </select> ``` I would like to open the list (the same as left-clicking on it). Is this possible using JavaScript (or more specifically jQuery)?
You can easily [simulate a click on an element](http://docs.jquery.com/Events/click), but a click on a `<select>` won’t open up the dropdown. Using multiple selects can be problematic. Perhaps you should consider radio buttons inside a container element which you can expand and contract as needed.
360,449
<p>I'm trying to run a 3d array but the code just crashes in windows when i run it, here's my code;</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main(){ int myArray[10][10][10]; for (int i = 0; i &lt;= 9; ++i){ for (int t = 0; t &lt;=9; ++t){ for (int x ...
[ { "answer_id": 360463, "author": "David Norman", "author_id": 34502, "author_profile": "https://Stackoverflow.com/users/34502", "pm_score": 5, "selected": true, "text": "<p>You twice have the line</p>\n\n<pre><code>for (int x = 0; x &lt;= 9; ++t){\n</code></pre>\n\n<p>when you mean</p>\n...
2008/12/11
[ "https://Stackoverflow.com/questions/360449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33061/" ]
I'm trying to run a 3d array but the code just crashes in windows when i run it, here's my code; ``` #include <iostream> using namespace std; int main(){ int myArray[10][10][10]; for (int i = 0; i <= 9; ++i){ for (int t = 0; t <=9; ++t){ for (int x = 0; x <= 9; ++t){ ...
You twice have the line ``` for (int x = 0; x <= 9; ++t){ ``` when you mean ``` for (int x = 0; x <= 9; ++x){ ``` Classic copy-and-paste error. BTW, if you run this in a debugger and look at the values of the variables, it's pretty easy to see what's going on.
360,466
<p>This UpdatePanel is contained by an UserControl. When the LinkButton is pressed arow should be added in another GridView. When an user is logged in this control is working well. The problems appears when an user is not logged in and try to push that button. No event triggers. Someone suggested me to give a permissio...
[ { "answer_id": 363700, "author": "JSC", "author_id": 37311, "author_profile": "https://Stackoverflow.com/users/37311", "pm_score": 0, "selected": false, "text": "<p>Don't forget to give the webresource.axd enough rights in the web.config?</p>\n" }, { "answer_id": 365009, "aut...
2008/12/11
[ "https://Stackoverflow.com/questions/360466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45468/" ]
This UpdatePanel is contained by an UserControl. When the LinkButton is pressed arow should be added in another GridView. When an user is logged in this control is working well. The problems appears when an user is not logged in and try to push that button. No event triggers. Someone suggested me to give a permission f...
I solved the problem in a tricky way. I deleted the LinkButton and before TemplateField I put a ButtonField and all is working fine. Now the code looks like: ``` <Columns> <asp:ButtonField Text="Add" CommandName="Select" /> <asp:TemplateField> ...... </asp:TemplateField> </...
360,467
<p>I have a table that looks a bit like this actors(forename, surname, stage_name);</p> <p>I want to update stage_name to have a default value of</p> <pre><code>forename." ".surname </code></pre> <p>So that</p> <pre><code>insert into actors(forename, surname) values ('Stack', 'Overflow'); </code></pre> <p>would pr...
[ { "answer_id": 360484, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 2, "selected": false, "text": "<p>According to <a href=\"http://dev.mysql.com/doc/refman/5.0/en/data-type-defaults.html\" rel=\"nofollow noreferrer\">10.1.4...
2008/12/11
[ "https://Stackoverflow.com/questions/360467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33604/" ]
I have a table that looks a bit like this actors(forename, surname, stage\_name); I want to update stage\_name to have a default value of ``` forename." ".surname ``` So that ``` insert into actors(forename, surname) values ('Stack', 'Overflow'); ``` would produce the record ``` 'Stack' 'Overflow' 'Stack...
MySQL does not support computed columns or expressions in the `DEFAULT` option of a column definition. You can do this in a trigger (MySQL 5.0 or greater required): ``` CREATE TRIGGER format_stage_name BEFORE INSERT ON actors FOR EACH ROW BEGIN SET NEW.stage_name = CONCAT(NEW.forename, ' ', NEW.surname); END ``` ...
360,480
<p>It seems that there're 6 variations to CBC-MAC algorithm. I've been trying to match the MAC algorithm on the PINPad 1000SE [which per manual is ISO 9797-1 Algorithm 1].</p> <p>I got an excellent start from <a href="http://bytes.com/topic/net/answers/654069-iso-iec-9797-1-cbc-mac-using-vb-net" rel="nofollow norefer...
[ { "answer_id": 1459874, "author": "Aleksander Adamowski", "author_id": 171960, "author_profile": "https://Stackoverflow.com/users/171960", "pm_score": 2, "selected": false, "text": "<p>Most CBC MAC algorithms are implemented in <a href=\"http://www.bouncycastle.org\" rel=\"nofollow noref...
2008/12/11
[ "https://Stackoverflow.com/questions/360480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28413/" ]
It seems that there're 6 variations to CBC-MAC algorithm. I've been trying to match the MAC algorithm on the PINPad 1000SE [which per manual is ISO 9797-1 Algorithm 1]. I got an excellent start from [here](http://bytes.com/topic/net/answers/654069-iso-iec-9797-1-cbc-mac-using-vb-net). And I coded the algorithm as bel...
Most CBC MAC algorithms are implemented in [BouncyCastle](http://www.bouncycastle.org)'s JCE provider. Look at: [BouncyCastleProvider.java](http://bouncycastle.org/viewcvs/viewcvs.cgi/java/crypto/src/org/bouncycastle/jce/provider/BouncyCastleProvider.java?rev=1.83&content-type=text/vnd.viewcvs-markup) You're probably...
360,491
<p>I'm wanting to use jQuery to wrap a mailto: anchor around an email address, but it's also grabbing the whitepace that the CMS is generating.</p> <p>Here's the HTML I have to work with, the script as I have it and a copy of the output.</p> <p>HTML</p> <pre><code>&lt;div class="field field-type-text field-field-ema...
[ { "answer_id": 360496, "author": "Andreas Grech", "author_id": 44084, "author_profile": "https://Stackoverflow.com/users/44084", "pm_score": 9, "selected": true, "text": "<p>Use the <code>replace</code> function in js:</p>\n\n<pre><code>var emailAdd = $(this).text().replace(/ /g,'');\n</...
2008/12/11
[ "https://Stackoverflow.com/questions/360491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16124/" ]
I'm wanting to use jQuery to wrap a mailto: anchor around an email address, but it's also grabbing the whitepace that the CMS is generating. Here's the HTML I have to work with, the script as I have it and a copy of the output. HTML ``` <div class="field field-type-text field-field-email"> <div class="field-item">...
Use the `replace` function in js: ``` var emailAdd = $(this).text().replace(/ /g,''); ``` That will remove all the spaces If you want to remove the leading and trailing whitespace **only**, use the jQuery $.trim method : ``` var emailAdd = $.trim($(this).text()); ```
360,492
<p>I'm fooling around with <a href="http://pipes.yahoo.com" rel="nofollow noreferrer">Yahoo! pipes</a> and I'm hitting a wall with some regular expression. Now I'm familiar with regular expressions from Perl but the rules just seem to be different in Yahoo! pipes.</p> <p><a href="https://i.stack.imgur.com/6I6Ok.png" r...
[ { "answer_id": 360610, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 4, "selected": true, "text": "<p>RegEx for the title:</p>\n\n<pre><code>(?i).*?&lt;i&gt;([^&lt;]*).* [ ] g [x] s [ ] m [ ] i\n</code></p...
2008/12/11
[ "https://Stackoverflow.com/questions/360492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
I'm fooling around with [Yahoo! pipes](http://pipes.yahoo.com) and I'm hitting a wall with some regular expression. Now I'm familiar with regular expressions from Perl but the rules just seem to be different in Yahoo! pipes. [![Screenshot of my pipe](https://i.stack.imgur.com/6I6Ok.png)](https://i.stack.imgur.com/6I6O...
RegEx for the title: ``` (?i).*?<i>([^<]*).* [ ] g [x] s [ ] m [ ] i ``` RegEx for the link: ``` (?i).*?href="([^"]*).* [ ] g [x] s [ ] m [ ] i ``` Somehow the case-insensitive checkbox seems broken. Luckily you can substitute with `(?i)`, which works nicely. Here is a nice web2.0-...
360,507
<p>I wonder if there is a less verbose way to do Input Verification in my methods. For example, i commonly write stuff like this:</p> <pre><code>public string SomeFunction(string param1, int param2) { if(string.IsNullOrEmpty(param1)){ throw new ArgumentException("bla", "param1"); } if(param2 &lt; 0...
[ { "answer_id": 360525, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 3, "selected": false, "text": "<p>Well, you could do something with AOP, look at <a href=\"http://www.postsharp.org\" rel=\"nofollow noreferrer\">Po...
2008/12/11
[ "https://Stackoverflow.com/questions/360507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
I wonder if there is a less verbose way to do Input Verification in my methods. For example, i commonly write stuff like this: ``` public string SomeFunction(string param1, int param2) { if(string.IsNullOrEmpty(param1)){ throw new ArgumentException("bla", "param1"); } if(param2 < 0 || param2 > 100 ...
Three words: [design by contract](http://en.wikipedia.org/wiki/Design_by_contract) One implementation for C# can be found here: <http://www.codeproject.com/KB/cs/designbycontract.aspx>
360,520
<p>My company has been evaluating Spring MVC to determine if we should use it in one of our next projects. So far I love what I've seen, and right now I'm taking a look at the Spring Security module to determine if it's something we can/should use. </p> <p>Our security requirements are pretty basic; a user just needs ...
[ { "answer_id": 360545, "author": "digitalsanctum", "author_id": 22436, "author_profile": "https://Stackoverflow.com/users/22436", "pm_score": 2, "selected": false, "text": "<p>I would take a look at Spring's abstract test classes and mock objects which are talked about <a href=\"http://s...
2008/12/11
[ "https://Stackoverflow.com/questions/360520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4249/" ]
My company has been evaluating Spring MVC to determine if we should use it in one of our next projects. So far I love what I've seen, and right now I'm taking a look at the Spring Security module to determine if it's something we can/should use. Our security requirements are pretty basic; a user just needs to be able...
The problem is that Spring Security does not make the Authentication object available as a bean in the container, so there is no way to easily inject or autowire it out of the box. Before we started to use Spring Security, we would create a session-scoped bean in the container to store the Principal, inject this into ...
360,597
<p>I have a class hierarchy, this one:</p> <pre><code>type TMatrix = class protected //... public constructor Create(Rows, Cols: Byte); //... type TMinMatrix = class(TMatrix) private procedure Allocate; procedure DeAllocate; public constructor Create(Rows, Cols: Byte...
[ { "answer_id": 360693, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 2, "selected": false, "text": "<p>You need overload for both constructors if they have the same name. </p>\n\n<pre><code>type\n TMatrix = class\n ...
2008/12/11
[ "https://Stackoverflow.com/questions/360597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28298/" ]
I have a class hierarchy, this one: ``` type TMatrix = class protected //... public constructor Create(Rows, Cols: Byte); //... type TMinMatrix = class(TMatrix) private procedure Allocate; procedure DeAllocate; public constructor Create(Rows, Cols: Byte); const...
As far as I know, there are two separate issues here: ### Making sure the child class' constructor calls the base class' constructor You'll have to *explicitly* call the base class' constructor: ``` constructor TMinMatrix.Create(Rows, Cols: Byte); begin inherited; //... end; ``` ### Making sure the child cla...
360,609
<p>For a current project, I was thinking of implementing WebDAV to present a virtual file store that clients can access. I have only done Google research so far but it looks like I can get away with only implementing two methods:</p> <pre><code>GET, PROPFIND </code></pre> <p>I think that this is great. I was just cur...
[ { "answer_id": 360641, "author": "Chinnery", "author_id": 31892, "author_profile": "https://Stackoverflow.com/users/31892", "pm_score": 2, "selected": false, "text": "<p>If you run Apache Jackrabbit under, say, Tomcat, it can be configured to offer WebDAV and store uploaded files. Perhap...
2008/12/11
[ "https://Stackoverflow.com/questions/360609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/338/" ]
For a current project, I was thinking of implementing WebDAV to present a virtual file store that clients can access. I have only done Google research so far but it looks like I can get away with only implementing two methods: ``` GET, PROPFIND ``` I think that this is great. I was just curious though. If I wanted t...
For many WebDAV clients and even for read only access, you will also need to support OPTIONS. If you want to support upload, PUT obviously is required, and some clients (MacOS X?) will require locking support. (btw, [RFC 4918](http://www.webdav.org/specs/rfc4918.html) is the authorative source of information).
360,615
<p>In postgres I am fairly sure you can do something like this</p> <pre><code>SELECT authors.stage_name, count(select id from books where books.author_id = authors.id) FROM authors, books; </code></pre> <p>Essentially, in this example I would like to return a list of authors and how many books each has wri...
[ { "answer_id": 360647, "author": "Robert Gamble", "author_id": 25222, "author_profile": "https://Stackoverflow.com/users/25222", "pm_score": 0, "selected": false, "text": "<p>How about using a join:</p>\n\n<pre><code>SELECT authors.stage_name, count(*) \nFROM authors INNER JOIN books on ...
2008/12/11
[ "https://Stackoverflow.com/questions/360615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33604/" ]
In postgres I am fairly sure you can do something like this ``` SELECT authors.stage_name, count(select id from books where books.author_id = authors.id) FROM authors, books; ``` Essentially, in this example I would like to return a list of authors and how many books each has written.... in the same query...
Well, for one thing, it returns a Cartesian product of all authors to all books, regardless of whether that author wrote that book. Here's how I'd write a query to get the result you say you want: ``` SELECT a.stage_name, COUNT(b.id) FROM authors a LEFT OUTER JOIN books b ON (a.id = b.author_id) GROUP BY a.id; ```...
360,628
<p>I'm trying to embed an xsl into a XML file. The reason for doing this is to create a single file that could be moved to different computers, this would prevent the need to move the xsl file. </p> <p>The xsl file is creating a table and grabbing a test step from the xml and whether it passed or failed, pretty simp...
[ { "answer_id": 361237, "author": "Dimitre Novatchev", "author_id": 36305, "author_profile": "https://Stackoverflow.com/users/36305", "pm_score": 4, "selected": false, "text": "<p><a href=\"http://www.w3.org/TR/xslt#section-Embedding-Stylesheets\" rel=\"nofollow noreferrer\"><strong>Altho...
2008/12/11
[ "https://Stackoverflow.com/questions/360628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7617/" ]
I'm trying to embed an xsl into a XML file. The reason for doing this is to create a single file that could be moved to different computers, this would prevent the need to move the xsl file. The xsl file is creating a table and grabbing a test step from the xml and whether it passed or failed, pretty simple. The i...
[**Although the W3C XSLT Spec supports embedding an XSLT stylesheet**](http://www.w3.org/TR/xslt#section-Embedding-Stylesheets) into an XML document, it seems that IE and Firefox do not support this. **UPDATE**: As per the comment by Robert Niestroj, years later, in Oct. 2014, this works in FireFox 33. **However, the...
360,649
<p>Is there a way to vertically stack selected td elments? I would like to have the same table, though display it differently using only css. Would this be possible, or do I have to have separate html markups? I would like to try to have the same html markup, though use different css for different sites/looks.</p> <pr...
[ { "answer_id": 360674, "author": "Eduardo Molteni", "author_id": 2385, "author_profile": "https://Stackoverflow.com/users/2385", "pm_score": 3, "selected": true, "text": "<p>You need to create the table stacked</p>\n\n<pre><code>&lt;table&gt;\n &lt;tr&gt;\n &lt;td class=\"vertical\"...
2008/12/11
[ "https://Stackoverflow.com/questions/360649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20641/" ]
Is there a way to vertically stack selected td elments? I would like to have the same table, though display it differently using only css. Would this be possible, or do I have to have separate html markups? I would like to try to have the same html markup, though use different css for different sites/looks. ``` <table...
You need to create the table stacked ``` <table> <tr> <td class="vertical">i'm</td> <td class="horizontal" rowspan="3">i'm horizontal</td> </tr> <tr> <td class="vertical">above</td> </tr> <tr> <td class="vertical">this</td> </tr> </table> ``` That is what tables are made for. If you w...
360,694
<p>If you have a web application that will run inside a network, it makes sense for it to support windows authentication (active directory?).</p> <p>Would it make sense to use AD security model as well, or would I make my own roles/security module that some admin would have to configure for each user?</p> <p>I've ne...
[ { "answer_id": 360701, "author": "Ryan Smith", "author_id": 10420, "author_profile": "https://Stackoverflow.com/users/10420", "pm_score": 0, "selected": false, "text": "<p>I used windows security on some of my internal sites.</p>\n\n<p>Basically the way I set it up is I remove anonymous ...
2008/12/11
[ "https://Stackoverflow.com/questions/360694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
If you have a web application that will run inside a network, it makes sense for it to support windows authentication (active directory?). Would it make sense to use AD security model as well, or would I make my own roles/security module that some admin would have to configure for each user? I've never dealt with win...
Basically windows handles everything, you never store usernames or passwords, AD and IIS do all the work for you add this to your `web.config` ``` <system.web> ... <authentication mode="Windows"/> ... </system.web> ``` To configure Windows authentication 1. Start Internet Information Services (IIS). 2. Rig...
360,705
<p>I am having problems connecting to a Sqlite database through System.Data.Sqlite. I was trying to use FluentNhibernate but that didn't work, so I went back to basics but got the same error: Cannot find entry point sqlite3_open_v2 in DLL sqlite3.</p> <p>This is my (fairly simple I believe) code:</p> <pre><code>using...
[ { "answer_id": 360749, "author": "JamesSugrue", "author_id": 1075, "author_profile": "https://Stackoverflow.com/users/1075", "pm_score": 3, "selected": true, "text": "<p>It may be the version of Sqlite3 you are working against. The V2 methods are relatively new - <a href=\"http://www.sql...
2008/12/11
[ "https://Stackoverflow.com/questions/360705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15349/" ]
I am having problems connecting to a Sqlite database through System.Data.Sqlite. I was trying to use FluentNhibernate but that didn't work, so I went back to basics but got the same error: Cannot find entry point sqlite3\_open\_v2 in DLL sqlite3. This is my (fairly simple I believe) code: ``` using (SQLiteConnection ...
It may be the version of Sqlite3 you are working against. The V2 methods are relatively new - [introduced in v3.5](http://www.sqlite.org/34to35.html)
360,725
<p>I am fetching an array of floats from my database but the array I get has converted the values to strings.</p> <p>How can I convert them into floats again without looping through the array?<br /> Alternatively, how can I fetch the values from the database without converting them to strings?</p> <hr /> <h3>EDIT:</h3>...
[ { "answer_id": 360736, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 6, "selected": true, "text": "<p>You could use </p>\n\n<pre><code>$floats = array_map('floatval', $nonFloats);\n</code></pre>\n\n<p>There is the option <cod...
2008/12/11
[ "https://Stackoverflow.com/questions/360725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11995/" ]
I am fetching an array of floats from my database but the array I get has converted the values to strings. How can I convert them into floats again without looping through the array? Alternatively, how can I fetch the values from the database without converting them to strings? --- ### EDIT: * I am using the Zen...
You could use ``` $floats = array_map('floatval', $nonFloats); ``` There is the option `PDO::ATTR_STRINGIFY_FETCHES` but from what I remember, MySQL always has it as `true` Edit: see [Bug 44341](http://bugs.php.net/bug.php?id=44341) which confirms MySQL doesn't support turning off stringify. Edit: you can also ma...
360,748
<p>I understand Big-O notation, but I don't know how to calculate it for many functions. In particular, I've been trying to figure out the computational complexity of the naive version of the Fibonacci sequence:</p> <pre><code>int Fibonacci(int n) { if (n &lt;= 1) return n; else return Fibonacc...
[ { "answer_id": 360768, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 7, "selected": false, "text": "<p>Just ask yourself how many statements need to execute for <code>F(n)</code> to complete.</p>\n\n<p>For <code>F(1)</co...
2008/12/11
[ "https://Stackoverflow.com/questions/360748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40516/" ]
I understand Big-O notation, but I don't know how to calculate it for many functions. In particular, I've been trying to figure out the computational complexity of the naive version of the Fibonacci sequence: ``` int Fibonacci(int n) { if (n <= 1) return n; else return Fibonacci(n - 1) + Fibona...
You model the time function to calculate `Fib(n)` as sum of time to calculate `Fib(n-1)` plus the time to calculate `Fib(n-2)` plus the time to add them together (`O(1)`). This is assuming that repeated evaluations of the same `Fib(n)` take the same time - i.e. no memoization is used. `T(n<=1) = O(1)` `T(n) = T(n-1) ...
360,753
<p>So I'm a newbie to TDD, and I successfully created a nice little sample app using the MVP pattern. The major problem to my current solution is that its blocking the UI thread, So I was trying to setup the Presenter to use the SynchronizationContext.Current, but when I run my tests the SynchronizationContext.Current...
[ { "answer_id": 360780, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 3, "selected": true, "text": "<p>I've run into similar problems with ASP.NET MVC where it is the HttpContext that is missing. One thing you can do is...
2008/12/11
[ "https://Stackoverflow.com/questions/360753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37881/" ]
So I'm a newbie to TDD, and I successfully created a nice little sample app using the MVP pattern. The major problem to my current solution is that its blocking the UI thread, So I was trying to setup the Presenter to use the SynchronizationContext.Current, but when I run my tests the SynchronizationContext.Current is ...
I've run into similar problems with ASP.NET MVC where it is the HttpContext that is missing. One thing you can do is provide an alternate constructor that allows you to inject a mock SynchronizationContext or expose a public setter that does the same thing. If you can't change the SynchronizationContext internally, the...
360,758
<p>I have a server that hosts my Subversion code base. That server is currently a <a href="http://en.wikipedia.org/wiki/Windows_Server_2003" rel="noreferrer">Windows Server 2003</a> box, and my IT administrator wants to update it to <a href="http://en.wikipedia.org/wiki/Windows_Server_2008" rel="noreferrer">Windows Ser...
[ { "answer_id": 360792, "author": "NerdFury", "author_id": 6146, "author_profile": "https://Stackoverflow.com/users/6146", "pm_score": 2, "selected": false, "text": "<p>If you are using the File System type repository, you can just literally take the folder containing your repository and ...
2008/12/11
[ "https://Stackoverflow.com/questions/360758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10420/" ]
I have a server that hosts my Subversion code base. That server is currently a [Windows Server 2003](http://en.wikipedia.org/wiki/Windows_Server_2003) box, and my IT administrator wants to update it to [Windows Server 2008](http://en.wikipedia.org/wiki/Windows_Server_2008). This means that I'm going to need to move my...
Yes, dumping and loading the repository is a way to go. Copying the repository folder directly is a viable option if, and only if, you are certain nobody will be accessing the repository while the copy process is in progress (or you can do a "hot copy" of the repository, which can handle these cases in a safe manner). ...
360,766
<p>I'd like to define a generic type, whose actual type parameter can only be</p> <ol> <li>One of the numeric primitive wrapper classes (<code>Long</code>, <code>Integer</code>, <code>Float</code>, <code>Double</code>)</li> <li><code>String</code></li> </ol> <p>I can meet the first requirement with a definition like ...
[ { "answer_id": 360786, "author": "Yuval Adam", "author_id": 24545, "author_profile": "https://Stackoverflow.com/users/24545", "pm_score": 0, "selected": false, "text": "<p>Interesting question, it boggled me a bit. However apparently this is impossible. I tried several different hacks, n...
2008/12/11
[ "https://Stackoverflow.com/questions/360766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
I'd like to define a generic type, whose actual type parameter can only be 1. One of the numeric primitive wrapper classes (`Long`, `Integer`, `Float`, `Double`) 2. `String` I can meet the first requirement with a definition like this ``` public final class MyClass<T extends Number> { // Implementation omitted }...
Java generics does not support union types (this parameter can be A OR B). On a related note that may be of interest to some, it does support multiple bounds, if you want to enforce multiple restrictions. Here's an example from the JDK mentioned in the Java [generics tutorial](http://java.sun.com/j2se/1.5/pdf/generics...
360,782
<p>Given either the binary or string representation of an IPv6 address and its prefix length, what's the best way to extract the prefix in Python?</p> <p>Is there a library that would do this for me, or would I have to:</p> <ol> <li>convert the address from string to an int (inet_ntop)</li> <li>Mask out the prefix</l...
[ { "answer_id": 360989, "author": "Martin v. Löwis", "author_id": 33006, "author_profile": "https://Stackoverflow.com/users/33006", "pm_score": 3, "selected": true, "text": "<p>See <a href=\"http://code.google.com/p/ipaddr-py/\" rel=\"nofollow noreferrer\">http://code.google.com/p/ipaddr-...
2008/12/11
[ "https://Stackoverflow.com/questions/360782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
Given either the binary or string representation of an IPv6 address and its prefix length, what's the best way to extract the prefix in Python? Is there a library that would do this for me, or would I have to: 1. convert the address from string to an int (inet\_ntop) 2. Mask out the prefix 3. Convert prefix back to b...
See <http://code.google.com/p/ipaddr-py/> With this, you can do ``` py> p=ipaddr.IPv6("2001:888:2000:d::a2") py> p.SetPrefix(64) py> p IPv6('2001:888:2000:d::a2/64') py> p.network_ext '2001:888:2000:d::' ``` etc.
360,789
<p>I want to otherwise block code execution on the main thread while still allowing UI changes to be displayed.</p> <p>I tried to come up with a simplified example version of what I'm trying to do; and this is the best I could come up with. Obviously it doesn't demonstrate the behavior I'm wanting or I wouldn't be pos...
[ { "answer_id": 360801, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 1, "selected": false, "text": "<p>structure your app so that the main thread only performs UI updates, and all other work is done on secondary threa...
2008/12/11
[ "https://Stackoverflow.com/questions/360789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16260/" ]
I want to otherwise block code execution on the main thread while still allowing UI changes to be displayed. I tried to come up with a simplified example version of what I'm trying to do; and this is the best I could come up with. Obviously it doesn't demonstrate the behavior I'm wanting or I wouldn't be posting the q...
I went with something I haven't seen posted yet which is to use MessageQueues. * The MainThread blocks while waiting for the next message on a queue. * The background thread posts different types of messages to the MessageQueue. * Some of the message types signal the MainThread to update UI elements. * Of course, ther...
360,816
<p>For some reason I can't use <code>runat="server"</code> as an attribute for the input tag in order for the jQuery to display the image button and work. Is something wrong without <code>runat="server"</code>? It works fine. And I want the format to be "yyyy/mm/dd" and also I need it for the server because this is whe...
[ { "answer_id": 360832, "author": "Jimmy", "author_id": 4435, "author_profile": "https://Stackoverflow.com/users/4435", "pm_score": 4, "selected": true, "text": "<p>it changes your id from \"#datepicker\" to \"form1_ctl01_ctl05_datepicker\" or something when you use runat='server'</p>\n\n...
2008/12/11
[ "https://Stackoverflow.com/questions/360816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39809/" ]
For some reason I can't use `runat="server"` as an attribute for the input tag in order for the jQuery to display the image button and work. Is something wrong without `runat="server"`? It works fine. And I want the format to be "yyyy/mm/dd" and also I need it for the server because this is where I check to see if the ...
it changes your id from "#datepicker" to "form1\_ctl01\_ctl05\_datepicker" or something when you use runat='server' EDIT: For a solution, you could pick it up based on css class rather than ID ``` <input id='datepicker' runat='server' class='datepicker' /> $(document).ready(function(){ $(".datepicker").datepicker({ ...
360,830
<p>I'm trying to retrieve data from an SQL Server 2000 server, and place into Excel. Which sounds simple I know. I'm currently Copying, and Pasting into Excel, from Management Studio</p> <p>The problem is one of the columns is an address, and it’s not retaining the newlines. These new lines have to stay in the same ce...
[ { "answer_id": 360886, "author": "Tmdean", "author_id": 45084, "author_profile": "https://Stackoverflow.com/users/45084", "pm_score": 2, "selected": true, "text": "<p>Try running this macro on the worksheet. (Right click the worksheet tab and click \"View Code\" to summon the VB IDE.)</p...
2008/12/11
[ "https://Stackoverflow.com/questions/360830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18405/" ]
I'm trying to retrieve data from an SQL Server 2000 server, and place into Excel. Which sounds simple I know. I'm currently Copying, and Pasting into Excel, from Management Studio The problem is one of the columns is an address, and it’s not retaining the newlines. These new lines have to stay in the same cell in exce...
Try running this macro on the worksheet. (Right click the worksheet tab and click "View Code" to summon the VB IDE.) ``` Sub FixNewlines() For Each Cell In UsedRange Cell.FormulaR1C1 = Replace(Cell.FormulaR1C1, Chr(13), "") Next Cell End Sub ```
360,831
<p>I have a scenario in which I'm going to need an arbitrary number of servers to provide the same SOAP web service. I would like to generate one set of proxy classes and be able to supply them with a location to point them at the different servers at runtime. Unfortunately, it looks as though the <code>wsdl:port</code...
[ { "answer_id": 360859, "author": "DCNYAM", "author_id": 30419, "author_profile": "https://Stackoverflow.com/users/30419", "pm_score": 0, "selected": false, "text": "<p>When you add a web reference to your project, it places the address of the web service into the .config file of your app...
2008/12/11
[ "https://Stackoverflow.com/questions/360831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2327/" ]
I have a scenario in which I'm going to need an arbitrary number of servers to provide the same SOAP web service. I would like to generate one set of proxy classes and be able to supply them with a location to point them at the different servers at runtime. Unfortunately, it looks as though the `wsdl:port` node (child ...
No, in .NET you can change the URL at runtime. ``` Service svc = new Service (); svc.url = "Value read from config. file or some such" output = svc.method (input); ```
360,833
<p>I have two Sharepoint lists: - Assignments - Activities</p> <p>The activities list has a lookup field to the assignments list as activities (e.g. monthly review of X) are related to an assignment. </p> <p>My question is, how would I display other fields from Assignments in a view of Activities using standard Sh...
[ { "answer_id": 363065, "author": "jwmiller5", "author_id": 7824, "author_profile": "https://Stackoverflow.com/users/7824", "pm_score": 2, "selected": true, "text": "<p>If you can't use the Data View Web Part from SPD, then I think you are going to have to use a content editor webpart and...
2008/12/11
[ "https://Stackoverflow.com/questions/360833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45492/" ]
I have two Sharepoint lists: - Assignments - Activities The activities list has a lookup field to the assignments list as activities (e.g. monthly review of X) are related to an assignment. My question is, how would I display other fields from Assignments in a view of Activities using standard Sharepoint 2007 (we h...
If you can't use the Data View Web Part from SPD, then I think you are going to have to use a content editor webpart and do this all in javascript. [intro article](http://www.cleverworkarounds.com/2008/02/28/more-sharepoint-branding-customisation-using-javascript-part-2/)
360,836
<p>Now this is all way simplified, but here goes:</p> <p>I have a User Control that consists only of a single *.ascx file. The control has no code-behind: it's just a script with a few functions, like this:</p> <pre><code>&lt;%@ Control Language="VB" EnableViewState="False" ClassName="MyControlType" %&gt; &lt;script...
[ { "answer_id": 360871, "author": "DCNYAM", "author_id": 30419, "author_profile": "https://Stackoverflow.com/users/30419", "pm_score": 0, "selected": false, "text": "<p>Make sure that the MyControl1 object in your code-behind is of type MyControlType and is casted as such when calling tha...
2008/12/11
[ "https://Stackoverflow.com/questions/360836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3043/" ]
Now this is all way simplified, but here goes: I have a User Control that consists only of a single \*.ascx file. The control has no code-behind: it's just a script with a few functions, like this: ``` <%@ Control Language="VB" EnableViewState="False" ClassName="MyControlType" %> <script runat="server"> Public Fu...
Weird works for me. ``` Imports Microsoft.VisualBasic Public Class MyControlType Inherits UserControl End Class ``` . ``` <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <%@ Register Src="~/WebUserControl.ascx" TagPrefix="aaa" TagName="MyControl" %> ... <aaa:My...
360,844
<p>I'd like to implement a <a href="http://en.wikipedia.org/wiki/Bloom_filter" rel="noreferrer">bloom filter</a> using MySQL (other a suggested alternative).</p> <p>The problem is as follows:</p> <p>Suppose I have a table that stores 8 bit integers, with these following values:</p> <pre><code>1: 10011010 2: 00110101...
[ { "answer_id": 361093, "author": "Alexei Tenitski", "author_id": 45508, "author_profile": "https://Stackoverflow.com/users/45508", "pm_score": 4, "selected": false, "text": "<p>Create a table with int column (use <a href=\"http://dev.mysql.com/doc/refman/5.0/en/integer-types.html\" rel=\...
2008/12/11
[ "https://Stackoverflow.com/questions/360844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43005/" ]
I'd like to implement a [bloom filter](http://en.wikipedia.org/wiki/Bloom_filter) using MySQL (other a suggested alternative). The problem is as follows: Suppose I have a table that stores 8 bit integers, with these following values: ``` 1: 10011010 2: 00110101 3: 10010100 4: 00100110 5: 00111011 6: 01101010 ``` I...
Create a table with int column (use [this link](http://dev.mysql.com/doc/refman/5.0/en/integer-types.html) to pick the right int size). Don't store numbers as a sequence of 0 and 1. For your data it will look like this: ``` number 154 53 148 38 59 106 ``` and you need to find all entries matching 24. Then you ca...
360,851
<p>What is the syntax to concatenate text into a binding expression for an asp.net webpage (aspx).</p> <p>For example if I had a hyperlink that was being bound like this:</p> <pre><code>&lt;asp:HyperLink id="lnkID" NavigateUrl='&lt;%# Bind("Link") %&gt;' Target="_blank" Text="View" runat="ser...
[ { "answer_id": 360865, "author": "Andrew Rollings", "author_id": 40410, "author_profile": "https://Stackoverflow.com/users/40410", "pm_score": 2, "selected": false, "text": "<p>I have used <code>String.Format(\"{0}{1}\"</code>... before to good effect.</p>\n" }, { "answer_id": 36...
2008/12/11
[ "https://Stackoverflow.com/questions/360851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1874/" ]
What is the syntax to concatenate text into a binding expression for an asp.net webpage (aspx). For example if I had a hyperlink that was being bound like this: ``` <asp:HyperLink id="lnkID" NavigateUrl='<%# Bind("Link") %>' Target="_blank" Text="View" runat="server"/> ``` How do you change...
You can also place the "concatenation" in the text portion of a tag if using a template field: ``` <asp:TemplateField HeaderText="Name" SortExpression="sortName"> <ItemTemplate> <asp:LinkButton ID="lbName" runat="server" OnClick="lbName_Click" CommandArgument='<%# Eval("ID") %>'> <%--Enter any text / eval ...
360,877
<pre><code>private static final GridLayout layout = new GridLayout( 3, 1, 1, 0 ); </code></pre> <p>in this line of code what do the numbers represent and how do you use them to arrange the checkboxes and buttons in the window?</p>
[ { "answer_id": 360984, "author": "Brian Knoblauch", "author_id": 15689, "author_profile": "https://Stackoverflow.com/users/15689", "pm_score": 3, "selected": false, "text": "<p>I refer you to: <a href=\"http://java.sun.com/javase/6/docs/api/java/awt/GridLayout.html\" rel=\"noreferrer\">h...
2008/12/11
[ "https://Stackoverflow.com/questions/360877", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` private static final GridLayout layout = new GridLayout( 3, 1, 1, 0 ); ``` in this line of code what do the numbers represent and how do you use them to arrange the checkboxes and buttons in the window?
I refer you to: <http://java.sun.com/javase/6/docs/api/java/awt/GridLayout.html>
360,899
<p>I have been working on this for the greater part of the day and I cant seem to make this part of my code work. The intent of the code is to allow the user to input a set of values in order to calculate the missing value. As an additional feature I placed a CheckBox on the form to allow the user to do further calcula...
[ { "answer_id": 360946, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 2, "selected": false, "text": "<p>Change this:</p>\n\n<pre><code>int y, b;\n</code></pre>\n\n<p>To this:</p>\n\n<pre><code>int y;\ndecimal b;\n</code></pre>\...
2008/12/11
[ "https://Stackoverflow.com/questions/360899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45151/" ]
I have been working on this for the greater part of the day and I cant seem to make this part of my code work. The intent of the code is to allow the user to input a set of values in order to calculate the missing value. As an additional feature I placed a CheckBox on the form to allow the user to do further calculatio...
Without really knowing what the problem is, a few things look a bit odd: * Also, mixing decimal and int in a calculation can lead to unexpected results unless you really know what you are doing. I suggest using only decimals (or doubles, which are way faster and usually have enough precision for engineering computatio...
360,913
<p>How do I update my subversion repository so it can accept updates to the log message field? I've got a Windows installation and I changed the pre-revprop-change.tmpl file name to a batch file, but now when I try to update a the log message property my tortoise svn just hangs and the property isn't updated. Am I doin...
[ { "answer_id": 360960, "author": "GEOCHET", "author_id": 5640, "author_profile": "https://Stackoverflow.com/users/5640", "pm_score": 2, "selected": false, "text": "<p>Assuming this is your application that you wrote in VS, just press F5 to run the program and either use a breakpoint, or ...
2008/12/11
[ "https://Stackoverflow.com/questions/360913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18927/" ]
How do I update my subversion repository so it can accept updates to the log message field? I've got a Windows installation and I changed the pre-revprop-change.tmpl file name to a batch file, but now when I try to update a the log message property my tortoise svn just hangs and the property isn't updated. Am I doing s...
Looking at the screenshot it appears that Visual Studio is currently debugging in Run mode - you need to break execution of the process before it makes sense to look at things like the call stack, etc... To break execution of the process you either need to hit a breakpoint, or you can break execution of the process at...
360,928
<p>I have a table (SQL 2000) with over 10,000,000 records. Records get added at a rate of approximately 80,000-100,000 per week. Once a week a few reports get generated from the data. The reports are typically fairly slow to run because there are few indexes (presumably to speed up the INSERTs). One new report coul...
[ { "answer_id": 360941, "author": "Brad Barker", "author_id": 12081, "author_profile": "https://Stackoverflow.com/users/12081", "pm_score": 0, "selected": false, "text": "<p>For a table of that size your best bet is probably going to be partitioning your table and indexes.</p>\n" }, {...
2008/12/11
[ "https://Stackoverflow.com/questions/360928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1664/" ]
I have a table (SQL 2000) with over 10,000,000 records. Records get added at a rate of approximately 80,000-100,000 per week. Once a week a few reports get generated from the data. The reports are typically fairly slow to run because there are few indexes (presumably to speed up the INSERTs). One new report could reall...
You need to look at the query plan and see if it is using that new index - if it isnt there are a couple things. One - it could have a cached query plan that it is using that has not been invalidated since the new index was created. If that is not the case you can also trying index hints [ With (Index (yourindexname)) ...
360,943
<p>I have a problem on how to read text from file and perform operations on it for example</p> <p>i have this text file that include</p> <p>//name-//sex---------//birth //m1//m2//m3</p> <pre><code>fofo, male, 1986, 67, 68, 69 momo, male, 1986, 99, 98, 100 Habs, female, 1988, 99, 100, 87 toto, male, 198...
[ { "answer_id": 360979, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 1, "selected": false, "text": "<p>I wrote a blog post a while back detailing the act of reading a CSV file and parsing its columns:</p>\n\n<p><a href=\...
2008/12/11
[ "https://Stackoverflow.com/questions/360943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a problem on how to read text from file and perform operations on it for example i have this text file that include //name-//sex---------//birth //m1//m2//m3 ``` fofo, male, 1986, 67, 68, 69 momo, male, 1986, 99, 98, 100 Habs, female, 1988, 99, 100, 87 toto, male, 1989, 67, 68, 69 lolo, female, ...
Try something like this. ``` var qry = from line in File.ReadAllLines(@"C:\Temp\Text.txt") let vals = line.Split(new char[] { ',' }) select new { Name = vals[0].Trim(), Sex = vals[1].Trim(), Birth = vals[2].Trim(), m1 = Int32...
360,961
<p>I've got a table, called faq_questions with the following structure:</p> <pre><code>id int not_null auto_increment, question varchar(255), sort_order int </code></pre> <p>I'm attempting to build a query that given a sort order, selects the row with the next highest sort order. </p> <p>Example:</p> <pre><code>id...
[ { "answer_id": 360975, "author": "Eran Galperin", "author_id": 10585, "author_profile": "https://Stackoverflow.com/users/10585", "pm_score": 6, "selected": true, "text": "<p>It seems too simple, but it looks like what you need: </p>\n\n<pre><code>SELECT id,question FROM `questions` \n...
2008/12/11
[ "https://Stackoverflow.com/questions/360961", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1742702/" ]
I've got a table, called faq\_questions with the following structure: ``` id int not_null auto_increment, question varchar(255), sort_order int ``` I'm attempting to build a query that given a sort order, selects the row with the next highest sort order. Example: ``` id question sort_order 1 'Th...
It seems too simple, but it looks like what you need: ``` SELECT id,question FROM `questions` WHERE `sort_order` > sort_order_variable ORDER BY sort_order ASC LIMIT 1 ```
360,968
<p>I'm seeing some code I've inherited that looks like the following:</p> <pre><code>@interface SomeClass (private) </code></pre> <p>This is within <code>SomeClass.m</code>, the implementation file. There is an accompanying header file which doesn't suggest that the class is using a category. Is <code>(private)</code...
[ { "answer_id": 361026, "author": "mipadi", "author_id": 28804, "author_profile": "https://Stackoverflow.com/users/28804", "pm_score": 2, "selected": false, "text": "<p>\"Private\" is just a name that suggests the methods are not public and are used for the internal implementation of the ...
2008/12/11
[ "https://Stackoverflow.com/questions/360968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40882/" ]
I'm seeing some code I've inherited that looks like the following: ``` @interface SomeClass (private) ``` This is within `SomeClass.m`, the implementation file. There is an accompanying header file which doesn't suggest that the class is using a category. Is `(private)` in this case just a poor name given to a categ...
It isn't the name "private" that makes it private; the methods are private because they are in a category declared within the implementation file. There are three uses of a category, each of which add methods to a class (note: methods only, not iVars) **Extending an existing Cocoa class** This lets you add your own ...
360,982
<p>I was searching here about converting a string like "16:20" to a DateTime type without losing the format, I said I dont want to add dd/MM/yyy or seconds or AM/PM, because db just accept this format.</p> <p>I tried with Cultures yet</p> <p>Thanks in Advance</p>
[ { "answer_id": 360998, "author": "MartinHN", "author_id": 2972, "author_profile": "https://Stackoverflow.com/users/2972", "pm_score": 2, "selected": false, "text": "<p>DateTime.Now.ToString(\"hh:mm\") - If it's C#.</p>\n\n<p>Oh. Only read the header.</p>\n\n<pre><code>DateTime dt = new D...
2008/12/11
[ "https://Stackoverflow.com/questions/360982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1388553/" ]
I was searching here about converting a string like "16:20" to a DateTime type without losing the format, I said I dont want to add dd/MM/yyy or seconds or AM/PM, because db just accept this format. I tried with Cultures yet Thanks in Advance
All DateTime objects must have a date and a time. If you want just the time, use TimeSpan: ``` TimeSpan span = TimeSpan.Parse("16:20"); ``` If you want a DateTime, add that time to the min value: ``` TimeSpan span = TimeSpan.Parse("16.20"); DateTime dt = DateTime.MinValue.Add(span); // will get you 1/1/1900 4:20 ...
360,990
<p>I am looking to get a list of the column names returned from a Model. Anyone know how this would be done, any help would be greatly appreciated.</p> <p>Example Code:</p> <pre><code>var project = db.Projects.Single(p =&gt; p.ProjectID.Equals(Id)); </code></pre> <p>This code would return the Projects object, how wo...
[ { "answer_id": 361154, "author": "Kyle West", "author_id": 34133, "author_profile": "https://Stackoverflow.com/users/34133", "pm_score": 0, "selected": false, "text": "<p>Your columns should be mapped as properties on your Project model. I'm not sure if you can get the underlying databas...
2008/12/11
[ "https://Stackoverflow.com/questions/360990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45509/" ]
I am looking to get a list of the column names returned from a Model. Anyone know how this would be done, any help would be greatly appreciated. Example Code: ``` var project = db.Projects.Single(p => p.ProjectID.Equals(Id)); ``` This code would return the Projects object, how would I get a list of all the column n...
I am sorry, I don't have working experience with LINQ. This is purely based on looking at MSDN. `DataContext` has a `Mapping` property, which returns an instance of [`MetaModel`](http://msdn.microsoft.com/en-us/library/system.data.linq.mapping.metamodel.aspx). `MetaModel` has `GetMetaType`, which takes a `Type`. ...
361,002
<p>For fun, I'm trying to write one of my son's favorite board games as a piece of software. Eventually I expect to build a WPF UI on top of it, but right now I'm building the machine that models the games and its rules.</p> <p>As I do this, I keep seeing problems that I think are common to many board games, and perh...
[ { "answer_id": 361044, "author": "jmucchiello", "author_id": 44065, "author_profile": "https://Stackoverflow.com/users/44065", "pm_score": 2, "selected": false, "text": "<p><a href=\"http://www.threerings.com/code/\" rel=\"nofollow noreferrer\">Three Rings</a> offers LGPL'd Java librarie...
2008/12/11
[ "https://Stackoverflow.com/questions/361002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5314/" ]
For fun, I'm trying to write one of my son's favorite board games as a piece of software. Eventually I expect to build a WPF UI on top of it, but right now I'm building the machine that models the games and its rules. As I do this, I keep seeing problems that I think are common to many board games, and perhaps others ...
it seems this is a 2 month old thread that I've just noticed now, but what the heck. I've designed and developed the gameplay framework for a commercial, networked board game before. We had a very pleasant experience working with it. Your game can probably be in a (close to) infinite amount of states because of the pe...
361,023
<p>Say I've got a generic vertical market application and I want to package it as two separate programs aaa.exe and bbb.exe. Is there any way to use the Delphi linker to create an EXE/DLL file that doesn't have the same name as the DPR? </p> <p><b>I can't just rename the file</b> because I get this error </p> <pre> ...
[ { "answer_id": 361056, "author": "Craig Stuntz", "author_id": 7714, "author_profile": "https://Stackoverflow.com/users/7714", "pm_score": 4, "selected": false, "text": "<p>Delphi 2007 and Delphi 2009 both use MSbuild. You can use post-build events in MSbuild to do almost anything you wa...
2008/12/11
[ "https://Stackoverflow.com/questions/361023", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1765/" ]
Say I've got a generic vertical market application and I want to package it as two separate programs aaa.exe and bbb.exe. Is there any way to use the Delphi linker to create an EXE/DLL file that doesn't have the same name as the DPR? **I can't just rename the file** because I get this error ``` bbb.exe - Unabl...
Delphi 2007 and Delphi 2009 both use MSbuild. You can use post-build events in MSbuild to do almost anything you want. You could, for example, use the Copy task to copy the EXE into a new filename.
361,024
<p>I want to make a WPF Window that behaves like a context menu.</p> <p>So, for instance - when I show the wpf window, I want it to be the topmost window and from there on out, if the user clicks anything outside of that window I want the window to be hidden again.</p> <p>So far I have tried quite a few techniques bu...
[ { "answer_id": 361061, "author": "Robert Macnee", "author_id": 19273, "author_profile": "https://Stackoverflow.com/users/19273", "pm_score": 3, "selected": true, "text": "<p>Is <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.popup.aspx\" rel=\"nofollo...
2008/12/11
[ "https://Stackoverflow.com/questions/361024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16387/" ]
I want to make a WPF Window that behaves like a context menu. So, for instance - when I show the wpf window, I want it to be the topmost window and from there on out, if the user clicks anything outside of that window I want the window to be hidden again. So far I have tried quite a few techniques but the only one th...
Is [PopUp](http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.popup.aspx) not sufficient for your needs? It has a [StaysOpen](http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.popup.staysopen.aspx) property that lets it act like you describe.
361,049
<p>I have a web application deployed in an internet hosting provider. This web application consumes a WCF Service deployed at an IIS server located at my company’s application server, in order to have data access to the company’s database, the network guys allowed me to expose this WCF service through a firewall for se...
[ { "answer_id": 362108, "author": "Mitch Baker", "author_id": 37896, "author_profile": "https://Stackoverflow.com/users/37896", "pm_score": 4, "selected": true, "text": "<p>You might try decorating your service class with:</p>\n\n<pre><code>[ServiceBehavior(AddressFilterMode = AddressFilt...
2008/12/11
[ "https://Stackoverflow.com/questions/361049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45516/" ]
I have a web application deployed in an internet hosting provider. This web application consumes a WCF Service deployed at an IIS server located at my company’s application server, in order to have data access to the company’s database, the network guys allowed me to expose this WCF service through a firewall for secur...
You might try decorating your service class with: ``` [ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)] ```
361,069
<p>An answer and subsequent <a href="https://stackoverflow.com/questions/360899/c-math-problem#360931">debate in the comments</a> in another thread prompted me to ask:</p> <p>In C# || and &amp;&amp; are the short-circuited versions of the logical operators | and &amp; respectively.<br /></p> <p>Example usage:</p> <p...
[ { "answer_id": 361085, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 7, "selected": true, "text": "<blockquote>\n <p>In terms of coding practice which is the better to use and why?</p>\n</blockquote>\n\n<p>Simple ans...
2008/12/11
[ "https://Stackoverflow.com/questions/361069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33226/" ]
An answer and subsequent [debate in the comments](https://stackoverflow.com/questions/360899/c-math-problem#360931) in another thread prompted me to ask: In C# || and && are the short-circuited versions of the logical operators | and & respectively. Example usage: ``` if (String.IsNullOrEmpty(text1) | String.IsNul...
> > In terms of coding practice which is the better to use and why? > > > Simple answer: always use the short-circuited versions. There’s simply no reason not to. Additionally, you make your code clearer because you express your *intent*: logical evaluation. Using the bitwise (logical) operations implies that you ...
361,073
<p>I'm working on a large web application with a lot of AJAX whose event handling has gotten out of control. I'm trying to set up an <a href="http://icant.co.uk/sandbox/eventdelegation/" rel="nofollow noreferrer">event delegation</a> system to manage all of it, but am wondering if there's a workaround for IE's non-bub...
[ { "answer_id": 361433, "author": "Matt Kantor", "author_id": 3625, "author_profile": "https://Stackoverflow.com/users/3625", "pm_score": 0, "selected": false, "text": "<p><strong>Options I've considered thus far:</strong></p>\n\n<ul>\n<li>The crappy solution that I posted in the question...
2008/12/11
[ "https://Stackoverflow.com/questions/361073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3625/" ]
I'm working on a large web application with a lot of AJAX whose event handling has gotten out of control. I'm trying to set up an [event delegation](http://icant.co.uk/sandbox/eventdelegation/) system to manage all of it, but am wondering if there's a workaround for IE's non-bubbling form submits (there are a lot of fo...
Can you make the forms return false and just look for the CLICK event on the submit buttons instead of the form submit event? Then submit the forms programatically via your AJAX calls.
361,077
<p>Today I ran into a problem were I needed to remote-debug a program. The program was launched from another system, so I really don't have an opportunity to interact with it on the command line. I could change its source easily though.</p> <p>What I needed to happen was for the program to start normally, and then w...
[ { "answer_id": 361124, "author": "Steven Behnke", "author_id": 42588, "author_profile": "https://Stackoverflow.com/users/42588", "pm_score": 3, "selected": false, "text": "<p>I don't know, since I've never tried it but I wonder if you could use <code>System.Diagnostics.Debugger.Break()</...
2008/12/11
[ "https://Stackoverflow.com/questions/361077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8173/" ]
Today I ran into a problem were I needed to remote-debug a program. The program was launched from another system, so I really don't have an opportunity to interact with it on the command line. I could change its source easily though. What I needed to happen was for the program to start normally, and then wait for me t...
You can use the [System.Diagnostics.Debugger.IsAttached](http://msdn.microsoft.com/en-us/library/system.diagnostics.debugger.isattached.aspx) property to check if a debugger is attached to the process. This application will wait until a debugger has been attached: ``` using System; using System.Diagnostics; using Syst...
361,097
<p>I have a service that sometimes calls a batch file. The batch file takes 5-10 seconds to execute:</p> <pre><code>System.Diagnostics.Process proc = new System.Diagnostics.Process(); // Declare New Process proc.StartInfo.FileName = fileName; proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.H...
[ { "answer_id": 361121, "author": "kemiller2002", "author_id": 1942, "author_profile": "https://Stackoverflow.com/users/1942", "pm_score": 6, "selected": true, "text": "<p>Here is what i use to execute batch files:</p>\n\n<pre><code>proc.StartInfo.FileName = target;\nproc....
2008/12/11
[ "https://Stackoverflow.com/questions/361097", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
I have a service that sometimes calls a batch file. The batch file takes 5-10 seconds to execute: ``` System.Diagnostics.Process proc = new System.Diagnostics.Process(); // Declare New Process proc.StartInfo.FileName = fileName; proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; pro...
Here is what i use to execute batch files: ``` proc.StartInfo.FileName = target; proc.StartInfo.RedirectStandardError = true; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.UseShellExecute = false; proc.Start(); proc.WaitForExit ( (timeout <= 0) ? i...
361,115
<p>I tried to make a dynamic 2D array of <code>char</code> as follow:</p> <pre><code>char** ppMapData = (char**)malloc(sizeof(char*)*iMapHeight); for (int i=0; i&lt; iMapHeight; i++) { ppMapData[i] = (char*)malloc(sizeof(char)*iMapWidth); //do something } // do something for (int i=0; i&lt;iMapHeight; i++) ...
[ { "answer_id": 361126, "author": "Torlack", "author_id": 5243, "author_profile": "https://Stackoverflow.com/users/5243", "pm_score": 3, "selected": false, "text": "<p>At a quick glance, the frees look fine. The next thing you should test is to make sure you aren't overrunning any of the...
2008/12/11
[ "https://Stackoverflow.com/questions/361115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I tried to make a dynamic 2D array of `char` as follow: ``` char** ppMapData = (char**)malloc(sizeof(char*)*iMapHeight); for (int i=0; i< iMapHeight; i++) { ppMapData[i] = (char*)malloc(sizeof(char)*iMapWidth); //do something } // do something for (int i=0; i<iMapHeight; i++) free(ppMapData[i]); free(ppM...
At a quick glance, the frees look fine. The next thing you should test is to make sure you aren't overrunning any of these arrays past the end. This can cause problems with memory allocation systems. If you are using visual studio, you can call \_CrtCheckMemory to help verify that you aren't trashing things. That call...
361,130
<p>When selecting a block of text (possibly spanning across many DOM nodes), is it possible to extract the selected text and nodes using Javascript?</p> <p>Imagine this HTML code:</p> <pre><code>&lt;h1&gt;Hello World&lt;/h1&gt;&lt;p&gt;Hi &lt;b&gt;there!&lt;/b&gt;&lt;/p&gt; </code></pre> <p>If the user initiated a m...
[ { "answer_id": 364476, "author": "Borgar", "author_id": 27388, "author_profile": "https://Stackoverflow.com/users/27388", "pm_score": 5, "selected": true, "text": "<p>You are in for a bumpy ride, but this is quite possible. The main problem is that IE and W3C expose completely different ...
2008/12/11
[ "https://Stackoverflow.com/questions/361130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45435/" ]
When selecting a block of text (possibly spanning across many DOM nodes), is it possible to extract the selected text and nodes using Javascript? Imagine this HTML code: ``` <h1>Hello World</h1><p>Hi <b>there!</b></p> ``` If the user initiated a mouseDown event starting at "World..." and then a mouseUp even right a...
You are in for a bumpy ride, but this is quite possible. The main problem is that IE and W3C expose completely different interfaces to selections so if you want cross browser functionality then you basically have to write the whole thing twice. Also, some basic functionality is missing from both interfaces. Mozilla de...
361,135
<p>I have a table where I store customer sales (on periodicals, like newspaper) data. The product is stored by issue. Example</p> <pre> custid prodid issue qty datesold 1 123 2 12 01052008 2 234 1 5 01022008 1 123 1 5 01012008 2 444 2 ...
[ { "answer_id": 361146, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>Generic SQL; SQL Server's syntax shouldn't be much different:</p>\n\n<pre><code>SELECT prodid, max(issue) FROM sales WHERE ...
2008/12/11
[ "https://Stackoverflow.com/questions/361135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23667/" ]
I have a table where I store customer sales (on periodicals, like newspaper) data. The product is stored by issue. Example ``` custid prodid issue qty datesold 1 123 2 12 01052008 2 234 1 5 01022008 1 123 1 5 01012008 2 444 2 3 ...
Assuming that "latest" is determined by date (rather than by issue number), this method is usually pretty fast, assuming decent indexes: ``` SELECT T1.prodid, T1.issue FROM Sales T1 LEFT OUTER JOIN dbo.Sales T2 ON T2.custid = T1.custid AND T2.prodid = T1.prodid AND T2.datesold > T1.dateso...
361,137
<p>Is it possible to bypass the Freemarker cache when certain templates are requested? I realise that I'll probably have to implement my own TemplateLoader in order to do this, but even so, I can't see a way to check the cache when say template A is requested, but bypass it when template B is requested?</p> <p>If this...
[ { "answer_id": 361242, "author": "Dan Vinton", "author_id": 21849, "author_profile": "https://Stackoverflow.com/users/21849", "pm_score": 2, "selected": false, "text": "<p>try disabling caching on your <a href=\"http://freemarker.sourceforge.net/docs/api/freemarker/template/Configuration...
2008/12/11
[ "https://Stackoverflow.com/questions/361137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
Is it possible to bypass the Freemarker cache when certain templates are requested? I realise that I'll probably have to implement my own TemplateLoader in order to do this, but even so, I can't see a way to check the cache when say template A is requested, but bypass it when template B is requested? If this is not po...
try disabling caching on your [configuration](http://freemarker.sourceforge.net/docs/api/freemarker/template/Configuration.html#setTemplateUpdateDelay(int)): ``` configuration.setTemplateUpdateDelay(0); ``` This should cause it to check for a newer version of a template every time it's requested. To skip the cache ...