instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>what is the value of using IDictionary here?</p>
| <p>The value of using an interface is always the same: you don't have to change client code when switching to another backend implementation.</p>
<p>Consider that profiling your code later shows that a hash table implementation (used in the <code>Dictionary</code> class) isn't suited for your task and that a binary se... | <p>Based on your previous question <a href="https://stackoverflow.com/questions/328772/class-inherits-generic-dictionarystring-ifoo-and-interface">Class inherits generic <code>dictionary<string, IFoo></code> and Interface</a> and the discussion in the answers, I'm guessing your asking more about inheriting from r... | 42,607 |
<p>I'm interested in measuring and improving (where necessary) my team's SQL-92 skills. Can anyone recommend an appropriate on-line course and/or examination?</p>
<p>Ideally it would be vendor-neutral, but it could also be MSSQL/Oracle specific, as long as the proprietary bits were flagged as such.</p>
| <p>What you have should work (it does for me). Make sure it's in the top <code>urls.py</code>, and it should also be at the top of the list.</p>
| <p>Is there any way you can just use a generic view and go straight to template for your index page?:</p>
<pre><code>urlpatterns += patterns('django.views.generic.simple',
(r'', 'direct_to_template', {'template': 'index.html'}),
)
</code></pre>
| 37,605 |
<p>Is it possible to do the equivalent of the following in xslt:</p>
<pre><code>.//TagA[./TagB/[@AttrA='AttrAValue'] = 'TagBValue']
</code></pre>
<p>This is failing within Visual Studio 2008 with the following error:</p>
<pre><code>error: Unexpected token '[' in the expression.
.//TagA[./TagB/ -->[<-- @AttrA='... | <p>You can use a <a href="http://docs.oracle.com/javase/6/docs/api/index.html?java/util/LinkedHashMap.html" rel="noreferrer">LinkedHashMap</a> (Java 1.4+) :</p>
<pre><code>// Create cache
final int MAX_ENTRIES = 100;
Map cache = new LinkedHashMap(MAX_ENTRIES+1, .75F, true) {
// This method is called just after a n... | <p>I also had same problem and I haven't found any good libraries... so I've created my own.</p>
<p>simplelrucache provides threadsafe, very simple, non-distributed LRU caching with TTL support. It provides two implementations</p>
<ul>
<li>Concurrent based on ConcurrentLinkedHashMap</li>
<li>Synchronized based on Lin... | 27,798 |
<p>In short: what is the best way to design and implement a factory+plugin mechanism, so that plugins can replace objects in the main application.</p>
<p>We have a code base from which we build our applications. The code base is fine for 70-95% of the applications, meaning that in each new application we need to chang... | <p>There was an article a while back in Doctor Dobb's that discussed this exact problem. Here is <a href="http://www.ddj.com/cpp/204202899" rel="nofollow noreferrer">a link</a> to the article in question.</p>
<p>As an aside you may want to stick with a straight C interface for the plugins to your project. That way you... | <p>Did you look at CodeProject examples for plugins frameworks?
<a href="https://secure.codeproject.com/KB/DLL/plugin.aspx" rel="nofollow noreferrer">https://secure.codeproject.com/KB/DLL/plugin.aspx</a>
<a href="http://www.codeproject.com/KB/library/dynobj.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/... | 40,112 |
<p>I have two points (a line segment) and a rectangle. I would like to know how to calculate if the line segment intersects the rectangle. </p>
| <p>From my "Geometry" class:</p>
<pre><code>public struct Line
{
public static Line Empty;
private PointF p1;
private PointF p2;
public Line(PointF p1, PointF p2)
{
this.p1 = p1;
this.p2 = p2;
}
public PointF P1
{
get { return p1; }
set { p1 = value; }... | <p>I hate browsing the MSDN docs (they're awfully slow and weird :-s) but I think they should have something similar to <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/awt/geom/Rectangle2D.html#intersectsLine%28double,%20double,%20double,%20double%29" rel="nofollow noreferrer">this Java method</a>... and if they ... | 4,995 |
<p>Printer: Monoprice Select V2.</p>
<p>I've done several prints already and swapped out filaments many times but in my most recent swap, I can't feed my PLA through any more.</p>
<p>I first preheat my extruder for PLA temps (185 °C). Then I press the plastic thingy to allow me to push as much of the filamen... | <p>I figured out the issue. I think I was shoving it in the wrong hole.</p>
<p>I took apart my extruder component. There's a good video on it <a href="https://youtu.be/37df_c2hqYE?t=194" rel="nofollow noreferrer">here</a>.
But basically, you just have to loosen the two bottom screws on the side fan like this:
<a href=... | <p>Maybe some PLA is stuck in the throat above the heat break. Can you feed a very small wire all the way through it, or see light through the filament path?</p>
<p>185 is a little on the cold side. I would suggest trying to feed at 195 before taking more drastic measures.</p>
| 1,183 |
<p>I built a <strong>[widget][1]</strong> that grabs the URL from the frontmost window in Safari, then allows you to shorten it using the tr.im API. Works sweet as.</p>
<p>I want to make this more flexible, so am investigating how to grab an URL from other browsers. Here's the AppleScript that works in Safari:</p>
<p... | <p>Firefox (tested on versions 2.0.0.14 and 3.0.1):</p>
<pre><code>tell application "Firefox"
set myURL to «class curl» of window 1
return myURL
end tell
</code></pre>
| <p>Opera (tested on versions 9.21 and 9.62):</p>
<pre><code>tell application "Opera"
return URL of front document as string
end tell
</code></pre>
| 33,024 |
<p>I have the following HandleError filter on my controller:</p>
<pre>[HandleError(ExceptionType = typeof(ArgumentException), View = "DestinationError")]</pre>
<p>I've set-up the Web.Config so that customErrors are on. The problem I'm having is that the HandleError filter is working fine, when I run the app locally ... | <p>To answer my own question the magic is to turn off HTTP Errors in IIS. I'm not delighted in this workaround, so if anyone has any better ideas, I'd love to hear them.</p>
| <p>What if you try the following?</p>
<pre><code>Response.TrySkipIisCustomErrors = true;
</code></pre>
| 46,386 |
<p>I work with a lot of offsite developers and contractors. I ask them daily to send me a quick 5 minute status of their work for the day. I have to sometimes consolidate the status of individuals into teams and sometimes consolidate the status of a week, for end-of-period reporting to my clients.</p>
I want to learn:
... | <p>Use <a href="http://en.wikipedia.org/wiki/Scrum_(development)" rel="nofollow noreferrer">Scrum</a>. Create the sprint backlog, have a spreadsheet with the tasks and a column for each day of the sprint. Ask people to fill out the hours worked on each task every day. Send daily report starting with the burndown chart ... | <p>Just give them a template laid out in a format that you expect to see the data returned in. You may also consider increasing the time they are going to devote to this and removing the "not thinking too much" clause if you are requiring estimates for future work. I wouldn't trust an estimate that someone came up wit... | 19,957 |
<p>A <a href="http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=windows+cron" rel="noreferrer">Google search</a> turned up software that performs the same functions as cron, but nothing built into Windows.</p>
<p>I'm running Windows XP Professional, but advice for any version o... | <p>For the original question, asking about Windows XP (and Windows 7): <a href="https://technet.microsoft.com/en-us/library/cc748993(v=ws.11).aspx" rel="noreferrer">Windows Task Scheduler</a></p>
<p>For command-line usage, you can schedule with the <a href="http://technet.microsoft.com/en-us/library/bb726974.aspx" rel... | <p>The At command is now deprecated</p>
<p>you can use the <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/bb736357(v=vs.85).aspx" rel="nofollow">SCHTASKS</a> </p>
| 16,104 |
<p>On a company that I've worked, me and my colleagues, implemented a tailored document distribution system on top of XSL-FO.</p>
<p>My task was to get the script to deliver the documents and configure the CUPS print server and the Fax server, so I never had the time to get my hands dirty on XSL-FO.</p>
<p>I'm thinki... | <p>I like to refer people to this 2003 IBM developerWorks article: <a href="http://www.ibm.com/developerworks/library/x-xslfo2app/?ca=dnt-46h" rel="noreferrer">HTML to Formatting Objects (FO) conversion guide</a></p>
<p>I don't recommend using the provided .xsl to convert HTML to FO, but use the narrative to understan... | <p>This might not be exactly what you need, but if you just want to have some XSL-FO test templates, you can use <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=E0FAA0AF-A185-4296-B74D-A9FE870C92CC&displaylang=en" rel="nofollow noreferrer">this</a> transformation in Word to generate XSL-FO.</p>
<... | 13,422 |
<p>I have to implement the VinPower application. They offer a Java version, a C dll and an ActiveX dll, if anyone has an idea on where I could begin, I'd appreciate it.</p>
| <p>First step would be to put the VinPOWER Jar file into your lib directory, then restart the server.<br/>(Or, you can put the file in a different directory and then add the path in CF Administrator)</p>
<p>Then to use it... well, here is their Java sample in CFML:</p>
<pre><code><cfset vp = createObject("java","c... | <p>A quick Google search shows that there is <a href="http://www.vinpowerdigital.com" rel="nofollow noreferrer">Vinpower</a> and there is <a href="http://www.vinpower.com" rel="nofollow noreferrer">VinPOWER</a>. To which one are you referring?</p>
<p>When you say "implement", are you looking at writing your own librar... | 23,643 |
<p>In my Java development I have had great benefit from the <a href="http://en.wikipedia.org/wiki/JAD_%28JAva_Decompiler%29" rel="noreferrer">Jad/JadClipse</a> decompiler. It made it possible to <em>know</em> why a third-party library failed rather than the usual guesswork.</p>
<p>I am looking for a similar setup for ... | <p>Here is a good article about <a href="http://en.csharp-online.net/Visual_Studio_Hacks%E2%80%94Hack_64:_Examine_the_Innards_of_Assemblies" rel="nofollow noreferrer">Reflector and how to integrate Reflector into Visual Studio</a>.</p>
<blockquote>
<p>Of particular interest is the Reflector.VisualStudio Add-In. This... | <p>I don't think it can integrate with Visual Studio, but <a href="http://www.red-gate.com/products/reflector/" rel="nofollow noreferrer" title="Reflector">Reflector</a> can disassemble .NET assemblies into a number of .NET languages, or show the IL.</p>
| 26,400 |
<p>I'm using LINQ to SQL in a data access object library. The library is used in both web (web application/web service) and non-web (windows service) contexts. Initially, I stored the <code>DataContext</code> on the current <code>HttpContext</code> since it permitted me to manage a fairly small unit of work (one web re... | <p>The guidelines from the <a href="http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.aspx" rel="noreferrer">MSDN documentation on the DataContext class</a> are what I would recommend following:</p>
<blockquote>
<p>In general, a DataContext instance is
designed to last for one "unit of
work" h... | <p>I'm using httpcontext in web scenarios and thread context for everything else. We built a little framework so that the data context would be completely abstracted from the presentation/business tier.</p>
| 23,847 |
<p>Moving through the maze forward is pretty easy, but I can't seem to figure out how to back up through the maze to try a new route once you hit a dead end without going back too far?</p>
| <p>Use <a href="http://www.cs.bu.edu/teaching/alg/maze/" rel="nofollow noreferrer">backtracking</a> by keeping a stack of previous direction decisions.</p>
| <p>Eric Lippert did a series of articles on creating a <a href="http://blogs.msdn.com/ericlippert/archive/tags/AStar/default.aspx" rel="nofollow noreferrer">C# implemention of A*</a>, which might be more efficient.</p>
| 6,164 |
<p>I want to list (a sorted list) all my entries from an attribute called streetNames in my table/relation Customers.
eg. I want to achieve the following order: </p>
<p>Street_1A<br>
Street_1B<br>
Street_2A<br>
Street_2B<br>
Street_12A<br>
Street_12B </p>
<p>A simple order by streetNames will do a lexical comparisio... | <p>Select street_name from tablex
order by udf_getStreetNumber(street_name)</p>
<p>in your udf_getStreetNumber - write your business rule for stripping out the number</p>
<p>EDIT</p>
<p>I think you can use regex functionality in SQL Server now. I'd just strip out all non-number characters from the input.</p>
| <p>Yes it's possible! But definitely of no interest! If you find somebody here ready to spend a few hours writing down and testing the SP that will split your streetNames into a streetName + streetNumber combination, give me his name: I will submit him a few problems where I thought I had to pay to get the work done.</... | 45,982 |
<p>Ever since moving to Vista some time ago on my development machine, connecting to SQL Servers in our DMZ active directory domain from client tools like SSMS has not worked like it used to. In XP, as long as I had authenticated in some way on the server (for example directing Explorer to \server.dmzdomain\c$ and ent... | <p>"Login Failed for user ' ', the user is not associated with a trusted SQL Server connection".</p>
<p>In this scenario, client may make tcp connetion, plus, running under local admin or non-admin machine account, no matter SPN is registered or not, the client credential is obviously not recognized by SQL Server.</p>... | <p>Have you tried running SSMS in elevated mode, and do you have the latest SP installed on the client?</p>
| 4,252 |
<p>I want to create a micromouse project for fun that use 2 20 mm x 8.5 mm (0.8 mm shaft) motors. I have my own PCB as base. I want its built-in gears will be attached to two 3D-printed wheels with gears at the back of the wheels at each side. I'm having hard time to start designing the gears s... | <p>Designing gears is very difficult for a variety of reasons. Let me list what you should take into account:</p>
<ol>
<li><p>The shape of the teeth are very peculiar, trapezoid shape will not work as the meshing will not be constant. Exact shape is controlled by the pressure angle</p></li>
<li><p>In lower number of t... | <p>Designing gears is very difficult for a variety of reasons. Let me list what you should take into account:</p>
<ol>
<li><p>The shape of the teeth are very peculiar, trapezoid shape will not work as the meshing will not be constant. Exact shape is controlled by the pressure angle</p></li>
<li><p>In lower number of t... | 1,200 |
<p>I'm experiencing some problems with CSS and/or tables on my newly redesigned <a href="http://www.artinthepicture.com" rel="nofollow noreferrer">website</a>. Because of the well known "100% div height"-issue, I have resorted to using tables as a structural element of the website. So it looks something like this:</p>
... | <blockquote>
<p>Because of the well known "100% div height"-issue …</p>
</blockquote>
<p>and which one would that be? The one solved <a href="http://www.xs4all.nl/~peterned/examples/csslayout1.html" rel="nofollow noreferrer">here</a>? Basically, the important part is</p>
<pre><code>html, body {
height: 100%;
}
... | <p>For troubleshooting, I usually give my divs and other elements a border so I can visually see where they are located on the page.</p>
<pre><code>border: 1px solid red;
</code></pre>
<p>I have a suspicion that its not your td that is not displaying, but rather the div you have inside it. You can try setting the di... | 35,322 |
<p>How do you traverse a folder structure using C# without falling into the trap of <a href="http://en.wikipedia.org/wiki/NTFS_junction_point" rel="nofollow noreferrer">junction points</a>? </p>
| <p>For those that don't know: A junction point behaves similarly to a symbolic link for a folder on linux. The trap that is mentioned happens when you set up a recursive folder structure, like this:</p>
<pre><code>given folder /a/b
let /a/b/c point to /a
then
/a/b/c/b/c/b becomes valid folder locations.
</code></pre>
... | <p>you can use following code:</p>
<pre><code>private void processing(string directory)
{
cmbFilesTypesSelectedIndex = cmbFilesTypes.SelectedIndex;
CheckForProjectFile(directory);
DirectoryInfo dInfo = new DirectoryInfo(directory);
DirectoryInfo[] dirs = dInfo.Ge... | 38,663 |
<p>Is there a fairly easy way to convert a datetime object into an RFC 1123 (HTTP/1.1) date/time string, i.e. a string with the format</p>
<pre><code>Sun, 06 Nov 1994 08:49:37 GMT
</code></pre>
<p>Using <code>strftime</code> does not work, since the strings are locale-dependant. Do I have to build the string by hand?... | <p>You can use wsgiref.handlers.format_date_time from the stdlib which does not rely on locale settings</p>
<pre><code>from wsgiref.handlers import format_date_time
from datetime import datetime
from time import mktime
now = datetime.now()
stamp = mktime(now.timetuple())
print format_date_time(stamp) #--> Wed, 22 ... | <p>Well, here is a manual function to format it:</p>
<pre><code>def httpdate(dt):
"""Return a string representation of a date according to RFC 1123
(HTTP/1.1).
The supplied date must be in UTC.
"""
weekday = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][dt.weekday()]
month = ["Jan", "Feb"... | 27,821 |
<p>Using <a href="http://www.oracle.com/technology/products/jdev" rel="noreferrer">JDeveloper</a>, I started developing a set of web pages for a project at work. Since I didn't know much about JDev at the time, I ran over to Oracle to follow some tutorials. The JDev tutorials recommended doing <a href="http://www.filei... | <p>The main difference is that a JSPX file (officially called a 'JSP document') may be easier to work with because the requirement for well-formed XML may allow your editor to identify more typos and syntax errors as you type.</p>
<p>However, there are also disadvantages. For example, well-formed XML must escape thing... | <p>Also, another problem I have found with JSPX is when you want to use scriptlets. I agree that clean code is generally good and Java logic in the JSP is generally bad but there are certain instances where you want to use a utility function to return a string value or something where a TagLib or the model (request at... | 4,789 |
<p>I want to be able to put preformatted text (i.e. containing line breaks) into a single cell of a FitNesse fixture table. Is there a way to manipulate the FitNesse wiki markup to do this?</p>
| <p>Use !- -! to get multiline table cells and {{{ }}} to get preformatted text. The {{{ has to be outside the !-</p>
<p>For example:</p>
<pre><code>|sql|
|{{{!- SELECT *
FROM bar
WHERE gaz = 14
-!}}}|
</code></pre>
| <p>richard's comment on <a href="https://stackoverflow.com/a/587889/173497">Johannes Brodwall's answer</a> worked for me, i.e. you don't need the <a href="http://www.fitnesse.org/FitNesse.UserGuide.QuickReferenceGuide" rel="nofollow noreferrer">"formatted 'as is'" line/block markup, just the "'as-is'/escaping" characte... | 29,227 |
<p>What's the easiest way to add a header and footer to a .Net PrintDocument object, either pragmatically or at design-time?</p>
<p>Specifically I'm trying to print a 3rd party grid control (Infragistics GridEx v4.3), which takes a PrintDocument object and draws itself into it.</p>
<p>The resulting page just contains... | <p>The printdocument object fires the printpage event for each page to be printed. You can draw text/lines/etc into the print queue using the printpageeventargs event parameter: </p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx" rel="nofollow noreferrer">http://msdn.mi... | <p>The printdocument object fires the printpage event for each page to be printed. You can draw text/lines/etc into the print queue using the printpageeventargs event parameter: </p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx" rel="nofollow noreferrer">http://msdn.mi... | 8,375 |
<p>What exception should I throw if I encounter an illegal state - for instance, an initialization method that should only be called once being called a second time? I don't really see any built-in exception that makes sense. This seems like something that should be in the framework - am I not poking in the right spo... | <p><a href="http://msdn.microsoft.com/en-us/library/system.invalidoperationexception.aspx" rel="noreferrer">InvalidOperationException</a> maybe?</p>
<blockquote>
<p>The exception that is thrown when a method call is invalid for the object's current state. </p>
</blockquote>
| <p>If at all I'd say System.InvalidProgramException get nearest to what you want. What's wrong with throwing a custom exception?</p>
| 32,463 |
<p>If we put aside the rights and wrongs of putting demo data into a live system for a minute (that's a whole separate discussion!), we are being asked to store some demo data in our live system so that it can be credibly demonstrated without the appearance of smoke + mirrors (we want to use the same login page for exa... | <p>Can you instead, segregate the data into a new database, and just redirect your connection strings (they're not hard-coded, right? right?) to point to the demo database. This way, live data isn't tainted, and your code looks identical. We actually do a three tier-deployment system this way, where we do local develop... | <p>I've often seen it on certain types of live systems.
For example, point of sale systems in a supermarket: cashiers are trained on the production point of sale terminals.</p>
<p>The key is to carefully identify the test or training data. I wouldn't say that there's any explicit best practice for how to model this i... | 20,149 |
<p>I'm using spring 2.5, and am using annotations to configure my controllers. My controller works fine if I do not implement any additional interfaces, but the spring container doesn't recognize the controller/request mapping when I add interface implementations.</p>
<p>I can't figure out why adding an interface imp... | <p><em>layne</em>, you described the problem as happening when your controller class implements an interface, but in the code sample you provided, the problem occurs when your controller class extends another class of yours, <code>ValidatingController</code>.</p>
<p>Perhaps the parent class also defines some Spring an... | <p>I think you'll find that the problem is to do with inheritance and using annotations, they do not mix well. </p>
<p>Have you tried to implement the above using inheritance and SimpleFormController with all other details configured in your application context? This will at least narrow down the problem to an annota... | 18,220 |
<p>I have a large 'Manager' class which I think is doing too much but I am unsure on how to divide it into more logical units. </p>
<p>Generally speaking the class basically consists of the following methods:</p>
<pre>
class FooBarManager
{
GetFooEntities();
AddFooEntity(..);
UpdateFooEntity(..);
SubmitFooEnt... | <p>You really shouldn't put all data access into one class unless it's generic. I would start by splitting out your data access classes into one manager per object or related groups of objects, i.e. CompanyManager, CustomerManager, etc. If your need to access the manager through one "god class" you could have an instan... | <pre><code> / FooManager
Manager (derive from Manager)
\ BarManager
</code></pre>
<p>Should be self-explaining</p>
| 18,584 |
<p>I am looking in the Collections framework of Java for a LIFO Structure (Stack) without any success. Basically I want a really simple stack; my perfect option would be a Deque, but I am in Java 1.5.</p>
<p>I would like not to have to add another class to my structure but I am wondering if that is possible:</p>
<ol>... | <p>There's actually a Stack class: <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Stack.html" rel="noreferrer">http://java.sun.com/j2se/1.5.0/docs/api/java/util/Stack.html</a></p>
<p>If you don't want to use that, the LinkedList class (<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/LinkedList.h... | <h1><code>Deque</code> & <code>LinkedList</code></h1>
<p>Just for the sake of completeness I'm providing an example using <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Deque.html" rel="nofollow noreferrer"><code>Deque</code></a> interface and a <a href="https://docs.oracle.com/en/... | 38,840 |
<p>So I've got a program that needs to be multilingual. The only difference between what I'm needing and what I've found on the web is that all the computers my program will run on are set to the localization of EN.</p>
<p>We have spanish speaking employees that will use the program just like the english speaking empl... | <p>You can set the culture you want in code, e.g.:</p>
<pre><code>Thread.CurrentThread.CurrentUICulture = new CultureInfo("es-ES");
</code></pre>
<p>See <a href="http://msdn.microsoft.com/en-us/library/b28bx3bh(VS.80).aspx" rel="nofollow noreferrer">this MSDN article</a> for more info.</p>
| <p>With Windows you can have a machine culture EN, but for the browser, individual users of the PC can select prefered cultures (IE & Firefox anyway). Everything else on PC is english
In IE, go to tools, Options, click the language button on the general tab.
You can specify a prefered hierarchy of languages.</p>
<... | 37,126 |
<p>Is there a standard way to convert an XSD to an input form (ASP.NET C#) so that later on whenever a new field is added / removed from the XSD the field on the page automatically shows up or goes away respectively, is this something which needs to be developed in-house I assume there must be a way to serializes / des... | <p>I don't think there's anything built in to make this fully automatic. However, you can get pretty close. Visual Studio includes a command line program called xsd.exe that you can use to automatically create a class definition from an xsd document. Once you have that class definition you can connect it to a form v... | <p>Assumption: You're using XML because it is simpler for you at the moment. </p>
<p>Idea: Since you want to create a form to manipulate the data, I'm guessing you might be open to SQL instead of XML. This may not be the case, but you will probably find more tools to help you if you have a database backend instead of ... | 26,717 |
<p>I'm trying to think of clever, clear, and simple ways to write code that describes the sequence of integers in a given range. </p>
<p>Here's an example:</p>
<pre><code>IEnumerable<int> EnumerateIntegerRange(int from, int to)
{
for (int i = from; i <= to; i++)
{
yield return i;
}
}
</c... | <p>This is already in the framework: <a href="http://msdn.microsoft.com/en-us/library/system.linq.enumerable.range.aspx" rel="noreferrer">Enumerable.Range</a>.</p>
<p>For other types, you might be interested in the range classes in my <a href="http://pobox.com/~skeet/csharp/miscutil" rel="noreferrer">MiscUtil</a> libr... | <p>Here's an idea that lets a range class work with both things that are discrete and those which are not:</p>
<pre><code>class Range<T> where T: IComparable<T>
{
public T From { get; set; }
public T To { get; set; }
public Range(T from, T to) { this.From = from; this.To = to; }
public IE... | 23,606 |
<p>I would like a panel in GWT to fill the page without actually having to set the size. Is there a way to do this? Currently I have the following:</p>
<pre><code>public class Main implements EntryPoint
{
public void onModuleLoad()
{
HorizontalSplitPanel split = new HorizontalSplitPanel();
/... | <p>Google has answered the main part of your question in one of their FAQs:
<a href="http://code.google.com/webtoolkit/doc/1.6/FAQ_UI.html#How_do_I_create_an_app_that_fills_the_page_vertically_when_the_b" rel="nofollow noreferrer">http://code.google.com/webtoolkit/doc/1.6/FAQ_UI.html#How_do_I_create_an_app_that_fills_t... | <p>I think you'll need to put something on the left and/or right of the split (split.setLeftWidget(widget), split.setRightWidget(widget) OR split.add(widget), which will add first to the left, then to the right) in order for anything to show up.</p>
| 11,238 |
<p>Is it possible to re-assign the <kbd>Win</kbd>+<kbd>L</kbd> hotkey to another executable/shortcut?</p>
<p>Use-case - I would like to switch off the monitor of my laptop as soon as it is locked. I know of a executable which can lock and turn off the monitor but I do not want to change the way the system is locked (b... | <p>You need to set the following registry key to completely disable the Windows locking feature:</p>
<pre><code>[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System] "DisableLockWorkstation"=dword:00000001
</code></pre>
<p>And restart the computer.</p>
<p>This works on Win7, Win8 and Win10</p... | <p>Use power toys for windows 10.
There you have options to remap shortcuts..
<a href="https://insider.windows.com/en-us/articles/powertoys-v012-now-available/" rel="nofollow noreferrer">download power toys</a></p>
| 38,601 |
<p>Is there a way to do a mysql database query in Corel Draw 13(X3)? </p>
| <p>If I recall correctly, CorelDraw uses VBA as scripting language, no?</p>
<p>If so, if it is not restricted, you can probably use ODBC to do that. See <a href="http://dev.mysql.com/doc/refman/5.0/en/connector-odbc.html" rel="nofollow noreferrer" title="MySQL Connector/ODBC">MySQL Connector/ODBC</a> for details.</p>
| <p>To follow up PhiLho's point, <a href="http://books.google.ca/books?id=9OTV1YNLLBsC&pg=PT609&lpg=PT609&dq=Corel+draw+odbc&source=web&ots=2CEhpBo-cE&sig=FjIShZtwQmdSnYMlEtyrEzkR5ys&hl=en&sa=X&oi=book_result&resnum=3&ct=result#PPT611,M1" rel="nofollow noreferrer">here's a Goo... | 27,504 |
<p>Creating a patch is very easy in SubVersion, With Tortoise, you right-click and select Create Patch. But for the life of me, I can't find this functionality in TFS. Is this possible?</p>
<p>If not, what's the standard way to submit patches in open source TFS hosted projects (a la CodePlex)?</p>
| <pre><code>tf diff /shelveset:shelveset /format:unified
</code></pre>
<p><strong>Edit:</strong> This writes to standard output. You can pipe the output to a file.</p>
<p>For more options, see <a href="http://msdn.microsoft.com/en-us/library/6fd7dc73%28v=vs.100%29.aspx" rel="noreferrer">Difference Command</a>.</p>
| <p>I wrote a blog post about a similar issue where I used the TF.exe command and 7Zip to <a href="http://codeblog.theg2.net/2014/09/create-tfs-patch-file-with-pending.html" rel="nofollow">create a TFS patch file</a> that could then be applied on another TFS server or workspace. I posted the the Powershell scripts at <a... | 7,547 |
<p>In a JSP page, I created a <code><h:form enctype="multipart/form-data"></code> with some elements: <code><t:inputText></code>, <code><t:inputDate></code>, etc. Also, I added some <code><t:message for="someElement"></code> And I wanted to allow the user upload several files (one at a time) wit... | <p>The <em>forceId</em> attribute of the tomahawk components should solve this problem.</p>
<p>something like:</p>
<pre><code>&lt;t:outputText id="xyz" forceId="true" value="#{mybean.stuff}"/&gt;
</code></pre>
<p>At the first view of the page, if you press the "CREATE TICKET" button with nothing in any of th... | <p>The <em>forceId</em> attribute of the tomahawk components should solve this problem.</p>
<p>something like:</p>
<pre><code>&lt;t:outputText id="xyz" forceId="true" value="#{mybean.stuff}"/&gt;
</code></pre>
<p>At the first view of the page, if you press the "CREATE TICKET" button with nothing in any of th... | 9,247 |
<p>I'm using Marlin 1.1.0RC8 to control an MPCNC, using a RAMPS1.4. We've just added a touch-plate to do Z-probing, which works nicely for a single probe (I just want calibrated height for variant bit-lengths, not bed-leveling, but I think it amounts to the same thing). I've set it up in Marlin as <em>FIX_MOUNTED_PROBE... | <p>I believe <code>G30</code> is a carry-over from CNC (G-code originated for CNC not printers)
I believe it is for going to a secondary reference (home) position and includes an optional by-way-of address that can be included in the command.</p>
<p>Looking at Marlin 1.1.0-1 (latest release), it seems to do what you s... | <p>I’ve recently had a need to use Z-probe touch
plate on my MPCNC + Ramps 1.4 + Marlin 1.1.5 setup.</p>
<p>Thought I’d share what ended up working for me.</p>
<p>In Marlin <code>Configuration.h</code>, I made the changes to enable Z-probe:</p>
<pre><code>#define USE_ZMIN_PLUG
#define Z_MIN_ENDSTOP_INVERTING tr... | 590 |
<p>I'm looking for a decent sort implementation for arrays in VBA. A Quicksort would be preferred. Or any other <a href="http://web.archive.org/web/20180224071555/http://www.cs.ubc.ca:80/~harrison/Java/sorting-demo.html" rel="noreferrer">sort algorithm</a> other than bubble or merge would suffice.</p>
<p>Please note t... | <p><del>Take a look <a href="http://en.allexperts.com/q/Visual-Basic-1048/string-manipulation.htm" rel="noreferrer">here</a>:</del><br>
<strong>Edit:</strong> The referenced source (allexperts.com) has since closed, but here are the relevant <a href="https://web.archive.org/web/20090629091145/http://www.allexperts.com... | <p>This is what I use to sort in memory - it can easily be expanded to sort an array.</p>
<pre><code>Sub sortlist()
Dim xarr As Variant
Dim yarr As Variant
Dim zarr As Variant
xarr = Sheets("sheet").Range("sing col range")
ReDim yarr(1 To UBound(xarr), 1 To 1)
ReDim zarr(1 To UBound(xarr), 1 ... | 18,377 |
<p>How to sort list of values using only one variable?</p>
<p>EDIT: according to @Igor's comment, I retitled the question.</p>
| <h2>A solution in C:</h2>
<pre><code>#include <stdio.h>
int main()
{
int list[]={4,7,2,4,1,10,3};
int n; // the one int variable
startsort:
for (n=0; n< sizeof(list)/sizeof(int)-1; ++n)
if (list[n] > list[n+1]) {
list[n] ^= list[n+1];
list[n+1] ^= list[... | <p>You dont, it is already sorted. (as the question is vague, I shall assume variable is a synonym for an object) </p>
| 16,069 |
<p>I am designing a WCF service which a client will call to get a list of GUID's from a server.</p>
<p>How should I define my endpoint contract?</p>
<p>Should I just return an Array? </p>
<p>If so, will the array just be serialized by WCF?</p>
| <p>The Guids, if you're going for SOA oriented services, will need to be set as strings. The client will be responsible for turning them back into whatever. As for the listing of the Guids, they'd be returned as an array. If you have a contract with a regular Generics List Object of Guids like this</p>
<pre><code>[Dat... | <p>If the client app has enough stuff to call web services, why not create the UUIDs locally using a built-in API?</p>
| 34,470 |
<p>If I want to use the validation framework that you can use with ASP.NET MVC, will the JavaScript conflict with other JavaScript frameworks like jQuery or YUI?</p>
| <p>No, it will not. Currently, ASP.NET MVC doesn't have an inherent validation framework. So you are free to use any server/client-side validation framework you wish.</p>
| <p>There are many MVC frameworks. There are many JavaScript frameworks that have different functionalities. If you want a meaningful answer, you should choose an MVC and a JavaScript framework and ask concerning those two. Please be as detailed as possible in your questions.</p>
<p>As an example, the validation handli... | 9,087 |
<p>I'm considering integrating some D3D code I have with WPF via the new D3DImage as described
<a href="http://www.codeproject.com/KB/WPF/D3DImage.aspx" rel="nofollow noreferrer">here:</a></p>
<p>My question is this: Do pixel shader's work on offscreen surfaces?</p>
| <p>Rendering to an offscreen surface is generally less constrained than rendering directly to a back buffer. The only constraints that come with using an offscreen surface with D3DImage is that it must be in a 32-bit RGB/ARGB format (depending on your platform). Other than that, all that the hardware has to offer is at... | <p>For some effects rendering to a different surface is required - glass refraction in front of a shader-rendered scene for example. Pixel shaders cannot access the current screen contents and so the view has to be first rendered to a buffer and then used as a texture in the refraction shader pass so that it can take t... | 26,668 |
<p>In Bash I'm executing a command and putting the result in a variable like this:</p>
<pre>export var=`svn ls`</pre>
<p>But if SVN fails for some reason--say it returns a non-zero error code--export still returns status code 0. How do I detect if the executed command fails?</p>
| <pre><code>var=`svn ls`
if [[ $? == 0 ]]
then
export var
else
unset var
fi
</code></pre>
<p><code>$?</code> is the exit code of the last command executed, which is <code>svn ls</code> here.</p>
<p>jmohr's solution is short and sweet. Adapted mildly,</p>
<pre><code>var=`svn ls` && export var ... | <pre><code>export FOO=$(your-command) || echo "your-command failed"
</code></pre>
| 30,769 |
<p>I need to create reports in a C# .NET Windows app. I've got an SQL Server 2005 .I want to display two more field to report(not available in data base table. I want to create these field by adding some data from existing field of data base table)</p>
| <p>If you look at the .NET API exposed by Crystal Reports, you'll find that you can inject a DataSet into a report - this gives your application full control over the data used by the report, leveraging Crystal Reports as a presentation engine.</p>
<p>I've used this technique to generate reports over data soures not n... | <p>You could use a crystal function also for this. Depending on how complex the calculation is from Column A to B. The more complex the easier it becomes just to do what Bevan says and change the dataset.</p>
<p>If you were more specific i might be able to give you some example code.</p>
| 28,789 |
<p>I bought an Ender 3 two days ago and assembled it today. I think I did it properly, tested the movement of all axes which works for all axes. Then I performed the calibration as described in the manual. I used a piece of paper and adjusted the bed until it barely fits underneath the nozzle for all four corners. Afte... | <p>I am a fairly new user of an Ender 3 and had similar issues on a couple of occasions.</p>
<p>The main reason was as @0scar suggested - the nozzle was too close to the build plate preventing the filament from exiting - and the back-pressure was causing the filament to jump back, giving the extruder a "shudder" as it... | <p>I use Cura on my Anycubic Chiron which I encountered a similar problem with and I was able to resolve the issue by preheating the nozzle to a higher temp. I would test the nozzle and make sure it is feeding properly. What I mean by that is load the filament manually and make sure it comes out. Reason I say this is b... | 1,537 |
<p>Are there any tools you would recommend for site architecture design and analysis? I've checked out several such as Poseidon UML, Adalon and FuseBuilder for ColdFusion, Mindmapper and a few others but have yet to find anything that seems to strike the right balance between allowing for quick high-level planning (as... | <p>My fantasy modeling tool would</p>
<ul>
<li>Be 'smart board' enabled
<ul>
<li>Recording White Board</li>
<li>Act as a "pointing device" for whatever software is behind it to allow drawing/highlighting</li>
<li>OCR</li>
</ul></li>
<li>Record Stories, as easily as 3x5 cards</li>
<li>Allow Use Case walk-throughs with... | <p>Anne, as of right now, I typically use Visio, althought that is not a great tool for doing things quick and easy, as it is a pain to use for the most part.</p>
<p>I dont know if you are interested but there is a preview coming out soon for Visual Studio 2010 that should contain some "Oslo" bits that will help in b... | 31,766 |
<p>Up till now all my programming experience has been desktop development (mostly C/C++ with OpenGL/DirectX) but I'm interested in trying my hand at some web dev.</p>
<p>The two directions I'm considering are Ruby on Rails and ASP.net. </p>
<p>Which is most widely used?</p>
<p>Which would be a more marketable skill... | <p>PHP, Ruby On Rails, ASP.Net, or Java.</p>
<p>It's a religious choce and it depends on who you ask.</p>
<p>Everyone you ask will give you a different answer.</p>
<p>You should ask yourself how you want to work, PHP java and ASP all let you write markup that is interspersed with code or code that writes the markup ... | <p>.NET platform, without a doubt.</p>
<p>Pick up RoR as a secondary.</p>
| 36,255 |
<p>How do I in SQL Server 2005 use the DateAdd function to add a day to a date</p>
| <p>Use the following function:</p>
<pre><code>DATEADD(type, value, date)
</code></pre>
<ul>
<li><p><strong>date</strong> is the date you want to manipulate</p>
</li>
<li><p><strong>value</strong> is the integere value you want to add (or subtract if you provide a negative number)</p>
</li>
<li><p><strong>type</strong> ... | <pre><code>DECLARE @date DateTime
SET @date = GetDate()
SET @date = DateAdd(day, 1, @date)
SELECT @date
</code></pre>
| 20,230 |
<p>I'm looking for somthing I can use as a timeline control.
A kind of "banner" the user can drag to the left or the right to go forward or backwards
in time and then he or she should be able to select a point in time on that control.</p>
<p>A fancy datetime picker :-)</p>
<p>Any ideas?</p>
| <p>Try this one also <a href="http://timeline.codeplex.com" rel="noreferrer">http://timeline.codeplex.com</a></p>
| <p>There is a datetime picker and month calendar on the <a href="http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=15598" rel="nofollow noreferrer">WPF Toolkit</a>. </p>
| 43,293 |
<p>I see a number of people writing "CURA", when I have always called it "Cura". So I started to wonder if CURA was a <em>capitalised</em> acronym, like LiDAR or NATO (but not like radar or laser).</p>
<p>I had a look and the Wikipedia entry, <a href="https://en.wikipedia.org/wiki/Cura_(software)" rel="nofollow norefe... | <p>As of version 4 the splash screen has changed, also the branding/naming of the product throughout Ultimaker's website.</p>
<p><a href="https://i.stack.imgur.com/1eX3U.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1eX3U.png" alt="enter image description here" /></a></p>
<p>Technically it is not <... | <p>Actually, it's neither:</p>
<p><a href="https://i.stack.imgur.com/H7bOQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H7bOQ.png" alt="enter image description here"></a></p>
<p>If you wanna believe this image, it's: Ultimaker <strong>cura</strong> ... all lower case.</p>
| 55 |
<p>I ask this because at work I am supposed to develop a web-application that is used in an intranet, by two people. It's an application that should keep some states in a workflow. So I have to keep data in a session and have to care about concurrency. It would be so much easier to develop a normal desktop-applicatio... | <p>Your point in general is false: web applications aren't more popular than local applications.</p>
<p>In <strong>your specific case</strong>, the client probably wants to take advantage of these things:</p>
<ul>
<li>seamless upgrades</li>
<li>availability from any machine without you having to install client softwa... | <p>Web based applications are not more popular with application users. </p>
<p>But application users often don't pay for their own software. </p>
<p>Software buyers don't make decisions based on technical merits.</p>
| 37,115 |
<p>We frequently have users that create multiple accounts and then end up storing the same lesson activity data more than once. Once they realize the error, then they contact us to merge the accounts into a single one that they can use. </p>
<p>I've been beating myself to death trying to figure out how to write a quer... | <p>Attempting to merge this data via last/first is a horrible idea, the more users you have, the more likely you are to mesh up incorrect entries. You have IDs on your tables for a reason, use them.</p>
<p>I don't see any reason why you can't say "I want to merge user 7 into 12" and then do the following:</p>
<pre><... | <p>How about this, assuming we are merging user_id 2 into 1.</p>
<p>This updates the lessons done under 2 that have not been done under 1.</p>
<pre><code>UPDATE lessonstatus_rtab
SET user_id = 1
WHERE user_id = 2
AND NOT EXISTS
(SELECT *
FROM lessonstatus_rtab e
WHERE e.lesson_id = lessonstatus_rtab.lesson_id
AND ... | 33,967 |
<p>A rather comprehensive site explaining the difficulties and solutions involved in using a dll written in c/c++ and the conversion of the .h header file to delphi/pascal was posted to a mailing list I was on recently, so I thought I'd share it, and invite others to post other useful resources for this, whether they b... | <p>Over at <a href="http://rvelthuis.de/index.html" rel="nofollow noreferrer">Rudy's Delphi Corner</a>, he has an <a href="http://rvelthuis.de/articles/articles-convert.html" rel="nofollow noreferrer">excellent article about the pitfalls of converting C/C++ to Delphi</a>. In my opinion, this is essential information wh... | <p><a href="http://www.drbob42.com/headconv/" rel="nofollow noreferrer">HeadConv</a> from DrBob is used quite a lot too, although I concur with Graza that manual translation is best.</p>
| 12,586 |
<p>When creating an auto updating feature for a .NET WinForms application, how does it update the DLLs and not affect the currently running application?</p>
<p>Since the application is running during the update process, won't there be a lock on the DLLs (because those DLLs will have to be overwritten during the update... | <p>Usually you would download the new files into a separate area. Then shutdown and restart and at startup you look for and use the new files if found. Always keeping a last known working version on the side so that the user can revert to something that definitely works if the download causes problems.</p>
<p>ClickOnc... | <p>These days Windows can do such updates automatically for you with AppInstaller if your app is packaged in the MSIX package.</p>
<p>It downloads the new version of the app in another folder inside <code>ProgramFiles\WindowsApps</code>, then when a user runs the app via the start menu, the system knows what folder it ... | 16,853 |
<p>Winforms c# application running on terminal server. All images for buttons and menu items are stored as resources in the .resx file. After some heavy use, opening and closing windows while using the system, an "index out of range" exception is thrown and the window no longer opens. If the user attempts to navigat... | <p>It is strange that you receive an out-of-range exception when accessing resources, mainly because the resources are not stored in any kind of collection, there are accessed as properties, so perhaps your exception does not come from there?</p>
<p>Plz provide some code about the way you are retrieving the images/but... | <p>Are you releasing the resources after you use them? It sounds like you're running out of resource handles (and the exception you're seeing may be a red herring).</p>
| 42,392 |
<p>One of my hobby applications uses a SQLite back end to store the application data. The application is setup so that the user can click the typical "Check for Updates" button, which will query a webservice to see if an update is available. If it is, the user clicks the "update" button and downloads a the new database... | <p>If you are only running on MS Windows, and your clients are using a new enough version of the operating system to support BITS, then I think certainly you should leverage the functionality already built into the platform, rather than doing what everyone else does and write your own background update checker that sit... | <p>This really feels like you should be considering Sync Framework <a href="http://msdn.microsoft.com/en-us/sync/bb736753.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/sync/bb736753.aspx</a> rather than BITS.</p>
| 38,864 |
<p>The GNU Scientific library has a <a href="http://www.gnu.org/software/gsl/manual/html_node/Multidimensional-Minimization.html" rel="nofollow noreferrer">multi-dimensional function minimization</a> framework. However, its caveats explicitly says that when used on a function with several different local minima it just... | <p>It's not based on GNU Scientific, but I found this algorithm for finding all local minima: http://www.cs.uoi.gr/~lagaris/papers/MINF.pdf </p>
| <p>It turns out Particle swarm optimization method is not a bad option for the task of finding all local minimums and global minimum of a function. Codes <a href="https://github.com/saunter999/PSO" rel="nofollow noreferrer">PSO to find local minimum</a> <a href="https://github.com/saunter999/Global-optimization-" rel="... | 26,011 |
<p>We're doing an "Amazing Race" kind of event, and thought it would be cool to have CDs that could only play once... like a "this message will self destruct in 5 seconds..." </p>
<p>Any thoughts on how to do this? I was thinking it could be a compiled HTML website that would write a cookie and only play once. I don... | <p>If the content is HTML and run inside a normal browser window, then a cookie may work but there are caveats:</p>
<ul>
<li>User runs the CD once when IE is the default browser. User runs at a later time, when Firefox is the default browser so cookie cannot be checked.</li>
<li>The browser's security settings may be ... | <p>Not quite what you're looking for, but you could put in on re-writable media and have an executable over-write itself (or part of itself).</p>
<p>I don't know if a CD-RW could do that automatically, or if you would have to look at cheap USB sticks.</p>
| 6,366 |
<p>I'm trying to build about 600 projects some are .net 2.0, some are 3.5. I'm using Windows 2003 Enterprise Edition 32 bit with all the latest windows updates.</p>
<p>Builds fine when maxcpucount is 1. If I bump it up to try and improve performance it get reference errors. When I look at the project references fro... | <p>In order for MSBuild to run with multiple cores/cpus, it needs to be able to determine beforehand what all of the dependencies are. Generally this means you either need to have all of your projects in a single <em>huge</em> solution and set up all of your references to be project references or set up multiple soluti... | <p>I could be quite late and you might have solved this problem. But I was stuck with the same error and found that it was due to the path length of one of my projects being too large.
Please see <a href="http://hamidshahid.blogspot.com/2010/04/missing-reference-name-while-building.html" rel="nofollow noreferrer">here... | 47,244 |
<p>I am writing a Jython script to sort a list of URLs.</p>
<p>I have a list that looks like this:</p>
<p><a href="http://www.domain.com/folder1/folder2/|,1" rel="nofollow noreferrer">http://www.domain.com/folder1/folder2/|,1</a><br />
<a href="http://www.domain.com/folder1/|,1" rel="nofollow noreferrer">http://www.d... | <p>Sort-by-length, using a sort function:</p>
<pre><code>urls.sort(lambda a, b: cmp(len(a), len(b)))
</code></pre>
<p>For performance, some might prefer the decorate-sort-undecorate pattern:</p>
<pre><code>urllengths= [(len(url), url) for url in urls]
urllengths.sort()
urls= [url for (l, url) in urllengths]
</code><... | <p>Wouldn't sorting them take care of this?</p>
| 31,057 |
<p>Given Microsoft FORTRAN 5.1 and Microsoft C/C++ 14.0, along with the linker that comes with that version of FORTRAN (that must be used for other dependencies) how do I create a C function and call it from the FORTRAN application? </p>
| <p>There's an article on MSDN with sample code here: <a href="http://msdn.microsoft.com/en-us/library/aa279034(VS.60).aspx" rel="nofollow noreferrer">FORTRAN calls to C</a></p>
| <p>Maybe better late than never.
I remember using ms fortran 5.1 with visual studio 1. I am not sure which visual studio 14.0 is equivalent to but I think it is relatively recent and not 13 years old.
I think this combination is a non starter as 5.1 is a 16bit compiler for windows 3.</p>
| 46,137 |
<p>I am trying to <code>INSERT INTO</code> a table using the input from another table. Although this is entirely feasible for many database engines, I always seem to struggle to remember the correct syntax for the <code>SQL</code> engine of the day (<a href="http://en.wikipedia.org/wiki/MySQL" rel="noreferrer">MySQL</a... | <p>Try:</p>
<pre><code>INSERT INTO table1 ( column1 )
SELECT col1
FROM table2
</code></pre>
<p>This is standard ANSI SQL and should work on any DBMS</p>
<p>It definitely works for:</p>
<ul>
<li>Oracle</li>
<li>MS SQL Server</li>
<li>MySQL</li>
<li>Postgres</li>
<li>SQLite v3</li>
<li>Teradata</li>
<li>DB2</li>
<l... | <p>In informix it works as Claude said:</p>
<pre><code>INSERT INTO table (column1, column2)
VALUES (value1, value2);
</code></pre>
| 4,553 |
<p>How do I find the start of the week (both Sunday and Monday) knowing just the current time in C#?</p>
<p>Something like:</p>
<pre><code>DateTime.Now.StartWeek(Monday);
</code></pre>
| <p>Use an extension method:</p>
<pre><code>public static class DateTimeExtensions
{
public static DateTime StartOfWeek(this DateTime dt, DayOfWeek startOfWeek)
{
int diff = (7 + (dt.DayOfWeek - startOfWeek)) % 7;
return dt.AddDays(-1 * diff).Date;
}
}
</code></pre>
<p>Which can be used as fo... | <pre><code>public static System.DateTime getstartweek()
{
System.DateTime dt = System.DateTime.Now;
System.DayOfWeek dmon = System.DayOfWeek.Monday;
int span = dt.DayOfWeek - dmon;
dt = dt.AddDays(-span);
return dt;
}
</code></pre>
| 5,897 |
<p>I'm writing a GreaseMonkey script where I'm iterating through a bunch of elements. For each element, I need a string ID that I can use to reference that element later. The element itself doesn't have an <code>id</code> attribute, and I can't modify the original document to give it one (although I can make DOM change... | <p><strong>UPDATE:</strong> Closures are indeed the answer. So after fiddling with it some more, I figured out why closures were initially problematic and how to fix it. The tricky thing with a closure is you have to be careful when iterating through the elements not to end up with all of your closures referencing the ... | <p>In javascript, you could attach a custom ID field to the node</p>
<pre><code>if(node.id) {
node.myId = node.id;
} else {
node.myId = createId();
}
// store myId
</code></pre>
<p>It's a bit of hack, but it'll give each and every node an id you can use. Of course, <code>document.getElementById()</code> won't pa... | 28,036 |
<p>Since a lot of email clients ignore the HEAD tag, can I embed an inline stylesheet in the body?</p>
| <p>The short answer is no. Gmail strips the tag and it's content.</p>
<p>Hotmail, Yahoo! Mail and Windows Live Mail does not strip style-tags in the body-element.</p>
<p>But take a look at <a href="http://www.campaignmonitor.com/css/" rel="noreferrer">"The Ultimate Guide to CSS" for HTML email</a> over at Campaign Mo... | <p>As others have pointed out, the accepted answer is out of date.</p>
<p>In my own tests, as of <strong>8/20/2022</strong>, Gmail supports elements with classes, and the use of the <code><style></code> tag, as long as it is in the <code><head></code>. Also, Gmail no longer strips out inline classes for el... | 27,916 |
<p>last time I asked how to populate a data structure <a href="https://stackoverflow.com/questions/144474/java-arrays-vectors">here</a>. Now I would like to know if there's something in Java, like the <a href="http://www.php.net/print_r" rel="nofollow noreferrer">print_r</a> I use in PHP, to represent what I have popul... | <p>Calling <code>toString</code> on the collection should return a string containing all the elements string representations.</p>
<p>This won't work with built-in arrays though, as they don't have a <code>toString</code> override and will just give you a memory address.</p>
| <p>I don't know of an equivalent of print_r in java.</p>
<p>But...</p>
<p>Every object has a default implementation of the toString() method, the list and map implementations print their contents if you call toString() for them.</p>
<p>If you need any debug information printed out, toString() may be the place you ar... | 17,860 |
<p>Does anybody know a good and free add-in for Visual Studio 2005 to get refactoring features in VB?</p>
| <p>The default answer to this one is probably <a href="http://msdn.microsoft.com/en-us/vbasic/bb693327.aspx" rel="nofollow noreferrer"><em>Refactor!</em></a> since this tool is also endorsed by Microsoft as the “official” VB refactoring addin. However, being a free tool, it comes nowhere near the power of other commerc... | <p>I must also add that you have to be carefull with Resharper for VB and especially for the 2005 version (R# 3.1). The VB version of Resharper is far less complete then the C# version and especially in the 2005 version. In the 2008 version (R# 4.1) the difference is quit a bit smaller. But still not the same. </p>
| 24,453 |
<p>I have a GridView defined like this:</p>
<pre><code><asp:GridView ID="myGridView" ruant="server">
<asp:BoundField DataField="myField" />
<asp:CommandField ShowDeleteButton="true" ShowEditButton="true" />
</asp:GridView>
</code></pre>
<p>After I put a row into edit mode with the Edit... | <p>Well, using the knowledge from the question you linked, it's simple:</p>
<pre><code>string js = "if (event.keyCode == 13) this.form.submit();"
myGridView.Attributes.Add("onkeydown", js);
</code></pre>
<p>As we found out in the comments, this introduces a small problem. The <code>GridView_RowUpdating</code> server ... | <p>Set "UseSubmitBehavior" property of buttons on the page to "False" (default is True)
solves the submit issue in several comments.</p>
| 32,287 |
<p>I would like to have some kind of catch-all exceptions mechanism in the root of my code, so when an app terminates unexpectedly I can still provide some useful logging.</p>
<p>Something along the lines of</p>
<pre><code>static void Main () {
if (Debugger.IsAttached)
RunApp();
else {
try {
... | <p>As Paul Betts already mentioned, you might be better off using the <a href="http://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception.aspx" rel="nofollow noreferrer">AppDomain.UnhandledException</a> event instead of a try/catch block.</p>
<p>In your UnhandledException event handler you can log/dis... | <p>Shouldn't simply do a</p>
<pre><code>Exception e1 = e;
LogException(e);
throw(e1);
</code></pre>
<p>inside the catch do the trick (at least you can examine the outer exception)?</p>
| 26,010 |
<p>Usecase: The user makes font customizations to an object on the design surface, that I need to load/save to my datastore. I.e. settings like Bold, Italics, Size, Font Name need to persisted.</p>
<p>Is there some easy (and reliable) mechanism to convert/read back from a string representation of the font object (in w... | <p>Use <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.typeconverter.aspx" rel="noreferrer">TypeConverter</a>:</p>
<pre><code>Font font = new Font("Arial", 12, GraphicsUnit.Pixel);
TypeConverter converter = TypeDescriptor.GetConverter(typeof (Font));
string fontStr = converter.ConvertToInvaria... | <p>What type of datastore do you need to persist this in? If it is just user settings that can be persisted in a file you could serialise the font object to a settings file in either binary or xml (if you want to be able to edit the config file directly). The serialisation namespaces (System.Xml.Serialization and Syste... | 14,454 |
<p>I'm not that up on VB.NET, the application I'm working on was not written by myself.<br>
It works fine through the IDE but once I run it from the exe it gives me the above error.</p>
<p>Any clues?</p>
<p>This is really hacking me off!</p>
| <p>The only user defined break point that I can think of is</p>
<pre><code>Debugger.Break()
</code></pre>
<p>So, I would suspect that the .exe is compiled in debug mode. I would recommend <a href="http://www.red-gate.com/products/reflector/index.htm" rel="noreferrer">Reflector</a> to look at the code and find out fo... | <p>I believe the exe file was compiled using the "Debug" setting. Try changing the Build setting to Release and do a full build (rebuild) of the project. Then try to run the executable file. It should then run normally.</p>
<p>The reason you see that error is because when you normally compile and run applications in V... | 15,889 |
<p>earlier today someone asked about free/cheap component libraries for winforms. I'm interested in the same thing, but for asp.net. There are some great commercial libraries like Telerik and DevExpress, but are there any great free/cheap alternatives?</p>
| <p>I am not sure what you constitute as cheap, but the Peter Blum ASP.NET controls are a good buy.</p>
<p><a href="http://www.peterblum.com/Home.aspx" rel="nofollow noreferrer">peterblum.com</a></p>
| <p>Try this free custom web controls : <a href="http://www.eworldui.net/" rel="nofollow noreferrer">Excentrics World .NET</a></p>
| 8,458 |
<p><a href="http://en.wikipedia.org/wiki/LAMP_(software_bundle)" rel="noreferrer">LAMP</a> is a well-known acronym for the software/technology bundle/stack representing <a href="http://en.wikipedia.org/wiki/Linux" rel="noreferrer">Linux</a>, <a href="http://www.apache.org/" rel="noreferrer">Apache</a>, <a href="http://... | <p>Or WISA:
Windows, IIS, SQL Server, ASP.net</p>
<p>I don't know why anyone would want to call it WISC, as these people are essentially saying "We will never ever use VB.NET, IronPython, IronRuby, F# or any other .NET Language". Also calling it .NET (WISN) sounds a bit weird as well, since ASP.NET is the Web-Technolo... | <p>If you're asking for something more-or-less like LAMP except it runs on Windows,
I usually see</p>
<ul>
<li>WAMP (Windows, Apache, MySQL and PHP)</li>
<li>WIMP (MS Windows; MS IIS (Internet Information Services); MySQL,
MS SQL Server or MS Access; PHP, Perl, or Python).</li>
</ul>
<p>On a completely unrelated topi... | 21,438 |
<p>I'm using Windows CE Platform Builder and my code is written in C++ . For each of the folders in the project I'm creating a lib ( the code is statically linked ) . However , there are about 20 libs so far . Is there a way to reduce their number ? I was thinking of creating a lib from other libs , but I don't know if... | <p>I haven't tried it in a while, but traditionally you could use the librarian tool (LIB.EXE) to do this sort of thing.</p>
<pre>
$ lib /?
Microsoft (R) Library Manager Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
usage: LIB [options] [files]
options:
/DEF[:filename]
... | <p>as mentionet above, lib.exe can really merge a couple of lib files into one library, just put lib files into command line instead of obj files. few seconds ago i've tried it with a fortran lib and a c lib - everything works perfect </p>
| 33,291 |
<p>In simulator mode, my app has an icon with round corners, but on a real iPhone, the corners aren't rounded.</p>
| <p>Corners get automatically rounded if you install via MobileInstallation (from iTunes, Xcode or App Store).
If you're building the package and installing it into /Applications manually or with cydia/apt, you have to make a rounded icon yourself.</p>
<p>You can find the images used to round the corners and add reflec... | <p>by default the iPhone should round your corners and add a reflection effect. Be sure you have not added the UIPrerenderedIcon key to your Info.plist file. Hope this helps!</p>
<p>Adam</p>
| 32,895 |
<p>What is the main difference between an inner class and a static nested class in Java? Does design / implementation play a role in choosing one of these?</p>
| <p>From the <a href="http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html" rel="noreferrer">Java Tutorial</a>:</p>
<blockquote>
<p>Nested classes are divided into two categories: static and non-static. Nested classes that are declared static are simply called static nested classes. Non-static nested class... | <p>The difference is that a nested class declaration that is also static can be instantiated outside of the enclosing class.</p>
<p>When you have a nested class declaration that is <em>not</em> static, also known as an <em>inner class</em>, Java won't let you instantiate it except via the enclosing class. The object c... | 9,569 |
<p>I am working on a SQL query that reads from a SQLServer database to produce an extract file. One of the requirements to remove the leading zeroes from a particular field, which is a simple <code>VARCHAR(10)</code> field. So, for example, if the field contains '00001A', the SELECT statement needs to return the data ... | <pre><code>select substring(ColumnName, patindex('%[^0]%',ColumnName), 10)
</code></pre>
| <p>To remove the leading 0 from month following statement will definitely work.</p>
<pre><code>SELECT replace(left(Convert(nvarchar,GETDATE(),101),2),'0','')+RIGHT(Convert(nvarchar,GETDATE(),101),8)
</code></pre>
<p>Just Replace <code>GETDATE()</code> with the date field of your Table.</p>
| 11,762 |
<p>How to convey a bad news to the client?</p>
| <p>When something has gone wrong the client needs to know three things:</p>
<ol>
<li>precisely what is wrong</li>
<li>what the impact is on them</li>
<li>what you are going to do about it</li>
</ol>
<p>If you are not completely honest and transparent you will get found out later and will compound the trouble.</p>
<p... | <p>In addition to being honest and straight-forward about it, equally important is how you convey the news. A simple statement of "you are doomed" may be honest but improper. It is important that the customer be told all the due deligence been done by you, what (if any) are the options or workarounds available to him a... | 28,352 |
<p>I'm familiar with TDD and use it in both my workplace and my home-brewed web applications. However, every time I have used TDD in a web application, I have had the luxury of having full access to the web server. That means that I can update the server then run my unit tests directly from the server. My question i... | <p>I think I probably would have to argue that running unit tests on your production server isn't really part of TDD because by the time you deploy to your production environment technically speaking, you're past "development".</p>
<p>I'm quite a stickler for TDD, and when I'm preaching the benefits to clients I often... | <p>I've written test tools for sites using python and httplib/urllib2 generally it would have been overkill but it was suitable in these cases. Not sure it's going to be of general use though.</p>
| 4,087 |
<p>I have created a console application that calls a method on a webservice.
I have accessed the webservice and get the response back from the console application that I expect.
When I create a separate test assembly and create some nunit tests which call the same method in the same way i get the following exception:-<... | <p>Yes, make sure you add an app.config file to the unit test project and add the same settings you have in the console application's config file to it.</p>
<p>Good luck!</p>
| <p>I had the same issue, however when opening the test project .NET dll directly in NUnit, the test(s) would succeed, but if I then saved the test as a project in NUnit, it would then go back to the above error!</p>
<p>The fix for me was to save the test as an NUnit project, then select from the menu 'Project=>Edit...... | 41,613 |
<p>If the same Silverlight application is running in two web browser tabs, does each tab use a separate application domain?</p>
<p>If you know where Microsoft explicitly provides this information, please include a reference.</p>
| <p>Not direct from Microsoft, but one AppDomain per Silverlight instance:</p>
<ul>
<li><a href="http://community.irritatedvowel.com/blogs/pete_browns_blog/archive/2007/11/07/How-Silverlight-is-Loaded-and-Instantiated.aspx" rel="nofollow noreferrer">http://community.irritatedvowel.com/blogs/pete_browns_blog/archive/200... | <p>The browser is completely in control of the tabs, and should keep them separate for obvious security reasons.</p>
| 41,682 |
<p>By this, I don't mean PC-based development environments (like Visual Studio) for developing and deploying Windows Mobile applications. Rather, I mean an IDE that runs on Windows Mobile devices and lets you write and test code there.</p>
| <p>Over the past year or so I have been searching regularly for new developer tools for use on Windows Mobile based devices and have come across many. I currently have installed on my device <a href="http://pythonce.sourceforge.net/" rel="nofollow noreferrer">PythonCE</a>, <a href="http://www.evolane.com/software/etcl/... | <p>You could try Basic4PPC (www.basic4ppc.com).</p>
<p>It's a great programming-enviroment (based on the NET framework) with a very active and numerous user-community. There is also a version of the IDE which can be used on the device.</p>
<p>Rgds,
Moster67</p>
| 34,712 |
<p>I've been trying to get something decent printed for days but nothing works! I have a Tarantula Tevo i3 <code>MKS Base V1.4</code> and have done a lot of trial & plenty of error. Still I am puzzled to get good prints.</p>
<ol>
<li>What is the stock firmware for a single extruder regular/large bed firmware &... | <h2>Answer for <strong>"2)"</strong>:</h2>
<p>The default firmware seems to be Repetier. It also includes Bed leveling (see documentation):
<a href="https://www.repetier.com/documentation/repetier-firmware/z-probing/" rel="nofollow noreferrer">https://www.repetier.com/documentation/repetier-firmware/z-probing/</a></p>... | <p>Tevo Tarantula i3 owners on FaceBook is where I got marlin 2.0. Other things I tried didn't work, but this is working fine if you just want to add auto bed leveling using the standard SN04 sensor.</p>
| 686 |
<p>When I hire developers for general mid-to-senior web app development positions, I generally expect them to understand core concurrent programming concepts such as liveness vs. safety, race conditions, thread synchronization and deadlocks. I'm not sure whether to consider topics like fork/join, wait/notify, lock orde... | <p>I tend to think that at this point in time concurrent programming at any serious level of depth is still a specialist skill. Many will claim to know about it through study, but many will also make an almighty mess of it when they come to apply it.</p>
<p>In addition to the considerations listed, I would also look ... | <p>I know all these topics, but I studied them. I also know many competent senior programmers that don't know these. So unless you expect these programmers to be using those concepts actively, there is no reason to turn down a perfectly good candidate because they don't understand every aspect of concurrency</p>
| 48,879 |
<p>For my web service component, I need to generate a relatively large XML (~500 lines) according to many factors. I am facing a few different choices here:
1. StringBuilder
2. XmlWriter class
3. C# object with serialization???</p>
<p>Which one should I use. Is there any other ways that I am not aware of?</p>
| <p>If you populate the XML with data from database, you can generate the whole XML by using SQL query and create a class with a property holds the XML blob. The property type can be XElement. This is the easiest I can think of.</p>
| <p>Need more info, but I would not use Object serialization. It's quite rigid and hides too much of the implementation. Especially when consumed by somebody other than your own application. I would also not use a StringBuilder because all of a sudden you are handling the escaping of content and doing all the hard and e... | 30,362 |
<p>I am putting together a SVN demonstration using a WinXP Virtual PC image, and am unable to see my host machine from within the VPC guest OS.</p>
<p>This demo will be performed while disconnected from our LAN, so I installed the Microsoft Loopback adapter on my laptop. In the TCP/IP settings I manually set the IP a... | <p>So your host machine's loopback is set to 192.168.3.1 (subnet 255.255.255.0, gateway 192.168.3.1) and your VM's network adapter is set to 192.168.3.2 (subnet 255.255.255.0, gateway 192.168.3.1)? They should be able to see each other, there's not much else to this setup.</p>
<p>I'd shake things up:</p>
<ul>
<li>In... | <p>Just make sure that firewalls are off the only reason not able to ping Microsoft loop back adapter is some antivirus software is obsolete so make It updated or else just remove it from add/remove programs then go to control panel and select firewall just make sure firewall should be in off then only we can ping from... | 24,073 |
<p>I've never developed a web application that uses distributed memory. </p>
<p>Is it common practice to run a tool such as Microsoft <a href="http://blogs.msdn.com/velocity/" rel="nofollow noreferrer">Velocity</a> on my local machine as I develop, should I run Velocity on another server as I develop, or should I just... | <p>I'm looking at using Velocity on a project as well. What I've done thus far is to write a common caching interface and a simple implementation that utilizes the standard ASP.NET caching system. This way I can program against that interface and later plug in the Velocity caching via a concrete implementation of the i... | <p>Ahh that is some good feedback. I was thinking just the same thing about writing a common caching interface so I can switch out the default caching with Velocity without any code changes.</p>
<p>Based on an article by <a href="http://weblogs.asp.net/stephenwalther/archive/2008/08/27/asp-net-mvc-tip-39-use-the-veloc... | 16,882 |
<pre><code>function a () {
return "foo";
}
a.b = function () {
return "bar";
}
function c () { };
c.prototype = a;
var d = new c();
d.b(); // returns "bar"
d(); // throws exception, d is not a function
</code></pre>
<p>Is there some way for <code>d</code> to be a function, and yet still inherit properties f... | <p>Actually, it turns out that this <strong>is possible</strong>, albeit in a <strong>non-standard</strong> way.</p>
<p>Mozilla, Webkit, Blink/V8, Rhino and ActionScript provide a non-standard <strong><code>__proto__</code></strong> property, which allow changing the prototype of an object after it has been created. O... | <p>This is something I've been trying to do for a while now. Special thanks to the authors above for their input.</p>
<p>Here is a chained implementation of using a "callable-object":</p>
<pre><code>var $omnifarious = (function(Schema){
var fn = function f(){
console.log('ran f!!!');
return f;
... | 44,227 |
<p>I have tried</p>
<pre><code><ul id="contact_list">
<li id="phone">Local 604-555-5555</li>
<li id="i18l_phone">Toll-Free 1-800-555-5555</li>
</ul>
</code></pre>
<p>with</p>
<pre><code>#contact_list
{
list-style: disc none inside;
}
#contact_list #phone
{
list-st... | <p>Try this:</p>
<pre><code>#contact_list li
{
list-style: none;
}
#contact_list li#phone
{
list-style-image: url('images/small_wood_phone.png');
}
#contact_list li#i18l_phone
{
list-style-image: url('images/i18l_wood_phone.png');
}
</code></pre>
| <pre><code>#contact_list
{
list-style: disc none inside;
}
#contact_list #phone
{
background-image: url(images/small_wood_phone.png) no-repeat top left;
padding-left: <image width>px;
}
#contact_list #i18l_phone
{
background-image: url(images/i18l_wood_phone.png) no-repeat top left;
padding-... | 25,776 |
<p>I'd like to write a batch file that checks to see if a process is running, and takes one action if it is, and another action if it isn't.</p>
<p>I know I can use tasklist to list all running processes, but is there a simpler way to directly check on a specific process?</p>
<p>It seems like this should work, but it... | <p>You can use "for /f" construct to analyze program output.</p>
<pre><code>set running=0
for /f "usebackq" %%T in (`tasklist /nh /fi "imagename eq firefox.exe"`) do set running=1
</code></pre>
<p>Also, it's a good idea to stick a</p>
<pre><code>setlocal EnableExtensions
</code></pre>
<p>at the begginning of your s... | <p>Some options:</p>
<ul>
<li>PsList from Microsoft</li>
</ul>
<p><a href="http://www.windowsdevcenter.com/pub/a/oreilly/windows/news/win2kcommands_0401.html#ps" rel="nofollow noreferrer">http://www.windowsdevcenter.com/pub/a/oreilly/windows/news/win2kcommands_0401.html#ps</a></p>
<ul>
<li>Cygwin (for ps)</li>
<li>t... | 38,867 |
<p>Using MySQL syntax and having a table with a row like:</p>
<pre><code>mydate DATETIME NULL,
</code></pre>
<p>Is there a way to do something like:</p>
<pre><code>... WHERE mydate<='2008-11-25';
</code></pre>
<p>I'm trying but not really getting it to work.</p>
| <p>Nevermind found an answer. Ty the same for anyone who was willing to reply.</p>
<pre><code>WHERE DATEDIFF(mydata,'2008-11-20') >=0;
</code></pre>
| <p>Your problem may be that you are dealing with DATETIME data, not just dates. If a row has a mydate that is '2008-11-25 09:30 AM', then your <em>WHERE mydate<='2008-11-25';</em> is not going to return that row. '2008-11-25' has an implied time of 00:00 (midnight), so even though the date part is the same, they ar... | 41,178 |
<p>I would like to use <code>Class.newInstance()</code> but the class I am instantiating does not have a nullary constructor. Therefore I need to be able to pass in constructor arguments. Is there a way to do this?</p>
| <pre><code>MyClass.class.getDeclaredConstructor(String.class).newInstance("HERESMYARG");
</code></pre>
<p>or</p>
<pre><code>obj.getClass().getDeclaredConstructor(String.class).newInstance("HERESMYARG");
</code></pre>
| <p>This is how I created an instance of <code>Class clazz</code> using a dynamic constructor args list.</p>
<pre><code>final Constructor constructor = clazz.getConstructors()[0];
final int constructorArgsCount = constructor.getParameterCount();
if (constructorArgsCount > 0) {
final Object[] constructorArgs = new... | 29,040 |
<ul>
<li>What rules do you use to name your variables?</li>
<li>Where are single letter vars allowed?</li>
<li>How much info do you put in the name?</li>
<li>How about for example code?</li>
<li>What are your preferred meaningless variable names? (after foo & bar)</li>
<li>Why are they spelled <a href="http://en.wi... | <pre><code>function startEditing(){
if (user.canEdit(currentDocument)){
editorControl.setEditMode(true);
setButtonDown(btnStartEditing);
}
}
</code></pre>
<p>Should read like a narrative work.</p>
| <p><strong>Updated</strong></p>
<p>First off, naming depends on existing conventions, whether from language, framework, library, or project. (When in Rome...) Example: Use the <a href="http://docs.jquery.com/JQuery_Core_Style_Guidelines" rel="nofollow noreferrer">jQuery style</a> for jQuery plugins, use the <a href="h... | 24,913 |
<p>I have a submission table that is very simple: userId, submissionGuid</p>
<p>I want to select the username (simple inner join to get it) of all the users who have more than 10 submissions in the table. </p>
<p>I would do this with embedded queries and a group by to count submissions... but is there a better way of... | <p>This is the simplest way, I believe:</p>
<pre><code>select userId
from submission
group by userId
having count(submissionGuid) > 10
</code></pre>
| <p>I think the correct query is this (SQL Server):</p>
<pre><code>SELECT s.userId, u.userName
FROM submission s INNER JOIN users u on u.userId = s.userId
GROUP BY s.userId, u.username
HAVING COUNT(submissionGuid) > 10
</code></pre>
<p>If you don't have the HAVING clause:</p>
<pre><code>SELECT u.userId, u.userN... | 18,333 |
<p>Basically I want tools which generate source code visualization like:</p>
<ul>
<li>function call graph</li>
<li>dependency graph</li>
<li>...</li>
</ul>
| <p><a href="http://www.doxygen.nl/" rel="noreferrer">Doxygen</a> is really excellent for this, although you will need to install <a href="http://www.graphviz.org/" rel="noreferrer">GraphViz</a> to get the the graphs to draw.</p>
<p>Once you've got everything installed, it's really rather simple to draw the graphs. Mak... | <p>Might be a duplication, but check out ollydbg, IDA Pro and <a href="http://www.openrce.org/" rel="nofollow noreferrer">this website</a> has a whole bunch of resources with some very sexy images.</p>
| 4,754 |
<p>I have defined a fieldset in HTML, and applied the following (simple) CSS rules to it:</p>
<pre><code>fieldset
{
margin: 2em 0;
position:relative;
padding: 1em;
border:1px solid #ccc;
}
</code></pre>
<p>Everything is great, no big deal, except in all versions (well, up to 7 as far as I know) of IE... | <p>I've struggled with this one for some time; tonight I finally found the answer.</p>
<p><a href="http://www.sitepoint.com/forums/showthread.php?t=526881" rel="nofollow noreferrer">http://www.sitepoint.com/forums/showthread.php?t=526881</a></p>
<p>To quote NatalieMac:</p>
<blockquote>
<p>Seems that if you have an... | <p>Could you post more of your code, like the HTML of what's surrounding the fieldset and the corresponding CSS rules for that?</p>
<p>You mentioned that you can see it's wider than its parent element in Firebug. That's almost certainly related. Can you change the CSS of the parent element to make it wide enough to co... | 30,878 |
<p>Some of my data are 64-bit integers. I would like to send these to a JavaScript program running on a page.</p>
<p>However, as far as I can tell, integers in most JavaScript implementations are 32-bit signed quantities.</p>
<p>My two options seem to be:</p>
<ol>
<li>Send the values as strings</li>
<li>Send the val... | <p>This seems to be less a problem with JSON and more a problem with Javascript itself. What are you planning to do with these numbers? If it's just a magic token that you need to pass back to the website later on, by all means simply use a string containing the value. If you actually have to do arithmetic on the va... | <p>JSON itself doesn't care about implementation limits.
your problem is that JS can't handle your data, not the protocol.
In other words, your JS client code has to use either of those non-perfect options.</p>
| 25,762 |
<p>I'm currently using the following SQL for retrieving the last seven days worth of entries from a table:</p>
<pre><code>purchased >= date_sub(now() ,interval 7 day)
</code></pre>
<p>However, I need to change this so it retrieves the last full weeks worth of entries (midnight Saturday to midnight Saturday). So ba... | <p>see the MySQL function <a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_yearweek" rel="nofollow noreferrer">YEARWEEK()</a>. </p>
<p>So you could do something like</p>
<pre><code>SELECT * FROM table WHERE YEARWEEK(purchased) = YEARWEEK(NOW());
</code></pre>
<p>You can change th... | <p>MySQL has a <a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_week" rel="nofollow noreferrer">WEEK()</a> function, that allows you to get the numeric week of the year from a date. You can get (the week of today) -1, and compare that to the week of your records you are filtering o... | 40,490 |
<p>I know that the following is true</p>
<pre><code>int i = 17; //binary 10001
int j = i << 1; //decimal 34, binary 100010
</code></pre>
<p>But, if you shift too far, the bits fall off the end. Where this happens is a matter of the size of integer you are working with.</p>
<p>Is there a way to perform a shift... | <p>If you know the size of type, you could do something like:</p>
<pre><code>uint i = 17;
uint j = i << 1 | i >> 31;
</code></pre>
<p>... which would perform a circular shift of a 32 bit value.</p>
<p>As a generalization to circular shift left n bits, on a b bit variable:</p>
<pre><code>/*some unsigned ... | <p>The extension methods for rotating bits of a <code>uint</code> (32 bits):</p>
<pre><code>public static uint ROR(this uint x, int nbitsShift)
=> (x >> nbitsShift) | (x << (32 - nbitsShift));
public static uint ROL(this uint x, int nbitsShift)
=> (x << nbitsShift) | (x >> (32 - n... | 5,558 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.