instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>When I try to test the AutoLotWCFService using "wcftestclient", I get the following error. What am I doing wrong? Any insight will help. This is a simple Web Service that has wshttpbinding with interface contract and the implementation in the service. Here is the long error message: The Web.Config file has 2 endpoin...
<p>I recently had this problem whilst trying to host WCF on my Windows Vista Laptop under IIS7.</p> <p>I first recieved the following error : "HTTP Error 404.3 - Not Found" and one of the resolutions suggested was to "Ensure that the expected handler for the current page is mapped."</p> <p>So I added a handler for th...
<p>you need to make sure that the service behaviour configuration enables has a metadata tag with httpGetEnabled="true"</p> <pre><code>&lt;serviceBehaviors> &lt;behavior name="serviceBehavior"> &lt;serviceMetadata httpGetEnabled="true"> &lt/behavior> &lt;/serviceBehaviors> </code></pre> <p>In addition, make s...
22,977
<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.HashPasswordForStoringInCo...
<pre><code>using System.Security.Cryptography; public static string EncodePasswordToBase64(string password) { byte[] bytes = Encoding.Unicode.GetBytes(password); byte[] inArray = HashAlgorithm.Create("SHA1").ComputeHash(bytes); return Convert.ToBase64String(inArray); } </code></pre>
<p>I think it should work. All you need to do is reference System.Web.Security in your code (and add it as a reference in your Visual Studio Project).</p>
26,151
<p>I have a <a href="http://en.wikipedia.org/wiki/Wii" rel="noreferrer">Nintendo Wii</a>, and I've got <a href="http://www.devkitpro.org/" rel="noreferrer">devkitpro</a> working to load some simple programs. The example source code that I've been able to find is very simplistic, such as drawing and rotating a simple s...
<p>I'm going to provide you with some nice links:</p> <ul> <li><strike><a href="http://www.wii-boss.symbiote.org/files/Programming%20your%20wii-boss.pdf" rel="nofollow noreferrer">Getting started</a></strike> (dead)</li> <li><strike><a href="http://swik.net/Wii+Programming" rel="nofollow noreferrer">Wii Programming</a...
<p>Some friends were programming a game using Wii with Flash. I don't how, though :(</p> <p>Have you checked this post here? <a href="https://stackoverflow.com/questions/29466/writing-a-game-for-the-nintendo-wii">Writing a game for the Nintendo Wii</a></p>
17,638
<p>I have some numbers of different length (like 1, 999, 76492, so on) and I want to convert them all to strings with a common length (for example, if the length is 6, then those strings will be: '000001', '000999', '076492'). </p> <p>In other words, I need to add correct amount of leading zeros to the number.</p> <p...
<p>or using the stringstreams:</p> <pre><code>#include &lt;sstream&gt; #include &lt;iomanip&gt; std::stringstream ss; ss &lt;&lt; std::setw(10) &lt;&lt; std::setfill('0') &lt;&lt; i; std::string s = ss.str(); </code></pre> <p>I compiled the information I found on <a href="http://www.arachnoid.com/cpptutor/student3.h...
<p>sprintf is the C-like way of doing this, which also works in C++.</p> <p>In C++, a combination of a stringstream and stream output formatting (see <a href="http://www.arachnoid.com/cpptutor/student3.html" rel="nofollow noreferrer">http://www.arachnoid.com/cpptutor/student3.html</a> ) will do the job.</p>
27,853
<p>I have a version number of the following form:</p> <p>version.release.modification</p> <p>where version, release and modification are either a set of digits or the '*' wildcard character. Additionally, any of these numbers (and any preceding .) may be missing.</p> <p>So the following are valid and parse as:</p> ...
<p>I'd express the format as:</p> <blockquote> <p>"1-3 dot-separated components, each numeric except that the last one may be *"</p> </blockquote> <p>As a regexp, that's: </p> <pre><code>^(\d+\.)?(\d+\.)?(\*|\d+)$ </code></pre> <p>[Edit to add: this solution is a concise way to validate, but it has been pointed o...
<p>I found this, and it works for me:</p> <pre><code>/(\^|\~?)(\d|x|\*)+\.(\d|x|\*)+\.(\d|x|\*)+ </code></pre>
10,777
<p>We have a Silverlight 2 project (game) that will require a lot of character animation. Can anyone suggest a good way to do this. Currently we plan to build the art in Illustrator, imported to Silverlight via Mike Snow's plug-in as this matches the skills our artists have.</p> <p>Is key framing the animations our ...
<p>You can use the Clip property on the image itself or on a container for the image to display a specific piece of a larger image, like a sprite sheet. This may or may not be more performant than swapping pngs. Also you could use the ImageBrush on a Rectangle to show just what you want, this would probably be a bit mo...
<p>Silverlight at this time does not support bitmap effects nor has any libraries to manipulate the images. Your option now is to use keyframe animations from one png to another.</p> <p>Now you can get at the raw bytes of an image. If you have your own image processing libraries you can compile them with the Silverl...
16,387
<p>A common pattern with STL containers is this:</p> <pre><code>map&lt;Key, Value&gt; map; for(map&lt;Key, Value&gt;::iterator iter = map.begin(); iter != map.end(); ++iter) { ... } </code></pre> <p>So in order to avoid writing the declaration of the template parameters we can do this somewhere:</p> <pre><code>typ...
<p>Not sure what you mean by "overhead". If it simplifies the way you write your code, use it, otherwise stick with the longhand.</p> <p>If it's only used in a restricted scope, put the typedef in that same scope. Then it doesn't need to be published, or documented, or appear on any UML diagrams. For example (and I do...
<p>If the typedef is local to a single function it doesn't even need to be a <em>nice</em> name. Use X or MAP, just like in a template.</p>
15,220
<p>I'm working on a team investigating a technology stack for a green-field systems integration project. Part of our favored technology stack use Hibernate to persist its internal state and exposes hooks into the Hibernate transactions, so that business entities stay synchronized with the state of this utility. Great, ...
<p>I am using RDF in my project and what we have done is use <a href="http://www.w3.org/2004/OWL/" rel="nofollow noreferrer">OWL</a> to define an ontology for the RDF data and give it some structure. From there we generate C# classes from the OWL ontology. The nice thing about this is that you can still add additional ...
<p>One solution is to keep the object model at the RDF triplestore level, for example by having classes for</p> <ul> <li>nodes: uris, blanks and literals</li> <li>statements: collections of three or more nodes (three for the RDF triple, additional node(s) for meta)</li> </ul> <p>Running queries on such a storage is e...
28,635
<p>I have a coworker who is looking to switch from InteilliJ Idea to Eclipse, and is concerned about not knowing the Eclipse set of commands. </p> <p>I was wondering - would anyone have a link to keyboard mappings that can set Eclipse commands to at least sort of match Idea? </p> <p>Have you made this switch? Any "go...
<p>If he definitely want to do this:</p> <p><a href="http://www.jroller.com/ervines/resource/eclipse-intellij-key-bindings.java" rel="nofollow noreferrer">http://www.jroller.com/ervines/resource/eclipse-intellij-key-bindings.java</a></p>
<p>I could list a bunch of tips, gotchas, etc. because I've made the switch several times. I've tried to make the switch to Eclipse several times but couldn't do it and went back to IntelliJ. </p> <p>First tip:<br> Intellj "project" -> Eclipse "workspace" Intellij "module" -> Eclipse "project"</p> <p>Second tip: Ec...
20,215
<p>What is the difference between TrueType fonts and Type-1 fonts?</p>
<p>The Postscript Type-1 specification was created by Adobe back in 1985 or so. Type-1 fonts are vector based. You can find the specification in "<a href="https://www-cdf.fnal.gov/offline/PostScript/T1_SPEC.PDF" rel="nofollow noreferrer">Adobe Type 1. Font Format.</a>".</p> <p>TrueType fonts were defined by Apple a co...
<p>Type-1 is the older format, and dates back to the days when Adobe where pioneering DTP with PostScript and vector fonts. At the time Type 1 and Type 3 were the only formats understood by PostScript printers, and only Type 1 could include hints needed to make fonts look good, and the format was a trade secret. This w...
10,902
<p>I'm working on some code that uses a pattern in its business and data tiers that uses events to signal errors e.g. </p> <pre><code>resource = AllocateLotsOfMemory(); if (SomeCondition()) { OnOddError(new OddErrorEventArgs(resource.StatusProperty)); resource.FreeLotsOfMemory(); return; } </code><...
<p>It seems odd to me too. There are a few advantages - such as allowing multiple "handlers" but the semantics are significantly different to normal error handling. In particular, the fact that it doesn't automatically get propagated up the stack concerns me - unless the error handlers themselves throw an exception, th...
<p>We have a base Error object and ErrorEvent that we use with the command pattern in our framework to handle non-critical errors (e.g. validation errors). Like exceptions, people can listen for the base ErrorEvent or a more specific ErrorEvent. </p> <p>Also there's a significant difference between your two snippets.<...
17,941
<p>are there any free Team Foundation Server sites we can use for our <em>private</em> development? Please don't say CodePlex (which I love) because that means the code is all opensource.</p> <p>Lastly, I also understand that some people might raise the issue of having their private code hosted somewhere by people the...
<p>Microsoft are currently providing their next generation cloud hosted TFS service at <a href="http://tfspreview.com" rel="noreferrer">tfs.visualstudiow.com</a> - private repositories are free for up to 5 users but they have indicated that they will be charging for the service when you in the future when you have more...
<p>We're running a pilot program on our TFS Hosting services, so for a short period of time it's free. After that we'll have the best prices on the full TFS suite.</p> <p><a href="http://www.tfsserver.com" rel="nofollow">http://www.tfsserver.com</a></p>
34,911
<p>I need to perform a filtered query from within a django template, to get a set of objects equivalent to python code within a view:</p> <pre><code>queryset = Modelclass.objects.filter(somekey=foo) </code></pre> <p>In my template I would like to do</p> <pre><code>{% for object in data.somekey_set.FILTER %} </code><...
<p>You can't do this, which is by design. The Django framework authors intended a strict separation of presentation code from data logic. Filtering models is data logic, and outputting HTML is presentation logic.</p> <p>So you have several options. The easiest is to do the filtering, then pass the result to <code>r...
<p>This is my approach:</p> <pre><code>@register.filter() def query_filter(value, attr): return value.filter(**eval(attr)) </code></pre> <p>In the template:</p> <pre><code>{{ queryset|query_filter:'{&quot;cod_tipoinmueble&quot;:1,&quot;des_operacion&quot;: &quot;alquiler&quot;}'|length }} </code></pre>
27,667
<p>I've got a DataSet in VisualStudio 2005. I need to change the datatype of a column in one of the datatables from <code>System.Int32</code> to <code>System.Decimal</code>. When I try to change the datatype in the <code>DataSet Designer</code> I receive the following error:</p> <blockquote> <p>Property value is n...
<p>I get the same error but only for columns with its <code>DefaultValue</code> set to any value (except the default <code>&lt;DBNull&gt;</code>). So the way I got around this issue was:</p> <ol> <li>Column DefaultValue : Type in <code>&lt;DBNull&gt;</code></li> <li>Save and reopen the dataset</li> </ol>
<ul> <li>Close the DataSet in the visual designer</li> <li>Right click the dataset, choose <code>Open With...</code></li> <li>Choose <code>XML (Text) Editor</code></li> <li>Find the column in the XML, in your dataset it will look something like:</li> </ul> <pre><code>&lt;xs:element name="DataColumn1" msprop:Generato...
6,943
<p>In a web-based application that uses the Model-View-Controller design pattern, the logic relating to processing form submissions seems to belong somewhere in between the Model layer and the Controller layer. This is especially true in the case of a complex form (i.e. where form processing goes well beyond simple CRU...
<p>I'd say this should probably be seen as 2 separate actions...</p> <ol> <li>submitting the form (V -> C)</li> <li>processing the submission (C -> M)</li> </ol> <p>Speaking in generics, I tend to think as each action as a message between the sections. The full series of messages would be something like this...</p> ...
<p>Form processing should take place in the model, because that's the layer of the application that is receiving and processing data from controllers by the way of views. The controller moves it around, but as for the actual code execution, it should be happening in your models.</p>
44,871
<p>I'm using Visual C++ 2003 to debug a program remotely via TCP/IP.</p> <p>I had set the Win32 exception c00000005, "Access violation," to break into the debugger when thrown. Then, I set it back to "Use parent setting." The setting for the parent, Win32 Exceptions, is to continue when the exception is thrown.</p> <...
<p>I'd like to support <a href="https://stackoverflow.com/questions/8263/i-cant-get-my-debugger-to-stop-breaking-on-first-chance-exceptions#8304">Will Dean's answer</a></p> <p>An access violation sounds like an actual bug in your code. It's not something I'd expect the underlying C/++ Runtime to be throwing and catchi...
<p><kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>E</kbd> (or Debug\Exceptions)</p> <p>From there you can select which exceptions break.</p>
2,972
<p>Ok, I'm not great in mysql, but I know an index would help me out here, however I've done some plugging and can't find one to help...</p> <p>Anyone got any ideas?</p> <pre><code> explain select `users_usr`.`id_usr` AS `id_usr`, `users_usr`.`firstname_usr` AS `firstname_usr`, `users_usr`.`lastname_usr` AS `last...
<p>There are calls on classes derived from <code>Control</code> for this purpose. They are <code>SuspendLayout</code> and <code>PerformLayout</code>. As they are on <code>Control</code> and <code>Form</code> is derived from <code>Control</code>, your <code>Form</code> has them too.</p> <p>These calls suffice for most ...
<p>The behavior you're describing is not normal for a .NET winforms application. The fact that you're using WndProc and sending messages in your example suggests that there is a lot of other unusual stuff going on with this form (I'm guessing there's more than one thread involved). Another possibility that is common ...
45,688
<p>What is the "canonical" way to access the MessageContext from a PayloadEndpoint?</p> <p>We are using <a href="http://static.springframework.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/server/endpoint/PayloadEndpoint.html" rel="nofollow noreferrer">PayloadEndpoint</a> and <a href="http://static.springfram...
<p>Easiest way I can think of: create a 'wrapper' endpoint which implements <a href="http://static.springframework.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/server/endpoint/MessageEndpoint.html" rel="nofollow noreferrer">MessageEndpoint</a>. Then you can extract your request parameters and pass them down t...
<p>Someone on the Spring forum <a href="http://forum.springframework.org/showthread.php?t=62388" rel="nofollow noreferrer">suggested</a> to use the <a href="http://static.springframework.org/spring-ws/sites/1.5/reference/html/common.html#transport-context" rel="nofollow noreferrer">TransportContext</a> to access the HT...
27,809
<p>I have been asked to setup a course leaflet system for a college. For whatever reason in the past their current system is not linked to their actual course file, they wish to close this link so course leaflets are related to actual course codes. Unfortunately their course file is a ms access database linked to many ...
<p>Just how often does the course file change? Fifty times a day? Once a month?</p> <p>What about creating the appropriate tables in the SQL Server database? Then every so often (as often as necessary to stay reasonably current), clear those tables out and repopulate them from the Access database. You could set th...
<p>Why do you need the Access file to the SQL server to create a Linked Server? Just put it on a network share with appropriate security and create your linked server like that.</p>
26,297
<p>In my javascript experience, I found that is a very common task "searching the nearest ancestor of an element with some condition (tag name, class,...)". Can the parents() method of jquery do the job? The order of returned elements of parents() is predictable? Is top-to-bottom or bottom-to-top? For the moment I us...
<p><strong>Edit</strong>: Since jQuery 1.3, this has been built in as the <a href="http://api.jquery.com/closest" rel="noreferrer"><code>closest()</code></a> function. eg: <code>$('#foo').closest('.bar');</code></p> <hr> <p>yep - parents() traverses up the tree.</p> <pre><code>&lt;div id="a"&gt; &lt;div id="b"&g...
<p>You should use <code>closest</code>, because <code>parents</code> won't give you the result you expect if you're working with multiple elements. For instance, let's say you have this:</p> <pre><code> &lt;div id="0"&gt; &lt;div id="1"&gt;test with &lt;b&gt;nested&lt;/b&gt; divs.&lt;/div&gt; &lt;di...
24,577
<p>After an upgrade to XP and Java 1.6 one of our intranet apps is experiencing a problem when running a java applet in the browser. The java applet is a document editor and accepts a parameter to where the document is located. I assume it copies this file to the users machine for editing. I wish I knew more but I don'...
<p>I worked out the problem. Turn off temporary files in the java control panel.</p>
<p>You say you went from Java v1.3 directly to Java 1.6, have you had a chance to test it at all with Java 1.4 or 1.5? A bit more contextual information would be helpful here.</p>
47,195
<p>I try to find something similar to nokia's <strong>python for windows mobile</strong> based devices - a script interpreter [in this case also able to create standalone apps] with easy access to all phone interfaces - ability to make a phone call, send SMS, make a photo, send a file over GPRS, etc...</p> <p>While th...
<p>It sounds as if this is an opportunity for you to develop some C extension modules for the PythonCE project.</p>
<p>Well there is <a href="http://www.sto-helit.de/index.php?module=download&amp;action=list&amp;category=18" rel="nofollow noreferrer">Mortscript</a>. a widely used scripting for Windows Mobile. Not sure if it can access all the phones functions. I believe there is <a href="http://www.kocjan.org/tclmentor/1-tcl/17-tcl-...
31,329
<p>I want to debug a windows C++ application I've written to see why it isn't responding to WM_QUERYENDSESSION how I expect it to. Clearly it's a little tricky to do this by just shutting the system down. Is there any utility or code which I can use to send a fake WM_QUERYENDSESSION to my application windows myself?</p...
<p>I've used the <a href="http://winguitest.sourceforge.net" rel="nofollow noreferrer">Win32::GuiTest</a> Perl module to do this kind of thing in the past.</p>
<p>Yes. If you can get the window handle (maybe using FindWindow()), you can send/post any message to it as long as the WPARAM &amp; LPARAM aren't pointers.</p>
10,274
<p>Does anyone have a good recommendation for a drop shadow jQuery plugin?</p> <p>I've been working on a project that had every element on the page with a subtle drop shadow, we started using <a href="http://www.ruzee.com/blog/shadedborder/" rel="noreferrer">RUZEE</a> to do the shadows but there was a severe performan...
<p>The original site hosting the jQuery Dropshadow plugin has apparently gone down.</p> <p>For anyone looking for it, <a href="http://dl.dropbox.com/u/1546882/jquery.dropshadow.js" rel="nofollow noreferrer">I'm currently hosting it on my Dropbox account</a>.</p>
<p><a href="http://docs.jquery.com/UI/Shadow" rel="nofollow noreferrer">jQuery UI</a> also provides drop shadow functionality.</p>
19,986
<p>Im trying to get into some basic JavaFX game development and I'm getting confused with some circle maths.</p> <p>I have a circle at (x:250, y:250) with a radius of 50.</p> <p>My objective is to make a smaller circle to be placed on the circumference of the above circle based on the position of the mouse.</p> <p>W...
<p><code>atan(height/length)</code> is not enough to get the angle. You need to compensate for each quadrant, as well as the possibility of "division-by-zero". Most programming language libraries supply a method called <code>atan2</code> which take two arguments; <code>y</code> and <code>x</code>. This method does this...
<p>There's a <a href="https://rads.stackoverflow.com/amzn/click/com/0122861663" rel="nofollow noreferrer" rel="nofollow noreferrer">great book called "Graphics Gems"</a> that can help with this kind of problem. It is a cookbook of algorithms and source code (in C I think), and allows you to quickly solve a problem usi...
33,563
<p>I know that it is possible to check how much physical RAM is installed using <code>GetPhysicallyInstalledSystemMemory</code> or how much ram the operating system can see using <code>GlobalMemoryStatusEx</code>. However, I am wondering if there is any way to check how much ram a user has installed by slot. That is,...
<p>Use WMI to look at Win32_PhysicalMemory. Look at the Capacity and Bank Label properties.</p> <p>UPDATED: You do not need .NET for this. See <a href="http://msdn.microsoft.com/en-us/library/aa389762(VS.85).aspx" rel="nofollow noreferrer">Creating a WMI Application Using C++</a> for examples in C++</p>
<p>On Linux, I can almost always find that information with dmidecode, which parses the DMI tables from the BIOS. It shows all the memory slots and what is on each one, together with other interesting information. I don't know how to get the DMI data on Windows, however.</p>
28,161
<p>I would like to provide downloadable files to website users, but want to hide the URL of the files from the user... I'm thinking an HTTPHandler could do the trick, but is it possible to retrieve a file from an external server and stream it to the user?</p> <p>Perhaps somebody can give me a hint at how to accomplish...
<p>With your clarification of wanting the bandwidth to come from the external server and not yours, it changes the question quite a bit.</p> <p>In order to accomplish that, the external server would have to have a website on it you could send the user to. You cannot stream the file through your site but not get hit wi...
<p>I've done this before. First, and obviously, the files have to be in a share on the external server that the user process of the website has access to.</p> <p>As far as the HTTPHandler goes, I handled this by giving the users zip files containing the files they want to download; this way my handler could intercept ...
19,421
<p>How can I use HttpWebRequest (.NET, C#) asynchronously?</p>
<p>Use <a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.begingetresponse.aspx" rel="noreferrer"><code>HttpWebRequest.BeginGetResponse()</code></a></p> <pre><code>HttpWebRequest webRequest; void StartWebRequest() { webRequest.BeginGetResponse(new AsyncCallback(FinishWebRequest), null); } ...
<p>I've been using this for async UWR, hopefully it helps someone</p> <pre><code> string uri = &quot;http://some.place.online&quot;; using (UnityWebRequest uwr = UnityWebRequest.Get(uri)) { var asyncOp = uwr.SendWebRequest(); while (asyncOp.isDone == false) await Task.Delay(1000 / 30); // 30...
24,761
<p>I just started learning JSP technology, and came across a wall.</p> <p><em>How do you output HTML from a method in &lt;%! ... %> JSP declaration block?</em></p> <p>This doesn't work:</p> <pre><code>&lt;%! void someOutput() { out.println("Some Output"); } %&gt; ... &lt;% someOutput(); %&gt; </code></pre> <p>...
<p>You can't use the 'out' variable (nor any of the other "predeclared" scriptlet variables) inside directives.</p> <p>The JSP page gets translated by your webserver into a Java servlet. Inside tomcats, for instance, everything inside scriptlets (which start "&lt;%"), along with all the static HTML, gets translated in...
<p>You can do something like this: <br></p> <pre><code>&lt;% out.print("&lt;p&gt;Hey!&lt;/p&gt;"); out.print("&lt;p&gt;How are you?&lt;/p&gt;"); %&gt; </code></pre>
16,822
<p>Is there a way to create a function/sub signature that accepts an arbitrary typed generic in vb.net.</p>
<p>Its like this:</p> <pre><code>Public Function DoThing(Of T)(ByVal value As T) </code></pre>
<p>You can read about generic types in Visual Basic here <a href="http://msdn.microsoft.com/en-us/library/w256ka79.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/w256ka79.aspx</a></p>
36,475
<p>I've got a wxGrid that I populate dynamically. I'd like to store some information with each row that shouldn't be displayed to the user. What is the best way to associate data with a row? Should I just create a hidden column or is there a better way?</p>
<p>Creating a hidden column is the fastest, but indeed a very ugly method. If you can justify the effort, then you should better create your own grid table base class. Your own <em>wxGridTableBase</em>-derived class can hold any information you need it to, without the need to show it in the grid. Unfortunately the docu...
<p>Store the value in the row label using SetRowLabelValue and hide the row labels.</p>
35,276
<p>I am using Ruby on Rails.</p> <p>I want to create a filter field on a page such that whenever the input field's value changes I filter a list shown below via ajax. (Exaclty like the Users search works in Stackoverflow)</p> <p>For now, I made it run with a form_remote_tag containing a text_field_tag and a submit_ta...
<p>Use <strong>observe_field</strong> helper with a single input, like the code bellow:</p> <pre><code>&lt;%= text_field_tag 'filter' %&gt; &lt;%= observe_field 'filter', :url =&gt; {:controller =&gt; 'your_controller', :action =&gt; 'filter'}, :frequency =&gt; 1.2, :update =&gt; 'results', :with =&gt...
<p>In general for text inputs you want to use onkeypress, onkeyup, onkeydown events, not onchange for this type of autocomplete. @Ricardo Acras solution is far better than writing your own, but I thought you might want to know that onchange doesn't work because it doesn't fire until you navigate out of the text input ...
29,292
<p>I would like to use a language that I am familiar with - Java, C#, Ruby, PHP, C/C++, although examples in any language or pseudocode are more than welcome.</p> <p>What is the best way of splitting a large XML document into smaller sections that are still valid XML? For my purposes, I need to split them into roughly...
<p>Well of course you can always extract the top-level elements (whether this is the granularity you want is up to you). In C#, you'd use the XmlDocument class. For example, if your XML file looked something like this:</p> <pre><code>&lt;Document&gt; &lt;Piece&gt; Some text &lt;/Piece&gt; &lt;Piece&gt; ...
<p>It looks like you're working with C# and .NET 3.5. I have come across some posts that suggest using a yield type of algorithm on a file stream with an XmlReader.</p> <p>Here's a couple blog posts to get you started down the path:</p> <ul> <li><a href="http://blogs.msdn.com/xmlteam/archive/2007/03/05/streaming-wit...
2,939
<p>How do you generate a random number within a range while excluding certain range(s). Eg. range 1-10 but not in 2-4 or 7. Solutions I've used so far:</p> <ul> <li>Generate a random an test if it is within the dis-allowed range. Based on result either output the number or try again.</li> <li>Map allowed ranges to a u...
<p><strong>(b) Use the single range and map to allowed values.</strong></p> <p>(a) Is slower and running time is non-deterministic because you have to wait until you get a number in the right range. If you were to skip a large range, you'd be hosed.</p> <p>(c) Is more complex than (b); don't add complexity if it isn...
<p>It sounds like your algorithm can benefit from a slight redesign that will make creating the random numbers implicit rather than explicitly finding them using a random number generator. </p> <p>For instance if you want to get a random series of the numbers from 1 to 10, its better to start from an ordered series, ...
23,811
<p>I'm fairly new to unit testing. I have a site built in the 3-tier architecture, UI -> BLL -> DAL. And I used the asp.net Provider Model, so by making changes to web.config I can switch to DAL dll to target different data sources, to be complete the DAL is written with Entity Framework.</p> <p>Now, my question is ...
<p>Looks like what you are trying to do - is integration testing... Unit testing, by definition, testing Plain Old .Net Classes in isolation. No database, no configuration...so...as I see it, to do proper unit testing, you need to refactor your BLL to service layer and domain logic classes which you will test separatel...
<p>You have a couple of different options depending on how isolated you want to be from the DAL. If you want to involve the DAL in your tests, then you can copy the connection string section of the app.config file to an app.config file in your unit test project. As @badbadboy says, though, this really is integration ...
38,552
<p>I'm using Eclipse as my IDE for a C++ project, and I would love for it to tell me where a given symbol is defined and what the parameters are for a function.</p> <p>However, there's a catch: I also use <a href="http://www.lazycplusplus.com/" rel="nofollow noreferrer">Lazy C++</a>, a tool that takes a single source ...
<p>I'd imagine its one of:</p> <ul> <li><p>Eclipse doesn't want to display non-C++ resources in the tree (I've had problems with this)</p></li> <li><p>You don't have "Preferences > C/C++ > Indexer > Index All Files" enabled.</p></li> <li><p>You want to use the "Full C/C++ Indexer" rather than the "Fast C/C++ Indexer"<...
<p>The CDT parser/indexer won't recognize weird extensions like that. The only thing you can do is to define macros on the Paths and Symbols property page to trick the parser. Try creating macros for <code>$hdr</code>, <code>$end</code> and <code>$src</code> that have empty bodies. That way the preprocessor will remove...
8,294
<p>The code below gives me this mysterious error, and i cannot fathom it. I am new to regular expressions and so am consequently stumped. The regular expression should be validating any international phone number.</p> <p>Any help would be much appreciated.</p> <pre><code>function validate_phone($phone) { $phonere...
<p>If this is PHP, then the regex must be enclosed in quotes. <del>Furthermore, what's <code>preg</code>? Did you mean <code>preg_match</code>?</del></p> <p>Another thing. PHP knows boolean values. The canonical solution would rather look like this:</p> <pre><code>return preg_match($regex, $phone) !== 0; </code></pre...
<p>Just to provide some reference material please read</p> <ul> <li><a href="http://de.php.net/manual/en/book.pcre.php" rel="nofollow noreferrer">Regular Expressions (Perl-Compatible)</a></li> <li><a href="http://de.php.net/manual/en/function.preg-match.php" rel="nofollow noreferrer">preg_match()</a></li> </ul> <p>or...
28,356
<p>I'm writing an app which for various reasons involves Internet Explorer (IE7, for the record), ActiveX controls, and a heroic amount of JavaScript, which is spread across multiple .js includes. </p> <p>One of our remote testers is experiencing an error message and IE's error message says something to the effect of:...
<p>In short. Not really. Try finding the error in FF first, and if that fails, you can get an almost as good debugger with <a href="http://www.berniecode.com/blog/2007/03/08/how-to-debug-javascript-with-visual-web-developer-express/" rel="nofollow noreferrer">Visual Web Developer</a>. Debugging IE just sucks for the ...
<p>I use <a href="http://projects.nikhilk.net/WebDevHelper/" rel="nofollow noreferrer">Web Development Helper</a></p>
21,592
<p>I would like to have information about the icons which are displayed alongside the site URLs on a web browser. Is this some browser specific feature? Where do we specify the icon source, ie, is it in some tag on the web page itself ?</p>
<p>These icons are called <a href="http://en.wikipedia.org/wiki/Favicon" rel="noreferrer">favicons</a></p> <p>Most web browsers support <a href="http://mysite.com/favicon.ico" rel="noreferrer">http://mysite.com/favicon.ico</a> but the proper way to do it is to include an icon meta tag in the head profile.</p> <pre><c...
<p>It was originally a windows icon format file, stored under the URL <a href="http://site/favicon.ico" rel="nofollow noreferrer">http://site/favicon.ico</a>. Most sites still use favicon.ico, and many browsers still automatically look there, regardless of the meta tags.</p>
14,643
<p>I need to create an ODBC link from an Access 2003 (Jet) database to a SQL Server hosted view which contains aliased field names containing periods such as:</p> <pre><code>Seq.Group </code></pre> <p>In the SQL source behind the view, the field names are encased in square brackets...</p> <pre><code>SELECT Table._Gr...
<p>Although I didn't technically end up escaping the dot, your suggestion actually <em>did</em> make me realize another alternative. While wondering how I would "pass" the escape code to the "SQL" server, it dawned on me: Why not use a "SQL Pass-Through Query" instead of an ODBC linked table? Since I only need read ...
<p>Another proposal would be to add a new view on your sql server, not modifying the existing one. Even if your initial view is part of a "solution", nothing forbids you of adding new views:</p> <pre><code>SELECT Table._Group AS [Seq_Group] </code></pre>
19,399
<p><a href="https://photos.app.goo.gl/O6yPf3sDeV1yhS0C2" rel="nofollow noreferrer">https://photos.app.goo.gl/O6yPf3sDeV1yhS0C2</a></p> <p>I tried to illustrate my problem in the videos above, two of them show the weird movement and the other shows me clicking on the home button repeatedly.</p> <p>Some Info:</p> <ul>...
<p>As far as I can see on the attached videos your homing movement is reversed. as per Marlin, the homing for X shall move towards the left side and for Y to the back of the printer.</p> <p>That could occur when: cable connectors to stepper motors are reversed, or the motor is assembled the other way (you can set reve...
<p>The problem was the logic of the endstops that were reversed</p>
859
<p>Warning - I am very new to NHibernate. I know this question seems simple - and I'm sure there's a simple answer, but I've been spinning my wheels for some time on this one. I am dealing with a legacy db which really can't be altered structurally. I have a details table which lists payment plans that have been accept...
<p>I'd steer away from having child object containing their logical parent, it can get very messy and very recursive pretty quickly when you do that. I'd take a look at how you're intending to use the domain model before you do that sort of thing. You can easily still have the ID references in the tables and just lea...
<p>The approach I'd take to model this is as follows:</p> <p>Customer object contains an ICollection &lt;PaymentPlan&gt; PaymentPlans which represent the plans that customer has accepted.</p> <p>The PaymentPlan to the Customer would be mapped using a bag which uses the details table to establish which customer id's m...
3,211
<p>How to change text encoded in ANSEL to UTF-8 in C#?</p>
<p>This is a non-trivial conversion as Windows/.NET Framework does not have an ANSEL codepage. See <a href="http://www.heiner-eichmann.de/gedcom/charintr.htm" rel="nofollow noreferrer">here</a> for the travails of another person attempting this conversion.</p>
<p>Joshperry is correct. Eichmann's site has basically the ONLY documentation around that attempts to explain ANSEL encoding. Unfortunately there is no program code there, so you'll have to code it yourself.</p> <p>There is another code table (dated Dec 2007 - I didn't know anyone was still interested) for ANSEL at: <...
46,972
<p>I'm getting a <code>NoSuchMethodError</code> error when running my Java program. What's wrong and how do I fix it?</p>
<p>Without any more information it is difficult to pinpoint the problem, but the root cause is that you most likely have compiled a class against a different version of the class that is missing a method, than the one you are using when running it.</p> <p>Look at the stack trace ... If the exception appears when calli...
<p>If your file name is different than the class name which contain main method then it may be the possibility that this error may cause.</p>
5,562
<p>Is there any efficiency difference in an explicit vs implicit inner join? For example:</p> <pre><code>SELECT * FROM table a INNER JOIN table b ON a.id = b.id; </code></pre> <p>vs.</p> <pre><code>SELECT a.*, b.* FROM table a, table b WHERE a.id = b.id; </code></pre>
<p>Performance wise, they are exactly the same (at least in SQL Server).</p> <p>PS: Be aware that the <code>IMPLICIT OUTER JOIN</code> syntax is deprecated since SQL Server 2005. (The <code>IMPLICIT INNER JOIN</code> syntax as used in the question is still supported)</p> <p><a href="https://learn.microsoft.com/en-us/...
<p>In my experience, using the cross-join-with-a-where-clause syntax often produces a brain damaged execution plan, especially if you are using a Microsoft SQL product. The way that SQL Server attempts to estimate table row counts, for instance, is savagely horrible. Using the inner join syntax gives you some control...
6,670
<p>When I want an array of flags it has typically pained me to use an entire byte (or word) to store each one, as would be the result if I made an array of <code>bool</code>s or some other numeric type that could be set to 0 or 1. But now I wonder whether using a structure that is more space-efficient is worth it given...
<p>It's mostly about saving memory. If your array of bools is large enough that a 8x improvement on storage space is meaningful, then by all means, use a bitarray.</p> <p>Note that the memory access is pretty expensive compared to the shift/and, so the bitarray approach is slightly faster than the array-of-chars. Ba...
<p>Is it worth it? Only if you know that you have a problem with memory usage.</p> <p>But unless you're either:</p> <ol> <li>Working on an embedded processor with <em>very</em> limited resources, or</li> <li>Storing an astronomical number of <code>bool</code>s</li> </ol> <p>then the answer is no. You'll have to work...
21,308
<p>Does Microsoft force an update down to all of its users of windows-update? Is it for legal reasons?</p> <p>EDIT(aku): </p> <p>Question was reformulated. if you want to know which version of Windows comes with .NET see this topic:</p> <p><a href="https://stackoverflow.com/questions/71390/which-operating-systems-...
<p>Yes, Windows Vista shipped with .NET Framework 3.0. I'm sure future versions of Windows will ship with whichever is the most recent version of the framework.</p> <p>Scott Hanselman recently blogged about the status of .NET 3.5 on Windows Update:</p> <p><a href="http://www.hanselman.com/blog/UpdateOnNETFramework35S...
<p>Some XP OEM installations have some version of .NET installed as it is needed from some included software. Vista comes with .NET 3.0 installed.</p>
18,289
<p>I had to delete all the rows from a log table that contained about 5 million rows. My initial try was to issue the following command in query analyzer:</p> <p>delete from client_log</p> <p>which took a very long time.</p>
<p>Check out <a href="https://msdn.microsoft.com/en-us/library/ms177570.aspx" rel="noreferrer">truncate table</a> which is a lot faster.</p>
<pre><code>DELETE * FROM table_name; </code></pre> <p>Premature optimization may be dangerous. Optimizing may mean doing something weird, but if it works you may want to take advantage of it.</p> <pre><code>SELECT DbVendor_SuperFastDeleteAllFunction(tablename, BOZO_BIT) FROM dummy; </code></pre> <p>For speed I thin...
8,960
<p>I need to read from Outlook .MSG file in .NET <em>without</em> using COM API for Outlook (cos it will not be installed on the machines that my app will run). Are there any free 3rd party libraries to do that? I want to extract From, To, CC and BCC fields. Sent/Receive date fields would be good if they are also store...
<p><strong>Update:</strong> I have found a 3rd party COM library called <a href="http://www.dimastr.com/redemption/" rel="noreferrer">Outlook Redemption</a> which is working fine for me at the moment. If you use it via COM-Interop in .NET, don't forget to release every COM object after you are done with it, otherwise y...
<p>If you open the .MSG file in a text editor, i believe you will find that the information you are after is stored as plain text inside the file. (It is on all the messages i have checked at least)</p> <p>It would be pretty easy to write some code to parse the file looking for lines beginning with "From:" or "To:" et...
3,669
<p>Are there Windows API functions that allows reading what the current password policy is? For instance, minimum length, complexity etc.</p> <p>If not reading, is there a way to verify a password against the policy programmatically?</p>
<p>See <a href="http://technet.microsoft.com/en-us/magazine/cc137749.aspx" rel="nofollow noreferrer">Security Watch Windows Domain Password Policies</a>. You can hit AD using <a href="http://msdn.microsoft.com/en-us/library/aa772170.aspx" rel="nofollow noreferrer">ADSI</a> or its wrappers. I found a <a href="http://www...
<p>Querying ActiveDirectory only works for computers joined to a domain; and where the user has the ability to query the domain controller (which is something that can be un-granted).</p> <p>@NicholasWilson's answer of using <code>NetValidatePasswordPolicy</code> is a good one; as it can do a lot of heavy lifting for ...
40,476
<p>Can the built in VPN client "Connect to Workplace" in Vista home connect to a Cisco router?</p> <p>Are there any other Cisco compatible clients? I love vpnc, but it only runs under Linux or Cygrin on Windows.</p>
<p>As others have mentioned the built in windows VPN client will not work however the Cisco VPN Client is a bit rubbish, the main gripe is it doesn't work on 64bit windows but even on 32bit windows I used to have many troubles trying to get it to connect.</p> <p>I would instead reccomend using the Shrew Soft VPN Clien...
<p>I don't believe that you can use the built in VPN client to connect to a Cisco router. At least I haven't found a way to do it yet.</p>
31,660
<p>I've run into a problem where I make changes to a few JavaScript files that are referenced in an HTML file, but the browser doesn't see the changes. It holds onto the copy cached in the browser, even though the web server has a newer version.</p> <p>Not until I force the browser to clear the cache do I see the chan...
<p>We append a product build number to the end of all Javascript (and CSS etc.) like so:</p> <pre><code>&lt;script src="MyScript.js?4.0.8243"&gt; </code></pre> <p>Browsers ignore everything after the question mark but upgrades cause a new URL which means cache-reload.</p> <p>This has the additional benefit that you ...
<p>I am also of the method of just renaming things. It never fails, and is fairly easy to do.</p>
7,807
<p>I have a problem with the <a href="http://freetextbox.com/" rel="nofollow noreferrer">FreeTextBox</a> rich Text Editor in my ASP.NET site. The problem occurs when I access the site with firefox, and I have a freetextbox instance in a hidden div. The hidden div might also be an AJAX Tab Panel. The actual problem is t...
<p>I recently met a similar problem with jQuery UI tabs. What you need to do is to change the CSS for hidden tabs to something like:</p> <pre><code>.hiddentab { position: absolute; left: -99999999999999; } </code></pre> <p>This puts hidden tabs far to the left, and in absolute position mode this does not ca...
<p>Firefox has a problem with being inside anything with a style of display:none. What I did was to use a div with a zIndex that hid the div until I needed it displayed. I would start there. </p>
31,599
<p>The log levels WARN, ERROR and FATAL are pretty clear. But when is something DEBUG, and when INFO? </p> <p>I've seen some projects that are annoyingly verbose on the INFO level, but I've also seen code that favors the DEBUG level too much. In both cases, useful information is hidden in the noise.</p> <p>What are t...
<p>I don't think there are any hard-and-fast rules; using the log4j-type levels, my 'rules of thumb' are something like:</p> <ul> <li><strong>FATAL</strong>: the app (or at the very least a thread) is about to die horribly. This is where the info explaining <em>why</em> that's happening goes.</li> <li><strong>ERROR</s...
<p>There's no need for a DEBUG2 level. That's what 'TRACE' is for. TRACE is intended to be the absolute lowest level of logging outputting every possible piece of information you might want to see.</p> <p>To avoid a deluge of information, it is generally not recommended that you enable trace-level logging across an ...
22,607
<p>When placing email addresses on a webpage do you place them as text like this:</p> <pre><code>joe.somebody@company.com </code></pre> <p>or use a clever trick to try and fool the email address harvester bots? For example:</p> <p><strong>HTML Escape Characters:</strong></p> <pre><code>&amp;#106;&amp;#111;&amp;#101...
<p>I generally don't bother. I used to be on a mailing list that got several thousand spams every day. Our spam filter (spamassassin) let maybe 1 or 2 a day through. With filters this good, why make it difficult for legitimate people to contact you?</p>
<p>Another option, I perefer font awesome icons</p> <p>Fa implementation:</p> <pre><code>&lt;link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css"&gt; </code></pre> <p>Mail Address:</p> <pre><code>&lt;a href="mailto:info@uploadimage.club"&gt;&lt;span class="label"&gt;info&lt;i class="fa fa-at"&...
19,782
<p>I started using NetBeans for Python development, and so far it looks pretty good. One thing that bothers me is that when I highlight a few lines of text and hit the Tab key, it doesn't do what almost every other editor does, but rather just adds four spaces at the end of the block.</p> <p>I know NetBeans has a bloc...
<p>This should be fixed now - in build #415 and later from <a href="http://deadlock.netbeans.org/hudson/job/python/" rel="nofollow noreferrer">http://deadlock.netbeans.org/hudson/job/python/</a> . Thanks for the bug report.</p>
<p>Had you changed the default keys at some point? Tab works for block indent for me.</p>
49,087
<p>The line-height property usually takes care of vertical alignment, but not with inputs. Is there a way to automatically center text without playing around with padding?</p>
<p>I ran into this problem myself. I found that not specifying an input height, but using the font-height and padding combined, results in vertically aligned text.</p> <p>For instance, lets say you want to have a 42px tall input box, with a font-size of 20px. You could simply find the difference between the input he...
<p>If your element is a block element contained/or with display like so:</p> <pre><code>display: table-cel </code></pre> <p>Or, with an fixed line-height, you can set the vertical align like so:</p> <pre><code>Vertical-Align: Middle; </code></pre> <p>It won't work for other cases, but it works fine on these condit...
42,320
<p>This is a question regarding Unix shell scripting (any shell), but any other &quot;standard&quot; scripting language solution would also be appreciated:</p> <p>I have a directory full of files where the filenames are hash values like this:</p> <pre><code>fd73d0cf8ee68073dce270cf7e770b97 fec8047a9186fdcc98fdbfc0ea607...
<p>Here's mimetypes' version:</p> <pre><code>#!/usr/bin/env python """It is a `filename -&gt; filename.ext` filter. `ext` is mime-based. """ import fileinput import mimetypes import os import sys from subprocess import Popen, PIPE if len(sys.argv) &gt; 1 and sys.argv[1] == '--rename': do_rename = True d...
<p>Agreeing with Keltia, and elaborating some on his answer:</p> <p>Take care -- some filetypes may be problematic. <a href="http://www.linuxquestions.org/questions/showthread.php?p=3843206#post3843206" rel="nofollow noreferrer">JPEG2000</a>, for example.<br> And others might return too much info given the "file" comm...
45,957
<p>I am in college and am doing a team competition to print PPSU filament, and get the best results. This is being put on by the Solvay company, who makes the material. Our team signed up and the university bought us an <a href="https://www.intamsys.com/" rel="nofollow noreferrer">Intamsys</a> <a href="https://www.inta...
<p>If you're a brave individual you might try insulating the bottom of your heated bed. You're going to want to get fiberglass or something that can actually withstand the temperatures you're trying to reach; anything past about 230&nbsp;&deg;C and you'll get organic things like cork and cotton starting to smoke. 200&n...
<p>Inspired by the answer from Nach0z, according to my back of the notepad radiative emission approximation, you need about a 3x increase in bed dissipation to get from <span class="math-container">$ \Delta T$</span> of 130 °C up to 170 °C. So that would correspond to an increase from 12 V <em>at the bed</em> to 18 V. ...
1,187
<p><strong>My setup</strong></p> <ul> <li>Ender 3</li> <li>Creality glass bed</li> <li>Creality 3D BL Touch auto bed levelling kit v1</li> <li>Creality 3D silent mainboard v4.2.7</li> <li>OctoPrint running on a Raspberry Pi 4 connected over USB (with the 5 V pin covered with a piece of tape to prevent powering the main...
<p>Had similar problems. I even did a 10x10 grid just to find out that my printing bed wasn't actually flat.</p> <p>It actually had dips in it.</p> <p>I would have to look up the command, but I actually just lowered the nozzle by 0.050 mm at a time. Eventually it got too low, and then I backed it off in even smaller ...
<p>I had the exact same issue as you and had done all the fixes you mentioned. The only thing that solved it for me was to make sure the model in the slicing software was flat to the &quot;bed&quot;.</p> <p>I use Cura and it has a &quot;flat the bed&quot; option which I only discovered due to a model that was slightly ...
1,937
<p>For a web application, I would like to create a simple but effective licensing system. In C#, this is a little difficult, since my decryption method could be viewed by anyone with Reflector installed.</p> <p>What are some methods for encrypting files in C# that are fairly tamper-proof?</p>
<p>It sounds like you want to be using Public/Private cryptography to sign a license token (an XML Fragment or file for example) so you can detect tampering. The simplest way to handle it is to do the following steps:</p> <p>1) Generate a keypair for your company. You can do this in the Visual Studio command line usin...
<p>RE: Do not include the whole key in your code. Use sn -p to extract the public part to a file. Use that in your code you distribute to verify the license. </p> <p>Using the code from the MSDN articles, I created a small app (LicMaker) to facilitate this. The app is signed with the full key pair. The input is an u...
46,870
<p>I am connecting to a Windows XP machine via Microsoft's Remote Desktop Connection Client, version 2.0.0 Beta 3, running on a Mac. On the Windows machine there is a Java console running, where I want to send a Ctrl-Break so I can see the Java threads running.</p> <p>According to the RDC help, Alt/Option-F3 is break,...
<p>Hit CTRL+ALT+END instead.</p>
<p>Still would like to see a way to send Ctrl-Break from a Mac Book Pro to a Windows machine via RDP for Mac. Trying the default key assignment (Option-F3) doesn't work and re-assigning the key doesn't seem to work either. If anybody has successfully sent a Ctrl-Break using the RDP client on a Mac, I'd love to hear h...
14,086
<p>Getting started with jquery and having trouble getting hello world type example going for asp.net mvc. I get a runtime error "object expected" when trying to load a page with this script. </p> <p>A. Where should script tags be placed in a master page? B. What might I be doing wrong? There are definitely "a" element...
<p>Hmmm ... </p> <p>To answer your first question: They should be put in the <code>&lt;head&gt;</code> element.</p> <p>Also, usually I use the <a href="http://docs.jquery.com/Events/bind#typedatafn" rel="noreferrer">'bind' method</a> when sinking events in the DOM (like it looks like you're trying to do).</p> <p>So...
<p>The master page is usually stored in /Views/Shared/Site.Master while scripts are located in /Scripts so these:</p> <pre><code>&lt;script src="../Scripts/jquery-1.2.6.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="../Scripts/jquery.corner.js" type="text/javascript"&gt;&lt;/script&gt; <...
40,227
<pre><code>Shell ("explorer.exe www.google.com") </code></pre> <p>is how I'm currently opening my products ad page after successful install. However I think it would look much nicer if I could do it more like Avira does, or even a popup where there are no address bar links etc. Doing this via an inbrowser link is eas...
<p>No, there is not a built-in waitForProperty() type of method, so you cannot do something simple like tableObject.waitForProperty("rowCount", x);</p> <p>Your options are to use a verification point as you already are doing (if it ain't broke...) or to roll your own synchronization point using a do/while loop and the...
<p>You can do one thing.... you can try getting the particular property and check that you are getting the desired value of that. If not then iterate in a IF loop.</p> <pre><code>while (!flag) { if (obj.getproperty(".text").equals("Desired Text")) { flag = true } } </code></pre>
12,169
<p>I'm having trouble selecting elements that are part of an specific namespace. My xpath expression works in XMLSpy but fails when using the Xalan libraries..</p> <pre><code>&lt;item&gt; &lt;media:content attrb="xyz"&gt; &lt;dcterms:valid&gt;VALUE&lt;/dcterms:valid&gt; &lt;/media:content&gt; &lt;/item&gt; ...
<p>You'll need to implement a <a href="http://xml.apache.org/xalan-j/apidocs/org/apache/xml/utils/PrefixResolver.html" rel="nofollow noreferrer"><code>org.apache.xml.utils.PrefixResolver</code></a> to map the prefix to namespace URI, and then pass an instance to the <code>XPath</code> instance you use. This will allow ...
<p>Perhaps XMLSpy has implemented the 2.x XSLT spec of which I believe XPath is a part. Xalan on the other hand is still 1.x.</p>
22,674
<p>Without resorting to PInvoke, is there a way in .net to find out what windows are open? This is slightly different than asking what applications are running in memory. For example, Firefox could be running, but could be more than one window. Basically, I just want to be privy to the same information that the task...
<p>You could check out the new <a href="http://msdn.microsoft.com/en-us/library/ms747327.aspx" rel="nofollow noreferrer">UI Automation</a> stuff in .NET 3.5. It is supposed to mask a whole lot of the PInovke stuff and works with web and WPF applications.</p> <p>I haven't used it yet, so I don't have a more specific p...
<p>I'm afraid there is no way you can do it without PInvoke. To give focus to some window you should call SetForegroundWindow function, see <a href="http://www.codeproject.com/KB/cs/windowhider.aspx" rel="nofollow noreferrer">this</a> article for details.</p>
5,640
<p>How do I test the concrete methods of an abstract class with PHPUnit?</p> <p>I'd expect that I'd have to create some sort of object as part of the test. Though, I've no idea the best practice for this or if PHPUnit allows for this.</p>
<p>Unit testing of abstract classes doesn't necessary mean testing the interface, as abstract classes can have concrete methods, and this concrete methods can be tested. </p> <p>It is not so uncommon, when writing some library code, to have certain base class that you expect to extend in your application layer. And if...
<p>If you do not want to subclass the abstract class just to perform a unit test on the methods which are implemented in the abstract class already, you could try to see whether your framework allows you to <a href="http://en.wikipedia.org/wiki/Mock_object" rel="nofollow noreferrer" title="Mock object - Wikipedia, the ...
23,093
<p>Wish to simultaneously call a function multiple times. I wish to use threads to call a function which will utilize the machines capability to the fullest. This is a 8 core machine, and my requirement is to use the machine cpu from 10% to 100% or more. </p> <p>My requirement is to use the boost class. Is there any ...
<p>I suggest that you read up on the documentation for the functions you use. From your comment in James Hopkin's answer, it seems like you don't know what boost::bind does, but simply copy-pasted the code.</p> <p>boost::bind takes a function (call it f), and optionally a number of parameters, and returns a function w...
<p>If your interest is in using your processor effeciently then you might want to consider intels thread building blocks <a href="http://www.intel.com/cd/software/products/asmo-na/eng/294797.htm" rel="nofollow noreferrer">http://www.intel.com/cd/software/products/asmo-na/eng/294797.htm</a>. I believe it is designed spe...
44,759
<p>I've just started using Linq to SQL, and I'm wondering if anyone has any best practices they can share for managing dbml files.</p> <ul> <li>How do you keep them up to date with the database?</li> <li>Do you have a single dbml file for the entire database, or is it split into multiple logical units? </li> <li>How ...
<p>Have you looked at <a href="http://msdn.microsoft.com/en-us/library/bb386987.aspx" rel="nofollow noreferrer">SqlMetal</a>? It's officially supported, although not promoted too much. You can use it to build dbmls from the commandline - we've used it as part of a db's continous integration updates (make sure you have ...
<p>Here is a link that provides good information about LINQ to SQL best practices</p> <p><a href="http://www.a2zmenu.com/LINQ/LINQ%20to%20SQL%20Best%20Practice.aspx" rel="nofollow">http://www.a2zmenu.com/LINQ/LINQ%20to%20SQL%20Best%20Practice.aspx</a></p>
5,373
<p>I am using PLA and I am looking for ideas on using the <code>Tune</code> option to tune my Prusa i3 MK3 to increase the speed to 300 %.</p> <p>The 300 % speed works perfectly fine for some of the models.</p> <p>However, for some of the flat surfaces, the printer cannot handle the speed. The issues are pointed in the...
<p>extruder clicking means you're getting backed up, grinding.</p> <ul> <li>Make the hotend hotter so you can melt filament 3X faster than expected; most materials have quite a range; aim high.</li> <li>Slow down the cooling fan; a lot of them can cool the hotend.</li> <li>You have a silicone boot on the nozzle? that w...
<p>Changing &quot;Flow&quot; will affect whole print. So even if it helped for the middle part (I doubt), the next it would ruin the print on sides by overextrusion. However: <strong>if sides are printed ok, then why the middle couldn't?</strong> Because walls are printed slower? Indeed, the under-extrusion may quickly...
1,840
<p>I have a new ASP.NET MVC project (my first), and I had been running fine with 1 controller, view, and model. After I added a new controller and view, my first view started throwing this error message when I try to run the project:</p> <p>Description: An error occurred during the parsing of a resource required to se...
<p>I've had this happen before. Can't explain it. I ended up rebuilding the first view by creating it again and copying and pasting the markup. Also try shutting down VS and restarting.</p>
<p>This happened to me before too. It happened when I changed the name of the .aspx file after adding it to the project. Changing the name of your .aspx file does automatically change the names of your .axpx.cs and .axpx.designer.cs files, but it does not change any instance of the original name inside of your .aspx.cs...
49,931
<p>I have got these two classes interacting and I am trying to call four different classes from class one for use in class two.</p> <p>The methods are public and they do return values but for some reason there is not a connection being made. The error I get when I try is: <code>"An object reference is required for the...
<p>You're trying to call an instance method on the class. To call an instance method on a class you must create an instance on which to call the method. If you want to call the method on non-instances add the static keyword. For example</p> <pre><code>class Example { public static string NonInstanceMethod() { ...
<p>You have to create a variable of the type of the class, and set it equal to a new instance of the object first.</p> <pre><code>GradeBook myGradeBook = new GradeBook(); </code></pre> <p>Then call the method on the obect you just created.</p> <pre><code>myGradeBook.[method you want called] </code></pre>
42,768
<p>In the application I am writing I have a Policy class. There are 4 different types of Policy. Each Policy is weighted against the other Policies such that PolicyA > PolicyB > PolicyC > PolicyD.</p> <p>Who's responsibility is it to implement the logic to determine whether one Policy is greather than another? My i...
<p>I would think that a PolicyComparer class should do the evaluation.</p>
<p>I think you are on the right track with the overload however the extension of this is obviously a lot longer</p> <p>if (A > B || B > C || C > D) ...</p>
10,927
<p>I recently got stuck on an odd problem.</p> <p>My friend hired a designer to work on a web site for his company. He asked my recommendation about a tool to allow web designer perform secure file transfers so that he can update web site. Since he's hosting on Windows 2003, my immediate recommendation was to enable w...
<p>I am sorry, but I don't understand what the problem is with <a href="http://www.debian-administration.org/articles/94" rel="nofollow noreferrer">creating a user, changing their shell, and granting them only SFTP access on the system</a>. I've done that in the past to allow web developers access ONLY to upload files ...
<p>SFTP and SCP only give access to the entire system if that user has access to the entire system. Did you give him his own account or are you letting him login as root? </p> <p>I would give the developer his own account on the box in question, then set his permissions according to what he needed to do. </p>
37,863
<p>Pretty self explanatory. I just need to export lists easily to xml format. Are there any tools that accomplish this?</p>
<p>This is the method I use:</p> <p><a href="http://servername/site/_vti_bin/owssvr.dll?Cmd=Display&amp;List=YOURUNIQUELISTID&amp;XMLDATA=TRUE" rel="noreferrer">http://servername/site/_vti_bin/owssvr.dll?Cmd=Display&amp;List=YOURUNIQUELISTID&amp;XMLDATA=TRUE</a></p> <p>Works like a charm.</p>
<p>In the actions menu of the list, select export to spreadsheet. Then open the exported Excel Web Query file and from the File menu, select "Save as" and save it as XML.</p>
34,106
<p>I'm working in VS 2008 and have three projects in one solution. I'm debugging by attaching to a .net process invoked by a third party app (SalesLogix, a CRM app). </p> <p>Once it has attached to the process and I attempt to set a breakpoint in one of the projects, it doesn't set a breakpoint in that file. It act...
<p>I saw this functionality in older versions of VS.Net (2003 I think). It may still exist in current versions, but I haven't encountered it. Seems that files with the same name, even in different directories confuse VS.Net, and it ends up setting a break point in a file with the same name. May only happen if the cl...
<p>Kibbee, you were right! It was two files with the same name in different folders. I was setting the breakpoint in the correct file on line 58 - it was putting the breakpoint on the other file at line 58. I was finally able to set a breakpoint by using the "Debug-->New Breakpoint-->Break at Function Name" menu opt...
5,134
<p>I am trying to create a sidebar for a site that will allow a user to select an item from a drop down menu and show an RSS Feed. The feed will change depending on which item is selected from the list. I am not sure how to acomplish this, but my first thought was to use z-index and show/hide layers. I have one layer a...
<p>This uses jQuery and jFeed plugin to replace the contents of a DIV based on a dropdown selection.</p> <pre><code>// load first feed on document load $(document).ready( function() { load_feed( $('select#feedSelect')[0], 'feedDiv' ) ); // pick first } ); function load_feed( ctl, contentArea ) // load...
<p>This uses jQuery and jFeed plugin to replace the contents of a DIV based on a dropdown selection.</p> <pre><code>// load first feed on document load $(document).ready( function() { load_feed( $('select#feedSelect')[0], 'feedDiv' ) ); // pick first } ); function load_feed( ctl, contentArea ) // load...
37,574
<p>Here's a basic regex technique that I've never managed to remember. Let's say I'm using a fairly generic regex implementation (e.g., grep or grep -E). If I were to do a list of files and match any that end in either <code>.sty</code> or <code>.cls</code>, how would I do that?</p>
<pre><code>ls | grep -E "\.(sty|cls)$" </code></pre> <ul> <li><code>\.</code> matches literally a <code>"."</code> - an unescaped <code>.</code> matches any character</li> <li><code>(sty|cls)</code> - match <code>"sty"</code> or <code>"cls"</code> - the | is an <code>or</code> and the brackets limit the expression.</l...
<pre><code>egrep "\.sty$|\.cls$" </code></pre>
6,000
<p>We use SourceSafe 6.0d and have a DB that is about 1.6GB. We haven't had any problems yet, and there is no plan to change source control programs right now, but how big can the SourceSafe database be before it becomes an issue?</p> <p>Thanks</p>
<p>1 byte!</p> <p>:-)</p> <p>Sorry, dude you set me up.</p>
<p>I've administered a VSS DB over twice that size. As long as your are vigilant about running <a href="http://msdn.microsoft.com/en-us/library/ysxsfw4x(VS.80).aspx" rel="nofollow noreferrer">Analyze</a>, you should be OK.</p>
36,645
<p>I wanted to add a UTF-8 font in Gvim but I could not find out how to do this. I tried to follow the step on this manual but it still did not work. <a href="http://www.inter-locale.com/whitepaper/learn/learn_to_type.html" rel="noreferrer">http://www.inter-locale.com/whitepaper/learn/learn_to_type.html</a> (vim sectio...
<p>As others note, you must use a fixed-width font. Vim is a text editor, not a WYSIWYG editor.</p> <p>If you have a fixed-width font with the characters you need then:</p> <pre><code>:set guifont=* </code></pre> <p>Select the font you want to use, the size, etc. Once you're happy with it, do:</p> <pre><code>:set g...
<p>You have to use a fixed-width font for Gvim under Windows.</p> <p>There are several relevant pages at the Vim Tips Wiki:</p> <ul> <li><a href="http://vim.wikia.com/wiki/Working_with_Unicode" rel="nofollow noreferrer">Working with Unicode</a></li> <li><a href="http://vim.wikia.com/wiki/Setting_the_font_in_the_GUI" ...
29,172
<p>I know how to write trace statements that I can view in a webforms environment, but how do I do this in a windows forms app?</p> <p>I am inside of a static method, and I want to display the sql query that it is generating.</p> <p>I don't have access to messagebox.show, what are my options?</p>
<p>The simplest way is to use either <code>System.Diagnostics.Debug.WriteLine</code> or <code>System.Diagnostics.Trace.WriteLine</code>. If you have a debugger attached, the messages will show up in the output window, otherwise run <a href="http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx" rel="noreferrer"...
<p>You could use a global logging object:</p> <pre><code>enum LogLevel { Info, Warning, Error } delegate void OnLog (string msg, LogLevel level); interface ILogger { void Log(string msg, LogLevel level); event OnLog; } </code></pre> <p>Then extend ILogger with a class that you acquire using a pu...
26,238
<p>I know each iPhone has a electronic identifier other than the phone # or ESN - how do I call it and what does it return?</p>
<p>The UIDevice class contains the information you need.</p> <p><code>[[UIDevice currentDevice] uniqueIdentifier]</code></p>
<p>if you are writing a web app, why don't you use standard cookies?</p>
41,965
<p>can anyone think of a better way to do this?</p> <pre><code> [AcceptVerbs(HttpVerbs.Post)] public ActionResult SaveAction() { NameValueDeserializer value = new NameValueDeserializer(); // selected messages MemberMessageSaveAction[] messages = (MemberMessageSaveAction[])value.Dese...
<p>I think you can also leverage the mvc framework for most of your code. Correct me if I'm wrong because I'm gonna make a few assumptions about your classes because I can't deduct it from your post.<br> My assumptions:</p> <ul> <li>Request.Form["action"] is a single value selectbox</li> <li>Request.Form["value"] is a...
<p>I came up with this.</p> <pre><code> [AcceptVerbs(HttpVerbs.Post)] public ActionResult Update(MemberMessageUpdate[] messages, MemberMessage.Action action) { var actions = new List&lt;MemberMessage.Action&gt; { MemberMessage.Action.MoveToFolder, MemberMessage.Action...
45,392
<p>I'm using visual studio 2005 and have been building asp.net applications. Mostly just departmental level apps for reporting and data maintenance. They work and they look ok but they don't look great. I don't have any other tools like Dreamweaver or Expression. Can anyone name any books or resources for making b...
<p>Honestly, the IDE does a fairly good job at design work. We are transitioning our designers from Dreamweaver to Visual Studio 2008, and they definitely like the tools.</p> <p>Don't take this the wrong way, but some people just can't make a page look good, no matter what tool it is. I am one of those people. I ca...
<p>I always try to write the code myself rather than using design tools.</p> <p>There is a lot that you can to do with CSS and HTML, and it's important to understand how those pieces fit together.</p> <p>If your looking for some good examples of site design, I recommend checking out <a href="http://csszengarden.com" ...
47,451
<p>I need to stop the execution Is there any procedures for using terminate and suspend activity</p>
<p>This sample at the microsoft website should help you with the suspend and terminate Activity</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms742189.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms742189.aspx</a></p>
<p>This sample at the microsoft website should help you with the suspend and terminate Activity</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms742189.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms742189.aspx</a></p>
42,436
<p>I need to get the values in the registers with GCC.</p> <p>Something similar to this:</p> <pre> EAX=00000002 EBX=00000001 ECX=00000005 EDX=BFFC94C0 ESI=8184C544 EDI=00000000 EBP=0063FF78 ESP=0063FE3C CF=0 SF=0 ZF=0 OF=0 </pre> <p>Getting the 32-bit registers is easy enough, but I'm not sure what the simp...
<p>There is no need to use assembler just to get the registers.</p> <p>You can just use setjmp. That will write all registers into a stucture of type jmp_buf. It even kind of Works cross platform except for the fact that jmp_buf itself is different for each architecture.</p> <p>However, calling setjmp (and calling yo...
<p>I think using Jcc's would be longer and not as clear using inline assembly.</p> <p>Here is what I currently have, using CMOVcc's:</p> <pre> void dump_regs() { int eax = 0; int ebx = 0; int ecx = 0; int edx = 0; int esi = 0; int edi = 0; int ebp = 0; int esp = 0; int cf = 0; int sf = 0; int ...
34,760
<h2>My Situation</h2> <ul> <li>I have a N rectangles</li> <li>The rectangles all have the same shape (for example 2 inches wide x 1 inch tall) - Let's refer to this size as Sw and Sh for the width and height</li> <li>I want to position these rectangles in a grid such that the rects completely on top and next to each o...
<p>Building on Will Dean's response, find the derivative of his formula (with respect to nCols):</p> <p>-N*Sh / nCols + Sw</p> <p>Then set it to 0 and solve for nCols, which gives:</p> <p>nCols = sqrt(N * Sh / Sw)</p> <p>Round that and you should have the optimum number of columns:</p> <p>cols = round(sqrt(N * Sh ...
<p>If the number of rectangles was unlimited, you would need to find the LCD (Least Common Denominator) of Sw and Sh. Then you could divide it by Sw and Sh to find the horizontal and vertical count.</p> <p>Since it is limited, it's different. Do I understand correctly that you have to use up ALL the rectangles and the...
44,153
<p>I have an ASP.NET page which has a button it it. The button click launches a modal dialog box using JavaScript. Based on the value returned by the modal dialog box, I want to proceed with, or cancel the post back that happens. How do I do this?</p>
<p>Adding "return false;" to the onclick attribute of the button will prevent the automatic postback. </p>
<p>Basically what Wayne said, but you just need to put 'return false;' in the function that presents the modal. If it's the value you want, let the postback happen. If not, have the function return false and it will stop the submit.</p>
18,069
<p>I have seen the other questions <em>but I am still not satisfied with the way this subject is covered</em>.</p> <p><strong>I would like to extract a distiled list of things to check on comments at a code inspection.</strong> </p> <p>I am sure people will say things that will just cancel each other. But hey, maybe ...
<p>I have one simple rule about commenting: Your code should tell the story of what you are doing; your comments should tell the story of why you are doing it.</p> <p>This way, I make sure that whoever inherits my code will be able to understand the intent behind the code.</p>
<p>Pre-ambles only; state a class's Single Responsibility, any notes or comments, and change log. As for methods, if any method needs substantial commenting, it is time to refactor.</p>
17,260
<p>The standalone flashplayer takes no arguments other than a .swf file when you launch it from the command line. I need the player to go full screen, no window borders and such. This can be accomplished by hitting ctrl+f once the program has started. I want to do this programmatically as I need it to launch into full ...
<p>You can use a dedicated application which sends the keystroke to the window manager, which should then pass it to flash, if the window starts as being the active window on the screen. This is quite error prone, though, due to delays between starting flash and when the window will show up.</p> <p>For example, your s...
<p>I've done this using openbox using a similar mechanism to the one that bmdhacks mentions. The thing that I did note from this was that the standalone flash player performed considerably worse fullscreen than the same player in a maximised undecorated window. (that, annoyingly is not properly fullscreen because of...
19,885
<p>i am changing my hardware which currently runs Win XP and i am wondering if i should also upgrade my OS to vista. so my question is, what are the most common issues/advantages you find while developing in VS2008 on Vista. with out taking into consideration WPF. should i keep XP where i have no Problems? or what ver...
<p>I used both Vista and XP before as a developer machine. </p> <p>But <strong>Windows Server 2008</strong> is the smoothest of them all. Super stable, pretty as Vista and fast as XP. And you can install products that need server (BitTalk, SQL Server Standard, Sharepoint,...)</p> <p>Be sure to check out <a href="http...
<p>I have Vista Home Prem and it's fine for .NET development.</p> <p>As the post above says, UAC does cause issues. For example, you can't save in certain dirs with VS2008 unless you right click the program icon and run as an admin. This is what I do, and problem is solved (I am admin on the machine too).</p> <p>Also...
40,857
<p>I was wondering if it is possible to declare an array (size not known at this time), as a private member of a class and later set the size in the constructor of the class. For example:</p> <pre><code>class Test { int a[]; public: Test(int size); }; Test::Test(int size) { a[size]; // this is wrong, but what can ...
<p>No this is not possible. Array declarations in headers must have constant sized value. Otherwise it's impossible for constructs like "sizeof" to function properly. You'll need to declare the array as a pointer type and use new[] in the constructor. Example.</p> <pre><code>class Test { int *a; public: T...
<p>No, this is not possible. You should use a dynamic array such as an <code>std::vector</code>. C99 allows a struct to have an unsized array as the <em>last</em> member only, but even when you do this you still have to manually allocate the memory yourself, e.g. with <code>malloc()</code>.</p>
41,693
<p>I've heard that there are some free applications that will check the vulnerability of a PHP website, but I don't know what to use. I'd like a free program (preferably with a GUI) for Windows that will analyze my site an give me a report.</p> <p>Anyone know of a solution?</p>
<p><a href="http://sectools.org/web-scanners.html" rel="noreferrer">Top 10 Web Vulnerability Scanners</a> from Insecure.org (listing from 2006). Their number one, Nikto2, can be found <a href="http://www.cirt.net/nikto2" rel="noreferrer">here</a>.</p>
<p>I'm a little late to the party, but since you specifically asked for easy to use and not-too-technical scanners, take a look at <a href="https://www.golemtechnologies.com" rel="nofollow">Golem Technologies website security scanner</a> - the full scan isn't free, but they have a demo scan which checks about 10% of a ...
44,101
<p>For this WCF service I have developed, I have to set MaxReceivedMessageSize to 5MB. My current problem is figuring out whether it is better to have a larger MaxBufferPoolSize value, like 5MB, or retain the original 512KB value.</p> <p>Does anyone knows what is the recommended setting for this scenario?<br> In short...
<p>Check out this article. <a href="http://kennyw.com/?p=51" rel="noreferrer">http://kennyw.com/?p=51</a></p> <p>It suggests setting the MaxBufferPoolSize to zero for large messages in order to avoid buffering.</p>
<p>5 Mb seems like a lot of data to transfer over a Web Service. The first thing you should look for is to send less data. Secondly you need to set the size to your needs.</p>
42,115
<p>Sorry for the newb question. I'm still learning programming. So I'm using C++, and I need to do something like this:</p> <pre><code>int n; do { n = get_data(); if(n != -1) send(n); } while(n != -1); </code></pre> <p>This is just a sketch. Anyway it doesn't feel real elegant. I have to have my t...
<p>Howabout using <a href="http://msdn.microsoft.com/en-us/library/37zc9d2w(VS.80).aspx" rel="noreferrer">break</a>:</p> <pre><code>int n; while(1) { n = get_data(); if(n == -1) break; send(n); } </code></pre> <p>This way you only test once, and quit immediately if get_data doesn't return what you...
<pre><code>int get_data() { ... } void _send(int ) { ... } int send(int (*a) ()) { int n = a(); if (n == -1) return n; _send(n); return 1; } int main() { int (*fp)(); fp = get_data; while ( send(fp)!= -1 ); return 0; } </code></pre> <p>HTH</p>
37,603
<p>I have an old .dot file with a few dozen styles in it.<br> I need to place them into <b>another .dot file </b> that I received. Is there a better way to get them in there than manually recreating each style?</p>
<p>There is a 'Style Organizer' tool within Word which will let you copy styles from one document to another if they are both open at once.</p> <p>In Word 2007:</p> <ul> <li>Open the styles dialog (Home tab -> Styles -> Bottom Right button).</li> <li>Click the 'manage styles' button.</li> <li>Click 'Import/Export...'...
<p>This is the way to transfer your styles &amp; formatting between two documents:</p> <ol> <li><code>Go to Tools &gt; Templates &amp; Add-Ins...</code></li> <li><code>Click Organizer button...</code></li> </ol> <p>Cheers</p>
11,141
<p>I wrote C++ for 10 years. I encountered memory problems, but they could be fixed with a reasonable amount of effort.</p> <p>For the last couple of years I've been writing C#. I find I still get lots of memory problems. They're difficult to diagnose and fix due to the non-determinancy, and because the C# philosophy ...
<p>I use Scitech's <a href="http://memprofiler.com/" rel="noreferrer">MemProfiler</a> when I suspect a memory leak.</p> <p>So far, I have found it to be very reliable and powerful. It has saved my bacon on at least one occasion.</p> <p>The GC works very well in .NET IMO, but just like any other language or platform, ...
<p>From Visual Studio 2015 consider to use out of the box <a href="https://learn.microsoft.com/en-us/visualstudio/profiling/memory-usage" rel="nofollow noreferrer"><strong>Memory Usage diagnostic tool</strong></a> to collect and analyze memory usage data. </p> <p>The Memory Usage tool lets you take one or more snapsh...
16,232
<p>We have industrial automation application developed in .NET 3.5 framework.</p> <p>I have to list out the available serial ports in the computer for our user. As part this, if any of the serial port is already opened, I have to show "In Use" status. I tried google but no luck. </p> <p>Can someone help me please?</...
<p>Try opening the com port with an exclusive lock, if that fails, flag it as open.</p>
<p>There are undocumented APIs to find all the handles that are open in the system, and then you could check which ones are open to serial ports. That's if the user will always be an administrator and you don't care about staying with .Net and documented APIs.</p> <p>There are documented APIs to find all the COM port...
23,074
<p>I am just learning about Unit Testing. I am using NUnit to build tests for a VB.NET project.</p> <p>The project I'm working on is part of a framework which will be used by people who build ASP.NET websites. It includes a base class (which inherits <code>System.Web.HttpApplication</code>) that users of my framewor...
<p>I would test the application base class indirectly by creating a subclass and testing that, just as you said.</p> <p>For the controls, I would use Selenium: <a href="http://selenium.seleniumhq.org/" rel="nofollow noreferrer">http://selenium.seleniumhq.org/</a>.</p>
<p>It's no longer maintained but there is <a href="http://nunitasp.sourceforge.net/" rel="nofollow noreferrer">NUnitAsp</a>.</p> <pre><code>[Test] public void TestExample() { // First, instantiate "Tester" objects: LabelTester label = new LabelTester("textLabel"); LinkButtonTester link = new LinkButtonTe...
45,158
<p>I am a SQL Server user .</p> <p>I am on a project that is using oracle (which I rarely use) I need to create an ODBC connection so I can access the some data via MS Access I have a application on my machine called oraHome90. It seems to allow a configuration of something called a listener in a “net configuration u...
<p>from <a href="http://ora-12154.ora-code.com" rel="noreferrer">http://ora-12154.ora-code.com</a></p> <p><strong>ORA-12154</strong>: TNS:could not resolve the connect identifier specified<br> <em>Cause</em>: A connection to a database or other service was requested using a connect identifier, and the connect iden...
<p>Hours of problems SOLVED. I had installed the Beta Entity Framework for Oracle and in in visual studio 2010 MVC 3 project I was referencing under the tab .NET the Oracle.DataAccess ... This kept giving me the "Oracle ORA-12154: TNS: Could not..." error. I finally just browsed to the previous Oracle install un...
25,242