instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>In XLST how would you find out the length of a node-set?</p>
| <pre><code><xsl:variable name="length" select="count(nodeset)"/>
</code></pre>
| <p>Generally in XSLT things aren't referred to as <code>Arrays</code>, since there is really no such thing in XSLT. The technical term is either <code>nodesets</code> (made up of zero or more nodes) or in XSLT 2.0 <code>sequences</code>.</p>
| 5,203 |
<p>I'm looking for something simple to use where the grammar is easy to define.</p>
| <p>Although I've never used it before, <a href="http://www.antlr.org/" rel="nofollow noreferrer">ANTLR</a> has C# runtime.</p>
| <p>System.Text.RegularExpressions?</p>
| 47,783 |
<p>I hear that tr1::result_of gets used frequently inside of Boost... I'm wondering if there are any good (simple) use cases for tr1::result_of I can use at home.</p>
| <p>A description of result_of is given at <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1454.html" rel="nofollow noreferrer">open_std.org</a>. Microsoft has a quick example of a <a href="http://msdn.microsoft.com/en-us/library/bb982028.aspx" rel="nofollow noreferrer">unit test wrapper</a> that uses... | <p>It's useful when doing meta-programming. The only time I used it was in a wrapper function. If result_of<T>::type was void, the wrapper returned nothing. Otherwise it returns the whatever the wrapped function returns.</p>
| 23,542 |
<p>I am using xmlrpclib.ServerProxy to make RPC calls to a remote server. If there is not a network connection to the server it takes the default 10 seconds to return a socket.gaierror to my program. </p>
<p>This is annoying when doing development without a network connection, or if the remote server is down. Is there... | <p>An more straightforward solution is at:
<a href="http://www.devpicayune.com/entry/200609191448" rel="noreferrer">http://www.devpicayune.com/entry/200609191448</a></p>
<pre><code>import xmlrpclib
import socket
x = xmlrpclib.ServerProxy('http:1.2.3.4')
socket.setdefaulttimeout(10) #set the timeout to 10 se... | <p>The following example works with Python 2.7.4.</p>
<pre><code>import xmlrpclib
from xmlrpclib import *
import httplib
def Server(url, *args, **kwargs):
t = TimeoutTransport(kwargs.get('timeout', 20))
if 'timeout' in kwargs:
del kwargs['timeout']
kwargs['transport'] = t
server = xmlrpclib.Ser... | 48,678 |
<p>When trying to use GraphicsBuilder, I get a <code>java.lang.NoClassDefFoundError</code> for <code>groovy.swing.factory.BindProxyFactory</code>.</p>
<p>This is my environment:</p>
<pre><code>% java -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Server VM (buil... | <p>It's in the Groovy 1.6 builds, not the 1.5.7 builds. Apparently GfxBuilder 6.1 was built against the Groovy 1.6 codebase.</p>
| <p>Yes, that is correct. Groovy 1.6.x is required for GfxBuilder 6.1 and onwards.</p>
| 37,689 |
<p>So, at my current job we're usually 1-3 developers, 1-2 art directors and 1 project manager on each project, with the smallest ones just being one of each and the larger ones being three developers and two art directors.</p>
<p>I'm looking for a software, combination of softwares or some type of service that will a... | <p>Since you seem to have a maximum of six people working in a single room - I'd give serious consideration to not using software at all. </p>
<p>A whiteboard & cork board for each project, plus a whole lot of index cards / stickies can go a long, long way towards meeting the project management needs of one or two... | <p>I personally use <a href="http://www.basecamphq.com/?referrer=MITCHELSELLERS" rel="nofollow noreferrer">BaseCamp</a> for my company and have had great luck with it!</p>
<p><strong>Edit</strong> oops, I didn't notice the SVN requirement, BaseCamp can help with the other stuff.</p>
| 14,166 |
<p>I am using <code><input type="file" id="fileUpload" runat="server"></code> to upload a file in an ASP.NET application. I would like to limit the file type of the upload (example: limit to .xls or .xlsx file extensions). </p>
<p>Both JavaScript or server-side validation are OK (as long as the server side valid... | <p>Seems like you are going to have limited options since you want the check to occur before the upload. I think the best you are going to get is to use javascript to validate the extension of the file. You could build a hash of valid extensions and then look to see if the extension of the file being uploaded existed... | <p>Your only option seems to be client-side validation, because server side means the file was already uploaded. Also the MIME type is usually dictated by the file extension. </p>
<p>use a JavaScript Framework like jQuery to overload the onsubmit event of the form. Then check the extension. This will limit most at... | 9,749 |
<p>I'm trying to find the definition of a binary search tree and I keep finding different definitions everywhere. </p>
<p>Some say that for any given subtree the left child key is less than or equal to the root.</p>
<p>Some say that for any given subtree the right child key is greater than or equal to the root.</p>
... | <p>Many algorithms will specify that duplicates are excluded. For example, the example algorithms in the MIT Algorithms book usually present examples without duplicates. It is fairly trivial to implement duplicates (either as a list at the node, or in one particular direction.)</p>
<p>Most (that I've seen) specify l... | <p>The elements ordering relation <= is a <a href="http://en.wikipedia.org/wiki/Total_order" rel="nofollow">total order</a> so the relation must be reflexive but commonly a binary search tree (aka BST) is a tree without duplicates. </p>
<p>Otherwise if there are duplicates you need run twice or more the same functi... | 38,588 |
<p>I'm not sure what the correct size should be.</p>
<p>Many sites seem to repeat that the apple-touch-icon should be 57x57 pixels but cite a broken link as their source.</p>
<p><a href="http://www.hanselman.com/blog/MakeYourWebsiteMobileAndIPhoneFriendlyAddHomeScreenIPhoneIconsAndAdjustTheViewPort.aspx" rel="norefer... | <p>It seems that Apple guidelines as of August 3, 2010 now include the "High resolution" images (for iPhone 4) in their "required" icon sizes.</p>
<p>Looks like we need to provide both a 57x57 and a 114x114 image now, as well as a 640x960 title image.</p>
<p>See <a href="http://developer.apple.com/iphone/library/docu... | <p>I don't think there is a "correct size". Since the iPhone really is running OSX, the icon rendering system is pretty robust. As long as you give it a high-quality image with the right aspect ratio and a resolution at least as high as the actual output will be, the OS will downscale very cleanly. My site uses a 158x1... | 2,391 |
<p>I don't need this, obviously; I'm just curious about what's going on here. Am I missing
something simple? Can I rely on this behaviour in all versions of Perl?)</p>
<p>Perl v5.8.8:</p>
<pre><code>%h = ( 0=>'zero', 1=>'one', 2=>'two' );
while ($k = each %h) {
$v = delete $h{$k};
print "deleted $v; ... | <p>You're calling <code>each</code> in scalar context, so it's not working because of a list return value.</p>
<p>Just like</p>
<pre><code>while ($line = <FILE>)
</code></pre>
<p>is special-cased to add an implicit <code>defined</code>, so is</p>
<pre><code>while ($key = each %hash)
</code></pre>
<p>In 5.8.8... | <p>Thanks, cjm.
It was clear some kind of implicit addition of a <code>defined</code>
was going on like that for glob but not where it was
documented. Now at least I know the limited cases in which
that special handling applies.</p>
<p>But the information should be in the perlfunc documentation,
not just the Perl sou... | 27,210 |
<p>I have two tables, <strong>Book</strong> and <strong>Tag</strong>, and books are tagged using the association table <strong>BookTag</strong>. I want to create a report that contains a list of books, and for each book a list of the book's tags. Tag IDs will suffice, tag names are not necessary.</p>
<p>Example:</p>
... | <p>You can almost do it. The only problem I haven't resolved is the comma delimiter. Here is a query on a similar structure that separates the tags using a space.</p>
<pre><code>SELECT em.Code,
(SELECT et.Name + ' ' AS 'data()'
FROM tblEmployeeTag et
JOIN tblEmployeeTagAssignment eta ON et.I... | <p>Unless you know what the tag ids/names are and can hard code them into your query, I'm afraid the answer is no.</p>
| 21,026 |
<h1>Premise</h1>
<p>I believe that there is a way to objectively define "Good" and "Bad" Object-Oriented design techniques and that, as a community we can determine what these are. This is an academic exercise. If done with seriousness and resolve, I believe it can be of great benefit to the commu... | <p>Separation of Concerns</p>
<h2>Prefer Aggregation to Mixin-style Inheritance</h2>
<p>While functionality can be gained by inheriting from a utility class, in many cases it can all be gained using a member of said class.</p>
<h3>Example (Boost.Noncopyable):</h3>
<p>Boost.Noncopyable is a C++ class that lacks a co... | <p>I think the short answer is that "good" OO designs are robust under change, with the least code breakage for any requirements change. If you consider all the usual rules, they all tend to that same conclusion.</p>
<p>The difficulty is that you can't evaluate the "goodness" of the design without context; it is, I b... | 47,864 |
<p>I am using RRDtool for storing data for displaying graphs. I update the RRD by RRDs::update and this fails when trying to rewrite the information, means update data for a time in the past (e.g. someone moved the system timer back). The error I get is: </p>
<pre><code>ERROR: Cannot update /opt/dashboard/rrd/Disk/19... | <p>rrdtool does not write your input into the rrd file. It rather samples what you enter and then stores the resulting datapoints. So providing 'old data' to rrdtool update will not work in the same way, as you can not easily skip back in a sound recording to 'fix' a few bad notes.</p>
<p>Obviously there are ways to a... | <p>According to the RRD documentation, that timestamp number <strong>must</strong> increase with each update. Given your constraints, I'd modify your update routine so that if the update fails, you catch the exception and redo the update with the time field set to 'N'. That will make RRDtool use the current time as the... | 42,584 |
<p>I have classX: </p>
<p>Sub New(ByVal item_line_no As String, ByVal item_text As String)</p>
<pre><code> ' check to ensure that the parameters do not exceed the file template limits
Select Case item_line_no.Length
Case Is > m_item_line_no_capacity
Throw New ArgumentOutOfRangeException(... | <p>Ok. Just run this.</p>
<p>The message for the exception is:</p>
<blockquote>
<p><strong>Line No exceeds 4 characters</strong></p>
<p><strong>Parameter name: aaaaa</strong></p>
</blockquote>
<p>(Including the line break)</p>
<p>You need to specify this all of this as the expected message:</p>
<pre><code><ExpectedE... | <p><s>The <code>ExpectedExceptionAttribute</code> is deprecated - i.e. you shouldn't use it at all. The best reference I could quickly find about this was this post (the original article is here).</s></p>
<p>Your unit test would be a lot clearer if it was re-written:</p>
<pre><code><Test()> _
Sub testLineNoExce... | 33,653 |
<h2>The problem:</h2>
<p>We use a program written by our biggest customer to receive orders, book tranports and do other order-related stuff. We have no other chance but to use the program and the customer is very unsupportive when it comes to problems with their program. We just have to live with the program.</p>
<p... | <p>To get your grubby hands on exactly what Access is doing query-wise behind the scenes there's an undocumented feature called JETSHOWPLAN - when switched on in the registry it creates a <code>showplan.out</code> text file. The details are in
<a href="https://www.techrepublic.com/article/use-microsoft-jets-showplan-t... | <p>It is not possible without the help of the developers. Sorry.</p>
| 18,468 |
<p>This may be a very stupid question so I apologize in advance. It seems that Instruments only works for me when using the iPhone Simulator. Is there something special to getting it working when tethering the application to the iPhone? Or is that even possible? I launch the application the normal way through the Run->... | <p>My device worked with Instruments after following these steps:</p>
<ol>
<li>Unplug the iPhone.</li>
<li>In XCode, open the Organizer.</li>
<li>Delete the device.</li>
<li>Plug device in.</li>
<li>Answer yes when asked if you want to use device for development.</li>
</ol>
| <p>It works with the device, in XCode, go to the top bar, and i think it's inside "build" (don't have a mac infront of me so sorry for the vague position) in there you select "run application with performance tool" (something like that) and that will start a new Instruments' session connected to the hardware. You can't... | 49,792 |
<p>I am getting the following error when trying to install Visual Studio 2005 on my 64bit, Vista computer:</p>
<blockquote>
<p>"1305.Error reading from file
C:\Program Files (x86)\Microsoft
Visual Studio 8\Microsoft Visual
Studio 2005 Standard Edition -
ENU\SITSetup.dll"</p>
</blockquote>
<p>I have successf... | <p>I have to confess on this..especially since someone voted for the question. </p>
<p>Everything I said in my original posting about using the disks successfully in the past -was true. However, after innumerable shots at trying to get this install to work, I finally went back and looked at the DVD, and found that eit... | <p>I just installed it yesterday on my Vista box (32-bit, which may be the problem). It seemed to go through fine so I don't know what to tell you other than than when I first launched the app it notified me of "known compatibility issues" and recommended that I install both the SP1 and Vista SP! updates. No further is... | 36,837 |
<p>I wondered whether anybody knows how to obtain membership of local groups on a remote server programmatically via C#. Would this require administrator permissions? And if so is there any way to confirm the currently logged in user's membership (or not) of these groups?</p>
| <p><a href="http://www.codeproject.com/KB/system/everythingInAD.aspx" rel="nofollow noreferrer">Howto: (Almost) Everything In Active Directory via C#</a> is very helpfull and also includes instructions on how to iterate AD members in a group.</p>
<pre><code>public ArrayList Groups(string userDn, bool recursive)
{
... | <p>Perhaps this is something that can be done via WMI?</p>
| 6,732 |
<p>I am in the process of developing a web application that consists visually of a header above a body containing four columns of variable-height content. The design gods have decreed it to be fixed height, mainly because each of the columns can potentially get very long, and so (being designers) they are wanting ifram... | <p>I'm pretty sure this does exactly what you need: <a href="http://www.cssplay.co.uk/layouts/body5.html" rel="noreferrer">Liquid 4 column layout with fixed height banner and footer</a></p>
<p>No iframes, no java script, and each column automatically fills the available height.</p>
| <p>Are you talking of something like this?</p>
<pre><code><div id="head"></div>
<div id="body">
<div id="col1"></div>
<div id="col2"></div>
<div id="col3"></div>
<div id="col4"></div>
</div>
</code></pre>
<p>The CSS</p>
<pre><code>#body ... | 23,825 |
<p>I have an interface called Dictionary which has a method <code>insert()</code>. This interface is implemented by class <code>BSTree</code>, but I also have a class <code>AVLTree</code> which is a child class of <code>BSTree</code>. <code>AVLTree</code> redefines the <code>insert()</code> so it suits it's needs. Now ... | <p>When you say AVLTree "redefines" the insert, what exactly do you mean? It has to override the method, which means having exactly the same signature (modulo variance).</p>
<p>Could you post the signatures of insert() in both BSTree and AVLTree?</p>
<p>If you apply the @Override annotation in AVLTree (assuming a sui... | <p>In java, (I'm talking relatively to C++), polymorphism should "always" work. It's hard to see what's wrong without looking at the code.. maybe you could post interesting part? Such as the method's signature, class declaration, etc.. My guess is that you haven't used the same signature for both methods. </p>
| 43,730 |
<p>I would like to be able to build test applications (e.g. the nightly Minefield/Firefox) without Launch Services deciding that they're the best way to open their assigned file types.</p>
<p>Is there a way to hide my ~/src directory from Launch Services, so that Finder won't register applications in that folder?</p>
| <p>There are a number of client side controls that one can use.</p>
<p>You can </p>
<ul>
<li>Build your own ActiveX control. Windows/IE only</li>
<li>Use Flash to queue up files and upload them one at a time to the server using the stanard file upload protocol. </li>
<li>Use a signed java applet to upload.</li>
<li>W... | <p>If you running a mod_perl2 apache there is the <a href="http://search.cpan.org/~ceeshek/Apache2-UploadProgress-0.2/lib/Apache2/UploadProgress.pm" rel="nofollow noreferrer">Apache2::UploadProgress</a> module. This adds an id to the http upload request, you then query the server for the progress of that upload. Has bu... | 47,166 |
<p>Hi I have a view with several User Controls and I pass ViewData to all of them, I would like to know how you would determine the element count by specifying the string key.
I understand that you cannot use comparison to an integer because ViewData is an object but I have it setup this way for explaining my question.... | <p>If I understood your question correctly, you want to get the count out of an element stored inside the ViewData.
The only way to achieve this is by casting it to IEnumerable or IList and then call the Count method.</p>
| <p>To answer my own question this is the path I took about doing this. In my controller action method I determine the count based on number of records retrieved there and set my ViewData to null if it doesn't meet my requirements.</p>
<pre><code>public ActionResult Test(){
var test = //your query;
if(test.Count(... | 41,042 |
<p>Is there any good way to deal with the class renaming refactor from Resharper when the file is under source control and TortoiseSVN is the client. I have am trying VisualSVN right now but I haven't had the need to rename anything recently. I don't want to change our repository just to try this out.</p>
<p>Also no... | <p>TortoiseSVN 1.5 has a neat hidden feature on the check in window:</p>
<p>Select a missing file and a new file and right-click. One of the options will be "fix move".</p>
<p>I tend to refactor away, and then use this to fix any files where the name has changed.</p>
| <p>Time to branch your repository. That's the nice part about version control, you can create new branches without totaling the old ones.</p>
| 3,467 |
<p>Is it possible to create an integer (or DataTime, etc) column in ListView? It is quite important, because I would like to properly sort the list according to this column.</p>
<p>The only way to add subItems to a ListViewItem I found are:</p>
<pre><code>listviewitem.SubItems.Add("1");
</code></pre>
<p>I would like... | <p>You could use the Tag property. These little helper functions take care of it:</p>
<pre><code>private void setListItem(int row, int column, int value) {
ListViewItem.ListViewSubItem item = listView1.Items[row].SubItems[column];
item.Tag = value;
item.Text = value.ToString();
}
private int getListItem(int row... | <p>I think we have a column of type integer like what we have the columns in datagrid, actually i do not have idea about listview control. Let me know if you find the answer.</p>
| 38,379 |
<p>I'm working on a command line application for Solaris, written in Java6. I'd like to be able to scroll through a history of previous commands using the up and down arrows like many Unix tools allow (shells, VIM command mode prompt, etc).</p>
<p>Is there any standard way of achieving this, or do I have to roll my ow... | <p>Yes, use the <a href="http://tiswww.case.edu/php/chet/readline/rltop.html" rel="nofollow noreferrer">GNU readline</a> library.</p>
| <p>There is a SourceForge project, <a href="http://java-readline.sourceforge.net/" rel="nofollow noreferrer">http://java-readline.sourceforge.net/</a>, that provides JNI-based bindings to GNU readline. I've played around with it (not used in an actual project), and it certainly covers all of the functionality.</p>
| 7,148 |
<p>I have a page P1 loading from site S1 which contains an iframe. That iframe loads a page P2 from another site S2. At some point P2 would like to close the browser window, which contains P1 loaded from S1. Of course, since P2 is loaded from another site, it can't just do parent.close().</p>
<p>I have full control ov... | <p>It's impossible, I am afraid. JavaScript from an iframe that is loaded to a different site then the one it is being rendered on is strictly prohibited due to security issues.</p>
<p>However, if the iframe is pointed to the same site you can get to it like:</p>
<pre><code><iframe name = "frame1" src = "http://yo... | <p>If they originated from the same domain, you can modify the security-restrictions to allow modification between sub-domains.</p>
<p>set document.domain = "domain.com"; //on both pages and they are allowed to modify eachother.</p>
<p>It might work to just set them to a bogus-domain, haven't tried that, or just simp... | 36,398 |
<p>My automated deployment system updates a latest version of my site trough subversion. Instead of having my live site point to the trunk (which is always almost a work in progress version), I have my live site point to a tag.</p>
<p>E.g. I work on trunk and when my v1.0 is finished I create a tag called 1.0 and do a... | <p>There actually is a switch function that does just that. I use TortiseSVN which is a windows shell/gui for Subversion, so I'm not familiar with how to do it manually, but this looks like it should help:</p>
<p><a href="http://svnbook.red-bean.com/en/1.1/ch04s05.html" rel="noreferrer">http://svnbook.red-bean.com/en... | <p>I use a similar setup, except I use a live branch, rather than a tag. It's more work to commit, since I now have to merge changes from trunk into the live branch, but I can then just do an "svn up" in the webroot to update it. It also gives me slightly better control if I want to merge selected changes from differen... | 23,484 |
<p>I'm having a problem getting access to a database which lives on a remote server. </p>
<p>I have a ASP.NET 2.0 webpage that is trying to connect to a database.<br>
The database is accessed via a virtual folder (which I set up in IIS).<br>
The virtual folder points at a remote share which contains the database. <... | <p>When accessing a remote Access MDB database, you have to specify a UNC path like \\remoteMachine\Share\test.mdb.</p>
<p>Make sure your application pool identity has the right permissions to connect to the remote share. By default on IIS 6 you are working with the Network Service account, which is by default not all... | <p>make sure the two servers have internal access to each other and also specify the ip & port of db server in your connection string .</p>
| 44,112 |
<p>Server virtualization is a big thing these days, so I'm tasked at work to install some of our software on a virtualized server and see what happens. Long story short: a <code>rsync</code> transfer promptly brings the virtualized server to its knees. The virtualization host is a beefy machine with no other load; I do... | <p>I was going to put this in a comment, but I think it's more useful in the open:</p>
<p>Could you add more detail about your setup: </p>
<ul>
<li>Which VM server?<br>
(VMware Server, VMware ESX, MS VirtualServer, MS Hyper-V, something else?)</li>
<li>Which OS for the guest(s)?<br>
(Windows, Linux, 32-bit, 64-bit?)... | <p>Off hand I'd say this is I/O problem. In virtual environments on of the biggest factors that affects performance is the state of the disk of the host machine. The things that we do to optimize performance are:</p>
<ol>
<li>Fixed disk allocation. This way you get a contiguous block of drive space for the VM to li... | 14,802 |
<p>It' possible to use Junitperf with junit4?
I've a simplet Junit4 test class with several tests and I want to do a TimedTest on single test of that class. How can I do that?</p>
<p>To be more clear my Junit4 class is something like:</p>
<pre><code>public class TestCitta {
@Test
public void test1 {}
... | <p>I had the same problem but was not lucky trying to make it run in different build environments. So I used the @Rule feature available since JUnit 4 to inject performance test invocation and requirements checking using annotations. It turned out to become a small library which replaced JUnitPerf in this project and I... | <p>Or you can use the annotation: <code>@Test(timeout=1000)</code></p>
| 41,921 |
<p>Correct me if I'm wrong, but a "build" is a "compile", and not every language compiles. Continuous Integration involves building components to see if they continue to work beyond unit tests, which I might be oversimplifying. But if your project involves a language that does not compile, how do you perform nightly bu... | <p>Hmm... I'd define "building" as something like "preparing, packaging and deploying all artifacts of a software system". The compilation to machine code is only one of many steps in the build. Others might be checking out the latest version of the code from scm-system, getting external dependencies, setting configura... | <p>Create a daily tag of your current source control trunk?</p>
| 7,737 |
<p>When I pass an immutable type object(String, Integer,.. ) as final to a method I can achieve the characters of a C++ constant pointer. But how can I enforce such behavior in objects which are mutable?</p>
<pre><code>public void someMethod(someType someObject){
/*
* code that modifies the someObject's state
*
... | <p>In the general case, no, it's not possible. In a very limited case, you can wrap someType in a class that provides the same interface (see Collections.unmodifiableList() for an example).</p>
<p>However, there's no equivalent to "pass a const pointer and the compiler will only allow you to call const functions on it... | <p>No, it's not possible. You have to either pass in a copy of the object, or just rely on knowing what actions make state changes to the object and avoid calling them - the compiler won't help you.</p>
| 49,478 |
<p>I think I might be missing the point of having a logging framework for your application. In all the small apps I've always written a small "Logging" class and just pass log messages to a method in it which is written to a file. </p>
<p>What is the purpose of a 3rd party logging framework like log4net? Is it thre... | <p>That's an excellent question.</p>
<p>The first reason is "why not?" If you are using a logging framework, then you'll reap the maintainability benefits of using something already packaged.</p>
<p>The second reason is that logging is subtle. Different threads, sessions, classes and object instances may all come i... | <p>Just for an argument sake, why not a matured home grown? which doesn't come's with any extra baggage and you have complete control over it.</p>
<p>Most of the Logging frameworks has too many features which we really wont use most of them and having said that they comes with there own baggage(Its just not a class, i... | 17,446 |
<p>I know I must be missing something, but in a <code>while</code> statement how does the variable hold the data, when it finishes the first pass and goes into the second pass?</p>
<hr>
<p>{</p>
<pre><code>int num1 = 0 ;
int num2 = 0;
int num3 = 0;
while (num1 < 10)
{cout << "enter your first number: ... | <p>Is num1 the variable you're having trouble with? This line:</p>
<pre><code>cin >> num1;
</code></pre>
<p>is setting num1 to the value input by the user. So the value calculated for it in the previous run through the loop is being overwritten each time by the new input.</p>
| <p>I'm not sure I understand your question. In C any data that's not overwritten is carried over into the next iteration of the loop, and imagine that C++ works much the same way.</p>
| 5,679 |
<p>I've been digging through Stack Overflow as well as a number of Google searches, and I cannot find a satisfactory code formatter for JavaScript.</p>
<p>I have found several related tools, such as syntax highlighters and pretty-printers, but I am looking for a tool that I can ideally create a wrapper for in Eclipse a... | <p>In one breath: <a href="http://www.aptana.com/products/studio3.html" rel="nofollow noreferrer">Aptana Studio</a>! Yes, it's Java based and free (Eclipse, as standalone or plugin).</p>
<p>You can also <a href="http://www.aptana.com/docs/index.php/Customizing_your_formatting_preferences" rel="nofollow noreferrer">cus... | <p>If you are using notepad++, you can try jsminnpp plugin</p>
| 45,731 |
<p>I want to access a MySQL database directly from JavaScript code in an HTML page in Firefox.</p>
<p>Does such a library exist?</p>
<p>To be very clear, <strong>CGI+Ajax will not work</strong></p>
<p>Some background: I want to create something like a GUI front end for a MySQL database (that's not what it is, but it... | <p>JavaScript code lives inside the browser. It can make HTTP requests to the outside, but not really much more. So by design you won't be able to bind to a program running locally. If MySQL did expose an HTTP service, it might be possible, but that's not the case.</p>
<p>You might be able to find a plugin for Firefox... | <p>I can't give you complete answer, but here are the general idea how you can do it with just MySQL + Internet Explorer + JavaScript (untested):</p>
<p>In JavaScript you can call a Windows application by using</p>
<pre><code>var myshell = new ActiveXObject( "WScript.shell" );
myshell.run( program names );
</code></p... | 38,147 |
<p>If I have a URL (eg. <a href="http://www.foo.com/alink.pl?page=2" rel="noreferrer">http://www.foo.com/alink.pl?page=2</a>), I want to determine if I am being redirected to another link. I'd also like to know the final URL (eg. <a href="http://www.foo.com/other_link.pl" rel="noreferrer">http://www.foo.com/other_link... | <p>In Perl:</p>
<pre><code>use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $request = HTTP::Request->new( GET => 'http://google.com/' );
my $response = $ua->request($request);
if ( $response->is_success and $response->previous ) {
print $request->url, ' redirected to ', $response->re... | <p>I think this will work for 301 redirects.</p>
<pre><code>use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $request = HTTP::Request->new( GET => 'http://google.com/' );
my $response = $ua->request($request);
if ( $response->is_redirect ) {
print $request->url . " redirected to location "... | 31,330 |
<p>What WPF Calendar control would you recommend? I am looking for something that will let me display a variable amount of weeks potentially spanning multiple months.</p>
| <p>Microsoft has now released a WPF calendar control.</p>
<pre><code><c:Calendar>
<c:DatePicker.BlackoutDates>
<c:CalendarDateRange Start="4/1/2008" End="4/6/2008"/>
<c:CalendarDateRange Start="4/14/2008" End="4/17/2008"/>
</c:D... | <p>I would take a look at <a href="http://j832.com/BagOTricks/" rel="nofollow noreferrer">Kevin's Bag-o-tricks</a></p>
| 13,821 |
<pre><code>div#thing {
position: absolute;
top: 0px;
z-index: 2;
margin: 0 auto;
}
<div id="thing">
<p>text text text with no fixed size, variable font</p>
</div>
</code></pre>
<p>The div is at the top, but I can't center it with <code><center></code> or <code>margin: 0 auto</... | <p>Your problem may be solved if you give your <code>div</code> a fixed width, as follows:</p>
<pre><code>div#thing {
position: absolute;
top: 0px;
z-index: 2;
width:400px;
margin-left:-200px;
left:50%;
}
</code></pre>
| <p>Yes:</p>
<pre><code>div#thing { text-align:center; }
</code></pre>
| 31,503 |
<p>I have an idea for a website which involves a canvas area which has no limit to its size. Basically you would be able to add items to the canvas (notes, photos whatever really). You would then be able to drag the canvas which would move those items along with the canvas until they disappear of screen. If you dragged... | <p>I don't think this is a question that will get you an objective answer - Flash developers will tell you Flash is better, web developers will say JavaScript. Trying to remain objective, I'd say that both technologies are suitable for what you describe, but have different advantages.</p>
<p>Flash will definitely rend... | <p>Do you need to use canvas, what you're describing could be done with just javascript and the DOM. It would perform perfectly well unless there are a huge number of elements and it would be cross-browser compatible. For canvas you would require <a href="http://excanvas.sourceforge.net/" rel="nofollow noreferrer">ex... | 22,002 |
<p>I'm trying filter the child collection of an aggregate root when loading it with Nhibernate. Load a Customer with all their Orders that have been shipped. Is this possible?</p>
| <p>Well, you can expose properties that are filtered in the map, like so:</p>
<pre><code><bag name="shippedOrders" ... where="Status == 'Shipped'" >
<key column="CustomerId" />
<one-to-many class="Order" />
</bag>
</code></pre>
<p>The 'where' attribute is arbitrary SQL.</p>
<p>Theoretic... | <p>You could look at it the other way - load all the shipped orders for a Customer. </p>
<pre><code>session.CreateCriteria( typeOf(Order) )
.Add( Restrictions.Eq("Shipped", shippedStatus ) )
.Add( Restrictions.Eq("Customer", requiredCustomer) )
.List<Order>();
</code></pre>
| 30,752 |
<p>I have a few 3D printers and now want to start building a custom 3D printer.
I want to build a 3D printer with multiple nozzles, and I want to make the hotend thin so the nozzles can be closer together.
What is the thinnest nozzle avalible to buy?
Are there any guides or details on how I could make a custom nozzle o... | <p>The size of the nozzle usually isn't the main factor for how close you can put nozzles together. To keep the filament drive gear system from being the limiting factor, you would need Bowden extruders. "Then, the heat sinks and fans would be your limiting factor. Have you considered a single nozzle with three ... | <p>One of the thinnest hotends I've seen are those from a Chinese factory Mellow Store, the heatsink is smaller than the top flange to mount the hotend. I don't know the quality of these hotends, the image below shows the basic layouts of available options:</p>
<p><a href="https://i.stack.imgur.com/MsvUL.jpg" rel="nofo... | 1,702 |
<p>I'd like to use the Object Test Bench in VS2008. The docs - and even the helpful text in the test bench window - say to right click on class in the Class View. Further reading indicates that this class must be in the startup project or referenced assembly. I've tried this on numerous classes - public, private, stati... | <p>Solved it!</p>
<p>I had multiple projects set to run on startup (I've gotten so used to working that way I didn't even realize there was a difference!).</p>
<p>Setting just one startup project fixed the problem.</p>
| <p>I can only get it to work in the start up project if the project is a console or windows forms application. It doesn't seem to work with web sites.</p>
<p>BTW. I don't ever use it in practice. And after playing with awhile in the context of trying to figure out why it wasn't working for you, I now know why! Ver... | 25,299 |
<p>I'm creating a control and need to pass it the current logon user as a parameter (declaratively)</p>
<p>I tried this but didn't work (I got "<%= User.Identity.Name %>" as value):</p>
<pre><code><cc1:MyControl id="myid" runat="server" User="<%= User.Identity.Name %>" />
</code></pre>
<p>Is there a w... | <p>Why do you need to pass it at all?. The user control can access the User.Identity.Name property directly.</p>
| <p>Try using:</p>
<pre><code>User="<%= User.Identity.Name %>"
</code></pre>
<p>%= is for output</p>
<p>%# is for databinding.</p>
| 36,130 |
<p>I have two versions of rails (2.1.0 and 2.2.2) installed in my computer.</p>
<p>When I create a new application, is it possible to specify that I want to use the older (2.1.0) version?</p>
| <p>I found <a href="http://craiccomputing.blogspot.com/2008/06/using-older-versions-of-rails.html" rel="noreferrer">here</a> an undocumented option to create a new application using an older version of Rails.</p>
<pre><code>rails _2.1.0_ new myapp
</code></pre>
| <p>Please watch out which version of ruby you are using with Rails.</p>
<p>The command for making a new project for a specific version of Rail may not work for you. I had some issues about it. And the problem was the ruby version I have default which is 3.0.0. This version did not work with Rails 5. Then I installed ru... | 49,668 |
<p>I don't have too much experience with C# so if someone could point me in the right direction I would greatly appreciate it. I have a foreach loop that references a variable of an object. I wish to make another foreach loop inside the main one that compares (or performs actions on) the current variable to the rest ... | <p>Each time you execute foreach, (even while nesting them) the internal Enumerator should "new" up a new iterator for you, there should not be any issue with that. The issues come about when you are adding, or removing items from the collection while you are still iterating...</p>
<p>Remember, in the inner foreach, ... | <p>In this case, it's probably better to use a regular for loop with an index to what element you are on. Trying to iterate over the same collection withing it's own foreach loop will cause problems.</p>
| 42,966 |
<p>From what I know, the em keyword in CSS means the current size of a font.</p>
<p>So if you put 1.2 em, it means 120% of the font height.</p>
<p>It doesn't seem right though that em is used for setting the width of divs etc like YUI grids does:</p>
<pre><code>margin-right:24.0769em;*margin-right:23.62em;
</code></... | <p>Historically it is the width of an "M" in the font. Hence the name!
In CSS2.1 it is <a href="http://www.w3.org/TR/CSS21/syndata.html#em-width" rel="noreferrer">defined</a> to be the same as the font-size.</p>
<p>In many cases it seems more natural to use em rather than points or pixels, because it is relative to th... | <p>They are re-calculating exact pixel values to <code>em</code> to make them scalable.</p>
<p>See this <a href="http://riddle.pl/emcalc/" rel="nofollow noreferrer">on-line calculator</a> for example.</p>
| 17,395 |
<p>I'm pretty sure that I'm not understanding something about JPA (I'm using OpenJPA) and it's causing this problem. I want to make a copy of a Job entity.</p>
<pre><code>@Entity
@Table(name="Job")
public class Job implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int... | <p>You don't show what your implementation of the copy constructor for Job is, but if you are copying the id from one Job as the id of the copy of that Job, then attempting to save the copy job will fail because JPA will know that the instance of Job with that Id lives in another object, and it is that original object ... | <p>I'm not familiar with JPA and therefore I don't know if your JobManager is doing the wrong thing. </p>
<p>What will be really helpful is if you could provide a longer stacktrace so we can tell what led you to <code>DetachedStateManager.getMetaData()</code> and start from somewhere there.</p>
<p>yc</p>
| 40,675 |
<p>I'm using C#, .NET 3.5. I understand how to utilize events, how to declare them in my class, how to hook them from somewhere else, etc. A contrived example:</p>
<pre><code>public class MyList
{
private List<string> m_Strings = new List<string>();
public EventHandler<EventArgs> ElementAdd... | <p>I've written this up in a fair amount of detail in <a href="http://pobox.com/~skeet/csharp/events.html" rel="noreferrer">an article</a>, but here's the summary, assuming you're reasonably happy with <a href="http://msdn.microsoft.com/en-us/library/ms173171.aspx" rel="noreferrer">delegates</a> themselves:</p>
<ul>
<... | <p>Under the hood, events are just delegates with special calling conventions. (For example, you don't have to check for nullity before raising an event.)</p>
<p>In pseudocode, Event.Invoke() breaks down like this:</p>
<p>If Event Has Listeners
Call each listener synchronously on this thread in arbitrary order.</p>... | 26,262 |
<p>How can I delete the session information from my browser by using javascript? Is it possible to do?</p>
| <p>Session information is usually stored on the server. An HTTP request to a page that destroys the session would normally do the trick (using AJAX if you wish).</p>
<p>For cookies you can set the cookie expiry date to the current date, this will expire the cookie and remove it.</p>
<pre><code>var d = new Date();
doc... | <p>If you don't set an expiry date to a cookie, by definition it is only session lived. Ie. it will be deleted when the user will close his browser. Thus, no need for clean up.</p>
| 31,478 |
<p>I am forking a number of processes and I want to measure how long it takes to complete the whole task, that is when all processes forked are completed. Please advise how to make the parent process wait until all child processes are terminated? I want to make sure that I stop the timer at the right moment.</p>
<p>He... | <p>I'd move everything after the line "else //parent" down, outside the for loop. After the loop of forks, do another for loop with waitpid, then stop the clock and do the rest:</p>
<pre><code>for (int i = 0; i < pidCount; ++i) {
int status;
while (-1 == waitpid(pids[i], &status, 0));
if (!WIFEXITED... | <pre><code>for (int i = 0; i < pidCount; i++) {
while (waitpid(pids[i], NULL, 0) > 0);
}
</code></pre>
<p>It won't wait in the right order, but it will stop shortly after the last child dies.</p>
| 35,359 |
<p>For my C# RichTextBox, I want to programmatically do the same thing as clicking the up arrow at the top of a vertical scroll bar, which moves the RichTextBox display up by one line. What is the code for this? Thanks!</p>
| <p>Here's what I do:</p>
<pre><code>using System.Runtime.InteropServices;
[DllImport("user32.dll")]
static extern int SendMessage(IntPtr hWnd, uint wMsg,
UIntPtr wParam, IntPtr lParam);
</code></pre>
<p>then call:</p>
<pre><code>SendMessage(myRichTextBox.Handle, (uint)0x00B6, (UIntPt... | <p>window.scrollBy(0,20); </p>
<p>This will scroll the window. 20 is an approximate value I have used in the past that typically equals one line... but of course font size may impact how far one line really is.</p>
| 25,215 |
<p>Is that possible? I mean, can both ends of the many to many relationship point to the same table?</p>
| <p>I'm not sure how you'd do it without enormous, horrible redundancy. The standard way to handle a many-to-many relationship between two tables is via a third table that contains two primary key values, one for the first table, one for the second table, with a unique constraint (read 'index') on the combination of al... | <p>If you are using hibernate-annotations, there is a @ManyToMany, not sure about the XML equivalent. It should appear in the API documentation of your distribution</p>
| 46,267 |
<p>i am trying to produce clouds effect in my flash animation using as3</p>
<p>i am able to generate clouds through action script but the real problem is how to make them be generated at one end of the screen and travel diagonally to the other end... </p>
<p>any thoughts?</p>
| <p>This is the barebones version of what you want to do, the handleEnterFrame function will run once each frame (and for each cloud, but I'm guessing you'll prefer the simpler solution)</p>
<pre><code>package {
import flash.display.Sprite;
import flash.events.Event;
public class Cloud extends Sprite{
... | <p>Check out a package called Tweener: <a href="http://code.google.com/p/tweener/" rel="nofollow noreferrer">http://code.google.com/p/tweener/</a></p>
<p>I use Tweener for all my animation needs. You simply write a line of code like so:</p>
<p>Tweener.addTween(cloudObject, {x: targetX, time: 3.0});</p>
| 47,725 |
<p>I'm looking for something like the <code>tempfile</code> module in Python: A (preferably) secure way to open a file for writing to. This should be easy to delete when I'm done too...</p>
<p>It seems, .NET does not have the "batteries included" features of the <code>tempfile</code> module, which not only cr... | <p>I've also had the same requirement before, and I've created a small class to solve it:</p>
<pre><code>public sealed class TemporaryFile : IDisposable {
public TemporaryFile() :
this(Path.GetTempPath()) { }
public TemporaryFile(string directory) {
Create(Path.Combine(directory, Path.GetRandomFileName()... | <p>I don't know of any built in (within the framework) classes to do this, but I imagine it wouldn't be too much of an issue to roll your own..</p>
<p>Obviously it depends on the type of data you want to write to it, and the "security" required..</p>
<p><a href="http://www.developerfusion.co.uk/show/3913/" rel="nofol... | 4,048 |
<p>I've been interested in doing some work on a desktop application for while now and my most proficient language is Java. Due to wanting to be able to compile down to a native executable, does anyone have any experience they would like to share about using gcj to compile, and CNI for libraries? I was hoping to use of ... | <p>As Eclipse has been sucessfully compiled natively (see <a href="http://www.linuxjournal.com/article/7413" rel="nofollow noreferrer">http://www.linuxjournal.com/article/7413</a>) I would say it's possible.</p>
<p>I used GCJ to embed Java code into an C++ application, but I would not use it for a UI application. I wo... | <p>I haven't used gcj for compiling to a native executable but for interfacing to native libraries I've found <a href="https://github.com/twall/jna/" rel="nofollow noreferrer">JNA</a> to be a very nice way to do it as you don't have to write any native code at all to make native calls. Note that doing it this way does... | 46,238 |
<p>I need to create a 2D int array of size 800x800. But doing so creates a stack overflow (ha ha).</p>
<p>I'm new to C++, so should I do something like a vector of vectors? And just encapsulate the 2d array into a class?</p>
<p>Specifically, this array is my zbuffer in a graphics program. I need to store a z value... | <p>You need about 2.5 megs, so just using the heap should be fine. You don't need a vector unless you need to resize it. See <a href="https://isocpp.org/wiki/faq/freestore-mgmt#multidim-arrays" rel="nofollow noreferrer">C++ FAQ Lite</a> for an example of using a "2D" heap array.</p>
<pre><code>int *array = new int[8... | <p>Well, building on what Niall Ryan started, if performance is an issue, you can take this one step further by optimizing the math and encapsulating this into a class.</p>
<p>So we'll start with a bit of math. Recall that 800 can be written in powers of 2 as:</p>
<pre><code>800 = 512 + 256 + 32 = 2^5 + 2^8 + 2^9
</c... | 8,692 |
<p>I have an img tag in my webapp that uses the onload handler to resize the image:</p>
<pre><code><img onLoad="SizeImage(this);" src="foo" >
</code></pre>
<p>This works fine in Firefox 3, but fails in IE7 because the image object being passed to the <code>SizeImage()</code> function has a width and height of 0... | <p>IE7 is trying to resize the image before the DOM tree is fully rendered. You need to run it on document.onload... you'll just need to make sure your function can handle being passed a reference to the element that isn't "this."</p>
<p>Alternatively... and I hope this isn't a flameable offense... jQuery makes stuff ... | <p>You can do something like : </p>
<pre><code>var img = new Image();
img.src = '/output/preview_image.jpg' + '?' + Math.random();
img.onload = function() {
alert('pass')
}
</code></pre>
| 24,239 |
<p>I'm trying to call into a C++ library from Perl on an AIX 5.1 machine. I've created a very simple test project to try to exercise this.</p>
<p>My C++ shared library (<code>test.cpp</code>):</p>
<pre><code>#include <stdio.h>
#include <iostream>
void myfunc()
{
printf("in myfunc()\n");
std::cou... | <p>Wouldn't you just add your libstdc++ to your ld command? e.g., <code>-lstdc++</code>?</p>
<p>What I did on Linux, after replicating your problem was:</p>
<pre><code>gcc -g -lstdc++ -shared test*.o -o test.so
</code></pre>
<p>Then the problem went away.</p>
<p>(Trying to get the exact right list of libraries for... | <p>I know nothing about SWIG, but you might also want to check that it's expecting a function using cdecl (rather than pascal, fastcall, or some other calling convention). Using the wrong one between tools can lead to "bad things happening" (usually stack corruption, as far as I can tell).</p>
| 22,379 |
<p>I want to "remove" a UIView from a superview and add it again at the end... but at the "bottom" of the rest of the UIviews that belong to the superview. </p>
<p>Is this possible?</p>
<p>Any help is very appreciated!</p>
| <p>Hmmm...</p>
<pre><code>- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index;
</code></pre>
<p>Might be what you're after? Alternatively -</p>
<pre><code>- (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview;
</code></pre>
<p>Though you could avoid removing the view all together (if... | <p>I don't really understand what you mean by bottom.
You can use: <code>[view removeFromSuperview];</code> to remove it ( make sure you <code>retain</code> it ( <code>[view retain];</code> ) before you do that and <code>release</code> <code>[view release];</code> when it's no longer needed.</p>
<p>Another thing you c... | 29,531 |
<p>I'm trying to understand the concepts behind DDD, but I find it hard to understand just by reading books as they tend to discuss the topic in a rather abstract way. I would like to see some good implementations of DDD in code, preferably in C#.</p>
<p>Are there any good examples of projects practicing DDD in the op... | <p>Eric Evans and a Swedish consulting company have released a sample application based on the shipping example that Eric uses throughout the book. It's in Java, but the concepts are well documented on the project page.</p>
<p><a href="http://dddsample.sourceforge.net/" rel="nofollow noreferrer">http://dddsample.sour... | <p>I haven't used any myself, but there are some tools mentioned on the DDD Wikipedia page. Most of them seem to be implemented in Java though.</p>
<p><a href="http://en.wikipedia.org/wiki/Domain-driven_design#Software_tools_to_support_domain-driven_design" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Domain... | 18,347 |
<p>How to list physical disks in Windows?
In order to obtain a list of <code>"\\\\.\PhysicalDrive0"</code> available.</p>
| <p>#WMIC
<a href="http://www.ss64.com/nt/wmic.html" rel="nofollow noreferrer">wmic</a> is a very complete tool</p>
<pre class="lang-none prettyprint-override"><code>wmic diskdrive list
</code></pre>
<p>provide a (too much) detailed list, for instance</p>
<p>for less info</p>
<pre class="lang-none prettyprint-override">... | <p>Make a list of all letters in the US English Alphabet, skipping a & b. "CDEFGHIJKLMNOPQRSTUVWXYZ". Open each of those drives with <code>CreateFile</code> e.g. <code>CreateFile("\\.\C:")</code>. If it does not return <code>INVALID_HANDLE_VALUE</code> then you got a 'good' drive. Next take that handle and run it t... | 42,479 |
<p>When would a database design be described as overnormalized? Is this characterization an absolute one? Or is it dependent on the way it is used in the application? Thanks.</p>
| <p>In the general sense, I think that overnormalized is when you are doing so many JOINs to retrieve data that it is causing notable performance penalties and deadlocks on your database, even after you've tuned the heck out of your indexes. Obviously, for huge applications and sites like MySpace or eBay, de-normalizati... | <p>In my experience, I've never seen a normalized database that contains postal addresses, as it's usually acceptable to store the address as a string. Ideally, there would be tables for countries, counties / states, cities, districts and streets. I've not come across anyone who needs to report on street level, so it h... | 37,359 |
<p>How would retrieve all customer's birthdays for a given month in SQL? What about MySQL?
I was thinking of using the following with SQL server.</p>
<pre><code>select c.name
from cust c
where datename(m,c.birthdate) = datename(m,@suppliedDate)
order by c.name
</code></pre>
| <p>don't forget the 29th February...</p>
<pre><code>SELECT c.name
FROM cust c
WHERE (
MONTH(c.birthdate) = MONTH(@suppliedDate)
AND DAY(c.birthdate) = DAY(@suppliedDate)
) OR (
MONTH(c.birthdate) = 2 AND DAY(c.birthdate) = 29
AND MONTH(@suppliedDate) = 3 AND DAY(@suppliedDate) = 1
AND (YEAR(@suppli... | <pre><code> SELECT * FROM tbl_Employee WHERE DATEADD( Year, DATEPART( Year, GETDATE()) - DATEPART( Year, DOB), DOB) BETWEEN CONVERT( DATE, GETDATE()) AND CONVERT( DATE, GETDATE() + 30)
</code></pre>
<p>This can be use to get the upcoming Birthday by days</p>
| 13,798 |
<p>Given an Oracle table created using the following:</p>
<pre><code>CREATE TABLE Log(WhenAdded TIMESTAMP(6) WITH TIME ZONE);
</code></pre>
<p>Using the Python ODBC module from its <a href="http://www.python.org/download/windows/" rel="nofollow noreferrer">Win32 extensions</a> (from the win32all package), I tried the... | <p>I believe this is a bug in the Oracle ODBC driver. Basically, the Oracle ODBC driver does not support the <code>TIMESTAMP WITH (LOCAL) TIME ZONE</code> data types, only the <code>TIMESTAMP</code> data type. As you have discovered, one workaround is in fact to use the <code>TO_CHAR</code> method.</p>
<p>In your exam... | <p>My solution to this, that I hope can be bettered, is to use Oracle to explicitly convert the TIMESTAMP into a string:</p>
<pre><code>cursor.execute("SELECT TO_CHAR(WhenAdded, 'YYYY-MM-DD HH:MI:SSAM') FROM Log")
</code></pre>
<p>This works, but isn't portable. I'd like to use the same Python script against a SQL Se... | 5,935 |
<p>I am trying to call a webservice using ssl.
How do i get the relevant server cert so that i can import it into my truststore?
I know about the use of property com.ibm.ssl.enableSignerExchangePrompt from a main method but i would add the server cert to my truststore manually.</p>
<p>I dont want this property set in ... | <p>you can programmatically do this with Java by implementing your own X509TrustManager. </p>
<pre><code>
public class dummyTrustManager implements X509TrustManager {
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
//do nothing
}
... | <p>If you browse to the site in your web browser you can look at the security info by hitting the little padlock icon and in the dialog that pops up you can save the certificate. </p>
<p><strong>Steps for Chrome</strong></p>
<ol>
<li>Click the padlock(in the address bar)</li>
<li>Click 'Certificate Information'</li>... | 17,630 |
<p>When a Java VM crashes with an EXCEPTION_ACCESS_VIOLATION and produces an hs_err_pidXXX.log file, what does that indicate? The error itself is basically a null pointer exception. Is it always caused by a bug in the JVM, or are there other causes like malfunctioning hardware or software conflicts?</p>
<p>Edit: there... | <p>Most of the times this is a bug in the VM.
But it can be caused by any native code (e.g. JNI calls).</p>
<p>The hs_err_pidXXX.log file should contain some information about where the problem happened.</p>
<p>You can also check the "Heap" section inside the file. Many of the VM bugs are caused by the garbage collec... | <p>Are you using a Browser widget and executing javascript in the Browser widget? If so, then there are bugs in some versions of SWT that causes the JVM to crash in native code, in various Windows libraries.</p>
<p>Two examples (that I opened) are <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=217306" rel="no... | 16,942 |
<p>I am getting the following error:</p>
<blockquote>
<p>Access denied for user 'apache'@'localhost' (using password: NO)</p>
</blockquote>
<p>When using the following code:</p>
<pre><code><?php
include("../includes/connect.php");
$query = "SELECT * from story";
$result = mysql_query($query) or die(mysql_err... | <blockquote>
<p>And if it matters at all, apache@localhost is not the name of the user account that I use to get into the database. I don't have any user accounts with the name apache in them at all for that matter.</p>
</blockquote>
<p>If it is saying 'apache@localhost' the username is not getting passed correctly ... | <p>Just to check, if you use <strong>just</strong> this part you get an error?</p>
<pre><code><?php
include("../includes/connect.php");
$query = "SELECT * from story";
$result = mysql_query($query) or die(mysql_error());
</code></pre>
<p>If so, do you still get an error if you copy and paste one of those Inserts ... | 2,505 |
<p>The idea is to move all of the right elements into the left and the left into the right with an empty space in the middle. The elements can either jump over one or two pieces into an empty space. </p>
<pre><code>LLL[ ]RRR
</code></pre>
<p>I'm trying to think of a heuristic for this task. Is the heuristic meant to ... | <p>Sounds like you are a bit confused about what a heuristic is.</p>
<p>A rough definition is "a simplifying assumption" or "a decent guess"</p>
<p>For example, let's say you have to put together a basketball team, and you have fact sheets on people who want to play that list their contact info, birth date, and heigh... | <p>A heuristic is generally a "hint" which usually (but not always) will guide your procedure to the correct direction. Using heuristics speeds up your procedures (your algorithms), again, <strong>usually</strong>, but not always. It's like an "advice" to the algorithm which is correct more often than not.</p>
<p>I'm ... | 36,727 |
<p>From the <em>Immediate Window</em> in Visual Studio: </p>
<pre><code>> Path.Combine(@"C:\x", "y")
"C:\\x\\y"
> Path.Combine(@"C:\x", @"\y")
"\\y"
</code></pre>
<p>It seems that they should both be the same. </p>
<p>The old FileSystemObject.BuildPath() didn't work this way...</p>
| <p>This is kind of a philosophical question (which perhaps only Microsoft can truly answer), since it's doing exactly what the documentation says.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx" rel="noreferrer">System.IO.Path.Combine</a></p>
<p>"If path2 contains an absolute path... | <p>This \ means "the root directory of the current drive". In your example it means the "test" folder in the current drive's root directory. So, this can be equal to "c:\test".</p>
| 7,652 |
<p>As everyone knows, the <a href="http://en.wikipedia.org/wiki/Visual_C%2B%2B" rel="nofollow noreferrer">Visual C++</a> runtime marks uninitialized or just freed memory blocks with special non-zero markers. Is there any way to disable this behavior entirely without manually setting all uninitialized memory to zeros? I... | <p>When you create a pointer, explicity initialize it to <code>NULL</code>. Likewise after a <code>delete</code>. Depending on the value of uninitialized data (except in a few specific cases) is asking for trouble.</p>
<p>You can save yourself a lot of headaches by using a smart pointer class (such as <a href="http://... | <p>I'm pretty sure you can't disable the visual studio default here, and even if you did, the value would then be just whatever was in memory before the memory was allocated.</p>
<p>Your best off just getting in the habit of setting them to 0 in the first place, it's only 2 extra charecters.</p>
<pre><code>int *ptr=0... | 9,143 |
<p>Example C API signature:</p>
<p><code>void Func(unsigned char* bytes);</code></p>
<p>In C, when I want to pass a pointer to an array, I can do:</p>
<pre><code>unsigned char* bytes = new unsigned char[1000];
Func(bytes); // call
</code></pre>
<p>How do I translate the above API to P/Invoke such that I can pass a ... | <p>The easiest way to pass an array of bytes is to declare the parameter in your import statement as a byte array. </p>
<pre><code>[DllImport EntryPoint="func" CharSet=CharSet.Auto, SetLastError=true]
public extern static void Func(byte[]);
byte[] ar = new byte[1000];
Func(ar);
</code></pre>
<p>You should also be a... | <p>Here is the appropriate signature for the native function.</p>
<pre><code>[System.Runtime.InteropServices.DllImportAttribute("<Unknown>", EntryPoint="Func")]
public static extern void Func(System.IntPtr bytes) ;
</code></pre>
| 36,800 |
<p>I understand that some countries have laws regarding website accessibility. In general, what are the minimum requirements that a website must meet to be accessible, regardless of country? Or, in lieu of minimum requirements, what are some specific things that websites should have to make the accessible?</p>
| <p>W3C publishes Web Content Accessibility Guidelines:</p>
<p><a href="http://www.w3.org/TR/WAI-WEBCONTENT/" rel="nofollow noreferrer">http://www.w3.org/TR/WAI-WEBCONTENT/</a></p>
<p>If you want a quick summary list, look for the yellow-highlighted lines in that document. Each guideline is also broken down into speci... | <p>It's not a binary question, and there's no silver bullet. Making sure you follow at least the basics of WCAG and testing in a couple of screen readers and without the mouse will probably be the most effective use of your time. If at all possible, test with real people with real disabilities, they have a perspectiv... | 10,116 |
<p>Some WPF controls (like the <code>Button</code>) seem to happily consume all the available space in its' container if you don't specify the height it is to have.</p>
<p>And some, like the ones I need to use right now, the (multiline) <code>TextBox</code> and the <code>ListBox</code> seem more worried about just tak... | <p>There are also some properties you can set to force a control to fill its available space when it would otherwise not do so. For example, you can say:</p>
<pre><code>HorizontalContentAlignment="Stretch"
</code></pre>
<p>... to force the contents of a control to stretch horizontally. Or you can say:</p>
<pre><code... | <p>Use the <strong>HorizontalAlignment</strong> and <strong>VerticalAlignment</strong> layout properties. They control how an element uses the space it has inside its parent when more room is available than it required by the element.</p>
<p>The width of a StackPanel, for example, will be as wide as the widest element... | 5,677 |
<p>I have a site that I've developed that makes decent use of Javascript, and minimal use of AJAX for a few things. The site worked fine on the iPhone until I added the <a href="http://www.w3schools.com/Ajax/ajax_server.asp" rel="nofollow noreferrer">function to create an HttpRequest handle</a> at which point all Javas... | <p>Of course the iPhone supports ajax, check out <a href="http://developer.apple.com/webapps/" rel="noreferrer">http://developer.apple.com/webapps/</a> for a BUNCH of resources for developing iPhone webapps. I would recommend using a framework (such as <a href="http://www.jquery.com/" rel="noreferrer">jQuery</a>, or <a... | <p>Aax works perfectly on the iPhone, even our most advanced stuff like the <a href="http://ra-ajax.org/samples/Viewport-Calendar-Starter-Kit.aspx" rel="nofollow noreferrer">Ajax Calendar Starter-Kit</a> works flawlessly on at least my iPhone (3G)</p>
| 32,534 |
<p>In Google groups and some other web sites, there is a 5-star rating component which is pretty neat, such as in this url:
<a href="http://groups.google.com/group/Google-Picasa-Data-API/browse_thread/thread/b5a346e6429a70a7?hl=en" rel="noreferrer">http://groups.google.com/group/Google-Picasa-Data-API/browse_thread/thr... | <p>UIView that allows you to build Rating components to provide the same kind of experience AppStore or Youtube applications on iPhone do.</p>
<p><a href="http://code.google.com/p/s7ratingview/" rel="nofollow noreferrer">http://code.google.com/p/s7ratingview/</a></p>
| <p>You can give <a href="https://github.com/dyang/DYRateView" rel="nofollow noreferrer">DYRateView</a> a try.</p>
<p>There is a tutorial on my blog on how to use DYRateView in your project: <a href="http://iappexperience.com/post/23227218867/dyrateview-a-simple-yet-powerful-rating-control-for" rel="nofollow noreferrer"... | 37,276 |
<p>In my web application I have a file which hold the current revision number via $Rev$. This work fine except, if I don't make any changes to that file, it doesn't get committed.</p>
<p><strong>Is there anyway I can force a single file to always get committed to the SVN server?</strong></p>
<p><em>I'm using Tortoise... | <p>Basically, you want the output of the <code>svnversion</code> command in a file.</p>
<p>Such files are usually kept out of the repository, and automatically created by a build script. I suggest you do the same. If you don't build, but just to a <code>svn up</code> on the server side, just call <code>svnversion</cod... | <p>Depending on your client, some of them offer a pre-commit hook that you can implement something that simply "touches" the file and flags it as changed. If your using something like Visual Studio you could create a post build task that would "touch" the file but you would have to make sure that you do a build before ... | 2,781 |
<p>In SQL server 2005 this query</p>
<pre><code>select len(cast('the quick brown fox jumped over the lazy dog' as varchar))
</code></pre>
<p>returns 30 as length while the supplied string has more characters. This seems to be the default. Why 30, and not 32 or any other power of 2?</p>
<p><strong>[EDIT]</strong> I a... | <p>Why don't you specify the varchar length? ie:</p>
<pre><code>SELECT CAST('the quick brown fox jumped over the lazy dog' AS VARCHAR(45))
</code></pre>
<p>As far as why 30, that's the default length in SQL Server for that type.</p>
<p>From <a href="http://msdn.microsoft.com/en-us/library/ms176089.aspx" rel="norefer... | <p>Default size with convert/cast has nothing to do with the memory allocation and hence the default value (ie 30) is not related to any power of 2.</p>
<p>regarding why 30, this is microsoft's guideline which gives this default value so as to cover the basic data in first 30 characters.
<a href="http://msdn.microsoft... | 46,853 |
<p>Because of the more tedious way of adding hosts to be monitored in Nagios (it requires defining a host object, as opposed to the previous program which only required the IP and hostname), I figured it'd be best to automate this, and it'd be a great time to learn Perl, because all I know at the moment is C/C++ and Ja... | <p>The one-liner is great, if you're not writing more Perl to handle the result.</p>
<p>More generally though, in the context of a larger Perl program, you would either write a custom regular expression, for example:</p>
<pre><code>if($line =~ m/(\S+)\s+(\S+)/) {
$ip = $1;
$hostname = $2;
}
</code></pre>
<... | <p>Since ray asked, I thought I'd rewrite my whole program without using Perl's implicitness (except the use of <code><ARGV></code>; that's hard to write out by hand). This will probably make Python people happier (braces notwithstanding :-P):</p>
<pre><code>while (my $line = <ARGV>) {
chop $line;
... | 18,876 |
<p>Here's the problem:</p>
<pre><code>split=re.compile('\\W*')
</code></pre>
<p>This regular expression works fine when dealing with regular words, but there are occasions where I need the expression to include words like <code>k&amp;auml;ytt&amp;auml;j&aml;auml;</code>.</p>
<p>What should I add to the r... | <p>You probably want to take the problem reverse, i.e. finding all the character without the spaces:</p>
<pre><code>[^ \t\n]*
</code></pre>
<p>Or you want to add the extra characters:</p>
<pre><code>[a-zA-Z0-9&;]*
</code></pre>
<p>In case you want to match HTML entities, you should try something like:</p>
<pre... | <p>Looks like this RegEx did the trick:</p>
<pre><code>split=re.compile('(\\\W+&\\\W+;)*')
</code></pre>
<p>Thanks for the suggestions. Most of them worked fine on Reggy, but I don't quite understand why they failed with <code>re.compile</code>.</p>
| 18,360 |
<p>In certain cases, I can't seem to get components to receive events.</p>
<p>[edit] </p>
<p>To clarify, the example code is just for demonstration sake, what I was really asking was if there was a central location that a listener could be added, to which one can reliably dispatch events to and from arbitrary objects... | <p>Above is correct.
You are dispatching the event from btnMenu, but you are not listening for events on btnMenu - you are listening for events on the Application.</p>
<p>Either dispatch from Application:</p>
<pre><code>dispatchEvent(new Event("stepchild", true));
</code></pre>
<p>or listen on the btnMenu</p>
<pre>... | <p>You are attaching the listener to <code>this</code> when the event is getting dispatched from <code>btnMenu</code>.</p>
<p>This should work:</p>
<pre>
dispatchEvent(new Event("stepchild", true));
</pre>
<p>ps. There is really no reason to put an unnecessary '<code>this</code>' everywhere, unless it's explicitly r... | 15,875 |
<p>On my journey into the depths of custom ASP.NET control development I am obviously getting my head around the ASP.NET PostBack model and how it affects control development.</p>
<p>I understand that controls have no "lifetime" in ASP.NET, and therefore must be re-initialized on each and every page load. We overcome ... | <p>Well, Session State is a server-side solution, with its own pile of cruft to deal with if you want to avoid ViewState altogether. Really though, using ViewState in a custom control is all fine and good - just be picky about what you store - only store deltas from the declared control state, don't store anything you... | <p>I think you still mis-understand controls somewhat. Controls only have the problem you describe when you add them to the page dynamically. If you declare your controls upfront in the aspx code then they build along with the page.</p>
| 10,147 |
<p>I would like to parse a document using SAX, and create a subdocument from some of the elements, while processing others purely with SAX. So, given this document:</p>
<pre><code> <DOC>
<small>
<element />
</small>
<entries>
<!-- thousands here -->
<... | <p>One approach is to create a <code>ContentHandler</code> that watches for events that signal the entry or exit from a <code><small></code> element. This handler acts as a proxy, and in "normal" mode passes the SAX events straight through to the "real" <code>ContentHandler</code>. </p>
<p>However, when entry in... | <p>I've had no problem building multiple simultaneous documents out of one SAX stream. It's pretty much SOP for any business-document-oriented stream. What difficulty are you having with doing that? The hierarchy of your classes needn't match the hierarchy of the SAX stream.</p>
| 47,441 |
<p>I am having a postgres production database in production (which contains a lot of Data). now I need to modify the model of the tg-app to add couple of new tables to the database. </p>
<p>How do i do this? I am using sqlAlchemy.</p>
| <p>This always works and requires little thinking -- only patience.</p>
<ol>
<li><p>Make a backup.</p></li>
<li><p>Actually make a backup. Everyone skips step 1 thinking that they have a backup, but they can never find it or work with it. Don't trust any backup that you can't recover from.</p></li>
<li><p>Create a n... | <p>If you are just adding tables, and not modifying any of the tables which have the existing data in it, you can simply add the new sqlAlchemy table definitions to model.py, and run:</p>
<pre><code>tg-admin sql create
</code></pre>
<p>This will not overwrite any of your existing tables.</p>
<p>For schema migration,... | 38,701 |
<p>I have a string which contain tags in the form <code>< tag ></code>. Is there an easy way for me to programmatically replace instances of these tags with special ascii characters? e.g. replace a tag like <code>"< tab >"</code> with the ascii equivelent of <code>'/t'</code>?</p>
| <pre><code>string s = "...<tab>...";
s = s.Replace("<tab>", "\t");
</code></pre>
| <p>Regex patterns should do the trick.</p>
| 11,998 |
<p>I'd like to be able to open a TDataSet asynchronously in its own thread so that the main VCL thread can continue until that's done, and then have the main VCL thread read from that TDataSet afterwards. I've done some experimenting and have gotten into some very weird situations, so I'm wondering if anyone has done t... | <p>Provided you only want to use the dataset in its own thread, you can just use synchronize to communicate with the main thread for any VCL/UI update, like with any other component.<br>
Or, better, you can implement communication between the mainthread and worker threads with your own messaging system. </p>
<p>check... | <p>Most TDatasets are not thread safe. One that I know is thread safe is <a href="http://www.components4programmers.com/products/kbmmemtable/index.htm" rel="nofollow noreferrer" title="kbmMemtable">kbmMemtable</a>. It also has the ability to clone a dataset so that the problem of moving the record pointer (as explain... | 10,393 |
<p>I want to make my Python library working with MySQLdb be able to detect deadlocks and try again. I believe I've coded a good solution, and now I want to test it.</p>
<p>Any ideas for the simplest queries I could run using MySQLdb to create a deadlock condition would be?</p>
<p>system info:</p>
<ul>
<li>MySQL 5.0... | <p>Here's some pseudocode for how i do it in PHP:</p>
<p>Script 1:</p>
<pre><code>START TRANSACTION;
INSERT INTO table <anything you want>;
SLEEP(5);
UPDATE table SET field = 'foo';
COMMIT;
</code></pre>
<p>Script 2:</p>
<pre><code>START TRANSACTION;
UPDATE table SET field = 'foo';
SLEEP(5);
INSERT INTO table... | <p>you can always run LOCK TABLE tablename from another session (mysql CLI for instance). That might do the trick.</p>
<p>It will remain locked until you release it or disconnect the session.</p>
| 33,882 |
<ol>
<li>Is there a way to do this with SQL Server tools?</li>
<li>If not, is there a 3rd party tool that does this?</li>
</ol>
<p>There doesn't seem to be a good way to edit longer text columns in the SQL Server Managers for SQL Server 2000 or 2005. While SQL Server Manager is really not for editing data in your db,... | <p>Generally, SQL Management Studio is an administrative tool for your database and not meant for data entry other than a quick edit here or there. Generally you would script the data or it would be entered by an application that uses the database for persistence.</p>
<p>(Although I have pointed Access to my SQL Serve... | <p>In the Management Console, isn't it possible to do an "Open Table" context-menu action and then edit the data from there?</p>
| 33,015 |
<p>We have a C++ library that we provide to several different clients. Recently we made the switch from using raw pointers in the public interface to using boost::sharedptr instead. This has provided an enormous benefit, as you might guess, in that now the clients no longer have to worry about who needs to delete what ... | <p>shared_ptr<> <em>is</em> part of the language, as of the release of TR1.
See: <a href="http://msdn.microsoft.com/en-us/library/bb982729.aspx" rel="nofollow noreferrer">(TR1)</a></p>
| <p>introducing boost::shared_ptr forces your client to use boost. to some people, this is a minor issue.</p>
<p>it also forces your clients to use the same compiler as used by your lib, if your lib is distributed as compiled binary. or, if your library is distributed in source code, the clients have to stick to their ... | 43,489 |
<p>Here on Stack Overflow, you're a "user." On <a href="http://43things.com/" rel="nofollow noreferrer">43things.com</a> you're a "person." On other sites, you're an "account." And then some web apps skip the usage of this kind of signifier, and it's just <a href="http://webapp.com/yourusername" rel="nofollow noreferre... | <p><strong>Person</strong> implies that there is a 1:1 correspondence with a real human being. <strong>Account</strong> doesn't necessarily imply this (e.g. service accounts), and neither does <strong>User</strong>, strictly speaking. For example, here on SO there is a "Community" user who is obviously not a real per... | <p>"Account" implies there could be several users for it. Using just / is appropriate if the user is the central part of your application, i. e. a social network like facebook. I'd use "user" for real users, people that can actually login etc. and "person" if you're just managing people, like a search engine for people... | 16,876 |
<ul>
<li>I make a user control and then want to include it on a page</li>
<li><p>I have to always manually type the @Register line at the top of my .aspx file, e.g.</p>
<p><%@ Register TagPrefix="edward" TagName="GetQuote" src="~/Controls/GetQuote.ascx" %>
<br/></p></li>
<li>Is there any way to automatically creat... | <p>I don't get this issue - are you dragging to the aspx in source or design mode?</p>
<p>Dragging in Design mode creates the Register line for me.</p>
| <p>try adding your control to the toolbox (via Tools > Choose Toolbox Items) and then dragging it onto your page from the toolbox? (your controls would need to be in a separate dll)</p>
| 41,434 |
<p>I am familiar with C++ RTTI, and find the concept interesting.</p>
<p>Still there exist a lot of more ways to abuse it than to use it correctly (the RTTI-switch dread comes to mind). As a developer, I found (and used) only two viable uses for it (more exactly, one and a half).</p>
<p><strong>Could you share some o... | <p><a href="http://www.objectmentor.com/resources/articles/acv.pdf" rel="nofollow noreferrer">Acyclic Visitor</a> (pdf) is a great use of it.</p>
| <p>I used RTTI when doing some canvas-based work with Qt several years ago. It was darn convenient when doing hit-tests on objects to employ RTTI to determine what I was going to do with the shape I'd 'hit'. But I haven't used it otherwise in production code.</p>
| 29,490 |
<p>I have a Visual Studio (2008) solution consisting of several projects, not all in the same namespace. When I build the solution, all the DLL files used by the top level project, <strong>TopProject</strong>, are copied into the <em>TopProject\bin\debug</em> folder. However, the corresponding .pdb files are only copie... | <p>From <a href="http://msdn.microsoft.com/en-us/library/yd4f8bd1(VS.71).aspx" rel="nofollow noreferrer">MSDN</a>:</p>
<blockquote>
<p>A program database (PDB) file holds
debugging and project state
information that allows incremental
linking of a Debug configuration of
your program. A PDB file is created
... | <p>First off, never assume anything. Clean the solution, rebuild it in debug mode, and check to see if all PDB files are created. If not, that's your problem.</p>
<p>If they are created, and they're not all getting copied, you can get around this by creating a post build event that manually copies the PDB files to th... | 16,087 |
<p>Is there a <a href="http://en.wikipedia.org/wiki/REPL" rel="noreferrer">REPL</a> (Read-Eval-Print Loop) available anywhere for Actionscript 3? I could not find anything on google, but it would really come in handy.</p>
| <p><a href="http://eval.hurlant.com/demo/" rel="noreferrer">Google harder</a>. ;)</p>
| <p>actionscript3 is a compiled language so is this even possible?</p>
| 41,180 |
<p>Acetone can be used to smooth ABS prints. What safety precautions should be taken during its use?</p>
| <p>There are a few main safety precautions you should consider.</p>
<ul>
<li><strong><a href="http://sinkhacks.com/building-acetone-vapor-bath-smoothing-3d-printed-parts/" rel="nofollow">Make sure the area is well-ventilated.</a></strong> Acetone is flammable. A buildup of acetone gas could quickly get concentrated, m... | <p>You can smooth a print with acetone using different approaches which require different precautions. In general, you should have ventilated area and use gloves (or wash your hands after the procedure). </p>
<h2>Applying Acetone Directly</h2>
<p>Using the print in acetone for several seconds or you can apply acetone... | 105 |
<p>Might it make <strong><em>more</em></strong> sense to put 64-bit applications into "Program Files (x64)" and leave 32-bit applications to run in "Program Files"?</p>
<p>I have a batch file that need to run a <a href="http://en.wikipedia.org/wiki/Adobe_Flex" rel="nofollow noreferrer">Flex</a> compiler. In x64, that ... | <p>That's nothing. Guess what <em>\Windows\System32</em> contains? That's right, 64-bit DLL files. So where did they decide to put 32-bit legacy DLL files? <em>\Windows\SysWOW64</em> of course.</p>
<p>The problem is, while there are built-in facilities for Windows applications to discover the location of system direct... | <p>Because Microsoft loves making things more complex for people. Rather than simplifying the transition to 64-bit, they made it divided and difficult.</p>
| 37,442 |
<p>I am looking to start writing apps for my Windows Mobile 6.1 professional device (Sprint Mogul/HTC Titan).</p>
<p>I use the copy of Visual Studio 2003 that I bought in college for all of my current contracting work, (all of my day job work is done on a company laptop). From what I can tell from MSDN in order to de... | <p>Even if you had Visual Studio 2005 you would be limited to the 2.0 Framework. You will need to use Visual Studio 2008 Professional or better to use the 3.5 Framework. But you also have an alternative. </p>
<p>I wrote an article on Windows Mobile Development without Visual Studio. The minimum you need is the .Net ... | <p>Can't you use Visual Studio Express Editions for Mobile Development</p>
<p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=94DE806B-E1A1-4282-ABC5-1F7347782553&displaylang=en" rel="nofollow noreferrer">http://www.microsoft.com/downloads/details.aspx?FamilyID=94DE806B-E1A1-4282-ABC5-1F734778255... | 5,314 |
<p>I have a simple html page with a div. I am using jQuery to load the contents of an aspx app into the "content" div. Code looks like this:</p>
<pre><code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<s... | <p>I have code doing this, it might be more verbose than is needed, but nested js files shouldn't be a problem.</p>
<pre><code>jQuery.get('default.aspx', null, function(data) {
$('#default').append(data);
}, 'html');
</code></pre>
| <p>Seems like a common problem: <a href="http://andreineculau.wordpress.com/2006/09/29/ajax-ondemand-javascript-or-dynamic-script-tags/" rel="nofollow noreferrer">http://andreineculau.wordpress.com/2006/09/29/ajax-ondemand-javascript-or-dynamic-script-tags/</a></p>
<p>I'm guessing it's security built into browsers to ... | 38,926 |
<p>What would be the most effective way to grab the schema + table name in this scenario:</p>
<p>SELECT [t0].[Id], [t0].[CODE] AS [arg0], [t0].[DESC] AS [arg1]
FROM [SchemaName].[TableName] AS [t0]
WHERE ([t0].[Id] <> @p0)</p>
<p>The outcome needs to be: "SchemaName.TableName" ....</p>
<p>I'm using C#.</p>
<p>Th... | <p>I believe you should be able to do this (make sure to declare the local namespace):</p>
<pre><code><Window.Resources>
<local:MyDataStructure x:Key="mds1" />
</Window.Resources>
<ListBox ItemsSource="{Binding Data}" SelectedValue="{Binding Source={StaticResource mds1} Path=ChosenItem}"/&... | <p>Make this two properties inside a single class(Just to simplify the solution) and make the code ready for property changed events</p>
<pre><code> public class MyDataList : INotifyPropertyChanged
{
private Guid _choosen;
public ObservableCollection<Guid> Data { get; set; }
public Guid ChosenItem ... | 46,254 |
<p>I have a pretty complicated Linq query that I can't seem to get into a LinqDataSsource for use in a GridView:</p>
<pre><code>IEnumerable<ticket> tikPart = (
from p in db.comments where
p.submitter == me.id &&
p.ticket.closed == DateTime.Parse("1/1/2001") &&
p.tic... | <pre><code>gridview.DataSource = tikPart.ToList();
gridview.DataBind();
</code></pre>
| <p>You can bind IQueryable<> type to GridView using LinqDataSource control. <a href="http://johnsobrepena.blogspot.com/2010/01/data-bind-coolgridview-to-iqueryable.html" rel="nofollow noreferrer">http://johnsobrepena.blogspot.com/2010/01/data-bind-coolgridview-to-iqueryable.html</a></p>
| 17,297 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.