instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>What's the best way to use NaNs in C++?</p>
<p>I found <code>std::numeric_limits<double>::quiet_NaN()</code> and <code>std::numeric_limits<double>::signaling_NaN()</code>. I'd like to use <code>signaling_NaN</code> to represent an uninitialized variable as follows:</p>
<pre><code>double diameter = std... | <p>After looking into this some more, it looks like <code>signaling_NaN</code> is useless as provided. If floating point exceptions are enabled, then calling it counts as processing a signaling NaN, so it immediately raises an exception. If floating point exceptions are disabled, then processing a signaling NaN autom... | <p>Your C++ implementation may have an API for accessing the floating point environment to test for and clear certain floating point exceptions. See <a href="https://stackoverflow.com/questions/85726/converting-floating-point-exceptions-into-c-exceptions#88829">my answer to a related question</a> for more information.... | 29,138 |
<p>I wanted some of those spiffy rounded corners for a web project that I'm currently working on.</p>
<p>I thought I'd try to accomplish it using javascript and not CSS in an effort to keep the requests for image files to a minimum (yes, I know that it's possible to combine all required rounded corner shapes into one ... | <p>How about this?</p>
<pre><code>var mozborderAvailable = false;
try {
if (typeof(document.body.style.MozBorderRadius) !== "undefined") {
mozborderAvailable = true;
}
} catch(err) {}
</code></pre>
<p>I tested it in Firefox 3 (true) and false in: Safari, IE7, and Opera.</p>
<p>(Edit: better undefined test)</... | <p>Apply CSS unconditionally and check <code>element.style.MozBorderRadius</code> in the script?</p>
| 3,868 |
<p>We have a large management software that is producing big reports of all kinds, based on numerous loops, with database retrievals, objects creations (many), and so on.</p>
<p>On PHP4 it could run happily with a memory limit of 64 MB - now we have moved it on a new server and with the same database - same code, the ... | <p>A big problem we have run into was circular references between objects stopping them from freeing memory when they become out of scope.</p>
<p>Depending on your architecture you may be able to use __destruct() and manually unset any references. For our problem i ended up restructuring the classes and removing the ... | <p>Since moving to the new server, have you verified that your MySQL and PHP system variables are identical to the way they were on your old server? </p>
<p>PHP5 introduced a lot of new functionality but due to its backward compatibility mantra, I don't believe that the differences between PHP5 and PHP4 should be caus... | 28,683 |
<p>I need to develop a generic jQuery-based search plugin for the ASP.NET MVC application I'm building, but I can't figure out how it's supposed to fit, or what the best practice is. I want to do the following:</p>
<pre><code>$().ready(function() {
$('#searchHolder').customSearch('MyApp.Models.User');
});
</code>... | <p>Just to follow up (I'm very surprised nobody else has had any opinions on this), in an effort to keep best practice I've opted to adopt <a href="http://jtemplates.tpython.com/" rel="nofollow noreferrer">jTemplates</a>.</p>
<p>It enables me to request some Model-style JSON from my server-side Controller and process ... | <p>I'm not sure I understand what you're trying to accomplish, but I would construct the relevant UI on the server as part of your view (e.g. as a user control that can be rendered on different pages), set it's display:none style and use JQuery on the client side to show it when the user clicks on some link or whatever... | 23,940 |
<p>I need a select from table which does not have column that tells when row was inserted, only <code>timestamp</code> column (values like: 0x0000000000530278). Some data was imported to the table yesterday and now I need to find out what exactly was imported :(</p>
<p>Is there a way to do it using only <code>timestam... | <p>The Transact-SQL timestamp data type is a binary data type with no time-related values.</p>
<p>So to answer your question: <em>Is there a way to get DateTime value from timestamp type column?</em></p>
<p>The answer is: <em>No</em></p>
| <p>I think your best bet is to restore a backup from before the inserts and compare the backuped table with the current table. </p>
| 21,451 |
<p>In Eclipse, I have a workspace that contains all of my projects. Each project builds and compiles separately. A project does not interact with another project.</p>
<p>How does this relate to Visual Studio and Projects/Solutions there?</p>
| <p>A VS project is it's own entity. It will build and compile by itself. A Solution is just a way to contain multiple projects. The projects don't necessarily need the other projects to compile (though, they can depend on the other projects). </p>
<p>This just lets you conceptually group projects together into one Big... | <p>A Solution has 0 or many Projects...</p>
| 8,163 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/1759352/how-do-i-mark-a-method-as-obsolete-deprecated-c-sharp">How do I mark a method as Obsolete/Deprecated? - C#</a> </p>
</blockquote>
<p>How do you mark a class as deprecated? I do not want to use a class a... | <p>You need to use the <code>[Obsolete]</code> attribute.</p>
<p>Example:</p>
<pre><code>[Obsolete("Not used any more", true)]
public class MyDeprecatedClass
{
//...
}
</code></pre>
<p>The parameters are optional. The first parameter is for providing the reason it's obsolete, and the last one is to throw ... | <p>If you are using version control I would recommend just deleting the class. There is no reason to have unused code around.</p>
<p>Version control will be a handy undo if you decide later that you want the class.</p>
| 40,582 |
<p>What is the Entity Framework pipeline like?
What gets translated to SQL, Expression Trees or ESQL, or both?
Is ESQL something an Entity Framework provider needs to implement or translate, or that the framework takes care of?</p>
| <p>Both Entity SQL and LINQ expressions are parsed into a common cannonical query tree which is then parsed to generate the provider specific SQL.</p>
<p>Jim Wooley</p>
<p><a href="http://www.ThinqLinq.com" rel="nofollow noreferrer">www.ThinqLinq.com</a></p>
| <p>Have you looked at the <a href="http://code.msdn.microsoft.com/EFSampleProvider" rel="nofollow noreferrer">sample</a> provider source <a href="http://code.msdn.microsoft.com/EFOracleProvider" rel="nofollow noreferrer">code</a>?</p>
| 40,213 |
<p>Does anyone know if it's possible to <em>not</em> use the navigation properties feature of the entity framework for tables linked with a foreign key?</p>
<p>for example, if my client table has an AddressId, I want that AddressId in my model, I don't want it to have a .Address property. But I have thus far been una... | <p>Sure, you can do this. It's just that the designer won't help you very much. Delete the navigation property, and add a scalar property for AddressId. It will work, but you'll have to be careful about hitting Update Model in the designer, as it may try to "fix" things for you. It's worth getting used to editing E... | <p>In the designer, you can set the navigation properties as having Private getters/setters. While they will still be <em>there</em>, because Entity Framework (by default) does lazy loading, it won't actually retrieve any data from the database at runtime. And they won't respawn the next time you update the model from ... | 43,775 |
<p>I'm trying to Unit Test a class that has many internal functions. These obviously need testing too, but my Tests project is seperate, mainly because it covers many small, related projects. What I have so far is:</p>
<pre><code>FieldInfo[] _fields =
typeof(ButtonedForm.TitleButton).GetFields(
BindingFla... | <p>It would be more appropriate to use the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx" rel="nofollow noreferrer"><code>InternalsVisibleTo</code></a> attribute to grant access to the internal members of the assembly to your unit test assembly.</p>
<p... | <p>A justification for using the InternalsVisible is under my circumstances. We purchase the source code to a Chart Control. We have found where we need to make some modifications to that source control and compile our own version. Now to ensure we did not break anything, there are some unit tests I need to write that ... | 20,657 |
<p>I'm programming a simple network chat with a Python server and a Java client.
But one question came into my mind:</p>
<p>Which "network protocol" should I use for communication?
There are some possibilities for me:</p>
<ul>
<li>YAML: Nice to parse, problem: parsed objects contain language specific parts</li>
<li>X... | <p>Check JSON. It is compatible accross many languages (Python and Java included), and it is human readable.
<a href="http://www.json.org/" rel="noreferrer">http://www.json.org/</a></p>
<p>If you plan to do Web development, and plan to use Javascript, then JSON might be a good choice as it was originally designed for ... | <p>If you want the protocol to also abstract away the method invocation, have a look at <a href="http://en.wikipedia.org/wiki/Xml-rpc" rel="nofollow noreferrer">XML-RPC</a>, which Java and Python (and pretty much everything else) has good support for.</p>
<p>Object marshalling and unmarshalling is solid, can handle un... | 49,440 |
<p>Is it possible to get access to the spell checker that is incorporated in browsers for text areas from Javascript? I would like to be able to control spell checking from withing my code. Most browsers (apart from IE) seem to have some kind of a spell checker built in to them nowadays.</p>
| <p>The most access that I know of is disabling or enabling spellchecking on a field: <a href="https://stackoverflow.com/questions/223940/inline-disabling-of-firefox-spellcheck">Inline Disabling of Firefox Spellcheck?</a></p>
<p>I don't know of a way that you can directly access the spellchecker of a browser via javasc... | <p>Nope. </p>
<p>If you want control over spell checking, you could do it yourself with AJAX.</p>
<p>(And, incidentally, ieSpell is a free spell checker plugin for IE that is pretty easy for users to install on their own)</p>
| 41,022 |
<p>Is there a way clear or reset the outputcache for an entire website without a restart?</p>
<p>I'm just starting to use outputcache on a site and when I make a mistake in setting it up I need a page I can browse to that will reset it.</p>
| <p>This should do the trick:</p>
<pre><code>Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim path As String
path="/AbosoluteVirtualPath/OutputCached.aspx"
HttpResponse.RemoveOutputCacheItem(path)
End Sub
</code></pre>
| <p>Add the following code to controller or to page code:</p>
<pre><code>HttpContext.Cache.Insert("Page", 1);
Response.AddCacheItemDependency("Page");
</code></pre>
<p>To clear output cachne use the following command in controller:</p>
<pre><code> HttpContext.Cache.Remove("Page");
</code></pre>
| 5,779 |
<p>I installed wxWidgets 2.8.9 on a Windows XP SP2 box and built the library according to the directions and now I'm trying to get the <a href="http://www.wxwidgets.org/docs/tutorials/hello.htm" rel="nofollow noreferrer">Hello World! tutorial</a> app to build from within Eclipse and I'm just missing something apparentl... | <p>This <a href="http://groups.google.com/group/comp.soft-sys.wxwindows/browse_thread/thread/2771869bdadbf576/28e8011930924b64?lnk=st&q=eclipse+wxWidgets#28e8011930924b64" rel="nofollow noreferrer">answer</a> was posted by Lars Uffmann to the comp.soft-sys.wxwindows newsgroup. In a nutshell:</p>
<ol>
<li><p>Add c... | <p>I built wxWidgets with MinGW on Windows myself and let CMake 2.6 create the Makefiles and project files for Eclipse on Windows. This works pretty well for me.</p>
| 23,278 |
<p>I'm trying to write a tennis reservation system and I got stucked with this problem.
Let's say you have players with their prefs regarding court number, day and hour.
Also every player is ranked so if there is day/hour slot and there are several players
with preferences for this slot the one with top priority should... | <p>This is an NP-complete problem, I think, so it'll be impossible to have a very fast algorithm for any large data sets. </p>
<p>There's also the problem where you might have a schedule that is impossible to make. Given that that's not the case, something like this pseudocode is probably your best bet:</p>
<pre><cod... | <p>Money. Allocate time slots based on who pays the most. In case of a draw don't let any of them have the slot.</p>
| 21,156 |
<p>so that you can make your program concurrent easily in the future.</p>
| <p>I focus on making items Immutable. Immutable objects allow you to reason about multi-threaded code a lot easier than "thread safe" objects. The object has one visible state that can be passed between threads without any synchronization. It takes the thought out of multi-threaded programming.</p>
<p>If you're int... | <p>Don't use member variables or global variables. Use the local stack of functions/methods. When a method uses only internally scoped variables and call parameters and returns all information using out/inout/reference parameters or return values, it is functional.</p>
| 45,840 |
<p>I'm thinking how to arrange a deployed python application which will have a </p>
<ol>
<li>Executable script located in /usr/bin/ which will provide a CLI to functionality implemented in</li>
<li>A library installed to wherever the current site-packages directory is.</li>
</ol>
<p>Now, currently, I have the followi... | <p><a href="http://jcalderone.livejournal.com/39794.html" rel="nofollow noreferrer">This article</a> is pretty good, and shows you a good way to do it. The second item from the <em>Do</em> list answers your question.</p>
<p><em>shameless copy paste:</em></p>
<blockquote>
<h1>Filesystem structure of a Python project... | <p>You should call the executable just <code>foo</code>, not <code>foo.py</code>, then attempts to import foo will not use it.</p>
<p>As for naming it properly: this is difficult to answer in the abstract; we would need to know what specifically it does. For example, if it configures and controls, calling it -config o... | 42,574 |
<p>Does anyone use <a href="http://phing.info/trac/" rel="nofollow noreferrer">Phing</a> to deploy PHP applications, and if so how do you use it? We currently have a hand-written "setup" script that we run whenever we deploy a new instance of our project. We just check out from SVN and run it. It sets some basic config... | <p>From Federico Cargnelutti's <a href="http://phpimpact.wordpress.com/2007/06/30/phing-php-project-build-system-based-on-apache-ant/" rel="noreferrer">blog post</a>:</p>
<blockquote>
<p>Features include file transformations (e.g. token
replacement, XSLT transformation,
Smarty template transformations), file
s... | <p>I don't see any compelling reason to go with phing. I mean, should PHP programmers attempt a rewrite of Eclipse "just because" it might somehow be easier to write Eclipse plugins in PHP? I don't think so.</p>
<p>Ant has better documentation, including some nice o'reilly books, and it's well-established in the Java ... | 5,725 |
<p>I know on client side (javascript) you can use windows.location.hash but could not find anyway to access from the server side. I'm using asp.net.</p>
| <p>We had a situation where we needed to persist the URL hash across ASP.Net post backs. As the browser does not send the hash to the server by default, the only way to do it is to use some Javascript:</p>
<ol>
<li><p>When the form submits, grab the hash (<code>window.location.hash</code>) and store it in a server-sid... | <p>Possible solution for GET requests:</p>
<p>New Link format: <code>http://example.com/yourDirectory?hash=video01</code></p>
<p>Call this function toward top of controller or <code>http://example.com/yourDirectory/index.php</code>:</p>
<pre><code>function redirect()
{
if (!empty($_GET['hash'])) {
/** Sa... | 41,051 |
<p>I was looking at the <a href="http://www.python.org/doc/2.5.2/lib/module-popen2.html" rel="noreferrer">Python documentation</a> and saw that there are 4-5 different versions of popen(), e.g. os.popen(), os.popen2(), etc. </p>
<p>Apart from the fact that some include <em>stderr</em> while others don't, what are the ... | <p>I would recommend to use the <code>subprocess</code> module which has all the features that these functions have and more.</p>
| <p>popen2 doesn't capture standard error, popen3 does capture standard error and gives a unique file handle for it. Finally, popen4 captures standard error but includes it in the same file object as standard output.</p>
| 34,758 |
<p>In the recent project, we had an issue with the performance of few queries that relied heavily on ordering the results by datetime field (MSSQL 2008 database).</p>
<p>When we executed the queries with ORDER BY RecordDate DESC (or ASC) the queries executed 10x slower than without that. Ordering by any other field di... | <p>I always store dates as ints, using the standardised <a href="http://en.wikipedia.org/wiki/Unix_time" rel="nofollow noreferrer">unix timestamp</a> as most languages I program in use that as a default date-time representation. Obviously, this makes sorting on a date much more efficient.</p>
<p>So, yes, I recommend i... | <p>I believe the <a href="http://www.sql-server-performance.com/articles/dev/date_time_search_p1.aspx" rel="nofollow noreferrer">datetime is physically stored as float</a> so the improvement would be the same as when converting float to INT.</p>
<p>I would rather use indexes as that is what they are designed for, and ... | 30,544 |
<p>I have a site that uses paypal to collect payments for electronically displayed data. Variables can't be passed with the URL through paypal (or I can't get them to work) so I have used cookies to pass the item number. However, a crafty user could, after the cookie writing part, enter the paypal redirect URL directly... | <p>I don't think you're going to be able to do what you want in a single step with the approach you're taking because your code has no way of knowing if the transaction actually finished successfully or not.</p>
<p>I think the only way the above approach will work is if you don't automatically send them over to the fil... | <p>There is plenty of information about PayPal IPN in other questions, start with <a href="https://stackoverflow.com/questions/1115822/setting-up-paypal-to-connect-to-script">Setting up Paypal to connect to script</a></p>
| 29,829 |
<p>I am currently starting a project utilizing ASP.NET MVC and would like to use NHaml as my view engine as I love Haml from Rails/Merb. The main issue I face is the laying out of my pages. In Webforms, I would place a ContentPlaceHolder in the head so that other pages can have specific CSS and JavaScript files.</p>
<... | <p>Use the ^ evaluator in the master page, and set it's value in each of the layouts(content pages).<br/></p>
<p>See <a href="http://code.google.com/p/nhaml/source/browse/tags/1.4.0/src/Samples/NHaml.Samples.Mvc/" rel="nofollow noreferrer">NHaml Samples</a> from it's source on <a href="http://code.google.com" rel="nof... | <p>The "content placeholders" are not yet supported.<br>
But there is a <a href="http://code.google.com/p/nhaml/issues/detail?id=5#c10" rel="nofollow noreferrer">request for that</a>.</p>
<p>You can vote <a href="http://nhaml.uservoice.com/pages/18694-general/suggestions/276848-multiple-content-placeholders" rel="nofo... | 15,485 |
<p>We are scheduling a task programatically. However, the executable to be scheduled could be installed in a path that has spaces. ie c:\program Files\folder\folder\folder program\program.exe</p>
<p>When we provide this path as a parameter to the Tasjk Scheduler it fails to start because it cannot find the executable.... | <p>It appears that you're using schtasks.exe - it took me longer to figure that out than to find an answer! More details please! :) I found an answer with <a href="http://tinyurl.com/6z6m8j" rel="nofollow noreferrer">a quick google search</a></p>
<p>Try this code:</p>
<pre><code>string args = "/CREATE /RU SYSTEM /... | <p>Put a batch file in a location that does not have spaces.</p>
<p>In the batch file, run the program commands that have spaces.</p>
| 47,036 |
<p>Per this <a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=608abffd" rel="nofollow noreferrer">Adobe KB tech note</a> is there any way around having to place the FLVPlayback skin SWF in same directory as HTML file the container SWF is loaded from? It pains me to have to put a SWF in my site's root ... | <p>Well, you can place the skin in another directory as long as you specify the path (relative to the loading HTML) in the "skin" parameter for your FLV playback component in the component inspector. Troubleshooting is very easy if you use the Net panel in Firebug or a similar tool. </p>
<p>Using an iframe works and d... | <p>You can set a different URL for the FLVPlayback component in two ways:</p>
<p>1) In the Component Parameters section of the Properties window, way at the bottom of the list of skins is the option Custom URL. Set its path there.</p>
<p>2) You can set it by Actionscript using the 'skin' parameter for your FLVPlaybac... | 20,516 |
<p>How can I view the intermediate translation done to JSP and JSPX pages by WTP? I'm getting weird syntax errors in my Problems tab of Eclipse in a project that has plenty of .jspx pages. They don't affect anything in the running application (Tomcat 6.0) and they appeared only over the last 2 weeks, after an update.... | <p>Right now you'd have to add the separate automated tests download to do this, and only in the 3.1 branch, but it enables a "Show Translation" command through Ctrl+Shift+9. Beware that the translation generated isn't 100% the same as the server would create at runtime--it's not intended to be executed. Also, the mo... | <p>I've seen the eclipse JSP editor get really confused over almost nothing. You said the problem goes away if you remove the tag. Does it come back if you put the tag back? I know that Eclipse 3.3 sometimes had some issues with JSP files where opening them, and forcing a save would clear the file of error messages... | 20,454 |
<p><a href="http://en.wikipedia.org/wiki/Visual_Basic_.NET" rel="nofollow noreferrer">VB.NET</a> has a very handy "with" statement, but it also lets you use it on an unnamed variable, like this:</p>
<pre><code>With New FancyClass()
.Level = "SuperSpiffy"
.Style = Slimming
.Execute()
End With
</code></pre>
... | <p>As answered, the simple answer is "no".</p>
<p>But isn't another way to do it: instead of declaring and then cleaning up the variable is to use the "Using".</p>
<pre><code>Using fc as new FancyClass()
With fc
.Level = "SuperSpiffy"
.Style = Slimming
.Execute()
End With
End Using
</code>... | <p>You're creating a variable either way - in the first case (your example) the compiler is creating an implicit variable that you aren't allowed to really get to, and the in the second case (another answer, by Oli) you'd be creating the variable explicitly. </p>
<p>If you create it explicitly you can use it in the im... | 13,165 |
<p>How can I implement <code>OpenID</code> feature in ASP NET2.0?</p>
| <p>Looks like there are some .NET options here: <a href="http://wiki.openid.net/Libraries" rel="nofollow noreferrer">http://wiki.openid.net/Libraries</a></p>
| <p>You can also use an RPX <a href="http://rpxnow.com" rel="nofollow noreferrer">http://rpxnow.com</a> . The service will allow you to accept OpenIDs, Facebook, and MySpace . Your application needs to be able to make https calls out, and be able to parse xml or json responses.</p>
| 43,710 |
<p>If there is more than one way, please list them. I only know of one, but I'm wondering if there is a cleaner, in-Ruby way.</p>
| <p>If it's a process you expect to "own" (e.g. you're using this to validate a pid for a process you control), you can just send sig 0 to it.</p>
<pre><code>>> Process.kill 0, 370
=> 1
>> Process.kill 0, 2
Errno::ESRCH: No such process
from (irb):5:in `kill'
from (irb):5
>>
</code></pre>
| <p>A <code>*nix</code>-only approach would be to shell-out to <code>ps</code> and check if a <code>\n</code> (new line) delimiter exists in the returned string.</p>
<p><em><strong>Example IRB Output</em></strong></p>
<pre><code>1.9.3p448 :067 > `ps -p 56718` ... | 42,089 |
<p>I'm trying to connect to a remote database (hosted on Netfirms <a href="http://www.netfirms.ca" rel="nofollow noreferrer">www.netfirms.ca</a> if anyone is curious) using hibernate. My mapping file is as follows:</p>
<pre><code><hibernate-configuration>
<session-factory>
<property name="hi... | <p>It turns out that there were several issues with the connection:</p>
<ol>
<li>Although the site said to use mysql.netfirms.ca on the Control Panel, their generic instructions were correct and I was supposed to use mysql.netfirms.com as someone else mentioned earlier.</li>
<li>Netfirms was having some issues with th... | <p>The Exception says, that there is no route to the host. That means you most likely can not even ping your db server.</p>
<p>reading <a href="http://support.netfirms.com/article.php?id=694" rel="nofollow noreferrer">http://support.netfirms.com/article.php?id=694</a> you should put another host in your jdbc url</p>
... | 45,805 |
<p>I have a DBGrid on a form. The DBGrid has many columns, so an horizontal scroller is displayed. I scroll the DBGrid view to the right to see more columns. If I select a row, the DBGrid view is automatically reset to view the first column (As if I scroll back to the left most position). </p>
<p>Is there a way t... | <p>I assume you have <em>goRowSelect</em> in the grid options. This forces the selected col to be the first non-fixed column, so whenever the row changes the code to scroll the selected cell into view forces the first non-fixed column to be visible.</p>
<p>Since <em>goRowSelect</em> also effectively disables the hori... | <p>You might be able to ask for the scrollbar position</p>
<pre><code>GetScrollInfo(Self.Handle, SB_VERT, SIOld);
</code></pre>
<p>and use <code>SetScrollInfo( )</code> to put it back. There's probably a better way. <code>SelectedField</code> is another way (get/set it as needed).</p>
| 43,521 |
<p>I need rich UI designer for editing the web.config for ASP.net application.
From the designer We can edit the tags in config files</p>
<p>It may be any windows application going to edit my config files.</p>
| <p>ASPhere is a nice Windows GUI app for editing web.config:</p>
<ul>
<li><a href="http://asphere.aspweb.cz/" rel="nofollow noreferrer">ASPhere</a></li>
</ul>
| <p>What exactly do you want to accomplish? Web.config is just an XML file, and there are loads of good XML editors available. However, using Visual Studio 2008 gives you full IntelliSense support. The IIS web server manager also has a built-in graphical editor, but you'll need web server access for that.</p>
| 38,620 |
<p>Which download I need to use to use TinyMCE in JSP(Struts application)</p>
<p>I see Main Package, Development Package and also different Compression packages.</p>
<p>I am trying to implement Rich text editor for a text area in our application.</p>
| <p>The compression packages are just compressed versions of the main package - you should be careful about using them because they can cause a lot of load on the client-side. The development package will probably be an unstable version of the code, so you should probably use the main package to be safe.</p>
| <p>I got it working.
Answering my own quesion: We need to copy the entire folder to the project and edit the Jsp as per examples in the website.</p>
<p>I used main package.</p>
| 25,109 |
<p>It's fairly common for E3D to sell silicone socks for their hot ends. There are also other companies that sell these silicone socks for their hot end cartridges.</p>
<p>According to a brief internet search, it seems the ignition temperature of silicone is surprisingly low - around 450 °C. This surprised me... | <p>Neither your thermistor nor your heater cartridge should ever be capable of becoming loose from your hotend, let alone the fact it's capable of reaching 800 °C before your printer even notices (This is a massive issue in itself!!!)</p>
<p>Silicone socks are safe, unless you're printing materials with extre... | <p>Silicone socks are <strong>safe to use</strong>, provided your <strong>printer is safely operating</strong> and you are <strong>using the silicone socks in their operating temperature range</strong>.</p>
<hr />
<h1>Your current setup is NOT SAFE!</h1>
<hr />
<p>When the heater element falls out of the heater block ... | 1,515 |
<p>According to <a href="http://msdn.microsoft.com/en-us/magazine/cc163610.aspx" rel="noreferrer">this article</a> rebasing is not necessary for .NET assemblies due to JIT compilation of the code. The article states: </p>
<p><em>"JIT-compiled code does not have a rebasing problem since the addresses are generated at r... | <p>CLR Loading mechanism uses LoadLibrary behind the scenes, so this is what you observe: 2 assemblies can't be loaded at the same address. Now what people often mean when they try to rebase a dll is to avoid the perf. hit of fix-ups, e.g. absolute addresses & function calls need to be "relocated" with the loaded b... | <p>What OS are you running? I know that the vista and beyond introduced ASLR which randomizes the address space it loads dlls into. This happens for system dlls but not sure about .net - maybe something to look into.</p>
| 45,902 |
<p>In Postgresql you can create additional Aggregate Functions with </p>
<pre><code>CREATE AGGREGATE name(...);
</code></pre>
<p>But this gives an error if the aggregate already exists inside the database, so how can I check if a Aggregate already exists in the Postgres Database? </p>
| <pre><code>SELECT * FROM pg_proc WHERE proname = 'name' AND proisagg;
</code></pre>
<ul>
<li><a href="http://www.postgresql.org/docs/8.3/interactive/catalogs-overview.html" rel="noreferrer">http://www.postgresql.org/docs/8.3/interactive/catalogs-overview.html</a></li>
<li><a href="http://www.postgresql.org/docs/8.3/i... | <pre><code>drop aggregate if exists my_agg(varchar);
create aggregate my_agg(varchar) (...);
select * from pg_aggregate
where aggfnoid = 'my_agg'::regproc;
</code></pre>
| 39,742 |
<p>I have some data in the following format:</p>
<p>Salary<br>
Code InTime </p>
<p>1690 09:03:00<br>
1690 09:13:00<br>
1690 09:07:00<br>
1691 08:48:00<br>
1691 08:52:00<br>
1691 08:50:00<br>
1691 08:54:00<br>
1691 08:46:00<br>
1691 09:28:00<br>
1691 08:59:00<br>
1691 08:53:00<b... | <p>It can be done without programming, but there is one bit of information you need to add in order for this to make sense - the date or sequence number for each entry.
Then you will be able to plot:</p>
<ol>
<li>salary code: the series</li>
<li>date or sequence number: the x-axis</li>
<li>In Time: the value / y-axis<... | <p>I don't think there is an easy way out.. </p>
<p>the best I can do in 5 minutes is flip the columns, select and Create an XY Scatter plot.</p>
<p>It still won't give you different dot colors for each employee or individual lines</p>
| 24,486 |
<p>I want to select records that are 1 month old or newer.</p>
<p>The query is: SELECT * FROM foobar WHERE created_at > DATE_SUB(curdate(), INTERVAL 1 MONTH)</p>
<p>Using Propel in Symfony, I do:</p>
<blockquote>
<p>$c = new Criteria<br>
$c->add(FoobarPeer::CREATED_AT, "DATE_SUB(curdate(), INTERVAL 1 MONTH)", Cr... | <p>I think there is no option more than using Criteria::CUSTOM or doing a custom SQL query like this:</p>
<pre><code>$con = Propel::getConnection(DATABASE_NAME);
$sql = "SELECT foobar.* FROM foobar WHERE created_at > DATE_SUB(curdate(), INTERVAL 1 MONTH)";
$stmt = $con->prepare($sql);
$stmt->execute();
$b... | <p>just replace the mysql date code you are using there with a precalculated php variable that has that date in it already.</p>
<p>i.e.</p>
<pre><code>$monthAgo = '2008-10-03';
$c = new Criteria
$c->add(FoobarPeer::CREATED_AT, $monthAgo, Criteria::GREATER_THAN);
</code></pre>
<p>obviously, you should dynamically... | 32,520 |
<p>Is there a component available list FileUpload which shows files on the server, not the client? </p>
<p>I am basically looking for a clean dialog box to select server side files, like the one used in FileUpload.</p>
| <p>Nope. There's not. That said, you can use a listbox, and load the files into it.</p>
<pre><code>public sub file_DatabindListbox(directoryPath as string)
for each fName as string in io.directory(directorypath).getfilenames()
dim li as new listitem
li.text = io.path.getfilename(fName)
li.value = f... | <p>You cannot browse through the folders of your server in the same way that you would with the FileUpload components, because... well all the files are located on the server and the "clean dialog" that you refer to is client side. You can write you own code to list the files in a dropdown. But if your files are locate... | 17,927 |
<p>In Visual c# Express Edition, is it possible to make some (but not all) items in a ListBox bold? I can't find any sort of option for this in the API.</p>
| <p>You need to change listbox's DrawMode to DrawMode.OwnerDrawFixed. Check out these articles on msdn:<br>
<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.drawmode.aspx" rel="noreferrer">DrawMode Enumeration</a><br>
<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.listbox.draw... | <p>Following is the code demonstrating the same.</p>
<pre><code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : ... | 42,408 |
<p>Is it possible to convert some part of web page into a image. Lets say i have a div which contains a text and image inside. I want to store this entire div as an image on the server side, So that i can use that image from the next time onwards. </p>
<p>Could you let me know whether there is any jquery plugin/ php ... | <p>You could use a browser engine render the page as an image, and then cut out the requested section of the page.</p>
<p>I don't know if there is a jquery or php extension that does it for you, but you could use an exec call and use for instance <a href="http://cutycapt.sourceforge.net/" rel="nofollow noreferrer">Cut... | <p>I'm pretty sure you can't do this in JavaScript / jQuery. Not without some plugin anyway.</p>
<p>Also it sounds a little strange to store text as an image.</p>
| 47,287 |
<p>Is there a C function call that can change the last modified date of a file or directory in Windows?</p>
| <p>You can use the <a href="http://msdn.microsoft.com/en-us/library/ms724933(VS.85).aspx" rel="noreferrer">SetFileTime</a> function, for the directories, you have to use the <a href="http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx" rel="noreferrer">CreateFile</a> function with the FILE_FLAG_BACKUP_SEMANTIC... | <p>Yes. You can use the <a href="http://msdn.microsoft.com/en-us/library/ms724933.aspx" rel="nofollow noreferrer">SetFileTime</a> API function.</p>
| 35,382 |
<p>I have a web application that uses Ext-JS 2.2. In a certain component, we have an empty toolbar that we are trying to add a button to using </p>
<pre><code>myPanel.getTopToolbar().insertButton(0, [...array of buttons...]);
</code></pre>
<p>However, in IE6/7 this fails because of lines 20241-20242 in ext-all-debug.... | <p>What I've had to do in the past was include an empty toolbar in my element config:</p>
<p>tbar:[]</p>
<p>Then (and only after the element has completely rendered) use the .add() method for injecting buttons.</p>
<p>Order of events will get you every time. It takes a while to get a handle on it.</p>
| <p>If all you are doing is adding to a empty panel </p>
<pre><code> myPanel.getTopToolbar().add(buttons etc);
</code></pre>
<p>Or </p>
<pre><code> myPanel.getTopToolbar().addButton(..);
</code></pre>
<p>Either should work. It looks like purpose of insertButton is for putting a button within a non-empty toolbar.</p... | 40,751 |
<p>I've been strictly in a C++ environment for years (and specialized statistical languages). Visual Studio until 2001, and Borland since. Mostly specialized desktop applications for clients. </p>
<p>I'm not remaining willfully ignorant of it, but over the years when I've dipped into other things, I've spent my time p... | <blockquote>
<p>ASP.NET is a web application framework
developed and marketed by Microsoft,
that programmers can use to build
dynamic web sites, web applications
and web services. It was first
released in January 2002 with version
1.0 of the .NET Framework, and is the successor to Microsoft's Active Serve... | <p>Take a look at MS' info for those who don't know or understand the platform.</p>
<p><a href="http://www.asp.net/get-started" rel="nofollow noreferrer">http://www.asp.net/get-started</a></p>
| 4,549 |
<p>E3D mentions on their <a href="http://wiki.e3d-online.com/wiki/E3D-v6_Assembly#Usage_Guidance" rel="nofollow noreferrer">own wiki</a>:</p>
<blockquote>
<p>Excessively long retractions will cause issues by dragging soft filament into cold areas. [...] for bowden systems you might want to go up to 2 mm. Retrac... | <p>Yes, you can increase retraction past E3D's max 2 mm recommendation to compensate for Bowden tube stretch and slop. The reason for the recommendation is that jams will occur with most all-metal hot ends if you pull molten filament up into the cold zone. Any molten filament that enters the cold zone rapidly cool... | <p>In addition to the already excellent answers above, I want to mention that maybe a change in hotend temperature (lower) can also help reducing ooze/stringing. That is, if not other parameters prevent that.</p>
| 238 |
<p>In case one wants to protect VBA applications to make trial(demo) versions and not to expose the scripts, how secure the built in password protection is? Are there any alternatives?</p>
<p>Edit: I'm asking about Excel VBA here.</p>
| <p>Your password security is going to depend largely upon the version of office used. All other Office solutions prior to 2007 can be cracked. Office 2007 requires brute forcing the password. The default encryption mechanism is 128 bit AES.</p>
<p>This means the higher the complexity of the password, the harder to c... | <p>If you really want to protect source, <a href="http://msdn.microsoft.com/en-us/library/aa730920.aspx" rel="nofollow noreferrer">this</a> may be the way to go for you. For those who may not want to follow the link it's an article regarding developing an XLL add-in for Excel 2007. Xll is a specialized dll for use wi... | 32,447 |
<p>I have limited knowledge of Java-based technologies, and for business enforced reasons, I may need to decide whether WebLogic Integration (WLI) or Oracle Service Bus (OSB) is the better choice for integrating a small number of standalone systems together. Both products seem capable of similar tasks, though in one c... | <p>Well it depends. </p>
<p>OSB will integrate existing BEA's Aqualogic Service Bus. It is a service bus only.</p>
<p>WLI will no longer exists. Now it will be part of Oracle BPEL PM ( Oracle BPEL Process Manager execution engine )</p>
<p>A service bus may be used to integrated webservice "ready" applications. If y... | <p>It sounds like WLI is a premature BPM & ESB tool. It is also listed as part of the Oracle SOA Stretegry platform on their website. Since it does things what an ESB and a BPM tool should do, what is the future of WLI?</p>
| 49,225 |
<p>I keep reading about how great this new Canvas element for HTML5 is and I see amazing demos done with just javascript and no flash. Where can I find some good information on how to some of these things myself?</p>
| <p><a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#the-canvas-element" rel="noreferrer">The specification</a> defines the API and behaviour.</p>
<p><a href="http://developer.mozilla.org/en/Canvas_tutorial" rel="noreferrer">This tutorial</a> should help you get started.</p>
| <p><a href="http://www.brighthub.com/hubfolio/matthew-casperson/blog/archive/2009/06/29/game-development-with-javascript-and-the-canvas-element.aspx" rel="nofollow noreferrer">This page</a> is a 14 part series that shows you how to create a simple platform game using the canvas element.</p>
| 20,511 |
<p>I intend and would like to print a transparent hemisphere. I have a Taulman T-Glase clear 1.75 mm filament and I have XTC-3D.</p>
<p>You can read this interesting page, <a href="http://taulman3d.com/t-glase-optics.html" rel="nofollow noreferrer">Hacking t-glase to look more like glass!</a></p>
<p>First question, w... | <p>First I would hedge your expectations.. I am very familiar with t-glase. It is very translucent but it is not clear and no amount of post treatment will make it 100% clear. Their example is the only exception where you have a simple print where it has only a single layer. By applying the clear coating they have norm... | <p>You will not get perfectly clear prints with FDM because of the mechanics of FDM printing there will always be tiny gaps. But, you can get pretty close as demonstrated by a <a href="https://learn.colorfabb.com/lets-make-something-clear/" rel="nofollow noreferrer">ColorFabb tutorial</a>.</p>
<p>A clear filament and ... | 506 |
<p>I have unsorted map of key value pairs.</p>
<pre><code>input = {
"xa" => "xavalue",
"ab" => "abvalue",
"aa" => "aavalue",
"ba" => "bavalue",
}
</code></pre>
<p>Now I want to sort them by the key and cluster them into sections by the first character of the key. Similar to this:</p>
<pre><code>o... | <p>As far as I know, there isn't the notion of a sorted hash/map in Ruby, so you're limited to good old arrays for this one. You may want to start from this code:</p>
<pre><code>output = input.inject({}) { |acc, pair|
letter = pair.first[0].chr
acc[letter] ||= {}
acc[letter][pair.first] = pair.last
acc
}.sort
... | <p>I'm a pythonista but i've tried anyway:</p>
<pre><code>class Hash
def clustered
clustered = Hash.new
sort.each do | key, value |
first = key[0,1]
unless clustered.has_key?(first)
clustered[first] = Hash.new
end
clustered[first][key] = value
end
clustered
e... | 48,492 |
<p>Specifically, once I get the WCAG Anaylsis warnings for a website into my warnings window I can't get rid of them, until I close down studio. When building another project in the same solution they stay there.</p>
<p>Anyone got any ideas?</p>
| <p>I came across this question yesterday looking for an easy answer. While closing the solution works for me, and then rebuilding only the solution I want to see warnings on, I found that doing a "Clean Solution" (right-click solution, select "Clean Solution") will clear the Error List pane (including warnings).</p>
| <p>Just click on the "Warnings" button at the top of the window to hide them.</p>
| 43,699 |
<p>A few months back my team switched our source control over to <a href="http://subversion.apache.org/" rel="noreferrer">Apache Subversion</a> from <a href="http://msdn.microsoft.com/en-us/vs2005/aa718670.aspx" rel="noreferrer">Visual SourceSafe</a>, and we haven't been happier. </p>
<p>Recently I've been looking at... | <p>I joined an Open Source project over at CodePlex, recently. They use TFS for their source control and I have to say that it's absolutely magnificent. I'm incredibly impressed with it, so far. I'm a huge fan of the IDE integration and how easy it is to branch and tag your code. Adding a solution to source control is ... | <p>TFS by a mile.</p>
<p>I inadvertently cause too many problems for myself with SVNs file-based approach.
Source control problems ive experienced:
TFS – 0 problems over 2 years
SVN – lost count...</p>
<p>Yes I know the price of TFS factors it out for most companies which is such a shame. MS might have a lot more mar... | 2,620 |
<p>In SEO people talk a lot about Google <a href="http://en.wikipedia.org/wiki/PageRank" rel="nofollow noreferrer">PageRank</a>. It's kind of a catch 22 because until your site is actually big and you don't really need search engines as much, it's unlikely that big sites will link to you and increase your PageRank!</p>... | <h2>Have great content</h2>
<p>Nothing helps your google rank more than having <strong>content</strong> or offering a service people are interested in. If your web site is better than the competition and solves a real need you will naturally generate more traffic and inbound links.</p>
<h2>Keep your content fresh</h2>
... | <p>A easy trick is to use</p>
<p>Google webmaster tool <a href="https://www.google.com/webmasters/tools" rel="nofollow">https://www.google.com/webmasters/tools</a></p>
<p>And you can generate a sitemap using <a href="http://www.xml-sitemaps.com/" rel="nofollow">http://www.xml-sitemaps.com/</a></p>
<p>Then, don't m... | 8,283 |
<p>I have a winform app that is hiding it's UI and waiting on a named pipe message before showing up
On receiving the event the thread invokes into the main UI thread and then does the following</p>
<p>Set the opacity to 100
ShowInTaskbar = true;
BringToFront();</p>
<p>ON Windows Vista the window does not show up on... | <p>Your email might not be considered "bulk" because it sounds like it's one->one as opposed to one->many, but these bulk mail help resources might still be helpful:</p>
<ul>
<li><a href="http://help.yahoo.com/l/us/yahoo/mail/postmaster/forms_index.html" rel="nofollow noreferrer">Yahoo! Mail Postmaster Help</a></li>
<... | <p>While there may be whitelists used by those sites, I suspect that they only contribute to whatever scoring system is in use - being on the list won't be sufficient in itself.</p>
<p>The overall controlling factor will be the "reputation" of your site - you need to work to ensure that reputation stays sound.</p>
<p... | 37,651 |
<p>I see there are <a href="http://codeigniter.com/wiki/Category:Libraries::Authentication/" rel="noreferrer">a few</a>. Which ones are maintained and easy to use? What are their pros and cons? </p>
| <h2>Update (May 14, 2010):</h2>
<p><strong>It turns out, the russian developer Ilya Konyukhov picked up the gauntlet after reading this and created a new auth library for CI based on DX Auth, following the recommendations and requirements below.</strong></p>
<p><strong>And the resulting <a href="http://konyukhov.com/so... | <p>Also take a look at <a href="http://www.kaydoo.co.uk/projects/backendpro" rel="nofollow noreferrer">BackendPro</a></p>
<p>Ultimately you will probably end up writing something custom, but there's nothing wrong with borrowing concepts from DX Auth, Freak Auth, BackendPro, etc.</p>
<p>My experiences with the package... | 45,147 |
<p>I'd like a textbox that allows for certain text within to be "constant" and uneditable while the rest of the text is editable. For instance, I'd like to define a template like this:</p>
<pre><code><Name:>[]
<Address:>[] <City>:[]
</code></pre>
<p>So that the user could later enter:</p>
<pre><co... | <p>I don't know of any ready-made components. But you could try this simple method.</p>
<ol>
<li>Create a normal multi-line text box control</li>
<li>Create a regex-based template that has <code>(.*)</code> or <code>([a-z]*)</code> or whatever wherever you want the user to add text.</li>
<li>Whenever the text is chang... | <p>I would suggest using multiple controls instead of just one. A single text box would require the user to cursor over to the next field, whereas multiple controls would allow the user to tab between fields, which is expected behavior. If you want to make it <em>look</em> like one control (perhaps to make it look li... | 40,210 |
<p>I'm creating an app that will have to put at max 32 GB of data into my database. I am using B-tree indexing because the reads will have range queries (like from 0 < time < 1hr).</p>
<p>At the beginning (database size = 0GB), I will get 60 and 70 writes per millisecond. After say 5GB, the three databases I've... | <p>Yes; indexing improves fetch times at the cost of insert times. Your numbers sound reasonable - without knowing more.</p>
<p>You can benchmark it. You'll need to have a reasonable amount of data stored. Consider whether or not to index based upon the queries - heavy fetch and light insert? index everywhere a where ... | <p>Totally agree with @Richard-t - it is quite common in offline/batch scenarios to remove indexes completely before bulk updates to a corpus, only to reapply them when update is complete.</p>
<p>The type of indices applied also influence insertion performance - for example with SQL Server clustered index update I/O ... | 26,732 |
<p>I have a small app that has a Render thread. All this thread does is draw my objects at their current location.</p>
<p>I have some code like:</p>
<pre><code>public void render()
{
// ... rendering various objects
if (mouseBall != null) mouseBall.draw()
}
</code></pre>
<p>Then I also have some mouse han... | <p>The problem lies in the fact that you are accessing <code>mouseBall</code> twice, once to check whether it is not <code>null</code> and another to call a function on it. You can avoid this problem by using a temporary like this:</p>
<pre><code>public void render()
{
// ... rendering various objects
tmpBall ... | <p>I know you've already accepted other answers, but a third option would be to use the java.util.concurrent.atomic package's AtomicReference class. This provides retrieval, update and compare operations that act atomically without you needing any supporting code. So in your example:</p>
<pre><code>public void rende... | 47,747 |
<p>Is there a way to test the type of an element in JavaScript? </p>
<p>The answer may or may not require the prototype library, however the following setup does make use of the library.</p>
<pre><code>function(event) {
var element = event.element();
// if the element is an anchor
...
// if the element is a t... | <p>You can use <code>typeof(N)</code> to get the actual object type, but what you want to do is check the tag, not the type of the DOM element.</p>
<p>In that case, use the <code>elem.tagName</code> or <code>elem.nodeName</code> property.</p>
<p>if you want to get really creative, you can use a dictionary of tagnames... | <h1>I have another way of testing the same.</h1>
<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>Element.prototype.typeof = "element";
var element = document.body; // any dom element
if (element && element.... | 22,373 |
<p>I'm trying to use MySQL to create a view with the "WITH" clause</p>
<pre><code>WITH authorRating(aname, rating) AS
SELECT aname, AVG(quantity)
FROM book
GROUP BY aname
</code></pre>
<p>But it doesn't seem like MySQL supports this.</p>
<p>I thought this was pretty standard and I'm sure Oracle supports thi... | <p>Update: MySQL 8.0 is finally getting the feature of common table expressions, including recursive CTEs.</p>
<p>Here's a blog announcing it: <a href="http://mysqlserverteam.com/mysql-8-0-labs-recursive-common-table-expressions-in-mysql-ctes/" rel="noreferrer">http://mysqlserverteam.com/mysql-8-0-labs-recursive-common... | <p>Have you ever tried Temporary Table?
This solved my convern:</p>
<pre><code>create temporary table abc (
column1 varchar(255)
column2 decimal
);
insert into abc
select ...
or otherwise
insert into abc
values ('text', 5.5), ('text2', 0815.8);
</code></pre>
<p>Then you can use this table in every select in this sess... | 42,070 |
<p>If I were writing my own HTML and placing the values in the table I would use css and style the borders using something like:</p>
<pre><code>td{
border-left : solid gray 1px;
}
</code></pre>
| <p>if you put that css style into your web page, you'll find that your datagrid will use it, since the datagrid control just generates a html table!</p>
<p>of course, you can set the CssClass of the datagrid and make a style just for it as well; you can also fiddle with the row-style properties of the datagridview but... | <p>You might try using the gridrowstyle & alternatinggridrowstyle properties of the datagrid. i would suggest setting them to a CSS class as Steven suggests.</p>
| 36,166 |
<p>So I'm getting a new job working with databases (Microsoft SQL Server to be precise). I know nothing about SQL much less SQL Server. They said they'd train me, but I want to take some initiative to learn about it on my own to be ahead. Where's the best place to start (tutorials, books, etc)? I want to learn more... | <p>If you're planning on coding against a sql database using .NET, skip ADO and go directly to Linq. You will NOT miss anything.</p>
<p>Oh, also, Joe Celko. If you see his name on an article or a book about SQL, read it.</p>
| <p>Yikes...first I'd say "Best of luck to ya!"</p>
<p>Then secondly if you are really serious that you have no experiences with SQL I'd say find one of the SAMS "Teach Yourself SQL in 34 nanoseconds" books. Normally I'd never recommend a SAMS book, but if you are the stalwart type to accept a job you know nothing abo... | 3,879 |
<p>So we're trying to set up replicated repositories using PlasticSCM, one in the US, and one in Australia and running into a bit of a snag.</p>
<p>The US configuration is Active Directory, the AU configuration is User/Password. This in itself is not a big deal, I've already set up the SID translation table. </p>
<... | <p>Ok, I've solved my own problem.<br>
To get that "authdata" string, you need to configure your client to how you need to authenticate.<br>
Then navigate to c:[users directory][username]\Local Settings\Application Data\plastic.<br>
Pick up the client.conf and extract the string from the SecurityConfig element in t... | <p>Check the new GUI <a href="http://www.plasticscm.com/demos/distributed_intro/distributed_intro.html" rel="nofollow noreferrer">here</a>. It's a little bit easier.</p>
| 5,090 |
<p>I want to be able to control my FLSUN QQ over Wi-Fi and don't have OctoPrint or a Raspberry Pi to run it on.</p>
| <p>Assuming you use Ultimaker Cura to slice, there is a MKS plugin that allows connecting to the MKS WiFi module that comes with the QQ. Just follow these steps:</p>
<p><strong>Install the MKS WiFi Plugin</strong></p>
<ol>
<li>Open Cura</li>
<li>Click "Marketplace" in top right</li>
<li>Select "Plugins"</li>
<li>Scro... | <p>As the auto-install from the Marketplace described in <a href="https://3dprinting.stackexchange.com/a/13753">this answer</a> wasn't working , I did have to manually install the MKS WiFi plugin on my Mac (M1 MBPro). To do this I just:</p>
<ol>
<li>Downloaded the GitHub files (from the plugin webpage, linked in the M... | 1,675 |
<p>I've done some research into server push with javascript and have found the general consensus to be that what I'm looking for lies in the "Comet" design pattern. Are there any good implementations of this pattern built on top of jQuery? If not, are there any good implementations of this pattern at all? And regardles... | <p>I wrote the plugin mentioned by Till. The plugin is an implementation of the <a href="http://cometdproject.dojotoolkit.org/documentation/bayeux" rel="noreferrer">Bayeux</a> protocol and currently supports long-polling (local server via AJAX) and callback-polling (remote server via XSS). There is a <a href="http://co... | <p>Comet is a great solution, and there are all kinds of implementations. Which one depends on your needs.</p>
<p>We've implemented a solution for IIS/ASP.NET, <a href="http://www.frozenmountain.com/websync" rel="nofollow noreferrer">WebSync</a>. It includes the javascript client, which plays nicely with jQuery. Techn... | 16,464 |
<p>Does anyone have an example of using of populating a YUI DataTable with a .NET webservice?</p>
<p>Thanks in advance.
:)</p>
| <p>I tried this a while back:
<a href="http://mattberseth.com/blog/2008/09/dynamic_data_experimenting_wit.html" rel="nofollow noreferrer">http://mattberseth.com/blog/2008/09/dynamic_data_experimenting_wit.html</a></p>
<p>However, you will need control over the webservice so that you can turn it into XML, or JSON or w... | <p>DataTable Control: XML Data Over XHR (Ajax Request) With POST</p>
<p><a href="http://developer.yahoo.com/yui/examples/datatable/dt_xhrpostxml.html" rel="nofollow noreferrer">http://developer.yahoo.com/yui/examples/datatable/dt_xhrpostxml.html</a></p>
| 25,213 |
<p>There are apparently many ways to iterate over a collection. Curious if there are any differences, or why you'd use one way over the other.</p>
<p>First type:</p>
<pre><code>List<string> someList = <some way to init>
foreach(string s in someList) {
<process the string>
}
</code></pre>
<p>Othe... | <p>There is one important, and useful, distinction between the two.</p>
<p>Because .ForEach uses a <code>for</code> loop to iterate the collection, this is valid (edit: <strong>prior to .net 4.5</strong> - the implementation changed and they both throw):</p>
<pre><code>someList.ForEach(x => { if(x.RemoveMe) someLi... | <p>The second way you showed uses an extension method to execute the delegate method for each of the elements in the list.</p>
<p>This way, you have another delegate (=method) call.</p>
<p>Additionally, there is the possibility to iterate the list with a <em>for</em> loop.</p>
| 27,931 |
<p>i need to convert pointers to long (SendMessage())
and i want to safely check if the variable is correct on the otherside. So i was thinking of doing dynamic_cast but that wont work on classes that are not virtual. Then i thought of doing typeid but that will work until i pass a derived var as its base.</p>
<p>Is t... | <p>If all you have is a <code>long</code>, then there's not really much you can do. There is no general way to determine whether an arbitrary number represents a valid memory address. And even if you know it's a valid memory address, there is no way to determine the type of the thing the pointer points to. If you can't... | <p>PTLib ( <a href="http://sourceforge.net/projects/opalvoip/" rel="nofollow noreferrer">http://sourceforge.net/projects/opalvoip/</a> ) uses a PCLASSINFO macro to define relations between classes. This provides functions like IsDescendant and GetClass.</p>
<p>You could probably implement something similar.</p>
| 40,176 |
<p>Right, in short we basically already have a system in place where the HTML content for emails is generated. It's not perfect, but it works.</p>
<p>From this, we need to be able to derive a plaintext alternative for the email. I was thinking of instantly jumping on and creating a RegEx to strip the <code><*></... | <h2>My Solution</h2>
<p>OK, so here it is! I thought up a solution to my problem and it works like a charm!</p>
<p>Now, here are some of the goals I wanted to set out:</p>
<ul>
<li>All the content for the emails should remain in the ASPX pages (as the HTML content currently does).</li>
<li>I didn't want the client code... | <h3>My Idea</h3>
<p>Create a page based on the HTML content and traverse the control tree. You can then pick the text from the controls and handle different controls as required (e.g. use ALT text for images, "_____" for HR etc).</p>
| 35,012 |
<p>When interviewing for a programming position, did you ever get an answer to your question that you didn't quite expect? The answer could've been quite smart that you didn't even know or it could've been a dumbest answer you never expected. I'm expecting technical type of questions but anything interesting is fine.</... | <p>Q: "Do you have any weaknesses?"</p>
<p>A: "Kryptonite"</p>
| <p>Sorry, I misread the question. But since I've also done interviewing I can adapt my answer.</p>
<p>Where I work, the first question we ask in every interview is "tell us a joke". (Yes, I know, it isn't technically a "question"). This tends to lead to some unexpected answers, but they'd only be entertaining in pe... | 36,871 |
<p>When I write to the beginning of the file,it always leaves the first line empty,and start writing from the second one.<br>
How can I make it write from the first line,including the first one and on?<br>
Thanks.</p>
| <p>If I understand your question correctly, you are creating a new file or overwriting an existing file and afterwards the file starts with a blank line that you do not want? If so, you are probably printing out a newline ("\n" or endl) at the beginning without realizing it.</p>
| <p>Sounds like you are outputting a newline character before the first line . Can you post some code that has the problem?</p>
| 32,083 |
<p>My InstallShield 2009 basic MSI project installs pretty slowly. We have a 65MB .msi and a 110MB .cab. The project was upgraded from IS12, using which it took about half as long to install.</p>
<p>Did the 2009 upgrade make some default modifications that I can reverse? Are there any general optimizations that can ... | <p>The phrase I emphasized in the paragraph below, found on <a href="http://kb.acresso.com/selfservice/documentLink.do?popup=false&externalID=Q200151&languageId=" rel="nofollow noreferrer">this page</a> describing possible issues upgrading to 2009, could be taken as a euphamism:</p>
<blockquote>
<p>Previousl... | <p>I had a similar problem going from IS12 to 2008, eventually I just bit the bullet and rebuilt the project from scratch (using a bit of import/export for certain dialogs, registry entries, etc)</p>
| 22,662 |
<p>I have a simple Flex application that is a panel with a repeater inside of it; albeit a little simplified, it is like such:</p>
<pre>
<code>
<mx:Panel id="pnl">
<mx:Repeater id="rp">
<mx:Label text = "foo" />
</mx:Repeater>
</mx:Panel>
</code>
</pre>
<p>I am then embedding this Flex ap... | <p>I'm currently working in the same thing (a swf that dynamically changes it's height depending on the content it's currently holding). I also had a similar problem to yours trying to make a multi-line button.</p>
<p>I'm new to flex but I managed to solve the problem manually invoking the updateDisplayList() of the c... | <p>Why not simply using percent width and height on your HTML page for your Flash object ? This way you event don't have to do anything to resize your SWF...</p>
| 30,852 |
<p>I'm using CFHTTP to post data to my payment gateway (Protx).</p>
<p>Protx requires that I whitelist the IP that will send this request.</p>
<p>I am hosted on a shared server running Windows 2008.</p>
<p>This morning, my hosting company assigned a new IP to this server for a customer who required an SSL certificat... | <p>Here's something I put together in under 5 minutes to change the icon on a specific window. You could easily use this code to create a winform that would enumerate the currently open windows and allow you to assign arbitrary icons to them. (C# code below)</p>
<pre><code>[DllImport("user32.dll", CharSet=CharSet.Auto... | <p>I believe the taskbar uses the icon resource embedded in the executable. I tried creating multiple shortcuts to Internet Explorer, each with a unique shortcut icon, but they all had the same icon when opened on the taskbar.</p>
<p>I think you'd have to run multiple instances of the browser executable, and each woul... | 46,539 |
<p>I'm using the following code for setting/getting deleting cookies:</p>
<pre><code>function get_cookie(cookie_name)
{
var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
if (results)
return ( decodeURI(results[2]) );
else
return null;
}
function set_cookie(n... | <p>If you're getting old cookies that might be because your page contains a lot of content and onload isn't called before onunload (because the page doesn't finish loading). So delete the cookie by calling something like this from both onload and onunload:</p>
<pre><code>var deleted_cookie = false;
function delete_tim... | <p>Your code for set_cookie, get_cookie and delete_cookie seems to be correct. And your usage as well.</p>
<p>I think you should move this into your Java code - for me it seems an easier option than to hack this via cookies.</p>
| 15,290 |
<p>Can someone explain in simple terms the "signals and slots" pattern?</p>
| <p>Signals and slots are a way of decoupling a sender (the signal) and zero or more receivers (the slots). Let's say you a system which has events that you want to make available to any other part of the system interested in those events. Rather than hard-wiring the code that generates event to the code that wants to k... | <p>The best example and explanation I've found for signals and slots is <a href="http://www.codeproject.com/Articles/6780/Type-safe-Signals-and-Slots-in-C-Part-2" rel="nofollow">this code project article</a>.</p>
| 40,326 |
<p>In the default asp.net mvc project, in the Site.Master file, there is a menu navigation list:</p>
<pre><code><div id="menucontainer">
<ul id="menu">
<li><%= Html.ActionLink("Home", "Index", "Home")%></li>
<li><%= Html.ActionLink("About Us", "A... | <p>I made myself a helper method to handle this type of thing. In the code behind of my master page (could be pushed of to an extension method ... probably a better approach), I put the following code.</p>
<pre><code>protected string ActiveActionLinkHelper(string linkText, string actionName, string controlName, strin... | <p>Try </p>
<p>Should work fine !!!</p>
<p>EDIT : REMOVED IN BETA1</p>
<p>Removed the ViewName property from the ViewContext class.</p>
| 26,373 |
<p>Does some article or proof exist that .NET applications are immune to low level errors? </p>
<p>I'm talking about the classic pointer errors we can see in a C++ application, memory overflow, problems from the Intel <a href="http://en.wikipedia.org/wiki/NX_bit" rel="nofollow noreferrer">DEP</a> and so on.</p>
<p>I'... | <p>I would say that by design a pure .NET managed safe application is immune to exploits, but...</p>
<ol>
<li>That's only by design</li>
<li><p>That application is also immune to performing any useful work - to do that it will have to interoperate with some unmanaged code - a great deal of effort goes into ensuring th... | <p>I haven't personally encountered anything related to memory management or chipset, but I've seen a LOT of wholly unexpected exceptions flow out of COMesque situations (LDAP as a lousy example, maybe file or database i/o) where you might not declare or feel like you're calling "unsafe" code but nonetheless encounter ... | 25,442 |
<p>I have a self-hosted service that I want to add transport security to.
I've set WSHttpBinding.SecurityMode to Transport and the ClientCredentialType to HttpClientCredentialType.None.
I've created a certificate and set it to my host with
ServiceHost.Credentials.ServiceCertificate.SetCertificate()
I've also registered... | <p>I assume you are complaining about the minimal height of the middle row (the one containing only rowspanned cells), and the enlarged height of the adjacent rows to compensate, leaving gaps between the divs.</p>
<p>IE cannot calculate optimal row heights when the row contains only rowspanned cells. The usual solutio... | <p>You should definitely go with CSS. Tables should NEVER be used for layout.</p>
| 23,996 |
<p>Greetings!</p>
<p>I'm working on wrapping my head around LINQ. If I had some XML such as this loaded into an XDocument object:</p>
<pre><code><Root>
<GroupA>
<Item attrib1="aaa" attrib2="000" attrib3="true" />
</GroupA>
<GroupB>
<Item attrib1="bbb" attri... | <pre><code>XElement e = XElement.Parse(testStr);
string groupName = "GroupB";
var items = from g in e.Elements(groupName)
from i in g.Elements("Item")
select new {
attr1 = (string)i.Attribute("attrib1"),
attr2 = (string)i.Attribute("attrib2"... | <p>Another possibility is using a where clause:</p>
<pre><code>var groupName = "GroupB";
var results = from theitem in doc.Descendants("Item")
where theitem.Parent.Name == groupName
select new
{
attrib1_val = theitem.Attribute("attrib1").Value,
... | 15,484 |
<p>I have an application that uses DataTables to perform grouping, filtering and aggregation of data. I want to replace datatables with my own data structures so we don't have any unnecessary overhead that we get from using datatables. So my question is if Linq can be used to perform the grouping, filtering and aggreg... | <p>Unless you go for simple classes (POCO etc), your own implementation is likely to have nearly as much overhead as <code>DataTable</code>. Personally, I'd look more at using tools like LINQ-to-SQL, Entity Framework, etc. Then you can use either LINQ-to-Objects against local data, or the provider-specific implementati... | <p>Why not use a local database like Sqlserver CE or firebird embedded? (or even ms access! :)). Store the data in the local database, do the processing using simple sql queries and pull the data back. Much simpler and likely less overhead, plus you don't have to write all the logic for grouping/aggregates etc. as the ... | 49,175 |
<p>Why is an exception being thrown in the "f++" part of the code below ("IndexOutOfRangeException was unhandled by user code"):</p>
<pre><code>for (int f = 0; f < gnf; f++)
{
fieldNames[g] = grid.FieldName(f);
}
</code></pre>
<p>The bug is in the "fieldNames[g] = ..." part of the code, my algorithm sh... | <p><a href="http://msdn.microsoft.com/en-us/library/ey1cdcx8.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ey1cdcx8.aspx</a></p>
<p>You need to use the overloaded DateTime.Parse to accurately parse timezones.</p>
| <p>If a specific date and time format will be parsed across different locales, use one of the overloads of the ParseExact method and provide a format specifier. </p>
| 23,470 |
<p>While googling, I see that using <a href="http://docs.oracle.com/javase/6/docs/api/java/io/File.html#length%28%29" rel="noreferrer"><code>java.io.File#length()</code></a> can be slow.
<a href="http://docs.oracle.com/javase/6/docs/api/java/nio/channels/FileChannel.html" rel="noreferrer"><code>FileChannel</code></a> h... | <p>Well, I tried to measure it up with the code below:</p>
<p>For runs = 1 and iterations = 1 the URL method is fastest most times followed by channel. I run this with some pause fresh about 10 times. So for one time access, using the URL is the fastest way I can think of:</p>
<pre><code>LENGTH sum: 10626, per Iterat... | <p>Actually, I think the "ls" may be faster. There are definitely some issues in Java dealing with getting File info. Unfortunately there is no equivalent safe method of recursive ls for Windows. (cmd.exe's DIR /S can get confused and generate errors in infinite loops)</p>
<p>On XP, accessing a server on the LAN, i... | 14,199 |
<p>When is it appropriate to use <cflock scope="application"> or it's ilk as opposed to <cflock name="foo">? </p>
<p>Specifically, I'm interested in using CFLock to protect shared objects in the application, session, or server scopes, but I'm also interested in finding out about different uses of locking ... | <p>You should use when reading and writing from things that can change in the application scope. For example:</p>
<pre><code><cfquery name="application.myData">
select * from myTable
</cfquery>
</code></pre>
<p>You are going to want to lock that with type="exclusive". Wherever application.myData is u... | <p>Typically you should always use cflock for session, application and server vars any time you're reading or changing those vars outside of an Application.cfc so as to prevent race-conditions. Here's an article that may be helpful:</p>
<p><a href="http://www.horwith.com/index.cfm/2008/4/28/cflock-explained" rel="nof... | 37,942 |
<p>Visual Studio 2008 SP1 (although IIRC, the behavior was present in 2005 as well) keeps resizing a couple of grid controls (Janus.GridEx to be precise) I use.</p>
<p>I can resize them back to normal, save, and compile just fine. When it does compile, these two controls will expand to ridiculous values.</p>
<p>More ... | <p>I usually solve that kind of trouble by putting the 'good' code in the form constructor, right after the call to InitializeComponent(), so it overrides any mess the automatic designer magic might cause. </p>
| <p>Usually when I have this problem, I end up using Panels and Labels (blank text) with the Dock and Padding properties on the controls to get the same visual look. Whether this would be practical for your form would depend on how it is laid out.</p>
<p>Not the best solution because of all the extra controls, but it ... | 23,438 |
<p>To analyze lots of text logs I did some hackery that looks like this:</p>
<ol>
<li>Locally import logs into Access </li>
<li>Reprocess Cube link to previous mdb in Analisis Service 2000 (yes it is 2k)</li>
<li>Use Excel to visualize Cube (it is not big - up to milions raw entries)</li>
</ol>
<p>My hackery is a suc... | <p>You could also try the other free open source OLAP server, PALO from Jedox (www.palo.net)</p>
| <p>I dont think that Mondrian is better than SSAS but I do know that its free and you independently distribute it. It uses XMLA and its cube definition XML file is almost the same as SSAS.</p>
| 2,653 |
<p>When I add a reference to <strong>Microsoft.Office.Interop.Excel</strong> on my computer, Visual Studio adds this to the project file:</p>
<pre><code><COMReference Include="Excel">
<Guid>{00020813-0000-0000-C000-000000000046}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor... | <p>I don't see a problem with your approach either. </p>
<p>Typically VS will generate an interop assembly for COM components automatically when you add a reference to the component. However, when you add a reference to one of the Office components (XP or any later version), a reference to the pregenerated (and optimi... | <p>I found the cleanest way to use it, this also allows for multiple versions of the interop, is to create a shared bin\Office Interop\11 or 12\Microsoft.Office.Interop.Excel.dll\ and refeferenced them from the project, works a treat for different version</p>
| 27,693 |
<p>I'm fooling around with WCF, and would like to see how many messages I send/receive, and how large these messages are.</p>
<p>I tried activated WCF tracing, and ended up with a real huge trace file, but I found no way to extract the simple message size from this.</p>
<p>There sure must be some way to get this? May... | <p>The WCF Service Trace Viewer tool allows you to open the huge trace file and analyze many aspects of your messages. Make sure you've also turned on message logging, so the messages themselves get logged too (with properties such as size...)</p>
| <p>you could also build interceptors in WCF and capture and log this information on your own.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms751495.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms751495.aspx</a></p>
| 41,933 |
<p>This is hopefully a simple question: I have an OpenGL texture and would like to be able to change its opacity, how do I do that? The texture already has an alpha channel and blending works fine, but I want to be able to decrease the opacity of the whole texture, to fade it into the background. I have fiddled with <c... | <p>I have no idea about OpenGL ES, but in standard OpenGL you would set the opacity by declaring a colour for the texture before you use it:</p>
<pre><code>// R, G, B, A
glColor4f(1.0, 1.0, 1.0, 0.5);
</code></pre>
<p>The example would give you 50% alpha without affecting the colour of your texture. By... | <p>I suspect that you had a black background, and thus by decreasing the amount of every color, you were effectively fading the color to black.</p>
| 32,305 |
<p>Linux/Gcc/LD - Toolchain.</p>
<p>I would like to remove STL/Boost debug symbols from libraries and executable, for two reasons:</p>
<ol>
<li>Linking gets very slow for big programs</li>
<li>Debugging jumps into stl/boost code, which is annoying</li>
</ol>
<p>For 1. incremental linking would be a big improvement, ... | <p>As far as I know there's no real option to do what you want in gcc. The main problem being that all the code you want to strip debug symbols for is defined in headers.</p>
<p>Otherwhise it would be possible to build a library separatly, strip that, and link with the stripped version.</p>
<p>But only getting debug ... | <p>Which compiler are you using? For example, if I understand your question correctly, this is a trivial matter in MS Visual Studio.</p>
| 9,924 |
<p><strong>Encrypted email - sounds like a great thing, right?</strong> Problem already solved, right? Well... I don't think so and I'm hoping I'm wrong!</p>
<p>To understand what I'm asking, <strong>please understand what I'm NOT asking</strong>: I am not asking how I encrypt and sign messages sent over public networ... | <p>Most existing email clients support message submission (either using SMTP or MSA) via TLS/SSL. I just checked in Outlook and Opera and both support it.</p>
<p>And I know for a fact that Courier's email suite supports TLS/SSL for both SMTP and MSA (and IMAP), so it's not an obscure setup; just a little uncommon. And... | <p>Here is an example client SSL config screen.</p>
<p>Outlook Express:</p>
<p><img src="https://lh6.ggpht.com/chase.seibert/SQHOAsoCaHI/AAAAAAAAHV8/M28OhvDtsuA/s800/outlookExpress.gif" alt="Outlook Express SSL config"></p>
| 28,767 |
<p>My main experience is with C && C++, so I'd prefer to remain with them. I don't want to use anything like QT, GTK, or wxWidgets or any tool kits. I'd like to learn native programming and this sort of defeats the purpose. With that in mind I'd also like to avoid Java.</p>
<p>I understand gnome and xfce and K... | <p>X is a hideous layer to program for and, despite your intent to avoid Java, QT or any of the excellent UI abstraction layers, you'll be doing yourself a disservice by coding to that level. I've done it (a long time ago when Motif was in its infancy on the platform we were using) and I would <em>not</em> do it again ... | <p>Why not choose one among, say, Qt, wxWidgets and GTK and learn its internals, rather than its API? I do not mean just for the sake of it, but with the aim of contributing to the parts you find most appealing. In this way you'd fulfill your goal and get to do something useful, for you and also for others. I think thi... | 47,201 |
<p>I'm known around the office as "the backup guy". As a developer, I often jump back and forth between projects, and as a result I don't always remember exactly what changes were present in each when I return to them. I usually have to compare my local changes versus those in our source control system, and then I'll e... | <p>I think what you want is a distributed version control system, such as git.</p>
| <p>I use:</p>
<p>ZenOK <a href="http://onlinebackup.zenok.com/" rel="nofollow">Online Backup</a> for my documents and small files (photos, videos and large files)</p>
<p>Love it. </p>
| 44,781 |
<p>There's a requirement that we will need to support querying a local SQL Server database for new data when the database is updated. Since these are external SQL Server databases, we may not be able to use SQL Server Notification Services nor can we make any changes to the database. </p>
<p>My basic idea is to wat... | <p>There's probably no way for you to intercept a FileWrite() call being made by the SQL Server process - if there was, it would be a massive security flaw.</p>
<p>Fortunately, you don't need to, as the filesystem provides you with exactly what you are needing.</p>
<p>The <a href="http://msdn.microsoft.com/en-us/libr... | <p>I don't think going through the file system would be the best option. Even if you could get access to file system activity, I would think it would be difficult to discern what file operation added data vs any other type of file activity like maintenance, index defrags, etc. </p>
<p>A possible alternative would be t... | 33,022 |
<p>We would like to be able to nightly make a copy/backup/snapshot of a production database so that we can import it in the dev environment. </p>
<p>We don't want to log ship to the dev environment because it needs to be something we can reset whenever we like to the last taken copy of the production database.</p>
<p... | <p><a href="http://msdn.microsoft.com/en-us/library/ms187858.aspx" rel="nofollow noreferrer">MSDN</a></p>
<p>I'd say use those procedures inside a SQL Agent job (use master.xp_cmdshell to perform the copy).</p>
| <p>You might want to put the big huge tables on their own partition and have this partition belong to a different file group. You would backup then backup and restore the main file group.</p>
<p>You might want to also consider doing incremental backups. Say, a full backup every weekend and an incremental every night... | 11,524 |
<p>I wrote this function that's supposed to do StringPadRight("Hello", 10, "0") -> "Hello00000".</p>
<pre><code>char *StringPadRight(char *string, int padded_len, char *pad) {
int len = (int) strlen(string);
if (len >= padded_len) {
return string;
}
int i;
for (i = 0; i < padded_len -... | <p>It might be helpful to know that printf does padding for you, using %-10s as the format string will pad the input right in a field 10 characters long</p>
<pre><code>printf("|%-10s|", "Hello");
</code></pre>
<p>will output</p>
<pre><code>|Hello |
</code></pre>
<p>In this case the - symbol means "Left align", ... | <p>The function itself looks fine to me. The problem could be that you aren't allocating enough space for your string to pad that many characters onto it. You could avoid this problem in the future by passing a <code>size_of_string</code> argument to the function and make sure you don't pad the string when the length i... | 34,916 |
<p>I'm using Spring.net with NHiberante (HibernateTemplate) to implement my DAO's.</p>
<p>I also have some integration tests, that extend from 'AbstractTransactionalDbProviderSpringContextTests '.</p>
<p>DI is working fine, and all test pass BUT sometimes they pass <strong>even when they shouldn't</strong>. </p>
<p>... | <p>If you have a syntax error in your mapping, then NHibernate will fail on config.BuildSessionFactory()</p>
<p>But for mispelled/non-existence database objects, the only way for NHibernate to know is to actually run a query... So you might employ some integration tests to test insert/select on a single entity, to ma... | <p>If you have a syntax error in your mapping, then NHibernate will fail on config.BuildSessionFactory()</p>
<p>But for mispelled/non-existence database objects, the only way for NHibernate to know is to actually run a query... So you might employ some integration tests to test insert/select on a single entity, to ma... | 15,452 |
<p>I have class with internal property:</p>
<pre><code>internal virtual StateEnum EnrolmentState
{
get { ..getter logic }
set { ..setter logic }
}
</code></pre>
<p>However I want to be able to access to this property outside of the assembly so I created method that simply returns this property:</p>
<pre><c... | <p>Why is the property internal in the first place? If you want to have public access to it, make it public. I assume you have some control over this, as otherwise you wouldn't be able to add a public method to access it in the first place.</p>
<p>If you only want selected other assemblies to be able to access it, <co... | <p>This sounds like you should reconsider your choice of design. Internal is used to avoid what you are trying to do, so consider using some kind of public access to the properties instead.</p>
<p>It's possible to use the InternalsVisibleTo Attribute to make a specific assembly able to reach internal properties but fr... | 44,148 |
<p>On my app i am creating a real time trace (not sure how yet but i am!) and on the sp_trace_create function in SQlServer, i know that the @maxfilesize defaults to 5, but on my app its going to be stopped when the user wants to stop it...any ideas how this can be done?</p>
<hr>
<p>Because i dont want to have to save... | <p>To start a trace with file rollover, instead of stopping at a maximum size, start the trace like so:</p>
<pre><code>exec @rc = sp_trace_create @TraceID output, 2, N'InsertFileNameHere', @maxfilesize, NULL
</code></pre>
<p>where @maxfilesize will define the size reached before a new rollover file will be created.<... | <p>According to the documentation, what you want to do is not possible:</p>
<p>[ @maxfilesize = ] max_file_size
Specifies the maximum size in megabytes (MB) a trace file can grow. max_file_size is bigint, with a default value of 5. </p>
<p>If this parameter is specified without the TRACE_FILE_ROLLOVER option, the tra... | 39,236 |
<p>I am looking for more information about the minimum requirements needed for a visitor to successfully stream a 1 Mbps 640x360 H.264-encoded video. I know that the user needs the latest Flash 9 version. I am looking for the minimum requirements for their computers.</p>
<p>We want to switch to this codec for our vide... | <p>It actually depends tremendously on the encoding options that you use. Some features that help reduce the bitrate while retaining quality require substantial compute power to decode. </p>
<p>The Microsoft link doesn't indicate what codec they're using (as far as I can tell). They may be giving stats for mpeg2 co... | <p>It actually depends tremendously on the encoding options that you use. Some features that help reduce the bitrate while retaining quality require substantial compute power to decode. </p>
<p>The Microsoft link doesn't indicate what codec they're using (as far as I can tell). They may be giving stats for mpeg2 co... | 25,340 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.