instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I've created a language pack for a site before, but I'm not sure if what I'm doing is the best method.</p>
<p>Basically, all I have is a file with variables defining string constants. Usually a set of arrays where an array usually refers to a particular elements of the site.</p>
<p>Then the site code just include... | <p>I suggest using <a href="http://framework.zend.com/manual/en/zend.translate.html" rel="nofollow noreferrer">Zend_Translate</a>. It is somewhat a combination of the other suggestions people left here, only more maintainable and better designed. </p>
<p>You can switch adapters depending on your preference (supports g... | <p>A couple of the most common ways to do this are:</p>
<p>1) Use <code>define('SOME_STRING', 'Some string');</code> - simply have a different file stuffed with these defines for each language. This is very easy, and you don't have to use "global" all over the place.</p>
<p>2) Wrap strings in a function: <code>trans... | 22,836 |
<p>I want to write a small utility to call arbitrary functions from a C shared library. User should be able to list all the exported functions similar to what objdump or nm does. I checked these utilities' source but they are intimidating. Couldn't find enough information on google, if dl library has this functionality... | <p>This might be near to what you're looking for:
<a href="http://python.net/crew/theller/ctypes/" rel="nofollow noreferrer">http://python.net/crew/theller/ctypes/</a></p>
| <p>Eek! You've touched on one of the very platform-dependent topics of programming. On windows, you have DLLs, on linux, you have <code>ld.so</code>, <code>ld-linux.so</code>, and mac os x's <code>dyld</code>.</p>
| 9,208 |
<p>Requirements:</p>
<ul>
<li>Must be able to use C strings as well as C++ strings</li>
<li>Fast</li>
<li>No maps</li>
<li>No templates</li>
<li>No direct lookup, i.e. index might be out of bounds.</li>
<li>Index is not consecutive</li>
<li>Enums and strings contained in one header file</li>
<li>Only instantiate what ... | <p>Here is what I settled on. Using this technique all you need to do is to include a header file. You will only instantiate what you use. You could also store a perfect hash table instead of just Idx & pStr. This approach does not work in C.</p>
<p>file: e2str.hh</p>
<pre><code>struct Mapper_s
{
int Idx;
... | <blockquote>
<p>I can't do a direct mapping since one application might be feeding me values which are >out of range for my list of strings. A direct lookup into nothingness would be critical.</p>
</blockquote>
<p>So add a count of objects to the array that your accessors check before returnng a value:</p>
<pre><co... | 48,444 |
<p>I have a project where I would like to generate a report export in MS Word format. The report will include images/graphs, tables, and text. What is the best way to do this? Third party tools? What are your experiences?</p>
| <p>The answer is going to depend slightly upon if the application is running on a server or if it is running on the client machine. If you are running on a server then you are going to want to use one of the XML based office generation formats as there are know issues when <a href="http://support.microsoft.com/kb/25775... | <p>Another alternative is <a href="https://www.windwardstudios.com/programming-languages/csharp" rel="nofollow noreferrer">Windward Docgen</a> (disclaimer - I'm the founder). With Windward you design the template in Word, including images, tables, graphs, gauges, and anything else you want. You can set tags where data ... | 3,160 |
<p>Whenever I show a ModalPopupExtender on my Sharepoint site, the popup shown creates both horizontal and vertical scrollbars. If you scroll all the way to the end of the page, the scrollbar refreshes, and there is more page to scroll through. Basically, I think the popup is setting its bounds beyond the end of the ... | <p>Hacky answer would be to grab the IE Developer Toolbar, find the tag that has the scrollbar, and alter your CSS file to add the overflow:hidden property to it.</p>
| <p>Hacky answer would be to grab the IE Developer Toolbar, find the tag that has the scrollbar, and alter your CSS file to add the overflow:hidden property to it.</p>
| 4,753 |
<p>I've seen a few different ways to iterate over a dictionary in C#. Is there a standard way?</p>
| <pre class="lang-cs prettyprint-override"><code>foreach(KeyValuePair<string, string> entry in myDictionary)
{
// do something with entry.Value or entry.Key
}
</code></pre>
| <pre><code>var dictionary = new Dictionary<string, int>
{
{ "Key", 12 }
};
var aggregateObjectCollection = dictionary.Select(
entry => new AggregateObject(entry.Key, entry.Value));
</code></pre>
| 17,039 |
<p><strong><a href="http://en.wikipedia.org/wiki/Anti-pattern" rel="noreferrer">anti-pattern</a></strong> : there must be at least two key elements present to formally distinguish an actual anti-pattern from a simple bad habit, bad practice, or bad idea:</p>
<ul>
<li>Some repeated pattern of action, process or structu... | <p><strong>The Mockery</strong><br>
Sometimes mocking can be good, and handy. But sometimes developers can lose themselves and in their effort to mock out what isn’t being tested. In this case, a unit test contains so many mocks, stubs, and/or fakes that the system under test isn’t even being tested at all, instead dat... | <p><strong>The Conjoined Twins</strong></p>
<p>Tests that people are calling "Unit Tests" but are really integration tests since they are not isolated from dependencies (file configuration, databases, services, other in other words the parts not being tested in your tests that people got lazy and did not isolate) and ... | 43,257 |
<p>What is the best way to include an html entity in XSLT?</p>
<pre><code><xsl:template match="/a/node">
<xsl:value-of select="."/>
<xsl:text>&nbsp;</xsl:text>
</xsl:template>
</code></pre>
<p>this one returns a <strong>XsltParseError</strong></p>
| <p>You can use CDATA section</p>
<pre><code><xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>
</code></pre>
<p>or you can describe &nbsp in local DTD:</p>
<pre><code><!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]>
</code></pre>
<p>or just use <code... | <p>
</p>
<p>One space character between text tags should be enough.</p>
| 5,180 |
<p>How do I create an Application Pool on IIS 6.0 using a PowerShell script?</p>
<p>This is what I have come up with so far ...</p>
<pre><code>$appPool = [wmiclass] "root\MicrosoftIISv2:IIsApplicationPool"
</code></pre>
<p>Thanks</p>
| <p>It isn't the most obvious process, but here is what worked for me..</p>
<pre><code>$AppPoolSettings = [wmiclass]'root\MicrosoftIISv2:IISApplicationPoolSetting'
$NewPool = $AppPoolSettings.CreateInstance()
$NewPool.Name = 'W3SVC/AppPools/MyAppPool'
$Result = $NewPool.Put()
</code></pre>
<p>You might get an error wi... | <p>All is well! I modified the code so there is an explicit call to the $newPool.Put() command after the initial error. Thanks for your help!</p>
| 32,659 |
<p>This is really two questions, first, do browsers normally cache images on the client by default or does the server have to indicate that they can be cached?</p>
<p>Second, given that I do not have access to IIS what can I do in an ASP application to improve client side caching of images.</p>
| <p>i haven't used this but you may be interested in taking a look at <a href="http://www.codeproject.com/KB/aspnet/CachingImagesInASPNET.aspx" rel="nofollow noreferrer">caching images in asp.net</a></p>
| <blockquote>
<p>This is really two questions, first, do browsers normally cache images on the client by default or does the server have to indicate that they can be cached?</p>
</blockquote>
<p>Browsers cache what they are allowed to. You can globally set those Headers within IIS, but you can almost always override ... | 32,459 |
<p>Which is the best method to make the browser use cached versions of js files (from the serverside)?</p>
| <p>Have a look at Yahoo! tips: <a href="https://developer.yahoo.com/performance/rules.html#expires" rel="nofollow noreferrer">https://developer.yahoo.com/performance/rules.html#expires</a>. </p>
<p>There are also tips by Google: <a href="https://developers.google.com/speed/docs/insights/LeverageBrowserCaching" rel="no... | <p>The best (and only) method is to set correct HTTP headers, specifically these ones: "Expires", "Last-Modified", and "Cache-Control". How to do it depends on the server software you use.</p>
<p>In <a href="http://lazutkin.com/blog/2007/feb/1/improving-performance/" rel="nofollow noreferrer">Improving performance&hel... | 40,082 |
<p>I am trying to use the Data View Web Part in Sharepoint. There are many articles on the web related to populating it with data. My question is, what if the data source is empty? Is there a way to display a default message in this scenario?</p>
| <p>You can do this in the XSL stylesheet, which is what SharePoint Designer does when you set the text to display if data source is empty.</p>
<pre><code> <xsl:variable name="dvt_IsEmpty" select="$dvt_RowCount = 0" />
<xsl:choose>
<xsl:when test="$dvt_IsEmpty">
<xsl:call... | <p>Go to the DataView properties, under the General tab at the bottom there is a field where you can type the message that you want to display if there n data displayed.</p>
| 47,328 |
<p>In C#, if you have multiple constructors, you can do something like this:</p>
<pre><code>public MyClass(Guid inputId, string inputName){
// do something
}
public MyClass(Guid inputId): this(inputId, "foo") {}
</code></pre>
<p>The idea is of course code reuse. However, what is the best approach when there is a... | <p>The most common pattern used to solve this problem is to have an Initialize() method that your constructors call, but in the example you just gave, adding a static method that you called like the code below, would do the trick.</p>
<pre><code>public MyClass(MyOtherClass inputObject): this(inputObject.ID, GetHelperT... | <p>The object would only be automatically disposed when garbage collection runs. If you want the dispose to run as soon as it went out of scope, you should use a <code>using</code> block:</p>
<pre><code>using (MyThirdClass mc = inputObject.CreateHelper())
{
// do something with mc
}
</code></pre>
<p>This is really ... | 13,493 |
<p>how to show all values of a particular field in a text box ???
ie. for eg. when u run the SP, u'll be getting 3 rows. and i want to show the (eg.empname)
in a textbox each value separated by a comma.
(ram, john, sita). </p>
| <p>I had this problem the other day. If you are using SQL 2005 you can use the CROSS APPLY function.</p>
<p>Here is a sample; </p>
<pre><code>Structure;
ID TYPE TEXT
1 1 Ram
2 1 Jon
3 2 Sita
4 2 Joe
Expecteed Output;
ID TYPE TEXT
1 1 Ram, Jon
2 2 Sita, Joe
Query;
SELECT t.TYPE,LEFT(tl.txtlist,LEN(tl.txtlist)-1)
... | <p>In 2005 the cross apply looks like a good solution (haven't used it myself). I have usually solved this by creating a UDF that concatenates the values by looping through a cursor.</p>
| 28,354 |
<p>I thought I'd offer this softball to whomever would like to hit it out of the park. What are generics, what are the advantages of generics, why, where, how should I use them? Please keep it fairly basic. Thanks.</p>
| <ul>
<li>Allows you to write code/use library methods which are type-safe, i.e. a List<string> is guaranteed to be a list of strings.</li>
<li>As a result of generics being used the compiler can perform compile-time checks on code for type safety, i.e. are you trying to put an int into that list of strings? Using... | <p>I once gave a talk on this topic. You can find my slides, code, and audio recording at <a href="http://www.adventuresinsoftware.com/generics/" rel="nofollow noreferrer">http://www.adventuresinsoftware.com/generics/</a>.</p>
| 10,310 |
<p>I'm about to build a web app and I would like to use either SproutCore or Cappuccino. Only thing is, I can't figure out which one to use...</p>
<p>I've been reading about them, and they seem to share the same goals (MVC on the client, with a thin REST server). I understand that they differ in their implementation (... | <p>Dilemma indeed it is. </p>
<p>I personally took a chance on Cappuccino, but that is because I'm currently involved in objective-c and having the theoretical possibility to plug my code (with some adjustments) into a javascript/web environment - is tempting. </p>
<p>Anyway, if are you doing cocoa development, you w... | <p>Yeah...I feel like if I go with SproutCore, I would have to spend some more time learning the quirks of Javascript, as opposed to Objective-J.</p>
<p>Since you've spent time in Obj-J...How close is it to Obj-C and how different is it than Javascript? (I ask you because I want someone's real-life experience...not wh... | 48,416 |
<p>I've always used Subversion or CVS for version control, which use a 'merge' methodology. One of my friends raves about Perforce and how great it is with its change lists and check-out methodology.</p>
<p>While I'm sure a lot of it comes down to experience & personal preference, I was wondering if any research ... | <p>Merge is more efficient. For the simple reason that changes to the same file simultaneously tends to be common, and merge allows you to recover from that. In contrast, single checkout prevents that little bit of extra work but it does so at the cost of huge inefficiencies in scheduling. Typically it takes a short am... | <p>Not sure about the research, but here's one data point for you:<br>
My team chose PVCS (checkout) mostly because of comfort. Doubts about merge and lack of awareness of tools like Subversion definitely contributed to that.</p>
| 4,882 |
<p>I have four tables containing exactly the same columns, and want to create a view over all four so I can query them together.</p>
<p>Is this possible?</p>
<p>(for tedious reasons I cannot/am not permitted to combine them, which would make this irrelevant!)</p>
| <p>Assuming that in addition to having the same column names, columns of the same contain the same data, you want to create a view that is the union of all those tables.</p>
<p>Something like the following should work, but my SQL is rusty:</p>
<pre><code>(CREATE VIEW view_name AS
(SELECT * FROM table1
UNION
SELECT * ... | <p>Use union.
<a href="http://www.techonthenet.com/sql/union.php" rel="nofollow noreferrer">Here is explanation</a></p>
| 45,913 |
<p>A recent <a href="https://stackoverflow.com/questions/349659/stringformat-or-not">question came up</a> about using String.Format(). Part of my answer included a suggestion to use StringBuilder.AppendLine(string.Format(...)). Jon Skeet suggested this was a bad example and proposed using a combination of AppendLine a... | <p>I view <code>AppendFormat</code> followed by <code>AppendLine</code> as not only more readable, but also more performant than calling <code>AppendLine(string.Format(...))</code>.</p>
<p>The latter creates a whole new string and then appends it wholesale into the existing builder. I'm not going to go as far as sayin... | <p>AppendFormat() is a lot more readable than AppendLine(String.Format())</p>
| 45,501 |
<p>I am looking for a Ajax Grid control that can be used easily for binding data using js methods. I have tried using the <code>GridView</code> in <code>AjaxDataControls</code>, and it's okay - but I am also looking for multiple select support in the <code>GridView</code>. Any pointers would be much appreciated.</p>
| <p>Have a look at <a href="http://extjs.com/deploy/dev/examples/grid/binding-with-classes.html" rel="nofollow noreferrer">ExtJs</a>. It has the best Grid i've seen so far. It supports XML and JSON and conversion from basic HTML tables.</p>
| <p>Take a look at Dojo Grid:</p>
<ul>
<li>Good write up in <a href="http://www.sitepen.com/blog/2008/07/14/dojo-12-grid/" rel="nofollow noreferrer">Dojo 1.2 Grid</a> and in <a href="http://www.sitepen.com/blog/2008/10/22/new-features-in-dojo-grid-12/" rel="nofollow noreferrer">New Features in Dojo Grid 1.2</a>.</li>
<... | 43,118 |
<p>If you are creating a 1d array in Python, is there any benefit to using the NumPy package?</p>
| <p>It all depends on what you plan to do with the array. If all you're doing is creating arrays of simple data types and doing I/O, the <a href="https://docs.python.org/3/library/array.html" rel="noreferrer">array</a> module will do just fine.</p>
<p>If, on the other hand, you want to do any kind of numerical calculat... | <p>For storage purposes, both numpy array and array.array are comparable. Here is the code for benchmark for both comparing storage size of unsigned integer of 4 bytes. Other datatypes can also be used for comparison. Data of list and tuple is also added for comparison</p>
<pre><code>import sys
import numpy as np
from ... | 13,715 |
<p>I just got my first 3D printer (Creality Ender 3) on Friday, 2 days ago. It works great, but for some reason I'm getting a lot of stringing on my prints, especially the ones where the extruder head has to move a long distance between columns/posts, etc.</p>
<p>I'm using Hatchbox "True White" PLA, which has a recomm... | <p>4.5 mm is a low retraction distance. Cura's default is 6.5 mm, and the Ender 3 profile provided with Cura sets it to 6 mm. The first thing you should try is increasing the retraction amount up to at least 6 mm. Also, make sure you actually enabled retraction. I saw one question here where a Cura user had enabled "Re... | <p>decrease retraction speed to 25-30mm/sec</p>
| 1,434 |
<p>I'm using C# and I get an out System.OutOfMemoryException error after I read in 50,000 records, what is best practice for handling such large datasets? Will paging help?</p>
| <p>You still shouldn't read everything in at once. Read in chunks, then write the chunk out to the mdb file, then read another chunk and add that to the file. Reading in 50,000 records at once is just asking for trouble.</p>
| <p>If you're using xml, just read a few nodes at at time. If you're using some other format, just read a few lines (or whatever) at a time. Don't load the entire thing into memory before you start working on it.</p>
| 21,802 |
<p>I'm new to 3D printing and I noticed some problems with my print.</p>
<p>I've printed it 3 times and releveled the bed. Now, I found that the right lower corner always has holes,</p>
<p><a href="https://i.stack.imgur.com/ZK0WA.jpg" rel="nofollow noreferrer" title="Printed model on bed shows incomplete coverage durin... | <p>Anycubic 4Max Pro appears to be a direct drive printer (extruder motor is right on top of hotend). The 6.5 mm retraction on in your slicer settings is more typical of a Bowden setup, where the extruder motor lives off of the moving carriage, and has to move extra to compensate for slack in the tube to the hotend. Di... | <p>From the wispy horizontal lines within the perimeters in your second image, it appears that the nozzle is still oozing material during the travel moves. This is likely causing the hole in the corner and the wispy perimeters too. When the extruder reinserts the filament into the hotend after a travel move, it expects... | 1,667 |
<p>When creating a new build in Team Foundation Server, I get the following error when attempting to run the new build:</p>
<blockquote>
<p>The path
C:\Build\ProductReleases\FullBuildv5.4.2x\Sources
is already mapped to workspace
BuildServer_23.</p>
</blockquote>
<p>I am unable to see a workspace by that name... | <p>Use the command line utility <em>TF - Team Foundation Version Control Tool</em> (<strong>tf</strong>).</p>
<p>You can get a list of all workspaces by bringing up a <em>Visual Studio Command Prompt</em> then changing to your workspace folder and issuing the following commands:</p>
<pre><code>C:\YourWorkspaceFolder&... | <p>I had this issue with this with Azure DevOps automated builds in an on-prem TFS build agent. Removing the workspace using TFS Sidekicks did not work. And tf.exe could not even find the workspace to delete it.</p>
<p>This solution should work for TFS 2017, TFS 2018, Azure DevOps, and possibly other versions:</p>
<o... | 27,974 |
<p>The print is very solid except for the 4 walls.</p>
<p>From the top, I can slide a paper down to the bottom. This is ONLY between the walls, the rest of the print is solid. The filament is PLA 1.75 mm.</p>
<p>But the bottom is solid, no gaps.</p>
<p>I have checked the usual problems on Ultimaker troubleshoot... | <p>I've experienced this too, especially with flex modified PLA filament. For that, fixing underextrusion and increasing temperature made it go away. Sadly Cura has no option to overlap walls slightly (if printed in the right order, this could be done without affecting dimensional accuracy) except possibly the outer on... | <p>Look for the <strong>horizontal expansion</strong> setting in Cura. By default it should be zero. The description includes this:</p>
<blockquote>
<p>Positive values can help compensate for too big holes.</p>
</blockquote>
<p>The "holes" here includes these gaps. You can set it to something very small (ie: .01 or... | 1,358 |
<p>I have a report that renders data returned from a stored procedure. Using profiler I can catch the call to the stored procedure from the reporting services.</p>
<p>The report fails stating the report timed out yet I can execute the stored procedure from SSMS and it returns the data back in five to six seconds.</p>... | <p>The problem, as you described it, seems to come from variations on the execution plan of some parts in your stored procedure. Look at what statistics are kept on the tables used and how adding new rows affect them.</p>
<blockquote>
<p>If you're adding a lot of rows at the
end of the range of a column (think
a... | <p>Basically all I've done so far was to optimise the sproc a bit more and it seems to at least temporarily solve the problem.</p>
<p>I would still like to know what the difference is between calling the sproc from SSMS and SSRS.</p>
| 29,332 |
<p>Is there a simple way to retrieve the length of an associative array (implemented as an <code>Object</code>) in ActionScript 3.0?</p>
<p>I understand that there are two primary ways of creating associative arrays in AS3:</p>
<ol>
<li>Use a <code>Dictionary</code> object; especially handy when the key does not need... | <p>You have to count them in a for loop as you do. Of course, you could make a class and stick the for loop in that class. </p>
<p>For some great implmentations of Collections in AS3, check <a href="http://lab.polygonal.de/ds/" rel="nofollow noreferrer">these guys</a>.</p>
<p><strong>Edit 2013</strong> Not surprising... | <p>I think you're stuck with counting them "manually". </p>
<p>An option would be to wrap the whole thing in a class and keep a separate variable that you update as you add/remove. </p>
| 36,168 |
<p>I want to be able to intercept the shutdown event in C# for Windows Vista. Due to the advanced security features with Vista, any applications that are running after the shutdown command is called are halted and displayed in a list, prompting the user to do something with them.</p>
<p>Does anybody know how to overc... | <p>You can use WPF's application object and subscribe to its SessionEnding event. You can then look at the <a href="http://msdn.microsoft.com/en-us/library/system.windows.sessionendingcanceleventargs.reasonsessionending.aspx" rel="nofollow noreferrer">SessionEndingCancelEventArgs.ReasonSessionEnding</a> enumeration to... | <pre><code>System.Environment.HasShutdownStarted
</code></pre>
| 17,917 |
<p>I've been trying to understand how to read the memory of other processes on Mac OS X, but I'm not having much luck. I've seen many examples online using <code>ptrace</code> with <code>PEEKDATA</code> and such, however it doesn't have that option on BSD <sup>[<a href="http://developer.apple.com/documentation/Darwin/R... | <p>Matasano Chargen had a good post a while back on porting some debugging code to OS X, which included learning how to read and write memory in another process (among other things).</p>
<p><a href="http://replay.web.archive.org/20090627062246/http://www.matasano.com/log/1100/what-ive-been-doing-on-my-summer-vacation-... | <p>Manipulating a process's memory behind its back is a Bad Thing and is fraught with peril. That's why Mac OS X (like any Unix system) has protected memory, and keeps processes isolated from one another.</p>
<p>Of course it can be done: There are facilities for shared memory between processes that explicitly cooper... | 3,188 |
<p>I have a Flex app that does a a fair amount of network traffic, it uses ExternalInterface to make some javascript calls (for SCORM), it loads XML files, images, video, audio and it has a series of modules that it could be loading at some point...</p>
<p>So the problem is - we now have a requirement where the user n... | <p>What you are trying to do is exactly the problem solved by AIR. You should really give it a try, it's not that hard to pick up. If you really really can't use AIR (you didn't specify why, so I assume it's just because you don't want to have to learn a new system), then modifying the security config file will solve t... | <p>Did you try to specify the authorized domain with:</p>
<pre><code>System.security.allowDomain("www.yourdomain.com");
</code></pre>
| 20,002 |
<p>I want to send a message to a thread and handle it in the thread. How can I do this in Delphi? I guess <code>PostMessage</code> is the way to go, but the examples I've seen so far are describing the other way, i.e. from the thread to main thread.</p>
| <p>I won't even try and explain or write any code. Just look at this tutorial. It's a little old, but very good imho.
<a href="http://web.archive.org/web/20120423060358/http://www.eonclash.com/Tutorials/Multithreading/MartinHarvey1.1/ToC.html" rel="nofollow noreferrer">Multithreading - The Delphi Way</a></p>
| <p>Why would you need to do it? It is only for one reason that I ever had to create a message loop in a secondary thread, and that is because the thread used COM objects. The calls to <em>OleInitialize()</em> and <em>OleUnitialize()</em> are a sign that you <strong>need</strong> a standard <em>GetMessage()</em> loop.... | 34,512 |
<p>I want to enable an user to be able to communicate with other users through a site. I know that ASP.net is stateless, but what can I use for this synced communication? Java servlets?</p>
| <p>I don't think you need to set up Java just to use a servlet for this. I would use AJAX and the database. I don't know ASP.NET but I PHP is similar in this case, being also basically "stateless". If you want to display some kind of asynchronous communication between two different users, say, from two different sessio... | <p>ASP.NET is "stateless" but it maintains state using Sessions. You can use them by default just using the Session[] keyword. </p>
<p>Look at <a href="http://msdn.microsoft.com/en-us/library/ms972429.aspx" rel="nofollow noreferrer">ASP.NET Session State</a> for some details from Microsoft.</p>
| 5,754 |
<p>I started using rafts more often, to get better results with complex or fragile parts, but my Ender 3 consistently under-extrudes the initial outside line of the raft (for the first inch or two, where extrusion starts). </p>
<p>It is often very thin and does not adhere. This often leads to problems with the followi... | <p>In Ultimaker Cura you can select only one of the the build plate adhesion options skirt, brim or raft. You cannot select multiple options. </p>
<p>There is no option available in Ultimaker Cura to increase the outline count of the raft bed adhesion structure. Basically the raft exists of a line support structure as... | <p>It's not necessarily the case that the apparent underextrusion of a small portion of your raft is the root cause. ABS is notorious for shrinkage and peeling. As a start, you should have a full enclosure so as to maintain a warm environment while printing. </p>
<p>It's also quite possible that your bed is slight... | 1,083 |
<p>Say I have a stored procedure that returns data from a SELECT query. I would like to get a slightly different cut on those results depending on what parameters I pass through. I'm wondering whether it is better design to have multiple stored procedures that take one or no parameters to do this (for example, GetXByDa... | <p>The more complex stored procedures are more complex for the SQL server to compile
correctly and execute quickly and efficiently.</p>
<p>Even in the big stored procedure you have to either have to have several copies of the query or add lots of CASEs and IFs in it which reduce performance. So you don't really gain ... | <p>Who/what will be calling these stored procedures? I wouldn't write stored procedures for SELECT statements normally, precisely because there are lots of different SELECT statements you might want, including joins to other tables etc.</p>
| 27,858 |
<p>I need to add functionality to my J2EE-based wep application:
1) Take some page, probably with form controls, convert it to some printer friendly format.
2) Print this rendered format a) without showing it and b) without a print dialog.</p>
<p>I'm not too worried about 1, but have no idea if 2a and 2b are even poss... | <p>you can set a specific CSS print style. and just trust that your users can use their print screen button effectively. :)</p>
<p>here's an <a href="http://meyerweb.com/eric/articles/webrev/200001.html" rel="nofollow noreferrer">article</a> from eric meyer on the subject</p>
| <p>I think 2b is going to be the real sticking point. 2a should be able to be accomplished with CSS via the "media" type...</p>
<p><a href="http://www.w3.org/TR/CSS2/media.html" rel="nofollow noreferrer">http://www.w3.org/TR/CSS2/media.html</a></p>
| 21,082 |
<p>I am rendering a certain scene to an off-screen frame buffer (FBO) and then I'm reading the rendered image using <code>glReadPixels()</code> for processing on the CPU. The processing involves some very simple scanning routines and extraction of data. </p>
<p>After profiling I realized that most of what my applicat... | <p>You might find the answers in the "<a href="https://stackoverflow.com/questions/219928/intro-to-gpu-programming">Intro to GPU programming</a>" questions useful.</p>
<p>-Adam</p>
| <p>I recently found this <a href="http://nvlabs.github.io/moderngpu/index.html" rel="nofollow">Modern GPU</a></p>
| 48,247 |
<p>I'm working on a tool that will generate the source code for an interface and a couple classes implementing that interface. My output isn't particularly complicated, so it's not going to be hard to make the output conform to our normal code formatting standards.</p>
<p>But this got me thinking: how human-readable ... | <p>I think it's just as important for generated code to be readable and follow normal coding styles. At some point, someone is either going to need to debug the code or otherwise see what is happening "behind the scenes".</p>
| <p>It's quite possible that somebody in the future will want to go through and see what your code does. So making it somewhat understandable is a good thing.</p>
<p>You also might want to include at the top of each generated file a comment saying how and why this file was generated and what it's purpose is.</p>
| 8,878 |
<p>We are using log4j behind a selfmade wrapper. We plan to use much more features of it now. </p>
<p>Should we update to logback ?</p>
<p>(I mean the framework not a facade like SLF4J)</p>
| <p>Logback natively implements the SLF4J API. This means that if you are using logback, you are actually using the SLF4J API. You could theoretically use the internals of the logback API directly for logging, but that is highly discouraged. All logback documentation and examples on loggers are written in terms of the S... | <p>Mature project or even project deep into development stages would probably loose more than gain from such upgrade, IMHO. Logback is certainly much more advanced in an array of points, but not to an extent for complete replacement in a working system. I would certainly consider logback for a new development, but exis... | 21,473 |
<p>We use MS SQL Server and C#. Our database is under sourse control and I will tell you some details of our implementation. We had implemented two operations: </p>
<ol>
<li><p>Export database to plain-text files. Database schema files:
tables.sql
relationships.sql
views.sql
...
and table contents files:
Data/table1.t... | <p>I think you are asking two questions here. The first is how to get your database under source control. Your solution is interesting, and I've also used Visual Studio Team Edition for Database Professionals (here's a tutorial I wrote on <a href="http://www.cornetdesign.com/2007/07/test-driving-stored-procedures-in-sq... | <p>I use VSTS for DB Pros. You point it at your SQL server and it analyzes your database and creates the individual files for you. You can even have it generate test data for you. The next release will include support for third party providers (think Oracle, MySQL, DB2).</p>
<p>The really great feature in here is the ... | 17,742 |
<p>I have an asp.net page which sends content of a file to the client, so the browser shows the save as dialog to download the file. This page is displayed in a popup and when the user clicks the save button, it closes automatically and the download starts.</p>
<p>On windows server 2003, it works fine. On vista with o... | <p>Try removing the spaces in your <code>ContentType</code>. The standard is <code>application/octet-stream</code>.</p>
| <p>I think your problem could be with IIS 7 . There is a problem with "addHeader" in the new Internet information Server with the integration pipeline mode.</p>
<p>Try to use Response.AppendHeader .</p>
| 25,639 |
<p>I'm working on serial port, transmitting and receiving data to some hardware at 8bit data. I would like to store it as string to facilitate comparison, and preset data are stored as string or hex format in xml file. I found out that only when using Encoding.Default which is ANSI encoding then the 8bit data is conver... | <p>Latin-1 aka ISO-8859-1 aka codepage 28591 is a useful codepage for this scenario, as it maps values in the range 128-255 unchanged. The following are interchangeable:</p>
<pre><code>Encoding.GetEncoding(28591)
Encoding.GetEncoding("Latin1")
Encoding.GetEncoding("iso-8859-1")
</code></pre>
<p>The following code il... | <p>You could use base64 encoding to convert from byte to string and back. No problems with code pages or weird characters that way, and it'll be more space-efficient than hex.</p>
<pre><code>byte[] toEncode;
string encoded = System.Convert.ToBase64String(toEncode);
</code></pre>
| 13,667 |
<p>What communication is going on between Eclipse and my application server (JBoss) when I run the server from within Eclipse in debugging mode? How does this work?</p>
| <p>When you start the server in debug mode, it listens on a specified TCP port. Eclipse connects to that port, and they talk using the Java Debug Wire Protocol (JDWP). Read the details here:
<a href="http://java.sun.com/j2se/1.5.0/docs/guide/jpda/" rel="noreferrer">http://java.sun.com/j2se/1.5.0/docs/guide/jpda/</a></p... | <p>Eclipse debugging starts with what is referred to as Agents.</p>
<p>The JVM, which runs the complied .class sources has a feature that allows externally libraries (written in either Java or C++) to be injected into the JVM, just about runtime. These external libraries are referred to as Agents and they have the abi... | 44,731 |
<p>I have column that contains strings. The strings in that column look like this:</p>
<p>FirstString/SecondString/ThirdString</p>
<p>I need to parse this so I have two values:</p>
<p>Value 1: FirstString/SecondString
Value 2: ThirdString</p>
<p>I could have actually longer strings but I always nee it seperated lik... | <p>In a query, use the following two expressions as columns:</p>
<pre><code>Left(col, InStrRev(col, "/") - 1), Mid(col, InStrRev(col, "/") + 1)
</code></pre>
<p>col is your column.</p>
<p>If in VBA, use the following:</p>
<pre><code>last_index= InStrRev(your_string, "/")
first_part= Left$(your_string, last_index ... | <p>mid(col, 1, instr(col, "/", -1)) , mid(col, instr(col, "/", -1)+1, length(col)) </p>
| 19,004 |
<p>I have a .rc file which is used to include some text data in my executable, like this:</p>
<pre><code>1234 RCDATA myfile.txt
</code></pre>
<p>This works fine: the content of the 'myfile.txt' is included in my executable.
The problem is that no 0-terminator is added to the string, and I cannot add it to the file. I... | <p>I don't think so, unless you write your own resource compiler.<br>
I have not meet one which allowed to build one resource from several sources.<br>
You may write a small utility to add a trailing '\0' to a file, say makeZ.exe,<br>
and set an additional build step: </p>
<pre><code>makeZ myfile.txt myfileZ.txt
</cod... | <p>Alternatively, you could look at embedding the data in the RC itself, as per this slice out of the <a href="http://www.jorgon.freeserve.co.uk/Resource.htm#raw" rel="nofollow noreferrer">GORC manual</a>:</p>
<pre><code>0x3333 RCDATA
BEGIN
"Hello world"
"Hello world (zero terminated)\0"
L"A Unicode version of t... | 28,829 |
<p>I have a couple of pet projects where I'm the sole designer/programmer and I spend too much time changing the user interface to make it easier to use <strong>by real users</strong> and avoiding <strong>bright yellow and green</strong> that is so common on "programmer" designs.</p>
<p>Do you have tips to choose a co... | <p><a href="http://kuler.adobe.com/" rel="noreferrer">kuler</a> has a lot of user submitted colour schemes</p>
<p>edit: just remembered... also try <a href="http://www.colourlovers.com/" rel="noreferrer">colorlovers</a></p>
| <p>Adobe's <a href="http://kuler.adobe.com" rel="nofollow noreferrer">Kuler</a> website has a lot of user-created color schemes uploaded by designers. I normally search for higher ranked schemes first. </p>
| 5,305 |
<p>I'm new to Shark, and I was wondering if it's possible to narrow down a time sample to one specific method?</p>
<p>Let's say I'd like to, just for the sake of it, know how much resources have been used on calls to the method 'count' for all NSArray (or subclasses) instances.</p>
| <p>If you view the time profile graph bottom-up, and charge any time -count spends in libraries to its callers, that should give you what you want. It lets you see how much time is spent because of -count (i.e. both in executing that method, and anything the method needs to get its job done) and also lets you find out ... | <p>The time spend at least on the function level is exactly what Instruments is giving you. With DTrace you can even dig deeper than that. Maybe checkout <a href="http://vafer.org/blog/20080812182921" rel="nofollow noreferrer">my blog post</a> about this. That should hopefully clear things up.</p>
<p>You could easily ... | 42,273 |
<p>I have set the <code>itemRollOver</code> and <code>itemRollOut</code> event listeners on a List component, but whenever I roll the mouse over a list item, both the over and out events of the same list item fire in succession right after each other. My list uses a custom itemRenderer.</p>
<p>Any ideas why this might... | <p>In my opinion this is a bug. The ListBase.mouseOverHandler now sets a variable called lastHighlightItemRendererAtIndices when it dispatches an ITEM_ROLL_OVER event, which is then used (together with lastHighlightItemIndices) when dispatching an ITEM_ROLL_OUT event in ListBase.clearHighlight (called by the mouseOutHa... | <p>Are they coming from the same object?
If not you will it is likely so that you will get an itemRollOut from the "item" you just left and a itemRollOver from the new one you entered, depending on their spacing and such these may fire very close to each other. </p>
| 42,885 |
<p>I want to use the DateTime.TryParse method to get the datetime value of a string into a Nullable. But when I try this:</p>
<pre><code>DateTime? d;
bool success = DateTime.TryParse("some date text", out (DateTime)d);
</code></pre>
<p>the compiler tells me </p>
<blockquote>
<p>'out' argument is not classified as... | <pre><code>DateTime? d=null;
DateTime d2;
bool success = DateTime.TryParse("some date text", out d2);
if (success) d=d2;
</code></pre>
<p>(There might be more elegant solutions, but why don't you simply do something as above?)</p>
| <p>Alternatively, if you are not concerned with the possible exception raised, you could change TryParse for Parse:</p>
<pre><code>DateTime? d = DateTime.Parse("some valid text");
</code></pre>
<p>Although there won't be a boolean indicating success either, it could be practical in some situations where you know that... | 23,348 |
<p>After considering the answers to my previous question (<a href="https://stackoverflow.com/questions/252459/one-svn-repository-or-many">One SVN Repository or many?</a>), I've decided to take the 4 or so repositories I have and consolidate them into one. This of course leads to the question, <strong>what's the best wa... | <p>Edit: Oh well, the question edit was made while I was typing. This is an answer to</p>
<blockquote>
<p>Is there a way to combine two or more
repositories maintaining the version
history for both?</p>
</blockquote>
<hr>
<p>Assuming that </p>
<p>The existing repositories have a structure like:</p>
<ul>
<li... | <p>The other answers for this question enabled me to make the script below. Adapt the REPOS map for your case. Also, you may want to move the tags and branches into a "preaggregate" directory in stead of directly into the new branches and trunk.</p>
<pre><code>#!/bin/bash
NEWREPO=$(pwd)/newrepo
NEWREPOCO="${NEWREPO}_... | 33,521 |
<p>In C, is it possible to forward the invocation of a variadic function? As in,</p>
<pre><code>int my_printf(char *fmt, ...) {
fprintf(stderr, "Calling printf with fmt %s", fmt);
return SOMEHOW_INVOKE_LIBC_PRINTF;
}
</code></pre>
<p>Forwarding the invocation in the manner above obviously isn't strictly neces... | <p>If you don't have a function analogous to <code>vfprintf</code> that takes a <code>va_list</code> instead of a variable number of arguments, <strong>you can't do it</strong>. See <a href="http://c-faq.com/varargs/handoff.html" rel="noreferrer"><a href="http://c-faq.com/varargs/handoff.html" rel="noreferrer">http://... | <p>The best way to do this is</p>
<pre><code>static BOOL(__cdecl *OriginalVarArgsFunction)(BYTE variable1, char* format, ...)(0x12345678); //TODO: change address lolz
BOOL __cdecl HookedVarArgsFunction(BYTE variable1, char* format, ...)
{
BOOL res;
va_list vl;
va_start(vl, format);
// Get variable a... | 18,147 |
<p>I generally stay away from <code>regular expressions</code> because I seldom find a good use for them. But in this case, I don't think I have choice. </p>
<p>I need a regex for the following situation. I will be looking at three character strings. It will be a match if the first character is <code>1-9 or the lett... | <p>Slight variation on a few other answers. Restrict the input to be exactly the matched text.</p>
<pre>
<code>
^[1-9ondOND][123][0-9]$
</code></pre>
| <p>In a PREG-based system (most of them these days):</p>
<pre><code>^(?:[1-9]|[ond])[1-3][0-9]$
</code></pre>
<p>Some systems require the start/end markers (PHP, Perl, but not .NET for instance), if yours does, it'd end up something like:</p>
<pre><code>/^(?:[1-9]|[ond])[1-3][0-9]$/
</code></pre>
| 20,164 |
<p><a href="https://3dprinting.stackexchange.com/questions/871/is-22-guage-stranded-hookup-wire-the-correct-wire-to-connect-the-switching-power">I'm still looking at wires</a> for my Prusa i3, to go between the power supply and <a href="http://reprap.org/wiki/RAMPS_1.4" rel="nofollow noreferrer">RAMPS 1.4</a>, and <a h... | <p><strong>THHN</strong> wire is thermoplastic high heat-resistant nylon coated wire.<br>
<strong>THWN</strong> is thermoplastic heat- and moisture-resistant nylon coated wire.</p>
<p><strong>"T"</strong> stands for thermoplastic insulation covering the wire itself.<br>
<strong>"H"</strong> stands for a heat resistanc... | <h2>No "mystery meat" wire in AC electrical</h2>
<p>That kit is random Chinese "no-name" hookup wire and cannot be used for AC power. It's fine for low voltage hobbyist tinkering, which is what it's sold for. If it was better than that, <em>they'd say</em>.</p>
<p><strong>But who knows?</strong> Ma... | 254 |
<p>I get to dust off my VBScript hat and write some classic ASP to query a SQL Server 2000 database.</p>
<p>Here's the scenario:</p>
<ul>
<li>I have two <em>datetime</em> fields called <strong>fieldA</strong> and <strong>fieldB</strong>.</li>
<li><strong>fieldB</strong> will never have a year value that's greater tha... | <p>You may want to use the built in time functions such as DAY and MONTH. e.g.</p>
<pre><code>SELECT * from table where
MONTH(fieldA) > MONTH(fieldB) OR(
MONTH(fieldA) = MONTH(fieldB) AND DAY(fieldA) >= DAY(fieldB))
</code></pre>
<p>Selecting all rows where either the fieldA's month is greater or the months are... | <p>I would approach this from a Julian date perspective, convert each field into the Julian date (number of days after the first of year), then compare those values. </p>
<p>This may or may not produce desired results with respect to leap years.</p>
<p>If you were worried about hours, minutes, seconds, etc., you cou... | 27,589 |
<p>When I'm using an If statement and I want to check if a boolean is false should I use the "Not" keyword or just = false, like so</p>
<pre><code>If (Not myboolean) then
</code></pre>
<p>vs</p>
<pre><code>If (myboolean = False) then
</code></pre>
<p>Which is better practice and more readable?</p>
| <p>Definitely, use "Not". And for the alternately, use "If (myboolean)" instead of "If (myboolean = true)"</p>
<p>The works best if you give the boolean a readable name:</p>
<pre><code> if (node.HasChildren)
</code></pre>
| <p>Made a difference with these lines in vb 2010/12
With the top line, Option Strict had to be turned off.</p>
<pre><code>If InStr(strLine, "=") = False Then _
If Not CBool(InStr(strLine, "=")) Then
</code></pre>
<p>Thanks for answering the question for me. (I'm learning)</p>
| 30,473 |
<p>I faced some problem with my 3D printer device. It seems the bed warms up without any problem, however, the hotend does not warm up! </p>
<p>Could you please help me identify what the problem is? </p>
| <p>I really hope the extruder doesn't warm up as this would be a problem with your stepper motor :)</p>
<p>I'm sure you mean the hotend doesn't heat up. This could be a number of things but i would start to double check the pinout in your code vs the pins on your mainboard and measure if it gives 12v/24v (depending on... | <p>First, I want to make sure if your hotend is really not heating up. If you are saying the numbers are not showing (like when it is heating, the number on display or octoprint says 0/180) this could be a Thermistor problem. Check to make sure if your hot end is heating up by putting a paper or filament under it. DO N... | 1,573 |
<p>I am trying to import a .csv file into WorldShip containing names, addresses, and zip codes. I have two profiles set up defining package weight, UPS service, bill transportation, package type, and reference numbers.</p>
<p>Can I import just name, addresses and zip codes under a specific profile to keep the other va... | <p>The <code>%%</code> becomes a single <code>%</code>. This code is essentially doing two levels of string formatting. First the <code>%sourcedest</code> is executed to turn your code essentially into:</p>
<pre><code>cursor.execute('INSERT INTO mastertickets (BLAH, FOO) VALUES (%s, %s)', (self.tkt.id, n))
</code></... | <p>It does the same:</p>
<pre><code>cursor.execute('INSERT INTO mastertickets (%s, %s) VALUES (:%s, :%s)' % \
tuple(sourcedest + sourcedest), dict(zip(sourcedest, (self.tkt.id, n))))
</code></pre>
<p>Never do that.</p>
| 40,994 |
<p>I have an MFC app which I have been working on for a few weeks now, I want to manually set the dimensions of the main frame when it is loaded, can someone give me a hand with this, specifically where to put the code as well?</p>
<p>Thanks!</p>
| <p>You can also set the size (with <code>SetWindowPos()</code>) from within <code>CMainFrame::OnCreate()</code>, or in the <code>CWinApp</code>-derived class' <code>InitInstance</code>. Look for the line that says <code>pMainFrame->ShowWindow()</code>, and call <code>pMainFrame->SetWindowPos()</code> before that ... | <pre><code>BOOL YourProjectApp::InitInstance()
{
:
:
m_pMainWnd->MoveWindow(0, 0, 1900, 1000); // add this line for fixing the default size of mainWindow
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
</code></pre>
| 21,493 |
<p>I have a data acquisition program written in C++ (Visual Studio 6.0). Some clients would like to control the software from their own custom software or LabView. I would like to come up with a simple API with a dll I can distribute to them and would like some tips on how to get started. This is going to be VERY ba... | <p>You are on the right track with a DLL. The real trick, it sounds like, will be deciding what sort of inter-process communication (IPC) you want to use. Options are: sockets, pipes, shared memory, synchronization objects (events, etc.), files, registry, etc.</p>
<p>Once you decide that, then implement a listener w... | <p>There is a <a href="https://stackoverflow.com/questions/227329/labview-driver-getting-started">related question here</a>. I don't want to end up with something that is LabView-specific, and it appears that <a href="http://zone.ni.com/reference/en-XX/help/371361B-01/lvexcodeconcepts/shared_libraries_dlls/" rel="nofo... | 36,257 |
<p>I'm a PHP developer, and I use the MVC pattern and object-oriented code. I really want to write applications for the iPhone, but to do that I need to know Cocoa, but to do that I need to know Objective-C 2.0, but to do that I need to know C, and to do that I need to know about compiled languages (versus interpreted)... | <p>Yes, you're really best off learning C and then Objective-C. There are some resources that will get you over the C and Objective-C language learning curve:</p>
<ul>
<li>Uli Kusterer's online book <a href="http://www.zathras.de/angelweb/masters-of-the-void.htm" rel="noreferrer">Masters of the Void</a></li>
<li>Step... | <p>I think starting with C would be a smart thing to do. After all, Objective-C is C language with some extensions.</p>
<p>To develop in Cocoa you are required to know well how pointers and memory allocation work (there's no garbage collection on the iPhone), plus you will have to use some standard C libraries, <b>bec... | 5,375 |
<p>I'm bored with surrounding code with try catch like this..</p>
<pre><code>try
{
//some boring stuff
}
catch(Exception ex)
{
//something even more boring stuff
}
</code></pre>
<p>I would like something like</p>
<pre><code>SurroundWithTryCatch(MyMethod)
</code></pre>
<p>I know I can accomplish this behavio... | <p>Firstly, it sounds like you may be using try/catch too often - particularly if you're catching <code>Exception</code>. try/catch blocks should be relatively rare; unless you can really "handle" the exception, you should just let it bubble up to the next layer of the stack.</p>
<p>Now, assuming you really <em>do</em... | <p>I'm not sure for C#, but in Java-land you could define and interface with all the methods, and then hide it under a proxy object. You could run away with writing even more code by defining something like:</p>
<pre><code>ExceptionCatcher.catchAll(new Runnable() {
public void run() {
//run delegate here
M... | 35,412 |
<p>Is there any way to have different layout based on level of the log message when using log4net? Say, if it is a fatal error, I want to see all kind of information possible - class name, method name, line number etc. But for normal, debug and warning, I want to see only the message (I hope, this can increase the perf... | <p>I think you're looking for LevelRangeFilter and a two-appender combination. One appender/filter combo for FATAL level (fatal being the min and max) and one appender/filter combo for everthing else (with ERROR or INFO being the max depending on if you wanted to include errors for debugging purposes)</p>
<p>Example ... | <p>You could just use a different Appender for each "Level" and have them identical but for the pattern layout.</p>
| 15,480 |
<p>We use a customized installation of SugarCRM and I need to make a change to the "Convert Lead to Contact" form. On the form, only "last name" is marked as required, but if the user does not enter a salutation or first name, Sugar will throw an SQL error on the insert (because salutation and first name are required f... | <p>I appear to have figured out a solution. I created an upgrade file in "custom/Extension/modules/Contacts/Ext/Vardefs" called "custom.php". The contents of the file are below:</p>
<pre><code><?php
$dictionary['Contact']['fields']['salutation']['required'] = true;
$dictionary['Contact']['fields']['first_name']['re... | <p>Why not just make Fist Name and Salutation required fields in Leads? Then you can modify the fields to "required" right in Studio and not have to worry about upgrade security.</p>
| 49,044 |
<p>I know that it's possible to replace the browse button, which is generated in html, when you use <code>input</code> tag with <code>type="file</code>.</p>
<p>I'm not sure what is the best way, so if someone has experience with this please contribute. </p>
| <p>The best way is to make the file input control <strong>almost</strong> invisible (by giving it a very low opacity - do not do "<strong>visibility: hidden</strong>" or "<strong>display: none</strong>") and absolutely position something under it - with a lower <strong>z-index</strong>.</p>
<p>This way, the actual con... | <p>This isn't technically possible for security purposes, so the user cannot be misled.</p>
<p>However, there are a couple of workarounds - take a look at <a href="http://www.quirksmode.org/dom/inputfile.html" rel="nofollow noreferrer">http://www.quirksmode.org/dom/inputfile.html</a> for one example.</p>
<p>For the r... | 13,354 |
<p>Hello I would like to ask you, If someone knows how can I add a directory for the header files in the Makefile to avoid the error *.h not found, I have tried this option but does not work:</p>
<pre><code>INC_PATH := -I /directory/to/add
</code></pre>
| <p>At least for GNU make, try the implicit variable <code><a href="http://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html#index-CFLAGS-885" rel="noreferrer">CFLAGS</a></code>, as in:</p>
<pre><code>CFLAGS=-I/directory/to/add
</code></pre>
| <p>At least for GNU make, try the implicit variable <code><a href="http://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html#index-CFLAGS-885" rel="noreferrer">CFLAGS</a></code>, as in:</p>
<pre><code>CFLAGS=-I/directory/to/add
</code></pre>
| 44,374 |
<p>How do I sort the columns in a winforms datagrid control into alphabetical order?</p>
<p>Thanks</p>
| <p>Have you tried binding the DataGrid to a DataTable object (instead of a view) and turning setting the "AllowSorting" property to true on the DataGrid? I believe the grid will then automatically sort the table source for you.</p>
<p>If not, you can always catch the event when a column header is clicked and rebuild a... | <p>My items are generally lists of items in memory. With databound grids you have to sort the data at the source, not within the grid itself.</p>
<p>Here's the code for my list sorts. Maybe this will give you an idea for getting off the ground.</p>
<p><a href="http://jspot.jerryhanel.com/2012/06/28/sort-your-databoun... | 29,150 |
<p>I have run into an issue with WPF and Commands that are bound to a Button inside the DataTemplate of an ItemsControl. The scenario is quite straight forward. The ItemsControl is bound to a list of objects, and I want to be able to remove each object in the list by clicking a Button. The Button executes a Command, an... | <p>I was having this same issue while trying to bind to a command on my view model.</p>
<p>I changed it to use a relative source binding rather than referring to the element by name and that did the trick. Parameter binding didn't change.</p>
<p>Old Code:</p>
<pre><code>Command="{Binding DataContext.MyCommand, Eleme... | <p>Its a long shot. to debug this you can try:<br/>
- checking the PreviewCanExecute event.<br/>
- use snoop/wpf mole to peek inside and see what the commandparameter is.<br/></p>
<p>HTH,</p>
| 43,571 |
<p>Coming from a C# background the naming convention for variables and method names are usually either camelCase or PascalCase:</p>
<pre class="lang-cs prettyprint-override"><code>// C# example
string thisIsMyVariable = "a"
public void ThisIsMyMethod()
</code></pre>
<p>In Python, I have seen the above but I have also... | <p>See Python <a href="https://www.python.org/dev/peps/pep-0008/#function-and-variable-names" rel="noreferrer">PEP 8: Function and Variable Names</a>:</p>
<blockquote>
<p>Function names should be <a href="https://en.wikipedia.org/wiki/Snake_case" rel="noreferrer">lowercase, with words separated by underscores</a> as ne... | <p>Typically, one follow the conventions used in the language's standard library.</p>
| 19,316 |
<p>I developing ASP.NET application using a Swedish version of Windows XP and Visual studio Professional. When ever i get an error aka. "yellow screen of death" the error message is in swedish, making it a bit hard to search for info about it.</p>
<p>How can i change what language the error messages in ASP.NET uses?</... | <p>In web.config add:</p>
<pre><code><system.web>
<globalization uiCulture="en-US" />
</system.web>
</code></pre>
<p>or whatever language you prefer (note: uiCulture="en-US" not culture="en-US").</p>
<p>Also you should check that your app is not changing the uiCulture, for example to a user-spec... | <p>Aren't the error messages dependent on the installed .NET Framework? I.e. you could just uninstall the Swedish language pack for .NET. On the production server, you'll most likely have an English-only Framework anyway.</p>
| 19,517 |
<p>I know just the question is a bit of heresey, but I'm curious...</p>
<p>Sure, there are the express editions. But when Microsoft is effectively competing for 'hearts and minds' in an OSS world, it seems more than a bit counterproductive to charge devs who wholeheartedly support .NET high subscription fees for Micro... | <p>It does to me. It makes me ask maybe I should try and become a Microsoft MVP because they get all the software for free.</p>
<p>You can't buy Expression Blend and Design for anything but the highest level on the License and that just ticks me off.</p>
| <p>In my view MSDN subscriptions are not a huge deterrant, as not only are there express editions, there are also trial versions of most products, and I think a basic MSDN subscription is not that expensive.</p>
<p>However licencing costs and licencing complexity of certain developer tools as well as certain products ... | 18,715 |
<p>I defined a record named <code>log</code>. I want to create an mnesia table with name <code>log_table</code>. When I try to write a record to table, I get <code>bad_type</code> error as follows:</p>
<pre><code>(node1@kitt)4> mnesia:create_table(log_table, [{ram_copies, [node()]},
... | <p>By default the record name is assumed to be the same as the table name.</p>
<p>To fix this you should either name your table just <code>log</code> or append the option <code>{record_name, log}</code> in your table options (as you've done in your fix).</p>
<p>It is usually good practice to let your record and table... | <p>How does your definition of the log-records look? Do you get the same error if you create a new table from scratch (i.e. remove the Mnesia@ directory first).</p>
| 15,334 |
<p>I am primarily a .NET developer, and in that sphere alone there are at any given time probably close to a dozen fascinating emerging technologies, some of them real game-changers, that I would love to delve into. </p>
<p>Sadly, this appears to be beyond the limits of human capacity. </p>
<p>I read an article by Ro... | <p>I have been in IT for 30 years now, so perhaps I can offer some perspective. Yes, there is an increasing amount of material to keep abreast of. But the rate of <i>change</i> (as in "progress") is not increasing - if anything, it is decreasing. What we are seeing is a <i>widening</i> of the field.</p>
<p>Take a simp... | <p>I say just pick a facet of the development landscape that fascinates you and delve into that. For example, if you enjoy dealing with distributed systems, start reading up on WCF and becoming an expert on it.</p>
<p>I don't think it's possible to be familiar with <em>everything</em> aside from a casual understandi... | 13,048 |
<p>I have two classes, and want to include a static instance of one class inside the other and access the static fields from the second class via the first. </p>
<p>This is so I can have non-identical instances with the same name. </p>
<pre><code>Class A
{
public static package1.Foo foo;
}
Class B
{
publ... | <p>You should use:</p>
<pre><code>Foo.bar
</code></pre>
<p>And not:</p>
<pre><code>A.foo.bar
</code></pre>
<p>That's what the warning means.</p>
<p>The reason is that <code>bar</code> isn't a member of an <em>instance</em> of <code>Foo</code>. Rather, <code>bar</code> is global, on the class <code>Foo</code>. Th... | <p>It's true that a Foo instance has access to Foo's static fields, but think about the word "static". It means "statically bound", at least in this case. Since A.foo is of type Foo, "A.foo.bar" is not going to ask the object for "bar", it's going to go straight to the class. That means that even if a subclass has a... | 11,216 |
<p>There's a HTML:</p>
<pre><code><div class="test">
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
</div>
</code></pre>
<p>And a bit of JS:</p>
<pre><code>$(document).ready(function() {
// do stuff when DOM is ready
$(".test ul").append('<li>Foo</... | <p>adding actual HTML from JavaScript is rather ugly, have you tried something like this:</p>
<pre><code>var li=document.createElement("li");
li.appendChild(document.createTextNode("Dupa"));
$(".text ul").appendChild(li);
</code></pre>
<p>?</p>
| <p>Extending Frans-Willems code: </p>
<pre><code>jQuery(function($){
/* This is exactly the same as that document ready thing */
var li=document.createElement("li");
$(li).text("Dupa");
$(".text ul").append(li);
});
</code></pre>
| 37,529 |
<p>I'm looking for programs/projects that are small to moderate size that show good modern practices for developing applications in C on Linux. I'd like to learn by example and curious how things are done out in the real world.</p>
| <p><a href="http://www.faqs.org/docs/artu/" rel="noreferrer" title="The Art of Unix Programming">The Art of Unix Programming</a></p>
<p>A great book that is simply a joy to read. Even if you aren't a *nix programmer or a C programmer, the examples and case studies are great.</p>
| <p>My advice is go for huge. Good practices almost don't count on small projects, and what would be good practices for a big project mainly piss you off on a one-man tiny one.</p>
| 27,642 |
<p>Regarding Agile development, what are the best practices for testing security per release?</p>
<p>If it is a monthly release, are there shops doing pen-tests every month?</p>
| <p>What's your application domain? It depends. </p>
<p>Since you used the word "Agile", I'm guessing it's a web app. I have a nice easy answer for you. </p>
<p>Go buy a copy of Burp Suite (it's the #1 Google result for "burp" --- a sure endorsement!); it'll cost you 99EU, or ~$180USD, or $98 Obama Dollars if you wait... | <p>I'm no expert on Agile development, but I would imagine that integrating some basic automated pen-test software into your build cycle would be a good start. I have seen several software packages out there that will do basic testing and are well suited for automation.</p>
| 2,454 |
<p><a href="http://github.com/rails/ssl_requirement/tree/master/lib/ssl_requirement.rb" rel="nofollow noreferrer">Take a look at the ssl_requirement plugin.</a></p>
<p>Shouldn't it check to see if you're in production mode? We're seeing a redirect to https in development mode, which seems odd. Or is that the normal ... | <p>I guess they believe that you should probably be using HTTPS (perhaps with a self-signed certificate) in development mode. If that's not the desired behaviour, there's nothing stopping you from special casing SSL behaviour in the development environment yourself:</p>
<pre><code>class YourController < Application... | <p>Ideally you should be testing that your application redirects to https during sensitive stages.</p>
| 12,296 |
<p>I am trying to access XMLHTTPRequest.open Method I have even included netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");</p>
<p>but still its not working. </p>
<p>I am using javascript and HTML to access the WebService.</p>
<p>Any Help would be really great</p>
<p>Code</p>
<p><pre><code... | <h2>Browser Independent code for XML HTTPRequest</h2>
<p>I use the following code to create an XML object. It has been designed to handle all browsers (esp. IE and non IE)</p>
<pre><code>/* Function to create an XMLHTTP object for all browsers */
function getXMLHTTPObject(){
var xmlHttp;
try{
// Firef... | <p>There is a pretty concise example <a href="http://www.codeproject.com/KB/webservices/WebServiceFromHTMLPage.aspx" rel="nofollow noreferrer">here</a></p>
<p>Try making your URL <a href="http://recpushdata.cyndigo.com/Jobs.asmx/InsertXML" rel="nofollow noreferrer">http://recpushdata.cyndigo.com/Jobs.asmx/InsertXML</a... | 46,292 |
<p>I'm really struggling with grasping how to effectively use FasterCSV to accomplish what I want.</p>
<p>I have a CSV file; say:</p>
<pre><code>ID,day,site
test,tuesday,cnn.com
bozo,friday,fark.com
god,monday,xkcd.com
test,saturday,whatever.com
</code></pre>
<p>I what to go through this file and end up with a hash ... | <p>Easy:</p>
<pre><code>h = Hash.new(0)
FasterCSV.read("file.csv")[1..-1].each {|row| h[row[0]] += 1}
</code></pre>
<p>Works the same with CSV.read, as well.</p>
| <p>Hum, would :</p>
<pre><code>File.open("file.csv").readlines[1..-1].inject({}) {|acc,line| word = line.split(/,/).first; acc[word] ||= 0; acc[word] += 1; acc}
</code></pre>
<p>do ?</p>
<p>[1..-1] because we don't want the header line with the column names</p>
<p>then, for each line, get the first word, put 0 in t... | 44,034 |
<p>What is the one most common mistake you make while writing unit tests? Coupling? Lack of cohesion? Try to test too much functionality at once? Not testing enough functionality? </p>
<p>Post some example code if you have an example of that mistake</p>
| <p>Not writing them at all.</p>
| <p>Leaving out some small detail (e.g. a hex to dec function where the unit test didn't have any letters in it...)</p>
| 26,253 |
<p>We have a large backlog of things we should do in our software, in a lot of different categories, for example:</p>
<ul>
<li>New problem areas for our products to solve </li>
<li>New functionality supporting existing problem areas</li>
<li>New functionality requested by our existing users</li>
<li>Usability and "loo... | <p>Managing a large backlog in an aggressive manner is almost always wasteful. By the time you get to the middle of a prioritized pile things have more often than not changed. I'd recommend adopting something like what Corey Ladas calls a priority filter:</p>
<p><a href="http://leansoftwareengineering.com/2008/08/19/p... | <p>I'm not sure if the tool is as critical as the process. I've seen teams be very successful using something as simple as index cards and white boards to manage fairly large projects. One thing that I would recommend in prioritization is make sure you have a comprehensive list of these items together. This way you ... | 13,442 |
<p>How can I pass a null constuctor argument using Castle Windsor? I thought the following would work</p>
<pre><code><parameters>
<repository>null</repository>
<message>null</message>
</parameters>`
</code></pre>
| <p>If you want them to be null, it means that they are non-essential dependencies. By having them as ctor arguments you suggest otherwise. You should redesign your class to have another constructor that takes only essential dependencies, if you wish that they not change throughout the lifetime of an object (be readonly... | <p>Wouldn't it better to simply have an additional public constructor that doesn't take these parameters, then you wouldn't need to register the parameters in the config?</p>
| 47,030 |
<p>What is the best way to manage a database connection in a Java servlet?</p>
<p>Currently, I simply open a connection in the <code>init()</code> function, and then close it in <code>destroy()</code>. </p>
<p>However, I am concerned that "permanently" holding onto a database connection could be a bad thing. </p>
<p... | <p>I actually disagree with using Commons DBCP. You should really defer to the container to manage connection pooling for you.</p>
<p>Since you're using Java Servlets, that implies running in a Servlet container, and all major Servlet containers that I'm familiar with provide connection pool management (the Java EE sp... | <p>Usually you will find that opening connections per request is easier to manage. That means in the doPost() or the doGet() method of your servlet.</p>
<p>Opening it in the init() makes it available to all requests and what happens when you have concurrent requests?</p>
| 29,888 |
<p>What's the best way to get a string containing a folder name that I can be certain does <strong>not</strong> exist? That is, if I call <code>DirectoryInfo.Exists</code> for the given path, it should return false.</p>
<p>EDIT: The reason behind it is I am writing a test for an error checker, the error checker tests ... | <p>Name it after a GUID - <strike>just take out the illegal characters.</strike></p>
| <p>Well, one good bet will be to concatenate strings like the user name, today's date, and time down to the millisecond.</p>
<p>I'm curious though: Why would you want to do this? What should it be for?</p>
| 17,817 |
<p>I am trying to start WebLogic within Eclipse</p>
<p>When it starts it complains like this.</p>
<p>Unable to load performance pack. Using Java I/O instead. Please ensure that wlntio.dll is in: 'C:\bea81\jdk142_04\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\bea81\jdk142_04\jre\bin;C:\Program Files\Java\jre1.6.0\bin\clie... | <p>Make sure that wlintio.dll is in the path. The location may vary depending on Weblogic version; in 9.2 it is in $BEA_HOME/server/native/win/32</p>
| <p>I don't see native folder under $BEA_HOME/server</p>
<p>I can see wlintio.dll under $BEA_HOME/server/bin</p>
| 31,623 |
<p>I've got a Win32 C++ app with a suite of unit tests. After the unit tests have finished running, I'd like a human-readable report on any unfreed memory to be automatically generated. Ideally, the report will have a stack with files & line number info for each unfreed allocation. It would be nice to have them ... | <p>To obtain this sort of information, we override new/delete and malloc/free, providing our own heap implementations that store stacktraces on allocation and produce a report when the heap is destroyed (as well as adding sentinels to detect buffer overruns).</p>
<p>This is a fair bit of work the first time you do it.... | <p>You can define DEBUG_NEW and that turns on some leak detection, you need to define it before including any system include files. It only checks for leaks using the new operator and of course you must recompile your code so you can't attach it like valgrind.</p>
<p>See more info here:</p>
<p><a href="http://msdn.mi... | 20,403 |
<p>How can I tell the preprocessor not to replace a specific macro?</p>
<p>The specific problem is the following: Windows header files define the GetMessage macro.</p>
<p>My C++ header files with my API have a GetMessage method. I do not want to rename my method. But when using the API on Windows, including windows.h... | <p>have you tried just doing an</p>
<pre>#undef GetMessage</pre>
<p>or even</p>
<pre>#ifdef GetMessage
#undef GetMessage
#endif</pre>
<p>and then calling the windows GetMessageA or GetMessageW directly, whichever is appropriate.</p>
<p>you should know if you are using char* for wchar_t8..</p>
<p>(thanks don.neufe... | <p>Given your constraints as outlined in your comment, the only way you can do this is to do a:</p>
<pre><code>#undef GetMessage
</code></pre>
<p>right before the call to your API's GetMessage. (And this assumes noone after this point in the source file is calling the Win32 GetMessage.)</p>
| 37,195 |
<p>I was wondering if there was a good way to monitor a document library on SharePoint for changes (new files added, files changed / checked-in, files deleted, etc.)</p>
<p>Basically, what <code>System.IO.FileSystemWatcher</code> does on local / network directories.</p>
<p>Are there events that get fired when documen... | <p>Take a look at event receivers for lists/document libraries. There are both synchronous and asynchronous options built into the object model. (ItemAdded, ItemAdding, ItemUpdated, ItemUpdating ... and so on.) </p>
<p>The following site should give you a good start:
<a href="http://www.davehunter.co.uk/Blog/Lists/P... | <p>That depends whether you need to react to these events immediately or if you can gather them later. For immediate actions event receivers would be the best option but you have to prepare them for each action type you want to handle.
For the latter, you can use audit log. That's a feature in sharepoint, that gathers ... | 26,870 |
<p>The project I'm working on requires access to the users source control. To do this we are wrapping the Perforce API and the Subversion API ( using P4.NET and SubversionSharp respectively ). </p>
<p>We would like to support as many as we can depending on user requirements and I've tried googling for an existing libr... | <p>You propably search for Microsoft Source Code Control Provider ( MSSCCI ).
I know, the Source Safe, Team Foundation Server, Subversion, Evolution, ( and some next others ) source control products has this interface implemented.</p>
| <p>I would recommend not to use MSSCCI as abstraction layer, as that old style SCC api is fully modeled after the checkout-checkin principal promoted by VSS.</p>
<p>Most newer Source Control systems use the Update/Merge principle and/or allow a combination of Update/Merge and locking to mimick the old behavior.</p>
<... | 45,274 |
<p>I'm writing a simple application in PHP which needs to occasionally carry out a fairly intensive set of MySQL updates. I don't particularly want this to cause a delay for the user, so I'm wondering about using pcntl_fork(). </p>
<p>I'm not sure how this really works though: will the child process continue running a... | <p>The parent process will end, the user's page will load fully, the child process will continue, and the use will have no feedback as to whether or not the child process finished successfully.</p>
| <p>If PHP runs under Apache as mod_php module forking will not work at all, you'll get a warning saying that function *pcntl_fork()* is undefined. In that case a good solution is to use <em>exec()</em> instead to run a separate php job using the command line. </p>
| 40,999 |
<p>We are using standard asp.net forms authentication. Certain pages require a user to be logged in; and least some of these pages are delivered by https. There is a search control at the top of each page. When this is used, we don't care whether the user's session has expired, even if the current page requires a lo... | <p>For the search page you want to make sure the search is happening via a GET request. (i.e. like google with the "q" in the query string) Chances are you are doing a POST.</p>
<p>So change your </p>
<pre><code><form method="post" ...>
</code></pre>
<p>to </p>
<pre><code><form method="get" ...>
</cod... | <p>If the search results page is performing a postback the pageload event will be fired before your search button is clicked.</p>
<p>So if the page they are on required a login that login command will be run before the search button click event sending them back to the login screen. </p>
<p>There are a few ways round... | 24,651 |
<p>I am writing a command-line tool for Windows that uses libcurl to download files from the internet.</p>
<p>Obviously, the downloading doesn't work when the user is behind a proxy server, because the proxy needs to be configured. I want to keep my tool as simple as possible however, and not have to burden the user w... | <p>The function you're looking for is WinHttpGetIEProxyConfigForCurrentUser(), which is documented at <a href="http://msdn.microsoft.com/en-us/library/aa384096(VS.85).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/aa384096(VS.85).aspx</a>. This function is used by Firefox and Opera to get their proxy se... | <p>For Firefox/Seamonkey, the problem is a bit more tricky because of the existence of many profiles.</p>
<p>If you want to assume there is only one profile then you just need to find prefs.js. You parse the network.proxy.type, and then use it to decide, which related values to read.</p>
<p>I'm working on some docume... | 24,768 |
<p>I'd like to know what are the most useful JQuery plugins. I'm particularly interested in those which are likely to be useful in general UI development, such as <a href="http://tablesorter.com" rel="noreferrer">Tablesorter</a>, rather than those which serve uncommon needs.</p>
<p>If you could provide a very brief d... | <p>My list:</p>
<ul>
<li><a href="http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/" rel="noreferrer">Autocomplete</a>
<ul>
<li>Input field to enable users quickly finding and selecting some value, leveraging searching and filtering.</li>
</ul></li>
<li><a href="http://mg.to/2006/01/25/json-for-jquery"... | <p>I'm a big fan of <a href="http://jtemplates.tpython.com/" rel="nofollow noreferrer">jTemplates</a>, which gives you client side templating. I find it extremely powerful, especially for rendering results.</p>
| 33,562 |
<p>How can I detect mouse clicks regardless of the window the mouse is in?</p>
<p>Perferabliy in python, but if someone can explain it in any langauge I might be able to figure it out.</p>
<p>I found this on microsoft's site:
<a href="http://msdn.microsoft.com/en-us/library/ms645533(VS.85).aspx" rel="noreferrer">http... | <p>The only way to detect mouse events outside your program is to install a Windows hook using <a href="http://msdn.microsoft.com/en-us/library/ms644990(VS.85).aspx" rel="noreferrer">SetWindowsHookEx</a>. The <a href="http://www.cs.unc.edu/Research/assist/developer.shtml" rel="noreferrer">pyHook</a> module encapsulates... | <p>The windows way of doing it is to handle the <code>WM_LBUTTONDBLCLK</code> message. </p>
<p>For this to be sent, your window class needs to be created with the <code>CS_DBLCLKS</code> class style.</p>
<p>I'm afraid I don't know how to apply this in Python, but hopefully it might give you some hints.</p>
| 19,992 |
<p>Other than for app launch shortcuts, which should only be provided by the O/S, what are the legitimate uses of things like Windows keyboard hooks? It seems to me that we only have problems with things like key loggers because operating systems provide hooks to do things that should not be permitted by anyone under ... | <p>Not true, there are environments where the owner of the computer may want to stop things such as <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Delete</kbd>... example, a Kiosk, or... .... Best Buy?</p>
| <p>There may not be a lot of legitimate uses. However, I'm of the opinion that you shouldn't intentionally limit the features of a system, simply to make it more secure.</p>
<p>Also, a key-logger isn't a bad thing if you know it's there and you installed it yourself.</p>
| 40,045 |
<p>I am getting comfortable writing regular queries in SPARQL, but I'm still having trouble with fancier stuff. My latest problem is trying to select everything except stuff that matches the where clause. For instance, say I want to find all the husbands who like a car color that their wife doesn't like (I'm working ... | <p>I realize that this isn't actually answering the question, but...</p>
<p>On Windows, Helvetica isn't always installed. My machine at work (the one I'm using now) doesn't, despite having Microsoft Office XP.</p>
| <p>I think if you put the the font file in your src folder and call it from there it will work.</p>
| 49,157 |
<p>The same as <a href="https://stackoverflow.com/questions/367633/what-are-all-the-common-undefined-behaviour-that-c-programmer-should-know-about">this</a> question but for java</p>
<p><strong>Update</strong>
Based on the comments and responses of a few people, Its clear that Java has very little undefined behaviour.<... | <p>Anything to do with threads... :)</p>
<p>Also:</p>
<ul>
<li>Overriding methods and expecting them to be used in the same way between versions</li>
<li>Assumptions about underlying platform (file separator, for instance)</li>
<li>Details of garbage collection/finalisation</li>
<li>Some details about class initialis... | <p>The one thing I remember is regarding jvm compatibility with jni. We had and application that was developed on jdk1.4 and when installing it on a machine with ibm jvm (jikes I believe), the jni call just puked! That was in 2006 though. I believe this has little to do with java as a language, but more to do with java... | 49,259 |
<p>Simple question:</p>
<p>Can a swing frame be completely modal ( block all others windows ) ?</p>
<p>I tried the following, but I can still click on other apps windows ( like this browser ) </p>
<pre><code>JDialog myDialog = ....
myDialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
</code></pre>
<p>... | <p>JFrame is not designed to be modal. Use JDialog for it, but you will loose some JFrame functionality doing so.
If you can't live with the loss, you have to block the EventQueue and replace it with your own to only accept events from the blocking one.</p>
<p>See <a href="http://java.sun.com/developer/JDCTechTips/200... | <p>I don't know about global modal, but here's an idea. </p>
<ol>
<li>Take the screenshot of the desktop.</li>
<li>Go full screen.</li>
<li>Pop up your dialog.</li>
</ol>
<p>Since the desktop is fake screenshot, you can ignore any attempt to click into it.</p>
<p><a href="http://terai.xrea.jp/Swing/FullScreen.html" ... | 39,150 |
<p>I am trying to develop a script to pull some data from a large number of html tables. One problem is that the number of rows that contain the information to create the column headings is indeterminate. I have discovered that the last row of the set of header rows has the attribute border-bottom for each cell with ... | <p>Is there any reason </p>
<blockquote>
<p><code>borderCells = soup.findAll("td", style=re.compile("border-bottom")})</code></p>
</blockquote>
<p>wouldn't work? It's kind of hard to figure out exactly what you're asking for, since your description of the original tables is pretty ambiguous, and it's not really cl... | <p>Well you know computers are always right. The answer is that the attrs are on different things in the html. What I was modeling on what some html that looked like this:</p>
<pre><code><TD nowrap align="left" valign="bottom">
<DIV style="border-bottom: 1px solid #000000; width: 1%; padding-bottom: 1px">... | 26,507 |
<p>I have a nice little file upload control I wrote for ASP.NET webforms that utilizes an IFrame and ASP.NET AJAX.</p>
<p>However, on large uploads, the browser times out before it can finish posting the form.</p>
<p>Is there a way I can increase this?</p>
<p>I'm not really interesting in alternative solutions, so d... | <p>You need to update a metabase setting on IIS6 and later. The key is " AspMaxRequestEntityAllowed" and is expressed in bytes. I highly recommend the Metabase Explorer to make the change, wading through the XML at %systemroot%\system32\inetserv\metabase.xml is possible though.</p>
<p>Metabase Explorer: <a href="http... | <p>Check the code of <a href="http://www.codeplex.com/VelodocXP" rel="nofollow noreferrer">Velodoc XP Edition</a>. It includes an upload streaming module, a resumable download handler and ASP.NET upload controls based on ASP.NET Ajax extensions and it is all open source.</p>
<p>For more information check also <a href=... | 27,632 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.