instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>From what I gather, Google Chrome can run browser plugins written using <a href="http://en.wikipedia.org/wiki/NPAPI" rel="nofollow noreferrer">NPAPI</a>. </p>
<p>I've written one that does its job just fine in Firefox, but makes Chrome crash and burn as soon as you embed it on a page. I don't even have to call any ... | <p>As it turns out, part of the initialization code from the old NPAPI plugin example I was using caused the crash. I'm sorry to say I solved this quite a while back and can't seem to locate the specific modifications I made to fix it in the version control history. Anyway, my problem is fixed and was caused by me bein... | <p>Chrome is open-source... have you tried downloading the source and building it? That way, you at least can point your IDE to the source code tree and have it auto-attach when it crashes, which can give you a bit more information as to what happened.</p>
<p>This won't solve your bug, of course, but it might help yo... | 38,818 |
<p>I'm in a situation where I have the class "progress" - trouble is that I'm interested in incorporating some open source that also has the class "progress". I remember very vaguely some reference to an app that's able to inspect the various files in a development for a given class name ... and either return it ... or... | <p>Some languages (C++, C#) have a notion of namespace. Java has packages. Python has modules. They are desgined to prevent class name collision. Assume you're talking about Java, the Open Source class called "Progress" probably is in its own package, and your "Progress" is in your own package. So maybe you are no... | <p>Many IDEs (e.g. Eclipse) can do this, but it's more common for Java then PHP. Because of the dynamic nature of PHP variables, it's a little harder for IDEs to know exactly what to change. For example, you could do this:</p>
<pre><code>$name = "prog";
$name .= "ress";
$cls = new $name();
</code></pre>
<p>The IDE wo... | 48,278 |
<p>A couple of days ago I got my first 3D printer: Creality 3D Ender 3 Pro. I finished assembling it last night. I booted it up, but ran into problems (which I guess is not a common thing for a beginner in 3D printing). After booting and running the motors, it seemed that the lead screw got stuck about halfway down the... | <p>The threads of the screw are very damaged, this causes your brass nut to be damaged as well.</p>
<p>This is hardly accountable by misusage, this is a production or handling error in the factory.</p>
<p>You need to contact the vendor for a new screw and new threaded brass nut.</p>
<p>Although the nut is softer and ma... | <p>Both of the above answers are likely correct <strong>but also,</strong> I own an Ender 3 and it's kinda/sorta tricky to get it set up right. I had a similar problem and I was certain it was the lead screw -- and mine indeed does not have the marks that yours has -- but in the end the issue was that I had assembled ... | 2,183 |
<p>Is there a good .NET file syncing library? It can be pretty basic and only needs to work on local and mapped drives (no server client model like rsync is needed).</p>
<p>And yes, I know there is the MS Sync Services, but that is <em>a lot</em> more than what I need. </p>
| <p>Can you put something together yourself based on the FileSystemWatcher component, or are you looking for something more complete?</p>
| <p>Microsoft's SyncToy tool installs an API that you can call from your code, according to the article at:</p>
<p><a href="http://www.codeproject.com/KB/vb/SyncToy_Helper.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/vb/SyncToy_Helper.aspx</a></p>
| 18,122 |
<p>I would like to do the equivalent of:</p>
<pre><code>object result = Eval("1 + 3");
string now = Eval("System.DateTime.Now().ToString()") as string
</code></pre>
<p>Following Biri s <a href="http://www.codeproject.com/KB/cs/evalcscode.aspx" rel="noreferrer">link</a>, I got this snippet (modified to remove obsol... | <p>I have written an open source project, <a href="https://github.com/davideicardi/DynamicExpresso/" rel="noreferrer">Dynamic Expresso</a>, that can convert text expression written using a C# syntax into delegates (or expression tree). Text expressions are parsed and transformed into <a href="http://msdn.microsoft.com/... | <p>Looks like there is also a way of doing it using RegEx and XPathNavigator to evaluate the expression. I did not have the chance to test it yet but I kind of liked it because it did not require to compile code at runtime or use libraries that could not be available.</p>
<p><a href="http://www.webtips.co.in/c/evaluat... | 7,744 |
<p>I am attempting to have a ReportHandler service to handle report creation. Reports can have multiple, differing number of parameters that could be set. In the system currently there are several different methods of creating reports (MS reporting services, html reports, etc) and the way the data is generated for ea... | <p>From your description, if you're looking for a pattern that matches better than Factory, try Strategy:</p>
<p><a href="http://en.wikipedia.org/wiki/Strategy_pattern" rel="nofollow noreferrer">Strategy Pattern</a></p>
<ol>
<li>Your <strong>context</strong> could be a custom class which encapsulates and abstracts th... | <p>We had a similar problem and went with the concept of "connectors" that are interfaces between the main report generator application and the different report engines. By doing this, we were able to create a "universal report server" application. You should check it out at www.versareports.com.</p>
| 23,272 |
<p>Consider the following code and its output:</p>
<h3>Code</h3>
<pre><code>#!/usr/bin/perl -w
use strict;
use Data::Dumper;
my $HOURS_PER_DAY = 24.0 * 1.0;
my $BSA = 1.7 * 1.0;
my $MCG_PER_MG = 1000.0 * 1.0;
my $HOURS_DURATION = 20.0 * $HOURS_PER_DAY;
my $dummy = $HOURS_PER_DAY * $BSA * $MCG_PER_MG * $HOURS_DURAT... | <p>Data::Dumper's job is to serialize data and you can't tell much about what perl is doing internally with the data based on its output. The <a href="http://search.cpan.org/perldoc?Devel::Peek" rel="noreferrer">Devel::Peek</a> module can dump the underlying flags and values stored in the variables. The Devel::Peek POD... | <p>Quick dirty way to force a numeric context:</p>
<pre>
print Dumper( $HOURS_DURATION + 0.0 );
</pre>
<p>If your concern is how the data will be displayed then the clean way is:-</p>
<pre>
printf "%5.2d",$HOURS_DURATION;
</pre>
| 42,856 |
<p>I am having some problems with events being raised from the non-UI thread, in that i dont wish to have to handle the If me.invokerequired on every event handler added to the thread in Form1.</p>
<p>I am sure i have read somewhere how to use a delegate event (on SO) but i am unable to find it.</p>
<pre><code>Public... | <p>You derived your class from Control. A bit unusual, but if the control is actually hosted on a form, you can use Me.Invoke() to marshal the call. For example:</p>
<pre><code> Private Delegate Sub SomethingHappenedDelegate(ByVal result As Integer)
Private Sub Work()
For i As Integer = 0 To 10
Me.Invo... | <p>If you want to simplify all of this there is a class available called BackgroundWorker that handles the GUI thread marshaling for you.</p>
| 37,348 |
<p>Stackoverflow User <a href="https://stackoverflow.com/users/17602/luke">Luke</a> wrote in <a href="https://stackoverflow.com/questions/138761/web-applications-desktop-applications#171113">this answer</a>:</p>
<blockquote>
<p>The boundaries between desktop and web
applications have really blurred.
Whilst once ... | <p>The thing you'll never be able to imitate in a web application is the low latency and instant feedback of a well written desktop app. </p>
<p>Even with the ajax techniques to load only parts of the pages, there usually is a noticeable delay in the response (or maybe it's just me and my narrowband). You're (for at l... | <p>Blue Screen of Death</p>
| 48,479 |
<p>The RFC for a Java class is set of all methods that can be invoked in response to a message to an object of the class or by some method in the class.
RFC = M + R where
M = Number of methods in the class.
R = Total number of other methods directly invoked from the M.</p>
<p>Thinking C is the .class and J is the .j... | <p>You could use the <a href="http://jakarta.apache.org/bcel/index.html" rel="nofollow noreferrer">Byte Code Engineering Library</a> with binaries. You can use a <a href="http://jakarta.apache.org/bcel/apidocs/org/apache/bcel/classfile/DescendingVisitor.html" rel="nofollow noreferrer">DescendingVisitor</a> to visit a c... | <p>You should find your answer in the <a href="http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html" rel="nofollow noreferrer">Java language specification</a>.</p>
<p>You have forgot static method call, method call inside parameters...</p>
| 4,029 |
<p>Is it possible to detect the HTTP request method (e.g. GET or POST) of a page from JavaScript? If so, how?</p>
| <p>In a word - No</p>
| <p>Try this
</p>
<pre><code>function getURIQueryString(){
var params = {};
var qstring = window.location.toString().substring(window.location.toString().indexOf("?") + 1);
var regex = /([^&=]+)=([^&=]+)/g;
var m;
while (m = regex.exec(qstring)){
params[decodeURIComponent(m[1])] = de... | 14,744 |
<p>Does anyone have experience with a query language for the web?</p>
<p>I am looking for project, commercial or not, that does a good job at making a webpage queryable and that even follows links on it to aggregate information from a bunch of pages.</p>
<p>I would prefere a sql or linq like syntax. I could of course... | <p>See <a href="http://code.whytheluckystiff.net/hpricot/" rel="nofollow noreferrer">hpricot</a> (a Ruby library).</p>
<pre><code># load the RedHanded home page
doc = Hpricot(open("http://redhanded.hobix.com/index.html"))
# change the CSS class on links
(doc/"span.entryPermalink").set("class", "newLinks")
# remove the... | <p>I'm not sure whether this is exactly what you're looking for, but <a href="http://freebase.com" rel="nofollow noreferrer">Freebase</a> is an open database of information with a programmatic query interface.</p>
| 26,508 |
<p>I have a little problem with a Listview.</p>
<p>I can load it with listview items fine, but when I set the background color it doesn't draw the color all the way to the left side of the row [The listViewItems are loaded with ListViewSubItems to make a grid view, only the first column shows the error]. There is a a... | <p>Ah! I see now :}</p>
<p>You want hacky? I present unto you the following:</p>
<pre><code> ...
lv.OwnerDraw = true;
lv.DrawItem += new DrawListViewItemEventHandler( lv_DrawItem );
...
void lv_DrawItem( object sender, DrawListViewItemEventArgs e )
{
Rectangle foo = e.Bounds;
foo.Offset( -10,... | <p>Ok I'm adding some additional solution notes. If you use the solution above you also need to insert a draw handler for the column headers, otherwise they won't paint. The selected item rectangle also looks funny so you'll want to check for that in the lv_DrawItem function and implement a similar solution. Remeber ... | 8,517 |
<p>I'm trying to get some code working that a previous developer has written.
Yep, he now left the company. :-(</p>
<p>I have a JSON RPC call being made from the JS code.
The JS all runs fine and the callback method gets an object back (not an error object).</p>
<p>But the method on the Java class never gets hit.
The... | <p>You forgot to include the javascript code. From the example:</p>
<pre><code><s:url id="smdUrl" namespace="/nodecorate" action="SMDAction" />
<script type="text/javascript">
//load dojo RPC
dojo.require("dojo.rpc.*");
//create service object(proxy) using SMD (generated by the json result)
... | <p>I'm guessing that you need to update the <code>smd()</code> method to actually call <code>updateRowValueForField()</code> rather than simply return immediately. Looks like the previous developer never actually hooked up the methods.</p>
| 26,959 |
<p>I'm currently writing an app for a Windows Mobile 5.0 app and it seems to possess some firewall-esqe feature where I need to permit the running of any deployed executable. Is there some kind of registry key I can use to turn this off during development as it's frustrating having to babysit the device.</p>
| <p>Try removing any 'empty space' from the body. Shrink the editing surface to be just large enough for all your ReportItems, both height-wise and width-wise. ReportingServices thinks the space you have in your body is intentional, so it's preserved.</p>
<p>If that doesn't help and you're noticing this issue on 2005... | <p>use <code>ConsumeContainerWhitespace</code> to <code>TRUE</code> in the Report Properties its <code>FALSE</code> by default</p>
| 44,780 |
<p>The code below crashes IE6 for some reason. Much as IE is god-awful, i have never seen this before. Does anyone have any ideas?</p>
<pre><code><div id="edit">
<?php
$a = $_POST['category'];
if ($a == "")
{
$a = $_GET['category'];
}
$result = mysql_query("SELECT * FROM media WHERE related_page_id = $... | <p>I don't know if it's the reason for the crash, but the <code>td</code> tag in the line</p>
<pre><code>echo "<td><a href='addimage.php?id=$row[id]&&category=$a'>Add image/file</a>";
</code></pre>
<p>is not closed. Also:</p>
<pre><code></div>
</div>
</div>
</table>
... | <p>The generated code doesn't crash IE6 for me. It could probably be one of your stylesheets or javascript though, or maybe it's just my setup (IE6 is used as a standalone browser here).</p>
<p>Also, why do you have those double ampersands? Are you sure you don't want to use <code>&amp;</code> instead?</p>
| 23,138 |
<p>Our web team has been asked to build some user interfaces in Sharepoint. The UI's would primarily be forms that would need to write to a SQL Server database.</p>
<p>Is ASP.NET the best way to do this? If so what's the best way to integrate the ASP.NET application into Sharepoint?</p>
| <p>You have 4 options:</p>
<pre><code>1. Build web parts
2. build user controls , and use smart part to display them.
3. use infopath
4. host the asp.net in an iframe (page viewer web part).
</code></pre>
<p>I would go with building web parts, however user controls and smart part are probably quicker, and quickest ... | <p>I would combine 1 and 2 of Mauro's answer. Wrap up your user control in your own web part.</p>
| 39,892 |
<p>I am having an issue with IEMobile accessing my site. A certain redirect I use has a 302 response code, and the headers (yep, that's app-engine):</p>
<pre>Server Development/1.0 Python/2.5.2
Date Tue, 04 Nov 2008 16:47:02 GMT
Content-Type text/html; charset=utf-8
Cache-Control no-cache
Locatio... | <p>You have a few options:</p>
<ol>
<li><p><strong>GLIBC-specific solution (mostly Linux).</strong> If your compilation environment is <code>glibc</code> with <code>gcc</code>, the preferred way is to use <a href="http://www.gnu.org/software/libtool/manual/libc/Hooks-for-Malloc.html" rel="noreferrer">malloc hooks</a>.... | <p>If you are using Linux, you can use malloc_hook() (with GNU glibc). This function allows you to have malloc call your function prior to calling the actual malloc. The man page has an example on how to use it.</p>
| 32,851 |
<p>With our next major release we are looking to globalize our ASP.Net application and I was asked to think of a way to keep track of what code has been already worked on in this effort. </p>
<p>My thought was to use a custom Attribute and place it on all classes that have been "fixed".</p>
<p>What do you think? </p... | <p>Using an attribute to determine which classes have been globalized would then require a tool to process the code and determine which classes have and haven't been "processed", it seems like it's getting a bit complicated.</p>
<p>A more traditional project tracking process would probably be better - and wouldn't "po... | <p>What about just counting or listing the classes and then work class by class? While an attribute may be an interesting idea, I'd regard it as over-engineered. Globalizing does nothing more than, well, going through each class and globalizing the code :)</p>
<p>You want to finish that anyway before the next release.... | 18,127 |
<p>I'm calling some code that uses the BitmapData class from .NET. I've hit something where I can't find a definitive answer on Googlespace.</p>
<p>Because it seems that LockBits and UnlockBits must always be called in a pair, I'm using this:</p>
<pre><code> System.Drawing.Imaging.BitmapData tempImageData = t... | <p>The try-finally pattern is correct. Since this is external code, you have no control over what exceptions are thrown, and the UnlockBits cleanup code needs to be executed regardless of what error has occurred.</p>
| <p>Are you expecting some sort of exception to be thrown? If you are, can you catch it? If not, then I don't see the point of the try/finally.</p>
<p>There's also differing philosophies on exceptions. Personally, I think of them as being 'exceptional'-- like the power went out when your last file write took place, ... | 16,211 |
<p>I'm developing a restful Web service that runs as a servlet (using blocking IO) in Jetty. Figuring out the optimal setting for max threads seems hard.</p>
<p>Is there a researched formula for deciding the max number of threads from some easily measurable characteristics of the rest of the setup?</p>
| <p>Very simple and primitive one:</p>
<p>max_number_of_threads = number_of_CPUs * C</p>
<p>Where C depends on other factors of your application :-)</p>
<p>Ask yourself following questions:</p>
<ul>
<li>Will your application be CPU intensive (lower C) or spend most time waiting for a third systems (higher C)?</li>
<... | <p>The answer depends on the maximum number of simultaneous connections you expect to handle. You should allow as many threads as connections you expect.</p>
<p>andreasmk2 is incorrect about the number of threads. I've run apps with 1000 threads and had no issue with system resources; of course it depends on the speci... | 12,635 |
<p>How would you create a database in Microsoft Access that is searchable only by certain fields and controlled by only a few (necessary) text boxes and check boxes on a form so it is easy to use - no difficult queries?</p>
<p>Example:
You have several text boxes and several corresponding check boxes on a form, and w... | <p>My own solution is to add a "filter" control in the header part of the form for each of the columns I want to be able to filter on (usually all ...). Each time such a "filter" control is updated, a procedure will run to update the active filter of the form, using the "BuildCriteria" function available in Access VBA.... | <p>For a question that vague, all that I can answer is open MS Access, and click the mouse a few times.</p>
<p>On second thought:<br>
Use the "WhereCondition" argument of the "OpenForm" method</p>
| 9,811 |
<p>In this abbreviated code, the inline event works - the "event" is passed to the testKeyPress function </p>
<pre><code><textarea id="source"
onkeydown= "showCursPos(this);
var tf=testKeyPress(event);
document.onkeypress=function(){return tf};
document.onkeydown=function(){return tf}; " ></... | <p>Yes, there is an event object as arguments.</p>
<p>You can get it by </p>
<pre><code>var e=arguments[0] || event; // Firefox via the argument, but IE don't
</code></pre>
<p>I don't know if they exact the same, but I read <code><xxx onkeydown="func(event);"></code> as <code>xxx.ononkeydown=function(event){fu... | <p>Worked like a charm. This modification to my original code successfully passes the event from the anonymous function to the named function in my four browsers: IE6, FF2, NS7.2, OP9.22</p>
<pre><code>$("source").onkeydown = function(){
var e=arguments[0] || event;
showCursPos(this);
var tf=testKeyPre... | 42,302 |
<p>Part of my latest webapp needs to write to file a fair amount as part of its logging. One problem I've noticed is that if there are a few concurrent users, the writes <em>can</em> overwrite each other (instead of appending to file). I assume this is because of the destination file can be open in a number of places a... | <p>Directory operations are <em>NOT</em> atomic under NFSv2 and NFSv3
(please refer to the book 'NFS Illustrated' by Brent Callaghan,
ISBN 0-201-32570-5; Brent is a NFS-veteran at Sun).</p>
<p>NFSv2 has two atomic operations:</p>
<ul>
<li>symlink</li>
<li>rename</li>
</ul>
<p>With NFSv3 the create call is also atomi... | <p>Should just use memcache add and avoid a race condition.</p>
<pre><code>if ($memcache->add($filename, 1, 1))
{
$memcache->delete($filename);
}
</code></pre>
| 26,873 |
<p>Is there a pure .net way to do this reliably? The solutions I keep finding either require guessing or they have a solution that is specific to a database provider. Usually querying some internal system table to get this information.</p>
| <p>Each DataTable object has a PrimaryKey property wich is an array of DataColumns that represent the table's primary key.</p>
<p>For example:</p>
<pre><code>string[] GetPrimaryKeys(SqlConnection connection, string tableName)
{
using(SqlDataAdapter adapter = new SqlDataAdapter("select * from " + tableName, connec... | <p>just tagging onto this query. is there a way in ADO.Net to get a generic (i.e. database vendor independent) schema extracted from a selection of tables. i'm thinking along the lines of not only column names, types and primary keys (which i know is fairly easy to get) but also the foreign keys collections. i can do a... | 48,673 |
<p>I've implemented a .NET Web control that uses the callback structure implemented in ASP.Net 2.0. It's an autodropdown control, and it works correctly in IE 6.0/7.0 and Google Chrome. Here's the relevant callback function:</p>
<pre><code>function ReceiveServerData(args, context)
{
document.getElementById(context).... | <p>For what it's worth, the MS AJAX Function.createCallback() doesn't seem to work correctly in FireFox. See this post here, with repro code:</p>
<p><a href="https://stackoverflow.com/questions/969326/function-createcallback-doesnt-pass-context-correctly-in-firefox/969362#969362">Function.createCallback doesn't p... | <p>I am not sure if this would help but I have patched the ASP.NET 2.0 callbacks like this (minified code):</p>
<pre><code>function WebForm_CallbackComplete()
{
for(var i=0; i< __pendingCallbacks.length;i++)
{
var _f3=__pendingCallbacks[i];
if(_f3 && _f3.xmlRequest && (_f3.xm... | 26,217 |
<p>I have a large amount of rows in the database from which I need to create an XML document. I am using hibernate 3. The basic list() method in Criteria and Query interfaces looks dangerous: I quess it pretty much has to read all the records into memory even if I only iterate over them. Or is there some lazy loading m... | <p>Try using scroll() in conjunction with this:</p>
<p><a href="http://docs.jboss.org/hibernate/core/3.3/api/org/hibernate/StatelessSession.html" rel="nofollow">http://docs.jboss.org/hibernate/core/3.3/api/org/hibernate/StatelessSession.html</a></p>
<p>A command-oriented API for performing bulk operations against a d... | <p>Also, have a look at batch fetching Section 19.1.4 and 19.1.5 should do.
<a href="http://www.hibernate.org/hib_docs/v3/reference/en-US/html_single/#queryhql-joins-forms" rel="nofollow noreferrer">http://www.hibernate.org/hib_docs/v3/reference/en-US/html_single/#queryhql-joins-forms</a></p>
| 37,539 |
<p>I am having a problem displaying a Javascript string with embedded Unicode character escape sequences (\uXXXX) where the initial "\" character is itself escaped as "&#92;"
What do I need to do to transform the string so that it properly evaluates the escape sequences and produces output with the correct Unicode ... | <p>As it turns out, it's unescape() we want, but with '%uXXXX' rather than '\uXXXX':</p>
<p>unescape(yourteststringhere.replace(/&#92;/g,'%'))</p>
| <p>I'm not sure if this is it, but the answer might have something to do with eval(), if you can trust your input.</p>
| 34,654 |
<p>When designing a file format for recording binary data, what attributes would you think the format should have? So far, I've come up with the following important points:</p>
<ul>
<li>have some "magic bytes" at the beginning, to be able to recognize the files (in my specific case, this should also help to distinguis... | <p>Take a look at the <a href="http://www.w3.org/TR/PNG/" rel="noreferrer">PNG spec</a>. This format has some very good rationale behind it.</p>
<p>Also, decide what's important for your future format: compactness, compatibility, allowing to embed other formats (different compression algorithms) inside it. Another int... | <p>I would consider defining a substructure that higher levels use to store data, a little like a mini file system inside the file.</p>
<p>For example, even though your file format is going to store application-specific data, I would consider defining records / streams etc. inside the file in such a way that applicati... | 41,897 |
<p>I have several init.d scripts that I'm using to start some daemons. Most of these scripts I've found on the internet and they all use start-stop-daemon. My understanding is that "start-stop-daemon" is a command that is specific to Linux or BSD distros and is not available on Solaris.</p>
<p>What is the best way to ... | <p>start-stop-daemon is a Linux thing, and not used that much on Solaris. I guess you can port the command though, if you want to reuse your init scripts.</p>
<p>Otherwise it depends on what version of Solaris you are using. Starting with Solaris 10 and also OpenSolaris they use a new startup script framework "Solaris... | <p>On Solaris 10 or later using SMF is recommended, but on an earlier release you'd create an init script in /etc/init.d and link to it from the rcX.d directories. Here's a bare-bones example of an init script for launching an rsync daemon:</p>
<pre class="lang-bsh prettyprint-override"><code>#!/sbin/sh
startcmd ()... | 36,420 |
<p>Since multiple inheritance is bad (it makes the source more complicated) C# does not provide such a pattern directly. But sometimes it would be helpful to have this ability.</p>
<p>For instance I'm able to implement the missing multiple inheritance pattern using interfaces and three classes like that:</p>
<pre><code... | <p>Consider just using <em><a href="http://en.wikipedia.org/wiki/Object_composition" rel="noreferrer">composition</a></em> instead of trying to simulate Multiple Inheritance. You can use Interfaces to define what classes make up the composition, eg: <code>ISteerable</code> implies a property of type <code>SteeringWheel... | <p>Multiple inheritance is one of those things that generally causes more problems than it solves. In C++ it fits the pattern of giving you enough rope to hang yourself, but Java and C# have chosen to go the safer route of not giving you the option. The biggest problem is what to do if you inherit multiple classes th... | 21,495 |
<p>We have a "master database structure", and need a routine to keep the database structure on client sites up-to-date.</p>
<p>A number of suggestions have been given <a href="https://stackoverflow.com/questions/115389/update-sql-sever-database-schema-with-software-update" title="here">to a related question</a>, but I... | <p>ListItems are automatically HtmlEncoded.</p>
<p>You can HtmlDecode the list items before hand, so when they are HtmlEncoded you get the proper characters:</p>
<pre><code>DropDownList1.DataSource = new List<string> { Server.HtmlDecode("A&hellip;"), Server.HtmlDecode("B&nbsp;C") };
DropDownList1.DataBi... | <p>Standard drop down lists are very poor at representing treeviews . </p>
<p>They can handle going one level deep if the top level is not selectable (see the <a href="http://www.w3.org/TR/html4/interact/forms.html#edef-OPTGROUP" rel="nofollow noreferrer">optgroup</a> element[1]), but beyond that I suggest taking a re... | 21,417 |
<p>I use something like this:
screen.addstr(text, color_pair(1) | A_BOLD), but it doesn't seem to work..
However, A_REVERSE and all others attribute does work! </p>
<p>In fact, I'm trying to print something in white, but the COLOR_WHITE prints it gray.. and after a while of searching, it seems that printing it gray +... | <p>Here's an example code (Python 2.6, Linux):</p>
<pre><code>#!/usr/bin/env python
from itertools import cycle
import curses, contextlib, time
@contextlib.contextmanager
def curses_screen():
"""Contextmanager's version of curses.wrapper()."""
try:
stdscr=curses.initscr()
curses.noecho()
... | <p>Here's an example code (Python 2.6, Linux):</p>
<pre><code>#!/usr/bin/env python
from itertools import cycle
import curses, contextlib, time
@contextlib.contextmanager
def curses_screen():
"""Contextmanager's version of curses.wrapper()."""
try:
stdscr=curses.initscr()
curses.noecho()
... | 42,369 |
<p>I have a sample file for BASIC page authentication that works perfectly in tomcat but it wont work at all in websphere. Any ideas what needs to be done differently in Websphere?</p>
<p>Thanks
Damien</p>
| <p>Damien,</p>
<p>Please review Chapter 7 of the Websphere 6.1 Security Handbook titled "Securing a Web application":
<a href="http://www.redbooks.ibm.com/redbooks/pdfs/sg246316.pdf" rel="noreferrer">http://www.redbooks.ibm.com/redbooks/pdfs/sg246316.pdf</a></p>
| <p>Have you enabled global security on Websphere?</p>
| 27,325 |
<p>Whats the benefit of:</p>
<pre><code>public string User {get; set;}
</code></pre>
<p>over</p>
<pre><code>public string User;
</code></pre>
<p>Since you can't access the private member in the first case, how is it any different that just making your property public?</p>
| <p>The second example is making the <em>field</em> public, not a property (your question). This provides a simple way of making simple properties. Properties should be your default, not public fields; the list of reasons is endless, but starts with:</p>
<ul>
<li>encapsulation</li>
<li>ability to add notification</li>
... | <p>There can be a number of things that you must do when User value changes. Things that you don't know in advance or are not present at the time you design your classes.
For example one day you realize that user value should be at least 5 characters long. If you have and property it simple to implement. If you have a... | 25,200 |
<p>Having read the threads <a href="https://stackoverflow.com/questions/60919/is-sqlcommanddispose-enough">Is SqlCommand.Dispose enough?</a> and <a href="https://stackoverflow.com/questions/23867/closing-and-disposing-a-wcf-service">Closing and Disposing a WCF Service</a> I am wondering for classes such as SqlConnectio... | <h3>I want to clarify this situation.</h3>
<p>According to Microsoft guidelines, it's a good practice to provide <code>Close</code> method where suitable. <a href="https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/dispose-pattern" rel="noreferrer">Here</a> is a citation from <a href="https://rads.stac... | <p>I just had an issue on net6 app using <code>TransactionScope</code>: I had multiple consequently created, opened and disposed connections, but was catching <code>This platform does not support distributed transactions</code> on completing scope (while clearly there were no distributed transactions).</p>
<p>The issue... | 8,622 |
<p>I am working on an algorithm that will try to pick out, given an HTML file, what it thinks is the parent element that most likely contains the majority of the page's content text.
For example, it would pick the div "content" in the following HTML:</p>
<pre><code><html>
<body>
<div id="header... | <p>Here's roughly how I would approach this:</p>
<pre><code>// get array of all elements (body is used as parent here but you could use whatever)
var elms = document.body.getElementsByTagName('*');
var nodes = Array.prototype.slice.call( elms, 0 );
// get inline elements out of the way (incomplete list)
nodes = nodes... | <p>I can also say that word banks are a great help. Any lists of common 'advertisey' words like twitter and click and several capitalized nouns in a row. Having a POS tagger can improve accuracy. For news sites, a list of all known major cities in the world can help separate. In fact, you can almost scrape a page witho... | 36,864 |
<p>I am currently writing an financial application, and we have a pretty standard customer table. It consists of many mandatory fields, and some optional like Cell/Fax etc.. I'm using NHibernate as a ORM and have all the mappings right. It already works.</p>
<p>I just wonder, how do I "express" in code that a field is... | <p>Does your TextBox have AutoPostBack="True" set? If so, it will automatically postback when you're "finished" (when the input control loses focus). If this is the case, just set it to false.</p>
| <p>yeah,My TextBox AutoPostBack was set to true which i have changed it to false, now.</p>
<p>but i have a url attached to each of my suggestions.On click of suggestion, user gets navigated to that particular url. When i do AutoPostback= "false", i wont get navigated to that page.</p>
<p>HOw do i handle it?</p>
| 39,169 |
<p>I am trying to wrap my head around this. I am making a business specific messaging application, it is going to connect between 5000 and 10,000 machines back to our datacenter via WCF (no vpns, all over the net). It is mainly for alerts and I need to be able to send message direclty to specific clients, and WCF allo... | <p>I think each port is actually a combination of DestinationTCPAddress and Port Number - so you won't run out.</p>
<p>I.e. You can have several subscribers all being talked to on the same source port. It just becomes a matter of capacity.</p>
| <p>I think each port is actually a combination of DestinationTCPAddress and Port Number - so you won't run out.</p>
<p>I.e. You can have several subscribers all being talked to on the same source port. It just becomes a matter of capacity.</p>
| 36,388 |
<p>I am running a program and want to see what its return code is (since it returns different codes based on different errors).</p>
<p>I know in Bash I can do this by running</p>
<blockquote>
<p>echo $?</p>
</blockquote>
<p>What do I do when using cmd.exe on Windows?</p>
| <p>A pseudo environment variable named <code>errorlevel</code> stores the exit code:</p>
<pre><code>echo Exit Code is %errorlevel%
</code></pre>
<p>Also, the <code>if</code> command has a special syntax:</p>
<pre><code>if errorlevel
</code></pre>
<p>See <code>if /?</code> for details.</p>
<h1>Example</h1>
<pre><code>@e... | <p>At one point I needed to accurately push log events from Cygwin to the Windows Event log. I wanted the messages in WEVL to be custom, have the correct exit code, details, priorities, message, etc. So I created a little Bash script to take care of this. Here it is on GitHub, <a href="https://github.com/jonretting/gef... | 43,430 |
<p>Few of us would deny the awesomeness of debuggers, but to make it more useful, some tricks can be used. </p>
<p>For example in Python, you can use <strong><em>pass</em></strong> to do absolutely nothing except to leave you room to put a break point and allow you to observe the values in the Watch window. </p>
<p>I... | <p>In C#, you can use this:</p>
<pre><code>System.Diagnostics.Debugger.Break();
</code></pre>
<p>It will force a breakpoint.</p>
| <p>Not very sophisticated, but functional.</p>
<pre><code>bool bp;
bp = true; //whereever I need to break.
</code></pre>
| 34,426 |
<p><a href="https://3dprinting.stackexchange.com/questions/3586/adding-custom-m-codes-to-marlin">Adding custom M Codes to Marlin</a> doesn't work for Marlin 2.0</p>
<p>How would one go about adding custom G codes or M Codes to Marlin 2.0? The Marlin_main.cpp file does not exist. </p>
<p>In general for Marlin 2.0, thi... | <p>The code in 2.0.x is similar to the old branch 1.1.x, G-code is parsed in <a href="https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/src/gcode/gcode.cpp" rel="nofollow noreferrer"><code>gcode.cpp</code></a>, specifically in <code>process_parsed_command</code>:</p>
<pre><code>void GcodeSuite::process_parsed... | <ol start="0">
<li>Choose a code in the >10,000 in case new codes are added. But in this example I will choose 13</li>
<li>Navigate to 'src' folder of Marlin</li>
<li>Edit the file <code>gcode.cpp</code> around line 223 to have a new unused number. For example, this will create a new G code function for the label <... | 1,669 |
<p>Any thoughts on why I might be getting tons of "hangs" when trying to download a file via HTTP, based on the following?</p>
<ul>
<li>Server is IIS 6</li>
<li>File being downloaded is a binary file, rather than a web page</li>
<li>Several clients hang, including TrueUpdate and FlexNet web updating packages, as well ... | <p>Perhaps your issue was a low level networking issue with the ISP as you speculated in your reply comment. I am experiencing a similar problem with IIS and some mysterious 200 0 64 lines appearing in the log file, which is how I found this post. For the record, this is my understanding of sc-win32-status=64; I hope s... | <p>You will have to use wireshare or network monitor to gather more data on this problem. Me think.</p>
| 48,644 |
<p>We need to add WorkFlow to our Spring managed application. Does anyone have any useful experience in using any of the myriad of OSS Work Flow solutions? Which one is best? Which one integrates with Spring best? Which ones should we avoid?</p>
| <p>If you only need some simple process orchestration, Spring's own <a href="http://springframework.org/webflow" rel="nofollow noreferrer">Web Flow</a>, despite its name can serve as a orchestration task manager. If you need to preserve state for several days then you will need to become an 'early adopter' of one of ... | <p>We're looking at Drools/Guvnor, possibly integrated with jBPM (as in this <a href="http://www.firstpartners.net/blog/technology/java/2008/06/05/jboss-business-rules-and-jbpm-workflow-presentation-dublin/" rel="nofollow noreferrer">presentation</a>), to add a workflow engine to our Spring/Java EE app, but we're still... | 3,044 |
<p>I've been using vim, but after reading <a href="https://stackoverflow.com/questions/256365/what-ide-editor-do-you-use-for-ruby-on-windows">this question</a> was wondering what is being used in the linux world. </p>
| <p>There's also Netbeans: <a href="http://ruby.netbeans.org/" rel="noreferrer">http://ruby.netbeans.org/</a> </p>
| <p>komodo Edit is the best choice.</p>
| 33,297 |
<p>My company is looking into writing a custom application that will need to perform many list item queries across multiple site collections. It will need to run for WSS 3.0 and it 'would be nice' if it worked on WSS 2.0 as well. It won't be designed for MOSS/SPS but again it 'would be nice' if it worked on these platf... | <p>Object model is better as you can gain access to additional features and the full detail of the list items, such as the version history.</p>
<p>The object model is also better for performance (as long as you dispose() your spsite and spweb objects properly).</p>
<p>The Sharepoint object model has some differences ... | <p>Can the OM be used inside an Infopath form? Currently I'm using the web services to pull in the list data I want but I would rather use the OM.</p>
| 41,994 |
<p>I'm developing a PHP website that uses url routing. I'd like the site to be directory independent, so that it could be moved from <a href="http://site.example.com/" rel="noreferrer">http://site.example.com/</a> to <a href="http://example.com/site/" rel="noreferrer">http://example.com/site/</a> without having to chan... | <p>You could put in the head</p>
<pre><code><base href="<?php echo url::base(); ?>" />
</code></pre>
<p>This will mean the browser will request any non-absolute URLs relative to that path. <strike>However I am not sure how this would affect URLs embedded in CSS files etc.</strike> This does not affect pa... | <p>tomhaigh has a good point, and would be worthwhile to investigate it further.</p>
<p>According to <a href="http://msdn.microsoft.com/en-au/library/ms535191(VS.85).aspx" rel="nofollow noreferrer">MSDN</a>, the <a href="http://msdn.microsoft.com/en-au/library/ms535191(VS.85).aspx" rel="nofollow noreferrer">base</a> t... | 34,858 |
<p>I've got a table of hardware and a table of incidents. Each hardware has a unique tag, and the incidents are tied to the tag.</p>
<p>How can I select all the hardware which has at least one incident listed as unresolved?</p>
<p>I can't just do a join, because then if one piece of hardware had multiple unresolved i... | <pre><code>select distinct(hardware_name)
from hardware,incidents
where hardware.id = incidents.hardware_id and incidents.resolved=0;
</code></pre>
| <p>This can also work</p>
<pre><code>SELECT hd.name, inc.issue, FROM hardware hd INNER JOIN inc ON hd.tag = inc.tag AND inc.issue = 'unresolved' group by hd.name
</code></pre>
| 25,773 |
<p>How do you prepare your SQL deltas? do you manually save each schema-changing SQL to a delta folder, or do you have some kind of an automated diffing process?</p>
<p>I am interested in conventions for versioning database schema along with the source code. Perhaps a pre-commit hook that diffs the schema?</p>
<p>Als... | <p>See</p>
<p><a href="https://stackoverflow.com/questions/308/is-there-a-version-control-system-for-database-structure-changes">Is there a version control system for database structure changes?</a></p>
<p><a href="https://stackoverflow.com/questions/173/how-do-i-version-my-ms-sql-database-in-svn">How do I version my... | <p>We're exporting the data to a portable format (using our toolchain), then importing it to a new schema. no need for delta SQL. Highly recommended.</p>
| 21,149 |
<p>Can anyone recommend for/against the time-travel functions in postgresql's contrib/spi module? Is there an example available anywhere?</p>
<p>Tnx</p>
| <p>The argument for time-travel would be being able to look at tables that are updated often at an earlier insertion/deletion point. Say a table of stock prices for a firms investment portfolio.<br>
The argument against would be the extra storage space it eats up. </p>
<p>Here is an <a href="http://www.pgcluster.org/b... | <p>See <a href="https://stackoverflow.com/questions/125877/versioning-database-persisted-objects-how-would-you#126029">This discussion</a> for an alternative approach to historical reporting.</p>
| 20,366 |
<p>This question has been asked before (<a href="https://stackoverflow.com/questions/2556/whats-the-best-online-payment-processing-solution">link</a>) but I have slightly different requirements. First, I'm in Canada so that rules out Google Checkout and probably a few others. I just need a basic service that provides "... | <p>I have used <a href="https://www.beanstream.com" rel="noreferrer">Beanstream</a> in Canada. They provide a hosted service, where you provide a link to a custom Beanstream page in your site; they do all the payment processing and deposit the funds in your bank account. You can edit the checkout page to make it match ... | <p>Maybe You should add some details about Your requirements:</p>
<ul>
<li>If sufficient, try bank transfers. They are not known or free in all countries and I do not know about Canada, but it is the best payment system in Europe: You just tell Your bank to transfer the money to the destination account.
<ul>
<li>Adva... | 27,985 |
<p>I have a bad habit of using the cursor keys of my keyboard to navigate source code. It's something I've done for 15 years and this of course means that my navigating speed is limited by the speed of the keyboard. On both Vista and OS X (I dual boot a MacBook), I have my key repeat rate turned all the way up. But in ... | <p>On Mac OS X, open the Global Preferences plist</p>
<pre><code>open ~/Library/Preferences/.GlobalPreferences.plist
</code></pre>
<p>Then change the KeyRepeat field. Smaller numbers will speed up your cursor rate. The settings dialog will only set it to a minimum of 2, so if you go to 0 or 1, you'll get a faster cur... | <p>Don't navigate character-by-character.</p>
<p>In Vim (see <a href="http://www.viemu.com/" rel="nofollow noreferrer">ViEmu</a> for Visual Studio):</p>
<ul>
<li><code>bw</code> -- prev/next word</li>
<li><code>()</code> -- prev/next sentence (full stop-delimited text)</li>
<li><code>{}</code> -- prev/next paragraph ... | 20,656 |
<p>I want to use VBScript to catch errors and log them (ie on error "log something") then resume the next line of the script.</p>
<p>For example,</p>
<pre>
On Error Resume Next
'Do Step 1
'Do Step 2
'Do Step 3
</pre>
<p>When an error occurs on step 1, I want it to log that error (or perform other custom functions wi... | <p>VBScript has no notion of throwing or catching exceptions, but the runtime provides a global Err object that contains the results of the last operation performed. You have to explicitly check whether the Err.Number property is non-zero after each operation.</p>
<pre><code>On Error Resume Next
DoStep1
If Err.Numbe... | <p>I'm exceptionally new to VBScript, so this may not be considered best practice or there may be a reason it shouldn't be done this that way I'm not yet aware of, but this is the solution I came up with to trim down the amount of error logging code in my main code block.</p>
<pre><code>Dim oConn, connStr
Set oConn = ... | 19,073 |
<p>We're in the process of upgrading one of our SQL Server instances from 2000 to 2005. I installed the performance dashboard (<a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=1d3a4a0d-7e0c-4730-8204-e419218c1efc&displaylang=en" rel="noreferrer">http://www.microsoft.com/downloads/details.aspx?Famil... | <p>First thing to be aware of:</p>
<p>When you upgrade from 2000 to 2005 (by using detach and attach) make sure that you:</p>
<ol>
<li>Set compability to 90</li>
<li>Rebuild the indexes</li>
<li>Run update statistics with full scan</li>
</ol>
<p>If you don't do this you will get suboptimal plans.</p>
<p>IF the tabl... | <p>Your best researching the most common type of queries that happen on your database and creating indexes based on that research.</p>
<p>For example, if there is a table which stores website hits, which is written to very very often but hardly even read from. Then don't index the table in away.</p>
<p>If how ever yo... | 2,598 |
<p>Now that the source code to the .NET Framework has been made available, is there any way to actually view it that doesn't involve using Visual Studio to step into a framework class? Several times now, I've been curious just how something works and wished I could peek at some code, but don't feel like putting togethe... | <p>There are different ways to look at the .NET source code:
Online via the browser:</p>
<ul>
<li><a href="http://www.dotnetframework.org" rel="nofollow noreferrer">http://www.dotnetframework.org</a></li>
<li><s><a href="http://typedescriptor.net/browse" rel="nofollow noreferrer">http://typedescriptor.net/browse</a></... | <p>A GREAT resource, not only for .NET is <a href="http://dotnetinside.com/en/" rel="nofollow">this</a>. It also has all you can think of (for example EF)</p>
<p><strong>[EDIT]</strong></p>
<p>The project seems to be dead now. </p>
<p>Also Microsoft's source page is out of beta. Probably this is the reason for the d... | 41,273 |
<p>I am about to reenter the MFC world after years away for a new job. What resources to people recommend for refreshing the memory? I have been doing mainly C# recently.</p>
<p>Also any MFC centric websites or blogs that people recommend?</p>
| <ul>
<li>For blogs: Your best bet would be the <a href="http://blogs.msdn.com/vcblog/default.aspx" rel="nofollow noreferrer">Visual C++ Team Blog</a>.</li>
<li>For books: <a href="https://rads.stackoverflow.com/amzn/click/com/1572316950" rel="nofollow noreferrer" rel="nofollow noreferrer">Programming Windows with MFC</... | <p>Books are one thing, but I always found that practice was the key with MFC. <a href="http://www.codeguru.com" rel="nofollow noreferrer">CodeGuru</a> was my favourite destination to answer anything MFC-related. </p>
<p>There's also that new website. What's it called...that's it - <a href="https://stackoverflow.com/"... | 4,745 |
<p>I want to find an SQL query to find rows where field1 does not contain $x. How can I do this?</p>
| <p>What kind of field is this? The IN operator cannot be used with a single field, but is meant to be used in subqueries or with predefined lists:</p>
<pre><code>-- subquery
SELECT a FROM x WHERE x.b NOT IN (SELECT b FROM y);
-- predefined list
SELECT a FROM x WHERE x.b NOT IN (1, 2, 3, 6);
</code></pre>
<p>If you ar... | <p><code>SELECT * FROM table WHERE field1 NOT LIKE '%$x%';</code> (Make sure you escape $x properly beforehand to avoid SQL injection)</p>
<p>Edit: <code>NOT IN</code> does something a bit different - your question isn't totally clear so pick which one to use. <code>LIKE 'xxx%'</code> can use an index. <code>LIKE... | 28,828 |
<p>I'm currently working on a small project with OCaml; a simple mathematical expression simplifier. I'm supposed to find certain patterns inside an expression, and simplify them so the number of parenthesis inside the expression decreases. So far I've been able to implement most rules except two, for which I've decide... | <p><strong>Quick Solution</strong></p>
<p>You just need to add parentheses, or <code>begin</code>/<code>end</code>, around the inner match:</p>
<pre class="lang-ml prettyprint-override"><code>let rec filter exp =
match exp with
| Var v -> Var v
| Sum (e1, e2) -> Sum (e1, e2)
| Prod (e1, e2) -> ... | <p>You can make this terser (and I would argue clearer) by judicious use of underscores, as's and or-patterns. The resulting code is also more efficient, because it allocates less (in the Var, Sum and Prod cases)</p>
<pre><code>let rec filter = function
| Var _ | Sum _ | Prod _ as e -> e
| Diff (_, (Sum _ | Diff _... | 32,146 |
<p>We have various php projects developed on windows (xampp) that need to be deployed to a mix of linux/windows servers. </p>
<p>We've used <a href="http://www.capify.org/" rel="nofollow noreferrer">capistrano</a> in the past to deploy from windows to the linux servers, but recent changes in architecture and windows s... | <p>I use 4 different approaches depending on the client environment:</p>
<ol>
<li>Capistrano and similar tools (effective, but complex)</li>
<li><code>rsync</code> from + to Windows, Linux, Mac (simple, doesn't enforce discipline)</li>
<li><code>svn</code> from + to Windows, Linux, Mac (simple, doesn't enforce discipl... | <p>Capistrano is the nicest deployment tool I've seen. Do the architecture changes make it impossible to fix the configs so it works again? </p>
| 10,273 |
<p>I believe this is a common question / problem but have not been able to find a good clean concise answer.</p>
<p><strong>The Problem</strong></p>
<p>How to map entities that appear to have an inheritance relationship:</p>
<pre><code>Company
Supplier
Manufacturer
Customer
</code></pre>
<p>However, a Supplie... | <p>You probably want to consider using the Roles. So a Role will have a set of Persons. Or a Person will have a set of Roles or both. This would probably imply that there is an Association class that maps persons to roles. </p>
<p>Define a Person class with all properties that are common to people. Then define a Role ... | <p>I came across a bit more commentary you might find relevant:</p>
<p>In a <a href="http://blog.nakedobjects.net/?p=60" rel="nofollow noreferrer">blog post on the Naked Objects blog</a> a few different approaches are outlined discussing the pros and cons of each.</p>
<ul>
<li>Using an 'Any' association mapping</li>
... | 28,067 |
<p>I'm working on a CakePHP 1.2 application. I have a model "User" defined with a few HABTM relationships with other tables through a join table.</p>
<p>I'm now tasked with finding User information based on the data stored in one of these HABTM tables. Unfortunately, when the query executes, my condition is rejected w... | <p>Turn your debug level up to 2 and look at the SQL output. Find the query that your code is generating and you'll notice there are several. The ORM layer in CakePHP doesn't join HABTM related tables in the first query. It gets the results from the first select, then separately fetches the HABTM data for each item. Be... | <p>FWIW, your join tables do appear to be "oddly named" insofar as they don't follow the convention described here:</p>
<p><a href="http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM" rel="nofollow noreferrer">http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM</a></p>
<p>In any case, good luck, I rememb... | 42,374 |
<p>I work for a small web development company (only 2 to 3 developers) that work on a wide range of projects for different customers (everything from CMS's to eCommerce sites). </p>
<p>Usually we work on our own projects but occasionally we need to work together on one. We use subversion as our source control software... | <p>Unit testing IS necassary no matter what. If you write code, you unit test. I work by myself alot too. I still test. I dont know how I ever wrote code before it.</p>
<p>Heres the way I look at it. you dont necassarily need the same expensive tools as the big boys, but if you want to be big, you have to think big. D... | <p>Our development environment is pretty small as well. We mostly do Java web development (some php) as oppose to .NET or something else. We use Project locker for our wiki, svn and bug tracking system. For code development it varies between Netbeans 6.1 and Eclipse and MySQL as our database backend.<br>
We've made ... | 17,626 |
<p>I've been developing Web applications for a while now and have dipped my toe into GUI and Game application development.</p>
<p>In the web application (php for me), a request is made to the file, that file includes all the necessary files to process the info into memory, then the flow is from Top to Bottom for each ... | <p>There's almost always a loop in all of these - but it's not something you would tend to think about during most of your development.</p>
<p>If you take a step back, your web applications are based around a loop - the Web Server's <code>accept()</code> loop:</p>
<pre><code>while(listening) {
get a socket conne... | <p>For applications and to a lesser extent Games the software is event driven. The user does "something" with the keyboard or mouse and that event is sent to the rest of the software. </p>
<p>In Games the Game Loop is important because is focused on processing the screen and the game state. With many Games needing rea... | 49,678 |
<p>Let's say that I have a record in the database and that both admin and normal users can do updates.</p>
<p>Can anyone suggest a good approach/architecture on how to version control every change in this table so it's possible to roll back a record to a previous revision?</p>
| <p>Let's say you have a <code>FOO</code> table that admins and users can update. Most of the time you can write queries against the FOO table. Happy days.</p>
<p>Then, I would create a <code>FOO_HISTORY</code> table. This has all the columns of the <code>FOO</code> table. The primary key is the same as FOO plus a ... | <p>As an additional step to the answers above me, I would suggest giving each generated change a unique ID, likely something with the date/time and a unique counter for each day (so that multiple updates a second don't overlap). I would include a action type code within this code, so "9129128213939REPLACE". T... | 41,808 |
<p>In <a href="http://msdn.microsoft.com/en-us/library/ms462365.aspx" rel="nofollow noreferrer">CAML</a> I can query SharePoint Listitems using the "Contains"-element, but there is no "does not contain"-element I could use.</p>
<p>So what is the best way to get the items that do not contain a string? Is there a better... | <p>The same restriction applies to BeginWith. I do not know any good solution sadly. What you could do: Do a Contains-Query, loop through each item and get the IDs, then do another big query for "ID NotEqual 1 or ID NotEqual 2 or ID NotEqual 3......" Since ID is indexed as far as I know, that should have a smaller impa... | <p>This problem with 'Contains' and 'BeginsWith' bothers me also. I hope that in next version of Sharepoint caml will be extended to be real tool, not just a rock on our leg.</p>
<p>The way I do it is to specify query as much as possible and then filter rows which don't match conditions in C# code. It is quite ugly so... | 44,313 |
<p>I have Eclipse setup with PyDev and love being able to debug my scripts/apps. I've just started playing around with Pylons and was wondering if there is a way to start up the paster server through Eclipse so I can debug my webapp?</p>
| <p>Create a new launch configuration (Python Run)</p>
<p><strong>Main tab</strong></p>
<p>Use paster-script.py as main module (you can find it in the Scripts sub-directory in your python installation directory)</p>
<p>Don't forget to add the root folder of your application in the PYTHONPATH zone</p>
<p><strong>Argu... | <p>This doesn't really answer question about how to do it in eclipse. But I've been debugging paster server with winpdb, which is quite nice graphical python debugger (you can install it with easy_install winpdb). </p>
<p>Just start your server e.g.:</p>
<pre><code>winpdb /usr/local/bin/paster serve development.ini
<... | 17,776 |
<p>1.
How can I reinterpret cast a float to an int (or a double to a long)?</p>
<pre><code>float f = 2.0f;
int i = (int)f; // causes conversion
</code></pre>
<p>I only want to copy the bit-pattern from <code>f</code> to <code>i</code>. How can this be done?</p>
<p>2.
The implicit and explicit operators in C# uses on... | <p>1: BitConverter (as sixlettervariables) is an option; as is unsafe code (which doesn't need an intermediate buffer):</p>
<pre><code> float f = 2.0f;
int i;
// perform unsafe cast (preserving raw binary)
unsafe
{
float* fRef = &f;
i = *((int*)fRef);
}
Console.WriteLine(... | <p>This approach, while unsafe, works as a generic solution</p>
<pre><code>static unsafe TDest ReinterpretCast<TSource, TDest>(TSource source)
{
var tr = __makeref(source);
TDest w = default(TDest);
var trw = __makeref(w);
*((IntPtr*)&trw) = *((IntPtr*)&tr);
return __refvalue(trw, TDe... | 20,856 |
<p>I have just start using git and i can't get it to remember my passphrase I'm using cmd.exe elevated and my git host is github and i have create a ssh key like that guide on github</p>
<p>but i still get </p>
<pre><code>*\subnus.mvc>git push origin master
Enter passphrase for key '/c/Users/Subnus/.ssh/id_rsa':
... | <p>I realize that this question is coming up on two years old, but I had the same issue and several answers here did not completely answer the question for me. Here are three step-by-step solutions, depending on whether you use TortoiseGit in addition to msysgit or not.</p>
<p><strong>First solution</strong> Assumes Wi... | <p>Make sure that your <code>~/.ssh/config</code> does <strong>not</strong> contain</p>
<p><code>UseKeychain yes</code></p>
<p>which prevents <code>ssh-add</code> from persisting to the <code>ssh-agent</code>.</p>
| 48,334 |
<p>I am using Multiview. And I am switching between views. Each view contains lots of fields. I am going to another view from the current view to add some data. And after adding data from the new view, I am returning to the previous view. Now on this view I want to populate fields which I have entered before switching.... | <p>This isn't too far off from what viewstate is designed for--I'd stick with that. </p>
<p>Other less-desirable alternatives include sessions, database tables, and httpcontext.</p>
| <p>Another possiblity is to use the Server.Transfer("url", true) which allows you to pass the previous form along with the data that was contained in the form to the next page.</p>
<p>Check out <a href="http://www.developer.com/net/asp/article.php/3299641" rel="nofollow noreferrer">http://www.developer.com/net/asp/art... | 47,322 |
<p>I am looking for a regex pattern that would match several different combinations of
zeros such as 00-00-0000 or 0 or 0.0 or 00000 </p>
<p>Please help</p>
<p>Thanks!</p>
<p>EDIT:</p>
<p>Well, I have web service that returns me a result set, based on what it returns me I can decide if the result is worth displayi... | <p>You need to better define what is valid to appear between the zeros. Going from your question, I'll assume you're looking for any number of zeros with any number and grouping of "-" and "." between them....</p>
<p><code>0([-.]?0+)*</code></p>
<p>Hope you don't mind, SoapBox:</p>
<p>Based on the question edit, wh... | <p>Try this:</p>
<pre><code>(00-00-0000|0|0\\.0|00000)
</code></pre>
| 42,074 |
<p>How to generate the Symbols file of a PowerBuilder program for dump analysis?</p>
| <p>Try</p>
<pre><code>tail -n +21 myfile.txt
</code></pre>
| <p>Awk power can be used too:</p>
<pre><code>awk -- 'NR > 20' /etc/passwd
</code></pre>
| 40,554 |
<p>I want to experiment with GCC whole program optimizations. To do so I have to pass all C-files at once to the compiler frontend. However, I use makefiles to automate my build process, and I'm not an expert when it comes to makefile magic.</p>
<p>How should I modify the makefile if I want to compile (maybe even link... | <pre><code>LIBS = -lkernel32 -luser32 -lgdi32 -lopengl32
CFLAGS = -Wall
# Should be equivalent to your list of C files, if you don't build selectively
SRC=$(wildcard *.c)
test: $(SRC)
gcc -o $@ $^ $(CFLAGS) $(LIBS)
</code></pre>
| <p>You need to take out your suffix rule (%.o: %.c) in favour of a big-bang rule.
Something like this:</p>
<pre><code>LIBS = -lkernel32 -luser32 -lgdi32 -lopengl32
CFLAGS = -Wall
OBJ = 64bitmath.o \
monotone.o \
node_sort.o \
planesweep.o \
triangulate.o \
prim_combine.o \
... | 20,569 |
<p>I have a .exe and many plug-in .dll modules that the .exe loads. (I have source for both.) A cross-platform (with source) solution would be ideal, but the platform can be narrowed to WinXP and Visual Studio (7.1/2003 in my case).</p>
<p>The built-in VS leak detector only gives the line where new/malloc was called f... | <p>I personally use <a href="http://vld.codeplex.com" rel="noreferrer">Visual Leak Detector</a>, though it can cause large delays when large blocks are leaked (it displays the contents of the entire leaked block).</p>
| <p>Try <a href="http://www.codeproject.com/KB/applications/leakfinder.aspx" rel="nofollow noreferrer">Jochen Kalmbach's Memory Leak Detector</a> on Code Project.
The URL to the latest version was somewhere in the comments when I last checked.</p>
| 4,531 |
<p>I'm patching connect() to redirect network traffic as part of a library (<a href="http://www.assembla.com/wiki/show/nethooker" rel="nofollow noreferrer">NetHooker</a>) and this works well, but it depends on ws2_32.dll remaining the same and doesn't work if the syscall is used directly. So what I'm wondering is if t... | <p>Cody,</p>
<p>Instead of system call hooking, you might want to look into writing a layered service provider.</p>
<p><a href="http://www.microsoft.com/msj/0599/LayeredService/LayeredService.aspx" rel="nofollow noreferrer">http://www.microsoft.com/msj/0599/LayeredService/LayeredService.aspx</a></p>
| <p>Cody, maybe you could take a look at <a href="http://research.microsoft.com/en-us/projects/detours/" rel="nofollow noreferrer">http://research.microsoft.com/en-us/projects/detours/</a></p>
<p>Also, I wrote some code that, given the name of dll export will redirect it to another function pointer by patching the imag... | 20,875 |
<p>I need to perform Diffs between Java strings. I would like to be able to rebuild a string using the original string and diff versions. Has anyone done this in Java? What library do you use?</p>
<pre><code>String a1; // This can be a long text
String a2; // ej. above text with spelling corrections
String a3; // ej. ... | <p>This library seems to do the trick: <a href="https://github.com/google/diff-match-patch" rel="noreferrer">google-diff-match-patch</a>. It can create a patch string from differences and allow to reapply the patch.</p>
<p><strong>edit</strong>: Another solution might be to <a href="https://code.google.com/p/java-diff... | <pre><code>public class Stringdiff {
public static void main(String args[]){
System.out.println(strcheck("sum","sumsum"));
}
public static String strcheck(String str1,String str2){
if(Math.abs((str1.length()-str2.length()))==-1){
return "Invalid";
}
int num=diffcheck1(str1, str2);
if(num==-1){
... | 16,065 |
<p><strong><code>oPanel = CType(Master.FindControl("panelSearch"), Panel)</code></strong></p>
<p>This code resides on my masterpage's back-end (<strong><code>theMaster.master.vb</code></strong>), but I get a "Cannot refer to an instance member from within a shared class or shared member initializer without an explicit... | <p>Remove the <code>Shared</code> modifier on your method that this code is written in.</p>
| <p>You can't access the Master property of the page from a shared function. You must make the function an instance function (remove the Shared keyword) before you can use the Master property.</p>
| 46,108 |
<p>It's my understanding that nulls are not indexable in DB2, so assuming we have a huge table (Sales) with a date column (sold_on) which is normally a date, but is occasionally (10% of the time) null.</p>
<p>Furthermore, let's assume that it's a legacy application that we can't change, so those nulls are staying ther... | <p>I'm no DB2 expert, but if 10% of your values are null, I don't think an index on that column alone will ever help your query. 10% is too many to bother using an index for -- it'll just do a table scan. If you were talking about 2-3%, I think it would actually use your index.</p>
<p>Think about how many records ar... | <p>Troels is correct; even rows with a SOLD_ON value of NULL will benefit from an index on that column. If you're doing ranged searches on SOLD_ON, you may benefit even more by creating a clustered index that begins with SOLD_ON. In this particular example, it may not require much additional overhead to maintain the cl... | 14,114 |
<p>In C#, does anybody know why the following will compile:</p>
<pre><code>int i = 1;
++i;
i++;
</code></pre>
<p>but this will not compile?</p>
<pre><code>int i = 1;
++i++;
</code></pre>
<p>(Compiler error: The operand of an increment or decrement operator must be a variable, property or indexer.)</p>
| <p>you are running one of the operands on the result of the other, the result of a increment/decrement is a value - and you can not use increment/decrement on a value it has to be a variable that can be set.</p>
| <p>My guess: to avoid such ugly and unnecessary constructs. Also it would use 2 operations (2x INC) instead of one (1x ADD 2).</p>
<p>Yes, i know ... "but i want to increase by two and i'm a l33t g33k!"</p>
<p>Well, don't be a geek and write something that doesn't look like an inadvertent mistake, like this:</p>
<pr... | 20,981 |
<p>Does anyone know how to programmatically capture the sound that is being played (that is, everything that is coming from the sound card, not the input devices such as a microphone).</p>
| <p>Assuming that you are talking about Windows, there are essentially three ways to do this. </p>
<p>The first is to open the audio device's main output as a recording source. This is only possible when the driver supports it, although most do these days. Common names for the virtual device are "What You Hear" or "Wav... | <p>If you were using OSX, <a href="http://rogueamoeba.com/audiohijackpro/" rel="nofollow noreferrer">Audio Hijack Pro from Rogue Amoeba</a> probably is the easiest way to go. </p>
<p>Anyway, why not just looping your audio back into your line in and recording that? This is a <em>very</em> simple solution. Just plug a ... | 25,988 |
<p>I'm working on VS 2005 and something has gone wrong on my machine. Suddenly, out of the blue, I can no longer build deployment files.
The build message is:</p>
<pre><code>ERROR: An error occurred generating a bootstrapper: Invalid syntax.
ERROR: General failure building bootstrapper
ERROR: Unrecoverable build erro... | <p><strong>SOLUTION!</strong><br>
Thanks to Michael Bleifer of Microsoft support - I installed .NET 2.0 SP1, and the problem was solved!</p>
| <p>If it doesn't build only on the one machine, then either you've managed to make that machine different, or the VS2005 install is corrupted. If you take the error message at face-value, then the problem is probably the latter. Try running the repair feature of the VS2005 installer, or failing that, reinstall VS2005... | 9,517 |
<p>I have read on Stack Overflow some people that have converting to C#2.0 to C#3, but is it really worth it?</p>
<p><strike>I have a project that is done at 75% before going in maintenance phase. I am asking to myself if it is worth it to switch to C#3.0?</strike></p>
<h3>Update:</h3>
<p>The project will have a web in... | <p>No, I would advise not. I would advise starting 3.5 on new projects only, unless there is a specific reason otherwise. You will not have any benefit from 3.5 by just recompiling, since your code is already written (or at least 75% of it).</p>
<p>If you need to migrate to 3.5 in the future, you can easily do it. Of ... | <p>I wouldn't change anything unless you have a good reason to do so; i.e. there is a bug that you can't work-around in 2.0. </p>
<p>Upgrading the framework at such a late point in the project is likely to cause some problems which you really don't need at the moment.</p>
| 20,579 |
<p>I am looking for a reliable technique for adding Ajax to a working ASP.NET MVC application. I want to use jQuery, and understand how to use the AJAX functionality from jQuery. </p>
<p>What I need to know is how I should write my controller so that I can run the site without JavaScript, but at the same time make AJA... | <p>Typically you would create your site so that it works without JavaScript being enabled. Then you would add the <a href="http://en.wikipedia.org/wiki/Unobtrusive_JavaScript" rel="nofollow noreferrer">unobtrusive JavaScript</a> needed to enhance your site with Ajax e.g. adding event handlers for links, form submits, e... | <p>in your controller (derived from Controller), you can call Request.IsMvcAjaxRequest() to check if the request is a normal POST or an AJAX request. This will be true if the request was created from a an AjaxForm submit or an AsyncHyperlink.
The Ajax form can be made visible by javascript, along with hiding the stand... | 8,039 |
<p>I have an application with several files that contain configuration parameters and other data that changes as the user uses the application. These files can change with newer versions of my software, but the user can also modify them (or they may be changed by the application itself). Basically, I'm looking for a ... | <p>I think there is no "clean" way to do this, because a msi project must be able to uninstall itself completely by design. I think the best way to solve this, is by using a custom action which executes a batch file and put your configfile update logic in that batch file. The custom action looks like this (only relevan... | <p>I think there is no "clean" way to do this, because a msi project must be able to uninstall itself completely by design. I think the best way to solve this, is by using a custom action which executes a batch file and put your configfile update logic in that batch file. The custom action looks like this (only relevan... | 46,672 |
<p>What is the difference between the CIL instructions "Call" and "Callvirt"?</p>
| <p><code>call</code> is for calling non-virtual, static, or superclass methods, i.e., the target of the call is not subject to overriding. <code>callvirt</code> is for calling virtual methods (so that if <code>this</code> is a subclass that overrides the method, the subclass version is called instead).</p>
| <p>Just adding to the above answers, I think the change has been made long back such that Callvirt IL instruction will get generated for all the instance methods and Call IL instruction will get generated for static methods. </p>
<p>Reference :</p>
<p>Pluralsight course "C# Language Internals - Part 1 by Bart De Smet... | 23,569 |
<p>We have recently switched from the Rational stack (ClearQuest/ClearCase etc..) over to TFS 2008 for our .NET group and one of the challenges that we are seeing are some of the limitations of the Team System Web Access as far as what work items a client can view. Has anyone been able to take TSWA and successfully ex... | <p>What was formerly called Team System <a href="http://blogs.msdn.com/hakane/archive/2008/04/09/what-is-work-item-web-access-wiwa.aspx" rel="nofollow noreferrer">Work Item Web Access</a> (WIWA) is your answer and is now called "<a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=3ECD00BA-972B-4120-A8D5-3... | <p>Are you talking about customers being able to view and create only their own work items on a per-customer basis, or something more like a public vs. private scenario?</p>
<p>If it is the latter, you could create a Team Project with the sole intent of acting as a triage center for issues that customers report and cr... | 43,453 |
<p>Most Scrum teams have some sort of whiteboard or other board upon which the stories/tasks for the current sprint are visualized.</p>
<p>I'm curious as to how people organize this board? Do you use post-it notes? Are they color-coded? How do you group tasks? How do you distinguish the state of tasks? Etc...</p>
| <p>I've seen groups use a whiteboard, and use different colors for each group of tasks.</p>
<p>If you use note cards for your stories, you can put them up there as well, and divide them by release/iteration/group of tasks. <a href="http://www.mountaingoatsoftware.com/task_boards" rel="nofollow noreferrer">This concep... | <p>I usually use an Excel sheet, on a shared network folder: one column is used to specify the "group" of the task, and one to specify the task itself. For completed tasks, we simply mark the row in green. The primary disadvantage for that is sharing - I've yet to find a decent solution that allows more than one person... | 14,649 |
<p>I have a Windows forms project (VS 2005, .net 2.0). The solution has references to 9 projects. Everything works and compiles fine on one of my computers. When I move it to a second computer, 8 out of the 9 project compile with no problem. When I try to compile the 9th project (the main project for the application - ... | <p>I just got it to build by doing the following:</p>
<p>There had been a licenses file in the Properties of the project in question. After deleting the file (it was no longer needed) the project was able to build successfully. So it looks like that was the culprit.</p>
| <p>It could be that you have to specify your target platform explicitly and set it to x86. There might be an issue with the 64bit build. </p>
<p>Another thing: Do you run VS as Administrator? There are issues with VS2005 when it is not running with elevation on Vista, maybe this strange compile error is one of them.</... | 37,106 |
<p>A friend of mine asked me to implement a blue and a red pointer to represent the inputs of two separate mice to expedite a mixing desk scenario for real time audio mixing. I'd love to, but as much as I think it is a great idea, I don't have a clue as to where to start looking for a possible solution.</p>
<p>Where ... | <p>Look at <a href="http://java.net/projects/jinput" rel="nofollow noreferrer">jinput</a>.</p>
<p>I have had multiple keyboards working with it, I am nearly certain it supports multiple mice too.</p>
| <p>You can use multiple devices, but at the Java level, all mouse events are coalesced into a single stream. The event does not include which mouse it came from. You did say you wanted to mix audio, right? Well this mix might be interesting, but surely not what you want. </p>
<p>I'd suggest using the Java-supported mi... | 32,791 |
<p>Please follow the link <a href="http://msdn.microsoft.com/hi-in/default.aspx" rel="noreferrer">http://msdn.microsoft.com/hi-in/default.aspx</a> and see the top right corner of the page. </p>
<p>There you will find a "Microsoft.com" expander. When you move the mouse over it, it displays as a popup and grows. When yo... | <p>Not sure why you're being modded down. You can use a <code>Popup</code> control and animate its size.</p>
| <p>Take a <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/41742469-ba87-454d-9a02-630f42299811/" rel="nofollow noreferrer">look</a> at this post at the msdn forum. It explains the use of the popup control a bit. <a href="http://blogs.msdn.com/wpfsdk/archive/2007/04/27/popup-your-control.aspx" rel="nof... | 48,467 |
<p>I'm building a winForms app in NET3.5SP1 using VS2008Express. Am trying to deserialize an object using the System.Web.Script.Serialization library.</p>
<p>The error is: Type 'jsonWinForm.Category' is not supported for deserialization of an array.</p>
<p>Cheers!</p>
<pre><code>using System;
using System.Collectio... | <p>It's great you found your error. If you are looking for another tool for JSON serialization you might want to try <a href="http://james.newtonking.com/pages/json-net.aspx" rel="noreferrer">JSON.Net</a>.</p>
| <p>I found my error.. should be:</p>
<p>Cheers </p>
<pre><code>JavaScriptSerializer serializer = new JavaScriptSerializer();
// create a generic list of categories
List<Category> listOfCategories = new List<Category>();
// deserialize as a list of Categories, and put into listOfCategories
listOfCategor... | 39,069 |
<p>I have an XML input file and I'm trying to output the result of a call like: </p>
<pre><code><xsl:value-of select="Some/Value"/>
</code></pre>
<p>into an attribute. </p>
<pre><code><Output Attribute="Value should be put here"/>
</code></pre>
<p>My problem is, since I'm outputting XML, the XSL pro... | <p>The easiest way is to use <a href="http://www.w3.org/TR/xslt.html#dt-attribute-value-template" rel="noreferrer">attribute value templates</a>, like this:</p>
<pre><code><Output Attribute="{Some/Value}"/>
</code></pre>
| <p>You can use an xsl:attribute element:</p>
<pre><code><Output>
<xsl:attribute name="Attribute">
<xsl:value-of select="Some/Value"/>
</xsl:attribute>
</Output>
</code></pre>
| 36,001 |
<p>I would like to move a file or folder from one place to another within the same repository without having to use Repo Browser to do it, and without creating two independent add/delete operations. Using Repo Browser works fine except that your code will be hanging in a broken state until you get any supporting chang... | <p>To move a file or set of files using <code>Tortoise SVN</code>, right-click-and-drag the target files to their destination and release the right mouse button. The popup menu will have a <code>SVN move versioned files here</code> option.</p>
<p><strong>Note that the destination folder must have already been added to... | <p>Use the <code>svn move</code> command to move file/folder.</p>
| 8,806 |
<p>I have heard that it's best not to actually have any html in your helpers; my question is, Why not? And furthermore, if you were trying to generate an html list or something like that, how can I avoid actual tags?</p>
<p>Thanks!</p>
<p>-fREW</p>
| <p>My advice - if it's small pieces of HTML (a couple of tags) don't worry about it. More than that - think about partials (as pulling strings of html together in a helper is a pain that's what the views are good at).</p>
<p>I regularly include HTML in my helpers (either directly or through calls to Rails methods like... | <p>I put html into partials usually.</p>
<p>Think about semantics. If you put html in a string, you lose the semantic aspect of it: it becomes a string instead of markup. Very different. For example, you cannot validate a string, but you can validate markup.</p>
<p>The reason I wanna put html in a helper instead of p... | 16,193 |
<p>I am using Hibernate 3.x, MySQL 4.1.20 with Java 1.6. I am mapping a Hibernate Timestamp to a MySQL TIMESTAMP. So far so good. The problem is that MySQL stores the TIMESTAMP in seconds and discards the milliseconds and I now need millisecond precision. I figure I can use a BIGINT instead of TIMESTAMP in my table a... | <p>Also, look at creating a custom Hibernate Type implementation. Something along the lines of (psuedocode as I don't have a handy environment to make it bulletproof):</p>
<pre><code>public class CalendarBigIntType extends org.hibernate.type.CalendarType {
public Object get(ResultSet rs, String name) {
ret... | <p>Why not use it in addition to the TIMESTAMP field? You would have one field (which is already defined) for storing the date, without the milliseconds, and another field for the milliseconds. You can still run your HSQL queries on the first field, except you will have to ensure that you take care of storing the milli... | 48,254 |
<p>I have <strong>CustomForm</strong> inherited from <strong>Form</strong> which implements a boolean property named <strong>Prop</strong>. The forms I'll be using will inherit from <strong>CustomForm</strong>. This property will do some painting and changes (if it's enabled) to the form. However, this is not working a... | <p>Someone else helped me out and to fix the problem. I just call <strong>ReCreateHandle()</strong> when the user sets <strong>EnableSkin</strong> to false. Problem solved :)</p>
<p>Thanks everyone though :)</p>
| <p>As far as I know the painting routines doesn't reflect in the IDE if you are showing the object that do the painting. For instance, if your base form do some painting, the inherited shows that... but if you open the base form it doesn't show the painting result.</p>
<p>I think that if you need to view the result of... | 40,825 |
<p>Is there a Wiki plugin for TFS 2005, ie. SharePoint Services 2.0?</p>
| <p>You cannot do it easily.</p>
<p>The best option is:
<a href="https://web.archive.org/web/20200718062913/http://geekswithblogs.net:80/kobush/articles/CustomBorderForms3.aspx" rel="nofollow noreferrer">http://geekswithblogs.net/kobush/articles/CustomBorderForms3.aspx</a></p>
<p>You can find more answers here:
<a href=... | <p>The short version is, out of the box, not that I'm aware of.</p>
<p>The longer version is that there's nothing stopping you from creating a borderless form, then creating your own [minimize|restore]/maximize/close buttons on it. You'll have to draw your own form title bar, and basically take on all the magic of mov... | 40,740 |
<p>I'm writing an application that allows users to upload images onto the server. I expect about 20 images per day all jpeg and probably not edited/resized. (This is another question, how to resize the images on the server side before storing. Maybe someone can please drop a .NET resource for that in the comment or so)... | <p>I generally store files on the file-system, since that's what its there for, though there are exceptions. For files, the file-system is the most flexible and performant solution (usually).</p>
<p>There are a few problems with storing files on a database - files are generally much larger than your average row - resu... | <p>If they are small files that will not need to be edited then option B is not a bad option. I prefer this to writing logic to store files and deal with crazy directory structure issues. Having <em>a lot</em> of files in one directory is bad. emkay?</p>
<p>If the files are large or require constant editing, especia... | 45,328 |
<p>While editing an aspx file I found both these opening tags used for seemingly the same thing. Is there a difference and if yes, what is it?</p>
| <p><code><%=</code> is a equivalent to <code><% Repsonse.Write()</code></p>
<p>You can write any content out here: for example </p>
<pre><code><%=myProperty + " additional Text" %>
</code></pre>
<p><code><%#</code> is a binding expression. You can retrieve any public value in the current context (for ... | <p>The difference is that the # symbol specifies a data binding directive, that is resolved at data binding time (for example, when you call Page.DataBind ) and the = sign specifies an evaluation expression just evaluates and prints to the HTML output when that line is processed.</p>
<p>Edit: Just adding that only ins... | 12,616 |
<p>When printing RFC documents on my A4 format printer I noticed that I print more than it is considered to be one page in RFC document. I figure this is because probably RFC is written in North American paper letter format (216 × 279 mm) and I want to use ISO A4 format (210 × 297 mm). Info on <a href="http://en.wikipe... | <p>The RFC documents contain page breaks and such in the form of line printer control codes. Just printing a plain text rfc out of vi / notepad / word / whatever will <em>probably</em> not work as expected. Try searching for the rfc in PDF form, they'll be easier to print and the page numbering should be correct. You m... | <p>Loading a .txt version of an RFC into MS Word will work, so long as you ensure that you download the versions with the embedded form-feed character still in them.</p>
<p>The ones at <a href="http://www.ietf.org/rfc/" rel="nofollow noreferrer">http://www.ietf.org/rfc/</a> are fine for this.</p>
<p>If you set the fo... | 27,883 |
<p>As everyone knows, sometimes developers have to document stuff. Or capture some stuff for filing bug reports. </p>
<p>My question is in MS Windows.</p>
<p>I'm trying to capture the context menu (the popup menu that appears after right-clicking an item) of several areas of an application. Pressing <kbd>Alt</kbd> to... | <p>You can't get the menu on its own, but you can get it to capture the parent window + context menu through a similar trick to the one you discovered with the main menu:</p>
<ol>
<li>Press & hold <kbd>Shift</kbd></li>
<li>Press <kbd>F10</kbd></li>
<li>Press and hold <kbd>Alt</kbd> (you're still holding down <kbd>... | <p>you don't need anything.
Just hook the menu window .</p>
| 30,035 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.