instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I need to provide a window on an ASP.NET MVC web page where registered users of the site can group chat live.</p>
<p>Can anyone recommend a component or control that can provide real-time group chat that I can embed on an ASP.NET MVC page?</p>
<p>I am willing to use free or commercial components, as well as a web ... | <p>All you really need is an action to post new messages to, an action to poll for updates, and a div to place the items.</p>
<p>You can accomplish all of this pretty easily with ajax and those two actions on a ChatController in ASP.NET MVC.</p>
<p>+1 for Campfire though, it's a really well polished tool.</p>
| <p>There's an unofficial developer API for Campfire called <a href="http://opensoul.org/2006/12/8/tinder-campfire-api" rel="nofollow noreferrer">Tinder</a>.</p>
<p>I saw that that 37 Signals was promoting it on their website <a href="http://www.campfirenow.com/?source=37s+home" rel="nofollow noreferrer">here</a>, so i... | 39,935 |
<p>I have a property called "IsSecureConnection" that is part of my object's interface. This makes sense for most implementations of the interface, however, in some implementations I would like to make the property ReadOnly. </p>
<p>Should I omit this property from the object's interface even though it is required b... | <p>Just add the getter in the interface.</p>
<pre><code>public interface Foo{
bool MyMinimallyReadOnlyPropertyThatCanAlsoBeReadWrite {get;}
}
</code></pre>
<p>Interfaces specify the minimum an object must implement; it doesn't say what an object cannot do. For that, you need to look into creating base classes.</p>... | <p>You need to evaluate the case. If it doesn't make sense to have it always be writeable, separate it into a second interface.</p>
<pre><code>public interface IFoo {
bool SecuredConnection{ get; }
}
public interface ISecurableOptionFoo: IFoo {
bool SecuredConnection{ get; set; }
}
</code></pre>
| 29,694 |
<p>The company I work for is wanting to add blog functionality to our website and they were looking to spend an awful amount of money to have some crap being built on top of a CMS they purchased (sitecore). I pointed them to Telligent's Community Server and we had a sales like meeting today to get the Marketing folks... | <p>I've done quite a few projects using Community Server. If you're okay with the out-of-the-box functionality, or you don't mind sticking to the version you start with, I think you'll be very happy.</p>
<p>The times I've run into headaches using CS is when the client wants functionality CS does not provide, but also ... | <p>Have you had a look at the <a href="http://trac.sitecore.net/Blog" rel="nofollow noreferrer">Shared Source blog module</a> for Sitecore?</p>
| 2,736 |
<p>does anyone know is there a way to implement Windows Live ID authentication into your ASP.NET MVC site. There is some info about OpenID implementations and it uses some libraries.
So is there a way to implement Live ID or it is not yet supported.</p>
<p>Thank you</p>
| <p>The same way you would with Memberships:
<a href="http://www.eggheadcafe.com/tutorials/aspnet/48857836-0c72-4efb-9d29-fbcb8e17ef3a/integrate-windows-live-id.aspx" rel="nofollow noreferrer">http://www.eggheadcafe.com/tutorials/aspnet/48857836-0c72-4efb-9d29-fbcb8e17ef3a/integrate-windows-live-id.aspx</a></p>
| <p>Newer information at </p>
<p>It's pretty independent of mvc or webforms I think.</p>
<p>Windows Live Messenger Connect Developer Guide
<a href="http://msdn.microsoft.com/en-us/library/hh243641.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/hh243641.aspx</a></p>
| 48,773 |
<p>I'm trying to increase adhesion of the first layer (as well as to fill gaps for a more even surface) by squeezing more material against the bed. The obvious way of doing that in Cura is by increasing the "Initial Layer Flow", i.e. to make the printer push out slightly more material than it normally would.</p>
<p>Bu... | <p>Cura option <code>Initial Layer Width</code> will cause lines to be further apart or closer together, based on the value you set with respect to the default. The required filament flow to produce these lines is calculated based on the width of the line and the overlap between lines (and layer height).</p>
<p>The Cu... | <p>The typical consensus is that you increase the layer flow initially for better adhesion, though from my experience I <strong>decrease</strong> it!<br />
My first layer is printed at between 70-75 % layer flow, this gives the best adhesion and best visuals when printing with ASA or ABS.<br />
From layer 2 on I've 105... | 1,538 |
<p>First post here, so please forgive me for any silly mistakes.</p>
<p>Recently the y-axis (I think, forward-backward) has started skipping forward when printing the first layer of my print. It prints the raft with no issues at all, sticks the bed nice and flat and the raft is perfect every time. </p>
<p>Then it sta... | <p>Layer shifting is a result of the use of open-loop control systems. This means that the printer just instructs the head to go to certain positions without checking that it actually did arrive at that position. If something happens along the path, like hitting some part of the print or the printer, the motors could l... | <p>I'm guessing that the bed in the offending corner is farther away and your raft is curling and lifting off the bed in that corner, and your nozzle it hitting it. Try releveling your bed, paying particular close attention to that corner. In addition, work on bed adhesion in general. Clean the bed, make sure fan is of... | 1,116 |
<p>I have a little logging app (written in wxPython) that receives data from a bit of kit we're developing, and I want to display the text in a scrolling window. As it stands I'm using a wx.TextCtrl for the text display, but I'm having some issues with the scrolling behaviour.</p>
<p>Basically, I'd like it so that if ... | <p>I just tested a simple example (checking <code>GetScrollPos(0)</code> and <code>GetScrollRange(0)</code> in <code>EVT_TEXT</code> event handler for <code>wx.TextCtrl</code>) and it works fine for me - they return index of currently shown line and total number of lines, respectively.</p>
<p>Maybe the problem is your... | <p>I just tested a simple example (checking <code>GetScrollPos(0)</code> and <code>GetScrollRange(0)</code> in <code>EVT_TEXT</code> event handler for <code>wx.TextCtrl</code>) and it works fine for me - they return index of currently shown line and total number of lines, respectively.</p>
<p>Maybe the problem is your... | 18,604 |
<p>I'm in a new contract where they seem to have gone overboard with Agile, including hiring a consultant merely for facilitating Agile processes. Something he is instituting is a notion of "core hours" where we will all actually be in the same room together. Is this really what "core hours" constitutes? I ask becau... | <p>Yes and no.</p>
<p>Core hours are the period(s) when all team members commit to working on the project (and not doing administrative stuff or other projects). For many teams, this will imply being in the same room, but with proper planning and the necessary infrastructure, the team can work well from different loca... | <p>I think what you have is an extension of the "core hours" where you are. The idea of being in the shared location is that ad-hoc meetings could occur as well as possibly being within earshot of various discussions so that you can jump in if it is something where you think your opinion or knowledge would be useful, ... | 39,384 |
<p>Something that has always bugged me is how unpredictable the <code>setTimeout()</code> method in Javascript is.</p>
<p>In my experience, the timer is horribly inaccurate in a lot of situations. By inaccurate, I mean the actual delay time seems to vary by 250-500ms more or less. Although this isn't a huge amount of ... | <blockquote>
<p>Are there any tricks that can be done
to ensure that <code>setTimeout()</code> performs
accurately (without resorting to an
external API) or is this a lost cause?</p>
</blockquote>
<p>No and no. You're not going to get anything close to a perfectly accurate timer with <code>setTimeout()</code> ... | <p>You could consider using the <a href="http://www.sitepoint.com/creating-accurate-timers-in-javascript/" rel="nofollow">html5 webaudio clock</a> which uses the system time for better accuracy</p>
| 23,819 |
<p><strong>Dup of <a href="https://stackoverflow.com/questions/330709/some-basic-php-questions#330829">Some Basic PHP Questions</a></strong></p>
<p>Hello,</p>
<p>I have a heap of tinyint fields in a mysql database I need to show with PHP. At the moment I am doing something like this:</p>
<pre><code>if ($row['PAYPAL_... | <p>Try if you want:</p>
<pre><code>$paypal = $row['PAYPAL_ACCEPT'] ? 'YES' : 'NO';
</code></pre>
| <p>You could write it shorter like:</p>
<pre><code>$paypal = ($row['PAYPAL_ACCEPT']?'Yes':'No');
</code></pre>
| 46,439 |
<p>I am using jQuert .ajax function to call a page method. The site is using FormsAuthentication. So when an authentication ticket expires a call to the page method will obviously cause a redirect to the login page. </p>
<p>Now, the geniuses that wrote the System.Web.Handlers.ScriptModule decided that if for some reas... | <p>I think I worked around it. Ofcourse relying on internal MS AJAX related errors is not really nice, but this will do the trick for others faces with this problem.</p>
<p>Basically what you do, is you set the <strong>X-MicrosoftAjax</strong> header to the value <strong>Delta=true</strong> (case is important here), t... | <p>Both are great answers. But if your website is hosted in a shared server, you will probably not be able to change IIS settings, so the client side solution rocks.
I have been facing the same problem, and this post saves me. My two cents to the solution:
In jquery (at least in the latest versions) you can use a param... | 47,171 |
<p>I'm having trouble getting my MendelMax 2's heatbed <em>not</em> to heat up when I want to print without it. I don't get how multiple sources of control relate to each other (same with extrusion temperatures, actually):</p>
<ul>
<li><p>Slic3r (1.2.9) has settings under Filament Settings / Filament / Bed, for First ... | <p>3D printer get the temperature settings from g-code file. The firmware settings for min and max temperature are just safeguards.</p>
<p>You should verify instructions within the g-code file. If you are not familiar with g-code, take a look to <a href="https://en.wikipedia.org/wiki/G-code" rel="noreferrer">wikipedia... | <p>Sli3er will control the bed temperature during a print. The options in Pronterface can be used to pre-heat the bed and hot end, or to adjust the temperature during a print. </p>
<p>The slicer will put the temperatures you set in the filament tab settings into the gcode at the appropriate layers. As the printer read... | 204 |
<p>I'm using start.jar and stop.jar to stop and start my jetty instance.
I restart by calling stop.jar, then start.jar.
The problem is, if I don't sleep long enough between stop.jar and start.jar I start getting these random ClassNotFoundExceptions and the application doesn't work correctly.</p>
<p>Sleeping for a long... | <p>Can you write a shell script that does something like this after calling shutdown and before calling startup?</p>
<pre>
LISTEN_PORT = `netstat -vatn | grep LISTEN| grep 8080 | wc -l `
while [$LISTEN_PORT -ne 0] ; do
sleep 1
LISTEN_PORT = `netstat -vatn | grep LISTEN| grep 8080 | wc -l `
done
</pre>
| <p>Did you try JFGI?
Setting up Ant task that could do the work for you?</p>
<p>This blog post details how to setup targets that can start and stop jetty for you. You could easily cobble together another target called 'jetty-restart' which depends on 'jetty-stop' and then calls 'jetty-start'.</p>
<p><a href="http://p... | 12,907 |
<p>I'm getting a random unreproducible Error when initializing a JSplitPane in with JDK 1.5.0_08. Note that this does not occur every time, but about 80% of the time:</p>
<pre><code>Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.KeyStroke
at java.util.TreeMap.compare(TreeMap.java:1093... | <p>After doing some Googling on bugs.sun.com, this looks like this might be a JDK bug that was only fixed in JDK 6.</p>
<p>See <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6434148" rel="nofollow noreferrer">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6434148</a></p>
| <pre><code>java.lang.ClassCastException: javax.swing.KeyStroke cannot be cast to java.lang.Comparable....
</code></pre>
<p>If you are getting above error after installing java 7 in dbviz
then add Environment variabbles like:
'DBVIS_JAVA_HOME' as a 'Variable Name' and java path like
for ex. "C:\SWDTOOLS\IBM\RAD85\run... | 13,911 |
<p>I would like to implement a command line interface for a Java application. This wouldn't be too difficult to do, except I would like the command line program to affect the state of another Java GUI program. So for example, I could type:</p>
<pre><code>java CliMain arg1 arg2
</code></pre>
<p>And another running GUI... | <p>You could have the GUI application listen on a TCP port (on the <code>localhost</code> interface) and the CLI application would connect to it.</p>
<p>One way to do this would be to use REST over HTTP.</p>
| <p>Another way is through JMX. It gives you a lot of stuff "for free" (in the simple case you just implement a bean and register it -- very simple), and is particularly well suited to this task.</p>
| 30,955 |
<p>I need to deploy an application on the WAS ND 6.1 and do not know anything about it and cannot afford to go to training...</p>
| <p>Getting started with WAS ND can be a bit overwhelming. The redbooks mentioned above to give you a good introduction, especially the first few chapters but they are often over 500 pages long. IBM also provides an educational assistant which is a presentation style overview and that may give a good point to start wi... | <p>This course from IBM would also be excellent but a bit pricy!!!</p>
<p><a href="http://www.redbooks.ibm.com/abstracts/sg247304.html?Open" rel="nofollow noreferrer">http://www.redbooks.ibm.com/abstracts/sg247304.html?Open</a></p>
| 9,053 |
<p>In Java, I have a String and I want to encode it as a byte array (in UTF8, or some other encoding). Alternately, I have a byte array (in some known encoding) and I want to convert it into a Java String. How do I do these conversions?</p>
| <p>Convert from <code>String</code> to <code>byte[]</code>:</p>
<pre><code>String s = "some text here";
byte[] b = s.getBytes(StandardCharsets.UTF_8);
</code></pre>
<p>Convert from <code>byte[]</code> to <code>String</code>:</p>
<pre><code>byte[] b = {(byte) 99, (byte)97, (byte)116};
String s = new String(b, ... | <p>terribly late but i just encountered this issue and this is my fix:</p>
<pre><code>private static String removeNonUtf8CompliantCharacters( final String inString ) {
if (null == inString ) return null;
byte[] byteArr = inString.getBytes();
for ( int i=0; i < byteArr.length; i++ ) {
byte ch= by... | 11,451 |
<p>Im just starting a project and since this project is personal I was wondering what are the advantages of using Enterprise Library? We use the version 2 for several projects in the office but im not quite sure (aside of the good practices) of the advantages of it, especially in the database component. Any advice? Tha... | <p>For the database application block, the main advantage is that it makes it easier to produce database-agnostic code. The developer interacts mainly with generic Database and DbCommand objects, rather than eg SqlConnection, SqlCommand, etc. Thus, switching to a different database (ie Oracle) becomes more feasible. D... | <p>The choice of not being able to use EF for me is bind by the constraints I have in my environment that requires the applications to process millions of transactions per hour. This is the volume of processing in Telco environment.</p>
<p>Whether to use EF or not is entirely up to your environment and choice (as long... | 29,828 |
<p>Being a C# developer since version 1.0, F# has captured my free time for the past few weeks. Computers are now sold with 2, 4 .. Cores and multi-threading is not always simple to accomplish. </p>
<p>At the moment I see that F# has great potential for complicated and or heavy workloads.
Do you think that F# will (on... | <p>I think regardless of whether F# becomes import for Enterprise Software being able to isolate pure functional portions of code in any language will be key to using the potential of multi-core computers. For instance Microsoft's Parallel Extensions for .NET are great, but there is still a lot of room to make mistake... | <p>I think F# will always be a niche language, compared to VB/C#/Java, because it does require more of a mathematical or computer science background. However the very fact that it is a CLR language means that it will have much bigger exposure than earlier functional languages.</p>
<p>I work in an investment bank and w... | 13,096 |
<p>At my workplace we are using CVS as the version control system. Since we are using Windows mostly, TortoiseCVS and WinCVS serve as the GUI front-ends to CVS.</p>
<p>Is there anything like those front-ends for one of the distributed VCS (bzr, hg, git)? I know we could use the command line but that is not an option.<... | <p>Try <a href="http://www.selenic.com/mercurial/wiki/" rel="nofollow noreferrer">Mercurial</a>. It has a <a href="http://tortoisehg.sourceforge.net/" rel="nofollow noreferrer">tortoise shell plugin</a> and <a href="http://www.vectrace.com/mercurialeclipse/" rel="nofollow noreferrer">integrates with Eclipse</a>.</p>
| <p>I like bzr, but have not used the tortoise plugin; I believe Canonical are working on some front-ends for it as well. Oh, and of course there's an Eclipse plugin, so you can use your IDE as the GUI for it.</p>
| 35,737 |
<p>I am trying to get PHP working on my vista home machine but I am getting weird problems. First I had file permission problems for which I disabled Vista's UAC. Now I can't get the PHP interpreter working.</p>
<p>I have made all the necessary changes following some tutorial but I still can't get it working.</p>
<p>... | <p>Try <a href="http://www.apachefriends.org/en/xampp.html" rel="nofollow noreferrer">XAMPP</a>. I use that at home on a Vista machine and it worked nicely after the install.</p>
| <p>You can use FastCGI for IIS 7. I'm using this also and it works perfectly!!</p>
<p><a href="http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70/" rel="nofollow noreferrer">FastCGI</a></p>
| 28,309 |
<p>I have a friend who is need of a web page. He does interior construction, and would like to have a gallery of his work. I'll probably go for a php host, and was thinking about the best way to implement the image gallery for him. I came up with:</p>
<ul>
<li>Use flickr to host the images. They can be tagged, add... | <p>It sounds like a difficult way to do things - have you considered <a href="http://gallery.menalto.com/" rel="nofollow noreferrer">Gallery</a> (No points on creativity for the name!).</p>
<p>Unless you're really wanting to save on bandwidth, I think you'd get much better results from installing some pre-built galler... | <p>If you have any interest in Ruby on Rails, there is a screencast <a href="http://www.rubyonrails.org/screencasts" rel="nofollow noreferrer">here</a> that shows how to create a site similar to what you are describing in RoR.</p>
| 22,101 |
<p>I have Visual Studio setup with a VSTO word project, and when I hit run it runs fine.</p>
<p>But, how do I setup a word document to use my code without having Visual Studio running?</p>
| <p>RubyCocoa is not supported at all on the iPhone. There is no bridge support library, and I do not believe there is any ruby interpreter on the phone.</p>
<p>You might be able to get it working in the simulator, it will not stop you from using OS X only libraries if you really try, but that still will not make it wo... | <p>Howdy! Though I'm not familiar with how Ruby/Cocoa wraps foreign method calls- or with Objective C for that matter- the first place that would seem likely to disconnect under test is passing in a Ruby mock to the natively implemented controller. In the bowling tutorial, the ruby controller proxy is exposes its inter... | 35,147 |
<p>I have two NSURLConnections. The second one depends on the content of the first, so handling the data received from the connection will be different for the two connections. </p>
<p>I'm just picking up Objective-C and I would like to know what the proper way to implement the delegates is.</p>
<p>Right now I'm usin... | <p><strong>Ben</strong>, while your info was helpful It didn't fully answer the question I asked. </p>
<p>I finally figured out how to setup my own delegates, which was what I was really asking. </p>
<p>I implemented it like so: </p>
<pre><code>@interface DownloadDelegate : NSObject
- (void)connection:(NSURLConnect... | <p>since the delegates are called asynchronously, they could call didfinishloading in random order. you can then use a state check to determine if the "other" download is done yet before continuing.</p>
<p>i use 2 delegates:</p>
<p>for instance (this is pseudo oc):</p>
<pre><code>jsondelegate = [[JSonDelegate alloc]... | 24,871 |
<p>I have always initialized my strings to NULL, with the thinking that NULL means the absence of a value and "" or String.Empty is a valid value. I have seen more examples lately of code where String.Empty is considered the default value or represents no value. This strikes me as odd, with the newly added ... | <p>+1 for distinguishing between "empty" and NULL. I agree that "empty" should mean "valid, but blank" and "NULL" should mean "invalid."</p>
<p>So I'd answer your question like this:</p>
<p><strong>empty</strong> when I want a valid default value that may or may not be changed, for example, a user's middle name.</p>... | <p>Strings aren't value types, and never will be ;-)</p>
| 33,338 |
<p>Anyone have experience with algorithmic trading (like stocks)? Any good services to use to get quotes and to make trades?</p>
| <p>I had a freelance project that used <a href="http://www.interactivebrokers.com/" rel="noreferrer">Interactive Brokers</a>, which provided both a proprietary API as well as a FIX-based one. The proprietary API is somewhat painful to use (and they probably can't change it much, for compatibility), but you can easily c... | <p>I know <a href="http://www.tradestation.com/default_2.shtm" rel="nofollow noreferrer">TradeStation</a> is pretty popular. </p>
| 40,095 |
<p>In Cura, I can edit my .ini profile settings as needed, for example, when I change filament or models. It's annoying to have to edit the profile on another computer and update it on my Pi just to change the infill, etc. I've searched <a href="http://plugins.octoprint.org/" rel="noreferrer">http://plugins.octoprint.o... | <p>As far as I know, this is currently not possible.</p>
| <p>There is an import function.
<a href="https://github.com/foosel/OctoPrint/wiki/Plugin:-Cura" rel="nofollow">https://github.com/foosel/OctoPrint/wiki/Plugin:-Cura</a></p>
<p>Btw. now in Cura 2.1 you'll also need to reimport your .ini.</p>
<p>Regards :)</p>
| 162 |
<p>I have run in to a bit of a problem and I have done a bit of digging, but struggling to come up with a conclusive answer/fix.</p>
<p>Basically, I have some javascript (created by a 3rd party) that does some whizzbang stuff to page elements to make them look pretty. The code works great on single pages (i.e. no maste... | <p>Put a ContentPlaceHolder in the head section of the master page, then add a asp:Content control on the content page referring to the placeholder and put your script in that control. You can customize it for each page this way.</p>
<p>Also, the reference by ID may not be working because when you use Master Pages, th... | <p>Once you use Master Pages, the ids of controls on the client side aren't what you think they are. You should use Control.ClientID when you generate the script.</p>
| 21,224 |
<p>Is there any free java library which I can use to convert string in one encoding to other encoding, something like <a href="https://en.wikipedia.org/wiki/Iconv" rel="nofollow noreferrer"><code>iconv</code></a>? I'm using Java version 1.3.</p>
| <p>You don't need a library beyond the standard one - just use <a href="https://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html" rel="nofollow noreferrer">Charset</a>. (You can just use the String constructors and getBytes methods, but personally I don't like just working with the names of character enc... | <p>It is a whole lot easier if you think of unicode as a character set (which it actually is - it is very basically the numbered set of all known characters). You can encode it as UTF-8 (1-3 bytes per character depending) or maybe UTF-16 (2 bytes per character or 4 bytes using surrogate pairs).</p>
<p>Back in the mist... | 28,348 |
<p>I'm trying to figure out the best lower-budget home office development hardware setup. My laptop is aging.</p>
<p>My latest idea is that I would like a very powerful desktop paired with a less-powerful laptop. The idea being that the desktop would do the heavy lifting while the laptop would allow me to work untethe... | <p>You can do that with an RDP / Terminal Services client or VNC. You could also run multiple virtual machines on the beefy server (making it look like a poor man's datacentre / set of less powerful servers). </p>
<p>Another benefit is that you can do some testing with the laptop as the browser client and the desktop... | <p>This is exactly how my current setup is, and it works nicely. I'd still get a couple of 20"+ monitors, as the laptop can be a little restricting for long usage.</p>
| 49,270 |
<p>Is there some way to determine what file currently is being rendered by Rails (2.2) in a helper method. An example result would be "/sessions/new.html.erb" or something similar.</p>
<p>I am trying to write a helper function that does something based on the file name that is being rendered, so I need a reliable way ... | <p>It's never a good idea to use <code>DoCmd.RunSQL</code> as it generates a prompt (which you have to turn off if you don't want it), and it completes the updates even if errors occur, and doesn't report the errors. Much better is to replace it with a function that executes the same SQL:</p>
<pre><code>Public Functio... | <p>I don't see any way at this time to get the information after the update query has run unless you have another distinguishing field (maybe an updated date field). Why not run a select query for it and run a report off of that data, THEN run the update query to change the values for 'bonus'.</p>
<p>Let me know if t... | 43,284 |
<p>My current problem is that I have a JFrame with a 2x2 GridLayout. And inside one of the squares, I have a JPanel that is to display a grid. I am having a field day with the java swing library... take a look</p>
<p><a href="http://img114.imageshack.us/img114/9683/frameow2.jpg" rel="nofollow noreferrer">Image</a></p>... | <p>If you want the two checkerboards to stay the same size, then you'll need to have them each contained in their own <code>JPanel</code>. Set each of those parent JPanel's to have a layout type of <code>GridBagLayout</code>. Set the preferedSize for each checkerboard component and then add them to their respective c... | <p>I have had success solving problems like these using <code>TableLayout</code> which is a third party layout manager. You will need to download it and read the tutorial but the key would be to set the justification to CENTER when adding the JButtons to their positions in the layout.</p>
| 40,863 |
<p>So I was thinking about creating a dynamic sql question, meaning that i want the amount of parameters to be dynamic.</p>
<p>Having looked at this: <a href="https://stackoverflow.com/questions/337704/parameterizing-a-sql-in-clause#337725">Parameterize an SQL IN clause</a> i was thinking that using like '%x%' is SLOW... | <p>It looks like SQL 2008 is an option, so passing a table parameter is probably your best bet. Another possible solution for those who can't move to 2008 yet, is to write a table-valued UDF that generates a table from a delimited string. Then you can do something like this:</p>
<pre><code>SELECT DISTINCT
CN.user... | <p>I hear that SQL Server 2008 has a feature called Table Parameters, so you can pass a Table as a parameter to a Function or Stored Procedure.</p>
<p>Until then, you could use the classic:</p>
<pre><code>SELECT UserId FROM NameTable WHERE CHARINDEX( '|' + Name + '|', '|Filip Ekberg|Filip|Ekberg Filip|') > 0
</cod... | 44,257 |
<p>I've been working with JSF for some time, and been using the Apache-Trinidad tags. I like developing using this a lot but I keep hearing great things about facelets. Is anyone out there using it, and what exactly does it get you? </p>
<p>I've looked at the facelets site (<a href="https://facelets.dev.java.net/" rel... | <p>Facelets haven't really changed. It's a very simple templating engine that runs as a JSF view handler and replaces jsp.</p>
<p>The old resources are still valid.</p>
<ul>
<li>Uses xml for templates.</li>
<li>You can use EL anywhere.</li>
<li>Very few tags.</li>
<li>Very simple</li>
<li>...</li>
</ul>
<p>In my hum... | <p>I've just started working with facelets as well, and so far the best resource I've found is the book "The Definitive Guide to Apache MyFaces and Facelets" from Apress. While it's likely you won't need the other chapters, since you've worked with Trinadad tags already, I've found the examples they use to explain fac... | 41,499 |
<p>I'm experimenting with the iPhone SDK and doing some TDD ala Dr. Nic's rbiPhoneTest project. I'm wondering how many, if any, have been successful using this or any other testing framework for iPhone/Cocoa? More important, I'd like to know how to best assert a proprietary binary request/response protocol. The idea is... | <p>I don’t know much about Ruby or binary protocols, but if You’re interested in unit testing on iPhone, You might want to check out the <a href="http://code.google.com/p/google-toolbox-for-mac/" rel="nofollow noreferrer">Google Toolbox for Mac</a>. I am having great success testing my OpenGL ES application with it.</p... | <p>Cliff, long term you're best investing time in pure ObjC TDD tools. I have used my own rbiphonetest lib in fmdb-migration-manager successfully, but its usefulness is probably limited to libraries etc. Even then there will undoubtly be enough 'works in Cocoa but fails in UIKit' scenarios to make rbiphonetest dubious ... | 23,795 |
<p>Are PHP variables passed by value or by reference?</p>
| <p>It's by value according to the <a href="http://php.net/manual/en/functions.arguments.php" rel="noreferrer">PHP Documentation</a>.</p>
<blockquote>
<p>By default, function arguments are passed by value (so that if the value of the argument within the function is changed, it does not get changed outside of the func... | <p>Depends on the version, 4 is by value, 5 is by reference.</p>
| 2,331 |
<p>When using TFS with a tool outside of Visual Studio (Specifially ORMS), modifications to the project file to include a new file will not cause the file to be added to source control.</p>
<p>Does anything exist that could potentially say "Warning: You are about to check in change to a project file which include a fi... | <p>Not quite, however you might want to download the <a href="http://msdn.microsoft.com/en-us/tfs2008/bb980963.aspx" rel="nofollow noreferrer">TFS Power Tools</a> and check out the command line utility tfpt.exe.</p>
<p>The "tfpt online" and "tfpt treeclean" might be most useful to you when working outside of an integr... | <p>One gotcha I've found using tfpt online is that it doesn't always pick up changes unless you use the /diff switch. That one caused us all kinds of headaches with our automated build until I realised what was happening!</p>
| 43,085 |
<p>I have a form that has multiple fields, and for testing purposes is there a way I could print out the values entered in all the fields, without having to individually print each value.</p>
| <p>You should be able to do a <code>var_dump($_REQUEST);</code></p>
<p><a href="http://us2.php.net/manual/en/reserved.variables.request.php" rel="nofollow noreferrer">http://us2.php.net/manual/en/reserved.variables.request.php</a></p>
<p><a href="http://us2.php.net/manual/en/function.var-dump.php" rel="nofollow norefer... | <p>Very simply,</p>
<pre><code>phpinfo();
</code></pre>
<p>It includes a listing of all variables passed to PHP from a form, in an easy-to-read format.</p>
| 23,891 |
<p>My goal is to integrate testing into my development environment (as post-build step). I don't want to interfere with the DLLs that are generated in debug and release, so i plan to create new configurations for the project. But i don't want to compile every source file i have twice - once for the DLL, once for the te... | <p>Compile the objs into a new lib project that is shared between the dll and your test project.</p>
| <p>The compiler has an "intermediate" directory per configuration. If the .obj files in there are newer than the source files it compiles, it won't regenerate them.</p>
| 32,710 |
<p>Ok this is more of a computer science question, than a question based on a particular language, but is there a difference between a map operation and a foreach operation? Or are they simply different names for the same thing?</p>
| <p>Different.</p>
<p>foreach iterates over a list and <strong>performs</strong> some operation with side effects to each list member (such as saving each one to the database for example)</p>
<p>map iterates over a list, <strong>transforms</strong> each member of that list, and returns another list of the same size with... | <p>ForEach tries to apply a function such as writing to db etc on each element of the RDD without returning anything back.</p>
<p>But the <code>map()</code> applies some function over the elements of rdd and returns the rdd. So when you run the below method it won't fail at line3 but while collecting the rdd after appl... | 46,248 |
<p>I have been hearing that with unit testing we can catch most of the bugs in the code and I really believe that this is true. But my question is in large projects where each class is dependent on many other classes how do you go about unit testing the class ? Stubbing out every other class doesn't make much sense bec... | <p>Part of the advantage of using tests, is that it forces you to minimize dependencies thereby creating testable code. By minimizing dependencies you will increase maintainability and reusability of your code, both highly desirable traits. </p>
<p>Since you are introducing tests into an existing code-base, you will n... | <p>I'm not up to speed on the whole unit testing thing, but I would think that each unit should represent some sort of test. A test case should test some procedure. A procedure may not be confined to a single class.</p>
<p>For instance, if your application can be broken down into atomic components, then a test case co... | 45,065 |
<p>I'm working on a WPF application that sometimes exhibits odd problems and appears to <em>hang</em> in the UI. It is inconsistent, it happens in different pages, but it happens often enough that it is a big problem. I should mention that it is not a true hang as described below.</p>
<p>My first thought was that th... | <p>Try removing the borderless behavior of your window and see if that helps. Also, are you BeginInvoke()'ing or Invoke()'ing any long running operations?</p>
<p>Another thing to look at: When you break into your code, try looking at threads other than your main thread. One of them may be blocking the UI thread.</p>
| <p>Hurrah,... it seems that the problem isn't related to borderless windows (at least in my case).</p>
<p>There is a big performance hit when you set <code>AllowsTransparency</code> to true. So much of a hit it would seem, that the whole thing can hang the UI thread. Very strange behaviour. Could be related to <a h... | 12,977 |
<p>When trying to use <code>libxml2</code> as myself I get an error saying the package cannot be found. If I run as as super user I am able to import fine.</p>
<p>I have installed <code>python25</code> and all <code>libxml2</code> and <code>libxml2-py25</code> related libraries via fink and own the entire path includi... | <p>Check your path by running:</p>
<pre><code>'echo $PATH'
</code></pre>
| <p>I would suspect the permissions on the library. Can you do a strace or similar to find out the filenames it's looking for, and then check the permissions on them?</p>
| 9,402 |
<p>I would like to ask this in more of a general sense than anything, just for people to make note.</p>
<p>I am printing out things for people and some files have some edges hanging out the side. I always worry, since it is printing in mid air, that it would screw up the print. But I was able to go, maybe 1mm(I am not... | <p>If I understand correctly, your question is specifically for <strong>overhangs at 90°</strong> (so an horizontal plane that has no support under it.</p>
<p>The first to notice is that <strong>you can only pull this off if the extrusion happens perpendicular to the surface from which the overhang is coming off</stro... | <p>To add to what mac described, there are small detail effects which sometimes change the behaviour of an overhang (and not necessarily in a predictable manner).</p>
<p>Concave overhangs might sag (rather than turn out like a bridge).
Convex overhangs might pull tight.
Cooling plastic tends to shrink,so might sag les... | 803 |
<p>I have the following code that shows either a bug or a misunderstanding on my part.</p>
<p>I sent the same list, but modified over an ObjectOutputStream. Once as [0] and other as [1]. But when I read it, I get [0] twice. I think this is caused by the fact that I am sending over the same object and ObjectOutputSt... | <p>The stream has a reference graph, so an object which is sent twice will not give two objects on the other end, you will only get one. And sending the same object twice separately will give you the same instance twice (each with the same data - which is what you're seeing).</p>
<p>See the reset() method if you want ... | <p>Max is correct, but you can also use:</p>
<pre><code>public void writeUnshared(Object obj);
</code></pre>
<p>See comment below for caveat</p>
| 17,201 |
<p>I have a MemoryStream with the contents of a Font File (.ttf) and I would like to be able to create a FontFamily WPF object from that stream <strong>WITHOUT</strong> writing the contents of the stream to disk. I know this is possible with a System.Drawing.FontFamily but I cannot find out how to do it with System.Win... | <p>There is a similar question <a href="https://stackoverflow.com/questions/44912480/c-sharp-wpf-how-to-load-a-fontfamily-from-a-byte-array">here</a>, which contains a supposed solution by converting a System.Drawing.FontFamily to a WPF font family, all in memory without any file IO:</p>
<pre><code>public static void L... | <p>The best approach I could think of, was to save the oldFont to a temp directory, and immediately load it using the newFont constructor that accepts a uri.</p>
| 6,616 |
<p>I have a simple table in SQL Server 2005, I wish to convert this to XML (using the "FOR XML" clause). I'm having trouble getting my XML to look like the required output.</p>
<p>I've tried looking through various tutorials on the web, but I am struggling. Can someone help?</p>
<p>The table I have looks like this</p... | <p>As close as I can get is this:</p>
<pre><code>select "type" as '@name', "group" as 'row/column1', "value" as 'row/column2'
from tableName
for xml path('variable'), root('data')
</code></pre>
<p>Naming two items the same ("column" and "column") isn't something I know how to do in one pass, but on the other hand it ... | <p><b>The script below produces the desired format </b></p>
<blockquote>
<br/><DATA>
<br/> <VARIABLE TYPE="Books">
<br/> <row TYPE="Books">
<br/> <GROUP>Hardback</GROUP>
<br/> <VALUE>56</VALUE&... | 31,393 |
<p>I'm working with a datagrid and adapter that correspond with an MSAccess table through a stored query (named "UpdatePaid", 3 paramaters as shown below) like so:</p>
<pre><code> OleDbCommand odc = new OleDbCommand("UpdatePaid", connection);
OleDbParameter param;
odc.CommandType = CommandType.StoredProce... | <p>This is called, oddly enough, a prepared statement, and they're actually really nice. Basically what happens is you either create or get a sql statement (insert, delete, update) and instead of passing actual values, you pass "?" as a place holder. This is all well and good, except what we want is our values to get... | <p>I don't use it with SqlDbCommand. It seems as a bug to me that it's <em>required</em>. It should only be <em>nice to have</em> if you're going to call a procedure multiple times in a row. Maybe I'm wrong and there's a note in documentation about providers that love this call too much.</p>
| 18,790 |
<p>Say I have a list as follows:</p>
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
<p>Is there a CSS selector that will allow me to directly select the last item of a list? In this case item 3.</p>
<p>Cheers!</p>
| <p>Not that i'm aware of. The traditional solution is to tag the first & last items with class="first" & class="last" so you can identify them.</p>
<p>The CSS psudo-class <a href="http://www.w3.org/TR/CSS2/selector.html#first-child" rel="noreferrer">first-child</a> will get you the first item but not all brow... | <p>The answer for this question should be updated! IE9 + Firefox (for a while back) + Chrome, Safari all support: <code>last-of-type</code> or <code>last-child</code> </p>
| 7,411 |
<p>I'm exploring the possibility of writing an application in Erlang, but it would need to have a portion written in Cocoa (presumably Objective-C). I'd like the front-end and back-end to be able to communicate easily. How can this best be done?</p>
<p>I can think of using C ports and connected processes, but I think ... | <p>One way would be to have the Erlang core of the application be a daemon that the Cocoa front-end communicates with over a Unix-domain socket using some simple protocol you devise.</p>
<p>The use of a Unix-domain socket means that the Erlang daemon could be launched on-demand by <code>launchd</code> and the Cocoa fr... | <p>Usually when creating Cocoa applications that front UNIX commands or other headless programs you use an <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSTask_Class/Reference/Reference.html" rel="nofollow noreferrer"><code>NSTask</code></a>:</p>
<blockquote>
<p>Using the NSTask c... | 5,805 |
<p>Was looking to get peoples thoughts on keeping a Lucene index up to date as changes are made to the domain model objects of an application. </p>
<p>The application in question is a Java/J2EE based web app that uses Hibernate. The way I currently have things working is that the Hibernate mapped model objects all i... | <p>Change the message: just provide the primary key and the current date, not the key/value pairs. Your mdb fetches the entity by primary key and calls index(). After indexing you set a value "updated" in your index to the message date. You update your index only if the message date is after the "updated" field of the ... | <p>The accepted answer is 8 years old now and very out of date.</p>
<p>The Compass Project is not maintained anymore since a long time, as its main developer moved on to create the excellent Elasticsearch.</p>
<p>The modern answer to this is to use <a href="http://hibernate.org/search/" rel="nofollow noreferrer">Hibe... | 5,905 |
<p>I'm curious as I begin to adopt more of the boost idioms and what appears to be best practices I wonder at what point does my c++ even remotely look like the c++ of yesteryear, often found in typical examples and in the minds of those who've not been introduced to "Modern C++"?</p>
| <p>Just a few off the top of my head:</p>
<ul>
<li>Navigating around in memory-mapped files.</li>
<li>Windows API calls where you have to over-allocate (like a LPBITMAPINFOHEADER).</li>
<li>Any code where you're munging around in arbitrary memory (VirtualQuery() and the like).</li>
<li>Just about any time you're using... | <p>Not that I would do it, but you need raw pointers to implement, say, a linked list or a graph. But it would be much smarter to use <code>std::list<></code> or <code>boost::graph<></code>.</p>
| 47,445 |
<p>I write a singleton c++ in the follow way:</p>
<pre><code>class A {
private:
static A* m_pA;
A();
virtual ~A();
public:
static A* GetInstance();
static void FreeInstance();
void WORK1();
void WORK2();
void WORK3();
}
}
A* A::GetInstance(... | <p>Why does everybody want to return a singleton as a pointer?<br>
Return it as a reference seems much more logical!</p>
<p>You should never be able to free a singleton manually. How do you know who is keeping a reference to the singleton? If you don't know (or can't guarantee) nobody has a reference (in your case via... | <p>There is a great C++ library, ACE, based on patterns. There's a lot of documentation about different kind of patterns so look at their work:
<a href="http://www.cs.wustl.edu/~schmidt/ACE.html" rel="nofollow noreferrer">http://www.cs.wustl.edu/~schmidt/ACE.html</a></p>
| 34,067 |
<p>I just want to know how to validate (or clean) user input in ASP.NET MVC so that an HttpRequestValidationException will not be thrown regardless of the values submitted. For example, with a text input, if the user inputs <code><BR/></code>, it will cause an exception and the Yellow Screen of Death will be sh... | <p>With the latest version of ASP.NET MVC (the RC, at the time of writing this) you can just put an attribute on either your controller class or your action method, e.g.:</p>
<pre><code>[ValidateInput(false)]
public ActionResult create()
{
// ...method body
}
</code></pre>
<p>The ValidateInputAttribute is in Syst... | <p>Put put ValidateRequest="false" to your aspx view declaration, but sanitize users input text inside your code, to avoid some xss attacks. </p>
| 30,959 |
<p>I'm using <code>ByteBuffers</code> and <code>FileChannels</code> to write binary data to a file. When doing that for big files or successively for multiple files, I get an <code>OutOfMemoryError</code> exception.
I've read elsewhere that using <code>Bytebuffers</code> with NIO is broken and should be avoided. Does a... | <p>I would say don't create a huge ByteBuffer that contains ALL of the data at once. Create a much smaller ByteBuffer, fill it with data, then write this data to the FileChannel. Then reset the ByteBuffer and continue until all the data is written.</p>
| <p>The previous two responses seem pretty reasonable. As for whether the command line switch will work, it depends how quickly your memory usage hits the limit. If you don't have enough ram and virtual memory available to at least triple the memory available, then you will need to use one of the alternate suggestions g... | 4,830 |
<p>What resources do you know dedicated to software development in C for PIC microcontrollers?</p>
<p>I would like to see some kind of framework that handles both IO (buttons for input and LCD for output) and application logic. You can think of it as a VERY simple OS. I understand that PIC's memory can be small for su... | <p>TinyOS (written in a dialect of C) has been ported to some of the PIC microcontrollers:</p>
<ul>
<li><a href="http://www.tinyos.net/" rel="nofollow noreferrer">http://www.tinyos.net</a></li>
<li><a href="http://en.wikipedia.org/wiki/TinyOS" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/TinyOS</a></li>
</ul... | <p>Look into CCS C compiler (<a href="http://www.ccsinfo.com" rel="nofollow noreferrer">http://www.ccsinfo.com</a>). It has a nice comprehensive library for handling digital I/O, ADC, common bus communication. Tutorials and development boards available too.</p>
<p>It has a remarkable peer-to-peer support forum <a hr... | 37,521 |
<p>I have a Makefile that starts by running a tool before applying the build rules (which this tool writes for me). If this tool, which is a python script, exits with a non-null status code, I want GNU Make to stop right there and not go on with building the program.</p>
<p>Currently, I do something like this (top lev... | <p>There might be a better way, but I tried the following and it works:</p>
<pre><code>$(if $(shell if your_command; then echo ok; fi), , $(error your_command failed))
</code></pre>
<p>Here I did assume that <code>your_command</code> does not give any output, but it shouldn't be hard to work around such a situation.<... | <p>Make sure you're not invoking make/gmake with the -k option.</p>
| 27,876 |
<p>I first want to say <strong>thank you</strong> for taking the time to read this. I've been trying to print out some parts for another project of mine. These parts use up around 70% of the bed so they are fairly large, unlike the smaller trinkets and things I normally print.</p>
<p>However, I have yet been able to pr... | <p>You mentioned a noticeable 'clunk' when it shifts, are you sure it isn't a physical obstruction? You said you checked that all axis run smoothly but are you sure you checked the full extents of the printable area?</p>
<p>Watch carefully when the issue happens, are any of the cables getting snagged on the machine or ... | <p>Not sure if you're still actively working on this but my setup mirrors yours almost perfectly, I added an all metal extruder, Micro Swiss hotend, a BLTouch, yellow bed springs and Capricorn tube and got great results but needed more cooling so I changed to the Hero Me Gen 5 using 2 5015 blowers and a Noctua 40x20 fa... | 1,825 |
<p>I'm writing some JavaScript code that needs to fire the <code>click</code> event for a link. In Internet Explorer I can do this </p>
<pre><code>var button = document.getElementById('myButton');
button.click();
</code></pre>
<p>But this doesn't work in Firefox, and I assume any other browser. In Firefox, I've done... | <p><a href="http://jehiah.cz/archive/firing-javascript-events-properly" rel="noreferrer">http://jehiah.cz/archive/firing-javascript-events-properly</a></p>
<pre><code>function fireEvent(element,event) {
if (document.createEvent) {
// dispatch for firefox + others
var evt = document.createEvent("HTMLEv... | <p>Hey, I don't mean to dig up an old thread - but I was searching for an answer to this same problem as well, and found a function new to jQuery 1.3x (I was having a problem with Ajax Loaded content)</p>
<p>Here's how I implemented it:</p>
<p>HTML</p>
<pre><code><a class="navlink" href="mypage.html">Online Es... | 17,344 |
<p>Is there any way to remove “save target as” from internet explorer’s right-click menu by using group policies or registry hacks? Failing that is there a simple programmatic way?</p>
| <p>If you are trying to implement some kind of DRM scheme for websites - just dont. They never work and just annoy your users.</p>
| <p>Why dont you try removing the right click altogether. Or if you need your own menu, you can create your own popup easily using div's. </p>
<p>There is no way to modify the default menu and to disable a part of the menu as such. </p>
<p>See how I disabled right click context menu here :</p>
<p><a href="http://www.... | 19,318 |
<p>I have a bash script which will be run on a Mac via ssh. The script requires a particular network drive to already be mounted. On the Mac, I mount this drive by opening a folder "JPLemme" on that drive in Finder. This mounts the drive until the Mac goes to sleep at night.</p>
<p>Obviously, Finder isn't available vi... | <p>Your network volume should have a domain attached to it of some kind. So, "JPLemme.domain.com". I use the following chunk of code to get onto a network volume that is password protected:</p>
<pre><code> tell application "Finder"
try
set theServer to mount volume "smb://path/to/volume" as usernam... | <p>At it's very core, all that is really needed is the following: </p>
<pre><code>Tell Application "Finder"
Mount Volume "smb://username:password@server/sub/directory"
End Tell
</code></pre>
<p>But what is used will depend largely on network environment and errors returned.</p>
| 41,065 |
<p>I have a poorly designed database. One of the most important tables has 11,000+ entries. We would like to expand our system, and I am wondering if this table grew to 5x its size, would this be a problem? It's 15360 kB in size... if that matters.</p>
<hr>
<p>I'm using phpMyAdmin, the server is a Fedora Linux box (n... | <p>What DBMS? What server? What load? What application?</p>
<p>Besides: 11.000 records are nothing, really. Even in MS Access. :-)</p>
<p>EDIT:
So I assume you use a fairly recent MySQL with MyISAM tables. In theory, you can go ahead and fill the table into the millions of records. Depending on how you work with the... | <p>A bad foundation will be your most costly mistake. If the table is important, then you need to decide how important it is to fix it. The amount of rows in a table only affects the speed at which you can pull stuff out of it. But, if you've got a bad database design to start with, your hands will be tied at certai... | 21,629 |
<p>The following Code does not compile</p>
<pre><code>Dim BasicGroups As String() = New String() {"Node1", "Node2"}
Dim NodesToRemove = From Element In SchemaDoc.Root.<Group> _
Where Element.@Name not in BasicGroups
For Each XNode In NodesToRemove
XNode.Remove()
Next
</code></pre>
<p>It ... | <p>You probably want to move the 'not' part. Eg (psuedo code)</p>
<pre><code>where (not (list.Contains(foo))
</code></pre>
| <p>Maybe you can try something like this</p>
<p>mylistWithOutUndesirebleNodes =
(from b in NodeLists.Cast()
where (from c in NodesToDeleteList.Cast()
where c.Attributes["atributo"].Value == b.Attributes["atributo"].Value
select c).Count() == 0
select b).ToList();</p>
| 27,307 |
<p>Can anyone recommend a good Windows form component for displaying PDF documents and allowing users to add <em>real</em> annotation (by which I mean identical to that created by Adobe Reader). </p>
<p>Update: I've tried the AxAcroPDF component which Abobe installs alongside Reader, but this doesn't support annotatio... | <p>If anyone's interested, it looks like we'll end up using jPDFNotes, from <a href="http://www.qoppa.com" rel="nofollow noreferrer">Qoppa Software</a>.</p>
<p>To quote from the web site:</p>
<blockquote>
<p>jPDFNotes is a Java™ bean that
integrates into your application to
display PDF documents and forms and
... | <p>For editing the documents I have worked with <a href="http://www.syncfusion.com" rel="nofollow noreferrer">SyncFusions</a> Essential PDF and it worked quite well</p>
| 11,119 |
<p>I want to set up an ASP.NET custom control such that it has a custom name, specifically, with a hyphen within it, so it might look like this in markup:</p>
<pre><code><rp:do-something runat="server" id="doSomething1" /></code></pre>
<p>I don't mind if this syntax requires setting up a tag mapping in web.conf... | <p>XML, unlike HTML does not define entities (ie named references to UNICODE characters) so &alpha; &mdash; etc. are not translated to their corresponding character. You must use the numerical value instead. You can only use &lt; and &amp; in XML</p>
<p>If you want to create HTML, use an HtmlDocument i... | <p>You could also set the InnerText to <code>"Hello, I am text α – —"</code>, making the XmlDocument escape them automatically. I think.</p>
| 35,650 |
<p>I have a user control which is loaded in the page dynamically using the following code in Init of the Page.</p>
<pre><code>Dim oCtl As Object
oCtl = LoadControl("~/Controls/UserControl1.ascx")
oCtl.Id = "UserControl11"
PlaceHolder1.Controls.Clear()
PlaceHolder1.Controls.Add(oCtl)
</code></pre>
<p>The user control... | <p>You have to ensure that the control exists on the page prior to .NET entering the "Postback event handling" step of the page lifecycle. Since the control is added dynamically you have to ensure that on every post back you recreate that control so that it can find the control to fire the event.</p>
| <p>You want to only load the control when not isPostBack</p>
| 11,825 |
<p>I've read that Silverlight 2.0 imposes by design an asynchronous model when communicating with the web server. I haven't had a chance to experiment with Silverlight, but I assume that it uses a thread-pool to manage threads like in the .NET Framework.<br /><br/>
Now, since some browsers, most notably Internet Explor... | <p>In IE (haven't tested others) Silverlight is restricted to 2 connections at a time. </p>
<p>The behavior in Silverlight is to simply not make the request. So if you make 5 Async web service requests right in a row, the first 2 will happen, the other three won't. No exception is thrown that i've seen... </p>
<p>... | <p>Firstly the Machine.config file would not be used as the Silverlight control is sandboxed with its own version of the CoreCLR.</p>
<p>I believe that the Silverlight control actually makes use of the underlying browser to make the asynchronous HTTP requests. This is most likely the case considering how the Silverlig... | 28,346 |
<p>Just wondering if someone could help me with some msbuild scripts that I am trying to write. What I would like to do is copy all the files and sub folders from a folder to another folder using msbuild.</p>
<pre><code>{ProjectName}
|----->Source
|----->Tools
|----->Viewer
... | <p>I was searching help on this too. It took me a while, but here is what I did that worked really well.</p>
<pre><code><Target Name="AfterBuild">
<ItemGroup>
<ANTLR Include="..\Data\antlrcs\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(ANTLR)" DestinationFolder="$(TargetD... | <p>The best way to recursively copy files from one directory to another using MSBuild is using Copy task with SourceFiles and DestinationFiles as parameters. For example - To copy all files from build directory to back up directory will be</p>
<pre><code><PropertyGroup>
<BuildDirectory Condition="'$(BuildDire... | 14,505 |
<p>I am designing a web app and I intent to embed data on an xml island so that I can dynamically render it on an HTML table on the client-side based on options the users will select.</p>
<p>I have the broad concepts, but I need pointers on how to use DOM in navigating my xml. And how to update my xml island possibly ... | <p>In <em>W3C</em> HTML there are no XML data islands (unless you're referring to external XML file linked via frames loaded using Javascript), but you can re-use HTML elements and insert metadata in <code>class</code>, <code>title</code> (if you care about HTML4 validity), <code>data-*</code> (HTML5) or your custom at... | <p>Ajax Patterns has some good examples for using data islands: <a href="http://ajaxpatterns.org/wiki/index.php?title=XML_Data_Island" rel="nofollow noreferrer">http://ajaxpatterns.org/wiki/index.php?title=XML_Data_Island</a></p>
| 38,476 |
<p>This question is simple. What function would I use in a PHP script to load data from a URL into a string?</p>
| <p>CURL is usually a good solution: <a href="http://www.php.net/curl" rel="noreferrer">http://www.php.net/curl</a></p>
<pre><code>
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);
cu... | <p>Check out <a href="http://sourceforge.net/projects/snoopy/" rel="nofollow noreferrer">Snoopy</a>, a PHP class that simulates a web browser:</p>
<pre><code>include "Snoopy.class.php";
$snoopy = new Snoopy;
$snoopy->fetchtext("http://www.example.com");
$html = $snoopy->results;
</code></pre>
| 44,070 |
<p>I found this in an error log and am trying to work out how it's possible. It's not every day that a NullReferenceException turns up deep within the .net base classes!</p>
<pre><code>1) Exception Information
*********************************************
Exception Type: System.NullReferenceException
Message: Object r... | <blockquote>
<p>Could a multi-thread scenario cause this exception</p>
</blockquote>
<p>Instance methods of ADO.NET classes (e.g. SqlCommand) are generally not thread-safe.
So if you are using such instances from multiple threads, you can expect problems such as the one you describe.</p>
| <p>I'm guessing that disposing the dataset invalidates the table that it contains!</p>
<p>BTW you don't need the dataset, you can fill a datatable directly - or call the other data adapter function which creates a datatable for you (Get, i think)</p>
<p>and it's spelled "adapter" not "adaptor" ;-)</p>
| 47,933 |
<p>I'm making a simple Image Debugger Visualizer. Code is below. I'm not sure if i need to manually dispose of the Image instance? Because i'm making a windows Form window and the PictureBox inside that contains my dynamic image .. do i need to add some special code when the form is terminating, to dispose of this? </p... | <p>Change your Show method to this:</p>
<pre><code>protected override void Show(IDialogVisualizerService windowService,
IVisualizerObjectProvider objectProvider)
{
Image image = (Image) objectProvider.GetObject();
using (Form form = new Form())
{
PictureBox pictu... | <p>I think you should dispose it. It should be quite easy, just add a using() at the first line of your method (around the Image image = ... line) and end it after the form.ShowDialog().</p>
<p>I think it is safe to dispose the image, for if you want to change the visualized object you must call one of the TransferDat... | 41,000 |
<p>Does anyone have experiences in providing a custom MvcRouteHandler? In my application I'd like to implement a globalization-pattern like <em>http://mydomain/en/about</em> or <em>http://mydomain/de/about</em>. </p>
<p>As for persistance, I'd like to have a cookie read as soon as a request arrives and if there is a l... | <p>I don't believe a custom route handler is required for what you are doing.</p>
<p>For your "globalized" URIs, a regular MVC route, with a constraint that the "locale" parameter must be equal to "en", "de", etc., will do. The constraint will prevent non-globalized URIs from matching the route.</p>
<p>For a "non-glo... | <p>You should be able to do this with ASP.NET MVC's default template, I'm doing something similar. Just build your routes as {language}/{controller}/{action}/{id}</p>
<p>Just set a default route that goes to a controller that checks for the language cookie, and redirects the user based on that cookie.</p>
| 11,102 |
<p>I get a 2032 stream error from Flash in response to POST requests that return "201 Created" in IE (Firefox works fine). Since Flash doesn't provide access to the HTTP status I can't tell that it has actually succeeded. The request is being made with HTTPService.</p>
<p>Any suggestions? Has anyone else seen this?... | <p>I found a way around this on my Flex on Rails application. I was seeing the same problem in IE - my development.log in Rails gave a 201 message, but this caused a fault coming back to Flex. I found a reference in a new book called <em>Flex On Rails</em> by Tony Hillerson and Daniel Wanja, on p. 31. It involves ca... | <p>Try using a debug proxy to take a peek at the traffic, I like <a href="http://www.charlesproxy.com/" rel="nofollow noreferrer">Charles</a>.</p>
| 46,250 |
<p>When you pipe two process and kill the one at the "output" of the pipe, the first process used to receive the "Broken Pipe" signal, which usually terminated it aswell. E.g. running</p>
<pre><code>$> do_something_intensive | less
</code></pre>
<p>and then exiting <em>less</em> used to return you immediately to a... | <p>Well, if there is an attempt to write to a pipe after the reader has gone away, a SIGPIPE signal gets generated. The application has the ability to catch this signal, but if it doesn't, the process is killed.</p>
<p>The SIGPIPE won't be generated until the calling process attempts to write, so if there's no more o... | <p>Thanks for your advices, the solution is getting closer...</p>
<p>According to the manpage of tcsh, "non-login shells inherit the terminate behavior from their parents. Other signals have the values which the shell inherited from its parent."</p>
<p>Which suggest my <em>terminal</em> is actually the root o... | 12,861 |
<p>I am operating a laser sintering machine, using polyamide 2200 powder (with a grain size of approximately 50 micrometers). During a print, a lot of powder goes unsintered and can theoretically be reused. However, using purely recycled powder degrades print quality to an unacceptable level.</p>
<p>Mixing a little us... | <p>You'll find generally that mixing 40% new polyamide with 60% recycled polyamide will result in a reasonable finish and part. You will obviously want to use all new for parts requiring the best possible finish and mechanical properties, but this mixture will be very difficult to tell apart from a fully new mixture pa... | <p>You'll find generally that mixing 40% new polyamide with 60% recycled polyamide will result in a reasonable finish and part. You will obviously want to use all new for parts requiring the best possible finish and mechanical properties, but this mixture will be very difficult to tell apart from a fully new mixture pa... | 141 |
<p>I'm already familiar with the standard Java package naming convention of using a domain name to create a unique package name (i.e. package <code>com.stackoverflow.widgets</code>). However, I've never seen any recommendations for how to choose package names for personal projects. I assume because this is because this... | <p>If you're just doing personal projects where nobody else will use the code, then you can make up a package name that you like. Don't make up something that starts with <code>com.</code> or <code>net.</code> or other top-level domain though, because that would imply that you own the domain name (ie. using <code>com.j... | <p>I thought about asking this same question. So far i've used the prefix com.tehvan, even though i don't actually have a company.</p>
| 37,281 |
<p>What function will let us know whether a date in VBA is in DST or not?</p>
| <p><b>For non-current dates (DST 2007+):</b></p>
<p>First, you need a function to find the number of specific weekdays in a month:</p>
<pre><code>Public Function NDow(Y As Integer, M As Integer, _
N As Integer, DOW As Integer) As Date
' Returns Date of Nth Day of the Week in Month
NDow = DateSer... | <p>For anyone wondering how to account for daylight saving time in Europe (central europe time), I modified the script from <a href="http://www.cpearson.com/excel/DaylightSavings.htm" rel="nofollow noreferrer">Chip Pearson</a>. The last sunday of March (2 AM to 3 AM) and October (3 AM to 2 AM) are the days when the hou... | 15,895 |
<p>I want to take an action in an Excel workbook macro after a period of inactivity (hide/protect some worksheets). What is the best/simplest way to achieve this?</p>
<p>Í'm assuming I'll use <code>Application.OnTime</code> to periodically check if the user has been active. But what events should I handle to see if ... | <p>I have implemented this by handling Workbook_SheetActivate, Workbook_SheetSelectionChange and Workbook_WindowActivate. Realistically this is probably enough.</p>
| <p>One simple way is to compare the content of the workbook with that of the last time you check. I believe combining this with Application.OnTime will solve your concern.</p>
| 20,555 |
<p>For example, given a type param method i'm looking for something like the part in bold</p>
<blockquote>
<p>void MyMethod< T >() {<br>
if ( <strong>typeof(T).Implements( <em>IMyInterface</em> )</strong> )
{</p>
<pre><code> //Do something
</code></pre>
<p>else</p>
<pre><code> //Do something else ... | <p><a href="http://msdn.microsoft.com/en-us/library/system.type.isassignablefrom.aspx" rel="noreferrer">Type.IsAssignableFrom</a></p>
<pre><code>if(typeof(IMyInterface).IsAssignableFrom(typeof(T)))
{
// something
}
else
{
// something else
}
</code></pre>
| <p>Ï've just tried using </p>
<pre><code>if( typeof(T).Equals(typeof(IMyInterface) )
...
</code></pre>
<p>And also works, but your answer seems more robust and was what I was looking for. Thanks!</p>
| 12,157 |
<p>I would like to display multiple colors (and potentially shapes and sizes) of data points in a Google Chart scatter chart. Does anyone have an example of how to do so?</p>
| <p>I answered my own question after waiting SECONDS for an answer here :-)</p>
<p>You can indeed have different colors for different data elements. For example:</p>
<p><a href="http://chart.apis.google.com/chart?chs=300x200&cht=s&chd=t:1,2,3|6,5,4&chds=1,3,0,10&chxt=x,y&chxl=0:|0|1|2|1:|0|10&c... | <p>Here's another example: <a href="http://www.xefer.com/twitter/gruber" rel="nofollow noreferrer">twitter charts</a>. I'm hoping to do the same thing. Need to find out how to do the concentric circles.</p>
| 10,266 |
<p>I keep on hearing about concurrent programing every where.
Can you guys throw some light on what it's and how c++ new standards facilitate doing the same?</p>
| <p>Concurrency is about your code doing multiple things at the same time. This is typically done with explicit "threads", but there are other possibilities. For example, if you use OpenMP directives in your code then a compiler that supports OpenMP will automatically generate threads for you.</p>
<p>Thread is short fo... | <p>This is the best article to understand concurrent programming: <a href="http://www.nondot.org/sabre/Mirrored/AdvProgLangDesign/finkel07.pdf" rel="nofollow">Concurrent Programming</a></p>
<p>You will get the full picture of concurrent programming and C++ after reading it.</p>
<p>As a quick summary, we can say that ... | 26,922 |
<p>Perhaps not directly programming related, but definitely product / commercially related. And I can't find a dupe, so I thought I would ask.</p>
<p>I have had a bit of trouble trying to figure out what best to say to people who have called and asked for advice. The Microsoft message is a bit worrying - basically, ... | <p><a href="http://www.google.com/chrome" rel="nofollow noreferrer">Switch</a> to <a href="http://www.mozilla.com/en-US/firefox/" rel="nofollow noreferrer">another</a> <a href="http://www.opera.com/" rel="nofollow noreferrer">browser</a>, <a href="http://www.apple.com/safari/" rel="nofollow noreferrer">already</a>.</p>... | <p>Apart from switch browser, pay attention to the <a href="http://www.computerworld.com/action/article.do?command=viewArticleBasic&articleId=9123612&source=NLT_PM" rel="nofollow noreferrer">emergency patch</a> - get it installed.</p>
| 48,781 |
<p>I'm trying to find a simple way to change the colour of the text and background in <code>listview</code> and <code>treeview</code> controls in WTL or plain Win32 code.</p>
<p>I really don't want to have to implement full owner drawing for these controls, simply change the colours used.</p>
<p>I want to make sure t... | <p>Have a look at the following macros:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb775063%28VS.85%29.aspx" rel="nofollow noreferrer">ListView_SetBkColor</a><br>
<a href="http://msdn.microsoft.com/en-us/library/bb775116%28VS.85%29.aspx>" rel="nofollow noreferrer">ListView_SetTextColor</a> </p>
<p><a... | <p>It's been a while since I've use the win32 API directly, but I believe that if you handle the WM_ERASEBACKGROUND message for your control, you can use FillRect() in your handler to paint the background using whatever color you like.</p>
| 6,742 |
<pre><code>$query = "SELECT * FROM `table`";
$results = mysql_query($query, $connection);
</code></pre>
<p>If 'table' has no rows. whats the easiest way to check for this.?</p>
| <p>You could use <a href="http://php.net/mysql_num_rows" rel="noreferrer">mysql_num_rows($results)</a> to check if 0 rows were returned, or use this faster alternative:</p>
<pre><code>$query = "SELECT COUNT(*) AS total FROM table";
$results = mysql_query($query, $connection);
$values = mysql_fetch_assoc($results);
$nu... | <p>If you loop through the results, you can have a counter and check that.</p>
<pre><code>$x = 1;
$query = mysql_query("SELECT * FROM table");
while($row = mysql_fetch_assoc($query))
{
$x++;
}
if($x == 1)
{
//No rows
}
</code></pre>
| 26,356 |
<p>I'm about to start a new .net web project.
Previsouly for my n-layer web apps i've used the "Microsoft Data Access Application Block" (sqlhelper.cs) for the data access, then an interface class to interface with the object classes. I'm aware this technique is a bit dated and was looking to use something a little mo... | <p>Not at all. It supports the creation of multi-tier layers which separates our data access from our logic. I usually have business and data classes in separate folders and include the SqlHelper class with my Data DALC class.</p>
<p>I'm looking forward to the move towards LINQ and the use of generics. That's my next ... | <p>You can get simple and good example of sql helper class on <a href="http://followprogrammers.blogspot.com/" rel="nofollow noreferrer">http://followprogrammers.blogspot.com/</a></p>
| 44,073 |
<p>I'm not good at programming and my trying to open one of my spreadsheet documents.
Below in the basic login im using, I then request a list all my spreadsheet, which is returned in $feed.</p>
<p>And now I'm worried I'm not on the right track with opening a document so I can read and write cells.</p>
<pre><code><... | <p>I forgot which social network my id was with, and so I have Activ8ed a new. A bit like a cylon.</p>
<blockquote>
<p>I looked at the zend manual. I'm new
to php so accessing Objects like $feed
is still confusing. The Zend document
needs to make better usage of http to
expand the information present.</p>
... | <p>You're on the right track. Are you using the information found <a href="http://framework.zend.com/manual/en/zend.gdata.spreadsheets.html" rel="nofollow noreferrer">http://framework.zend.com/manual/en/zend.gdata.spreadsheets.html</a> ?</p>
<p>Your code is getting a spreadsheet feed which lists all the available spr... | 40,266 |
<p>Say I have entities organized in a hierarchy with <code>Parent</code> being the root entity and <code>Child</code> being a subclass of <code>Parent</code>. I'd like to setup an <code>NSArrayController</code> to fetch only entities of <code>Parent</code>, but not <code>Child</code>.</p>
<p>If you set the Entity Nam... | <p>Leopard introduced the <code>includesSubentities</code> property to NSFetchRequest for exactly this purpose. You'll have to subclass your NSObjectController or NSArrayController to provide the fetch request it will use via its <code>defaultFetchRequest</code> property, or to change the fetch request it uses by over... | <p>Leopard introduced the <code>includesSubentities</code> property to NSFetchRequest for exactly this purpose. You'll have to subclass your NSObjectController or NSArrayController to provide the fetch request it will use via its <code>defaultFetchRequest</code> property, or to change the fetch request it uses by over... | 38,139 |
<p>I'm busy with an asignment where i have to make a graphical interface for a simple program. But i'm strugling with the layout.</p>
<p>This is the idea:<br>
<img src="https://i.stack.imgur.com/a3Xk7.png" alt="Layout Example" title="Layout Example"></p>
<p>What is the easiest way to accomplish such a layout?</p>
<p... | <p>Well considering how simple the layout is I would suggest you use a BorderLayout with NORTH set to the top section in a container and the JTable in the CENTER of the BorderLayout. For the Top it appears to be a simple BorderLayout again with NORTH as the Instruction: south as the black box (possibly in a container w... | <p>I used to love Motif's XmForm for this sort of thing. In Java, I usually put Boxes inside of boxes. So I have a vertical box. First row of the box contains a JLabel for the Instruction. Second row contains something for the label/result stuff, possibly some sort of grid. Third row contains whatever that blacked... | 30,860 |
<p>I've created a DLL project in VS 2005 for native Win32/unmanaged C++, call it myProj.dll. It depends on a 3rd-party commercial DLL that in turn depends on msvcr90.dll (I assume it was built from a VS 2008 project). I'll call it thirdParty.dll.</p>
<p>My DLL project builds just fine in VS2005. I've built a test a... | <p>This looks like a <em>"Side-by-Side Assemblies"</em> issue to me.</p>
<p>From what I can tell, Microsoft in an attempt to stop the <em>DLL Hell</em> problems of past years has introduced a concept of <em>"Side-by-Side Assemblies".</em> </p>
<p>In a nut shell it means that your application needs to tell <strong>Win... | <p>I would ask the third party dll people about this. </p>
| 43,070 |
<p>Is there a way to download older versions of Visual C++ Express? I'm particularly interested in Visual C++ 2005 Express (PRIOR SP1) and Visual C++ Toolkit 2003. I tried googling for them, but all the sites linked to microsoft.com, from where microsoft (for some reason) has taken them down.</p>
| <p>If you want to link your application against the RTM (pre-SP1) version of the CRT (C runtime), you can apparently do that by <a href="http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/13efe532-8a62-4951-b636-39e4589e65a5/" rel="nofollow noreferrer">defining <code>_USE_RTM_VERSION</code></a> in your proj... | <p>From my personal experience the software compiled with SP1 doesn't simply work, if the end user hasn't installed the redistributables. Without SP1 however it is possible to get the .exe working if you distribute it with the required .dlls.</p>
| 33,986 |
<p>I need the tool for graphical representing of work flow in a program (like electronic circuits are described with graphical representation). The representation has to be like the following: functions are boxes and arrows between boxes are "messages". Like this:</p>
<p><a href="http://img372.imageshack.us/img372/847... | <p>What about using something like <a href="http://www.graphviz.org/" rel="nofollow noreferrer">Graphviz</a>?</p>
| <p><a href="http://www.graphviz.org/" rel="nofollow noreferrer">http://www.graphviz.org/</a></p>
<p>HTH</p>
| 43,398 |
<p>Since I'm running a 3D printing facility of an engineering school, students are always wondering how much infill percentage affects the stiffness of the part. I know that it is impossible to get a numerical solution for this question, but maybe there is an option to simulate in software an already sliced model. I ha... | <p>I don't believe that slicing engines create any sort of solid model that would be useful for CAD simulation. When a slicing engine slices a 3D model, it's goal is to spit out the preferred machine paths in G-Code (of some kind). However, I've read a few articles, done some tests, and heard through the grape vine tha... | <p>If you're an engineering class, you may very well print out big cubes of different infils and test them. </p>
| 266 |
<p>aspnet mvc has the HandleError filter that will return a view if an error occurs, but if an error occurs when calling a JsonResult Action how can I return a JSON object that represents an error?</p>
<p>I don't want to wrap the code in each action method that returns a JsonResult in a try/catch to accomplish it, I'd... | <p>Take a look at the MVC implementation of HandleErrorAttribute. It returns a ViewResult. You could write your own version (HandleJsonErrorAttribute) that returns a JsonResult.</p>
| <p>Maybe you could create your own Attribute and have a constructor value that takes an enum value of View or Json. Below is what Im using for a custom Authorization Attribute to demonstrate what I mean. This way when authentication fails on a json request it responds with a json error and the same with if it returns ... | 13,515 |
<p>A colleague and I are discussing best practices regarding ordering method parameters. The goal is to establish a standard in our organization to improve readability and productivity by giving our methods common signatures. We are merely establishing guidelines for the recent grads we are hiring. </p>
<p><strong>... | <p>I'd go with the ordering of input,output,optional.</p>
<p>Optional should go at the end to me because most languages allow you to specify a default value for optional arguments to avoid having to include them. The provision of that is that they have to be the last argument(s) otherwise you can't drop them. </p>
<p... | <p>One idiom popular in C programming, is that the target goes first, so that in strcpy(A, B); is copying B to A (much like "A=B;" is copying B to A).</p>
| 25,619 |
<p>I'm on OS X 10.5.5 (though it does not matter much I guess)</p>
<p>I have a set of text files with fancy characters like double backquotes, ellipsises ("...") in one character etc. </p>
<p>I need to convert these files to good old plain 7-bit ASCII, preferably without losing character meaning (that is, convert tho... | <p>The <a href="http://elinks.or.cz/" rel="nofollow noreferrer">Elinks</a> web browser will convert Unicode entities to their ASCII equivalents, giving things like "--" for "—" and "..." for "…", etc. There is a python module <a href="http://code.google.com/p/python-elinks/" rel="nofollow noreferrer">python-elinks</a> ... | <p>There was a question yesterday or the day before about file renaming, and I showed a Perl script <code>rename.pl</code> that would be usable for the task. The problem area is knowing how the odd characters are encoded, and devising the correct sequence of transliterations. I'd probably do it with an adaptation of ... | 26,147 |
<p>I'm having a bit of a problem with converting the result of a MySQL query to a Java class when using SUM.</p>
<p>When performing a simple SUM in MySQL</p>
<pre><code>SELECT SUM(price) FROM cakes WHERE ingredient = 'chocolate';
</code></pre>
<p>with <code>price</code> being an integer, it appears that the <code>SU... | <p>This is just a guess, but maybe casting to integer will force MySQL to always tell it is an integer.</p>
<pre><code>SELECT CAST(SUM(price) AS SIGNED) FROM cakes WHERE ingredient = 'marshmallows';
</code></pre>
| <p>I found <code>COALESCE(SUM(price),0)</code> good for always ensuring the field returned 0 if there was no result.</p>
<p>See: <a href="http://lists.mysql.com/mysql/177427" rel="nofollow noreferrer">http://lists.mysql.com/mysql/177427</a></p>
| 41,845 |
<p>We've been trying to alter a lot of columns from nullable to not nullable, which involves dropping all the associated objects, making the change, and recreating the associated objects.</p>
<p>We've been using SQL Compare to generate the scripts, but I noticed that SQL Compare doesn't script statistic objects. Does ... | <p>It is considered best practice to auto create and auto update statistics. Sql Server will create them if it needs them. You will often see the tuning wizard generate lots of these, and you will also see people advise that you update statistics as a part of your maintenance plan, but this is not necessary and might... | <p>Statistics are too data-specific to be tooled. It would be potentially very inefficient to blindly re-create them on a data set.</p>
| 4,078 |
<p>I'm just starting with CodeIgniter, and I am not sure where things such as css, js, and images should go. Outside the whole system folder seems ok, but that means everything is seperate. Inside means the filepaths are longer, and I'm worried that it might mess things up. What's the best practice on this issue?</p>
| <p>I usually put separate folders at the root level, so I end up with a directory structure like this:</p>
<pre><code>/system
/css
/js
/img
</code></pre>
<p>Seems to work for me - when you use <code>site_url(url)</code>, the URL it generates is from the root, so you can use <code>site_url('css/file.css')</code> to ge... | <p>I hate having so many directories at the root level, so I use /public and use htaccess to rewrite /scripts to /public/scripts and so on.</p>
| 21,514 |
<p>I'm terribly new to SQL, and cannot seem to get the desired information out, after trying a few different google searches, and reading through some SQL tutorials.</p>
<p>I think it involves some sort of joins, but cannot get them straight.</p>
<p>Given the following sample tables:</p>
<p>Table 1(Activity This is ... | <pre><code>SELECT a1.Who, a1.What, a1.ID, c.When, c.Comment
FROM Activity AS a1
JOIN Activity AS a2 ON (a1.ID = a2.ID AND a1.When > a2.When)
JOIN Comments AS c ON (a1.ID = c.ID AND a.When = c.When);
WHERE a2.What = 'Closed';
</code></pre>
<p>I think you need some way to associate a row in Comments to the correc... | <p>Are you planning on joining the tables based on the date? So you will only have 1 change per day?</p>
| 28,607 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.