instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I'm thinking of creating a small offline blog editor for personal use and I don't know how do the APIs work. Where can I find this information?</p>
<p>I'm particularly looking for the most common providers: Blogger, Wordpress, MovableType, Live Spaces (not sure if this has an API) etc.</p>
| <p>See the following links:</p>
<p><a href="http://www.blogger.com/developers/api/1_docs/" rel="nofollow noreferrer">Blogger</a></p>
<p><a href="http://codex.wordpress.org/Plugin_API" rel="nofollow noreferrer">Wordpress</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb447732.aspx" rel="nofollow noreferr... | <p>The Blogger API link you provided says:</p>
<blockquote>
<p>This documentation is provided for
historical interest only. The Blogger
1.0 API is no longer supported and must not be used for new client
development. Please use our GData API
instead.</p>
</blockquote>
<p>So the correct one probably is: <a h... | 4,435 |
<p>UPDATE:
Thank you all for your input. Some additional information.</p>
<p>It's really just a small chunk of markup (20 lines) I'm working with and had aimed to to leverage a regex to do the work.</p>
<p>I also do have the ability to hack up the script (an ecommerce one) to insert the classes as the navigation is ... | <p><a href="http://www.jwz.org/" rel="nofollow noreferrer">Jamie Zawinski</a> would have <a href="http://fishbowl.pastiche.org/2003/08/18/beware_regular_expressions/" rel="nofollow noreferrer">something to say about this</a>...</p>
<p>Do you have a proper HTML parser? I don't know if there's anything like <a href="ht... | <p>You could load the navigation in a <a href="http://www.php.net/simplexml" rel="nofollow noreferrer">SimpleXML</a> object and work with that. This prevents you from breaking your markup with some crazy regex :)</p>
| 42,578 |
<p>While refactoring code and ridding myself of all those #defines that we're now taught to hate, I came across this beauty used to calculate the number of elements in a structure:</p>
<pre><code>#define STRUCTSIZE(s) (sizeof(s) / sizeof(*s))
</code></pre>
<p>Very useful as it is but can it be converted into an inlin... | <p>As been stated, the code actually work out the number of elements in an array, not struct. I would just write out the sizeof() division explicitly when I want it. If I were to make it a function, I would want to make it clear in its definition that it's expecting an array.</p>
<pre><code>template<typename T,int ... | <p>Yes it can be made a template in C++</p>
<pre><code>template <typename T>
size_t getTypeSize()
{
return sizeof(T)/sizeof(*T);
}
</code></pre>
<p>to use:</p>
<pre><code>struct JibbaJabba
{
int int1;
float f;
};
int main()
{
cout << "sizeof JibbaJabba is " << getTypeSize<JibbaJabb... | 12,106 |
<p>Is it possible, in Java, to make a <code>JPanel</code> skip drawing its background thus being transparent except for the components on it?</p>
| <p><code>setOpaque(false)</code></p>
<p>It'll pass off painting the background to its parent, which may draw its own background.</p>
<p>You can do a screen capture and then use that to paint the background of the panel.</p>
| <pre><code>class TransparentJPanel extends JPanel
{
TransparentJPanel()
{
super() ;
this.setOpaque( false ) ; // this will make the JPanel transparent
// but not its components (JLabel, TextField etc.)
this.setLayout( null ) ;
}
}
</code></pre>
| 7,858 |
<pre><code>function returnsAnArray ()
{
return array ('test');
}
echo returnsAnArray ()[0];
</code></pre>
<p>generates a syntax error in PHP. What's the most efficient way to directly obtain an element from a returned array without assigning the result to a temp variable?</p>
| <p>Here's one way, using the <a href="http://www.php.net/list" rel="nofollow noreferrer">list</a> language construct</p>
<pre><code>function returnsAnArray ()
{
return array ('test');
}
list($foo)=returnsAnArray();
</code></pre>
<p>You could grab a sequence of elements from an offset by combining this with <a href... | <p>I ask myself why one would like to avoid creating a temporary variable for a returned array. Why don't you just return one value instead of an whole array? Maybe you'll have to overthink your program logic.</p>
<p>Or is it a performance/memory issue? Consider using <a href="http://de2.php.net/manual/en/language.ref... | 20,793 |
<p>Writing a ton of web applications leveraging JSON/AJAX, I find myself returning tons literal javascript objects (JSON). For example, I may be request all the Cats from GetCats.asp. It would return:</p>
<pre>
[
{ 'id': 0, 'name': 'Persian' },
{ 'id': 1, 'name': 'Calico' },
{ 'id': 2, 'name': 'Tabby' }
]
</pr... | <p>There's no getting around the fact that you will have to iterate through all of your simple objects and change them to a different kind of object. You cannot avoid the loop. That being said you could create a constructor that takes a simple object like this and copies those values into the new instance.</p>
<p>Li... | <p>Assign each object an appropriate prototype:</p>
<pre><code>var list = [
{ 'id': 0, 'name': 'Persian' },
{ 'id': 1, 'name': 'Calico' },
{ 'id': 2, 'name': 'Tabby' }
];
for (obj in list)
{
obj.prototype = new Cat();
}
</code></pre>
| 40,788 |
<p>I'm using JQuery's jquery.corner.js to create rounded corners on some td tags, and they look fine in IE EXCEPT </p>
<ol>
<li>if you open a new tab and then come back to the page</li>
<li>if you go to another tab, click a link, then come back to the page</li>
<li>if you hover over a javascript-executing div / menu (... | <p>In IE I had better results with the <em><a href="http://www.filamentgroup.com/lab/achieving_rounded_corners_in_internet_explorer_for_jquery_ui_with_dd_roundi/" rel="nofollow noreferrer">DD_Roundies</a></em> library. Only works in IE though. For Firefox you need to add -moz-border-radius styles.</p>
| <p>It's a bit hard to visualize the issue you're having, a link would be really helpful. Make sure your height and width properties are defined for each cell of your table. It could potentially be a hasLayout issue.</p>
| 26,990 |
<p>If you had some social networking applications and you wanted your users to interact with them using a mobile device would you use WAP or a slimmed down version of your regular website with HTML?</p>
<p>My train of thought is that WAP is dead or at least starting to bleed to death because of all the mobile web brow... | <p>WAP 2.0 = XHTML Mobile Profile. I'm assuming by WAP you mean WAP 1.0 and WML. Pretty much all mobile browsers these days support XHTML MP (or some close cousin).</p>
<p>For best practices on mobile development, refer to the <a href="http://www.networksolutions.com/learning-center/mobi-guide.pdf" rel="noreferrer">do... | <p>You shoud use standard XHTML 1.0 Strict or XHTML Mobile Profile. WAP is going to die very, very soon (if it hasn´t already).</p>
<p><a href="http://en.wikipedia.org/wiki/XHTML_Mobile_Profile" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/XHTML_Mobile_Profile</a></p>
| 36,064 |
<p>I am having issues using the :collection command for a partial within a form I am creating in rails. I would ideally like to use the :collection command, so I can easily manipulate this section in my .rjs templates (the form will submit and reload the form when the check box is changed, it's a to-do list).</p>
<p>T... | <p>I think that the problem is you've not got @list defined anywhere when you're using the render :partial with a :collection.</p>
<p>The system is looking for @list to match the list[] when you call f.check_box</p>
<p>you could set @list = list in your partial to get around that. I suppose.</p>
| <p>Tim's answer is correct, but I'd probably avoid extracting the partial within the form_for loop altogether. I suppose it's a matter of style, but I think the confusion here isn't really worth the cleanup that the partial represents in this case. I'd probably write a partial that included the whole form.</p>
| 38,613 |
<p>Apologies for the long post, but I wonder if I could get some more eyeballs on this before I submit a bug report to Sun.</p>
<p>JVM: 6u11<br>
O/S: Windows XP SP3<br>
Hardware: AMD Athlon 64 X2 4600+ @ 2.41GHz, with 3.25 GB RAM.</p>
<p>I believe I have encountered a fault in the JVM where no thread is given a monit... | <p>The provided thread trace is complete with respect to the lock in question. Two other people I work with agree that a JVM fault is clearly indicated, as do the programmers at jProfiler (ej-technologies).</p>
| <p>Are you sure thread RelayedMessages-0000000001 gets notified? It is normal for the other threads to be blocked as the first thread still obtains the lock for <0x12a8f9f8>. In order to other threads can obtain the lock, first thread should be removed from wait list and scheduled to run again and afterwards release... | 48,432 |
<p>I am looking for things like reordering of code that could even break the code in the case of a multiple processor.</p>
| <p>The most important one would be memory access reordering.</p>
<p>Absent memory fences or serializing instructions, the processor is free to reorder memory accesses. Some processor architectures have restrictions on how much they can reorder; Alpha is known for being the weakest (i.e., the one which can reorder the ... | <p>Yes, but what exactly is your question?</p>
<p>However, since this is an interesting topic: tricks that compilers and processors use to optimize code should not break code, even with multiple processors, in the absence of race conditions in that code. This is called the guarantee of sequential consistency: if your ... | 34,264 |
<p>I have a Visual Studio 2008 solution, and I would like to include a real folder in the solution, but not at the project level, instead at the solution level. </p>
<p>I noticed you can right click the solution and add a solution folder, but it comes up as some white folder, and I have my doubts as to exact... | <p>I also would like to be able to add physical folders to a solution, but unfortunately you can't do so outside a project.</p>
<p>The best solution I have found is to add a solution folder with the same name as the physical folder (myFolder in your example), then add files from that physical folder to the solution fo... | <p>You can also add standalone files in a solution folder, and they will be source-controlled. But be wary that VS tends to put these files in the same folder as the solution file - the "Solution Folders" are virtual and don't corresspond to real filesystem folders. To have a real filesystem folders I think you would h... | 48,918 |
<p>I have a QMainWindow in a Qt application. When I close it I want it to store its current restore size (the size of the window when it is not maximized). This works well when I close the window in restore mode (that is, not maximized). But if I close the window if it is maximized, then next time i start the applicati... | <p>Use the <a href="http://doc.qt.io/qt-4.8/qwidget.html#saveGeometry" rel="nofollow noreferrer">QWidget::saveGeometry</a> feature to write the current settings into the registry.(The registry is accessed using QSettings). Then use restoreGeometry() upon startup to return to the previous state.</p>
| <p>The image at <a href="http://qt-project.org/doc/qt-4.8/application-windows.html" rel="nofollow">http://qt-project.org/doc/qt-4.8/application-windows.html</a> shows, that <code>geometry.x()</code> and <code>geometry.y()</code> are not equal to <code>x()</code> and <code>y()</code>, which are the same as <code>pos()</... | 10,035 |
<p>This is a sql 2000 database that I am working with.</p>
<p>I have what I call a staging table that is a raw data dump of data, so everything is ntext or nvarchar(255). </p>
<p>I need to cast/convert all of this data into the appropriate data types (ie int, decimal, nvarchar, etc.)</p>
<p>The way I was going to do... | <p>Generally I don't like "loop through the record" solutions as they tend to be slow and you end up writing a lot of custom code.</p>
<p>So...</p>
<p>Depending on how many records are in your staging table, you could post process the data with a series of SQL statements that test the columns for correctness and mark... | <p>It looks like you are doomed. See <a href="http://www.sommarskog.se/error-handling-I.html#whathappens" rel="nofollow noreferrer">this</a> document.</p>
<p>TL/DR: A data conversion error always causes the whole batch to be aborted - your sql script will not continue to execute no matter what you do. Transactions won... | 5,374 |
<p>I've copied a Dataset from one csproj to another, and the new project gets the following compile warning:
"The custom tool 'MSDataSetGenerator' failed while processing the file 'Client.xsd'."</p>
<p>In researching this warning I discovered that if I opened a VS cmd prompt and run XSD.exe on the xsd file directly I ... | <p>I'm running into the same problem, and have found a manual workaround for this. </p>
<ol>
<li>Open the properties for the XSD file in your project.</li>
<li>Remove the MSDataSetGenerator entry from the Custom Tool property.</li>
<li>Re-add the MSDataSetGenerator value for the Custom Tool property.</li>
</ol>
<p>Wh... | <p>If you right click on the XSD file in your project there is an option "Run Custom Tool". If the Custom Tool property of the XSD is set to MSDataSetGenerator this will regenerate the class.</p>
| 46,056 |
<p>I have a method that where I want to redirect the user back to a login page located at the root of my web application.</p>
<p>I'm using the following code:</p>
<pre><code>Response.Redirect("~/Login.aspx?ReturnPath=" + Request.Url.ToString());
</code></pre>
<p>This doesn't work though. My assumption was that ASP.... | <blockquote>
<p>I think you need to drop the "~/" and replace it with just "/", I believe / is the root</p>
</blockquote>
<p><strong>STOP RIGHT THERE!</strong> :-) unless you want to hardcode your web app so that it can only be installed at the root of a web site. </p>
<p>"~/" <strong><em>is</em></strong> the corre... | <p>What about using</p>
<pre><code>Response.Redirect(String.Format("http://{0}/Login.aspx?ReturnPath={1}", Request.ServerVariables["SERVER_NAME"], Request.Url.ToString()));
</code></pre>
| 5,112 |
<p>I'd like to hear some opinions as to what role, if any, parallel computing approaches, including the potential use of the parallel extensions (<a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=348F73FD-593D-4B3C-B055-694C50D2B0F3&displaylang=en#filelist" rel="nofollow noreferrer">June CTP for exa... | <p>Well, web-servers present an interesting challenge in that they are already highly threaded, servicing parallel requests. So on a busy site, you can't rely on being able to steal lots of cores for your ends. Of course, if you only expect light traffic, and your site requires lots of crunching (data processing etc), ... | <p>Your humble web server is generally best suited to serving up static content which it can cache. I really doubt its suitability for parallel processing (except as a pure experiment out of interest).</p>
<p>Some clarity after the comment: My original point is not that IIS does not process in parallel. My point is th... | 49,503 |
<p>I am new to strut/web programming and I thought I could learn a lot by reading a sample app. On google, I searched and found a sample app at
<a href="http://www.roseindia.net/struts/struts2/struts2tutorial.zip" rel="nofollow noreferrer">http://www.roseindia.net/struts/struts2/struts2tutorial.zip</a> , the tutorial i... | <p>You will learn a lot by reading sample apps. If your sample doesn't work, perhaps your sample is wrong.</p>
<p>Perhaps you need the actual authoritative documentation. See <a href="http://struts.apache.org/1.2.4/faqs/eclipse.html" rel="nofollow noreferrer">How to setup a basic struts project using Eclipse</a>. T... | <p>Did you name the file "strut.xml" or "struts.xml"? It should be the latter (although you could override it if you wanted). Also, in Struts 2 the struts.xml file has to be in the classpath, not at the root of WEB-INF. So, in your project, you should put in the "src" folder, so when it deploys it goes into WEB-INF/... | 23,841 |
<p>I have googled quite a bit and I cannot find the answer. So how many characters can be stored in a Windows Installer property value. If you give an answer can you provide the source of the answer?</p>
| <p>I asked the Windows Installer team how large a Property could be when marshalling data from an immediate CustomAction to a deferred CustomAction and I was told that I was only really limited by the amount of memory on the machine.</p>
| <p>In case you are writing InstallScript, note that while an MSI property can be set to any length, there is a trick for getting a "long" value. Refer to: <a href="https://stackoverflow.com/questions/16690206/string-too-long-with-msigetproperty-with-installshield-installscript/32214859#32214859">string too long with M... | 36,260 |
<p>I have a ClickOnce deployed application I want to launch from VBScript, similar to launching Microsoft Word in the following example:</p>
<pre><code>Dim word
Set word = CreateObject("Word.Application")
word.Visible = True
</code></pre>
<p>The problem is I don't know what parameter to pass into the <code>CreateObje... | <p>ClickOnce simply isn't installed that way. They don't typically have COM hooks (for CreateObject), and are installed in an isolated part of the user's profile (not that machine's profile). And don't forget you can also get multiple copies/versions of the same app at once via ClickOnce (from different locations).</p>... | <p>Thanks for the info. That made me realize that I could use a .Net executable instead of a vbscript to launch my application.</p>
<pre><code> Dim program As New Process
'Try to run a .Net click-once application
Try
Dim shortcut As String = Environment.GetFolderPath(Environment.SpecialFolder.Star... | 29,751 |
<p>I've kept up to date with new features in the C# language as it's moved from version 1 through version 3. I haven't done such a good job keeping up to date with ASP.NET. I feel like some of the post version 1 features are not so good (e.g. the AJAX framework) or are just not that useful to me (e.g. the membership ... | <p>For ASP.NET, you have a lot of improvements:</p>
<ul>
<li>split view (code and design)</li>
<li>faster switching between code and design view</li>
<li>embedded master pages (one master page in another)</li>
<li>javascript debugging</li>
</ul>
<p>Anyway most of the useful stuff are really in the meat of the languag... | <p>I don't think the MVC Framework is quite ready for prime time yet, though I definitely plan to use it sometime next year. I love the clean URLs, clean XHTML (web forms can really spew out some nasty HTML) and the ability to create controller actions with no associated view.</p>
<p>I've been using Master Pages sinc... | 3,147 |
<p>I'd like to use Segoe UI 9 pt on Vista, and Tahoma 8 pt on Windows XP/etc. (Actually, I'd settle for Segoe UI on both, but my users probably don't have it installed.) But, these being quite different, they really screw up the layout of my forms. So... is there a good way to deal with this?</p>
<p>An example: I have... | <p>It's strange to need to layout one control within another. You might be solving an upstream problem wrong. Are you able to split the label into two labels with the updown between and maybe rely on a Windows Forms TableLayout panel? </p>
<p>If it's essential to try to position based on font sizes, you could use <a... | <p>First of all, you can find out which version of Windows you are using with the <a href="http://msdn.microsoft.com/en-us/library/system.operatingsystem.platform.aspx" rel="nofollow noreferrer">OperatingSystem.Platform</a> property in the System library.</p>
<p>Second, it is possible that you may put your font settin... | 5,795 |
<p>I am working on setting up a Drupal based website and wanted to replace the site title in the header with an image file. I came across this article: <a href="http://www.mezzoblue.com/tests/revised-image-replacement/" rel="nofollow noreferrer">"Revised Image Replacement"</a> summarizing several techniques for doing ... | <p>This should do the trick :</p>
<pre><code>// Macros
$mes = "mysql_escape_string";
$ss = "stripslashes";
// Using your macros
$x = $mes($ss($_GET['x']));
</code></pre>
<p>Though I don't recommend coding like this at all. </p>
<p>I'm just answering the question since you said you didn't want to create any new func... | <p>"easily", sure? "elegantly", nope.</p>
| 41,319 |
<p>Has anybody experimented with these. Is this supported?</p>
| <p>I actually had to try this myself. :0</p>
<p>It does not seem to be supported. I get this error when adding a stored procedure using a tvp parameter into the dbml file</p>
<p>DBML1005: Mapping between DbType 'Structured' and Type 'System.Object' in Parameter 'TVP' of Function 'dbo.spTestTableTypeParm' is not suppo... | <p>I actually had to try this myself. :0</p>
<p>It does not seem to be supported. I get this error when adding a stored procedure using a tvp parameter into the dbml file</p>
<p>DBML1005: Mapping between DbType 'Structured' and Type 'System.Object' in Parameter 'TVP' of Function 'dbo.spTestTableTypeParm' is not suppo... | 43,871 |
<p>I need to have a string, based on an integer, which should always have 5 digits.</p>
<p>Example:</p>
<pre><code>myInteger = 999
formatedInteger = "00999"
</code></pre>
<p>What is the best way of doing this in classic ASP?</p>
| <p>You can use string manipulation functions for this.</p>
<p>This assumes classic ASP with VBScript (original version of the answer).</p>
<pre class="lang-vb prettyprint-override"><code>Const NUMBER_DIGITS = 5
Dim myInteger
Dim formatedInteger
myInteger = 999
formatedInteger = Right(String(NUMBER_DIGITS, "0") &... | <p>Really, you should ask yourself why you might want this. </p>
<p>If this is for display purposes then it's probably best to apply a string formatting function (there will be one) to your integer, at the point of display.</p>
<p>On the other hand, if you need it for internal processing, i.e. you're always expectin... | 37,754 |
<p>I have noticed that cURL in PHP returns different data when told to output to a file via <code>CURLOPT_FILE</code> as it does when told to send the output to a string via <code>CURLOPT_RETURNTRANSFER</code>.</p>
<p><code>_RETURNTRANSFER</code> seems to strip newlines and extra white space as if parsing it for displ... | <p>Turns out, the error is not in what was being returned, but in the way I was going about parsing it. \r\n is not parsed the way I expected when put in single quotes, switching to double quotes solved my problem. I was not aware that this made a difference inside function calls like that.</p>
<p>This works just fine... | <p>I didn't try to reproduce the "bug" (I think we can consider this as a bug if it is the actual behavior), but maybe you could get over it.</p>
<p>The PHP Doc says that the default comportement is to write the result to a file, and that the default file is STDOUT (the browser's window). What you want is to get the s... | 12,976 |
<p>What's the best way to connect to a Informix database from .Net?</p>
<p>I'm developing a client-server application based on a legacy Informix DB which used to be connected by JDBC.</p>
<p>I need it, from the most important to the least:</p>
<ol>
<li>To be fast</li>
<li>DB server changes not needed</li>
<li>No ODB... | <p>The connections strings to use with OleDb or ADO.NET can be found <a href="http://www.connectionstrings.com/?carrier=informix" rel="nofollow noreferrer">here</a>.</p>
<p>Take a look at this <a href="https://www.ibm.com/developerworks/data/library/techarticle/dm-0510durity/index.html" rel="nofollow noreferrer">artic... | <p><a href="http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.relnotes.doc/uc3/netrel.htm" rel="nofollow noreferrer">http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.relnotes.doc/uc3/netrel.htm</a></p>
<p>See if that helps. Also, what about the built in ODBC or ... | 23,390 |
<p>Visual Studio makes calling a web service easy, trying to figure out what is going on under the covers is difficult.</p>
<p>How can I see the actual XML generated from my .Net app when making a call to a web service?</p>
| <p>tools like <a href="http://www.pocketsoap.com/tcptrace/" rel="noreferrer">tcptrace</a> or <a href="http://www.fiddler2.com/fiddler2/" rel="noreferrer">Fiddler</a> can help. </p>
<p>few troubleshooting links:</p>
<p><a href="http://www.pluralsight.com/community/blogs/aaron/archive/2006/04/17/21870.aspx" rel="norefe... | <p>The suggestion to use <a href="http://www.fiddler2.com/fiddler2" rel="nofollow noreferrer">Fiddler</a> was enough for me to get my IT team on board. They already had a copy of a similar program <a href="http://www.wireshark.org" rel="nofollow noreferrer">WireShark</a> installed on the webserver. </p>
<p>Not being... | 25,182 |
<p>I have a class that defines the names of various constants, e.g.</p>
<pre><code>class Constants {
public static final String ATTR_CURRENT_USER = "current.user";
}
</code></pre>
<p>I would like to use these constants within a JSP <strong>without</strong> using Scriptlet code such as:</p>
<pre><code><%@ page... | <p>On application startup, you can add the Constants class to the servletContext and then access it in any jsp page</p>
<pre><code>servletContext.setAttribute("Constants", com.example.Constants);
</code></pre>
<p>and then access it in a jsp page</p>
<pre><code><c:out value="${Constants.ATTR_CURRENT_USER}"/>
</... | <p>Why do you want to print the value of the constant on the JSP? Surely you are defining them so that in the JSP you can extract objects from the session and request before you present them?</p>
<pre>
<%@ page import="com.example.Constants" %>
<%@ page import="com.example.model.User" %>
<%
User user = (User)... | 15,494 |
<p>I have a class Pkg and I need to use it under form of QVariant. </p>
<p>At the end of my Pkg.h I have:</p>
<pre><code>Q_DECLARE_METATYPE(Pkg)
</code></pre>
<p>and this does not give compile errors, but in my main.cpp I have to do:</p>
<pre><code>qRegisterMetaType<Pkg>("Pkg");
</code></pre>
<p>and this doe... | <p>The QVariant constructor won't just take any old type. You need to use <a href="http://doc.trolltech.com/4.4/qvariant.html#setValue" rel="nofollow noreferrer">QVariant::setValue()</a> or <a href="http://doc.trolltech.com/4.4/qvariant.html#qVariantFromValue" rel="nofollow noreferrer">qVariantFromValue</a>.</p>
| <p>ahhhhh solved, many thanks, I've used:</p>
<pre><code> item->data(1,Qt::UserRole).value<Pkg>();
</code></pre>
<p>item is the QTreeWidgetItem selected in this event:</p>
<pre><code>connect(packList,SIGNAL(itemClicked(QTreeWidgetItem*, int)), SLOT(setActualPackage(QTreeWidgetItem*)));
</code></pre>
| 46,620 |
<p>Lets assume we have this xml: </p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<tns:RegistryResponse status="urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure"
xmlns:tns="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0">
<t... | <pre><code>var q = from x in doc.Root.Elements()
where x.Name.LocalName=="RegistryErrorList"
select x;
var errorList = q.SingleOrDefault();
</code></pre>
| <p>The following extension will return a collection of matching elements from any level of an XDocument (or any XContainer).</p>
<pre><code> public static IEnumerable<XElement> GetElements(this XContainer doc, string elementName)
{
return doc.Descendants().Where(p => p.Name.LocalName == elemen... | 21,192 |
<p>I am using an IP location lookup to display localised prices to customers depending on whether they are visiting from the UK, US or general EU and defaulting to the US price if the location can't be determined. </p>
<p>I could easily force the system to believe I'm from a specific country for testing but still ther... | <p>You should be able to achieve that by using proxies. <a href="http://www.proxy4free.com/page1.html" rel="nofollow noreferrer">http://www.proxy4free.com/page1.html</a> has a bunch. That site just came from a Google search; I've never used proxies like this before though, so there may be better sites out there.</p>
| <p>If the website is indexed in Google's cache, you can visit the google with the proper URL address. ex. <a href="http://www.google.co.uk/" rel="nofollow noreferrer">http://www.google.co.uk/</a></p>
<p>And see if it's displaying properly in the cache.</p>
| 37,420 |
<p>One thing I've always wondered about is how software patches work. A lot of software seems to just release new versions on their binaries that need to be installed over older versions, but some software (operating systems like Windows in particular) seem to be able to release very small patches that correct bugs or ... | <p>This is usually implemented using binary diff algorithms -- diff the most recently released version against the new code. If the user's running the most recent version, you only need to apply the diff. Works particularly well against software, because compiled code is usually pretty similar between versions. Of cour... | <p>If you are talking about patching windows applications then what you want to look at are .MSP files. These are similar to an .MSI but just patch and application.</p>
<p>Take a look at <a href="http://msdn.microsoft.com/en-us/library/aa370579(VS.85).aspx" rel="nofollow noreferrer">Patching and Upgrading</a> in the ... | 17,509 |
<p>Looking for a c# library that interfaces to multiple merchant gateways.
Should at minimum be able to handle PayPal and authorize.</p>
| <p>I've used <a href="http://www.dotnetcharge.com/" rel="nofollow noreferrer">dotnetcharge</a> with success. They have support for something like 50 payment processors, plus (most importantly), data storage encryption for credit card information.</p>
| <p>Considering that working with the gateways themselves is extremely simple, Adding support to your application for each one shouldn't be difficult.</p>
<p>That said, here is one that claims to have the support you want:</p>
<p><a href="http://www.componentsource.com/products/ibiz-e-payment-integrator-net/index.html... | 24,062 |
<p>Suppose you have a method with some pre and post-conditions.
Is it ok to create an exception class for each pre-condition that is not accomplished?
For example:
Not accomplishing pre1 means throwing a notPre1Exception instance.</p>
| <p>Why wouldn't you want to define PreconditionFailedException(string precondition)? Throwing a different exception type for each failed precondition is overkill.</p>
| <p>I would say it's okay as long as you make them unchecked exceptions (subclass of RuntimeException in Java). However, in Java it is better to just use assertions.</p>
| 18,062 |
<p>I have code in an Update Panel and even though on a button click i am inserting data into a db and simply calling Updatepanel.Update() the whole page is reloaded:</p>
<p>Gifts.ASPX</p>
<pre><code><table style="width:100%;">
<tr>
<td>
<asp:Label I... | <p>Where is the button on Gifts.ASPX? If you put the button inside the UpdatePanel or use triggers you don't need to call UpdatePanel3.Update(); from the code behind.</p>
| <p>please check tag of update panel...you have to specify the trigger controls for update panel on on which the update panel will get update</p>
| 37,464 |
<p>I am interested in hearing about experiences using TDD and unit testing for C++ in general with Visual Studio 2005 (Professional)</p>
<p>First some background. We have a fairly large project and much of it has been developed on Linux using CppUnit for the unit tests. The project is divided into several libraries, e... | <p>I use the Boost Test framework. I tend to split my code into .lib files and will have a separate console-mode EXE test project for each. When the test project is built it makes use of the 'Post build stage' to launch itself, thus running the tests. You could make each test project a dependency of your main applic... | <p>Have a look at <a href="http://code.google.com/p/cunitwin32/" rel="nofollow noreferrer">CUnitWin32</a>. There's an example included as well.</p>
| 13,627 |
<p>I haven't been able to find this explicitly stated anywhere yet, but a bunch of examples I've found online follow what I've been doing.</p>
<p>I have a C# class which uses ODP.net to connect to an Oracle DB and run a procedure that's in a package. </p>
<p>My package has stored procedures which take a ref cursor o... | <p>ODP.NET requires you to clean up things. So you:</p>
<ul>
<li>have to dispose OracleParameter instances, as they contain unmanaged resources (!) and Odp.net doesn't do this</li>
<li>have to dispose OracleCommand objects, as they too contain unmanaged resources and closing a connection doesn't close these</li>
<li>o... | <p>I'm not sure if you've stumbled onto <a href="http://www.oracle.com/technology/oramag/oracle/06-jan/o16odpnet.html" rel="nofollow noreferrer">this</a> article, and it doesn't apply directly to your question, but it illustrates something I learned when working with ODP.Net: when in doubt, always close (connections) a... | 46,700 |
<p>I'm going through MSIL and noticing there are a lot of <a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.opcodes.nop.aspx" rel="nofollow noreferrer">nop</a> instructions in the MSIL.</p>
<p>The MSDN article says they take no action and are used to fill space if the opcode is patched. They're u... | <p>NOPs serve several purposes:</p>
<ul>
<li>They allow the debugger to place a breakpoint on a line even if it is combined with others in the generated code.</li>
<li>It allows the loader to patch a jump with a different-sized target offset.</li>
<li>It allows a block of code to be aligned at a particular boundary, w... | <p>They allow the linker to replace a longer instruction (typically long jump) with a shorter one (short jump). The NOP takes the extra space - the code could not be moved around as it would stop other jumps from working. This happens at link-time, so the compiler can't know whether a long or short jump would be approp... | 29,074 |
<p>I despise the PHP language, and I'm quite certain that I'm not alone. But the great thing about PHP is the way that mod_php takes and hides the gory details of integrating with the apache runtime, and achieves CGI-like request isolation and decent performance.</p>
<p>What's the shortest-distance approach to gettin... | <p>Look at <a href="http://www.catalystframework.org/" rel="noreferrer">Catalyst</a> this MVC (model, view, controller) framework works stand-a-lone or with apache_perl and hides a lot of the messy bits. There is a slightly odd learning curve (quick start, slower middle, then it really clicks for advanced stuff).</p>
... | <p>I've worked with HTML::Mason, first hacking RT and then creating two sites with it. There's a learning curve, but it's not too bad. Worse, I think, is installing the thing, but that has much more to do with Apache and mod_perl than Mason. Once the pieces are in place, it's only as complicated as you make it (like... | 16,467 |
<p>I'm trying a very basic XPath on <a href="http://pastebin.com/f14a20a30" rel="noreferrer">this xml</a> (same as below), and it doesn't find anything.
I'm trying both .NET and <a href="http://www.xmlme.com/XpathTool.aspx" rel="noreferrer">this website</a>, and XPaths such as <code>//PropertyGroup</code>, <code>/Prope... | <p>You can add namespaces in your code and all that, but you can effectively wildcard the namespace. Try the following XPath idiom.</p>
<pre><code>//*[local-name()='PropertyGroup']
//*[local-name()='MSBuildCommunityTasksPath']
</code></pre>
<p>name() usually works as well, as in:</p>
<pre><code>//*[name()='PropertyG... | <p>Your issue is with the namespace (xmlns="http://schemas.microsoft.com/developer/msbuild/2003"). You're receiving zero nodes because you aren't qualifying it with the namespace. If you remove the xmlns attribute, your "//PropertyGroup" XPath will work. How you query with namespace usually involves aliasing a defau... | 12,922 |
<p>For example:</p>
<blockquote>
<p>This is main body of my content. I have a
footnote link for this line [1]. Then, I have some more
content. Some of it is interesting and it
has some footnotes as well [2].</p>
<p>[1] Here is my first footnote.</p>
<p>[2] Another footnote.</p>
</blockquote>
<p>So, ... | <p>Give a container an id, then use <code>#</code> to refer to that Id.</p>
<p>e.g.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><p>This is main body of my con... | <p>anchor tags using named anchors</p>
<p><a href="http://www.w3schools.com/HTML/html_links.asp" rel="nofollow noreferrer">http://www.w3schools.com/HTML/html_links.asp</a></p>
| 9,254 |
<p>I'm having an issue with the following code:</p>
<pre><code> private void DataPortal_Fetch(TaskCriteria criteria)
{
using (var ctx = ContextManager<Gimli.Data.GimliDataContext>
.GetManager(Database.ApplicationConnection, false))
{
this.RaiseListChangedEve... | <p>The following code works ... interestingly enough ... any idea of why?</p>
<pre><code>query = query.Where(row => row.InvoiceId == new Guid("00000000-0000-0000-0000-000000000000"));
</code></pre>
| <p>Try changing the code to:</p>
<pre><code>query.Where(row => object.Equals(row.InvoiceId, Guid.Empty))
</code></pre>
<p>Post back if that helped...</p>
| 46,727 |
<p>I've worked on a couple of projects where we spent a great deal of time discussing and writing elaborate coding standards covering everything from syntax layout to actual best practices. However, I have also found that these are rarely followed to the full extent. Many developers seem to hesitate to reject a code re... | <p>I've worked in places with barely-followed coding practices, and others where they're close to being enforced - or at least easily checked.</p>
<p>A few suggestions:</p>
<ul>
<li>The most important thing is to get buy-in to the idea that consistency trumps your personal preferred style. There should be discussion ... | <p>I have never seen a project fail because of lack of coding standards (or adherence to them), or even have any effect on productivity. If you are spending any time on enforcing them then you are wasting money. There are so many important things to worry about instead (like code quality).</p>
<p>Create a set of sug... | 49,397 |
<p>How do I check if an object is of a given type, or if it inherits from a given type?</p>
<p>How do I check if the object <code>o</code> is of type <code>str</code>?</p>
<hr />
<p><sub>Beginners often wrongly expect the string to <em>already be</em> "a number" - either expecting Python 3.x <code>input</code... | <p>Use <a href="https://docs.python.org/library/functions.html#isinstance" rel="noreferrer"><code>isinstance</code></a> to check if <code>o</code> is an instance of <code>str</code> or any subclass of <code>str</code>:</p>
<pre><code>if isinstance(o, str):
</code></pre>
<p>To check if the type of <code>o</code> is exac... | <p>I think the best way is to typing well your variables. You can do this by using the "typing" library.</p>
<p>Example:</p>
<pre class="lang-py prettyprint-override"><code>from typing import NewType
UserId = NewType ('UserId', int)
some_id = UserId (524313`)
</code></pre>
<p>See <a href="https://docs.python.... | 18,409 |
<p>I've studied C programming in college some years ago and have developed some medium applications back then (nothing serious). Now I have to develop some more 'advanced' C applications (involving POSIX threads and RPC), but right now I'm a little rusty even with the basics.</p>
<p>Can anyone recommend me good online... | <ul>
<li><del><a href="http://members.aol.com/wantondeb/" rel="nofollow noreferrer">C standard library reference (both C89 and C99)</a></del></li>
<li><a href="http://www.acm.uiuc.edu/webmonkeys/book/c_guide/" rel="nofollow noreferrer">C89 library reference guide</a></li>
<li><a href="http://www.crasseux.com/books/ctut... | <p>I would recommend reading through the <a href="http://c-faq.com/" rel="nofollow noreferrer">comp.lang.c FAQ</a> at least once to help get the rust off. For reference material, you might want to grab a copy of the C Standard, the latest version of C99 with TC3 included is available for free <a href="http://www.open-... | 23,055 |
<p>I'm working in an ASP.NET MVC Beta 1 project, and I've noticed that if I want to rename a file in the Solution Explorer pane, Ctrl+Backspace does not do what it should (delete the closest "word"), and I get a silly box character and annoyed.</p>
<p>I'm doing this rather a lot as I'm using jTemplates, so rather than... | <p>Probably not. File a bug on connect.microsoft.com, and hope that they fix it in VS 2010.</p>
| <p>I'm not sure if this completely works, but if you go to Tools -> Options: Environemt -> Keyboard, you can set up short cuts. </p>
<p>Type "Rename" in the Show commands containing textbox.
Search for "File.Rename"</p>
<p>Put your cursor in the "Press shortcut keys" textbox and press Ctrl+Backspace.</p>
<p>Press As... | 32,333 |
<p>I wanted to know why UDP is used in RTP rather than TCP ?. Major VoIP Tools used only UDP as i hacked some of the VoIP OSS.</p>
| <p>As DJ pointed out, TCP is about getting a reliable data stream, and will slow down transmission, and re-transmit corrupted packets, in order to achieve that.</p>
<p>UDP does not care about reliability of the communication, and will not slow down or re-transmit data.</p>
<p>If your application needs a reliable data... | <p>UDP is used wherever data is send, that does not need to be exactly received on the target, or where no stable connection is needed.</p>
<p>TCP is used if data needs to be exactly received, bit for bit, no loss of bits.</p>
<p>For Video and Sound streaming, some bits that are lost on the way do not affect the resu... | 47,242 |
<p>Our automated build machine needs to archive the version numbers of the OS plus various tools used during each build. (In case we ever need to replicate exactly the same build later on, perhaps when the machine is long dead.)</p>
<p>I see the command "msinfo32.exe" can be used to dump a whole load of system versio... | <p><strong>EMAIL ADDRESS</strong></p>
<p>Rational</p>
<ol>
<li>Users don't change emails very often</li>
<li>Removes the step of asking for username and email address, which you'll need anyway</li>
<li>Users don't often forget their email address (see number one)</li>
<li>Email will be unique unless the user already ... | <p>OpenID seems to be a very good alternative to writing your own user management/authentication piece. I'm seeing more and more sites using OpenID these days, so the barrier to entry for your users should be relatively low.</p>
| 2,790 |
<p>We have a problem affecting the production environment only.</p>
<p>We have a VB6/ASP website that allows for data in a database table to be hand edited.</p>
<p>It looks alot like an editable datagrid.</p>
<p>One of the editable columns is a date and when the record is saved dates day/month are being reversed.</p... | <p>If you convert the user supplied string to a date <em>before</em> you feed it to the DB, then the <a href="http://msdn.microsoft.com/en-us/library/ms525071.aspx" rel="nofollow noreferrer">Session.LCID</a> of the thread executing your ASP page is responsible for how dates are interpreted. </p>
<p>If you feed the dat... | <p>How about the regional settings of the OS?</p>
| 35,487 |
<p>I am a 10year+, C++ linux/windows developer and I have been asked to estimate the effort to port the windows application to OS X.</p>
<p>I haven't developed on OS X before,so I don't know what to expect.</p>
<p>It is a C++/Qt application, so I want to ask: what are the de facto tools like editor, IDE, compiler, ma... | <p>You're in luck that your app is in Qt, TrollTech has a lot of documentation on how to do this; developing on OS X can be very similar to developing on Linux, make sure to check out the MacPorts project (<a href="http://www.macports.org" rel="nofollow noreferrer">http://www.macports.org</a>), which is like apt-get/yu... | <p>If all your code is Qt, it would not be a big job to make it compile and run on OSX or linux, but if you use other windows specific things, it might take some time. How mutch depends on how much you have programed, how big the project is, your experience with g++ and so on.</p>
<p>Trolltech has released a beta of t... | 47,894 |
<p>I'm pretty much into lisp at the moment, and unfortunately i'm only available to code on windows. Is is possible to let Notepad++ take care of the interpreting of my scripts, and display the output in the compiler window?</p>
<p>If yes, what interpreter would be the best to use?</p>
<p>Thanks!</p>
| <p>I'd consider picking up NT EMACS instead. Does all that stuff, free, and if you get bored you can always run M-x psychoanalyze-pinhead.</p>
<p>If you're really doing Scheme, have a look at Drscheme.</p>
| <p>I found getting slime (superior lisp interaction mode emacs) up and running in emacs a little difficult. You do want slime, but the barrier to entry is a little high if you don't already know emacs--or even if you do! </p>
<p>Luckily, there's a much easier way. </p>
<p>Just download <a href="http://common-lisp.n... | 49,208 |
<p>How can you get the directory of the script that was run and use it within the .cmd file?</p>
| <p>Raymond Chen has a few ideas:</p>
<blockquote>
<p><a href="https://devblogs.microsoft.com/oldnewthing/20050128-00/?p=36573" rel="nofollow noreferrer">https://devblogs.microsoft.com/oldnewthing/20050128-00/?p=36573</a></p>
</blockquote>
<p>Quoted here in full because MSDN archives tend to be somewhat unreliable:<... | <pre><code>for /F "eol= delims=~" %%d in ('CD') do set curdir=%%d
pushd %curdir%
</code></pre>
<p><a href="http://www.umachandar.com/technical/CMDScripts/Main12.htm" rel="nofollow noreferrer">Source</a></p>
| 15,799 |
<p>How to dynamically bind data to <code><%Html.Dropdownlist....</code> in ASP.NET MVC?</p>
| <p>Just pass the correct IEnumerable as the typed model or ViewData. Try something like this (out of my head):</p>
<pre><code><%= Html.DropDownList(string.Empty,
"myDropDownList",
new SelectList((IEnumerable)ViewData["stuff"],
"DescriptionProperty",
"ValueProperty"))
%>
</code></pre... | <p><a href="http://www.altafkhatri.com/Technical/How_to_bind_IList_with_MVC_Dropdownlist_box" rel="nofollow noreferrer">link text</a>The link below provides 2 methods to bind dropdownlist.
Bind Dropdownlist</p>
| 26,425 |
<p>Is there a way to find the HTML element on the page that a Silverlight control is hosted in from within Silverlight?</p>
| <p>Use this:</p>
<pre><code>System.Windows.Browser.HtmlElement plugin = System.Windows.Browser.HtmlPage.Plugin;
</code></pre>
| <p>Use firefox and install <a href="https://addons.mozilla.org/en-US/firefox/addon/1843" rel="nofollow noreferrer">FireBug</a></p>
<p>Then use the 'inspect' button and highlight the silverlight portion of the page. This should automatically show you the HTML for that portion of the page and show you the element which ... | 47,928 |
<p>What is the optimal number of connections that can be open on a SQL Server 2000 DB. I know in the previous company I was working for, on a tru 64 box with Oracle 8i, 8 processor machine we'd figured out that 8*12= 96 connections seemed to be a good number. Is there any such calc for SQL Server 2000. The DB runs on a... | <p>If you don't know if this is your performance bottleneck then you should be trying to determine that, not trying to limit the connections or something.</p>
<p>If you haven't, you should:</p>
<ol>
<li>Use SQL Profiler to find long-running queries.</li>
<li>Monitor your db server's cpu load, memory/page file usage, ... | <p>If the app is a long running app and it's on the same server, if the app leaves open db handles that have created a lock this is truly bad for performance. You can check something like select * from sys.dm_tran_locks or sp_lock to give you an idea.</p>
| 32,336 |
<p>I have created the following stored procedure..</p>
<pre><code>CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP]
(
@CODE CHAR(5)
, @DESC VARCHAR(255) OUTPUT
)
AS
DECLARE @SERVERNAME nvarchar(30)
DECLARE @DBASE nvarchar(30)
DECLARE @SQL nvarchar(2000)
SET @SERVERNAME =
Convert(nvarchar,
(SELECT spData FRO... | <p>Change the line:</p>
<pre><code>SET @myDesc =
EXEC UDSPRBHPRIMBUSTYPESTARTUP @CODE = @myCode, @DESC = @@tempDesc OUTPUT
</code></pre>
<p>to</p>
<pre><code>EXEC UDSPRBHPRIMBUSTYPESTARTUP @CODE = @myCode, @DESC = @tempDesc OUTPUT
</code></pre>
<p>And you have missed assigning <code>@DESC</code> in the stored pr... | <p>You can create a function (instead of a procedure) that returns a table.</p>
<pre><code>CREATE FUNCTION [dbo].[my_function]
(
@par2 UNIQUEIDENTIFIER,
@par2 UNIQUEIDENTIFIER,
@par3 UNIQUEIDENTIFIER
)
RETURNS @returntable TABLE
(
col1 UNIQUEIDENTIFIER,
col2 NVARCHAR(50),
col3 NVARCHAR(... | 23,135 |
<p>I need to modify a (xml-)file from Apache Ant. "loadfile" task allows to load the file's content in a property. But how to store the property's value back to a file after its (property) modification?</p>
<p>Of course I could write custom task to perform this operation but I would like to know if there's some existi... | <p>You can use the <a href="http://ant.apache.org/manual/Tasks/echo.html" rel="noreferrer">echo</a> task.</p>
<pre><code><echo file="${fileName}" message="${xmlProperty}"/>
</code></pre>
<p>The <a href="http://ant.apache.org/manual/Tasks/echoxml.html" rel="noreferrer">echoxml</a> task might be of interest to yo... | <p>Use <a href="http://ant.apache.org/manual/Tasks/propertyfile.html" rel="noreferrer">propertyfile</a> task. An example taken from ant manual:</p>
<pre><code><propertyfile file="my.properties">
<entry key="abc" value="${abc}"/>
</propertyfile>
</code></pre>
<p>This may be better than <code>echo<... | 32,774 |
<p>Given a java.util.Date object how do I go about finding what Quarter it's in?</p>
<p>Assuming Q1 = Jan Feb Mar, Q2 = Apr, May, Jun, etc.</p>
| <p>Since Java 8, the quarter is accessible as a field using classes in the <a href="https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html" rel="noreferrer">java.time</a> package.</p>
<pre><code>import java.time.LocalDate;
import java.time.temporal.IsoFields;
LocalDate myLocal = LocalDate.now();
quar... | <p>For Me, I Used this method for string representation:</p>
<pre><code>int quarter = (Calendar.getInstance().get(Calendar.MONTH) / 3); // 0 to 3
String[] mQuarterKey = {"qt1", "qt2", "qt3", "qt4"};
String strQuarter = mQuarterKey[quarter];
</code></pre>
| 38,873 |
<p>In AES encryption (.net framework), how are the public and private keys used?</p>
<p>Are the public and private keys combined to form a full key, and then the algorithm uses the public + private key to encrypt the data?</p>
<p>(simplified keys used below for example purposes)</p>
<p>e.g.
public key = 12345
privat... | <p>As others have said, AES is a symmetric algorithm (<a href="http://en.wikipedia.org/wiki/Symmetric-key_algorithm" rel="noreferrer">private-key cryptography</a>). This involves a <strong>single</strong> key which is a shared secret between the sender and recipient. An analogy is a locked mailbox <strong>without</stro... | <p>A public key is linked to a private key. The public key (<a href="http://www.cs.bham.ac.uk/~mdr/teaching/modules03/security/public_key.html" rel="nofollow noreferrer">RSA</a>) is distributed to the 'wild' and anyone who wants to send an encrypted file (generically speaking here), they will request the public key and... | 34,439 |
<p>In my web application, I need to log all the SOAP messages to my SQL 2005 database whenever I make a web service call to my business partners' web service. How do I accomplish that?</p>
<p>Thanks in Advance,</p>
<p>Tony</p>
| <p>You haven't specified what language you are using but assuming C# / .NET you could use <a href="http://msdn.microsoft.com/en-us/library/esw638yk(VS.71).aspx" rel="nofollow noreferrer">SOAP extensions</a> to get the SOAP content as a string and then use a simple INSERT to add to an arbitrary DB table.</p>
<p>There a... | <p>Consider using Log4net configured with an Appender that targets the database table.</p>
| 32,145 |
<p>What are the best and worst emacs key bindings in development software? Ever since I learned it, I find myself trying to use C-p and C-n to move up and down in everything that has a text box on it.</p>
<p>I'm perpetually annoyed by software that has an emacs mode that's pretty obviously either put together by some... | <p><strong>A Valiant attempt</strong></p>
<p><strong>Eclipse</strong> Emacs bindings are decent when editing. In some dialog boxes, however, they mysteriously break and copy reverts to C-c and paste to C-v. An irritation.</p>
<p><strong>A nice Mac OS Bonus</strong></p>
<p>On Mac OS, all <strong>Cocoa</strong> applic... | <h2>The good</h2>
<ul>
<li>Um... emacs? Haven't found any software other than emacs that does a decent job of making the environment emacs-like enough.</li>
</ul>
<h2>The bad</h2>
<ul>
<li>SQL Developer by Oracle - seriously, does it have to be that difficult to make C-p do something other than print?</li>
</ul>
<h2>M... | 37,417 |
<p>The Project's Web section (under project properties in VS2008) has a list of debuggers: ASP.NET, Native Code, SQL Server. What is Native Code?</p>
| <p>Native code is machine code executed directly by the CPU. This is in contrast to .NET bytecode, which is interpreted by the .NET virtual machine.</p>
<p>A nice MSDN hit: <a href="https://learn.microsoft.com/en-us/visualstudio/debugger/debugging-native-code?view=vs-2017" rel="nofollow noreferrer">Debugging Native Co... | <p>For starters, the native code is just an Intermediate Language tailored to run on a particular assembly. It resembles the object code as in other HLLs.</p>
| 18,317 |
<p>I have a ControlTemplate that is made up of a ToolBarTray and a ToolBar. In my ToolBar, I have several buttons and then a label. I want to be able to update the label in my toolbar with something like "1 of 10" </p>
<p>My first thought is to programatically find the label and set it, but I'm reading that this s... | <p>The purpose of a ControlTemplate is to define the look of a control. For your problem, I'm not sure if a control template is the right solution.</p>
<p>As Bryan also points out, you should bind the <em>Content</em> property of the Label to a property that is already present in your control. This should be done via ... | <p>I would create a view model which implements INotifyPropertyChanged interface and use DataTemplate to display it using something like this:</p>
<pre><code><DataTemplate DataType={x:Type viewmodel:MyToolBarViewModel}>
<Label Content={Binding CurrentPage} />
<Label Content={Binding TotalPages} ... | 27,387 |
<p>I'm searching a wsgi middleware which I can warp around a wsgi applications and which lets me monitor incoming and outgoing http requests and header fields.</p>
<p>Something like firefox live headers, but for the server side.</p>
| <p>The middleware</p>
<pre><code>from wsgiref.util import request_uri
import sys
def logging_middleware(application, stream=sys.stdout):
def _logger(environ, start_response):
stream.write('REQUEST\n')
stream.write('%s %s\n' %(
environ['REQUEST_METHOD'],
request_uri(environ)... | <p>The mod_wsgi documentation provides various tips on debugging which are applicable to any WSGI hosting mechanism and not just mod_wsgi. See:</p>
<p><a href="http://code.google.com/p/modwsgi/wiki/DebuggingTechniques" rel="nofollow noreferrer">http://code.google.com/p/modwsgi/wiki/DebuggingTechniques</a></p>
<p>This... | 14,360 |
<p>I'm trying to let an <code><input type="text"></code> (henceforth referred to as “textbox”) fill a parent container by settings its <code>width</code> to <code>100%</code>. This works until I give the textbox a padding. This is then added to the content width and the input field overflows. Notice that in Firef... | <p>With CSS3 you can use the box-sizing property on your inputs to standardise their box models.
Something like this would enable you to add padding and have 100% width:</p>
<pre class="lang-css prettyprint-override"><code>input[type="text"] {
-webkit-box-sizing: border-box; // Safari/Chrome, other WebKit
-moz... | <p>i believe you can counter the overflow with a negative margin. ie</p>
<pre><code>margin: -1em;
</code></pre>
| 7,580 |
<p>I have some code I've written in PHP for consuming our simple webservice, which I'd also like to provide in Perl for users who may prefer that language. What's the simplest method of making a HTTP request to do that? In PHP I can do it in one line with <code>file_get_contents()</code>.</p>
<p>Here's the entire code... | <p>LWP::Simple:</p>
<pre><code>use LWP::Simple;
$contents = get("http://YOUR_URL_HERE");
</code></pre>
| <p>If it's in Unix and if LWP::Simple isn't installed, you can try:</p>
<pre><code>my $content = `GET "http://trackMyPhones.com/"`;
</code></pre>
| 16,331 |
<p>How can I validate a username and password against Active Directory? I simply want to check if a username and password are correct.</p>
| <p>If you work on .NET 3.5 or newer, you can use the <code>System.DirectoryServices.AccountManagement</code> namespace and easily verify your credentials:</p>
<pre><code>// create a "principal context" - e.g. your domain (could be machine, too)
using(PrincipalContext pc = new PrincipalContext(ContextType.Domain, "YOUR... | <p>Here my complete authentication solution for your reference.</p>
<p>First, add the following four references</p>
<pre><code> using System.DirectoryServices;
using System.DirectoryServices.Protocols;
using System.DirectoryServices.AccountManagement;
using System.Net;
private void AuthUser() {
try{
... | 37,038 |
<p>I've been using <strong>Codegear RAD Studio</strong> for a over a year now but since the <strong>"May08 Help Update"</strong> the help system no longer works. If I open the help the contents pane is entirely blank. If I hit F1 I get the following error: <strong>"Unable to interpret the specified HxC file."</stron... | <p>It sounds like you need to do a complete uninstall/reinstall. Alas.</p>
<p>Be sure to check <a href="http://docs.codegear.com" rel="nofollow noreferrer">http://docs.codegear.com</a> for the latest in Delphi help. On that site you can also download the Delphi 2007 help in various forms, including PDF and CHM. </p>... | <p>You probably got a corrupted file from the download. I would try download again and reinstall the help.</p>
| 12,340 |
<p>This is probably a n00blike (or worse) question. But I've always viewed a schema as a table definition in a database. This is wrong or not entirely correct. I don't remember much from my database courses. </p>
| <p><strong>schema</strong> -> floor plan</p>
<p><strong>database</strong> -> house</p>
<p><strong>table</strong> -> room</p>
| <p>A database <strong>schema</strong> is a way to logically group objects such as tables, views, stored procedures etc. Think of a schema as a container of objects.
And tables are collections of rows and columns.
combination of all tables makes a db.</p>
| 38,254 |
<p>This is a question with many answers - I am interested in knowing what others consider to be "best practice".</p>
<p>Consider the following situation: you have an object-oriented program that contains one or more data structures that are needed by many different classes. How do you make these data structures access... | <p>Global data isn't as bad as many OO purists claim!</p>
<p>After all, when implementing OO classes you've usually using an API to your OS. What the heck is this if it isn't a huge pile of global data and services!</p>
<p>If you use some global stuff in your program, you're merely extending this huge environment you... | <p>I don't like any of your proposed solutions:</p>
<ol>
<li>You are passing around a bunch of "context" objects - the things that use them don't specify what fields or pieces of data they are really interested in</li>
<li>See here for a description of the <a href="http://en.wikipedia.org/wiki/God_object" rel="nofollo... | 18,960 |
<p>I am looking for a method of storing Application Messages, such as</p>
<ul>
<li>"You have logged in successfully"</li>
<li>"An error has occurred, please call the helpdesk on x100"</li>
<li>"You do not have the authority to reset all system passwords" etc</li>
</ul>
<p>So that "when" the users decide they don't li... | <p>In your Web.config, under appSettings, change it to:</p>
<pre><code><appSettings file="StringKeys.config">
</code></pre>
<p>Then, create your StringKeys.config file and have all your keys in it.</p>
<p>You can still use the AppSettings area in the main web.config for any real application related keys.</p>
| <p>You can use <a href="http://msdn.microsoft.com/en-us/library/system.resources.resourcemanager.aspx" rel="nofollow noreferrer">ResourceManager</a> class. See "ResourceManager and ASP.NET" article at <a href="http://msdn.microsoft.com/en-us/library/aa309419(VS.71).aspx" rel="nofollow noreferrer">http://msdn.microsoft.... | 5,024 |
<p>In Hibernate we have two classes with the following classes with JPA mapping:</p>
<pre><code>package com.example.hibernate
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax... | <p>I had a similar problem:</p>
<ul>
<li>I did Session.save(nastyItem) to save an object into the Session.
However, I did not fill in the property buyer which is mapped as update="false" insert="false" (this happens a lot when you have a composed primary key, then you map the many-to-one's as insert="false" update="fa... | <p>Not really seen this problem, although we do get intermittent Lazy Load errors - so perhaps we have the same problem, anyway, is it an option to use a different session for the loading of the Bar object - that should load it from scratch, I would expect...</p>
| 8,724 |
<p>What would be the best way to call a method in the code-behind of parent page from the code behind of the child page in the ASP.NET 2.0 Web Site model?</p>
<p><b>Scenario:</b> User clicks a link in the parent page to view a data record's detail in child page (The parent and child are tow seperate pages). The user ... | <p>Easiest way would be to do the whole thing on one page using a multiview or some such thing.</p>
<p>Other then that, with javascript you can call </p>
<pre><code>document.opener.location.href = "url";
</code></pre>
<p>to change the url on the parent page. You could just keep it the same, or stick stuff in the qu... | <p>If you're opening the child page in a modal pop-up, you can access <code>window.returnValue</code> on the parent page (via JavaScript) and then invoke a page refresh or an Ajaxy rebind call.</p>
<p>Check <a href="http://microsoft.apress.com/asptodayarchive/71799/creating-a-pop-up-modal-dialog-box-for-a-login-page-a... | 49,200 |
<p>Does the C++ STL set data structure have a set difference operator?</p>
| <p>Yes there is, it is in <code><algorithm></code> and is called: <a href="http://en.cppreference.com/w/cpp/algorithm/set_difference" rel="noreferrer"><code>std::set_difference</code></a>. The usage is:</p>
<pre><code>#include <algorithm>
#include <set>
#include <iterator>
// ...
std::set<in... | <p>can we just use</p>
<pre><code> set_difference(set1.begin(), set1.end(), set2.begin(). set2,end(),std::back_inserter(result)).
</code></pre>
| 36,023 |
<p>I am relatively new to Python, and I have always used the standard cpython (v2.5) implementation. </p>
<p>I've been wondering about the other implementations though, particularly Jython and IronPython. What makes them better? What makes them worse? What other implementations are there?</p>
<p>I guess what I'm ... | <p><strong>Jython</strong> and <strong>IronPython</strong> are useful if you have an overriding need to interface with existing libraries written in a different platform, like if you have 100,000 lines of Java and you just want to write a 20-line Python script. Not particularly useful for anything else, in my opinion, ... | <p>Pros: Access to the libraries available for JVM or CLR.</p>
<p>Cons: Both naturally lag behind CPython in terms of features.</p>
| 11,163 |
<p>I am a .Net developer that has been tasked with upgrading a classic asp website to asp.net. The website is currently running on luck and bubble gum but there is not enough time or money to stop progress and do a full rewrite. Of course I will still need to be able to deliver new features while I am upgrading.</p>
<... | <p>Having been a longtime classic asp programmer, and now an ASP.NET dev, I would take the time and architect it properly in the 2.0 framework (3.5 if you want/need the features).</p>
<p>My last job we had a large handful of very badly build classic asp apps that we were rebuilding, and the "nuke and pave" approach wa... | <p>You may want to look at the new ASP.NET MVC framework. The level of flexibility is amazing and the coding style is slightly more akin to the ASP classic approach, albeit with much better separation of church and state. </p>
| 12,125 |
<p>I have just installed Eclipse 3.4 and found out that there is not a plugin to create Swing applications yet. I also have found that there is a Matisse implementation in MyEclipse IDE, but I'd like to now whether there is such a Matisse plugin for free.</p>
| <p>Instatiations Swing Designer is the best in my opinion. We settled on it after trying may different Eclipse plugins.</p>
| <p>I did a quick Google search and found that you could use Netbeans Matisse and Eclipse in parallel: </p>
<p><a href="http://wiki.netbeans.org/UsingNetbeansMatisseAndEclipseInParallel" rel="nofollow noreferrer">NetBeans Wiki: UsingNetbeansMatisseAndEclipseInParallel</a></p>
<p>It seems to basically involve building ... | 32,578 |
<p>I am currently modifying some jsf application. I have two beans.</p>
<ul>
<li>connectionBean</li>
<li>UIBean</li>
</ul>
<p>When I set my connection parameters in connectionBean the first time, the UIBean is able to read my connectionBean information and display the correct UI Tree.</p>
<p>However when I try to se... | <p>Sounds to me like it's some kind of problem with UIBean referencing an out-of-date version of ConnectionBean. This is one problem with JSF - if you re-create a bean, JSF will not update the references in all your other beans.</p>
<p>You could try getting a 'fresh' copy of the ConnectionBean each time. The following... | <p>Define constant and static method in first session bean:</p>
<pre><code>public class FirstBean {
public static final String MANAGED_BEAN_NAME="firstBean";
/**
* @return current managed bean instance
*/
public static FirstBean getCurrentInstance()
{
FacesContext context = FacesContext.getCurrentInstance();
r... | 36,027 |
<p>Why is the dropdown not showing my blank item first? Here is what I have</p>
<pre><code>drpList.Items.Add(New ListItem("", ""))
With drpList
.DataSource = myController.GetList(userid)
.DataTextField = "Name"
.DataValueField = "ID"
.DataBind()
End With
</code></pre>
<p>Edit ~ I am binding to a Gene... | <p>After your databind:</p>
<pre><code>drpList.Items.Insert(0, new ListItem(String.Empty, String.Empty));
drpList.SelectedIndex = 0;
</code></pre>
| <p>You could also have a union of the blank select with the select that has content:</p>
<pre><code>select '' value, '' name
union
select value, name from mytable
</code></pre>
| 33,489 |
<p>I am confused about the licensing model for Microsoft PerformancePoint Server.</p>
<p>When I look at
<a href="http://www.microsoft.com/business/performancepoint/howtobuy/default.aspx" rel="nofollow noreferrer">http://www.microsoft.com/business/performancepoint/howtobuy/default.aspx</a></p>
<p>I see a 20,000 USD S... | <p>It's <a href="http://blogs.msdn.com/sharepoint/archive/2009/01/23/microsoft-business-intelligence-strategy-update-and-sharepoint.aspx" rel="nofollow noreferrer">included with the Enterprise License</a> of MOSS 2007 now. </p>
| <p>I'm not a lawyer or anything, but this license term looks like something that Microsoft can't actually enforce. Sometimes they put terms in licenses that are legally baseless(i.e. they couldn't sue you and win) and just assume you'll follow the license because you're afraid.</p>
| 41,985 |
<p>Debugging asp.net websites/web projects in visual studio.net 2005 with Firefox is loads slower
than using IE.</p>
<p>I've read something somewhere that there is a way of fixing this but i can't for the life of me find it again.</p>
<p>Does anyone know what i'm on about and can point me in the right direction plea... | <p>bingo. found the <a href="http://dotnetslackers.com/ASP_NET/re-122146_Speeding_Up_FireFox_When_Using_the_ASP_NET_Development_Server_from_Localhost.aspx" rel="noreferrer">article</a> i read before. </p>
<p>i just changed my network.dns.ipv4OnlyDomains property in about:config to localhost. restarted firefox and now ... | <p>Are you serious? One of the main reasons I stick to Firefox is because its so much nicer to develop with..</p>
<p>The live source update is awesome (view source > change code > rebuild > F5 in source)...</p>
<p>What is actually "slow".. I mean, the some browsers tend to be slower at rendering, but I dont see how i... | 4,460 |
<p>Is it possible to split the information in a .csproj across more than one file? A bit like a project version of the <code>partial class</code> feature.</p>
| <p>You can not have more than one master csproj. But because the underneath wiring of the csproj is done using msbuild you can simply have multiple partial csproj that import each other. The solution file would see the most <em>derived</em> csproj.</p>
<p><strong>project1.csproj</strong></p>
<pre><code><Project De... | <p>Well you can have multiple projects combined into one large solution, but I don't think that is quite what you had in mind as each project has to be a complete project in that case.</p>
| 19,015 |
<p>I'm working on keyboard input for a very basic kernel that I'm developing and I'm completely stuck. I can't seem to find any information online that can show me the information I need to know.</p>
<p>My kernel is running in protected mode right now, so I can't use the real mode keyboard routines without jumping int... | <p>The <a href="http://course.mit.edu/6.828" rel="noreferrer">MIT operating systems class</a> has lots of good references. In particular, check out <a href="http://www.computer-engineering.org/index.html" rel="noreferrer">Adam Chapweske's resources</a> on keyboard and mouse programming.</p>
<p>In short, yes, you will... | <p>The <strong>8042 PS/2 Controller</strong> looks like the simplest possibility.</p>
<p>The oszur11 OS tutorial contains a working example under <a href="https://sourceforge.net/p/oszur11/code/ci/master/tree/Chapter_06_Shell/04_Makepp/arch/i386/arch/devices/i8042.c" rel="nofollow">https://sourceforge.net/p/oszur11/co... | 26,966 |
<p>What is the general feeling amongst developers regarding the changing of files in the 12 hive.
For example if you were asked to remove the sign is a different user menu item, you would need to modify the relevent user control on the filesystem. Now if you just go and modify it via notepad or copy over and then if y... | <p>I have done a bit of SharePoint development, and I must tell you that messing with the 12-hive is a ticket to a world of pain if you ever want to move the app.</p>
<p>I'd rather hack up some javascript to hide it, at least that can be bound to the master page, which is much more portable.<br>
And remember, you neve... | <p>Not sure if there is much use pitching in, as everyone else pretty much has it covered, but I would also say don't do it. As tempting as it is, its just impossible to know the full impact of that little change you have made.</p>
<p>From a support perspective you will make it difficult for Microsoft support (patches... | 4,643 |
<p>Consider a standard ASP.NET web application where the user types in some numeric data on a form. On submitting, some business objects are spun up to operate on the numeric data. But server-side textbox controls in .Net return a value of type string. Question: Should the codebehind of the page take responsibility ... | <p>IMO, the business objects should accept numeric types only. Strings can be parsed in various formats, according to culture specific rules. Numbers are numbers. You don't want to change your business objects for localization - accepting only numbers will make it easier to reuse.</p>
| <p>The business objects should only be given properly parsed & verified objects.</p>
<p>Now, should this parsing & verification be done in the codebehind? hard to say, as the codebehind really isn't a layer. Properly, the codebehind should just handle UI issues, and parsing should be done at the controller l... | 26,083 |
<p>When i navigate to an ASP.NET page, the browser displays a "Page Not Found" message. The page exists and is in a virtual directory, I am able to browse it on the IIS on my local development machine. What could be causing this problem on the server? </p>
<p>When i replace one of the class libraries that iam using, w... | <p>You have the ASP.NET extension installed and active? This is not installed by default in Windows Server 2003. When this is not active, you will get a 404 for any .aspx file.</p>
| <p>Does the virtual directory on your server allow scripting? Having scripting off could make the page inaccessible.</p>
| 37,926 |
<p>I'm trying to determine the best way of having a PHP script determine which server the script/site is currently running on.</p>
<p>At the moment I have a <code>switch()</code> that uses <code>$_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']</code> to determine which server it's on. It then sets a few paths, ... | <p>How about using <strong>$_SERVER['SERVER_ADDR']</strong> and base your identity off the IP address of the server.</p>
<p>UPDATE: In a virtual host situation, you might also like to concatenate the IP with the document root path like so:</p>
<pre><code>$id = $_SERVER['SERVER_ADDR'] . $_SERVER['DOCUMENT_ROOT'];
</co... | <p>Why don't you have configuration files for each host stored outside of the project directory and read it from the php code?</p>
<p>Having host specific code is not really a good practice.</p>
| 26,741 |
<p>My company is about to hire <strong>.NET developers</strong>. We work on a variety of .NET platforms: ASP.NET, Compact Framework, Windowsforms, Web Services. I'd like to compile a list/catalog of good questions, a kind of minimum standard to see if the applicants are experienced. So, my question is:</p>
<p><strong>... | <p>Basic questions include:</p>
<ul>
<li><a href="https://stackoverflow.com/questions/479142/when-to-use-an-interface-instead-of-an-abstract-class-and-vice-versa">Whats the difference between an abstract class and interface? When would you want to use them?</a></li>
<li><a href="https://stackoverflow.com/questions/448... | <p>I would prefer giving him a problem and asking him to solve it using the features of .net you know and why do you think it is best solution.</p>
<p>This will crack almost all the capabilities of a candidate in terms of technical, analytical and problem solving skills along with his approach for solving a problem.</... | 47,719 |
<p>What regex pattern would need I to pass to <code>java.lang.String.split()</code> to split a String into an Array of substrings using all whitespace characters (<code>' '</code>, <code>'\t'</code>, <code>'\n'</code>, etc.) as delimiters?</p>
| <p>Something in the lines of</p>
<pre><code>myString.split("\\s+");
</code></pre>
<p>This groups all white spaces as a delimiter.</p>
<p>So if I have the string:</p>
<pre><code>"Hello[space character][tab character]World"
</code></pre>
<p>This should yield the strings <code>"Hello"</code> ... | <p>Study this code.. good luck</p>
<pre><code> import java.util.*;
class Demo{
public static void main(String args[]){
Scanner input = new Scanner(System.in);
System.out.print("Input String : ");
String s1 = input.nextLine();
String[] tokens = s1.split("[\\s\\xA0]+");
... | 27,851 |
<p>I've built web apps before that utilize phpBB session, and user data. The common move is to use code like this:</p>
<pre><code>define('IN_PHPBB', true);
//replace $phpbb_root_path with path to your forum
$phpbb_root_path = '../forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'... | <p>Two things:</p>
<ul>
<li>I would make the default block size a <em>lot</em> larger than 512. I would start with 16384 and perhaps more.</li>
<li>For modularity, it might be better to have the <code>copy_with_prog</code> function not output the progress bar itself, but call a callback function so the caller can deci... | <p>If you want an overall progress, you can use something like this (made for another script). Note that in this case, the 'threading.Thread' that calls the progress bar was placed outside the 'for' loop. Also, the measures need be taken in a different way. This is the third example (non utf-8) from the gif image in th... | 34,582 |
<p>Is there an animation format supported in Qt (using v4.4) that will support a full alpha channel? GIF only has one-bit transparency, and I don't think Qt supports APNG.
Update: MNG seems to be supported, but that's even less popular than APNG! Maybe SVG is my best bet.</p>
| <p>Qt supports SVG 1.2 Tiny as well as GIF and MNG. On a side-note, an animation API is being worked on which might be interesting for you; </p>
<p><a href="http://labs.trolltech.com/blogs/2008/11/05/qt-animation-framework/" rel="nofollow noreferrer">http://labs.trolltech.com/blogs/2008/11/05/qt-animation-framework/</... | <p>Without knowing much of Qt, I will mention MNG and SVG, perhaps.</p>
| 18,500 |
<p>I've just printed my very first part and it did not want to come loose from the build plate, it fact, it just broke instead.</p>
<p>I can heat the bed up again and work it off, but I wondered if a release agent would be better?</p>
<p>I have a silicon release spray (like those use with molds). Could I spray the b... | <p>Advice from another source suggested thoroughly cleaning the feed gear on the bowden extruder. When I looked closely there were plastic flakes all over the mechanism. I used compressed air and a brush to clean it.
I also discovered expert mode in the FlashPrint software, which enabled me to slow down the speed at... | <p>I had a lot of thumps lately after I moved my printer location.</p>
<p>Turns out my printer wasn't level and the extruder was pushing harder (further down) on different places, causing thumps.
This really shows because the calibration is only in 1 spot.</p>
<p>I used some printer paper and a bubble level then reca... | 1,134 |
<p>Are there any libraries (3rd party or built-in) in <code>PHP</code> to calculate text diffs?</p>
| <p>What sort of diffs? File diffs? There is <a href="http://php.net/array_diff" rel="nofollow noreferrer">array_diff()</a> which acts on arrays. Then there is also <a href="http://php.net/manual/en/book.xdiff.php" rel="nofollow noreferrer">xdiff</a>, which "enables you to create and apply patch files containing diff... | <p>Not build in, but I like it because it has such a nice interface to test everything out on the website, and because it seems to be somewhat faster than Text_Diff at high granularity levels.</p>
<p><a href="http://www.raymondhill.net/finediff/viewdiff-ex.php" rel="nofollow">http://www.raymondhill.net/finediff/viewdi... | 13,759 |
<p>I need some help calculating Pi. I am trying to write a python program that will calculate Pi to X digits. I have tried several from the python mailing list, and it is to slow for my use.
I have read about the <a href="http://en.wikipedia.org/wiki/Gauss-Legendre_algorithm" rel="noreferrer">Gauss-Legendre Algorithm<... | <ol>
<li><p>You forgot parentheses around <code>4*t</code>:</p>
<pre><code>pi = (a+b)**2 / (4*t)
</code></pre></li>
<li><p>You can use <code>decimal</code> to perform calculation with higher precision.</p>
<pre><code>#!/usr/bin/env python
from __future__ import with_statement
import decimal
def pi_gauss_legendre():
... | <pre><code>pi = (square((a+b)))/4*t
</code></pre>
<p>should be</p>
<pre><code>pi = (square((a+b)))/(4*t)
</code></pre>
| 45,256 |
<p>Has anyone actually shipped an Entity Framework project that does O/R mapping into conceptual classes that are quite different from the tables in the datastore?</p>
<p>I mean collapse junction (M:M) tables into other entities to form <strong>Conceptual</strong> classes that exist in the business domain but are orga... | <p>I attempted to use the Entity Framework on an existing project (~60 tables, 3 with inheritance) just to see what it was all about. My experience boiled down to:</p>
<p>The designer surface is kludgy. The mapping isn’t intuitive and someone must have thought that having several tool windows open at the same time is ... | <p>You mean like this?</p>
<pre><code><edmx:ConceptualModels>
<Schema xmlns="http://schemas.microsoft.com/ado/2006/04/edm" Namespace="Model1" Alias="Self">
<EntityContainer Name="Model1Container" >
<EntitySet Name="ColorSet" EntityType="Model1.Color" />
<EntitySet Name="Doc... | 8,207 |
<p>I'm used to working in a Delphi and C# environment which seem to have a rich set of third party components available. I'm currently wanting to do cross-platform programming in C++ using either qt or wxwidgets. Is there a large market for third party components? I was looking at sourceforge and that doesn't seem to s... | <p>There are a number of good quality third party Qt libraries, though I don't know of a centralized resource for finding them.</p>
<p>A few places to start looking:</p>
<ul>
<li><p><a href="http://www.ics.com/products/qt/addons/" rel="nofollow noreferrer">http://www.ics.com/products/qt/addons</a></p>
<p><a href="ht... | <p>In addition to the ones by ICS and at QtCentre the <a href="http://www.qt-apps.org/index.php?xcontentmode=4298" rel="nofollow noreferrer">Qt-apps</a> website has some open source widgets/components for Qt.</p>
| 18,838 |
<p>I'm involved in building a donation form for non-profits. We recently got hit by a fast round of low dollar submissions. Many were invalid cards, but a few went through. Obviously someone wrote a script to check a bunch of card numbers for validity, possibly so they can sell them later.</p>
<p>Any ideas on how to p... | <p>When a flood of invalid transactions from a single IP address or small range of addresses is detected, block that address / network.</p>
<p>If a botnet is in use, this will not help. You can still detect floods of low dollar amount submissions and so deduce when you are under attack; during these times, stall low d... | <p>limit submissions from the same IP address to one per minute, or whatever reasonable period of time it would take for a real person to fill out the form</p>
| 19,809 |
<p>I need to knock out a quick animation in C#/Windows Forms for a Halloween display. Just some 2D shapes moving about on a solid background. Since this is just a quick one-off project I <strong><em>really</em></strong> don't want to install and learn an entire new set of tools for this. (DirectX dev kits, Silverlig... | <p>Set off a timer at your desired frame rate. At each timer firing twiddle the internal representation of the shapes on the screen (your model) per the animation motion you want to achieve, then call <code>Invalidate(true)</code>. Inside the OnPaint just draw the model on the screen.</p>
<p>Oh yeah, and you probabl... | <p><a href="https://channel9.msdn.com/coding4fun/articles/2D-Game-Primer-Visual-C" rel="nofollow noreferrer">2d Game Primer</a></p>
<p><a href="http://www.java2s.com/Code/CSharp/2D-Graphics/Timerbasedanimation.htm" rel="nofollow noreferrer">Timer Based Animation</a></p>
<p>Both of these give good examples of animatio... | 22,834 |
<p>A few guys on our team are of the opinion that every web page in the application should be a web user control. So you'll have all of your html + event handling in the Customer.ascx, for example, and there will be a corresponding Customer.aspx page that contains Customer.ascx control. </p>
<p>These are their argumen... | <p>1, 2 & 3: Doing <em>anything</em> because "you might need it later" is a horrible strategy.</p>
<p><a href="http://c2.com/xp/YouArentGonnaNeedIt.html" rel="nofollow noreferrer">http://c2.com/xp/YouArentGonnaNeedIt.html</a></p>
<p>4: I have never read this and seriously doubt MS has ever said anything like this... | <ol>
<li>Seriously complicates client-side script as the NamingContainer jiggery will prepend _ctl0 etc to everything sometimes.</li>
<li>I don't think MS ever recommended it. Request links to MSDN documentation.</li>
<li>Typically by the time your are done implementing something, and it is sufficiently complicated, y... | 35,297 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.