qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
127,001
<p>I need to compress portions of our application's network traffic for performance. I presume this means I need to stay away from some of the newer algorithms like bzip2, which I think I have heard is slower.</p>
[ { "answer_id": 127011, "author": "Steve g", "author_id": 12092, "author_profile": "https://Stackoverflow.com/users/12092", "pm_score": 5, "selected": true, "text": ".addRequestHeader(\"Accept-Encoding\",\"gzip,deflate\");\n" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/127001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18103/" ]
127,006
<p>Could anyone recommend to me a good online guide to PowerPoint VBA? Also, does anyone has advice on how to record a macro in PowerPoint? </p>
[ { "answer_id": 7265123, "author": "Bruno Leite", "author_id": 858857, "author_profile": "https://Stackoverflow.com/users/858857", "pm_score": 2, "selected": false, "text": "dim ppt as powerpoint.Presentation\n\nset ppt =activepresentation\n" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/127006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
127,009
<p>Suppose I want to implement in C++ a data-structure to store oriented graphs. Arcs will be stored in Nodes thanks to STL containers. I'd like users to be able to iterate over the arcs of a node, in an STL-like way.</p> <p>The issue I have is that I don't want to expose in the Node class (that will actually be an abstract base class) which STL container I will actually use in the concrete class. I therefore don't want to have my methods return std::list::iterator or std::vector::iterator...</p> <p>I tried this:</p> <pre><code>class Arc; typedef std::iterator&lt;std::random_access_iterator_tag, Arc*&gt; ArcIterator; // Wrong! class Node { public: ArcIterator incomingArcsBegin() const { return _incomingArcs.begin(); } private: std::vector&lt;Arc*&gt; _incomingArcs; }; </code></pre> <p>But this is not correct because a vector::const_iterator can't be used to create an ArcIterator. So what can be this ArcIterator?</p> <p>I found this paper about <a href="http://www.oonumerics.org/tmpw00/becker.html" rel="nofollow noreferrer">Custom Iterators for the STL</a> but it did not help. I must be a bit heavy today... ;)</p>
[ { "answer_id": 127231, "author": "zvrba", "author_id": 2583, "author_profile": "https://Stackoverflow.com/users/2583", "pm_score": 3, "selected": false, "text": "class Arc;\nclass Node {\nprivate:\n std::vector<Arc*> incoming_;\npublic:\n typedef std::vector<Arc*>::iterator iterator;\n...
2008/09/24
[ "https://Stackoverflow.com/questions/127009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4177/" ]
127,027
<p>I use a byte to store some flag like <code>10101010</code>, and I would like to know how to verify that a specific bit is at <code>1</code> or <code>0</code>.</p>
[ { "answer_id": 127049, "author": "Tnilsson", "author_id": 4165, "author_profile": "https://Stackoverflow.com/users/4165", "pm_score": 1, "selected": false, "text": "byte THIRDBIT = 4; // 4 = 00000100 i.e third bit is set\n\nint isThirdBitSet(byte in) {\n return in & THIRDBIT; // Returns ...
2008/09/24
[ "https://Stackoverflow.com/questions/127027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21386/" ]
127,029
<p>Our application takes significantly more time to launch after a reboot (cold start) than if it was already opened once (warm start). </p> <p>Most (if not all) the difference seems to come from loading DLLs, when the DLLs' are in cached memory pages they load much faster. We tried using <a href="http://mypchell.com/content/view/40/1/" rel="noreferrer">ClearMem</a> to simulate rebooting (since its much less time consuming than actually rebooting) and got mixed results, on some machines it seemed to simulate a reboot very consistently and in some not.</p> <p>To sum up my questions are:</p> <ol> <li>Have you experienced differences in launch time between cold and warm starts?</li> <li>How have you delt with such differences? </li> <li>Do you know of a way to dependably simulate a reboot?</li> </ol> <p><strong>Edit:</strong></p> <p>Clarifications for comments:</p> <ul> <li>The application is mostly native C++ with some .NET (the first .NET assembly that's loaded pays for the CLR).</li> <li>We're looking to improve load time, obviously we did our share of profiling and improved the hotspots in our code.</li> </ul> <p>Something I forgot to mention was that we got some improvement by re-basing all our binaries so the loader doesn't have to do it at load time.</p>
[ { "answer_id": 653865, "author": "Baiyan Huang", "author_id": 70198, "author_profile": "https://Stackoverflow.com/users/70198", "pm_score": 1, "selected": false, "text": "#pragma code_seg(\".startUp\")\n //...\n#pragma code_seg\n\n#pragma data_seg(\".startUp\")\n //...\n#pragma data_seg\...
2008/09/24
[ "https://Stackoverflow.com/questions/127029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
127,040
<p>In Internet Explorer I can use the clipboardData object to access the clipboard. How can I do that in FireFox, Safari and/or Chrome?</p>
[ { "answer_id": 127064, "author": "ine", "author_id": 4965, "author_profile": "https://Stackoverflow.com/users/4965", "pm_score": 6, "selected": false, "text": "function copyIntoClipboard(text) {\n\n var flashId = 'flashId-HKxmj5';\n\n /* Replace this with your clipboard.swf locatio...
2008/09/24
[ "https://Stackoverflow.com/questions/127040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11492/" ]
127,042
<p>I've found an <a href="http://chrison.net/UACElevationInManagedCodeStartingElevatedCOMComponents.aspx" rel="noreferrer">article</a> on how to elevate a COM object written in C++ by calling <code>CoCreateInstanceAsAdmin</code>. But what I have not been able to find or do, is a way to implement a component of my .NET (c#) application as a COM object and then call into that object to execute the tasks which need UAC elevation. MSDN documents this as the <a href="http://msdn.microsoft.com/en-us/library/bb756990.aspx" rel="noreferrer">admin COM object model</a>.</p> <p>I am aware that it is possible and quite easy to launch the application (or another app) as an administrator, to execute the tasks in a separate process (see for instance the <a href="http://www.danielmoth.com/Blog/2006/12/launch-elevated-and-modal-too.html" rel="noreferrer">post from Daniel Moth</a>, but what I am looking for is a way to do everything from within the same, un-elevated .NET executable. Doing so will, of course, spawn the COM object in a new process, but thanks to transparent marshalling, the caller of the .NET COM object should not be (too much) aware of it.</p> <p>Any ideas as to how I could instanciate a COM object written in C#, from a C# project, through the <code>CoCreateInstanceAsAdmin</code> API would be very helpful. So I am really interested in learning how to write a COM object in C#, which I can then invoke from C# through the COM elevation APIs.</p> <p>Never mind if the elevated COM object does not run in the same process. I just don't want to have to launch the whole application elevated; I would just like to have the COM object which will execute the code be elevated. If I could write something along the lines:</p> <pre><code>// in a dedicated assembly, marked with the following attributes: [assembly: ComVisible (true)] [assembly: Guid ("....")] public class ElevatedClass { public void X() { /* do something */ } } </code></pre> <p>and then have my main application just instanciate <code>ElevatedClass</code> through the <code>CoCreateInstanceAsAdmin</code> call. But maybe I am just dreaming.</p>
[ { "answer_id": 311824, "author": "Ryan", "author_id": 20198, "author_profile": "https://Stackoverflow.com/users/20198", "pm_score": 3, "selected": false, "text": "[return: MarshalAs(UnmanagedType.Interface)]\nstatic internal object LaunchElevatedCOMObject(Guid Clsid, Guid InterfaceID)\n ...
2008/09/24
[ "https://Stackoverflow.com/questions/127042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4597/" ]
127,055
<p>Is there a way to determine how many capture groups there are in a given regular expression?</p> <p>I would like to be able to do the follwing:</p> <pre><code>def groups(regexp, s): """ Returns the first result of re.findall, or an empty default &gt;&gt;&gt; groups(r'(\d)(\d)(\d)', '123') ('1', '2', '3') &gt;&gt;&gt; groups(r'(\d)(\d)(\d)', 'abc') ('', '', '') """ import re m = re.search(regexp, s) if m: return m.groups() return ('',) * num_of_groups(regexp) </code></pre> <p>This allows me to do stuff like:</p> <pre><code>first, last, phone = groups(r'(\w+) (\w+) ([\d\-]+)', 'John Doe 555-3456') </code></pre> <p>However, I don't know how to implement <code>num_of_groups</code>. (Currently I just work around it.)</p> <p><strong>EDIT:</strong> Following the <a href="https://stackoverflow.com/questions/127055/find-out-number-of-capture-groups-in-python-regular-expressions/127089#127089">advice from rslite</a>, I replaced <code>re.findall</code> with <code>re.search</code>. </p> <p><code>sre_parse</code> seems like the most robust and comprehensive solution, but requires tree traversal and appears to be a bit heavy.</p> <p>MizardX's regular expression seems to cover all bases, so I'm going to go with that.</p>
[ { "answer_id": 127089, "author": "rslite", "author_id": 15682, "author_profile": "https://Stackoverflow.com/users/15682", "pm_score": 1, "selected": false, "text": "def num_of_groups(regexp):\n rg = re.compile(r'(?<!\\\\)\\(')\n return len(rg.findall(regexp))\n" }, { "answe...
2008/09/24
[ "https://Stackoverflow.com/questions/127055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7581/" ]
127,076
<p>In ASP.NET, if I databind a gridview with a array of objects lets say , how can I retrieve and use foo(index) when the user selects the row?</p> <p>i.e.</p> <pre><code>dim fooArr() as foo; gv1.datasource = fooArr; gv1.databind(); </code></pre> <p>On Row Select</p> <pre><code>Private Sub gv1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gv1.RowCommand If e.CommandName = "Select" Then 'get and use foo(index) End If End Sub </code></pre>
[ { "answer_id": 127114, "author": "Stephen Wrighton", "author_id": 7516, "author_profile": "https://Stackoverflow.com/users/7516", "pm_score": 0, "selected": false, "text": "dim x as object = foo(e.row.selectedIndex)\n" }, { "answer_id": 127123, "author": "kristian", "auth...
2008/09/24
[ "https://Stackoverflow.com/questions/127076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11802/" ]
127,095
<p>I'm used to Atlas where the preferred (from what I know) method is to use XML comments such as:</p> <pre><code>/// &lt;summary&gt; /// Method to calculate distance between two points /// &lt;/summary&gt; /// /// &lt;param name=&quot;pointA&quot;&gt;First point&lt;/param&gt; /// &lt;param name=&quot;pointB&quot;&gt;Second point&lt;/param&gt; /// function calculatePointDistance(pointA, pointB) { ... } </code></pre> <p>Recently I've been looking into other third-party JavaScript libraries and I see syntax like:</p> <pre><code>/* * some comment here * another comment here * ... */ function blahblah() { ... } </code></pre> <p>As a bonus, are there API generators for JavaScript that could read the 'preferred' commenting style?</p>
[ { "answer_id": 127106, "author": "Chris MacDonald", "author_id": 18146, "author_profile": "https://Stackoverflow.com/users/18146", "pm_score": 8, "selected": true, "text": "/**\n * Shape is an abstract base class. It is defined simply\n * to have something to inherit from for geometric \...
2008/09/24
[ "https://Stackoverflow.com/questions/127095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6350/" ]
127,116
<p>I was wondering if there was an easy way in SQL to convert an integer to its binary representation and then store it as a varchar.</p> <p>For example 5 would be converted to "101" and stored as a varchar.</p>
[ { "answer_id": 127371, "author": "Sean", "author_id": 5446, "author_profile": "https://Stackoverflow.com/users/5446", "pm_score": 5, "selected": true, "text": "declare @intvalue int\nset @intvalue=5\n\ndeclare @vsresult varchar(64)\ndeclare @inti int\nselect @inti = 64, @vsresult = ''\nw...
2008/09/24
[ "https://Stackoverflow.com/questions/127116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4779/" ]
127,124
<p>How do you resolve an NT style device path, e.g. <code>\Device\CdRom0</code>, to its logical drive letter, e.g. <code>G:\</code> ?</p> <p>Edit: A Volume Name isn't the same as a Device Path so unfortunately <code>GetVolumePathNamesForVolumeName()</code> won't work.</p>
[ { "answer_id": 132048, "author": "RichS", "author_id": 6247, "author_profile": "https://Stackoverflow.com/users/6247", "pm_score": 4, "selected": true, "text": "typedef basic_string<TCHAR> tstring;\ntypedef map<tstring, tstring> HardDiskCollection;\n\nvoid Initialise( HardDiskCollection ...
2008/09/24
[ "https://Stackoverflow.com/questions/127124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14260/" ]
127,137
<p>Does anyone know a good online resource for example of R code?</p> <p>The programs do not have to be written for illustrative purposes, I am really just looking for some places where a bunch of R code has been written to give me a sense of the syntax and capabilities of the language?</p> <p><strong>Edit:</strong> I have read the basic documentation on the main site, but was wondering if there was some code samples or even programs that show how R is used by different people.</p>
[ { "answer_id": 574365, "author": "Chang Chung", "author_id": 69117, "author_profile": "https://Stackoverflow.com/users/69117", "pm_score": 3, "selected": false, "text": "r" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/127137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/277/" ]
127,144
<p>i was wondering how you deal with permalinks on international sites. By permalink i mean some link which is unique and human readable. </p> <p>E.g. for english phrases its no problem e.g. <strong>/product/some-title/</strong></p> <p>but what do you do if the product title is in e.g chinese language?? how do you deal with this problem? </p> <p>i am implementing an international site and one requirement is to have human readable URLs. Thanks for every comment</p>
[ { "answer_id": 127295, "author": "ConroyP", "author_id": 2287, "author_profile": "https://Stackoverflow.com/users/2287", "pm_score": 2, "selected": false, "text": "<DOMAIN>/<LANGUAGE>/DIR/<PRODUCT_TRANSLATED>" }, { "answer_id": 128046, "author": "Community", "author_id": ...
2008/09/24
[ "https://Stackoverflow.com/questions/127144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21672/" ]
127,151
<p>This is an exercise for the CS guys to shine with the theory.</p> <p>Imagine you have 2 containers with elements. Folders, URLs, Files, Strings, it really doesn't matter.</p> <p>What is AN algorithm to calculate the added and the removed?</p> <p><strong>Notice</strong>: If there are many ways to solve this problem, please post one per answer so it can be analysed and voted up.</p> <p><strong>Edit</strong>: All the answers solve the matter with 4 containers. Is it possible to use only the initial 2?</p>
[ { "answer_id": 127207, "author": "Joe Skora", "author_id": 14057, "author_profile": "https://Stackoverflow.com/users/14057", "pm_score": 1, "selected": false, "text": "sort left-list and right-list\nadds = {}\ndeletes = {}\nget first right-item from right-list\nget first left-item from l...
2008/09/24
[ "https://Stackoverflow.com/questions/127151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8167/" ]
127,156
<p>How do I check if an index exists on a table field in MySQL?</p> <p>I've needed to Google this multiple times, so I'm sharing my Q/A.</p>
[ { "answer_id": 127157, "author": "Sean", "author_id": 5446, "author_profile": "https://Stackoverflow.com/users/5446", "pm_score": 8, "selected": true, "text": "SHOW INDEX" }, { "answer_id": 127164, "author": "J.J.", "author_id": 21204, "author_profile": "https://Stack...
2008/09/24
[ "https://Stackoverflow.com/questions/127156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5446/" ]
127,188
<p>Can you explain STA and MTA in your own words?</p> <p>Also, what are apartment threads and do they pertain only to COM? If so, why?</p>
[ { "answer_id": 127340, "author": "Mike Dimmick", "author_id": 6970, "author_profile": "https://Stackoverflow.com/users/6970", "pm_score": 8, "selected": false, "text": "ThreadingModel" }, { "answer_id": 68271080, "author": "Pekka Ylönen", "author_id": 16391556, "autho...
2008/09/24
[ "https://Stackoverflow.com/questions/127188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19490/" ]
127,190
<p>I'm learning Haskell in the hope that it will help me get closer to functional programming. Previously, I've mostly used languages with C-like syntax, like C, Java, and D.</p> <p>I have a little question about the coding style of an <code>if</code>/<code>else</code> control block used by the <a href="http://en.wikibooks.org/wiki/Haskell/Simple_input_and_output" rel="nofollow noreferrer">tutorial on Wikibooks</a>. The code looks like the following:</p> <pre><code>doGuessing num = do putStrLn "Enter your guess:" guess &lt;- getLine if (read guess) &lt; num then do putStrLn "Too low!" doGuessing num else if (read guess) &gt; num then do putStrLn "Too high!" doGuessing num else do putStrLn "You Win!" </code></pre> <p>It makes me confused, because this coding style totally violates the recommended style in C-like languages, where we should indent <code>if</code>, <code>else if</code>, and <code>else</code> at the same column.</p> <p>I know it just does not work in Haskell, because it would be a parse error if I indented <code>else</code> at the same column as <code>if</code>.</p> <p>But what about the following style? I think it is much more clear than the above one. But since the above is used by Wikibooks and Yet Another Haskell Tutorial, which is marked "best tutorial available online" at the official Haskell website, I'm not sure whether this coding style is a convention in Haskell programs.</p> <pre><code>doGuessing num = do putStrLn "Enter your guess:" guess &lt;- getLine if (read guess) &lt; num then do putStrLn "Too low!" doGuessing num else if (read guess) &gt; num then do putStrLn "Too high!" doGuessing num else do putStrLn "You Win!" </code></pre> <p>So, I'm curious about which coding style is used more often—or is there another coding style for this piece of code?</p>
[ { "answer_id": 130220, "author": "mattiast", "author_id": 8272, "author_profile": "https://Stackoverflow.com/users/8272", "pm_score": 3, "selected": false, "text": "doGuessing num = do\n putStrLn \"Enter your guess:\"\n guess <- getLine\n case (read guess) of\n g | g < nu...
2008/09/24
[ "https://Stackoverflow.com/questions/127190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/242644/" ]
127,205
<p>I have a constructor like as follows:</p> <pre><code>public Agent(){ this.name = "John"; this.id = 9; this.setTopWorldAgent(this, "Top_World_Agent", true); } </code></pre> <p>I'm getting a null pointer exception here in the method call. It appears to be because I'm using 'this' as an argument in the setTopWorldAgent method. By removing this method call everything appears fine. Why does this happen? Has anyone else experienced this?</p>
[ { "answer_id": 127219, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 0, "selected": false, "text": "this" }, { "answer_id": 127245, "author": "Hank Gay", "author_id": 4203, "author_profile": "https://Stac...
2008/09/24
[ "https://Stackoverflow.com/questions/127205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
127,233
<p>This is in C#, I have a class that I am using from some else's DLL. It does not implement IEnumerable but has 2 methods that pass back a IEnumerator. Is there a way I can use a foreach loop on these. The class I am using is sealed.</p>
[ { "answer_id": 127254, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 5, "selected": true, "text": "foreach" }, { "answer_id": 127260, "author": "Torbjörn Gyllebring", "author_id": 21182, "author_pr...
2008/09/24
[ "https://Stackoverflow.com/questions/127233", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3208/" ]
127,241
<p>We are developing a .NET 2.0 winform application. The application needs to access <a href="http://ws.lokad.com/" rel="nofollow noreferrer">Web Services</a>. Yet, we are encountering issues with users behind proxies.</p> <p>Popular windows backup applications (think <a href="http://mozy.com/" rel="nofollow noreferrer">Mozy</a>) are providing a moderately complex dialog window dedicated the proxy settings. Yet, re-implementing yet-another proxy handling logic and GUI looks a total waste of time to me.</p> <p>What are best ways to deal with proxy with .NET client apps?</p> <p>More specifically, we have a case where the user has recorded his proxy settings in Internet Explorer (including username and password), so the <em>default proxy behavior</em> of .NET should work. Yet, the user is still prompted for his username and password when launching IE (both fields are pre-completed, the user just need to click OK) - and our winform application still fails at handling the proxy.</p> <p>What should we do to enforce that the user is not prompted for his username and password when launching IE?</p>
[ { "answer_id": 127338, "author": "MusiGenesis", "author_id": 14606, "author_profile": "https://Stackoverflow.com/users/14606", "pm_score": 4, "selected": true, "text": "<configuration>\n <system.net>\n <defaultProxy>\n <proxy autoDetect=\"true\" />\n </defaultProxy>\n </syst...
2008/09/24
[ "https://Stackoverflow.com/questions/127241", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18858/" ]
127,258
<p>Greetings!</p> <p>I'm working on wrapping my head around LINQ. If I had some XML such as this loaded into an XDocument object:</p> <pre><code>&lt;Root&gt; &lt;GroupA&gt; &lt;Item attrib1="aaa" attrib2="000" attrib3="true" /&gt; &lt;/GroupA&gt; &lt;GroupB&gt; &lt;Item attrib1="bbb" attrib2="111" attrib3="true" /&gt; &lt;Item attrib1="ccc" attrib2="222" attrib3="false" /&gt; &lt;Item attrib1="ddd" attrib2="333" attrib3="true" /&gt; &lt;/GroupB&gt; &lt;GroupC&gt; &lt;Item attrib1="eee" attrib2="444" attrib3="true" /&gt; &lt;Item attrib1="fff" attrib2="555" attrib3="true" /&gt; &lt;/GroupC&gt; &lt;/Root&gt; </code></pre> <p>I'd like to get the attribute values of all of the Item child elements of a Group element. Here's what my query looks like:</p> <pre><code>var results = from thegroup in l_theDoc.Elements("Root").Elements(groupName) select new { attrib1_val = thegroup.Element("Item").Attribute("attrib1").Value, attrib2_val = thegroup.Element("Item").Attribute("attrib2").Value, }; </code></pre> <p>The query works, but if for example the groupName variable contains "GroupB", only one result (the first Item element) is returned instead of three. Am I missing something?</p>
[ { "answer_id": 127301, "author": "Chris Wenham", "author_id": 5548, "author_profile": "https://Stackoverflow.com/users/5548", "pm_score": 2, "selected": false, "text": "var results = from group in l_theDoc.Root.Elements(groupName)\n select new\n {\n ...
2008/09/24
[ "https://Stackoverflow.com/questions/127258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27870/" ]
127,283
<p>I'm having an annoying problem registering a javascript event from inside a user control within a formview in an Async panel. I go to my formview, and press a button to switch into insert mode. This doesn't do a full page postback. Within insert mode, my user control's page_load event should then register a javascript event using ScriptManager.RegisterStartupScript:</p> <pre><code>ScriptManager.RegisterStartupScript(base.Page, this.GetType(), ("dialogJavascript" + this.ID), "alert(\"Registered\");", true); </code></pre> <p>However when I look at my HTML source, the event isn't there. Hence the alert box is never shown. This is the setup of my actual aspx file:</p> <pre><code>&lt;igmisc:WebAsyncRefreshPanel ID="WebAsyncRefreshPanel1" runat="server"&gt; &lt;asp:FormView ID="FormView1" runat="server" DataSourceID="odsCurrentIncident"&gt; &lt;EditItemTemplate&gt; &lt;uc1:SearchSEDUsers ID="SearchSEDUsers1" runat="server" /&gt; &lt;/EditItemTemplate&gt; &lt;ItemTemplate&gt; Hello &lt;asp:Button ID="Button1" runat="server" CommandName="Edit" Text="Button" /&gt; &lt;/ItemTemplate&gt; &lt;/asp:FormView&gt; &lt;/igmisc:WebAsyncRefreshPanel&gt; </code></pre> <p>Does anyone have any idea what I might be missing here?</p>
[ { "answer_id": 1482753, "author": "Christian", "author_id": 179649, "author_profile": "https://Stackoverflow.com/users/179649", "pm_score": 0, "selected": false, "text": "ScriptManager.RegisterClientScriptBlock(MyBase.Page, Me.[GetType](),\n (\"dialogJavascript\" + th...
2008/09/24
[ "https://Stackoverflow.com/questions/127283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17885/" ]
127,290
<p>Is there a side effect in doing this:</p> <p>C code:</p> <pre><code>struct foo { int k; }; int ret_foo(const struct foo* f){ return f.k; } </code></pre> <p>C++ code:</p> <pre><code>class bar : public foo { int my_bar() { return ret_foo( (foo)this ); } }; </code></pre> <p>There's an <code>extern "C"</code> around the C++ code and each code is inside its own compilation unit.</p> <p>Is this portable across compilers?</p>
[ { "answer_id": 127312, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": false, "text": "foo* x = new bar();\ndelete x;\n" }, { "answer_id": 127358, "author": "Airsource Ltd", "author_id": 1...
2008/09/24
[ "https://Stackoverflow.com/questions/127290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21648/" ]
127,316
<p>I first got an error usign the code below, explaining that "DataGridLinkButton' must be placed inside a form tag with runat=server."</p> <p>Now I've tried setting AllowSorting to false, as well as removing the sort expression from each column, with the same error. Then I tried creating a new, plain, DataGrid, with the same data source, but now I get a blank page and FF doesn't recognise the content type properly any more. Please help.</p> <pre><code>Response.Clear(); base.Response.Buffer = true; base.Response.ContentType = "application/vnd.ms-excel"; base.Response.AddHeader("Content-Disposition", "attachment;filename=file.xls"); base.Response.Charset = ""; this.EnableViewState = false; StringWriter writer = new StringWriter(); HtmlTextWriter writer2 = new HtmlTextWriter(writer); this.lblExport.RenderControl(writer2); base.Response.Write(writer.ToString()); </code></pre>
[ { "answer_id": 127334, "author": "Erikk Ross", "author_id": 18772, "author_profile": "https://Stackoverflow.com/users/18772", "pm_score": 2, "selected": true, "text": "public override void VerifyRenderingInServerForm(Control control)\n {\n }\n" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/127316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8741/" ]
127,318
<p>I want to programmatically edit file content using windows command line (<a href="http://en.wikipedia.org/wiki/Windows_command_line" rel="noreferrer">cmd.exe</a>). In *nix there is <a href="http://en.wikipedia.org/wiki/Sed" rel="noreferrer">sed</a> for this tasks. Is there any useful native equivalent in windows?</p>
[ { "answer_id": 127567, "author": "b w", "author_id": 4126, "author_profile": "https://Stackoverflow.com/users/4126", "pm_score": 7, "selected": false, "text": "sed" }, { "answer_id": 5728961, "author": "Rober", "author_id": 339460, "author_profile": "https://Stackover...
2008/09/24
[ "https://Stackoverflow.com/questions/127318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2361/" ]
127,328
<p>I have a class that defines the names of various constants, e.g.</p> <pre><code>class Constants { public static final String ATTR_CURRENT_USER = "current.user"; } </code></pre> <p>I would like to use these constants within a JSP <strong>without</strong> using Scriptlet code such as:</p> <pre><code>&lt;%@ page import="com.example.Constants" %&gt; &lt;%= Constants.ATTR_CURRENT_USER %&gt; </code></pre> <p>There appears to be a tag in the Apache <a href="http://jakarta.apache.org/taglibs/sandbox/doc/unstandard-doc/index.html#useConstants" rel="noreferrer">unstandard</a> taglib that provides this functionality. However, I cannot find any way to download this taglib. I'm beginning to wonder if it's been deprecated and the functionality has been moved to another (Apache) tag library?</p> <p>Does anyone know where I can get this library, or if it's not available, if there's some other way I can access constants in a JSP without using scriptlet code?</p> <p>Cheers, Don</p>
[ { "answer_id": 127442, "author": "ncgz", "author_id": 12905, "author_profile": "https://Stackoverflow.com/users/12905", "pm_score": 2, "selected": false, "text": "servletContext.setAttribute(\"Constants\", com.example.Constants);\n" }, { "answer_id": 128234, "author": "paulgr...
2008/09/24
[ "https://Stackoverflow.com/questions/127328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
127,336
<p>Outlook saves its client-side rule definitions in a binary blob in a hidden message in the Inbox folder of the default store for a profile. The hidden message is named <em>"Outlook Rules Organizer"</em> with a message class <code>IPM.RuleOrganizer</code>. The binary blob is saved in property 0x6802. The same binary blob is written to the exported RWZ file when you manually export the rules through the Rules and Alerts Wizard.</p> <p>Has anyone deciphered the layout of this binary blob?</p>
[ { "answer_id": 127442, "author": "ncgz", "author_id": 12905, "author_profile": "https://Stackoverflow.com/users/12905", "pm_score": 2, "selected": false, "text": "servletContext.setAttribute(\"Constants\", com.example.Constants);\n" }, { "answer_id": 128234, "author": "paulgr...
2008/09/24
[ "https://Stackoverflow.com/questions/127336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21685/" ]
127,363
<p>I need to create S/MIME messages using C# (as specified in RFC 2633, "S/MIME Version 3 message specification", and RFC 3335). The only S/MIME library I can find is a commercial library (<a href="http://www.example-code.com/csharp/smime.asp" rel="noreferrer">http://www.example-code.com/csharp/smime.asp</a>), which is no good for us.</p> <p>Are there any existing libraries to accomplish creating S/MIME messages, and in particular, .p7s files?</p> <p>I have all the encrypted and signed elements that need to go into this file, but I'd like to create the .p7s file without handrolling my own library with the aid of the RFC document...</p> <hr> <p>EDIT: I've found another <a href="http://www.eldos.com/sbb/desc-mime.php" rel="noreferrer">commercial S/MIME library</a>, which is still no good for our requirements. It's looking more and more like I'm going to have to hand roll a S/MIME library, which is sad. Is everyone in .net who needs S/MIME using commercial, closed source libraries to do it?</p>
[ { "answer_id": 18392068, "author": "Bert Johnson", "author_id": 2709133, "author_profile": "https://Stackoverflow.com/users/2709133", "pm_score": 2, "selected": false, "text": "// Instantiate a new SMTP connection to Gmail using TLS/SSL protection.\nSmtpClient smtpClient = new SmtpClient...
2008/09/24
[ "https://Stackoverflow.com/questions/127363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21002/" ]
127,386
<p>In Visual Studio, we've all had "baadf00d", have seen seen "CC" and "CD" when inspecting variables in the debugger in C++ during run-time.</p> <p>From what I understand, "CC" is in DEBUG mode only to indicate when a memory has been new() or alloc() and unitilialized. While "CD" represents delete'd or free'd memory. I've only seen "baadf00d" in RELEASE build (but I may be wrong).</p> <p>Once in a while, we get into a situation of tacking memory leaks, buffer overflows, etc and these kind of information comes in handy.</p> <p>Would somebody be kind enough to point out when and in what modes the memory are set to recognizable byte patterns for debugging purpose?</p>
[ { "answer_id": 48255562, "author": "Glenn Slayden", "author_id": 147511, "author_profile": "https://Stackoverflow.com/users/147511", "pm_score": 3, "selected": false, "text": "0xCC" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/127386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7234/" ]
127,389
<p>Today I stumbled about a Problem which seems to be a bug in the Zend-Framework. Given the following route:</p> <pre><code>&lt;test&gt; &lt;route&gt;citytest/:city&lt;/route&gt; &lt;defaults&gt; &lt;controller&gt;result&lt;/controller&gt; &lt;action&gt;test&lt;/action&gt; &lt;/defaults&gt; &lt;reqs&gt; &lt;city&gt;.+&lt;/city&gt; &lt;/reqs&gt; &lt;/test&gt; </code></pre> <p>and three Urls:</p> <ul> <li>mysite.local/citytest/Berlin</li> <li>mysite.local/citytest/Hamburg</li> <li>mysite.local/citytest/M%FCnchen </li> </ul> <p>the last Url does not match and thus the correct controller is not called. Anybody got a clue why?</p> <p>Fyi, where are using Zend-Framework 1.0 ( Yeah, I know that's ancient but I am not in charge to change that :-/ )</p> <p>Edit: From what I hear, we are going to upgrade to Zend 1.5.6 soon, but I don't know when, so a Patch would be great.</p> <p>Edit: I've tracked it down to the following line (Zend/Controller/Router/Route.php:170):</p> <pre><code>$regex = $this-&gt;_regexDelimiter . '^' . $part['regex'] . '$' . $this-&gt;_regexDelimiter . 'iu'; </code></pre> <p>If I change that to </p> <pre><code> $this-&gt;_regexDelimiter . 'i'; </code></pre> <p>it works. From what I understand, the u-modifier is for working with asian characters. As I don't use them, I'm fine with that patch for know. Thanks for reading.</p>
[ { "answer_id": 127818, "author": "troelskn", "author_id": 18180, "author_profile": "https://Stackoverflow.com/users/18180", "pm_score": 1, "selected": false, "text": "ü" }, { "answer_id": 144192, "author": "Stefan Gehrig", "author_id": 11354, "author_profile": "https:...
2008/09/24
[ "https://Stackoverflow.com/questions/127389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18606/" ]
127,391
<p>I was asked a question in C last night and I did not know the answer since I have not used C much since college so I thought maybe I could find the answer here instead of just forgetting about it.</p> <p>If a person has a define such as:</p> <pre><code>#define count 1 </code></pre> <p>Can that person find the variable name <code>count</code> using the 1 that is inside it?</p> <p>I did not think so since I thought the count would point to the 1 but do not see how the 1 could point back to count.</p>
[ { "answer_id": 127402, "author": "Remo.D", "author_id": 16827, "author_profile": "https://Stackoverflow.com/users/16827", "pm_score": 0, "selected": false, "text": "#define count 1\n" }, { "answer_id": 127407, "author": "Cade Roux", "author_id": 18255, "author_profile...
2008/09/24
[ "https://Stackoverflow.com/questions/127391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16354/" ]
127,395
<p>Is there a way when creating web services to specify the types to use? Specifically, I want to be able to use the same type on both the client and server to reduce duplication of code.</p> <p>Over simplified example:</p> <pre><code> public class Name { public string FirstName {get; set;} public string Surname { get; set; } public override string ToString() { return string.Concat(FirstName, " ", Surname); } } </code></pre> <p>I don't want to have recode pieces of functionality in my class. The other thing is that any code that exists that manipulates this class won't work client side as the client side class that is generated would be a different type.</p>
[ { "answer_id": 127910, "author": "MusiGenesis", "author_id": 14606, "author_profile": "https://Stackoverflow.com/users/14606", "pm_score": 0, "selected": false, "text": "public struct Whatever\n{\n public string A;\n public int B;\n}\n" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/127395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9539/" ]
127,411
<p>Is there a project that maintains annotations for patterns?</p> <p><p>For example, when I write a builder, I want to mark it with <code>@Builder</code>.</p> <p><p>Annotating in this way immediately provides a clear idea of what the code implements. Also, the Javadoc of the <code>@Builder</code> annotation can reference explanations of the builder pattern. Furthermore, navigating from the Javadoc of a builder implementation to <code>@Builder</code> Javadoc is made easy by annotating <code>@Builder</code> with <code>@Documented</code>.</p> <p><p>I've being slowing accumulating a small set of such annotations for patterns and idioms that I have in my code, but I'd like to leverage a more complete existing project if it exists. If there is no such project, maybe I can share what I have by spinning it off to a separate pattern/idiom annotation project.</p> <p><p>Update: I've created the <a href="http://code.google.com/p/patternnotes" rel="noreferrer">Pattern Notes project</a> in response to this discussion. Contributions welcome! Here is <a href="http://code.google.com/p/patternnotes/source/browse/trunk/trunk/src/com/iparelan/annotations/patterns/Builder.java" rel="noreferrer"><code>@Builder</code></a></p>
[ { "answer_id": 1543918, "author": "elhoim", "author_id": 171469, "author_profile": "https://Stackoverflow.com/users/171469", "pm_score": 2, "selected": false, "text": "Serializable" }, { "answer_id": 1843217, "author": "Martin Harris", "author_id": 224306, "author_pro...
2008/09/24
[ "https://Stackoverflow.com/questions/127411", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13940/" ]
127,412
<p>Is there a indexing plugin for GDS that allows for source code search? I see some for specific types (Java, C++, ...) and one for "any text". These are nice, but I would like one that allows for many/configurable extensions (HTML, CSS, JS, VB, C#, Java, Python, ...). A huge bonus would be to allow for syntax highlighting (<a href="http://pygments.org/" rel="noreferrer">http://pygments.org/</a>) in the cache.</p>
[ { "answer_id": 2416289, "author": "HaveAGuess", "author_id": 57344, "author_profile": "https://Stackoverflow.com/users/57344", "pm_score": 0, "selected": false, "text": "<YOUR SEARCH> filetype:java under:\"C:\\hft\\trunk\"\n" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/127412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4231/" ]
127,413
<p>I have user control named DateTimeUC which has two textboxes on its markup:</p> <pre><code>&lt;asp:TextBox ID="dateTextBox" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:TextBox ID="timeTextBox" runat="server"&gt;&lt;/asp:TextBox&gt; </code></pre> <p>I am dynamically creating this control in another user control:</p> <pre><code>Controls.Add(GenerateDateTime(parameter)); private DateTimeUC GenerateDateTime(SomeParameter parameter) { DateTimeUC uc = new DateTimeUC(); uc.ID = parameter.Name; return uc; } </code></pre> <p>But when I render the page, DateTimeUC renders nothing. I checked it like this:</p> <pre><code>protected override void Render(HtmlTextWriter writer) { base.Render(writer); StringBuilder builder = new StringBuilder(); StringWriter swriter = new StringWriter(builder); HtmlTextWriter hwriter = new HtmlTextWriter(swriter); base.Render(hwriter); string s = builder.ToString(); } </code></pre> <p>s is empty and Controls.Count is 0. What am I doing wrong?</p>
[ { "answer_id": 127438, "author": "TcKs", "author_id": 20382, "author_profile": "https://Stackoverflow.com/users/20382", "pm_score": 4, "selected": true, "text": "LoadControl( \"your_user_control_app_relative_path.ascx\" )" }, { "answer_id": 127499, "author": "Briggie Smalls",...
2008/09/24
[ "https://Stackoverflow.com/questions/127413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31505/" ]
127,426
<p>I have defined an interface in C++, i.e. a class containing only pure virtual functions.</p> <p>I want to explicitly forbid users of the interface to delete the object through a pointer to the interface, so I declared a protected and non-virtual destructor for the interface, something like:</p> <pre><code>class ITest{ public: virtual void doSomething() = 0; protected: ~ITest(){} }; void someFunction(ITest * test){ test-&gt;doSomething(); // ok // deleting object is not allowed // delete test; } </code></pre> <p>The GNU compiler gives me a warning saying:</p> <blockquote> <p>class 'ITest' has virtual functions but non-virtual destructor</p> </blockquote> <p>Once the destructor is protected, what is the difference in having it virtual or non-virtual?</p> <p>Do you think this warning can be safely ignored or silenced?</p>
[ { "answer_id": 127486, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 0, "selected": false, "text": "ITest" }, { "answer_id": 127557, "author": "bk1e", "author_id": 8090, "author_profile": "https:/...
2008/09/24
[ "https://Stackoverflow.com/questions/127426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15622/" ]
127,459
<p>I need to be able to change the users' password through a web page (in a controlled environment). So, for that, I'm using this code:</p> <pre><code>&lt;?php $output = shell_exec("sudo -u dummy passwd testUser testUserPassword"); $output2 = shell_exec("dummyPassword"); echo $output; echo $output2; echo "done"; ?&gt; </code></pre> <p>My problem is that this script is not changing the password for the user "testUser". What am I doing wrong?</p> <p>Thanks</p>
[ { "answer_id": 127495, "author": "Jeremy", "author_id": 1114, "author_profile": "https://Stackoverflow.com/users/1114", "pm_score": 2, "selected": false, "text": "shell_exec" }, { "answer_id": 127574, "author": "Jeremy DeGroot", "author_id": 20820, "author_profile": "...
2008/09/24
[ "https://Stackoverflow.com/questions/127459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2019426/" ]
127,461
<p>A coworker of mine has this problem, apparently after installing Re#, which seems totally irrelevant. But perhaps it isn't.</p> <p>Could not load file or assembly "SqlManagerUi, Version=9.0.242.0..." or one of its dependencies. The module was expected to contain an assembly manifest. (mscorlib).</p> <p>Why is this?</p> <p>Thanks</p>
[ { "answer_id": 56600620, "author": "Fabricio Leite", "author_id": 6780871, "author_profile": "https://Stackoverflow.com/users/6780871", "pm_score": 3, "selected": false, "text": "C:\\Program Files (x86)\\Microsoft SQL Server Management Studio 18\\Common7\\IDE\\Ssms.exe.config" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/127461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21692/" ]
127,477
<p>In WPF you can setup validation based on errors thrown in your Data Layer during Data Binding using the <code>ExceptionValidationRule</code> or <code>DataErrorValidationRule</code>.</p> <p>Suppose you had a bunch of controls set up this way and you had a Save button. When the user clicks the Save button, you need to make sure there are no validation errors before proceeding with the save. If there are validation errors, you want to holler at them.</p> <p>In WPF, how do you find out if any of your Data Bound controls have validation errors set?</p>
[ { "answer_id": 128346, "author": "aogan", "author_id": 4795, "author_profile": "https://Stackoverflow.com/users/4795", "pm_score": 6, "selected": false, "text": "public static class Validator\n{\n\n public static bool IsValid(DependencyObject parent)\n {\n // Validate all th...
2008/09/24
[ "https://Stackoverflow.com/questions/127477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4407/" ]
127,492
<p>I have an EAR file that contains two WARs, war1.war and war2.war. My application.xml file looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;application version="5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"&gt; &lt;display-name&gt;MyEAR&lt;/display-name&gt; &lt;module&gt; &lt;web&gt; &lt;web-uri&gt;war1.war&lt;/web-uri&gt; &lt;context-root&gt;/&lt;/context-root&gt; &lt;/web&gt; &lt;/module&gt; &lt;module&gt; &lt;web&gt; &lt;web-uri&gt;war2.war&lt;/web-uri&gt; &lt;context-root&gt;/war2location&lt;/context-root&gt; &lt;/web&gt; &lt;/module&gt; &lt;/application&gt; </code></pre> <p>This results in war2.war being available on <strong><a href="http://localhost:8080/war2location" rel="nofollow noreferrer">http://localhost:8080/war2location</a></strong>, which is correct, but war1.war is on <strong><a href="http://localhost:8080//" rel="nofollow noreferrer">http://localhost:8080//</a></strong> -- note the two slashes.</p> <p>What am I doing wrong?</p> <p>Note that the WARs' sun-web.xml files get ignored when contained in an EAR.</p>
[ { "answer_id": 127548, "author": "Joseph Daigle", "author_id": 507, "author_profile": "https://Stackoverflow.com/users/507", "pm_score": 0, "selected": false, "text": "http://localhost:8080//" }, { "answer_id": 127566, "author": "Panagiotis Korros", "author_id": 19331, ...
2008/09/24
[ "https://Stackoverflow.com/questions/127492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13455/" ]
127,498
<p>What guidelines can you give for rich HTML formatting in emails while maintaining good visual stability across many clients and web based email interfaces?</p> <p>An unrelated answer on a question on Stack Overflow suggested:</p> <p><a href="http://www.campaignmonitor.com/blog/archives/2008/05/2008_email_design_guidelines.html" rel="noreferrer">http://www.campaignmonitor.com/blog/archives/2008/05/2008_email_design_guidelines.html</a></p> <p>Which contains the following guidelines:</p> <ol> <li><strong>Place stylesheet in <code>&lt;body&gt;</code> instead of <code>&lt;head&gt;</code></strong><br> Some email clients will strip CSS out of the head, but leave it if the style block is (invalidly) in the body. </li> <li><strong>Use inline styles where ever possible</strong><br> Gmail will strip any stylesheet, whether in the <code>&lt;head&gt;</code> or in the <code>&lt;body&gt;</code>, but honor inline styles assigned using the <code>style=""</code> attribute</li> <li><strong>Return to tables</strong><br> Email standards have actually taken a giant step backwards in recent years thanks to Outlook 2007 using the Microsoft Word rendering engine. Unlearn most of what you learned about positioning without stylesheets.</li> <li><strong>Don't rely on images</strong><br> Most clients and most web based email clients will not display images unless the user specifically requests them to be displayed.</li> </ol> <p>I also have a few "unconfirmed" truths that I don't remember where I read them.</p> <ol> <li><strong>Don't use more than two levels of nesting in tables</strong><br> Is this true. What is likely to happen if I do? Is there any particular client/clients that choke on this?</li> <li><strong>Be careful of nesting background images in cells/tables</strong><br> As I understand you may encounter situations where the background image is applied in the descending table/cell completely anew, and not just "shining through". Again, true or not? Which clients?</li> </ol> <p>I would like to flesh out this list with more guidelines and experiences from the trenches.</p> <p><strong>Can you offer any further suggestions?</strong></p> <p><strong>Update:</strong> I'm specifially asking for guidelines for the <strong>design part</strong> in HTML and consistency there of. Questions about general guidelines for <a href="https://stackoverflow.com/questions/371/how-do-you-make-sure-email-you-send-programmatically-is-not-automatically-marke">avoiding spam filters</a>, and <a href="https://stackoverflow.com/questions/120107/guidelines-for-email-newsletter-service">common courtesy</a> are already on SO.</p>
[ { "answer_id": 127576, "author": "Dan", "author_id": 17121, "author_profile": "https://Stackoverflow.com/users/17121", "pm_score": 6, "selected": false, "text": "style" }, { "answer_id": 127706, "author": "jj33", "author_id": 430, "author_profile": "https://Stackoverf...
2008/09/24
[ "https://Stackoverflow.com/questions/127498", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2105/" ]
127,514
<p>I am writing a program which has two panes (via <code>CSplitter</code>), however I am having problems figuring out out to resize the controls in each frame. For simplicity, can someone tell me how I would do it for a basic frame with a single <code>CEdit</code> control? </p> <p>I'm fairly sure it is to do with the <code>CEdit::OnSize()</code> function... But I'm not really getting anywhere...</p> <p>Thanks! :)</p>
[ { "answer_id": 127520, "author": "Rob", "author_id": 9236, "author_profile": "https://Stackoverflow.com/users/9236", "pm_score": 4, "selected": true, "text": "void CMyPane::OnSize(UINT nType, int cx, int cy)\n{\n m_wndEdit.SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOMOVE | SWP_NOACTIVATE |...
2008/09/24
[ "https://Stackoverflow.com/questions/127514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18664/" ]
127,530
<p>I'm adding a new field to a list and view. To add the field to the view, I'm using this code:</p> <pre><code>view.ViewFields.Add("My New Field"); </code></pre> <p>However this just tacks it on to the end of the view. How do I add the field to a particular column, or rearrange the field order? view.ViewFields is an SPViewFieldCollection object that inherits from SPBaseCollection and there are no Insert / Reverse / Sort / RemoveAt methods available.</p>
[ { "answer_id": 127859, "author": "Alex Angas", "author_id": 6651, "author_profile": "https://Stackoverflow.com/users/6651", "pm_score": 3, "selected": true, "text": "string[] fieldNames = new string[] { \"Title\", \"My New Field\", \"Modified\", \"Created\" };\nSPViewFieldCollection view...
2008/09/24
[ "https://Stackoverflow.com/questions/127530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6651/" ]
127,534
<p>We have a couple of developers asking for <code>allow_url_fopen</code> to be enabled on our server. What's the norm these days and if <code>libcurl</code> is enabled is there really any good reason to allow?</p> <p>Environment is: Windows 2003, PHP 5.2.6, FastCGI</p>
[ { "answer_id": 127562, "author": "Daniel Papasian", "author_id": 7548, "author_profile": "https://Stackoverflow.com/users/7548", "pm_score": 5, "selected": true, "text": "allow_url_include" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/127534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/419/" ]
127,556
<p>I have a listbox where the items contain checkboxes:</p> <pre><code>&lt;ListBox Style="{StaticResource CheckBoxListStyle}" Name="EditListBox"&gt; &lt;ListBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;CheckBox Click="Checkbox_Click" IsChecked="{Binding Path=IsChecked, Mode=TwoWay}" Content="{Binding Path=DisplayText}" /&gt; &lt;/DataTemplate&gt; &lt;/ListBox.ItemTemplate&gt; &lt;/ListBox&gt; </code></pre> <p>The problem I'm having is that when I click on the checkbox or its content, the parent ListBoxItem does not get selected. If I click on the white space next to the checkbox, the ListBoxItem does get selected.</p> <p>The behavior that I'm trying to get is to be able to select one or many items in the list and use the spacebar to toggle the checkboxes on and off.</p> <p>Some more info:</p> <pre><code>private void Checkbox_Click(object sender, RoutedEventArgs e) { CheckBox chkBox = e.OriginalSource as CheckBox; } </code></pre> <p>In the code above when I click on a checkbox, e.Handled is false and chkBox.Parent is null.</p> <p>Kent's answer put me down the right path, here's what I ended up with:</p> <pre><code>&lt;ListBox Style="{StaticResource CheckBoxListStyle}" Name="EditListBox" PreviewKeyDown="ListBox_PreviewKeyDown"&gt; &lt;ListBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;CheckBox IsChecked="{Binding Path=IsChecked, Mode=TwoWay}" /&gt; &lt;TextBlock Text="{Binding DisplayText}"/&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/ListBox.ItemTemplate&gt; &lt;/ListBox&gt; </code></pre> <p>I had to use PreviewKeyDown because by default when you hit the spacebar in a list box, it deselects everything except for the most recently selected item.</p>
[ { "answer_id": 127589, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 4, "selected": true, "text": "CheckBox" }, { "answer_id": 133823, "author": "Vassili Altynikov", "author_id": 22205, "author_prof...
2008/09/24
[ "https://Stackoverflow.com/questions/127556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2284/" ]
127,564
<p>I have come to realize that Windbg is a very powerful debugger for the Windows platform &amp; I learn something new about it once in a while. Can fellow Windbg users share some of their mad skills?</p> <p>ps: I am not looking for a nifty command, those can be found in the documentation. How about sharing tips on doing something that one couldn't otherwise imagine could be done with windbg? e.g. Some way to generate statistics about memory allocations when a process is run under windbg.</p>
[ { "answer_id": 127875, "author": "Kris Kumler", "author_id": 4281, "author_profile": "https://Stackoverflow.com/users/4281", "pm_score": 5, "selected": false, "text": ".cmdtree <file>" }, { "answer_id": 159483, "author": "Community", "author_id": -1, "author_profile":...
2008/09/24
[ "https://Stackoverflow.com/questions/127564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15071/" ]
127,587
<p>I'm trying to use <a href="http://trac.videolan.org/jvlc/" rel="nofollow noreferrer">JVLC</a> but I can't seem to get it work. I've downloaded the jar, I installed <a href="http://www.videolan.org/vlc/" rel="nofollow noreferrer">VLC</a> and passed the -D argument to the JVM telling it where VLC is installed. I also tried:</p> <pre><code>NativeLibrary.addSearchPath("libvlc", "C:\\Program Files\\VideoLAN\\VLC"); </code></pre> <p>with no luck. I always get:</p> <blockquote> <p>Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'libvlc': The specified module could not be found.</p> </blockquote> <p>Has anyone made it work?</p>
[ { "answer_id": 127875, "author": "Kris Kumler", "author_id": 4281, "author_profile": "https://Stackoverflow.com/users/4281", "pm_score": 5, "selected": false, "text": ".cmdtree <file>" }, { "answer_id": 159483, "author": "Community", "author_id": -1, "author_profile":...
2008/09/24
[ "https://Stackoverflow.com/questions/127587", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20459/" ]
127,591
<p>How do I make <kbd>Caps Lock</kbd> work like <kbd>Esc</kbd> in Mac OS X?</p>
[ { "answer_id": 249923, "author": "eelco", "author_id": 8293, "author_profile": "https://Stackoverflow.com/users/8293", "pm_score": 5, "selected": false, "text": "map <Help> <Esc>\nmap! <Help> <Esc>\nmap <Insert> <Esc>\nmap! <Insert> <Esc>\n" }, { "answer_id": 8437594, "auth...
2008/09/24
[ "https://Stackoverflow.com/questions/127591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7706/" ]
127,598
<p>So, I have Flex project that loads a Module using the ModuleManager - not the module loader. The problem that I'm having is that to load an external asset (like a video or image) the path to load that asset has to be relative to the Module swf...not relative to the swf that loaded the module.</p> <p>The question is - How can I load an asset into a loaded module using a path relative to the parent swf, not the module swf?</p> <hr> <p>Arg! So in digging through the SWFLoader Class I found this chunk of code in private function loadContent:</p> <pre><code> // make relative paths relative to the SWF loading it, not the top-level SWF if (!(url.indexOf(":") &gt; -1 || url.indexOf("/") == 0 || url.indexOf("\\") == 0)) { var rootURL:String; if (SystemManagerGlobals.bootstrapLoaderInfoURL != null &amp;&amp; SystemManagerGlobals.bootstrapLoaderInfoURL != "") rootURL = SystemManagerGlobals.bootstrapLoaderInfoURL; else if (root) rootURL = LoaderUtil.normalizeURL(root.loaderInfo); else if (systemManager) rootURL = LoaderUtil.normalizeURL(DisplayObject(systemManager).loaderInfo); if (rootURL) { var lastIndex:int = Math.max(rootURL.lastIndexOf("\\"), rootURL.lastIndexOf("/")); if (lastIndex != -1) url = rootURL.substr(0, lastIndex + 1) + url; } } } </code></pre> <p>So apparently, Adobe has gone through the extra effort to make images load in the actual swf and not the top level swf (with no flag to choose otherwise...), so I guess I should submit a feature request to have some sort of "load relative to swf" flag, edit the SWFLoader directly, or maybe I should have everything relative to the individual swf and not the top level...any suggestions?</p>
[ { "answer_id": 132670, "author": "hasseg", "author_id": 4111, "author_profile": "https://Stackoverflow.com/users/4111", "pm_score": 3, "selected": true, "text": "mx.core.Application" }, { "answer_id": 2252676, "author": "Fréderic Cox", "author_id": 271921, "author_pro...
2008/09/24
[ "https://Stackoverflow.com/questions/127598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3435/" ]
127,606
<p>I'm trying to generate customized xml files from a template xml file in python. </p> <p>Conceptually, I want to read in the template xml, remove some elements, change some text attributes, and write the new xml out to a file. I wanted it to work something like this:</p> <pre><code>conf_base = ConvertXmlToDict('config-template.xml') conf_base_dict = conf_base.UnWrap() del conf_base_dict['root-name']['level1-name']['leaf1'] del conf_base_dict['root-name']['level1-name']['leaf2'] conf_new = ConvertDictToXml(conf_base_dict) </code></pre> <p>now I want to write to file, but I don't see how to get to ElementTree.ElementTree.write() </p> <pre><code>conf_new.write('config-new.xml') </code></pre> <p>Is there some way to do this, or can someone suggest doing this a different way? </p>
[ { "answer_id": 127678, "author": "Torsten Marek", "author_id": 9567, "author_profile": "https://Stackoverflow.com/users/9567", "pm_score": 4, "selected": false, "text": "import xml.etree.ElementTree as ET\ndoc = ET.parse(\"template.xml\")\nlvl1 = doc.findall(\"level1-name\")[0]\nlvl1.rem...
2008/09/24
[ "https://Stackoverflow.com/questions/127606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1489/" ]
127,610
<p>I have an SSIS package, which depending on a boolean variable, should either go to a Script Task or an Email task.(Note: the paths are coming <em>from</em> a Script Task)</p> <p>I recall in the old dts designer there was a way to do this via code. What is the proper way to accomplish this in SSIS?</p>
[ { "answer_id": 129159, "author": "Meff", "author_id": 9647, "author_profile": "https://Stackoverflow.com/users/9647", "pm_score": 2, "selected": false, "text": "@[User::SendEmail] == True\n" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/127610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/343291/" ]
127,625
<p>I'm currently working on a class that calculates the difference between two objects. I'm trying to decide what the best design for this class would be. I see two options:</p> <p>1) Single-use class instance. Takes the objects to diff in the constructor and calculates the diff for that.</p> <pre><code>public class MyObjDiffer { public MyObjDiffer(MyObj o1, MyObj o2) { // Calculate diff here and store results in member variables } public boolean areObjectsDifferent() { // ... } public Vector getOnlyInObj1() { // ... } public Vector getOnlyInObj2() { // ... } // ... } </code></pre> <p>2) Re-usable class instance. Constructor takes no arguments. Has a "calculateDiff()" method that takes the objects to diff, and returns the results.</p> <pre><code>public class MyObjDiffer { public MyObjDiffer() { } public DiffResults getResults(MyObj o1, MyObj o2) { // calculate and return the results. Nothing is stored in this class's members. } } public class DiffResults { public boolean areObjectsDifferent() { // ... } public Vector getOnlyInObj1() { // ... } public Vector getOnlyInObj2() { // ... } } </code></pre> <p>The diffing will be fairly complex (details don't matter for the question), so there will need to be a number of helper functions. If I take solution 1 then I can store the data in member variables and don't have to pass everything around. It's slightly more compact, as everything is handled within a single class.</p> <p>However, conceptually, it seems weird that a "Differ" would be specific to a certain set of results. Option 2 splits the results from the logic that actually calculates them.</p> <p>EDIT: Option 2 also provides the ability to make the "MyObjDiffer" class static. Thanks kitsune, I forgot to mention that.</p> <p>I'm having trouble seeing any significant pro or con to either option. I figure this kind of thing (a class that just handles some one-shot calculation) has to come up fairly often, and maybe I'm missing something. So, I figured I'd pose the question to the cloud. Are there significant pros or cons to one or the other option here? Is one inherently better? Does it matter?</p> <p>I am doing this in Java, so there might be some restrictions on the possibilities, but the overall question of design is probably language-agnostic.</p>
[ { "answer_id": 127670, "author": "Ben Collins", "author_id": 3279, "author_profile": "https://Stackoverflow.com/users/3279", "pm_score": 0, "selected": false, "text": "public class Diff\n{\n public Diff(String path1, String path2)\n {\n // get diff\n\n if (same)\n ...
2008/09/24
[ "https://Stackoverflow.com/questions/127625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1409/" ]
127,626
<p>I'm trying to install <a href="http://www.maatkit.org/" rel="nofollow noreferrer">Maatkit</a> following <a href="http://maatkit.sourceforge.net/doc/maatkit.html#installation" rel="nofollow noreferrer">the maatkit instructions</a>. I can't get past having to install DBD::mysql. "Warning: prerequisite DBD::mysql 1 not found." When I try to install DBD::mysql from cpan, I get very helpful "make had returned bad status, install seems impossible".</p> <p>Perl is "v5.8.8 built for darwin-thread-multi-2level", the one that came with OS X. I also tried <a href="http://search.cpan.org/dist/DBD-mysql/lib/DBD/mysql.pm#INSTALLATION" rel="nofollow noreferrer">building</a> from source with same result.</p>
[ { "answer_id": 127923, "author": "Corion", "author_id": 21731, "author_profile": "https://Stackoverflow.com/users/21731", "pm_score": 3, "selected": false, "text": "make" }, { "answer_id": 344043, "author": "Community", "author_id": -1, "author_profile": "https://Stac...
2008/09/24
[ "https://Stackoverflow.com/questions/127626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/556/" ]
127,638
<p>Is there a way to prevent someone from faking a mime type on a file upload and then running a php/exe/etc...</p> <p>I have to make the file upload directory writeable and executable so that the files can be stored, but this allows anyone to run a script after. One thing I can do is add random data to the file name so they can't guess the file name after (since they still can't read from the directory to get a listing).</p> <p>I'm using file upload with php for the first time and I'm trying to cover all of the security issues.</p>
[ { "answer_id": 127658, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 3, "selected": true, "text": "remove_all_my_files.php" }, { "answer_id": 127694, "author": "Till", "author_id": 2859, "author_prof...
2008/09/24
[ "https://Stackoverflow.com/questions/127638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12529/" ]
127,645
<p>When an error occurs in a function, I'd like to know the sequence of events that lead up to it, especially when that function is called from a dozen different places. Is there any way to retrieve the call stack in VB6, or do I have to do it the hard way (e.g., log entries in every function and error handler, etc.)?</p>
[ { "answer_id": 206726, "author": "JeffK", "author_id": 5420, "author_profile": "https://Stackoverflow.com/users/5420", "pm_score": 4, "selected": false, "text": "Private Function DoSomething(ByVal Arg as String)\n\n On Error GoTo Handler\n\n Dim ThisVar as String\n Dim ThatVar a...
2008/09/24
[ "https://Stackoverflow.com/questions/127645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4228/" ]
127,654
<p>I'm working on an existing report and I would like to test it with the database. The problem is that the catalog set during the initial report creation no longer exists. I just need to change the catalog parameter to a new database. The report is using a stored proc for its data. It looks like if try and remove the proc to re-add it all the fields on the report will disapear and I'll have to start over.</p> <p>I'm working in the designer in Studio and just need to tweak the catalog property to get a preview. I have code working to handle things properly from the program.</p>
[ { "answer_id": 127674, "author": "Quintin Robinson", "author_id": 12707, "author_profile": "https://Stackoverflow.com/users/12707", "pm_score": 0, "selected": false, "text": "report.SetDatabaseLogon(UserID, Password, ServerName, DatabaseName);\n" }, { "answer_id": 135406, "au...
2008/09/24
[ "https://Stackoverflow.com/questions/127654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2862/" ]
127,669
<p>I have a computer A with two directory trees. The first directory contains the original mod dates that span back several years. The second directory is a copy of the first with a few additional files. There is a second computer be which contains a directory tree which is the same as the second directory on computer A (new mod times and additional files). How update the files in the two newer directories on both machines so that the mod times on the files are the same as the original? Note that these directory trees are in the order of 10s of gigabytes so the solution would have to include some method of sending only the date information to the second computer.</p>
[ { "answer_id": 128307, "author": "Jeremy Bourque", "author_id": 2192597, "author_profile": "https://Stackoverflow.com/users/2192597", "pm_score": 1, "selected": false, "text": "touch" }, { "answer_id": 128316, "author": "Jeremy Bourque", "author_id": 2192597, "author_...
2008/09/24
[ "https://Stackoverflow.com/questions/127669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9940/" ]
127,679
<p>How do I view the grants (access rights) for a given user in MySQL?</p>
[ { "answer_id": 127683, "author": "alanc10n", "author_id": 14059, "author_profile": "https://Stackoverflow.com/users/14059", "pm_score": 6, "selected": true, "text": "mysql> show grants for 'user'@'host'\n" }, { "answer_id": 129533, "author": "igelkott", "author_id": 20521...
2008/09/24
[ "https://Stackoverflow.com/questions/127679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14059/" ]
127,684
<p>I have a REST Java server implemented with Jersey running on Jetty. It seems that certain browsers (IE7) internally caches all requests made to the server. </p> <p>What I would like to do is to send a certain HTTP header in the response from the REST server indicating the browser that it shouldn't cache that response, and so will query the server again the next time it needs access to that resource.</p> <p>Any ideas on how to configure Jersey/Jetty for this? Or the only way to configure it is client-side?</p>
[ { "answer_id": 127723, "author": "Steve g", "author_id": 12092, "author_profile": "https://Stackoverflow.com/users/12092", "pm_score": 2, "selected": false, "text": "response.setHeader(\"Pragma\", \"no-cache\");\nresponse.setHeader(\"Cache-Control\", \"no-cache\");\nresponse.setHeader(\"...
2008/09/24
[ "https://Stackoverflow.com/questions/127684", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12791/" ]
127,704
<p>I want to write a function that takes an array of letters as an argument and a number of those letters to select. </p> <p>Say you provide an array of 8 letters and want to select 3 letters from that. Then you should get:</p> <pre><code>8! / ((8 - 3)! * 3!) = 56 </code></pre> <p>Arrays (or words) in return consisting of 3 letters each.</p>
[ { "answer_id": 127856, "author": "nlucaroni", "author_id": 157, "author_profile": "https://Stackoverflow.com/users/157", "pm_score": 10, "selected": true, "text": "27 = C(6,4) + C(5,3) + C(2,2) + C(1,1)" }, { "answer_id": 127898, "author": "quinmars", "author_id": 18687, ...
2008/09/24
[ "https://Stackoverflow.com/questions/127704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9191/" ]
127,713
<p>Why does the following method hang?</p> <pre> public void pipe(Reader in, Writer out) { CharBuffer buf = CharBuffer.allocate(DEFAULT_BUFFER_SIZE); while( in.read(buf) >= 0 ) { out.append(buf.flip()); } } </pre>
[ { "answer_id": 127729, "author": "Chris Conway", "author_id": 1412, "author_profile": "https://Stackoverflow.com/users/1412", "pm_score": 2, "selected": true, "text": "buf.clear()" }, { "answer_id": 9628316, "author": "Fuwjax", "author_id": 315943, "author_profile": "...
2008/09/24
[ "https://Stackoverflow.com/questions/127713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
127,728
<p>I'm working with ASP.NET 3.5. I have a list box that users must add items to (I've written the code for this). My requirement is that at least one item must be added to the listbox or they cannot submit the form. I have several other validators on the page and they all write to a ValidationSummary control. I would like this listbox validation to write to the Validation Summary control as well. Any help is greatly appreciated. Thank you.</p>
[ { "answer_id": 127983, "author": "stephenbayer", "author_id": 18893, "author_profile": "https://Stackoverflow.com/users/18893", "pm_score": 3, "selected": false, "text": "protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args) \n{\n args.IsValid...
2008/09/24
[ "https://Stackoverflow.com/questions/127728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
127,736
<p>Greetings, currently I am refactoring one of my programs, and I found an interesting problem.</p> <p>I have Transitions in an automata. Transitions always have a start-state and an end-state. Some Transitions have a label, which encodes a certain Action that must be performed upon traversal. No label means no action. Some transitions have a condition, which must be fulfilled in order to traverse this condition, if there is no condition, the transition is basically an epsilon-transition in an NFA and will be traversed without consuming an input symbol.</p> <p>I need the following operations: </p> <ul> <li>check if the transition has a label</li> <li>get this label</li> <li>add a label to a transition</li> <li>check if the transition has a condition </li> <li>get this condition</li> <li>check for equality</li> </ul> <p>Judging from the first five points, this sounds like a clear decorator, with a base transition and two decorators: Labeled and Condition. However, this approach has a problem: two transitions are considered equal if their start-state and end-state are the same, the labels at both transitions are equal (or not-existing) and both conditions are the same (or not existing). With a decorator, I might have two transitions Labeled("foo", Conditional("bar", Transition("baz", "qux"))) and Conditional("bar", Labeled("foo", Transition("baz", "qux"))) which need a non-local equality, that is, the decorators would need to collect all the data and the Transition must compare this collected data on a set-base:</p> <pre><code>class Transition(object): def __init__(self, start, end): self.start = start self.end = end def get_label(self): return None def has_label(self): return False def collect_decorations(self, decorations): return decorations def internal_equality(self, my_decorations, other): try: return (self.start == other.start and self.end == other.end and my_decorations = other.collect_decorations()) def __eq__(self, other): return self.internal_equality(self.collect_decorations({}), other) class Labeled(object): def __init__(self, label, base): self.base = base self.label = label def has_label(self): return True def get_label(self): return self.label def collect_decorations(self, decorations): assert 'label' not in decorations decorations['label'] = self.label return self.base.collect_decorations(decorations) def __getattr__(self, attribute): return self.base.__getattr(attribute) </code></pre> <p>Is this a clean approach? Am I missing something?</p> <p>I am mostly confused, because I can solve this - with longer class names - using cooperative multiple inheritance:</p> <pre><code>class Transition(object): def __init__(self, **kwargs): # init is pythons MI-madness ;-) super(Transition, self).__init__(**kwargs) self.start = kwargs['start'] self.end = kwargs['end'] def get_label(self): return None def get_condition(self): return None def __eq__(self, other): try: return self.start == other.start and self.end == other.end except AttributeError: return False class LabeledTransition(Transition): def __init__(self, **kwargs): super(LabeledTransition).__init__(**kwargs) self.label = kwargs['label'] def get_label(self): return self.label def __eq__(self): super_result = super(LabeledTransition, self).__eq__(other) try: return super_result and self.label == other.label except AttributeError: return False class ConditionalTransition(Transition): def __init__(self, **kwargs): super(ConditionalTransition, self).__init__(**kwargs) self.condition = kwargs['condition'] def get_condition(self): return self.condition def __eq__(self, other): super_result = super(ConditionalTransition, self).__eq__(other) try: return super_result and self.condition = other.condition except AttributeError: return False # ConditionalTransition about the same, with get_condition class LabeledConditionalTransition(LabeledTransition, ConditionalTransition): pass </code></pre> <p>the class LabledConditionalTransition behaves exactly as expected - and having no code in there is appealing and I do not thing MI is confusing at this size.</p> <p>Of course, the third option would be to just hammer everything into a single transition class with a bunch of in has_label/has_transition.</p> <p>So... I am confused. Am I missing something? Which implementation looks better? How do you handle similar cases, that is, objects which look like a Decorator could handle them, but then, such a non-local method comes around?</p> <p><em>EDIT</em>: Added the ConditionalTransition-class. Basically, this kinda behaves like the decorator, minus the order created by the order of creating the decorators, the transition checks for start and end being correct, the LabeledTransition-class checks for label being correct and ConditionalTransition checks for condition being correct.</p>
[ { "answer_id": 128005, "author": "Mark Roddy", "author_id": 9940, "author_profile": "https://Stackoverflow.com/users/9940", "pm_score": 0, "selected": false, "text": "return self.label is not None\n" }, { "answer_id": 219303, "author": "Florian Bösch", "author_id": 19435,...
2008/09/24
[ "https://Stackoverflow.com/questions/127736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17663/" ]
127,739
<pre><code> $a = '{ "tag": "&lt;b&gt;&lt;/b&gt;" }'; echo json_encode( json_decode($a) ); </code></pre> <p>This outputs:</p> <pre><code>{"tag":"&lt;b&gt;&lt;\/b&gt;"} </code></pre> <p>when you would think it would output exactly the input. For some reason json_encode adds an extra slash.</p>
[ { "answer_id": 127775, "author": "Peter Bailey", "author_id": 8815, "author_profile": "https://Stackoverflow.com/users/8815", "pm_score": 5, "selected": true, "text": "any-Unicode-character-\n except-\"-or-\\-or-\n control-character\n\\\"\n\\\\\n\\/ <---- see here?\n\\b\n\\f\n\\n\n...
2008/09/24
[ "https://Stackoverflow.com/questions/127739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19087/" ]
127,753
<p>Is there a more concise/standard idiom (e.g., a JDK method) for "piping" an input to an output in Java than the following?</p> <pre><code>public void pipe(Reader in, Writer out) { CharBuffer buf = CharBuffer.allocate(DEFAULT_BUFFER_SIZE); while (in.read(buf) &gt;= 0 ) { out.append(buf.flip()); buf.clear(); } } </code></pre> <p>[EDIT] Please note the <code>Reader</code> and <code>Writer</code> are <em>given</em>. The correct answer will demonstrate how to take <code>in</code> and <code>out</code> and form a pipe (preferably with no more than 1 or 2 method calls). I will accept answers where <code>in</code> and <code>out</code> are an <code>InputStream</code> and an <code>OutputStream</code> (preferably with a conversion from/to <code>Reader</code>/<code>Writer</code>). I will not accept answers where either <code>in</code> or <code>out</code> is a <em>subclass</em> of <code>Reader</code>/<code>InputStream</code> or <code>Writer</code>/<code>OutputStrem</code>.</p>
[ { "answer_id": 331854, "author": "Henning", "author_id": 7034, "author_profile": "https://Stackoverflow.com/users/7034", "pm_score": 4, "selected": true, "text": "IOUtils.copy(in, out)" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/127753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
127,761
<p>Have you managed to get Aptana Studio debugging to work? I tried following this, but I don't see <code>Windows -&gt; Preferences -&gt; Aptana -&gt; Editors -&gt; PHP -&gt; PHP Interpreters</code> in my menu (I have <code>PHP plugin</code> installed) and any attempt to set up the servers menu gives me "socket error" when I try to debug. <code>Xdebug</code> is installed, confirmed through <code>php info</code>.</p>
[ { "answer_id": 131722, "author": "phatduckk", "author_id": 3896, "author_profile": "https://Stackoverflow.com/users/3896", "pm_score": 3, "selected": true, "text": "[Zend Modules] \nZend Debugger\n" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/127761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/556/" ]
127,771
<p>My problem is:</p> <p>I have a perl script which uses lot of memory (expected behaviour because of caching). But, I noticed that the more I do caching, slower it gets and the process spends most of the time in sleep mode.</p> <p>I thought pre-allocating memory to the process might speed up the performance.</p> <p>Does someone have any ideas here?</p> <p><strong>Update</strong>:</p> <p>I think I am not being very clear here. I will put question in clearer way:</p> <p>I am not looking for the ways of pre-allocating inside the perl script. I dont think that would help me much here. What I am interested in is a way to tell OS to allocate X amount of memory for my perl script so that it does not have to compete with other processes coming in later.</p> <p>Assume that I cant get away with the memory usage. Although, I am exploring ways of reducing that too but dont expect much improvement there. FYI, I am working on a solaris 10 machine.</p>
[ { "answer_id": 127978, "author": "douglashunter", "author_id": 13838, "author_profile": "https://Stackoverflow.com/users/13838", "pm_score": 0, "selected": false, "text": "my @array;\n$#array = 1_000_000; # pre-extend array to one million elements,\n # http://perldoc....
2008/09/24
[ "https://Stackoverflow.com/questions/127771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4406/" ]
127,776
<p>Where can I find the specifications for the various C# languages?</p> <p><em>(EDIT: it appears people voted down because you could 'google' this, however, my original intent was to put an answer with information not found on google. I've accepted the answer with the best google results, as they are relevant to people who haven't paid for VS)</em></p>
[ { "answer_id": 127789, "author": "user7116", "author_id": 7116, "author_profile": "https://Stackoverflow.com/users/7116", "pm_score": 4, "selected": false, "text": ".\\Microsoft Visual Studio 8\\VC#\\Specifications\\1033\n" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/127776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7116/" ]
127,794
<p>Part of the series of controls I am working on obviously involves me lumping some of them together in to composites. I am rapidly starting to learn that this takes consideration (this is all new to me!) :)</p> <p>I basically have a <code>StyledWindow</code> control, which is essentially a glorified <code>Panel</code> with ability to do other bits (like add borders etc).</p> <p>Here is the code that instantiates the child controls within it. Up till this point it seems to have been working correctly with mundane static controls:</p> <pre><code> protected override void CreateChildControls() { _panel = new Panel(); if (_editable != null) _editable.InstantiateIn(_panel); _regions = new List&lt;IAttributeAccessor&gt;(); _regions.Add(_panel); } </code></pre> <p>The problems came today when I tried nesting a more complex control within it. This control uses a reference to the page since it injects JavaScript in to make it a bit more snappy and responsive (the <code>RegisterClientScriptBlock</code> is the only reason I need the page ref).</p> <p>Now, this was causing &quot;object null&quot; errors, but I localized this down to the render method, which was of course trying to call the method against the [null] <code>Page</code> object.</p> <p>What's confusing me is that the control works fine as a standalone, but when placed in the <code>StyledWindow</code> it all goes horribly wrong!</p> <p><strong>So, it looks like I am missing something in either my <code>StyledWindow</code> or <code>ChildControl</code>. Any ideas?</strong></p> <h2>Update</h2> <p>As <a href="https://stackoverflow.com/questions/127794/child-control-initialization-in-custom-composite-in-aspnet#127824">Brad Wilson</a> quite rightly pointed out, you do not see the controls being added to the <code>Controls</code> collection. This is what the <code>_panel</code> is for, this was there to handle that for me, basically then override <code>Controls</code> (I got this from a guide somewhere):</p> <pre><code> Panel _panel; // Sub-Control to store the &quot;Content&quot;. public override ControlCollection Controls { get { EnsureChildControls(); return _panel.Controls; } } </code></pre> <p>I hope that helps clarify things. Apologies.</p> <h2>Update Following <a href="https://stackoverflow.com/questions/127794/child-control-initialization-in-custom-composite-in-aspnet#128299">Longhorn213's Answer</a></h2> <p>Right, I have been doing some playing with the control, placing one within the composite, and one outside. I then got the status of Page at event major event in the control Lifecycle and rendered it to the page.</p> <p>The standalone is working fine and the page is inited as expected. However, the one nested in the Composite is different. It's <code>OnLoad</code> event is not being fired at all! So I am guessing Brad is probably right in that I am not setting up the control hierarchy correctly, can anyone offer some advice as to what I am missing? Is the Panel method not enough? (well, it obviously isn't is it?!) :D</p> <p>Thanks for your help guys, appreciated :)</p>
[ { "answer_id": 128299, "author": "David Basarab", "author_id": 2469, "author_profile": "https://Stackoverflow.com/users/2469", "pm_score": 1, "selected": false, "text": "protected override void OnLoad(EventArgs e)\n{\n\n // Do something to get the script\n string script = GetScript...
2008/09/24
[ "https://Stackoverflow.com/questions/127794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/832/" ]
127,803
<p>I need to parse <a href="https://www.rfc-editor.org/rfc/rfc3339" rel="noreferrer">RFC 3339</a> strings like <code>&quot;2008-09-03T20:56:35.450686Z&quot;</code> into Python's <code>datetime</code> type.</p> <p>I have found <a href="https://docs.python.org/library/datetime.html#datetime.datetime.strptime" rel="noreferrer"><code>strptime</code></a> in the Python standard library, but it is not very convenient.</p> <p>What is the best way to do this?</p>
[ { "answer_id": 127825, "author": "tzot", "author_id": 6899, "author_profile": "https://Stackoverflow.com/users/6899", "pm_score": 5, "selected": false, "text": ">>> datetime.datetime.strptime(\"2008-08-12T12:20:30.656234Z\", \"%Y-%m-%dT%H:%M:%S.Z\")\nValueError: time data did not match f...
2008/09/24
[ "https://Stackoverflow.com/questions/127803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/70293/" ]
127,817
<p>I'm having a little problem and I don't see why, it's easy to go around it, but still I want to understand. </p> <p>I have the following class :</p> <pre><code>public class AccountStatement : IAccountStatement { public IList&lt;IAccountStatementCharge&gt; StatementCharges { get; set; } public AccountStatement() { new AccountStatement(new Period(new NullDate().DateTime,newNullDate().DateTime), 0); } public AccountStatement(IPeriod period, int accountID) { StatementCharges = new List&lt;IAccountStatementCharge&gt;(); StartDate = new Date(period.PeriodStartDate); EndDate = new Date(period.PeriodEndDate); AccountID = accountID; } public void AddStatementCharge(IAccountStatementCharge charge) { StatementCharges.Add(charge); } </code></pre> <p>}</p> <p>(note startdate,enddate,accountID are automatic property to...)</p> <p>If I use it this way :</p> <pre><code>var accountStatement = new AccountStatement{ StartDate = new Date(2007, 1, 1), EndDate = new Date(2007, 1, 31), StartingBalance = 125.05m }; </code></pre> <p>When I try to use the method "AddStatementCharge: I end up with a "null" StatementCharges list... In step-by-step I clearly see that my list get a value, but as soon as I quit de instantiation line, my list become "null"</p>
[ { "answer_id": 127840, "author": "Brad Wilson", "author_id": 1554, "author_profile": "https://Stackoverflow.com/users/1554", "pm_score": 5, "selected": true, "text": "public AccountStatement()\n{\n new AccountStatement(new Period(new NullDate().DateTime,newNullDate().DateTime), 0);\n}...
2008/09/24
[ "https://Stackoverflow.com/questions/127817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7419/" ]
127,842
<p>We are writing a search application that saves the search criteria to session state and executes the search inside of an asp.net updatepanel. Sometimes when we execute multiple searches successively the 2nd or 3rd search will sometimes return results from the first set of search criteria. </p> <p>Example: our first search we do a look up on "John Smith" -> John Smith results are displayed. The second search we do a look up on "Bob Jones" -> John Smith results are displayed. </p> <p>We save all of the search criteria in session state as I said, and read it from session state inside of the ajax request to format the DB query. When we put break points in VS everything behaves as normal, but without them we get the original search criteria and results.</p> <p>My guess is because they are saved in session, that the ajax request somehow gets its own session and saves the criteria to that, and then retrieves the criteria from that session every time, but the non-async stuff is able to see when the criteria is modified and saves the changes to state accordingly, but because they are from two different sessions there is a disparity in what is saved and read.</p> <p>EDIT::: To elaborate more, there was a suggestion of appending the search criteria to the query string which normally is good practice and I agree thats how it should be but following our requirements I don't see it as being viable. They want it so the user fills out the input controls hits search and there is no page reload, the only thing they see is a progress indicator on the page, and they still have the ability to navigate and use other features on the current page. If I were to add criteria to the query string I would have to do another request causing the whole page to load, which depending on the search criteria can take a really long time. This is why we are using an ajax call to perform the search and why we aren't causing another full page request..... I hope this clarifies the situation.</p>
[ { "answer_id": 127903, "author": "palehorse", "author_id": 312, "author_profile": "https://Stackoverflow.com/users/312", "pm_score": 2, "selected": false, "text": "[WebMethod( EnableSession=true )]\npublic static void DoSomething(){\n /// ....\n}\n" }, { "answer_id": 2916755, ...
2008/09/24
[ "https://Stackoverflow.com/questions/127842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19840/" ]
127,867
<p>I have great doubts about this forum, but I am willing to be pleasantly surprised ;) <strong>Kudos and great karma to those who get me back on track.</strong></p> <p>I am attempting to use the blitz implementation of JavaSpaces (<a href="http://www.dancres.org/blitz/blitz_js.html" rel="nofollow noreferrer">http://www.dancres.org/blitz/blitz_js.html</a>) to implement the ComputeFarm example provided at <a href="http://today.java.net/pub/a/today/2005/04/21/farm.html" rel="nofollow noreferrer">http://today.java.net/pub/a/today/2005/04/21/farm.html</a></p> <p>The in memory example works fine, but whenever I attempt to use the blitz out-of-box implementation i get the following error:</p> <p>(yes <strong><code>com.sun.jini.mahalo.TxnMgrProxy</code></strong> is in the class path)</p> <pre><code>2008-09-24 09:57:37.316 ERROR [Thread-4] JavaSpaceComputeSpace 155 - Exception while taking task. java.rmi.ServerException: RemoteException in server thread; nested exception is: java.rmi.UnmarshalException: unmarshalling method/arguments; nested exception is: java.lang.ClassNotFoundException: com.sun.jini.mahalo.TxnMgrProxy at net.jini.jeri.BasicInvocationDispatcher.dispatch(BasicInvocationDispatcher.java:644) at com.sun.jini.jeri.internal.runtime.ObjectTable$6.run(ObjectTable.java:597) at net.jini.export.ServerContext.doWithServerContext(ServerContext.java:103) at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch0(ObjectTable.java:595) at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.access$700(ObjectTable.java:212) at com.sun.jini.jeri.internal.runtime.ObjectTable$5.run(ObjectTable.java:568) at com.sun.jini.start.AggregatePolicyProvider$6.run(AggregatePolicyProvider.java:527) at java.security.AccessController.doPrivileged(Native Method) at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:565) at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:540) at com.sun.jini.jeri.internal.runtime.ObjectTable$RD.dispatch(ObjectTable.java:778) at net.jini.jeri.connection.ServerConnectionManager$Dispatcher.dispatch(ServerConnectionManager.java:148) at com.sun.jini.jeri.internal.mux.MuxServer$2.run(MuxServer.java:244) at com.sun.jini.start.AggregatePolicyProvider$5.run(AggregatePolicyProvider.java:513) at java.security.AccessController.doPrivileged(Native Method) at com.sun.jini.jeri.internal.mux.MuxServer$1.run(MuxServer.java:241) at com.sun.jini.thread.ThreadPool$Worker.run(ThreadPool.java:136) at java.lang.Thread.run(Thread.java:595) at com.sun.jini.jeri.internal.runtime.Util.__________EXCEPTION_RECEIVED_FROM_SERVER__________(Util.java:108) at com.sun.jini.jeri.internal.runtime.Util.exceptionReceivedFromServer(Util.java:101) at net.jini.jeri.BasicInvocationHandler.unmarshalThrow(BasicInvocationHandler.java:1303) at net.jini.jeri.BasicInvocationHandler.invokeRemoteMethodOnce(BasicInvocationHandler.java:832) at net.jini.jeri.BasicInvocationHandler.invokeRemoteMethod(BasicInvocationHandler.java:659) at net.jini.jeri.BasicInvocationHandler.invoke(BasicInvocationHandler.java:528) at $Proxy0.take(Unknown Source) at org.dancres.blitz.remote.BlitzProxy.take(BlitzProxy.java:157) at compute.impl.javaspaces.JavaSpaceComputeSpace.take(JavaSpaceComputeSpace.java:138) at example.squares.SquaresJob.collectResults(SquaresJob.java:47) at compute.impl.AbstractJobRunner$CollectThread.run(AbstractJobRunner.java:28) Caused by: java.rmi.UnmarshalException: unmarshalling method/arguments; nested exception is: java.lang.ClassNotFoundException: com.sun.jini.mahalo.TxnMgrProxy at net.jini.jeri.BasicInvocationDispatcher.dispatch(BasicInvocationDispatcher.java:619) at com.sun.jini.jeri.internal.runtime.ObjectTable$6.run(ObjectTable.java:597) at net.jini.export.ServerContext.doWithServerContext(ServerContext.java:103) at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch0(ObjectTable.java:595) at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.access$700(ObjectTable.java:212) at com.sun.jini.jeri.internal.runtime.ObjectTable$5.run(ObjectTable.java:568) at com.sun.jini.start.AggregatePolicyProvider$6.run(AggregatePolicyProvider.java:527) at java.security.AccessController.doPrivileged(Native Method) at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:565) at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:540) at com.sun.jini.jeri.internal.runtime.ObjectTable$RD.dispatch(ObjectTable.java:778) at net.jini.jeri.connection.ServerConnectionManager$Dispatcher.dispatch(ServerConnectionManager.java:148) at com.sun.jini.jeri.internal.mux.MuxServer$2.run(MuxServer.java:244) at com.sun.jini.start.AggregatePolicyProvider$5.run(AggregatePolicyProvider.java:513) at java.security.AccessController.doPrivileged(Native Method) at com.sun.jini.jeri.internal.mux.MuxServer$1.run(MuxServer.java:241) at com.sun.jini.thread.ThreadPool$Worker.run(ThreadPool.java:136) at java.lang.Thread.run(Thread.java:595) Caused by: java.lang.ClassNotFoundException: com.sun.jini.mahalo.TxnMgrProxy at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at net.jini.loader.pref.PreferredClassLoader.loadClass(PreferredClassLoader.java:922) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:242) at net.jini.loader.pref.PreferredClassProvider.loadClass(PreferredClassProvider.java:613) at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247) at net.jini.loader.ClassLoading.loadClass(ClassLoading.java:138) at net.jini.io.MarshalInputStream.resolveClass(MarshalInputStream.java:296) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1544) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348) at com.sun.jini.jeri.internal.runtime.Util.unmarshalValue(Util.java:221) at net.jini.jeri.BasicInvocationDispatcher.unmarshalArguments(BasicInvocationDispatcher.java:1049) at net.jini.jeri.BasicInvocationDispatcher.dispatch(BasicInvocationDispatcher.java:599) ... 17 more </code></pre>
[ { "answer_id": 128936, "author": "deltaVee", "author_id": 21707, "author_profile": "https://Stackoverflow.com/users/21707", "pm_score": 0, "selected": false, "text": "C:\\dev\\jini\\blitz>javap com.sun.jini.mahalo.TxnMgrProxy\nCompiled from \"TxnMgrProxy.java\"\nclass com.sun.jini.mahalo...
2008/09/24
[ "https://Stackoverflow.com/questions/127867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21707/" ]
127,886
<p>I'm confused with how views are organized, and it is important to understand this as ASP.NET MVC uses conventions to get everything working right.</p> <p>Under the views directory, there are subdirectories. Inside these subdirectories are views. I'm assuming that the subdirectories map to controllers, and the controllers act on the views contained within their subdirectories.</p> <p>Is there an emerging expectation of what types of views are contained within these directories? For instance, should the default page for each directory be index.aspx? Should the pages follow a naming convention such as Create[controller].aspx, List[controller].aspx, etc? Or does it not matter?</p>
[ { "answer_id": 128045, "author": "Craig Stuntz", "author_id": 7714, "author_profile": "https://Stackoverflow.com/users/7714", "pm_score": 4, "selected": true, "text": " public ActionResult NotAuthorized()\n {\n return View();\n }\n" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/127886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
127,890
<p>Is there a specfic <a href="http://en.wikipedia.org/wiki/Design_Patterns" rel="nofollow noreferrer">Gang Of Four Design Pattern</a> that you frequently use, yet hardly see used in other peoples designs? If possible, please describe a simple example where this pattern can be useful. It doesn't have to necessarily be a Gang Of Four pattern, but please include a hyperlink to the pattern's description if you choose a non-GoF pattern.</p> <p>Put another way:<br> <strong>What are some good/useful design patterns that I, or someone else who does have a passing knowledge of the main patterns, may not already know?</strong></p>
[ { "answer_id": 274993, "author": "fizzer", "author_id": 18167, "author_profile": "https://Stackoverflow.com/users/18167", "pm_score": 3, "selected": false, "text": "SendTo()" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/127890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16448/" ]
127,899
<p>i have a control that is organized like this</p> <p><img src="https://dl-web.getdropbox.com/get/jsstructure.GIF?w=faef1ed3" alt="alt text"></p> <p>and i want to have the javascript registered on the calling master pages, etc, so that anywhere this control folder is dropped and then registered, it will know how to find the URL to the js.</p> <p>Here is what i have so far (in the user control )</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if(!Page.IsClientScriptBlockRegistered("jqModal")) Page.ClientScript.RegisterClientScriptInclude("jqModal", ResolveClientUrl("~js/jqModal.js")); if (!Page.IsClientScriptBlockRegistered("jQuery")) Page.ClientScript.RegisterClientScriptInclude("jQuery", ResolveClientUrl("~/js/jQuery.js")); if (!Page.IsClientScriptBlockRegistered("tellAFriend")) Page.ClientScript.RegisterClientScriptInclude("tellAFriend", ResolveClientUrl("js/tellAFriend.js")); } </code></pre> <p>Any ideas?</p>
[ { "answer_id": 127935, "author": "TcKs", "author_id": 20382, "author_profile": "https://Stackoverflow.com/users/20382", "pm_score": 1, "selected": false, "text": "public static class PageHelper {\n public static void RegisterClientScriptIfNeeded( Page page, string key, string url ) {\...
2008/09/24
[ "https://Stackoverflow.com/questions/127899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1748529/" ]
127,912
<p>Writing some test scripts in IronPython, I want to verify whether a window is displayed or not. I have the pid of the main app's process, and want to get a list of window titles that are related to the pid. </p> <p>I was trying to avoid using win32api calls, such as FindWindowEx, since (to my knowledge) you cannot access win32api directly from IronPython. Is there a way to do this using built-in .net classes? Most of the stuff I have come across recommends using win32api, such as below.</p> <p><a href="https://stackoverflow.com/questions/79111/net-c-getting-child-windows-when-you-only-have-a-process-handle-or-pid">.NET (C#): Getting child windows when you only have a process handle or PID?</a></p> <p>UPDATE: I found a work-around to what I was trying to do. Answer below. </p>
[ { "answer_id": 11841411, "author": "Jonas Lundgren", "author_id": 1482659, "author_profile": "https://Stackoverflow.com/users/1482659", "pm_score": 2, "selected": false, "text": "import ctypes\nbuffer = ctypes.create_string_buffer(100)\nctypes.windll.kernel32.GetWindowsDirectoryA(buffer,...
2008/09/24
[ "https://Stackoverflow.com/questions/127912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9267/" ]
127,932
<p>I get this error when I do an <code>svn update</code>:</p> <blockquote> <p>Working copy XXXXXXXX locked Please execute "Cleanup" command</p> </blockquote> <p>When I run cleanup, I get</p> <blockquote> <p>Cleanup failed to process the following paths: XXXXXXXX</p> </blockquote> <p>How do I get out of this loop?</p>
[ { "answer_id": 1125468, "author": "Intu", "author_id": 138079, "author_profile": "https://Stackoverflow.com/users/138079", "pm_score": 8, "selected": false, "text": ".svn" }, { "answer_id": 1344837, "author": "BradS", "author_id": 10537, "author_profile": "https://Sta...
2008/09/24
[ "https://Stackoverflow.com/questions/127932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/230/" ]
127,936
<p>I have an application that has created a number of custom event log sources to help filter its output. How can I delete the custom sources from the machine WITHOUT writing any code as running a quick program using System.Diagnostics.EventLog.Delete is not possible.</p> <p>I've tried using RegEdit to remove the custom sources from [HKEY_LOCAL_MACHINE\SYSTEM\ControlSetXXX\Services\Eventlog] however the application acts as if the logs still exist behind the scenes.</p> <p>What else am I missing?</p>
[ { "answer_id": 28902869, "author": "Kapé", "author_id": 465942, "author_profile": "https://Stackoverflow.com/users/465942", "pm_score": 5, "selected": false, "text": "Remove-EventLog -LogName \"Custom log name\"\n\nRemove-EventLog -Source \"Custom source name\"\n" }, { "answer_id...
2008/09/24
[ "https://Stackoverflow.com/questions/127936", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15570/" ]
127,973
<p>I've been aware of Steve Yegge's advice to <a href="http://steve.yegge.googlepages.com/effective-emacs#item1" rel="nofollow noreferrer">swap Ctrl and Caps Lock</a> for a while now, although I don't use Emacs. I've just tried swapping them over as an experiment and I'm finding it difficult to adjust. There are several shortcuts that are second nature to me now and I hadn't realised quite how ingrained they are in how I use the keyboard.</p> <p>In particular, I keep going to the old Ctrl key for <kbd>Ctrl</kbd>+<kbd>Z</kbd> (undo), and for cut, copy &amp; paste operations (<kbd>Ctrl</kbd>+ <kbd>X</kbd>, <kbd>C</kbd> and <kbd>V</kbd>). Experimenting with going from the home position to <kbd>Ctrl</kbd>+<kbd>Z</kbd> I don't know which finger to put on <kbd>Z</kbd>, as it feels awkward with either my ring, middle or index finger. Is this something I'll get used to the same way I've got used to the original position and I should just give it time or <strong>is this arrangement not suited to windows keyboard shortcuts</strong>.</p> <p>I'd be interested to hear from people who have successfully made the transition as well as those who have tried it and move back, but particularly from people who were doing it on <strong>windows</strong>. </p> <p>Will it lead to any improvement in my typing speed or comfort when typing.</p> <p>Do you have any tips for finger positions or typing training to speed up the transition.</p>
[ { "answer_id": 35177791, "author": "Sam Hasler", "author_id": 2541, "author_profile": "https://Stackoverflow.com/users/2541", "pm_score": 3, "selected": true, "text": "#IfWinActive\n ^+Capslock::Capslock ; make CTRL+SHIFT+Caps-Lock the Caps Lock toggle\nreturn\n" }, { "answer_i...
2008/09/24
[ "https://Stackoverflow.com/questions/127973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2541/" ]
127,974
<p>SQL is not my forte, but I'm working on it - thank you for the replies.</p> <p>I am working on a report that will return the completion percent of services for indiviudals in our contracts. There is a master table "Contracts," each individual Contract can have multiple services from the "services" table, each service has multiple standards for the "standards" table which records the percent complete for each standard.</p> <p>I've gotten as far as calculating the total percent complete for each individual service for a specific Contract_ServiceID, but how do I return all the services percentages for all the contracts? Something like this:</p> <p>Contract &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Service &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Percent complete <hr> abc Company &nbsp;&nbsp;service 1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;98%<br> abc Company &nbsp;&nbsp;service 2 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;100%<br> xyz Company &nbsp;&nbsp;service 1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;50% <br> <br> Here's what I have so far:</p> <pre><code>SELECT Contract_ServiceId, (SUM(CompletionPercentage)/COUNT(CompletionPercentage)) * 100 as "Percent Complete" FROM dbo.Standard sta WITH (NOLOCK) INNER JOIN dbo.Contract_Service conSer ON sta.ServiceId = conSer.ServiceId LEFT OUTER JOIN dbo.StandardResponse standResp ON sta.StandardId = standResp.StandardId AND conSer.StandardReportId = standResp.StandardReportId WHERE Contract_ServiceId = '[an id]' GROUP BY Contract_ServiceID </code></pre> <p>This gets me too:<br><br> Contract_serviceid &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Percent Complete <hr> [an id]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;100%</p> <p>EDIT: Tables didn't show up in post.</p>
[ { "answer_id": 128017, "author": "Steven Murawski", "author_id": 1233, "author_profile": "https://Stackoverflow.com/users/1233", "pm_score": 1, "selected": false, "text": "SELECT \n Contract,\n Contract_ServiceId, \n (SUM(CompletionPercentage)/COUNT(CompletionPercentage)) * 100...
2008/09/24
[ "https://Stackoverflow.com/questions/127974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21717/" ]
128,008
<p>When I iterate over the values or keys are they going to correlate? Will the second key map to the second value?</p>
[ { "answer_id": 128025, "author": "Jorge Ferreira", "author_id": 6508, "author_profile": "https://Stackoverflow.com/users/6508", "pm_score": 0, "selected": false, "text": "Map<Integer, Integer> a = new HashMap<Integer, Integer>(2);\na.put(1, 2);\na.put(2, 3);\nfor (Map.Entry<Integer, Inte...
2008/09/24
[ "https://Stackoverflow.com/questions/128008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
128,011
<p>In a <code>CakePHP 1.2</code> app, I'm using </p> <pre><code>&lt;?php $session-&gt;flash();?&gt; </code></pre> <p>to output messages like "Record edited". It's working great.</p> <p>However, I want to add a link called "Dismiss" that will fade out the message. I know how to construct the link, but I don't know how to insert into the output of the flass message.</p> <p>The flash message wraps itself in a <code>DIV tag</code>. I want to insert my dismiss code into that div, but I don't know how.</p>
[ { "answer_id": 128033, "author": "Justin", "author_id": 43, "author_profile": "https://Stackoverflow.com/users/43", "pm_score": 2, "selected": true, "text": "layouts/message.ctp\n" }, { "answer_id": 747226, "author": "RichardAtHome", "author_id": 7032, "author_profile...
2008/09/24
[ "https://Stackoverflow.com/questions/128011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43/" ]
128,012
<p>I want to create a UITableView with varying row heights, and I'm trying to accomplish this by creating UILabels inside the UITableViewCells.</p> <p>Here's my code so far:</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyIdentifier = @"EntryCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease]; } UILabel *textView = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 300, 40)]; textView.numberOfLines = 0; textView.text = [entries objectAtIndex:[indexPath row]]; [cell.contentView addSubview:textView]; [textView release]; return cell; } </code></pre> <p>This gives me 2 lines of text per cell. However, each "entry" has a different number of lines, and I want the UITableViewCells to resize automatically, wrapping text as necessary, without changing the font size.</p> <p><code>[textView sizeToFit]</code> and/or <code>[cell sizeToFit]</code> don't seem to work.</p> <p>Here's how I want the UITableView to look:</p> <pre><code>---------------- Lorem ipsum ---------------- Lorem ipsum Lorem ipsum ---------------- Lorem ipsum Lorem ipsum Lorem ipsum ---------------- Lorem ipsum ---------------- Lorem ipsum Lorem ipsum ---------------- </code></pre> <p>Does anyone know how to do this properly?</p> <p>Thanks.</p>
[ { "answer_id": 2358335, "author": "Olof", "author_id": 283153, "author_profile": "https://Stackoverflow.com/users/283153", "pm_score": 1, "selected": false, "text": "- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath\n{\n\n if(indexPath.row<...
2008/09/24
[ "https://Stackoverflow.com/questions/128012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2119/" ]
128,015
<p>Normal OSX applications eat the first mouse click when not focused to first focus the application. Then future clicks are processed by the application. iTunes play/pause button and Finder behave differently, the first click is acted on even when not focused. I am looking for a way to force an existing application (Remote Desktop Connection.app) to act on the first click and not just focus.</p>
[ { "answer_id": 28377340, "author": "johndpope", "author_id": 284895, "author_profile": "https://Stackoverflow.com/users/284895", "pm_score": 0, "selected": false, "text": "- (void)loadView {\n NSLog(@\"loadView\");\n\n\n self.view = [[NSView alloc] initWithFrame:\n ...
2008/09/24
[ "https://Stackoverflow.com/questions/128015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21737/" ]
128,016
<p>I'm writing a custom file selection component. In my UI, first the user clicks a button, which pops a <code>JFileChooser</code>; when it is closed, the absolute path of the selected file is written to a <code>JTextField</code>.</p> <p>The problem is, absolute paths are usually long, which causes the text field to enlarge, making its container too wide.</p> <p>I've tried this, but it didn't do anything, the text field is still too wide:</p> <pre><code>fileNameTextField.setMaximumSize(new java.awt.Dimension(450, 2147483647)); </code></pre> <p>Currently, when it is empty, it is already 400px long, because of <code>GridBagConstraints</code> attached to it.</p> <p>I'd like it to be like text fields in HTML pages, which have a fixed size and do not enlarge when the input is too long.</p> <p>So, how do I set the max size for a <code>JTextField</code> ?</p>
[ { "answer_id": 128040, "author": "davetron5000", "author_id": 3029, "author_profile": "https://Stackoverflow.com/users/3029", "pm_score": 5, "selected": true, "text": "filedNameTextField = new JTextField(80); // 80 == columns\n" }, { "answer_id": 128191, "author": "Leonel", ...
2008/09/24
[ "https://Stackoverflow.com/questions/128016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15649/" ]
128,028
<p>We have a project that generates a code snippet that can be used on various other projects. The purpose of the code is to read two parameters from the query string and assign them to the "src" attribute of an iframe.</p> <p>For example, the page at the URL <a href="http://oursite/Page.aspx?a=1&amp;b=2" rel="nofollow noreferrer">http://oursite/Page.aspx?a=1&amp;b=2</a> would have JavaScript in it to read the "a" and "b" parameters. The JavaScript would then set the "src" attribute of an iframe based on those parameters. For example, "&lt;iframe src="http://someothersite/Page.aspx?a=1&amp;b=2" /&gt;"</p> <p>We're currently doing this with server-side code that uses Microsoft's Anti Cross-Scripting library to check the parameters. However, a new requirement has come stating that we need to use JavaScript, and that it can't use any third-party JavaScript tools (such as jQuery or Prototype).</p> <p>One way I know of is to replace any instances of "&lt;", single quote, and double quote from the parameters before using them, but that doesn't seem secure enough to me.</p> <p>One of the parameters is always a "P" followed by 9 integers. The other parameter is always 15 alpha-numeric characters. (Thanks Liam for suggesting I make that clear).</p> <p>Does anybody have any suggestions for us?</p> <p>Thank you very much for your time.</p>
[ { "answer_id": 128703, "author": "Mike Samuel", "author_id": 20394, "author_profile": "https://Stackoverflow.com/users/20394", "pm_score": 5, "selected": true, "text": "let searchParams/*: URLSearchParams*/ = new URL(\n myUrl,\n // Supply a base URL whose scheme allows\n // quer...
2008/09/24
[ "https://Stackoverflow.com/questions/128028", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21732/" ]
128,035
<p>Note: while the use-case described is about using submodules within a project, the same applies to a normal <code>git clone</code> of a repository over HTTP.</p> <p>I have a project under Git control. I'd like to add a submodule:</p> <pre><code>git submodule add http://github.com/jscruggs/metric_fu.git vendor/plugins/metric_fu </code></pre> <p>But I get</p> <pre><code>... got 1b0313f016d98e556396c91d08127c59722762d0 got 4c42d44a9221209293e5f3eb7e662a1571b09421 got b0d6414e3ca5c2fb4b95b7712c7edbf7d2becac7 error: Unable to find abc07fcf79aebed56497e3894c6c3c06046f913a under http://github.com/jscruggs/metri... Cannot obtain needed commit abc07fcf79aebed56497e3894c6c3c06046f913a while processing commit ee576543b3a0820cc966cc10cc41e6ffb3415658. fatal: Fetch failed. Clone of 'http://github.com/jscruggs/metric_fu.git' into submodule path 'vendor/plugins/metric_fu' </code></pre> <p>I have my HTTP_PROXY set up:</p> <pre><code>c:\project&gt; echo %HTTP_PROXY% http://proxy.mycompany:80 </code></pre> <p>I even have a global Git setting for the http proxy:</p> <pre><code>c:\project&gt; git config --get http.proxy http://proxy.mycompany:80 </code></pre> <p>Has anybody gotten HTTP fetches to consistently work through a proxy? What's really strange is that a few project on GitHub work fine (<a href="http://github.com/collectiveidea/awesome_nested_set/" rel="noreferrer"><code>awesome_nested_set</code></a> for example), but others consistently fail (<a href="http://github.com/rails/rails/" rel="noreferrer">rails</a> for example).</p>
[ { "answer_id": 128198, "author": "sethbc", "author_id": 21722, "author_profile": "https://Stackoverflow.com/users/21722", "pm_score": 6, "selected": false, "text": "GIT_CURL_VERBOSE=1\n" }, { "answer_id": 397642, "author": "James A. Rosen", "author_id": 1190, "author_...
2008/09/24
[ "https://Stackoverflow.com/questions/128035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1190/" ]
128,038
<p>I have a Java process that opens a file using a FileReader. How can I prevent another (Java) process from opening this file, or at least notify that second process that the file is already opened? Does this automatically make the second process get an exception if the file is open (which solves my problem) or do I have to explicitly open it in the first process with some sort of flag or argument?</p> <h3>To clarify:</h3> <p>I have a Java app that lists a folder and opens each file in the listing for processing it. It processes each file after the other. The processing of each file consists of reading it and doing some calculations based on the contents and it takes about 2 minutes. I also have another Java app that does the same thing but instead writes on the file. What I want is to be able to run these apps at the same time so the scenario goes like this. ReadApp lists the folder and finds files A, B, C. It opens file A and starts the reading. WriteApp lists the folder and finds files A, B, C. It opens file A, sees that is is open (by an exception or whatever way) and goes to file B. ReadApp finishes file A and continues to B. It sees that it is open and continues to C. It is crucial that WriteApp doesn't write while ReadApp is reading the same file or vice versa. They are different processes.</p>
[ { "answer_id": 128119, "author": "KC Baltz", "author_id": 9910, "author_profile": "https://Stackoverflow.com/users/9910", "pm_score": 4, "selected": false, "text": "java.nio.channels.FileChannel.lock()" }, { "answer_id": 128168, "author": "Tom Hawtin - tackline", "author_...
2008/09/24
[ "https://Stackoverflow.com/questions/128038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11906/" ]
128,042
<p>In Java, I use a class in which some fields can be <code>null</code>. For example:</p> <pre><code>class Foo { String bar; //.... } </code></pre> <p>I want to write a BarComparator for this class,</p> <pre><code> private static class BarComparator implements Comparator&lt;Foo&gt; { public int compare( final Foo o1, final Foo o2 ) { // Implementation goes here } } </code></pre> <p>Is there a standard way to deal with the fact that any of <code>o1</code>, <code>o2</code>, <code>o1.bar</code>, <code>o2.bar</code> can be <code>null</code>, without writing lots of nested <code>if</code>...<code>else</code>?</p> <p>Cheers!</p>
[ { "answer_id": 128084, "author": "cagcowboy", "author_id": 19629, "author_profile": "https://Stackoverflow.com/users/19629", "pm_score": 0, "selected": false, "text": "if(o1==null) return x;\nif(o2==null) return x;\nif(o1.getBar()==null) return x;\nif(o2.getBar()==null) return x;\n\n// N...
2008/09/24
[ "https://Stackoverflow.com/questions/128042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2797/" ]
128,043
<p>I have several log files of events (one event per line). The logs can possibly overlap. The logs are generated on separate client machines from possibly multiple time zones (but I assume I know the time zone). Each event has a timestamp that was normalized into a common time (by instantianting each log parsers calendar instance with the timezone appropriate to the log file and then using getTimeInMillis to get the UTC time). The logs are already sorted by timestamp. Multiple events can occur at the same time, but they are by no means equal events.</p> <p>These files can be relatively large, as in, 500000 events or more in a single log, so reading the entire contents of the logs into a simple Event[] is not feasible.</p> <p>What I am trying do is merge the events from each of the logs into a single log. It is kinda like a mergesort task, but each log is already sorted, I just need to bring them together. The second component is that the same event can be witnessed in each of the separate log files, and I want to "remove duplicate events" in the file output log.</p> <p>Can this be done "in place", as in, sequentially working over some small buffers of each log file? I can't simply read in all the files into an Event[], sort the list, and then remove duplicates, but so far my limited programming capabilities only enable me to see this as the solution. Is there some more sophisticated approach that I can use to do this as I read events from each of the logs concurrently?</p>
[ { "answer_id": 128098, "author": "Nick Johnson", "author_id": 12030, "author_profile": "https://Stackoverflow.com/users/12030", "pm_score": 3, "selected": false, "text": "def merge_files(files, key_func):\n # Populate the current array with the first line from each file\n current =...
2008/09/24
[ "https://Stackoverflow.com/questions/128043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2204759/" ]
128,083
<p>I find my self having a repeater control which is being databound to an xml document. My client is now requesting that the Textbox's which are being repeater can be either a Textbox or a Checkbox.</p> <p>I cannot seem to find an easyway to essentially do the following:</p> <pre><code>if ((System.Xml.XmlNode)e.Item.DataItem.Attributes["type"] == "text") &lt;asp:TextBox runat="server" ID="txtField" Text='&lt;%#((System.Xml.XmlNode)Container.DataItem).InnerText %&gt;' CssClass="std"&gt;&lt;/asp:TextBox&gt; else &lt;asp:CheckBox runat="server" ID="txtField" Text='&lt;%#((System.Xml.XmlNode)Container.DataItem).InnerText %&gt;' CssClass="std"&gt;&lt;/asp:TextBox&gt; </code></pre> <p>Is there a nice way I can extend my current implementaion without have to rewrite the logic. If I could inject the control via "OnItemDataBound" that would also be fine. But I cannot seem to make it work</p>
[ { "answer_id": 128101, "author": "Tom Ritter", "author_id": 8435, "author_profile": "https://Stackoverflow.com/users/8435", "pm_score": 3, "selected": true, "text": "Visible=<%= Eval(\"type\").tostring() == \"text\") %>\n" }, { "answer_id": 199914, "author": "vmarquez", "...
2008/09/24
[ "https://Stackoverflow.com/questions/128083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20032/" ]
128,103
<p>Given an <code>Item</code> that has been appended to a <code>Form</code>, whats the best way to find out what index that item is at on the Form?</p> <p><code>Form.append(Item)</code> will give me the index its initially added at, but if I later insert items before that the index will be out of sync.</p>
[ { "answer_id": 128355, "author": "roryf", "author_id": 270, "author_profile": "https://Stackoverflow.com/users/270", "pm_score": 2, "selected": true, "text": "private int getItemIndex(Item item, Form form) {\n for(int i = 0, size = form.size(); i < size; i++) {\n if(form.get(i)...
2008/09/24
[ "https://Stackoverflow.com/questions/128103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/270/" ]
128,104
<p>What is a good implementation of a IsLeapYear function in VBA? </p> <p><b>Edit: </b>I ran the if-then and the DateSerial implementation with iterations wrapped in a timer, and the DateSerial was quicker on the average by 1-2 ms (5 runs of 300 iterations, with 1 average cell worksheet formula also working).</p>
[ { "answer_id": 128105, "author": "Lance Roberts", "author_id": 13295, "author_profile": "https://Stackoverflow.com/users/13295", "pm_score": 6, "selected": true, "text": "Public Function isLeapYear(Yr As Integer) As Boolean \n\n ' returns FALSE if not Leap Year, TRUE if Leap Year \n...
2008/09/24
[ "https://Stackoverflow.com/questions/128104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13295/" ]
128,162
<p>My program generates relatively simple PDF documents on request, but I'm having trouble with unicode characters, like kanji or odd math symbols. To write a normal string in PDF, you place it in brackets:</p> <pre><code>(something) </code></pre> <p>There is also the option to escape a character with octal codes:</p> <pre><code>(\527) </code></pre> <p>but this only goes up to 512 characters. How do you encode or escape higher characters? I've seen references to byte streams and hex-encoded strings, but none of the references I've read seem to be willing to tell me how to actually do it.</p> <hr> <p><strong>Edit:</strong> Alternatively, point me to a good Java PDF library that will do the job for me. The one I'm currently using is a version of gnujpdf (which I've fixed several bugs in, since the original author appears to have gone AWOL), that allows you to program against an AWT Graphics interface, and ideally any replacement should do the same.</p> <p>The alternatives seem to be either HTML -> PDF, or a programmatic model based on paragraphs and boxes that feels very much like HTML. iText is an example of the latter. This would mean rewriting my existing code, and I'm not convinced they'd give me the same flexibility in laying out.</p> <hr> <p><strong>Edit 2:</strong> I didn't realise before, but the iText library has a Graphics2D API and seems to handle unicode perfectly, so that's what I'll be using. Though it isn't an answer to the question as asked, it solves the problem for me.</p> <hr> <p><strong>Edit 3:</strong> iText is working nicely for me. I guess the lesson is, when faced with something that seems pointlessly difficult, look for somebody who knows more about it than you.</p>
[ { "answer_id": 31831124, "author": "Algoman", "author_id": 507970, "author_profile": "https://Stackoverflow.com/users/507970", "pm_score": 2, "selected": false, "text": "std::map<std::string, std::vector<wchar_t> > Codepage;\nstd::map<std::string, std::map<wchar_t, int> > LookupTable;\n"...
2008/09/24
[ "https://Stackoverflow.com/questions/128162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1000/" ]
128,190
<p>I need help logging errors from T-SQL in SQL Server 2000. We need to log errors that we trap, but are having trouble getting the same information we would have had sitting in front of SQL Server Management Studio.</p> <p>I can get a message without any argument substitution like this:</p> <pre><code>SELECT MSG.description from master.dbo.sysmessages MSG INNER JOIN sys.syslanguages LANG ON MSG.msglangID=LANG.msglangid WHERE MSG.error=@err AND LANG.langid=@@LANGID </code></pre> <p>But I have not found any way of finding out the error arguments. I want to see:</p> <p>Constraint violation MYCONSTRAINT2 on table MYTABLE7</p> <p>not</p> <p>Constraint violation %s on table %s</p> <p>Googling has only turned up exotic schemes using DBCC OUTPUTBUFFER that require admin access and aren't appropriate for production code. How do I get an error message with argument replacement?</p>
[ { "answer_id": 128421, "author": "Dave Jackson", "author_id": 12328, "author_profile": "https://Stackoverflow.com/users/12328", "pm_score": 1, "selected": false, "text": "RAISERROR ( { msg_id | msg_str } { , severity , state } \n [ , argument [ ,...n ] ] ) \n [ WITH option [ ,...n ...
2008/09/24
[ "https://Stackoverflow.com/questions/128190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/945/" ]
128,217
<p>If I create an event using <code>CreateEvent</code> in Windows, how can I check if that event is signaled or not using the debugger in Visual Studio? <code>CreateEvent</code> returns back a handle, which doesn't give me access to much information. Before I call <code>WaitForSingleObject()</code>, I want to check to see if the event is signaled before I step into the function.</p>
[ { "answer_id": 131417, "author": "computinglife", "author_id": 17224, "author_profile": "https://Stackoverflow.com/users/17224", "pm_score": 2, "selected": false, "text": "0:000> !handle 8 f \n" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/128217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21745/" ]
128,232
<p>I am trying to do the following in <code>SQL*PLUS</code> in <code>ORACLE</code>.</p> <ul> <li>Create a variable</li> <li>Pass it as output variable to my method invocation</li> <li>Print the value from output variable</li> </ul> <p>I get</p> <blockquote> <p><em>undeclared variable</em></p> </blockquote> <p>error. I am trying to create a variable that persists in the session till i close the <code>SQL*PLUS</code> window.</p> <pre><code>variable subhandle number; exec MYMETHOD - (CHANGE_SET =&gt; 'SYNC_SET', - DESCRIPTION =&gt; 'Change data for emp', - SUBSCRIPTION_HANDLE =&gt; :subhandle); print subhandle; </code></pre>
[ { "answer_id": 128280, "author": "Tony Andrews", "author_id": 18747, "author_profile": "https://Stackoverflow.com/users/18747", "pm_score": 2, "selected": false, "text": "SQL> create procedure myproc (p1 out number)\n 2 is\n 3 begin\n 4 p1 := 42;\n 5 end;\n 6 /\n\nProcedure ...
2008/09/24
[ "https://Stackoverflow.com/questions/128232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15425/" ]
128,239
<p>I'm using the Crystal Reports included with VisualStudio 2005. I would like to change the image that is displayed on the report at runtime ideally by building a path to the image file and then have that image displayed on the report.</p> <p>Has anyone been able to accomplish this with this version of Crystal Reports?</p>
[ { "answer_id": 582454, "author": "e-holder", "author_id": 22252, "author_profile": "https://Stackoverflow.com/users/22252", "pm_score": 2, "selected": false, "text": "byte[]" } ]
2008/09/24
[ "https://Stackoverflow.com/questions/128239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16419/" ]