qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
316,295
<p>I have a function that exports a table to CSV and in the query I set which fields will export.</p> <p>Here is the query:</p> <pre><code>SELECT lname, fname, email, address1, address2, city, state, zip, venue_id, dtelephone, etelephone, tshirt FROM volunteers_2009 </code></pre> <p>The field venue_id is the the id of the venue which is referred to in another table (venues)</p> <p>So volunteers_2009.venue_id = venues.id</p> <p>When I open the CSV file it displays the venue_id which I understand, but I need help modifying the query to put in the name of the venue (venues.venue_name) within the CSV file.</p> <p>Any help is appreciated.</p>
[ { "answer_id": 316303, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 0, "selected": false, "text": "SELECT a.lname as lname, a.fname as fname, a.email as email,\n a.address1 as address1, a.address2 as address2, a.city...
2008/11/25
[ "https://Stackoverflow.com/questions/316295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26130/" ]
316,312
<p>From the help for the Overflow Error in VBA, there's the following examples:</p> <pre><code>Dim x As Long x = 2000 * 365 ' gives an error Dim x As Long x = CLng(2000) * 365 ' fine </code></pre> <p>I would have thought that, since the Long data type is supposed to be able to hold 32-bit numbers, that the first example would work fine.</p> <p>I ask this because I have some code like this:</p> <pre><code>Dim Price as Long Price = CLng(AnnualCost * Months / 12) </code></pre> <p>and this throws an Overflow Error when AnnualCost is 5000 and Months is 12.</p> <p>What am I missing?</p>
[ { "answer_id": 316331, "author": "Robert Gamble", "author_id": 25222, "author_profile": "https://Stackoverflow.com/users/25222", "pm_score": 5, "selected": true, "text": "Dim Price as Long\nPrice = CLng(AnnualCost) * Months / 12\n" }, { "answer_id": 396310, "author": "Communi...
2008/11/25
[ "https://Stackoverflow.com/questions/316312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10439/" ]
316,315
<p>Is it possible to determine whether a particular youtube video is encoded with H.264 or FLV through the YouTube data API? If so, how? </p> <p>I can start a file download and check how the video stream was encoded (programmatically, of course), but I'd like to use the YouTube data API to avoid all that overhead.</p>
[ { "answer_id": 316331, "author": "Robert Gamble", "author_id": 25222, "author_profile": "https://Stackoverflow.com/users/25222", "pm_score": 5, "selected": true, "text": "Dim Price as Long\nPrice = CLng(AnnualCost) * Months / 12\n" }, { "answer_id": 396310, "author": "Communi...
2008/11/25
[ "https://Stackoverflow.com/questions/316315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25164/" ]
316,320
<p>I ran into this bug where an element of an array, if its index is the string "0", is inaccessible. </p> <p>It's not a bug with unserialize, either, as this occurred in my code without invoking it.</p> <pre><code>$arr = unserialize('a:1:{s:1:"0";i:5;}'); var_dump($arr["0"]); //should be 5, but is NULL var_dump($arr[0]); //maybe this would work? no. NULL </code></pre> <p>Am I doing something wrong here? How do I access this element of the array?</p>
[ { "answer_id": 316336, "author": "Draemon", "author_id": 26334, "author_profile": "https://Stackoverflow.com/users/26334", "pm_score": 0, "selected": false, "text": "int(5)\n" }, { "answer_id": 316343, "author": "kranzky", "author_id": 5442, "author_profile": "https:/...
2008/11/25
[ "https://Stackoverflow.com/questions/316320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
316,325
<p>I downloaded and installed this version of <a href="http://en.wikipedia.org/wiki/WxPython" rel="nofollow noreferrer">wxPython</a> for use with my Python 2.6 installation:</p> <p><a href="http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-2.8.9.1-py26.exe" rel="nofollow noreferrer">http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-2.8.9.1-py26.exe</a></p> <p>When I run Python and try to import wx, I get the following error:</p> <pre><code>C:\Program Files\Console2&gt;python Python 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; import wx Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; File "c:\Python26\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.py", line 45, in &lt;module&gt; from wx._core import * File "c:\Python26\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 4, in &lt;module&gt; import _core_ ImportError: DLL load failed: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. &gt;&gt;&gt; </code></pre> <p>I have already tried removing wxPython and installing again and I got the same error. How can I fix this problem?</p>
[ { "answer_id": 853581, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "msvcr90.dll" } ]
2008/11/25
[ "https://Stackoverflow.com/questions/316325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40495/" ]
316,341
<p>Hopefully this is a really quick one ;) I have written a lexer / parser specification in ANTLR3, and am targeting the CSharp2 target. The generated code works correctly, but I can't get ANTLR to put the C# output into a namespace.</p> <p>The relevant section of the Grammar file is as follows:</p> <pre><code>grammar MyGrammar; options { language = CSharp2; output = AST; ASTLabelType = CommonTree; } </code></pre> <p>To generate the correct namespace, I have tried:</p> <pre><code>@namespace { MyNamespace } </code></pre> <p>and</p> <pre><code>@lexer::namespace { MyNamespace } @parser::namespace { MyNamespace } </code></pre> <p>but both of these generate errors, claiming that the file has no rules.</p> <p>Any help is appreciated.</p>
[ { "answer_id": 316858, "author": "Fionn", "author_id": 21566, "author_profile": "https://Stackoverflow.com/users/21566", "pm_score": 4, "selected": true, "text": "grammar Test;\n\noptions\n{\n language=CSharp2;\n}\n\n@lexer::namespace {\n My.Name.Space\n}\n\n@parser::namespace {\n ...
2008/11/25
[ "https://Stackoverflow.com/questions/316341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/691/" ]
316,352
<p>In Java, you can qualify local variables and method parameters with the final keyword.</p> <pre><code>public static void foo(final int x) { final String qwerty = "bar"; } </code></pre> <p>Doing so results in not being able to reassign x and qwerty in the body of the method.</p> <p>This practice nudges your code in the direction of immutability which is generally considered a plus. But, it also tends to clutter up code with "final" showing up everywhere. What is your opinion of the final keyword for local variables and method parameters in Java?</p>
[ { "answer_id": 3852070, "author": "fastcodejava", "author_id": 184730, "author_profile": "https://Stackoverflow.com/users/184730", "pm_score": 2, "selected": false, "text": "final" }, { "answer_id": 3852100, "author": "kartheek", "author_id": 5760280, "author_profile"...
2008/11/25
[ "https://Stackoverflow.com/questions/316352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32174/" ]
316,367
<p>In a comment on a previous question, someone said that the following sql statement opens me up to sql injection:</p> <pre><code>select ss.*, se.name as engine, ss.last_run_at + interval ss.refresh_frequency day as next_run_at, se.logo_name from searches ss join search_engines se on ss.engine_id = se.id where ss.user_id='.$user_id.' group by ss.id order by ss.project_id, ss.domain, ss.keywords </code></pre> <p>Assuming that the <code>$userid</code> variable is properly escaped, how does this make me vulnerable, and what can I do to fix it?</p>
[ { "answer_id": 316372, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 4, "selected": true, "text": "$db_connection = new mysqli(\"localhost\", \"user\", \"pass\", \"db\");\n$statement = $db_connection->prepare(\"SELEC...
2008/11/25
[ "https://Stackoverflow.com/questions/316367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39539/" ]
316,383
<p>i need a C# library about strict HTML validation and filtering </p>
[ { "answer_id": 316372, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 4, "selected": true, "text": "$db_connection = new mysqli(\"localhost\", \"user\", \"pass\", \"db\");\n$statement = $db_connection->prepare(\"SELEC...
2008/11/25
[ "https://Stackoverflow.com/questions/316383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/441493/" ]
316,384
<p>How do you go about checking that an IIS website is successfully using Kerberos and not falling back on NTLM?</p>
[ { "answer_id": 319245, "author": "James Newton-King", "author_id": 11829, "author_profile": "https://Stackoverflow.com/users/11829", "pm_score": 3, "selected": true, "text": "Negotiate TlRMTVNTUA\n" }, { "answer_id": 605057, "author": "Christopher G. Lewis", "author_id": ...
2008/11/25
[ "https://Stackoverflow.com/questions/316384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11829/" ]
316,409
<p>I'm trying out PHPTAL and I want to render a table with zebra stripes. I'm looping through a simple php assoc array ($_SERVER).</p> <p>Note that I don't want to use jQuery or anything like that, I'm trying to learn PHPTAL usage!</p> <p>Currently I have it working like this (too verbose for my liking):</p> <pre><code>&lt;tr tal:repeat="item server"&gt; &lt;td tal:condition="repeat/item/odd" tal:content="repeat/item/key" class="odd"&gt;item key&lt;/td&gt; &lt;td tal:condition="repeat/item/even" tal:content="repeat/item/key" class="even"&gt;item key&lt;/td&gt; &lt;td tal:condition="repeat/item/odd" tal:content="item" class="odd"&gt;item value&lt;/td&gt; &lt;td tal:condition="repeat/item/even" tal:content="item" class="even"&gt;item value&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>Basically I want some kind of conditional assignment on the fly, but I'm unsure of the syntax.</p>
[ { "answer_id": 316420, "author": "starmonkey", "author_id": 29854, "author_profile": "https://Stackoverflow.com/users/29854", "pm_score": 2, "selected": false, "text": "<tr tal:repeat=\"item server\">\n <td tal:content=\"repeat/item/key\" tal:attributes=\"class php: repeat.item.odd ? 'o...
2008/11/25
[ "https://Stackoverflow.com/questions/316409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29854/" ]
316,422
<p>I've built a entity framework model against a 2008 database. All works ok against the 2008 database. When I try to update the entity on a 2005 database I get this error. </p> <pre>The version of SQL Server in use does not support datatype 'datetime2</pre> <p>I specifically did not use any 2008 features when I built the database. I can't find any reference to datetime2 in the code. And, yes the column is defined as "datetime" in the database. </p>
[ { "answer_id": 2211263, "author": "Jason", "author_id": 26860, "author_profile": "https://Stackoverflow.com/users/26860", "pm_score": 4, "selected": false, "text": "<Schema Namespace=\"Foobar.Store\" Alias=\"Self\" Provider=\"System.Data.SqlClient\" ProviderManifestToken=\"2005\" >\n" ...
2008/11/25
[ "https://Stackoverflow.com/questions/316422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1351/" ]
316,454
<p>My current problem is that I have a JFrame with a 2x2 GridLayout. And inside one of the squares, I have a JPanel that is to display a grid. I am having a field day with the java swing library... take a look</p> <p><a href="http://img114.imageshack.us/img114/9683/frameow2.jpg" rel="nofollow noreferrer">Image</a></p> <p>Java is automatically expanding each JLabel to fit the screen. I want it to just be those blue squares (water) and the black border and not that gray space. Is there a way I can just set the size of that JPanel permanently so that I don't have to go through changing the size of the JFrame a million times before I get the exact dimension so that the gray space disappears?</p> <p>I also would like to set the size of those buttons so they are not so huge (<code>BorderLayout</code> is being used for the buttons and TextField)</p>
[ { "answer_id": 316460, "author": "javamonkey79", "author_id": 27657, "author_profile": "https://Stackoverflow.com/users/27657", "pm_score": 1, "selected": false, "text": "setResizeable( false )" }, { "answer_id": 316496, "author": "Community", "author_id": -1, "author...
2008/11/25
[ "https://Stackoverflow.com/questions/316454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29326/" ]
316,463
<p>How would I go upon detecting input for a console application in C#?</p> <p>Let's say for example I want the console application to start up by writing: Welcome To Food Hut (cursor to type stuff here after the first line)</p> <p>I would want the console application to detect two commands:</p> <p>1: /help - which will display some help gibberish.</p> <p>2: /food pizza -t pepperoni -d pepsi - which will display "So you would like a Pizza with Pepperoni and Pepsi to drink?"</p> <p>How would I go upon detecting first what /command was typed and also reading the arguments like -t pepperoni (topping) and -d pepsi (to drink) if /food pizza was typed?</p> <p>My main problem is figuring out how to detect the first word ever typed, figuring out that if it was /help then call some method that would post some help text into the console or if the command is /food then to read what is after the /food command, -t, and -p.</p> <pre><code> static void Main(string[] args) { Console.WriteLine("Welcome To Food Hut"); Console.ReadLine(); // if readline equals to /help then display some help text. // if /food command is typed, read first argument after /food Pizza, -t TheTopping // and -p ForWhatToDrink // and then display, 'So you would like a Pizza with Pepperoni and Pepsi to drink?' } </code></pre>
[ { "answer_id": 316482, "author": "Juliet", "author_id": 40516, "author_profile": "https://Stackoverflow.com/users/40516", "pm_score": 2, "selected": false, "text": "string input = Console.ReadLine();\nif (input == \"/help\") { }\nelse if (input.StartsWith(\"/food\")) { }\nelse { //... }\...
2008/11/25
[ "https://Stackoverflow.com/questions/316463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
316,485
<p>How can I rename a schema using SQL Server? </p>
[ { "answer_id": 316769, "author": "Ray Lu", "author_id": 11413, "author_profile": "https://Stackoverflow.com/users/11413", "pm_score": 5, "selected": false, "text": "ALTER SCHEMA NewSchema TRANSFER OldSchema.Object;\n" }, { "answer_id": 317711, "author": "Cade Roux", "auth...
2008/11/25
[ "https://Stackoverflow.com/questions/316485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
316,486
<p>I have been looking at using TDD and implementing proper testing (only just started to learn how much better it makes your life) in any of my projects that I create in the future. So for the last couple of days I have been floating around on SO trying to learn about how to design your application for testability, but I still seem to be struggling with some of the ideas. </p> <p>I have read a lot that you should program <strong>against interfaces</strong> rather than <strong>classes</strong>. The main problem I'm having is, how many interfaces should you create? Should you have one for everything you want to test? or am I reading this wrong?</p> <p>Another thing is use lots of dependency injection, so you can mock the parts that you are injecting rather than use the real things. Is this correct? or am I way off here too?</p>
[ { "answer_id": 316536, "author": "tsimon", "author_id": 1685, "author_profile": "https://Stackoverflow.com/users/1685", "pm_score": 4, "selected": true, "text": "Assert.AreEqual(5, calc.Add(2, 3), \"Adding positives not as expected\");\nAssert.AreEqual(-5, calc.Add(-2, -3), \"Adding nega...
2008/11/25
[ "https://Stackoverflow.com/questions/316486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6335/" ]
316,488
<p>What is the best way to construct a bit mask in C with <code>m</code> set bits preceded by <code>k</code> unset bits, and followed by <code>n</code> unset bits:</p> <pre><code>00..0 11..1 00..0 k m n </code></pre> <p>For example, k=1, m=4, n=3 would result in the bit mask:</p> <pre><code>01111000 </code></pre>
[ { "answer_id": 316493, "author": "Darius Bacon", "author_id": 27024, "author_profile": "https://Stackoverflow.com/users/27024", "pm_score": 6, "selected": true, "text": "~(~0 << m) << n\n" }, { "answer_id": 316494, "author": "Jonathan Leffler", "author_id": 15168, "au...
2008/11/25
[ "https://Stackoverflow.com/questions/316488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1692070/" ]
316,508
<p>I am trying to write a JavaScript script to add to greasemonkey that adds a button after an element. The onClick for this button should copy the parents element text to the keyboard. I have seen plenty of examples that copy already selected text to the clipboard such as this:</p> <pre><code> &lt;SCRIPT LANGUAGE="JavaScript"&gt; &lt;!-- Begin function copyit(theField) { var selectedText = document.selection; if (selectedText.type == 'Text') { var newRange = selectedText.createRange(); theField.focus(); theField.value = newRange.text; } else { alert('Alert: Select The text in the textarea then click on this button'); } } // End --&gt; &lt;/script&gt; &lt;input onclick="copyit(this.form.text_select)" type="button" value="Click Here to Copy the Highlighted Text" name="copy_button"&gt; </code></pre> <p>Found <a href="http://www.wallpaperama.com/forums/javascript-copy-selected-text-box-select-all-highlight-text-form-copy-paste-t706.html" rel="noreferrer">here</a>. </p> <p>I have also found that you can select text in input elements. I have tried combining both techniques, as well as many others with no viable solution yet. I am not even sure why the code above copies to the clipboard. Does anyone have a solution to this? </p>
[ { "answer_id": 348379, "author": "PhiLho", "author_id": 15459, "author_profile": "https://Stackoverflow.com/users/15459", "pm_score": 4, "selected": true, "text": "var tc = textToCopy.replace(/\\n\\n/g, '\\n');\nif (window.clipboardData) // IE\n{\n window.clipboardData.setData(\"Text\",...
2008/11/25
[ "https://Stackoverflow.com/questions/316508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27657/" ]
316,520
<p>I saw this signature on the ListView class:</p> <pre><code>public ListView..::.ListViewItemCollection Items { get; } </code></pre> <p>When I saw that, "What?!"</p> <p>I searched "dot dot colon colon dot" and "..::." on Google with no result.</p> <p><img src="https://i.stack.imgur.com/av0FO.png" alt="alt text"></p>
[ { "answer_id": 316568, "author": "tsimon", "author_id": 1685, "author_profile": "https://Stackoverflow.com/users/1685", "pm_score": -1, "selected": false, "text": "public class ListView {\n public ListViewItemCollection Items {get;}\n\n public class ListViewItemCollection : IList {\n ...
2008/11/25
[ "https://Stackoverflow.com/questions/316520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11238/" ]
316,524
<p>I wish to find all rows in a table where one column is a substring of another column.</p> <p>In other words, suppose I have a table (called people) with two columns: firstname and lastname, and I want to find all people like "rob robinowitz" and "jill bajillion".</p> <p>Is there a way to do something like "select * from people where lastname like %firstname%"? (But something which actually works).</p>
[ { "answer_id": 316539, "author": "Dmitry Khalatov", "author_id": 18174, "author_profile": "https://Stackoverflow.com/users/18174", "pm_score": 4, "selected": true, "text": "select * from people where lastname like '%' + firstname + '%'\n" }, { "answer_id": 316542, "author": "...
2008/11/25
[ "https://Stackoverflow.com/questions/316524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31060/" ]
316,528
<p>Sounds easy, but I can't find where this built in class and others exists in the documentation. I use functions but want to know what there is on the OO side.</p>
[ { "answer_id": 316541, "author": "majelbstoat", "author_id": 38812, "author_profile": "https://Stackoverflow.com/users/38812", "pm_score": 2, "selected": false, "text": "Reflection::export(new ReflectionClass('DateTime'));\n\nClass [ class DateTime ] {\n\n - Constants [11] {\n Const...
2008/11/25
[ "https://Stackoverflow.com/questions/316528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10117/" ]
316,532
<p>If I have code like this:</p> <pre><code> public XALServiceConfiguration CreateInstance() { var config = ConfigurationManager.GetSection(ConfigurationSectionName) as XALServiceConfiguration; if (config == null) throw new ConfigurationErrorsException("Configuration element 'xalService' was not found or is not of correct type."); return config; } </code></pre> <p>How can I test that the exception is thrown if the section is missing from the configuration file ? For other tests, the configuration section needs to be in the config file, so I cannot actually remove it from the file.</p> <p>I am using the Visual Studio 2008 Unit test framework.</p>
[ { "answer_id": 316538, "author": "Aaron Powell", "author_id": 11388, "author_profile": "https://Stackoverflow.com/users/11388", "pm_score": 0, "selected": false, "text": "try catch" }, { "answer_id": 316553, "author": "tsimon", "author_id": 1685, "author_profile": "ht...
2008/11/25
[ "https://Stackoverflow.com/questions/316532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13627/" ]
316,540
<p>I want add the new node as parent node of the old nodes in XML using C#. for example node have the following XMl file:</p> <pre><code>&lt;bookstore&gt; &lt;books&gt; &lt;author&gt; &lt;/author&gt; &lt;/books&gt; &lt;/bookstore&gt; </code></pre> <p>like that now I want add the new like below:</p> <pre><code>&lt;bookstore&gt; &lt;newnode&gt; &lt;books&gt; &lt;author&gt; &lt;/author&gt; &lt;/books&gt; &lt;/newnode&gt; &lt;/bookstore&gt; </code></pre>
[ { "answer_id": 316561, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "XmlDocument xd = new XmlDocument();\nxd.Load(\"oldxmlfile.xml\");\nXmlNode oldNode = xd[\"nameOfRootNode\"];\nxd.RemoveAll();\...
2008/11/25
[ "https://Stackoverflow.com/questions/316540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
316,574
<p>Are there any command line interfaces to the DHCP settings in Mac OS X? I have found that inside System Profiler, the Network tab provides a lot of useful information, but I have not found any documentation about any command line equivalents.</p>
[ { "answer_id": 316598, "author": "Jason Coco", "author_id": 34218, "author_profile": "https://Stackoverflow.com/users/34218", "pm_score": -1, "selected": false, "text": "ifconfig(8)\nnetstat(1)\nnetintro(4)\n" }, { "answer_id": 316601, "author": "Arne Burmeister", "author...
2008/11/25
[ "https://Stackoverflow.com/questions/316574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2910/" ]
316,581
<p>I have a batch file that does this.</p> <p>ECHO A41,35,0,a,1,1,N,"Mr ZACHARY KAPLAN">> test.txt </p> <p>There are about 30k similar lines. It takes the batch file about 5 hours to run. </p> <p>Is there a way to speed this up?</p> <p>/Jeanre</p>
[ { "answer_id": 316631, "author": "hasen", "author_id": 35364, "author_profile": "https://Stackoverflow.com/users/35364", "pm_score": 1, "selected": false, "text": ">>> import re\n>>> text = 'ECHO A41,35,0,a,1,1,N,\"Mr ZACHARY KAPLAN\">> test.txt'\n>>> re.sub( r\"ECHO\\s*(.*?)>>\\s*test.t...
2008/11/25
[ "https://Stackoverflow.com/questions/316581", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
316,582
<p>I want to pose a question such as:</p> <blockquote> <p>What is your name? Joe</p> </blockquote> <p>How would I accomplish this using <code>Console.WriteLine</code> to also wait for the response on that same line instead of it being broken into:</p> <blockquote> <p>What is your name?</p> <p>Joe</p> </blockquote>
[ { "answer_id": 316583, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 7, "selected": true, "text": "Console.Write" }, { "answer_id": 316587, "author": "Jon Skeet", "author_id": 22656, "author_profile":...
2008/11/25
[ "https://Stackoverflow.com/questions/316582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
316,590
<p>Suppose I want to count the lines of code in a project. If all of the files are in the same directory I can execute:</p> <pre><code>cat * | wc -l </code></pre> <p>However, if there are sub-directories, this doesn't work. For this to work cat would have to have a recursive mode. I suspect this might be a job for xargs, but I wonder if there is a more elegant solution?</p>
[ { "answer_id": 316602, "author": "chromakode", "author_id": 40508, "author_profile": "https://Stackoverflow.com/users/40508", "pm_score": 4, "selected": false, "text": "find" }, { "answer_id": 316605, "author": "Ken", "author_id": 20074, "author_profile": "https://Sta...
2008/11/25
[ "https://Stackoverflow.com/questions/316590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39584/" ]
316,626
<p>I have a version resource in my resources in a C++ project which contains version number, copyright and build details. Is there an easy way to access this at run-time to populate my <em>help/about</em> dialog as I am currently maintaining seperate const values of this information. Ideally, the solution should work for Windows/CE mobile and earlier versions of Visual C++ (6.0 upwards).</p>
[ { "answer_id": 316633, "author": "Rob", "author_id": 9236, "author_profile": "https://Stackoverflow.com/users/9236", "pm_score": 3, "selected": false, "text": "HRSRC res = ::FindResource(NULL, MAKEINTRESOURCE(MY_VERSION_ID), RT_VERSION);\nDWORD size = ::SizeofResource(NULL, res);\nHGLOBA...
2008/11/25
[ "https://Stackoverflow.com/questions/316626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22564/" ]
316,629
<p>I'm adding avatars to a forum engine I'm designing, and I'm debating whether to do something simple (forum image is named .png) and use PHP to check if the file exists before displaying it, or to do something a bit more complicated (but not much) and use a database field to contain the name of the image to show.</p> <p>I'd much rather go with the file_exists() method personally, as that gives me an easy way to fall back to a "default" avatar if the current one doesn't exist (yet), and its simple to implement code wise. However, I'm worried about performance, since this will be run once per user shown per pageload on the forum read pages. So I'd like to know, does the file_exists() function in PHP cause any major slowdowns that would cause significant performance hits in high traffic conditions?</p> <p>If not, great. If it does, what is your opinion on alternatives for keeping track of a user-uploaded image? Thanks!</p> <p>PS: The code differences I can see are that the file checking versions lets the files do the talking, while the database form trusts that the database is accurate and doesn't bother to check. (its just a url that gets passed to the browser of course.)</p>
[ { "answer_id": 316729, "author": "Zebra North", "author_id": 17440, "author_profile": "https://Stackoverflow.com/users/17440", "pm_score": 5, "selected": true, "text": "SELECT CONCAT(IF(has_avatar, id, 'default'), '.png') AS avatar FROM users" } ]
2008/11/25
[ "https://Stackoverflow.com/questions/316629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19521/" ]
316,649
<p>I am trying to use C# to parse CSV. I used regular expressions to find <code>","</code> and read string if my header counts were equal to my match count.</p> <p>Now this will not work if I have a value like:</p> <pre><code>"a",""b","x","y"","c" </code></pre> <p>then my output is:</p> <pre><code>'a' '"b' 'x' 'y"' 'c' </code></pre> <p>but what I want is:</p> <pre><code>'a' '"b","x","y"' 'c' </code></pre> <p>Is there any regex or any other logic I can use for this ?</p>
[ { "answer_id": 316663, "author": "Adam Davis", "author_id": 2915, "author_profile": "https://Stackoverflow.com/users/2915", "pm_score": 0, "selected": false, "text": "\"a\", \"\"b\", \"\"c\", \"d\"\", \"e\"\"" }, { "answer_id": 316669, "author": "Tomalak", "author_id": 18...
2008/11/25
[ "https://Stackoverflow.com/questions/316649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
316,673
<p>I have an app that is written in Swing, awt. I want to prevent users from pasting values into the textfields. is there any way to do this without using action listeners?</p>
[ { "answer_id": 316703, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "paste()" }, { "answer_id": 2343559, "author": "Rob", "author_id": 282240, "author_profile": "https://Stack...
2008/11/25
[ "https://Stackoverflow.com/questions/316673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
316,674
<p>How would I accomplish displaying a line as the one below in a console window by writing it into a variable during design time then just calling Console.WriteLine(sDescription) to display it?</p> <pre><code> Options: -t Description of -t argument. -b Description of -b argument. </code></pre>
[ { "answer_id": 316680, "author": "Gishu", "author_id": 1695, "author_profile": "https://Stackoverflow.com/users/1695", "pm_score": 2, "selected": false, "text": "Console.Write(\"Options:\\n\\tSomething\\t\\tElse\");\n" }, { "answer_id": 316688, "author": "Marc Gravell", "...
2008/11/25
[ "https://Stackoverflow.com/questions/316674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
316,682
<p>I have a byte stream I need parsed into a struct, and I also need to be able to parse the struct back to a byte stream.</p> <p>Below is an example of what I want where I've used BitConverter to parse the values. I hope there is a more efficient way of doing this, because my structs are HUGE!</p> <pre><code>ref struct TestStruct { int TestInt; float TestFloat; }; int main(array&lt;System::String ^&gt; ^args) { // populating array - just for demo, it's really coming from a file array&lt;unsigned char&gt;^ arrBytes = gcnew array&lt;unsigned char&gt;(8); Array::Copy(BitConverter::GetBytes((int)1234), arrBytes, 4); Array::Copy(BitConverter::GetBytes((float)12.34), 0, arrBytes, 4, 4); // parsing to struct - I want help TestStruct^ myStruct = gcnew TestStruct(); myStruct-&gt;TestInt = BitConverter::ToInt32(arrBytes, 0); myStruct-&gt;TestFloat = BitConverter::ToSingle(arrBytes, 4); String^ str = Console::ReadLine(); return 0; } </code></pre>
[ { "answer_id": 316705, "author": "Adam Davis", "author_id": 2915, "author_profile": "https://Stackoverflow.com/users/2915", "pm_score": -1, "selected": false, "text": "char buffer[sizeof(MYSTRUCT)];\nmemcopy((char*) &mystruct, buffer, sizeof(MYSTRUCT));\n" }, { "answer_id": 31671...
2008/11/25
[ "https://Stackoverflow.com/questions/316682", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37583/" ]
316,727
<p>I always tell in c# a variable of type double is not suitable for money. All weird things could happen. But I can't seem to create an example to demonstrate some of these issues. Can anyone provide such an example?</p> <p>(edit; this post was originally tagged C#; some replies refer to specific details of <code>decimal</code>, which therefore means <a href="http://msdn.microsoft.com/en-us/library/system.decimal.aspx" rel="noreferrer"><code>System.Decimal</code></a>).</p> <p>(edit 2: I was specific asking for some c# code, so I don't think this is language agnostic only)</p>
[ { "answer_id": 316731, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 8, "selected": true, "text": "double x = 3.65, y = 0.05, z = 3.7;\nConsole.WriteLine((x + y) == z); // false\n" }, { "answer_id": 316737, ...
2008/11/25
[ "https://Stackoverflow.com/questions/316727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56/" ]
316,747
<p>I had this question earlier and it was concluded it was a bug in 5.2.5. Well, it's still broken in 5.2.6, at least for me:</p> <p>Please let me know if it is broken or works for you:</p> <pre><code>$obj = new stdClass(); $obj-&gt;{"foo"} = "bar"; $obj-&gt;{"0"} = "zero"; $arr = (array)$obj; //foo -- bar //0 -- {error: undefined index} foreach ($arr as $key=&gt;$value){ echo "$key -- " . $arr[$key] . "\n"; } </code></pre> <p>Any ways to "fix" the array after it has been cast from a stdClass?</p>
[ { "answer_id": 316772, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 3, "selected": true, "text": "$arr = array_combine(array_keys($arr), array_values($arr));\n" }, { "answer_id": 316776, "author": "Community", ...
2008/11/25
[ "https://Stackoverflow.com/questions/316747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
316,757
<p>The UK VAT system is changing from 17.5% to 15%. What strategies have you used in your code to store the VAT, and how will the change affect your applications. Do you store a history of vats so you can calculate old prices, or are old invoices stored in a separate table? Is it a simple config setting, or did you bodge it? What's the ideal way to store VAT?</p>
[ { "answer_id": 316768, "author": "digiguru", "author_id": 5055, "author_profile": "https://Stackoverflow.com/users/5055", "pm_score": -1, "selected": false, "text": "Table tbl_config\n config_id int\n config_name varchar(255)\n config_value varchar(255)\n" }, { "answer_id":...
2008/11/25
[ "https://Stackoverflow.com/questions/316757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5055/" ]
316,761
<p>I'm working with a Java program that has multiple components (with Eclipse &amp; Ant at the moment). </p> <p>Is there some way to start multiple programs with one launch configuration? I have an Ant target that does the job (launches multiple programs) but there are things I would like to do:</p> <ul> <li>I would like to debug the programs with Eclipse, hence the need for Eclipse launch.</li> <li>I would like to see the outputs for the programs at separate consoles.</li> </ul> <p>Also other ways to launch multiple Java programs "with one click" with separate consoles and/or debugging would be ok.</p>
[ { "answer_id": 316783, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 4, "selected": true, "text": "Main Class: org.apache.tools.ant.Main\n\n-Dant.home=${resource_loc:/myPath/apache_ant} \n-f ${resource_loc:/myProject/config/myF...
2008/11/25
[ "https://Stackoverflow.com/questions/316761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28482/" ]
316,773
<p>Ok I am a total beginner with the Solaris Operating system and I need to install and configure samba on 3 boxes each has a different version of Solaris (8,9,10).</p> <p>What I want to know location of samba configuration file i.e., <code>smb.conf</code> files in each version? So far all I have found is </p> <ol> <li><p>Solaris 8 </p> <blockquote> <p>/usr/local/samba/lib/smb.conf</p> </blockquote></li> <li><p>Solaris 9 and Solaris 10</p> <blockquote> <p>/etc/sfw/samba/smb.conf</p> </blockquote></li> </ol> <p>Is this right? I need to know where these files go by default when samba is installed.</p>
[ { "answer_id": 316816, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 3, "selected": true, "text": "/usr/local/samba/" } ]
2008/11/25
[ "https://Stackoverflow.com/questions/316773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38210/" ]
316,780
<p>I'm developing a multilanguage software. As far as the application code goes, localizability is not an issue. We can use language specific resources and have all kinds of tools that work well with them.</p> <p>But what is the best approach in defining a multilanguage database schema? Let's say we have a lot of tables (100 or more), and each table can have multiple columns that can be localized (most of nvarchar columns should be localizable). For instance one of the tables might hold product information:</p> <pre class="lang-sql prettyprint-override"><code>CREATE TABLE T_PRODUCT ( NAME NVARCHAR(50), DESCRIPTION NTEXT, PRICE NUMBER(18, 2) ) </code></pre> <p>I can think of three approaches to support multilingual text in NAME and DESCRIPTION columns:</p> <ol> <li><p>Separate column for each language</p> <p>When we add a new language to the system, we must create additional columns to store the translated text, like this:</p> <pre class="lang-sql prettyprint-override"><code>CREATE TABLE T_PRODUCT ( NAME_EN NVARCHAR(50), NAME_DE NVARCHAR(50), NAME_SP NVARCHAR(50), DESCRIPTION_EN NTEXT, DESCRIPTION_DE NTEXT, DESCRIPTION_SP NTEXT, PRICE NUMBER(18,2) ) </code></pre></li> <li><p>Translation table with columns for each language</p> <p>Instead of storing translated text, only a foreign key to the translations table is stored. The translations table contains a column for each language.</p> <pre class="lang-sql prettyprint-override"><code>CREATE TABLE T_PRODUCT ( NAME_FK int, DESCRIPTION_FK int, PRICE NUMBER(18, 2) ) CREATE TABLE T_TRANSLATION ( TRANSLATION_ID, TEXT_EN NTEXT, TEXT_DE NTEXT, TEXT_SP NTEXT ) </code></pre></li> <li><p>Translation tables with rows for each language</p> <p>Instead of storing translated text, only a foreign key to the translations table is stored. The translations table contains only a key, and a separate table contains a row for each translation to a language.</p> <pre class="lang-sql prettyprint-override"><code>CREATE TABLE T_PRODUCT ( NAME_FK int, DESCRIPTION_FK int, PRICE NUMBER(18, 2) ) CREATE TABLE T_TRANSLATION ( TRANSLATION_ID ) CREATE TABLE T_TRANSLATION_ENTRY ( TRANSLATION_FK, LANGUAGE_FK, TRANSLATED_TEXT NTEXT ) CREATE TABLE T_TRANSLATION_LANGUAGE ( LANGUAGE_ID, LANGUAGE_CODE CHAR(2) ) </code></pre></li> </ol> <p>There are pros and cons to each solution, and I would like to know what are your experiences with these approaches, what do you recommend and how would you go about designing a multilanguage database schema.</p>
[ { "answer_id": 316829, "author": "user39603", "author_id": 39603, "author_profile": "https://Stackoverflow.com/users/39603", "pm_score": 3, "selected": false, "text": "table Product\nproductid INT PK, price DECIMAL, translationid INT FK\n\ntable Translation\ntranslationid INT PK\n\ntable...
2008/11/25
[ "https://Stackoverflow.com/questions/316780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5348/" ]
316,781
<p>Just wondering if there is anything built-in to Javascript that can take a Form and return the query parameters, eg: <code>"var1=value&amp;var2=value2&amp;arr[]=foo&amp;arr[]=bar..."</code></p> <p>I've been wondering this for years.</p>
[ { "answer_id": 316817, "author": "Kent Fredric", "author_id": 15614, "author_profile": "https://Stackoverflow.com/users/15614", "pm_score": 2, "selected": false, "text": " var foo = document.createElement(\"elementnamehere\"); \n foo.attribute = allUserSpecifiedDataConsideredDangerou...
2008/11/25
[ "https://Stackoverflow.com/questions/316781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
316,790
<p>Got a little problem with a Seam application I'm working on and I was wondering if anyone knows a way round it. I've got a form in my application that uses AJAX to show certain input boxes depending on an item in a dropdown box. The code works fine except for setting the ID's in my input boxes. It looks like JSF doesn't let me set an ID via a variable. Other attributes like "for" in labels are fine. Here's some code explaining what I mean:</p> <pre><code>&lt;ui:repeat value="#{serviceHome.instance.serviceSettings}" var="currSetting" &gt; &lt;li&gt; &lt;!-- Imagine the below works out as "settingABC" --&gt; &lt;c:set var="labelKey" value="setting#{jsfUtils.removeWhitespace(currSetting.key.name)}" /&gt; &lt;!-- Labelkey is correctly added into this input so for = "settingABC" --&gt; &lt;h:outputLabel for="#{labelKey}" styleClass="required generated" value="#{currSetting.key.name}:"/&gt; &lt;s:decorate styleClass="errorwrapper"&gt; &lt;!-- Labelkey ISN'T correctly added into this input. Instead we just get "setting" --&gt; &lt;h:inputText id="#{labelKey}" value="#{currSetting.value}"/&gt; &lt;a4j:outputPanel ajaxRendered="true"&gt; &lt;h:message for="#{labelKey}" styleClass="errormessage" /&gt; &lt;/a4j:outputPanel&gt; &lt;/s:decorate&gt; &lt;/li&gt; &lt;/ui:repeat&gt; </code></pre> <p>Does anyone have any idea how I can get past this?</p>
[ { "answer_id": 318513, "author": "Grant Wagner", "author_id": 9254, "author_profile": "https://Stackoverflow.com/users/9254", "pm_score": 2, "selected": false, "text": "<h:inputText id=\"whatever\" value=\"...\" />\n" }, { "answer_id": 326389, "author": "billjamesdev", "a...
2008/11/25
[ "https://Stackoverflow.com/questions/316790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1900/" ]
316,807
<p>There are too many method for embedding flash in html, which way is the best? Requirements are:</p> <ul> <li>Cross-browser support</li> <li>Support for alternative content (if flash is not supported by the browser)</li> <li>Possibility to require a specific version of the flash player</li> </ul> <p>I have been reading about <a href="http://code.google.com/p/swfobject/wiki/documentation" rel="nofollow noreferrer">SWFobject</a>, has anyone used it/tested? </p>
[ { "answer_id": 316815, "author": "martinlund", "author_id": 1808, "author_profile": "https://Stackoverflow.com/users/1808", "pm_score": 5, "selected": true, "text": "var fn = function() {\n if(swfobject.hasFlashPlayerVersion(\"9.0.115\"))\n {\n var att = { data:\"flash.swf\"...
2008/11/25
[ "https://Stackoverflow.com/questions/316807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16265/" ]
316,808
<p>Env.: VS 2008, .NET 2.0, WinForms</p> <p>I have a listview in Tile mode. Some items have an associated image. Some don't.</p> <p>The contents (listview items) is often renewed when user clicks some controls. When this happens, it sometimes appears that none of the new items have images. In that case, I would like to get rid of the empty space on the left of items reserved for images. I tried the following pseudo-code to temporarily get rid of the image list</p> <pre><code>list.Items.Clear(); FillList(); list.LargeImageList= (none of the items has image) ? null : MyImageList; </code></pre> <p>But it doesn't work: The empty space is still there. I also try to repaint the control, to no avail.</p> <p><a href="http://apptranslator.com/_so/so_list1.jpg" rel="nofollow noreferrer">alt text http://apptranslator.com/_so/so_list1.jpg</a> <a href="http://apptranslator.com/_so/so_list2.jpg" rel="nofollow noreferrer">alt text http://apptranslator.com/_so/so_list2.jpg</a> <a href="http://apptranslator.com/_so/so_list3.jpg" rel="nofollow noreferrer">alt text http://apptranslator.com/_so/so_list3.jpg</a></p> <p>Left: list with images.</p> <p>Middle: List without images. Space for images is visible.</p> <p>Right: How I would like it to be when there's no images.</p> <p>EDIT: I also made this test: Don't assign the image list in the designer. If the first display doesn't contain any images, then I get the expected result. I then click to display images (I get them). I click again to come back to a no images selection: the image space doesn't disappear.</p> <p>Also, Hath, no I don't use small images or state images. Only large images.</p> <p>What can I do? TIA.</p>
[ { "answer_id": 317249, "author": "Hath", "author_id": 5186, "author_profile": "https://Stackoverflow.com/users/5186", "pm_score": 2, "selected": true, "text": "using System;\nusing System.Windows.Forms;\npublic class MainForm : Form\n{\n private System.ComponentModel.IContainer compon...
2008/11/25
[ "https://Stackoverflow.com/questions/316808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12379/" ]
316,812
<p>How can I find poor performing SQL queries in Oracle?</p> <p>Oracle maintains statistics on shared SQL area and contains one row per SQL string(v$sqlarea). But how can we identify which one of them are badly performing?</p>
[ { "answer_id": 316881, "author": "WW.", "author_id": 14663, "author_profile": "https://Stackoverflow.com/users/14663", "pm_score": 6, "selected": false, "text": "SELECT * FROM\n(SELECT\n sql_fulltext,\n sql_id,\n elapsed_time,\n child_number,\n disk_reads,\n executions,...
2008/11/25
[ "https://Stackoverflow.com/questions/316812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34058/" ]
316,820
<p>I need to launch a media file from a URL from within my c# .NET application. Is there any way to do this natively in .NET? I don't need an embedded player, I just need the default player to launch. I have tried </p> <pre><code>System.Diagnostics.Process.Start("File URL"); </code></pre> <p>but it launches the default browser and downloads the file, instead of attempting to play it in WMP/VLC/whatever the default media player is. Any ideas?</p>
[ { "answer_id": 316915, "author": "Stefan", "author_id": 19307, "author_profile": "https://Stackoverflow.com/users/19307", "pm_score": 2, "selected": false, "text": "System.Diagnostics.Process.Start(\"Local File\");\n" } ]
2008/11/25
[ "https://Stackoverflow.com/questions/316820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13877/" ]
316,831
<p>Can we have a SQL query which will basically help in viewing table and index sizes in SQl Server.</p> <p>How SQL server maintains memory usage for tables/indexes?</p>
[ { "answer_id": 316893, "author": "Ben R", "author_id": 27705, "author_profile": "https://Stackoverflow.com/users/27705", "pm_score": 4, "selected": false, "text": "EXEC sp_MSforeachtable @command1=\"EXEC sp_spaceused '?'\"\n" }, { "answer_id": 316895, "author": "ConcernedOfTu...
2008/11/25
[ "https://Stackoverflow.com/questions/316831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34058/" ]
316,835
<p>I got this page, and have some problems with ie &lt; 7 and opera 7.11</p> <p><a href="http://browsershots.org/png/original/c5/c5bac9b3838ba30cfebae2f03f896548.png" rel="nofollow noreferrer">This</a> is what i hoped to be the layout in all browsers, and these are the IE ones instead: <a href="http://browsershots.org/screenshots/97347e42778e88203c896cc3f30134bd/" rel="nofollow noreferrer">ie 5.5</a> and <a href="http://browsershots.org/screenshots/b53d6391290363ea1e7ada0e77bdca20/" rel="nofollow noreferrer">ie 6.0</a>.</p> <p>the xhtml is quite simple:</p> <pre><code>print "&lt;div id=\"page\"&gt; &lt;div id=\"header\"&gt; &lt;ul id=\"nav\"&gt; &lt;li&gt;&lt;a href=\"/\" class=\"first\"&gt;Címlap&lt;div&gt;Az oldal címlapja&lt;/div&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href=\"/blog\"&gt;Blogok&lt;div&gt;Minden bejegyzés&lt;/div&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href=\"/friss\"&gt;Friss tartalom&lt;div&gt;Aktuális témák&lt;/div&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;!-- header --&gt; &lt;div id=\"main\"&gt;&lt;div id=\"main-in\"&gt; &lt;div id=\"right\"&gt;"; do_boxes(); print " &lt;/div&gt; &lt;!-- right --&gt; &lt;div id=\"left\"&gt;"; do_content(); print"&lt;/div&gt; &lt;!-- left --&gt; &lt;/div&gt;&lt;/div&gt;&lt;!-- main --&gt; &lt;/div&gt;"; </code></pre> <p>Where a the content made from posts and a post looks like: </p> <pre><code> &lt;div class="post"&gt; &lt;h2&gt;&lt;a href="/blog/2/252/newcastleben-betiltottak-a-ketreces-tojast"&gt;Newcastleben betiltották a ketreces tojást&lt;/a&gt;&lt;/h2&gt; &lt;div class="author"&gt;warnew | 2008. october 16. 20:26 &lt;/div&gt; &lt;p&gt;Az angliai Newcastle Városi Tanácsa kitiltotta a ketreces baromfitartásból származó tojásokat az iskolai étkeztetésből, személyzeti éttermekből, rendezvényekről es a "hospitality outletekből".&lt;/p&gt; &lt;p&gt;A ketreces csirke- és pulykahúst még nem tiltották be, de vizsgálják a kérdést, ahogy a &lt;a href="http://en.wikipedia.org/wiki/Halal"&gt;Halal&lt;/a&gt; hús és a ketreces tojásból készült sütemények és tésztafélék tiltását is.&lt;/p&gt; &lt;ul class="postnav"&gt; &lt;li&gt;&lt;a href="/blog/2/252/newcastleben-betiltottak-a-ketreces-tojast%7D"&gt;Tovább&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/blog/2/252/newcastleben-betiltottak-a-ketreces-tojast#comments"&gt;Hozzászólások (0)&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;!-- post --&gt; </code></pre> <p>and a box is like this: </p> <pre><code>&lt;div id="ownadbox" class="box"&gt; &lt;h5&gt;Viridis matrica&lt;/h5&gt; &lt;a href="http://viridis.hu/blog/2/172/nepszerusits-minket" title="Népszerűsíts minket"&gt;&lt;img src="http://viridis.hu/files/viridis_matrica_jobb.png" alt="viridis matrica"/&gt;&lt;/a&gt; &lt;/div&gt; </code></pre> <p>The -what i think is - relevan css:</p> <pre><code>body { background : transparent url(/images/design/background.png) repeat; } #page { margin : 0px auto; width : 994px; background : transparent url(/images/design/header.jpg) no-repeat top left; } div#header { width : 746px; margin : 0px auto; } div#header ul#nav { padding-top : 170px; margin-left : 3px; margin-right : 3px; border-bottom : #896e51 solid 7px; overflow : hidden; } div#header ul#nav li { display : block; float : left; width : 120px; margin-bottom : 7px; } div#main { width : 746px; margin : 0px auto; } div#main div#main-in { padding : 30px 20px; background : transparent url(/images/design/content-background.png) repeat-y top left; overflow : hidden; } div#main div#main-in div#left { width : 460px; overflow : hidden; float : left; } div#main div#main-in div#left div.post { clear : left; margin-bottom : 35px; } div#main div#main-in div#right { width : 215px; float : right; } div#main div#main-in div#right div.box { margin-bottom : 30px; clear : both; } </code></pre> <p>The live version is <a href="http://viridis.hu/index3.php" rel="nofollow noreferrer">here</a>, but after I got it fixed it's gona move - thats the reason behind the long codes in the post.</p>
[ { "answer_id": 316901, "author": "jalf", "author_id": 33213, "author_profile": "https://Stackoverflow.com/users/33213", "pm_score": 3, "selected": false, "text": "<!--[if lt IE 7]><script src=\"http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE7.js\" type=\"text/javascript\"></script...
2008/11/25
[ "https://Stackoverflow.com/questions/316835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/553923/" ]
316,837
<p>I'm recoding an old site that contains a chart similar to this:</p> <p><a href="http://dl.getdropbox.com/u/240752/rental-chart.gif" rel="nofollow noreferrer">alt text http://dl.getdropbox.com/u/240752/rental-chart.gif</a></p> <p>How would this chart be represented with pure HTML? I'm loathed to just include it as an image.</p> <p>I'm thinking a table, just replaced with an image, or perhaps overlaid with absolutely positioned table rows, but I think that may be a bit fragile.</p> <p>Any suggestions welcomed.</p>
[ { "answer_id": 316877, "author": "Kent Fredric", "author_id": 15614, "author_profile": "https://Stackoverflow.com/users/15614", "pm_score": 2, "selected": false, "text": "<div class=\"chart\">\n <h3>Price for two weeks</h3>\n <div class=\"companies\">\n <div class=\"company_scale\"></di...
2008/11/25
[ "https://Stackoverflow.com/questions/316837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26107/" ]
316,847
<p>How can I access the apache basic-auth username in a PHP script?</p>
[ { "answer_id": 39879024, "author": "William Entriken", "author_id": 300224, "author_profile": "https://Stackoverflow.com/users/300224", "pm_score": 4, "selected": false, "text": "$_SERVER['PHP_AUTH_USER']\n" }, { "answer_id": 65130656, "author": "Alexandar Penkin", "autho...
2008/11/25
[ "https://Stackoverflow.com/questions/316847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11522/" ]
316,855
<p>I have the following string:</p> <pre><code>&lt;SEM&gt;electric&lt;/SEM&gt; cu &lt;SEM&gt;hello&lt;/SEM&gt; rent &lt;SEM&gt;is&lt;I&gt;love&lt;/I&gt;, &lt;PARTITION /&gt;mind </code></pre> <p>I want to find the last "SEM" start tag before the "PARTITION" tag. not the SEM end tag but the start tag. The result should be:</p> <pre><code>&lt;SEM&gt;is &lt;Im&gt;love&lt;/Im&gt;, &lt;PARTITION /&gt; </code></pre> <p>I have tried this regular expression:</p> <pre><code>&lt;SEM&gt;[^&lt;]*&lt;PARTITION[ ]/&gt; </code></pre> <p>but it only works if the final "SEM" and "PARTITION" tags do not have any other tag between them. Any ideas?</p>
[ { "answer_id": 316869, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 0, "selected": false, "text": "<EM>.*<PARTITION\\s*/>\n" }, { "answer_id": 316872, "author": "Jon Skeet", "author_id": 22656, "au...
2008/11/25
[ "https://Stackoverflow.com/questions/316855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40570/" ]
316,864
<p>is it possible to develop DLL for both win32 console and MFC GUI. If yes please explain.</p> <p>What i want to do is to create dll that contains certain API's for both win32 console and MFC GUI.</p>
[ { "answer_id": 316887, "author": "John Sibly", "author_id": 1078, "author_profile": "https://Stackoverflow.com/users/1078", "pm_score": 3, "selected": true, "text": "#ifdef TEST_EXPORTS\n#define TEST_API __declspec(dllexport)\n#else\n#define TEST_API __declspec(dllimport)\n#endif\n" } ...
2008/11/25
[ "https://Stackoverflow.com/questions/316864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38038/" ]
316,866
<p>How do I ping a website or IP address with Python?</p>
[ { "answer_id": 316974, "author": "dbr", "author_id": 745, "author_profile": "https://Stackoverflow.com/users/745", "pm_score": 6, "selected": false, "text": "import subprocess\n\nhost = \"www.google.com\"\n\nping = subprocess.Popen(\n [\"ping\", \"-c\", \"4\", host],\n stdout = sub...
2008/11/25
[ "https://Stackoverflow.com/questions/316866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40572/" ]
316,879
<p>I have a method in an objective-C class. It has 2 callback functions written in C. The class pointer i.e. <code>self</code> is passed to these functions as <code>void *</code>. In the C functions I create a pointer of type class and assign the <code>void *</code> parameter. The first callback function executes successfully. But the <code>void *</code> pointer becomes <code>nil</code> in the 2nd callback function. Note that I haven't tweaked pointer in the first callback but still I get <code>nil</code> in 2nd callback.</p> <p>Any ideas what might be going wrong?</p> <p>For example:</p> <pre><code>kr = IOServiceAddMatchingNotification(gNotifyPort, kIOFirstMatchNotification, matchingDict, RawDeviceAdded, NULL, &amp;gRawAddedIter); RawDeviceAdded(NULL, gRawAddedIter, self); </code></pre> <p>This works fine. But below function receives <code>self</code> as <code>nil</code>.</p> <pre><code>kr = IOServiceAddMatchingNotification(gNotifyPort, kIOFirstMatchNotification, matchingDict, BulkTestDeviceAdded, NULL, &amp;gBulkTestAddedIter); BulkTestDeviceAdded(NULL, gBulkTestAddedIter, self); </code></pre>
[ { "answer_id": 316947, "author": "Chris Hanson", "author_id": 714, "author_profile": "https://Stackoverflow.com/users/714", "pm_score": 1, "selected": false, "text": "- (void)logMessage:(NSString *)message\n delegate:(id)delegate\n didLogSelector:(SEL)didLogSelector\n{\n N...
2008/11/25
[ "https://Stackoverflow.com/questions/316879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39270/" ]
316,889
<p>I can't seem to retrieve an ID I'm sending in a html.ActionLink in my controller, here is what I'm trying to do</p> <pre><code>&lt;li&gt; &lt;%= Html.ActionLink(&quot;Modify Villa&quot;, &quot;Modify&quot;, &quot;Villa&quot;, new { @id = &quot;1&quot; })%&gt;&lt;/li&gt; public ActionResult Modify(string ID) { ViewData[&quot;Title&quot;] =ID; return View(); } </code></pre> <p>That's what a tutorial I followed recommended, but it's not working, it's also putting ?Length=5 at the end of the URL!</p> <p>Here is the route I'm using, it's default</p> <pre><code> routes.MapRoute( &quot;Default&quot;, // Route name &quot;{controller}/{action}/{id}&quot;, // URL with parameters new { controller = &quot;Home&quot;, action = &quot;Index&quot;, id = &quot;&quot; } // Parameter defaults ); </code></pre>
[ { "answer_id": 316970, "author": "Davide Vosti", "author_id": 1812, "author_profile": "https://Stackoverflow.com/users/1812", "pm_score": 4, "selected": false, "text": "new { id = \"1\" }\n" }, { "answer_id": 316996, "author": "AnthonyWJones", "author_id": 17516, "aut...
2008/11/25
[ "https://Stackoverflow.com/questions/316889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29445/" ]
316,899
<p>I want to change the behavior of a JavaScript used to display a banner, coming from a central source.</p> <p>Today I include a script-tag inline in code, like this:</p> <pre><code>&lt;script type=&quot;text/javascript&quot; src=&quot;http://banner.com/b?id=1234&quot;&gt;&lt;/script&gt; </code></pre> <p>But what that returns is code which uses <code>document.write</code>, like this:</p> <pre><code>if(condition) { document.write('&lt;a href=&quot;...&quot;&gt;&lt;img src=&quot;...&quot; /&gt;&lt;/a&gt;') } </code></pre> <p>I want to somehow override this <code>document.write</code> and maybe evaluate the returned code and instead use a JavaScript-framework to bind code to a div-element at DOM ready.</p> <p>Is there a way to do that? Something like this?:</p> <pre><code>OnDOMReady() { BindBanner(1234); } BindBanner(bannerId) { var divTag = document.getElementById('banner_' + bannerId); divTag.innerHtml = ManipulatedReturenedCode(bannerId); } </code></pre> <p>Can JavaScript's prototyping handle something like this?</p> <p><strong>Edit</strong>: It has to be somewhat waterproof cross-platform, cross-browser-compatible, so I don't know if changing <code>document.write</code> is ok.</p>
[ { "answer_id": 316906, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 1, "selected": false, "text": "var foo = document.write;\nvar bannerCode = '';\ndocument.write = function(str) { bannerCode += str; };\n" }, { "answ...
2008/11/25
[ "https://Stackoverflow.com/questions/316899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2429/" ]
316,900
<p>I'm working on a windows client written in WPF with C# on .Net 3.5 Sp1, where a requirement is that data from emails received by clients can be stored in the database. Right now the easiest way to handle this is to copy and paste the text, subject, contact information and time received manually using an arthritis-inducing amount of ctrl-c/ctrl-v.</p> <p>I thought that a simple way to handle this would be to allow the user to drag one or more emails from Outlook (they are all using Outlook 2007 currently) into the window, allowing my app to extract the necessary information and send it to the backend system for storage.</p> <p>However, a few hours googling for information on this seem to indicate a shocking lack of information about this seemingly basic task. I would think that something like this would be useful in a lot of different settings, but all I've been able to find so far have been half-baked non-solutions. </p> <p>Does anyone have any advice on how to do this? Since I am just going to read the mails and not send anything out or do anything evil, it would be nice with a solution that didn't involve the hated security pop ups, but anything beats not being able to do it at all.</p> <p>Basically, if I could get a list of all the mail items that were selected, dragged and dropped from Outlook, I will be able to handle the rest myself!</p> <p>Thanks!</p> <p>Rune</p>
[ { "answer_id": 318045, "author": "cgreeno", "author_id": 6088, "author_profile": "https://Stackoverflow.com/users/6088", "pm_score": 2, "selected": false, "text": "<TextBlock\n Name=\"myTextBlock\" \n Text=\"Drag something into here\"\n AllowDrop=\"True\" \n ...
2008/11/25
[ "https://Stackoverflow.com/questions/316900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2122/" ]
316,903
<p>I need to know if I can create a file in a specific folder, but there are too many things to check such as permissions, duplicate files, etc. I'm looking for something like <code>File.CanCreate(@"C:\myfolder\myfile.aaa"</code>), but haven't found such a method. The only thing I thought is to try to create a dummy file and check for exceptions but this is an ungly solution that also affects performance. Do you know a better solution?</p>
[ { "answer_id": 316913, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 5, "selected": true, "text": "string file = Path.Combine(dir, Guid.NewGuid().ToString() + \".tmp\");\n// perhaps check File.Exists(file), but it wou...
2008/11/25
[ "https://Stackoverflow.com/questions/316903", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30729/" ]
316,911
<p>Aloha</p> <p>I have a method with (pseudo) signature:</p> <pre><code>public static T Parse&lt;T&gt;(string datadictionary) where T : List&lt;U&gt; </code></pre> <p>This doesn't build. How can I restrict the in the method to accept only generic List&lt;> objects (which should of cource not contain T's but something else :)</p> <p>I need to restrict the type of T because I need to call a method on it in this code. The type passed in is a custom collection (based on List).</p> <pre><code>public class MyCollection&lt;T&gt; : List&lt;T&gt; where T: MyClass, new() { public void Foo(); } public static T Parse&lt;T&gt;(string datadictionary) where T : MyCollection&lt;U&gt; { T.Foo(); } </code></pre> <p>-Edoode</p>
[ { "answer_id": 316925, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": true, "text": "public static T Parse<T, U>(string datadictionary) where T : List<U>\n" }, { "answer_id": 316952, "author": "...
2008/11/25
[ "https://Stackoverflow.com/questions/316911", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6399/" ]
316,921
<p>i`m currently playing around with WPF and now i wonder what would be the layout for a typical dataentry window (20+ textboxes and stuff).</p> <p>atm i`m using a grid object like this (basic sample)</p> <pre><code> &lt;Grid Margin="2,2,2,2"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="Auto"&gt;&lt;/ColumnDefinition&gt; &lt;ColumnDefinition Width="*"&gt;&lt;/ColumnDefinition&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Grid.RowDefinitions &gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;/Grid.RowDefinitions&gt; &lt;Label Grid.Row="0" Grid.Column="0"&gt;Vorname:&lt;/Label&gt; &lt;TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=Surname, UpdateSourceTrigger=PropertyChanged}" &gt;&lt;/TextBox&gt; &lt;Label Grid.Row="1" Grid.Column="0"&gt;Nachname:&lt;/Label&gt; &lt;TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=ChristianName, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/TextBox&gt; &lt;Label Grid.Row="2" Grid.Column="0"&gt;Strasse (Wohnsitz):&lt;/Label&gt; &lt;TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Path=Street1, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/TextBox&gt; &lt;Label Grid.Row="3" Grid.Column="0"&gt;Ort (Wohnsitz):&lt;/Label&gt; &lt;TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Path=Town1, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/TextBox&gt; &lt;Label Grid.Row="4" Grid.Column="0"&gt;Postleitzahl (Wohnsitz):&lt;/Label&gt; &lt;TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Path=PostalCode1, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/TextBox&gt; &lt;Label Grid.Row="5" Grid.Column="0"&gt;Bundesland (Wohnsitz):&lt;/Label&gt; &lt;TextBox Grid.Row="5" Grid.Column="1" Text="{Binding Path=State1, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/TextBox&gt; &lt;Label Grid.Row="6" Grid.Column="0"&gt;Land (Wohnsitz):&lt;/Label&gt; &lt;TextBox Grid.Row="6" Grid.Column="1" Text="{Binding Path=Country1, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/TextBox&gt; &lt;Label Grid.Row="7" Grid.Column="0"&gt;Zusatz (Wohnsitz):&lt;/Label&gt; &lt;TextBox Grid.Row="7" Grid.Column="1" Text="{Binding Path=AdditionalAdrInfo1, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/TextBox&gt; &lt;/Grid&gt; </code></pre> <p>basically this satisfies all my layout needs, but what if i wish to change something, like adding a new textbox in row 3?</p> <p>currently i have to change every single Grid.Row property greater then 3, but that cant be the intended WPF way!? </p> <p>how do others layout complex dataentry windows?</p> <p>tia</p>
[ { "answer_id": 316948, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 2, "selected": false, "text": "StackPanel" } ]
2008/11/25
[ "https://Stackoverflow.com/questions/316921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12406/" ]
316,924
<p>If you have a route:</p> <pre><code>routes.MapRoute("search", "{controller}/{action}/{filter1}/{filter2}/{filter3}", _ New With {.filter1 = "", .filter2 = "", .filter3 = ""}) </code></pre> <p>then in a view satisfied by the route pattern with a url of <code>/member/search/dev/phil/hoy</code>, when you attempt to create another route url with only <code>filter1</code> present i.e.</p> <pre><code>&lt;%=Url.RouteUrl(New RouteValueDictionary( New With {.controller="member",.action="search", .filter1="dev"}))%&gt; </code></pre> <p>the result is the current route <code>/member/search/dev/phil/hoy</code>, not the expected trimmed route <code>/member/search/dev</code> </p> <p>I have managed to work round the issue by using <code>RouteTable.Routes.GetVirtualPath</code> method directly, but does anyone know why it works this way or is it perhaps a bug?</p>
[ { "answer_id": 316948, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 2, "selected": false, "text": "StackPanel" } ]
2008/11/25
[ "https://Stackoverflow.com/questions/316924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29547/" ]
316,931
<ul> <li>I autoformat a GridView in ASP.NET.</li> <li><p>It looks nice but the headers all run together like this:</p> <p><strong>idfirstNamelastNameage</strong></p></li> <li><p>I set CellPadding="5" but it does nothing.</p></li> </ul> <p>How can I set the cell padding of the headers and all cells?</p> <p>A D D E N D U M :</p> <p>Thanks Andrew, I fixed it with this. Works in Firefox and Explorer 7:</p> <pre><code>.gridview2 tr td { padding: 5px; border: 1px solid #ddd; } .gridview2 tr th { padding: 5px; } </code></pre>
[ { "answer_id": 316955, "author": "Andrew Bullock", "author_id": 28543, "author_profile": "https://Stackoverflow.com/users/28543", "pm_score": 5, "selected": true, "text": ".myTableClass tr th {\n padding: 5px;\n}\n" }, { "answer_id": 11330757, "author": "jumxozizi", "a...
2008/11/25
[ "https://Stackoverflow.com/questions/316931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
316,940
<p>I'm looking for a generic method to implement a wait screen during long operations. I have used threading a few times before, but I have the feeling that I implemented it either very poorly, or with way too much hassle (and copy/pasting - the horror!).</p> <p>I want to keep this as generic and simple as possible, so I won't have to implement loads of <code>BackgroundWorker</code>s handling all kinds of crap, making things hard to maintain.</p> <p>Here's what I would like to do -- please note this might differ from what's actually possible/best practise/whatever -- using VB.NET, Framework 2.0 (so no anonymous methods):</p> <pre><code> Private Sub HandleBtnClick(sender as Object, e as EventArgs) Handles Button.Click LoadingScreen.Show() 'Do stuff here, this takes a while!' Dim Result as Object = DoSomethingTakingALongTime(SomeControl.SelectedObject) LoadingScreen.Hide() ProcessResults(Result) End Sub </code></pre> <p>The application is now completely single-threaded, so everything runs on the GUI thread. I need to be able to access objects in <code>DoSomethingTakingALongTime()</code> without getting cross-thread exceptions. The GUI thread waits for some method (which takes a long time) to complete, while the <code>LoadingScreen</code> Form should stay responsive (it's animated/has a progressbar/etc.).</p> <p>Is this a doable/good approach or am I seeing this way too simplistic? What is the best practise concerning this matter? And most importantly: how could I implement such a system? As I already mentioned, I have very little experience with threading, so be gentle please :-)</p>
[ { "answer_id": 330806, "author": "Hath", "author_id": 5186, "author_profile": "https://Stackoverflow.com/users/5186", "pm_score": 3, "selected": true, "text": "Private Sub work_CrossThreadEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles work.CrossThreadEvent\n\n I...
2008/11/25
[ "https://Stackoverflow.com/questions/316940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39259/" ]
316,965
<p>I can only think of Peek() and ReadNoAdvance() atm, but I wonder if there are better or standard options.</p> <p>Thanks.</p>
[ { "answer_id": 5839282, "author": "hippietrail", "author_id": 527702, "author_profile": "https://Stackoverflow.com/users/527702", "pm_score": 1, "selected": false, "text": "lookahead" } ]
2008/11/25
[ "https://Stackoverflow.com/questions/316965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7839/" ]
316,967
<p>I have need to select a number of 'master' rows from a table, also returning for each result a number of detail rows from another table. What is a good way of achieving this without multiple queries (one for the master rows and one per result to get the detail rows).</p> <p>For example, with a database structure like below:</p> <pre><code>MasterTable: - MasterId BIGINT - Name NVARCHAR(100) DetailTable: - DetailId BIGINT - MasterId BIGINT - Amount MONEY </code></pre> <p>How would I most efficiently populate the <code>data</code> object below?</p> <pre><code>IList&lt;MasterDetail&gt; data; public class Master { private readonly List&lt;Detail&gt; _details = new List&lt;Detail&gt;(); public long MasterId { get; set; } public string Name { get; set; } public IList&lt;Detail&gt; Details { get { return _details; } } } public class Detail { public long DetailId { get; set; } public decimal Amount { get; set; } } </code></pre>
[ { "answer_id": 317041, "author": "Wolfwyrd", "author_id": 15570, "author_profile": "https://Stackoverflow.com/users/15570", "pm_score": 0, "selected": false, "text": "List<Master> allMasters = GetAllMasters();\nList<Detail> allDetail = getAllDetail();\n\nforeach (Master m in allMasters)\...
2008/11/25
[ "https://Stackoverflow.com/questions/316967", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4048/" ]
316,978
<p>I have a bunch of rows in Excel that I want to paste into a new table in MS SQL. Is there a simple way ?</p>
[ { "answer_id": 317003, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 6, "selected": true, "text": "=\"insert into tblyourtablename (yourkeyID_pk, intmine, strval) values (\"&A4&\", \"&B4&\", N'\"&C4&\"')\"" }, { "a...
2008/11/25
[ "https://Stackoverflow.com/questions/316978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39426/" ]
316,988
<p>I am developing an application and want to display a form that will be filled in if editing the form, but will not be if the form will be a new entry. I believe the least verbose way of doing this is to have just one form and to suppress any errors for echoing my variables so that nothing will be printed if it is a new form (since the variables will not exist if it is a new form). For example:</p> <pre><code>&lt;?php if ( ! $new_item) { $variable = 'Example'; } ?&gt; &lt;form&gt; &lt;input type="text" name="inputbox" value="&lt;?php echo @$variable; ?&gt;" /&gt; &lt;/form&gt; </code></pre> <p>Is this a good practice, or is there a better way of doing it? Should I make separate views for the new items and for the items to be edited? What are the performance repercussions of doing this?</p>
[ { "answer_id": 316993, "author": "Tom Haigh", "author_id": 22224, "author_profile": "https://Stackoverflow.com/users/22224", "pm_score": 1, "selected": false, "text": "if ( ! $new_item) {\n $variable = 'Example';\n} else {\n $variable = 'Default value'; \n //or\n $variable = ...
2008/11/25
[ "https://Stackoverflow.com/questions/316988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3831/" ]
317,001
<p>What are the other ways of achieving auto-increment in oracle other than use of triggers?</p>
[ { "answer_id": 317116, "author": "angus", "author_id": 36925, "author_profile": "https://Stackoverflow.com/users/36925", "pm_score": 4, "selected": false, "text": "CREATE TABLE xxx ( ID RAW(16) DEFAULT SYS_GUID() )\n" }, { "answer_id": 317263, "author": "Tony Andrews", "a...
2008/11/25
[ "https://Stackoverflow.com/questions/317001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40236/" ]
317,002
<p>I have this in my installer and I need to change the name of the ini file.</p> <pre><code>[INI] Filename: {app}\bin\old.ini; Section: Data; Key: key; String: Value; </code></pre> <p>If I just change the filename it will create another ini file and I'll lose the data.</p> <p>Is there some easy way to rename this ini file in the installer?</p>
[ { "answer_id": 331310, "author": "Fabio Gomes", "author_id": 727, "author_profile": "https://Stackoverflow.com/users/727", "pm_score": 2, "selected": true, "text": "procedure CurStepChanged(CurStep: TSetupStep);\nvar\n OldFile: string;\nbegin\n if CurStep = ssInstall then\n begin\n ...
2008/11/25
[ "https://Stackoverflow.com/questions/317002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/727/" ]
317,005
<p>In my routing I would like to have something like not found route handler. </p> <p>For example I have created one mapping like</p> <pre><code>routes.MapRoute( "default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id="" } ); routes.MapRoute( "Catchall", "{*catchall}", new { controller = "Home", action = "Lost" } ); </code></pre> <p>but when user inserts address something like /one/two/three/four/bla/bla it will be cached with the Catchall mapping.</p> <p>But when user inserts something that should match with default mapping, (like /one/two/ ,but this controller or action is not implemented) I would want that Catchall mapping would accept this request, because all other mappings failed. But instead of this I get an error. </p> <p>Should I override some mapping handlers to catch the exception if controller or action getting an exception?</p>
[ { "answer_id": 331310, "author": "Fabio Gomes", "author_id": 727, "author_profile": "https://Stackoverflow.com/users/727", "pm_score": 2, "selected": true, "text": "procedure CurStepChanged(CurStep: TSetupStep);\nvar\n OldFile: string;\nbegin\n if CurStep = ssInstall then\n begin\n ...
2008/11/25
[ "https://Stackoverflow.com/questions/317005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56035/" ]
317,017
<p>How can I validate a SOAP response against an XSD file that defines the response schema. the web service I'm calling has an XMLDocument as input and output, so can't use WSDL for response schema validation.</p>
[ { "answer_id": 29982101, "author": "geek_sandeep", "author_id": 2596815, "author_profile": "https://Stackoverflow.com/users/2596815", "pm_score": 0, "selected": false, "text": "import javax.xml.transform.stream.StreamSource;\nimport javax.xml.validation.SchemaFactory;\nimport javax.xml.X...
2008/11/25
[ "https://Stackoverflow.com/questions/317017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7722/" ]
317,029
<p>So far i have got the code below which works lovely when trying an update, delete or select statement. However I run into problems when I try to use an insert. If someone could point me in the correct direction i would be grateful.</p> <pre><code>private function escape($value) { if(get_magic_quotes_gpc()) $value = stripslashes($value); return mysql_real_escape_string($value, $this-&gt;dbConn); } /** * Handles connection to the database. * Die functions are used to catch any errors. */ public function connect($dbHost, $dbName, $dbUser, $dbPass) { $this-&gt;dbConn = mysql_connect( $dbHost, $dbUser, $dbPass ) or die(mysql_error()); mysql_select_db($dbName, $this-&gt;dbConn) or die(mysql_error()); } /** * Loads a raw SQL string into the object $dbSql variable */ public function prep($sql) { $this-&gt;dbSql = $sql; } /** * Load bound hooks and values into object variable */ public function bind($hook, $value) { $this-&gt;dbBind[$hook] = $this-&gt;escape($value); } /** * Runs the SQL string in $dbSql object variable */ public function run() { $sql = $this-&gt;dbSql; if(is_array($this-&gt;dbBind)) foreach($this-&gt;dbBind as $hook =&gt; $value) $sql = str_replace($hook, "'" . $value . "'", $sql); $this-&gt;dbQuery = mysql_query($sql) or die(mysql_error()); $this-&gt;dbBind = array(); return $this-&gt;numRows(); } // Load SQL statment into object $MyDB-&gt;prep("INSERT INTO `demo` (`id`, `name`, `score`, `dept`, `date`) VALUES '1','James Kablammo', '1205550', 'Marketing', '$date'"); // Bind a value to our :id hook // Produces: SELECT * FROM demo_table WHERE id = '23' $MyDB-&gt;bind(':id',1); // Run the query $MyDB-&gt;run(); </code></pre>
[ { "answer_id": 317039, "author": "Tim", "author_id": 33914, "author_profile": "https://Stackoverflow.com/users/33914", "pm_score": 1, "selected": false, "text": "$MyDB->prep(\"INSERT INTO `demo` (`id`, `name`, `score`, `dept`, `date`) VALUES ('1','James Kablammo', '1205550', 'Marketing',...
2008/11/25
[ "https://Stackoverflow.com/questions/317029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31677/" ]
317,053
<p>I'm trying to extract the attributes of a anchor tag (<code>&lt;a&gt;</code>). So far I have this expression:</p> <pre><code>(?&lt;name&gt;\b\w+\b)\s*=\s*("(?&lt;value&gt;[^"]*)"|'(?&lt;value&gt;[^']*)'|(?&lt;value&gt;[^"'&lt;&gt; \s]+)\s*)+ </code></pre> <p>which works for strings like</p> <pre><code>&lt;a href="test.html" class="xyz"&gt; </code></pre> <p>and (single quotes)</p> <pre><code>&lt;a href='test.html' class="xyz"&gt; </code></pre> <p>but not for a string without quotes:</p> <pre><code>&lt;a href=test.html class=xyz&gt; </code></pre> <p>How can I modify my regex making it work with attributes without quotes? Or is there a better way to do that?</p> <p><strong>Update:</strong> <em>Thanks for all the good comments and advice so far. There is one thing I didn't mention: I sadly have to patch/modify code not written by me. And there is no time/money to rewrite this stuff from the bottom up.</em></p>
[ { "answer_id": 317069, "author": "Kent Fredric", "author_id": 15614, "author_profile": "https://Stackoverflow.com/users/15614", "pm_score": 4, "selected": false, "text": "my $foo = Someclass->parse( $xmlstring ); \nmy @links = $foo->getChildrenByTagName(\"a\"); \nmy @srcs = map { $_->ge...
2008/11/25
[ "https://Stackoverflow.com/questions/317053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6461/" ]
317,070
<p>For the purposes of tracking non-HTML documents via google analytics, I need the mentioned algorithm. It should:</p> <ul><li>not hard-code the domain</li> <li>ignore the protocol (i.e. http/https)</li> <li>not worry about the presence/absence of "www" (any absolute links WILL prefix with "www" and all pages WILL be served via "www")</li></ul> <p>This is complicated by the fact that I need to access it via a function called from the IE-only 'attachEvent'.</p> <p><strong>UPDATE</strong> Sorry, I've worded this question <em>really</em> badly. The real problem is getting this to work via an event, since IE has its own made-up world of event handling. Take the following:</p> <pre><code>function add_event(obj) { if (obj.addEventListener) obj.addEventListener('click', track_file, true); else if (obj.attachEvent) obj.attachEvent("on" + 'click', track_file); } function track_file(obj) { } </code></pre> <p>It seems as if the "obj" in track_file is not the same across browsers - how can I refer to what was clicked in IE?</p>
[ { "answer_id": 317157, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 2, "selected": false, "text": "$('a.external')\n" }, { "answer_id": 317195, "author": "bobince", "author_id": 18936, "author_profile...
2008/11/25
[ "https://Stackoverflow.com/questions/317070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5058/" ]
317,071
<p>I've seen several of answers about using <a href="http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx" rel="noreferrer">Handle</a> or <a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" rel="noreferrer">Process Monitor</a>, but I would like to be able to find out in my own code (C#) which process is locking a file.</p> <p>I have a nasty feeling that I'm going to have to spelunk around in the win32 API, but if anyone has already done this and can put me on the right track, I'd really appreciate the help.</p> <h2>Update</h2> <h3>Links to similar questions</h3> <ul> <li><a href="https://stackoverflow.com/questions/860656/how-does-one-figure-out-what-process-locked-a-file-using-c">How does one figure out what process locked a file using c#?</a></li> <li><a href="https://stackoverflow.com/questions/241178/command-line-tool-for-finding-out-who-is-locking-a-file">Command line tool</a></li> <li><a href="https://stackoverflow.com/questions/208283/is-it-possible-to-programatically-find-out-what-process-is-locking-a-file-acros">Across a Network</a></li> <li><a href="https://stackoverflow.com/questions/23197/find-out-which-process-has-an-exclusive-lock-on-a-usb-device-handle">Locking a USB device</a></li> <li><a href="https://stackoverflow.com/questions/305843/determining-what-process-has-a-lock-on-a-file">Unit test fails with locked file</a></li> <li><a href="https://stackoverflow.com/questions/1040/how-do-i-delete-a-file-which-is-locked-by-another-process-in-c">deleting locked file</a></li> </ul>
[ { "answer_id": 317104, "author": "orip", "author_id": 37020, "author_profile": "https://Stackoverflow.com/users/37020", "pm_score": 6, "selected": true, "text": "handle.exe" }, { "answer_id": 317209, "author": "Stefan", "author_id": 19307, "author_profile": "https://S...
2008/11/25
[ "https://Stackoverflow.com/questions/317071", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7211/" ]
317,087
<p>Does anybody know why</p> <pre><code> vector&lt;int&gt; test(10); int a=0; for_each(test.begin(),test.end(),(_1+=var(a),++var(a))); for_each(test.begin(),test.end(),(cout &lt;&lt; _1 &lt;&lt; " ")); cout &lt;&lt; "\n" </code></pre> <p>Gives : "0 1 2 3 4 5 6 7 8 9"</p> <p>but </p> <pre><code> transform(test.begin(),test.end(),test.begin(), (_1+=var(a),++var(a))); ...(as before) </code></pre> <p>Gives : "1 2 3 4 5 6 7 8 9 10"</p> <p>?</p>
[ { "answer_id": 317100, "author": "Pieter", "author_id": 5822, "author_profile": "https://Stackoverflow.com/users/5822", "pm_score": 4, "selected": true, "text": "_1+=var(a), ++var(a)\n" }, { "answer_id": 317138, "author": "xtofl", "author_id": 6610, "author_profile": ...
2008/11/25
[ "https://Stackoverflow.com/questions/317087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24508/" ]
317,089
<p>I have a table which consists of 200 Companies Stock prices for 5 years. This is one large table which consists of Company Name, Stock Open, High, Low, Close, Date</p> <p>I am now required to do some processing on the same and also let users [up to 10] access this database to fetch reports on different sets of parameters and queries.</p> <p>Should I use the database as it is or do you have any suggestion to make it more optimized.</p> <p>Thanks.</p>
[ { "answer_id": 317178, "author": "Henrik Gustafsson", "author_id": 2010, "author_profile": "https://Stackoverflow.com/users/2010", "pm_score": 0, "selected": false, "text": "CREATE TABLE company (\n id INTEGER PRIMARY KEY, -- Well, this would be a serial, but that works different in dif...
2008/11/25
[ "https://Stackoverflow.com/questions/317089", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32289/" ]
317,095
<p>As the question says, how do I add a new option to a DropDownList using jQuery?</p> <p>Thanks</p>
[ { "answer_id": 317101, "author": "cgreeno", "author_id": 6088, "author_profile": "https://Stackoverflow.com/users/6088", "pm_score": 4, "selected": false, "text": "var myOptions = {\n \"Value 1\" : \"Text 1\",\n \"Value 2\" : \"Text 2\",\n \"Value 3\" : \"Text 3\"\n ...
2008/11/25
[ "https://Stackoverflow.com/questions/317095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27805/" ]
317,114
<p>In my application I have several DataContexts that connects to different databases with different schemas. In a custom user control I display the results of the query and let the user edit them, and when the user edits the data I want to persist the changes to the database. To do that I need a reference to the source DataContext (or at least the source datacontext type) so I can do a <code>DataContext.SubmitChanges();</code></p> <p>Is there any way to determine which DataContext a query comes from? The DataQuery class itself is marked as internal, so I can't access its context property without resorting to ugly reflection hacks, so I'm looking for a cleaner approach. </p> <p>There are (several) ways around this problem, passing along a reference to the source DataContext for instance, but I imagine there must be a simpler way to do this. </p> <p>Edit: The following code works, but it's ugly:</p> <pre><code>FieldInfo contextField = query.GetType().GetField("context", BindingFlags.Instance | BindingFlags.NonPublic); if (query != null) { queryContext = contextField.GetValue(value) as DataContext; } </code></pre>
[ { "answer_id": 986122, "author": "Mark", "author_id": 64084, "author_profile": "https://Stackoverflow.com/users/64084", "pm_score": 2, "selected": false, "text": "Private Const StandardChangeTrackerName As String = \"System.Data.Linq.ChangeTracker+StandardChangeTracker\"\n\nPrivate _cont...
2008/11/25
[ "https://Stackoverflow.com/questions/317114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30366/" ]
317,127
<p>How to set the CVSROOT environment variable in WinCVS?</p>
[ { "answer_id": 317555, "author": "Oliver Giesen", "author_id": 9784, "author_profile": "https://Stackoverflow.com/users/9784", "pm_score": 4, "selected": true, "text": "CVSROOT" } ]
2008/11/25
[ "https://Stackoverflow.com/questions/317127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40236/" ]
317,134
<p>There seem to be many options to create an XML document in .NET. What's the best approach?</p>
[ { "answer_id": 317137, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "&" }, { "answer_id": 317159, "author": "Serge Wautier", "author_id": 12379, "author_profile": "https...
2008/11/25
[ "https://Stackoverflow.com/questions/317134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6651/" ]
317,140
<p>I need to get the image dimensions of a JPEG in C++. I'm looking for either a fairly simple way to do it or a smallish library that provides that functionality. I'm working in C++ on OpenVMS, so any external libraries may have to be adapted to compile on our systems - so please don't post me links to big, closed source libraries!</p> <p>Has anyone come across anything that might do the trick, or understand the JPEG file format (I think I probably mean the JFIF file format here) to tell me how I might go about rolling my own solution?</p>
[ { "answer_id": 317145, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 5, "selected": true, "text": "boost::gil::jpeg_read_dimensions (const char *filename)\n" }, { "answer_id": 2101460, "author": "mloskot", "auth...
2008/11/25
[ "https://Stackoverflow.com/questions/317140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20972/" ]
317,154
<p>I have a legacy database and I am trying to create a NHibernate DAL. I have a problem with a mapping on Many-To-Many table.</p> <p>The Database tables:</p> <ul> <li><code>studio_Subscribers</code></li> <li><code>studio_Groups</code> (contains a IList of Subscribers)</li> <li><code>studio_Subscribers_Groups</code> - Many-To-Many table with primary keys</li> </ul> <p>The problem is when I create a <code>SubscriberGroup</code> instance and fill it with Subscribers they gets saved to the <code>studio_Subscribers</code> table but not to the Many-To-Many table.</p> <p>I cant figure out whats wrong? </p> <p><code>studio_Subscribers</code> table mapping:</p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Meridix.Studio.Common" namespace="Meridix.Studio.Common"&gt; &lt;class name="SubscriberItem" table="studio_Subscribers"&gt; &lt;id name="StorageId" column="Id" unsaved-value="0" access="nosetter.camelcase"&gt; &lt;generator class="identity" /&gt; &lt;/id&gt; &lt;property name="Id" column="DomainId" not-null="true" /&gt; &lt;property name="Subscriber" column="Subscriber" not-null="true" length="50" /&gt; &lt;property name="Description" column="Description" not-null="false" length="100" /&gt; &lt;property name="Type" column="Type" not-null="true" length="40" type="Meridix.Studio.Data.Repositories.EnumStringTypes.SubscriberTypeEst, Meridix.Studio.Data.Repositories" /&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre> <p><code>studio_Groups</code> table mapping:</p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Meridix.Studio.Common" namespace="Meridix.Studio.Common"&gt; &lt;class name="SubscriberGroup" table="studio_Groups"&gt; &lt;id name="StorageId" column="Id" unsaved-value="0" access="nosetter.camelcase"&gt; &lt;generator class="identity" /&gt; &lt;/id&gt; &lt;property name="Id" column="DomainId" not-null="true" /&gt; &lt;property name="Name" column="Name" not-null="true" length="200" /&gt; &lt;property name="Description" column="Description" not-null="false" length="300" /&gt; &lt;bag name="Subscribers" table="studio_Groups_Subscribers" access="nosetter.camelcase"&gt; &lt;key column="GroupId"&gt;&lt;/key&gt; &lt;many-to-many column="SubscriberId" class="SubscriberItem" /&gt; &lt;/bag&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre>
[ { "answer_id": 317200, "author": "jishi", "author_id": 33663, "author_profile": "https://Stackoverflow.com/users/33663", "pm_score": 2, "selected": false, "text": "<bag name=\"Groups\" table=\"studio_Groups_Subscribers\" access=\"nosetter.camelcase\">\n <key column=\"SubscriberId\...
2008/11/25
[ "https://Stackoverflow.com/questions/317154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29906/" ]
317,170
<p>I would like to change all the names of the attributes where <code>class="testingCase"</code> throughout all my whole html document.</p> <p>e.g. Change:</p> <pre><code>&lt;a class="testingCase" href="#" title="name of testing case"&gt;Blabla&lt;/a&gt; &lt;a class="testingCase" href="#" title="name of another testing case"&gt;Bloo&lt;/a&gt; </code></pre> <p>To this: </p> <pre><code>&lt;a class="testingCase" href="#" newTitleName="name of testing case"&gt;Blabla&lt;/a&gt;` &lt;a class="testingCase" href="#" newTitleName="name of another testing case"&gt;Bloo&lt;/a&gt;` </code></pre> <p>I was thinking of a find and replace but that seems a lot of code for something so easy. Is there a jQuery function for this or a simple method?</p>
[ { "answer_id": 317179, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 6, "selected": false, "text": "$('a.testingCase[title]').each(function() {\n var $t = $(this);\n $t.attr({\n newTitleName: $t.attr('title')\n })\n ...
2008/11/25
[ "https://Stackoverflow.com/questions/317170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
317,175
<p>On Apache/PHP sites if I want to put a senstive file within my website folders, I put a .htaccess file in that folder so users can't download the sensitive file.</p> <p><strong>Is there a similar practice for IIS/ASP.NET sites</strong>, i.e. if I have a shared hosting account and don't have access to IIS server. Can I do this in web.config for instance?</p> <p>e.g. the ASPNETDB.MDF file that ASP.NET Configuration put in the App_Data directory. I would assume this is protected by default but where can I change the settings for this folder as I could with a .htaccess file?</p>
[ { "answer_id": 317662, "author": "JamesEggers", "author_id": 28540, "author_profile": "https://Stackoverflow.com/users/28540", "pm_score": 4, "selected": true, "text": "<location path=\"Secret\" allowOverride=\"false\">\n <system.web>\n <authorization>\n <deny users=\"*\" />\n ...
2008/11/25
[ "https://Stackoverflow.com/questions/317175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
317,176
<p>I am looking for any tool which will allow the performance testing/tuning of Sybase nested stored procedures. There are many tools around and of course Sybase's own for performance tuning and testing SQL but none of these can handle nested stored procedures (i.e. a stored proc calling another stored proc). Does anyone have/know of such a tool?</p>
[ { "answer_id": 317662, "author": "JamesEggers", "author_id": 28540, "author_profile": "https://Stackoverflow.com/users/28540", "pm_score": 4, "selected": true, "text": "<location path=\"Secret\" allowOverride=\"false\">\n <system.web>\n <authorization>\n <deny users=\"*\" />\n ...
2008/11/25
[ "https://Stackoverflow.com/questions/317176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
317,184
<p>I'd like to know when i should and shouldn't be wrapping things in a USING block.</p> <p>From what I understand, the compiler translates it into a try/finally, where the finally calls Dispose() on the object.</p> <p>I always use a USING around database connections and file access, but its more out of habit rather than a 100% understanding. I know you should explicity (or with a using) Dispose() objects which control resources, to ensure they are released instantly rather than whenever the CLR feels like it, but thats where my understanding breaks down.</p> <p>Are IDisposables not disposed of when they go out of scope?</p> <p>Do I only need to use a USING when my object makes use of Dispose to tidy itself up?</p> <p>Thanks</p> <p>Edit: I know there are a couple of other posts on the USING keyword, but I'm more interested in answers relating the the CLR and exactly whats going on internally</p> <p>Andrew</p>
[ { "answer_id": 317201, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 6, "selected": true, "text": "IDisposable" }, { "answer_id": 317240, "author": "babbageclunk", "author_id": 38851, "author_profi...
2008/11/25
[ "https://Stackoverflow.com/questions/317184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28543/" ]
317,194
<p>On some websites or forums I usually go to, entries that I havn't read yet are marked as "new". I would like to implement this feature on a website I have developed (with news being posted from time to time) -- php/mySQL. How is this usually done ? Does it require using a cookie remembering the last visit date/time ? Or the last viewed posts/urls ? How can I identify the users ?</p>
[ { "answer_id": 317264, "author": "seanyboy", "author_id": 1726, "author_profile": "https://Stackoverflow.com/users/1726", "pm_score": 0, "selected": false, "text": "function drawPage\n if (isLoggedIn) \n get dbUser from database\n lastUserDateTime = dbUser.LastCommentTim...
2008/11/25
[ "https://Stackoverflow.com/questions/317194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39474/" ]
317,198
<p>I mainly use the MySQL GUI tools. This allows me to easily see the results in a table as well as to quick edits and bookmark frequently run queries. This suits my needs far better than the command line.</p> <p>I remember when I used to do this on Oracle DBs years ago I could put variables in the query itself, so that when running the query I got prompted for the variable.</p> <p>e.g.</p> <pre><code>select email from users where login = [VAR] </code></pre> <p>And when you run the query the system prompts you for VAR and you can type in <code>john_smith14</code> and it executes the query. This is really useful for adhoc queries which you run a lot.</p> <p>Yes I know using shell scripts and the command line this could be done more easily, but for several reasons aside from this, shell scripts are not a good solution for me.</p>
[ { "answer_id": 317210, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 0, "selected": false, "text": "SET @myVar='john_smith14';\nSELECT email FROM users WHERE login = @myVar;\n" }, { "answer_id": 317226, "author": "...
2008/11/25
[ "https://Stackoverflow.com/questions/317198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11660/" ]
317,225
<pre><code> &lt;form action="/Villa/Add" method="post"&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; Name: &lt;/td&gt; &lt;td&gt; &lt;%= Html.TextBox("name") %&gt; &lt;%= Html.ValidationMessage("Name") %&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;/td&gt; &lt;td&gt; &lt;input type="submit" value="Add" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>My form is above, how do I retrieve the values in my controller?</p> <p>Thanks a lot in advance! Hard to find the right material because of different Previews of MVC being released and being different.</p>
[ { "answer_id": 317236, "author": "Jeff Sheldon", "author_id": 33910, "author_profile": "https://Stackoverflow.com/users/33910", "pm_score": 3, "selected": false, "text": "public class VillaController : Controller \n{\n public ActionResult Add(string name)\n {\n // Code...
2008/11/25
[ "https://Stackoverflow.com/questions/317225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29445/" ]
317,259
<p>I am using NetBeans for PHP 6.5.</p> <p>In my code I frequently use the following type of command:</p> <pre><code>if (($row = $db-&gt;get_row($sql))) { return $row-&gt;folder; } else { return FALSE; } </code></pre> <p>Netbeans tells me that I should not be using assignments in the IF statement.</p> <p>Why ?</p>
[ { "answer_id": 317268, "author": "Tom Ritter", "author_id": 8435, "author_profile": "https://Stackoverflow.com/users/8435", "pm_score": 3, "selected": false, "text": "if(a = b)\n //logic error\n" }, { "answer_id": 317272, "author": "Toon Krijthe", "author_id": 18061, ...
2008/11/25
[ "https://Stackoverflow.com/questions/317259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2725/" ]
317,279
<p>I'm currently having a problem with a ShoppingCart for my customer.</p> <p>He wants to be able to add Text between the CartItems so I was wondering if there is some way to still only have one List.</p> <p>My solution would be to have two lists, one of type IList that gets iterated over when calculating Weight and overall Price of the Cart while having another IList that only exposes the necessary fields for displaying it in the ListView and that is a SuperType of CartItem. (But how do I then access additional fields for the listView, defaulting weight and price to 0 in the Description-Text-Class would break LSP).</p> <p>But having two lists somehow feels a bit odd (and still gives me problems), so I was wondering if I could do some sort of a TypedList where I specify the Type of each item.</p> <p>Any suggestions are welcome, I'm not really happy with both options.</p>
[ { "answer_id": 317293, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 5, "selected": true, "text": " ICartListItem\n" }, { "answer_id": 12401533, "author": "Sid", "author_id": 1667881, "author_profile": "h...
2008/11/25
[ "https://Stackoverflow.com/questions/317279", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21699/" ]
317,281
<p>I have this query in LINQ to Entities.</p> <pre><code> var query = (from s in db.ForumStatsSet where s.LogDate &gt;= date1 &amp;&amp; s.LogDate &lt;= date2 group s by new { s.Topic.topicID, s.Topic.subject, s.Topic.Forum.forumName, s.Topic.datum, s.Topic.Forum.ForumGroup.name, s.Topic.Forum.forumID } into g orderby g.Count() descending select new TopicStatsData { TopicId = g.Key.topicID, Count = g.Count(), Subject = g.Key.subject, ForumGroupName = g.Key.name, ForumName = g.Key.forumName, ForumId = g.Key.forumID }); </code></pre> <p>I know it is kind of an "Evil" query but it is only used in a admin interface. But the SQL it generated is absolutely horrifying. Have a look at this baby.</p> <pre><code> exec sp_executesql N'SELECT TOP (50) [Project6].[C1] AS [C1], [Project6].[TopicId] AS [TopicId], [Project6].[C4] AS [C2], [Project6].[subject] AS [subject], [Project6].[name] AS [name], [Project6].[forumName] AS [forumName], [Project6].[C2] AS [C3] FROM ( SELECT [Project5].[TopicId] AS [TopicId], [Project5].[subject] AS [subject], [Project5].[forumName] AS [forumName], [Project5].[name] AS [name], 1 AS [C1], CAST( [Project5].[forumID] AS int) AS [C2], [Project5].[C1] AS [C3], [Project5].[C2] AS [C4] FROM ( SELECT [Project4].[TopicId] AS [TopicId], [Project4].[forumID] AS [forumID], [Project4].[subject] AS [subject], [Project4].[forumName] AS [forumName], [Project4].[name] AS [name], [Project4].[C1] AS [C1], (SELECT COUNT(cast(1 as bit)) AS [A1] FROM [dbo].[tForumStats] AS [Extent14] LEFT OUTER JOIN [dbo].[tTopic] AS [Extent15] ON [Extent14].[TopicId] = [Extent15].[topicID] LEFT OUTER JOIN [dbo].[tForum] AS [Extent16] ON [Extent15].[forumID] = [Extent16].[forumID] LEFT OUTER JOIN [dbo].[tForum] AS [Extent17] ON [Extent15].[forumID] = [Extent17].[forumID] LEFT OUTER JOIN [dbo].[tForum] AS [Extent18] ON [Extent15].[forumID] = [Extent18].[forumID] LEFT OUTER JOIN [dbo].[tForumGroup] AS [Extent19] ON [Extent18].[forumGroupID] = [Extent19].[forumGroupID] LEFT OUTER JOIN [dbo].[tForum] AS [Extent20] ON [Extent15].[forumID] = [Extent20].[forumID] LEFT OUTER JOIN [dbo].[tForumGroup] AS [Extent21] ON [Extent20].[forumGroupID] = [Extent21].[forumGroupID] WHERE ([Extent14].[LogDate] >= @p__linq__25) AND ([Extent14].[LogDate] = @p__linq__25) AND ([Extent6].[LogDate] = @p__linq__25) AND ([Extent1].[LogDate] </pre> <p>I do not as anyone to explain that query but it would be great to get some tips on how to optimze the query so that it just do a simple regular join. Something like this works as fine if I write the SQL myself.</p> <pre>SELECT COUNT(*) AS NumberOfViews, s.topicid AS topicId, t.subject AS TopicSubject, g.[name] AS ForumGroupName, f.forumName AS ForumName FROM tForumStats s join tTopic t on s.topicid = t.topicid join tForum f on f.forumid = t.forumid JOIN tForumGroup g ON f.forumGroupID = g.forumGroupID WHERE s.[LogDate] between @date1 AND @date2 group by s.topicid, t.subject, f.Forumname, t.Datum, g.[name] order by count(*) desc </code></pre> <p>Btw, i LOVE this site. Amazing design and usability! Hope it works good to get some help to :)</p>
[ { "answer_id": 317307, "author": "Ali Ersöz", "author_id": 4215, "author_profile": "https://Stackoverflow.com/users/4215", "pm_score": 4, "selected": true, "text": "from s in db.ForumStatsSet\njoin t in db.Topics on t.TopicId == s.TopicId\njoin f in db.Forums on f.ForumId == t.ForumId\nj...
2008/11/25
[ "https://Stackoverflow.com/questions/317281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40609/" ]
317,282
<p>I am trying to build a server control that, depending on a "QuestionTypeId" display either a text box, date picker or Yes-No radio buttons. </p> <p>I have my control displaying how I want it to, but when the submit button is pressed on the form, the text box, date picker or radio buttons that were generated in the RenderContents method are all null.</p> <p>I have attempted to store the generated controls in view state, that stopped them being null, but the user inputs were not being stored.</p> <p>I will post code if it is needed. Just ask.</p>
[ { "answer_id": 317324, "author": "dexter", "author_id": 2703984, "author_profile": "https://Stackoverflow.com/users/2703984", "pm_score": 0, "selected": false, "text": "MyProperty = Request.Form(\"myControl\");\n" }, { "answer_id": 317435, "author": "Yona", "author_id": 4...
2008/11/25
[ "https://Stackoverflow.com/questions/317282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30357/" ]
317,295
<p>Is there any setting using which the iPhone keyboard won't appear for a particular textbox in web page? May be some css kind of setting?</p>
[ { "answer_id": 317321, "author": "JamesEggers", "author_id": 28540, "author_profile": "https://Stackoverflow.com/users/28540", "pm_score": 2, "selected": false, "text": "navigator.userAgent" }, { "answer_id": 4844951, "author": "Gustavo Costa De Oliveira", "author_id": 59...
2008/11/25
[ "https://Stackoverflow.com/questions/317295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/191/" ]
317,302
<p>Which ftp client or which syntax allows easy chmod for sub-directories?</p>
[ { "answer_id": 317314, "author": "Tim", "author_id": 33914, "author_profile": "https://Stackoverflow.com/users/33914", "pm_score": 0, "selected": false, "text": "chmod -R *\n" }, { "answer_id": 317361, "author": "Ken Gentle", "author_id": 8709, "author_profile": "http...
2008/11/25
[ "https://Stackoverflow.com/questions/317302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
317,310
<p>I am a bit new to Perl, but here is what I want to do: </p> <pre><code>my @array2d; while(&lt;FILE&gt;){ push(@array2d[$i], $_); } </code></pre> <p>It doesn't compile since <code>@array2d[$i]</code> is not an array but a scalar value.</p> <p>How should I declare @array2d as an array of array?</p> <p>Of course, I have no idea of how many rows I have.</p>
[ { "answer_id": 317330, "author": "gpojd", "author_id": 28071, "author_profile": "https://Stackoverflow.com/users/28071", "pm_score": 6, "selected": true, "text": "my @array = ();\nforeach my $i ( 0 .. 10 ) {\n foreach my $j ( 0 .. 10 ) {\n push @{ $array[$i] }, $j;\n }\n}\n" }, ...
2008/11/25
[ "https://Stackoverflow.com/questions/317310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38924/" ]
317,311
<p>I have some string s that is locale specific (eg, 0.01 or 0,01). I want to convert this string to a NSDecimalNumber. From the <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/DataFormatting/Articles/dfNumberFormatting10_4.html" rel="noreferrer">examples I've seen thus far on the interwebs</a>, this is accomplished by using an NSNumberFormatter a la:</p> <pre><code>NSString *s = @"0.07"; NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; [formatter setFormatterBehavior:NSNumberFormatterBehavior10_4]; [formatter setGeneratesDecimalNumbers:YES]; NSDecimalNumber *decimalNumber = [formatter numberFromString:s]; NSLog([decimalNumber stringValue]); // prints 0.07000000000000001 </code></pre> <p>I'm using 10.4 mode (in addition to being recommended per the documentation, it is also the only mode available on the iPhone) but indicating to the formatter that I want to generate decimal numbers. Note that I've simplified my example (I'm actually dealing with currency strings). However, I'm obviously doing something wrong for it to return a value that illustrates the imprecision of floating point numbers.</p> <p>What is the correct method to convert a locale specific number string to an NSDecimalNumber?</p> <p>Edit: Note that my example is for simplicity. The question I'm asking also should relate to when you need to take a locale specific currency string and convert it to an NSDecimalNumber. Additionally, this can be expanded to a locale specific percentage string and convert it to a NSDecimalNumber.</p>
[ { "answer_id": 317953, "author": "Boaz Stuller", "author_id": 1464654, "author_profile": "https://Stackoverflow.com/users/1464654", "pm_score": 2, "selected": false, "text": "NSString *s = @\"0.07\";\n\nNSScanner* scanner = [NSScanner localizedScannerWithString:s];\nNSDecimal decimal;\n[...
2008/11/25
[ "https://Stackoverflow.com/questions/317311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40618/" ]
317,315
<p>In my applications, I often have to use relative paths. For example, when I reference JQuery, I usually do so like this:</p> <pre><code>&lt;script type="text/javascript" src="../Scripts/jquery-1.2.6.js"&gt;&lt;/script&gt; </code></pre> <p>Now that I'm making the transition to MVC, I need to account for the different paths a page might have, relative to the root. This was of course an issue with URL rewriting in the past, but I managed to work around it by using consistent paths.</p> <p>I'm aware that the standard solution is to use absolute paths such as:</p> <pre><code>&lt;script type="text/javascript" src="/Scripts/jquery-1.2.6.js"&gt;&lt;/script&gt; </code></pre> <p>but this will not work for me as during the development cycle, I have to deploy to a test machine on which the app will run in a virtual directory. Root relative paths don't work when the root changes. Also, for maintenance reasons, I cannot simply change out all the paths for the duration of deploying the test - that would be a nightmare in itself.</p> <p>So what's the best solution?</p> <p>Edit:</p> <p>Since this question is still receiving views and answers, I thought it might be prudent to update it to note that as of Razor V2, support for root-relative urls is baked in, so you can use </p> <pre><code>&lt;img src="~/Content/MyImage.jpg"&gt; </code></pre> <p>without any server-side syntax, and the view engine automatically replaces ~/ with whatever the current site root is.</p>
[ { "answer_id": 317333, "author": "kͩeͣmͮpͥ ͩ", "author_id": 26479, "author_profile": "https://Stackoverflow.com/users/26479", "pm_score": 3, "selected": false, "text": "<img src='<%= VirtualPathUtility.ToAbsolute(\"~/images/logo.gif\") %>' alt=\"Our Company Logo\"/>" }, { "answer...
2008/11/25
[ "https://Stackoverflow.com/questions/317315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34942/" ]
317,322
<p>How would you get tree-structured data from a database with the best performance? For example, say you have a folder-hierarchy in a database. Where the folder-database-row has <strong>ID</strong>, <strong>Name</strong> and <strong>ParentID</strong> columns.</p> <p>Would you use a special algorithm to get all the data at once, minimizing the amount of database-calls and process it in code?</p> <p>Or would you use do many calls to the database and sort of get the structure done from the database directly?</p> <p>Maybe there are different answers based on x amount of database-rows, hierarchy-depth or whatever?</p> <p><strong>Edit</strong>: I use Microsoft SQL Server, but answers out of other perspectives are interesting too.</p>
[ { "answer_id": 317346, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 1, "selected": false, "text": "ID ParentID\n1 null\n2 null\n3 1\n4 2\n... ...\n" }, { "answer_id": 317375, "author...
2008/11/25
[ "https://Stackoverflow.com/questions/317322", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2429/" ]
317,335
<p>I understand that, if <code>S</code> is a child class of <code>T</code>, then a <code>List&lt;S&gt;</code> is <strong>not</strong> a child of <code>List&lt;T&gt;</code>. Fine. But interfaces have a different paradigm: if <code>Foo</code> implements <code>IFoo</code>, then why is a <code>List&lt;Foo&gt;</code> not (an example of) a <code>List&lt;IFoo&gt;</code>?</p> <p>As there can be no actual class <code>IFoo</code>, does this mean that I would always have to cast each element of the list when exposing a <code>List&lt;IFoo&gt;</code>? Or is this simply bad design and I have to define my own collection class <code>ListOfIFoos</code> to be able to work with them? Neither seem reasonable to me... </p> <p>What would be the best way of exposing such a list, given that I am trying to program to interfaces? I am currently tending towards actually storing my <code>List&lt;Foo&gt;</code> internally as a <code>List&lt;IFoo&gt;</code>.</p>
[ { "answer_id": 317355, "author": "kͩeͣmͮpͥ ͩ", "author_id": 26479, "author_profile": "https://Stackoverflow.com/users/26479", "pm_score": 3, "selected": false, "text": "ConvertAll" }, { "answer_id": 317358, "author": "Tom Ritter", "author_id": 8435, "author_profile": ...
2008/11/25
[ "https://Stackoverflow.com/questions/317335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6091/" ]