instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Is there a public, free web service that generates tag clouds? I'm looking for something like Google Chart--URL in, image out.</p>
| <p>It still makes sense to me, but I haven't been able to find any such service. Actually, the API could be words in, styled text out or words in, image out. I'll just implement what I need in SWT and go from there.</p>
<p>You can see an example of the kind of thing I'd like to generate at <a href="http://www.wordle.n... | <p>Maybe you could make a use of this : <a href="http://www.wordle.net/" rel="nofollow noreferrer">http://www.wordle.net/</a></p>
| 44,069 |
<p>As part of our build process I need to set the version information for all of our compiled binaries. Some of the binaries already have version information (added at compile time) and some do not. </p>
<p>I want to be able to apply the following information:</p>
<ul>
<li>Company Name </li>
<li>Copyright Notice</li>... | <p>While it's not a batch process, Visual Studio can also add/edit file resources. </p>
<p>Just use File->Open->File on the .EXE or .DLL. This is handy for fixing version information post-build, or adding it to files that don't have these resources to begin with.</p>
| <p>This is the best tool I've seen for the job, allows full control over all file resources, VersionInfo included.</p>
<p>See: <a href="http://melander.dk/reseditor/" rel="nofollow noreferrer">ResourceEditor</a> by <a href="https://stackoverflow.com/users/2249664/speedfreak">Anders Melander</a>.</p>
| 36,060 |
<p>"Fatal error: Allowed memory size of 31457280 bytes exhausted (tried to allocate 9828 bytes)".</p>
<p>This is the error i get but I am only trying to upload a 1mb image. I have increased the memory limit in php.ini and the execution time. I am trying this on a local MAMP server, on a Mac using firefox. This going t... | <p>You're likely loading the image to do some manipulation of it. That causes the image data to be decompressed, which requires a lot of memory for big images (I think it's about 4 bytes per pixel).</p>
<p>You can choose to either not process the image, or do your processing outside of PHP - for example by invoking Im... | <p>Did you restart apache after you increased the memory limit?
If yes, then increase a little more.</p>
| 38,751 |
<p>Developing a heavily XML-based Java-application, I recently encountered an interesting problem on Ubuntu Linux.</p>
<p>My application, using the <a href="http://jpf.sourceforge.net/" rel="noreferrer">Java Plugin Framework</a>, appears unable to convert a <a href="http://www.dom4j.org/" rel="noreferrer">dom4j</a>-cr... | <p>LinkageError is what you'll get in a classic case where you have a class C loaded by more than one classloader and those classes are being used together in the same code (compared, cast, etc). It doesn't matter if it is the same Class name or even if it's loaded from the identical jar - a Class from one classloader... | <p>As specified in <a href="https://stackoverflow.com/questions/2548384/java-get-a-list-of-all-classes-loaded-in-the-jvm">this question</a>, enabling the <code>-verbose:class</code> will make the JVM log information about all classes being loaded, which can be incredibly helpful to understand where the classes are comi... | 30,318 |
<p>I'm new to using LINQ to Entities (or Entity Framework whatever they're calling it) and I'm writing a lot of code like this:</p>
<pre><code>var item = (from InventoryItem item in db.Inventory
where item.ID == id
select item).First<InventoryItem>();
</code></pre>
<p>and then calling me... | <p>You want to use the .Include(string) method references in this <a href="http://msdn.microsoft.com/en-us/library/bb896272.aspx" rel="noreferrer">"Shaping query results"</a> article. </p>
<pre><code>var item = from InventoryItem item in
db.Inventory.Include("ItemTypeReference").Include("OrderLineItems")... | <p>In addition to Robert's answer, you might like to check out this question for options for an extension method that that allows you to .Include() using an expression instead of a string, so you get compile time checking:</p>
<p><a href="https://stackoverflow.com/questions/2921119/entity-framework-include-with-compil... | 40,798 |
<p>What is the difference between g++ and gcc? Which one of them should be used for general c++ development?</p>
| <p><code>gcc</code> and <code>g++</code> are compiler-drivers of the GNU Compiler <em>Collection</em> (which was once upon a time just the GNU <em>C Compiler</em>).</p>
<p>Even though they automatically determine which backends (<code>cc1</code> <code>cc1plus</code> ...) to call depending on the file-type, unless over... | <p>gcc and g ++ are both GNU compiler. They both compile c and c++. The difference is for *.c files gcc treats it as a c program, and g++ sees it as a c ++ program. *.cpp files are considered to be c ++ programs. c++ is a super set of c and the syntax is more strict, so be careful about the suffix.</p>
| 20,795 |
<p>I'm trying to send an email in Java but when I read the body of the email in Outlook, it's gotten rid of all my linebreaks. I'm putting \n at the ends of the lines but is there something special I need to do other than that? The receivers are always going to be using Outlook. </p>
<p>I found a page on microsoft.com... | <p>I've just been fighting with this today. Let's call the behavior of removing the extra line breaks "continuation." A little experimenting finds the following behavior:</p>
<ul>
<li>Every message starts with continuation off. </li>
<li>Lines less than 40 characters long do not trigger continuation, but if continuat... | <p>Try this:</p>
<pre><code>message.setContent(new String(body.getBytes(), "iso-8859-1"),
"text/html; charset=\"iso-8859-1\"");
</code></pre>
<p>Regards,
Mohammad Rasool Javeed</p>
| 16,471 |
<p>What is the difference between <code>HAVING</code> and <code>WHERE</code> in an <code>SQL SELECT</code> statement?</p>
<p>EDIT: I have marked Steven's answer as the correct one as it contained the key bit of information on the link:</p>
<blockquote>
<p>When <code>GROUP BY</code> is not used, <code>HAVING</code> beha... | <p>HAVING: is used to check conditions <em>after</em> the aggregation takes place.<br/>
WHERE: is used to check conditions <em>before</em> the aggregation takes place.</p>
<p>This code:</p>
<pre><code>select City, CNT=Count(1)
From Address
Where State = 'MA'
Group By City
</code></pre>
<p>Gives you a table of all ci... | <p>I use HAVING for constraining a query based on the results of an aggregate function. E.G. select * in blahblahblah group by SOMETHING having count(SOMETHING)>0</p>
| 36,573 |
<p>Assemblies A and B are privately deployed and strongly named. Assembly A contains references to Assembly B. There are two versions of Assembly B: B1 and B2. I want to be able to indicate for Assembly A that it may bind to either B1 or B2 -- ideally, by incorporating this information into the assembly itself. Wha... | <p>There are several places you can indicate to the .Net Framework that a specific version of a strongly typed library should be preferred over another. These are:</p>
<ul>
<li>Publisher Policy file</li>
<li>machine.config file</li>
<li>app.config file</li>
</ul>
<p>All these methods utilise the <a href="http://msdn... | <p>You can set version policy in your app.config file. Alternatively you can manually load these assemblies with a call to <code>Assembly.LoadFrom()</code> when this is done assembly version is not considered.</p>
| 7,816 |
<p>How do I get the type of a generic typed class within the class?</p>
<p>An example:</p>
<p>I build a generic typed collection implementing <em>ICollection< T></em>. Within I have methods like </p>
<pre><code> public void Add(T item){
...
}
public void Add(IEnumerable<T> enumItems){
... | <p>Personally, I would side step the issue by renaming the <code>IEnumerable<T></code> method to <code>AddRange</code>. This avoids such issues, and is consistent with existing APIs such as <a href="http://msdn.microsoft.com/en-us/library/z883w3dc.aspx" rel="noreferrer"><code>List<T>.AddRange</code></a>.</p... | <p>If you want to use the <code>is</code> operator in a generic class/method you have to limit <code>T</code> to a reference type:</p>
<pre><code>public void MyMethod<T>(T theItem) where T : class
{
if (theItem is IEnumerable) { DoStuff(); }
}
</code></pre>
| 28,852 |
<p>I have nested dictionaries:</p>
<pre><code>{'key0': {'attrs': {'entity': 'p', 'hash': '34nj3h43b4n3', 'id': '4130'},
u'key1': {'attrs': {'entity': 'r',
'hash': '34njasd3h43b4n3',
'id': '4130-1'},
u'key2': {'attrs': {'entity': '... | <p>Your structure is unpleasantly irregular. Here's a version with a <strong>Visitor</strong> function that traverses the <code>attrs</code> sub-dictionaries.</p>
<pre><code>def walkDict( aDict, visitor, path=() ):
for k in aDict:
if k == 'attrs':
visitor( path, aDict[k] )
elif type(a... | <p>Well, if you have to do it only a few times, you can just use nested dict.iteritems() to find what you are looking for.</p>
<p>If you plan to do it several times, performances will quickly becomes an issue. In that case you could :</p>
<ul>
<li><p>change the way you data is returned to you to something more suitab... | 49,895 |
<p>I'm wondering if anyone can recommend a good C++ tree implementation, hopefully one that is
stl compatible if at all possible.</p>
<p>For the record, I've written tree algorithms many times before, and I know it can be fun, but I want to be pragmatic and lazy if at all possible. So an actual link to a working solu... | <p>I don't know about your requirements, but wouldn't you be better off with a graph (implementations for example in <a href="http://www.boost.org/doc/libs/release/libs/graph/doc/index.html" rel="noreferrer">Boost Graph</a>) if you're interested mostly in the structure and not so much in tree-specific benefits like sp... | <p>Let suppose the question is about balanced (in some form, mostly red black tree) binary trees, even if it is not the case.</p>
<p>Balanced binaries trees, like vector, allow to manage some ordering of elements without any need of key (like by inserting elements anywhere in vector), but :</p>
<ul>
<li>With optimal ... | 21,930 |
<p>Can someone please walk me through the process of loading a class or package in JSP with Tomcat?</p>
<p>I think it might just be a Tomcat setup issue :S my JSP file runs fine without importing or using dbpool or dbpooljar. I've tried many suggestions to other peoples similar issues without any luck. Any help would ... | <p>You've typed </p>
<p>[%@ page import="java.sql.*,java.util.List,java.util.ArrayList,<strong>DBPool</strong>" %]</p>
<p>but</p>
<pre><code>package dbpooljar;
public class DBPool { ...
</code></pre>
<p>Therefor, it should be </p>
<p>[%@ page import="java.sql.*,java.util.List,java.util.ArrayList,<strong>dbpooljar.... | <p>I dont know about windows, but in linux there is a the file(/usr/share/tomcat5/conf/jkconfig.manifest) that you can edit to add specific jars to the tomcat instance that is running.</p>
| 48,894 |
<p>Now, I know this is completely subjective, so please don't flame me. I've never been entirely satisfied with linux whenever I decided to install a distro like Ubuntu, Fedora etc. because of their awkward positioning and spacing of widgets.</p>
<p>Have a look at <a href="http://art.gnome.org/themes/gtk2/?sort_by=pop... | <blockquote>
<p>The entire linux desktop doesn't have the visual integrity of OSX for instance, and I wonder why. If there is any example of a nice integrated Linux environment, please please please show me, I really WANT to use Linux.</p>
<p>(and I know, there's QT, and other managers like KDE etc. I noticed the same ... | <p>You know, it's just a different approach. The differences between particular themes are inevitable, as there isn't any sort of common guidelines, AFAIK.</p>
<p>For me, Linux themes are completely integral, I've yet to experience any sort of feeling of awkwardness.</p>
| 24,793 |
<p>A lot of literature talks about using inline functions to "avoid the overhead of a function call". However I haven't seen quantifiable data. What is the actual overhead of a function call i.e. what sort of performance increase do we achieve by inlining functions?</p>
| <p>On most architectures, the cost consists of saving all (or some, or none) of the registers to the stack, pushing the function arguments to the stack (or putting them in registers), incrementing the stack pointer and jumping to the beginning of the new code. Then when the function is done, you have to restore the re... | <p>Each new function requires a new local stack to be created. But the overhead of this would only be noticeable if you are calling a function on every iteration of a loop over a very large number of iterations.</p>
| 17,483 |
<p>I hear a lot of people talking about the revolution that is coming in programming due to multi-core processors and parallelism, but I can't shake the feeling that for most of us, CPU cycles aren't the bottleneck. Pretty much all of my programs have been I/O bound in one way or another (database, filesystem, network... | <p>Visual effects / rendering. (Entertainment industry.)<br>
Artificial Intelligence. (Games and scientific research.)<br>
Biomedical research.<br>
Physical simulations. (Games and scientific research.)<br>
Database applications including SaaS, most webpages, etc. </p>
<p>As the personal computer becomes more and ... | <p>One of the ways to leverage multi core is through a use of remote desktop technologies. </p>
<p>It's much easier to deploy desktop applications to one big Citrix server instead of dozens of user desktops. </p>
| 30,952 |
<p>I wanted to add dynamic charts in the webpage. It goes like this...</p>
<p>I get the start and end date from user and draw separate charts for each date bewteen the start and end date.</p>
<p>I get the data from sql database and bind it with the chart like this:</p>
<pre><code> SqlConnection UsageLogConn = new ... | <p>Ok so I may have overdone this, but I tried to make this pretty dynamic. Yeah, the list names are a bit odd, but I used another example of mine to build this.</p>
<pre><code> protected void Page_Load(object sender, EventArgs e)
{
Bench[] benchList;
FoodIntake[] foodIntakeList;
Panel panelChartHolder;
... | <p>I have updated the MS chart samples for .NET 4.0 and added two additional projects -- ChartsWithMVC and ChartsWithoutWebForms. You might find my sample code helpful, as I have a very basic implementation of a dynamic chart system using the asp.net chart control:</p>
<p><a href="http://develocity.blogspot.com/2010/... | 43,455 |
<p>Is there anything like <a href="http://en.wikipedia.org/wiki/ELMAH" rel="noreferrer">ELMAH</a> for Windows Forms? </p>
<p>I'm looking for a standard way to process unhandled exceptions and grab a screenshot and other environment information before packaging that up for support.</p>
| <p>The very same Jeff Atwood coded a nice solution (albeit in VB.NET) which I had to modify and "fix" but that I am happily using since then.</p>
<p>You can view his solution <a href="http://www.codeproject.com/KB/exception/ExceptionHandling.aspx" rel="nofollow noreferrer">Here</a></p>
| <p>There is a commercial alternative called <a href="http://www.smartassembly.com/product/index.aspx" rel="nofollow noreferrer">{smartassembly}</a> that does error reporting.</p>
| 9,226 |
<p>I would like to know the best way to replace a standard textarea field with a rich text editor in Django Admin?</p>
| <p>There's an <a href="http://pypi.python.org/pypi/django-tinymce/" rel="noreferrer">add-on Django application</a> to provide <a href="http://tinymce.moxiecode.com/" rel="noreferrer">TinyMCE</a> support for Django admin forms without having to muck around with admin templates or Django newform internals.</p>
| <p>Install this package</p>
<pre><code>pip install django-ckeditor
</code></pre>
<p>then run these commands to migrate.</p>
<pre><code>python manage.py makemigrations
python manage.py migrate
python manage.py collectstatic
</code></pre>
<p>finally restart your Django server.</p>
<p>Once you complete the above steps, yo... | 42,747 |
<p>We've had an ongoing need here that I can't figure out how to address using the stock Maven 2 tools and documentation.</p>
<p>Some of our developers have some very long running JUnit tests (usually stress tests) that under no circumstances should be run as a regular part of the build process / nightly build.</p>
<... | <p>Normally you would add a profile to your maven configuration that runs a different set of tests:</p>
<p>run this with mvn -Pintegrationtest install</p>
<pre><code> <profile>
<id>integrationtest</id>
<build>
<plugins>
<plugin>
... | <p>Another option is to have the stress test detect it is running in maven and run only once or twice. i.e. turn into a regular functional test. This way you can check the code is still good, but not run for a long time.</p>
| 31,360 |
<p>I got dtd in file and I cant remove it. When i try to parse it in Java I get "Caused by: java.net.SocketException: Network is unreachable: connect", because its remote dtd. can I disable somehow dtd checking?</p>
| <p>You should be able to specify your own EntityResolver, or use specific features of your parser? See <a href="https://stackoverflow.com/questions/155101/make-documentbuilderparse-ignore-dtd-references">here</a> for some approaches.</p>
<p>A more complete example:</p>
<pre><code><?xml version="1.0"?>
<!DOCT... | <p>I had this problem before. I solved it by downloading and storing a local copy of the DTD and then validating against the local copy. You need to edit the XML file to point to the local copy.</p>
<pre><code><!DOCTYPE root-element SYSTEM "filename">
</code></pre>
<p>Little more info here: <a href="http://w... | 30,194 |
<p>I've had this problem many times before, and I've never had a solution I felt good about. </p>
<p>Let's say I have a Transaction base class and two derived classes AdjustmentTransaction and IssueTransaction.</p>
<p>I have a list of transactions in the UI, and each transaction is of the concrete type AdjustmentTran... | <p>You need to map your "EditorForm" to a transaction at some point. You have a couple options:</p>
<ul>
<li>A switch statement...like you, I think this stinks, and scales poorly.</li>
<li>An abstract "EditorForm" property in base Transaction class, this scales better, but has poor seperation of concerns.</li>
<li>A T... | <p>Do I miss something in the question? I just ask because the obvious OO answer would be: Polymorph</p>
<p>Just execute Transaction.editWindow() (or however you want to call it), and
overwrite the method in AdjustmentTransaction and IssueTrasaction with the required functionality. The call to element.editWindow() the... | 39,431 |
<p>I have a visual studio 2005 solution which has a web application and a class library project. The web application has a reference to the library project. I'd like the library project's code documentation XML to output to the web application's bin folder, along with the library's DLL. I can't seem to find any easy... | <p>Post-build step, perhaps? A bit ugly, but I think it would work.</p>
| <p>Here is the post-build command that worked:</p>
<pre><code>copy "$(TargetDir)$(TargetName).xml" "$(SolutionDir)MyWebProject1\bin\$(TargetName).xml"
copy "$(TargetDir)$(TargetName).xml" "$(SolutionDir)MyWebProject2\bin\$(TargetName).xml"
</code></pre>
<p>A couple of problems inherent with this solution:</p>
<ul>
<... | 47,013 |
<p>I'm a complete beginner when it comes to programming. I'm taking a stab at PHP, and have seen how powerful the frameworks can be. But should I even consider trying to work with a framework until I have a strong grasp of PHP itself?</p>
<p>Note: I'd most likely be using CodeIgnitor, but the question applies to any o... | <p>Preferably, you should have a strong grasp of the language (and programming in general) before you start using frameworks. Frameworks can and will save you a lot of work, but you they also introduce advanced concepts and implementations. </p>
<p>After you gain some experience and start to wonder what's the best way... | <p>Frameworks can abstract much of the language's complexity away from you, but at some point, you're going to run into something that requires you to know the language's control structures and standard library.</p>
<p>It's really up to you, but I'd recommend at least learning some of the language's basic constructs, ... | 40,397 |
<p>This is a C# question, but really could be language-agnostic</p>
<p>I have inherited a large object model (100+ types), with a hierarchy of objects that 'own' 0..n of other typed objects that all share a base (where there is a 'relatively' strict type hierarachy).</p>
<p>I want to start decoupling these objects th... | <p>if you can complete the entire process in a reasonable amount of time, start with the bases and go through the whole thing; the app will be broken until you are done</p>
<p>if you must keep the app working in the meantime, start at the top and work your way down a few classes at a time</p>
<p>i would look at the b... | <p>This may be a little too academic, but there was a lot of research in the mid-nineties on how to automatically refactor large class hierarchies, for example by figuring out interfaces that are commonly used, etc. While this may not solve your problems, it may give you a good option of where to start or at least some... | 44,583 |
<p>With .Net what is the best way to interact with a service (i.e. how do most tray-apps communicate with their servers). It would be preferred if this method would be cross-platform as well (working in Mono, so I guess remoting is out?)</p>
<hr />
<h3>Edit:</h3>
<p>Forgot to mention, we still have to support Windows ... | <p>Be aware that if you are planning to eventually deploy on Windows Vista or Windows Server 2008, many ways that this can be done today will not work. This is because of the introduction of a new security feature called "Session 0 Isolation". </p>
<p>Most windows services have been moved to run in Session 0 now in or... | <p>Remoting is an option, but it's not cross-platform. Some other ways are to use named pipes, IPC, or kernel events.</p>
| 11,039 |
<p>I cannot figure out how to change the title bar icon (the icon in the furthest top left corner of the application) in Adobe AIR. It is currently displaying the default 'Adobe AIR' red icon. </p>
<p>I have been able to change it in the system tray, however.</p>
| <p>Does the following help?</p>
<p><a href="http://groups.google.com/group/chennai-flex-user-group/browse_thread/thread/cffb9ab56450c28e" rel="nofollow noreferrer">http://groups.google.com/group/chennai-flex-user-group/browse_thread/thread/cffb9ab56450c28e</a></p>
| <p>The first link shows how to change the Taskbar Icon, the second shows the application icon I believe used on the desktop. I am going to recompile and install the application and see if it works.</p>
<p>Edit: Yea, the one that changes the Desktop Icon also changes the Title Bar icon. It's in the app.xml file.</p>
| 3,892 |
<p>I've had some experience with Pygame, but there seems to be a lot of buzz around Pyglet these days.</p>
<p>How do these two libraries compare? What would be the advantage of using one over the other, both in features and ease of use?</p>
<p>Finally, would you say that one is more Pythonic than the other?</p>
| <p>I was considering both Pygame and Pyglet for a small 2D shooter, and after looking at source code and some tutorials went with Pyglet. I was very happy with the results.</p>
<p>Pyglet worked immediately and was enjoyable to work with, and conceptually very clean. It certainly had a Pythonic feel to me: you could ge... | <p>Having looked at both pygame and pyglet I found pyglet easier to pick up and was able to write a simple breakout style game within a few days.</p>
| 48,427 |
<p>Why am I getting a textbox that returns undefined list of variables?</p>
<p>When I run this code:</p>
<pre><code>var query = (from tisa in db.TA_Info_Step_Archives
where tisa.ta_Serial.ToString().StartsWith(prefixText)
select tisa.TA_Serial.ToString()).Distinct().Take(Convert.ToIn... | <p>updated my ajax kit to version 1.0.10920 then changed my code to the following:</p>
<pre><code> foreach (DataRow dr in dt.Rows)
{
items.SetValue("\"" + dr["somenumber"].ToString() + "\"", i);
i++;
}
</code></pre>
<p>Late friday nights with .net is not fun. I have no life... | <p>It sounds like the problem isn't with the method, but with the way you are hooking up the autocomplete to the method... Is your Extender similar to the following:</p>
<pre><code><cc1:AutoCompleteExtender ID="Result" runat="server" TargetControlID="txtSearch" ServiceMethod="YourMethodHere"
ServicePath="~/Serv... | 22,897 |
<p>We are build a website using MVC pattern. So far all the pages we built used models which had to operate on Reference data(which is cached when the website loads for the first time).
But now we have reached that stage of the flow where we have to deal with Transactional data (which is specific to that flow). Till no... | <p>If you're truly using MVC, then your controller should intercept the particular action that should be taken, invoke any data-related requests, and shove the data into your model objects so that the model can then be placed into the view. There is very little benefit to having the model populate itself from a databa... | <p>The disadvantage of the first approach is that the data that is fetched upfront might never be used. So we went with the second approach where the model gets the data. To decouple the model and the service calls we used a interface. Alternatives are welcome.</p>
| 19,759 |
<p>I've seen some very good questions on Stack Overflow concerning delegates, events, and the .NET implementation of these two features. One question in particular, "<a href="https://stackoverflow.com/questions/213638/how-do-c-events-work-behind-the-scenes#213651">How do C# Events work behind the scenes?</a>", produce... | <p>I'm not sure that is surprising... compare to the same for properties vs fields (since properties before the same function as events: encapsulation via accessors):</p>
<pre><code>.field public string Foo // public field
.property instance string Bar // public property
{
.get instance string MyType::get_Bar()
... | <p>The point of having events that are a pair of add, remove, methods is <strong>encapsulation</strong>.</p>
<p>Most of the time events are used as is, but other times you don't want to store the delegates attached to the event in a field, or you want to do extra processing on add or remove event methods. </p>
<p>For... | 27,058 |
<p>Is there any way to track the status of a posted upload in AS3? There is a ProgressEvent, but it gives data back about the response, not the actual POST upload. I'm posting binary data for an image, so it's usually in the 50-100kb range. </p>
<p>The image data was generated inside Flash itself, so I can't use the u... | <p>Perhaps you can use a function at the server side to send progress events to the flash object?</p>
| <p>Take a look at the <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/FileReference.html" rel="nofollow noreferrer">FileReference</a> class. The progress event in it will give you data about the upload:</p>
<blockquote>
<p>Dispatched periodically during the file upload or download operat... | 12,456 |
<p>Whenever I write a stored procedure for selecting data based on string variable (varchar, nvarchar, char) I would have something like:</p>
<pre><code>procedure dbo.p_get_user_by_username(
@username nvarchar(256)
as
begin
select
u.username
,u.email
--,etc
from
sampleU... | <p>You are correct. There is no benefit in using LIKE unless you are doing wild card matching. In addition, using it without wildcard could lead to the use of an inefficient queryplan.</p>
| <p>Yes, as far as I know, using like without any wildcards is the same as using the = operator. are you sure the input parameter doesn't have wildcards in it?</p>
| 38,831 |
<p>On our build server, we've installed the .NET Framework 2.0 SDK in order to kick off MSBuild and run our builds. Now we are upgrading to the .NET Framework 3.5. We do not want to install the complete Visual Studio, but we cannot find a .NET Framework 3.5 SDK on the internet either?</p>
<p>The question: What do we n... | <p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=F26B1AA4-741A-433A-9BE5-FA919850BDBF" rel="nofollow noreferrer">Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5</a></p>
<p>Actually, you only need the SDK for a few things (the RDL reports compiler <code>.targets</code> file leap... | <p>.net 3.5 comes with compiler and msbuild bundled with it. just download the normal .net 3.5 framework (not the client profile) and you'll be fine.</p>
| 35,023 |
<p>How do you manage your database connections in your ASP.Net application?</p>
<p>My understanding tells me the "best" way is to open a connection, make a query, close the connection - and do that multiple times because connection pooling makes the cost negligable.</p>
<p>The problem comes when I have a DAL where ea... | <p>I was reading somewhere and I don't remember where that Microsoft was going to address that when you have two connections to the same DB that they would not escalate to DTC which would make this problem go away. </p>
<p>Until then what we did was to develop our TransactionScope, our DALs would then ask the TS for a... | <p>Implement it in a similar idea on how TransactionContext works.</p>
<p>I started writing how to do this, but I think an example makes it clearer:</p>
<pre><code>public class MyConnectionManager : IDisposable
{
[ThreadStatic] // static per thread
private static SqlConnection con;
public static SqlConne... | 44,547 |
<pre><code>function array_value_from_key($array,$key)
{
return !empty($array[$key]) ? $array[$key] : null;
}
</code></pre>
<p>The reason I ask is because I have a class function that returns an array.</p>
<p>Instead of having to do</p>
<pre><code>$myArray = myClass::giveMeArray();
$myValue = $myArray[$myKey];
<... | <p>I haven't tried it, but:</p>
<pre><code>$myValue = @$myArray[$myKey];
</code></pre>
<p>might work, though i honestly think you would be better off using</p>
<pre><code>$myValue = (array_key_exists($myKey, $myArray)) ? $myArray[$myKey] : null;
</code></pre>
| <p><strong>EDIT</strong>: turns out I need to brush up on my PHP5. My answer below is incorrect and only applies to PHP4, since PHP5 has <a href="http://www.talkphp.com/advanced-php-programming/1163-php5-method-chaining.html" rel="nofollow noreferrer">method chaining</a>.</p>
<hr>
<p>PHP doesn't allow you to chain to... | 33,125 |
<p>If I understand correctly the .net runtime will always clean up after me. So if I create new objects and I stop referencing them in my code, the runtime will clean up those objects and free the memory they occupied.</p>
<p>Since this is the case why then do some objects need to have a destructor or dispose method? ... | <p>Finalizers are needed to guarantee the release of scarce resources back into the system like file handles, sockets, kernel objects, etc. Since the finalizer always runs at the end of the objects life, it’s the designated place to release those handles.</p>
<p>The <code>Dispose</code> pattern is used to provide dete... | <p>Some objects might need to clean up low-level items. Such as hardware that needs to be closed, etc.</p>
| 42,989 |
<pre><code>AlertEvent::AlertEvent(const std::string& text) :
IMEvent(kIMEventAlert, alertText.c_str()),
alertText(text)
{
//inspection at time of crash shows alertText is a valid string
}
IMEvent::IMEvent(long eventID, const char* details)
{
//during construction, details==0xcccccccc
}
</code></pr... | <p>alertText may be shown as a string in a debugger, but it has not been constructed yet (and therefore alertText.c_str() will return an indeterminate pointer).</p>
<p>To avoid this, one could initialize use text.c_str() as an argument to the IMEvent ctor.</p>
<pre><code>AlertEvent::AlertEvent(const std::string& ... | <p><em>The IMEvent constructor is called before alertText's constructor is called.</em></p>
<p>Almost. <code>alertText.c_str()</code> is called before alertText is constructed, that is the real problem. The easiest solution is replacing it with <code>text.c_str()</code></p>
| 33,048 |
<p>Do web browsers send the file size in the http header when uploading a file to the server? And if that is the case, then, is it possible to refuse the file just by reading the header and not wait for the whole upload process to finish?</p>
| <p><a href="http://www.faqs.org/rfcs/rfc1867.html" rel="noreferrer">http://www.faqs.org/rfcs/rfc1867.html</a></p>
<p><em>HTTP clients are
encouraged to supply content-length for overall file input so that a
busy server could detect if the proposed file data is too large to be
processed reasonably</em></p>
<p... | <ol>
<li><p>I'm not sure, but you should not really trust anything sent in the header, as it could be faked by the user.</p></li>
<li><p>It depends on how the server works. For example in PHP your script will not run until the file upload is complete, so this wouldn't be possible.</p></li>
</ol>
| 35,498 |
<p>I'm trying to use reflection to get a property from a class. Here is some sample code of what I'm seeing:</p>
<pre><code>
using System.Reflection;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
PropertyInfo[] tmp2 = typeof(TestClass).GetProperti... | <p>Add <code>BindingFlags.Instance</code> to the <code>GetProperty</code> call.</p>
<p>EDIT: In response to comment...</p>
<p>The following code returns the property.</p>
<p>Note: It's a good idea to actually make your property do something before you try to retrieve it (VS2005) :)</p>
<pre><code>using System.Refle... | <p>You need to specify whether it is static or an instance (or both) too.</p>
| 47,040 |
<p>I want to get started doing some game development using Microsoft's XNA. Part of that is Shader development, but I have no idea how to get started. I know that <a href="http://developer.nvidia.com/object/fx_composer_home.html" rel="noreferrer">nVidia's FX Composer</a> is a great tool to develop shaders, but I did no... | <p>Development of shaders in XNA (which obviously uses DirectX) requires knowledge of <a href="http://msdn.microsoft.com/en-us/library/bb509561(VS.85).aspx" rel="noreferrer">HLSL</a> or shader assembly. I'd recommend getting familiar with the former before diving into the latter.</p>
<p>Before writing any shaders, it'... | <p>SAMS's <a href="https://rads.stackoverflow.com/amzn/click/com/0672329646" rel="nofollow noreferrer" rel="nofollow noreferrer">XNA Unleashed</a> by Chad Carter is a great starting point for XNA and assumes little knowledge of game development practices or hard maths before you start. It has two chapters on basic and ... | 2,861 |
<p>I want to insert some special characters at the caret inside textboxes using javascript on a button. How can this be done?</p>
<p>The script needs to find the active textbox and insert the character at the caret in that textbox. The script also needs to work in IE and Firefox.</p>
<p><strong>EDIT:</strong> It is a... | <p>I think Jason Cohen is incorrect. The caret position is preserved when focus is lost.</p>
<p>[<strong>Edit</strong>: Added code for FireFox that I didn't have originally.]</p>
<p>[<strong>Edit</strong>: Added code to determine the most recent active text box.]</p>
<p>First, you can use each text box's onBlur eve... | <p>Note that if the user pushes a button, focus on the textbox will be lost and there will be no caret position!</p>
| 7,775 |
<p>Every class that wants to use java.util.logging generally needs to declare a logger like this:</p>
<pre><code>public class MyClass {
private static Logger _log = Logger.getLogger(MyClass.class.getName());
}
</code></pre>
<p>How do you avoid this MyClass.class.getName() boilerplate code?</p>
| <p>I have a template set up in Eclipse so that I only have to type a portion of the declaration, and then Eclipse will auto-complete the rest for me.</p>
<pre><code>${:import(org.apache.log4j.Logger)}
private final static Logger log = Logger.getLogger(${enclosing_type}.class);
${cursor}
</code></pre>
<p>So, I only ha... | <p>If you make the logger nonstatic, you can at least inherit it:</p>
<pre><code>public class SomeBaseClass
{
protected Logger logger = Logger.getLogger(getClass());
}
public class SubClass extends SomeBaseClass
{
public void doit() { logger.debug("doit!!!!"); }
}
</code></pre>
<p>That's how I've always done... | 26,140 |
<p>Here's the issue:</p>
<p>I have a hook in IE that reacts on <code>WebBrowser.OnNavigateComplete2</code> event to parse the content of the document for some precise info.</p>
<p>That document contains frames, so I look into the <code>HTMLDocument.frames</code>. For each one, I look into the document.body.outerHTML ... | <p>Do you know the name/id of the frame you are looking for content? If so, in your navigateComplete2 event, can you get a reference to the frame like </p>
<pre><code>iFrame frm = document.frames(<your frame id>);
int readyState=0;
while(frm.readystate !=4){
// do nothing. be careful to not create an endless l... | <p>Are you using some kind of threading? Running the browser in a separate thread really messes up things. Try to execute it in an STAThread and check if you get the correct result.</p>
| 41,988 |
<p>I know that XSLT does not work in procedural terms, but unfortunately I have been doing procedural languages for too long. Can anyone help me out by explaining in simple terms how things like apply-templates works and help a thicko like me to understand it.</p>
| <p>What makes you think that procedural terms do not apply here? It's just that the calling convention is somewhat more implicit than you would traditionally expect it, because there is an invisible context involved. Everything <code>apply-templates</code> does could be expressed in procedural terms.</p>
<p>Basically,... | <p>I strongly agree with the answer and blog post of Greg Beech.</p>
<p>For more detailed comparison between <code><xsl:for-each></code> and <code><xsl:apply-templates></code> see <a href="http://markmail.org/message/xbm7tsglnhqogdzd" rel="nofollow noreferrer"><strong>my answer</strong></a> to the question... | 43,225 |
<p>I have a table style page with rows. Each row has a checkbox. I can select all/many checkboxes and click "submit" and what is does is a Jquery ajax call for each row. </p>
<p>Basically I have a form for each row and I iterate over all the checked rows and submit that form which does the jquery ajax call.</p>
<p>So... | <h1>The easy way</h1>
<p>The easiest way is to use the <a href="http://api.jquery.com/ajaxStop/" rel="noreferrer"><code>.ajaxStop()</code> event handler</a>:
</p>
<pre><code>$(document).ajaxStop(function() {
// place code to be executed on completion of last outstanding ajax call here
});
</code></pre>
<h1>The har... | <p>How about just simply use <strong>if</strong>?</p>
<pre><code>success: function(html){
if(html.success == true ){
$('#result_'+rowNum).empty().append(html);
$('#coda_'+rowNum).removeClass("loading");
$('#coda_'+rowNum).addClass("loader");
}
}
</code></pre>
| 36,530 |
<p>Ideally I'd like a way to enable the mouse wheel for scrolling in old compiled java runtime apps, but java code to explicitly utilise it for an individual app would suffice. </p>
| <p>You shouldn't have to recompile against 1.5 or 1.6 to get mousewheel, unless you wrote custom components. The mousewheel behaviors were added to the swing classes, so just running old java apps against the new JRE should have mousewheel support without having to do anything (at least in scrollable/JScrollPane based... | <p>Mousewheel scrolling is supported in current Swing applications. You could try compiling your application using JDK 1.4, 1.5 or 1.6. Depending on the complexity and environment moving to a new version may or may not be a viable option.</p>
<p><a href="http://java.sun.com/docs/books/tutorial/uiswing/events/mousewhee... | 13,121 |
<p>I would like to monitor the number of threads used by a specific process on Linux.
Is there an easy way to get this information without impacting the performance of the process?</p>
| <p>try</p>
<pre><code>ps huH p <PID_OF_U_PROCESS> | wc -l
</code></pre>
<p>or <a href="http://htop.sourceforge.net/" rel="noreferrer">htop</a></p>
| <p>VisualVM can show clear states of threads of a given JVM process</p>
<p><a href="https://i.stack.imgur.com/kbLlz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kbLlz.png" alt="enter image description here"></a></p>
| 33,726 |
<p>Is there a one statement or one line way to accomplish something like this, where the string s is declared AND assigned the first non-null value in the expression?</p>
<pre><code>//pseudo-codeish
string s = Coalesce(string1, string2, string3);
</code></pre>
<p>or, more generally,</p>
<pre><code>object obj = Coale... | <p>As Darren Kopp said.</p>
<p>Your statement</p>
<pre><code>object obj = Coalesce(obj1, obj2, obj3, ...objx);
</code></pre>
<p>Can be written like this:</p>
<pre><code>object obj = obj1 ?? obj2 ?? obj3 ?? ... objx;
</code></pre>
<p>to put it in other words:</p>
<pre><code>var a = b ?? c;
</code></pre>
<p>is equ... | <p>the <strong>??</strong> operator.</p>
<pre><code>string a = nullstring ?? "empty!";
</code></pre>
| 6,383 |
<p>Without spending a long time reviewing the boost source code, could someone give me a quick rundown of how boost bind is implemented? </p>
| <p>I like this piece of the <code>bind</code> source:</p>
<pre><code>template<class R, class F, class L> class bind_t
{
public:
typedef bind_t this_type;
bind_t(F f, L const & l): f_(f), l_(l) {}
#define BOOST_BIND_RETURN return
#include <boost/bind/bind_template.hpp>
#undef BOOST_BIND_RETUR... | <p>I think it's a template class that declares a member variable for the arguments you want to bind and overloads () for the rest of the arguments.</p>
| 13,779 |
<p>to do some visualization of data I would like to include rectangles, circles and text within my graphs. Does anyone know a Java based framework (maybe similar to very basic Powerpoint functionality) that can export SVG graphics?</p>
| <p>Have a look at Java Advanced Imaging (<a href="http://java.sun.com/javase/technologies/desktop/media/jai/" rel="nofollow noreferrer">JAI</a>) and <a href="http://xmlgraphics.apache.org/batik/" rel="nofollow noreferrer">Batik</a> SVG toolkit:</p>
| <p>You could use the built in java.awt package for basic drawing functionality.</p>
<p><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Graphics2D.html" rel="nofollow noreferrer">http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Graphics2D.html</a></p>
<p>extend your class from the java.awt.Drawable interface... | 38,717 |
<p>Ok I need to change the value of a hidden field in a gridview and here is what I have so far:</p>
<pre><code>for(var i = 0; i < gv_Proofs.rows.length; i++)
{
var tbl_Cell = gv_Proofs.rows[i].cells[0];
var sdiFound = false;
for(var x = 0; x < tbl_Cell.childNodes.length; x++)
{
if(tbl_C... | <p>I got it working. The above loop was working just right but apparently my value of sdi was not always getting set right, and therefore the value I was checking was always set to false. So the above worked perfectly in my case if anyone ever has this issue again.</p>
| <p><strong>Edit: classic case of check before you post. <a href="http://www.beansoftware.com/ASP.NET-Tutorials/GridView-Hidden-Column.aspx" rel="nofollow noreferrer">Apparently</a> setting hidden=true actually prevents databinding which will be why the JS is having issues. <em>I</em> would say this is one of those typi... | 44,772 |
<pre><code>$array = explode(".", $row[copy]);
$a = $array.length -1;
</code></pre>
<p>I want to return the last element of this array but all i get from this is -1.</p>
| <p>You can also use:</p>
<p>$a = end($array);</p>
<p>This also sets the arrays internal pointer to the end of the array, but it does get you the last element easily.</p>
| <p>My PHP is a bit rusty, but shouldn't this be:</p>
<pre><code>$array = explode(".", $row[$copy]);
$a = $array[count($array)];
</code></pre>
<p>i.e.: isn't a "$" missing in front of "copy", and does .length actually work?</p>
| 19,915 |
<p>I found this in the code I'm working on at the moment and thought it was the cause of some problems I'm having.</p>
<p>In a header somewhere:</p>
<pre><code>enum SpecificIndexes{
//snip
INVALID_INDEX = -1
};
</code></pre>
<p>Then later - initialization:</p>
<pre><code>nextIndex = INVALID_INDEX;
</code></... | <p>Yes to everything.
It is valid code, it is also commonly used library-side C++ code, more so in modern C++ (it is strange when you see it the first time but its a very common pattern in reality).</p>
<p>Then enums are signed ints, but they get implicitly cast into unsigned ints, now this depending on your compiler ... | <p>Yes, I believe enums are signed. Change </p>
<pre><code>unsigned int nextIndex;
</code></pre>
<p>to </p>
<pre><code>int nextIndex;
</code></pre>
<p>and your program should work.</p>
| 38,709 |
<p>Okay, I guess this is entirely subjective and whatnot, but I was thinking about entropy sources for random number generators. It goes that most generators are seeded with the current time, correct? Well, I was curious as to what other sources could be used to generate perfectly valid, random (The loose definition) n... | <p>The Wikipedia article on <a href="http://en.wikipedia.org/wiki/Hardware_random_number_generator" rel="noreferrer">Hardware random number generator's</a> lists a couple of interesting sources for random numbers using physical properties. </p>
<p>My favorites: </p>
<ul>
<li>A nuclear decay radiation source detected ... | <p>Some use keyboard input (timeouts between keystrokes), I heard of I think in a novel that radio static reception can be used - but of course that requires other hardware and software...</p>
| 38,580 |
<p>What is the 'correct' way to store a native pointer inside a Java object?</p>
<p>I could treat the pointer as a Java <code>int</code>, if I happen to know that native pointers are <= 32 bits in size, or a Java <code>long</code> if I happen to know that native pointers are <= 64 bits in size. But is there a be... | <p>IIRC, both <code>java.util.zip</code> and <code>java.nio</code> just use <code>long</code>.</p>
| <p>You could look to the way C# handles this with the IntPtr type. By creating your own type for holding pointers, the same type can be used as a 32-bit or 64-bit depending on the system you're on.</p>
| 43,761 |
<p>I have an associative array, ie</p>
<pre><code>$primes = array(
2=>2,
3=>3,
5=>5,
7=>7,
11=>11,
13=>13,
17=>17,
// ...etc
);
</code></pre>
<p>then I do</p>
<pre><code>// seek to first prime greater than 10000
reset($primes);
while(next($primes) < 10000) {}
prev($primes);
/... | <p>You can "save" the state of the array:</p>
<pre><code>$state = key($array);
</code></pre>
<p>And "restore" (not sure if there's a better method):</p>
<pre><code>reset($array);
while(key($array) != $state)
next($array);
</code></pre>
| <p>If speed is not an issue and you aren't pushing php memory limits the quickest solution is just to duplicate your primes array and iterate 2 different ones.</p>
<pre><code>$awesomePrimes=$primes;
</code></pre>
<p>Then change globals and foreach in your function to <code>$awesomePrimes</code></p>
| 42,551 |
<p>I'm trying to write a script that will create a file on the server then use <code>header()</code> to redirect the user to that file. Then, after about 10 seconds I want to delete the file. I've tried this:</p>
<pre><code>header('Location: '.$url);
flush();
sleep(10);
unlink($url);
</code></pre>
<p>But the browser ... | <p>You might be better off having the PHP page serve the file. No need to create a temporary file in this case and delete it, just send out the data you intended to write to the temporary file. You will need to set the headers correctly so the browser can identify the type of file you are sending. i.e. Content-Type: te... | <p>You're going about this the wrong way. You can create the file and serve it to them, and delete it in one step.</p>
<pre><code><?php
$file_contents = 'these are the contents of your file';
$random_filename = md5(time()+rand(0,10000)).'.txt';
$public_directory = '/www';
$the_file = $public_directory.'/'.$random_f... | 46,635 |
<p>How can I add a line break to text when it is being set as an attribute i.e.:</p>
<pre><code><TextBlock Text="Stuff on line1 \n Stuff on line2" />
</code></pre>
<p>Breaking it out into the exploded format isn't an option for my particular situation. What I need is some way to emulate the following:</p>
<pr... | <pre><code><TextBlock Text="Stuff on line1&#x0a;Stuff on line 2"/>
</code></pre>
<p>You can use any hexadecimally encoded value to represent a literal. In this case, I used the line feed (char 10). If you want to do "classic" <code>vbCrLf</code>, then you can use <code>&#x0d;&#x0a;</code></p>
<p>By ... | <p>Code behind solution</p>
<pre><code>private void Button1_Click(object sender, RoutedEventArgs e)
{
System.Text.StringBuilder myStringBuilder = new System.Text.StringBuilder();
myStringBuilder.Append("Orange").AppendLine();
myStringBuilder.Append("").AppendLine();
myStringBuilder.Append("Apple").Appe... | 22,169 |
<p>I have IIS 5.1 installed on Windows XP Pro SP2. Besides I have installed VS 2008 Express with .NET 3.5. So obviously IIS is configured for ASP.NET automatically for .NET 3.5</p>
<p>The problem is whenever I access <a href="http://localhost" rel="noreferrer">http://localhost</a> IE & Firefox both presents authen... | <p>This is most likely a NT file permissions problem. IUSR_ needs to have file system permissions to read whatever file you're requesting (like /inetpub/wwwroot/index.htm).<p>If you still have trouble, check the IIS logs, typically at \windows\system32\logfiles\W3SVC*.</p>
| <p>What worked for me is ,,,</p>
<p>Click Start>control panel>Administrative Tools>Internet Information Services</p>
<p>Expand the left tree, right-click your WebSite>Properties</p>
<p>Click on Directory Security, then in "Anonymous access and authentication control" click on Edit</p>
<p>Enable Anonymous access>bro... | 7,691 |
<p>If you call <code>LoadLibrary</code> without a path (e.g., <code>LoadLibrary("whatever.dll")</code>, Windows will generally follow its standard search algorithm, the same one it uses to find EXEs.</p>
<p>My question is this: suppose that an application manifest specifies specifies a particular version of a system D... | <p>From <a href="http://msdn.microsoft.com/en-us/library/ms682586.aspx" rel="noreferrer">Microsoft:</a></p>
<blockquote>
<p>Applications can control the location from which a DLL is loaded by specifying a full path, using DLL redirection, or by using a manifest. If none of these methods are used, the system searches... | <p>To probe the loader when having troubles with missing libraries, you can use the "sxstrace" feature. <a href="http://www.codeproject.com/KB/DLL/QueryAssemblyIdentities.aspx" rel="nofollow noreferrer">www.codeproject.com/KB/DLL/QueryAssemblyIdentities.aspx</a> gives some details about the dependencies between manifes... | 18,643 |
<p>I have a form containing a web browser control. This browser control will load some HTML from disk and display it. I want to be able to have a button in the HTML access C# code in my form. </p>
<p>For example, a button in the HTML might call the Close() method on the form.</p>
<p>Target platform: C# and Windows Fo... | <p>Look at the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.objectforscripting.aspx" rel="noreferrer">WebBrowser.ObjectForScripting</a> property. Managed to get Google Maps talking to a windows forms application using this.</p>
| <p>This is possible, but I haven't done it in .NET.
A few years back I had a C++ application that hosted a web browser control (ActiveX). From the HTML in the control, it was possible to call 'out' to the ActiveX control and get it to do things. </p>
<p>The same should be possible in .NET, although HTML DOM/JavaScrip... | 39,358 |
<p>This appears to be the most commonly asked C# interop question and yet seems to be difficult to find a working solution for.</p>
<p>I am in need of allocating an array of matrix datastructure in C# passing it to a C DLL which fills up the data and returns it to the caller to deal with.</p>
<p>Based on various page... | <p>Here's a modified version of my initial code that works with an array of matrices:</p>
<pre><code>typedef struct Matrix
{
int rowsCount;
int colsCount;
int* data;
} TMatrix;
extern "C" __declspec(dllexport) void InitializeMatrix(TMatrix** matrices, int count)
{
srand(time(NULL));
printf("<u... | <p>Here's how I did it in an old project in which I had to pass a matrix of integers to a C routine that would fill it with values and then I had to get back the values in managed code.</p>
<p>I had a routine in unmanaged code that would fill a matrix of integers with some values:</p>
<pre><code>#include "stdafx.h"
#... | 48,957 |
<p>I have a question regarding handling errors in a J2EE application. Our current application is in use by many many users and as a result we get a lot of support tickets. Most of these tickets are user-related but 5-10% are system related exceptions, unhandled errors, etc.</p>
<p>We have the basic exception handling ... | <p>It sounds like you need to spend some serious time bucketing your support issues for some code triage. My experience has been that you can nearly always create a "top 10 list" of items that are causing 50%+ of the support issues. After you've knocked off the first 10, reexamine the call logs. Data is imperative.<... | <p>Use log4j to log all errors and exceptions to a logger which emails you the information. Don't worry about user messaging; all they need to know is there was an error and that it was logged.</p>
| 34,515 |
<p>Is there a quick one-liner to call datepart in Sql Server and get back the name of the day instead of just the number?</p>
<pre><code>select datepart(dw, getdate());
</code></pre>
<p>This will return 1-7, with Sunday being 1. I would like 'Sunday' instead of 1.</p>
| <pre><code>select datename(weekday, getdate());
</code></pre>
| <p>This is not possible without using the result to select the day yourself. For one thing the textual representation of the day is locale-dependent. For another the returned value depends upon the 'datefirst' setting.</p>
| 3,356 |
<p>Okay, what is it, and why does it occur on Win2003 server, but not on WinXP.</p>
<p>It doesn't seem to affect my application at all, but I get this error message when I close the application. And it's annoying (as errors messages should be).</p>
<p>I am using pyOpenGl and wxPython to do the graphics stuff. Unfor... | <p>Looks like OpenGL is trying to report some error on Win2003, however you've not configured your system where to output logging info.</p>
<p>You can add the following to the beginning of your program and you'll see details of the error in stderr.</p>
<pre><code>import logging
logging.basicConfig()
</code></pre>
<p... | <p>After adding the Logging above, I was able to see that the problem was caused by missing TConstants class, which I was excluding in the py2exe setup.py file. </p>
<p>After removing the "Tconstants" from the excluded list, I no longer had problems.</p>
| 45,019 |
<p>I am getting the following error:</p>
<pre><code>Open
OLE error code:80004005 in Microsoft OLE DB Provider for SQL Server
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
HRESULT error code:0×80020009
Exception occurred.
</code></pre>
<p>I have tried following the directions <a hr... | <p>Usually a authentication/permissions error.</p>
<p>Is the SQL Server on the same box as the web server, review the accounts they are running under, and review the type of connection you are making (integrated or otherwise)?</p>
| <p>Random guess: By default SQL Server (express, at least anyway) does NOT enable network access. The SQL Admin manager tools connect to it using named pipes, however rails most likely will be trying to use TCP.</p>
| 18,761 |
<p>The default Courier New 10pt is larger than necessary for me. However, using that font at 8pt does not look very good.</p>
<p>Are there better choices for a more readable, very small (e.g., 8pt) font for eclipse?</p>
| <p>If running on Windows, you may give Microsoft Consolas a shot (included in Vista or later, and available as a separate download). I use it everywhere.</p>
| <p>Check out <a href="http://www.lowing.org/fonts/" rel="nofollow noreferrer">Monospace/Fixed Width Programmer's Fonts</a>. It addresses many important aspects for using a font with programming.</p>
| 17,589 |
<p>I want to create an <code>NSOpenPanel</code> that can select any kind of file, so I do this</p>
<pre><code>NSOpenPanel* panel = [NSOpenPanel openPanel];
if([panel runModalForTypes:nil] == NSOKButton) {
// process files here
}
</code></pre>
<p>which lets me select all files <em>except</em> symbolic links.<b... | <p>I cannot reproduce this. I just tried it and it works just fine. If symlink points to a directory, it shows the directory content when I select the symlink and if the symlink points to a file, I can select it as well.</p>
<p>Of course if the symlink points to a directory, you can only select it if choosing director... | <p>Your code sample worked for me, as well - I'm using 10.5.5 and XCode 3.1, if it matters.</p>
<p>If the alias is to a directory, I couldn't select the alias, since it resolved to the directory that it was pointing to, not the alias itself (the panel seems to resolve aliases by default). I was able to select an alias... | 23,164 |
<p>I have a content type that has required fields. I have associated Word document with the content type as a template. I now want to edit the Word template, but word won't allow me to save the template without filling in the required fields. However, if I fill in the required fields and save the document, then thos... | <p>I've been using this work around: When I edit the template (ie go to the content type settings --> Advanced settings --> Edit Template), I make my changes and save the file locally. Then, on the same page that I clicked the "Edit Template" link, I upload the copy that I saved locally. Saving it locally avoids the... | <p>Have you tried saving the document as a normal document content type, making the changes, saving it, then moving back over the top of where the old version of the template was?</p>
| 36,134 |
<p>I'm a bit stuck here, I have a .net 3.5 sp1 application that I want to deploy locally to other machines on my network using ClickOnce.</p>
<p>On installation they get a warning message saying that this application is from an unknown publisher etc.</p>
<p>My boss does not want to buy a verisgn certificate. He just ... | <p>Since you're on your own network you could create your own trusted certificate publisher. To do so, install Certificate Authority services on one of your servers and create a code-signing certificate. By default your user's computers won't trust the certificate, so run the following on each computer: </p>
<p>cert... | <p>Mitchell's answer is good, but unless you have an Enterprise Edition server you can't customize templates and the Code Signing template is marked as "unexportable". That means that you cannot use the certificate within Visual Studio and have to have an after-process that signs your manifests.</p>
<p>Now this is a f... | 44,205 |
<p>Is the new ControlState feature only applicable to custom controls or is it available for the standard server controls as well?</p>
<p>That is..can you disable ViewState for an entire page with standard controls like Detailsview, Gridview and would it still work? <strong>Does ControlState apply to standard server c... | <p>From the <a href="http://msdn.microsoft.com/en-us/library/1whwt1k7.aspx" rel="nofollow noreferrer">Microsoft Documentation</a>.</p>
<blockquote>
<p>Use control state only for small
amounts of critical data that are
essential for the control across
postbacks. Do not use control state as
an alternative to v... | <p>You can disable view state for all page but you need to rebind datagrid, dataview in every postback. </p>
<p>Sometimes it works better then saving a huge viewstate on the client.</p>
<p>For standard server controls: if you modify Control Properties after init, then all modifications will be saved in ViewState too.... | 49,987 |
<p>You know how Subversion stores a copy of every file it has checked-out in the hidden .svn folders? The website I'm building is pretty big (has over 1Gig of PDF files). These PDF files will very rarely change throughout the existence of the website.</p>
<p>I was wondering if there was a way of telling Subversion tha... | <p>Subversion uses the version in the .svn folders to be able to diff the new file against the old file, and send just the differences to the subversion server. </p>
<p>So no, there's no way to not have the files inside the .svn folders, that still allows you to commit these files</p>
| <p>You might want to consider managing the "live" copy of your website using <code>svn export</code> instead of a checkout. This would completely avoid the problem of large files in .svn folders.</p>
<p>Your workflow could be like this:</p>
<ol>
<li>Edit files locally, test in test deployment</li>
<li>Commit changes ... | 42,684 |
<p>I have Windows 2003 Standard, IIS 6, PHP, MySQL and amy trying to get mcrypt working so I can use phpMyAdmin.</p>
<p>I have uncommended php_mcrypt.dll in php.ini and this file is in my extensions folder (c:\php).</p>
<p>I have downloaded libmcrypt.dll to c:\php, c:\php\ext, c:\windows, c:\windows\system32. I have ... | <p>I had the same problem and found that the version of libmcrypt.dll I had was corrupt and when I downloaded a version from the net it was fine. As you have already done this I doubt this helps?</p>
| <ul>
<li>Make sure your extension_dir in php.ini points to the right path (e.g. c:/php5/ext)</li>
<li>Try restarting windows after each change instead of IIS.</li>
<li>libmcrypt.dll only has to be in c:\windows\system32</li>
<li>To be sure mcrypt is (not) loaded, use phpinfo() to check.</li>
</ul>
<p>I'm also having d... | 24,813 |
<p>I need to store sensitive data across few pages (run over https) per session.</p>
<p>I can't use session object, for the primary reason being that the session store is designed as just as backup store (primarily make service calls and load the session). If the session has been restarted or in other words that the k... | <blockquote>
<p>I need to store sensitive data across
few pages (run over https) per
session.</p>
</blockquote>
<p>ViewState is set and maintained on the page level. It cannot be carried across different page requests, only postbacks of the current page. Assuming you really mean you have to carry the data "acr... | <p>Storing modest amounts of data in the viewstate, whether or not you use a serializable class, shouldn't be a performance concern.</p>
<p>You will need to use encryption to protect the data values within the viewstate. Again, performance should not be a concern for modest amounts of data. See <a href="http://weblogs... | 33,142 |
<p>I'm building the HTML code within an XML DOM object to be used as the contents of the innerHTML of a div element using an XSL template. Traditionally we create a new XML DOM document and add the input parameters as XML Elements for the transform via javascript. This is all very time-consuming as we are basically han... | <p>CloneNode is pretty efficient but it will be consuming more memory doing it that way.</p>
<p>Another approach to consider is to use a Template object and a processor, pass your additional/changed data as parameters to the processor and the element that you would have otherwise cloned as the input element. This app... | <p>If you don't need form-elements, cloneNode is a real reliable tool ...</p>
<p>-- and in inserting ajax-data it is incredible in efficiency ...</p>
<p>However, as especially IE has a history of having problems with name-attributes, it is inconvenient to address any of these if you insert data ...</p>
<p>-- I don't... | 34,388 |
<p>I had a plugin installed in Visual Studio 2008, and it created some extra dockable windows. I have uninstalled it, and I can't get rid of the windows it created - I close them, but they always come back. They're just empty windows now, since the plugin is no longer present, but nothing I've tried gets rid of them.... | <p>Have you tried this? In Visual Studio go to <strong>Tools</strong> > <strong>Import and Export Settings</strong> > <strong>Reset all settings</strong></p>
<p>Be sure you <strong>back up</strong> your settings before you do this. I made the mistake of trying this to fix an issue and didn't realize it would undo all... | <p><code>Window -> Reset Window Layout</code> didn't exist for me. For anybody looking in 2022 or later, I finally found the answer! The crucial information, buried in a VSCode update release note, was right at the bottom of <a href="https://code.visualstudio.com/updates/v1_64#_workbench" rel="nofollow noreferrer">... | 4,652 |
<p>I've been trying to fix this for two hours straight and I can't figure it out.</p>
<pre><code>onclick = "location='exceltest.asp?vanjaar=<%=vanjaar%>&vanmaand=<%=vanmaand%>&vandag=<%=vandag%>&totjaar=<%=totjaar%>&totmaand=<%=totmaand%>&totdag=<%=totdag%>'"
</c... | <p>The <code>&</code> inside <code>onclick=""</code> should be html-encoded to <code>&amp;</code></p>
<p>If fromdate contains slashes you're probably safest to url-encode that as well (though you seem to contradict that with your example URL).</p>
| <p>Something that might help: <a href="http://www.w3schools.com/asp/met_urlencode.asp" rel="nofollow noreferrer"><code>Server.URLEncode</code></a></p>
<pre><code>fromdate=<%=Server.URLEncode(fromdate)%>
</code></pre>
<p>But, your Excel file error -- <strong>Item cannot be found in the collection corresponding t... | 46,795 |
<p>The following code writes no data to the back buffer on Intel integrated video cards,for example, on a MacBook. On ATI cards, such as in the iMac, it draws to the back buffer. The width and height are correct (and 800x600 buffer) and m_PixelBuffer is correctly filled with 0xAA00AA00.</p>
<p>My best guess so far is ... | <p>I've always had problems with OpenGL implementations from Intel, though I'm not sure that's your problem this time. I think you're running into some byte-order issues. Give this a read and feel free to experiment with different constants for packing and color order.</p>
<p><a href="http://developer.apple.com/docume... | <blockquote>
<p>I've always had problems with OpenGL
implementations from Intel</p>
</blockquote>
<p>This is kind of what I'm worried about, but I have a hard time believing they'd screw up something as basic as glDrawPixels, and also, since I can "duplicate" the problem by changing the raster position vector, it ... | 4,524 |
<p>I have some integration points where I want to test various responses - where do you think should I store these artifacts in my spec/ directory of my rails application?</p>
| <p>In the past I've created a test/resources or spec/resources directory for other test/spec related files. That seems to keep it clear that it's some sort of other file used only for testing.</p>
| <p>you could just create a spec/fixtures dir and stick em in there.</p>
| 15,688 |
<p>I have some code like this:</p>
<pre><code>If key.Equals("search", StringComparison.OrdinalIgnoreCase) Then
DoSomething()
End If
</code></pre>
<p>I don't care about the case. Should I use <code>OrdinalIgnoreCase</code>, <code>InvariantCultureIgnoreCase</code>, or <code>CurrentCultureIgnoreCase</code>?</p>
| <p><strong><a href="https://learn.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings#choosing-a-stringcomparison-member-for-your-method-call" rel="noreferrer">Newer .Net Docs now has a table to help you decide which is best to use in your situation.</a></strong></p>
<p>From MSDN's "<a href="https://... | <p>The very simple answer is, unless you are using Turkish, you don't need to use InvariantCulture.</p>
<p>See the following link:</p>
<p><a href="https://stackoverflow.com/questions/3550213/in-c-sharp-what-is-the-difference-between-toupper-and-toupperinvariant">In C# what is the difference between ToUpper() and ToUp... | 9,832 |
<p>I am an advocate of ORM-solutions and from time to time I am giving a workshop about Hibernate.</p>
<p>When talking about framework-generated SQL, people usually start talking about how they need to be able to use "hints", and this is supposedly not possible with ORM frameworks.</p>
<p>Usually something like: "We ... | <p>A SQL statement, especially a complex one, can actually be executed by the DB engine in any number of different ways (which table in the join to read first, which index to use based on many different parameters, etc).</p>
<p>An experienced dba can use hints to <em>encourage</em> the DB engine to choose a particular... | <p>All modern RDBMS-es have some sort of query optimizer that calculates best query plan, which is sequence of read/write operations needed to execute SQL query. </p>
<p>Sometimes plans can be suboptimal, so RDBMS designers included "hints" in SQL. Hints are instructions you can embed in your SQL that affect query opt... | 32,771 |
<p>In
<a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6525150" rel="nofollow noreferrer">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6525150</a>
it says
Release Fixed 7(b14), 6u2(b01) (Bug ID:2147561)</p>
<p>What does 6u2 mean? (Am I right in assuming it as 1.6.0_02 ?) </p>
| <p>yes, release 6 update 2. Also, (b01) is build 01</p>
| <p>Yes. You are right. :) u2 -> Update 2</p>
| 23,835 |
<p>We are troubleshooting a SQL Server 2005 connection issue on a closed-source third-party ASP.NET application. The application is a .NET application and the developing company is using a custom formatted configuration file that stores the SQL Server authentication information.</p>
<p>The application when trying to ... | <p>run profiler and choose Security Audit: Audit Login, Audit Login Failed and Audit Logout events. choose all columns.
from that you'll get the app name, and the user that tries to log in from the login failed event.
once you get that check which database is default for that user in SQL Server users.</p>
| <p>I just asked some of the guys here and they both recommended trying reflector. If you had some hard coded values in the library, you should be able to see something there.</p>
| 32,348 |
<p>I have just discovered that if generating assemblies via Reflection.Emit, the .NET framework keeps references in a static member that prevents Reflection.Emit classes not to be GC'ed. </p>
<p>I cannot use DynamicMethod due to limitations. I also generate a lot of assemblies (incremental compiler of IronScheme) ove... | <p>As I understand it, it's just a little slower than spawning a thread.</p>
<hr>
<p>Been doing some research, trying to find a real reference for this. So far, this is the best I can come up with:<br>
<a href="http://msdn.microsoft.com/en-us/library/aa159887.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com... | <p>As I understand it, it's just a little slower than spawning a thread.</p>
<hr>
<p>Been doing some research, trying to find a real reference for this. So far, this is the best I can come up with:<br>
<a href="http://msdn.microsoft.com/en-us/library/aa159887.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com... | 43,433 |
<p>I like using "Vase Mode" (or single outline corkscrew printing mode) for quick nonfunctional prints, but it tends to leave gaps in horizontal or near horizontal surfaces. I understand why it does this, but is there a way (beyond printing with no infill*) to get a little more horizontal coverage out of it?</p>
<p>*I... | <p>Version 4 allows you to have multi-process vase mode prints -- do the vertical surfaces in vase mode, then switch over to normal mode for the horizontals. This lets you have the best of both worlds in the same print. :)</p>
| <p>Vase mode is what it is... As it prints one perimeter there is just one extrusion. Try increasing extrusion rate to see if that will fix the gaps. </p>
<p>but yes, printing without infill will do the job better than vase mode.</p>
| 684 |
<p>What is the best way to create fluid width/height rounded corners with jQuery?</p>
<hr>
<p>That plugin doesn't keep the height the same. I have a 10px high div that I want to round the corners on, when I use that script it adds about 10px onto whats there.</p>
| <pre><code>$(this).corner();
</code></pre>
<p>See: <a href="http://malsup.com/jquery/corner" rel="nofollow noreferrer">malsup.com/jquery/corner</a> and <a href="http://github.com/malsup/corner" rel="nofollow noreferrer">github repository for future ref</a></p>
| <p>If you want full control about the border an d gradient, you can use my iQuery Background Canvas plugin. It works with a HTML5 Canvas element and allows to draw borders and backgrounds in any variation. But you should be able to program JavaScript</p>
<p>This is a full featured sample with a background gradient and... | 5,597 |
<p>I need to create a panel which should be invisible but the components inside it (for example, JTextArea, JButton, etc.) should be visible. When I click on the invisible panel, it should become visible.</p>
<p>I can only use JRE 1.4 and nothing more than that. :(</p>
<p>Any idea how to create such a transparent pan... | <p>Transparancy is controlled with</p>
<pre><code>setOpaque(false)
</code></pre>
| <p><code>JComponent.setOpaque(false)</code> is the way to go.</p>
| 32,201 |
<p>I am retrieving multiple rows into a listview control from an ODBC source. For simple SELECTs it seems to work well with a statement attribute of SQL_SCROLLABLE. How do I do this with a UNION query (with two selects)?</p>
<p>The most likely server will be MS SQL Server (probably 2005). The code is C for the Win3... | <p>can you not define a view on the db server that does the union query for you, so from the client code it just looks like a single select?</p>
<p>if you can't, can you just issue the union operation as part of your select, e.g.</p>
<pre><code>select some_fields from table1
union
select same_fields from table2
</cod... | <p>If the issue is just needing to get the last row to get the number of rows and caching the last few rows (I assume if there are a million items in the select that you're not populating a drop-list with all of them) then you may be able to take advantage of the <code>ROW_NUMBER()</code> function of SQL Server 2005</p... | 12,466 |
<p>I am doing a BHO (extension for IE) that receives events on other thread. When I access the DOM from that other thread, IE crashes. Is it possible to make the DOM accessed from the same thread as the main BHO thread so that it does not crash? </p>
<p>It seems like a general COM multithreading problem, which I don't... | <p>Look into using <a href="http://msdn.microsoft.com/en-us/library/ms678428.aspx" rel="nofollow noreferrer">CoMarshalInterface</a> or <a href="http://msdn.microsoft.com/en-us/library/ms693316.aspx" rel="nofollow noreferrer">CoMarshalInterThreadInterfaceInStream</a></p>
<p>These will give you a wrapped interface to an... | <p>ah, fun fun fun multithreading with COM.</p>
<p><a href="https://stackoverflow.com/questions/199972/com-calling-from-other-thread-causes-crashes-how-to-make-it-run-on-the-same-thr#200012">Gerald's answer</a> looks right if you want to transfer an interface pointer from one thread to another exactly once. I've found... | 24,387 |
<p>I have set a canvas' background to an image of a company logo. I would like for this image to be aligned to the bottom right corner of the canvas.<br>
Is it possible to do this, or would it require for the image to be added into the canvas as a child? That would not work with this program as all children of the ca... | <p>Will this work? (It worked for me, anyway.)</p>
<pre><code> <Canvas>
<Canvas.Background>
<ImageBrush ImageSource="someimage.jpg" AlignmentX="Right"
AlignmentY="Bottom" Stretch="None" />
</Canvas.Background>
</Canvas>
</code></pre>
| <p>AFAIK The WPF Canvas needs child UI elements to be positioned using absolute co-ordinates.
To achieve the right-bottom-anchored effect, I think you'd need to <strong>handle the window resize event, recalculate and apply the Top,Left co-ordinates</strong> for the child Image element to always stick to the right butt... | 33,844 |
<p>Obviously I can do and <code>DateTime.Now.After</code> - <code>DateTime.Now.Before</code> but there must be something more sophisticated.</p>
<p>Any tips appreciated.</p>
| <p><a href="http://msdn.microsoft.com/en-us/library/system.environment.tickcount.aspx" rel="nofollow noreferrer">System.Environment.TickCount</a> and the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx" rel="nofollow noreferrer">System.Diagnostics.Stopwatch</a> class are two that work... | <p>Tickcount is good, however i suggest running it 100 or 1000 times, and calculating an average.
Not only makes it more measurable - in case of really fast/short functions, but helps dealing with some one-off effects caused by the overhead.</p>
| 49,919 |
<p>I've been trying to modify the following menu to make it look indentical in IE, Firefox, and Safari/Chrome but I can't seem to get it to look right in Safari/Chrome.</p>
<p>Could anyone tell me how to fix it? When viewed in Safari or Chrome, notice that the menu is ignoring the padding.</p>
<p><a href="http://www... | <p>Padding on elements that are or are displayed as inline. <a href="http://www.maxdesign.com.au/presentation/inline/" rel="nofollow noreferrer">http://www.maxdesign.com.au/presentation/inline/</a></p>
| <p>Try making the <code>inline</code> elements <code>inline-block</code> in order to get the padding working properly.</p>
| 29,134 |
<p>I have a customer who needs to send some direct mailing to his contacts which is being collected from trade shows etc. I am thinking about providing a web based solution for them on sending direct mailing material- however this kind of solution always face a major difficulty on having the server blacklisted. I would... | <ul>
<li>Have your SMTP server respond to HELO/EHLO commands with your specific DNS name, not generic IP nor generic reversal (YES: mail.example.com ; NO: 1.2.3.4 , 4-3-2-1.dsl.example.com )</li>
<li>Have a Reverse DNS matching the HELO response (example: nslookup mail.example.com -> 1.2.3.4, nslooup 1.2.3.4 -> mail.ex... | <p>Aside from the server (just set up exim or postfix and a web interface to send newsletters from, and do this on a server with an IP address that is different from your own personal mail server (maybe even a different network)), you will want to get your terms and conditions of use nice and tight so that you can remo... | 27,296 |
<p>I recently ran up against a wall doing some bash shell programming where an associative array would have solved my problems. I googled about features of the KornShell (ksh) and learned that it supports associative arrays, so I installed Cygwin's pdksh (Public Domain KornShell).</p>
<p>However, when trying to creat... | <p>Take a look at ksh93, it supports associative arrays and is a much more complete/correct implementation of ksh.</p>
<p>See: <a href="http://kornshell.com/" rel="nofollow noreferrer">kornshell.com</a></p>
| <p>Why not just use bash? It might not have explicit associative arrays, but you can <a href="http://linuxshellaccount.blogspot.com/2008/05/how-to-fake-associative-arrays-in-bash.html" rel="nofollow noreferrer">fake them</a>.</p>
<p>Alternatively, zsh has <a href="http://zsh.dotsrc.org/Doc/Release/zsh_14.html#SEC72" r... | 44,476 |
<p>I want to create a list of columns in SQL Server 2005 that have identity columns and their corresponding table in T-SQL.</p>
<p>Results would be something like:</p>
<p>TableName, ColumnName</p>
| <p>Another potential way to do this for SQL Server, which has less reliance on the system tables (which are subject to change, version to version) is to use the
INFORMATION_SCHEMA views:</p>
<pre><code>select COLUMN_NAME, TABLE_NAME
from INFORMATION_SCHEMA.COLUMNS
where COLUMNPROPERTY(object_id(TABLE_SCHEMA+'.'+TABLE_... | <p>Get all columns with Identity. Modern version for MSSQL 2017+. Locks down to specific database:</p>
<pre><code>SELECT
[COLUMN_NAME]
, [TABLE_NAME]
, [TABLE_CATALOG]
FROM
[INFORMATION_SCHEMA].[COLUMNS]
WHERE
COLUMNPROPERTY(OBJECT_ID(CONCAT_WS('.' ,[TABLE_CATALOG] ,[TABLE_SCHEMA] ,[TABLE_NAME])) ,[COLUM... | 11,331 |
<p>I am attempting to bind a WPF textbox's Maxlength property to a known constant deep within a class. I am using c#.</p>
<p>The class has a structure not too dissimilar to the following:</p>
<pre><code>namespace Blah
{
public partial class One
{
public partial class Two
{
public ... | <pre><code>MaxLength="{x:Static local:One+Two+MetaData+Sizes.Length1}"
</code></pre>
<p>Periods reference properties. Plus signs refer to inner classes.</p>
| <p>try to bind with x:Static. add a xmlns:local namespace with the namespace of Sizes to your xaml header and then bind with something like this:</p>
<pre><code>{x:Static local:Sizes.Length1}
</code></pre>
| 28,835 |
<p>I'm trying to install a .NET service I wrote. As recommended by MSDN, I'm using InstallUtil. But I have missed how I can set the default service user on the command-line or even in the service itself. Now, when InstallUtil is run, it will display a dialog asking the user for the credentials for a user. I'm tryin... | <p>I think I may have found it. In the service itself, the automatically created ServiceProcessInstaller component has a property "Account" which can be set to "LocalService", "LocalSystem", "NetworkService" or "User". It was defaulting to "User" which must have displayed the prompt. </p>
| <p>Are you being asked for the account to run the service under, or for rights to install the service? For the second, installing as admin should prevent that from happening. For the first, you have to add a ServiceProcessInstaller to your Installer.</p>
<p>I believe the design surface for a service has a link to cr... | 5,212 |
<p>Just got a question about generics, why doesn't this compile when using a generic List? If its not possible, anyway around it? Much appreciate any answer.</p>
<pre><code>// Interface used in the ServiceAsync inteface.
public interface BaseObject
{
public String getId();
}
// Class that implements the interface... | <p>The fact that your MyAsync interface doesn't contain any method signatures and doesn't have a particularly informative name is a code smell from my perspective, but I'll assume that this is just a dummy example. As it is written, getList() couldn't ever have any reasonable implementation that used the callback in an... | <p>The '?' in generic types can be pretty confusing. Honestly I'm not sure why this won't compile. It has to do with using the '?' in a nested generic type. But I do know some ways to work around it.</p>
<p>Is there a reason that the declaration of the MyAsync in MyClass has to reference _ModelDto? It would work if yo... | 24,917 |
<p>From a previous question I have seen that the CLR has workstation and server modes for its garbage collector. I know that these can be set from configuration using the <a href="http://msdn.microsoft.com/en-us/library/ms229357.aspx" rel="nofollow noreferrer"><code>gcServer</code></a> element.</p>
<p><strong>If you ... | <p>Certainly not. The CLR runs in concurrent mode unless you explicitly tell it to do otherwise.</p>
| <p>According to the documentation you linked to, the default is "false". I would expect this to be constant on all installations and instances, the MS documentation is pretty good on this sort of thing.</p>
<p>The only caveat is that perhaps the installer (or someone) sets this setting in the machine.config (for ASP.N... | 39,164 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.