qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
283,951 | <p>This may be a painfully simply question for which I will be mocked but I am having difficulty in using filepaths in master pages. I believe this is because if a page in a sub-directory to using the master page then the filepath is incorrect.</p>
<p>To fix this I need to get the filepath from the root but I can't seem to get it working.</p>
<p>I tried:</p>
<pre><code><script type="text/javascript" src="~/jQueryScripts/jquery.js"></script>
</code></pre>
<p>and</p>
<pre><code><script type="text/javascript" src="../jQueryScripts/jquery.js"></script>
</code></pre>
<p>No luck on either!</p>
<p>Any ideas on how I can tell it to get the filepath from the root?</p>
| [
{
"answer_id": 283976,
"author": "Powerlord",
"author_id": 15880,
"author_profile": "https://Stackoverflow.com/users/15880",
"pm_score": 3,
"selected": true,
"text": "<script type=\"text/javascript\" src=\"/jQueryScripts/jquery.js\"></script>"
},
{
"answer_id": 284005,
"autho... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35454/"
] |
283,956 | <p>If for example you follow the link:</p>
<p><code>data:application/octet-stream;base64,SGVsbG8=</code></p>
<p>The browser will prompt you to download a file consisting of the data held as base64 in the hyperlink itself. Is there any way of suggesting a default name in the markup? If not, is there a JavaScript solution?</p>
| [
{
"answer_id": 283982,
"author": "Alnitak",
"author_id": 6782,
"author_profile": "https://Stackoverflow.com/users/6782",
"pm_score": 5,
"selected": false,
"text": "<a>"
},
{
"answer_id": 6171309,
"author": "ninjagecko",
"author_id": 711085,
"author_profile": "https://... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
283,961 | <p>I have a problem when I try to center the div block "products" because I don't know in advance the div width. Anybody have a solution?</p>
<p>Update: The problem I have is I don't know how many products I'll display, I can have 1, 2 or 3 products, I can center them if it was a fixed number as I'd know the width of the parent div, I just don't know how to do it when the content is dynamic.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.product_container {
text-align: center;
height: 150px;
}
.products {
height: 140px;
text-align: center;
margin: 0 auto;
clear: ccc both;
}
.price {
margin: 6px 2px;
width: 137px;
color: #666;
font-size: 14pt;
font-style: normal;
border: 1px solid #CCC;
background-color: #EFEFEF;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="product_container">
<div class="products" id="products">
<div id="product_15">
<img src="/images/ecommerce/card_default.png">
<div class="price">R$ 0,01</div>
</div>
<div id="product_15">
<img src="/images/ecommerce/card_default.png">
<div class="price">R$ 0,01</div>
</div>
<div id="product_15">
<img src="/images/ecommerce/card_default.png">
<div class="price">R$ 0,01</div>
</div>
</div>
</div></code></pre>
</div>
</div>
</p>
| [
{
"answer_id": 283974,
"author": "Arief",
"author_id": 34096,
"author_profile": "https://Stackoverflow.com/users/34096",
"pm_score": -1,
"selected": false,
"text": " margin: 0px auto;\n padding: 0px;\n border:0;\n width: 700px;\n"
},
{
"answer_id": 283985,
"author... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283961",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
283,965 | <p>for a server based j2ee application, I need to retrieve the number of pages from word documents.. any ideas what works?</p>
| [
{
"answer_id": 34554452,
"author": "Khalid Habib",
"author_id": 1533783,
"author_profile": "https://Stackoverflow.com/users/1533783",
"pm_score": 0,
"selected": false,
"text": "Document doc = new Document(\"C:\\\\Temp\\\\file.doc\"); \n"
},
{
"answer_id": 58136976,
"author": ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36906/"
] |
283,977 | <p>Does the C++ STL set data structure have a set difference operator?</p>
| [
{
"answer_id": 283989,
"author": "Ian G",
"author_id": 5764,
"author_profile": "https://Stackoverflow.com/users/5764",
"pm_score": 1,
"selected": false,
"text": "template <class InputIterator1, class InputIterator2, class OutputIterator>\nOutputIterator set_difference(InputIterator1 firs... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28462/"
] |
284,019 | <p>What is the best way to convert a fixed length string array to a fixed lengh integer array in C++ ?</p>
| [
{
"answer_id": 284040,
"author": "luke",
"author_id": 16434,
"author_profile": "https://Stackoverflow.com/users/16434",
"pm_score": 3,
"selected": false,
"text": "#include <algorithm>\nchar foo[9] = \"asdfasdf\";\nint bar[9];\nstd::copy(foo, foo+9, bar);\n"
},
{
"answer_id": 2840... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
284,029 | <p>I use SourceGear Vault and applyLabel="true" for a project so when it builds it will create a label in SourceGear Vault for the corresponding project.My questions are</p>
<p>I have a nightly builds so what if i don't have any changes made to that project for that day then how do I define my settings....</p>
<pre><code> <sourcecontrol type="vault" autoGetSource="true" applyLabel="true">
<executable>c:\program files\sourcegear\vault client\vault.exe</executable>
<username>john</username>
<password>password</password>
<host>server</host>
<repository>Default Repository</repository>
<folder>$/Projects/xxx/xxx/xxx/source/xxx/xxx/xxx/xx.source</folder>
<ssl>false</ssl>
<timeout units="minutes">10</timeout>
**<useWorkingDirectory>false</useWorkingDirectory>**
<workingDirectory>C:\CCNET\build\xx\xx\</workingDirectory>
</sourcecontrol>
</code></pre>
<p>The thing is that I don't want labels for build where there are no changes to code. </p>
<p>Any help is appreciated.</p>
| [
{
"answer_id": 284068,
"author": "Scott Dorman",
"author_id": 1559,
"author_profile": "https://Stackoverflow.com/users/1559",
"pm_score": 2,
"selected": false,
"text": "<triggers>"
}
] | 2008/11/12 | [
"https://Stackoverflow.com/questions/284029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
284,038 | <p>I am currently modifying some jsf application. I have two beans.</p>
<ul>
<li>connectionBean</li>
<li>UIBean</li>
</ul>
<p>When I set my connection parameters in connectionBean the first time, the UIBean is able to read my connectionBean information and display the correct UI Tree.</p>
<p>However when I try to set the connection parameters in the same session. My UIBean will still use the previous connectionBean information.</p>
<p>It only will use after I invalidate the whole httpSession.</p>
<p>Is there anyway I can make one session bean update another session bean?</p>
| [
{
"answer_id": 286577,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "protected Object getBackingBean( String name )\n{\n FacesContext context = FacesContext.getCurrentInstance();\n\n return... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
284,043 | <p>If I'm writing unit tests in Python (using the unittest module), is it possible to output data from a failed test, so I can examine it to help deduce what caused the error?</p>
<p>I am aware of the ability to create a customized message, which can carry some information, but sometimes you might deal with more complex data, that can't easily be represented as a string.</p>
<p>For example, suppose you had a class Foo, and were testing a method bar, using data from a list called testdata:</p>
<pre><code>class TestBar(unittest.TestCase):
def runTest(self):
for t1, t2 in testdata:
f = Foo(t1)
self.assertEqual(f.bar(t2), 2)
</code></pre>
<p>If the test failed, I might want to output t1, t2 and/or f, to see why this particular data resulted in a failure. By output, I mean that the variables can be accessed like any other variables, after the test has been run.</p>
| [
{
"answer_id": 284110,
"author": "Ned Batchelder",
"author_id": 14343,
"author_profile": "https://Stackoverflow.com/users/14343",
"pm_score": 5,
"selected": false,
"text": "-s"
},
{
"answer_id": 284192,
"author": "monkut",
"author_id": 24718,
"author_profile": "https:... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27415/"
] |
284,049 | <p>How do you get the current directory where your app is running? </p>
| [
{
"answer_id": 284142,
"author": "Kieron",
"author_id": 5791,
"author_profile": "https://Stackoverflow.com/users/5791",
"pm_score": 5,
"selected": true,
"text": "using System.IO;\nusing System.Reflection;\n\nnamespace Utilities\n{\n static public class DirectoryHelper\n {\n ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7024/"
] |
284,052 | <p>Imagine the following. </p>
<ol>
<li>Html is parsed into a dom tree</li>
<li>Dom Nodes become available programmatically </li>
<li>Dom Nodes may-or-may-not be augmented programmatically</li>
<li>Augmented nodes are reserialised to html. </li>
</ol>
<p>I have primarily a question on how one would want the <b>"script"</b> tag to behave. </p>
<pre><code>my $tree = someparser( $source );
....
print $somenode->text();
$somenode->text('arbitraryjavascript');
....
print $tree->serialize();
</code></pre>
<p>Or to that effect. </p>
<p>The problem occurs when deciding how to appropriately treat the contents of this field in regards to ease of use, and portability/usability of its emissions.</p>
<p>What I'm wanting to do myself is this: </p>
<pre><code> $somenode->text("verbatim");
</code></pre>
<p>--> </p>
<pre><code> <script>
// <!-- <![CDATA[
verbatim
// ]]> -->
</script>
</code></pre>
<p>So that what i produce is both somewhat safe, and validation friendly. </p>
<p>But I'm indecisive if doing this magically is a good idea, and whether or not I should have code that tries to detect existing copies of 'safety blocks' and replace them/strip them on the 'parse' phase. </p>
<p>If I don't strip it from input, I'm likely going to double up on the output phase, especially problematic if the output of this code is later wanted to be re-parsed. </p>
<p>If i strip it from input It will have the beneficial effect that programmatically fetching the content of the script element wont see the safety blocks at either end. </p>
<p>Ultimately there will be a way of toggling out some of this behaviour, but the question is what the /default/ way of handling this should be, and why. </p>
<p>Its possible my entire reasoning is flawed here and the text contents should go totally unprocessed unless wanted to be processed. </p>
<p>What behaviour do <strong>you</strong> look for in such a tool? Please point out anything in reasoning I may have overlooked. </p>
<hr>
<p><strong>TLDR Summary:</strong>
How should i programmatically handle the <strong>escaping</strong> mechanism in these scripts, namely the '<code>//<<code>!--<![CDATA[</code></code>' safey padding at either end, with respect to input/output </p>
| [
{
"answer_id": 284130,
"author": "Kent Fredric",
"author_id": 15614,
"author_profile": "https://Stackoverflow.com/users/15614",
"pm_score": 1,
"selected": false,
"text": "my $html=<<'EOF'\n<script>\n//<!--<![CDATA[\nfoo\n//]]>-->\n</script>\nEOF\n#/# this line is here for the syntax high... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15614/"
] |
284,060 | <p>I am using a simple <a href="http://framework.zend.com/manual/en/zend.auth.html" rel="noreferrer">Zend_Auth</a> setup to authenticate users for one of my applications, using a check in the preDispatch() method in a <a href="http://framework.zend.com/manual/en/zend.controller.plugins.html" rel="noreferrer">controller plugin</a>. When anonymous users navigate to </p>
<pre><code>/users/view/id/6
</code></pre>
<p>for example, they should be redirected to the above URI after authentication.</p>
<p>What is the best way to do this? I'd prefer not to store <code>$_SERVER['REQUEST_URI']</code> in the session. Personally, I'd find storing the entire Zend Request object to cleanest solution, but I am not sure if this is sensible and if this is the approach I should be taking.</p>
<p>Any thoughts?</p>
| [
{
"answer_id": 284130,
"author": "Kent Fredric",
"author_id": 15614,
"author_profile": "https://Stackoverflow.com/users/15614",
"pm_score": 1,
"selected": false,
"text": "my $html=<<'EOF'\n<script>\n//<!--<![CDATA[\nfoo\n//]]>-->\n</script>\nEOF\n#/# this line is here for the syntax high... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11568/"
] |
284,061 | <p>I am working on an application where I have an images folder relative to my application root. I want to be able to specify this relative path in the Properties -> Settings designer eg. "\Images\". The issue I am running into is in cases where the Environment.CurrentDirectory gets changed via an OpenFileDialog the relative path doesn't resolve to the right location. Is there a way to specifiy in the Settings file a path that will imply to always start from the application directory as opposed to the current directory? I know I can always dynamically concatenate the application path to the front of the relative path, but I would like my Settings property to be able to resolve itself.</p>
| [
{
"answer_id": 284082,
"author": "Scott Dorman",
"author_id": 1559,
"author_profile": "https://Stackoverflow.com/users/1559",
"pm_score": 2,
"selected": true,
"text": "Environment.CurrentDirectory"
},
{
"answer_id": 284088,
"author": "Chris Marasti-Georg",
"author_id": 96... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284061",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20489/"
] |
284,063 | <p>I'm currently refactoring code to replace Convert.To's to TryParse.</p>
<p>I've come across the following bit of code which is creating and assigning a property to an object.</p>
<pre><code>List<Person> list = new List<Person>();
foreach (DataRow row in dt.Rows)
{
var p = new Person{ RecordID = Convert.ToInt32(row["ContactID"]) };
list.Add(p);
}
</code></pre>
<p>What I've come up with as a replacement is:</p>
<pre><code>var p = new Person { RecordID = Int32.TryParse(row["ContactID"].ToString(), out RecordID) ? RecordID : RecordID };
</code></pre>
<p>Any thoughts, opinions, alternatives to what I've done?</p>
| [
{
"answer_id": 284078,
"author": "yfeldblum",
"author_id": 12349,
"author_profile": "https://Stackoverflow.com/users/12349",
"pm_score": 4,
"selected": true,
"text": "public static Int32? ParseInt32(this string str) {\n Int32 k;\n if(Int32.TryParse(str, out k))\n return k;\n... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17692/"
] |
284,090 | <p>My class contains a <code>Dictionary<T, S> dict</code>, and I want to expose a <code>ReadOnlyCollection<T></code> of the keys. How can I do this without copying the <code>Dictionary<T, S>.KeyCollection dict.Keys</code> to an array and then exposing the array as a <code>ReadOnlyCollection</code>? </p>
<p>I want the <code>ReadOnlyCollection</code> to be a proper wrapper, ie. to reflect changes in the underlying Dictionary, and as I understand it copying the collection to an array will not do this (as well as seeming inefficient - I don't actually want a new collection, just to expose the underlying collection of keys...). Any ideas would be much appreciated!</p>
<p>Edit: I'm using C# 2.0, so don't have extension methods such as .ToList (easily) available. </p>
| [
{
"answer_id": 284129,
"author": "Jb Evain",
"author_id": 36702,
"author_profile": "https://Stackoverflow.com/users/36702",
"pm_score": 4,
"selected": true,
"text": "var dictionary = ...;\nvar readonly_keys = new ReadOnlyCollection<T> (new CollectionListWrapper<T> (dictionary.Keys)\n);\n... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6091/"
] |
284,093 | <p>How do I build an escape sequence string in hexadecimal notation. </p>
<p>Example:</p>
<pre><code>string s = "\x1A"; // this will create the hex-value 1A or dec-value 26
</code></pre>
<p>I want to be able to build strings with hex-values between 00 to FF like this (in this example 1B)</p>
<pre><code>string s = "\x" + "1B"; // Unrecognized escape sequence
</code></pre>
<p>Maybe there's another way of making hexadecimal strings...</p>
| [
{
"answer_id": 284116,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 6,
"selected": true,
"text": "Byte value = 0x0FF;\nint value = 0x1B;\n"
},
{
"answer_id": 284243,
"author": "Nicolas Repiquet",
"author_id"... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36922/"
] |
284,094 | <p>I have an XML document something like :::</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="urn:schemas-microsoft-com:office:spreadsheet">
<Worksheet ss:Name="Worksheet1">
<Table>
<Column ss:Width="100"></Column>
<Row>
<Cell ss:Index="1" ss:StyleID="headerStyle">
<Data ss:Type="String">Submitted By</Data>
</Cell>
</Row>
<Row>
<Cell ss:Index="1" ss:StyleID="alternatingItemStyle">
<Data ss:Type="String">Value1-0</Data>
</Cell>
</Row>
</Table>
<AutoFilter xmlns="urn:schemas-microsoft-com:office:excel"
x:Range="R1C1:R1C5"></AutoFilter>
</Worksheet>
</Workbook>
</code></pre>
<p>The problem is when trying to select Rows with </p>
<pre><code> <xsl:for-each select="//Row">
<xsl:copy-of select="."/>
</xsl:for-each>
</code></pre>
<p>It is not matching. I removed all of the name-spacing and it works fine. So, how do I get the 'select' to match Row?</p>
| [
{
"answer_id": 284123,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 3,
"selected": false,
"text": "<xsl:for-each select=\"//*[local-name() = 'Row']\">\n <xsl:copy-of select=\".\"/>\n</xsl:for-each>\n"
},
{
"answe... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2017/"
] |
284,115 | <p>What is the best way to do cross-platform handling of hidden files?
(preferably in Python, but other solutions still appreciated)</p>
<p>Simply checking for a leading '.' works for *nix/Mac, and file attributes work on Windows. However, this seems a little simplistic, and also doesn't account for alternative methods of hiding things (.hidden files, etc.). Is there a standard way to deal with this?</p>
| [
{
"answer_id": 6365265,
"author": "Jason R. Coombs",
"author_id": 70170,
"author_profile": "https://Stackoverflow.com/users/70170",
"pm_score": 5,
"selected": false,
"text": "import ctypes\nimport os\n\ndef is_hidden(filepath):\n name = os.path.basename(os.path.abspath(filepath))\n ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2963/"
] |
284,164 | <p>I am using a Flex dataGrid, and need to sort some of my columns numerically.<br>
Looking at the sortCompareFunction, it seems like i need to create a different function for each column that i want to sort, because my sort function has to know what field it is sorting on. </p>
<p>Is there any way that I can pass the field to be sorted on into the function? so that I only need one numeric sorting function.</p>
| [
{
"answer_id": 722563,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "private function xmlDataGridNumericSorter(field:String):Function \n{\n\n return function (obj1:Object, obj2:Object):int \n ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32392/"
] |
284,201 | <p>I have a <a href="http://en.wikipedia.org/wiki/VBScript" rel="nofollow noreferrer">VBScript</a> script that starts a cmd prompt, telnets into a device and <a href="http://en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol" rel="nofollow noreferrer">TFTP</a>'s the configuration to a server. It works when I am logged in and run it manually. I would like to automate it with Windows <a href="http://en.wikipedia.org/wiki/Task_Scheduler" rel="nofollow noreferrer">Task Scheduler</a>.</p>
<p>Any assistance would be appreciated, here is the VBScript script:</p>
<pre><code>set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WScript.Sleep 300
WshShell.SendKeys "telnet 10.20.70.254{ENTER}"
WScript.Sleep 300
WshShell.SendKeys "netscreen"
WScript.Sleep 300
WshShell.SendKeys "{ENTER}"
WScript.Sleep 300
WshShell.SendKeys "netscreen"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 300
WScript.Sleep 300
WshShell.SendKeys "save conf to tftp 10.10.40.139 test.cfg{ENTER}"
WScript.Sleep 200
WshShell.SendKeys "exit{ENTER}" 'close telnet session'
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WScript.Sleep 300
WshShell.SendKeys "telnet 10.20.70.254{ENTER}"
WScript.Sleep 300
WshShell.SendKeys "netscreen"
WScript.Sleep 300
WshShell.SendKeys "{ENTER}"
WScript.Sleep 300
WshShell.SendKeys "netscreen"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 300
WScript.Sleep 300
WshShell.SendKeys "save conf to tftp 10.10.40.139 palsg140.cfg{ENTER}" 'repeat as needed
WScript.Sleep 200
WshShell.SendKeys "exit{ENTER}" 'close telnet session'
WshShell.SendKeys "{ENTER}" 'get command prompt back
WScript.Sleep 200
WshShell.SendKeys "exit{ENTER}" 'close cmd.exe
WshShell.SendKeys "{ENTER}" 'get command prompt back
WScript.Sleep 200
WshShell.SendKeys "exit{ENTER}" 'close cmd.exe
</code></pre>
| [
{
"answer_id": 295640,
"author": "Michael Galos",
"author_id": 29820,
"author_profile": "https://Stackoverflow.com/users/29820",
"pm_score": 1,
"selected": false,
"text": "telnet 10.10.40.139\nnetscreen\nnetscreen\nsave conf to tftp 10.10.40.139 palsg140.cf\nexit\n"
},
{
"answer_... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
284,220 | <pre><code>public class Item
{
private int _rowID;
private Guid _itemGUID;
public Item() { }
public int Rid
{
get
{
return _rowID;
}
set { }
}
public Guid IetmGuid
{
get
{
return _itemGuid;
}
set
{
_itemGuid= value;
}
}
}
</code></pre>
<p>The above is my custom object.</p>
<p>I have a list:</p>
<pre><code>List<V> myList = someMethod;
</code></pre>
<p>where V is of type Item, my object.</p>
<p>I want to iterate and get the properties as such</p>
<pre><code>foreach(V element in mylist)
{
Guid test = element.IetmGuid;
}
</code></pre>
<p>When I debug and look at the 'element' object I can see all the properties in the 'Quickwatch' but I cannot do element.IetmGuid.</p>
| [
{
"answer_id": 284235,
"author": "TcKs",
"author_id": 20382,
"author_profile": "https://Stackoverflow.com/users/20382",
"pm_score": 1,
"selected": false,
"text": "foreach( object element in myList ) {\n Item itm = element as Item;\n if ( null == itm ) { continue; }\n Guid test =... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
284,234 | <p>Having played around a little with both Tkinter and wxPython, I like Tkinter much better in terms of how clean my source code looks. However, it doesn't seem to have as many features; in particular it doesn't have tabs (as in, the tabs at the top of a Firefox window).</p>
<p>A little Googling on the subject offers a few suggestions. There's <a href="http://code.activestate.com/recipes/188537/" rel="noreferrer">a cookbook entry</a> with a class allowing you to use tabs, but it's very primitive. There's also <a href="http://pmw.sourceforge.net/" rel="noreferrer">Python megawidgets</a> on SourceForge, although this seems very old and gave me errors during installation.</p>
<p>Does anyone have experience making tabbed GUIs in Tkinter? What did you use? Or is it simply the case that anyone who needs more powerful windowing components has to use wxPython?</p>
| [
{
"answer_id": 284695,
"author": "tzot",
"author_id": 6899,
"author_profile": "https://Stackoverflow.com/users/6899",
"pm_score": 6,
"selected": true,
"text": "ttk"
},
{
"answer_id": 18922125,
"author": "sPaz",
"author_id": 1762092,
"author_profile": "https://Stackove... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1694/"
] |
284,240 | <p>I have a project where there are multiple applications that have some common configuration values. I would like to have a shared .config file that is available to all of the applications using the .Net configuration object model. Each application would also have its own app.config file</p>
<p>How can this best be done. I'd rather avoid using the registry as much as possible. In looking through the documentation, the OpenExeConfiguration(string exePath) method seems promising for accessing a specified config file. Is this a reasonable approach? Any other suggestions?</p>
| [
{
"answer_id": 284517,
"author": "Thad",
"author_id": 24500,
"author_profile": "https://Stackoverflow.com/users/24500",
"pm_score": 3,
"selected": false,
"text": "<appSetting configSource=\"somefile.config\"/>\n"
}
] | 2008/11/12 | [
"https://Stackoverflow.com/questions/284240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35598/"
] |
284,245 | <p>So let's say you wanted to make a copy of a Web Form page within a .Net Project. </p>
<p>Is there an easier way than:</p>
<ol>
<li>Copy Source Page</li>
<li>Page Source Page within project to get new page</li>
<li>Exclude Source Page </li>
<li>Rename code behind class for new page</li>
<li>Add Source Page Back</li>
</ol>
<p>Sometimes I miss something obvious is there a better way to do this? I know the next question would be "Why are you copying code within a project instead for reusing it?" Let's just say that's a secret;). </p>
| [
{
"answer_id": 284292,
"author": "Kon",
"author_id": 22303,
"author_profile": "https://Stackoverflow.com/users/22303",
"pm_score": 2,
"selected": false,
"text": "Inherits"
}
] | 2008/11/12 | [
"https://Stackoverflow.com/questions/284245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32113/"
] |
284,246 | <p>I'm currently working on a Google Maps project and am implementing a search function. In my search function I'm trying to have content on the side listing which search makers that were just added to the map correspond to each hall. However in assembling this string I run into a problem where my <code>side_bar_html</code> variable will not output if I do not alert the data first.</p>
<p>Here is my searchMap function. The variable is declared as such: <code>var side_bar_html = "";</code></p>
<pre><code>function searchMap(term, map) {
closeSearch();
searchCount = 0;
searchMarkers = [];
var request = GXmlHttp.create();
request.open("GET", "admin/search.php?s=" + term, true);
request.onreadystatechange = function() {
if (request.readyState == 4) {
var xmlDoc = GXml.parse(request.responseText);
var points = xmlDoc.documentElement.getElementsByTagName("point");
var polygonsToShow = [];
for (var i = 0; i < points.length; i++) {
var lat = parseFloat(points[i].getAttribute("lat"));
var lng = parseFloat(points[i].getAttribute("lng"));
var pid = points[i].getAttribute("id");
for(var j = 0; j < polygons.length; j++) {
if(polygons[j].vt_bid == pid) {
polygonsToShow.push(j);
}
}
var point = new GLatLng(lat,lng);
var pname = points[i].getAttribute("name");
var curMarker = createSearchMarker(point, pid, pname,getLetter(i));
map.addOverlay(curMarker);
}
//olays.buildings.checked = false; : Figure out some way to uncheck the buildings overlay checkbox?
for(var k = 0; k < polygons.length; k++) {
polygons[k].hide();
}
for(var l = 0; l < polygonsToShow.length; l++){
polygons[polygonsToShow[l]].show();
}
}
}
request.send(null);
alert(side_bar_html); //side_bar_html will be empty unless I alert the variable
searchResults = new HtmlControl('<div style="background-color:white; border:solid 1px grey; padding:2ex; overflow:auto; width:125px; margin:1px; font-size:14px;"><img align="right" style="cursor: pointer;" src="http://www.thebort.com/maps/images/close.gif" onclick="closeSearch()"><strong>Search</strong><br/>' + side_bar_html + '</div>', {selectable:true});
map.addControl(searchResults, new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(20, 70)));
}
</code></pre>
<p>And the function to create a search marker:</p>
<pre><code>function createSearchMarker(point, id, pname, letIcon) {
var marker = new GMarker(point,letIcon);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml('<a href="#" onclick=\'tb_show("' + pname + '","admin/get_info.php?b=' + id + '&KeepThis=true&TB_iframe=true&height=400&width=600",false); return false;\'>' + pname + '</a>');
});
side_bar_html = side_bar_html + '<a href="javascript:clickSearch(' + searchCount + ')">' + String.fromCharCode("A".charCodeAt(0) + searchCount) + ': ' + pname + '</a><br>';
marker.vt_id = id;
searchMarkers.push(marker);
searchCount++;
return marker;
}
</code></pre>
<p>I would like to keep code exposure for this project at a minimum right now so if anything needs expounding please let me know. Thanks!</p>
| [
{
"answer_id": 284265,
"author": "Eli Courtwright",
"author_id": 1694,
"author_profile": "https://Stackoverflow.com/users/1694",
"pm_score": 3,
"selected": true,
"text": "side_bar_html"
},
{
"answer_id": 284284,
"author": "Jared",
"author_id": 1980,
"author_profile": ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36939/"
] |
284,247 | <p>Recently, I started maintaining a web application which unfortunately works only with IE 6. Most of the issues are related to CSS.</p>
<p>Is there any tool which can help me standardize the CSS classes to work with <strong>both</strong> <strong>IE 6 and IE 7</strong>? I understand I have to go through standards but I need something to start with quickly.</p>
<p>Firebug can help me to some extend in identifying the CSS classes related to the UI elements (if the page renders on firefox). But, I was looking for something more like an advisor tool. If you have some experience to share, please feel free.</p>
| [
{
"answer_id": 1177213,
"author": "se_pavel",
"author_id": 80917,
"author_profile": "https://Stackoverflow.com/users/80917",
"pm_score": 1,
"selected": false,
"text": "css-selector { code for all browsers }\n\n*html css-selector {code for IE6 browser }\n\n*+html css-selector {code for IE... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4337/"
] |
284,258 | <p>As part of our build process I need to set the version information for all of our compiled binaries. Some of the binaries already have version information (added at compile time) and some do not. </p>
<p>I want to be able to apply the following information:</p>
<ul>
<li>Company Name </li>
<li>Copyright Notice</li>
<li>Product Name </li>
<li>Product Description</li>
<li>File Version </li>
<li>Product Version</li>
</ul>
<p>All of these attributes are specified by the build script and must be applied after compilation. These are standard binaries (not assemblies) compiled with C++ Builder 2007.</p>
<p>How can I do this?</p>
| [
{
"answer_id": 2111700,
"author": "filofel",
"author_id": 94816,
"author_profile": "https://Stackoverflow.com/users/94816",
"pm_score": 4,
"selected": false,
"text": "verpatch /va foodll.dll %VERSION% %FILEDESCR% %COMPINFO% %PRODINFO% %BUILDINFO%\n"
},
{
"answer_id": 18839527,
... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5449/"
] |
284,259 | <p>Years ago when I was starting a small development project, the other developers and I sat down and agreed on a compromise brace and indentation style. It wasn't anybody's favourite, but it was something that nobody really hated. I wrote a .indentrc configuration file to that style, and had a check-in trigger that would run indent on every file as it was being checked in. That made it so that it didn't matter what style you wrote your code in, it would end up being the group standard before anybody else saw it. This had the advantage of consistency. But I've never seen anybody else do it this way before or since.</p>
<p>So what say the rest of you? Great idea, or abomination?</p>
| [
{
"answer_id": 284289,
"author": "Eli Courtwright",
"author_id": 1694,
"author_profile": "https://Stackoverflow.com/users/1694",
"pm_score": 3,
"selected": false,
"text": "int x = y * z;\n"
},
{
"answer_id": 376100,
"author": "Mr. Shiny and New 安宇",
"author_id": 7867,
... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3333/"
] |
284,269 | <p>If I have an xmlreader instance how can I use it to read its current node and end up with a xmlElement instance?</p>
| [
{
"answer_id": 284406,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": true,
"text": "XmlDocument"
},
{
"answer_id": 284580,
"author": "Sunny Milenov",
"author_id": 8220,
"author_profi... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1946/"
] |
284,285 | <p>I have a GPS from u-blox.com with a USB-connection and driver. The driver installs a virual COM port that pops up when you plug the USB in. Using a hyperterminal I can then watch the flow of data from the GPS.</p>
<p>Then I want the data in my program, not so easy...</p>
<p>I have implemented some methods using the serialPort class to read from the GPS, but am unsuccessful. I have programmed several serial device readers and writers before in C#, but this one stops me.</p>
<p>As an example, the simple code in <a href="http://csharp.simpleserial.com/" rel="nofollow noreferrer">simpleSerial</a> will not give you anything unless you unplug and replug the USB.</p>
<p>Have tried reading it with matlab, which works great, but as the rest of my program that needs the GPS data is in c#, that doesn't quite fix the problem.</p>
<p>Is there some high level C# things going on in the serialPort class that I can circumvent? Or is there any known problems reading USB-serialports, which I assume works like my GPS?</p>
| [
{
"answer_id": 286098,
"author": "Jon Norton",
"author_id": 4797,
"author_profile": "https://Stackoverflow.com/users/4797",
"pm_score": -1,
"selected": false,
"text": "SerialPort.WriteLine"
},
{
"answer_id": 593450,
"author": "Dan McClain",
"author_id": 53587,
"author... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36927/"
] |
284,310 | <p>We're using Infragistics grid (most probably, we'll have 8.2 version at the end) and we want to configure row/cells appearances "on-demand" in order to be able to provide sort of "dynamic appearance".</p>
<p>For example, I want some cell to be red or green, depending on its value. We might want to tweak other characteristics as well (font, size, image, etc).</p>
<p>A perfect place to do it would be some event, that happen before a cell gets repainted... But it seems there is no such event in Infragistics...</p>
<p>Or am I wrong? Any help?</p>
<p><strong>Clarification:</strong> I'm talking about WinForms Infragistics UltraGrid</p>
| [
{
"answer_id": 284461,
"author": "John Rudy",
"author_id": 14048,
"author_profile": "https://Stackoverflow.com/users/14048",
"pm_score": 1,
"selected": false,
"text": "Paint"
}
] | 2008/11/12 | [
"https://Stackoverflow.com/questions/284310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2351099/"
] |
284,321 | <p>I have an application with 5 <code>UIViewController</code>s each inside a corresponding <code>UINavigationController</code>, all tucked inside a <code>UITabBarController</code> that displays 5 tabs at the bottom of the screen.</p>
<p>I want to display another <code>UIViewController</code> (inside a <code>UINavigationController</code>) when a dialog button is pressed.</p>
<p>This view should only be loaded and unloaded programatically; i.e. it should not appear in the tab bar. However, I want the tab bar to be visible always.</p>
<p>If I add the <code>[UINavigationController view]</code> to <code>[self window]</code> the <code>UITabBar</code> is covered. If I add it to any other layer, the <code>UINavigationController</code> adds on the compensation it has for the status bar so appears further down than expected.</p>
<p>A solution would be to have the 6th <code>UINavigationController</code> added to the <code>UITabBar</code> with the others, but with its <code>tabBarItem</code> hidden. Then I can show it and hide it using the <code>tabBar</code>s <code>selectedIndex</code> property.</p>
<p>Accessing the <code>tabBarItem</code> through the <code>UIViewController</code> shows no obvious way of doing this.</p>
<hr>
<p>@wisequark, I think you completely misunderstood and you have almost rewritten the architecture of my application. However I have a separate navigation controller for each view as they are mutually exclusive and there is no concept of "drilling down".</p>
<p>@Kendall, This is what I expect I will have to do - have the modal view appear with a hide button to bring back the normal interface. But it would be nice to keep the tab bar always visible, so I was just wondering if anyone knew of a way.</p>
| [
{
"answer_id": 284711,
"author": "wisequark",
"author_id": 33159,
"author_profile": "https://Stackoverflow.com/users/33159",
"pm_score": 4,
"selected": false,
"text": "UINavigationController"
}
] | 2008/11/12 | [
"https://Stackoverflow.com/questions/284321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33604/"
] |
284,324 | <p>How can I generate valid XML in C#?</p>
| [
{
"answer_id": 284331,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 10,
"selected": true,
"text": "XmlSerializer"
},
{
"answer_id": 1365017,
"author": "Community",
"author_id": -1,
"author_profile... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19020/"
] |
284,325 | <p>Suppose I have a process which spawns exactly one child process. Now when the parent process exits for whatever reason (normally or abnormally, by kill, ^C, assert failure or anything else) I want the child process to die. How to do that correctly?</p>
<hr>
<p>Some similar question on stackoverflow:</p>
<ul>
<li>(asked earlier) <a href="https://stackoverflow.com/questions/269494/how-can-i-cause-a-child-process-to-exit-when-the-parent-does">How can I cause a child process to exit when the parent does?</a></li>
<li>(asked later) <a href="https://stackoverflow.com/questions/395877/are-child-processes-created-with-fork-automatically-killed-when-the-parent-is-k">Are child processes created with fork() automatically killed when the parent is killed?</a></li>
</ul>
<hr>
<p>Some similar question on stackoverflow for <strong>Windows</strong>: </p>
<ul>
<li><a href="https://stackoverflow.com/questions/53208/how-do-i-automatically-destroy-child-processes-in-windows">How do I automatically destroy child processes in Windows?</a> </li>
<li><a href="https://stackoverflow.com/questions/3342941/kill-child-process-when-parent-process-is-killed">Kill child process when parent process is killed</a></li>
</ul>
| [
{
"answer_id": 284353,
"author": "Alnitak",
"author_id": 6782,
"author_profile": "https://Stackoverflow.com/users/6782",
"pm_score": 3,
"selected": false,
"text": "SIGKILL"
},
{
"answer_id": 284443,
"author": "qrdl",
"author_id": 28494,
"author_profile": "https://Stac... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9403/"
] |
284,336 | <p>My colleague has written a DLL which drives Excel.<br />
When I reference his DLL in my .NET app, I get a warning:</p>
<pre><code>The dependency 'Microsoft.Office.Interop.Excel' could not be found.
</code></pre>
<p>My app will compile.<br />
However, when I get to the bit that uses my colleague's DLL to access Excel, an exception is thrown, with the message above.</p>
<p>We should have identical setups: <strong>Windows XP Pro SP3, VS2003, .NET 1.1, Office 2003</strong></p>
<p>My problem seems similar to <a href="https://stackoverflow.com/questions/224181/net-microsoftofficeinteropexcel-and-interopexcel-dll">this question</a>, but I don't know if it's the same.</p>
<p>Any help or suggestions gratefully received!</p>
<h2>Update:</h2>
<p>Thanks for answers so far!</p>
<p>I have not added an explicit reference to <code>Microsoft.Office.Interop.Excel</code>.<br />
Surely I shouldn't have to?<br />
<strong>However</strong>: When I tried to add this reference, I cannot find <code>Microsoft.Office.Interop.Excel</code> in the Add Reference dialog.</p>
<p>Presumably this means that I am missing a DLL?<br />
... But I don't understand how that could happen?!</p>
<h2>Update (fixed):</h2>
<p>@ConcernedOfTunbridgeWells has the answer that fixed this for me: installing the Primary Interop Assemblies.</p>
| [
{
"answer_id": 284355,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "Microsoft.Office.Interop.Excel"
}
] | 2008/11/12 | [
"https://Stackoverflow.com/questions/284336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7211/"
] |
284,358 | <p>When serializing/de-serializing certain classes I've come across the need to flag or mark certain properties as CDATA elements (due to their content). I am currently handling this like so:</p>
<pre><code> <XmlElement("MessageText")> _
Public Property XmlContentLeft() As XmlCDataSection
Get
Dim doc As New XmlDataDocument()
Dim cd As XmlCDataSection = doc.CreateCDataSection(Me.MessageText)
Return cd
End Get
Set(ByVal value As XmlCDataSection)
Me.MessageText = value.Value
End Set
End Property
<XmlIgnore()> _
Public Property MessageText() As String
Get
Return _messageText
End Get
Set(ByVal value As String)
_messageText= value
End Set
End Property
</code></pre>
<p>Now while this works great it has drawbacks -- I now have duplicate properties for anything I want to be a CDATA element and I have to write extra code for these properties.</p>
<p>So my question is whether or not there is a better way to do this? I don't want to have to write custom schemas or serialization routines for each class. In an ideal scenario I'd be able to add an attribute to these properties so they are automatically treated as CDATA elements. </p>
| [
{
"answer_id": 284456,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 3,
"selected": true,
"text": "<XmlElement(\"MessageText\")> _\nPublic Property XmlContentLeft() As XmlCDataSection\n Get\n return GetCData(... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284358",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12842/"
] |
284,364 | <p>What's the easiest and most robust way of altering the .NET DateTimePicker control, to allow users to enter <code>null</code> values?</p>
| [
{
"answer_id": 284386,
"author": "splattne",
"author_id": 6461,
"author_profile": "https://Stackoverflow.com/users/6461",
"pm_score": 4,
"selected": true,
"text": "Value"
},
{
"answer_id": 1762980,
"author": "Jan Obrestad",
"author_id": 214557,
"author_profile": "http... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284364",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18071/"
] |
284,365 | <p>I'm trying to determine what situations MySQL updates an index. Say I have the following table:</p>
<pre><code>CREATE TABLE MyTable (
ID INT NOT NULL AUTO_INCREMENT,
MyIndexedColumn VARCHAR NOT NULL,
MyNonIndexedColumn VARCHAR,
PRIMARY KEY (ID),
INDEX MyNewIndex(MyIndexedColumn)
)
</code></pre>
<p>Then I run the following SQL to insert a row:</p>
<pre><code>INSERT INTO MyTable (MyIndexedColumn, MyNonIndexedColumn)
VALUES ('MyTestValue', 'MyTestValue');
</code></pre>
<p>I understand that this query will add some sort of hash key to a B-Tree index in MySQL for the value 'MyTestValue'.</p>
<p>Now, if I run the following statement, will that force that B-Tree index to be updated, even if I haven't changed the value of the column?</p>
<pre><code>UPDATE MyTable SET MyIndexedColumn = 'MyTestValue',
MyNonIndexedColumn = 'A New Value' WHERE ID = 1;
</code></pre>
<p>Is MySQL smart enough to determine that? Or by just making that column part of the update statement, am I telling MySQL that possibly something has changed, and it should do the work to update the index?</p>
| [
{
"answer_id": 287880,
"author": "Ezran",
"author_id": 32883,
"author_profile": "https://Stackoverflow.com/users/32883",
"pm_score": 3,
"selected": false,
"text": "10k updates of an indexed column with a new value:\nA: 76.8 seconds\nB: 126.7 seconds\n\n10k updates of a non-indexed colum... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/650/"
] |
284,368 | <p>I'm trying to bind one of my model objects to the fields of a form, using Spring-MVC. Everything works fine, except that one of the attributes of the model object is an unordered collection. Doing something like</p>
<pre><code> <c:forEach items="${m.items}" var="i" varStatus="itemsRow">
<form:input path="items[${itemsRow.index}]"/>
</c:forEach>
<form:errors path="items" />
</code></pre>
<p>would work fine for a List-type property, but for a Set throws an error when, upon submit, it tries to bind input field content to object attributes.</p>
<p>Is there something in Spring that works out of the box with Sets?</p>
| [
{
"answer_id": 284549,
"author": "zmf",
"author_id": 13285,
"author_profile": "https://Stackoverflow.com/users/13285",
"pm_score": 1,
"selected": false,
"text": " <c:forEach items=\"${items}\" var=\"i\" varStatus=\"itemsRow\">\n <input name=\"items[${itemsRow.index}].fieldName\" t... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6069/"
] |
284,370 | <p>I'm trying to return all the child nodes of a set of navigation nodes in sharepoint, the SDK implies I should be doing something like this:</p>
<pre><code>NodeColl = objSite.Navigation.TopNavigationBar
Dim Node as SPNavigationNode
For Each Node In NodeColl
if Node.IsVisible then
Response.Write("<siteMapNode url=""" & Node.Url & """ title=""" & Node.Title & """ description=""" & Node.Title & """ >" & Environment.NewLine)
Dim SubChildNodes as SPNavigationNodeCollection = Node.Children
Response.Write(SubChildNodes.Count) 'returns 0 always even though I know theres over 20 nodes in some of the sections
Dim ChildNode as SPNavigationNode
For Each ChildNode in SubChildNodes
if ChildNode.IsVisible then
Response.Write("<siteMapNode url=""" & ChildNode.Url & """ title=""" & ChildNode.Title & """ description=""" & ChildNode.Title & """ />" & Environment.NewLine)
End if
Next
Response.Write("</siteMapNode>" & Environment.NewLine)
End If
Next
</code></pre>
<p>however whenever I do, it lists the top level navigation nodes but I cannot get the children to be displayed.</p>
| [
{
"answer_id": 284549,
"author": "zmf",
"author_id": 13285,
"author_profile": "https://Stackoverflow.com/users/13285",
"pm_score": 1,
"selected": false,
"text": " <c:forEach items=\"${items}\" var=\"i\" varStatus=\"itemsRow\">\n <input name=\"items[${itemsRow.index}].fieldName\" t... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2208/"
] |
284,382 | <p>G'day!</p>
<p>I have one million different words which I'd like to query for in a table with 15 million rows. The result of synonyms together with the word is getting processed after each query.</p>
<p>table looks like this:</p>
<pre><code> synonym word
---------------------
ancient old
anile old
centenarian old
darkened old
distant far
remote far
calm gentle
quite gentle
</code></pre>
<p>This is how it is done in Java currently:</p>
<pre><code>....
PreparedStatement stmt;
ResultSet wordList;
ResultSet syns;
...
stmt = conn.prepareStatement("select distinct word from table");
wordList = stmt.executeQuery();
while (wordList.next()) {
stmt = conn.prepareStatement("select synonym from table where word=?");
stmt.setString(1, wordList.getString(1));
syns = stmt.executeQuery();
process(syns, wordList.getString(1));
}
...
</code></pre>
<p>This is incredible slow. What's the fastest way to do stuff like this?</p>
<p>Cheers,
Chris</p>
| [
{
"answer_id": 284399,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 3,
"selected": true,
"text": "select synonym from table where word in (select distinct word from table)\n"
},
{
"answer_id": 284416,
"author": ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36942/"
] |
284,385 | <p>I wrote a small PHP application that I'd like to distribute. I'm looking for best practices so that it can be installed on most webhosts with minimal hassle.</p>
<p>Briefly: It's simple tool that lets people download files once they login with a password.</p>
<p>So my questions are:</p>
<p>1) How should I handle configuration values? I'm not using a database, so a configuration file seems appropriate. I know that other php apps (e.g. Wordpress) use defines, but they are global and there is potential that the names will conflict. (Global variables also have the same problem, obviously.) I looked at the "ini" file mechanism built into PHP. It only allows comments at the top - so you can't annotate each setting easily - and you can't validate syntax with "php -f". Other options?</p>
<p>2) How to handle templating? The application needs to pump out a form. Possibly with an error message. (e.g. "Sorry, wrong password.") I've have a class variable with the HTML form, but also allow an external template file to be used instead (specified in the config). I do some trivial search and replace - e.g. %SCRIPT% to the name of the script, %STATUS% to hold the error message. This feels a bit like reinventing the wheel, but including a templating system like Smarty is overkill. (Plus they may already have a templating system.) Other options?</p>
<p>3) i18n - There are only 3 message strings, and gettext doesn't seem to be universally installed. Is it such a bad idea just to make these three strings parameters in the config file?</p>
<p>4) How to best integrate with other frameworks? My app is a single class. So, I thought I could just include a php script that showed how the class was called. It would be a starting point for people who had to integrate it into another framework, but also be fine as-is for those not interested in customizing. Reasonable?</p>
<p>5) GET/POST parameters - Is it bad form for a class to be looking at $_GET and $_POST? Should all values be passed into my class during construction?</p>
<p>Thanks.</p>
| [
{
"answer_id": 284481,
"author": "Oli",
"author_id": 12870,
"author_profile": "https://Stackoverflow.com/users/12870",
"pm_score": 2,
"selected": false,
"text": "<?php ... ?>"
},
{
"answer_id": 284533,
"author": "Community",
"author_id": -1,
"author_profile": "https:/... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18158/"
] |
284,389 | <p>I'm using <a href="http://sourceforge.net/projects/nusoap/" rel="nofollow noreferrer">nusoap</a> to connect to a soap webservice. The xml that the class sends to the service is constructed from an array, ie:</p>
<pre><code>$params = array("param1" => "value1", "param2" => "value1");
$client->call('HelloWorld', $params, 'namespace', 'SOAPAction');
</code></pre>
<p>This works fine. A multidimensional array also constructs a nice nested xml message. </p>
<p>I encounter a problem when i need two tags with the same name:</p>
<pre><code><items>
<item>value 1</item>
<item>value 2</item>
</item>
$params = array("items" => array("item" => "value 1", "item" => "value 2"));
</code></pre>
<p>The second item in the array overwrites the first which results in:</p>
<pre><code><items>
<item>value 2</item>
</item>
</code></pre>
<p>How can achieve this?</p>
| [
{
"answer_id": 284436,
"author": "Powerlord",
"author_id": 15880,
"author_profile": "https://Stackoverflow.com/users/15880",
"pm_score": 2,
"selected": false,
"text": "$test_array = array(\"item\" => \"value 1\", \"item\" => \"value 2\");\n"
},
{
"answer_id": 284492,
"author"... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21238/"
] |
284,394 | <p>I am opening a XML file using .NET XmlReader and saving the file in another filename and it seems that the DOCTYPE declaration changes between the two files. While the newly saved file is still valid XML, I was wondering why it insisted on changing original tags.</p>
<pre><code>Dim oXmlSettings As Xml.XmlReaderSettings = New Xml.XmlReaderSettings()
oXmlSettings.XmlResolver = Nothing
oXmlSettings.CheckCharacters = False
oXmlSettings.ProhibitDtd = False
oXmlSettings.IgnoreWhitespace = True
Dim oXmlDoc As XmlReader = XmlReader.Create(pathToOriginalXml, oXmlSettings)
Dim oDoc As XmlDocument = New XmlDocument()
oDoc.Load(oXmlDoc)
oDoc.Save(pathToNewXml)
</code></pre>
<p>The following (in the original document):</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
</code></pre>
<p>becomes (notice the [ ] characters at the end): </p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd"[]>
</code></pre>
| [
{
"answer_id": 1070268,
"author": "Maurice Flanagan",
"author_id": 38791,
"author_profile": "https://Stackoverflow.com/users/38791",
"pm_score": 3,
"selected": false,
"text": " private class NullSubsetXmlTextWriter : XmlTextWriter\n {\n public NullSubsetXmlTextWriter(String ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1508/"
] |
284,398 | <p>i've found how to bind an asp:Menu to XML. i've found how to bind an asp:Menu to a site map (which is really binding it to XML). How do you bind an asp:Menu to a database?</p>
<p>The .NET Framework provides multiple data sources:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.hierarchicaldatasourcecontrol.aspx" rel="noreferrer">HierarchicalDataSourceControl</a></li>
<li><ul>
<li><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.aspx" rel="noreferrer">XmlDataSource</a></li>
</ul></li>
<li><ul>
<li><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sitemapdatasource.aspx" rel="noreferrer">SiteMapDataSource</a></li>
</ul></li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.datasourcecontrol.aspx" rel="noreferrer">DataSourceControl</a></li>
<li><ul>
<li><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.aspx" rel="noreferrer">SqlDataSource</a></li>
</ul></li>
<li><ul>
<li><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.accessdatasource.aspx" rel="noreferrer">AccessDataSource</a></li>
</ul></li>
<li><ul>
<li><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasource.aspx" rel="noreferrer">LinqDataSource</a></li>
</ul></li>
</ul>
<p>i want to use one that represents data from an SQL Server table. The data is stored in the standard <a href="http://www.answers.com/hierarchical" rel="noreferrer">hierarchical</a> format that everyone uses:</p>
<pre><code>NodeID ParentNodeID Caption Url
======== ============== ========= =================
{3234... {3632... stackoverflow http://stackov...
{3632... (null) Questions ~/questions.aspx
{3233... (null) Tags ~/tags.aspx
{3235... {3632... google http://www.goo...
</code></pre>
<p>And the query to return all the rows would be:</p>
<pre><code>SELECT * FROM Nodes
</code></pre>
<p>What is the secret method that Microsoft intended me to use to mash that data into an asp:Menu?</p>
<hr>
<p><strong>Update:</strong> There is a good article on aspalliance.com: <a href="http://aspalliance.com/822" rel="noreferrer">Building a Database Driven Hierarchical Menu using ASP.NET 2.0</a>. Unfortunatly it describes how to perform XML data binding; while i'm interested in database binding.</p>
| [
{
"answer_id": 284410,
"author": "splattne",
"author_id": 6461,
"author_profile": "https://Stackoverflow.com/users/6461",
"pm_score": 3,
"selected": false,
"text": "protected void LoadData()\n{\n DataSet ds = new DataSet();\n string connStr = YOUR_CONNECTION_STRING_HERE;\n using... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] |
284,418 | <p>I'm using system catalog views such as SYS.ALL_ OBJECTS, SYS.FOREIGN_KEYS etc. to get information about my database structure in MS SQL 2005. </p>
<p>Are there equivalent functions/views for MySQL (v. 5) servers? </p>
| [
{
"answer_id": 284589,
"author": "Nelson Miranda",
"author_id": 1130097,
"author_profile": "https://Stackoverflow.com/users/1130097",
"pm_score": 4,
"selected": true,
"text": "SELECT * FROM information_schema.SCHEMATA S;\n"
}
] | 2008/11/12 | [
"https://Stackoverflow.com/questions/284418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2899/"
] |
284,420 | <p>I would like to add a backcolor for specific line depending of a Property of the object binded.</p>
<p>The solution I have (and it works) is to use the Event <code>DataBindingComplete</code> but I do not think it's the best solution.</p>
<p>Here is the event:</p>
<pre><code> private void myGrid_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
for (int i = 0; i < this.myGrid.Rows.Count; i++)
{
if((this.myGrid.Rows[i].DataBoundItem as MyObject).Special)
{
this.myGrid.Rows[i].DefaultCellStyle.BackColor = Color.FromArgb(240, 128, 128);
}
}
}
</code></pre>
<p>Any other option that would be better?</p>
| [
{
"answer_id": 284470,
"author": "John",
"author_id": 30006,
"author_profile": "https://Stackoverflow.com/users/30006",
"pm_score": 1,
"selected": false,
"text": "if(((MyObject)e.Item.DataItem).Special)\n e.Item.DefaultCellStyle.BackColor = Color.FromArgb(240, 128, 128);\n"
},
{
... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13913/"
] |
284,422 | <p>I am a new user of Extjs library, I created a grid successfully and it works just fine, now I want to use Ext.grid.GridFilters to add filtering to my grid, however I don't see this class in the Extjs source code files, where I can get the required files?</p>
| [
{
"answer_id": 48125182,
"author": "Sachet Patil",
"author_id": 4331748,
"author_profile": "https://Stackoverflow.com/users/4331748",
"pm_score": 0,
"selected": false,
"text": "store.filterBy(function(rec, id)) { return (rec.get(\"RecName\") ==\"FilterRecord\");}\n"
}
] | 2008/11/12 | [
"https://Stackoverflow.com/questions/284422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22449/"
] |
284,428 | <p>Objective-C 2.0 gave us @properties.</p>
<ul>
<li>They allow for introspection.</li>
<li>They allow for declarative programming.</li>
<li>The @synthesize and @dynamic mechanisms relieve use from having to write repetitive, stock accessors.</li>
<li>Finally, there is the ‘dot’ property syntax, which some love, and some hate.</li>
</ul>
<p>That isn't what I'm hear to ask. Like any new feature, there is an initially tendency to want to use @property everywhere. So where is property use appropriate?</p>
<p>Clearly in model objects, attributes and relationships are good fodder for properties.</p>
<pre><code>@property(...) NSString *firstName;
@property(...) NSString *lastName;
@property(...) Person *parent;
</code></pre>
<p>Even synthesized/computed attributes seem like a good use case for properties.</p>
<pre><code>@property(...) NSString *fullName;
</code></pre>
<p>Where else have you used properties? Where have you used them, then later decided it was an inappropriate use of the feature?</p>
<p>Do you use properties for your private object attributes?</p>
<p>Can you think of any examples of things which aren't properties in Cocoa, which at first look, seem like they might want to be properties, but after closer inspection, are actual an example of abuse or property-itis?</p>
| [
{
"answer_id": 284689,
"author": "wisequark",
"author_id": 33159,
"author_profile": "https://Stackoverflow.com/users/33159",
"pm_score": 3,
"selected": false,
"text": "@interface"
},
{
"answer_id": 284818,
"author": "benzado",
"author_id": 10947,
"author_profile": "ht... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
284,433 | <p>The type 'x' is defined in an assembly that is not referenced. You must add a reference to assembly 'abc123'.</p>
<p>I have a .NET 2.0 web application that references my assembly 'abc123'. The assembly exists in the GAC and I've verified that it is the correct(same) version. The rest of application has no issues except for one .aspx page. The page in question has a repeater that displays a user control as one of its "fields". Upon binding a list of type y to the repeater I pass the user control a list of type x (a property of y) as shown here:</p>
<pre><code><uc1:usercontrol id="ucusercontrol " runat="server" myPublicUserControlProperty='<%#Eval("CollectionOfX") %>'/>
</code></pre>
<p>On the user control's property set, I bind the list of type x to a gridview in the user control.</p>
<p>One strange thing to note is that this report works fine on my development pc but not on any servers once I deploy. My pc is Windows XP, IIS6, VS2005. The servers are Windows Server 2003, IIS6.</p>
<p>I hope I explained that well enough. Thanks in advance for any insight you can provide.</p>
| [
{
"answer_id": 285059,
"author": "Aaron Daniels",
"author_id": 37064,
"author_profile": "https://Stackoverflow.com/users/37064",
"pm_score": 6,
"selected": true,
"text": "<assemblies>\n <add assembly=\"MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=[MyPublicKeyToken]... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36970/"
] |
284,468 | <p>How come the following doesn't work?</p>
<pre><code>CREATE FUNCTION Test (@top integer)
RETURNS TABLE
AS
RETURN
SELECT TOP @top * FROM SomeTable
GO
</code></pre>
<p>I just want to be able to be able to specify the number of results to be returned. [SQL Server 2000.]</p>
<p>Thanks!</p>
| [
{
"answer_id": 284561,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 4,
"selected": true,
"text": "CREATE FUNCTION Test (@top integer)\n\nRETURNS TABLE\n\nAS\n\nSET ROWCOUNT @top\n\nRETURN SELECT * FROM SomeTable\n"
... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10675/"
] |
284,472 | <p>I have a base page, BasePage, that raises an event that displays messages to the user. Works great on all pages derived from BasePage. I want to do the same thing from user controls, but they don't inherit from BasePage. </p>
<p>What I want is a central place that I can call from anywhere and in that code it will raise an event. Where is a good place to put this code:</p>
<pre><code> public void DisplayMessage(string message)
{
RaiseEvent(new MessageNotificationEventArgs(MessageNotificationEvent, message));
}
</code></pre>
<p>so that I can call it from anywhere? RaiseEvent is in the UIElement class, so it needs to go somewhere that is a UIElement.</p>
| [
{
"answer_id": 284561,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 4,
"selected": true,
"text": "CREATE FUNCTION Test (@top integer)\n\nRETURNS TABLE\n\nAS\n\nSET ROWCOUNT @top\n\nRETURN SELECT * FROM SomeTable\n"
... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3047/"
] |
284,475 | <p>I need to style a table to have rounded corners.</p>
<p>I'm just looking at how best to go about it:</p>
<p>Normally when I style a div to have rounded corners, I use 2 divs with empty comments at the top and bottom, and apply sizing & background image CSS to them.</p>
<p>The table, however, has internal borders, so I'd have to carefully align the vertical lines in the corner bg images, to match with the true cell borders. </p>
<p>Is this clear so
far?</p>
<p>So I was wondering how others would approach this. I think the best thing I can do is to just use one complete fixed size background image, borders and all, and overlay a borderless table on top. The table will always be the same size after all.</p>
<p>Can anyone think of a better way? </p>
| [
{
"answer_id": 284497,
"author": "Eduardo Molteni",
"author_id": 2385,
"author_profile": "https://Stackoverflow.com/users/2385",
"pm_score": 1,
"selected": false,
"text": "<html>\n<head>\n <style>\n\n\n .cell1 {background: #f8f8f8 url(images/cell1.gif) no-repeat left top; heigh... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284475",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26107/"
] |
284,491 | <p>I have an assembly that may be used by more than one process at a time. If I am using a static class, would the multiple processes all use the same "instance" of that class? </p>
<p>Since the processes are separate, would these be running under difference Application Domains, hence have the static "instances" separate? </p>
<p>The pudding in the details here is that the assembly is being used by a custom BizTalk adapter that my be set to process the messages in parallel batches. That is what I am calling "multiple processes" above. </p>
| [
{
"answer_id": 284505,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 5,
"selected": true,
"text": "Monitor"
}
] | 2008/11/12 | [
"https://Stackoverflow.com/questions/284491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1048/"
] |
284,500 | <p>So here's my current code:</p>
<pre><code>List<string> rowGroups = GetFileGroups((int)row.Cells["document_security_type"].Value);
bool found = false;
System.Security.Principal.WindowsPrincipal p = new System.Security.Principal.WindowsPrincipal(System.Security.Principal.WindowsIdentity.GetCurrent());
foreach (string group in rowGroups)
{
if (p.IsInRole(group))
{
found = true;
break;
}
}
</code></pre>
<p>This was done a couple of months ago by someone and I'm having difficulty grasping why its not working. The company has recently just moved from one domain name to another. So I was curious to what domain controller the p.IsInRole("String") function will use. I'm assuming its going to use the default DC by whatever the computer is using.</p>
<p>The odd item is that the computers in the office where this is running could be on 2 seperate domains. In the <code>List<string></code> object, i've got both domains possible. so it could contain items such as "domainA\groupA", "domainA\userB", domainB\groupC", and/or "domainB\userD".</p>
<p>So my major problem is that the IsInRole function is never returning true. i know it should, i even tested it with domainA\Domain users and still get a false returned.</p>
<p>Any ideas? changing the code is possible, but not wanted. i'm not 100% i can even compile it...</p>
| [
{
"answer_id": 284505,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 5,
"selected": true,
"text": "Monitor"
}
] | 2008/11/12 | [
"https://Stackoverflow.com/questions/284500",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21828/"
] |
284,511 | <p>When trying to invoke a method on an external webservice (over the Internet) it throws me
"The remote server returned an error: (407) Proxy Authentication Required."</p>
<p>To solve this, I used the following code to set the proxy we use in the office:</p>
<pre><code>//Set the system proxy with valid server address or IP and port.
System.Net.WebProxy pry = new System.Net.WebProxy("MyHost", 8080);
//The DefaultCredentials automically get username and password.
pry.Credentials = System.Net.CredentialCache.DefaultCredentials;
System.Net.WebRequest.DefaultWebProxy = pry;
</code></pre>
<p>That works fine, but now... I need to do that "less harcoded" trying to get the information from my system instead of setting that manually. </p>
| [
{
"answer_id": 284544,
"author": "John",
"author_id": 30006,
"author_profile": "https://Stackoverflow.com/users/30006",
"pm_score": 2,
"selected": true,
"text": "Services.MyService service = new Services.MyService();\nservice.UseDefaultCredentials = true;\nservice.Proxy = new System.Net.... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7720/"
] |
284,514 | <p>What is a git topic branch? Does it differ from an ordinary branch in some way? Are there any branches that are not topic branches?</p>
| [
{
"answer_id": 284817,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 8,
"selected": true,
"text": "git fetch"
}
] | 2008/11/12 | [
"https://Stackoverflow.com/questions/284514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18103/"
] |
284,519 | <p>I am trying to store a large amount of boolean information that is determined at run-time. I was wondering what the best method might be.</p>
<p>I have currently been trying to allocate the memory using: </p>
<p><code>pStatus = malloc((<number of data points>/8) + 1);</code> </p>
<p>thinking that this will give me enough bits to work with. I could then reference each boolean value using the pointer in array notation:</p>
<p><code>pStatus[element]</code></p>
<p>Unfortunately this does not seem to be working very well. First, I am having difficulty initializing the memory to the integer value <code>0</code>. Can this be done using <code>memset()</code>? Still, I don't think that is impacting why I crash when trying to access <code>pStatus[element]</code>. </p>
<p>I am also not entirely convinced that this approach is the best one to be using. What I really want is essentially a giant bitmask that reflects the status of the boolean values. Have I missed something?</p>
| [
{
"answer_id": 284536,
"author": "Ana Betts",
"author_id": 5728,
"author_profile": "https://Stackoverflow.com/users/5728",
"pm_score": 3,
"selected": false,
"text": "pStatus[element]\n"
},
{
"answer_id": 284541,
"author": "James Curran",
"author_id": 12725,
"author_pr... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284519",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35767/"
] |
284,538 | <p>I am trying to access my WCF service on a server from my client console application for testing. I am getting the following error: </p>
<blockquote>
<p>The caller was not authenticated by
the service</p>
</blockquote>
<p>I am using <code>wsHttpBinding</code>. I'm not sure what kind of authentication the service is expecting?</p>
<p>
<br>
<br>
</p>
<pre><code><behaviors>
<serviceBehaviors>
<behavior name="MyTrakerService.MyTrakerServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</code></pre>
<p></p>
<p><b>Update</b>
It works if I change my binding to <code><endpoint "basicHttpBinding" ... /></code> (from wsHttpBinding)
on the IIS 7.0 hosted, windows 2008 server</p>
| [
{
"answer_id": 285062,
"author": "Michael Kniskern",
"author_id": 26327,
"author_profile": "https://Stackoverflow.com/users/26327",
"pm_score": 5,
"selected": false,
"text": "<bindings>\n <basicHttpBinding>\n <binding name=\"MyBasicHttpBinding\">\n <security mode=\"N... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284538",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
284,545 | <p><code>Html.TextBox("ParentPassword", "", new { @class = "required" })</code></p>
<p>what the gosh darned heck is the @ for the @class.</p>
| [
{
"answer_id": 284570,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 5,
"selected": true,
"text": "class"
},
{
"answer_id": 284574,
"author": "yfeldblum",
"author_id": 12349,
"author_profile": "https://Stac... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220/"
] |
284,556 | <p>I am writing a lib and a demo project. The project doesn't care which version of the lib I use (I can use sdl, directx or whatever I like as the gfx backend). To get the object I do </p>
<pre><code>Obj *obj = libname_newDevice();
</code></pre>
<p>Now, should I use delete or should I do <code>obj->deleteMe();</code>? I ask because I am not exactly doing new so I shouldn't be doing the delete?</p>
<p>I have <code>obj->create(theType);</code> which returns a class with the Obj interface.
My real question is do I need a <code>libname_deleteDevice();</code> or is <code>obj->deleteMe()</code> fine since I have a deleteMe in the interface?</p>
| [
{
"answer_id": 284565,
"author": "Jaywalker",
"author_id": 382974,
"author_profile": "https://Stackoverflow.com/users/382974",
"pm_score": 4,
"selected": false,
"text": "libname_newDevice()"
},
{
"answer_id": 284584,
"author": "Serge Wautier",
"author_id": 12379,
"aut... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
284,558 | <p>I have an existing Stored Procedure which I am trying to now call with LINQ to SQL, here is the stored procedure:</p>
<pre><code>ALTER procedure [dbo].[sp_SELECT_Security_ALL] (
@UID Varchar(15)
)
as
DECLARE @A_ID int
If ISNULL(@UID,'') = ''
SELECT DISTINCT
App_ID,
App_Name,
App_Description,
DB,
DBNameApp_ID,
For_One_EVA_List_Ind
From v_Security_ALL
ELSE
BEGIN
Select @A_ID = (Select Assignee_ID From NEO.dbo.v_Assignees Where USER_ID = @UID and Inactive_Ind = 0)
SELECT DISTINCT
Security_User_ID,
Security_Company,
Security_MailCode,
Security_Last_Name,
Security_First_Name,
Security_User_Name,
Security_User_Info,
Security_User_CO_MC,
Security_Email_Addr,
Security_Phone,
Security_Security_Level,
Security_Security_Desc,
Security_Security_Comment,
Security_Security_Inactive_Ind,
App_ID,
App_Name,
App_Description,
DB,
DBNameApp_ID,
For_One_EVA_List_Ind,
@A_ID as Assignee_ID
From v_Security_ALL
Where Security_User_ID = @UID
END
</code></pre>
<p>My problem is that the intellsense only sees the first set of return values in the IF statement and I can not access anything from the "else" part of my stored procedure. so when I try to do this:</p>
<pre><code> var apps = dataContext.sp_SELECT_Security_ALL(userId);
foreach (var app in apps)
{
string i = app.
}
</code></pre>
<p>On the app. part the only available values I have there is the results of the the first Select distinct above.</p>
<p>Is it possible to use LINQ with this type of stored procedure?</p>
| [
{
"answer_id": 284565,
"author": "Jaywalker",
"author_id": 382974,
"author_profile": "https://Stackoverflow.com/users/382974",
"pm_score": 4,
"selected": false,
"text": "libname_newDevice()"
},
{
"answer_id": 284584,
"author": "Serge Wautier",
"author_id": 12379,
"aut... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20748/"
] |
284,566 | <p>I'm creating an interface wrapper for a class. The member within the class is a reference(to avoid copying the large structure). If I create a private constructor, what is the best way to initialize that reference to appease the compiler?</p>
<pre><code>struct InterfaceWrapper {
InterfaceWrapper( SomeHugeStructure& src ):m_internal(src){};
int someElement(void) const { return m_internal.someElement; };
private:
InterfaceWrapper(){} // initialize m_internal
SomeHugeStructure& m_internal;
};
</code></pre>
| [
{
"answer_id": 284618,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 2,
"selected": false,
"text": "private:\n InterfaceWrapper();\n SomeHugeStructure& m_internal;\n"
}
] | 2008/11/12 | [
"https://Stackoverflow.com/questions/284566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16496/"
] |
284,581 | <p>I've got a timer running in my Delphi MDI application and I'd like to use it to pop up a message if something changes in the background. But I don't want that message to pop up when the the application has a modal dialog in the foreground because the user couldn't do anything about it. </p>
<p>So what I'd like to know is how can I check for the existence of a modal dialog in my application?</p>
| [
{
"answer_id": 284621,
"author": "mghie",
"author_id": 30568,
"author_profile": "https://Stackoverflow.com/users/30568",
"pm_score": 5,
"selected": true,
"text": "var\n ActForm: TCustomForm;\nbegin\n ActForm := Screen.ActiveForm;\n if (ActForm = nil) or not (fsModal in ActForm.FormSta... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1765/"
] |
284,608 | <p>I need more than the default diff! I have recently purchased "Beyond Compare" and I'd like to integrate it with svn, so its launched when I type:</p>
<p>svn diff foo.c</p>
<p>How do I do this?</p>
| [
{
"answer_id": 284666,
"author": "Ned Batchelder",
"author_id": 14343,
"author_profile": "https://Stackoverflow.com/users/14343",
"pm_score": 6,
"selected": true,
"text": "#!/bin/bash\n/usr/bin/bcompare $6 $7 &\nexit 0\n"
},
{
"answer_id": 14249596,
"author": "David Wu",
... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284608",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3886/"
] |
284,609 | <p>I have a SQL Mobile database with one table. It has several columns with useful, often queried data and one column that stores a relatively large string per record (1000+ characters) that is not queried often.</p>
<p>Imagine this fake schema, the "lifeStory" field is the large one.</p>
<pre><code>table1
String firstName
String lastName
String address
String lifeStory
</code></pre>
<p>A representative query would be</p>
<pre><code>SELECT firstName, lastName, address FROM table1 WHERE firstName = :p1
</code></pre>
<p>Does anyone know of any performance concerns leaving that large, infrequently queried column in this table?</p>
| [
{
"answer_id": 284666,
"author": "Ned Batchelder",
"author_id": 14343,
"author_profile": "https://Stackoverflow.com/users/14343",
"pm_score": 6,
"selected": true,
"text": "#!/bin/bash\n/usr/bin/bcompare $6 $7 &\nexit 0\n"
},
{
"answer_id": 14249596,
"author": "David Wu",
... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3619/"
] |
284,619 | <p>i need write the code that runs when DllRegisterServer is called. i.e. when someone calls:</p>
<pre><code>regsvr32 myActiveX.ocx
</code></pre>
<p>i'm trying to find the definitive list of required registry entries (rather than just what i can cobble together by spellunking through the registry).</p>
<p>So far my expeditions have found:</p>
<pre><code>HKEY_CLASSES_ROOT
\MyCoolLibrary.MyCoolControl
\Clsid
(default) = "{myClassId}"
\CLSID
\{myClassId}
\Control
\InprocServer32
(default) = "c:\foo\myActiveX.ocx"
ThreadingModel = "Apartment"
\MiscStatus
\1
(default) = 205201
\ProgID
(default) = "MyCoolLibrary.MyCoolControl"
\ToolboxBitmap32
(default) = "c:\foo\myActiveX.ocx,1"
\TypeLib
(default) = "{myTypeLibraryGuid}"
\Verb
\0
(default) = "Properties,0,2"
\Version
(default) = "1.0"
\TypeLib
\{myTypeLibraryGuid}
\1.0
(default) = "MyCoolLibrary.MyCoolControl"
</code></pre>
<p>Now, the concerns:
- what does the Control folder contain? Is it's presence indicate a control?
- what's a MiscStatus of 205201 do? What would 205202 do instead?
- What's the verb "Properties,0,2"? Where's "Properties,0,0" and "Properties,0,1"?</p>
<p>In other words, i'm looking for the docs.</p>
| [
{
"answer_id": 284638,
"author": "Shog9",
"author_id": 811,
"author_profile": "https://Stackoverflow.com/users/811",
"pm_score": 3,
"selected": false,
"text": "HKEY_CLASSES_ROOT\\CLSID\\<clsid>\\"
},
{
"answer_id": 285060,
"author": "Ian Boyd",
"author_id": 12597,
"au... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284619",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] |
284,637 | <p>Into some view data i have put the result of an anonymous type:</p>
<pre><code> var projectData = from p in db.Projects
orderby p.title
select new
{
Title = p.title,
DevURL = p.devURL ?? "N/A",
QAURL = p.qaURL ?? "N/A",
LiveURL = p.liveURL ?? "N/A",
Users = p.GetUsers().MakeUserList()
};
ViewData["ProjectSummary"] = projectData;
</code></pre>
<p>How do I iterate through this view data in the MVC view on the front end to say, make a table of results?</p>
| [
{
"answer_id": 284646,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 0,
"selected": false,
"text": " var projectData = (from p in db.Projects\n orderby p.title\n select... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3193/"
] |
284,653 | <p>I've just wasted the past two hours of my life trying to create a table with an auto incrementing primary key bases on <a href="http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/" rel="nofollow noreferrer">this tutorial</a>, The tutorial is great the issue I've been encountering is that the Create Target fails if I have a column which is a timestamp and a table that is called timestamp in the same table...</p>
<p>Why doesn't oracle flag this as being an issue when I create the table?</p>
<p>Here is the Sequence of commands I enter:</p>
<ol>
<li><p>Creating the Table:</p>
<pre><code>CREATE TABLE myTable
(id NUMBER PRIMARY KEY,
field1 TIMESTAMP(6),
timeStamp NUMBER,
);
</code></pre></li>
<li><p>Creating the Sequence:</p>
<pre><code>CREATE SEQUENCE test_sequence
START WITH 1
INCREMENT BY 1;
</code></pre></li>
<li><p>Creating the trigger:</p>
<pre><code>CREATE OR REPLACE TRIGGER test_trigger
BEFORE INSERT
ON myTable
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT test_sequence.nextval INTO :NEW.ID FROM dual;
END;
/
</code></pre></li>
</ol>
<p>Here is the error message I get:</p>
<pre><code>ORA-06552: PL/SQL: Compilation unit analysis terminated
ORA-06553: PLS-320: the declaration of the type of this expression is incomplete or malformed
</code></pre>
<p>Any combination that does not have the two lines with a the word "timestamp" in them works fine. I would have thought the syntax would be enough to differentiate between the keyword and a column name. </p>
<p>As I've said I don't understand why the table is created fine but oracle falls over when I try to create the trigger...</p>
<p><strong>CLARIFICATION</strong></p>
<p>I know that the issue is that there is a column called timestamp which may or may not be a keyword. MY issue is why it barfed when I tried to create a trigger and not when I created the table, I would have at least expected a warning.</p>
<p>That said having used Oracle for a few hours, it seems a lot less verbose in it's error reporting, Maybe just because I'm using the express version though.</p>
<p>If this is a bug in Oracle how would one who doesn't have a support contract go about reporting it? I'm just playing around with the express version because I have to migrate some code from MySQL to Oracle.</p>
| [
{
"answer_id": 284715,
"author": "tragomaskhalos",
"author_id": 31140,
"author_profile": "https://Stackoverflow.com/users/31140",
"pm_score": 1,
"selected": false,
"text": "timestamp"
},
{
"answer_id": 287012,
"author": "pablo",
"author_id": 16112,
"author_profile": "... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20400/"
] |
284,662 | <p>I want to transform <code>/foo/bar/..</code> to <code>/foo</code></p>
<p>Is there a bash command which does this?</p>
<hr>
<p>Edit: in my practical case, the directory does exist.</p>
| [
{
"answer_id": 284664,
"author": "Adam Liss",
"author_id": 29157,
"author_profile": "https://Stackoverflow.com/users/29157",
"pm_score": 6,
"selected": false,
"text": "realpath"
},
{
"answer_id": 284667,
"author": "Tim Whitcomb",
"author_id": 24895,
"author_profile": ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21132/"
] |
284,678 | <p>I have an application where every now and then I'm getting a strange error.
This is the piece of code:</p>
<pre><code>Dim XMLWriter As New System.Xml.XmlTextWriter(Me.Context.Response.OutputStream, Encoding.UTF8)
XMLWriter.WriteStartDocument()
XMLWriter.WriteStartElement("Status")
Message.SerializeToXML(XMLWriter)
XMLWriter.WriteEndElement()
XMLWriter.WriteEndDocument()
XMLWriter.Flush()
XMLWriter.Close()
</code></pre>
<p>The error i'm getting is:
Message: Object reference not set to an instance of an object.</p>
<p>on line XMLWriter.Flush();</p>
<p>To make things more fun, this is absolutely non-reproducible. It just happens every now and then....</p>
<p>Since it's happening when flushing the XML i'm guessing the Object that is now null has to be the Response.OutputStream.</p>
<p>This is the relevant part of the stack trace:</p>
<pre><code>Description:
An unhandled exception occurred and the process was terminated.
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
StackTrace: at System.Web.HttpWriter.BufferData(Byte[] data, Int32 offset, Int32 size, Boolean needToCopyData)
at System.Web.HttpWriter.WriteFromStream(Byte[] data, Int32 offset, Int32 size)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.Xml.XmlTextWriter.Flush()
at RequestData.CompleteRequest(MessageBase Message) in RequestData.vb:line 142
</code></pre>
<p>My question is, in what cases could this be happening?
This server is a long-polling server, so the client asks for something, and I may not answer for 30 seconds...
Is it possible that this Stream will become Null if the client disconnects (ie. closes the browser window)?</p>
<p>Any other ideas? (any pointers appreciated)</p>
| [
{
"answer_id": 284687,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 0,
"selected": false,
"text": "Context.Response.OutputStream"
},
{
"answer_id": 344439,
"author": "Brian Rudolph",
"author_id": 33114,
... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3314/"
] |
284,679 | <p>What's the easiest way to get the data for a single table, delete a single table or break up the whole dump file into files each containing individual tables? I usually end up doing a lot of vi regex munging, but I bet there are easier ways to do these things with awk/perl, etc. The first page of Google results brings back a bunch of non-working perl scripts.</p>
| [
{
"answer_id": 284702,
"author": "J.D. Fitz.Gerald",
"author_id": 11542,
"author_profile": "https://Stackoverflow.com/users/11542",
"pm_score": 3,
"selected": false,
"text": "mysqldump -T"
},
{
"answer_id": 285089,
"author": "mercutio",
"author_id": 1951,
"author_prof... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/556/"
] |
284,708 | <p>I have an <code>.xsd</code>, <code>.vb</code>, <code>.xsc</code>, and <code>.xss</code> file for a dataset in Visual Studio 2008 that I copied over from another Visual Studio project, however I need to make changes to the dataset. Thus I got into the XSD file, created new columns, deleted ones that aren't needed, etc., etc. However I realized when I attempted to use the new dataset I did not have the Visual Basic code behind the scenes. This code is typically found in <code>dataset.designer.vb</code>. When I copied the old one over of course it was no longer valid since columns changed.</p>
<p>How I can force Visual Studio 2008 to use a <code>.xsd</code> file and to have it create/update its designer code?</p>
| [
{
"answer_id": 284764,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 0,
"selected": false,
"text": "*.designer.vb"
},
{
"answer_id": 284787,
"author": "Community",
"author_id": -1,
"author_profile":... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
284,716 | <p>I am working on an automated testing app, and am currently in the process of writing a function that compares values between two XML files that should be identical, but may not be. Here is a sample of the XML I'm trying to process:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<report xmlns="http://www.**.com/**">
<subreport name="RBDReport">
<record rowNumber="1">
<field name="Time">
<value>0</value>
</field>
<field name="Reliability">
<value>1.000000</value>
</field>
<field name="Unreliability">
<value>0.000000</value>
</field>
<field name="Availability">
<value> </value>
</field>
<field name="Unavailability">
<value> </value>
</field>
<field name="Failure Rate">
<value>N/A</value>
</field>
<field name="Number of Failures">
<value> </value>
</field>
<field name="Total Downtime">
<value> </value>
</field>
</record>
</code></pre>
<p>(Note there may be multiple <code><subreport></code> elements and within those, multiple <code><record></code> elements.)</p>
<p>What I'd like is to extract the <code><value></code> tags of two documents and then compare their values. That part I know how to do. The problem is the extraction itself.</p>
<p>Since I'm stuck in C++, I'm using MSXML, and have written a wrapper to allow my app to abstract away the actual XML manipulation, in case I ever decide to change my data format.</p>
<p>That wrapper, CSimpleXMLParser, loads an XML document and sets its "top record" to the document element of the XML document. (CRecord being an abstract class with CXMLRecord one of its subclasses, and which gives access to child records singularly or by group, and also allowing access to the "value" of the Record (values for child elements or attributes, in the case of CXMLRecord.) A CXMLRecord contains an MSXML::MSXMLDOMNodePtr and a pointer to an instance of a CSimpleXMLParser.) The wrapper also contains utility functions for returning children, which the CXMLRecord uses to return its child records.</p>
<p>In my code, I do the following (trying to return all <code><subreport></code> nodes just to see if it works):</p>
<pre><code>CSimpleXMLParser parserReportData;
parserReportData.OpenXMLDocument(strPathToXML);
bool bGetChildrenSuccess = parserReportData.GetFirstRecord()->GetChildRecords(listpChildren, _T("subreport"));
</code></pre>
<p>This is always returning false. The meat of the implementation of CXMLRecord::GetChildRecords() is basically</p>
<pre><code>MSXML2::IXMLDOMNodeListPtr pListChildren = m_pParser->SelectNodes(strPath, m_pXMLNode);
if (pListChildren->Getlength() == 0)
{
return false;
}
for (long l = 0; l < pListChildren->Getlength(); ++l)
{
listRecords.push_back(new CXMLRecord(pListChildren->Getitem(l), m_pParser));
}
return true;
</code></pre>
<p>And CSimpleXMLParser::SelectNodes() is:</p>
<pre><code>MSXML2::IXMLDOMNodeListPtr CSimpleXMLParser::SelectNodes(LPCTSTR strXPathFilter, MSXML2::IXMLDOMNodePtr pXMLNode)
{
return pXMLNode->selectNodes(_bstr_t(strXPathFilter));
}
</code></pre>
<p>When run, the top record is definitely being set to the <code><report></code> element properly. I can do all sorts of things with it, like getting its child nodes (through the MSXML interface, not through my wrapper) or its name, etc. I know that my wrapper <em>can</em> work, because I use it elsewhere in the app for parsing an XML configuration file, and that works flawlessly.</p>
<p>I thought maybe I was doing something faulty with the XPath query expression, but every permutation I could think of gives no joy. The <code>MSXML::IXMLDOMNodeListPtr</code> returned by <code>IXMLDOMNodePtr::SelectNodes()</code> is always of length 0 when I try to deal with this XML file.</p>
<p>This is driving me crazy.</p>
| [
{
"answer_id": 284734,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 4,
"selected": true,
"text": "/report/subreport/record/field/value"
}
] | 2008/11/12 | [
"https://Stackoverflow.com/questions/284716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24529/"
] |
284,722 | <p>I'm trying to insert a comment character into a string something similar to this:</p>
<pre><code>-CreateVideoTracker VT1 "vt name"
</code></pre>
<p>becomes</p>
<pre><code>-CreateVideoTracker VT1 # "vt name"
</code></pre>
<p>The VT1 word can actually be anything, so I'm using the regex</p>
<pre><code>$line =~ s/\-CreateVideoTracker \w/\-CreateVideoTracker \w # /g;
</code></pre>
<p>which gives me the result:</p>
<pre><code>-CreateVideoTracker w #T1 "vt name"
</code></pre>
<p>Is there any way to do this with a single regex, or do I need to split up the string and insert the comment manually?</p>
| [
{
"answer_id": 284739,
"author": "Alnitak",
"author_id": 6782,
"author_profile": "https://Stackoverflow.com/users/6782",
"pm_score": 4,
"selected": true,
"text": "$line =~ s/^(\\-CreateVideoTracker)\\s+(\\w+)/$1 $2 #/;\n"
},
{
"answer_id": 285921,
"author": "Brad Gilbert",
... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23504/"
] |
284,732 | <p><strong>First a bit of background.</strong> </p>
<p>I have been working on the MS platform for my entire development career. Up until 2 weeks ago, I had never booted any other OS than 98/XP/Vista. I started using VSS long long ago, and made the change to SVN about 2 years ago. With SVN I use TortiseSVN and use the standard branch/tag/trunk setup.</p>
<p>My projects are also self contained, meaning I can go to a fresh dev box, pull down a single repository, open VS, press F5 and it will run (most of the time). All dependencies are stored in a <code>lib</code> folder, source code is in a <code>src</code> folder, etc...</p>
<p>In an effort to learn new things, I've decided to build a Ruby on Rails application and have created a Ubuntu based development machine. I have a SVN server up and running and am working with another person on this project. He happens to be using a Mac for his development machine.</p>
<p><strong>And now for the issues.</strong></p>
<p>I seem to be struggling with how to manage the various versions of ruby, rails and all of the plugin's I'm working with. I also seem to be struggling with using SVN on Ubuntu. </p>
<p>So Ubuntu comes with Ruby pre-installed. I want to say it's version 1.8.5. Either way, I had a bunch of gems to install for the plugin I'm using (Community Engine). Being new to *nix, I didn't use <code>sudo</code> when installing them and ran into all sorts of issues. I ended up blowing away Ruby completely and starting fresh. That seemed to work.</p>
<p>The problem is though, that after I commit my code, and the other guy gets latest, he has to go through the whole process of installing gems.</p>
<p><strong>What is the best practice for managing gems and plug-ins in a RoR application?</strong> I don't care if a zillion files get added to SVN. Diskspace and network bandwidth are cheap. I just don't know how to do this correctly.</p>
<p>So on to SVN.</p>
<p>I have installed RapidSVN, but very frequently run into issues with folders getting locked. A couple times I realized my mistake, others, I had no clue why. But in both scenarios, i couldn't fix it. I ended up making a backup of my code, pulling down a new working copy, then manually moving over changes and being a bit smarter when committing them to the project.</p>
<p>I actually RTFM a bit last night and found that I'm supposed to create a bookmark for my repos, then do a "checkout working copy" from that bookmark. I'm not sure why, but ok, that's what the manual says...</p>
<p><strong>What are some best practices for using SVN on a RoR project on Ubuntu?</strong></p>
<p>I'm literally looking for a step by step process on this one.</p>
<p><em>edit</em>
I forgot to mention, I use NetBeans for my IDE, although i have not looked to see what kind of SVN support it has, if any. I looked at RubyMine, and would love to use it, but it appears to be too unstable right now.</p>
| [
{
"answer_id": 285216,
"author": "Orion Edwards",
"author_id": 234,
"author_profile": "https://Stackoverflow.com/users/234",
"pm_score": 3,
"selected": true,
"text": "config/environment.rb"
},
{
"answer_id": 296486,
"author": "Community",
"author_id": -1,
"author_prof... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23458/"
] |
284,740 | <p>What is the preferred way to insert strings that can contain both single and double quotes (",') into MySql using DBI? For example, <code>$val1</code> and <code>$val2</code> can contain quotes:</p>
<pre><code>my $dbh = DBI->connect( ... );
my $sql = "insert into tbl_name(col_one,col_two) values($val1, $val2)";
my $sth = $dbh->prepare($sql);
$sth->execute();
</code></pre>
| [
{
"answer_id": 284758,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 6,
"selected": true,
"text": "$sth = $dbh->prepare(\"insert into tbl_name(col_one,col_two) values(?,?)\");\n$sth->execute($val1, $val2);\n"
},
{
... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
284,741 | <p>I have a j2me client that would post some chunked encoded data to a webserver. I'd like to process the data in python. The script is being run as a CGI one, but apparently apache will refuse a chunked encoded post request to a CGI script. As far as I could see mod_python, WSGI and FastCGI are no go too.</p>
<p>I'd like to know if there is a way to have a python script process this kind of input. I'm open to any suggestion (e.g. a confoguration setting in apache2 that would assemble the chunks, a standalone python server that would do the same, etc.) I did quite a bit of googling and didn't find anything usable, which is quite strange.</p>
<p>I know that resorting to java on the server side would be a solution, but I just can't imagine that this can't be solved with apache + python.</p>
| [
{
"answer_id": 1187738,
"author": "Nathan de Vries",
"author_id": 11109,
"author_profile": "https://Stackoverflow.com/users/11109",
"pm_score": 3,
"selected": false,
"text": "ProxyRequests Off\n\n<Proxy http://example.com:81>\n Order deny,allow\n Allow from all\n</Proxy>\n\n<VirtualHos... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284741",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5695/"
] |
284,744 | <p>I'm creating a control and need to pass it the current logon user as a parameter (declaratively)</p>
<p>I tried this but didn't work (I got "<%= User.Identity.Name %>" as value):</p>
<pre><code><cc1:MyControl id="myid" runat="server" User="<%= User.Identity.Name %>" />
</code></pre>
<p>Is there a way to do it?</p>
| [
{
"answer_id": 284747,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 0,
"selected": false,
"text": "User=\"<%= User.Identity.Name %>\"\n"
},
{
"answer_id": 284767,
"author": "Josh Hinman",
"author_id": 2527,
... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1782/"
] |
284,748 | <p>Is there any way in a Win32 environment to "tune" the timeout on a socket <code>connect()</code> call? Specifically, I would like to increase the timeout length. The sockets in use are non-blocking. Thanks!</p>
| [
{
"answer_id": 286814,
"author": "fhe",
"author_id": 4445,
"author_profile": "https://Stackoverflow.com/users/4445",
"pm_score": 3,
"selected": true,
"text": "connect()"
},
{
"answer_id": 9867611,
"author": "kuchi",
"author_id": 903444,
"author_profile": "https://Stac... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16457/"
] |
284,751 | <p>I am writing a quick and dirty application that reads all the files from a given directory. I'm currently using the OpenFileDialog to choose a directory and just culling off the file name that it provides. It seems like there should be a way to just choose directories though, but in a quick browsing of MSDN I didn't find it. </p>
<p>If you have a way in winforms or more preferably in WPF I'm all ears.</p>
| [
{
"answer_id": 15790253,
"author": "Geoff",
"author_id": 2240898,
"author_profile": "https://Stackoverflow.com/users/2240898",
"pm_score": 4,
"selected": false,
"text": "using FORMS = System.Windows.Forms;\n\nvar dialog = new System.Windows.Forms.FolderBrowserDialog();\nFORMS.DialogResul... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1327/"
] |
284,761 | <p>I have an implementation of default handler. When it gets to a in the character data it stops parsing. Is there any reason that it is doing this? Are there additional properties that I need to set in order for it to deal with &nbsp?</p>
| [
{
"answer_id": 285075,
"author": "Ben Noland",
"author_id": 32899,
"author_profile": "https://Stackoverflow.com/users/32899",
"pm_score": 0,
"selected": false,
"text": " "
},
{
"answer_id": 335689,
"author": "tcurdt",
"author_id": 33165,
"author_profile": "https:... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35140/"
] |
284,766 | <p>If I have a DrawingVisual in WPF with Opacity=0, is that enough for it not to be drawn? We have hundreds of DrawingVisuals on a Canvas, and are currently setting Opacity=0 on the visuals that are not to be displayed, and I wanted to make sure there is no rendering performance hit for rendering a DrawingVisual with Opacity=0.</p>
<p>UPDATE: I have discovered through testing that there IS overhead when Opacity=0, but since DrawingVisual doesn't have a Visibility property, I don't know how else you would tell it to not be displayed unless you actualy remove it from the visual tree, so any suggestions are welcome. </p>
| [
{
"answer_id": 716469,
"author": "eesh",
"author_id": 85666,
"author_profile": "https://Stackoverflow.com/users/85666",
"pm_score": 2,
"selected": false,
"text": "DrawingGroup"
},
{
"answer_id": 11899486,
"author": "keft",
"author_id": 762979,
"author_profile": "https... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18967/"
] |
284,774 | <p>How do you automate <a href="http://en.wikipedia.org/wiki/Integration_testing" rel="noreferrer">integration testing</a>? I use JUnit for some of these tests. This is one of the solutions or is totally wrong? What do you suggest?</p>
| [
{
"answer_id": 284851,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 3,
"selected": false,
"text": "@BeforeSuite"
},
{
"answer_id": 285284,
"author": "Johannes Brodwall",
"author_id": 27658,
"author_profi... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36678/"
] |
284,775 | <p>How do I convert a DateTime structure to its equivalent <a href="http://www.w3.org/Protocols/rfc822/#z28" rel="noreferrer">RFC 822 date-time</a> formatted string representation <strong>and</strong> parse this string representation back to a DateTime structure in .NET? The RFC-822 date-time format is used in a number of specifications such as the <a href="http://www.rssboard.org/rss-specification" rel="noreferrer">RSS Syndication Format</a>.</p>
| [
{
"answer_id": 284785,
"author": "Oppositional",
"author_id": 2029,
"author_profile": "https://Stackoverflow.com/users/2029",
"pm_score": 6,
"selected": true,
"text": "/// <summary>\n/// Provides methods for converting <see cref=\"DateTime\"/> structures \n/// to and from the equivalent ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2029/"
] |
284,776 | <p>I'm automating some source control software functionality using a dot bat script but given that our svn repos are hosted in a *NIX box, I'm facing the eternal case problem between these two worlds.</p>
<p>Is there any cmd.exe function to convert the value of the Windows system variable %USERNAME% to lower case?</p>
<p>Thanks much in advance!</p>
| [
{
"answer_id": 284834,
"author": "Mauro",
"author_id": 2208,
"author_profile": "https://Stackoverflow.com/users/2208",
"pm_score": 4,
"selected": true,
"text": "@echo off\ngoto :end_remarks\n*************************************************************************************\n*\n*\n* ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6992/"
] |
284,778 | <h2>Background</h2>
<p>There are several different <a href="http://msdn.microsoft.com/en-us/library/958x11bc.aspx" rel="noreferrer">debug flags</a> you can use with the Visual Studio C++ compiler. They are:</p>
<ul>
<li><strong>(none)</strong>
<ul>
<li>Create no debugging information</li>
<li>Faster compilation times</li>
</ul></li>
<li><strong>/Z7</strong>
<ul>
<li>Produce full-symbolic debugging information in the .obj files using CodeView format</li>
</ul></li>
<li><strong>/Zi</strong>
<ul>
<li>Produce full-symbolic debugging information in a .pdb file for the target using Program Database format. </li>
<li>Enables support for minimal rebuilds (/Gm) which can reduce the time needed for recompilation.</li>
</ul></li>
<li><strong>/ZI</strong>
<ul>
<li>Produce debugging information like /Zi except with support for Edit-and-Continue</li>
</ul></li>
</ul>
<h2>Issues</h2>
<ul>
<li><p>The /Gm flag is incompatible with the <a href="http://msdn.microsoft.com/en-us/library/bb385193.aspx" rel="noreferrer">/MP flag for Multiple Process builds</a> (Visual Studio 2005/2008)</p></li>
<li><p>If you want to enable minimal rebuilds, then the /Zi flag is necessary over the /Z7 flag.</p></li>
<li><p>If you are going to use the /MP flag, there is seemingly no difference between /Z7 and /Zi looking at MSDN. However, the <a href="http://www.scons.org/doc/production/HTML/scons-user/a4761.html#cv-CCPDBFLAGS" rel="noreferrer">SCons documentation</a> states that you must use /Z7 to support parallel builds.</p></li>
</ul>
<h2>Questions</h2>
<ul>
<li><p>What are the implications of using /Zi vs /Z7 in a Visual Studio C++ project? </p></li>
<li><p>Are there other pros or cons for either of these options that I have missed? </p></li>
<li><p>Specifically, what is the benefit of a single Program Database format (PDB) file for the target vs multiple CodeView format (.obj) files for each source?</p></li>
</ul>
<h2>References</h2>
<p><a href="http://msdn.microsoft.com/en-us/library/958x11bc.aspx" rel="noreferrer">MDSN /Z7, /Zi, /ZI (Debug Information Format)</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb385193.aspx" rel="noreferrer">MSDN /MP (Build with Multiple Processes)</a></p>
<p><a href="http://www.scons.org/doc/production/HTML/scons-user/a4761.html#cv-CCPDBFLAGS" rel="noreferrer">SCons Construction Variables CCPDBFLAG</a></p>
<p><a href="http://www.debuginfo.com/articles/gendebuginfo.html" rel="noreferrer">Debug Info</a></p>
| [
{
"answer_id": 54529116,
"author": "Trass3r",
"author_id": 594456,
"author_profile": "https://Stackoverflow.com/users/594456",
"pm_score": 3,
"selected": false,
"text": "/Z7"
}
] | 2008/11/12 | [
"https://Stackoverflow.com/questions/284778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2233/"
] |
284,784 | <p>Some databases support commands such as:</p>
<pre><code>SELECT TOP 10 START AT 10 * FROM <TABLE>
</code></pre>
<p>Essentially I need to pull the first 10 records, then the next 10, then the next 10 etc. Maybe there is another way to do this but in the past I've done it like the above for databases that support 'START AT'.</p>
| [
{
"answer_id": 284789,
"author": "StingyJack",
"author_id": 16391,
"author_profile": "https://Stackoverflow.com/users/16391",
"pm_score": 2,
"selected": false,
"text": "SELECT Top 10 * \nFROM Table \nWHERE <primary key> Not IN (\n SELECT Top 10 <primaryKey> \n FROM Table \n ORDE... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5678/"
] |
284,786 | <p>I have the following equation</p>
<blockquote>
<p>1 - ((.5 * 0.83333333333333) ^ 2 + (.5 * 0.83333333333333) ^ 2 + (.5 * (1 - 0.83333333333333)) ^ 2 + (.5 * (1 - 0.83333333333333)) ^ 2) </p>
</blockquote>
<p>In Php5, this results in an answer of 1 as opposed to .63 (on two machines, OSx and Centos). Should I be exclusively using the bc math functions of Php to do equations like this?</p>
| [
{
"answer_id": 284824,
"author": "nlucaroni",
"author_id": 157,
"author_profile": "https://Stackoverflow.com/users/157",
"pm_score": 1,
"selected": false,
"text": " 83.3333333 = 100x\n 8.3333333 = 10x\n -----------------\n 75 = 90x\n x = 75 / 90 = 0.83333...\n"
},
{
... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
284,821 | <p>I have a Lotus Domino server with a truly astounding number of Domino databases on it, arranged in various folders. </p>
<p>Is there some means of exporting a list of all these databases, with their titles and creators' names, in a spreadsheet format of some kind? I have the Domino Admin and Domino Designer software, and I have or can get whatever access rights I'd need.</p>
| [
{
"answer_id": 1046830,
"author": "Ed Schembor",
"author_id": 125484,
"author_profile": "https://Stackoverflow.com/users/125484",
"pm_score": 3,
"selected": false,
"text": "Sub Initialize\n Dim db As NotesDatabase\n Dim f As Integer\n f = Freefile\n Open \"c:\\dbExport.csv\" ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25468/"
] |
284,826 | <p>I'm on a beginner level course in prolog, doing a map colouring problem. Here's my code.</p>
<pre><code>col(Colors,Map,Coloring) :-
checkMap(Colors,Map,Coloring).
checkMap(Colors,[Country1:Country2],Coloring) :-
goodColor(Country1:Country2,Coloring,Colors).
checkMap(Colors,[Country1:Country2|Rest],Coloring) :-
goodColor(Country1:Country2,Coloring,Colors),
checkMap(Colors,Rest,Coloring).
goodColor(Country1:Country2,Coloring,Colors) :-
mem(Country1:Color1,Coloring),!,
mem(Country2:Color2,Coloring),!,
mem(Color1,Colors), mem(Color2,Colors),
not(Color1=Color2).
mem(Var,[Var|_]).
mem(Var,[_|Rest]) :-
mem(Var,Rest).
</code></pre>
<p>My output looks like this:</p>
<pre><code>?- col([a,b,c],[1:2,1:3,2:3],X).
X = [1:a, 2:b, 3:c|_G332] ;
X = [1:a, 2:c, 3:b|_G332] ;
X = [1:b, 2:a, 3:c|_G332] ;
X = [1:b, 2:c, 3:a|_G332] ;
X = [1:c, 2:a, 3:b|_G332] ;
X = [1:c, 2:b, 3:a|_G332] ;
fail.
</code></pre>
<p>Anyone know how I can get rid of the trailing variable? I know it's mostly cosmetic, but I don't see why it's there.</p>
| [
{
"answer_id": 285001,
"author": "Nelson",
"author_id": 27366,
"author_profile": "https://Stackoverflow.com/users/27366",
"pm_score": 1,
"selected": false,
"text": "ground_terms([H|T1],[H|T2]) :- ground(H), !, ground_terms(T1,T2).\nground_terms(_,[]).\n"
},
{
"answer_id": 287788,... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36990/"
] |
284,832 | <pre><code>For Each line As String In System.IO.File.ReadAllLines("file.txt")
'Do Something'
Next
</code></pre>
<p>and</p>
<pre><code>Using f As System.IO.FileStream = System.IO.File.OpenRead("somefile.txt")
Using s As System.IO.StreamReader = New System.IO.StreamReader(f)
While Not s.EndOfStream
Dim line As String = s.ReadLine
'put you line processing code here
End While
End Using
End Using
</code></pre>
<p>are both showing as mostly red, I'm running a clean install of MS VS2005 and these codes were both recomended to me, am I missing something else I need to install or declare?</p>
| [
{
"answer_id": 284866,
"author": "Mauro",
"author_id": 2208,
"author_profile": "https://Stackoverflow.com/users/2208",
"pm_score": 1,
"selected": false,
"text": "Dim Lines As String()\nLines = System.IO.File.ReadAllLines(\"file.txt\")\n"
},
{
"answer_id": 284880,
"author": "G... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
284,833 | <p>This is related to some other questions, such as: <a href="https://stackoverflow.com/questions/34987/how-to-declare-an-array-of-strings-in-c">this</a>, and some of my other questions.</p>
<p>In <a href="https://stackoverflow.com/questions/34987/how-to-declare-an-array-of-strings-in-c">this question</a>, and others, we see we can declare and initialise string arrays in one nice step, for example:</p>
<pre><code>const char* const list[] = {"zip", "zam", "bam"}; //from other question
</code></pre>
<p>This can be done in the implementation of a function with no bother, or in the body of a .cpp file, outside any scope.</p>
<p>What I want to do is to have an array like this as as member of a class I am using, something like this:</p>
<pre><code>class DataProvider : public SomethingElse
{
const char* const mStringData[] = {"Name1", "Name2", "Name3", ... "NameX"};
public:
DataProvider();
~DataProvider();
char* GetData()
{
int index = GetCurrentIndex(); //work out the index based on some other data
return mStringData[index]; //error checking and what have you omitted
}
};
</code></pre>
<p>But, the compiler complains and I can't seem to work out why. Is it possible to declare and initialise an array like this in one step in a class definition? Are there alternatives that are better?</p>
| [
{
"answer_id": 284843,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 2,
"selected": false,
"text": "class DataProvider {\n enum { SIZEOF_VALUES = 4 };\n const char * values[SIZEOF_VALUES];\n\n publi... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15667/"
] |
284,837 | <p>If you have a sequence of block elements and you wanted to place margin in between them. </p>
<p>Which do you prefer, margin-top or margin-bottom or both? Why?</p>
| [
{
"answer_id": 284852,
"author": "Winston Smith",
"author_id": 35086,
"author_profile": "https://Stackoverflow.com/users/35086",
"pm_score": 5,
"selected": true,
"text": "margin-bottom"
},
{
"answer_id": 284865,
"author": "sblundy",
"author_id": 4893,
"author_profile"... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20300/"
] |
284,858 | <p>My project requires a file where I will store key/value pair data that should be able to be read and modified by the user. I want the program to just expect the keys to be there, and I want to parse them from the file as quickly as possible.</p>
<p>I could store them in XML, but XML is way to complex, and it would require traversing nodes, and child nodes and so on, all I want is some class that takes a file and generates key value pairs. I want as little error handling as possible, and I want it done with as little code as possible.</p>
<p>I could code a class like that myself, but I'd rather learn how it's don'e in the framework than inventing the wheel twice. Are there some built in magic class in .NET (3.5) that are able to do so?</p>
<pre><code>MagicClass kv = new MagicClass("Settings.ini"); // It doesn't neccesarily have to be an INI file, it can be any simple key/value pair format.
string Value1 = kv.get("Key1");
...
</code></pre>
| [
{
"answer_id": 284881,
"author": "Jb Evain",
"author_id": 36702,
"author_profile": "https://Stackoverflow.com/users/36702",
"pm_score": 3,
"selected": false,
"text": "[Configuration]\nName = Jb Evain\nPhone = +330101010101\n"
},
{
"answer_id": 284882,
"author": "Jeff Kotula",... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284858",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29442/"
] |
284,868 | <p>I am writing event data to a log file in an asp.net httphandler by using the File.AppendAllText method. I am concerned with what will happen when multiple requests are received simultaneously. Does AppendAllText lock the file it's writing to?</p>
| [
{
"answer_id": 284897,
"author": "Steven A. Lowe",
"author_id": 9345,
"author_profile": "https://Stackoverflow.com/users/9345",
"pm_score": 4,
"selected": true,
"text": "public static object LockingTarget = new object();\n\npublic void LogToFile(string msg)\n{\n lock(LockingTarget)\n ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
284,885 | <p>I am trying to gain a better understanding of tcp/ip sockets in c#, as i want to challenge myself to see if i can create a working MMO infrastructure (game world, map, players, etc) purely for educational purposes as i have no intention of being another one of those "OMGZ iz gonna make my r0x0r MMORPG that will be better than WoW!!!", you know what im talking about.</p>
<p>Anyway, i was wondering if anyone can shed some light as to how one might approach designing this kind of system and what kinds of things are required, and what i should watch out for?</p>
<p>My initial idea was to break up the system into seperate client/server connections with each connection (on its own port) performing a specific task, such as updating player/monster positions, sending and receiving chat messages, etc. which to me would make processing the data easier because you wouldn't always need to put a header on the data to know what information the packet contains. </p>
<p>Does that make sense and is useful or am i just way over complicating things?</p>
<p>your responses are very much appreciated.</p>
| [
{
"answer_id": 285986,
"author": "grieve",
"author_id": 34329,
"author_profile": "https://Stackoverflow.com/users/34329",
"pm_score": 6,
"selected": true,
"text": "+-------------------------+-------------------+-----------------+------------------------+\n| Length of Msg (4 bytes) | MsgT... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18811/"
] |
284,889 | <p>I am about to embark on a rewrite of a VB6 application in .NET 3.5sp1. The VB6 app is pretty well written and the data layer is completely based on stored procedures. I'd like to go with something automated like Linq2SQL/Entity Framework/NHibernate/SubSonic. Admittedly, I haven't used any of these tools in anything other than throwaway projects. </p>
<p>The potential problem I fear I might have with all these choices is speed. For instance, right now to retrieve a single row (or the entire list), I use the following sproc:</p>
<pre><code>ALTER PROCEDURE [dbo].[lst_Customers]
@intID INT = NULL
,@chvName VARCHAR(100) = NULL
AS
SELECT Customer_id, Name
FROM dbo.Customer
WHERE (@intID IS NULL OR @intID = Customer_id)
AND (@chvName IS NULL OR Name like ('%' + @chvName + '%'))
ORDER BY name
</code></pre>
<p>To retrieve a single row in Linq2SQL/Entity Framework/NHibernate/SubSonic, would these solutions have to bring the entire list down to the client and find the row that I need?</p>
<p>So, what's the consensus for the data access strategy for an application with a large data domain?</p>
| [
{
"answer_id": 285030,
"author": "John Rudy",
"author_id": 14048,
"author_profile": "https://Stackoverflow.com/users/14048",
"pm_score": 2,
"selected": false,
"text": "where"
}
] | 2008/11/12 | [
"https://Stackoverflow.com/questions/284889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9382/"
] |
284,896 | <p>Is it a good idea (from a design POV) to nest constructor calls for overloaded New or Factory style methods? This is mostly for simple constructors, where each overload builds on the previous one. </p>
<pre><code>MyClass( arg1 ) {
_arg1 = arg1;
_otherField = true;
_color="Blue"
}
MyClass( arg1, arg2) : this(arg1) {
_arg2 = arg2
}
MyClass( arg1, arg2, arg3) : this(arg1, ar2) {
_arg3 = arg3;
}
</code></pre>
<p>Or with factory methods:</p>
<pre><code>static NewInstance(arg1 ) {
_arg1 = arg1;
}
static NewInstance(arg1, arg2) {
f = NewInstance(arg1);
f._arg2 = arg2;
}
//... and so on
</code></pre>
<p>I can see a few drawbacks on both sides</p>
<ul>
<li>Nesting hides what the constructor is doing</li>
<li>Not nesting duplicates all the functionality</li>
</ul>
<p>So, is doing this a good idea, or does it set me up for something I'm just not seeing as a problem. For some reason I feel uneasy doing it, mostly because it divides up the responsibility for initializing.</p>
<p>Edit:
<strong>@Jon Skeet</strong>: I see now why this was bothering me so much. I was doing it backwards! I wrote the whole thing and didn't even notice, it just smelled. Most other cases I have (that I wrote), do it the way you recommend, but this certainly isn't the only one that I have done like this. I do notice that the more complicated ones I did properly, but the simple ones I seem to have gone sloppy.
<em>I love micro edits. I also like acronymns!</em></p>
| [
{
"answer_id": 284905,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 7,
"selected": true,
"text": "public Foo(int x, int y)\n{\n this.x = x;\n this.y = y;\n precomputedValue = x * y;\n}\n\nprivate static int Def... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15127/"
] |
284,899 | <pre><code>private JButton jBtnDrawCircle = new JButton("Circle");
private JButton jBtnDrawSquare = new JButton("Square");
private JButton jBtnDrawTriangle = new JButton("Triangle");
private JButton jBtnSelection = new JButton("Selection");
</code></pre>
<p>How do I add action listeners to these buttons, so that from a main method I can call <code>actionperformed</code> on them, so when they are clicked I can call them in my program?</p>
| [
{
"answer_id": 284925,
"author": "Alex B",
"author_id": 6180,
"author_profile": "https://Stackoverflow.com/users/6180",
"pm_score": 3,
"selected": false,
"text": "jBtnDrawCircle.addActionListener( /*class that implements ActionListener*/ );\n"
},
{
"answer_id": 284934,
"autho... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37037/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.