qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
59,425
<p>I'm using MySQL in particular, but I'm hoping for a cross-vendor solution. I'm using the NOW() function to add a timestamp as a column for each record.</p> <pre><code>INSERT INTO messages (typeId, messageTime, stationId, message) VALUES (?, NOW(), ?, ?) </code></pre>
[ { "answer_id": 59437, "author": "Alexander Morland", "author_id": 4013, "author_profile": "https://Stackoverflow.com/users/4013", "pm_score": 3, "selected": true, "text": "SELECT * FROM messages WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= messageTime\n" }, { "answer_id": 59443, ...
2008/09/12
[ "https://Stackoverflow.com/questions/59425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1288/" ]
59,444
<p>Is there a system stored procedure to get the version #?</p>
[ { "answer_id": 59457, "author": "Joe Kuemerle", "author_id": 4273, "author_profile": "https://Stackoverflow.com/users/4273", "pm_score": 9, "selected": true, "text": "SELECT @@VERSION \n" }, { "answer_id": 510741, "author": "Bruce Chapman", "author_id": 174730, "autho...
2008/09/12
[ "https://Stackoverflow.com/questions/59444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
59,451
<p>How do I create a silverlight data template in code? I've seen plenty of examples for WPF, but nothing for Silverlight.</p> <p>Edit: Here's the code I'm now using this for, based on the answer from Santiago below.</p> <pre><code>public DataTemplate Create(Type type) { return (DataTemplate)XamlReader.Load( @"&lt;DataTemplate xmlns=""http://schemas.microsoft.com/client/2007""&gt; &lt;" + type.Name + @" Text=""{Binding " + ShowColumn + @"}""/&gt; &lt;/DataTemplate&gt;" ); } </code></pre> <p>This works really nicely and allows me to change the binding on the fly. </p>
[ { "answer_id": 72158, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 6, "selected": true, "text": " public static DataTemplate Create(Type type)\n {\n return (DataTemplate) XamlReader.Load(\n @\"<DataTem...
2008/09/12
[ "https://Stackoverflow.com/questions/59451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5932/" ]
59,456
<p>I'd like to make some custom MenuHeaders in WPF so I can have (for example), an icon and text in a menu item.</p> <p>Normally using MenuItems, if you populate the Header field with straight text, you can add an accelerator by using an underscore. eg, _File</p> <p>However, if I wanted to put in a UserControl, I believe this function would break, how would I do something similar to the following?</p> <pre><code>&lt;Menu&gt; &lt;MenuItem&gt; &lt;MenuItem.Header&gt; &lt;UserControl&gt; &lt;Image Source="..." /&gt; &lt;Label Text="_Open" /&gt; &lt;/UserControl&gt; &lt;/MenuItem.Header&gt; &lt;/MenuItem&gt; ... </code></pre>
[ { "answer_id": 59706, "author": "Alan Le", "author_id": 1133, "author_profile": "https://Stackoverflow.com/users/1133", "pm_score": 2, "selected": false, "text": "<MenuItem Header=\"_Open\">\n <MenuItem.Icon>\n <Image Source=\"images/Open.png\"/>\n </MenuItem.Icon>\n</MenuItem>\n" ...
2008/09/12
[ "https://Stackoverflow.com/questions/59456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/483/" ]
59,465
<p>By default the webjump hotlist has the following which I use quite often:</p> <pre><code>M-x webjump RET Google M-x webjump RET Wikipedia </code></pre> <p>How can I add 'Stackoverflow' to my list?</p>
[ { "answer_id": 59476, "author": "Marcel Levy", "author_id": 676, "author_profile": "https://Stackoverflow.com/users/676", "pm_score": 2, "selected": true, "text": ";; (require 'webjump)\n;; (global-set-key \"\\C-cj\" 'webjump)\n;; (setq webjump-sites\n;; (append '(\n;; ...
2008/09/12
[ "https://Stackoverflow.com/questions/59465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
59,483
<pre><code>1167 ptr = (void*)getcwd(cwd, MAX_PATH_LENGTH-1); (gdb) n 1168 if (!ptr) { (gdb) print ptr $1 = 0xbff2d96c "/media/MMC-SD/partition1/aaaaaaaaaaa" (gdb) print &amp;cwd $2 = (char (*)[3500]) 0xbff2d96c (gdb) print strlen(cwd) $3 = 36 (gdb) print "%s",cwd $4 = "/media/MMC-SD/partition1/aaaaaaaaaaa", '\0' &lt;repeats 912 times&gt;, "��O�001\000\000\000\000��027\000\000\000�3����EL鷠3�000��027\000\000\000\000\000\000\000\027\000\000\000\000��/�027\000\000\000�3����N����\230���鷠3�000��027\000\000\000\000\000\000\000��000\000\000\000\001\000\000\000��M鷠3����\000\000\000\000.\231�027��w\005\b\001\000"... (gdb) print "%s", ptr $5 = 0xbff2d96c "/media/MMC-SD/partition1/aaaaaaaaaaa" (gdb) Quit </code></pre> <p>Why is ptr printing the string correctly but cwd not; this also affects the program and it crashes if I try to use the cwd...</p> <p>[edit: turns out that crash was caused by a stupid buffer overflow on this var... grr...not gdb, but the print question was still valid]</p>
[ { "answer_id": 59509, "author": "oliver", "author_id": 2148773, "author_profile": "https://Stackoverflow.com/users/2148773", "pm_score": 1, "selected": false, "text": "ptr" }, { "answer_id": 59517, "author": "mweerden", "author_id": 4285, "author_profile": "https://St...
2008/09/12
[ "https://Stackoverflow.com/questions/59483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5330/" ]
59,515
<p>I am new to all the anonymous features and need some help. I have gotten the following to work:</p> <pre><code>public void FakeSaveWithMessage(Transaction t) { t.Message = "I drink goats blood"; } public delegate void FakeSave(Transaction t); public void SampleTestFunction() { Expect.Call(delegate { _dao.Save(t); }).Do(new FakeSave(FakeSaveWithMessage)); } </code></pre> <p>But this is totally ugly and I would like to have the inside of the Do to be an anonymous method or even a lambda if it is possible. I tried:</p> <pre><code>Expect.Call(delegate { _dao.Save(t); }).Do(delegate(Transaction t2) { t2.Message = "I drink goats blood"; }); </code></pre> <p>and</p> <pre><code>Expect.Call(delegate { _dao.Save(t); }).Do(delegate { t.Message = "I drink goats blood"; }); </code></pre> <p>but these give me</p> <blockquote> <p>Cannot convert anonymous method to type 'System.Delegate' because it is not a delegate type** compile errors.</p> </blockquote> <p>What am I doing wrong?</p> <hr> <p>Because of what Mark Ingram posted, seems like the best answer, though nobody's explicitly said it, is to do this:</p> <pre><code>public delegate void FakeSave(Transaction t); Expect.Call(delegate { _dao.Save(t); }).Do( new FakeSave(delegate(Transaction t2) { t.Message = expected_msg; })); </code></pre>
[ { "answer_id": 59531, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile": "https://Stackoverflow.com/users/96", "pm_score": 0, "selected": false, "text": "Expect.Call(delegate { _dao.Save(t); }).Do(new EventHandler(delegate(Transaction t2) { t2.CheckInInfo.CheckInMessage ...
2008/09/12
[ "https://Stackoverflow.com/questions/59515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
59,544
<p>I have the following tables, the <code>groups</code> table which contains hierarchically ordered groups and <code>group_member</code> which stores which groups a user belongs to. </p> <pre><code>groups --------- id parent_id name group_member --------- id group_id user_id ID PARENT_ID NAME --------------------------- 1 NULL Cerebra 2 1 CATS 3 2 CATS 2.0 4 1 Cerepedia 5 4 Cerepedia 2.0 6 1 CMS ID GROUP_ID USER_ID --------------------------- 1 1 3 2 1 4 3 1 5 4 2 7 5 2 6 6 4 6 7 5 12 8 4 9 9 1 10 </code></pre> <p>I want to retrieve the visible groups for a given user. That it is to say groups a user belongs to and children of these groups. For example, with the above data: </p> <pre><code>USER VISIBLE_GROUPS 9 4, 5 3 1,2,4,5,6 12 5 </code></pre> <p>I am getting these values using recursion and several database queries. But I would like to know if it is possible to do this with a single SQL query to improve my app performance. I am using MySQL. </p>
[ { "answer_id": 59632, "author": "Kevin Fairchild", "author_id": 3743, "author_profile": "https://Stackoverflow.com/users/3743", "pm_score": 0, "selected": false, "text": "SELECT GroupUsers.User_ID,\n (\n SELECT \n STUFF((SELECT ',' + \n Cast(Group_ID A...
2008/09/12
[ "https://Stackoverflow.com/questions/59544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2138/" ]
59,557
<p>is there an easy way to transform HTML into markdown with JAVA?</p> <p>I am currently using the Java <strong><a href="http://code.google.com/p/markdownj/" rel="noreferrer">MarkdownJ</a></strong> library to transform markdown to html.</p> <pre><code>import com.petebevin.markdown.MarkdownProcessor; ... public static String getHTML(String markdown) { MarkdownProcessor markdown_processor = new MarkdownProcessor(); return markdown_processor.markdown(markdown); } public static String getMarkdown(String html) { /* TODO Ask stackoverflow */ } </code></pre>
[ { "answer_id": 741062, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "wmd.js" }, { "answer_id": 62105480, "author": "Gabriel Furstenheim", "author_id": 1536133, "author_profile...
2008/09/12
[ "https://Stackoverflow.com/questions/59557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2138/" ]
59,560
<p>Of all the forms of CAPTCHA available, which one is the "least crackable" while remaining fairly human readable?</p>
[ { "answer_id": 24972337, "author": "ZeroBased_IX", "author_id": 1888402, "author_profile": "https://Stackoverflow.com/users/1888402", "pm_score": 2, "selected": false, "text": "If honeypotfield <> Empty Then\n \"No Spam TY\"\nElse \n //Proceed with the form \nEnd If\n" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/59560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5287/" ]
59,599
<p>I have a large classic ASP app that I have to maintain, and I repeatedly find myself thwarted by the lack of short-circuit evaluation capability. E.g., VBScript won't let you get away with:</p> <pre><code>if not isNull(Rs("myField")) and Rs("myField") &lt;&gt; 0 then ... </code></pre> <p>...because if Rs("myField") is null, you get an error in the second condition, comparing null to 0. So I'll typically end up doing this instead:</p> <pre><code>dim myField if isNull(Rs("myField")) then myField = 0 else myField = Rs("myField") end if if myField &lt;&gt; 0 then ... </code></pre> <p>Obviously, the verboseness is pretty appalling. Looking around this large code base, the best workaround I've found is to use a function the original programmer wrote, called TernaryOp, which basically grafts in ternary operator-like functionality, but I'm still stuck using a temporary variable that would not be necessary in a more full-featured language. Is there a better way? Some super-secret way that short-circuiting really does exist in VBScript?</p>
[ { "answer_id": 59606, "author": "busse", "author_id": 5702, "author_profile": "https://Stackoverflow.com/users/5702", "pm_score": 3, "selected": false, "text": "if not isNull(Rs(\"myField\")) Then\n if Rs(\"myField\") <> 0 then\n" }, { "answer_id": 59618, "author": "ogleste...
2008/09/12
[ "https://Stackoverflow.com/questions/59599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1818/" ]
59,628
<p>I have a page results page (you get there after submitting your search query elsewhere) whit a whole bunch of gridviews for different type of data objects.</p> <p>Obviously, some of the queries take longer than the others. How can I make each gridview render as soon as it has the data it needs?</p> <p>This has been tricky for me because it must work on a postback as well as a pageload. Also, the object data sources just fire automatically on page load/postback; I'm not calling any methods programatically to get the data. Will I have to change this? </p>
[ { "answer_id": 59723, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 3, "selected": true, "text": "if (this.isPostBack && ScriptManager.IsInAsyncPostback)\n" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/59628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/781/" ]
59,635
<p>Since our switch from Visual Studio 6 to Visual Studio 2008, we've been using the MFC90.dll and msvc[pr]90.dlls along with the manifest files in a private side-by-side configuration so as to not worry about versions or installing them to the system.</p> <p>Pre-SP1, this was working fine (and still works fine on our developer machines). Now that we've done some testing post-SP1 I've been pulling my hair out since yesterday morning.</p> <p>First off, our NSIS installer script pulls the dlls and manifest files from the redist folder. These were no longer correct, as the app still links to the RTM version.</p> <p>So I added the define for <code>_BIND_TO_CURRENT_VCLIBS_VERSION=1</code> to all of our projects so that they will use the SP1 DLLs in the redist folder (or subsequent ones as new service packs come out). It took me hours to find this.</p> <p>I've double checked the generated manifest files in the intermediate files folder from the compilation, and they correctly list the 9.0.30729.1 SP1 versions. I've double and triple checked depends on a clean machine: it all links to the local dlls with no errors. </p> <p>Running the app still gets the following error:</p> <blockquote> <blockquote> <p>The application failed to initialize properly (0xc0150002). Click on OK to terminate the application.</p> </blockquote> </blockquote> <p>None of the searches I've done on google or microsoft have come up with anything that relates to my specific issues (but there are hits back to 2005 with this error message).</p> <p>Any one had any similar problem with SP1?</p> <p>Options:<ul> <li>Find the problem and fix it so it works as it should (preferred) <li>Install the redist <li>dig out the old RTM dlls and manifest files and remove the #define to use the current ones. (I've got them in an earlier installer build, since Microsoft blasts them out of your redist folder!)</ul></p> <p><b>Edit:</b> I've tried re-building with the define turned off (link to RTM dlls), and that works as long as the RTM dlls are installed in the folder. If the SP1 dlls are dropped in, it gets the following error:</p> <blockquote> <p>c:\Program Files\...\...\X.exe</p> <p>This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.</p> </blockquote> <p>Has no-one else had to deal with this issue?</p> <p><b>Edit:</b> Just for grins, I downloaded and ran the vcredist_x86.exe for VS2008SP1 on my test machine. <b><i>It</i></b> works. With the SP1 DLLs. And my RTM linked app. But <b>NOT</b> in a private side-by-side distribution that worked pre-SP1.</p>
[ { "answer_id": 70808, "author": "Roel", "author_id": 11449, "author_profile": "https://Stackoverflow.com/users/11449", "pm_score": 6, "selected": true, "text": "#define _BIND_TO_CURRENT_MFC_VERSION 1\n#define _BIND_TO_CURRENT_CRT_VERSION 1\n" }, { "answer_id": 2153085, "autho...
2008/09/12
[ "https://Stackoverflow.com/questions/59635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1441/" ]
59,642
<p>What's the best way to determine which version of the .NET Compact Frameworks (including Service Packs) is installed on a device through a .NET application. </p>
[ { "answer_id": 70808, "author": "Roel", "author_id": 11449, "author_profile": "https://Stackoverflow.com/users/11449", "pm_score": 6, "selected": true, "text": "#define _BIND_TO_CURRENT_MFC_VERSION 1\n#define _BIND_TO_CURRENT_CRT_VERSION 1\n" }, { "answer_id": 2153085, "autho...
2008/09/12
[ "https://Stackoverflow.com/questions/59642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2723/" ]
59,648
<p>I am writing a program to simulate the actual polling data companies like Gallup or Rasmussen publish daily: <em><a href="http://www.gallup.com" rel="nofollow noreferrer">www.gallup.com</a></em> and <em><a href="http://www.rassmussenreports.com" rel="nofollow noreferrer">www.rassmussenreports.com</a></em></p> <p>I'm using a brute force method, where the computer generates some random daily polling data and then calculates three day averages to see if the average of the random data matches pollsters numbers. (Most companies poll numbers are three day averages)</p> <p>Currently, it works well for one iteration, but my goal is to have it produce the most common simulation that matches the average polling data. I could then change the code of anywhere from 1 to 1000 iterations.</p> <p>And this is my problem. At the end of the test I have an array in a single variable that looks something like this:</p> <pre><code>[40.1, 39.4, 56.7, 60.0, 20.0 ..... 19.0] </code></pre> <p>The program currently produces one array for each correct simulation. <em>I can store each array in a single variable, but I then have to have a program that could generate 1 to 1000 variables depending on how many iterations I requested!?</em></p> <p>How do I avoid this? I know there is an intelligent way of doing this that doesn't require the program to generate variables to store arrays depending on how many simulations I want.</p> <p>Code testing for McCain:</p> <pre><code> test = [] while x &lt; 5: test = round(100*random.random()) mctest.append(test) x = x +1 mctestavg = (mctest[0] + mctest[1] + mctest[2])/3 #mcavg is real data if mctestavg == mcavg[2]: mcwork = mctest </code></pre> <p>How do I repeat without creating multiple mcwork vars?</p>
[ { "answer_id": 59662, "author": "Nick Stinemates", "author_id": 4960, "author_profile": "https://Stackoverflow.com/users/4960", "pm_score": 2, "selected": false, "text": ">>> a = [ ['a', 'b'], ['c', 'd'] ]\n>>> a[1]\n['c', 'd']\n>>> a[1][1]\n'd'\n" }, { "answer_id": 59663, "a...
2008/09/12
[ "https://Stackoverflow.com/questions/59648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6163/" ]
59,651
<p>I have a web page that I have hooked up to a <a href="http://en.wikipedia.org/wiki/Stored_procedure" rel="nofollow noreferrer">stored procedure</a>. In this SQL data source, I have a parameter that I'm passing back to the stored procedure of type int. </p> <p><a href="http://en.wikipedia.org/wiki/ASP.NET" rel="nofollow noreferrer">ASP.NET</a> seems to want to default to <em>int32</em>, but the number won't get higher than 6. Is it ok to override the ASP.NET default and put in 16 or will there be a conflict somewhere down the road?</p> <p>specification: the database field has a length of 4 and precision of 10, if that makes a difference in the answer.</p>
[ { "answer_id": 59662, "author": "Nick Stinemates", "author_id": 4960, "author_profile": "https://Stackoverflow.com/users/4960", "pm_score": 2, "selected": false, "text": ">>> a = [ ['a', 'b'], ['c', 'd'] ]\n>>> a[1]\n['c', 'd']\n>>> a[1][1]\n'd'\n" }, { "answer_id": 59663, "a...
2008/09/12
[ "https://Stackoverflow.com/questions/59651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/730/" ]
59,653
<p>Is there a way to get at the ItemContaner of a selected item in a listbox? In Silverlight 2.0 Beta 1 I could, but the container is hidden in Beta 2 of Silverlight 2.0. </p> <p>I'm trying to resize the listbox item when it is unselected to a specific size and when selected to a variable size. I also want to get the relative position of the selected item for animations. Growing to a variable size and getting the relative pasition is why i need to get to the listbox item.</p> <p>I should clarify i'm not adding items to the listbox explicitly. I am using data binding in xaml and DataTemplates. What I have trouble accessing is the ItemContainer of the selected item's DataTemplate.</p>
[ { "answer_id": 86980, "author": "dcstraw", "author_id": 10391, "author_profile": "https://Stackoverflow.com/users/10391", "pm_score": 0, "selected": false, "text": "_ListBox.Items.Add(obj0);\n_ListBox.Items.Add(obj1);\n" }, { "answer_id": 162051, "author": "MaxM", "author...
2008/09/12
[ "https://Stackoverflow.com/questions/59653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/580/" ]
59,655
<p>Given a controller method like: </p> <pre><code>def show @model = Model.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml =&gt; model } end end </code></pre> <p>What's the best way to write an integration test that asserts that the return has the expected XML?</p>
[ { "answer_id": 59714, "author": "Michael Sepcot", "author_id": 6033, "author_profile": "https://Stackoverflow.com/users/6033", "pm_score": 0, "selected": false, "text": "@request.accept = 'text/xml' # or 'application/xml' I forget which\n" }, { "answer_id": 60261, "author": "...
2008/09/12
[ "https://Stackoverflow.com/questions/59655", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4748/" ]
59,656
<p>Erasing programs such as Eraser recommend overwriting data maybe 36 times.</p> <p>As I understand it all data is stored on a hard drive as 1s or 0s.</p> <p>If an overwrite of random 1s and 0s is carried out once over the whole file then why isn't that enough to remove all traces of the original file?</p>
[ { "answer_id": 60193, "author": "Jesse C. Slicer", "author_id": 3312, "author_profile": "https://Stackoverflow.com/users/3312", "pm_score": 1, "selected": false, "text": "public static void DeleteGutmann(string fileName)\n{\n var fi = new FileInfo(fileName);\n\n if (!fi.Exists)\n ...
2008/09/12
[ "https://Stackoverflow.com/questions/59656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6164/" ]
59,667
<p>I realize that CHAR is recommended if all my values are fixed-width. But, so what? Why not just pick VARCHAR for all text fields just to be safe.</p>
[ { "answer_id": 59729, "author": "Ethan Post", "author_id": 4527, "author_profile": "https://Stackoverflow.com/users/4527", "pm_score": 6, "selected": false, "text": "varchar" }, { "answer_id": 59756, "author": "Hank Gay", "author_id": 4203, "author_profile": "https://...
2008/09/12
[ "https://Stackoverflow.com/questions/59667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5592/" ]
59,670
<p>I'm working on an exceedingly large codebase, and recently upgraded to GCC 4.3, which now triggers this warning:</p> <blockquote> <p>warning: deprecated conversion from string constant to ‘char*’</p> </blockquote> <p>Obviously, the correct way to fix this is to find every declaration like</p> <pre><code>char *s = &quot;constant string&quot;; </code></pre> <p>or function call like:</p> <pre><code>void foo(char *s); foo(&quot;constant string&quot;); </code></pre> <p>and make them <code>const char</code> pointers. However, that would mean touching 564 files, minimum, which is not a task I wish to perform at this point in time. The problem right now is that I'm running with <a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Werror" rel="nofollow noreferrer">-Werror</a>, so I need some way to stifle these warnings. How can I do that?</p>
[ { "answer_id": 59690, "author": "Rob Walker", "author_id": 3631, "author_profile": "https://Stackoverflow.com/users/3631", "pm_score": 6, "selected": false, "text": "#pragma warning" }, { "answer_id": 59741, "author": "Konrad Rudolph", "author_id": 1968, "author_profi...
2008/09/12
[ "https://Stackoverflow.com/questions/59670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3830/" ]
59,680
<p>In a LotusScript Agent that is being run via WebQueryOpen, how do you get the name of the current server?</p>
[ { "answer_id": 59683, "author": "Derek", "author_id": 5440, "author_profile": "https://Stackoverflow.com/users/5440", "pm_score": 3, "selected": false, "text": "Set s = New NotesSession\nSet db = s.CurrentDatabase\n\nIf db.Server <> \"\" Then\n Set sName = New NotesName(db.Server)\nElse...
2008/09/12
[ "https://Stackoverflow.com/questions/59680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5440/" ]
59,711
<p>Is there an equivalent operator to Haskell's list difference operator <code>\\</code> in F#?</p>
[ { "answer_id": 59814, "author": "nlucaroni", "author_id": 157, "author_profile": "https://Stackoverflow.com/users/157", "pm_score": 3, "selected": false, "text": "\\" }, { "answer_id": 827771, "author": "J D", "author_id": 13924, "author_profile": "https://Stackoverfl...
2008/09/12
[ "https://Stackoverflow.com/questions/59711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4592/" ]
59,719
<p>I need to run a JavaScript function onLoad(), but only do it if the page loaded the first time (i.e. is not the result of a postback).</p> <p>Basically, I need to check for IsPostBack in JavaScript.</p> <p>Thank you.</p>
[ { "answer_id": 59727, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 0, "selected": false, "text": "if (this.IsPostBack)\n{\n Page.ClientScript.RegisterStartupScript(this.GetType(),\"PostbackKey\",\"<script type='text/java...
2008/09/12
[ "https://Stackoverflow.com/questions/59719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3661/" ]
59,726
<p>Is there a way in .net 2.0 to discover the network alias for the machine that my code is running on? Specifically, if my workgroup sees my machine as //jekkedev01, how do I retrieve that name programmatically?</p>
[ { "answer_id": 229049, "author": "alexandrul", "author_id": 19756, "author_profile": "https://Stackoverflow.com/users/19756", "pm_score": 1, "selected": false, "text": "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\lanmanserver\\parameters" }, { "answer_id": 239489, ...
2008/09/12
[ "https://Stackoverflow.com/questions/59726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5287/" ]
59,734
<p>My application is using <strong>Dojo 1.1.1</strong> on an <em>SSL-only</em> website. It is currently taking advantage of <code>dijit.ProgressBar</code> and a <code>dijit.form.DateTextBox</code>.</p> <p>Everything works fabulous in <em>Firefox 2 &amp; 3</em>, but as soon as I try the same scripts in <em>IE7</em> the results are an annoying Security Information dialog:</p> <blockquote> <p>This page contains both secure and non-secure items. Do you want to display the non-secure items?</p> </blockquote> <p>I have scrutinized the page for any <em>non-HTTPS</em> reference to no avail. It appears to be something specific to <code>dojo.js</code>. There use to be an <code>iframe</code> glitch where the <code>src</code> was set to nothing, but this appears to be fixed now (on review of the source).</p> <p>Anyone else having this problem? What are the best-practices for getting <em>Dojo</em> to play well with <em>IE</em> on an <em>SSL-only</em> web server?</p>
[ { "answer_id": 72805, "author": "esarjeant", "author_id": 644, "author_profile": "https://Stackoverflow.com/users/644", "pm_score": 3, "selected": false, "text": "if(dojo.isIE){\n var html=\"<iframe src='javascript:\\\"\\\"'\"\n + \" style='position: absolute; left: 0px; top...
2008/09/12
[ "https://Stackoverflow.com/questions/59734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/644/" ]
59,743
<p>How many possible combinations of the variables a,b,c,d,e are possible if I know that:</p> <pre><code>a+b+c+d+e = 500 </code></pre> <p>and that they are all integers and >= 0, so I know they are finite.</p>
[ { "answer_id": 59824, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 3, "selected": false, "text": "public static long getNumCombinations( int summands, int sum )\n{\n if ( summands <= 1 )\n return 1;\n long ...
2008/09/12
[ "https://Stackoverflow.com/questions/59743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1815/" ]
59,761
<p>I need to disable specific keys (Ctrl and Backspace) in Internet Explorer 6. Is there a registry hack to do this. It has to be IE6. Thanks.</p> <p>Long Edit: </p> <p>@apandit: Whoops. I need to more specific about the backspace thing. When I say disable backspace, I mean disable the ability for Backspace to mimic the Back browser button. In IE, pressing Backspace when the focus is not in a text entry field is equivalent to pressing Back (browsing to the previous page).</p> <p>As for the Ctrl key. There are some pages which have links which create new IE windows. I have the popup blocker turned on, which block this. But, Ctrl clicking result in the new window being launched.</p> <p>This is for a kiosk application, which is currently a web based application. Clients do not have the funds at this time to make their site kiosk friendly. Things like URL filtering and disabling the URL entry field is already done.</p> <p>Thanks.</p>
[ { "answer_id": 59824, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 3, "selected": false, "text": "public static long getNumCombinations( int summands, int sum )\n{\n if ( summands <= 1 )\n return 1;\n long ...
2008/09/12
[ "https://Stackoverflow.com/questions/59761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78/" ]
59,766
<p>I thought jQuery Intellisense was supposed to be improved with SP1. I even downloaded an annotated version of jQuery 1.2.6, but intellisense will not work in a separate jscript file. I have the jQuery library referenced first on my web page in the &lt;head> tag. Am I doing anything wrong?</p>
[ { "answer_id": 59770, "author": "Jason Bunting", "author_id": 1790, "author_profile": "https://Stackoverflow.com/users/1790", "pm_score": 7, "selected": true, "text": "/// <reference path=\"jQuery.js\"/>\n" }, { "answer_id": 271359, "author": "JD Courtoy", "author_id": 23...
2008/09/12
[ "https://Stackoverflow.com/questions/59766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1284/" ]
59,787
<p>How do you generate and analyze a thread dump from a running JBoss instance?</p>
[ { "answer_id": 11678609, "author": "user98761", "author_id": 98761, "author_profile": "https://Stackoverflow.com/users/98761", "pm_score": 1, "selected": false, "text": "Thread.getAllStackTraces()" }, { "answer_id": 16665089, "author": "Stephan", "author_id": 363573, ...
2008/09/12
[ "https://Stackoverflow.com/questions/59787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4061/" ]
59,790
<p>I have been hearing the podcast blog for a while, I hope I dont break this. The question is this: I have to insert an xml to a database. This will be for already defined tables and fields. So what is the best way to accomplish this? So far I am leaning toward programatic. I have been seeing varios options, one is Data Transfer Objects (DTO), in the SQL Server there is the sp_xml_preparedocument that is used to get transfer XMLs to an object and throught code. </p> <p>I am using CSharp and SQL Server 2005. The fields are not XML fields, they are the usual SQL datatypes. </p>
[ { "answer_id": 60139, "author": "Scott Saad", "author_id": 4916, "author_profile": "https://Stackoverflow.com/users/4916", "pm_score": 2, "selected": false, "text": "declare @XmlDocumentHandle int\ndeclare @XmlDocument nvarchar(1000)\nset @XmlDocument = N'<ROOT>\n<Customer>\n <FirstNam...
2008/09/12
[ "https://Stackoverflow.com/questions/59790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
59,819
<p>I would like to be able to define and use a custom type in some of my PowerShell scripts. For example, let's pretend I had a need for an object that had the following structure:</p> <pre><code>Contact { string First string Last string Phone } </code></pre> <p>How would I go about creating this so that I could use it in function like the following:</p> <pre><code>function PrintContact { param( [Contact]$contact ) "Customer Name is " + $contact.First + " " + $contact.Last "Customer Phone is " + $contact.Phone } </code></pre> <p>Is something like this possible, or even recommended in PowerShell?</p>
[ { "answer_id": 59887, "author": "David Mohundro", "author_id": 4570, "author_profile": "https://Stackoverflow.com/users/4570", "pm_score": 2, "selected": false, "text": "$contact = New-Object PSObject\n\n$contact | Add-Member -memberType NoteProperty -name \"First\" -value \"John\"\n$con...
2008/09/12
[ "https://Stackoverflow.com/questions/59819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4916/" ]
59,825
<p>Suppose the following:</p> <pre><code>&gt;&gt;&gt; s = set([1, 2, 3]) </code></pre> <p>How do I get a value (any value) out of <code>s</code> without doing <code>s.pop()</code>? I want to leave the item in the set until I am sure I can remove it - something I can only be sure of after an asynchronous call to another host.</p> <p>Quick and dirty:</p> <pre><code>&gt;&gt;&gt; elem = s.pop() &gt;&gt;&gt; s.add(elem) </code></pre> <p>But do you know of a better way? Ideally in constant time.</p>
[ { "answer_id": 59841, "author": "Blair Conrad", "author_id": 1199, "author_profile": "https://Stackoverflow.com/users/1199", "pm_score": 11, "selected": true, "text": "for e in s:\n break\n# e is now an element from s\n" }, { "answer_id": 59928, "author": "Pat Notz", "...
2008/09/12
[ "https://Stackoverflow.com/questions/59825", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2260/" ]
59,829
<p>I have a radio button list on a page that is used to configure products. when the page loads the first time the first list of options is displayed. you select one of them then click a "Next Step" button and the page posts back and shows a new radio button list for step 2. Now if i click a "Previous Step" button i can easily get the previous list of options to display but i can not for some reason get one of the radio buttons to be selected. I can easily bring back the value i need. right after making the radio button list i have a step that just says radiobuttonlist.selected = "somevalue" depending on whatever the user chose when they completed the first step the first time.</p> <p>when i debug i see that the value is correct and is being applied. but then when the page is displayed the radiobutton is not selected.</p> <p>I have noticed that when i click my "Previous" button while debugging the folowing steps occur.:</p> <p>the page.load handler runs and the code inside my if not page.ispostback block does NOT run, which is correct. then the handles for the button i just clicked gets run. but then after that the page.load handler runs again but this time the code in the if not page.ispostback block DOES run...</p> <p>is that normal? for the page.onload block to run twice like that on a postback? i think it may have something to do with why my value is not being applied.</p>
[ { "answer_id": 59835, "author": "ctrlShiftBryan", "author_id": 6161, "author_profile": "https://Stackoverflow.com/users/6161", "pm_score": 0, "selected": false, "text": "AutoEventWireup = False" }, { "answer_id": 413434, "author": "netseng", "author_id": 32718, "autho...
2008/09/12
[ "https://Stackoverflow.com/questions/59829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
59,832
<p>I am currently calling the following line of code:</p> <pre><code>java.net.URL connection_url = new java.net.URL("http://&lt;ip address&gt;:&lt;port&gt;/path"); </code></pre> <p>and I get the exception above when it executes. Any ideas as to why this is happening?</p>
[ { "answer_id": 59960, "author": "matt b", "author_id": 4249, "author_profile": "https://Stackoverflow.com/users/4249", "pm_score": 3, "selected": true, "text": "public static void main(String[] args) {\n try {\n java.net.URL connection_url = new java.net.URL(\"http://:/path\");...
2008/09/12
[ "https://Stackoverflow.com/questions/59832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2328/" ]
59,838
<p>What command checks if a directory exists or not within a Bash shell script?</p>
[ { "answer_id": 59839, "author": "Grundlefleck", "author_id": 4120, "author_profile": "https://Stackoverflow.com/users/4120", "pm_score": 13, "selected": true, "text": "if [ -d \"$DIRECTORY\" ]; then\n echo \"$DIRECTORY does exist.\"\nfi\n" }, { "answer_id": 59853, "author": ...
2008/09/12
[ "https://Stackoverflow.com/questions/59838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4120/" ]
59,850
<p>I'd like to create a spring bean that holds the value of a double. Something like:</p> <pre><code>&lt;bean id="doubleValue" value="3.7"/&gt; </code></pre>
[ { "answer_id": 59875, "author": "Pavel Feldman", "author_id": 5507, "author_profile": "https://Stackoverflow.com/users/5507", "pm_score": 5, "selected": true, "text": "<bean id=\"doubleValue\" class=\"java.lang.Double\">\n <constructor-arg index=\"0\" value=\"3.7\"/>\n</bean>\n" }, ...
2008/09/12
[ "https://Stackoverflow.com/questions/59850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6180/" ]
59,857
<p>Should I use a dedicated network channel between the database and the application server?</p> <p>...or... </p> <p>Connecting both in the switch along with all other computer nodes makes no diference at all?</p> <p>The matter is <strong>performance!</strong></p>
[ { "answer_id": 59875, "author": "Pavel Feldman", "author_id": 5507, "author_profile": "https://Stackoverflow.com/users/5507", "pm_score": 5, "selected": true, "text": "<bean id=\"doubleValue\" class=\"java.lang.Double\">\n <constructor-arg index=\"0\" value=\"3.7\"/>\n</bean>\n" }, ...
2008/09/12
[ "https://Stackoverflow.com/questions/59857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1100/" ]
59,880
<p>Conventional wisdom states that stored procedures are always faster. So, since they're always faster, use them <strong>ALL THE TIME</strong>.</p> <p>I am pretty sure this is grounded in some historical context where this was once the case. Now, I'm not advocating that Stored Procs are not needed, but I want to know in what cases stored procedures are necessary in modern databases such as MySQL, SQL Server, Oracle, or &lt;<em>Insert_your_DB_here</em>&gt;. Is it overkill to have ALL access through stored procedures?</p>
[ { "answer_id": 59932, "author": "Matt Rogish", "author_id": 2590, "author_profile": "https://Stackoverflow.com/users/2590", "pm_score": 9, "selected": true, "text": "SELECT *\n FROM table WHERE id BETWEEN 1 AND\n 99999999" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/59880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5619/" ]
59,895
<p>How do I get the path of the directory in which a <a href="http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29" rel="noreferrer">Bash</a> script is located, <em>inside</em> that script?</p> <p>I want to use a Bash script as a launcher for another application. I want to change the working directory to the one where the Bash script is located, so I can operate on the files in that directory, like so:</p> <pre><code>$ ./application </code></pre>
[ { "answer_id": 59916, "author": "matt b", "author_id": 4249, "author_profile": "https://Stackoverflow.com/users/4249", "pm_score": 10, "selected": false, "text": "dirname \"$0\"" }, { "answer_id": 59921, "author": "Mr Shark", "author_id": 6093, "author_profile": "http...
2008/09/12
[ "https://Stackoverflow.com/questions/59895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2908/" ]
59,896
<p>I have a page that uses </p> <pre><code>$(id).show("highlight", {}, 2000); </code></pre> <p>to highlight an element when I start a ajax request, that might fail so that I want to use something like</p> <pre><code>$(id).show("highlight", {color: "#FF0000"}, 2000); </code></pre> <p>in the error handler. The problem is that if the first highlight haven't finished, the second is placed in a queue and wont run until the first is ready. Hence the question: Can I somehow stop the first effect?</p>
[ { "answer_id": 59904, "author": "Ryan Lanciaux", "author_id": 1385358, "author_profile": "https://Stackoverflow.com/users/1385358", "pm_score": 5, "selected": true, "text": ".stop()" }, { "answer_id": 10280784, "author": "Dutchie432", "author_id": 83809, "author_profi...
2008/09/12
[ "https://Stackoverflow.com/questions/59896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6093/" ]
59,942
<p>I started a project a long time ago and created a <strong>Data Access Layer</strong> project in my solution but have never developed anything in it. What is the purpose of a data access layer? Are there any good sources that I could learn more about the Data Access Layer?</p>
[ { "answer_id": 4237176, "author": "Shiv Kumar", "author_id": 501146, "author_profile": "https://Stackoverflow.com/users/501146", "pm_score": 5, "selected": false, "text": "GetOrdersForCustomer(42)\n" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/59942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/299/" ]
59,945
<p>We can successfully consume a .NET 2.0 web service from a Flex/AS3 application. Aside from SSL, how else can we make the security more robust (i.e., authentication)?</p>
[ { "answer_id": 196130, "author": "matt eisenberg", "author_id": 14654, "author_profile": "https://Stackoverflow.com/users/14654", "pm_score": 2, "selected": false, "text": "<EnableSession()>" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/59945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5592/" ]
59,986
<p>I have a simple type that explicitly implemets an Interface.</p> <pre><code>public interface IMessageHeader { string FromAddress { get; set; } string ToAddress { get; set; } } [Serializable] public class MessageHeader:IMessageHeader { private string from; private string to; [XmlAttribute("From")] string IMessageHeade.FromAddress { get { return this.from;} set { this.from = value;} } [XmlAttribute("To")] string IMessageHeade.ToAddress { get { return this.to;} set { this.to = value;} } } </code></pre> <p>Is there a way to Serialize and Deserialize objects of type IMessageHeader??</p> <p>I got the following error when tried</p> <p>"Cannot serialize interface IMessageHeader"</p>
[ { "answer_id": 59993, "author": "Brannon", "author_id": 5745, "author_profile": "https://Stackoverflow.com/users/5745", "pm_score": 0, "selected": false, "text": "XmlSerializer ser = new XmlSerializer(typeof(IMessageHeader));\n\nIMessageHeader header = (IMessageHeader)ser.Deserialize(dat...
2008/09/12
[ "https://Stackoverflow.com/questions/59986", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1647/" ]
60,000
<p>In C++, can member function pointers be used to point to derived (or even base) class members? </p> <p>EDIT: Perhaps an example will help. Suppose we have a hierarchy of three classes <code>X</code>, <code>Y</code>, <code>Z</code> in order of inheritance. <code>Y</code> therefore has a base class <code>X</code> and a derived class <code>Z</code>.</p> <p>Now we can define a member function pointer <code>p</code> for class <code>Y</code>. This is written as:</p> <pre><code>void (Y::*p)(); </code></pre> <p>(For simplicity, I'll assume we're only interested in functions with the signature <code>void f()</code> ) </p> <p>This pointer <code>p</code> can now be used to point to member functions of class <code>Y</code>.</p> <p>This question (two questions, really) is then:</p> <ol> <li>Can <code>p</code> be used to point to a function in the derived class <code>Z</code>?</li> <li>Can <code>p</code> be used to point to a function in the base class <code>X</code>?</li> </ol>
[ { "answer_id": 60023, "author": "Matt Price", "author_id": 852, "author_profile": "https://Stackoverflow.com/users/852", "pm_score": 4, "selected": false, "text": "#include <iostream>\nusing namespace std;\n\nclass A { \npublic:\n virtual void foo() { cout << \"A::foo\\n\"; }\n};\ncla...
2008/09/12
[ "https://Stackoverflow.com/questions/60000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1077/" ]
60,009
<p>I've been playing with RSS feeds this week, and for my next trick I want to build one for our internal application log. We have a centralized database table that our myriad batch and intranet apps use for posting log messages. I want to create an RSS feed off of this table, but I'm not sure how to handle the volume- there could be hundreds of entries per day even on a normal day. An exceptional make-you-want-to-quit kind of day might see a few thousand. Any thoughts?</p>
[ { "answer_id": 421550, "author": "Steve Losh", "author_id": 13498, "author_profile": "https://Stackoverflow.com/users/13498", "pm_score": 1, "selected": false, "text": "r'/rss/(?(\\w*?)/)+'" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/60009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3043/" ]
60,019
<p>I am wanting to use ActiveScaffold to create <em>assignment</em> records for several <em>students</em> in a single step. The records will all contain identical data, with the exception of the student_id.</p> <p>I was able to override the default form and replace the dropdown box for selecting the student name with a multi-select box - which is what I want. That change however, was only cosmetic, as the underlying code only grabs the first selected name from that box, and creates a single record.</p> <p>Can somebody suggest a good way to accomplish this in a way that doesn't require my deciphering and rewriting too much of the underlying ActiveScaffold code?</p> <hr> <p>Update: I still haven't found a good answer to this problem.</p>
[ { "answer_id": 60366, "author": "Can Berk Güder", "author_id": 2119, "author_profile": "https://Stackoverflow.com/users/2119", "pm_score": 0, "selected": false, "text": "has_many :students" }, { "answer_id": 295986, "author": "ARemesal", "author_id": 36599, "author_pr...
2008/09/12
[ "https://Stackoverflow.com/questions/60019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3764/" ]
60,030
<p>In Firefox you can enter the following into the awesome bar and hit enter:</p> <pre><code>javascript:self.resizeTo(1024,768); </code></pre> <p>How do you do the same thing in IE?</p>
[ { "answer_id": 60038, "author": "Ross", "author_id": 2025, "author_profile": "https://Stackoverflow.com/users/2025", "pm_score": 2, "selected": false, "text": "javascript:resizeTo(1024,768);\n" }, { "answer_id": 60209, "author": "Tolle", "author_id": 4260, "author_pro...
2008/09/12
[ "https://Stackoverflow.com/questions/60030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1496/" ]
60,032
<p>How do I get the key of the current element in a <code>foreach</code> loop in C#?</p> <p>For example:</p> <h2>PHP</h2> <pre><code>foreach ($array as $key =&gt; $value) { echo("$value is assigned to key: $key"); } </code></pre> <h3>What I'm trying to do in C#:</h3> <pre><code>int[] values = { 5, 14, 29, 49, 99, 150, 999 }; foreach (int val in values) { if(search &lt;= val &amp;&amp; !stop) { // Set key to a variable } } </code></pre>
[ { "answer_id": 60047, "author": "Billy Jo", "author_id": 3447, "author_profile": "https://Stackoverflow.com/users/3447", "pm_score": -1, "selected": false, "text": "myKey = Array.IndexOf(values, val);" }, { "answer_id": 60058, "author": "Tyler", "author_id": 5642, "au...
2008/09/12
[ "https://Stackoverflow.com/questions/60032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2025/" ]
60,033
<p>I want to make a copy of an ActiveRecord object, changing a single field in the process (in addition to the <strong>id</strong>). What is the simplest way to accomplish this?</p> <p>I realize I could create a new record, and then iterate over each of the fields copying the data field-by-field - but I figured there must be an easier way to do this.</p> <p>Perhaps something like this:</p> <pre class="lang-ruby prettyprint-override"><code> new_record = Record.copy(:id) </code></pre>
[ { "answer_id": 60053, "author": "Michael Sepcot", "author_id": 6033, "author_profile": "https://Stackoverflow.com/users/6033", "pm_score": 10, "selected": true, "text": "#rails >= 3.1\nnew_record = old_record.dup\n\n# rails < 3.1\nnew_record = old_record.clone\n" }, { "answer_id"...
2008/09/12
[ "https://Stackoverflow.com/questions/60033", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3764/" ]
60,034
<p>I am writing a batch file script using Windows command-line environment and want to change each occurrence of some text in a file (ex. "FOO") with another (ex. "BAR"). What is the simplest way to do that? Any built in functions?</p>
[ { "answer_id": 60055, "author": "Ferruccio", "author_id": 4086, "author_profile": "https://Stackoverflow.com/users/4086", "pm_score": 5, "selected": false, "text": "sed" }, { "answer_id": 60065, "author": "Mike Schall", "author_id": 4231, "author_profile": "https://St...
2008/09/12
[ "https://Stackoverflow.com/questions/60034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
60,046
<p>I'm embedding the Google Maps Flash API in Flex and it runs fine locally with the watermark on it, etc. When I upload it to the server (flex.mydomain.com) I get a sandbox security error listed below: </p> <pre><code>SecurityError: Error #2121: Security sandbox violation: Loader.content: http://mydomain.com/main.swf?Fri, 12 Sep 2008 21:46:03 UTC cannot access http://maps.googleapis.com/maps/lib/map_1_6.swf. This may be worked around by calling Security.allowDomain. at flash.display::Loader/get content() at com.google.maps::ClientBootstrap/createFactory() at com.google.maps::ClientBootstrap/executeNextFrameCalls() </code></pre> <p>Does anyone have any experience with embedding the Google Maps Flash API into Flex components and specifically settings security settings to make this work? I did get a new API key that is registered to my domain and am using that when it's published.</p> <p>I've tried doing the following in the main application as well as the component:</p> <pre><code>Security.allowDomain('*') Security.allowDomain('maps.googleapis.com') Security.allowDomain('mydomain.com') </code></pre>
[ { "answer_id": 60453, "author": "Till", "author_id": 2859, "author_profile": "https://Stackoverflow.com/users/2859", "pm_score": 2, "selected": false, "text": "crossdomain.xml" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/60046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4760/" ]
60,051
<p>My question is pertaining to the best practice for accessing a child object's parent. So let's say a class instantiates another class, that class instance is now referenced with an object. From that child object, what is the best way to reference back to the parent object? Currently I know of a couple ways that I use often, but I'm not sure if A) there is a better way to do it or B) which of them is the better practice</p> <p>The first method is to use getDefinitionByName, which would not instantiate that class, but allow access to anything inside of it that was publicly declared.</p> <pre><code>_class:Class = getDefinitionByName("com.site.Class") as Class; </code></pre> <p>And then reference that variable based on its parent to child hierarchy.<br> Example, if the child is attempting to reference a class that's two levels up from itself:</p> <pre><code>_class(parent.parent).function(); </code></pre> <p>This seems to work fine, but you are required to know the level at which the child is at compared to the level of the parent you are attempting to access.</p> <p>I can also get the following statement to trace out [object ClassName] into Flash's output.</p> <pre><code>trace(Class); </code></pre> <p>I'm not 100% on the implementation of that line, I haven't persued it as a way to reference an object outside of the current object I'm in.</p> <p>Another method I've seen used is to simply pass a reference to this into the class object you are creating and just catch it with a constructor argument</p> <pre><code>var class:Class = new Class(this); </code></pre> <p>and then in the Class file</p> <pre><code>public function Class(objectRef:Object) { _parentRef = objectRef; } </code></pre> <p>That reference also requires you to step back up using the child to parent hierarchy though.</p> <p>I could also import that class, and then use the direct filepath to reference a method inside of that class, regardless of its the parent or not.</p> <pre><code>import com.site.Class; com.site.Class.method(); </code></pre> <p>Of course there the parent to child relationship is irrelevant because I'm accessing the method or property directly through the imported class.</p> <p>I just feel like I'm missing something really obvious here. I'm basically looking for confirmation if these are the correct ways to reference the parent, and if so which is the most ideal, or am I over-looking something else?</p>
[ { "answer_id": 64085, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "private static const class:Class;\n\npublic static function setClass(_class:Class){\nclass = _class;\n}\npublic static function...
2008/09/12
[ "https://Stackoverflow.com/questions/60051", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1945/" ]
60,070
<p>I am currently in an operating systems class and my teacher spent half of the class period talking about PIDs. She mentioned, as many know, that processes know their parent's ID.</p> <p>My question is this:</p> <p>Does a process's PCB know its child's ID? If so, what is the way to go about it obtaining it?</p>
[ { "answer_id": 60075, "author": "wvdschel", "author_id": 2018, "author_profile": "https://Stackoverflow.com/users/2018", "pm_score": 2, "selected": false, "text": "fork()" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/60070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/73/" ]
60,093
<p>I have a c# asp.net web app. Breakpoints in the database layer are no longer stopping execution but the breakpoints in the UI layer are still working okay. Can anyone hazard a guess why this might be happening?</p> <p>I've checked all the usual suspects (Debug build is on for all projects) and recompiled all projects in solution...</p>
[ { "answer_id": 60106, "author": "Tyler", "author_id": 5642, "author_profile": "https://Stackoverflow.com/users/5642", "pm_score": 1, "selected": false, "text": "Modules View" }, { "answer_id": 1234258, "author": "Jack Marchetti", "author_id": 117658, "author_profile":...
2008/09/12
[ "https://Stackoverflow.com/questions/60093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
60,098
<p>I wrote a simple web service in C# using SharpDevelop (which I just got and I love).</p> <p>The client wanted it in VB, and fortunately there's a Convert To VB.NET feature. It's great. Translated all the code, and it builds. (I've been a "Notepad" guy for a long time, so I may seem a little old-fashioned.)</p> <p>But I get this error when I try to load the service now.</p> <pre> Parser Error Message: Could not load type 'flightinfo.Soap' from assembly 'flightinfo'. Source Error: Line 1: &lt;%@ WebService Class="flightinfo.Soap,flightinfo" %&gt; </pre> <p>I have deleted the bins and rebuilt, and I have searched google (and stackoverflow). I have scoured the project files for any remnants of C#.</p> <p>Any ideas?</p>
[ { "answer_id": 60108, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 0, "selected": false, "text": "<%@ WebService Class=\"flightinfo.Soap,flightinfo\" %>\n" }, { "answer_id": 201092, "author": "csgero", "auth...
2008/09/12
[ "https://Stackoverflow.com/questions/60098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4525/" ]
60,160
<p>Does Java have a built-in way to escape arbitrary text so that it can be included in a regular expression? For example, if my users enter "$5", I'd like to match that exactly rather than a "5" after the end of input.</p>
[ { "answer_id": 60161, "author": "Mike Stone", "author_id": 122, "author_profile": "https://Stackoverflow.com/users/122", "pm_score": 10, "selected": true, "text": "Pattern.quote(\"$5\");\n" }, { "answer_id": 60164, "author": "Rob Oxspring", "author_id": 1867, "author_...
2008/09/12
[ "https://Stackoverflow.com/questions/60160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2338/" ]
60,168
<p>Here is an example of what I've got going on:</p> <pre><code>CREATE TABLE Parent (id BIGINT NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB; CREATE TABLE Child (id BIGINT NOT NULL, parentid BIGINT NOT NULL, PRIMARY KEY (id), KEY (parentid), CONSTRAINT fk_parent FOREIGN KEY (parentid) REFERENCES Parent (id) ON DELETE CASCADE) ENGINE=InnoDB; CREATE TABLE Uncle (id BIGINT NOT NULL, parentid BIGINT NOT NULL, childid BIGINT NOT NULL, PRIMARY KEY (id), KEY (parentid), KEY (childid), CONSTRAINT fk_parent_u FOREIGN KEY (parentid) REFERENCES Parent (id) ON DELETE CASCADE, CONSTRAINT fk_child FOREIGN KEY (childid) REFERENCES Child (id)) ENGINE=InnoDB; </code></pre> <p>Notice there is no ON DELETE CASCADE for the Uncle-Child relationship; i.e. deleting a Child does not delete its Uncle(s) and vice-versa.</p> <p>When I have a Parent and an Uncle with the same Child, and I delete the Parent, it <em>seems</em> like InnoDB should be able to just "figure it out" and let the cascade ripple through the whole family (i.e. deleting the Parent deletes the Uncle and the Child as well). However, instead, I get the following:</p> <pre><code> ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`cascade_test/uncle`, CONSTRAINT `fk_child` FOREIGN KEY (`childid`) REFERENCES `child` (`id`)) </code></pre> <p>InnoDB is trying to cascade-delete the Child before the Uncle(s) that refer to it.</p> <p>Am I missing something? Is this <em>supposed</em> to fail for some reason I don't understand? Or is there some trick to making it work (or is it a bug in MySQL)?</p>
[ { "answer_id": 60229, "author": "Tony BenBrahim", "author_id": 80075, "author_profile": "https://Stackoverflow.com/users/80075", "pm_score": -1, "selected": false, "text": "\nselect id from persons where -find all children of the grandparents\nparent id in (\n select parentid from per...
2008/09/12
[ "https://Stackoverflow.com/questions/60168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6198/" ]
60,174
<p>If user input is inserted without modification into an SQL query, then the application becomes vulnerable to <a href="https://stackoverflow.com/a/332367/">SQL injection</a>, like in the following example:</p> <pre class="lang-php prettyprint-override"><code>$unsafe_variable = $_POST['user_input']; mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')"); </code></pre> <p>That's because the user can input something like <code>value'); DROP TABLE table;--</code>, and the query becomes:</p> <pre><code>INSERT INTO `table` (`column`) VALUES('value'); DROP TABLE table;--') </code></pre> <p>What can be done to prevent this from happening?</p>
[ { "answer_id": 60180, "author": "Kibbee", "author_id": 1862, "author_profile": "https://Stackoverflow.com/users/1862", "pm_score": 10, "selected": false, "text": "mysql_" }, { "answer_id": 60195, "author": "Tanerax", "author_id": 567, "author_profile": "https://Stacko...
2008/09/12
[ "https://Stackoverflow.com/questions/60174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/428190/" ]
60,204
<p>I was going to ask a question here about whether or not my design for some users/roles database tables was acceptable, but after some research I came across this question:</p> <p><a href="/questions/1451/what-is-the-best-way-to-handle-multiple-permission-types">What is the best way to handle multiple permission types?</a></p> <p>It sounds like an innovative approach, so instead of a many-to-many relationship users_to_roles table, I have multiple permissions defined as a single decimal (int data type I presume). That means all permissions for a single user are in one row. It probably won't make sense until you read the other question and answer</p> <p>I can't get my brain around this one. Can someone please explain the conversion process? It sounds "right", but I'm just not getting how I convert the roles to a decimal before it goes in the db, and how it gets converted back when it comes out of the db. I'm using Java, but if you stubbed it out, that would be cool as well.</p> <p>Here is the original answer in the off chance the other question gets deleted:</p> <p>"Personally, I sometimes use a flagged enumeration of permissions. This way you can use AND, OR, NOT and XOR bitwise operations on the enumeration's items.</p> <pre><code>[Flags] public enum Permission { VIEWUSERS = 1, // 2^0 // 0000 0001 EDITUSERS = 2, // 2^1 // 0000 0010 VIEWPRODUCTS = 4, // 2^2 // 0000 0100 EDITPRODUCTS = 8, // 2^3 // 0000 1000 VIEWCLIENTS = 16, // 2^4 // 0001 0000 EDITCLIENTS = 32, // 2^5 // 0010 0000 DELETECLIENTS = 64, // 2^6 // 0100 0000 } </code></pre> <p>Then, you can combine several permissions using the AND bitwise operator. </p> <p>For example, if a user can view &amp; edit users, the binary result of the operation is 0000 0011 which converted to decimal is 3. You can then store the permission of one user into a single column of your DataBase (in our case it would be 3).</p> <p>Inside your application, you just need another bitwise operation (OR) to verify if a user has a particular permission or not."</p>
[ { "answer_id": 60206, "author": "Josef", "author_id": 5581, "author_profile": "https://Stackoverflow.com/users/5581", "pm_score": 2, "selected": false, "text": "EXISTS" }, { "answer_id": 60228, "author": "Brannon", "author_id": 5745, "author_profile": "https://Stackov...
2008/09/13
[ "https://Stackoverflow.com/questions/60204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
60,208
<p>I want to write a function in Python that returns different fixed values based on the value of an input index. </p> <p>In other languages I would use a <code>switch</code> or <code>case</code> statement, but Python does not appear to have a <code>switch</code> statement. What are the recommended Python solutions in this scenario?</p>
[ { "answer_id": 60211, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 12, "selected": true, "text": "match" }, { "answer_id": 60215, "author": "Mark Biek", "author_id": 305, "author_profile": "https://St...
2008/09/13
[ "https://Stackoverflow.com/questions/60208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4907/" ]
60,221
<p>I have always wondered how people update a previous line in a command line. a great example of this is when using the wget command in linux. It creates an ASCII loading bar of sorts that looks like this:</p> <blockquote> <p>[======>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;] 37%</p> </blockquote> <p>and of course the loading bar moves and the percent changes, But it doesn't make a new line. I cannot figure out how to do this. Can someone point me in the right direction?</p>
[ { "answer_id": 60226, "author": "hazzen", "author_id": 5066, "author_profile": "https://Stackoverflow.com/users/5066", "pm_score": 7, "selected": true, "text": "curses" }, { "answer_id": 60227, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Sta...
2008/09/13
[ "https://Stackoverflow.com/questions/60221", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2128/" ]
60,244
<p>I need to join two binary files with a <code>*.bat</code> script on Windows.</p> <p>How can I achieve that?</p>
[ { "answer_id": 60248, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 7, "selected": false, "text": "copy /b" }, { "answer_id": 60249, "author": "simon", "author_id": 6040, "author_profile": "https://Sta...
2008/09/13
[ "https://Stackoverflow.com/questions/60244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2313/" ]
60,259
<p>Every sample that I have seen uses static XML in the xmldataprovider source, which is then used to databind UI controls using XPath binding. Idea is to edit a dynamic XML (structure known to the developer during coding), using the WPF UI.</p> <p>Has anyone found a way to load a dynamic xml string (for example load it from a file during runtime), then use that xml string as the XmlDataprovider source? </p> <p>Code snippets would be great.</p> <p>Update: To make it more clear, Let's say I want to load an xml string I received from a web service call. I know the structure of the xml. So I databind it to WPF UI controls on the WPF Window. How to make this work? All the samples over the web, define the whole XML inside the XAML code in the XmlDataProvider node. This is not what I am looking for. I want to use a xml string in the codebehind to be databound to the UI controls. </p>
[ { "answer_id": 395358, "author": "Paul Osterhout", "author_id": 30976, "author_profile": "https://Stackoverflow.com/users/30976", "pm_score": 3, "selected": true, "text": "XmlDataProvider provider = new XmlDataProvider();\n\nif (provider != null)\n{\n System.Xml.XmlDocument doc = new Sy...
2008/09/13
[ "https://Stackoverflow.com/questions/60259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1747/" ]
60,260
<p>I've been working through <a href="http://gigamonkeys.com/book" rel="nofollow noreferrer">Practical Common Lisp</a> and as an exercise decided to write a macro to determine if a number is a multiple of another number:</p> <p><code>(defmacro multp (value factor)<br> `(= (rem ,value ,factor) 0))</code></p> <p>so that : <code>(multp 40 10)</code> evaluates to true whilst <code>(multp 40 13)</code> does not </p> <p>The question is does this macro <a href="http://gigamonkeys.com/book/macros-defining-your-own.html#plugging-the-leaks" rel="nofollow noreferrer">leak</a> in some way? Also is this "good" Lisp? Is there already an existing function/macro that I could have used?</p>
[ { "answer_id": 60267, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 5, "selected": true, "text": "value" }, { "answer_id": 81824, "author": "Matthias Benkard", "author_id": 15517, "author_profile": "https:/...
2008/09/13
[ "https://Stackoverflow.com/questions/60260", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5303/" ]
60,269
<p>How do I implement a draggable tab using Java Swing? Instead of the static JTabbedPane I would like to drag-and-drop a tab to different position to rearrange the tabs.</p> <p><strong>EDIT</strong>: <a href="http://java.sun.com/docs/books/tutorial/uiswing/dnd/index.html" rel="noreferrer">The Java Tutorials - Drag and Drop and Data Transfer</a>.</p>
[ { "answer_id": 60279, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 3, "selected": false, "text": "class DnDTabbedPane extends JTabbedPane {\n private static final int LINEWIDTH = 3;\n private static final String NAME = ...
2008/09/13
[ "https://Stackoverflow.com/questions/60269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3827/" ]
60,271
<p>What is the best way to write a Safari extension? I've written a couple XUL extensions for Firefox, and now I'd like to write versions of them for Safari. Is there a way that would allow you to add buttons or forms to the browser UI, since this is not possible with an Input manager or Service menu?</p>
[ { "answer_id": 1256724, "author": "Quinn Taylor", "author_id": 120292, "author_profile": "https://Stackoverflow.com/users/120292", "pm_score": 3, "selected": false, "text": "/Library/Internet Plug-ins/" } ]
2008/09/13
[ "https://Stackoverflow.com/questions/60271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4939/" ]
60,278
<p>In all the Git tutorials I've read they say that you can do:</p> <pre><code>git init git add . git commit </code></pre> <p>When I do that I get a big text file opened up. None of the tutorials seem to address this, so I don't know what to do with the file or what to put in it if anything.</p>
[ { "answer_id": 60283, "author": "Ben Collins", "author_id": 3279, "author_profile": "https://Stackoverflow.com/users/3279", "pm_score": 3, "selected": false, "text": "git commit" }, { "answer_id": 60284, "author": "Greg Hewgill", "author_id": 893, "author_profile": "h...
2008/09/13
[ "https://Stackoverflow.com/questions/60278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
60,285
<p>If it's possible, I'm interested in being able to embed a PostgreSQL database, similar to <a href="http://www.sqlite.org/" rel="noreferrer">sqllite</a>. I've read that it's <a href="http://bytes.com/forum/thread647637.html" rel="noreferrer">not possible</a>. I'm no database expert though, so I want to hear from you.</p> <p>Essentially I want PostgreSQL without all the configuration and installation. If it's possible, tell me how.</p>
[ { "answer_id": 69473393, "author": "elikesprogramming", "author_id": 5141196, "author_profile": "https://Stackoverflow.com/users/5141196", "pm_score": 0, "selected": false, "text": "R" } ]
2008/09/13
[ "https://Stackoverflow.com/questions/60285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/525/" ]
60,290
<p>Is there a way to change the appearance of an icon (ie. contrast / luminosity) when I hover the cursor, without requiring a second image file (or without requiring a hidden portion of the image)?</p>
[ { "answer_id": 60295, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 4, "selected": true, "text": "<img src=\"image.png\" style=\"opacity: 0.5; filter: alpha(opacity=50)\" />\n" }, { "answer_id": 60322, "author"...
2008/09/13
[ "https://Stackoverflow.com/questions/60290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3764/" ]
60,293
<p>I have a little problem with a Listview.</p> <p>I can load it with listview items fine, but when I set the background color it doesn't draw the color all the way to the left side of the row [The listViewItems are loaded with ListViewSubItems to make a grid view, only the first column shows the error]. There is a a narrow strip that doesn't paint. The width of that strip is approximately the same as a row header would be if I had a row header. </p> <p>If you have a thought on what can be done to make the background draw I'd love to hear it. </p> <p>Now just to try a new idea, I'm offering a ten vote bounty for the first solution that still has me using this awful construct of a mess of a pseudo grid view. [I love legacy code.]</p> <p><strong>Edit:</strong></p> <p>Here is a sample that exhibits the problem.</p> <pre><code>public partial class Form1 : Form { public Form1() { InitializeComponent(); ListView lv = new ListView(); lv.Dock = System.Windows.Forms.DockStyle.Fill; lv.FullRowSelect = true; lv.GridLines = true; lv.HideSelection = false; lv.Location = new System.Drawing.Point(0, 0); lv.TabIndex = 0; lv.View = System.Windows.Forms.View.Details; lv.AllowColumnReorder = true; this.Controls.Add(lv); lv.MultiSelect = true; ColumnHeader ch = new ColumnHeader(); ch.Name = "Foo"; ch.Text = "Foo"; ch.Width = 40; ch.TextAlign = HorizontalAlignment.Left; lv.Columns.Add(ch); ColumnHeader ch2 = new ColumnHeader(); ch.Name = "Bar"; ch.Text = "Bar"; ch.Width = 40; ch.TextAlign = HorizontalAlignment.Left; lv.Columns.Add(ch2); lv.BeginUpdate(); for (int i = 0; i &lt; 3; i++) { ListViewItem lvi = new ListViewItem("1", "2"); lvi.BackColor = Color.Black; lvi.ForeColor = Color.White; lv.Items.Add(lvi); } lv.EndUpdate(); } } </code></pre>
[ { "answer_id": 60339, "author": "moobaa", "author_id": 3569, "author_profile": "https://Stackoverflow.com/users/3569", "pm_score": 4, "selected": true, "text": " ...\n lv.OwnerDraw = true;\n lv.DrawItem += new DrawListViewItemEventHandler( lv_DrawItem );\n ...\n\nvoid lv_Draw...
2008/09/13
[ "https://Stackoverflow.com/questions/60293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1327/" ]
60,302
<p>If I start a process via Java's <a href="http://java.sun.com/javase/6/docs/api/java/lang/ProcessBuilder.html" rel="noreferrer">ProcessBuilder</a> class, I have full access to that process's standard in, standard out, and standard error streams as Java <code>InputStreams</code> and <code>OutputStreams</code>. However, I can't find a way to seamlessly connect those streams to <code>System.in</code>, <code>System.out</code>, and <code>System.err</code>.</p> <p>It's possible to use <code>redirectErrorStream()</code> to get a single <code>InputStream</code> that contains the subprocess's standard out and standard error, and just loop through that and send it through my standard out—but I can't find a way to do that and let the user type into the process, as he or she could if I used the C <code>system()</code> call.</p> <p>This appears to be possible in Java SE 7 when it comes out—I'm just wondering if there's a workaround now. Bonus points if the result of <a href="http://www.opengroup.org/onlinepubs/009695399/functions/isatty.html" rel="noreferrer"><code>isatty()</code></a> in the child process carries through the redirection.</p>
[ { "answer_id": 60578, "author": "John Meagher", "author_id": 3535, "author_profile": "https://Stackoverflow.com/users/3535", "pm_score": 5, "selected": true, "text": "// Assume you already have a processBuilder all configured and ready to go\nfinal Process process = processBuilder.start(...
2008/09/13
[ "https://Stackoverflow.com/questions/60302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5696/" ]
60,352
<p>If all of my <code>__init__.py</code> files are empty, do I have to store them into version control, or is there a way to make <code>distutils</code> create empty <code>__init__.py</code> files during installation?</p>
[ { "answer_id": 60431, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "__init__.py" }, { "answer_id": 60506, "author": "dF.", "author_id": 3002, "author_profile": "https://Stacko...
2008/09/13
[ "https://Stackoverflow.com/questions/60352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2679/" ]
60,360
<p>What experience can you share about using multiple AJAX libraries?</p> <p>There are useful features in Prototype, some in jQuery, the Yahoo library, etc. Is it possible to include all libraries and use what you want from each, do they generally all play nicely together with name spaces, etc. For the sake of speed is there a practical limit to the size/number of libraries to include or is this negligible? Are there pairs that work particularly well together (e.g. Prototype/Scriptaculous) or pairs that don't?</p>
[ { "answer_id": 60432, "author": "Till", "author_id": 2859, "author_profile": "https://Stackoverflow.com/users/2859", "pm_score": 2, "selected": false, "text": "$('#foobar').whatever();\n" }, { "answer_id": 61881, "author": "Walter Rumsby", "author_id": 1654, "author_p...
2008/09/13
[ "https://Stackoverflow.com/questions/60360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
60,369
<p>I'm currently playing around with <a href="http://pear.php.net/package/HTML_QuickForm" rel="noreferrer">HTML_QuickForm</a> for generating forms in PHP. It seems kind of limited in that it's hard to insert my own javascript or customizing the display and grouping of certain elements.</p> <p>Are there any alternatives to QuickForm that might provide more flexibility?</p>
[ { "answer_id": 60372, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 4, "selected": true, "text": "$('myFormControl').observe('click', myClickFunction)\n" }, { "answer_id": 62035, "author": "Andrew Taylor",...
2008/09/13
[ "https://Stackoverflow.com/questions/60369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
60,409
<p>I know in php you can embed variables inside variables, like:</p> <pre><code>&lt;? $var1 = "I\'m including {$var2} in this variable.."; ?&gt; </code></pre> <p>But I was wondering how, and if it was possible to include a function inside a variable. I know I could just write:</p> <pre><code>&lt;?php $var1 = "I\'m including "; $var1 .= somefunc(); $var1 = " in this variable.."; ?&gt; </code></pre> <p>But what if I have a long variable for output, and I don't want to do this every time, or I want to use multiple functions:</p> <pre><code>&lt;?php $var1 = &lt;&lt;&lt;EOF &lt;html lang="en"&gt; &lt;head&gt; &lt;title&gt;AAAHHHHH&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8"&gt; &lt;/head&gt; &lt;body&gt; There is &lt;b&gt;alot&lt;/b&gt; of text and html here... but I want some &lt;i&gt;functions&lt;/i&gt;! -somefunc() doesn't work -{somefunc()} doesn't work -$somefunc() and {$somefunc()} doesn't work of course because a function needs to be a string -more non-working: ${somefunc()} &lt;/body&gt; &lt;/html&gt; EOF; ?&gt; </code></pre> <p>Or I want dynamic changes in that load of code:</p> <pre><code>&lt;? function somefunc($stuff) { $output = "my bold text &lt;b&gt;{$stuff}&lt;/b&gt;."; return $output; } $var1 = &lt;&lt;&lt;EOF &lt;html lang="en"&gt; &lt;head&gt; &lt;title&gt;AAAHHHHH&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8"&gt; &lt;/head&gt; &lt;body&gt; somefunc("is awesome!") somefunc("is actually not so awesome..") because somefunc("won\'t work due to my problem.") &lt;/body&gt; &lt;/html&gt; EOF; ?&gt; </code></pre> <p>Well?</p>
[ { "answer_id": 60420, "author": "Jason Weathered", "author_id": 3736, "author_profile": "https://Stackoverflow.com/users/3736", "pm_score": 6, "selected": true, "text": "<?\nfunction somefunc($stuff)\n{\n $output = \"<b>{$stuff}</b>\";\n return $output;\n}\n$somefunc='somefunc';\ne...
2008/09/13
[ "https://Stackoverflow.com/questions/60409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4867/" ]
60,438
<p>I am using jQuery. I call a JavaScript function with next html:</p> <pre><code>&lt;li&gt;&lt;span&gt;&lt;a href="javascript:uncheckEl('tagVO-$id')"&gt;$tagname&lt;/a&gt;&lt;/span&gt;&lt;/li&gt; </code></pre> <p>I would like to remove the <code>li</code> element and I thought this would be easy with the <code>$(this)</code> object. This is my JavaScript function:</p> <pre><code>function uncheckEl(id) { $("#"+id+"").attr("checked",""); $("#"+id+"").parent("li").css("color","black"); $(this).parent("li").remove(); // This is not working retrieveItems(); } </code></pre> <p>But <code>$(this)</code> is undefined. Any ideas?</p>
[ { "answer_id": 60449, "author": "Till", "author_id": 2859, "author_profile": "https://Stackoverflow.com/users/2859", "pm_score": 3, "selected": true, "text": "<li>" }, { "answer_id": 74712, "author": "Parand", "author_id": 13055, "author_profile": "https://Stackoverfl...
2008/09/13
[ "https://Stackoverflow.com/questions/60438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2138/" ]
60,455
<p>Is it possible to to take a screenshot of a webpage with JavaScript and then submit that back to the server?</p> <p>I'm not so concerned with browser security issues. etc. as the implementation would be for <a href="http://msdn.microsoft.com/en-us/library/ms536471(vs.85).aspx" rel="noreferrer">HTA</a>. But is it possible?</p>
[ { "answer_id": 63506, "author": "Joel Anair", "author_id": 7441, "author_profile": "https://Stackoverflow.com/users/7441", "pm_score": 6, "selected": true, "text": "Declare Sub keybd_event Lib \"user32\" _\n(ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo...
2008/09/13
[ "https://Stackoverflow.com/questions/60455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1915/" ]
60,456
<p>I have this in a page :</p> <pre><code>&lt;textarea id="taEditableContent" runat="server" rows="5"&gt;&lt;/textarea&gt; &lt;ajaxToolkit:DynamicPopulateExtender ID="dpeEditPopulate" runat="server" TargetControlID="taEditableContent" ClearContentsDuringUpdate="true" PopulateTriggerControlID="hLink" ServicePath="/Content.asmx" ServiceMethod="EditContent" ContextKey='&lt;%=ContextKey %&gt;' /&gt; </code></pre> <p>Basically, a DynamicPopulateExtender that fills the contents of a textarea from a webservice. Problem is, no matter how I return the line breaks, the text in the text area will have no line feeds.</p> <p>If I return the newlines as "br/" the entire text area remains empty. If I return new lines as "/r/n" , I get all the text as one continous line. The webservice returns the string correctly:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;string xmlns="http://rprealm.com/"&gt;First line Third line Fourth line&lt;/string&gt; </code></pre> <p>But what I get in the text area is :</p> <pre><code>First line Third line Fourth line </code></pre>
[ { "answer_id": 321353, "author": "csgero", "author_id": 21764, "author_profile": "https://Stackoverflow.com/users/21764", "pm_score": 1, "selected": false, "text": "xml:space=\"preserve\"" } ]
2008/09/13
[ "https://Stackoverflow.com/questions/60456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3263/" ]
60,464
<p>I am fairly new to Emacs and I have been trying to figure out how to change the default folder for <kbd>C-x C-f</kbd> on start-up. For instance when I first load Emacs and hit <kbd>C-x C-f</kbd> its default folder is <code>C:\emacs\emacs-21.3\bin</code>, but I would rather it be the desktop. I believe there is some way to customize the <code>.emacs</code> file to do this, but I am still unsure what that is.</p> <p>Update: There are three solutions to the problem that I found to work, however I believe solution 3 is Windows only.</p> <ul> <li><p>Solution 1: Add <code>(cd "C:/Users/Name/Desktop")</code> to the <code>.emacs</code> file</p></li> <li><p>Solution 2: Add <code>(setq default-directory "C:/Documents and Settings/USER_NAME/Desktop/")</code> to the <code>.emacs</code> file</p></li> <li><p>Solution 3: Right click the Emacs short cut, hit properties and change the start in field to the desired directory.</p></li> </ul>
[ { "answer_id": 60481, "author": "vava", "author_id": 6258, "author_profile": "https://Stackoverflow.com/users/6258", "pm_score": 5, "selected": false, "text": "(cd \"c:/cvsroot/\")\n" }, { "answer_id": 60482, "author": "Bart", "author_id": 4343, "author_profile": "htt...
2008/09/13
[ "https://Stackoverflow.com/questions/60464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340/" ]
60,470
<p>If I'm running a signed Java applet. Can I load additional classes from remote sources, in the same domain or maybe even the same host, and run them?</p> <p>I'd like to do this without changing pages or even stopping the current applet. Of course, the total size of all classes is too large to load them all at once.</p> <p>Is there a way to do this? And is there a way to do this with signed applets and preserve their "confidence" status?</p>
[ { "answer_id": 60615, "author": "jassuncao", "author_id": 1009, "author_profile": "https://Stackoverflow.com/users/1009", "pm_score": 4, "selected": true, "text": "ClassLoader loader = this.getClass().getClassLoader();\nClass clazz = loader.loadClass(\"acme.AppletAddon\");\n" } ]
2008/09/13
[ "https://Stackoverflow.com/questions/60470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
60,507
<p>Say I have:</p> <pre><code>void Render(void(*Call)()) { D3dDevice-&gt;BeginScene(); Call(); D3dDevice-&gt;EndScene(); D3dDevice-&gt;Present(0,0,0,0); } </code></pre> <p>This is fine as long as the function I want to use to render is a function or a <code>static</code> member function:</p> <pre><code>Render(MainMenuRender); Render(MainMenu::Render); </code></pre> <p>However, I really want to be able to use a class method as well since in most cases the rendering function will want to access member variables, and Id rather not make the class instance global, e.g.</p> <pre><code>Render(MainMenu-&gt;Render); </code></pre> <p>However I really have no idea how to do this, and still allow functions and <code>static</code> member functions to be used.</p>
[ { "answer_id": 60512, "author": "mweerden", "author_id": 4285, "author_profile": "https://Stackoverflow.com/users/4285", "pm_score": 2, "selected": false, "text": "void Wrap(T *t)" }, { "answer_id": 60513, "author": "David Joyner", "author_id": 1146, "author_profile":...
2008/09/13
[ "https://Stackoverflow.com/questions/60507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6266/" ]
60,516
<p>I'm using a few (2 or 3) master pages in my ASP.NET MVC application and they must each display bits of information from the database. Such as a list of sponsors, current fundings status etc.</p> <p>So my question was, where should I put these master-page database calling code?</p> <p>Normally, these should goes into its own controller class right? But then that'd mean I'd have to wire them up manually (e.g. passing ViewDatas) since it is out of the normal routing framework provided by the MVC framework.</p> <p>Is there a way to this cleanly without wiring ViewData passing/Action calls to master pages manually or subclassing the frameworks'?</p> <p>The amount of documentation is very low... and I'm very new to all this including the concepts of MVC itself so please share your tips/techniques on this.</p>
[ { "answer_id": 66806, "author": "Dane O'Connor", "author_id": 1946, "author_profile": "https://Stackoverflow.com/users/1946", "pm_score": 0, "selected": false, "text": "protected override ViewResult View(string viewName, string masterName, object model)\n{\n if (model == null)\n {\...
2008/09/13
[ "https://Stackoverflow.com/questions/60516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3055/" ]
60,558
<p>I need to do some emulation of some old DOS or mainframe terminals in Flex. Something like the image below for example.</p> <p><img src="https://i.stack.imgur.com/qFtvP.png" alt="alt text"></p> <p>The different coloured text is easy enough, but the ability to do different background colours, such as the yellow background is beyond the capabilities of the standard Flash text.</p> <p>I may also need to be able to enter text at certain places and scroll text up the "terminal". Any idea how I'd attack this? Or better still, any existing code/components for this sort of thing?</p>
[ { "answer_id": 60595, "author": "Theo", "author_id": 1109, "author_profile": "https://Stackoverflow.com/users/1109", "pm_score": 2, "selected": false, "text": "TextField.getCharBoundaries" } ]
2008/09/13
[ "https://Stackoverflow.com/questions/60558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6277/" ]
60,565
<p>I have a Visual Studio Setup Project that I use to install a fairly simple WinForms application. At the end of the install I have a custom user interface page that shows a single check box which asks the user if they want to run the application. I've seen other installers do this quite often. But I cannot find a way to get the Setup Project to run an executable after the install finishes. An ideas?</p> <p>NOTE: You cannot use Custom Actions because these are used as part of the install process, I want to run my installed application once the user presses the 'Close' button at the end of the install.</p>
[ { "answer_id": 7396841, "author": "Grub", "author_id": 723459, "author_profile": "https://Stackoverflow.com/users/723459", "pm_score": 0, "selected": false, "text": "(typeof(ClassWithinAssemblyToExecute)).Assembly.EntryPoint.Invoke(null, new Object[] {} )\n" } ]
2008/09/13
[ "https://Stackoverflow.com/questions/60565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6276/" ]
60,569
<p>I want something that looks like a file handle but is really backed by an in-memory buffer to use for I/O redirects. How can I do this?</p>
[ { "answer_id": 65211, "author": "Chris Smith", "author_id": 9073, "author_profile": "https://Stackoverflow.com/users/9073", "pm_score": 1, "selected": false, "text": "/libraries/base/IOBase.lhs" }, { "answer_id": 1047220, "author": "cjs", "author_id": 107294, "author_...
2008/09/13
[ "https://Stackoverflow.com/questions/60569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5304/" ]
60,570
<p>Backgrounder:</p> <p>The <a href="http://en.wikipedia.org/wiki/Opaque_pointer" rel="noreferrer">PIMPL Idiom</a> (Pointer to IMPLementation) is a technique for implementation hiding in which a public class wraps a structure or class that cannot be seen outside the library the public class is part of.</p> <p>This hides internal implementation details and data from the user of the library.</p> <p>When implementing this idiom why would you place the public methods on the pimpl class and not the public class since the public classes method implementations would be compiled into the library and the user only has the header file?</p> <p>To illustrate, this code puts the <code>Purr()</code> implementation on the impl class and wraps it as well.</p> <p><strong>Why not implement Purr directly on the public class?</strong></p> <pre class="lang-c++ prettyprint-override"><code>// header file: class Cat { private: class CatImpl; // Not defined here CatImpl *cat_; // Handle public: Cat(); // Constructor ~Cat(); // Destructor // Other operations... Purr(); }; // CPP file: #include "cat.h" class Cat::CatImpl { Purr(); ... // The actual implementation can be anything }; Cat::Cat() { cat_ = new CatImpl; } Cat::~Cat() { delete cat_; } Cat::Purr(){ cat_-&gt;Purr(); } CatImpl::Purr(){ printf("purrrrrr"); } </code></pre>
[ { "answer_id": 60605, "author": "Xavier Nodet", "author_id": 4177, "author_profile": "https://Stackoverflow.com/users/4177", "pm_score": 6, "selected": true, "text": "Purr()" }, { "answer_id": 60618, "author": "JeffV", "author_id": 445087, "author_profile": "https://S...
2008/09/13
[ "https://Stackoverflow.com/questions/60570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/445087/" ]
60,573
<p>Using C# .NET 2.0, I have a composite data class that does have the <code>[Serializable]</code> attribute on it. I am creating an <code>XMLSerializer</code> class and passing that into the constructor:</p> <pre><code>XmlSerializer serializer = new XmlSerializer(typeof(DataClass)); </code></pre> <p>I am getting an exception saying: </p> <blockquote> <p>There was an error reflecting type.</p> </blockquote> <p>Inside the data class there is another composite object. Does this also need to have the <code>[Serializable]</code> attribute, or by having it on the top object, does it recursively apply it to all objects inside?</p>
[ { "answer_id": 60581, "author": "Lamar", "author_id": 3566, "author_profile": "https://Stackoverflow.com/users/3566", "pm_score": 10, "selected": true, "text": "[XmlIgnore]" }, { "answer_id": 60596, "author": "Gulzar Nazim", "author_id": 4337, "author_profile": "https...
2008/09/13
[ "https://Stackoverflow.com/questions/60573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
60,585
<p>I'm running PHP, Apache, and Windows. I do not have a domain setup, so I would like my website's forms-based authentication to use the local user accounts database built in to Windows (I think it's called SAM).</p> <p>I know that if Active Directory is setup, you can use the PHP LDAP module to connect and authenticate in your script, but without AD there is no LDAP. What is the equivalent for standalone machines?</p>
[ { "answer_id": 66417, "author": "Martin", "author_id": 2581, "author_profile": "https://Stackoverflow.com/users/2581", "pm_score": 0, "selected": false, "text": "// Usage: logonuser.exe /user username /password password [/domain domain]\n// Exit code is 0 on logon success and 1 on failur...
2008/09/13
[ "https://Stackoverflow.com/questions/60585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2581/" ]
60,590
<p>On a PHP-based web site, I want to send users a download package after they have filled out a short form. The site-initiated download should be similar to sites like download.com, which say "your download will begin in a moment."</p> <p>A couple of <strong>possible approaches</strong> I know about, and browser compatibility (based on a quick test):</p> <p><strong>1) Do a <code>window.open</code> pointing to the new file.</strong> </p> <pre><code>- FireFox 3 blocks this. - IE6 blocks this. - IE7 blocks this. </code></pre> <p><strong>2) Create an iframe pointing to the new file.</strong> </p> <pre><code>- FireFox 3 seems to think this is OK. (Maybe it's because I already accepted it once?) - IE6 blocks this. - IE7 blocks this. How can I do this so that at least these three browsers will not object? </code></pre> <p>Bonus: is there a method that doesn't require browser-conditional statements? </p> <p>(I believe that download.com employs both methods conditionally, but I can't get either one to work.)</p> <p><strong>Responses and Clarifications:</strong></p> <pre><code>Q: "Why not point the current window to the file?" A: That might work, but in this particular case, I want to show them some other content while their download starts - for example, "would you like to donate to this project?" </code></pre> <p><strong>UPDATE: I have abandoned this approach. See my answer below for reasons.</strong></p>
[ { "answer_id": 60603, "author": "Mark Biek", "author_id": 305, "author_profile": "https://Stackoverflow.com/users/305", "pm_score": 3, "selected": false, "text": "if(file_exists($filename)) {\n header(\"Pragma: public\");\n header(\"Expires: 0\");\n header(\"Cache-Control: mu...
2008/09/13
[ "https://Stackoverflow.com/questions/60590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4376/" ]
60,607
<p>What are the pros/cons of doing either way. Is there One Right Way(tm) ?</p>
[ { "answer_id": 60631, "author": "Nick Stinemates", "author_id": 4960, "author_profile": "https://Stackoverflow.com/users/4960", "pm_score": 2, "selected": false, "text": "try {\n $user->login();\n} catch (AuthenticationFailureException $e) {\n set_error_handler(\"my_login_form_han...
2008/09/13
[ "https://Stackoverflow.com/questions/60607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
60,641
<p>I need to replace all WinAPI calls of the</p> <ul> <li>CreateFile, </li> <li>ReadFile, </li> <li>SetFilePointer,</li> <li>CloseHandle </li> </ul> <p>with my own implementation (which use low-level file reading via Bluetooth). The code, where functions will be replaced, is Video File Player and it already works with the regular hdd files. It is also needed, that Video Player still can play files from HDD, if the file in the VideoPlayer input is a regular hdd file.</p> <p>What is the best practice for such task?</p>
[ { "answer_id": 60651, "author": "Maximilian", "author_id": 1733, "author_profile": "https://Stackoverflow.com/users/1733", "pm_score": 0, "selected": false, "text": "#define CreateFile MyCreateFile\n\nHRESULT MyCreateFile(whatever the params are);\n" }, { "answer_id": 62005, ...
2008/09/13
[ "https://Stackoverflow.com/questions/60641", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2279145/" ]
60,645
<p>Is it possible to use overlapped I/O with an anonymous pipe? CreatePipe() does not have any way of specifying FILE_FLAG_OVERLAPPED, so I assume ReadFile() will block, even if I supply an OVERLAPPED-structure. </p>
[ { "answer_id": 419736, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 6, "selected": true, "text": "/******************************************************************************\\\n* This is a part of the Microsoft Sour...
2008/09/13
[ "https://Stackoverflow.com/questions/60645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3923/" ]
60,649
<p>I'm looking for suggestions on possible IPC mechanisms that are:</p> <ul> <li><strong>Cross platform</strong> (Win32 and Linux at least)</li> <li>Simple to implement in <strong>C++</strong> as well as the <strong>most common scripting languages</strong> (perl, ruby, python, etc).</li> <li>Finally, <strong>simple to use</strong> from a programming point of view!</li> </ul> <p>What my options are? I'm programming under Linux, but I'd like what I write to be portable to other OSes in the future. I've thought about using sockets, named pipes, or something like DBus.</p>
[ { "answer_id": 25034401, "author": "Peque", "author_id": 3577054, "author_profile": "https://Stackoverflow.com/users/3577054", "pm_score": 3, "selected": false, "text": "inproc://" } ]
2008/09/13
[ "https://Stackoverflow.com/questions/60649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1304/" ]
60,650
<p>Is it possible to to programmatically trigger a postback from server code in ASP.NET? I know that it is possible to do a Response.Redirect or Server.Transfer to redirect to a page, but is there a way to trigger a postback to the same page in server code (<em>i.e.</em> without using javascript trickery to submit a form)?</p>
[ { "answer_id": 38018367, "author": "Juls", "author_id": 933511, "author_profile": "https://Stackoverflow.com/users/933511", "pm_score": 1, "selected": false, "text": "using System;\nusing System.Web;\nusing Microsoft.AspNet.SignalR;\nnamespace SignalRChat\n{\n public class ChatHub : H...
2008/09/13
[ "https://Stackoverflow.com/questions/60650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4849/" ]
60,653
<p>Is global memory initialized in C++? And if so, how?</p> <p>(Second) clarification:</p> <p>When a program starts up, what is in the memory space which will become global memory, prior to primitives being initialized? I'm trying to understand if it is zeroed out, or garbage for example.</p> <p>The situation is: can a singleton reference be set - via an <code>instance()</code> call, prior to its initialization:</p> <pre><code>MySingleton* MySingleton::_instance = NULL; </code></pre> <p>and get two singleton instances as a result?</p> <p>See my C++ quiz on on multiple instances of a singleton...</p>
[ { "answer_id": 60655, "author": "Brian R. Bondy", "author_id": 3153, "author_profile": "https://Stackoverflow.com/users/3153", "pm_score": 4, "selected": true, "text": "int x;\n\nint main(int argc, char**argv)\n{\n assert(x == 0);\n int y;\n //assert(y == 0); <-- wrong can't assume th...
2008/09/13
[ "https://Stackoverflow.com/questions/60653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2167252/" ]
60,658
<p>In Ruby on Rails Development (or MVC in general), what quick rule should I follow as to where to put logic.</p> <p>Please answer in the affirmative - With <em>Do put this here</em>, rather than <em>Don't put that there</em>.</p>
[ { "answer_id": 63619, "author": "James A. Rosen", "author_id": 1190, "author_profile": "https://Stackoverflow.com/users/1190", "pm_score": 2, "selected": false, "text": "# app/controllers/foos_controller.rb:\nclass FoosController < ApplicationController\n\n def show\n @foo = Foo.find...
2008/09/13
[ "https://Stackoverflow.com/questions/60658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2167252/" ]
60,664
<p>is it possible to display &#8659; entity in ie6? It is being display in every browser but not IE 6.I am writing markup such as: </p> <pre><code>&lt;span&gt;&amp;#8659;&lt;/span&gt; </code></pre>
[ { "answer_id": 60679, "author": "ConroyP", "author_id": 2287, "author_profile": "https://Stackoverflow.com/users/2287", "pm_score": 4, "selected": true, "text": "Symbol Character Numeric Description\n⇓ &dArr; &#8659; Down double arrow - - * Doesn't show with MS IE6\n" },...
2008/09/13
[ "https://Stackoverflow.com/questions/60664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2138/" ]
60,672
<p>I want to implement an ISAPI filter like feature using HttpModule in IIS7 running under IIS Integrated Request Processing Pipeline mode.</p> <p>The goal is to look at the incoming request at the Web Server level, and inject some custom HttpHeaders into the request. <code>(for ex: HTTP\_EAUTH\_ID)</code></p> <p>And later in the page lifecycle of an ASPX page, i should be able to use that variable as</p> <pre><code>string eauthId = Request.ServerVariables["HTTP\_EAUTH\_ID"].ToString(); </code></pre> <p>So implementing this module at the Web Server level, is it possible to alter the ServerVariables collection ?? </p>
[ { "answer_id": 61224, "author": "Tyler", "author_id": 5642, "author_profile": "https://Stackoverflow.com/users/5642", "pm_score": 0, "selected": false, "text": "HttpRequest.Headers" } ]
2008/09/13
[ "https://Stackoverflow.com/questions/60672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1647/" ]
60,673
<p>What guidelines do you follow to improve the general quality of your code? Many people have rules about how to write C++ code that (supposedly) make it harder to make mistakes. I've seen people <em>insist</em> that every <code>if</code> statement is followed by a brace block (<code>{...}</code>).</p> <p>I'm interested in what guidelines other people follow, and the reasons behind them. I'm also interested in guidelines that you think are rubbish, but are commonly held. Can anyone suggest a few?</p> <p>To get the ball rolling, I'll mention a few to start with:</p> <ul> <li>Always use braces after every <code>if</code> / <code>else</code> statement (mentioned above). The rationale behind this is that it's not always easy to tell if a single statement is actually one statement, or a preprocessor macro that expands to more than one statement, so this code would break:</li> </ul> <pre> // top of file: #define statement doSomething(); doSomethingElse // in implementation: if (somecondition) doSomething(); </pre> <p>but if you use braces then it will work as expected.</p> <ul> <li>Use preprocessor macros for conditional compilation ONLY. preprocessor macros can cause all sorts of hell, since they don't allow C++ scoping rules. I've run aground many times due to preprocessor macros with common names in header files. If you're not careful you can cause all sorts of havoc!</li> </ul> <p>Now over to you.</p>
[ { "answer_id": 60712, "author": "David Joyner", "author_id": 1146, "author_profile": "https://Stackoverflow.com/users/1146", "pm_score": 4, "selected": true, "text": "std::auto_ptr" }, { "answer_id": 60715, "author": "Brian Paden", "author_id": 3176, "author_profile":...
2008/09/13
[ "https://Stackoverflow.com/questions/60673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1304/" ]