qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
212,271
<p>A person uses their cell phone multiple times per day, and the length of their calls vary. I am tracking the length of the calls in a table:</p> <pre><code>Calls [callID, memberID, startTime, duration] </code></pre> <p>I need to a query to return the average call length for users <strong>per day</strong>. Per day means, if a user used the phone 3 times, first time for 5 minutes, second for 10 minutes and the last time for 7 minutes, the calculation is: <code>5 + 10 + 7 / 3 = ...</code></p> <p>Note:</p> <ol> <li><p>People don't use the phone everyday, so we have to get the latest day's average per person and use this to get the overall average call duration.</p></li> <li><p>we don't want to count anyone twice in the average, so only 1 row per user will go into calculating the average daily call duration.</p></li> </ol> <p>Some clarifications...</p> <p>I need a overall per day average, based on the per-user per-day average, using the users latest days numbers (since we are only counting a given user ONCE in the query), so it will mean we will be using different days avg. since people might not use the phone each day or on the same day even.</p>
[ { "answer_id": 212284, "author": "matt b", "author_id": 4249, "author_profile": "https://Stackoverflow.com/users/4249", "pm_score": 0, "selected": false, "text": "select average(duration) from calls group by date(startTime);\n" }, { "answer_id": 212285, "author": "Tomalak", ...
2008/10/17
[ "https://Stackoverflow.com/questions/212271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
212,321
<p>Anyone know a simple way using Java calendar to subtract X days from a date?</p> <p>I have not been able to find any function which allows me to directly subtract X days from a date in Java. Can someone point me to the right direction?</p>
[ { "answer_id": 212334, "author": "Anson Smith", "author_id": 28685, "author_profile": "https://Stackoverflow.com/users/28685", "pm_score": 9, "selected": true, "text": "Calendar calendar = Calendar.getInstance(); // this would default to now\ncalendar.add(Calendar.DAY_OF_MONTH, -5).\n" ...
2008/10/17
[ "https://Stackoverflow.com/questions/212321", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26004/" ]
212,350
<p>The <code>JPA</code> (Java Persistence API) specification has 2 different ways to specify entity composite keys: <code>@IdClass</code> and <code>@EmbeddedId</code>. </p> <p>I'm using both annotations on my mapped entities, but it turns out to be a big mess to people who aren't very familiar with <code>JPA</code>. </p> <p>I want to adopt only one way to specify composite keys. Which one is really the best? Why?</p>
[ { "answer_id": 212371, "author": "Jorge Ferreira", "author_id": 6508, "author_profile": "https://Stackoverflow.com/users/6508", "pm_score": 8, "selected": true, "text": "@EmbeddedId" }, { "answer_id": 4672983, "author": "Bertie", "author_id": 500451, "author_profile":...
2008/10/17
[ "https://Stackoverflow.com/questions/212350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28921/" ]
212,358
<p>Is there a library function that performs binary search on a list/tuple and return the position of the item if found and 'False' (-1, None, etc.) if not?</p> <p>I found the functions bisect_left/right in the <a href="http://docs.python.org/library/bisect.html" rel="noreferrer">bisect module</a>, but they still return a position even if the item is not in the list. That's perfectly fine for their intended usage, but I just want to know if an item is in the list or not (don't want to insert anything).</p> <p>I thought of using <code>bisect_left</code> and then checking if the item at that position is equal to what I'm searching, but that seems cumbersome (and I also need to do bounds checking if the number can be larger than the largest number in my list). If there is a nicer method I'd like to know about it.</p> <p><strong>Edit</strong> To clarify what I need this for: I'm aware that a dictionary would be very well suited for this, but I'm trying to keep the memory consumption as low as possible. My intended usage would be a sort of double-way look-up table. I have in the table a list of values and I need to be able to access the values based on their index. And also I want to be able to find the index of a particular value or None if the value is not in the list.</p> <p>Using a dictionary for this would be the fastest way, but would (approximately) double the memory requirements.</p> <p>I was asking this question thinking that I may have overlooked something in the Python libraries. It seems I'll have to write my own code, as Moe suggested.</p>
[ { "answer_id": 212413, "author": "Moe", "author_id": 3051, "author_profile": "https://Stackoverflow.com/users/3051", "pm_score": 6, "selected": false, "text": "def binary_search(a, x, lo=0, hi=None):\n if hi is None:\n hi = len(a)\n while lo < hi:\n mid = (lo+hi)//2\n...
2008/10/17
[ "https://Stackoverflow.com/questions/212358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15682/" ]
212,378
<p>I have an embedded webserver that has a total of 2 Megs of space on it. Normally you gzip files for the clients benefit, but this would save us space on the server. I read that you can just gzip the js file and save it on the server. I tested that on IIS and I didn't have any luck at all. What exactly do I need to do on every step of the process to make this work?</p> <p>This is what I imagine it will be like:</p> <ol> <li>gzip foo.js</li> <li>change link in html to point to foo.js.gz instead of just .js</li> <li>Add some kind of header to the response?</li> </ol> <p>Thanks for any help at all.</p> <p>-fREW</p> <p><strong>EDIT</strong>: My webserver can't do anything on the fly. It's not Apache or IIS; it's a binary on a ZiLog processor. I know that you can compress streams; I just heard that you can also compress the files once and leave them compressed.</p>
[ { "answer_id": 212684, "author": "Pat", "author_id": 238, "author_profile": "https://Stackoverflow.com/users/238", "pm_score": 4, "selected": true, "text": "Content-Encoding: gzip\n" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448/" ]
212,381
<p>I am trying to create a multi dimensional array using this syntax:</p> <pre><code>$x[1] = 'parent'; $x[1][] = 'child'; </code></pre> <p>I get the error: <code>[] operator not supported for strings</code> because it is evaluating the <code>$x[1]</code> as a string as opposed to returning the array so I can append to it.</p> <p>What is the correct syntax for doing it this way? The overall goal is to create this multidimensional array in an iteration that will append elements to a known index.</p> <p>The syntax <code>${$x[1]}[]</code> does not work either.</p>
[ { "answer_id": 212396, "author": "Marius", "author_id": 1585, "author_profile": "https://Stackoverflow.com/users/1585", "pm_score": 3, "selected": false, "text": "$x = array();\n$x[1] = array();\n$x[1][] = 'child';\n" }, { "answer_id": 212399, "author": "Oli", "author_id"...
2008/10/17
[ "https://Stackoverflow.com/questions/212381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
212,401
<p>From Wikipedia, the free encyclopedia: <strong>Closure (computer science)</strong></p> <blockquote> <p>In computer science, a closure is a function that is evaluated in an environment containing one or more bound variables. When called, the function can access these variables. The explicit use of closures is associated with functional programming and with languages such as ML and Lisp. Constructs such as objects in other languages can also be modeled with closures.</p> </blockquote> <p>To use this inside of JavaScript, can someone point me to an example of how this applies?</p>
[ { "answer_id": 212431, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": true, "text": "function SetClassOnHover(className){\n $(\"td\").hover(\n function () {\n $(this).addClass(className);\n },\n fu...
2008/10/17
[ "https://Stackoverflow.com/questions/212401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
212,407
<p>Is the singleton class in Ruby a class in and of itself? Is it the reason why all objects belong to "class?" The concept is <strong>fuzzy</strong>, but I believe it has something to do with why I can define a class method at all (<code>class foo; def foo.bar ...</code>).</p> <p>What is the singleton class in Ruby?</p>
[ { "answer_id": 213177, "author": "Pistos", "author_id": 28558, "author_profile": "https://Stackoverflow.com/users/28558", "pm_score": 8, "selected": true, "text": "irb(main):001:0> class Foo; def method1; puts 1; end; end\n=> nil\nirb(main):002:0> foo = Foo.new\n=> #<Foo:0xb79fa724>\nirb...
2008/10/17
[ "https://Stackoverflow.com/questions/212407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28914/" ]
212,425
<p>How can I go about making my routes recognise an optional prefix parameter as follows:</p> <pre><code>/*lang/controller/id </code></pre> <p>In that the lang part is optional, and has a default value if it's not specified in the URL:</p> <pre><code>/en/posts/1 =&gt; lang = en /fr/posts/1 =&gt; lang = fr /posts/1 =&gt; lang = en </code></pre> <p><em>EDIT</em></p> <p>Ideally, I'm looking to do this across many controllers and actions by mapping a namespace:</p> <pre><code>map.namespace "*lang" do |lang| lang.resources :posts lang.resources :stories end </code></pre>
[ { "answer_id": 212895, "author": "Mike Woodhouse", "author_id": 1060, "author_profile": "https://Stackoverflow.com/users/1060", "pm_score": 1, "selected": false, "text": "map.connect ':language/posts/:id', :controller => 'posts', :action => 'show'\nmap.connect 'posts/:id', :controller =>...
2008/10/17
[ "https://Stackoverflow.com/questions/212425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12037/" ]
212,429
<p>Scenario:</p> <p>I'm currently writing a layer to abstract 3 similar webservices into one useable class. Each webservice exposes a set of objects that share commonality. I have created a set of intermediary objects which exploit the commonality. However in my layer I need to convert between the web service objects and my objects.</p> <p>I've used reflection to create the appropriate type at run time before I make the call to the web service like so:</p> <pre><code> public static object[] CreateProperties(Type type, IProperty[] properties) { //Empty so return null if (properties==null || properties.Length == 0) return null; //Check the type is allowed CheckPropertyTypes("CreateProperties(Type,IProperty[])",type); //Convert the array of intermediary IProperty objects into // the passed service type e.g. Service1.Property object[] result = new object[properties.Length]; for (int i = 0; i &lt; properties.Length; i++) { IProperty fromProp = properties[i]; object toProp = ReflectionUtility.CreateInstance(type, null); ServiceUtils.CopyProperties(fromProp, toProp); result[i] = toProp; } return result; } </code></pre> <p>Here's my calling code, from one of my service implementations:</p> <pre><code>Property[] props = (Property[])ObjectFactory.CreateProperties(typeof(Property), properties); _service.SetProperties(folderItem.Path, props); </code></pre> <p>So each service exposes a different "Property" object which I hide behind my own implementation of my IProperty interface.</p> <p>The reflection code works in unit tests producing an array of objects whose elements are of the appropriate type. But the calling code fails:</p> <blockquote> <p>System.InvalidCastException: Unable to cast object of type 'System.Object[]' to type 'MyProject.Property[]</p> </blockquote> <p>Any ideas?</p> <p>I was under the impression that any cast from Object will work as long as the contained object is convertable?</p>
[ { "answer_id": 212443, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 3, "selected": false, "text": "Property[] props = Array.ConvertAll(source, prop => (Property)prop);\n" }, { "answer_id": 212447, "author...
2008/10/17
[ "https://Stackoverflow.com/questions/212429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4950/" ]
212,434
<p>As the title states, is there a way to prevent extra elements from showing up in VBA dynamic arrays when they are non-zero based? </p> <p>For example, when using code similar to the following:</p> <pre><code>While Cells(ndx, 1).Value &lt;&gt; vbNullString ReDim Preserve data(1 To (UBound(data) + 1)) ndx = ndx + 1 Wend </code></pre> <p>You have an extra empty array element at the end of processing. While this can be eliminated with the following:</p> <pre><code>ReDim Preserve data(1 To (UBound(data) - 1)) </code></pre> <p>This doesn't seem like the best way of resolving this problem. </p> <p>As such, is there a way to prevent that extra element from being created in the first place? Preferably something that doesn't require additional logic inside of the loop.</p>
[ { "answer_id": 212497, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 1, "selected": false, "text": "Option Base" }, { "answer_id": 212615, "author": "onedaywhen", "author_id": 15354, "author_profile": "...
2008/10/17
[ "https://Stackoverflow.com/questions/212434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1185/" ]
212,442
<p>I want to do something very simple in C++ but i can't find how. I want to create a function like a for loop where i will ideally enter a variable for the times the iteration should happen and some functions inside brackets my function will execute. I hope i was clear enough. Thanks...</p> <p>Example</p> <pre><code>superFor (1) { //commands to be executed here add(1+2); } </code></pre>
[ { "answer_id": 212460, "author": "FOR", "author_id": 27826, "author_profile": "https://Stackoverflow.com/users/27826", "pm_score": 0, "selected": false, "text": "void DoSomethingRepeatedly(int numTimesTo Loop)\n{\n for(int i=0; i<numTimesToLoop; i++)\n { \n //do whatever; \n ...
2008/10/17
[ "https://Stackoverflow.com/questions/212442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28954/" ]
212,446
<p>I need to return only the facet counts from solr. So I basically want to search over all documents and return the facet counts, but I don't want to return any search results. Is this possible?</p> <p>Thanks</p>
[ { "answer_id": 2740207, "author": "nialloc", "author_id": 187419, "author_profile": "https://Stackoverflow.com/users/187419", "pm_score": 7, "selected": true, "text": "facet=true" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93743/" ]
212,466
<p>What does the &quot;bus error&quot; message mean, and how does it differ from a <a href="https://en.wikipedia.org/wiki/Segmentation_fault" rel="noreferrer">segmentation fault</a>?</p>
[ { "answer_id": 212519, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 3, "selected": false, "text": "unsigned char data[6];\n(unsigned int *) (data + 2) = 0xdeadf00d;\n" }, { "answer_id": 11203800, "author": "Vin...
2008/10/17
[ "https://Stackoverflow.com/questions/212466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7598/" ]
212,481
<p>I have a header file like this:</p> <pre><code>#ifndef __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #define __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #ifdef _DEBUG // macros for turning a number into a string #define STRING2(x) #x #define STRING(x) STRING2(x) #ifdef TRIAGE_MESG_AS_WARNING #define TRIAGE_TODO_TAG(description) __pragma(message(__FILE__"("STRING(__LINE__)") : warning : TRIAGE TO-DO: " STRING(description) )) #define TRIAGE_FIXTHIS_TAG(description) __pragma(message(__FILE__"("STRING(__LINE__)") : warning : TRIAGE FIXTHIS: " STRING(description) )) #else #define TRIAGE_TODO_TAG(description) __pragma(message(__FILE__"("STRING(__LINE__)") : message : TRIAGE TO-DO: " STRING(description) )) #define TRIAGE_FIXTHIS_TAG(description) __pragma(message(__FILE__"("STRING(__LINE__)") : message : TRIAGE FIXTHIS: " STRING(description) )) #endif #else #define TRIAGE_TODO_TAG(description) #define TRIAGE_FIXTHIS_TAG(description) #endif #endif // __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ </code></pre> <p>Which outputs notes to the output pane in Visual Studio 2005. When 'TRIAGE_MESG_AS_WARNING' is defined, Visual Studio will harvest these messages and list them as warnings in the Error List. It does this because the text format matches a warning. However, I don't want them to show up as warnings all the time, I would rather they show up in the Messages pane of the Error List.</p> <blockquote> <p>How do you format lines you put in the "Output Window" so that Visual Studio will auto-magically show them in the "Messages" tab of the "Error List" window?</p> </blockquote> <p>The format I have setup for messages in the above code looks like a message from other output, but does not get harvested in the same way.</p> <p>A co-worker suggested to me that I might need to write a 'custom automation object' to write to the Messages pane. That seems like a pain, especially since it is trivial to end-up with entries in the Error pane and Warning pane simply by proper formating. Is this a possible avenue?</p> <p>We're using unmanaged C++, so we can't rely on managed (.NET) only tooling. We do not want to extend VS with hooks.</p>
[ { "answer_id": 888396, "author": "ChrisBD", "author_id": 102238, "author_profile": "https://Stackoverflow.com/users/102238", "pm_score": 2, "selected": false, "text": "//Get the \"Error List Window\"\n\nErrorListProvider errorProvider = new ErrorListProvider(this);\nTask newError = new T...
2008/10/17
[ "https://Stackoverflow.com/questions/212481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28950/" ]
212,492
<p>I've worked with a couple of Visual C++ compilers (VC97, VC2005, VC2008) and I haven't really found a clearcut way of adding external libraries to my builds. I come from a Java background, and in Java libraries are everything! </p> <p>I understand from compiling open-source projects on my Linux box that all the source code for the library seems to need to be included, with the exception of those .so files.</p> <p>Also I've heard of the .lib static libraries and .dll dynamic libraries, but I'm still not entirely sure how to add them to a build and make them work. How does one go about this?</p>
[ { "answer_id": 213204, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": false, "text": "include" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18149/" ]
212,494
<p>I use an XML file in App_Data in conjunction with a Repeater on the main page of an intranet application allow me to display messages to users when they logon about application status, maintenance, etc. To test the functionality, it would be nice to have the file in the App_Data folder under development, but if I do this it copies it over the file on the production server when I publish the application. Is there anyway I can prevent this from happening short of going to a Web Deployment project (and will that solve my problem)?</p>
[ { "answer_id": 248958, "author": "Andrew Theken", "author_id": 32238, "author_profile": "https://Stackoverflow.com/users/32238", "pm_score": 1, "selected": false, "text": "Stream xml;\n#if DEBUG\nxml = File.Open(\"debug.xml\");\n#else\nxml = File.Open(\"release.xml\");\n#endif\n" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12950/" ]
212,510
<p>Currently I'm writing it in clear text <em>oops!</em>, it's an in house program so it's not that bad but I'd like to do it right. How should I go about encrypting this when writing to the registry and how do I decrypt it?</p> <pre><code>OurKey.SetValue("Password", textBoxPassword.Text); </code></pre>
[ { "answer_id": 212526, "author": "Oli", "author_id": 12870, "author_profile": "https://Stackoverflow.com/users/12870", "pm_score": 7, "selected": false, "text": "byte[] data = System.Text.Encoding.ASCII.GetBytes(inputString);\ndata = new System.Security.Cryptography.SHA256Managed().Compu...
2008/10/17
[ "https://Stackoverflow.com/questions/212510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
212,528
<p>This Question is almost the same as the previously asked <a href="https://stackoverflow.com/questions/122208/get-the-ip-address-of-local-computer">How can I get the IP Address of a local computer?</a> -Question. However I need to find the IP address(es) of a <strong>Linux Machine</strong>.</p> <p>So: How do I - programmatically in <strong>C++</strong> - detect the IP addresses of the linux server my application is running on. The servers will have at least two IP addresses and I need a specific one (the one in a given network (the public one)).</p> <p>I'm sure there is a simple function to do that - but where?</p> <hr /> <p>To make things a bit clearer:</p> <ul> <li>The server will obviously have the &quot;localhost&quot;: 127.0.0.1</li> <li>The server will have an internal (management) IP address: 172.16.x.x</li> <li>The server will have an external (public) IP address: 80.190.x.x</li> </ul> <p>I need to find the external IP address to bind my application to it. Obviously I can also bind to INADDR_ANY (and actually that's what I do at the moment). I would prefer to detect the public address, though.</p>
[ { "answer_id": 212688, "author": "Steve Baker", "author_id": 13566, "author_profile": "https://Stackoverflow.com/users/13566", "pm_score": 5, "selected": false, "text": "ioctl(<socketfd>, SIOCGIFCONF, (struct ifconf)&buffer);" }, { "answer_id": 213223, "author": "Community", ...
2008/10/17
[ "https://Stackoverflow.com/questions/212528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999/" ]
212,534
<p>I use a custom-built asp.net control that renders to a DIV and has "height='0'" hard-coded into the element (I know.. stupid). But I need to reset it - get rid of the height assignment somehow. Is this doable with CSS?</p> <p>I can set the height to 100px for example, and it works. But that's not what I want - I want the height assignment removed pretty much.</p> <p>UPDATE: Using FireBug, I can see that CSS's height gets overridden by the hard-coded one:</p> <p><em>removed dead ImageShack link</em></p> <p>I guess there's no way for me to resolve this besides removing the hard-coded height=0. Anyone else see an alternative?</p>
[ { "answer_id": 212635, "author": "Oli", "author_id": 12870, "author_profile": "https://Stackoverflow.com/users/12870", "pm_score": 7, "selected": true, "text": "height:auto !important" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22303/" ]
212,539
<p>Is there a Java equivalent to .NET's App.Config?</p> <p>If not is there a standard way to keep you application settings, so that they can be changed after an app has been distributed?</p>
[ { "answer_id": 212605, "author": "Powerlord", "author_id": 15880, "author_profile": "https://Stackoverflow.com/users/15880", "pm_score": 5, "selected": true, "text": "userNodeForPackage(ClassName.class)" }, { "answer_id": 19040876, "author": "Pursuit", "author_id": 931379...
2008/10/17
[ "https://Stackoverflow.com/questions/212539", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20400/" ]
212,550
<p>The problem is in the title - IE is misbehaving and is saying that there is a script running slowly - FF and Chrome don't have this problem.</p> <p>How can I find the problem . .there's a lot of JS on that page. Checking by hand is not a good ideea</p> <p><strong>EDIT :</strong> It's a page from a project i'm working on... but I need a tool to find the problem.</p> <p><strong>End :</strong> It turned out to be the UpdatePanel - somehow it would get "confused" and would take too long to process something. I just threw it out the window - will only use JQuery from now on :D.</p> <p>And I'm selecting Remy Sharp's answere because I really didn't know about the tool and it seems pretty cool.</p>
[ { "answer_id": 9475927, "author": "dude_id", "author_id": 1236988, "author_profile": "https://Stackoverflow.com/users/1236988", "pm_score": 1, "selected": false, "text": "Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(win_onload);\n" }, { "answer_id": 24812408, ...
2008/10/17
[ "https://Stackoverflow.com/questions/212550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5246/" ]
212,562
<p>Is there a good way to have a <code>Map&lt;String, ?&gt;</code> get and put ignoring case?</p>
[ { "answer_id": 212629, "author": "Guido", "author_id": 12388, "author_profile": "https://Stackoverflow.com/users/12388", "pm_score": 5, "selected": false, "text": "public class CaseInsensitiveMap extends HashMap<String, String> {\n ...\n put(String key, String value) {\n supe...
2008/10/17
[ "https://Stackoverflow.com/questions/212562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6013/" ]
212,569
<p>I'm using Spring's support for JDBC. I'd like to use <a href="http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/jdbc/core/JdbcTemplate.html" rel="noreferrer">JdbcTemplate</a> (or SimpleJdbcTemplate) to execute a query and obtain the result as an instance of ResultSet.</p> <p>The only way that I can see of achieving this is using:</p> <pre><code>String sql = "select * from...."; SqlRowSet results = jdbcTemplate.queryForRowSet(sql); ((ResultSetWrappingSqlRowSet) results).getResultSet(); </code></pre> <p>An obvious shortcoming of this approach is that it requires me to make an assumption (by casting) about the implementation type of SqlRowSet, but is there a better way?</p> <p><strong>Background info...</strong></p> <p>The reason I want to obtain the results as a ResultSet, rather than a collection of beans, is because the results will be passed straight to a Jasper report for display. In other words, the Java bean would be used for nothing other than temporarily storing each row in the ResultSet, and I'd like to avoid creating such a bean for every Jasper report if possible.</p> <p>Cheers, Don</p>
[ { "answer_id": 212632, "author": "Miguel Ping", "author_id": 22992, "author_profile": "https://Stackoverflow.com/users/22992", "pm_score": 3, "selected": true, "text": " Connection c = ...\n c.prepareCall(\"select ...\").getResultSet();\n" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
212,577
<p>At the moment, I'm creating an XML file in Java and displaying it in a JSP page by transforming it with XSL/XSLT. Now I need to take that XML file and display the same information in a PDF. Is there a way I can do this by using some kind of XSL file?</p> <p>I've seen the <a href="http://www.lowagie.com/iText/" rel="noreferrer">iText</a> Java-PDF library, but I can't find any way to use it with XML and a stylesheet.</p> <p>Any assistance would be much appreciated. Thanks in advance!</p>
[ { "answer_id": 9477362, "author": "Shriram Kalpathy Mohan", "author_id": 898726, "author_profile": "https://Stackoverflow.com/users/898726", "pm_score": 0, "selected": false, "text": "'Section 9.4.2 Parsing XML'" }, { "answer_id": 9622759, "author": "Yaroslav", "author_id...
2008/10/17
[ "https://Stackoverflow.com/questions/212577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21709/" ]
212,587
<p>I’m having an issue where a drop down list in IE 6/7 is behaving as such:</p> <p><img src="https://i488.photobucket.com/albums/rr249/djfloetic/ie7.jpg" alt="alt text"></p> <p>You can see that the drop down <code>width</code> is not wide enough to display the whole text without expanding the overall drop down list.</p> <p>However in Firefox, there is no issue as it <code>expands the width</code> accordingly. This is the behaviour we want in IE 6/7:</p> <p><img src="https://i488.photobucket.com/albums/rr249/djfloetic/firefox.jpg" alt="alt text"></p> <p>We’ve looked at various ways to utilize the <code>onfocus, onblur, onchange, keyboard and mouse events</code> to attempt to solve the problem but still some issues.</p> <p>I was wondering if anyone has solved this issue in IE 6/7 without using any toolkits/frameworks (YUI, Ext-JS, jQuery, etc…).</p>
[ { "answer_id": 212637, "author": "azamsharp", "author_id": 3797, "author_profile": "https://Stackoverflow.com/users/3797", "pm_score": -1, "selected": false, "text": "private void BindData()\n {\n List<Foo> list = new List<Foo>();\n list.Add(new Foo(\"Hello\"...
2008/10/17
[ "https://Stackoverflow.com/questions/212587", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5853/" ]
212,596
<p>I'm currently doing some GUI testing on a ASP.net 2.0 application. The RDBMS is SQL Server 2005. The host is Win Server 2003 / IIS 6.0.</p> <p>I do not have the source code of the application because it was programmed by an external company who's not releasing the code.</p> <p>I've noticed that the application performs well when I restart IIS but after some testing, after I have opened and closed my browser for a couple of hours, the application starts to get slower and slower. I was wondering if this behaviour was due to a bad closing connection practice from the programmers : I'm suspecting an open connection leak on the database here.</p> <p>I guess the .Net garbage collector will eventually close them but... that can take a while, no?</p> <p>I've got SQL Server Management Studio and I do notice from the activity monitor that there are quite a few connections opened on the database.</p> <p>From all that's being said above, here are some questions related to the main question : </p> <ol> <li><p>Is there any way to know in SQL Server 2005 if connections are open because they're waiting to be used in a connection pool or if they're open because they are used by an application?</p></li> <li><p>Does somone know of good online/paper resources where I could learn how to use performance counters or some other kind of tools to help track down these kind of issues?</p></li> <li><p>If performance counters are the best solution, what are the variables that I should watch?</p></li> </ol>
[ { "answer_id": 12428235, "author": "user1617425", "author_id": 1617425, "author_profile": "https://Stackoverflow.com/users/1617425", "pm_score": 6, "selected": false, "text": "SELECT S.spid, login_time, last_batch, status, hostname, program_name, cmd,\n(\n select text from sys.dm_ex...
2008/10/17
[ "https://Stackoverflow.com/questions/212596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2046272/" ]
212,603
<p>I'm trying to write some SQL that will delete files of type '.7z' that are older than 7 days.</p> <p>Here's what I've got that's not working:</p> <pre><code>DECLARE @DateString CHAR(8) SET @DateString = CONVERT(CHAR(8), DATEADD(d, -7, GETDATE()), 1) EXECUTE master.dbo.xp_delete_file 0, N'e:\Database Backups',N'7z', @DateString, 1 </code></pre> <p>I've also tried changing the '1' at the end to a '0'.</p> <p>This returns 'success', but the files aren't getting deleted.</p> <p>I'm using SQL Server 2005, Standard, w/SP2.</p>
[ { "answer_id": 212757, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 0, "selected": false, "text": "xp_delete_file" }, { "answer_id": 212834, "author": "Jorge Ferreira", "author_id": 6508, "author_profi...
2008/10/17
[ "https://Stackoverflow.com/questions/212603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6624/" ]
212,604
<p>I have a function that is effectively a replacement for print, and I want to call it without parentheses, just like calling print.</p> <pre><code># Replace print $foo, $bar, "\n"; # with myprint $foo, $bar, "\n"; </code></pre> <p>In Perl, you can create subroutines with parameter templates and it allows exactly this behavior if you define a subroutine as</p> <pre><code>sub myprint(@) { ... } </code></pre> <p>Anything similar in PHP?</p>
[ { "answer_id": 5452710, "author": "Marcelo", "author_id": 679386, "author_profile": "https://Stackoverflow.com/users/679386", "pm_score": 2, "selected": false, "text": "echoh \"hello\";\n" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8454/" ]
212,614
<p>Should a method that implements an interface method be annotated with <code>@Override</code>?</p> <p>The <a href="http://java.sun.com/javase/6/docs/api/java/lang/Override.html" rel="noreferrer">javadoc of the <code>Override</code> annotation</a> says: </p> <blockquote> <p>Indicates that a method declaration is intended to override a method declaration in a superclass. If a method is annotated with this annotation type but does not override a superclass method, compilers are required to generate an error message.</p> </blockquote> <p>I don't think that an interface is technically a superclass. Or is it?</p> <p><kbd><a href="https://stackoverflow.com/revisions/212614/5">Question Elaboration</a></kbd></p>
[ { "answer_id": 212624, "author": "jjnguy", "author_id": 2598, "author_profile": "https://Stackoverflow.com/users/2598", "pm_score": 9, "selected": true, "text": "class C {\n @Override\n public boolean equals(SomeClass obj){\n // code ...\n }\n}\n" }, { "answer_id"...
2008/10/17
[ "https://Stackoverflow.com/questions/212614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3565/" ]
212,645
<p>I have found an interesting issue in windows which allows me to cause the Windows clock (but not the hardware clocks) to run fast - as much as 8 seconds every minute. I am doing some background research to work out how Windows calculates and updates it's internal time (not how it syncs with an NTP servers). Any information anyone has or any documents you can point me to would be greatly appreciated!</p> <p>Also, if anyone knows how _ftime works please let me know.</p>
[ { "answer_id": 214347, "author": "bk1e", "author_id": 8090, "author_profile": "https://Stackoverflow.com/users/8090", "pm_score": 2, "selected": false, "text": "_ftime()" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18664/" ]
212,657
<p>Within a stored procedure, another stored procedure is being called within a cursor. For every call, the SQL Management Studio results window is showing a result. The cursor loops over 100 times and at that point the results window gives up with an error. Is there a way I can stop the stored procedure within the cursor from outputting any results?</p> <pre><code> WHILE @@FETCH_STATUS = 0 BEGIN EXEC @RC = dbo.NoisyProc SELECT @RValue2 = 1 WHERE @@ROWCOUNT = 0 FETCH NEXT FROM RCursor INTO @RValue1, @RValue2 END </code></pre> <p>Thanks!</p>
[ { "answer_id": 212670, "author": "Adam", "author_id": 13320, "author_profile": "https://Stackoverflow.com/users/13320", "pm_score": 0, "selected": false, "text": "SET ROWCOUNT OFF\n/* the internal SP */\nSET ROWCOUNT ON\n" }, { "answer_id": 212833, "author": "Steven A. Lowe",...
2008/10/17
[ "https://Stackoverflow.com/questions/212657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6651/" ]
212,689
<p>I have implemented a pretty simple picture viewer that will allow the user to browse through a collection of images. They are loaded from the Internet, and displayed on the device through a <code>UIImageView</code> object. Something like this:</p> <pre><code>UIImage *image = [[UIImage alloc] initWithData:imageData]; [img setImage:image]; </code></pre> <p><code>imageData</code> is an instance of <code>NSData</code> that I use to load the contents of the image from an URL, and <code>img</code> is the <code>UIImageView</code> instance.</p> <p>It all works well, but the new image replaces the one being displayed before without any transitions, and I was wondering if there is an easy way to do a good animation transition to improve the user experience.</p> <p>Any idea how to do this? Code samples would be very appreciated.</p>
[ { "answer_id": 223423, "author": "Jamey McElveen", "author_id": 30099, "author_profile": "https://Stackoverflow.com/users/30099", "pm_score": 1, "selected": false, "text": "RootViewController.m" }, { "answer_id": 353724, "author": "Rob", "author_id": 386102, "author_p...
2008/10/17
[ "https://Stackoverflow.com/questions/212689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
212,697
<p>Every class that wants to use java.util.logging generally needs to declare a logger like this:</p> <pre><code>public class MyClass { private static Logger _log = Logger.getLogger(MyClass.class.getName()); } </code></pre> <p>How do you avoid this MyClass.class.getName() boilerplate code?</p>
[ { "answer_id": 212750, "author": "Ogre Psalm33", "author_id": 13140, "author_profile": "https://Stackoverflow.com/users/13140", "pm_score": 0, "selected": false, "text": "public class MyClass {\n private static Logger _log = Logger.getLogger(MyClass.class);\n}\n" }, { "answer_...
2008/10/17
[ "https://Stackoverflow.com/questions/212697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28604/" ]
212,705
<p>I have a <code>&lt;div&gt;</code> that I want to be on a line by itself. According to <a href="http://www.w3schools.com/Css/pr_class_clear.asp" rel="nofollow noreferrer">W3Schools</a>, this rule:</p> <pre><code>div.foo { clear: both; } </code></pre> <p>...should mean this:</p> <blockquote> <p>"No floating elements allowed on either the left or the right side."</p> </blockquote> <p>However, if I float two <code>&lt;div&gt;</code> elements left, and apply the rule above to the first one, the second one does not budge.</p> <p>On the other hand, if I apply <code>"clear: left"</code> to the second <code>&lt;div&gt;</code>, it moves down to the next line. This is my normal approach, but I don't understand why I have to do it like this.</p> <p>Is the W3Schools description above poorly stated, or am I missing something? <strong>Is a clearing rule only able to move the element to which it is applied?</strong></p> <h2>Answer</h2> <p>Thanks Michael S and John D for the good explanations. Warren pointed to <a href="http://www.w3.org/TR/REC-CSS2" rel="nofollow noreferrer">the CSS2 spec</a>, and that's where I found this answer (emphasis mine):</p> <blockquote> <p>This property indicates which sides of an element's box(es) may not be adjacent to an <strong>earlier</strong> floating box.</p> </blockquote> <p>So: <code>clear</code> only affects the position of the element to which it is applied, relative to elements that appear before it the code.</p> <p>Disappointing that I can't tell my <code>&lt;div&gt;</code> to make other divs move down, but them's the breaks. :)</p>
[ { "answer_id": 212721, "author": "warren", "author_id": 4418, "author_profile": "https://Stackoverflow.com/users/4418", "pm_score": 1, "selected": false, "text": "float: left;\nclear: right;\n" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4376/" ]
212,706
<p>What is the best way to reset a PIC18 using C code with the HiTech Pic18 C compiler?</p> <p>Edit:</p> <p>I am currenlty using</p> <pre><code>void reset() { #asm reset #endasm } </code></pre> <p>but there must be a better way</p>
[ { "answer_id": 59441046, "author": "Dan1138", "author_id": 10085080, "author_profile": "https://Stackoverflow.com/users/10085080", "pm_score": 1, "selected": false, "text": "/*\n * File: main.c\n * Author: dan1138\n * Target: PIC18F45K20\n * Compiler: XC8 v2.05\n *\n * ...
2008/10/17
[ "https://Stackoverflow.com/questions/212706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17560/" ]
212,713
<p>Using subversion 1.5 I have branch B which was branched off of branch A. After doing work in both branches I go to merge changes from A into B (using <code>svn merge http://path/to/A</code> in the working directory of B) and get <code>svn: Target path does not exist</code>. What does this mean?</p>
[ { "answer_id": 15531404, "author": "dankuck", "author_id": 146786, "author_profile": "https://Stackoverflow.com/users/146786", "pm_score": 1, "selected": false, "text": " /---------\\\ntrunk -------+---+ +---\\\n \\-----------BOOM!\n" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14481/" ]
212,715
<p>I'm trying to use the giveio.sys driver which requires a "file" to be opened before you can access protected memory. I'm looking at a C example from WinAVR/AVRdude that uses the syntax:</p> <pre class="lang-c prettyprint-override"><code> #define DRIVERNAME "\\\\.\\giveio" HANDLE h = CreateFile(DRIVERNAME, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); </code></pre> <p>but this does not seem to work in Python - I just get a "The specified path is invalid" error, for both</p> <pre><code>f = os.open("\\\\.\\giveio", os.O_RDONLY) </code></pre> <p>and </p> <pre><code>f = os.open("//./giveio", os.O_RDONLY) </code></pre> <p>Why doesn't this do the same thing?</p> <p><strong>Edited</strong> to hopefully reduce confusion of ideas (thanks Will). I did verify that the device driver is running via the batch files that come with AVRdude.</p> <p><strong>Further edited</strong> to clarify SamB's bounty.</p>
[ { "answer_id": 214066, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "\\\\.\\DRIVERNAME\n" }, { "answer_id": 5870770, "author": "Grim", "author_id": 561323, "author_profile": "...
2008/10/17
[ "https://Stackoverflow.com/questions/212715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28984/" ]
212,718
<p>The NUnit documentation doesn't tell me when to use a method with a <code>TestFixtureSetup</code> and when to do the setup in the constructor.</p> <pre><code>public class MyTest { private MyClass myClass; public MyTest() { myClass = new MyClass(); } [TestFixtureSetUp] public void Init() { myClass = new MyClass(); } } </code></pre> <p>Are there any good/bad practices about the <code>TestFixtureSetup</code> versus default constructor or isn't there any difference?</p>
[ { "answer_id": 212769, "author": "Sam Wessel", "author_id": 4734, "author_profile": "https://Stackoverflow.com/users/4734", "pm_score": 6, "selected": false, "text": "[SetUp]" }, { "answer_id": 213172, "author": "casademora", "author_id": 5619, "author_profile": "http...
2008/10/17
[ "https://Stackoverflow.com/questions/212718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13376/" ]
212,734
<p>How do you automatically start a service after running an install from a Visual Studio Setup Project?</p> <p>I just figured this one out and thought I would share the answer for the general good. Answer to follow. I am open to other and better ways of doing this.</p>
[ { "answer_id": 212736, "author": "Jason Z", "author_id": 2470, "author_profile": "https://Stackoverflow.com/users/2470", "pm_score": 7, "selected": true, "text": "using System.ServiceProcess; \n\nclass ServInstaller : ServiceInstaller\n{\n protected override void OnCommitted(System.C...
2008/10/17
[ "https://Stackoverflow.com/questions/212734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2470/" ]
212,745
<p>I'm on OS X 10.5.5 (though it does not matter much I guess)</p> <p>I have a set of text files with fancy characters like double backquotes, ellipsises ("...") in one character etc. </p> <p>I need to convert these files to good old plain 7-bit ASCII, preferably without losing character meaning (that is, convert those ellipses to three periods, backquotes to usual "s etc.).</p> <p>Please advise some smart command-line (bash) tool/script to do that.</p>
[ { "answer_id": 212955, "author": "Josh Lee", "author_id": 19750, "author_profile": "https://Stackoverflow.com/users/19750", "pm_score": 3, "selected": true, "text": "#!/usr/bin/env python\nimport elinks\nimport sys\nfor line in sys.stdin:\n line = line.decode('utf-8')\n sys.stdout....
2008/10/17
[ "https://Stackoverflow.com/questions/212745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6236/" ]
212,748
<p>I wrote a savefile method to save an object to xml. But I am not sure how to test the method in NUnit. Do I need create a sample file manually and compare the string between the files? Are there any better ways to test the method?</p> <p>Thanks for your answer.</p>
[ { "answer_id": 212781, "author": "Robert P", "author_id": 18097, "author_profile": "https://Stackoverflow.com/users/18097", "pm_score": 1, "selected": false, "text": "XmlDocument" }, { "answer_id": 212789, "author": "Krzysztof Kozmic", "author_id": 13163, "author_prof...
2008/10/17
[ "https://Stackoverflow.com/questions/212748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28989/" ]
212,762
<p>I need generate <a href="https://stackoverflow.com/questions/27921/what-is-the-best-way-to-create-a-thumbnail-using-aspnet">thumbnails</a> for a bunch of jpegs (200,000+) but I want to make sure all of my thumbs have a equal height and width. However, I don't want to change the proportions of the image so I need to add empty space to the shorter dimension to "square it up". The empty space's background color is variable. </p> <p>Here's the code snippet I'm using to generate the thumbs. What's the best way to do the squaring?</p> <pre><code> Dim imgDest As System.Drawing.Bitmap = New Bitmap(ScaleWidth, ScaleHeight) imgDest.SetResolution(TARGET_RESOLUTION, TARGET_RESOLUTION) Dim grDest As Graphics = Graphics.FromImage(imgDest) grDest.DrawImage(SourceImage, 0, 0, imgDest.Width, imgDest.Height) </code></pre>
[ { "answer_id": 216042, "author": "Ates Goral", "author_id": 23501, "author_profile": "https://Stackoverflow.com/users/23501", "pm_score": 2, "selected": false, "text": "imageWidth" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4796/" ]
212,763
<p>My Win form app doesn't seem to like FormsAuthentication, I'm totally new to hashing so any help to convert this would be very welcome. Thanks.</p> <pre><code>//Write hash protected TextBox tbPassword; protected Literal liHashedPassword; { string strHashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(tbPassword.Text, "sha1"); liHashedPassword.Text = "Hashed Password is: " + strHashedPassword; } //read hash string strUserInputtedHashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile( tbPassword.Text, "sha1"); if(strUserInputtedHashedPassword == GetUsersHashedPasswordUsingUserName(tbUserName.Text)) { // sign-in successful } else { // sign-in failed } </code></pre>
[ { "answer_id": 212822, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 5, "selected": false, "text": "using System.Security.Cryptography;\n\npublic static string EncodePasswordToBase64(string password)\n{ byte[] bytes =...
2008/10/17
[ "https://Stackoverflow.com/questions/212763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
212,797
<p>It seems</p> <pre><code>import Queue Queue.Queue().get(timeout=10) </code></pre> <p>is keyboard interruptible (ctrl-c) whereas</p> <pre><code>import Queue Queue.Queue().get() </code></pre> <p>is not. I could always create a loop;</p> <pre><code>import Queue q = Queue() while True: try: q.get(timeout=1000) except Queue.Empty: pass </code></pre> <p>but this seems like a strange thing to do.</p> <p>So, is there a way of getting an indefinitely waiting but keyboard interruptible Queue.get()?</p>
[ { "answer_id": 212975, "author": "Eli Courtwright", "author_id": 1694, "author_profile": "https://Stackoverflow.com/users/1694", "pm_score": 4, "selected": true, "text": "Queue" }, { "answer_id": 216719, "author": "Anders Waldenborg", "author_id": 24082, "author_profi...
2008/10/17
[ "https://Stackoverflow.com/questions/212797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2010/" ]
212,805
<pre><code>Object o = new Long[0] System.out.println( o.getClass().isArray() ) System.out.println( o.getClass().getName() ) Class ofArray = ??? </code></pre> <p>Running the first 3 lines emits;</p> <pre><code>true [Ljava.lang.Long; </code></pre> <p>How do I get ??? to be type long? I could parse the string and do a Class.forname(), but thats grotty. What's the easy way?</p>
[ { "answer_id": 212816, "author": "ddimitrov", "author_id": 18187, "author_profile": "https://Stackoverflow.com/users/18187", "pm_score": 5, "selected": false, "text": "public Class<?> getComponentType()\n" }, { "answer_id": 212817, "author": "sakana", "author_id": 28921, ...
2008/10/17
[ "https://Stackoverflow.com/questions/212805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6580/" ]
212,808
<p>I'm trying to find an efficient C++ interval tree implementation (mostly likely based on red black trees) without a viral or restrictive license. Any pointers to a clean lightweight standalone implementation? For the use case I have in mind, the set of intervals is known at the outset (there would be say a million) and I want to be able to quickly obtain a list of intervals that overlap a given interval. Thus the tree once built will not change -- just needs rapid queries.</p>
[ { "answer_id": 213308, "author": "Max Lybbert", "author_id": 10593, "author_profile": "https://Stackoverflow.com/users/10593", "pm_score": 2, "selected": false, "text": "std::map" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
212,821
<p>In this class for example, I want to force a limit of characters the first/last name can allow.</p> <pre><code>public class Person { public string FirstName { get; set; } public string LastName { get; set; } } </code></pre> <p>Is there a way to force the string limit restriction for the first or last name, so <strong>when the client serializes this</strong> before sending it to me, it would throw an error on their side if it violates the lenght restriction?</p> <p>Update: this needs to be identified and forced in the WSDL itself, and not after I've recieved the invalid data.</p>
[ { "answer_id": 212917, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 2, "selected": false, "text": "[ValidationSchema(\"person.xsd\")]\npublic class Person { /* ... */ }\n\n<!-- person.xsd -->\n\n<?xml version=\"1.0\"?>\...
2008/10/17
[ "https://Stackoverflow.com/questions/212821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/820/" ]
212,827
<p>I've been using Pydev/Eclipse to develop Google App Engine (GAE) applications but I've been unable to get the response/request objects from WebOb to have auto-completion. I used a <a href="http://code.google.com/appengine/articles/eclipse.html" rel="nofollow noreferrer">widely recommended tutorial</a> to get everything configured; auto-completion is working for everything else I've run into.</p> <p>As an example: if I type in "self." I get auto-completion for response and request; if I select one of those, say "response", and add a "." (bringing the full line to "self.response." thus far) I don't get any options - since the WebOb library is included, I would expect to get things like "out.write()" as an option.</p> <p>I'm including the following libraries into my Pydev project:</p> <ul> <li>C:\Program Files\Google\google_appengine </li> <li>C:\Program Files\Google\google_appengine\lib\django </li> <li>C:\Program Files\Google\google_appengine\lib\webob </li> <li>C:\Program Files\Google\google_appengine\lib\yaml\lib</li> </ul> <p>Any help would be much appreciated, thanks.</p>
[ { "answer_id": 2321588, "author": "Goyuix", "author_id": 243, "author_profile": "https://Stackoverflow.com/users/243", "pm_score": 0, "selected": false, "text": "os.pathsep.join(EXTRA_PATHS)\n" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/312043/" ]
212,839
<p>The test form generated by ASMX is pretty handy for testing operations. However, there is no apparent way to include SOAP headers.</p> <p>How can you test your headers without programming a client to use the service?</p>
[ { "answer_id": 276501, "author": "Austin", "author_id": 32854, "author_profile": "https://Stackoverflow.com/users/32854", "pm_score": 1, "selected": false, "text": "// Set SOAP Message\nstring msg = \"<?xml version='1.0' encoding='UTF-8'?><soap:Envelope>\";\n...\n...\n\n// Make http requ...
2008/10/17
[ "https://Stackoverflow.com/questions/212839", "https://Stackoverflow.com", "https://Stackoverflow.com/users/337/" ]
212,842
<p>In short, how can I search, view, and modify in-memory values in linux, preferably as easily/simply as possible.</p> <p><a href="http://www.raymond.cc/blog/archives/2007/02/27/how-to-cheat-and-hack-flash-based-games/" rel="nofollow noreferrer">Like this</a>.</p>
[ { "answer_id": 72671768, "author": "Devon", "author_id": 7944912, "author_profile": "https://Stackoverflow.com/users/7944912", "pm_score": 0, "selected": false, "text": "ceserver" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
212,847
<p>I am mentoring the programming group of a high school robotics team. I would like to set up a source control repository to avoid the mess of manually copying directories for sharing/backups and merging these by hand. The build location will not usually have network access, so this has led me to distributed version control systems (DVCS), which I am not familiar with.</p> <p>The largest requirements are the following:</p> <ol> <li>Works in Windows XP and Vista. (absolute must)</li> <li>Changes can be committed locally. (Seems to be the case with all DVCS's)</li> <li>Repositories from multiple machines can be merged without network access. (Possibly by storing the repository on a USB drive and swapping the drive to another machine, then merging from there) </li> </ol> <p>It should also be easy to learn and use, preferably through a graphical UI, as I am working with high school students who have never used a version control system.</p> <p>Any suggestions as to which DVCS fits this the best.</p> <p>EDIT:</p> <p>Thanks for the answers. Mercurial looks pretty good, but does it support merging repositories from one directory to another, or do I have to set up a local network to merge across?</p>
[ { "answer_id": 213345, "author": "quark", "author_id": 29057, "author_profile": "https://Stackoverflow.com/users/29057", "pm_score": 2, "selected": false, "text": "cd C:\\Project" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5233/" ]
212,851
<p>I've got a <code>DataGridViewCobmoboxColumn</code> that has to be on the far right side of the screen. The items in the cell are wider that the cell width, so the dropdown list is also wider than the cell, so the user can see what top select. When the list drops down, the right side of the dropdown is not visible, and thus the scroll bar is also not visible. The users think there are only 7 items to choose from, when there are actually many.</p> <p>Since this has to be on the right side, is there any way to anchor the dropdown to the right of the cell and expand to the left?</p> <p>We're using .Net 2.0 for this project. Since we're coding in both VB and C#, I'm not too concerned about an answer being language specific. I'll take anything...</p>
[ { "answer_id": 42065719, "author": "Taras Kozubski", "author_id": 1259074, "author_profile": "https://Stackoverflow.com/users/1259074", "pm_score": 0, "selected": false, "text": "ToolStripDropDownDirection.AboveLeft" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
212,858
<p>I'm working on a web app project (in java; not that it matters) and we have a form with drop down lists and input fields. </p> <p>Obviously drop down lists are provided because we expect a specific value from a set of values. </p> <p>So my question is this: does it make sense to ensure the submitted value is in the set of expected values? Or is it acceptable to just assume the correct value is coming across?</p> <p>There aren't any "errors" that would arise from different values being submitted, but the data store would not be consistent with the business rules/requirements.</p>
[ { "answer_id": 42065719, "author": "Taras Kozubski", "author_id": 1259074, "author_profile": "https://Stackoverflow.com/users/1259074", "pm_score": 0, "selected": false, "text": "ToolStripDropDownDirection.AboveLeft" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17337/" ]
212,863
<p>My current project uses NUnit for unit tests and to drive UATs written with Selenium. Developers normally run tests using ReSharper's test runner in VS.Net 2003 and our build box kicks them off via NAnt.</p> <p>We would like to run the UAT tests in parallel so that we can take advantage of Selenium Grid/RCs so that they will be able to run much faster.</p> <p>Does anyone have any thoughts on how this might be achieved? and/or best practices for testing Selenium tests against multiple browsers environments without writing duplicate tests automatically?</p> <p>Thank you.</p>
[ { "answer_id": 32245312, "author": "Peter", "author_id": 707458, "author_profile": "https://Stackoverflow.com/users/707458", "pm_score": 1, "selected": false, "text": "[Parallelizable(ParallelScope.Self)]" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29009/" ]
212,900
<p>I've used lex and yacc (more usually bison) in the past for various projects, usually translators (such as a subset of EDIF streamed into an EDA app). Additionally, I've had to support code based on lex/yacc grammars dating back decades. So I know my way around the tools, though I'm no expert.</p> <p>I've seen positive comments about Antlr in various fora in the past, and I'm curious as to what I may be missing. So if you've used both, please tell me what's better or more advanced in Antlr. My current constraints are that I work in a C++ shop, and any product we ship will not include Java, so the resulting parsers would have to follow that rule.</p>
[ { "answer_id": 212930, "author": "Daniel Spiewak", "author_id": 9815, "author_profile": "https://Stackoverflow.com/users/9815", "pm_score": 8, "selected": true, "text": "expr ::= expr '+' expr\n | expr '-' expr\n | '(' expr ')'\n | NUM ;\n" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3778/" ]
212,902
<p>I'm trying to find about ALL the possible options that I can set in <code>web.config</code>. Surprisingly, I can't find this at all. I expected it to be somewhere inside <a href="http://msdn.microsoft.com" rel="noreferrer">MSDN</a>.</p> <p>I know I can technically add "anything" to <code>web.config</code>, what I'm looking for is the things that the .NET Framework "as shipped" uses.</p> <p>In particular, right now I'm interested in the <code>&lt;mailsettings&gt;</code> section.<br> For example, in many examples I've found, I noticed that they set <code>DeliveryMethod="Network"</code>. I'm really curious what other values this attribute can take.</p> <p>Is there any document on all the attributes and all their values, and all the effects those have?</p>
[ { "answer_id": 212933, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 6, "selected": true, "text": "<system.web>" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3314/" ]
212,906
<p>My customer is replacing MS Office with OpenOffice in some workstations. My program export a file to Excel using the .xml extension (using open format) and opens it using the current associated program (using ShellExecute)</p> <p>The problem is that OpenOffice does not register the .xml extension associated with it.</p> <p>Manually association works fine, but I want to make a .reg or something to easily change the setting.</p> <p>I'm looking in the registry in a PC with the change already made, but the </p> <pre><code>"HKEY_CLASSES_ROOT\.xml" </code></pre> <p>key does not have anything referencing OpenOffice.</p> <p>Where is the association stored? How can I make a script to do the work?</p>
[ { "answer_id": 212921, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 5, "selected": true, "text": "\"HKEY_CLASSES_ROOT\\.xml\"" }, { "answer_id": 212984, "author": "kenny", "author_id": 3225, "author_pr...
2008/10/17
[ "https://Stackoverflow.com/questions/212906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2385/" ]
212,919
<p>I need to change the permissions of a directory to be owned by the Everyone user with all access rights on this directory. I'm a bit new to the Win32 API, so I'm somewhat lost in the SetSecurity* functions.</p>
[ { "answer_id": 213716, "author": "Jason", "author_id": 26302, "author_profile": "https://Stackoverflow.com/users/26302", "pm_score": 2, "selected": false, "text": "SetSecurityInfo(hDir, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, NULL, NULL);\n" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26302/" ]
212,939
<p>MySQL 5.0.45</p> <p>What is the syntax to alter a table to allow a column to be null, alternately what's wrong with this:</p> <pre><code>ALTER mytable MODIFY mycolumn varchar(255) null; </code></pre> <p>I interpreted the manual as just run the above and it would recreate the column, this time allowing null. The server is telling me I have syntactical errors. I just don't see them.</p>
[ { "answer_id": 212947, "author": "Daniel Spiewak", "author_id": 9815, "author_profile": "https://Stackoverflow.com/users/9815", "pm_score": 11, "selected": true, "text": "ALTER TABLE mytable MODIFY mycolumn VARCHAR(255);\n" }, { "answer_id": 212966, "author": "ConroyP", "...
2008/10/17
[ "https://Stackoverflow.com/questions/212939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13285/" ]
212,941
<p>I have a django application that I'd like to add some rest interfaces to. I've seen <a href="http://code.google.com/p/django-rest-interface/" rel="noreferrer">http://code.google.com/p/django-rest-interface/</a> but it seems to be pretty simplistic. For instance it doesn't seem to have a way of enforcing security. How would I go about limiting what people can view and manipulate through the rest interface? Normally I'd put this kind of logic in my views. Is this the right place or should I be moving some more logic down into the model? Alternatively is there a better library out there or do I need to roll my own?</p>
[ { "answer_id": 214383, "author": "Anders Eurenius", "author_id": 1421, "author_profile": "https://Stackoverflow.com/users/1421", "pm_score": 2, "selected": false, "text": "authentication" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2351/" ]
212,965
<p>What I want to do is the following:</p> <ol> <li>read in multiple line input from <code>stdin</code> into variable <code>A</code></li> <li>make various operations on <code>A</code></li> <li>pipe <code>A</code> without losing delimiter symbols (<code>\n</code>,<code>\r</code>,<code>\t</code>,etc) to another command</li> </ol> <p>The current problem is that, I can't read it in with <code>read</code> command, because it stops reading at newline.</p> <p>I can read stdin with <code>cat</code>, like this:</p> <pre><code>my_var=`cat /dev/stdin` </code></pre> <p>, but then I don't know how to print it. So that the newline, tab, and other delimiters are still there.</p> <p>My sample script looks like this:</p> <pre><code>#!/usr/local/bin/bash A=`cat /dev/stdin` if [ ${#A} -eq 0 ]; then exit 0 else cat ${A} | /usr/local/sbin/nextcommand fi </code></pre>
[ { "answer_id": 212987, "author": "Tanktalus", "author_id": 23512, "author_profile": "https://Stackoverflow.com/users/23512", "pm_score": 7, "selected": true, "text": "myvar=`cat`\n\necho \"$myvar\"\n" }, { "answer_id": 213007, "author": "Community", "author_id": -1, "...
2008/10/17
[ "https://Stackoverflow.com/questions/212965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
212,968
<p>I have a scenario in a system which I've tried to simplify as best as I can. We have a table of (lets call them) artefacts, artefacts can be accessed by any number of security roles and security roles can access any number of artefacts. As such, we have 3 tables in the database - one describing artefacts, one describing roles and a many-to-many association table linking artefact ID to Role ID.</p> <p>Domain wise, we have two classes - one for a role and one for an artefact. the artefact class has an IList property that returns a list of roles that can access it. (Roles however do not offer a property to get artefacts that can be accessed).</p> <p>As such, the nhibernate mapping for artefact contains the following;</p> <pre class="lang-xml prettyprint-override"><code>&lt;bag name="AccessRoles" table="ArtefactAccess" order-by="RoleID" lazy="true" access="field.camelcase-underscore" optimistic-lock="false"&gt; &lt;key column="ArtefactID"/&gt; &lt;many-to-many class="Role" column="RoleID"/&gt; &lt;/bag&gt; </code></pre> <p>This all works fine and if I delete an artefact, the association table is cleaned up appropriately and all references between the removed artefact and roles are removed (the role isn't deleted though, correctly - as we don't want orphans deleted).</p> <p>The problem is - how to delete a role and have it clear up the association table automatically. If I presently try to delete a role, I get a reference constraint as there are still entries in the association table for the role. The only way to successfully delete a role is to query for all artefacts that link to that role, remove the role from the artefact's role collection, update the artefacts and then delete the role - not very efficient or nice, especially when in the un-simplified system, roles can be associated with any number of other tables/objects.</p> <p>I need to be able to hint to NHibernate that I want this association table cleared whenever I delete a role - is this possible, and if so - how do I do it?</p> <p>Thanks for any help.</p>
[ { "answer_id": 214138, "author": "kͩeͣmͮpͥ ͩ", "author_id": 26479, "author_profile": "https://Stackoverflow.com/users/26479", "pm_score": 0, "selected": false, "text": "Artifact" }, { "answer_id": 407171, "author": "Community", "author_id": -1, "author_profile": "http...
2008/10/17
[ "https://Stackoverflow.com/questions/212968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20524/" ]
212,988
<p>I have created an item swapper control consisting in two listboxes and some buttons that allow me to swap items between the two lists. The swapping is done using javascript. I also move items up and down in the list. Basically when I move the items to the list box on the right I store the datakeys of the elements (GUIDs) in a hiddenfield. On postback I simply read the GUIDs from the field. Everything works great but on postback, I get the following exception:</p> <blockquote> <p>Invalid postback or callback argument. Event validation is enabled using in configuration or &lt;%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. </p> </blockquote> <p>I've prepared a test application. All you have to do is download the archive and run the project. On the web page select the 3 items, press Add all, then move the third element up one level and then hit "Button". The error will show up. Turning event validation off is by no means acceptable. Can anyone help me, I've spent two already days without finding a solution.</p> <p><a href="http://cid-c9672af9b84b07ef.skydrive.live.com/self.aspx/TestApp/TestProject.zip" rel="noreferrer">TEST APPLICATION</a></p>
[ { "answer_id": 213535, "author": "kjv", "author_id": 1360, "author_profile": "https://Stackoverflow.com/users/1360", "pm_score": 1, "selected": true, "text": "public class CustomListBox : ListBox\n{\n protected override bool LoadPostData(string postDataKey, System.Collections.Speciali...
2008/10/17
[ "https://Stackoverflow.com/questions/212988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1360/" ]
212,989
<p>I have G729 encoded audio files. I need to programmatically convert them to WAV PCM (16bit 8kHz mono) in the flow of a tool that is doing other thing too. I have an executable that will do that for me. But spawning that external process every time I convert is too heavy on resources. Especially if I need many of them being done in parallel. Looking for a .NET library or code that will let me call this inside my process.</p>
[ { "answer_id": 12105360, "author": "AndroidLearner", "author_id": 1479075, "author_profile": "https://Stackoverflow.com/users/1479075", "pm_score": 0, "selected": false, "text": "EXE" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1363/" ]
212,994
<p>How can I get tab completion to work for selecting CVS modules under Linux (preferably using bash) ?</p> <p>For example, "cvs co " + tab would list the modules I can checkout. I've heard it's easy to do using zsh, but still I didn't manage to get it working either. </p> <p>Also, how can I list all available modules (or repositories?) available in the CVSROOT?</p>
[ { "answer_id": 213025, "author": "Isak Savo", "author_id": 8521, "author_profile": "https://Stackoverflow.com/users/8521", "pm_score": 2, "selected": false, "text": "cvs -d \"$the_cvsroot\" checkout -c" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2907/" ]
212,999
<p>After using Hudson for continuous integration with a prior project, I want to set up a continuous integration server for the iPhone projects I'm working on now. After doing some research it looks like there aren't any CI engines designed specifically for Xcode, but one guy has had success <a href="http://www.pragmaticautomation.com/cgi-bin/pragauto.cgi/Build/XcodeOnCC.rdoc" rel="noreferrer">using Cruise Control combined with the xcodebuild CLI tool</a>. Has anyone here tried this? Are there any CI engines that work well with Xcode projects?</p> <p>I'm probably going to give Cruise Control a try. I'll post an answer with my findings.</p>
[ { "answer_id": 1182726, "author": "Silentcode", "author_id": 145054, "author_profile": "https://Stackoverflow.com/users/145054", "pm_score": 6, "selected": true, "text": "xcodebuild -target \"myAppAppStore\" -configuration \"DistributionAppStore\" -sdk iphoneos2.1\n" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/212999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17188/" ]
213,002
<p>I have some data grouped in a table by a certain criteria, and for each group it is computed an average —well, the real case is a bit more tricky— of the values from each of the detail rows that belong to that group. This average is shown in each group footer rows. Let's see this simple example:</p> <p><img src="https://farm4.static.flickr.com/3008/2958165686_088405e1ef_o.jpg" alt="Report table"></p> <p>What I want now is to show a grand total on the <strong>table footer</strong>. The grand total should be computed by <em>adding</em> each group's average (for instance, in this example the grand total should be 20 + 15 = 35). However, I can't nest aggregate functions. How can I do?</p>
[ { "answer_id": 305766, "author": "user33675", "author_id": 33675, "author_profile": "https://Stackoverflow.com/users/33675", "pm_score": 3, "selected": true, "text": "Public Sub New()\n\n m_valueTable = New DataTable(tableName:=\"DoubleValueList\")\n\n 'Type reference to System.Dou...
2008/10/17
[ "https://Stackoverflow.com/questions/213002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1679/" ]
213,015
<p>I have over a TB of home movies with horrible file names. Finding what you want is impossible. I would like to rename all files to the time they were originally recorded (not the file time they were placed on my computer). Some applications (like Ulead Video Studio) can access this information, which I believe is embedded in the CODEC.</p> <p>I would LOVE to find how how either I can write a .Net app to extract this information to rename my files so I can easily organize them OR find an application that will do this for me. Thank you very much in advanced.</p> <p>additional information:: home movies were captured on miniDV and DVD camcorders.</p>
[ { "answer_id": 6050589, "author": "PhilT", "author_id": 759912, "author_profile": "https://Stackoverflow.com/users/759912", "pm_score": 3, "selected": false, "text": "mplayer -vo null -ao null -frames 0 -identify myfile.MOV 2>/dev/null|grep creation_time:\n" }, { "answer_id": 168...
2008/10/17
[ "https://Stackoverflow.com/questions/213015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29027/" ]
213,027
<p>The following code was produced by a consultant working for my group. I'm not a C++ developer (worked in many languages, though) but would like some independent opinions on the following code. This is in Visual Studio C++ 6.0. I've got a gut reaction (not a good one, obviously), but I'd like some "gut reactions" from seasoned (or even not so unseasoned) C++ developers out there. Thanks in advance!</p> <pre><code>// Example call strColHeader = insert_escape(strColHeader, ',', '\\'); //Get rid of the commas and make it an escape character </code></pre> <p>...snip...</p> <pre><code>CString insert_escape ( CString originalString, char charFind, char charInsert ) { bool continueLoop = true; int currentInd = 0; do { int occurenceInd = originalString.Find(charFind, currentInd); if(occurenceInd&gt;0) { originalString.Insert(occurenceInd, charInsert); currentInd = occurenceInd + 2; } else { continueLoop = false; } } while(continueLoop); return(originalString); } </code></pre>
[ { "answer_id": 213041, "author": "gbjbaanb", "author_id": 13744, "author_profile": "https://Stackoverflow.com/users/13744", "pm_score": 4, "selected": false, "text": "CString strColHeader;\nstrColHeader.Replace(\",\", \"\\\\,\") \n" }, { "answer_id": 213398, "author": "Eclips...
2008/10/17
[ "https://Stackoverflow.com/questions/213027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
213,042
<p>I tried "x = y ** e", but that didn't work.</p>
[ { "answer_id": 213043, "author": "Evan Teran", "author_id": 13430, "author_profile": "https://Stackoverflow.com/users/13430", "pm_score": 8, "selected": true, "text": "pow" }, { "answer_id": 213064, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "ht...
2008/10/17
[ "https://Stackoverflow.com/questions/213042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7598/" ]
213,045
<p>I have a class library with some extension methods written in C# and an old website written in VB.</p> <p>I want to call my extension methods from the VB code but they don't appear in intelisense and I get compile errors when I visit the site.</p> <p>I have got all the required <em>Import</em>s because other classes contained in the same namespaces are appearing fine in Intelisense.</p> <p>Any suggestions</p> <p><strong>EDIT:</strong> More info to help with some comments.</p> <p>my implementation looks like this </p> <pre><code>//C# code compiled as DLL namespace x.y { public static class z { public static string q (this string s){ return s + " " + s; } } } </code></pre> <p>and my usage like this </p> <pre><code>Imports x.y '...' Dim r as string = "greg" Dim s as string = r.q() ' does not show in intelisense ' and throws error : Compiler Error Message: BC30203: Identifier expected. </code></pre>
[ { "answer_id": 213066, "author": "ICR", "author_id": 214, "author_profile": "https://Stackoverflow.com/users/214", "pm_score": 2, "selected": false, "text": "public static string MyExtMethod(this string s)\n" }, { "answer_id": 213070, "author": "Jason Jackson", "author_id...
2008/10/17
[ "https://Stackoverflow.com/questions/213045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1741868/" ]
213,078
<p>Alright so I'm essentialyl trying to code something that will combine two files together in VB and output a single file that when run, runs both of them. I've grabbed this source from several places online and am just trying to get it to work. We have the main program that combines them with a GUI</p> <pre><code>Const FileSplit = "@&lt;&gt;#&lt;&gt;#&lt;&gt;@" Private Sub cmdAdd_Click() With Dlg .Filter = "All Files(*.*) | *.*" .DialogTitle = "Please Select a File..." .ShowOpen End With lsFiles.AddItem (Dlg.FileName) End Sub Private Sub cmdBuild_Click() Dim sStub As String, sFiles As String, i As Integer Open App.Path &amp; "\stub.exe" For Binary As #1 sStub = Space(LOF(1)) Get #1, , sStub Close #1 Open App.Path &amp; "\boundfile.exe" For Binary As #1 Put #1, , sStub &amp; FileSplit For i = 0 To lsFiles.ListCount - 1 Open lsFiles.List(i) For Binary As #2 sFiles = Space(LOF(2)) Get #2, , sFiles Close #2 Put #1, , sFiles &amp; FileSplit Next i Close #1 MsgBox "Files Successfully Combined" End Sub </code></pre> <p>And then we have a second App that acts as a stub</p> <pre><code>Const FileSplit = "@&lt;&gt;#&lt;&gt;#&lt;&gt;@" Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Private Sub Form_Load() Dim sStub As String, sFiles() As String, i As Integer Open App.Path &amp; "\" &amp; App.EXEName &amp; ".exe" For Binary As #1 sStub = Input(LOF(1), 1) Get #1, , stub Close #1 sFiles = Split(sStub, FileSplit) For i = 1 To UBound(sFiles()) Open Environ("tmp") &amp; "\tmp" &amp; i &amp; ".exe" For Binary As #1 Put #1, , sFiles(i) Close #1 Call ShellExecute(0, vbNullString, Environ("tmp") &amp; "\tmp" &amp; i &amp; ".exe", vbNullString, vbNullString, vbNormalFocus) Next i End End Sub </code></pre> <p>however when the files are combined and run all I get is a dosbox opening and closing. Any ideas?</p>
[ { "answer_id": 235586, "author": "Svante Svenson", "author_id": 19707, "author_profile": "https://Stackoverflow.com/users/19707", "pm_score": 0, "selected": false, "text": "Const FileSplit = \"@<>#<>#<>@\"\n\nPrivate Sub cmdAdd_Click()\n With Dlg\n .Filter = \"All Files(*.*) | ...
2008/10/17
[ "https://Stackoverflow.com/questions/213078", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
213,085
<p>I'm working on a forums system. I'm trying to allow users to see the posts they've made. In order for this link to work, I'd need to jump to the <strong>page</strong> on the particular topic they posted in that contained their post, so the bookmarks could work, etc. Since this is a new feature on an old forum, I'd like to code it so that the forum system doesn't have to keep track of every post, but can simply populate this list automatically.</p> <p>I know how to populate the list, but I need to do this: </p> <p>Given a query, where will X row within the query (guaranteed to be unique by some combination of identifiers) appear? As in, how many rows would I have to offset to get to it? This would be in a sorted query.</p> <p>Ideally, I'd like to do this with SQL and not PHP, but if it can't be done in SQL I guess that's an answer too. ^_^</p> <p>Thanks</p>
[ { "answer_id": 213186, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 3, "selected": true, "text": "SELECT count(post_id) FROM posts\n WHERE thread_id = '{$thread_id}' AND date_posted <= '{$date_posted}'\n" }, { "answer...
2008/10/17
[ "https://Stackoverflow.com/questions/213085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19521/" ]
213,118
<p>In MFC I'm trying to set a null handler timer (ie. no windows). But I'm unable to process the WM_TIMER event in the CWinApp MESSAGE_MAP. Is this possible? If so, how?</p>
[ { "answer_id": 213776, "author": "Shog9", "author_id": 811, "author_profile": "https://Stackoverflow.com/users/811", "pm_score": 5, "selected": true, "text": "SetTimer()" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/213118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
213,121
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2023977/c-difference-of-keywords-typename-and-class-in-templates">C++ difference of keywords ‘typename’ and ‘class’ in templates</a> </p> </blockquote> <p>When defining a function template or class template in C++, one can write this:</p> <pre><code>template &lt;class T&gt; ... </code></pre> <p>or one can write this:</p> <pre><code>template &lt;typename T&gt; ... </code></pre> <p>Is there a good reason to prefer one over the other?</p> <hr> <p>I accepted the most popular (and interesting) answer, but the real answer seems to be "No, there is no good reason to prefer one over the other."</p> <ul> <li>They are equivalent (except as noted below).</li> <li>Some people have reasons to always use <code>typename</code>.</li> <li>Some people have reasons to always use <code>class</code>.</li> <li>Some people have reasons to use both.</li> <li>Some people don't care which one they use.</li> </ul> <p>Note, however, that before C++17 in the case of <em>template template</em> parameters, use of <code>class</code> instead of <code>typename</code> was required. See <a href="https://stackoverflow.com/a/11311432/3964522">user1428839's answer</a> below. (But this particular case is not a matter of preference, it was a requirement of the language.)</p>
[ { "answer_id": 213135, "author": "itsmatt", "author_id": 7862, "author_profile": "https://Stackoverflow.com/users/7862", "pm_score": 10, "selected": true, "text": "class" }, { "answer_id": 213149, "author": "Michael Burr", "author_id": 12711, "author_profile": "https:...
2008/10/17
[ "https://Stackoverflow.com/questions/213121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1175/" ]
213,128
<p>We're running into issues with how we specify font sizes. If we specify the font sizes using pt, they don't always look the same across browsers/platforms. If we specify font sizes using px, IE6 users can't resize the text.</p>
[ { "answer_id": 213407, "author": "Nathan Long", "author_id": 4376, "author_profile": "https://Stackoverflow.com/users/4376", "pm_score": 3, "selected": true, "text": "<style type=\"text/css\">`\nbody {\n font-size:100%;\n line-height:1.125em;\n}\n\n.bodytext p {\n font-size:0.87...
2008/10/17
[ "https://Stackoverflow.com/questions/213128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1538/" ]
213,148
<p>Can anyone tell the function to sort the columns of a gridview in c# asp.net.</p> <p>The databound to gridview is from datacontext created using linq. I wanted to click the header of the column to sort the data.</p> <p>Thanks!</p>
[ { "answer_id": 213306, "author": "craigmoliver", "author_id": 12252, "author_profile": "https://Stackoverflow.com/users/12252", "pm_score": 0, "selected": false, "text": " AllowSorting=\"true\"\n" }, { "answer_id": 213541, "author": "Daniel Schaffer", "author_id": 2596, ...
2008/10/17
[ "https://Stackoverflow.com/questions/213148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
213,151
<p>EDIT: It seems to be something with having the two queues in the same schema.</p> <p>I’m trying to experiment with queue propagation but I’m not seeing records in the destination queue. But that could easily be because I don’t have all the pieces in place.</p> <p>Does anyone have a test case they could post? I’ll include what I tried below. I found the troubleshooting in the docs a little light and the propagation is such a black box, it’s hard to know why this isn’t moving.</p> <p>Here’s what I have; no laughing.</p> <hr> <pre><code>CREATE OR REPLACE TYPE test_payload AS OBJECT( test_id NUMBER, test_dt DATE); DECLARE subscriber SYS.aq$_agent; BEGIN --- Create Originating Queue and start it DBMS_AQADM.create_queue_table( queue_table =&gt; 'Test_MQT', queue_payload_type =&gt; 'Test_Payload', multiple_consumers =&gt; TRUE ); --- multiple subscriber DBMS_AQADM.create_queue( 'Test_Q', 'Test_MQT' ); DBMS_AQADM.start_queue( queue_name =&gt; 'Test_Q' ); --- Create Destination Queue and start it DBMS_AQADM.create_queue_table( queue_table =&gt; 'Dest_MQT', queue_payload_type =&gt; 'Test_Payload', multiple_consumers =&gt; TRUE ); DBMS_AQADM.create_queue( 'Dest_Q', 'Dest_MQT' ); DBMS_AQADM.start_queue( queue_name =&gt; 'Dest_Q' ); --- Add Subscriber and schedule propagation subscriber := SYS.aq$_agent( 'test_local_sub', 'Dest_Q', NULL ); DBMS_AQADM.add_subscriber( queue_name =&gt; 'Test_Q', subscriber =&gt; subscriber ); DBMS_AQADM.schedule_propagation( queue_name =&gt; 'Test_Q', destination_queue =&gt; 'Dest_Q' ); END; DECLARE enqueue_options DBMS_AQ.enqueue_options_t; message_properties DBMS_AQ.message_properties_t; message_handle RAW( 16 ); MESSAGE test_payload; BEGIN MESSAGE := test_payload( 2, SYSDATE ); DBMS_AQ.enqueue( queue_name =&gt; 'Test_Q', enqueue_options =&gt; enqueue_options, message_properties =&gt; message_properties, payload =&gt; MESSAGE, msgid =&gt; message_handle ); COMMIT; END; DECLARE dequeue_options DBMS_AQ.dequeue_options_t; message_properties DBMS_AQ.message_properties_t; message_handle RAW( 16 ); MESSAGE test_payload; BEGIN dequeue_options.navigation := DBMS_AQ.first_message; DBMS_AQ.dequeue( queue_name =&gt; 'Dest_Q', dequeue_options =&gt; dequeue_options, message_properties =&gt; message_properties, payload =&gt; MESSAGE, msgid =&gt; message_handle ); DBMS_OUTPUT.put_line( 'Test_ID: ' || MESSAGE.test_id ); DBMS_OUTPUT.put_line( 'Test_Date: ' || MESSAGE.test_dt ); COMMIT; END; </code></pre>
[ { "answer_id": 215092, "author": "TheSoftwareJedi", "author_id": 18941, "author_profile": "https://Stackoverflow.com/users/18941", "pm_score": 1, "selected": false, "text": "DBMS_AQADM.ENABLE_PROPAGATION_SCHEDULE(queue_name => 'Test_Q'); \n" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/213151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
213,153
<p>The general problem:</p> <p>We have urls coming to our IIS web servers formatted like: </p> <blockquote> <p><strong><a href="http://www.server.com/page.aspx" rel="nofollow noreferrer">http://www.server.com/page.aspx</a></strong></p> </blockquote> <p>We are also seeing that urls like this are coming in: </p> <blockquote> <p><strong><a href="http://www.server.com//page.aspx" rel="nofollow noreferrer">http://www.server.com//page.aspx</a></strong></p> </blockquote> <p>We would like to get rid of that extra path character because when the user agent is Internet Explorer, this is resolving as 2 different pages, and thus, downloading the content twice when it should be resolved from a cache.</p> <p>I am not sure if this is a problem to be solved with something like a url-rewriting module, or if there is a configuration setting.</p>
[ { "answer_id": 215092, "author": "TheSoftwareJedi", "author_id": 18941, "author_profile": "https://Stackoverflow.com/users/18941", "pm_score": 1, "selected": false, "text": "DBMS_AQADM.ENABLE_PROPAGATION_SCHEDULE(queue_name => 'Test_Q'); \n" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/213153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5619/" ]
213,167
<p>I'm looking at the code for a phase accumulator, and I must be a simpleton because I don't get it. The code is simple enough:</p> <pre> Every Clock Tick do: accum = accum + NCO_param; return accum; </pre> <p>accum is a 32-bit register. Obviously, at some point it will roll-over.</p> <p>My question really is: How does this relate to the phase?</p>
[ { "answer_id": 27747391, "author": "LifeInTheTrees", "author_id": 2040877, "author_profile": "https://Stackoverflow.com/users/2040877", "pm_score": 0, "selected": false, "text": " var accadd = 1.0/( sampleRate / p2freq( note ) ) ;\n acc+= accadd;\n acc = acc%1.0;// not sure to d...
2008/10/17
[ "https://Stackoverflow.com/questions/213167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10703/" ]
213,173
<p>I have a single image with 9 different states and the appropriate background-position rules set up as classes to show the different states. I can't use the :hover pseudo-selector because the background image being changed is not the same element that is being hovered over. I have defined the classes this way:</p> <pre><code>#chooser_nav {width:580px; height:38px; background:transparent url(/assets/images/chooser-tabs.jpg) 0 0 no-repeat; margin-left:34px;} #chooser_nav.feat {background-position:0 0;} #chooser_nav.inv {background-position:0 -114px;} #chooser_nav.bts {background-position:0 -228px;} #chooser_nav.featinv {background-position:0 -38px;} #chooser_nav.featbts {background-position:0 -76px;} #chooser_nav.invfeat {background-position:0 -152px;} #chooser_nav.invbts {background-position:0 -190px;} #chooser_nav.btsfeat {background-position:0 -266px;} #chooser_nav.btsinv {background-position:0 -304px;} </code></pre> <p>Then, using jQuery, I have a series of hover rules based on a previous click event (the here-undeclared "cur" variable is properly declared elsewhere):</p> <pre><code> $("#featured_races a").hover(function(){ cur == "feat" ? $("#chooser_nav").attr("class", cur) : $("#chooser_nav").attr("class", cur+"feat"); }, function(){ $("#chooser_nav").attr("class", cur); }); $("#invitational_races a").hover(function(){ cur == "inv" ? $("#chooser_nav").attr("class", cur) : $("#chooser_nav").attr("class", cur+"inv"); }, function(){ $("#chooser_nav").attr("class", cur); }); $("#behind_the_scenes a").hover(function(){ cur == "bts" ? $("#chooser_nav").attr("class", cur) : $("#chooser_nav").attr("class", cur+"bts"); }, function(){ $("#chooser_nav").attr("class", cur); }); </code></pre> <p>So, in Moz and WebKit browsers, this works fine. The classes are applied and the background image changes accordingly. Works in IE7 as well. However, in IE6, the background image never changes. The classes get applied appropriately, I verified this with the DOM viewer in MS's web dev tool. So, the jQuery is working. The class is getting applied, but no change is visibly occurring.</p> <p>I'm kinda stumped here... Help me, Crackoverflow... you're my only hope...</p> <p>EDIT: As far as className vs. setAttribute... the class is changing. attr("class", cur) is working. However, once the class is changed, the resulting rules are not applied visually... but the change of class is occurring.</p> <p>EDIT 2: As for jQuery's class-specific methods: I originally had them in the code, and the result was the same. Again, the problem is not with the class not getting applied to the element... this has been verified to be happening. it's that once the class is on the element, for some reason, the element is not following the CSS rules set for that class...</p>
[ { "answer_id": 213213, "author": "Kornel", "author_id": 27009, "author_profile": "https://Stackoverflow.com/users/27009", "pm_score": 0, "selected": false, "text": "className" }, { "answer_id": 215156, "author": "Borgar", "author_id": 27388, "author_profile": "https:/...
2008/10/17
[ "https://Stackoverflow.com/questions/213173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9414/" ]
213,181
<p>Umm, I guess my questions in the title:</p> <p>How do I turn on Option Strict / Infer in a VB.NET aspx page without a code behind file?</p> <pre><code>&lt;%@ Page Language="VB" %&gt; &lt;script runat="server"&gt; Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) End Sub &lt;/script&gt; </code></pre>
[ { "answer_id": 213190, "author": "IAmCodeMonkey", "author_id": 27613, "author_profile": "https://Stackoverflow.com/users/27613", "pm_score": 5, "selected": true, "text": "<%@ Page Language=\"VB\" Strict=\"true\" %>\n" }, { "answer_id": 213198, "author": "Mitchel Sellers", ...
2008/10/17
[ "https://Stackoverflow.com/questions/213181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26/" ]
213,192
<p>In my ideal world, what I'm looking for would exist as something along the lines of this:</p> <pre><code>public string UserDefinedField { get { return _userDefinedField; } internal set { _userDefinedField = value; } set { _userDefinedField = value; ChangedFields.Add(Fields.UserDefinedField); } } </code></pre> <p>Where one statement is executed regardless of the access modifier, and another statement is executed if it's called from an external assembly or class.</p> <p>I'm sure I could code something by using reflection and checking up the current call stack to see if the caller is in the same assembly, but I'm looking to see if there's a more elegant approach than that.</p>
[ { "answer_id": 213207, "author": "Isak Savo", "author_id": 8521, "author_profile": "https://Stackoverflow.com/users/8521", "pm_score": 3, "selected": true, "text": "public string UserDefinedField\n{\n get { return _userDefinedField; }\n set { SetField(value); ChangedFields.Add(Fiel...
2008/10/17
[ "https://Stackoverflow.com/questions/213192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13412/" ]
213,195
<p>When I try to login to this site using my yahoo openid, it takes me to the yahoo site, I click "continue" meaning that i <em>want</em> to send my authentication details to stackoverflow.com and stackoverflow.com gives me the following error underneath the login text field:</p> <p>Unable to log in with your OpenID provider:</p> <p>failed to authenticate, returning Failed. Please ensure your identifier is correct and try again. </p>
[ { "answer_id": 213207, "author": "Isak Savo", "author_id": 8521, "author_profile": "https://Stackoverflow.com/users/8521", "pm_score": 3, "selected": true, "text": "public string UserDefinedField\n{\n get { return _userDefinedField; }\n set { SetField(value); ChangedFields.Add(Fiel...
2008/10/17
[ "https://Stackoverflow.com/questions/213195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29049/" ]
213,214
<p>I'm in a 10 person team working on a large legacy code base with a less than ideal product owner. Our backlog is in pretty bad shape and large epics have frequently been breaking our sprints. The team also struggles with its definition of done - some members write unit test religiously, others don't, sometimes depending on time available.</p> <p>So, I've been seeing some interesting burndown patterns, and I'm wondering which patterns others are seeing and what they mean.</p> <p>Pattern 1:</p> <pre><code># # # # # # # # # # # # # # # # # # # # # # # # # # # # </code></pre> <ul> <li>Positive explanation: "All good."</li> <li>Negative explanation: "Too good to be true. What's <strong>really</strong> going on?"</li> </ul> <p>Pattern 2:</p> <pre><code># # # # # # # # # # # # # # # # # # # # # # </code></pre> <ul> <li>Positive explanation: "This was way easier than we thought, let's pull in more stories."</li> <li>Negative explanation: ??</li> </ul> <p>Pattern 3:</p> <pre><code># # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # </code></pre> <ul> <li>Positive explanation: "Not sure about this work at first, then turns out easier than we thought."</li> <li>Negative explanation: "Not enough progress, let's stop writing unit tests to get 'done' on time."</li> </ul>
[ { "answer_id": 213289, "author": "MojoFilter", "author_id": 93, "author_profile": "https://Stackoverflow.com/users/93", "pm_score": 3, "selected": true, "text": " # # #\n # # # #\n # # # # #\n # # # # # #\n# # # # # # #\n# # # # # # # #\n# # # # # # # #\n" }, { "ans...
2008/10/17
[ "https://Stackoverflow.com/questions/213214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13041/" ]
213,237
<p>In Django, given excerpts from an application <em>animals</em> likeso:</p> <p>A <em>animals/models.py</em> with: </p> <pre><code>from django.db import models from django.contrib.contenttypes.models import ContentType class Animal(models.Model): content_type = models.ForeignKey(ContentType,editable=False,null=True) name = models.CharField() class Dog(Animal): is_lucky = models.BooleanField() class Cat(Animal): lives_left = models.IntegerField() </code></pre> <p>And an <em>animals/urls.py</em>:</p> <pre><code>from django.conf.urls.default import * from animals.models import Animal, Dog, Cat dict = { 'model' : Animal } urlpatterns = ( url(r'^edit/(?P&lt;object_id&gt;\d+)$', 'create_update.update_object', dict), ) </code></pre> <p>How can one use generic views to edit Dog and/or Cat using the same form?</p> <p>I.e. The <em>form</em> object that is passed to <em>animals/animal_form.html</em> will be Animal, and thus won't contain any of the specifics for the derived classes Dog and Cat. How could I have Django automatically pass a form for the child class to <em>animal/animals_form.html</em>?</p> <p>Incidentally, I'm using <a href="http://www.djangosnippets.org/snippets/1031/" rel="nofollow noreferrer">Djangosnippets #1031</a> for ContentType management, so Animal would have a method named <em>as_leaf_class</em> that returns the derived class.</p> <p>Clearly, one could create forms for each derived class, but that's quite a lot of unnecessary duplication (as the templates will all be generic -- essentially {{ form.as_p }}).</p> <p>Incidentally, it's best to assume that Animal will probably be one of several unrelated base classes with the same problem, so an ideal solution would be generic.</p> <p>Thank you in advance for the help.</p>
[ { "answer_id": 213393, "author": "Javier", "author_id": 11649, "author_profile": "https://Stackoverflow.com/users/11649", "pm_score": 0, "selected": false, "text": "'create_update.update_object'" }, { "answer_id": 215488, "author": "Brian M. Hunt", "author_id": 19212, ...
2008/10/17
[ "https://Stackoverflow.com/questions/213237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19212/" ]
213,238
<p>Just playing around with the now released Silverlight 2.0. I'm trying to put a simple Calendar in a control. However the project doesn't seem to know what I'm talking about:-</p> <pre><code>&lt;UserControl x:Class="MyFirstSL2.Test" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" &gt; &lt;Grid Background="#FF5C7590"&gt; &lt;Calendar /&gt; &lt;/Grid&gt; &lt;/UserControl&gt; </code></pre> <p>Visual Studio 2008 just puts blue line under the Calendar saying the type Calendar not found. Do I need to add an assembly? Which one? Do I need to add another namespace to the Xaml?</p>
[ { "answer_id": 213592, "author": "Tim Heuer", "author_id": 705, "author_profile": "https://Stackoverflow.com/users/705", "pm_score": 5, "selected": true, "text": "xmlns:basics=\"clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls\"\n" } ]
2008/10/17
[ "https://Stackoverflow.com/questions/213238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17516/" ]
213,249
<p>I am wondering - What's the most effective way of parsing something like:</p> <pre><code>{{HEADER}} Hello my name is {{NAME}} {{#CONTENT}} This is the content ... {{#PERSONS}} &lt;p&gt;My name is {{NAME}}.&lt;/p&gt; {{/PERSONS}} {{/CONTENT}} {{FOOTER}} </code></pre> <p>Of course this is intended to be somewhat of a templating system in the end, so my plan is to create a hashmap to "lay over" the template, as something like this</p> <pre><code>$hash = array( 'HEADER' =&gt; 'This is a header', 'NAME' =&gt; 'David', 'CONTENT' =&gt; array('PERSONS' =&gt; array(array('NAME' =&gt; 'Heino'), array('NAME' =&gt; 'Sebastian')), 'FOOTER' =&gt; 'This is the footer' ); </code></pre> <p>It's worth noticing that the "sections" (the tags that start with #), can be repeated more than once, and i think this is what trips me up ...</p> <p>Also, any section can contain any number of other sections, and regular tags...</p> <p>So.. how'd you do it?</p>
[ { "answer_id": 213344, "author": "Troy Howard", "author_id": 19258, "author_profile": "https://Stackoverflow.com/users/19258", "pm_score": 2, "selected": true, "text": "This is the content ...\n\nMy name is Heino.\n\nMy name is Sebastian.\n" }, { "answer_id": 213589, "author"...
2008/10/17
[ "https://Stackoverflow.com/questions/213249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20538/" ]
213,251
<p>I've been reading that Adobe has made crossdomain.xml stricter in flash 9-10 and I'm wondering of someone can paste me a copy of one that they know works. Having some trouble finding a recent sample on Adobe's site.</p>
[ { "answer_id": 213272, "author": "Mitch Haile", "author_id": 28807, "author_profile": "https://Stackoverflow.com/users/28807", "pm_score": 8, "selected": true, "text": "<?xml version=\"1.0\" ?>\n<cross-domain-policy>\n<allow-access-from domain=\"*\" />\n</cross-domain-policy>\n" }, {...
2008/10/17
[ "https://Stackoverflow.com/questions/213251", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18309/" ]
213,256
<p>I am trying to debug a strange issue with users that have <a href="https://secure.logmein.com/home.asp" rel="nofollow noreferrer">LogMeIn</a> installed. After a few days, some of my dialogs that my app opens can end up offscreen. If I could reliable detect that, I could programmatically move the dialogs back where they are visible again.</p> <p>Note: this has to work for multiple monitors and use the win32 API. However, if you know how to do it from .NET I can probably extrapolate from there...</p> <p><strong>Update:</strong> For the curious, the bug mentioned above has to do with wxWidgets. If you run a wxWidgets application, then walk away and let your screen saver go, then log in remotely with LogMeIn, then try to open a dialog from your app, you will have trouble if you use wxDisplay::GetFromPoint(pos) or wxWindowBase::Center() to position the dialog.</p>
[ { "answer_id": 5454407, "author": "CAD bloke", "author_id": 492, "author_profile": "https://Stackoverflow.com/users/492", "pm_score": 1, "selected": false, "text": "if (!Screen.FromControl(this).Bounds.Contains(this.Location))\n {\n this.DesktopLocation = new Po...
2008/10/17
[ "https://Stackoverflow.com/questions/213256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21784/" ]
213,266
<p>How do I go about positioning a JDialog at the center of the screen?</p>
[ { "answer_id": 213291, "author": "johnstok", "author_id": 27929, "author_profile": "https://Stackoverflow.com/users/27929", "pm_score": 8, "selected": true, "text": "final JDialog d = new JDialog();\nd.setSize(200,200);\nd.setLocationRelativeTo(null);\nd.setVisible(true);\n" }, { ...
2008/10/17
[ "https://Stackoverflow.com/questions/213266", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
213,267
<p>I'm trying to pass one method to another in elisp, and then have that method execute it. Here is an example:</p> <pre><code>(defun t1 () "t1") (defun t2 () "t1") (defun call-t (t) ; how do I execute "t"? (t)) ; How do I pass in method reference? (call-t 't1) </code></pre>
[ { "answer_id": 213511, "author": "Timo Geusch", "author_id": 29068, "author_profile": "https://Stackoverflow.com/users/29068", "pm_score": 6, "selected": true, "text": "t" }, { "answer_id": 226770, "author": "Jouni K. Seppänen", "author_id": 26575, "author_profile": "...
2008/10/17
[ "https://Stackoverflow.com/questions/213267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9435/" ]
213,271
<p>window.scrollMaxY can be set via that property in IE and older versions of Firefox, but when trying in FF3 it says "Cannot set this property as it only has a getter".</p> <p>What is my alternative?</p> <p>EDIT:</p> <p>The reason why I'm asking is that I'm fixing some very horrible JS written by someone else, it has a function to keep a div centered on the page while scrolling, and has this line:</p> <pre><code>// Fixes Firefox incrementing page height while scrolling window.scrollMaxY = scrollMaxY </code></pre> <p>Obviously this doesn't work, but the main issue is that when the page is scrolled, it grows in length.</p>
[ { "answer_id": 213511, "author": "Timo Geusch", "author_id": 29068, "author_profile": "https://Stackoverflow.com/users/29068", "pm_score": 6, "selected": true, "text": "t" }, { "answer_id": 226770, "author": "Jouni K. Seppänen", "author_id": 26575, "author_profile": "...
2008/10/17
[ "https://Stackoverflow.com/questions/213271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
213,295
<p>I'm storing an ArrayList of Ids in a processing script that I want to spit out as a comma delimited list for output to the debug log. Is there a way I can get this easily without looping through things?</p> <p>EDIT: Thanks to Joel for pointing out the List(Of T) that is available in .net 2.0 and above. That makes things TONS easier if you have it available.</p>
[ { "answer_id": 213305, "author": "Dillie-O", "author_id": 71, "author_profile": "https://Stackoverflow.com/users/71", "pm_score": 8, "selected": true, "text": "String.Join(\",\", CType(TargetArrayList.ToArray(Type.GetType(\"System.String\")), String()))\n" }, { "answer_id": 21332...
2008/10/17
[ "https://Stackoverflow.com/questions/213295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/71/" ]
213,299
<p>I've implemented a .NET Web control that uses the callback structure implemented in ASP.Net 2.0. It's an autodropdown control, and it works correctly in IE 6.0/7.0 and Google Chrome. Here's the relevant callback function:</p> <pre><code>function ReceiveServerData(args, context) { document.getElementById(context).style.zIndex = 300; document.getElementById(context).style.visibility = 'visible'; document.getElementById(context).innerHTML = args; fixHover(context); } </code></pre> <p>In Firefox, "args" is always the same data, so the innerHTML of the <code>&lt;div&gt;</code> that is the display for my dropdown always shows the same items. I've doublechecked my client-side code, and the right information is being sent client->server and in return server-> client.</p> <p>Of note, in the "WebForm_DoCallback" function created by the .NET framework, the following snippet is getting called:</p> <pre><code>if (setRequestHeaderMethodExists) { xmlRequest.onreadystatechange = WebForm_CallbackComplete; callback.xmlRequest = xmlRequest; xmlRequest.open("POST", theForm.action, true); xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlRequest.send(postData); return; } </code></pre> <p>and the callback function ReceiveServerData is called both on <code>xmlRequest.open("POST", theForm.action, true);</code> and <code>xmlRequest.send(postData);</code>. I wonder if this is causing an error, but I'm at the end of my debugging skills.</p> <p>Edited to add -- ReceiveServerData is not being called twice the very first time I use the dropdown -- in fact, the dropdown works correctly for the very first keystroke. It stops working, and doubles the callback with old return data, after the first keystroke.</p>
[ { "answer_id": 220090, "author": "Atanas Korchev", "author_id": 10141, "author_profile": "https://Stackoverflow.com/users/10141", "pm_score": 0, "selected": false, "text": "function WebForm_CallbackComplete()\n{\n for(var i=0; i< __pendingCallbacks.length;i++)\n {\n var _f3=...
2008/10/17
[ "https://Stackoverflow.com/questions/213299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11947/" ]
213,303
<p>There are many tools out there for writing and managing requirements, but are there any good ones for reviewing them? </p> <p>I'm not talking about <strong><em>managing</em></strong> reviews, but automation tools that look for common requirement blunders (such as using negative requirements, or ones that are worded in a way that makes testing difficult).<br> More of a screening tool that someone writing requirements can use to screen their document before distributing to a group of reviewers so that the review process need not be slowed down by everyone commenting on the same easily recognizable issues.</p> <p>I'm curious if anyone's used anything like this in the past.</p>
[ { "answer_id": 213452, "author": "kenny", "author_id": 3225, "author_profile": "https://Stackoverflow.com/users/3225", "pm_score": 3, "selected": true, "text": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ReqCheck>\n <Categories name=\"Reconsider wording\">\n <Keyword>may</Keyword>\...
2008/10/17
[ "https://Stackoverflow.com/questions/213303", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2382102/" ]
213,309
<p>Is it possible to create, for instance, a box model hack while using in-line CSS?</p> <p>For example:</p> <p><code>&lt;div id="blah" style="padding: 5px; margin: 5px; width: 30px; /*IE5-6 Equivalent here*/"&gt;</code></p> <p>Thanks! </p>
[ { "answer_id": 213342, "author": "eyelidlessness", "author_id": 17964, "author_profile": "https://Stackoverflow.com/users/17964", "pm_score": 0, "selected": false, "text": "<div id=\"blah\" style=\"padding: 5px; margin: 5px; width: 30px; <!--[if lte IE 6]> ... <![endif]-->\">\n" }, {...
2008/10/17
[ "https://Stackoverflow.com/questions/213309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
213,312
<p>Can Ruby really be used as a functional language? What are some good tutorials to teach this facet of the language? Note: I really want to use and stick with Ruby as my primary language so I am not interested at this point in being converted to YAFL (yet another functional language). I am really interested in how well Ruby's functional facets perform against the standard functional language baseline. Thanks.</p>
[ { "answer_id": 213336, "author": "Daniel Spiewak", "author_id": 9815, "author_profile": "https://Stackoverflow.com/users/9815", "pm_score": 4, "selected": false, "text": "Object#freeze" }, { "answer_id": 214330, "author": "madlep", "author_id": 14160, "author_profile"...
2008/10/17
[ "https://Stackoverflow.com/questions/213312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20714/" ]
213,333
<p>I have a generic class in C# with 2 constructors:</p> <pre><code>public Houses(params T[] InitialiseElements) {} public Houses(int Num, T DefaultValue) {} </code></pre> <p>Constructing an object using int as the generic type and passing in two ints as arguments causes the 'incorrect' constructor to be called (from my point of view).</p> <p>E.g. <code>Houses&lt;int&gt; houses = new Houses&lt;int&gt;(1,2)</code> - calls the 2nd construtor. Passing in any other number of ints into the constructor will call the 1st constructor.</p> <p>Is there any way around this other than removing the params keyword and forcing users to pass an array of T when using the first constructor?</p>
[ { "answer_id": 213354, "author": "Jon B", "author_id": 27414, "author_profile": "https://Stackoverflow.com/users/27414", "pm_score": 2, "selected": false, "text": "public Houses(IEnumerable<T> InitialiseElements){}\n" }, { "answer_id": 213403, "author": "Jon Skeet", "auth...
2008/10/17
[ "https://Stackoverflow.com/questions/213333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29059/" ]