instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I'm trying to unit test a piece of code that needs a currently logged in user in the test. Using the .Net 2.0 Membership Provider, how can I programmatically log in as a user for this test?</p>
<pre><code>if(Membership.ValidateUser("user1",P@ssw0rd)) { FormsAuthentication.SetAuthCookie("user1",true); } </code></pre>
<p>Using your Membership Provider you can validate a user using Membership.ValidateUser. Then you can set the authentication cookie using FormsAuthentication.SetAuthCookie. As long as you have a cookie container this should allow you to log in a user. </p>
30,216
<p>We are thinking of renaming our web directory schema to be more user friendly. However, we need any URL requests for the old directory structure to forward to the new one. so....</p> <p>How do I forward requests for all of these: </p> <p><a href="http://mydomain.com/OLDdirname/" rel="nofollow noreferrer">http://my...
<p>You can use a number of things to do something like this. Basically, you're doing URL Rewriting. One of these products should help you get the job done:</p> <ul> <li><a href="http://www.isapirewrite.com/" rel="nofollow noreferrer">ISAPI Rewrite</a></li> <li><a href="http://www.qwerksoft.com/products/iisrewrite/" re...
<p>I use IIRF on many of my websites, and it has always worked without failing. You use regular expressions to define the rules, and it takes care of the rest. It would be extremely easy to setup a few redirects using IIRF.</p> <p><a href="http://cheeso.members.winisp.net/IIRF.aspx" rel="nofollow noreferrer">http://che...
22,821
<p>I'm writing C# code that uses the windows IP Helper API. One of the functions I'm trying to call is "<a href="http://msdn.microsoft.com/en-us/library/aa365920(VS.85).aspx" rel="nofollow noreferrer">GetBestInterface</a>" that takes a 'uint' representation of an IP. What I need is to parse a textual representation of ...
<p>MSDN <a href="http://msdn.microsoft.com/en-us/library/system.net.ipaddress.getaddressbytes.aspx" rel="noreferrer">says</a> that IPAddress.Address property (which returns numeric representation of IP address) is obsolete and you should use <a href="http://msdn.microsoft.com/en-us/library/system.net.ipaddress.getaddre...
<p>I have never found a clean solution (i.e.: a class / method in the .NET Framework) for this problem. I guess it just isn't available except the solutions / examples you provided or Aku's example. :(</p>
5,742
<p>I am doing 2^1000 and I am getting this:</p> <p>1.07151e+301</p> <p>Is there any way to actually turn this into a proper number without the e+301, or at least can anyone show me where I can see how to turn this in to a real number, by some way working with the e+301 part?</p>
<p>So, I'm thinking that what you really want is just the ability to print it without scientific notation. If you're using <code>printf</code>, what you want is:</p> <pre><code>printf( "%f1000.0", value ); // note that 1000 is way larger than need be, // I'm just too lazy to count the digits </code></pre> <p>With <c...
<p>You are getting as precise a number as the variable type can support. That number is on the order of 1 followed by 301 zeroes. To get a precise number you'll have to work with a library that supports large numbers, or work with a language that is made for that kind of math (maple, matlab, etc)</p>
33,241
<p>It looks like we'll be adding <a href="http://en.wikipedia.org/wiki/Captcha" rel="noreferrer">CAPTCHA</a> support to Stack Overflow. This is necessary to prevent bots, spammers, and other malicious scripted activity. We only want human beings to post or edit things here!</p> <p>We'll be using a JavaScript (jQuery) ...
<p><a href="http://gatekiller.co.uk/Post/JavaScript_Captcha" rel="noreferrer">A method that I have developed</a> and which seems to work perfectly (although I probably don't get as much comment spam as you), is to have a hidden field and fill it with a bogus value e.g.:</p> <pre class="lang-html prettyprint-override">...
<p>One option would be out-of-band communication; the server could send the user an instant message (or SMS message?) that he/she then has to type into the captcha field.</p> <p>This imparts an "either/or" requirement on the user -- either you must enable JavaScript OR you must be logged on to your IM service of choic...
2,991
<p>I'm porting a C++ 32 bit application to 64 bit on windows. The application is a client of IBM WebSphere MQ. It uses the MQ client API.</p> <p>Now, as the port progresses, I'm trying to find a 64 bit client. So far, no luck.</p> <p>Does anyone here happen to know if where I can find one or confirm that there isn't ...
<p>Websphere MQ 7 for Windows supports x86 and x64, but not Itanium 64-bit. It only <strong>officially</strong> supports Visual C++ 2005 for development at the moment but IBM usually issues PTFs for toleration on a regular basis so it shouldn't be too long before C++ 2008 support is there.</p> <p>The statements of su...
<p>I found this page on IBM's site: <a href="http://www-01.ibm.com/support/docview.wss?uid=swg24007092" rel="nofollow noreferrer">IA94: IBM Message Service Client for C/C++</a>. On it there is a link to a <a href="ftp://ftp.software.ibm.com/software/integration/support/supportpacs/individual/ia94.readme.txt" rel="nofol...
11,884
<p>A requirement for my application is if it looses database connectivity then it must pop up a big modal "No Connection. Try again later" dialog blocking all user interaction until such time that connectivity is regained.</p> <p>I achieve this by at the start of the application starting an instance of a DeviceMonito...
<p>I'm pretty sure what Marc suggested should work. This is how I would write it to use your dialog instead of <code>MessageBox</code>:</p> <pre><code>someControl.Invoke((Action)delegate { var d = _dialogFactory.GetNoConnectionDialog(); d.ShowDialog(); }, null); </code></pre> <p>If that really isn't working ...
<p>This is called marshaling and is a very simple concept once you read some good material on it (Google is your friend).</p> <p>If your background thread has a delegate that calls into an object that is owned by the UI thread, then that method (on the called end of the delegate) simply has to marshal itself back onto...
48,701
<p>I often see code like:</p> <pre><code>Iterator i = list.iterator(); while(i.hasNext()) { ... } </code></pre> <p>but I write that (when Java 1.5 isn't available or for each can't be used) as:</p> <pre><code>for(Iterator i = list.iterator(); i.hasNext(); ) { ... } </code></pre> <p>because</p> <ul> <li>It ...
<p>I prefer the for loop because it also sets the scope of the iterator to just the for loop.</p>
<p>Either is fine. I use for () myself, and I don't know if there are compile issues. I suspect they both get optimized down to pretty much the same thing.</p>
12,442
<p>I'm familiar with .NET and with SQL. Now I'm looking at the new LINQ and it looks to me just like a cursor. I understand the ease of use, etc., but if I do a LINQ-to-SQL query with a foreach loop, am I just using a DB cursor? Or is there some sort of magic behind the scenes where LINQ collects all the data at onc...
<p>No it's not a cursor in the SQL sense. It doesn't iterate over the rows in the database one at a time. Rather, it dynamically constructs a query using the conditions that you specify. It delays the execution of the query until the first data is needed, then executes the query against the database. Depending on...
<p>Anytime you return rows from a database across the wire to a client, the database server uses a cursor to return the results of the query.</p> <p>It's an implicit cursor, that's controlled by the database server, but it's still a cursor.</p> <p>The reason people recommend against explicit cursors, and the reason t...
47,767
<p>Is there an equivalent to the Java File method <strong>isDirectory()</strong> in MFC? I tried using this :</p> <pre><code> static bool isDirectory(CString &path) { return GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY; } </code></pre> <p>but it doesn't seem to work.</p>
<p>Sorry for possibly "inconsistency" of answer to question but may be you'll see it useful because anytime I need something like this in Windows I am NOT using MFC but regular Windows API: </p> <pre><code>//not completely tested but after some debug I'm sure it'll work bool IsDirectory(LPCTSTR sDirName) { //First...
<p>MFC solution as requested: a_FSItem path ot the item to test (examine the CFile::GetStatus() for the needed requirements).</p> <pre><code> CFileStatus t_aFSItemStat; CFile::GetStatus( a_FSItem, t_aFSItemStat ); if ( ( t_aFSItemStat.m_attribute &amp; CFile::directory ) return true; return false; </code>...
45,665
<p>I have an information retrieval application that creates bit arrays on the order of 10s of million bits. The number of "set" bits in the array varies widely, from all clear to all set. Currently, I'm using a straight-forward bit array (<code>java.util.BitSet</code>), so each of my bit arrays takes several megabytes....
<p>Unless the data is truly random <strong><em>and</em></strong> has a symmetric 1/0 distribution, then this simply becomes a lossless data compression problem and is very analogous to CCITT Group 3 compression used for black and white (i.e.: Binary) FAX images. CCITT Group 3 uses a Huffman Coding scheme. In the case o...
<p>Straight forward lossless compression is the way to go. To make it searchable you will have to compress relatively small blocks and create an index into an array of the blocks. This index can contain the bit offset of the starting bit in each block.</p>
5,676
<p>Right now I'm working on a web application that receives a significant amount of data from a database that has a potential to return null results. When going through the cyclomatic complexity for the application a number of functions are weighing in between 10 - 30. For the most part the majority of the functions wi...
<p>What about using <a href="http://msdn.microsoft.com/en-us/library/bb384936.aspx" rel="nofollow noreferrer">Extension Methods</a>.</p> <pre><code>Imports System.Runtime.CompilerServices Module Extensions &lt;Extension()&gt; _ Public Function TryGetString(ByVal row As IDataRecord, i As Integer) As String ...
<p>It is possible to refactor the <strong>if</strong> into a separate utility function to reduce your CC. A number of functions or a function relying on type differentiation might be required to handle the different database types ( string, int etc ..)</p> <p>However, I would argue that any solution would result in le...
25,069
<p>I am using Eclipse 3.4 (ganymede official, not the service pack).</p> <p>I have an update site that organizes features into categories; everything looks great in the editor and in the XML.</p> <p>Once the site is online, accessing it in the usual manner tells me that all the features are "uncategorized". I've trie...
<p>It appears to be a known problem, due to the new <a href="http://wiki.eclipse.org/Equinox_p2" rel="nofollow noreferrer">'p2' provisioning system</a>.</p> <p>See <a href="http://dev.eclipse.org/newslists/news.eclipse.technology.equinox/msg04954.html" rel="nofollow noreferrer">this discussion</a>, and <a href="https:...
<p>This solution works for me:</p> <ol> <li>Use the PDE update site project to create the site.xml and build your plugins. Make sure you set the category here. </li> <li>Delete the artifacts.xml and content.xml created by the update site build.</li> <li>Use the <a href="http://wiki.eclipse.org/Equinox_p2_Metadata_Gene...
17,445
<p>What are the usual methods to compare two polygons for similarity? Vertices are in 2D.</p>
<p>You will find <a href="http://www.cs.princeton.edu/courses/archive/spr00/cs598b/lectures/polygonsimilarity/polygonsimilarity.pdf" rel="nofollow noreferrer">some methods exposed here</a>.</p> <ul> <li>Turning function</li> <li>Graph matching</li> <li>Shape signature by deformation</li> </ul> <p>It is used in domain...
<p>I didn't read about the turning function discussed by @VonC, but I suspect a correlation of the vector(s) containing the difference in slopes between the segments would work well.</p>
31,007
<p>I'm just beginning to have a look at Objective-C and Cocoa with a view to playing with the iPhone SDK. I'm reasonably comfortable with C's <code>malloc</code> and <code>free</code> concept, but Cocoa's references counting scheme has me rather confused. I'm told it's very elegant once you understand it, but I'm just ...
<p>Let's start with <code>retain</code> and <code>release</code>; <code>autorelease</code> is really just a special case once you understand the basic concepts. </p> <p>In Cocoa, each object keeps track of how many times it is being referenced (specifically, the <code>NSObject</code> base class implements this). By ...
<p>As several people mentioned already, Apple's <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmPractical.html" rel="nofollow noreferrer">Intro to Memory Management</a> is by far the best place to start.</p> <p>One useful link I haven't seen mentioned yet is <a href...
2,828
<p>I'm wanting to change my movie clips to actionscript classes in AS3. Is there a standard list of things I need to do to make sure the classes work?</p>
<p>Check out these resources:</p> <p>Grant Skinners Introductory AS3 Workshop slidedeck <a href="http://gskinner.com/talks/as3workshop/" rel="nofollow noreferrer">http://gskinner.com/talks/as3workshop/</a></p> <p>Lee Brimelow : 6 Reasons to learn ActionScript 3 <a href="http://www.adobe.com/devnet/actionscript/articl...
<p>Don't forget this excellent devnet article meant for transitioning from AS2 to AS3:</p> <p><a href="http://www.adobe.com/devnet/actionscript/articles/actionscript_tips.html" rel="nofollow noreferrer">http://www.adobe.com/devnet/actionscript/articles/actionscript_tips.html</a></p>
9,316
<p>How can I get the list of available databases on a SQL Server instance? I'm planning to make a list of them in a combo box in VB.NET.</p>
<p>Execute: </p> <p><code>SELECT name FROM master.sys.databases</code> </p> <p>This the preferred approach now, rather than <code>dbo.sysdatabases</code>, which has been deprecated for some time.</p> <hr> <p>Execute this query:</p> <pre><code>SELECT name FROM master.dbo.sysdatabases </code></pre> <p>or if you pre...
<p>To exclude system databases :</p> <pre><code>SELECT name FROM master.dbo.sysdatabases where sid &lt;&gt;0x01 </code></pre>
17,778
<p>As part of my overall development practices review I'm looking at how best to streamline and automate our ASP.net web development practices.</p> <p>At the moment, our process goes something like this:</p> <ol> <li>Designer builds frontend as static HTML/CSS on a network share. This gets tweaked until signed off. (...
<p>I found that using SVN, NAnt and NUnit with Cruise Control.net solves a lot of the issues you describe. I think it works well for small groups and it's all free. Just need to learn how to use them.</p> <p>CruiseControl.net helps you put together builds and continuous integration.</p> <p>Use NAnt or MSBuild to do...
<p>One thing that really helps is making sure you keep your paths relative where you can and centralise them where you can't, so when I've been working with ASP.Net I have tended to use <a href="http://msdn.microsoft.com/en-us/library/aa719558.aspx" rel="nofollow noreferrer">web.config</a> to store any configuration an...
32,878
<p>So I'm interested in hearing different thoughts about what is the best way to go about unit testing XNA Game/Applications. Astute googlers can probably figure out why I'm asking, but I didn't want to bias the topic :-)</p>
<p>I would that this question is geared more toward the approach of <strong>unit testing in game development</strong>. I mean, XNA is a framework. Plug in <a href="http://www.nunit.org/index.php" rel="nofollow noreferrer">NUnit</a>, and begin writing test cases while you develop. </p> <p><a href="https://stackoverfl...
<p>I know this is an old post, but for other people wondering how to best go about testing their XNA Games, there is another option. The built-in testing in Visual Studio is definitely great, but is not well suited for games. Everytime a value is needed, you have to pause the game, and then either hover over the variab...
5,283
<p>I'm working with a snippet of code that recursively calls itself and tries to pull out a MIME Type part of <code>text/html</code> from an email (if it exists) for further processing.</p> <p>The "text/html" could exist inside other content such as <code>multipart/alternative</code>, so I'm trying to find out if ther...
<p>In theory, only multipart/ and message/ can parent other types (per RFC2046).</p>
<p>Your question assumes that mail clients follow the RFC standards for MIME encoding, which they don't. I'd advise you collect a bunch of mail from sources and try and process it as-it-exists. The problem you are facing is extremely difficult (perhaps impossible) to solve 100%.</p>
7,925
<p>In a recent project I have nearly completed we used an architecture that as its top layer of interaction from the web/services layers uses XXXManager classes. </p> <p>For example, there is a windows services that runs on a scheduled basis that imports data from several diverse data sources into our system. Within t...
<p>Managers are a commonly overused naming strategy for services that handle the workflow or complex tasks for a given set of entities. However, if it gets the job done, then it is not necessarily a bad thing. </p> <p>The important question I would have is what is going on underneath the managers? IF they are simply c...
<p>Sounds like your motivation for that design was good - reuse of code. In some ways it is similar in motivation to <a href="http://martinfowler.com/eaaCatalog/serviceLayer.html" rel="nofollow noreferrer">Martin Fowler's Service Layer</a>. However, you may be piling too many responsibilities into these Manager classes...
16,829
<p>I've been a Delphi (D7) developer for many sometime already, I've always been wondering about the .NET + C# stuffs. What I mean are about not the "Delphi for .NET" or "Oxygene" tech/plugin, but clean .NET/C#.</p> <p>How much different is it from Delphi? And some other questions...</p> <ul> <li>Is Mono/SharpDevelop...
<p>Re the first point: have you tried the (free) <a href="http://www.microsoft.com/Express/" rel="nofollow noreferrer">VIsual Studio Express Edition</a>? For a lot of things, this is perfectly capable. You just don't get as many helpers / designers, and no plug-in support (for IDE extensions).</p> <p>Re the second: ex...
<p>Delphi was written by the same person who wrote C#, so the overall structure of the language would not be the toughest transition. You also have to keep in mind that C# is C-like while Delphi is Pascal. I tried looking Delphi after using C# it was a very tough transition. First no garbage collection, second like @A...
29,409
<p><a href="http://github.com/orestis/pysmell/tree/master" rel="noreferrer">PySmell</a> seems like a good starting point.</p> <p>I think it should be possible, PySmell's <code>idehelper.py</code> does a majority of the complex stuff, it should just be a case of giving it the current line, offering up the completions (...
<p>EDIT: I've actually took your code above and integrated into a command. It will properly show a completion list for you to choose.</p> <p>You can grab it here: <a href="http://github.com/orestis/pysmell/tree/master" rel="nofollow noreferrer">http://github.com/orestis/pysmell/tree/master</a> (hit download and do pyt...
<p>In TextMate PHP has a simple auto-completion in form of hardcoded set of function names. Sounds as ugly as PHP, but in practice it's good enough to be useful.</p>
27,274
<p>I am working on a background program that will be running for a long time, and I have a external logging program (<a href="http://www.gurock.com/products/smartinspect/" rel="noreferrer">SmartInspect</a>) that I want to feed with some values periodically, to monitor it in realtime when debugging.</p> <p>I know I can...
<p>You can also use <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.totalprocessortime.aspx" rel="noreferrer">System.Diagnostics.<strong>Process.TotalProcessorTime</strong></a> and <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.processthread.totalprocessortime.aspx" rel=...
<p>This code project article describes how to use the high performance timer:</p> <p><a href="http://www.codeproject.com/KB/cs/highperformancetimercshar.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/cs/highperformancetimercshar.aspx</a></p> <p>You can use it to time the execution of your code.</p> <p...
34,785
<p>I know that there has been a couple questions about tutorials on moq. But I am wondering if there are any sample apps out there that use moq in the context of an n-tier business application using ado.net.</p> <p>I find the tutes good, but they don't seem to bring everything all together into the big picture. Thus, ...
<p><em>Edit 5/5/09: Moq was removed from this code base so you would have to download an older revision (140) to see the moq stuff.</em></p> <p>Try <a href="http://code.google.com/p/sutekishop/" rel="nofollow noreferrer">SutekiShop</a> - uses .NET 3.5, MVC, LINQ, Windsor, and Moq.</p>
<p>Moq, like all unit testing frameworks, should not have much a concept of n-tier-ness about it.</p> <p>One would typically use unit testing to test each individual class one-at-a-time. When a particular class is a little more complex and relies on having references to component classes and calling methods on these c...
30,075
<p>I've seen lots of descriptions how anonymous types work, but I'm not sure how they're really useful. What are some scenarios that anonymous types can be used to address in a well-designed program?</p>
<p>Anonymous types have nothing to do with the design of systems or even at the class level. They're a tool for developers to use when coding.</p> <p>I don't even treat anonymous types as types per-se. I use them mainly as method-level anonymous tuples. If I query the database and then manipulate the results, I would ...
<p>@Wouter :</p> <pre><code>var query = from item in database.Items select new Person { ID =item.id, NAME= item.Name }; </code></pre> <p>where ID and NAME are real property of your Person class.</p>
7,113
<p>After trying to avoid JavaScript for years, Iv started using Query for <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" rel="nofollow noreferrer">validation</a> in MVC asp.net, as there does not seem to be an official way of doing validation, Iv been surprised how good jQuery is. </p> <p>Fir...
<p>Try specifying both a wrapper and a label container in your options. I also added <code>display:none;</code> to the style of error-container to let jQuery decide when to show it.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre cl...
<p>regarding intellisense for jquery (and other plugins): in order to have full intellisense in your own script files as well, just include the following line at the top of your .js file once for each file you want intellisensee from:</p> <pre><code>/// &lt;reference path="[insert path to script file here]" /&gt; </co...
8,671
<p>I was loading a Bitmap Image from a File. When I tried to save the Image to another file I got the following error "A generic error occurred in GDI+". I believe this is because the file is locked by the image object.</p> <p>Ok so tried calling the Image.Clone function. This still locks the file.</p> <p>hmm. Next ...
<p>I have since found an alternative method to clone the image without locking the file. <a href="https://web.archive.org/web/20120419185819/http://www.bobpowell.net/imagefileconvert.htm" rel="nofollow noreferrer">Bob Powell has it all plus more GDI resources</a>.</p> <pre><code> //open the file Image i = Im...
<p>I had a similar problem. But I knew, that I will save the image as a bitmap-file. So I did this:</p> <pre><code> public void SaveHeightmap(string path) { if (File.Exists(path)) { Bitmap bitmap = new Bitmap(image); //create bitmap from image image.Dispose(); //delete im...
31,592
<p>Is there a standard way of dealing with globally scoped variables in PHP? Session scoped? </p> <p>From the research I've done, it looks like the options are mostly add-ons or external. APC might work, but would be limited to a single PHP instance and not so useful for a farm of servers. <em>Memcached</em> seems lik...
<p>A persistent layar is the only way to go with php. Either file based solution or database. </p> <p>php natively doesn't provide any mechanism to do application scope variable.</p>
<p>You can do session variables with <a href="http://www.php.net/manual/en/reserved.variables.session.php" rel="nofollow noreferrer">$_SESSION</a>.</p>
7,344
<p>I just got done working through the Django tutorials for the second time, and am understanding things much more clearly now. However, I'm still unclear how apps inside a site interact with one another.</p> <p>For example, lets say I'm writing a blog application (a rather popular activity, apparently). Blog posts an...
<p>Take a look at django's built-in <a href="http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#ref-contrib-contenttypes" rel="noreferrer">contenttypes framework</a>:</p> <p><code>django.contrib.contenttypes</code></p> <p>It allows you develop your applications as stand-alone units. This is what the djan...
<p>Your code seems correct. I would keep the post and the comment in a <strong>blog</strong> app though. I am not saying this is <em>the</em> Django way, but those models are close enough to be in the same app.</p> <h3>How To Divide The Project</h3> <p>I would seperate an app if;</p> <ul> <li>I plan to design it res...
46,052
<p>I am working on an Actionscript 2 project - trying to use the XML object to find a url which is returned as a 302 redirect. Is there a way to do this in actionscript 2?</p> <p>code:</p> <pre><code>var urlone:XML = new XML(); urlone.load("http://mydomain.com/file.py"); urlone.onLoad = function (success) { trac...
<p>You can use SqlMethods.Like </p> <p>e.g. </p> <pre><code>Where SqlMethods.Like(t.country, "%Sweden%") </code></pre>
<p>You can use SqlMethods.Like </p> <p>e.g. </p> <pre><code>Where SqlMethods.Like(t.country, "%Sweden%") </code></pre>
23,352
<p>is there some open source Java API (ideally not GPL) for creating an object model from an XQuery string? </p> <p>thanks</p>
<p>There's an extremely fast and powerful implementation in Saxon: <a href="http://www.saxonica.com/index.html" rel="nofollow noreferrer">http://www.saxonica.com/index.html</a></p> <p>I've used it a number of times in production code and it is very good.</p>
<p><a href="http://www.gnu.org/software/qexo/" rel="nofollow noreferrer">http://www.gnu.org/software/qexo/</a></p> <p>HTH</p>
39,548
<p>Which are the events of an ASP .Net server control and how does their order relate to the containing page's events?</p> <p>The concrete problem is that I am looking for an event inside the server control that fires before the <em>Page_Load</em> event of the containing page.</p>
<p>With regards to how they relate to Page events, at least for Init and Load:</p> <p>"Although both Init and Load recursively occur on each control, they happen in reverse order. The Init event (and also the Unload event) for each child control occur before the corresponding event is raised for its container (bottom-...
<p>It's a littlebit problem, because the control can be placed inside the page after the "Page_Load" event.</p> <p>In one my historic project, I derived all pages from my class "PageEx : System.Web.UI.Page". Which had a property "CurrentState" of type "enum PageStates { PreInit, Init, PostInit, PreLoad, /* etc... */ }...
15,571
<pre><code>int main() { HandPhone A,B; A&gt;&gt;B;//overloading operator&gt;&gt; to simulate sending sms to another handphone(object) return 0; } </code></pre> <p>How should I declare the istream operator to simulate sending sms to another handphone(object)?</p>
<p>This is how to define the >> operator:</p> <pre><code>void operator &gt;&gt; (HandPhone&amp; a, HandPhone&amp; b) { // Add code here. } </code></pre> <p>I have set the return type to void as I am not sure chaining would make sense.</p> <p>But it is considered bad design (in the C++ world) to overload operator...
<p><a href="http://www.cplusplus.com/reference/iostream/istream/" rel="nofollow noreferrer">std::istream</a> is a class, not an operator. The &lt;&lt; and >> operators can be defined for any two types:</p> <pre><code>class A; class B; A operator &lt;&lt; (A&amp; a, const B&amp; b) // a &lt;&lt; b; sends b to a. ...
24,140
<p>I have some nested tables that I want to hide/show upon a click on one of the top-level rows.</p> <p>The markup is, in a nutshell, this:</p> <pre> &lt;table&gt; &lt;tr&gt; &lt;td&gt;stuff&lt;/td&gt; .... more tds here &lt;/tr&gt; &lt;tr&gt; &lt;td colspan=some_number&gt; &lt...
<p>Keep in mind that the innerHTML of a &lt;table&gt; element is <em>read-only</em> in IE(6 for sure, not sure about 7). That being the case, are you explicitly adding a &lt;tbody&gt; element? If not, try adding one and adding the rows to the body element rather than the table element.</p> <pre><code>&lt;table&gt; &...
<p>There are a bunch of bugs in IE related to modifying the contents of tables from Javascript. In a lot of cases, IE (including IE7) will even crash.</p> <p><strike>I ran into this recently and I'm blanking on the work-around I came up with. Let me go back through my logs and see what I can find.</strike></p> <hr>...
23,439
<p>I have an Xtext/Xpand (oAW 4.3, Eclipse 3.4) generator plug-in, which I run together with the editor plug-in in a second workbench. There, I'd like to run Xpand workflows programmatically on the model file I create. If I set the model file using the absolute path of the IFile I have, e.g. with:</p> <pre><code>Strin...
<p>I found help at the <a href="http://openarchitectureware.org/forum/viewtopic.php?showtopic=10197" rel="nofollow noreferrer">openArchitectureWare forum</a>. Basically using</p> <pre><code>properties.put("modelFile", file.getLocation().makeAbsolute().toOSString()); </code></pre> <p>works, but you need to specify loo...
<p>This is a sample application <strong>Launcher.java</strong> (sitting in the default package):</p> <pre><code>import gnu.getopt.Getopt; import gnu.getopt.LongOpt; import java.io.File; import java.io.IOException; import org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher; public class Launcher implements Runnable { ...
16,877
<p>I have a web service that queries data from this json file, but I don't want the web service to have to access the file every time. I'm thinking that maybe I can store the data somewhere else (maybe in memory) so the web service can just get the data from there the next time it's trying to query the same data. I kin...
<p>Extending on <a href="https://stackoverflow.com/questions/11761/persisting-data-in-net-web-service-memory#11779">Ice^^Heat</a>'s idea, you might want to think about where you would cache - either cache the contents of the json file in the Application cache like so: </p> <pre><code>Context.Cache.Insert("foo", _ ...
<p>ASP.NET caching works just as well with Web services so you can implement regular caching as explained here: <a href="http://msdn.microsoft.com/en-us/library/aa478965.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa478965.aspx</a></p>
3,284
<p>My printer has been doing weird things lately. It used to print fine, but now it's like the Y or X axis after a certain percentage time. ie on a 24 hour print: it got off at 5 hours on a 42 print it got off at 16%</p> <p>Thoughts?</p>
<p>That depends on how much noise you have on your motor power supply ground. You definitely want the 100&nbsp;µF capacitor to have a good high frequency response. Motors turning on and off can be noisy, and that noise can cause false clock signals in your logic circuitry if you tie the grounds together. </p>
<p>That depends on how much noise you have on your motor power supply ground. You definitely want the 100&nbsp;µF capacitor to have a good high frequency response. Motors turning on and off can be noisy, and that noise can cause false clock signals in your logic circuitry if you tie the grounds together. </p>
1,342
<p>Related to an issue I had in <a href="https://3dprinting.stackexchange.com/questions/1205/increased-issues-with-filament-grinding">this question</a>, where the PTFE tube feeding my filament to the metal tip of the extruder clogged and became discolored: what are the advantages and disadvantages of changing out my ex...
<p>This is a good question to make a comparison table. All-metal hotends Vs. PTFE liner hotends.</p> <p>All metal:</p> <ul> <li>Works well for high (+250ºC) temperatures filaments like nylon or PC.</li> <li>No need to replace the PTFE liner (pretty obvious).</li> <li>Retraction performs worse.</li> <li>Plastic can ge...
<p>My Tevo Tarantula had an all metal hotend included and I never ran into any issues only printing PLA and PETG, most of the time I was even able to pull out the filament while the printer was cold.</p> <p>After I upgraded to an E3Dv6 clone with PTFE lined heatbreak I started to have issues because of the filament ge...
359
<p>Is there a indexing plugin for GDS that allows for source code search? I see some for specific types (Java, C++, ...) and one for "any text". These are nice, but I would like one that allows for many/configurable extensions (HTML, CSS, JS, VB, C#, Java, Python, ...). A huge bonus would be to allow for syntax high...
<p>I just found Dropout and it seems to work great. Put Dropout in any folder and it will index all files in that folder. I put it in my Projects folder and it crawled all my code. Very fast and flexible search. <a href="http://dropout.codeplex.com/">Dropout</a></p>
<p>Im just giving this a go:</p> <p><a href="http://desktop.google.com/plugins/i/java.html?hl=en" rel="nofollow noreferrer">http://desktop.google.com/plugins/i/java.html?hl=en</a></p> <p>..also you can search for things in your Java tree using the following syntax in Google Desktop:</p> <pre><code>&lt;YOUR SEARCH&gt...
15,503
<p>I'm new to jQuery, and I'm totally struggling with using jQuery UI's <code>sortable</code>.</p> <p>I'm trying to put together a page to facilitate grouping and ordering of items.</p> <p>My page has a list of groups, and each group contains a list of items. I want to allow users to be able to do the following: </p...
<p>Can you include the syntax you used for <code>connectWith</code>? Did you place the list of other groups inside brackets(even if it's a selector)? That is:</p> <pre><code>...sortable({connectWith:['.group'], ... } </code></pre>
<pre><code> $(function() { $( "#groupItems1, #groupItems2, #groupItems3" ).sortable({ connectWith: ".itemsList" }).disableSelection(); }); </code></pre> <p>This will go all fine for you! doing the same here for me. NO change required in your HTML.</p>
39,562
<p>What are the major difference between bindable LINQ and continuous LINQ?</p> <p>•Bindable LINQ: www.codeplex.com/bindablelinq</p> <p>•Continuous LINQ: www.codeplex.com/clinq</p> <p>One more project was added basing on the provided feedback:</p> <p>•Obtics: obtics.codeplex.com</p>
<p>Their are 2 problems both these packages try to solve: Lack of a CollectionChanged event and Dynamic result sets. There is one additional problem bindable solves, additional automatic event triggers.</p> <hr> <p><strong>The First Problem</strong> both packages aim to solve is this: </p> <blockquote> <p>Objec...
<p>I think Bindable LINQ and continuous LINQ are about the same: they provides observing for changes in LINQ computation. Implementation and API provided may some differ. It seems my <a href="https://github.com/IgorBuchelnikov/ObservableComputations" rel="nofollow noreferrer">ObservableComputations</a> library covers ...
20,248
<p>I have a Zimbra installation and I need to programmaticaly update contacts in it. It seems that its REST interface is only working to add new contacts, but I need to update existing ones. Is there a way, tool or something, open-source, to do that ?</p>
<p>Well, I have an answer to my question : you may use the "zmmailbox" command. Under the Zimbra system user, it is possible to modify content in a mailbox. Since quite everything is stored in the Zimbra mailbox, contacts can be edited. I need now to find a way to use this :</p> <pre><code>box$ zmmailbox help contact ...
<p>There's actually also a SOAP interface in Zimbra but from what I've been able to tell by reading the forums at <a href="http://www.zimbra.com/forums/" rel="nofollow noreferrer">zimbra.com/forums</a>, for some reason they "could not" (?!) document it properly, nor generate any WSDL file; thus I've never used it. </p>...
23,711
<p>I'm using <code>M80</code> and <code>M81</code> G-codes to power on/off power supply. </p> <p>Is there a G-code to know the actual state of the power supply?</p>
<p>I don't have this specific printer but this used to happen to me as well on my D-Bot. The reason being bed not being leveled properly. Ensure that your bed is leveled such that the distance between the nozzle and bed is about 0.2mm after homing. Also coat your bed with something sticky like glue or hairspray. You wo...
<p>I've cleaned the heated bed as suggested using ethanol, then I've tested the Z distance of the nozzle from the bed with a paper sheet and it was ok. Lastly, I tried to raise the temperature of the extruder for the first layer to 215°C. I think that this did the trick.</p>
592
<p>When verbally talking about methods, I'm never sure whether to use the word <em>argument</em> or <em>parameter</em> or something else. Either way the other people know what I mean, but what's correct, and what's the history of the terms?</p> <p>I'm a C# programmer, but I also wonder whether people use different ter...
<p>A parameter is a variable in a method definition. When a method is called, the arguments are the data you pass into the method's parameters.</p> <pre><code>public void MyMethod(string myParam) { } ... string myArg1 = "this is my argument"; myClass.MyMethod(myArg1); </code></pre>
<p>This is a <strong>key:value</strong> issue...</p> <p>The <strong>parameter</strong> is the key</p> <p>The <strong>argument</strong> is the value</p> <p>/****************************************/</p> <p>Example:</p> <p>name: &quot;Peter&quot;</p> <p>/********/</p> <p>let printName = (<strong>name</strong>) =&gt; con...
18,967
<p>In short: I want to monitor selected calls from an application to a DLL.</p> <p>We have an old VB6 application for which we lost the source code (the company wasn't using source control back then..). This application uses a 3rd party DLL.</p> <p>I want to use this DLL in a new C++ application. Unfortunately the DL...
<p>A "static" solution (in the sense it can capture a stack trace on demand) would be <a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" rel="noreferrer"><strong>Process Monitor</strong></a>.</p> <p><img src="https://i.stack.imgur.com/PwXMa.gif" alt="Process Monitor"></p> <p>A more dynamic soluti...
<p>If you just want to see the function interfaces of the DLL, you could try &quot;Dependecies&quot; (<a href="https://lucasg.github.io/Dependencies/" rel="nofollow noreferrer">https://lucasg.github.io/Dependencies/</a>). This is a nice remake of the DependencyWalker in as OpenSource.</p> <p>This only allows you to se...
40,117
<p>I am using <code>setInterval(fname, 10000);</code> to call a function every 10 seconds in JavaScript. Is it possible to stop calling it on some event? </p> <p>I want the user to be able to stop the repeated refresh of data.</p>
<p><code>setInterval()</code> returns an interval ID, which you can pass to <code>clearInterval()</code>:</p> <pre><code>var refreshIntervalId = setInterval(fname, 10000); /* later */ clearInterval(refreshIntervalId); </code></pre> <p>See the docs for <a href="https://developer.mozilla.org/en-US/docs/Web/API/WindowOrW...
<h2>Why not use a simpler approach? Add a class!</h2> <p>Simply add a class that tells the interval not to do anything. For example: on hover.</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var i = 0; this.set...
13,437
<p>I have a method running in a seperate thread. The thread is created and started from a form in a windows application. If an exception is thrown from inside the thread, what is the best way to pass it back to the main application. Right now, I'm passing a reference to the main form into the thread, then invoking t...
<p>So you're using Invoke to marshall back to the UI thread, by the looks of it - which is exactly what you need to do. I'd personally use an Action&lt;Exception> for simplicity's sake, and possibly BeginInvoke instead of Invoke, but basically you're doing the right thing.</p>
<p>I totally agree with Dror. In a formal way we can call this structure as FaultContract. Fundamentally when an exception has happened in another thread, the client thread can hardly do any thing at that moment except that to collect that information and act accordingly in it's own theread. If the thereads are in diff...
22,922
<p>I'm looking for some information on Routing in MVC with C#. I'm currently very aware of the basics of routing in MVC, but what i'm looking for is somewhat difficult to find. </p> <p>Effectively, what I want to find is a way of defining a single route that takes a single parameter.</p> <p>The common examples I have...
<p>I don't think that you can do exactly what you are asking. When MVC invokes an action it looks for parameters in routes, request params and the query string. It's always looking to match the parameter name. </p> <p>Perhaps good old query string will meet your needs.</p> <pre><code>~/mycontroller/myaction/?fooba...
<p>Although you still can't use the <code>FromUri</code> attribute, you can however use the <code>Route</code> attribute, like so</p> <pre><code>[Route("~/Policy/PriorAddressDelete/{sequence}")] public ActionResult PriorAddressDelete(int sequence) { Policy.RemoveScheduledPriorAddressItem(sequence); return Redirect...
44,690
<p>I have over 50 clients connected to one server (low end server, running windows 2003 server), every time there is a power failure or switch failure the clients will disconnect from the server, the server might remain on during this incidents (if power backup is installed), when the clients came back they automatical...
<p>Similar to network collision-detection protocols, perhaps clients could wait a random period of time before initiating their connection at startup?</p>
<p>In addition to the random startup delay suggested by Bremen, implement some sort of "too busy; try again later" message in your protocol. Rejecting a client with a short message should not be a problem for 50, 100, or even 1000 clients. Have the clients respond by doing a random delay and retrying + exponential back...
48,397
<p>This is quite a controversial topic, and before you say "no", is it really, really needed? </p> <p>I have been programming for about 10 years, and I can't honestly say that I can recall a time where inheritance solved a problem that couldn't be solved another way. On the other hand I can recall many times when ...
<p>I <a href="https://codeblog.jonskeet.uk/2007/02/27/wacky-ideas-1-inheritance-is-dead-long-live-mix-ins/" rel="nofollow noreferrer">blogged about this</a> as a wacky idea a while ago.</p> <p>I don't think it should be removed, but I think classes should be sealed by default to <em>discourage</em> inheritance when it'...
<p>The question is, "Should inheritance (of non-interface types) be removed from programming languages?"</p> <p>I say, "No", as it will break a hell of a lot of existing code.</p> <p>That aside, should you use inheritance, other than inheritance of interfaces? I'm predominantly a C++ programmer and I follow a strict...
47,160
<p>So I'm running PPP under linux with a cellular modem. The program I'm writing needs to know if the link is active before sending any data.</p> <p>What are my options to check</p> <ul> <li>if the link is available</li> <li>if it routes to a server I control (it doesn't go to the internet as I said earlier)</li> </...
<p>You can use the <code>ip-up</code> script functionality of pppd to have it execute a program when the IP interface is up and ready. Details are in the <a href="http://ppp.samba.org/pppd.html" rel="nofollow noreferrer">pppd(8) man page</a> - search for "ip-up".</p> <p>To restart pppd, use the <code>linkname</code> p...
<p>You could parse <code>/proc/net/route</code>.</p>
7,434
<p>Is it possible to send a HTTP REDIRECT response from inside the XFire SOAP server instead of a regular response?</p> <p>I need this in order to redirect the client to another server based on some checking of method parameters.</p> <p>Also, is redirect handling something that major SOAP clients support? I know Http...
<p>Many soap clients won't follow redirects because you're not supposed to follow redirects on POSTs without confirmation from the user. (and all SOAP requests are POST)</p>
<p>WS-BasicProfile 1.1 and 1.2 states that using HTTP temporary redirection 307 MAY work :</p> <p><a href="http://www.ws-i.org/Profiles/BasicProfile-1_2%28WGAD%29.html#HTTP_Redirect_Status_Codes" rel="nofollow noreferrer">http://www.ws-i.org/Profiles/BasicProfile-1_2%28WGAD%29.html#HTTP_Redirect_Status_Codes</a></p>
30,089
<p>I need to rotate an image at 12 midnight every day from a group of 5-10 images. How can I go about doing this with JavaScript or jQuery or even PHP?</p>
<p>At a basic level what you want to do is define an array of image names then take the number of days from a given point in time then modulo (remainder after division) by the number of images and access that index in the array and set the image, e.g. (untested code)</p> <pre><code>var images = new Array("image1.gif",...
<p>If you are running a linux system you can set a <a href="http://www.sitepoint.com/article/introducing-cron/" rel="nofollow noreferrer">Cron Job</a> or you can use the windows task scheduler if you are on windows</p>
9,193
<p>I have a service contract that defines a method with a parameter of type System.Object (xs:anyType in the WSDL). I want to be able to pass simple types as well as complex types in this parameter. Simple types work fine, but when I try to pass a complex type that is defined in my WSDL, I get this error:</p> <p>Ele...
<p>The NetDataContract works because the NetDataContractSerializer includes type information.</p> <p>The KnownType attribute instructs the DataContractSerializer how to deserialize the message. Being implementation specific, this is information over-and-above that defined by the public contract and doesn't belong in t...
<p>Try use data contract Surrogates to map unsupported object that is dot net specific or not interoperable types. See <a href="http://msdn.microsoft.com/en-us/library/ms733064.aspx" rel="nofollow noreferrer">MSDN</a></p>
9,330
<p>I am stuck building reports that will be generated by a custom application using the Crystal Reports 9.1.5 that comes with Visual Studio 2003. In addition to the editor being one of the most infuriating things I've ever had to work with I am also constantly hounded by the various gotchas having to do with their cod...
<p>Not sure why you're stuck with that version of CR. If you can at all upgrade to at least CR XI developer edition, you'll be better off. Integrating them into your VS projects is a bit kludgy, but you can try this blog for starters: <a href="http://weblogs.asp.net/jgaylord/archive/2007/01/24/crystal-reports-merge-...
<p>i know of no tutorial, sorry</p> <p>but i can definitely recommend using datasets as your data source, never a direct connection</p> <p>and expect to write the same stupid little formatting expressions over and over and over and over...</p>
35,262
<p>How can I decode a base64 encoded message in PHP? I know how to use PHP_base64_decode function, but I wanna know how to write little endian part, like the code below, it is base64 code with little endian: (how to write little endian part in php)</p> <p><strong>Original Base64 Content ( as posted by original poster ...
<p>Use the <a href="http://php.net/base64_decode" rel="nofollow noreferrer">base64_decode()</a> function.</p>
<p>Use the <a href="http://php.net/base64_decode" rel="nofollow noreferrer">base64_decode()</a> function.</p>
36,830
<p>I'm writing a series of Windows services. I want them to fail if errors are thrown during startup (in <code>OnStart()</code> method). I had assumed that merely throwing an error in <code>OnStart()</code> would do this, but I'm finding that instead it "Starts" and presents me with a message stating "The service has...
<p>if you are running .NET 2.0 or higher, you can use <a href="http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicebase.stop" rel="nofollow noreferrer">ServiceBase.Stop</a> to stop the service from OnStart. Otherwise call Stop from a new thread. </p> <p><strike>ref [devnewsgroups] (<a href="http://www...
<p>Move all of your startup logic to a separate method, and Throw exceptions (or call OnStop) from that seperate method. </p> <p>OnStart has some oddities when starting up. I have found that if OnStart() has no more than one line in it, then I dont get the "The service started and then stopped.Some services stop autom...
19,205
<p>I'm trying to bind a <code>List&lt;T&gt;</code> to a DataGridView control, and I'm not having any luck creating custom bindings.</p> <p>I have tried:</p> <pre><code>gvProgramCode.DataBindings.Add(new Binding("Opcode",code,"Opcode")); </code></pre> <p>It throws an exception, saying that nothing was found by that p...
<p>Is the property on the grid you are binding to Opcode as well?.. if you want to bind directly to List you would just DataSource = list. The databindings allows custom binding. are you trying to do something other than the datasource?</p> <p>You are getting a bunch of empty rows? do the auto generated columns have ...
<p>Had the same issue... I had a struct with public fields obviously. nothing in the grid. provided public getters, worked.</p>
15,209
<p>I would like to know where to get started, or how possible it is to hook into, or patch the windows kernel(XP and up). I am specifically interested in software like McAfee Entercept, or certain antivirus scanners that patch the kernel. I would like to know how feasable it is for a startup to create software that add...
<p>Yes, it's very possible to hook into the kernel. I strongly suggest the books <a href="https://rads.stackoverflow.com/amzn/click/com/0735619174" rel="nofollow noreferrer" rel="nofollow noreferrer">Windows Internals</a> and <a href="https://rads.stackoverflow.com/amzn/click/com/0321294319" rel="nofollow noreferrer" ...
<p>You talk about patching the kernel without providing a sensible explanation of why you want to do this and why you think the official API will not get you where you want to get. As a consequence, we have to assume you are planning to write some kind of malware -- do not expect anybody on stackoverflow to help you wi...
21,425
<p>Hi why doesn't this work in SQL Server 2005?</p> <pre><code>select HALID, count(HALID) as CH from Outages.FaultsInOutages where CH &gt; 3 group by HALID </code></pre> <p>I get invalid column name 'CH'</p> <hr> <p>i think having was the right way to go but still receive the error: Invalid column name 'CH'.</p> ...
<p>You can't use the alias in the where clause or having clause, as it isn't processed until AFTER the result set is generated, the proper syntax is</p> <pre><code>SELECT HALID, COUNT(HALID) AS CH FROM Outages.FaultsInOutages GROUP BY HALID HAVING COUNT(HALID) &gt; 3 </code></pre> <p>This will group items on HALID, t...
<p>Try</p> <pre><code>select HALID, count(HALID) from Outages.FaultsInOutages group by HALID having count(HALID) &gt; 3 </code></pre> <p>Your query has two errors:</p> <ul> <li>Using where an aggregate when grouping by, solved by using having</li> <li>Using an alias for an aggregate in the condition, not supported,...
19,642
<p>I realize this issue (warping) has been repeatedly addressed on this site. I've just graduated to high-temp filaments (PC in particular). I don't know much of the physics of this. I'm wondering whether the degree to which the filament contracts is proportional to the amount that it cools. If the answer is yes, then ...
<p>I can't address polycarbonate specifically, but can provide a general overview of the higher temperature filament considerations.</p> <p>Printing on a raft means that the adhesion temperature of the filament is accomplished. This temperature is the factor to be considered if you are thinking of dropping the printin...
<p>I can't address polycarbonate specifically, but can provide a general overview of the higher temperature filament considerations.</p> <p>Printing on a raft means that the adhesion temperature of the filament is accomplished. This temperature is the factor to be considered if you are thinking of dropping the printin...
817
<p>I am new to creating Java web applications and came across this problem when trying to interact with my database (called ccdb) through my application:</p> <p><code>java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/ccdb/</code></p> <p>My application runs on JBoss and uses Hibernate to inter...
<p>You don't have to hide every <code>select</code> using a loop. All you need is a CSS rule like:</p> <pre><code>* html .hideSelects select { visibility: hidden; } </code></pre> <p>And the following JavaScript:</p> <pre><code>//hide: document.body.className +=' hideSelects' //show: document.body.className = docum...
<p>There's also the activex method, which I'm starting to explore. It requires creating conditional code to use an activex control instead of a select box for ie6. There's a <a href="http://www.hedgerwow.com/360/bugs/activex-listbox/demo.php" rel="nofollow noreferrer">demo script</a> showing the technique, which is <a ...
27,732
<p>I'm actual looking for a way to get notified about any changes on a SharePoint group. First I though I would be able to this by attaching a event handler to some kind of group list. But unfortunately there are no such list representing SharePoint groups. </p> <p>My second attempt was to bind a event handler to the ...
<p>It is really annoying that adding or removing from a group doesn't have an event handler the best work around I have found using Google! is to turn on auditing.</p> <p>Then periodicaly loop through the audit to fire my event.</p> <pre><code> wssQuery = new SPAuditQuery(site); wssQuery.AddEve...
<p>Unfortunately, "List events are not raised on the UserInformation list type." see: <a href="http://msdn.microsoft.com/en-us/library/aa979520.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa979520.aspx</a> or the discussion here: <a href="http://social.msdn.microsoft.com/Forums/en-US/ea2e06fb-63e1-4096...
37,851
<p>Is there a way to display the headerText of the Grid View vertically?</p> <p><a href="http://img371.imageshack.us/img371/4813/testyk6.jpg" rel="nofollow noreferrer">http://img371.imageshack.us/img371/4813/testyk6.jpg</a></p> <p>I hope the above link works</p> <p>Thanks</p>
<p>I believe you'd have to use images. Either created at design time, or using a HttpHandler to generate images at run-time if they need to be dynamic. Make all of your fields use TemplateFields and place the image in the HeaderTemplate. Kind of tedious, but it's the only way I can think. Perhaps some third party g...
<p>I used a break (br) command between each letter</p>
28,474
<p>Is there an open source library that will help me with reading/parsing PDF documents in .NET/C#?</p>
<p>Since this question was last answered in 2008, iTextSharp has improved their api dramatically. If you download the latest version of their api from <a href="http://sourceforge.net/projects/itextsharp/" rel="noreferrer">http://sourceforge.net/projects/itextsharp/</a>, you can use the following snippet of code to extr...
<p>There is also LibHaru</p> <p><a href="http://libharu.org/wiki/Main_Page" rel="nofollow noreferrer">http://libharu.org/wiki/Main_Page</a></p>
10,885
<p>The problem: Loading an excel spreadsheet template. Using the Save command with a different filename and then quitting the interop object. This ends up saving the original template file. Not the result that is liked.</p> <pre><code>public void saveAndExit(string filename) { excelApplication.Save(filen...
<p>Excel interop is pretty painful. I dug up an old project I had, did a little fiddling, and I think this is what you're looking for. The other commenters are right, but, at least in my experience, there's a lot more to calling SaveAs() than you'd expect if you've used the same objects (without the interop wrapper) ...
<p>Have you tried the SaveAs from the Worksheet?</p>
4,880
<p>I am completely new to 3D Printing. I got my first printer a Creality Ender 5 Pro yesterday.</p> <h3>My problem</h3> <p>I did shutdown the printer without the axis being in home position (<strong>X: 0, Y: 0, Z: 320</strong> instead of <strong>X: 0, Y: 0, Z: 0</strong>). I thought this should be no problem but after ...
<p>Once you pull the plug or disable power to the stepper motors, the printer forgets its location. That is perfectly normal and exactly how it is supposed to work.</p> <p>The printer knows where the printer volume is once you have &quot;homed&quot; the printer. Homing is done prior to printing with G-code <a href="htt...
<p>Slightly unscrew the motor. Manually rig the Z-axis above its lowest point. Rescrew the motor back into place tightly. Then auto home it.</p>
1,700
<p>I have written a Silverlight 2 application communicating with a WCF service (BasicHttpBinding). The site hosting the Silverlight content is protected using a ASP.NET Membership Provider. I can access the current user using HttpContext.Current.User.Identity.Name from my WCF service, and I have turned on AspNetCompati...
<p>I finally found a way to make this work. For authentication I'm using the "<a href="http://msdn.microsoft.com/en-us/library/bb386582.aspx" rel="noreferrer">WCF Authentication Service</a>". When authenticating the service will try to set an authentication cookie. I need to get this cookie out of the response, and add...
<p>It is possible to hide much of the extra code behind a custom message inspector &amp; behavior so you don't need to take care of tinkering with the OperationContextScope yourself.</p> <p>I'll try to mock something later and send it to you.</p> <p>--larsw</p>
8,001
<p>I have an Obj-C method similar to this:</p> <pre><code>-(void)getUserDefaults:(BOOL *)refreshDefaults { PostAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; if (refreshDefaults) { [appDelegate retrieveDefaults]; } } </code></pre> <p>When I call it like this I get no war...
<p>getUserDefaults takes a BOOL*. You don't get a warning when you pass NO because NO is 0 and 0 is NULL, which is a legal BOOL*. YES is 1 and the same conversion isn't automatically safe.</p> <p>You should make getUserDefaults take a plain BOOL, instead of a pointer.</p>
<p>In the first case, NO probably defaults to 0 - the null pointer. This is a valid Bool*. Yes will default to 1, and so when it is cast to a Bool* you are passing the integer 1 in - which is then turned into a Bool*.</p>
49,797
<p>Simple question. If you have a compiled and published ASP.NET web application running on a server and you need to update, say, a line in one of the codebehind files. Do you shut down the entire site, republish, then load the site back up? Or do you publish straight to your live site with users still using it?</p>...
<p>For myself, place an <strike>app.offline</strike> app_offline.htm file into the site, then overwrite the entire website with the latest published build.</p> <p>there are a few options when building a site -> one dll for the site or one per page. if u just updated one line in a code behind, and you have chosen the b...
<p>If it is a single file and a simple site that uses that app_code folder to store the code behinds, I simply xcopy up the new files. If I use http expiration headers I may need to do some better scheduling to make sure things like javascript files and css sheets match the rest of the site that was updated.</p>
32,564
<p>I want to get the path name and arguments of running processes using java code. Is there any solution?</p>
<p>For instance, on Windows, one possibility is to encapsulate the <a href="http://www.rgagnon.com/javadetails/java-0593.html" rel="nofollow noreferrer">system call to <code>TASKLIST.EXE</code></a> </p> <p>Extract from the code:</p> <pre><code>Process p = Runtime.getRuntime().exec("tasklist.exe /fo csv /nh"); B...
<p>You could use the <a href="http://support.hyperic.com/display/SIGAR/Home" rel="nofollow noreferrer">SIGAR</a> framework, which gives you native support for Linux, FreeBSD, Windows, Solaris, AIX, HP-UX and Mac OSX</p>
46,880
<p>Is this possible? I want to have the To:, Body, and an Attachment all pre-populated so all the user has to do is click send. Thanks!</p>
<p>Open a new mail message (<code>ipm.note</code> is the <a href="https://msdn.microsoft.com/en-gb/en-en/library/office/ff861573.aspx" rel="nofollow noreferrer">message class</a> for emails)</p> <pre><code>outlook.exe /c ipm.note </code></pre> <p>Open a new mail message and populate sender: </p> <pre><code>outlook.e...
<p>VonC's solution works, but as stated in the comments by skbergam it doesn't allow for attachments.</p> <p>If, like me, that's a biggie then the following WSH code does it.</p> <pre><code>Set olApp = CreateObject("Outlook.Application") Set olMsg = olApp.CreateItem(0) With olMsg .To = "test@testing.com" '.CC = ...
30,890
<p>I have a table with almost 800,000 records and I am currently using dynamic sql to generate the query on the back end. The front end is a search page which takes about 20 parameters and depending on if a parameter was chosen, it adds an " AND ..." to the base query. I'm curious as to if dynamic sql is the right wa...
<p>It is more likely that your indexing (or lack thereof) is causing the slowness than the dynamic SQL.</p> <p>What does the execution plan look like? Is the same query slow when executed in SSMS? What about when it's in a stored procedure?</p> <p>If your table is an unindexed heap, it will perform poorly as the nu...
<p>I've had some success (in a limited number of instances) with the following logic:</p> <pre><code>CREATE PROCEDURE GetArticlesByAuthor ( @AuthorId int, @EarliestDate datetime = Null ) AS SELECT SomeColumn FROM Articles WHERE AuthorId = @AuthorId AND @EarliestDate is Null UNION SELECT ...
41,044
<p>Haven't done ASP.NET development since VS 2003, so I'd like to save some time and learn from other's mistakes.</p> <p>Writing a web services app, but not a WSDL/SOAP/etc. -- more like REST + XML. </p> <p>Which of the many "New Item" options (Web Form, Generic Handler, ASP.NET Handler, etc.) makes the most sense i...
<p>If you're not using the built in web services (<em>.asmx), then you should probably use a generic handler (</em>.ashx). </p>
<p>Probably MVC if you need rest.</p>
16,379
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/7094118/reference-comparing-phps-print-and-echo">Reference: Comparing PHP&#39;s print and echo</a> </p> </blockquote> <p>Is there any major and fundamental difference between these two functions in PHP?</p>
<p>From: <a href="http://web.archive.org/web/20090221144611/http://faqts.com/knowledge_base/view.phtml/aid/1/fid/40" rel="noreferrer">http://web.archive.org/web/20090221144611/http://faqts.com/knowledge_base/view.phtml/aid/1/fid/40</a></p> <ol> <li><p>Speed. There is a difference between the two, but speed-wise it sh...
<p>As the PHP.net manual suggests, take a read of <a href="http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40" rel="nofollow noreferrer">this discussion</a>.</p> <p>One major difference is that <code>echo</code> can take multiple parameters to output. E.g.:</p> <pre><code>echo 'foo', 'bar'; // Concatenates...
28,994
<p>Does anyone know of any 'standard' way to interface with a telephony system (think Cisco CCM) from a C/C++ app in *nix? I have used MS TAPI in the past but this is Windows only and don't want to go the jTAPI (Java) route, which seems to be the only option on the face of it.</p> <p>I want to monitor the phone syste...
<p>I have experience with two telephony standards TAPI, and CSTA, as far as I know there is no such agreement between vendors (e.g. Cisco, Nortel, NEC) regarding THE standard API.</p> <p>I would recommend looking at the availability of <a href="http://en.wikipedia.org/wiki/Call_detail_record" rel="nofollow noreferrer"...
<p>Here's another vote for SMDR. The telephony systems I've seen all offer the option of SMDR logging through a serial port on the phone box. Just capture the text from the serial port and parse it as needed.</p> <p>I wrote a server process that captures the SMDR output, parses it and saves the result in a database ...
11,175
<p>Would it be possible to execute a JSP page and capture its output outside of a web application? Mode specifically, in my case there still exists a usual web application, but it loads JSP pages not from its classpath, but from an arbitrary source. It seems like I cannot simply get RequestDispatcher and point it to ...
<p>I think you're better off with a templating engine like velocity. This provides a clean infrastructure for dynamic content that's clearly different from the jsp/servlet stuff that you are asking fore.</p> <p>That said, I've seen applications that copy jsps into their deployed directory in order for the container to...
<p>Correct me if I'm wrong, but I think you mean you want to capture the HTML... not the JSP. A JSP is processed (into a JAVA file) on a servlet-engine (Web app Server) and after the HTML is formatted and served up to the requestor via a Web server (not the same as a web APP server). You can't get the RequestDispatch...
23,740
<p>I am building a simple Django app that will use scribd to display documents. I would like to have a page where the administrator can upload documents to scribd through the website, since I need to know a few things about it before it gets to scribd. What is the best/easiest way to do this, display an upload page and...
<p>That is quite a few questions. </p> <p>Handling the file upload is pretty straight-forward with Django, see the <a href="http://docs.djangoproject.com/en/dev/topics/http/file-uploads/" rel="nofollow noreferrer">File Uploads documentation</a> for examples. In short you can access the uploaded file via <code>request....
<p>What you want to do (at least from what I read here and on the Django documentation site) is create a <a href="http://docs.djangoproject.com/en/dev/howto/custom-file-storage/#howto-custom-file-storage" rel="nofollow noreferrer">custom storage system.</a></p> <p>This should give you exactly what you need - it's the ...
30,480
<p>I'm downloading some images from a service that doesn't always include a content-type and doesn't provide an extension for the file I'm downloading (ugh, don't ask).</p> <p>What's the best way to determine the image format in .NET?</p> <p>The application that is reading these downloaded images needs to have a prop...
<p>A probably easier approach would be to use Image.FromFile() and then use the RawFormat property, as it already knows about the magic bits in the headers for the most common formats, like this:</p> <pre><code>Image i = Image.FromFile("c:\\foo"); if (System.Drawing.Imaging.ImageFormat.Jpeg.Equals(i.RawFormat)) M...
<p>Try loading the stream into a System.IO.BinaryReader. </p> <p>Then you will need to refer to the specifications for each image format you need, and load the header byte by byte to compare against the specifications. For example here are the <a href="http://www.libpng.org/pub/png/pngdocs.html" rel="nofollow norefe...
7,972
<p>Hi if I am creating something on the stack using new I declare it like:</p> <pre><code>object *myObject = new object(contr, params); </code></pre> <p>Is there a way to declare this such as:</p> <pre><code>object *myObject; myObject = new object(constr, params); </code></pre> <p>Is this correct?</p>
<p>Yes, that is correct. But new does not create things on the stack, it creates them on the heap.</p> <p>To create object on the stack you would do:</p> <pre><code>object myObject(constr, params); </code></pre> <p>There is no other way to create an object on the stack and once it is created on the stack you can't ...
<p>This code:</p> <pre><code>object *myObject; myObject = new object(constr, params); </code></pre> <p>...is legal &amp; correct. But please <strong>please</strong> initialize myObject to something when you allocate it. Remember 'myObject' is itself not an instance of the 'object', but an instance of a <em>pointer<...
41,327
<p>Just forgot the command which I used to execute at DOS Prompt to list all running CLR instances on a Machine. Anyone remembers it??</p>
<p><strong>tasklist /m mscor*</strong></p> <p>tasklist /m mscor* will show processes that have loaded modules (usaully .DLL files) hosting the .NET runtime. The same technique can be used to search for other DLLs that have been loaded.</p> <p>On a related note, <a href="http://technet.microsoft.com/en-us/sysinternals...
<p>I have got it - it is tasklist /m mscor*</p>
34,596
<p>Using Morph Labs' Appspace to deploy a site means no automated way to redirect 'myapp.com' to 'www.myapp.com' (and no access to .htacess).</p> <p>Is there an in-rails way to do this? Would I need a plugin like <a href="http://github.com/mbleigh/subdomain-fu/tree/master" rel="nofollow noreferrer">subdomain-fu</a>?</...
<p>Maybe something like this would do the trick:</p> <pre><code>class ApplicationController &lt; ActionController::Base before_filter :check_uri def check_uri redirect_to request.protocol + "www." + request.host_with_port + request.request_uri if !/^www/.match(request.host) end end </code></pre>
<p>Here is a couple of different ways:</p> <pre><code> head :moved_permanently, :location =&gt; ‘http://www.newdomain.com’ </code></pre> <p>another:</p> <pre><code>def rails_301 headers["Status"] = "301 Moved Permanently" redirect_to "http://www.newdomain.com" end </code></pre>
42,385
<p>I'm not clear on the differences between the "current" version of Ruby (1.8) and the "new" version (1.9). Is there an "easy" or a "simple" explanation of the differences and why it is so different?</p>
<p>Sam Ruby has a <a href="http://slideshow.rubyforge.org/ruby19.html" rel="noreferrer">cool slideshow that outline the differences</a>.</p> <p>In the interest of bringing this information inline for easier reference, and in case the link goes dead in the abstract future, here's an overview of Sam's slides. The slides...
<p>Some more changes:</p> <p><strong>Returning a splat singleton array:</strong></p> <pre><code>def function return *[1] end a=function </code></pre> <ul> <li>ruby 1.9 : [1]</li> <li>ruby 1.8 : 1</li> </ul> <p><strong>array arguments</strong></p> <pre><code>def function(array) array.each { |v| p v } end funct...
4,171
<p>Is there an easy way to convert the number 1, 2, 3, ... to "1st", "2nd", "3rd", ..., and in such a way that I can give the function a language and have it return me the correct form for the language I'm targeting? Either standard C++ (stl or boost OK), MFC or ATL, win32 api or a small, single-purpose and free librar...
<p>I doubt whether it is possible at all, since in many languages this form will depend on the context, like gender or case of the noun it describes and different languages will require different kind of context information to allow to determine the correct form.</p> <p>EDIT: E.g. in Polish it is "5-ta klasa" (5th cla...
<p><a href="http://www.codeproject.com/KB/cpp/number_to_text_converter.aspx" rel="nofollow noreferrer">Here</a> is the piece of code on CodeProject that does the job. Haven't tried it on my own.</p>
16,461
<p>I have a C#.net winform program which runs with a SQL Server database. I am using LINQ-to-SQL. Is it possible to rollback the call to one or more stored procedures inside a transaction within my program using LINQ-to-SQL? </p> <p>Initially I thought it would make sense to manage the transaction inside the stored...
<p>Another alternative to <code>DbTransaction</code> is <a href="http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope(VS.85).aspx" rel="nofollow noreferrer"><code>TransactionScope</code></a> - this provides a much simpler programming model, and is extensible to multiple simultaneous databases an...
<p>Although I'm not using stored procs, you coudl have something like that:</p> <pre><code> public Response&lt;SomeObject&gt; SaveSomething(Object yourObject) { DbTransaction dbTransaction = null; try { using (DataContext context = new DataContext()) { ...
39,599
<p>I hope this question is not considered too basic for this forum, but we'll see. I'm wondering how to refactor some code for better performance that is getting run a bunch of times.</p> <p>Say I'm creating a word frequency list, using a Map (probably a HashMap), where each key is a String with the word that's being ...
<h2>Some test results</h2> <p>I've gotten a lot of good answers to this question--thanks folks--so I decided to run some tests and figure out which method is actually fastest. The five methods I tested are these:</p> <ul> <li>the "ContainsKey" method that I presented in <a href="https://stackoverflow.com/questions/81...
<p>Since a lot of people search Java topics for Groovy answers, here's how you can do it in Groovy:</p> <pre><code>dev map = new HashMap&lt;String, Integer&gt;() map.put("key1", 3) map.merge("key1", 1) {a, b -&gt; a + b} map.merge("key2", 1) {a, b -&gt; a + b} </code></pre>
10,698
<p>I have a VmWare virtual machine that is coming dangerously close to it's primarry HDD's limit and I need to extend it. How do I do this? I'm working with VmWare Workstation 6.0.5</p>
<p><a href="http://www.seandeasy.com/expanding-a-drive-within-a-vmware-image/" rel="nofollow noreferrer">This link</a> gives two approaches that should help.</p> <p>It looks like this is the most straightforward method:</p> <pre><code>vmware-vdiskmanager -x 12GB path\to\disk.vmdk </code></pre> <p>where 12GB is the d...
<p>Assuming this is under Windows, there is a program usually in "C:\Program Files\VMWare\VMware Workstation\" called vmware-vdiskmanager.exe that you can use to do this. Open a DOS prompt and CD to that directory. The command to expand the drive is:</p> <pre><code>vmware-vdiskmanager.exe -x 50Gb NameOfDisk.vmdk </cod...
13,098
<p>Was looking for some approaches to incrementally converting an large existing ASP.NET VB.NET project to C# while still being able to deploy it as a single web application (currently deployed on a weekly basis). </p> <p>My thoughts were to just create a new C# ASP.NET project and slowly move pages over, but I've ne...
<p>Start with the business logic and work your way out to the pages. Encapsulate everything you can into C# libraries that you can add as references to the VB.NET site.</p> <p>Once you've got all of your backend ported over and tested, you can start doing individual pages, though I would suggest that you not roll out...
<p>It can be done. Well I hope it can be done as I am doing this bit by bit on a legacy ASP.net application. You could just change over 1 Webform at a time. Where you may struggle is that I can't seem to have mixed languages in the app code folder as they are compiled together.</p>
11,819
<p>Is there any method? My computer is AMD64.</p> <pre><code>::std::string str; BOOL loadU(const wchar_t* lpszPathName, int flag = 0); </code></pre> <p>When I used: </p> <pre><code>loadU(&amp;str); </code></pre> <p>the VS2005 compiler says:</p> <pre><code>Error 7 error C2664:: cannot convert parameter 1 from 'std:...
<p>If you have a std::wstring object, you can call <code>c_str()</code> on it to get a <code>wchar_t*</code>:</p> <pre><code>std::wstring name( L"Steve Nash" ); const wchar_t* szName = name.c_str(); </code></pre> <p>Since you are operating on a narrow string, however, you would first need to widen it. There are vari...
<p>You can use the ATL text conversion macros to convert a narrow (char) string to a wide (wchar_t) one. For example, to convert a std::string:</p> <pre><code>#include &lt;atlconv.h&gt; ... std::string str = "Hello, world!"; CA2W pszWide(str.c_str()); loadU(pszWide); </code></pre> <p>You can also specify a code page...
30,639
<p>I have a 3 table SQLServer Database.</p> <pre><code>Project ProjectID ProjectName Thing ThingID ThingName ProjectThingLink ProjectID ThingID CreatedDate </code></pre> <p>When a Thing is ascribed to a Project an entry is put in the ProjectThingLink table. Things can move between Projects. The CreatedDate is used to...
<pre><code>select p.projectName, t.ThingName from projects p join projectThingLink l on l.projectId = p.projectId join thing t on t.thingId = l.thingId where l.createdDate = ( select max(l2.createdDate) from projectThingLink l2 where l2.thingId = l.thingId ); </code></pre> <p>NOTE: Corrected after comment</p>
<p>You can simply do</p> <pre><code>SELECT Project.projectId, Project.ProjectName, ThingName FROM Project INNER JOIN ProjectThingLink ON Project.ProjectID = ProjectThingLink.ProjectID INNER JOIN Thing ON ProjectThingLink.ThingID = Thing.ThingID </code></pre> <p>Will will get a list of every pro...
49,040
<p>Im thinking of updating my practices, and looking for a little help and advice!</p> <p>I do a lot of work on sites that run joomla, oscommerce, drupal etc and so I have created a lot of custom components/plugins and hacks etc. Currently each site has its own folder on my xampp setup. What I would like to do is hav...
<p>Yes, SVN would be a great tool for this purpose. Store your code (eg: a custom Joomla component) in source control. Wherever you want to use that component, just do a <code>checkout</code> or <code>export</code> of that particular folder into your live site. Here's one way you could structure your repository:</p> <...
<p>I don't have a good answer for your situation, but I don't think Subversion by itself is the answer.</p> <p><a href="https://stackoverflow.com/questions/249085/shared-components-throughout-all-projects-is-there-a-better-alternative-than-sv#249146">This Question</a> addresses some of the concerns about Subversion's ...
32,141
<p>I have a list of more than 15 thousand latitude and longitude coordinates. Given any X,Y coordinates, what is the fastest way to find the closest coordinates on the list?</p>
<p>You will want to use a geometric construction called a <a href="http://mathworld.wolfram.com/VoronoiDiagram.html" rel="nofollow noreferrer">Voronoi diagram</a>. This divides up the plane into a number of areas, one for each point, that encompass all the points that are closest to each of your given points.</p> <p>T...
<p>Even if you create a voronoi diagram, that still means you need to compare your x, y coordinates to all 15 thousand created areas. To make that easier, the first thing that popped into my mind though was to create some sort of grid over the possible values, so that you can easily place and x/y coordinate into one of...
5,645
<p>What platforms and tools should I use for rapid game development and prototyping?</p> <p>Say that I have an idea for a simple game or a game mechanic that I want to try out, what are the best tools for quickly creating something playable that I can experiment with to try out the idea?</p> <p>The platform does not ...
<p><a href="http://www.adobe.com/products/flash/" rel="noreferrer">Flash</a> or <a href="http://www.yoyogames.com/gamemaker" rel="noreferrer">Game Maker</a> for 2D games. <a href="http://unity3d.com/" rel="noreferrer">Unity</a> for 3D games.</p>
<p>If you like dynamic languages try out <a href="http://www.pygame.org" rel="nofollow noreferrer">Pygame</a>? Plus i think you can target OpenGL with this one too...depends on what you are looking at. XNA Game Studio is great...or u wana look at some Mac software</p>
40,257
<p>By default, Eclipse won't show my .htaccess file that I maintain in my project. It just shows an empty folder in the Package Viewer tree. How can I get it to show up? No obvious preferences.</p>
<p>In the package explorer, in the upper right corner of the view, there is a little down arrow. Tool tip will say view menu. From that menu, select filters</p> <p><img src="https://i.stack.imgur.com/NWo2x.jpg" alt="filters menu"></p> <p>From there, uncheck .* resources.</p> <p>So <code>Package Explorer -&gt; View M...
<p>If you're using Eclipse PDT, this is done by opening up the PHP explorer view, then clicking the upside-down triangle in the top-right of that window. A context window appears, and the filters option is available there. Clicking the Filters menu option opens a new window, where .* files can be unchecked, thus allowi...
12,394
<p>I have ASP.NET web pages for which I want to build automated tests (using WatiN &amp; MBUnit). How do I start the ASP.Net Development Server from my code? I do not want to use IIS.</p>
<p>From what I know, you can fire up the dev server from the command prompt with the following path/syntax:</p> <pre><code>C:\Windows\Microsoft.NET\Framework\v2.0.50727\Webdev.WebServer.exe /port:[PORT NUMBER] /path: [PATH TO ROOT] </code></pre> <p>...so I could imagine you could easily use Process.Start() to launch ...
<p>You can easily use <strong>Process Explorer</strong> to find complete command line options needed for manually start it. Start Process Explorer while debugging your website. For VS2012, expand 'devenv.exe' node. Right-click on 'WebDev.WebServer20.exe' and from there you can see Path and Command Line values.</p>
8,129
<p>I have a simple Python script that I want to stop executing if a condition is met.</p> <p>For example:</p> <pre><code>done = True if done: # quit/stop/exit else: # do other stuff </code></pre> <p>Essentially, I am looking for something that behaves equivalently to the 'return' keyword in the body of a fun...
<p>To exit a script you can use,</p> <pre><code>import sys sys.exit() </code></pre> <p>You can also provide an exit status value, usually an integer.</p> <pre><code>import sys sys.exit(0) </code></pre> <p>Exits with zero, which is generally interpreted as success. Non-zero codes are usually treated as errors. The...
<p>exit() should do the trick</p>
21,630
<p>I need to design a small project for generating excel reports in .NET, which will be sent to users to use.</p> <p>The excel reports will contain PivotTables.</p> <p>I don't have much experience with them, but I can think of three implementation alternatives:</p> <ol> <li>Set a query for it, populate it, send it d...
<p><strong>PHP sample</strong>:</p> <pre><code>$string = "A man, a plan, a canal, Panama"; function is_palindrome($string) { $a = strtolower(preg_replace("/[^A-Za-z0-9]/","",$string)); return $a==strrev($a); } </code></pre> <p>Removes any non-alphanumeric characters (spaces, commas, exclamation points, etc.)...
<p>Another one from Delphi, which I think is a little more rigorous than the other Delphi example submitted. This can easily turn into a golfing match, but I've tried to make mine readable.</p> <p><em>Edit0: I was curious about the performance characteristics, so I did a little test. On my machine, I ran this functi...
7,524
<p>I am using wxWidgets and Visual C++ to create functionality similar to using Unix "tail -f" with rich formatting (colors, fonts, images) in a GUI. I am targeting both wxMSW and wxMAC.</p> <p>The obvious answer is to use wxTextCtrl with wxTE_RICH, using calls to wxTextCtrl::SetDefaultStyle() and wxTextCtrl::WriteTe...
<p>Have you considered limiting the amount of lines in the view? When we had a similar issue, we just made sure never more than 10,000 lines are in the view. If more lines come in at the bottom we remove lines at the top. This was not using WxWidgets, it was using a native Cocoa UI on Mac, but the issue is the same. If...
<p>Sounds like the control you are using is simply not built for the amount of data you are throwing at it. I would consider building a custom control. Here's some things you could take into account:</p> <ol> <li>When a new line comes in, you don't need to re-render the previous lines... they don't change and the la...
17,940
<p>Is there a way to have a RewriteRule fire on any domain that is requested on a box? For example, I have 5 VirtualHosts that would have the exact same RewriteRule applied to them and currently each VirtualHost directive has the rule, but can I put this somewhere 'global' so that upkeep is easier?</p>
<p>No, I'm afraid not</p>
<p>You can, but it is somewhat of a hack. Create your RewriteRule in a .htaccess somewhere like:</p> <blockquote> <p>/www/redirects/global/.htaccess</p> </blockquote> <p>Now just set the DocumentRoot for your virtualhosts to /www/redirects/global/ and every request will be forced through your RewriteRule's.</p>
24,693